prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
imer_id()), 1800 * MS_PER_SECOND); rtc_set_time(s_saturday_00_30); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at 01:00 on Saturday. (0.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_SECOND...
(get_dnd_timer_id())
, 36000 * MS_PER_SECOND); rtc_set_time(s_saturday_10_30); do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at 01:00 on Sunday. (13.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 48600 * MS_PER_SECOND); rtc...
handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATIO...
animation_set_duration(b, duration_b)
t_palette_1bit__2bit_palette_to_1bit_assign(void) { GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt_palette_1bit__2bit_palette_to_1bit.pbi"); bitblt_bitmap_into_bitmap(&s_dest_bitmap, src_bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(&s_dest_bitmap, "test...
(graphics_private_get_1bit_grayscale_pattern(GColorDarkGray, 1), 0xAAAAAAAA)
ssert_equal_m(&irk_out, &pairing.irk, sizeof(irk_out)); } void test_bluetooth_persistent_storage_prf__delete_ble_pairing_by_id(void) { bool ret; // Output variables SMIdentityResolvingKey irk_out; BTDeviceInternal device_out; // Store a pairing SMPairingInfo pairing = (SMPairingInfo) { .irk = (SMIde...
bt_persistent_storage_get_bt_classic_pairing_by_id(id_1, &addr_out, &link_key_out, name_out, &platform_bits_out)
MM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMM...
(new_dialog, "")
; dialog_set_text(new_dialog, string); Window *window = &new_dialog->window; window_set_window_handlers(window, &(WindowHandlers) { .load = prv_dialog_load, .unload = prv_dialog_unload, .appear = prv_dialog_appear, }); window_set_user_data(window, new_dialog); dialog_push(new_dialog, stack); } ...
ed. mbuf_clear_next(&s_header_mbuf); smartstrap_state_unlock(); return; } // All other tasks and ISRs will be blocked while we are in the ReadComplete state and while we // hold the state lock, so we're free to access / modify static variables until we transition // the state back to ReadReady. S...
smartstrap_fsm_state_set(SmartstrapStateReadComplete)
; ReadCompleteContext context = { .success = true, .is_notify = is_notify }; system_task_add_callback_from_isr(prv_read_complete_system_task_cb, context.context_ptr, should_context_switch); } else { // Reset our context so we can try again to receive a...
/* * 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...
(RCC->AHB1ENR, (0x1 << idx))
; // Init the flash hardware flash_hw_init(); // Make sure we are not in deep sleep prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_WAKE); prv_flash_end_cmd(); // See if we can successfully access the flash // TODO: Will we successfully recover if the flash HW was left midstream in a...
greed 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 and * limitations under the License. */ #include "applib/graphics/graphics....
test_graphics_context_reset(&ctx, fb)
/* * 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 (void*)&p[i]; }
} return NULL; }
ceId card_icon) { const time_t now = rtc_get_time(); time_t target = now + delta_time_s; if (is_all_day) { target = time_util_get_midnight_of(target); duration_m = ((duration_m - 1) / MINUTES_PER_DAY + 1) * MINUTES_PER_DAY; } AttributeList list = {}; prv_set_timeline_icon(&list, icon ?: TIMELINE_RE...
{ const time_t now = rtc_get_time(); AttributeList list = {}; attribute_list_add_uint32(&list, AttributeIdIconPin, TIMELINE_RESOURCE_RUN); attribute_list_add_uint32(&list, AttributeIdIconTiny, TIMELINE_RESOURCE_PACE); attribute_list_add_uint8(&list, AttributeIdHealthInsightType, Ac...
pin_db_insert_item_without_event(item); timeline_item_destroy(item); attribute_list_destroy_list(&list); } static void prv_launch_timeline(void) { app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = APP_ID_TIMELINE }); } static void prv_launch_notifications(void) { app_manager_put_launch_app_e...
se AppInstallStorageResources: rv = prv_app_install_entry_from_resource_registry_entry(reg_entry, entry); break; case AppInstallStorageInvalid: case AppInstallStorageFlash: PBL_LOG(LOG_LEVEL_DEBUG, "Invalid app registry type %d", reg_entry->type); break; } if (rv) { ...
{ if (!md) { return; } switch (md->process_storage) { case ProcessStorageBuiltin: break; case ProcessStorageFlash: case ProcessStorageResource: kernel_free((PebbleProcessMd*) md); } }
static void prv_enumerate_app_db_delete(AppInstallId install_id, AppDBEntry *db_entry, void *data) { PBL_ASSERTN(app_install_id_from_app_db(install_id)); task_watchdog_bit_set(pebble_task_get_current()); const bool gracefully = true; if (app_manager_get_current_app_id() == install_id) { process_manag...
ase_layer); } static void prv_update_current_steps(KickstartData *data) { data->current_steps = health_service_sum_today(HealthMetricStepCount); prv_update_steps_buffer(data); } static void prv_update_typical_steps(KickstartData *data) { data->typical_steps = health_service_sum_averaged(HealthMetricStepCount, ...
fonts_get_system_font(FONT_KEY_AGENCY_FB_60_NUMBERS_AM_PM)
; data->am_pm_font = fonts_get_system_font(FONT_KEY_AGENCY_FB_60_THIN_NUMBERS_AM_PM); #else #error "Undefined screen size" #endif // ROBERT_SCREEN_RES #endif // PBL_BW Layer *window_layer = window_get_root_layer(window); // set window background window_set_background_color(window, GColorBlack); // set up t...
on(expandable_dialog, BUTTON_ID_DOWN); } else if (offset.y + content_size.h <= bounds->size.h) { // Hide the down arrow as we've reached the bottom. action_bar_layer_clear_icon(action_bar, BUTTON_ID_DOWN); } } static void prv_up_click_handler(ClickRecognizerRef recognizer, void *context) { ExpandableDial...
text_layer_init_with_parameters(header_layer, &GRect(x, y, w, header_content_height), expandable_dialog->header, header_font, dialog->text_color, GColorClear, alignment, GTextOverflowModeWordWrap)
/* * 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...
{ const uint32_t battery_base_resource_id = (charge_state.is_charging || charge_state.is_plugged) ? RESOURCE_ID_TINTIN_LAUNCHER_CHARGING_5_PERCENT : RESOURCE_ID_TINTIN_LAUNCHER_BATTERY_5_PERCENT; if (charge_state.charge_percent ...
static void prv_reload_status_bar_icons(LauncherMenuData *data) { // Draw airplane mode, do not disturb, or silent status icon. AlertMask 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_c...
MINUTES_PER_HOUR, .type = ActivitySessionType_Sleep, }, }; uint16_t session_entries = ARRAY_LENGTH(sessions); activity_algorithm_post_process_sleep_sessions(session_entries, sessions); cl_assert_equal_i(sessions[0].type, ActivitySessionType_Nap); cl_assert_equal_i(sessions[1].type, A...
(&steps_awake_120m)
; // We should get steps counted while not sleeping printf("\nWhile awake: "); printf("\n Counted %d steps first 60m", steps_awake_60m); printf("\n Counted %d steps next 40m", steps_awake_100m - steps_awake_60m); printf("\n Counted %d steps last 20m", steps_awake_120m - steps_awake_100m); printf("\n To...
ed; remote->type = StoredRemoteTypeBTDual; remote->dual.classic.connected = classic_connected; // Note: We update remote->dual.ble.connected outside this cb remote->dual.ble.bonding = *id; } else { // Remote for which we only have a BLE key, add it in the menu as well, so it is accessible // a...
{ settings_bluetooth_update_remotes_private(settings_data); settings_menu_mark_dirty(SettingsMenuItemBluetooth); break; }
bytes) { DLSChunkHeader chunk_hdr; // Reached the end of the file? // NOTE: we don't do this check if we are scanning for the last written byte (buffer == NULL) if (buffer) { if (read_offset >= logging_session->storage.write_offset) { break; } } // Read the chunk header ...
(logging_session->storage.fd, logging_session->storage.read_offset, FSeekSet)
) { consumed_bytes = -1; // error goto exit; } if (!prv_pfs_write(logging_session->storage.fd, &chunk_hdr, sizeof(chunk_hdr))) { consumed_bytes = -1; // error goto exit; } if (logging_session->storage.num_bytes < chunk_hdr.num_bytes) { PBL_LOG(LOG_LE...
ther express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "test_jerry_port_common.h" #include "test_rocky_common.h" #include "applib/rockyjs/api/rocky_api_global.h" #include "applib/rockyjs/api/rocky_api_watchinfo.h...
("suffix", VERSION_SUFFIX)
; }
, .parent_id = {0}, .timestamp = 1421183462, // Tue Jan 13 13:11:02 PST 2015 .duration = 4, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, }, .attr_list = { .num_attributes = 0, .attributes = NULL, }, .action_group = { ...
cl_assert(timeline_model_iter_next(&new_idx, &has_next))
; cl_assert(has_next); cl_assert_equal_i(new_idx, 5); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model...
try->cursor->begin; } static void move_cursor_to_active_registry(Registry* registry) { // Search for an active registry, starting at the start of the registry sector // in flash (`REGISTRY_FLASH_BEGIN`). // If cursor loops back to the start of the registry sector, then the // entire sector has been scanned and...
{ if (record_compare(r, key, key_length, uuid)) { return i; } }
} return -1; } Record* registry_private_get(const char* key, const uint8_t key_length, const uint8_t* uuid, Registry* registry) { const int idx = record_get_index(key, key_length, uuid, registry); PBL_ASSERTN(idx < registry->num_records); if (idx >= 0) { return registry->r...
ent.smartstrap.attribute = mbuf_get_data(&attr->mbuf); if (type == SmartstrapDataReceivedEvent) { PBL_ASSERTN(attr->state == SmartstrapAttributeStateRequestInProgress); prv_set_attribute_state(attr, SmartstrapAttributeStateIdle); if (attr->request_type == SmartstrapRequestTypeWrite) { // the data we...
(s_attr_list_lock)
; SmartstrapAttributeInternal *attr; FOREACH_VALID_ATTR(attr) { // At this point, the app is closing so there's no point in freeing the buffers, and doing so // will crash the watch if the app had crashed (and the heap has already been cleaned up). prv_queue_deferred_delete(attr, false /* !do_free */); ...
ORIGIN_DRAW_RECT_NO_CLIP, 2, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); // TODO: Remove these #ifdefs in PBL-15916 when support for non-antialiased rounded rect #if SCREEN_COLOR_DEPTH_BITS == 8 // TODO: Fix left corners PBL-15915 setup_test_a...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1)
annel_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_Channel_TempSensor, .clock_ctrl = RCC_APB2Periph_ADC1, // .input not applicable }; VoltageMo...
(&I2C_MFI_BUS)
; spi_slave_port_init(BMI160_SPI); voltage_monitor_device_init(VOLTAGE_MONITOR_ALS); voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY); }
const PropertyAnimationImplementation *impl, void *subject); static void prv_handle_stop_transition(VoiceUiData *data); static void prv_voice_window_push(VoiceUiData *data); char *sys_voice_get_transcription_from_event(PebbleVoiceServiceEvent *e, char *buffer...
dialog_set_destroy_on_pop(dialog, false /* free_on_pop */)
; } static void prv_push_error_dialog(VoiceUiData *data, const char *text, uint32_t resource_id, GColor color) { prv_set_mic_window_state(data, StateError); SimpleDialog *simple_dialog = &data->short_error_dialog; simple_dialog_init(simple_dialog, "Dictation Error"); Dialog *dialog = simple_dialog_get_dia...
}; static const LayoutNodeConfig * const s_horizontal_config_nodes[] = { &s_number_config.text.extent.node, &s_word_config.text.extent.node, }; static const LayoutNodeHorizontalConfig s_horizontal_config = { .container.extent.node.type = LayoutNodeType_Horizontal, .container.num_nodes = ARRAY_L...
(TIMELINE_LAYER_TEXT_ALIGNMENT)
, }; GTextNodeText *primary_node = (GTextNodeText *)layout_create_text_node_from_config( &layout->layout_layer, &s_primary_config.extent.node); primary_node->text = attribute_get_string(attributes, AttributeIdShortTitle, NULL) ?: attribute_get_string(attributes, layout->...
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 and * limitations under the License. */ #in...
{ layer_deinit(&action_bar_layer->layer); }
void action_bar_layer_legacy2_destroy(ActionBarLayerLegacy2 *action_bar_layer) { if (action_bar_layer == NULL) { return; } action_bar_layer_legacy2_deinit(action_bar_layer); task_free(action_bar_layer); } Layer* action_bar_layer_legacy2_get_layer(ActionBarLayerLegacy2 *action_bar_layer) { return &actio...
rollable_metrics, &s_sports_data, &s_sports_controller); prv_create_window_and_render(active_window, 0); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__sports_hr_z0(void) { s_sports_data = (SportsData) { .current_bpm = 71, .duration_string = "30:00", .d...
prv_create_window_and_render(active_window, 1)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__sports_custom_long_values(void) { s_sports_data = (SportsData) { .current_bpm = 71, .duration_string = "30:00", .distance_string = "5.0", .pace_string = "6:00", .custom_label_string = "CUSTOM FIELD LABEL"...
handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped...
(b, delay_b)
-872}, { 64, -240, -784}, { -112, 200, -840}, { -96, 304, -912}, { 40, 248, -704}, { 232, -8, -584}, { 288, -384, -400}, { 168, -16, -840}, { 120, 272, -1024}, { 192, 672, -1072}, { 112, 600, -776}, { -88, 920, -832}, { 168, 992, -136}, { 128, 568, -208}, { 448, ...
// 86 seconds { 328, 712, 872}, { 360, 960, 1040}, { 392, 888, 944}, { 544, 672, 640}, { 464, 488, 656}, { 488, 424, 624}, { 272, 384, 408}, { 128, 224, 296}, { -16, 256, 200}, { -136, 272, 160}, { -288, 224, 152}, { -496, 184, 160}, { -784, 112, 96}, { -3088,...
{ -1184, -64, 392}, { -984, 144, 168}, { -944, 144, 160}, { -896, 56, 200}, { -800, 56, 184}, { -784, 88, 168}, { -976, 88, 168}, { -1000, -40, 128}, { -1256, 0, 88}, // 89 seconds { -1368, 376, -56}, { -1392, 496, -104}, { -1192, 440, -48}, { -1168, 144, 120}, ...
strncpy(timezone_abbr, sys_tz, TZ_LEN); } struct tm *sys_gmtime_r(const time_t *timep, struct tm *result) { return gmtime_r(timep, result); } struct tm *sys_localtime_r(const time_t *timep, struct tm *result) { return localtime_r(timep, result); } // i18n dummies //////////////////////////////////// static boo...
strftime(tmbuf, sizeof(tmbuf), "%k %l", &jan_2_2015__13_00_00)
; cl_assert_equal_s(tmbuf, "13 1"); #endif tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%H %I", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "13 01"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%j %m %M %p", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "002 01 00 PM"); #if EXTENSION_...
mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_process_info.h" #include "stubs_pebble_tasks.h" #include "stubs_pin_db.h" #include "stubs_process_manager.h" #include "stubs_prompt.h" #include "stubs_property_animation.h" #include "stubs_scroll_layer.h" #include "stubs_serial.h" ...
timeline_item_create_with_attributes(timestamp, MINUTES_PER_HOUR, TimelineItemTypePin, LayoutIdGeneric, &list, NULL)
; attribute_list_destroy_list(&list); } timeline_peek_set_item(item, timestamp >= now, config ? config->num_concurrent : 0, false /* first */, animated); return item; } static void prv_render_timeline_peek(const TimelinePeekItemConfig *config) { TimelineItem *item = prv_set_timelin...
/* * 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...
(app_num, resource_id, &resource)
; if (resource.id < 1) { mutex_unlock_recursive(s_resource_mutex); return 0; } if (offset + num_bytes > resource.length) { if (offset >= resource.length) { // Can't recover from trying to read from beyond the resource. Read nothing. mutex_unlock_recursive(s_resource_mutex); return 0...
ivityMetricHeartRateZone1Minutes, 1, &zone1_minutes); cl_assert_equal_i(zone1_minutes, 1); activity_get_metric(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes); cl_assert_equal_i(zone2_minutes, 1); activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes); cl_assert_equal_i(zone3_minu...
activity_private_state()
f(int8_t), sizeof(int16_t), sizeof(int32_t), 0, strlen(SOME_EMPTY_STRING) + 1); const uint32_t surplus = 16; // allocate more than nee...
(tuple->value->cstring[strlen(SOME_EMPTY_STRING)] == 0)
p_manager.h" #include "drivers/flash.h" #include "flash_region/flash_region.h" #include "kernel/pbl_malloc.h" #include "os/mutex.h" #include "services/normal/process_management/app_storage.h" #include "system/logging.h" #include "system/passert.h" // TODO: this may be replaced once apps become more dynamic typedef st...
{ mutex_lock_recursive(s_resource_mutex); ResourceStoreEntry resource; prv_get_resource(app_num, resource_id, &resource); mutex_unlock_recursive(s_resource_mutex); return resource.length; }
bool resource_bytes_are_readonly(void *bytes) { return resource_storage_builtin_bytes_are_readonly(bytes) || resource_storage_flash_bytes_are_readonly(bytes); } const uint8_t *resource_get_readonly_bytes(ResAppNum app_num, uint32_t resource_id, size_t *num_bytes_...
back(); rtc_set_time(rtc_get_time() + SECONDS_PER_MINUTE); prv_clear_event_queue(); } } // ------------------------------------------------------------------------------- static void prv_test_steps(void *context) { bool passed = false; // Reset all stored data activity_test_reset(true /*reset_setting...
activity_get_metric(ActivityMetricSleepRestfulSeconds, 1, &deep_sleep)
; deep_sleep -= before_deep; PBL_LOG(LOG_LEVEL_DEBUG, "total: %d, deep: %d", (int)total_sleep / SECONDS_PER_MINUTE, (int)deep_sleep / SECONDS_PER_MINUTE); const int k_min_total_sleep_min = 240; const int k_max_total_sleep_min = 280; const int k_min_deep_sleep_min = 40; const int k_max_deep_sleep_...
opyright 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 writi...
memset(data_out, 0, data_out_size)
indow_push(data->active_window); } static void prv_start_workout_cb(ActivitySessionType type) { workout_service_start_workout(type); prv_prep_and_open_active_window(type); } static void prv_select_workout_cb(ActivitySessionType type) { WorkoutAppData *data = app_state_get_user_data(); s_activity_type = type;...
workout_summary_window_create(s_activity_type, prv_start_workout_cb, prv_select_workout_cb)
int32_t metric_values[ACTIVITY_HISTORY_DAYS] = {0}; // Set today's value activity_metrics_prv_set_metric(ActivityMetricStepCount, Thursday, 1111); // Set yesterday's value activity_metrics_prv_set_metric(ActivityMetricStepCount, Wednesday, 2222); // Set last friday value activity_metrics_prv_set_metr...
(false /*test_mode*/)
; fake_system_task_callbacks_invoke_pending(); // No sessions active, ensure that asking if a run is ongoing returns false cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Run)); cl_assert_equal_i(0, health_service_peek_current_activities()); // Start on known boundary ...
istributed 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 "text_flow.h" #include "applib/app.h" #include "applib/fonts/fonts.h" #include "applib/ui/ui...
(&data->scroll_layer, true)
; // Trim text layer and scroll content to fit text box scroll_layer_set_content_size( &data->scroll_layer, GSize(scroll_bounds.size.w, max_size_1.h + max_size_2.h)); } static void push_window(struct AppState *data) { Window* window = &data->window; window_init(window, WINDOW_NAME("Text Flow")); window_s...
x7f, 0x00, 0x18, 0x00, 0x7f, 0x00, 0x1f, 0x00, /* bytes 16 - 32 */ 0x7f, 0xf0, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, /* bytes 32 - 48 */ 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, /* bytes 48 - 64 */ 0x7f, 0xfc, 0x1...
(menu_layer, data, &(MenuLayerCallbacks) { .get_num_sections = (MenuLayerGetNumberOfSectionsCallback) get_num_sections_callback, .get_num_rows = (MenuLayerGetNumberOfRowsInSectionsCallback) get_num_rows_callback, .get_header_height = (MenuLayerGetHeaderHeightCallback) get_header_height_callback, .draw_r...
; menu_layer_set_click_config_onto_window(menu_layer, window); layer_add_child(&window->layer, menu_layer_get_layer(menu_layer)); } static void push_window(AppData *data) { Window *window = &data->window; window_init(window, WINDOW_NAME("Demo Menu")); window_set_user_data(window, data); window_set_window_h...
have space for the model. mfg_info_set_model("test_model"); cl_assert_equal_i(mfg_info_get_disp_offsets().x, -2); cl_assert_equal_i(mfg_info_get_disp_offsets().y, 1); cl_assert_equal_i(mfg_info_get_watch_color(), 3); cl_assert_equal_i(mfg_info_get_rtc_freq(), 4); mfg_info_get_model(buffer); cl_a...
mfg_info_update_constant_data()
; flash_read_bytes(fpga_buffer, BOOT_FPGA_FLASH_ADDR, sizeof(fpga_buffer)); cl_assert(memcmp(fpga_buffer + HEADER_SIZE, s_boot_fpga, sizeof(s_boot_fpga)) == 0); }
MAX || raw_y < INT16_MIN || raw_x > INT16_MAX) { return rocky_error_argument_invalid("Value out of bounds"); } TRY_ALLOCATE_STEPS_OR_RETURN_ERROR(1); s_rocky_path_steps[s_rocky_path_steps_num++] = (RockyAPIPathStep) { .type = step_type, .pt.xy = GPointPrecise((int16_t)raw_x, (int16_t)raw_y), }; ...
(center.x)
, ROCKY_ARG(center.y), ROCKY_ARG(radius), ROCKY_ARG_ANGLE(angle_1), ROCKY_ARG_ANGLE(angle_2)); TRY_ALLOCATE_STEPS_OR_RETURN_ERROR(1); const bool anti_clockwise = (argc >= 6) ? jerry_get_boolean_value(argv[5]) : false; // adjust for coordinate system center.x.raw_value -= FIXED_S16_3_HALF.raw_...
{ s_nack_sent_is_called = true; prv_send_ack_nack(endpoint_id, data, length, true); }
static void prv_ack_sent_callback(uint16_t endpoint_id, const uint8_t* data, unsigned int length) { s_ack_sent_is_called = true; prv_send_ack_nack(endpoint_id, data, length, false); } static void prv_receive_test_data(uint8_t transaction_id, const bool oversized) { const uint16_t dict_length = dict_calc_buffer...
#include "system/passert.h" #include "util/attributes.h" #include "util/math.h" #include "util/trig.h" // Window transition implementations ////////////////////////////////////// static uint16_t prv_window_distance_from_screen_bounds(const Window *window) { const GPoint origin = window->layer.frame.origin; retur...
(window_to)
; } } static Animation *prv_window_transition_create_animation(WindowTransitioningContext *context) { static AnimationImplementation const impl = { .setup = prv_window_transition_animation_setup, .update = prv_window_transition_animation_update, }; Animation *animation = animation_create(); animatio...
has alternating white / black lines. // - Dest is Blue, 100x100. // - Dest offset is set to 8x10 clipped in the bottom right corner. // Result: // - There should be an 8x10 alternating black & white lines in the bottom right corner. void test_bitblt__1bit_to_8bit_clipping(void) { GBitmap *src_bitmap = get_gbitm...
bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, src_bitmap, dest_rect, src_origin_offset, GCompOpAssign, GColorWhite)
; cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_dest_origin_offset_clip-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Setup: // - Source width is 32 pixels (ie. a word in source) // - Source starts with 2 rows and 4 columns of black pixels. // - Dest ...
, { 424, 536, -768}, { 504, 552, -728}, { 456, 448, -616}, { 472, 640, -648}, { 496, 568, -728}, { 416, 352, -656}, { 472, 528, -680}, { 456, 528, -720}, { 456, 560, -648}, { 488, 512, -720}, { 472, 512, -704}, { 480, 480, -712}, { 464, 432, -744}, { 464, 472, -73...
{ 456, 480, -728}, { 448, 480, -728}, { 456, 464, -720}, { 448, 496, -736}, { 440, 472, -728}, { 440, 480, -744}, { 448, 456, -736}, { 440, 496, -704}, { 456, 496, -752}, // 104 seconds { 432, 432, -736}, { 440, 496, -728}, { 456, 464, -728}, { 456, 496, -704}, ...
{ 424, 552, -696}, { 488, 544, -688}, { 488, 592, -624}, { 456, 544, -672}, { 456, 456, -720}, { 432, 544, -688}, { 440, 480, -712}, { 440, 480, -728}, { 432, 520, -664}, { 488, 512, -712}, { 456, 512, -696}, { 456, 528, -688}, { 448, 488, -688}, { 464, 624, -712...
/* * 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...
{ dbgserial_newline(); }
else if (*str != '\r') { s_message_buffer[s_message_length++] = *str; } } } void dbgserial_newline(void) { uint32_t crc; size_t raw_length = sizeof(PulseFrame) + sizeof(PushPacket) + sizeof(s_message_header) + s_message_length + sizeof(crc); unsigned char raw_packet[raw_length]...
D / rate), .samples_per_update = ACCEL_MAX_SAMPLES_PER_UPDATE, }; bool no_subscribers_before = (s_data_subscribers == NULL); s_data_subscribers = list_insert_before(s_data_subscribers, &state->list_node); if (no_subscribers_before) { sys_vibe_history_start_collecting(); } // Add as...
(bool, sys_accel_manager_consume_samples, AccelManagerState *state, uint32_t samples)
{ bool success = true; mutex_lock_recursive(s_accel_manager_mutex); if (samples > state->num_samples) { PBL_LOG(LOG_LEVEL_ERROR, "Consuming more samples than exist %d vs %d!", (int)samples, (int)state->num_samples); success = false; } else if (samples != state->num_samples) { PBL_LOG(L...
5); ASSERT_JS_GLOBAL_EQUALS_I("uot", 6); ASSERT_JS_GLOBAL_EQUALS_I("uow", 7); ASSERT_JS_GLOBAL_EQUALS_I("uoh", 8); } static const jerry_value_t prv_global_init_and_set_ctx(void) { rocky_global_init(s_graphics_api); // make this easily testable by putting it int JS context as global Layer l = {.bounds = G...
{ prv_global_init_and_set_ctx(); EXECUTE_SCRIPT_EXPECT_ERROR( "ctx.rockyFillRadial(4096, 40, 10, 20, 0, false);\n", "TypeError: Argument at index 0 is invalid: Value out of bounds for native type" ); }
void test_rocky_api_graphics__fill_radial_zero_radius(void) { prv_global_init_and_set_ctx(); // inner radius = 0 EXECUTE_SCRIPT( "ctx.rockyFillRadial(30, 40, 0, 20, 0, Math.PI);\n" ); MockCallRecording *const lc = &s_graphics_fill_radial_precise_internal.last_call; cl_assert_equal_i(1, s_graphics_fill...
/* * 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...
{ font_height = 14; }
return (height / 2) - (font_height / 2) - font_top_padding; } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Drawing the layer typedef struct { GCornerMask corner_mask; uint16_t corner_radius; } CellCornerInfo; static CellCornerInfo prv_get_cell_corner...
cations.h" #include "services/normal/timeline/timeline.h" #include "system/logging.h" #include "system/passert.h" #include "util/pstring.h" #include <stdio.h> static const Uuid uuid_reminders_data_source = UUID_REMINDERS_DATA_SOURCE; static void prv_dismiss_notification(const TimelineItem *notification) { const Ti...
(&reminder)
orkout_active_create_tripple_layout( top_metric, middle_metric, ARRAY_LENGTH(scrollable_metrics), scrollable_metrics, &s_sports_data, &s_sports_controller); prv_create_window_and_render(active_window, 0); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__sports_sp...
(active_window, 1)
7] = {true, false, true, false, false, true, true}; id = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &custom_schedule1 }); prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_CUSTOM, custom_schedule1); alarm_set_kind(id, ALARM_KIND_WEEKDAYS); prv_assert_ala...
bool schedule_8[7] = {false, false, false, false, false, false, true}; char alarm_day_text_8[32] = {0}; alarm_get_string_for_custom(schedule_8, alarm_day_text_8); cl_assert_equal_s(alarm_day_text_8, "Saturdays"); bool schedule_9[7] = {true, false, false, false, false, false, false}; char alarm_day_text_9[3...
ek_current_activities()); // Delete session activity_sessions_prv_delete_activity_session(&sleep_session); // Flip the switch to say we are in an awake state. activity_private_state()->sleep_data.cur_state = ActivitySleepStateAwake; // Sleep session ended, ensure that asking if a Sleep is ongoing returns f...
(zone2_minutes, 0)
((const uint32_t [ACTIVITY_HISTORY_DAYS]){2 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepRestfulSeconds, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){1 * SECONDS_PER_MINUTE, 0, 0, 0, 0, 0, 0})); // The actual resting calories must be in the range from min_resti...
ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricDistanceMeters, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, exp_distance, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricActiveKCalories, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, exp_active_kcalories, 0, 0, 0, 0, 0})); ASSERT_EQUAL_METRIC_HI...
_card.dialog_text, sizeof(data->debug_card.dialog_text), "Not enough memory"); return; } // Get sessions bool success = activity_get_sessions(&num_sessions, sessions); if (!success) { snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "Error getting a...
if (!minute_data) { snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "Out of memory"); prv_display_alert(data->debug_card.dialog_text); goto exit; }
// Start as far back as 30 days ago time_t utc_start = rtc_get_time() - 30 * SECONDS_PER_DAY; uint32_t num_records = 0; while (true) { uint32_t chunk = k_size; time_t prior_start = utc_start; success = activity_get_minute_history(minute_data, &chunk, &utc_start); if (!success) { snprint...
/* * 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->layer, &data->text_layer.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...
(CTRL_REG1, 0x00)
) { return false; } // Wait for the sysmod register to read that we're now in standby mode. This can take up to // 1/ODR to respond. Since we only support speeds as slow as 5Hz, that means we may be waiting // for up to 200ms for this part to become ready. const int NUM_ATTEMPTS = 300; // 200ms + some pa...
nfig *cfg = &BOARD_CONFIG_ACCEL.accel_config; data->x = (cfg->axes_inverts[AXIS_X] ? -1 : 1) * prv_raw_to_mgs(readings[cfg->axes_offsets[AXIS_X]]); data->y = (cfg->axes_inverts[AXIS_Y] ? -1 : 1) * prv_raw_to_mgs(readings[cfg->axes_offsets[AXIS_Y]]); data->z = (cfg->axes_inverts[AXIS_Z] ? -1 : 1) * ...
if ((int2_status & (shift << cfg->axes_offsets[AXIS_Y])) != 0) { axis = AXIS_Y; invert = cfg->axes_inverts[AXIS_Y]; } else if ((int2_status & (shift << cfg->axes_offsets[AXIS_Z])) != 0) { axis = AXIS_Z; invert = cfg->axes_inverts[AXIS_Z]; } else { BMI160_DBG("No Axis?: 0x%"PRIx8" 0x%"PRIx8, int0...
_line_wordwrap_clip_outside_ny.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_outside_y); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_y.${BIT_DEPTH_N...
graphics_context_set_text_color(&ctx, GColorBlack)
; graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NULL, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_null", fb, GColorWhite)); setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1); graphics_context_set_text_color(&c...
nceStructured *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, const GRect *rect, ...
{ *size_out = GSize(battery_silhouette_icon_size.w, settings_glance->subtitle_font_height); }
} static void prv_battery_percent_dynamic_text_node_update( UNUSED GContext *ctx, UNUSED GTextNode *node, UNUSED const GRect *box, UNUSED const GTextNodeDrawConfig *config, UNUSED bool render, char *buffer, size_t buffer_size, void *user_data) { LauncherAppGlanceStructured *structured_glance = user_data...
/* * 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...
(GBitmapLegacy2)
; } return applib_type_zalloc(GBitmap); } static size_t prv_gbitmap_size(void) { if (process_manager_compiled_with_legacy2_sdk()) { return applib_type_size(GBitmapLegacy2); } return applib_type_size(GBitmap); } static void prv_init_gbitmap_version(GBitmap *bitmap) { if (process_manager_compiled_with_l...
b_pebble_tasks_set_current(PebbleTask_App); uint32_t num_records = exp_num_records; activity_get_minute_history(minutes, &num_records, &utc_start); cl_assert_equal_i(num_records, exp_num_records); cl_assert_equal_i(utc_start, exp_utc_start); cl_assert_equal_i(minutes[0].steps, exp_utc_start % 255); // ---...
(ActivityMetricSleepRestfulSeconds, ((const uint32_t [ACTIVITY_HISTORY_DAYS]) {3 * SECONDS_PER_MINUTE, 2 * SECONDS_PER_MINUTE, 1 * SECONDS_PER_MINUTE, 0, 0, 0, 0}))
em_storage.h" #include "kernel/pbl_malloc.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/settings/settings_raw_iter.h" #include "system/logging.h" #define MAX_CHILDREN_PER_PIN 3 typedef struct { Uuid parent_id; Uuid children_ids[MAX_CHILDREN_PER_PIN]; int num_children; bool find_all...
settings_file_each(&storage->file, prv_each_first_item, &next_info)
; if (rv) { goto cleanup; } if (!next_info.found) { rv = S_NO_MORE_ITEMS; goto cleanup; } *id_out = next_info.id; rv = S_SUCCESS; cleanup: mutex_unlock(storage->mutex); return rv; } bool timeline_item_storage_exists_with_parent(TimelineItemStorage *storage, const Uuid *parent_id) { mu...
eed 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 and * limitations under the License. */ #include "mfg/mfg_serials.h" #include...
cl_assert_equal_s(written_pcba_serial3, pcba_serial)
; } void test_mfg_serials__serial_number_fails(void) { const char * sn; uint8_t index; MfgSerialsResult r; // Initially, return bunch of XXs: sn = mfg_get_serial_number(); cl_assert_equal_s(sn, "XXXXXXXXXXXX"); // String too long: const char *long_sn = "ABCDEFGHIJKLM"; r = mfg_write_serial_number(l...
n i18n_noop("PERFORMANCE"); default: /// Default/Zone 0 HR Label return i18n_noop("HEART RATE"); } } static const char* prv_get_label_for_metric(WorkoutMetricType metric_type, WorkoutActiveWindow *active_window) { switch (metric_type) { case WorkoutMe...
fonts_get_font_height(units_font)
; switch (metric_type) { case WorkoutMetricType_Hr: { GPoint heart_node_offset = GPoint(2, prefer_larger_font ? 5 : 0); GTextNodeCustom *heart_node; if (active_window->workout_controller->get_metric_value( metric_type, active_window->workout_data) > 0) { const size_t buffer_si...
s temporarily so that PFS can test on these regions static void prv_layout_version_add_all_regions(bool revert) { static unsigned int original_idx; if (!revert) { original_idx = s_next_region_idx; s_next_region_idx = TOTAL_NUM_FLASH_REGIONS; } else { s_next_region_idx = original_idx; } s_ftl_siz...
{ uint32_t curr_virt_offset_begin = 0; uint32_t curr_virt_offset_end = 0; // iterate through all regions and perform read, write, or erase for (unsigned int idx = 0; (idx < s_next_region_idx) && (size != 0); idx++) { curr_virt_offset_end += prv_region_size(idx); if (offset < curr_virt_offset_end) { ...
void ftl_read(void *buffer, size_t size, uint32_t offset) { prv_ftl_operation(buffer, size, offset, FTLRead); } void ftl_write(const void *buffer, size_t size, uint32_t offset) { prv_ftl_operation((void *)buffer, size, offset, FTLWrite); } void ftl_erase_sector(uint32_t size, uint32_t offset) { prv_ftl_operat...
/* * 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...
i18n_free(missed_text, data)
ggleState_Disabled : ActionToggleState_Enabled; } static void prv_setup_state_config(ActionToggleContext *ctx, ActionToggleDialogConfig *config, ActionToggleDialogType dialog_type) { if (!config->window_name) { config->window_name = ctx->config.impl->window_name; } if (!con...
(actionable_dialog, prv_prompt_click_config_provider)
; prv_setup_dialog(actionable_dialog_get_dialog(actionable_dialog), &config, (void *)ctx); actionable_dialog_push(actionable_dialog, prv_get_window_stack()); } static bool prv_should_prompt(const ActionToggleConfig *config) { switch (config->prompt) { case ActionTogglePrompt_Auto: #if PLATFORM_SPALDING ...
s is after // ACTIVITY_LAST_SLEEP_MINUTE_OF_DAY (9pm), so it should be part of "tonight's" sleep. prv_add_sleep_session(22, 1); // Starting 22 hours from midnight of today // Awake until 11:45pm rtc_set_time(rtc_get_time() + 15 * SECONDS_PER_MINUTE); s_data.metric_history[ActivityMetricSleepState][0] = A...
activity_insights_process_sleep_data(rtc_get_time())
; cl_assert_equal_i(s_data.pins_added, 1); Uuid orig_id = s_last_timeline_id; // Next session, < 1h after should move the pin rtc_set_time(rtc_get_time() + 2 * SECONDS_PER_HOUR); prv_add_sleep_session(0.5, 1.5); activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 2)...
///// void smartstrap_comms_init(void) { s_read_timer = new_timer_create(); s_header_mbuf = MBUF_EMPTY; mbuf_set_data(&s_header_mbuf, s_header_data, sizeof(s_header_data)); } // Helper functions for static variables //////////////////////////////////////////////////////////////////////////////// static void p...
crc8_calculate_bytes_streaming((uint8_t *)&data, sizeof(data), (uint8_t *)&s_read_info.checksum, false /* !big_endian */)
; } static void prv_handle_complete_frame(bool *should_context_switch) { FrameHeader *header = mbuf_get_data(&s_header_mbuf); bool is_notify = header->flags.is_notify; if ((is_notify && (smartstrap_fsm_state_get() != SmartstrapStateNotifyInProgress)) || (!is_notify && (s_read_consumer.profile != header->pr...
text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, // Width for first word only: .box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 3 * HORIZ_ADVANCE_PX, 10 } } }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; // Init mutable types word_i...
line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)
); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); } //! Multi-line, multi-word, multi-hyphenation void test_line_layout__test_line_add_words_multi_line(void) { // Allocate mutable types Iterator word_iter = ITERATOR_EMPTY; WordIterState word_iter_state = WORD_ITER_STATE_...
/* * 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(sequence == NULL)
; }
_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(19, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ...
(&ctx, GPoint(10, 96), 5)
; // T facing right - even vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(50, 90), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(46, 95), 5); // T facing right - odd vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(71, 91), 10); graphics_draw_horizontal_line_dotte...
_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(0, l.selection.y); cl_assert_equal_i(initial_scroll_offset, l.scroll_layer.content_sublayer.bounds.origin.y); menu_layer_set_selected_next(&l, false, MenuRowAlignNone, true); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).sect...
menu_layer_set_center_focused(&l, true)
/* * 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...
assert_buffer_not_touched(6)
; } void test_cobs_decode__output_too_small_2(void) { const char vector[] = { 0x05, 'a', 'b', 'c', 'd', 0x01, 0x01 }; decode_start(5); assert_decode_fails(vector, sizeof(vector)); assert_decode_completed(SIZE_MAX); assert_buffer_not_touched(6); } void test_cobs_decode__input_truncated(void) { const char v...
rect_order[0]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(1)->pin.header...
cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id, &timeline_model_get_iter_state(1)->pin.header.id))
h_progress.h" #include "health_ui.h" #include "services/normal/activity/health_util.h" #include "applib/pbl_std/pbl_std.h" #include "applib/ui/kino/kino_reel.h" #include "applib/ui/text_layer.h" #include "kernel/pbl_malloc.h" #include "resource/resource_ids.auto.h" #include "services/common/i18n/i18n.h" #include "syst...
(ctx, base_layer, steps_buffer)
app_data), GColorLightGray)); timeline_layer_set_layouts_hidden(timeline_layer, true); // hide until the peek is over layer_set_hidden((Layer *)&timeline_layer->day_separator, true); layer_add_child(&window->layer, (Layer *)timeline_layer); // peek layer p...
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; } else { data->timeline_model.direction = args->direction; } // check if we were aske...
: if the watch fails three times, return true // to tell the parent we should load the recovery firmware. A reset for any other reason // will reset this algorithm. if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)) { // Yikes, our firmware is screwed. Boot into recovery mode. dbgserial_putstr("Failed ...
(BOOT_BIT_FW_STABLE)
; boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO); } flash_init(); button_init(); display_init(); #ifdef DISPLAY_DEMO_LOOP whi...
E_NAME_BUFFER_SIZE - 1] = '\0'; GapBondingFileSetStatus status; status = prv_file_set(&bonding, sizeof(bonding), &data, sizeof(data)); // If this is the gateway, update SPRF so our pairing info betwen PRF and normal // FW is in sync if (data.ble_data.is_gateway && (status == GapBondingFileSetUpdated)) { ...
{ return true; // continue iterating }
FindByAddrItrData *itr_data = (FindByAddrItrData *) context; BTBondingID key; BtPersistBondingData stored_data; info->get_key(file, (uint8_t*) &key, info->key_len); info->get_val(file, (uint8_t*) &stored_data, MIN((unsigned)info->val_len, sizeof(stored_data))); if (stored_data.type == BtPersistBondingTy...
/* * 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(BTErrno, sys_ble_client_discover_services_and_characteristics, BTDeviceInternal device)
{ return gatt_client_discovery_discover_all(&device); } DEFINE_SYSCALL(uint8_t, sys_ble_client_copy_services, BTDeviceInternal device, BLEService services[], uint8_t num_services) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(services, sizeof(BLEService) * num_service...
define ROCKY_LISTENERS "_listeners" #define ROCKY_ON "on" #define ROCKY_ADD_EVENT_LISTENER "addEventListener" #define ROCKY_OFF "off" #define ROCKY_REMOVE_EVENT_LISTENER "removeEventListener" #define ROCKY_EVENT_CONSTRUCTOR "Event" #define ROCKY_EVENT_TYPE "type" // TODO: PBL-35780 make this part of app_state_get_roc...
jerry_call_function(splice, event_listeners, args, ARRAY_LENGTH(args))
; if (jerry_value_has_error_flag(remove_result)) { rocky_log_exception("removing event listener", remove_result); } for (size_t i = 0; i < ARRAY_LENGTH(args); i++) { jerry_release_value(args[i]); } // mark item as removed and stop iterating query_data->found = true; 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...
(idx >= 0 && idx < NUM_MAX_TIMERS)
/* * 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...
graphics_context_set_fill_color(ctx, GColorBlack)
; graphics_fill_round_rect(ctx, &GRect(4, 5, 18, 10), 4, GCornersAll); } void across_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rect(ctx, &GRect(4, -5, 18, 10), 4, GCornersAll); } voi...
b.attributes[i].string_list; cl_assert_equal_i(list_a->serialized_byte_length, list_b->serialized_byte_length); cl_assert_equal_i( string_list_count(list_a), string_list_count(list_b) ); uint32_t count = string_list_count(list_a); for (uint32_t idx = 0; i<...
notification_storage_get(&i2, &r)
risticData]); // Expect "Reset Complete" to be sent by FW: prv_assert_sent_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]); // Expect Session to be opened now: cl_assert_equal_i(fake_comm_session_open_call_count(), 1); } void test_ppogatt__start_reset_upon_out_of_range_ack(void) { test_ppog...
(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS)
; } // Expect "Reset Request" sent by FW: prv_assert_sent_reset_request(s_characteristics[0][PPoGATTCharacteristicData]); } void test_ppogatt__server_reset_request_while_pending_ack(void) { test_ppogatt__open_session_when_found_pebble_app(); // Simulate outbound queue full, so ack will have to wait until 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...
RTC_GetTime(RTC_Format_BIN, &rtc_time)
; RTC_DateTypeDef rtc_date; RTC_GetDate(RTC_Format_BIN, &rtc_date); // Unlike mktime there's no error checking here since if something goes wrong // it'll just give us the wrong time anyway unsigned days = rtc_date.RTC_Year * 365; // RTC_Year is 0-99 days += (rtc_date.RTC_Year / 4); // Leap years // C...
ty_menu_push(SettingsDisplayData *data) { const int index = prv_intensity_get_selection_index(); const OptionMenuCallbacks callbacks = { .select = prv_intensity_menu_select, }; const char *title = PBL_IF_RECT_ELSE(i18n_noop("INTENSITY"), i18n_noop("Intensity")); settings_option_menu_push( title, Opt...
("Backlight")
; if (backlight_is_enabled()) { subtitle = i18n_noop("On"); } else { subtitle = i18n_noop("Off"); } break; case SettingsDisplayMotionSensor: title = i18n_noop("Motion Enabled"); if (backlight_is_motion_enabled()) { subtitle = i18n_noop("On"); } else ...
y, outbox->transmission_size_limit - APP_MSG_HDR_OVRHD_SIZE); } static void prv_stop_timer(AppMessageCtxOutbox *outbox) { if (outbox->ack_nack_timer) { app_timer_cancel(outbox->ack_nack_timer); outbox->ack_nack_timer = NULL; } } void app_message_outbox_close(AppMessageCtxOutbox *outbox)...
{ outbox->phase = OUT_AWAITING_REPLY; return; }
age governing permissions and * limitations under the License. */ #include "accel_service.h" #include "accel_service_private.h" #include "applib/applib_malloc.auto.h" #include "applib/pbl_std/pbl_std.h" #include "event_service_client.h" #include "kernel/kernel_applib_state.h" #include "kernel/pbl_malloc.h" #include...
for (unsigned int i=0; i<num_samples; i++) { ACCEL_LOG_DEBUG(" => x:%d, y:%d, z:%d", state->raw_data[i].x, state->raw_data[i].y, state->raw_data[i].z); }
#endif if (state->raw_data_handler_deprecated) { state->raw_data_handler_deprecated(state->raw_data, num_samples); } else if (state->raw_data_handler) { state->raw_data_handler(state->raw_data, num_samples, timestamp_ms); } else { AccelData data[num_samples]; for (uint32_t i = 0; i < num_sampl...
("OK"); } else { prompt_send_response("ERROR"); } } void command_disp_offset_read(void) { char buffer[16]; prompt_send_response_fmt(buffer, sizeof(buffer), "X: %"PRId16" Y: %"PRId16, mfg_info_get_disp_offsets().x, mfg_info_get_disp_offsets().y); } void...
(BOOT_BIT_FORCE_PRF)
; } BLTEST_LOG("STAGE 1 -- Rebooting"); RebootReason reason = { RebootReasonCode_PrfReset, 0 }; reboot_reason_set(&reason); system_hard_reset(); } #else void command_bootloader_test(void) { prompt_send_response("Not configured for bootloader test"); } #endif
(fake_gap_le_connect_params_get_last_requested(), ResponseTimeMiddle)
; // higher rate should take over lower rate already scheduled conn_mgr_set_ble_conn_response_time( &s_hdl, BtConsumerLeServiceDiscovery, ResponseTimeMin, 25); state = conn_mgr_get_latency_for_le_connection(&s_hdl, &secs_to_wait); cl_assert_equal_i(state, ResponseTimeMin); cl_assert_equal_i(secs_to_wai...
- PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_aa_sw11_no_clip.${BI...
(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) ...
nizer *recognizer) { if (recognizer->number_of_clicks_counted >= prv_multi_click_get_max(recognizer)) { return false; } return true; } uint8_t click_number_of_clicks_counted(ClickRecognizerRef recognizer_ref) { ClickRecognizer *recognizer = (ClickRecognizer*)recognizer_ref; return recognizer->number_of_c...
( CLICK_REPETITION_DELAY_MS, prv_repetition_delay_callback, recognizer)
; } if (false == prv_is_multi_click_enabled(recognizer)) { // No long click nor multi click, fire handler immediately on button down: ++(recognizer->number_of_clicks_counted); const bool needs_reset = (false == local_is_hold_to_repeat_enabled); prv_dispatch_event(recognizer, ClickHandler...
/* * 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_p(result, false)
BtPersistBondingOp op) { bt_pairability_update_due_to_bonding_change(); } BTBondingID bt_persistent_storage_store_bt_classic_pairing(BTDeviceAddress *address, SM128BitKey *key, char *name, ui...
{ return false; }
} bool bt_persistent_storage_is_unfaithful(void) { return true; } void bt_persistent_storage_set_unfaithful(bool is_unfaithful) { return; } bool bt_persistent_storage_get_root_key(SMRootKeyType key_type, SM128BitKey *key_out) { return shared_prf_storage_get_root_key(key_type, key_out); } void bt_persistent_s...
/* * 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_text_color(text_heap_info, GColorWhite)
; text_layer_set_background_color(text_heap_info, GColorBlack); text_layer_set_font(text_heap_info, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)); // Get the size of the heap from the beginning of the first thing allocated unsigned long heap_size = 0x20020000 - (unsigned long)start; unsigned long alloc_siz...
cent_completion = 0, .firmware_percent_completion = 0 }; return true; } // End Legacy completion handlers bool firmware_update_is_in_progress(void) { return s_update_status == FirmwareUpdateRunning; } FirmwareUpdateStatus firmware_update_current_status(void) { return s_update_status; } void firmware_up...
{ if (prv_legacy_handle_progress(event)) { return; } if (event->type != PebblePutBytesEventTypeProgress) { return; // Only progress events report bytes_transferred updates } FwUpdateCompletionStatus *status = &s_current_completion_status.status; status->bytes_transferred += event->bytes_transferre...
void firmware_update_pb_event_handler(PebblePutBytesEvent *event) { if (!firmware_update_is_in_progress()) { return; // not my pb transfer } switch (event->type) { case PebblePutBytesEventTypeStart: s_is_recovery_fw = (event->object_type == ObjectRecovery); prv_handle_progress(event); ...