prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
{ {.id = 0, .type = TimelineItemActionTypeGeneric, .attr_list = {.num_attributes = ARRAY_LENGTH(action1_attributes), .attributes = action1_attributes}}, {.id = 1, .type = TimelineItemActionTypeGeneric, .attr_list = {.num_attributes = ARRAY_LENGTH(action2_attributes), .attributes = action2_attributes}}, }; void...
cl_assert_equal_s("bc", string_list_get_at(list, 1))
(item->is_leaf && item->perform_action) { item->perform_action(action_menu, item, data->config.context); data->performed_item = item; if (!data->frozen) { prv_action_window_pop(true /*animated*/, action_menu); } } else if (item->next_level) { prv_set_level(data, item->next_level); } } st...
prv_action_window_pop(animated, action_menu)
; } void action_menu_set_result_window(ActionMenu *action_menu, Window *result_window) { if (!action_menu) return; // remove existing result window ActionMenuData *data = window_get_user_data(&action_menu->window); if (data->result_window) { prv_remove_window(data->result_window); } // insert new res...
if (is_connected) { light_enable_interaction(); } else { // Chances are the Pebble of our dear customer has been charging away // from the phone and is disconnected because of that. Try reconnecting // immediately upon disconnecting the charger: bt_driver_reconnect_reset...
alarm_handle_clock_change()
; wakeup_handle_clock_change(); cron_service_handle_clock_change(set_time_info); } // TODO: evaluate if these need to change on every time update do_not_disturb_handle_clock_change(); reminders_update_timer(); #endif return; } case PEBBLE_BLE_SCAN_EVENT: case P...
char s_test_file_b[TEST_FILE_B_APPEND_SIZE]; // c - space to perform non-append writes static const char *const TEST_FILE_C_NAME = "c"; static const size_t TEST_FILE_C_SIZE = 9001; // it's over 9000! static char s_test_file_c[TEST_FILE_C_SIZE]; static uint32_t num_pages(void) { return pfs_get_size() / PFS_SECTOR_S...
pfs_close(fd)
, S_SUCCESS); } void test_pfs__open(void) { int fd = pfs_open("dne", OP_FLAG_READ, 0, 0); cl_assert(fd == E_DOES_NOT_EXIST); fd = pfs_open("dne", OP_FLAG_OVERWRITE, FILE_TYPE_STATIC, 0); cl_assert(fd == E_DOES_NOT_EXIST); char name[] = {'a'}; int fds[100]; // arbitrarily large # of FDs int i; for (i ...
= (uint8_t*)context; *cur_val = key_i; int val_i = atoi((char*)val + 1); cl_assert_equal_i(key_i, val_i); if (key_i == STOPPING_NUM) { return false; } return true; } void test_settings_file__each_quit_early(void) { printf("\nTesting if we can use each and stop early at %d iterations...\n", STOPPIN...
settings_file_exists(&file, key, key_len)
); // Check that we can do a get_len and we don't search past the current record int before_count = settings_raw_iter_prv_get_num_record_searches(); cl_assert_equal_i(key_len, settings_file_get_len(&file, key, key_len)); int after_count = settings_raw_iter_prv_get_num_record_searches(); cl_assert_equal_i(bef...
/* * 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...
(text_node->overflow, overflow_mode)
; cl_assert_equal_p(text_node->alignment, alignment); TextLayoutExtended *layout = (TextLayoutExtended *)layout_ref; cl_assert_equal_p(text_node->line_spacing_delta, layout->line_spacing_delta); layout->max_used_size = s_data.max_used_size; } GSize graphics_text_layout_get_max_used_size(GContext *ctx, const ...
uint8_t *flash_written_data; bool *flash_written_flag; void *source_buffer; uint32_t flash_data_start, flash_data_length; bool callback_called; void test_system_flash__initialize(void) { erased_sector = 0; flash_locked = true; flash_flags_set = false; return_status = FLASH_COMPLETE; flash_written_data = NUL...
(!system_flash_write(FLASH_BASE, "abc", 3, NULL, NULL))
; cl_assert(flash_locked); assert_flash_unwritten(0, 10); } extern void FLASH_Lock(void) { flash_locked = true; } extern void FLASH_Unlock(void) { flash_locked = false; } extern void FLASH_ClearFlag(uint32_t FLASH_FLAG) { flash_flags_set = false; } extern FLASH_Status FLASH_EraseSector(uint32_t sector, ui...
/* * 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 cl_mock_type(size_t); }
uint32_t icache_line_size(void) { return cl_mock_type(size_t); } bool dcache_is_enabled(void) { return cl_mock_type(bool); } bool icache_is_enabled(void) { return cl_mock_type(bool); } void icache_invalidate(void *addr, size_t size) { s_invalidate_size = size; s_invalidate_addr = (uintptr_t)addr; } void...
ctivity_prefs_get_health_app_opened_version(void) { return s_activity_prefs_health_app_opened; } void activity_prefs_set_health_app_opened_version(uint8_t version) { if (s_activity_prefs_health_app_opened != version) { s_activity_prefs_health_app_opened = version; prv_pref_set(PREF_KEY_ACTIVITY_HEALTH_APP_...
{ display_set_offset(shell_prefs_get_display_offset()); }
bool shell_prefs_should_prompt_display_calibration(void) { return s_should_prompt_display_calibration; } void shell_prefs_set_should_prompt_display_calibration(bool should_prompt) { s_should_prompt_display_calibration = should_prompt; prv_pref_set(PREF_KEY_SHOULD_PROMPT_DISPLAY_CALIBRATION, &s_should_prompt_di...
id = uuids[i]; e.header.timestamp = timestamp + i; notification_storage_store(&e); cl_assert(notification_storage_get(&uuids[i], &r)); compare_notifications(&e, &r); free(r.allocated_buffer); //Ensure that compression does not remove old notifications e.header.id = uuids[j]; e.header.timestamp = timest...
uuid_generate(&i3)
; TimelineItem e3 = { .header = { .id = i3, .type = TimelineItemTypeNotification, .status = 0, .ancs_uid = 84, .layout = LayoutIdGeneric, .timestamp = 0x53f0dda7, }, .attr_list = { .num_attributes = 1, .attributes = &attributes[2], }, .action_group =...
break; } if (time_search >= node->time_start && time_search <= node->time_end) { rc = true; break; } node = (VibeHistory*)list_get_next((ListNode*)node); } mutex_unlock(s_vibe_history_mutex); return rc; } // @param cutoff The time to cut off the list at. 0 means to clear the list. s...
mutex_lock(s_vibe_pattern_mutex)
; if (enable != s_vibe_service_enabled) { // ensure that the vibe is off before disabling it. No op if enabling it prv_vibes_set_vibe_strength(VIBE_STRENGTH_OFF); s_vibe_service_enabled = enable; } mutex_unlock(s_vibe_pattern_mutex); } static void prv_timer_callback(void* data) { if (s_vibe_queue_h...
rBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, -40, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } void draw_text_single_line_ellipsis_clip_outside_y(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_dr...
graphics_context_set_stroke_color(ctx, GColorBlack)
; graphics_draw_rect(ctx, &GRect(39, 39, 82, 42)); } void test_graphics_draw_text_${BIT_DEPTH_NAME}__clipping(void) { GContext ctx; Layer canvas; Layer layer; prv_setup_resources(); uint32_t gothic_24_handle = RESOURCE_ID_GOTHIC_24_BOLD; cl_assert(text_resources_init_font(0, gothic_24_handle, 0, &s_fon...
y the BT Controller. Simulate this event: fake_gap_le_put_cancel_create_event(&device, true /* is_master */); prv_assert_no_event(); // Verify there are no more intents: cl_assert_equal_i(gap_le_connect_connection_intents_count(), 0); cl_assert_equal_b(gap_le_connect_has_pending_create_connection(), false);...
(gap_le_connect_has_connection_intent(&device, GAPLEClientKernel), false)
; } void test_gap_le_connect__connection_event_only_after_encrypted_if_encryption_required(void) { BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk(); BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_device(); // Register connection intent for app: gap_le_connect_connect_by_...
in privileged mode because a corrupted heap could crash the // watch. We will post a callback event to the process's event handler which is executed // in unprivileged mode. PebbleEvent e = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_free_storage_buffer_cb, .d...
mutex_lock_recursive(s_list_mutex)
; DataLoggingSession **iter = &s_logging_sessions; for (int i = 0; i < logging_session->comm.session_id; i++) { if (*iter == NULL) { break; } PBL_ASSERTN(logging_session->comm.session_id != (*iter)->comm.session_id); if ((*iter)->comm.session_id > logging_session->comm.session_id) { bre...
t VoltageMonitorDevice VOLTAGE_MONITOR_BATTERY_DEVICE = { .adc = ADC2, .adc_channel = ADC_Channel_1, .clock_ctrl = RCC_APB2Periph_ADC2, .input = { .gpio = GPIOA, .gpio_pin = GPIO_Pin_1, } }; static const VoltageMonitorDevice VOLTAGE_MONITOR_TEMPERATURE_DEVICE = { .adc = ADC1, .adc_channel = ADC_C...
spi_slave_port_init(ICE40LP->spi_port)
; } void board_init(void) { i2c_init(&I2C_PMIC_MAG_BUS); i2c_init(&I2C_MFI_BUS); spi_slave_port_init(BMI160_SPI); voltage_monitor_device_init(VOLTAGE_MONITOR_ALS); voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY); }
EXECUTE_SCRIPT(script); prv_deinit(); } prv_init(); } static char *prv_load_js(char *suffix) { char path[512] = {0}; snprintf(path, sizeof(path), "%s/js/tictoc~rect~%s.js", CLAR_FIXTURE_PATH, suffix); FILE *f = fopen(path, "r"); cl_assert(f); fseek(f, 0, SEEK_END); size_t length = (size_t)ftel...
(prv_js_global_get_value("s1"))
); cl_assert_equal_i(100, jerry_get_int32_value(prv_js_global_get_value("s2"))); cl_assert_equal_i(150, jerry_get_int32_value(prv_js_global_get_value("c1"))); cl_assert_equal_i(150, jerry_get_int32_value(prv_js_global_get_value("c2"))); } void test_js__date(void) { const time_t cur_time = 1458250851; // Thu Ma...
OP_TICKS = 1024; extern void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ) { if (!rtc_alarm_is_initialized() || !sleep_mode_is_allowed()) { // the RTC is not yet initialized to the point where it can wake us from sleep or sleep/stop // is disabled. Just returning will cause a busy loop where the...
reset_due_to_software_failure()
; } } bool xApplicationIsAllowedToRaisePrivilege(uint32_t caller_pc) { // This function is called by portSVCHandler with the PC value of the // function which initiated the SVC call requesting privilege elevation. // The memory_region.c functions are not used for this check as this function // is in a hot c...
RECT_CLIP_XY, true, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NX...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi"))
get_time()) + 1 * SECONDS_PER_DAY); ActivityInsightSettings original_settings; activity_insights_settings_read(ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD, &original_settings); ActivityInsightSettings disabled_settings = original_settings; disabled_settings.enabled = false; activity_insights_settings_write(A...
(HealthMetricStepCount)
; APP_LOG(APP_LOG_LEVEL_DEBUG, "Got steps update event.(today value: %d)", (int) steps_today); data->steps_updated_value = steps_today; } } // ------------------------------------------------------------------------------- // Tests typedef struct { const char *title; AppTimerCallback cal...
= 0, .attributes = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, } }; // items with long duration static TimelineItem s_long_items[] = { { .header = { .id = {0xaa}, .timestamp = 10000, .duration = 30, ....
cl_assert_equal_i(pin_db_insert_item(&s_items[i]), 0)
; } cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), num_net_allocs); } void test_timeline__cleanup(void) { fake_settings_file_reset(); fake_pbl_malloc_clear_tracking(); } // Tests /////////////////////////// void test_timeline__all_forwards(void) { Iterator iterator = {0}; TimelineIterState state = {0...
|| button > NUM_BUTTONS)) { return; } switch(*click_type) { case 's': offset = ClickHandlerOffsetSingle; break; case 'm': offset = ClickHandlerOffsetMulti; break; case 'l': offset = ClickHandlerOffsetLong; break; case 'r': offset = ClickHandlerOffsetL...
{ return; }
} // fall-through if no more clicks can follow, // and we're not resetting using a click event that has been put. } prv_click_pattern_done(recognizer); } void click_manager_init(ClickManager* click_manager) { for (unsigned int button_id = 0; button_id < ARRAY_LENGTH(click_manager->recognizer...
1464, 192, -48}, { 1232, 80, -16}, { 1112, 112, -40}, { 1096, 144, -88}, { 1072, 120, -16}, { 1024, 96, -32}, { 968, 104, -72}, { 1072, 24, -184}, { 1056, -48, -216}, { 1120, -184, -64}, { 992, -208, -192}, { 936, -120, -304}, // 62 seconds { 960, -136, -304}, { ...
{ 240, 80, -1112}, { 352, 112, -1160}, { 368, 88, -1144}, { 280, 48, -1072}, { 200, -56, -1032}, { 160, -176, -952}, { 112, -200, -920}, { 136, -184, -896}, { 184, -200, -904}, { 152, -176, -888}, { 32, -120, -944}, { 72, -232, -952}, { 120, -24, -944}, { 112, -8,...
{ 760, 704, -472}, { 800, 680, -440}, { 904, 672, -376}, { 1008, 488, -368}, { 1120, 416, -216}, // 5 seconds { 1184, 360, -232}, { 1232, 392, -192}, { 1128, 368, -168}, { 1040, 336, -192}, { 992, 328, -176}, { 920, 256, -80}, { 896, 168, -72}, { 896, 112, -88}, ...
, -32}, { 1128, -32, -8}, { 1240, -40, 80}, { 1384, 16, 40}, // 64 seconds { 1368, 64, 56}, { 1232, 80, 136}, { 1064, 40, 112}, { 1168, 56, 120}, { 1352, 8, 176}, { 1360, -8, 248}, { 1136, -48, 336}, { 1064, 32, 144}, { 1040, 64, 104}, { 1024, 16, 184}, { 1048...
{ 1040, -24, -208}, { 1224, -40, -120}, { 1160, 8, -120}, { 1072, 72, -136}, { 1016, 64, -120}, { 1040, 72, -104}, { 1008, 56, -88}, { 976, 32, -120}, { 984, 64, -80}, { 968, 160, -128}, { 960, 192, -88}, { 1008, 200, -16}, { 1104, 152, 72}, { 1208, 168, 104}, ...
/* * 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...
circular_cache_flush(s_cache)
; kernel_free(s_cache->cache); kernel_free(s_cache); s_cache = NULL; } } void ancs_app_name_storage_store(const ANCSAttribute *app_id, const ANCSAttribute *app_name) { if (!app_id || !app_name) { return; } // copy app id ANCSAttribute *app_id_copy = kernel_zalloc_check(sizeof(ANCSAttribute) ...
PBL_LOG(LOG_LEVEL_ERROR, "Unknown settings file verison %"PRIu16"", version); } if (result != S_SUCCESS) { // Delete the old file and create a new one if migration failed activity_private_settings_close(file); pfs_remove(ACTIVITY_SETTINGS_FILE_NAME); file = activity_private_settings_open(); ...
{ cur_day_index = time_util_get_day(utc_sec); need_history_update_event = (cur_day_index != s_activity_state.cur_day_index); // Call the activity sessions minute handler activity_sessions_prv_minute_handler(utc_sec); // Update our backing store if necessary prv_update_storage(utc_sec); //...
mutex_unlock_recursive(s_activity_state.mutex); // Send the history update event now if history has changed if (need_history_update_event) { PBL_LOG(LOG_LEVEL_DEBUG, "Sending history update event"); PebbleEvent e = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = Heal...
{ PFSFileChangedCallbackNode *callback_node = (PFSFileChangedCallbackNode *)s_head_callback_node_list; while (callback_node) { if (!strcmp(callback_node->name, file_name) && (callback_node->event_flags & event)) { callback_node->callback(callback_node->data); } callba...
status_t pfs_close(int fd) { mutex_lock_recursive(s_pfs_mutex); int res = E_UNKNOWN; if (!FD_VALID(fd)) { res = E_INVALID_ARGUMENT; goto cleanup; } File *f = &PFS_FD(fd).file; if (f->is_tmp) { // TODO: For safety, could disallow this op if user has orig file hdl open pfs_remove(f->name);...
} else { bottom_margin.raw_value = bm_p0.y.raw_value; } } // Find edges for both caps prv_calc_cap_vert(&p0, radius, x, &top_margin, &bottom_margin); prv_calc_cap_vert(&p1, radius, x, &top_margin, &bottom_margin); // Finally draw line if (top_margin.raw_value <= b...
graphics_line_draw_stroked_aa(ctx, p0, p1, ctx->draw_state.stroke_width)
; return; } else { // Antialiased and Stroke Width == 1 (not suppported on 1-bit color) graphics_line_draw_1px_aa(ctx, p0, p1); return; } } #endif if (ctx->draw_state.stroke_width > 1) { // Non-Antialiased and Stroke Width > 1 graphics_line_draw_stroked_non_aa(ctx, p0, p1, ct...
ONDS_PER_DAY) / MAX(1, seconds_today); if (stats->weekday.sum == 0) { stats->weekday = (HealthServiceStats) { .sum = per_day_default, .avg = per_day_default, .min = per_day_default, .max = per_day_default, .count = 1, }; } if (stats->weekend.sum == 0) { stats->weekend...
pbl_override_localtime(&time_start)
; // Add up the metric averages for the passed in time range time_t chunk_start_time = time_start; const int k_seconds_per_step_avg = SECONDS_PER_DAY / ACTIVITY_NUM_METRIC_AVERAGES; unsigned int second_idx = local_tm->tm_hour * SECONDS_PER_HOUR + local_tm->tm_min * SECONDS_PER_MINUTE + local_tm->tm_sec; ...
-------------- // Stopped handler that calls unschedule static void prv_stopped_handler_unschedule(Animation *animation, bool finished, void *context) { prv_add_handler_entry(&s_stopped_handler_calls, animation, finished, context); animation_unschedule(animation); } // --------------------------------------------...
(b, duration_b)
play back at the wrong sample rate most of the time, but live //! replay from a phone will work in realtime with minimal latency //! without speeding up or slowing down the signal during replay. #include "drivers/accel.h" #include "drivers/imu/bmi160/bmi160.h" #include "drivers/qemu/qemu_serial.h" #include "drivers/...
MIN(hdr->num_samples, QEMU_ACCEL_RCV_BUFFER_SAMPLES)
; #else s_num_rcv_samples = hdr->num_samples; #endif s_current_rcv_sample = 0; mutex_lock(s_accel_mutex); { for (uint32_t i=0; i < s_num_rcv_samples; ++i) { s_rcv_buffer[i].x = ntohs(hdr->samples[i].x); s_rcv_buffer[i].y = ntohs(hdr->samples[i].y); s_rcv_buffer[i].z = ntohs(hdr->samples[i]...
isplay.h" #include "drivers/flash.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "drivers/pmic.h" #include "drivers/pwr.h" #include "drivers/watchdog.h" #include "boot_tests.h" #include "firmware.h" #include "fw_copy.h" #include "pebble_errors.h" #include "system/bootbits.h" #include "system/l...
((uintptr_t)reset_handler)
s_num_cb_events_1, 1); cl_assert_equal_i(s_cb_events_1[0].event_type, HRMEvent_BPM); cl_assert_equal_i(s_cb_events_1[0].bpm.bpm, s_hrm_event_data.hrm_bpm); cl_assert_equal_i(s_cb_events_1[0].bpm.quality, s_hrm_event_data.hrm_quality); // Now advance time to just before the expiration time rtc_set_time(rtc_g...
sys_hrm_manager_app_subscribe(app_id + 3, 1, expire_s, 0 /* no features */)
/* * 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...
text_layer_set_font(text, s_fonts[s_font_selection])
; GSize max_size = graphics_text_layout_get_max_used_size(app_state_get_graphics_context(), text->text, text->font, GRect(0, 0, text->layer.bounds.size.w, SHRT_MAX), text->overflow_mode, text->text_alignment, NULL); text_laye...
memcpy(original_in, buffer, buffer_length + 1)
; // test decode unsigned int num_bytes = base64_decode_inplace(buffer, buffer_length); cl_assert(num_bytes == expected_length); cl_assert(memcmp(buffer, expected, num_bytes) == 0); // test encode char out[buffer_length + 1]; int result = base64_encode(out, buffer_length + 1, expected, expected_length);...
, // 27 seconds { 296, 808, 176}, { 328, 800, 144}, { 336, 832, 136}, { 296, 768, 40}, { 272, 1136, 248}, { 200, 1040, 272}, { 232, 1160, 240}, { 72, 1248, 520}, { 32, 1248, 200}, { 200, 800, 88}, { 208, 616, 208}, { 88, 992, 240}, { 0, 1072, 176}, { 136, 1032...
{ 272, 896, 160}, { 272, 976, 144}, { 224, 984, 256}, { 216, 936, 96}, // 33 seconds { 168, 1160, 312}, { 24, 1184, 304}, { 192, 992, -8}, { 208, 704, 0}, { 160, 744, 88}, { 72, 992, 160}, { 0, 1056, 80}, { 88, 960, -8}, { 152, 808, -24}, { 176, 784, -8}, ...
{ 136, 952, 248}, { 240, 1072, 112}, { -48, 1336, 360}, { 24, 1216, 48}, { 120, 680, 88}, { 112, 800, 104}, { 8, 920, 128}, { -24, 992, 104}, { 104, 992, 64}, // 36 seconds { 144, 856, 56}, { 168, 808, 64}, { 192, 880, 64}, { 208, 864, 64}, { 224, 880, 48}, ...
region erased ? FlashLoggingHeader erased_hdr; memset(&erased_hdr, 0xff, sizeof(erased_hdr)); bool region_erased = (memcmp(&erased_hdr, &hdr, sizeof(hdr)) == 0); if (!region_erased) { // unrecognized format, erase everything prv_format_flash_logging_region(); return (UINT32_MAX);...
prv_get_unit_base_address(flash_addr)
.steps = 100, .active_kcalories = 200, .resting_kcalories = 300, .distance_meters = 400, }, }; activity_sessions_prv_add_activity_session(&walk_activity); // Capture the resting kcalories now, It is time dependent and we're not sure exactly which time // of day it will be saved to storag...
mktime(&time_tm)
; rtc_set_time(utc_sec); prv_activity_init_and_set_enabled(true); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 100, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricDistanceMeters, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, exp_distan...
l).section); cl_assert_equal_i(4, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(4 * basic_cell_height, l.selection.y); } void test_menu_layer__center_focused_handles_skipped_rows_animated(void) { MenuLayer l; menu_layer_init(&l, &GRect(10, 10, DISP_COLS, DISP_ROWS)); menu_layer_set_center_focused...
(&s_menu_layer_hierarchy, NULL, &(MenuLayerCallbacks){ .draw_row = prv_menu_cell_is_part_of_hierarchy_draw_row, .get_num_rows = prv_get_num_rows, })
cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // No space: cl_assert_equal_b(false, app_inbox_service_begin(AppInboxServiceTagUnitTest, BUFFER_SIZE + 1, s_writer)); // Shouldn't call ..._end() here because ..._begin() failed. //...
(BUFFER_SIZE, 1, test_message_handler, test_dropped_handler)
/* * 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...
(utf8_iter_state.current >= utf8_bounds.start)
; cl_assert(i > 0); uint32_t decoded_codepoint = utf8_iter_state.codepoint; uint32_t actual_codepoint = s_valid_test_codepoints[i - 1]; cl_assert_equal_i(decoded_codepoint, actual_codepoint); --i; }; cl_assert(i == 0); cl_assert(utf8_iter_state.current == utf8_bounds.start); cl_assert(utf...
/* * 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...
(heartbeat)
; } // Repeat a given bit several times. static int64_t pattern(uint8_t i, size_t n) { uint64_t pat = 0; uint64_t mask = i; for (size_t j = 0; j < n; j++) { pat |= mask << (j*8); } pat &= 0x7f; // truncate so there are no overflows return *(int64_t*)&pat; } static void verify_metric(AnalyticsHeartbeat...
/* * 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...
(1bitpalette)
t_node, list_node_closest_to_head); } // Update the reference to list head in case the window that was inserted is // the new list head. window_stack->list_head = list_get_head(list_node_closest_to_head); } static void prv_insert_with_function(WindowStack *window_stack_to, Window *window, ...
list_remove(&pop_item->list_node, &window_stack->list_head, NULL)
; WindowStackItem *stack_item = (WindowStackItem *)window_stack->list_head; Window *window_to = stack_item ? stack_item->window : NULL; // Add the removed item to the 'removed' list window_stack->removed_list_head = list_insert_before(window_stack->removed_list_head, &pop_item->list_node); // Store t...
system_reset()
; } delay_ms(10); } } static void check_and_handle_resuming_from_standby(void) { periph_config_enable(RCC_APB1PeriphClockCmd, RCC_APB1Periph_PWR); if (PWR_GetFlagStatus(PWR_FLAG_SB) == SET) { // We just woke up from standby. For some reason this leaves the system in a funny state, // so clear the...
hState_FingerDown, GPointZero, 3686380, 0); touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400); TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(10, 10), 20, ...
touch_handle_update(0, TouchState_FingerDown, &GPoint(31, 1), 6, 3686500)
prv_count_handler_entries(&s_stopped_handler_calls, a)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c)...
ert_gpoint_precise(center, 5.5, 5.5); cl_assert_fixedS16_3(radius, 3.5); } void test_graphics_circle__grect_polar_calc_values_mode(void) { GPointPrecise center = {}; Fixed_S16_3 radius = {}; GRect r = GRect(0, 0, 144, 168); grect_polar_calc_values(&r, GOvalScaleModeFitCircle, &center, &radius); cl_assert_...
TRIGANGLE_TO_DEG(TRIG_PI / 2)
1000) // 15s timeout for each dictation #define SPEECH_DETECTION_TIMEOUT (3 * 1000) // Session must last at least 600ms before reporting an error to the user #define MIN_ELAPSED_DURATION (600) #define TEXT_PADDING (4) #define MIC_DOT_MAX_RADIUS (9) #define MIC_DOT_LAYER_RADIUS (MIC_DOT_MAX_RADIUS + 1) #define MI...
sys_light_reset_to_timed_mode()
; prv_teardown(data); } static void prv_handle_error_retries(VoiceUiData *data) { if (data->error_count < MAX_ERROR_COUNT) { VOICE_LOG("Restarting dictation after error"); prv_start_dictation(data); } else { VOICE_LOG("Too many errors! Exiting..."); prv_exit_and_send_result_event(data, data->err...
this is a "static AccelRawData samples[] = {" line, skip it if (strcmp(token, "static") == 0) { continue; } // Grab a sample if (strcmp(token, "{") == 0) { PBL_ASSERTN(state->test_entry.name[0] != 0); int x, y, z; sscanf(token + strlen(token) + 1, "%d, %d, %d", &x, &y, &z); ...
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.end_at.min)
; } else if (strcmp(token, "TEST_END_AT_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.end_at.max); } else if (strcmp(token, "TEST_CUR_STATE_ELAPSED") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.cur_state_elapsed.value); } else if (str...
{ net16 protocol; net16 length; unsigned char information[]; }
PushPacket; static const unsigned char s_message_header[] = { // Message type: text 1, // Source filename 'B', 'O', 'O', 'T', 'L', 'O', 'A', 'D', 'E', 'R', 0, 0, 0, 0, 0, 0, // Log level and task '*', '*', // Timestamp 0, 0, 0, 0, 0, 0, 0, 0, // Line number 0, 0, }; static size_t s_message_length...
r 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 writing, software * distributed under the Licens...
(task, false /*graceful*/)
; } // --------------------------------------------------------------------------------------------- EXTERNALLY_VISIBLE void process_manager_handle_syscall_exit(void) { PebbleTask task = pebble_task_get_current(); ProcessContext *context = prv_get_context_for_task(task); if (context->closing_state == ProcessRu...
/* * 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 pulse_link_max_send_size() - sizeof(ReliablePacket); }
static void prv_send_supervisory_response(enum SupervisoryKind kind, bool final) { ReliablePacket *packet = pulse_link_send_begin( PULSE2_RELIABLE_TRANSPORT_RESPONSE); packet->s = (struct ReliableSupervisoryPacket) { .is_supervisory = true, .kind = kind, ...
/* * 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...
(list_get_prev(&b) == NULL)
; cl_assert(list_get_tail(&b) == &b); } void test_list__append(void) { ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL; ListNode *tail; tail = list_append(&a, &b); cl_assert(tail == &b); tail = list_append(&a, &c); cl_assert(tail == &c); cl_assert(list_get_prev(&a) == NULL); cl_as...
, num_samples / KALG_SAMPLE_HZ, steps); return steps; } // ---------------------------------------------------------------------------------- // The file discovery state definitions typedef enum { SampleFileType_AccelSamples, SampleFileType_MinuteSamples, } SampleFileType; typedef struct { char *res_path; ...
fflush(stdout)
; PBL_ASSERTN(state->test_entry.num_samples < ACCEL_SAMPLES_DISCOVERY_MAX_SAMPLES); state->samples[state->test_entry.num_samples++] = (AccelRawData) { .x = x, .y = y, .z = z, }; continue; } // End of a sample if (strcmp(token, "}") == 0) { PBL_ASSERTN(...
4, 217, 0}, { 16, 0x45, 9447, 155, 0}, { 61, 0x34, 3253, 153, 0}, { 8, 0x44, 2739, 136, 0}, { 0, 0x62, 6031, 238, 0}, { 0, 0x8d, 0, 237, 0}, { 0, 0x8c, 593, 237, 0}, { 0, 0x8d, 0, 238, 0}, { 0, 0x8e, 0, 238, 0}, { 0, 0x8e, 0, 237, 0}, { 0, 0x8e, 0, 237, 0}, ...
{ 0, 0x5b, 0, 141, 0}, { 0, 0x5b, 0, 141, 0}, // 165: Local time: 2016-05-19 11:50:00 PM { 0, 0x5b, 0, 141, 0}, { 0, 0x5b, 0, 141, 0}, { 0, 0x5b, 0, 141, 0}, { 0, 0x5b, 0, 141, 0}, { 0, 0x5b, 0, 141, 0}, { 0, 0x5b, 0, 141, 0}, { 0, 0x5b, 0, 141, 0}, { 0,...
PBL_LOG(LOG_LEVEL_ERROR, "Could not allocate %d bytes for corrupt file of size %d.", read_size, file_size); return NULL; } // In case reading the whole file is not possible due to RAM limitations, // read the portions nearest the current seek position, as they are most // likely to...
(iter, (uint8_t*)&iter->hdr, sizeof(iter->hdr))
Layer *bg_layer, bool highlight) { GDrawState prev_state = graphics_context_get_drawing_state(ctx); const GRect *bounds = &bg_layer->bounds; ctx->draw_state.drawing_box.origin.y = bounds->origin.y; ctx->draw_state.drawing_box.size.h = bounds->size.h; MenuLayerDrawBackgroundCallback draw_backgr...
scroll_layer_set_clips_content_offset(&menu_layer->scroll_layer, !center_focused)
; } void menu_layer_init(MenuLayer *menu_layer, const GRect *frame) { *menu_layer = (MenuLayer) { .pad_bottom = true, }; ScrollLayer *scroll_layer = &menu_layer->scroll_layer; scroll_layer_init(scroll_layer, frame); menu_layer_init_scroll_layer_callbacks(menu_layer); scroll_layer_set_shadow_hidden(scr...
nter of the job's current term. //! Updates the job's term if the term is done. //! It removes the job if it's done. //! It updates the s_jobs list. //! It calls prv_perform_next_job() to set up the next job. static void prv_cycle_timer_callback(void *unused) { bool force_update = false; bt_lock(); { if (!s_...
(&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"...
uint32_t before_size; uint32_t after_size; // lets save ids 17, 25, 42, and 47 because they are my favorite numbers uint32_t after_free = t_data[16].size + t_data[24].size + t_data[41].size + t_data[46].size; s_test_id_ql_up = 17; s_test_id_ql_down = 25; s_test_id_watchface = 42; s_test_id_worker = 47;...
for (uint32_t i = 0; i < 15; ++i) { char filename[15]; int id = (i + 1) * 257; prv_app_filename(filename, sizeof(filename), id); prv_check_file_exists(filename); prv_res_filename(filename, sizeof(filename), id); prv_check_file_exists(filename); }
// finally, make sure the 'standard' files are all there for (uint32_t i = 0; i < ARRAY_LENGTH(descriptions); ++i) { prv_check_file_exists(descriptions[i].name); } } void test_app_cache__purge_orphaned_files_no_apps(void) { // make sure nothing goes awry if there are no installed apps // create some 'st...
/* * 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...
cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 5)
_task_woken != pdFALSE; } static void prv_config_indirect_read(QSPIPort *dev, uint8_t instruction, uint32_t addr, uint8_t dummy_cycles, bool is_ddr) { prv_set_ddr_enabled(is_ddr); uint32_t modes_bitset = 0; modes_bitset |= is_ddr ? QSPI_ComConfig_DDRMode_Enable : QSPI_ComCon...
prv_set_ddr_enabled(false)
ActivitySession *session, int32_t avg_hr, int32_t *hr_zone_time_s) { if (session->length_min <= 0) { return; } ActivityInsightType type; Timeline...
INSIGHTS_LOG_DEBUG("Not adding session pin - asleep")
; return; } if (session->length_min < s_activity_session_settings.session.activity.trigger_elapsed_minutes) { INSIGHTS_LOG_DEBUG("Not adding session pin - not long enough (%"PRIu16" < %"PRIu16")", session->length_min, s_activity_session_settings.session.activit...
temTypeReminder, } }; static TimelineItem item4 = { .header = { .id = {0x8c, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c, 0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05}, .timestamp = 1337, .duration = 0, .type = TimelineItemTypeReminder, } }; // Setup /////////////////////////////////...
{ now = 3 * 60 * 60; // 3 hours after stale_reminder cl_assert_equal_i(reminders_insert(&s_stale_reminder), E_INVALID_OPERATION); }
void test_reminders__stale_item_init(void) { cl_assert_equal_i(reminders_insert(&s_stale_reminder), S_SUCCESS); stub_new_timer_stop(get_reminder_timer_id()); now = 1 * 60 * 60; reminders_init(); cl_assert(new_timer_scheduled(get_reminder_timer_id(), NULL)); now = 3 * 60 * 60; reminders_init(); cl_as...
/* * 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...
cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, 10, 20)))
; cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, 20, 10))); cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, 10, -20))); cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, -20, 10))); } void test_gtypes__grect_shortest_side(void) { cl_assert_equal_i(0, grect_shortest_side(GRectZero)); cl_assert_e...
log hashing output buffer typedef struct LogBuffer { CircularBuffer circular_buffer; uint8_t level; volatile bool transmitting; } LogBuffer; static uint8_t s_log_buffer_ram[LOG_BUFFER_SIZE] __attribute__((section(".log_buffer"))); static LogBuffer s_log_buffer = { .level = LOG_LEVEL_ALWAYS, .transmitting = fals...
prv_start_tx()
/* * 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 (do_not_disturb_is_active() && !(alerts_preferences_dnd_get_mask() & type)) { return false; }
/* * 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...
prompt_send_response("Invalid length")
; return; } char buffer[128]; prompt_send_response_fmt(buffer, 128, "Erasing sectors from 0x%"PRIx32" for %ub", address, length); const uint32_t end_address = address + length; const uint32_t aligned_end_address = (end_address + (SUBSECTOR_SIZE_BYTES - 1)) & SUBSECTOR_AD...
es[current_slice_index]; // Note that we default the expiration time to "never expire" if one was not provided *current_slice_out = (AppGlanceSliceInternal) { .expiration_time = attribute_get_uint32(&attr_list, AttributeIdTimestamp, APP_GLANCE_SLICE_NO_EXPIRATION), ...
attribute_list_add_uint32(attr_list, AttributeIdTimestamp, (uint32_t)current_slice->expiration_time)
; // Initialize the type-specific attributes in the attribute list s_slice_type_impls[current_slice->type].init_attr_list_from_slice(current_slice, attr_list); // Record size of the attribute list in the data struct as well as the overall size accumulator current_attr_list_data->attr_list_size = attrib...
BG_COUNTER_APP_ID, MENU_LAYER_APP_ID}; app_menu_data_source_init(&data_source, &(AppMenuDataSourceCallbacks) { .changed = prv_menu_layer_reload_data, .filter = app_filter_callback, }, &menu_layer); uint16_t num_apps = app_menu_data_source_get_count(&data_source); cl_assert_equal_...
for (uint8_t i = 0; i < n - 1; i++) { uint8_t j = i + rand() / (RAND_MAX / (n - i) + 1); int t = array[j]; array[j] = array[i]; array[i] = t; }
} void test_app_menu_data_source__change_order_apps(void) { // settings has to be at the beginning. The app_menu_data_source module enforces it AppInstallId app_order[] = {APP_ID_SETTINGS, APP_ID_MUSIC, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, APP_ID_WATCHFACES, APP_ID_WORKOUT, BG_COUNTE...
8, 0, 151, 0}, { 0, 0x18, 0, 151, 0}, { 0, 0x18, 0, 151, 0}, { 0, 0x18, 0, 151, 0}, { 0, 0x18, 0, 152, 0}, { 0, 0x18, 0, 151, 0}, { 0, 0x18, 0, 152, 0}, { 0, 0x18, 0, 151, 0}, { 0, 0x18, 0, 151, 0}, { 0, 0x18, 0, 152, 0}, { 0, 0x18, 0, 151, 0}, { 0, 0x18, 0, 151, 0}, { 0,...
ARRAY_LENGTH(samples)
#define PREF_KEY_QUICK_LAUNCH_SETUP_OPENED "qlSetupOpened" static uint8_t s_quick_launch_setup_opened = 0; #define PREF_KEY_DEFAULT_WATCHFACE "watchface" static Uuid s_default_watchface = UUID_INVALID_INIT; #define PREF_KEY_WELCOME_VERSION "welcomeVersion" static uint8_t s_welcome_version = 0; #if CAPABILITY_HAS_HEA...
{ s_backlight_timeout_ms = *timeout_ms; return true; }
s_backlight_timeout_ms = DEFAULT_BACKLIGHT_TIMEOUT_MS; return false; } static uint16_t prv_convert_backlight_percent_to_intensity(uint32_t percent_intensity); static bool prv_set_s_backlight_intensity(uint16_t *intensity) { if (*intensity > BACKLIGHT_BRIGHTNESS_OFF) { s_backlight_intensity = *intensity; ...
_ELSE(3, 7), .location_margin = PBL_IF_RECT_ELSE(5, 9), .body_icon_offset = 3, .body_icon_margin = -5, .body_padding = PBL_IF_RECT_ELSE(1, 1), #if PBL_ROUND .timestamp_upper_padding = 6, .timestamp_lower_padding = -3, #else .timestamp_upper_padding = 3, #endif }, [PreferredContentSizeMed...
if (emoji->codepoint == emoji_codepoint) { return emoji->resource_id; }
} return INVALID_RESOURCE; } static ResourceId prv_get_emoji_icon(NotificationLayout *layout) { const char *body = attribute_get_string(layout->layout.attributes, AttributeIdBody, NULL); return prv_get_emoji_icon_by_string(s_emoji_table, body); } static bool prv_should_enlarge_emoji(NotificationLayout *layou...
/* * 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...
settings_file_set(&file, (uint8_t*)&timestamp, sizeof(timestamp), (uint8_t*)&w_entry, sizeof(w_entry))
); close_settings_file(&file); } void test_migrate_wakeup__test_migration_of_wakeup_entries(void) { SettingsFile file; WakeupId wakeup_id = TIMESTAMP; WakeupEntryV1 wakeup_entry_v1; open_settings_file(&file); cl_must_pass(settings_file_get(&file, (uint8_t*)&wakeup_id, sizeof(wakeup_id), (uint8_t*)...
/* * 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...
{ cl_assert_equal_i(0b1, BITS(0)); cl_assert_equal_i(0b00011111, BITS(4)); cl_assert_equal_i(0b00111111, BITS_BETWEEN(0, 5)); cl_assert_equal_i(0b00111000, BITS_BETWEEN(3, 5)); cl_assert_equal_i(0b00010000, BITS_BETWEEN(4, 4)); }
// Flash memory is organized into twelve sectors of unequal sizes. // Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB. // The remaining sectors are 128 KiB. // Bitset of sectors that have been "erased" static uint32_t erased_sector; static bool flash_locked, flash_flags_set; static FLASH_Status return_status; uint8_t *fl...
ay_text[32] = {0}; MenuCellLayerConfig config = { .title = alarm_time_text, .value = enabled, #if CAPABILITY_HAS_HEALTH_TRACKING .icon = &data->smart_alarm_icon, .icon_align = MenuCellLayerIconAlign_TopLeft, .icon_box_model = &(GBoxModel) { .offset = { 0, 5 }, .margin = { 6, 0 } }, .icon_form_...
GEdgeInsets(STATUS_BAR_LAYER_HEIGHT, 0, PBL_IF_ROUND_ELSE(STATUS_BAR_LAYER_HEIGHT, 0), 0)
); menu_layer_init(&data->menu_layer, &bounds); menu_layer_set_callbacks(&data->menu_layer, data, &(MenuLayerCallbacks) { .get_num_sections = prv_alarm_list_get_num_sections_callback, .get_num_rows = prv_alarm_list_get_num_rows_callback, .get_cell_height = prv_alarm_list_get_cell_height_callback, .d...
*ctx, HealthProgressSegment *segment, GColor color, HealthProgressBarValue start, HealthProgressBarValue end) { GPoint p1, p2, p3, p4; if (segment->type == HealthProgressSegmentType_Vertical) { p1 = prv_get_point_between_points(segment->points[0], segment->points[3], start); p2...
prv_fill_segment(ctx, segment, color, from, to)
; } void health_progress_bar_outline(GContext *ctx, HealthProgressBar *progress_bar, GColor color) { graphics_context_set_stroke_color(ctx, color); graphics_context_set_stroke_width(ctx, 2); for (int i = 0; i < progress_bar->num_segments; i++) { HealthProgressSegment *segment = &progress_bar->segments[i]; ...
4, -856}, { -392, 296, -856}, { -376, 24, -672}, { -256, -168, -448}, { -168, -280, -400}, { -40, -264, -472}, { 16, -400, -304}, { 72, -632, -144}, { 128, -512, 64}, { 136, -528, 240}, { 48, -472, 360}, { 56, -608, 368}, // 8 seconds { 112, -776, 408}, { 104, -86...
{ 1808, 800, 456}, { 2568, 1128, 512}, { 3448, 1040, 560}, { 3952, 2192, 112}, { 2160, 1848, 504}, { 2184, -328, 880}, { 2512, -1256, 1216}, { 2472, 1936, 488}, { 1304, 1928, -176}, { 544, 1280, -440}, { 680, 808, -200}, { 920, 496, 160}, { 1168, 88, 208}, { 960, ...
{ 1264, 208, 192}, { 1016, 56, 112}, { 848, 280, 64}, { 808, 552, 24}, { 864, 656, 32}, { 808, 888, 40}, { 656, 696, 16}, // 16 seconds { 584, 768, 120}, { 696, 752, 224}, { 864, 760, 392}, { 1064, 744, 528}, { 936, 688, 552}, { 792, 656, 552}, { 872, 568, 58...
&layer->bounds; const GRect *menu_layer_frame = &menu_layer_get_layer(&aml->menu_layer)->frame; const int16_t arrow_layer_height = (aml_bounds->size.h - menu_layer_frame->size.h) / 2; const int row = prv_get_menu_layer_row(aml, aml->selected_index); const GColor bg_color = GColorBlack; const GColo...
(&aml->item_animation.fade_top, SYSTEM_APP, RESOURCE_ID_ACTION_MENU_FADE_TOP)
; gbitmap_init_with_resource_system(&aml->item_animation.fade_bottom, SYSTEM_APP, RESOURCE_ID_ACTION_MENU_FADE_BOTTOM); #endif layer_add_child(&aml->layer, menu_layer_get_layer(&aml->menu_layer)); layer_set_hidden((Layer *)&aml->menu_layer.inverter, true); aml->menu_layer.se...
/* * 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...
(&item->header.id)
; item->header.type = type; item->header.duration = duration; item->header.timestamp = timestamp; item->header.layout = layout; if (!prv_deep_copy_attributes_actions(attr_list, action_group, item)) { timeline_item_destroy(item); return NULL; } return item; } TimelineItem *timeline_item_create(i...
(*hdr), hdr->msg_size, s_parsed_msg.payload_sender_type, s_parsed_msg.payload_sender_id, s_parsed_msg.payload_sender_version_patch, &s_parsed_msg.payload_send_time, &s_parsed_msg.payload_sender_v_major, &s_parsed_msg.payload_sender_v_minor, &s_parsed_msg.msrmt.uuid, ...
LOG("payload_send_time: %"PRIu32"", s_parsed_msg.payload_send_time)
; const int num_events = s_parsed_msg.events.num_events; LOG("Events: Number: %d", num_events); for (int i = 0; i < num_events; i++) { pebble_pipeline_Event *event = &s_parsed_msg.events.events[i]; LOG(" Event -- Type: %d", event->type); char uuid_str[UUID_STRING_BUFFER_LENGTH]; uu...
g_Text && text_crc_matches) { continue; } // Write out a chunk header chunk_hdr.key = CORE_DUMP_CHUNK_KEY_MEMORY; chunk_hdr.size = region_buf[region].length + sizeof(CoreDumpMemoryHeader); if (flash_addr_max < (flash_addr + sizeof(chunk_hdr) + chunk_hdr.size)) { PBL_LOG(LOG_LEVEL_ERROR,...
(prv_int_exti_cb)
; prv_core_dump_main(); } dialog_spi_deinit(); vSemaphoreDelete(s_spi_dma_semph); vSemaphoreDelete(s_spi_int_semph); } void core_dump_and_reset_or_reboot(void) { prv_core_dump(); #if REBOOT_ON_BT_CRASH RebootReason reboot_reason = { .code = RebootReasonCode_BtCoredump, }; ...
NotDisturbScheduleConfigKeys s_dnd_schedule_keys[NumDNDSchedules] = { [WeekdaySchedule] = { .schedule_pref_key = "dndWeekdaySchedule", .enabled_pref_key = "dndWeekdayScheduleEnabled", }, [WeekendSchedule] = { .schedule_pref_key = "dndWeekendSchedule", .enabled_pref_key = "dndWeekendScheduleEnabled...
prv_return_default_if_invalid(s_vibe_score_incoming_calls, DEFAULT_VIBE_SCORE_INCOMING_CALLS)
; s_vibe_score_alarms = prv_return_default_if_invalid(s_vibe_score_alarms, DEFAULT_VIBE_SCORE_ALARMS); } static void prv_set_vibe_scores_based_on_legacy_intensity(VibeIntensity intensity) { if (intensity == VibeIntensityHigh) { s_vibe_score_notifications = ...
alert_mask = alerts_get_mask(); // Get the connectivity ResourceId uint32_t new_connectivity_icon_id = RESOURCE_ID_INVALID; if (bt_ctl_is_airplane_mode_on()) { new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_AIRPLANE_MODE; } else if (do_not_disturb_is_active()) { new_connectivity_icon_id...
kino_layer_set_alignment(&data->connectivity_icon, GAlignLeft)
; layer_add_child(&window->layer, kino_layer_get_layer(&data->connectivity_icon)); kino_layer_init(&data->battery_icon, &GRect(DISP_COLS - kino_width - kino_padding, 0, kino_width, STATUS_BAR_LAYER_HEIGHT)); kino_layer_set_alignment(&data->battery_icon, GAlignRight); ...
)); ios_notif_pref_db_insert(key, sizeof(key), val, sizeof(val)); uint32_t flags = ios_notif_pref_db_get_flags(key, sizeof(key)); cl_assert_equal_i(flags, 0); } void test_ios_notif_pref_db__store_prefs(void) { // Create an attribute list and action group AttributeList attr_list; attribute_list_init_list(...
ios_notif_pref_db_is_dirty(&is_dirty)
, S_SUCCESS); cl_assert(is_dirty); BlobDBDirtyItem *dirty_list = ios_notif_pref_db_get_dirty_list(); cl_assert(dirty_list); cl_assert(list_count((ListNode *)dirty_list) == ARRAY_LENGTH(keys)); // Mark some items as synced ios_notif_pref_db_mark_synced((uint8_t *)keys[0], key_len); ios_notif_pref_db_mark...
_card_view_show_select_indicator[health_card_view->current_card_index]( card_layer); layer_set_hidden(&health_card_view->select_indicator_layer, is_hidden); } static void prv_content_indicator_setup_direction(HealthCardView *health_card_view, ContentIndicator ...
layer_set_hidden(health_card_view->card_layers[i], true)
; } } if (!finished) { prv_set_window_background_color(health_card_view); } else { prv_refresh_select_indicator(health_card_view); prv_refresh_content_indicators(health_card_view); } } static const AnimationImplementation prv_bg_animation_implementation = { .update = &prv_bg_animation_upda...
hunk_id = s_current_chunk_id }; flash_write_bytes((const uint8_t*) &chunk_header, get_current_address(s_current_chunk, 0), sizeof(chunk_header)); s_current_offset = sizeof(LogChunkHeader); } static void make_space_for_log(int length) { if (s_current_offset + sizeof(LogHeader) + length + sizeof(LogHeader) < CH...
(num_valid_chunks != 0)
; return true; } void flash_logging_set_enabled(bool enabled) { s_enabled = enabled; }
.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 writing, software * distributed under the License is distributed on an "AS IS" ...
dict_read_next(&iter)
; } return success; } static void prv_send_ack_nack_reply(CommSession *session, const uint8_t transaction_id, bool ack) { const AppMessageAck nack_message = { .header = { .command = ack ? CMD_ACK : CMD_NACK, .transaction_id = transaction_id, }, }; comm_session_send_data(session, LAUNCHER...
/* * 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...
{ mutex_lock_with_timeout(global_lock); mutex_unlock(global_lock); }
HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, update_interval_s, expire_s, features); fake_system_task_callbacks_invoke_pending(); // Should start out enabled before we get the first good reading cl_assert_equal_b(hrm_is_enabled(HRM...
cl_assert(hrm_is_enabled(HRM))
ack.h" // Helper Functions ///////////////////// #include "fw/graphics/util.h" // Setup and Teardown //////////////////////////////////// static GContext s_ctx; static FrameBuffer *fb = NULL; GContext *graphics_context_get_current_context(void) { return &s_ctx; } void test_timeline_layouts__initialize(void) { ...
{ const TimelineLayoutTestConfig config = (TimelineLayoutTestConfig) { .layout_id = LayoutIdGeneric, .title = "Delfina Pizza", .subtitle = "Open Table Reservation", .location_name = "145 Williams\nJohn Ave, Palo Alto", .body = "Body message", .icon_timeline_res_id = TIMELINE_RESOURCE_DINNER_RE...
void test_timeline_layouts__weather(void) { const TimelineLayoutTestConfig config = (TimelineLayoutTestConfig) { .layout_id = LayoutIdWeather, .title = "The Greatest Sunrise Ever", .subtitle = "90°/60°", .location_name = "Redwood City", .body = "A clear sky. Low around 60F.", .icon_timeline_...
/* * 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 (!iterator_func(node, ctx)) { return false; }
; if (!layer_process_tree_level(node->first_child, ctx, iterator_func)) { return false; }; node = node->next_sibling; } return true; } void layer_process_tree(Layer *node, void *ctx, LayerIteratorFunc iterator_func) { layer_process_tree_level(node, ctx, iterator_func); } inline static Layer _...
/* * 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...
is_app_file_name(filename)
) { return INSTALL_ID_INVALID; } return app_file_parse_app_id(filename); }
/* * 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...
syscall_internal_elevate_privilege()
; do_stuff(buffer, size); } void if_syscall(void * buffer, int size) { if (syscall_internal_elevate_privilege()) { syscall_assert_userspace_buffer(buffer, size); } do_stuff(buffer, size); } void wrapper() { void * buffer = NULL; int size = 0; good_syscall(buffer, size); // This tests to make sure...
ASSERT(emx_resources_get_size(1, id_1) == 0)
; emx_resources_remove_custom(id_3); ASSERT(emx_resources_get_size(1, id_3) == 0); // verify 4 is ok buf = 0; ASSERT(emx_resources_read(1, id_4, 0, (uint8_t *)&buf, 1) == 4); ASSERT(buf == 4); ASSERT(s_read_4_called == 2); // remove 4 emx_resources_remove_custom(id_4); ASSERT(emx_resources_get_size...
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 and * limitations under the License. */ #include "clar.h" #include "fixtures/load_te...
strcmp(second, "Activé")
== 0); const char *third = i18n_get(ctxt_txt_1, __FILE__); cl_assert(third == first); const char *fourth = i18n_get(ctxt_txt_2, __FILE__); cl_assert(fourth == second); i18n_free(ctxt_txt_1, __FILE__); cl_assert(prv_list_find_string(ctxt_txt_1, __FILE__) == NULL); i18n_ctx_free("Quiet Time", "Enabled", _...
/ #include "applib/cpu_cache.h" #include "mcu/cache.h" #include "clar.h" // Fakes ////////////////////////////////////////////////////////// static uintptr_t s_user_start, s_user_size; static size_t s_flush_size, s_invalidate_size; static uintptr_t s_flush_addr, s_invalidate_addr; typedef enum { UserSpaceBuffer_U...
(dcache_is_enabled, true)
; cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_size, 1); cl_will_return(syscall_internal_check_return_address, false); s_user_start = 0x00; s_user_size = 0x04; memory_cache_flush((void*)0x00, 0x10); cl_assert_equal_i(s_flush_addr, 0x00); cl_assert_equal_i(s_flush_size, 0x10); cl...
{ 64, 24, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 64, 16, -1000}, { 56, 24, -1000}, { 64, 16, -1000}, { 64, 16, -1000}, { 64, 16, -1000}, { 64, 16, -992}, { 64, 24, -1000}, { 64, 16, -1000}, { 64, 16, -1000}, { 64, 16, -992}, { 64, 16, -100...
{ 56, 8, -1008}, { 56, 24, -1000}, { 56, 16, -1000}, { 64, 16, -1008}, { 56, 16, -1000}, { 56, 16, -1008}, { 56, 24, -992}, { 56, 16, -1000}, { 56, 16, -1000}, { 56, 24, -1000}, { 56, 24, -1000}, { 56, 24, -1000}, { 56, 24, -1000}, { 56, 24, -1008}, { 64, 16, ...
{ 64, 24, -1000}, { 64, 16, -1000}, { 56, 24, -1000}, { 56, 16, -1008}, { 56, 16, -1000}, { 64, 24, -1000}, { 56, 16, -1000}, { 64, 24, -1008}, { 56, 16, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 56, 16, -1000}, { 64, 16, -1000}, { 56, 16, -1000}, { 56, 1...
_remove__callcount++; } int s_prv_listener_a1__callcount; JERRY_FUNCTION(prv_listener_a1) { s_prv_listener_a1__callcount++; return jerry_create_undefined(); } int s_prv_listener_a2__callcount; JERRY_FUNCTION(prv_listener_a2) { s_prv_listener_a2__callcount++; return jerry_create_undefined(); } int s_prv_liste...
("_rocky.off('foo', f1);\n")
; cl_assert_equal_i(1, s_prv_api_remove__callcount); cl_assert_equal_b(false, rocky_global_has_event_handlers("foo")); } void prv_add_event_listener_to_list(const char *event_name, jerry_value_t listener); int jerry_obj_refcount(jerry_value_t o); void test_rocky_api_global__refcount(void) { jerry_value_t o = je...
pyright 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 writin...
strlen(filename)
/// #include "stubs_heap.h" #include "stubs_hexdump.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_syscal...
(tmbuf, "\n 01:00:00 PM")
; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%R %t %T", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "13:00 \t 13:00:00"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%u %V", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "5 01"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%z",...