prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
_job(bool force_refresh) {
// Part of work-around for CC2564 bug (see comment with prv_work_around_should_not_cycle).
// When forced, we've just connected or disconnected, in that case cycle as well, because
// otherwise we'll continue to advertise non-connectable if we've just disconnected and there
// was al... | {
return NULL;
} |
// Minimum interval is 32 slots (20ms), or 160 slots (100ms) when there is a
// scan response:
const uint16_t min_threshold = payload->scan_resp_data_length ? 160 : 32;
for (int i = 0; i < num_terms; i++) {
// Loop-around term:
const bool is_loop_around = (terms[i].duration_secs == GAPLE_ADVERTISING_D... |
GColorBlack, false);
graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10));
ASSERT_CALLED(graphics_line_draw_stroked_non_aa(&context, GPoint(5, 5), GPoint(45, 10), SW_EVEN));
setup_test(&context, false, SW_EVEN, GColorBlack, GColorBlack, false);
graphics_draw_rect(&context, &GRect(10, 20, 40, 10));
ASS... | (&context, GPoint(50, 50), 10) | |
ntrol message which was sent
static LinkControlType s_type;
//! Number of consecutive bad status message responses received from the smartstrap
static int s_strikes;
static void prv_do_send(LinkControlType type) {
FrameHeader header = (FrameHeader) {
.version = LINK_CONTROL_VERSION,
.type = type
};
s_ty... | (BAUDS[requested_baud]) | ;
prv_do_send(LinkControlTypeStatus);
}
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Invalid response type (%d)", header->type);
smartstrap_link_control_disconnect();
success = false;
}
return success;
}
void smartstrap_link_control_connect(void) {
prv_do_send(LinkControlTypeProfiles);
accessory_... |
(averages, &state->cache->step_averages, sizeof(*averages)) | ;
return true;
}
// Fetch the intraday averages, if available
if (state->cache && (metric == HealthMetricStepCount)) {
// Fill the cache if this is step count
sys_activity_get_step_averages(day_in_week, &state->cache->step_averages);
state->cache->step_averages_day = day_in_week;
state->cache... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
PBL_ASSERTN(!s_handler);
s_raw_handler = handler;
s_samples_per_update = samples_per_update;
} |
void accel_data_service_unsubscribe(void) {
s_handler = NULL;
s_raw_handler = NULL;
}
int accel_service_set_sampling_rate(AccelSamplingRate rate) {
return 0;
}
void fake_accel_service_invoke_callbacks(AccelData *data, uint32_t num_samples) {
if (s_handler) {
s_handler(data, num_samples);
}
if (s_r... |
_smart_dnd_enabled() == false);
do_not_disturb_toggle_smart_dnd();
cl_assert(do_not_disturb_is_smart_dnd_enabled() == true);
active = do_not_disturb_is_active();
cl_assert(active == false);
s_event_ongoing = true;
// Manual && !Scheduled && Smart
do_not_disturb_set_manually_enabled(true);
do_not_distur... | do_not_disturb_is_manually_enabled() | |
bi"));
}
#define RADIUS_BIG 15
#define RADIUS_MEDIUM 8
#define RADIUS_MIN_CALCULATED 3
#define RADIUS_MAX_PRECOMPUTED 2
#define RADIUS_SMALL 1
#define RADIUS_NONE 0
#define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168)
#define ORIGIN_RECT_CLIP_XY GRect(0, 0, 30, 40)
#define ORIGIN_RECT_CLIP_NXNY GRect(... | GRect(10, 15, 28, 28) | );
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_inside_offset_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_x_layer_update_callback);
layer... |
{ 1904, 424, 192},
{ 2016, 288, 104},
{ 1752, 136, 64},
{ 1608, 40, 112},
// 27 seconds
{ 1424, -24, 32},
{ 1240, -8, -72},
{ 1000, 0, -88},
{ 848, -176, 48},
{ 832, -248, 40},
{ 544, -128, -72},
{ 648, -32, -144},
{ 1008, -32, -8},
{ 1504, 280, -248},
{ 1896,... | { 1080, 24, -56},
{ 888, 40, -40},
{ 928, -24, 48},
{ 1008, -48, 16},
{ 664, -48, -64},
{ 904, 0, -160},
{ 1024, -32, -56},
{ 1240, 64, 0},
{ 1472, 144, -120},
{ 1592, 208, -232},
{ 1288, 248, -112},
{ 912, 168, -88},
// 33 seconds
{ 856, 112, 16},
{ 1048, 152... |
{ 1280, 176, 48},
{ 1072, 264, 80},
{ 1296, 336, 184},
{ 1096, 472, 480},
{ 952, 976, 248},
{ 1096, 544, 0},
{ 904, 304, 8},
{ 1232, 400, 152},
{ 1640, 520, 200},
{ 1648, 344, 88},
{ 1408, 144, 184},
{ 1368, -16, 288},
{ 1288, -64, 88},
{ 1168, 8, -8},
{ 1016... |
SmartstrapAttributeId) == sizeof(uint16_t),
"SmartstrapAttributeId MUST be two bytes in length!");
typedef struct {
ListNode list_node;
//! The ServiceId for this attribute
uint16_t service_id;
//! The AttributeId for this attribute
uint16_t attribute_id;
//! MBuf used for sending / receivin... | prv_set_attribute_state(attr, SmartstrapAttributeStateRequestPending) | ;
return true;
}
return false;
}
//! Note; This should only be called from the consumer task
static void prv_cancel_transaction(SmartstrapAttributeInternal *attr) {
PBL_ASSERT_TASK(CONSUMER_TASK);
if (attr->state == SmartstrapAttributeStateWritePending) {
prv_set_attribute_state(attr, SmartstrapAttribu... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | dialog_set_icon((Dialog *) s_alarm_popup_data->alarm_popup,
RESOURCE_ID_ALARM_CLOCK_LARGE_STATIC) | ;
}
}
static void prv_stop_vibes(void) {
if (s_alarm_popup_data->vibe_timer != TIMER_INVALID_ID) {
new_timer_stop(s_alarm_popup_data->vibe_timer);
new_timer_delete(s_alarm_popup_data->vibe_timer);
s_alarm_popup_data->vibe_timer = TIMER_INVALID_ID;
#if CAPABILITY_HAS_VIBE_SCORES
if (s_alarm_popup_da... |
h;
static void prv_handshake_int_exti_cb(bool *should_context_switch) {
// Ignore Int -- not needed during initial handshaking
*should_context_switch = false;
}
static bool prv_handshake(void) {
uint8_t buffer[sizeof(core_dump_connect_response)];
PBL_LOG(LOG_LEVEL_ERROR, "BLE Hang/Crash ... attempt to conn... | prv_spi_transaction(&cmd, s_rx_buffer, region_buf_size) | ) {
PBL_LOG(LOG_LEVEL_ERROR, "Unable to get Region Table");
goto spi_failed;
}
memcpy(region_buf, s_rx_buffer, region_buf_size);
// Dump the memory region table
for (int index = 0; index < MemoryRegionTagCount; ++index) {
PBL_LOG(LOG_LEVEL_ERROR, "Memory Region %d: %p - 0x%lx", index, region_buf[in... |
GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_aa_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, 3, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_bottom.${BIT_DEPTH_NAME}.pbi")) | |
s, health_sessions,
HealthIterationDirectionFuture);
cl_assert_equal_i(health_session_entries, exp_num_sessions);
for (int i = 0; i < exp_num_sessions; i++) {
cl_assert_equal_i(sessions[i].type, health_sessions[i].type);
cl_assert_equal_i(sessions[i].start_utc, hea... | activity_get_metric(ActivityMetricRestingKCalories, 1, &min_resting_kcalories) | |
pts from the accel
bma255_write_register(BMA255Register_INT_EN_0, 0);
prv_disable_operating_mode(AccelOperatingMode_ShakeDetection);
}
void accel_enable_shake_detection(bool enable) {
if (s_shake_detection_enabled == enable) {
// the requested change matches what we already have!
return;
}
PBL_LOG(L... | prv_selftest_axis(BMA255Axis_X) | |
I160_CMD_SOFTRESET);
psleep(50);
bmi160_enable_spi_mode();
return pass;
}
bool gyro_run_selftest(void) {
prv_update_accel_interrupts(false);
prv_run_command(BMI160_CMD_SOFTRESET);
psleep(50);
bmi160_enable_spi_mode();
bmi160_set_gyro_power_mode(BMI160_Gyro_Mode_Normal);
// Write the gyr_self_te... | { // any interval < min supported must saturate to 1600Hz
sample_rate = BMI160SampleRate_1600_HZ;
} | |
window_init(window, WINDOW_NAME("Voice Window")) | ;
window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_mic_window_load,
.unload = prv_mic_window_unload,
.appear = prv_mic_window_appear,
.disappear = prv_mic_window_disappear
});
window_set_user_data(window, data);
prv_window_push(window);
}
// External interface
///////////////... | |
ving our power at any time now.
while(1);
__builtin_unreachable();
}
return false;
}
static bool prv_set_mon_config_register(uint8_t value) {
return prv_write_register(PmicRegisters_MON_CFG, value);
}
static bool prv_set_mon_config(const PmicMonConfig *config) {
const uint8_t ratio_config = 4 - conf... | {
i2c_use(I2C_DEVICE_MAX14690);
prv_update_rail_state(PmicRail_LDO3, enabled);
i2c_release(I2C_DEVICE_MAX14690);
} |
void set_4V5_power_state(bool enabled) {
gpio_use(GPIOF);
GPIO_WriteBit(GPIOF, GPIO_Pin_2, enabled?Bit_SET:Bit_RESET);
gpio_release(GPIOF);
}
void set_6V6_power_state(bool enabled) {
gpio_use(GPIOF);
GPIO_WriteBit(GPIOF, GPIO_Pin_3, enabled?Bit_SET:Bit_RESET);
gpio_release(GPIOF);
}
void set_accessory_p... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | analytics_storage_has_lock() | );
AnalyticsHeartbeatList *apps = s_app_heartbeat_list;
s_app_heartbeat_list = NULL;
return apps;
}
///////////
// Search
static bool prv_is_app_node_with_uuid(ListNode *found_node, void *data) {
const Uuid *searching_for_uuid = (const Uuid*)data;
AnalyticsHeartbeatList *app_node = (AnalyticsHeartbeatList*)... |
ify_services_discovered(1);
ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta],
(const uint8_t *) &future_meta_non_compatible,
sizeof(future_meta_non_compatible),
BLEGATT... | prv_notify_services_discovered(1) | ;
ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta],
(const uint8_t *) &s_meta_v0_system,
sizeof(s_meta_v0_system),
BLEGATTErrorSuccess);
cl_assert_equal_i(ppogatt_cli... |
;
*end_sec = s_test_alg_state.rate_last_update_time;
return true;
}
bool activity_algorithm_metrics_changed_notification(void) {
s_test_alg_state.steps = 0;
s_test_alg_state.rate_last_steps = 0;
s_test_alg_state.rate_last_update_time = rtc_get_time();
return true;
}
bool activity_algorithm_get_sleep_sessi... | {
return true;
} | |
m_erase_status(is_subsector, addr);
mutex_unlock(s_flash_lock);
return (s_erase.expected_duration * 7 / 8);
} else {
stop_mode_enable(InhibitorFlash);
s_erase.in_progress = false;
mutex_unlock(s_flash_lock);
xSemaphoreGive(s_erase_semphr);
// Only run the callback with no locks held so tha... | while (remaining_ms) {
psleep(remaining_ms);
total_time_spent_waiting_ms += remaining_ms;
remaining_ms = prv_flash_erase_poll();
// check to see if the cb responsible for resuming erases should have run
// but is blocked. See PBL-25741 for details
uint32_t erase_suspend_time_remaining;
if ... |
// instead. The downside to this is that it may take us longer to detect another thread is
// stuck, but we should still detect it eventually as long as we're not constantly erasing.
task_watchdog_bit_set_all();
#else
// Just kick the watchdog for the current task. This should give us more accu... |
-----------------------------------
void test_workout_service__initialize(void) {
fake_rtc_init(0, 0);
workout_service_reset();
// Start the step value for the day at X
s_total_step_count = 5000;
s_hrm_expiration = 0;
s_hrm_subscribed = false;
s_abandoned_workout_notification_sent = false;
const bool... | cl_assert_equal_i(steps, 2000) | ;
cl_assert_equal_i(duration_s, 600);
cl_assert_equal_i(distance_m, 1600);
// Get the active calories, should be same as session
workout_service_get_active_kcalories(&active_kcalories);
cl_assert_equal_i(200, active_kcalories);
// Add some time and steps
prv_inc_time(600); /* 10 mins */
prv_inc_steps_... |
EPTH_NAME}.pbi"));
prv_reset();
test_graphics_context_init(&ctx, fb);
s_current_path = s_house_path;
ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 2);
graphics_context_set_antialiased(&ctx, true);
prv_filled_update_proc(NULL, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
... | GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2) | );
s_path_angle = 20;
test_graphics_context_init(&ctx, fb);
graphics_context_set_antialiased(&ctx, true);
prv_filled_update_proc(NULL, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_house_20_aa.8bit.pbi"));
// This case demonstrates tipping point that is also the starting point of the path
... |
= last_written_page; // reset our tracker
mutex_unlock_recursive(s_pfs_mutex);
}
// In the future, the next_page field may be updated dynamically (i.e to resize
// a file). Use a CRC to catch corruption issues in this field.
static uint8_t crc8_next_page(uint16_t next_page) {
return crc8_calculate_bytes((uint8_t*... | prv_page_to_flash_offset(start_page) | + FILE_NAME_OFFSET);
if (!f->is_tmp) {
update_curr_state(f->start_page, TMP_STATE_OFFSET, TMP_STATE_DONE);
}
// finally, mark the creation as complete
update_curr_state(start_page, CREATE_STATE_OFFSET, CREATE_STATE_DONE);
return (S_SUCCESS);
}
static status_t scan_to_offset(File *f, uint32_t *pg_offs... |
6, 640, -768},
{ 64, 632, -760},
{ 56, 640, -768},
{ 64, 632, -768},
{ 64, 648, -768},
{ 64, 640, -768},
{ 64, 632, -760},
{ 64, 640, -768},
{ 64, 632, -760},
{ 56, 640, -760},
{ 56, 632, -760},
{ 64, 632, -760},
{ 64, 640, -760},
{ 56, 640, -760},
{ 64, 632, -760... | { 56, 640, -768},
{ 56, 632, -760},
{ 64, 640, -760},
{ 64, 640, -768},
{ 64, 632, -768},
{ 64, 640, -768},
{ 64, 632, -760},
{ 64, 632, -768},
{ 64, 624, -768},
{ 64, 640, -760},
{ 56, 640, -760},
{ 56, 632, -768},
{ 64, 640, -760},
{ 64, 632, -760},
{ 56, 63... |
{ 56, 640, -760},
{ 64, 632, -760},
{ 56, 632, -768},
{ 64, 632, -760},
{ 64, 632, -768},
{ 64, 632, -768},
{ 56, 632, -768},
{ 64, 632, -768},
{ 64, 640, -768},
{ 64, 632, -768},
{ 64, 640, -760},
{ 64, 632, -760},
{ 56, 640, -760},
{ 64, 632, -760},
{ 64, 6... |
AM where the relocation table overwrote .bss. We don't need the table
// anymore so restore the zero values.
memset(reloc_array, 0, info->num_reloc_entries * 4);
return true;
}
// ----------------------------------------------------------------------------------------------
static bool prv_load_from_flash(const ... | process_metadata_get_size_bytes(app_md) | ;
if (loaded_size) {
void *main_func = prv_offset_to_address(
destination, (uintptr_t)app_md->main_func);
if (!memory_segment_split(destination, NULL, loaded_size)) {
return NULL;
}
// Set the THUMB bit on the function pointer.
return (void *)((uintptr_t)main_func | 1);
} else {
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&s_state, &rcv_bytes, &rcv_protocol) | |
wakeup_id;
info->get_key(file, (uint8_t*)&wakeup_id, sizeof(WakeupId));
WakeupEntry entry;
info->get_val(file, (uint8_t*)&entry, sizeof(WakeupEntry));
//If we have already flagged an error, just skip the rest
if (check->wakeup_count < S_SUCCESS) {
return true; // continue iterating
}
if (uuid_equa... | settings_file_close(&wakeup_settings) | ;
} else {
status = E_INTERNAL;
}
}
mutex_unlock(s_mutex);
if (status != S_SUCCESS) {
return status;
}
// timer doesn't belong to this app
if (!uuid_equal(&app_manager_get_current_app_md()->uuid, &entry.uuid)) {
return E_DOES_NOT_EXIST;
}
time_t return_time = entry.timestamp;
... |
E->CACHE_ASSOCCFG_REG = 0x2;
CACHE->CACHE_CTRL2_REG = 0x0;
CACHE->CACHE_CTRL3_REG = 0x22;
CACHE->CACHE_MRM_HITS_REG = 0x0;
CACHE->CACHE_MRM_MISSES_REG = 0x0;
CACHE->CACHE_MRM_CTRL_REG = 0x0;
CACHE->CACHE_MRM_TINT_REG = 0x0;
CACHE->CACHE_MRM_THRES_REG = 0x0;
CACHE->SWD_RESET_REG = 0x0;
#if DEFAULT_REGIS... | REG_SETF(DCDC, DCDC_V18P_1_REG, DCDC_V18P_IDLE_MIN, 0x10);
REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_V18P_RET_CYCLES, 0x5);
REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_V18P_CUR_LIM_RET, 0xA);
REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_VDD_RET_CYCLES, 0x5);
REG_SETF(DCDC, DCDC_RET_0_REG, DCDC_VDD_CUR_LIM_RET, 0x6);
REG_SETF(DC... |
REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_TEST_REG, 0x0);
REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_BROWN_OUT_IRQ_CLEAR, 0x0);
REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_V18P_TIMEOUT_IRQ_CLEAR, 0x0);
REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_VDD_TIMEOUT_IRQ_CLEAR, 0x0);
REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_V18_TIMEO... |
width_actual = width - (2 * radius);
const int16_t height_actual = height - (2 * radius);
// Take into account the radius values to determine the eight points for each of the four lines
const GPoint top_l = GPoint(origin.x + radius, origin.y);
const GPoint top_r = GPoint(origin.x + radius + width_actual - 1, ... | {
// Non-Antialiased and Stroke Width > 1
prv_draw_round_rect_stroked(ctx, rect, radius, ctx->draw_state.stroke_width);
} | else {
// Non-Antialiased and Stroke Width == 1
prv_draw_round_rect(ctx, rect, radius);
}
}
}
void graphics_draw_round_rect_by_value(GContext* ctx, GRect rect, uint16_t radius) {
graphics_draw_round_rect(ctx, &rect, radius);
}
void graphics_context_init(GContext *context, FrameBuffer *framebuffer... |
memset(&s_ad_data, 0, sizeof(s_ad_data)) | ;
s_ad_data_length = 0;
s_le_create_connection_event_callback = NULL;
s_le_create_connection_callback_param = 0;
memset(&s_scan_resp_data, 0, sizeof(s_scan_resp_data));
s_scan_resp_data_length = 0;
}
| |
ta_buffer, str_size);
OutgoingObject * const obj = task_zalloc(sizeof(*obj));
if (!obj) {
task_free(data_buffer);
return prv_create_oom_error();
}
*obj = (OutgoingObject) {
.data_buffer = data_buffer,
};
const bool is_first = prv_object_queue_add(obj);
if (is_first) {
if (s_state.state =... | (event_name, handler) | ;
}
const RockyGlobalAPI APP_MESSAGE_APIS = {
.init = prv_init_apis,
.deinit = prv_deinit_apis,
.add_handler = prv_add_handler,
};
////////////////////////////////////////////////////////////////////////////////
// Unit Test Helpers
//////////////////////////////////////////////////////////////////////////////... |
peripheral config access before enabling it
static void prv_bus_enable(I2CBus *bus) {
// Don't power up rail if the bus is already in use (enable can be called to reset bus)
if (bus->state->user_count == 0) {
prv_bus_rail_power_up(bus);
}
prv_bus_pins_cfg_i2c(bus);
i2c_hal_enable(bus);
}
//! De-initia... | (LOG_LEVEL_ERROR, "Timed out waiting for bus %s to become non-busy", bus->name) | ;
return false;
}
}
return true;
}
//! Set up and start a transfer to a bus, wait for it to finish and clean up after the transfer
//! has completed
static bool prv_do_transfer(I2CBus *bus, TransferDirection direction, uint16_t device_address,
uint8_t register_address, uint32... |
apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions an... | {
window = app_window_stack_get_top_window();
if (window == NULL) {
return;
}
} |
const char *window_name = window_get_debug_name(window);
if (window_name) {
dbgserial_putstr(window_name);
}
layer_dump_tree(window_get_root_layer(window));
}
#endif /* UI_DEBUG */
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | touch_event_queue_get_event(1, 0) | ;
prv_test_touch_event(touch_event, 1, TouchEvent_Touchdown, &GPoint(1, 13), 3686401, 5,
&GPointZero, 0, 0, true);
}
void test_touch__handle_update_liftoff(void) {
// Test first touch
touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0);
touch_handle_update(0, TouchSta... |
DEFINE_SYSCALL(ButtonId, sys_process_get_launch_button, void) | {
return prv_get_context()->launch_button;
}
// -------------------------------------------------------------------------------------------
DEFINE_SYSCALL(uint32_t, sys_process_get_launch_args, void) {
if (sys_process_get_launch_reason() != APP_LAUNCH_TIMELINE_ACTION) {
return 0;
} else {
return (uint32... | |
process_manager_get_current_process_args();
Uuid app_uuid;
sys_get_app_uuid(&app_uuid);
if (uuid_equal(&app_uuid, &(Uuid)TIMELINE_PAST_UUID_INIT)) {
data->timeline_model.direction = TimelineIterDirectionPast;
} else if (args == NULL) {
data->timeline_model.direction = TimelineIterDirectionFuture;
} e... | ("Timeline Past") | ,
};
return &s_app_md.common;
}
|
h"
#include "kernel/pbl_malloc.h"
#include "os/mutex.h"
#include "resource/resource_ids.auto.h"
#include "process_management/app_install_manager.h"
#include "services/normal/app_cache.h"
#include "services/normal/filesystem/pfs.h"
#include "services/normal/settings/settings_file.h"
#include "system/logging.h"
#include ... | attribute_list_add_resource_id(attr_list_to_init, AttributeIdIcon,
slice->icon_and_subtitle.icon_resource_id) | ;
}
//////////////////////////////////
// Slice Type Implementations
//////////////////////////////////
//! Add new entries to this array as we introduce new slice types
static const SliceTypeImplementation s_slice_type_impls[AppGlanceSliceTypeCount] = {
[AppGlanceSliceType_IconAndSubtitle] = {
.is_attr_list_va... |
imer_id()), 1800 * MS_PER_SECOND);
rtc_set_time(s_saturday_01_30);
do_not_disturb_handle_clock_change();
active = do_not_disturb_is_active();
cl_assert(active == true);
// Timer will go off at 09:00 on Saturday. (7.5 hours)
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 27000 * MS_PER_SECOND... | (get_dnd_timer_id()) | , 48600 * MS_PER_SECOND);
rtc_set_time(s_sunday_9_30);
do_not_disturb_handle_clock_change();
active = do_not_disturb_is_active();
cl_assert(active == true);
// Timer will go off at 10:00 on Sunday. (0.5 hours)
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_SECOND);
rtc_set_t... |
Clear);
}
static void window_load(Window *window) {
AppData *data = &s_data;
// Action bar icon bitmaps.
data->up_bitmap = gbitmap_create_from_png_data(s_golf_api_up_icon_png_data,
sizeof(s_golf_api_up_icon_png_data));
data->down_bitmap = gbitmap_create_from_pn... | (63, background_width) | ;
const int16_t back_value_y_offset = STATUS_BAR_LAYER_HEIGHT + PBL_IF_ROUND_ELSE(24, 0);
const int16_t mid_value_y_offset = back_value_y_offset + PBL_IF_ROUND_ELSE(30, 26);
const int16_t front_value_y_offset = mid_value_y_offset + PBL_IF_ROUND_ELSE(30, 40);
const int16_t disconnected_text_y_offset = mid_value_... |
e TRANSFER_STATE_WRITE_ADDRESS_RX:
// Write the I2C device address again, but this time in read mode.
bus->i2c->DR = bus->transfer.device_address | I2C_READ_WRITE_BIT;
if (bus->transfer.size == 1) {
// Last byte, we want to NACK this one to tell the slave to stop sending us bytes.
bus-... | {
portEND_SWITCHING_ISR(irq_event_handler(&i2c_buses[0]));
} |
void I2C1_ER_IRQHandler(void) {
portEND_SWITCHING_ISR(irq_error_handler(&i2c_buses[0]));
}
void I2C2_EV_IRQHandler(void) {
portEND_SWITCHING_ISR(irq_event_handler(&i2c_buses[1]));
}
void I2C2_ER_IRQHandler(void) {
portEND_SWITCHING_ISR(irq_error_handler(&i2c_buses[1]));
}
void I2C3_EV_IRQHandler(void) {
po... |
PBL_ASSERTN(slave->slave_state->initialized) | ;
PBL_ASSERTN(slave->slave_state->acquired);
spi_slave_wait_until_idle_blocking(slave);
prv_spi_clear_flags(slave->spi_bus);
spi_ll_slave_spi_disable(slave);
slave->slave_state->acquired = false;
prv_spi_disable_peripheral_clock(slave->spi_bus);
}
void spi_ll_slave_spi_enable(const SPISlavePort *slave) {
... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | window_init(window, "") | ;
window_set_fullscreen(window, true);
TextLayer *title = &data->title;
text_layer_init(title, &window->layer.bounds);
text_layer_set_font(title, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
text_layer_set_text_alignment(title, GTextAlignmentCenter);
text_layer_set_text(title, "ACCEL TEST");
layer_ad... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (data) {
*data = (WakeupUICbData) {
.count = missed_apps_count,
.app_ids = missed_app_ids,
};
launcher_task_add_callback(prv_show_dialog, data);
} |
// don't really care if it fails.
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (settings_file_open(&file, SHELL_PREFS_FILE_NAME, SHELL_PREFS_FILE_LEN) != S_SUCCESS) {
goto cleanup;
} |
if (settings_file_get(&file, PREF_KEY_CLOCK_24H, sizeof(PREF_KEY_CLOCK_24H),
&s_is_24h_style, sizeof(s_is_24h_style)) != S_SUCCESS) {
// The setting likely doesn't exist yet so set it to the default (true)
s_is_24h_style = true;
}
if (settings_file_get(&file, PREF_KEY_DEFAULT_WATC... |
_list_add_cstring(&positive_attr_list, AttributeIdBody,
i18n_get(notif_config->text_positive_response, ¬if_attr_list));
attribute_list_add_uint32(&positive_attr_list, AttributeIdIconLarge,
notif_config->icon_positive_response);
AttributeList neutral_attr_... | (action_attr_list, AttributeIdLaunchCode, launch_args.args) | ;
}
// ------------------------------------------------------------------------------------------------
static NOINLINE TimelineItem *prv_create_pin_with_response_items(
time_t pin_time_utc, time_t now_utc, uint32_t duration_m, LayoutId layout_id,
AttributeList *pin_attr_list, HealthCardType health_card_type, ... |
"∂ƒ©˙∆˚¬…Ω≈√∫˜µ≤≥÷¡™£¢∞§¶•ªº–≠`“‘"
"«ÈÉÊËĒĖĘŸÛÜÙÚŪÎÏÍĪĮÌÔÖÒÓŒØŌÕÀÁÂÄÆÃÅĀŚ"
"ŠŁŽŹŻÇĆČÑŃ∑ˇ∏”’»˝¸˛◊ı˜¯˘¿"
"あいうえおかきくけこさしすせそたちつてとなに"
"ぬねのはひふへほまみむめもやゆよらりるれろわ"
"をんアイウエオサシスセソタチツテトナニヌネノ"
"ハヒフヘホマミムメモヤユヨラリルレロワヲン",
.lengths = {
#if... | strcmp(s_perftest_text_arguments.font_key, "RESOURCE_ID_GOTHIC_24_BOLD") | == 0) {
font_index = TestStringFont_Gothic24B;
} else {
font_index = TestStringFont_Other;
}
#if TEXT_PERFTEST_MODAL
// Length replaces the yoffset argument
size_t length = atoi(s_perftest_text_arguments.y_offset);
if (length == 0) {
length = STRING_LENGTH_MAX;
}
#else
size_t length = s_perf... |
emu_test_add_byte_from_isr(QemuSerialGlobals *state, uint8_t byte);
// Stubs
////////////////////////////////////
#include "stubs_passert.h"
#include "stubs_logging.h"
#include "stubs_pbl_malloc.h"
#include "stubs_mutex.h"
// Globals
QemuSerialGlobals s_state;
// Setup
////////////////////////////////////
void tes... | prv_send_bytes(msg_data, sizeof(msg_data)) | ;
cl_assert(!qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &rcv_protocol));
prv_send_bytes(msg_data, sizeof(msg_data));
rcv_msg = qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &rcv_protocol);
cl_assert(rcv_msg);
cl_assert_equal_i(rcv_bytes, 2*sizeof(msg_data));
cl_assert_equal_m(m... |
Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writ... | interval_timer_get(&timer, &average_ms) | ;
cl_assert_equal_i(num_intervals, 2);
cl_assert_equal_i(average_ms, 3000000000);
fake_rtc_increment_time_ms(3000000000);
interval_timer_take_sample(&timer);
num_intervals = interval_timer_get(&timer, &average_ms);
cl_assert_equal_i(num_intervals, 3);
cl_assert_equal_i(average_ms, 3000000000);
}
void t... |
kalg_get_sleep_stats(s_kalg_state, &stats) | ;
// If we ask for the stats before sleep starts, should be no sleep info
if (i < k_sleep_start_m) {
cl_assert_equal_i(stats.sleep_start_utc, 0);
cl_assert_equal_i(stats.sleep_len_m, 0);
cl_assert_equal_i(stats.uncertain_start_utc, 0);
}
// If we ask once we know for sure sleep has s... | |
DDING (4)
#define MIC_DOT_MAX_RADIUS (9)
#define MIC_DOT_LAYER_RADIUS (MIC_DOT_MAX_RADIUS + 1)
#define MIC_DOT_LAYER_SIZE ((GSize){ .w = MIC_DOT_LAYER_RADIUS * 2, .h = MIC_DOT_LAYER_RADIUS * 2})
#define MAX_MESSAGE_LEN (500)
#define MAX_ERROR_COUNT (4)
#define ERROR_DIALOG_TIMEOUT (5000)
static const uint32_t UNFO... | prv_start_dictation(data) | ;
} else {
VOICE_LOG("Too many errors! Exiting...");
prv_exit_and_send_result_event(data, data->error_exit_status);
}
}
static void prv_error_dialog_unload(void *context) {
VoiceUiData *data = context;
prv_handle_error_retries(data);
}
static void prv_init_dialog(VoiceUiData *data, Dialog *dialog, con... |
cess_state/app_state/app_state.h"
#include "process_state/worker_state/worker_state.h"
#include "system/passert.h"
#include "util/heap.h"
#include <string.h>
Heap *task_heap_get_for_current_task(void) {
if (pebble_task_get_current() == PebbleTask_App) {
return app_state_get_heap();
} else if (pebble_task_get_... | heap_zalloc(app_state_get_heap(), size, saved_lr) | ;
}
void *app_zalloc_check(size_t bytes) {
register uintptr_t lr __asm("lr");
uintptr_t saved_lr = lr;
Heap *heap = app_state_get_heap();
void *mem = heap_zalloc(heap, bytes, saved_lr);
if (!mem && bytes != 0) {
PBL_CROAK_OOM(bytes, saved_lr, heap);
}
return mem;
}
void *app_calloc(size_t count, s... |
l_assert_equal_i(s_unscheduled_cb_count, 1);
cl_assert_equal_p(s_unscheduled_job, job);
cl_assert_equal_b(s_unscheduled_completed, false);
cl_assert_equal_i(regular_timer_seconds_count(), 0);
free(ad);
}
void test_gap_le_advert__cant_schedule_after_deinit(void) {
gap_le_advert_deinit();
BLEAdData *ad = cre... | cl_assert_equal_b(gap_le_is_advertising_enabled(), false) | ;
free(ad);
}
|
al_line_dotted(&ctx, GPoint(7, 24), 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_origin_no_clip")));
// Even rows of different lengths
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_draw_horizontal_line_dotted(&ctx,... | GPoint(7, 13) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
LauncherAppGlanceSettings *settings_glance =
launcher_app_glance_structured_get_data(structured_glance);
return NULL_SAFE_FIELD_ACCESS(settings_glance, icon, NULL);
} |
static const char *prv_get_title(LauncherAppGlanceStructured *structured_glance) {
LauncherAppGlanceSettings *settings_glance =
launcher_app_glance_structured_get_data(structured_glance);
return NULL_SAFE_FIELD_ACCESS(settings_glance, title, NULL);
}
static void prv_charging_icon_node_draw_cb(GContext *ctx... |
set_duration(animation, TIMELINE_CARD_TRANSITION_MS / 2);
return animation;
}
static void prv_pin_window_load(Window *window) {
TimelinePinWindow *pin_window = window_get_user_data(window);
Layer *window_layer = window_get_root_layer(window);
layer_init(&pin_window->layer, &window_layer->bounds);
layer_add_c... | {
TimelinePinWindow *pin_window = (TimelinePinWindow *)window;
event_service_client_unsubscribe(&pin_window->blobdb_event_info);
timeline_item_destroy(pin_window->item_detail_layer.item);
prv_pin_window_unload(window);
kernel_free(window);
} | |
status_t rv;
// Iterate over the glance slices, creating attribute lists and summing the size we need for the
// overall serialized slice
size_t serialized_glance_size = sizeof(SerializedAppGlanceHeader);
for (unsigned int slice_index = 0; slice_index < glance->num_slices; slice_index++) {
SliceSerializ... | // Destroy the attributes of each of the attribute lists in attr_lists
for (unsigned int i = 0; i < glance->num_slices; i++) {
attribute_list_destroy_list(&attr_lists[i].attr_list);
}
kernel_free(attr_lists);
return rv;
} |
//////////////////////////////////
// Serialized Slice Validation
//////////////////////////////////
static bool prv_is_serialized_slice_valid(const SerializedAppGlanceSliceHeader *serialized_slice) {
if (!serialized_slice ||
!prv_is_slice_type_valid(serialized_slice->type) ||
!WITHIN(serialized_slice-... |
2);
// Assert it got filtered out:
cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0);
}
void test_ancs__should_filter_out_duplicate_messages(void) {
// With an empty db, new notifications should be added as usual
prv_send_notification((uint8_t *)&s_complete_dict);
cl_assert... | cl_assert_equal_i(s_num_requested_notif_attributes, 4) | |
(info->key_len != sizeof(AppInstallId))) {
return true; // continue iterating
}
struct AppDBInitData *data = context;
AppInstallId app_id;
info->get_key(file, (uint8_t *)&app_id, sizeof(AppInstallId));
data->max_id = MAX(data->max_id, app_id);
data->num_apps++;
return true; // continue iterating
}... | kernel_malloc_check(sizeof(AppDBEntry)) | ;
EnumerateData cb_data = {
.cb = cb,
.data = data,
.entry_buf = db_entry,
};
settings_file_each(&s_app_db.settings_file, prv_enumerate_entries, &cb_data);
prv_close_file_and_unlock_mutex();
kernel_free(db_entry);
return;
}
/////////////////////////
// Blob DB API
/////////////////////////
v... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | sys_get_time() | + (i * WAKEUP_EVENT_WINDOW), 0, false);
cl_assert_equal_i(sys_wakeup_query(wakeup_id), sys_get_time() + (i * WAKEUP_EVENT_WINDOW));
}
// Test that the 9th wakeup event fails to schedule (E_DOES_NOT_EXIST)
wakeup_id = sys_wakeup_schedule(sys_get_time() + ((MAX_WAKEUP_EVENTS_PER_APP + 1) * WAKEUP_EVENT_WINDOW... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (activity_sessions[i].type == ActivitySessionType_Sleep) {
if (sleep_enter_utc == -1) {
sleep_enter_utc = activity_sessions[i].start_utc;
}
if (sleep_exit_utc == -1 || exit_utc > sleep_exit_utc) {
sleep_exit_utc = exit_utc;
}
} |
total_seconds += activity_sessions[i].length_min * SECONDS_PER_MINUTE;
}
s_data.metric_history[ActivityMetricSleepEnterAtSeconds][0] =
time_util_get_minute_of_day(sleep_enter_utc) * SECONDS_PER_MINUTE;
s_data.metric_history[ActivityMetricSleepExitAtSeconds][0] =
time_util_g... |
ls to schedule (E_DOES_NOT_EXIST)
wakeup_id = sys_wakeup_schedule(sys_get_time() + ((MAX_WAKEUP_EVENTS_PER_APP + 1) * WAKEUP_EVENT_WINDOW), 0, false);
cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST);
}
void test_wakeup__gap(void) {
WakeupId wakeup_id = 0;
sys_wakeup_cancel_all_for_app();
//... | sys_wakeup_schedule(fourth_event, 0, false) | ;
cl_assert_equal_i(sys_wakeup_query(fourth_wakeup_id), fourth_event);
// Jump to the future right before the 3rd event
rtc_set_time(sys_get_time() + 170);
// Force wakeup to check for current wakeup event
wakeup_enable(false);
wakeup_enable(true);
// fire the first wakeup event, as it is still current... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return;
} | |
calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handle... | (&s_update_handler_calls, b) | , 0);
// A should start out low
distance = prv_last_update_distance(a);
cl_assert(distance < TEST_ANIMATION_NORMALIZED_LOW);
// Execute to the start of B
prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls,... |
uled_jobs != NULL &&
((CronJob*)s_scheduled_jobs)->cached_execute_time <= rtc_get_time()) {
CronJob *job = (CronJob*)s_scheduled_jobs;
// Remove the job from the list, it's done.
s_scheduled_jobs = list_pop_head(s_scheduled_jobs);
// Release the mutex while we execute the callback
mutex_un... | list_remove(&job->list_node, &s_scheduled_jobs, NULL) | ;
removed = true;
}
mutex_unlock(s_list_mutex);
return removed;
}
// ---------------------------------------------------------------------------------------
// For Testing:
void cron_clear_all_jobs(void) {
mutex_lock(s_list_mutex);
// Iterate over all the jobs to remove them all.
for (ListNode* ite... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
prv_flash_start_cmd();
prv_flash_send_and_receive_byte(FLASH_CMD_WRITE_ENABLE);
prv_flash_end_cmd();
} |
static void prv_flash_send_24b_address(uint32_t start_addr) {
// Ensure the high bits are not set.
prv_flash_send_and_receive_byte((start_addr & 0xFF0000) >> 16);
prv_flash_send_and_receive_byte((start_addr & 0x00FF00) >> 8);
prv_flash_send_and_receive_byte((start_addr & 0x0000FF));
}
static void prv_flash_w... |
SECONDS_PER_MINUTE) + 59);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("12:00 PM", time_buf);
// June 10th 2015, 00:00:00 (T+12:00:00)
rtc_set_time(event_time + (12 * SECONDS_PER_HOUR));
clock_get_until_time_capitalized(time_buf, sizeof(time_b... | cl_assert_equal_s("1 H AGO", time_buf) | |
for busy bit to clear
static bool wait_for_busy_clear(uint8_t bus_idx) {
unsigned int attempts = I2C_TIMEOUT_ATTEMPTS_MAX;
while((i2c_buses[bus_idx].i2c->SR2 & I2C_SR2_BUSY) != 0) {
--attempts;
if (!attempts) {
return false;
}
}
return true;
}
//! Abort the transfer
//! Should only be calle... | wait_for_busy_clear(bus_idx) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | QEMU_LOG_DEBUG("Got tap msg: axis: %d, direction: %d", hdr->axis, hdr->direction) | ;
PebbleEvent e = {
.type = PEBBLE_ACCEL_SHAKE_EVENT,
.accel_tap = {
.axis = hdr->axis,
.direction = hdr->direction,
},
};
event_put(&e);
}
// -----------------------------------------------------------------------------------------
// Handle incoming Bluetooth connection packet data (Q... |
stroke_circle_${BIT_DEPTH_NAME}__origin_layer(void) {
#if SCREEN_COLOR_DEPTH_BITS == 8
GContext ctx;
test_graphics_context_init(&ctx, fb);
// Big circles
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_BIG);
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG);
... | (&ctx, fb) | ;
// Big circles
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, STROKE_BIG);
graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_BIG);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r16_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_R... |
;
// Should not allow any other notifications through
cl_assert(!alerts_should_notify_for_type(AlertInvalid));
cl_assert(!alerts_should_notify_for_type(AlertMobile));
cl_assert(!alerts_should_notify_for_type(AlertReminder));
}
void test_alerts__migration(void) {
cl_assert(alerts_get_mask() == AlertMaskAllOn... | (!alerts_should_enable_backlight_for_type(AlertReminder)) | ;
cl_assert(!alerts_should_notify_for_type(AlertOther));
cl_assert(!alerts_should_vibrate_for_type(AlertOther));
alerts_set_notification_vibe_timestamp();
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS);
cl_assert(!alerts_should_enable_backlight_for_type(AlertOther));
s_dnd_active = ... |
//////////////////////////////////////////////////////////////
// API: "postmessageerror" event
////////////////////////////////////////////////////////////////////////////////
static void prv_free_json_buffer_associated_with_postmessageerror_event(const uintptr_t ptr) {
task_free((char *)ptr);
}
JERRY_FUNCTION(prv... | task_zalloc(str_size) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | DEFINE_SYSCALL(void, sys_analytics_stopwatch_stop, AnalyticsMetric metric) | {
analytics_stopwatch_stop(metric);
}
static bool prv_is_event_allowed(const AnalyticsEventBlob *const event_blob) {
switch (event_blob->event) {
case AnalyticsEvent_AppOOMNative:
case AnalyticsEvent_AppOOMRocky:
return true;
default:
// Don't allow any other event types:
return fal... |
er);
s_kernel_receiver_is_receiving = false;
s_kernel_receiver_finish_called = true;
}
static void prv_default_kernel_receiver_cleanup(Receiver *receiver) {
cl_assert_equal_p(receiver, s_kernel_receiver);
s_kernel_receiver_is_receiving = false;
s_kernel_receiver_cleanup_called = true;
}
const ReceiverImplem... | cl_assert_equal_p(r, NULL) | |
-32, 896, 320},
{ -32, 904, 320},
{ -32, 896, 320},
{ -32, 888, 320},
// 294 seconds
{ -32, 904, 304},
{ -32, 896, 320},
{ -32, 904, 320},
{ -40, 904, 296},
{ -40, 904, 296},
{ -32, 896, 304},
{ -40, 904, 304},
{ -32, 904, 312},
{ -32, 904, 304},
{ -40, 896, 312}... | ARRAY_LENGTH(samples) | ;
return samples;
}
|
(entry.utc == false) {
entry.timestamp -= *((int*)utc_diff);
entry.utc = true;
if (wakeup_id == s_wakeup_state.current_wakeup_id) {
s_wakeup_state.timestamp = entry.timestamp;
}
}
// Write the new entry to the settings file. We always write as there's no
// chance of it being invalid.
s... | (&wakeup_settings) | ;
// If wakeup events were missed by apps requesting notify_if_missed
// popup a notification window displaying these apps
if (missed_events.missed_apps_count) {
wakeup_popup_window(missed_events.missed_apps_count, missed_events.missed_app_ids);
}
}
static bool prv_compiled_without_utc_support(void) {
... |
sert(enabled == true);
cl_assert(do_not_disturb_is_active() == true);
prv_assert_manually_dnd_setting_val(true);
cl_assert_equal_i(s_num_dnd_events_put, 1);
do_not_disturb_set_manually_enabled(false);
enabled = do_not_disturb_is_manually_enabled();
cl_assert(do_not_disturb_is_active() == false);
cl_asser... | (active == true) | ;
// !Manual && Scheduled && Smart
do_not_disturb_set_manually_enabled(false);
do_not_disturb_set_schedule_enabled(WeekdaySchedule, true);
active = do_not_disturb_is_active();
cl_assert(active == true);
}
void test_do_not_disturb__disabling_manual_dnd_should_override_scheduled(void) {
bool active;
// Ti... |
) - 1);
BTErrno e = gatt_client_subscriptions_subscribe(prv_get_indicatable_characteristic(),
BLESubscriptionIndications,
GAPLEClientKernel);
cl_assert_equal_i(e, BTErrnoNotEnoughResources);
fake_kernel_malloc_mark_assert_equal();... | prv_get_indicatable_characteristic() | |
ption_cb(&hrm_event, NULL);
s_num_hrm_callbacks++;
}
if ((rtc_get_time() % SECONDS_PER_MINUTE) == 0) {
prv_minute_system_task_cb(NULL);
}
}
}
// ---------------------------------------------------------------------------------------
// Test that we subscribe to the HR events at the expected ... | cl_assert_equal_i(last_median, 0) | ;
cl_assert_equal_i(last_update_utc, 0);
// Simulate some HRM callbacks with non-zero heart rate
prv_advance_time_hr(3 /*sec*/, 50 /*hr*/, HRMQuality_Good, true /*force_continuous*/);
prv_advance_time_hr(3 /*sec*/, 100 /*hr*/, HRMQuality_Good, true /*force_continuous*/);
prv_advance_time_hr(1 /*sec*/, 51 /*h... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | RTC_WriteBackupRegister(MAG_XY_CORRECTION_VALS, valxy) | ;
RTC_WriteBackupRegister(MAG_Z_CORRECTION_VAL, valz);
for (int i = 0; i < 3; i++) {
s_saved_corr[i] = corr[i];
}
s_saved_corr_present = true;
}
// Loads the calibration values. Returns true if loads successfully,
// otherwise false.
static bool prv_load_calibration_values(void) {
uint32_t valxy = RTC_... |
arm_service_enable_alarms(bool enable) {
s_alarms_enabled = enable;
}
// ----------------------------------------------------------------------------------------------
const char *alarm_get_string_for_kind(AlarmKind kind, bool all_caps) {
const char *alarm_day_text = NULL;
switch (kind) {
case ALARM_KIND_EV... | if (scheduled_days[i % 7] == true) {
num_days_scheduled++;
latest_day_scheduled = i % 7;
const char *day_string = i18n_get(day_strings[i % 7], day_strings);
strcat(alarm_day_text, day_string);
strcat(alarm_day_text, ",");
i18n_free(day_strings[i % 7], day_strings); // copied in by st... |
}
if (num_days_scheduled == 1) {
// Write the full day string
const char *full_day_string = i18n_get(full_day_strings[latest_day_scheduled],
full_day_strings);
strcpy(alarm_day_text, full_day_string);
i18n_free(full_day_strings[latest_day_scheduled], full_... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {clar_categories} |
static const struct clar_suite _clar_suites[] = {
${clar_suites}
};
static size_t _clar_suite_count = ${clar_suite_count};
static size_t _clar_callback_count = ${clar_callback_count};
/* Core test functions */
static void
clar_report_errors(void)
{
int i = 1;
struct clar_error *error, *next;
error = _clar.... |
l_malloc_clear_tracking();
// Thursday Jan 16 14:00:00 PST 2015
// all items garbage collected
rtc_set_time(1421445600);
head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast,
1421445600),
... | cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id)) | ;
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id));
}
void test_timeline__all_day_past(void) {
prv_insert_all_day_items();
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
TimelineItem earlier_item = {
.header = {
... |
ssert_equal_b(s_dls_private_handle_disconnect_called, false);
cl_assert_equal_b(s_comm_session_event_put, false);
}
void test_session__last_system_session_wins(void) {
Transport *system_transport = (Transport *) TransportID1;
CommSession *system_session = comm_session_open(system_transport, &s_transport_imp,
... | comm_session_send_next(session) | ;
cl_assert_equal_i(fake_system_task_count_callbacks(), 1);
comm_session_send_next(session);
cl_assert_equal_i(fake_system_task_count_callbacks(), 1);
comm_session_send_next(session);
cl_assert_equal_i(fake_system_task_count_callbacks(), 1);
cl_assert_equal_i(s_send_next_count, 0);
fake_system_task_callb... |
nnection,
prv_send_clients_encrypted_event, NULL);
unlock:
bt_unlock();
}
// -------------------------------------------------------------------------------------------------
//! Wrappers around Bluetopia HCI / GAP calls - Not compiled at the moment, fix in PBL-3276... | if (bt_device_equal(&connection->device.opaque, &intent->device.opaque)) {
return true;
} |
if (!connection->irk) {
// are we looking for a bonding which did not exchange an irk?
if (sm_is_pairing_info_irk_not_used(&intent->bonding->irk)) {
PBL_LOG(LOG_LEVEL_DEBUG, "Bonding does not have irk ... comparing identity address");
return (0 == memcmp(&connection->device.opaque, &int... |
LEGATTErrorSuccess);
ams_handle_write_response(entity_update, BLEGATTErrorSuccess);
cl_assert_equal_b(ams_is_registered_for_all_entity_updates(), true);
fake_gatt_client_op_clear_write_list();
}
static uint8_t prv_ams_command_for_music_command(MusicCommand command) {
switch (command) {
case MusicCommandP... | (s_conn_mgr_states[BtConsumerMusicServiceIndefinite].state,
ResponseTimeMiddle) | |
h/id.h>
#include <btutil/bt_device.h>
static uint32_t s_pra_cycling_pause_count;
static BTDeviceAddress s_pinned_addr;
static bool s_cycling_paused_due_to_dependent_bondings;
static void prv_allow_cycling(bool allow_cycling) {
bt_driver_set_local_address(allow_cycling, allow_cycling ? NULL : &s_pinned_addr);
}
voi... | (LOG_LEVEL_INFO, "No bondings found that require address pinning!") | ;
bt_driver_set_local_address(true /* allow_cycling */, NULL);
#endif
}
}
|
ENT:
#endif
case PEBBLE_BLE_DEVICE_NAME_UPDATED_EVENT: {
settings_bluetooth_update_remotes_private(settings_data);
settings_menu_mark_dirty(SettingsMenuItemBluetooth);
break;
}
case PEBBLE_BT_STATE_EVENT: {
settings_bluetooth_reconnect_once();
settings_data->toggle_state = Tog... | ("", NULL) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (null_ptr, field_to_access, 1234) | , 1234);
cl_assert_equal_p(NULL_SAFE_FIELD_ACCESS(null_ptr, ptr_field_to_access, NULL), NULL);
int data = 1337;
const NullSafeFieldAccessTestStruct test_struct = (NullSafeFieldAccessTestStruct) {
.field_to_access = data,
.ptr_field_to_access = &data,
};
// Passing in a valid struct ptr should return... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (true /* write erase headers */) | ;
load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, FRENCH_FIXTURE_NAME, "lang");
shell_prefs_set_language_english(false);
i18n_set_resource(RESOURCE_ID_STRINGS);
}
void test_i18n__cleanup(void) {
}
extern I18nString *prv_list_find_string(const char *string, void * owner);
void test_i18n__music(void) {
co... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | GRect(0, 0, 640, 64) | ;
GBitmap bitmap = {
.bounds = BITMAP_BOUNDS,
};
BitmapLayer layer;
bitmap_layer_init(&layer, &BITMAP_LAYER_FRAME);
bitmap_layer_set_bitmap(&layer, &bitmap);
// set bounds with non-zero origin
layer_set_bounds((Layer *)&layer, &BITMAP_LAYER_BOUNDS);
// !legacy2
cl_will_return(process_manager_co... |
layout) {
return GSizeZero;
}
uint32_t resource_storage_get_num_entries(ResAppNum app_num, uint32_t resource_id) {
return 0;
}
static bool s_skip_mem_leak_check;
static void prv_init(void) {
rocky_runtime_context_init();
jerry_init(JERRY_INIT_EMPTY);
}
static void prv_deinit(void) {
jerry_cleanup();
ro... | {
Layer *root_layer = &s_app_window_stack_get_top_window.layer;
root_layer->bounds = GRect(10, 20, 30, 40);
cl_assert(root_layer->update_proc);
GContext ctx = {.lock = true};
root_layer->update_proc(root_layer, &ctx);
if (s_tictoc_callback_is_color) {
cl_assert_equal_i(1, s_graphics_fill_rect.call_coun... | |
ible);
recognizer->flags = 0;
}
void recognizer_cancel(Recognizer *recognizer) {
PBL_ASSERTN(recognizer && recognizer->impl);
if (!recognizer_is_active(recognizer)) {
return;
}
if (recognizer->state == RecognizerState_Possible) {
// Nothing to cancel
return;
}
if (recognizer->impl->cancel(r... | list_get_head(list_append(list->node, &recognizer->node)) | ;
}
void recognizer_remove_from_list(Recognizer *recognizer, RecognizerList *list) {
if (!recognizer || !list || !recognizer->is_owned) {
return;
}
recognizer->is_owned = false;
list_remove(&recognizer->node, &list->node, NULL);
}
//////////////////////////////////////////////////////////////////////////... |
{ 1224, 216, 152},
{ 1152, 160, 96},
{ 960, 88, 56},
{ 792, -40, -48},
{ 736, -32, -64},
{ 848, 24, -96},
{ 1072, 112, -64},
{ 1464, 232, -96},
{ 1744, 352, -280},
// 5 seconds
{ 1632, 472, -192},
{ 1328, 312, -32},
{ 1224, 320, 8},
{ 1344, 352, -184},
{ 1280... | { 528, 216, -464},
{ 432, 96, -744},
{ 272, -56, -784},
{ 168, -64, -864},
{ 16, 64, -1040},
{ 240, -56, -1120},
{ 312, -32, -1016},
{ 248, 16, -936},
{ 88, -8, -840},
{ -104, -16, -760},
{ -200, 0, -784},
{ -192, 8, -848},
{ -176, -16, -928},
{ -240, -64, -984},
... |
{ 1312, 512, 168},
{ 1192, 584, 184},
// 13 seconds
{ 1208, 632, 136},
{ 888, 864, 184},
{ 1312, 944, 40},
{ 1016, 536, 152},
{ 896, 632, -64},
{ 928, 656, -24},
{ 1248, 760, 80},
{ 1344, 584, 64},
{ 1360, 480, 104},
{ 1488, 344, 168},
{ 1568, 280, 96},
{ 142... |
if (s_current_ad_data != &next->payload) {
// Give the advertisement data to the BT controller:
bt_driver_advert_set_advertising_data(&next->payload);
s_current_ad_data = &next->payload;
} |
// One slot is 625us:
const uint32_t min_interval_ms = ((next->terms[next->cur_term].min_interval_slots * 5) / 8);
const uint32_t max_interval_ms = ((next->terms[next->cur_term].max_interval_slots * 5) / 8);
BLE_LOG_DEBUG("Enable Ad job %s", prv_string_for_debug_tag(next->tag));
bool r... | |
t having to do a read-modify-write.
static uint8_t s_pmic_gpio_output_state = 0;
typedef enum PmicGpio {
PmicGpio1 = (1 << 0),
PmicGpio2 = (1 << 1),
PmicGpio3 = (1 << 2),
PmicGpio4 = (1 << 3),
PmicGpio5 = (1 << 4),
} PmicGpio;
typedef enum {
PmicRegisters_SD1_VOLTAGE = 0x01,
PmicRegisters_LDO1_VOLTAGE =... | {
uint8_t val;
if (!prv_read_register(register_address, &val)) {
return false;
}
if (enable) {
val |= (1 << bit);
} else {
val &= ~(1 << bit);
}
return prv_write_register(register_address, val);
} |
static bool prv_set_pmic_gpio_outputs(PmicGpio set_mask, PmicGpio clear_mask) {
PBL_ASSERTN((set_mask & clear_mask) == 0);
uint8_t new_output_state = s_pmic_gpio_output_state;
new_output_state |= set_mask;
new_output_state &= ~clear_mask;
if (prv_write_register(PmicRegisters_GPIO_SIG_OUT, new_output_state))... |
i18n_noop("Every Day");
break;
case ALARM_KIND_WEEKDAYS:
alarm_day_text = all_caps ?
/// A frequency option for alarms, i.e. the alarm would only go off every weekday. Respect
/// capitalization!
i18n_noop("WEEKDAYS") :
/// A frequency option for a... | strnlen(alarm_day_text, 28) | - 1] = 0;
}
}
// ----------------------------------------------------------------------------------------------
void command_alarm(void) {
prv_put_alarm_event();
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | GPIO_Init(af_config->gpio, &init) | ;
gpio_release(af_config->gpio);
}
void gpio_af_configure_fixed_output(const AfConfig *af_config, bool asserted) {
GPIO_InitTypeDef init = {
.GPIO_Pin = af_config->gpio_pin,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_NOPULL
}... |
% TWELVE_HOURS;
const int sleep_end_24h = health_data_sleep_get_end_time(data->health_data);
const int sleep_end_12h = (sleep_end_24h - time_fuzz) % TWELVE_HOURS;
if (sleep_start_24h || sleep_end_24h) {
const int sleep_start = (sleep_start_12h * HEALTH_PROGRESS_BAR_MAX_VALUE / TWELVE_HOURS);
const int ... | (&container->node, ctx, &rect, NULL, NULL) | ;
graphics_text_node_destroy(&container->node);
} else {
char buffer[16];
const GFont font = data->em_dash_font;
snprintf(buffer, sizeof(buffer), EM_DASH);
graphics_context_set_text_color(ctx, CURRENT_TEXT_COLOR);
graphics_draw_text(ctx, buffer, font, rect, GTextOverflowModeFill, GTextAlignmen... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | FIND_REGION("US/Pacific") | ;
cl_assert(us_pacific_region != -1);
// Look up the real America/Los_Angeles
const int america_los_angeles_region = FIND_REGION("America/Los_Angeles");
cl_assert(america_los_angeles_region != -1);
// Verify that they're the same underlying region
cl_assert_equal_i(us_pacific_region, america_los_angeles_r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.