prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ItemTypePin; pin->header.from_watch = true; pin->header.ancs_uid = uid; // patch the dismiss action to be a remove action TimelineItemAction *remove_action = timeline_item_find_dismiss_action(pin); // TODO: PBL-23915 // We leak this i18n'd string because not leaking it is really hard. // We make sure we...
attribute_get_uint32(&action->attr_list, AttributeIdAncsId, item->header.ancs_uid)
; PBL_LOG(LOG_LEVEL_INFO, "Perform ancs notification action (%"PRIu32", %"PRIu8")", ancs_uid, action_id); ancs_perform_action(ancs_uid, action_id); if (!timeline_is_bulk_ancs_action_mode_enabled()) { // TODO: PBL-23915 // We leak this i18n'd string because not leaking it is really hard. //...
is_updating_existing = false; SMPairingInfo existing_pairing_info; if (shared_prf_storage_get_ble_pairing_data(&existing_pairing_info, NULL, NULL, NULL)) { if (sm_is_pairing_info_equal_identity(new_pairing_info, &existing_pairing_info)) { // Treat re-pairing an existing device as an "update" instead of de...
bt_persistent_storage_get_ble_pairing_by_id(BLE_BONDING_ID, NULL, NULL, NULL)
; } bool bt_persistent_storage_has_ble_ancs_bonding(void) { return bt_persistent_storage_get_ble_pairing_by_id(BLE_BONDING_ID, NULL, NULL, NULL); } bool bt_persistent_storage_has_active_ble_gateway_bonding(void) { return bt_persistent_storage_get_ble_pairing_by_id(BLE_BONDING_ID, NULL, NULL, NULL); } void bt_per...
_c); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Started); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Started); cl_assert_equal_i(recognizers[2]->state, RecognizerState_Started); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Cancelled); // Layer C's and layer A's recogni...
prv_compare_recognizers_processed((int[]) {4, 0, 3, 1}, 4, &s_recognizers_handled)
destroy(s_dest_bitmap); s_dest_bitmap = NULL; } // Helpers ////////////////////// static void prv_action_menu_did_close_cb(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { ActionMenuLevel *root_level = action_me...
gbitmap_destroy(s_dest_bitmap)
; const unsigned int num_columns = SettingsContentSizeCount; const int16_t bitmap_width = (DISP_COLS * num_columns) + (GRID_CELL_PADDING * (num_columns + 1)); const int16_t bitmap_height = (num_rows == 1) ? DISP_ROWS : ((DISP_ROWS * num_rows) + (GRID_CELL_PADDING * (num_rows + 1))); const GSize bitmap_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...
cl_assert_equal_i(average_ms, 3000000000)
; fake_rtc_increment_time_ms(3000000000); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 2); cl_assert_equal_i(average_ms, 3000000000); fake_rtc_increment_time_ms(3000000000); interval_timer_take_sample(&timer); num_inter...
= sys_watch_info_get_color(); char *model_name = NULL; if (color < WATCH_INFO_COLOR__MAX) { switch (color) { case WATCH_INFO_COLOR_BLACK: model_name = TINTIN_MODEL("pebble_black"); break; case WATCH_INFO_COLOR_WHITE: model_name = TINTIN_MODEL("pebble_white"); break; ...
strlen(qemu_prefix)
ta_row_info.data + i); const unsigned int data_row_offset = data_row_info.data - (uint8_t *)framebuffer->addr; prv_set_color(ctx, output, data_row_offset, i, 1, gcolor_alpha_blend(color, *output)); } #else // TODO: as part of PBL-30849 make this a first-class function // also see, prv_assign_horizontal_li...
(ctx, output, data_row_offset, color, x1.integer, (uint8_t)(FIXED_S16_3_ONE.raw_value * i / left_aa_offset))
; output++; x1.integer++; } } // middle pixels const int16_t width = x2.integer - x1.integer + 1; if (width > 0) { prv_set_color(ctx, output, data_row_offset, x1.integer, width, color); output += width; x1.integer += width; } // last pixel with blending (don't render first *and...
/* * 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...
(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); } // Tests //////////////////////////////////// void test_pbl_std__get_id(void) { const int STR_SIZE =...
has gone before. "; static const char* QUOTE_BUF_2 = "Dib: You're just jealous...\n" "Zim: This has nothing to do with jelly!\n" "Zim: You dare agree with me? Prepare to meet your horrible doom!"; static void prv_window_load(Window *window) { graphics_text_perimeter_debugging_enable(true); AppState *data =...
handle_deinit()
; } const PebbleProcessMd* text_flow_app_get_info() { static const PebbleProcessMdSystem text_flow_info = { .common.main_func = &s_main, .name = "Text Flow" }; return (const PebbleProcessMd*) &text_flow_info; }
j = 0; j < 2; j++) { graphics_context_set_stroke_color(ctx, j ? GColorGreen : GColorRed); for (int i = 0 + j; i < 5; i += 2) { graphics_draw_line(ctx, (GPoint) {.x = i, .y = pixel_min}, (GPoint) {.x = i, .y = pixel_max}); graphics_draw_line(ctx, (GPoint) {.x = pixel_max...
prv_handle_init()
; app_event_loop(); prv_handle_deinit(); } const PebbleProcessMd* mfg_display_calibration_app_get_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.main_func = &s_main, // UUID: d0582042-5beb-410f-9fed-76eccd31821e .common.uuid = { 0xd0, 0x58, 0x20, 0x42, 0x5b, 0xeb, 0x41, 0x0f...
/* * 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...
comm_session_send_data(session, PB_APP_STATE_ENDPOINT_ID, (uint8_t*)app_run_state, sizeof(*app_run_state), COMM_SESSION_DEFAULT_TIMEOUT)
; uuid_to_string(&app_run_state->uuid, uuid_buffer); PBL_LOG(LOG_LEVEL_DEBUG, "AppRunState(0x34) %s sending status: %s - %u", (success ? "success" : "failed"), uuid_buffer, app_run_state->state); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Using deprecated launcher_app_message"); const...
oid) { PBL_ASSERTN(s_phone_ui_data == NULL); s_phone_ui_data = kernel_zalloc_check(sizeof(PhoneUIData)); s_phone_ui_data->hid_action_bar = false; s_phone_ui_data->style = s_phone_styles[system_theme_get_content_size()]; const PhoneStyle *style = s_phone_ui_data->style; s_phone_ui_data->name_font = system...
layer_add_child(&s_phone_ui_data->core_ui_container, &s_phone_ui_data->call_status_text_layer.layer)
; // Shrink the bounds but not the frame size to allow for centering when action bar removed s_phone_ui_data->call_status_text_layer.layer.bounds.size.w = width - TEXT_RIGHTSIDE_PADDING; // Action bar action_bar_layer_init(&s_phone_ui_data->action_bar); action_bar_layer_add_to_window(&s_phone_ui_data->action...
eek is over layer_set_hidden((Layer *)&timeline_layer->day_separator, true); layer_add_child(&window->layer, (Layer *)timeline_layer); // peek layer prv_init_peek_layer(s_app_data); prv_setup_peek(s_app_data); } static void prv_timeline_window_appear(Window *window) { TimelineAppData *data = window_get_us...
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 asked to launch into a specific item time_t now = rtc_get_time(); TimelineItem pin; bool launch_into_pin = false; if (args && args->launch_into_pin && !uuid_is_invalid(&args->pin_id) && pin_db_get(&args->pin_id, &pin) == S_SUCCESS) { launch_into_pin = true; if (!args-...
/* * 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(is_complete == true)
eline_removes, 0); alarm_set_enabled(id1, false); prv_assert_alarm_config(id1, 3, 14, true, ALARM_KIND_EVERYDAY, s_every_day_schedule); cl_assert_equal_i(s_num_timeline_adds, 3); cl_assert_equal_i(s_num_timeline_removes, 3); alarm_set_enabled(id1, true); prv_assert_alarm_config(id1, 3, 14, false, ALARM_KI...
cl_assert_equal_i(s_num_alarms_fired, 1)
; } //////////////////////////////////////////////////////////////////////////////////////////////////// //! Alarm Timeline Pin Tests void test_alarm__pin_add(void) { const AlarmId dummy_alarm_id = 0; const AlarmKind alarm_kind = ALARM_KIND_WEEKENDS; Uuid added_pin_uuid; alarm_pin_add(s_monday, dummy_alarm_id...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ s_handler = handler; s_samples_per_update = samples_per_update; }
void accel_session_raw_data_subscribe( AccelServiceState *session, AccelSamplingRate sampling_rate, uint32_t samples_per_update, AccelRawDataHandler handler) { s_raw_handler = handler; s_samples_per_update = samples_per_update; } void accel_session_data_unsubscribe(AccelServiceState *session) { s_hand...
_command(void) { prv_connect_ams(); // Exercise all MusicCommand types (currently they are all supported): for (MusicCommand music_cmd = 0; music_cmd < NumMusicCommand; ++music_cmd) { music_command_send(music_cmd); BLECharacteristic remote_command = s_characteristics[0][AMSCharacteristicRemoteCommand]; ...
ams_handle_read_or_notification(entity_update, update, update_length, BLEGATTErrorSuccess)
; } void test_ams__receive_player_name_update(void) { prv_connect_ams(); // 0000 00 00 00 4d 75 73 69 63 ...Music uint8_t player_name_update[] = { 0x00, 0x00, 0x00, 0x4d, 0x75, 0x73, 0x69, 0x63, }; prv_receive_entity_update(player_name_update, sizeof(player_name_update)); ...
argb); #else cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorBlack.argb); #endif color.a = 2; graphics_context_set_stroke_color(&context, color); #if PBL_COLOR cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorBlue.argb); #else cl_assert_equal_i(context.draw_state.stroke_color.argb,...
GPoint(45, 10)
); #if PBL_COLOR ASSERT_CALLED(graphics_line_draw_1px_aa(&context, GPoint(5, 5), GPoint(45, 10))); #else ASSERT_CALLED(graphics_line_draw_1px_non_aa(&context, GPoint(5, 5), GPoint(45, 10))); #endif setup_test(&context, true, 1, GColorBlack, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 1...
e start of HeartRateZoneData"); _Static_assert(sizeof(HeartRateZoneData) % sizeof(uint32_t) == 0, "HeartRateZoneData size is invalid"); static status_t prv_file_open_and_lock(SettingsFile *file) { mutex_lock(s_mutex); status_t rv = settings_file_open(file, HEALTH_DB_FILE_NAME, HEALTH_DB_MAX_SIZE);...
{ HeartRateZoneData *data = (HeartRateZoneData *)val; if (!prv_is_last_processed_timestamp_valid(data->last_processed_timestamp)) { return; } if (data->num_zones != HRZone_Max) { return; } PBL_LOG(LOG_LEVEL_INFO, "Got HeartRateZoneData for wday: %d, cur_wday: %d, zone1: %"PRIu32"", ...
} ///////////////////////// // Public API ///////////////////////// bool health_db_get_typical_value(ActivityMetric metric, DayInWeek day, int32_t *value_out) { char key[HEALTH_DB_MAX_KEY_LEN]; snprintf(key, HEALTH_DB_MAX_KEY_LEN, "%s%s", WEEKDAY...
rescheduled, so check before we destroy it prv_unlink_and_free(state, animation); } } // ------------------------------------------------------------------------------------------- // Low level schedule of an animation, no recursion static void prv_schedule_low_level_animation(AnimationState* state, const uint...
if (child_idx == 0 && child->abs_start_time_ms) { // Remove the sequence's delay, we will shift all of the delay into the first child animation->delay_ms = 0; int32_t child_position_inc_delay = prv_get_elapsed(child, now) + child->delay_ms; earliest_start_time = now - child_position_inc_...
if (duration == PLAY_DURATION_INFINITE) { break; } } } else if (animation->type == AnimationTypeSpawn) { // For a spawn animation, schedule each of the components in parallel // If any of the children have already been scheduled, then we need to back up our start time // of the ...
uteDLSRecord)); return s_dls_session; } void dls_send_all_sessions(void) { } // ============================================================================================ // Activity service stubs // -------------------------------------------------------------------------------------------- // Values to return...
{ // The sleep was in the past and has ended *stats = (KAlgOngoingSleepStats) { .sleep_start_utc = s_kalg_sleep_start_utc, .sleep_len_m = s_kalg_sleep_m, .uncertain_start_utc = 0, }; }
} } // -------------------------------------------------------------------------------------------- // Create sample data for testing sleep and data logging static void prv_create_test_data(uint32_t num_minutes, AlgMinuteDLSSample *minute_data) { uint16_t next_vmc = 0; uint8_t next_orient = 1; uint8_t next_l...
r_accel_data(data); return 0; } //////////////////////////////////////////////////////////////////////////////// // FIFO Support //////////////////////////////////////////////////////////////////////////////// static void prv_program_fifo_register(uint8_t address, uint8_t data) { // To prevent lockups of the fifo...
prv_set_accel_power_mode(BMA255PowerMode_Normal)
/* * 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...
heap_realloc(task_heap_get_for_current_task(), ptr, size, saved_lr)
; } void *task_zalloc(size_t size) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return heap_zalloc(task_heap_get_for_current_task(), size, saved_lr); } void *task_zalloc_check(size_t bytes) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; Heap *heap = task_heap_get_for_curr...
ted); static const PropertyAnimationImplementation s_center_focus_selection_animation_in_out_impl = { .base = { .setup = prv_center_focus_animation_setup, .update = prv_center_focus_animation_update_in_and_out, .teardown = prv_center_focus_animation_teardown, } }; static const PropertyA...
if (menu_layer->callbacks.get_num_rows == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "Please set menu layer callbacks before running menu_layer_set_selected_index."); return; }
const uint16_t num_rows = menu_layer->callbacks.get_num_rows(menu_layer, index.section, menu_layer->callback_context); if (index.row >= num_rows) { index.row = num_rows - 1; } // when called from iteration triggered by menu_layer_set_selected_next() the // selection.index.section could be MENU_INDEX_NO...
/* * 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_mask_use(ctx, NULL)
); cl_assert_equal_p(ctx->draw_state.draw_mask, NULL); cl_check(gbitmap_pbi_eq(&ctx->dest_bitmap, TEST_NAMED_PBI_FILE(expected_image))); graphics_context_mask_destroy(ctx, mask); free(ctx); } // Tests //////////////////////////////////// // NOTE: All of the following tests first fill the framebuffer with g...
/* * 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_APB2PeriphClockCmd, RCC_APB2Periph_SYSCFG)
; }
/* * 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_will_return(gack, 573)
; printf("gack() = %d\n", gack()); // 573 cl_will_return(gack, 123); cl_will_return(gack, 456); cl_will_return(gack, 789); printf("gack() = %d\n", gack()); // 123 printf("gack() = %d\n", gack()); // 456 printf("gack() = %d\n", gack()); // 789 cl_will_return_count(gack, 765, 3); printf("gack() = %d\n",...
Bluetooth controller directly bt_driver_stop(); stop_mode_enable(InhibitorCommMode); analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_BT_OFF_TIME, AnalyticsClient_System); s_comm_is_running = false; // This is a legacy event used to update the Settings app. prv_put_disconnection_event(); } static void pr...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Resetting Bluetooth"); mutex_lock(s_comm_state_change_mutex); bool was_already_running = s_comm_is_running; prv_comm_stop(); prv_comm_start(); // It's possible a reset was triggered because the stack failed to boot up // correctly in which case we have never generated an eve...
lette_to_1bit_assign(void) { GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt_palette_1bit__1bit_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_bitblt_palette_1bit__1...
(&s_dest_bitmap, "test_bitblt_palette_1bit__2bit_palette_to_1bit_wrap-expect.pbi")
); gbitmap_destroy(src_bitmap); } // Tests assign, from same size to same size. // Setup: // - Source is 50x50, alternating lines between orange and blue for the top half. // The bottom half is a diagonal orange line over blue. // The left half is semi-transparent and the right half is completely opaque /...
-------------------------- T_STATIC void prv_timer_kernel_bg_callback(void *data) { AlarmId id = (intptr_t) data; if (id == ALARM_INVALID_ID) { return; } // We allocate some larger variables on the heap to reduce stack usage AlarmConfig *config = &s_most_recent_alarm_config; SettingsFile *file = kernel...
settings_file_get_len(file, &key, sizeof(key))
, 904, 208}, { 232, 888, 184}, { 320, 912, 24}, { 296, 1072, 280}, { 184, 1136, 248}, { 160, 1160, 184}, { 200, 1088, 288}, { 16, 1280, 288}, { 88, 1048, 80}, { 288, 856, 8}, { 160, 688, 224}, { 120, 1032, 96}, { 16, 1024, 64}, { 160, 880, 8}, { 232, 848, -64}, ...
{ 200, 1040, 200}, { 192, 1360, 264}, { 120, 968, 176}, { 136, 856, 72}, { 232, 672, 88}, { 112, 872, 120}, { 16, 1064, 192}, { 48, 1152, 64}, { 112, 936, 40}, { 144, 832, 24}, { 168, 848, 72}, { 200, 872, 88}, { 232, 904, 72}, { 248, 880, 48}, { 248, 896, 64}...
{ 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}, ...
/* * 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...
sign_extend(0, 32)
/* * 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...
(&device, auto_reconnect, is_pairing_required, GAPLEClientApp)
; } DEFINE_SYSCALL(BTErrno, sys_ble_central_cancel_connect, BTDeviceInternal device) { return gap_le_connect_cancel(&device, GAPLEClientApp); } // ----------------------------------------------------------------------------- // ble_client.h DEFINE_SYSCALL(BTErrno, sys_ble_client_discover_services_and_characteristi...
/* * 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...
{ // Iterate to the end of the command list (next frame starts immediately afterwards) return gdraw_command_list_iterate_private(&frame->command_list, NULL, NULL); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(argv, argc, false /*is_repeating*/)
nse 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" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific langu...
(list, 20, "hello", 10)
; cl_assert_equal_i(5, list->serialized_byte_length); cl_assert_equal_i(1, string_list_count(list)); cl_assert_equal_s("hello", string_list_get_at(list, 0)); // add a string to string list with strings string_list_add_string(list, 20, "world", 10); cl_assert_equal_i(11, list->serialized_byte_length); cl_...
er, &bounds); menu_layer_set_callbacks(&data->custom_day_picker_menu_layer, data, &(MenuLayerCallbacks) { .get_num_sections = prv_custom_day_picker_get_num_sections, .get_num_rows = prv_custom_day_picker_get_num_rows, .get_cell_height = prv_custom_day_picker_get_cell_height, .draw_row = prv_custom_day...
(&data->time_picker_window.window, data)
, { -112, 1432, 96}, { -120, 1728, -176}, { -176, 1504, -280}, { -144, 1072, -320}, { -160, 784, -160}, // 37 seconds { -168, 672, -80}, { -168, 632, -72}, { -144, 544, -48}, { -80, 472, -8}, { -40, 464, -8}, { -8, 560, -32}, { -48, 792, 0}, { -128, 1128, 56}, ...
{ -840, 112, 200}, { -880, 104, 144}, { -840, 128, 112}, { -944, 104, 88}, { -1160, 200, -80}, { -1320, 376, -232}, { -1296, 352, -376}, { -1400, -72, -216}, { -1400, 128, -232}, { -1440, 480, 16}, { -1224, 456, -200}, { -1032, 312, -64}, { -1040, 336, -56}, { -97...
{ -1032, -24, -272}, // 45 seconds { -1192, 120, -240}, { -1080, 320, -440}, { -912, 312, -424}, { -1200, 536, -520}, { -1056, 640, -488}, { -904, 400, -224}, { -952, 584, -144}, { -1128, 312, -136}, { -1384, 456, -136}, { -1176, 368, -152}, { -1032, 400, -104}, ...
prv_get_line_height(text_box_params); } else { // We're either in a non-truncating mode, or on the first line of a truncating mode. // So, only include the extent of the previous line in next_line_y_extent (making it more of // a "last_line_y_extent"). // Putting aside the misleading variable name, t...
iter_next(&char_iter)
; if (!is_advanced) { PBL_ASSERTN(*word->end == NULL_CODEPOINT); word->start = NULL; return false; } if (word->end == char_iter_state.utf8_iter_state.current) { // Word has been completely trimmed; init a new word bool is_end_of_text = (word->end == NULL_CODEPOINT || char_iter_state....
e); int64_t prv_default_interpolate(int32_t normalized, int64_t from, int64_t to); void test_gdraw_command_transforms__int_scale_to_translate_overflow(void) { InterpolateInt64Function interp = prv_default_interpolate; int y = prv_int_scale_and_translate_to(255, 10, 10, 10, 0, 255, ANIMATION_NORMALIZED_MAX, ...
GColorFromHEX(0x55aaff)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_test_cache, &s_test_item[1])
; cl_assert_equal_m(&s_cache_buffer[0], &s_test_item[1], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[1], &s_test_item[2], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[2], &s_test_item[1], sizeof(TestCacheItem)); cl_assert(*s_test_item[0].freed); circular_cache_push(&s_test_cache, &...
s->app_num, font_res->resource_id, data->resource_offset, (uint8_t *)&g->header, sizeof(GlyphHeaderData)); SYS_PROFILER_NODE_STOP(text_render_flash); } if (!num_bytes_loaded) { PBL_LOG(LOG_LEVEL_WARNING, ...
{ font_res->md.version |= VERSION_FIELD_FEATURE_RLE4; }
_attributes[]) { return true; } bool weather_layout_verify(bool existing_attributes[]) { return true; } const TimelineEventImpl *timeline_peek_get_event_service(void) { return NULL; } // Helpers //////////////////////////////////////////////////////////////// static bool s_in_calendar_event = false; static bo...
stub_new_timer_is_scheduled(timer_id)
); cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000); } void test_calendar_handle__future_event_added_and_removed(void) { timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert_equa...
, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3184 - 3200 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* bytes 3200 - 3216 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /*...
snprintf(filename, 32, "res_bank%u", resource_bank)
/* * 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...
strlen(MFG_COLOR_KEY)
&& memcmp(data + 2, MFG_COLOR_KEY, strlen(MFG_COLOR_KEY)) == 0) { prv_send_color_response(); return; } prv_send_fail_response(); }
OLOR cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorBlue.argb); #else cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorBlack.argb); #endif color.a = 1; graphics_context_set_stroke_color(&context, color); cl_assert_equal_i(context.draw_state.stroke_color.argb, GColorClear.argb); ...
GPoint(5, 5)
, GPoint(45, 10))); #endif setup_test(&context, true, 1, GColorBlack, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10))); setup_test(&context, true, 1, GColorBlack, GColorBlack, false); graphics_draw_circle(&context, GPoi...
(storage, sizeof(storage), test_alt_message_handler, test_alt_dropped_handler, AppInboxServiceTagUnitTestAlt)
; cl_assert_equal_b(success, false); cl_assert_equal_b(false, app_inbox_service_has_inbox_for_tag(AppInboxServiceTagUnitTestAlt)); fake_kernel_malloc_mark_assert_equal(); } void test_app_inbox__app_inbox_create_and_register_tag_already_associated(void) { bool success; uint8_t storage[BUFFER_SIZE]; success...
/* * 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_s(local_name, "Light")
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_init(&s_low_power_data->low_power_window, "Low Power")
; window_set_background_color(&s_low_power_data->low_power_window, GColorLightGray); app_window_stack_push(&s_low_power_data->low_power_window, true /* Animated */); const GFont text_font = fonts_get_system_font(FONT_KEY_LECO_42_NUMBERS); const GTextAlignment text_alignment = GTextAlignmentCenter; const unsi...
assert(system_flash_erase(FLASH_BASE + 25 KiB, 871 KiB - 1, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(1, 10), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_sectors_1_thru_11(void) { cl_assert(system_flash_erase(FLASH_BASE + 25 KiB, 871 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BET...
fprintf(stderr, "%s", str)
; } extern void dbgserial_print_hex(uint32_t num) { fprintf(stderr, "0x%.08x", num); } extern void dbgserial_putstr(char *str) { fprintf(stderr, "%s\n", str); }
/* * 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(config.units, 1)
; cl_assert_equal_i(config.sign, RTC_CalibSign_Positive); } void test_rtc_calibration__slightly_fast_but_not_enough_to_calibrate(void) { // Approximately +1.01ppm RTCCalibConfig config = rtc_calibration_get_config(32768033, TARGET_FREQUENCY_mHZ); cl_assert_equal_i(config.units, 0); } void test_rtc_calibration...
0); // The modal overshoots its destination by a few pixels. When this happens, fill in the pixels // at the bottom of the screen with black. if (new_modal_offset_y < 0) { graphics_fill_rect( ctx, &GRect(0, DISP_ROWS + new_modal_offset_y, DISP_COLS, -new_m...
{ // Performs different operations on whether the modal is being pushed or popped. s_data = (CompositorModalSlideTransitionData) { .modal_is_destination = modal_is_destination, }; static const CompositorTransition s_impl = { .init = prv_transition_animation_init, .update = prv_transition_animation_...
6}, { 784, 456, 344}, { 800, 488, 272}, { 752, 552, 288}, { 736, 592, 328}, { 784, 568, 344}, { 800, 536, 392}, { 832, 536, 456}, { 856, 632, 432}, { 872, 728, 552}, { 1016, 848, 568}, { 944, 760, 512}, { 888, 456, 464}, { 800, 288, 320}, { 792, -16, 304}, { 1...
{ 784, 832, 600}, { 736, 552, 520}, { 776, 344, 416}, { 760, 360, 440}, { 760, 432, 432}, { 792, 528, 360}, { 800, 560, 256}, { 728, 576, 280}, { 728, 552, 360}, { 784, 512, 368}, { 816, 456, 416}, { 872, 504, 464}, { 832, 544, 432}, { 920, 624, 464}, { 800, 8...
{ 912, 616, -16}, { 1480, 1256, 176}, { 896, 56, 432}, { 496, -344, 472}, { 680, 208, 400}, { 800, 656, 504}, { 888, 712, 592}, { 816, 488, 512}, { 784, 344, 424}, { 736, 352, 408}, { 776, 440, 336}, { 832, 480, 224}, { 792, 504, 272}, { 752, 552, 312}, { 760...
/* * 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 (mfg_is_mfg_mode()) { return; }
app_manager_close_current_app(true); } #endif } void low_power_standby(void) { analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_WATCH_ONLY_TIME); enter_standby(RebootReasonCode_LowBattery); } void low_power_enter(void) { #if RECOVERY_FW if (mfg_is_mfg_mode()) { return; } #endif prv_low_power_tran...
/* * 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...
("42", 3, true, 42 * 3)
; } void test_ams_util__float_string_parse_separator_but_no_fraction(void) { // "21." * 3 assert_float_parse("21.", 3, true, 21 * 3); } void test_ams_util__float_string_parse_comma_decimal_separator(void) { // "1.23456" * 3 is approx 3.7036800000000003, round up to 4 assert_float_parse("1,23456", 3, true, 4);...
2_t buffer_size) {} void flash_write_bytes(const uint8_t* buffer, uint32_t start_addr, uint32_t buffer_size) {} // Fakes /////////////////////////////////////////////////////////// typedef enum EraseCommandType { SectorEraseCommand, SubsectorEraseCommand } EraseCommandType; typedef struct EraseCommand { uint32...
cl_assert_equal_i(s_command_list_index, 1)
; cl_assert_equal_i(s_command_list[0].addr, 0); cl_assert_equal_i(s_command_list[0].type, SectorEraseCommand); s_command_list_index = 0; // App that's in an aligned bank but larger than than 64k flash_region_erase_optimal_range(0, 0, 69 * 1024, 96 * 1024); cl_assert_equal_i(s_command_list_index, 3); cl...
/* * 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...
{ case CLOCK_HAND_STYLE_POINTED: prv_draw_watch_hand_pointed(ctx, hand, GPointFromGPointPrecise(center), path); case CLOCK_HAND_STYLE_ROUNDED: case CLOCK_HAND_STYLE_ROUNDED_WITH_HIGHLIGHT: default: prv_draw_watch_hand_rounded(ctx, hand, center); break; }
} static GPointPrecise prv_get_clock_center_point(ClockLocation location, const GRect *bounds) { GPoint imprecise_center_point = {0}; switch (location) { case CLOCK_LOCATION_TOP: imprecise_center_point = (GPoint) { .x = bounds->size.w / 2, .y = bounds->size.h / 4, }; case CLOCK...
rry_create_undefined(); } static size_t prv_get_realloc_array_len(const size_t required_array_len) { size_t len = s_rocky_path_steps_array_len ?: MINIMUM_ARRAY_LEN; while (required_array_len > len) { len *= 2; } return len; } static jerry_value_t prv_try_allocate_steps(const size_t num_steps_increment) { ...
(ctx, &path)
; } static GPointPrecise prv_point_add_vector_precise(GPointPrecise *pt, GVectorPrecise *v) { return GPointPrecise( pt->x.raw_value + v->dx.raw_value, pt->y.raw_value + v->dy.raw_value); } JERRY_FUNCTION(prv_fill) { GPoint *const points = task_zalloc(sizeof(*points) * s_rocky_path_steps_num); if (!point...
layStatePaused; } static Animation *prv_create_cassette_animation(MusicAppData *data) { const MusicAppSizeConfig *config = prv_config(); const GRect cassette_rect = prv_cassette_rect(); GPoint left_target = GPoint(-cassette_rect.size.w - cassette_rect.origin.x, 0); Animation *cassette_left = property_animation...
animation_set_duration(bounceback_animation, 4 * ANIMATION_FRAME_MS)
; animation_set_curve(bounceback_animation, AnimationCurveEaseOut); animation_set_handlers(disappear_animation, (AnimationHandlers) { .stopped = prv_update_icon, }, new_bitmap); Animation *sequence = animation_sequence_create(disappear_animation, bounceback_animation, NULL); data->cassette_current_ic...
} static void prv_move_shape(AppData *data) { for (uint8_t shape = POINT; shape < MAX_SHAPES; shape++) { if (shape == POINT) { // Move the point 4*X per Y data->point_p0.x += (data->point_velocity_x * PIXEL_SPEED_PER_FRAME * 4); if (data->point_p0.x < 0 || data->point_p0.x > data->window.layer....
if (data->circle_origin.y - data->circle_radius < 0 || data->circle_origin.y + data->circle_radius > data->window.layer.bounds.size.h) { data->circle_velocity_y = data->circle_velocity_y * -1; data->circle_color.argb = (((data->circle_color.argb + 1) & 0x3F) | 0xC0); }
} else if (shape == GPATH_TRIANGLE) { // Move the line 3*X per Y data->triangle_offset.x += (data->triangle_velocity_x * PIXEL_SPEED_PER_FRAME * 3); if (data->triangle_offset.x < 0 || data->triangle_offset.x > data->window.layer.bounds.size.w) { data->triangle_velocity_x = 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...
window_set_on_screen(window, true, true)
; window_render(window, &s_ctx); return window; } // Tests ////////////////////// void test_health_detail_card__render_no_data(void) { prv_create_card_and_render(&(HealthDetailCardConfig) {}); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_detail_card__render_one_heading(void...
/* * 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...
(&BOARD_CONFIG_DISPLAY.cs, GPIO_OType_PP, GPIO_Speed_50MHz)
; gpio_output_init(&BOARD_CONFIG_DISPLAY.on_ctrl, BOARD_CONFIG_DISPLAY.on_ctrl_otype, GPIO_Speed_50MHz); if (BOARD_CONFIG.power_5v0_options != OptionNotPresent) { GPIOOType_TypeDef otype = (BOARD_CONFIG.power_5v0_options == OptionActiveLowOpenDrain) ? GPIO_OType_OD...
IN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_color, GPointZero, DEG_TO_TRIGANGLE(0), GPoint(20, 20)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_color_0.Xbit.pbi")); // Top-left corner rotation point...
cl_check(gbitmap_pbi_eq(&ctx->dest_bitmap, "draw_rotated_bitmap_stamp_45deg.Xbit.pbi"))
; // Top-left corner rotation point, Angle 180 setup_test_rotate_bitmap(ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(ctx, test_image, GPoint(71, 71), DEG_TO_TRIGANGLE(180), center); cl_check(gbitmap_pbi_eq(&ctx->dest_bitmap, "dra...
clude "flash_region/flash_region.h" #include "services/common/legacy/registry_private.h" #include "system/logging.h" #include "system/passert.h" #include <string.h> #include <stdbool.h> // Header patterns must precede any registry written to flash. // They are used to indicate if a registry is active. Only one regist...
(r->uuid, uuid, UUID_SIZE_BYTES)
; r->description = description; memcpy(r->value, value, value_length); r->value_length = value_length; registry->is_different_from_flash = true; PBL_LOG(LOG_LEVEL_DEBUG, "Writing new key: %s", r->key); return 0; } void registry_record_print(Record* r) { PBL_LOG_VERBOSE("Active:\n\t"); if (r->active) ...
#define MAX_SUPPORTED_HCI_CMD_LEN (MAX_SUPPORTED_HCI_PARAM_LEN + HCI_CMD_HEADER_LEN) typedef struct { bool found_cmd_start; uint8_t param_len; uint8_t write_offset; uint8_t data_buf[MAX_SUPPORTED_HCI_CMD_LEN]; // holds one HCI cmd } HciCmdInfo; static void prv_handle_hci_cmd(void *hci_data) { uint8_t *data ...
{ // Don't intercept anything if we are in passthrough mode if (s_hci_passthrough_enabled) { return false; } // we expect to handle a "command complete" event so check for it if ((hci_msg[0] != HCI_EVT_START) || (hci_msg[1] != HCI_CMD_COMPLETE_CODE)) { return false; } typedef struct { uint8_...
bool bt_test_chip_in_test_mode(void) { return s_test_mode_enabled; } static bool prv_in_test_mode(void) { if (!s_test_mode_enabled) { char buf[80]; prompt_send_response_fmt( buf, sizeof(buf), "Not in test mode, run 'bt test start' first!"); return false; } return true; } void bt_driver_l...
rmissions and * limitations under the License. */ #include "action_chaining_window.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" typedef struct { Window window; MenuLayer menu_layer; StatusBarLayer status_layer; const char *title; TimelineItemActionGroup *action_group; ActionChainingMenu...
menu_layer_set_click_config_onto_window(&data->menu_layer, &data->window)
; layer_add_child(&data->window.layer, menu_layer_get_layer(&data->menu_layer)); #if PBL_RECT status_bar_layer_init(&data->status_layer); status_bar_layer_set_colors(&data->status_layer, PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack), PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite)); sta...
ory(HealthMinuteData *minute_data, uint32_t *num_records, time_t *utc_start) { // Get the current time time_t now = rtc_get_time(); // Get the minute index uint32_t minute_idx = now / SECONDS_PER_MINUTE; // Compute the timestamp of the end of the last record we wou...
{ AccelData accel_data[ALGORITHM_SAMPLING_RATE]; int j; for (j = 0; j < ALGORITHM_SAMPLING_RATE && i < num_samples; j++, i++) { accel_data[j] = (AccelData) { .x = samples[i].x, .y = samples[i].y, .z = samples[i].z, .did_vibrate = false, .timestamp = start_ms ...
} // -------------------------------------------------------------------------------- // Fast forward time, one minute at a time, calling all minute callbacks along the way. // This does not feed in any accel data static void prv_advance_by_days(uint32_t num_days) { for (int i = 0; i < num_days; i++) { // Adva...
ress_timer(ProgressWindow *data) { if (data->fake_progress_timer != EVENTED_TIMER_INVALID_ID) { evented_timer_cancel(data->fake_progress_timer); data->fake_progress_timer = EVENTED_TIMER_INVALID_ID; } } static void prv_set_progress(ProgressWindow *data, int16_t progress) { data->progress_percent = CLIP(p...
(progress_layer, GColorBlack)
; #endif progress_layer_set_corner_radius(progress_layer, PROGRESS_SUGGESTED_CORNER_RADIUS); layer_add_child(&window->layer, (Layer *)progress_layer); data->max_fake_progress_percent = PROGRESS_WINDOW_DEFAULT_FAKE_PERCENT; data->state = ProgressWindowState_FakeProgress; data->is_peek_layer_used = false; d...
layer_add_child(a, ab); a->next_sibling = b; stack[0] = a; // go to child if possible Layer *actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(aa, actual); cl_assert_equal_i(1, current_stack); cl_assert_equal_p(a, stack[0]); ...
GRect(10, 10, 10, 10)
/* * 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...
while (bytes != last_byte) { c = *bytes; hash = ((hash << 5) + hash) + c; bytes++; }
urn offset_16 ? sizeof(OffsetTableEntry_2_2) : sizeof(OffsetTableEntry_2_4); } else { return offset_16 ? sizeof(OffsetTableEntry_4_2) : sizeof(OffsetTableEntry_4_4); } } static int prv_offset_table_get_id(const FontMetaData *md, Codepoint codepoint) { if (FONT_VERSION(md->version) == FONT_VERSION_1) { ...
(codepoint, font_cache, font_res)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Freeing buffer storage ptr: %p", p)
static void prv_check_attribute_list_serialize(AttributeList *attr_list_to_serialize, const uint8_t *expected_attr_list_serialized, size_t expected_attr_list_serialized_size) { uint8_t buffer[expected_attr_list_serialized_size]; const...
(attribute_get_string(&list, AttributeIdSubtitle, ""), "Subtitle")
; cl_assert_equal_i(list.num_attributes, 2); attribute_list_add_uint32(&list, AttributeIdLastUpdated, value_uint32); attribute_list_add_uint8(&list, AttributeIdBgColor, value_uint8); cl_assert_equal_i(value_uint32, attribute_get_uint32(&list, AttributeIdLastUpdated, 0)); cl_assert_equal_i(value_uint8, attrib...
te) { case MusicPlayStatePlaying: // We need to update the progress bar every second. tick_timer_service_subscribe(SECOND_UNIT, prv_handle_tick_time); break; default: // We're no longer updating the progress bar; unsubscribe. tick_timer_service_unsubscribe(); } } static void prv...
(&data->track_pos_bar, PBL_IF_COLOR_ELSE(GColorRed, GColorBlack))
; progress_layer_set_corner_radius(&data->track_pos_bar, config->track_corner_radius); layer_add_child(&window->layer, (Layer *)&data->track_pos_bar); ActionBarLayer *action_bar = &data->action_bar; data->action_bar_state = ActionBarStateSkip; action_bar_layer_init(action_bar); action_bar_layer_set_context...
failed mid-way): BleAddressAndIRKChange e = {}; if (!prv_get_device_and_irk_by_conn_idx(evt->conn_idx, &e.is_resolved, &e.irk)) { // Disconnected in the mean time return; } e.is_address_updated = true; dialog_utils_bd_address_to_bt_device(&evt->address, &e.device); dialog_utils_bd_address_to_bt_dev...
PBL_ASSERTN(xTaskGetCurrentTaskHandle() == DialogTaskList[DialogTask_Ble])
; } static void prv_configure_irk(const BTDriverConfig *config) { // Use the Identity Root directly as the local Identity Resolving Key: PBL_LOG(LOG_LEVEL_DEBUG, "Setting local IRK:"); PBL_HEXDUMP(LOG_LEVEL_DEBUG, (const uint8_t *)&config->root_keys[SMRootKeyTypeIdentity], sizeof(config->root_keys[...
recognizer_set_on_destroy(r, prv_sub_destroy)
; // can't destroy a recognizer if it is owned r->is_owned = true; recognizer_destroy(r); cl_assert_equal_b(impl_destroyed, false); cl_assert_equal_b(sub_destroyed, false); r->is_owned = false; recognizer_destroy(r); cl_assert_equal_b(impl_destroyed, true); cl_assert_equal_b(sub_destroyed, true); } ...
void *context) { ActivityTestAppData *data = (ActivityTestAppData *)context; // Test the sum function if (event == HealthEventMovementUpdate) { int32_t steps_today = health_service_sum_today(HealthMetricStepCount); APP_LOG(APP_LOG_LEVEL_DEBUG, "Got steps update event.(today ...
(data->window)
; app_free(data); } // ------------------------------------------------------------------------------- static void init(void) { ActivityTestAppData *data = app_malloc_check(sizeof(ActivityTestAppData)); memset(data, 0, sizeof(ActivityTestAppData)); app_state_set_user_data(data); // Init window data->wind...
} StatusBarTextFormat; static ALWAYS_INLINE StatusBarTextFormat prv_get_text_format(void) { const PlatformType platform = process_manager_current_platform(); const char *font_key = PBL_PLATFORM_SWITCH(platform, /*aplite*/ FONT_KEY_GOTHIC_14, /*basalt*/ FONT_KEY_GOTHIC_14, /*chalk*/ FONT_KEY_GOTHI...
event_service_client_unsubscribe(&(status_bar_layer->tick_event))
; } Layer *status_bar_layer_get_layer(StatusBarLayer *status_bar_layer) { PBL_ASSERTN(status_bar_layer); return &status_bar_layer->layer; } void status_bar_layer_set_colors(StatusBarLayer *status_bar_layer, GColor background, GColor foreground) { PBL_ASSERTN(status_bar_layer); ...
valid index %" PRId32 " (len %" PRId32 ")", index, len); } return heartbeat->data + analytics_metric_offset(metric) + index*element_size; } static void prv_location_set_value(uint8_t *location, int64_t val, AnalyticsMetricElementType type) { switch (type) { case ANALYTICS_METRIC_ELEMENT_TYPE_NIL:...
(hb, ANALYTICS_DEVICE_METRIC_BLOB_VERSION, ANALYTICS_DEVICE_HEARTBEAT_BLOB_VERSION)
/* * 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...
number_window_set_max(vibe_num_window, VIBE_STRENGTH_MAX)
; number_window_set_min(vibe_num_window, VIBE_STRENGTH_MIN); number_window_set_step_size(vibe_num_window, scale_granularity); app_window_stack_push(number_window_get_window(vibe_num_window), true); } static void handle_deinit(void) { NumberWindow *data = app_state_get_user_data(); number_window_destroy(data...
#include "applib/rockyjs/rocky_res.h" #include "process_management/process_manager.h" #include "process_management/app_install_manager.h" #include "process_management/pebble_process_info.h" #include "util/size.h" // Stubs #include "stubs_accel_service.h" #include "stubs_analytics.h" #include "stubs_analytics_external...
{ return (entry->sdk_version.major == PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR && entry->sdk_version.minor <= PROCESS_INFO_CURRENT_SDK_VERSION_MINOR); }
static PebbleProcessMd *s_app_install_get_md__result; const PebbleProcessMd *app_install_get_md(AppInstallId id, bool worker) { return s_app_install_get_md__result; } void app_install_release_md(const PebbleProcessMd *md) { } static int s_process_metadata_get_res_bank_num__result; int process_metadata_get_res_ban...
uint8_t num_characteristics) { cl_assert_equal_i(num_characteristics, TestCharacteristicCount); switch (service_ref) { case TestServiceInstanceComplete: characteristics_out[0] = TestCharacteristicInstanceCompleteOne; characteristics_out[1] = TestCharacteristicInstanceCompleteTwo; ...
cl_assert_equal_i(s_services_discovered_count, 1)
/* * 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...
(metric_group->values, max_list_size, value, metric_group->max_item_string_size)
; metric_group->icons->values[metric_group->num_items++] = icon; metric_group->icons->num_values = metric_group->num_items; return true; }
List*) list_find((ListNode *) s_presented_notifs, prv_filter_presented_notification_by_id, id); } Uuid *notifications_presented_list_first(void) { NotifList * node = (NotifList *)list_get_head((ListNode*)s_presented_notifs); return node ? &node->notif.id : NULL; } Uuid *notificatio...
{ return; }
NotifList *itr = s_presented_notifs; while (itr) { NotifList *next = (NotifList *)itr->list_node.next; callback(&itr->notif.id, itr->notif.type, cb_data); itr = next; } }
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. */ #inc...
{ if (next_app_id == APP_ID_LAUNCHER_MENU) { res = prv_get_watchface_compositor_animation(CompositorTransitionDirectionRight); goto done; } else if (next_app_id == APP_ID_HEALTH_APP) { res = prv_get_health_compositor_animation(CompositorTransitionDirectionUp); goto done; ...
callback, data->callback_context); } static void prv_edit_day_handler(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { AlarmDetailData *data = (AlarmDetailData *) context; alarm_editor_update_alarm_days(data->alarm_id, data->ala...
prv_create_snooze_menu(main_menu)
, }; main_menu->separator_index = DetailMenuItemIndexSnooze; data->menu_config.root_level = main_menu; // Setup snooze menu items ActionMenuLevel *snooze_level = main_menu->items[DetailMenuItemIndexSnooze].next_level; static const unsigned snooze_delays[NUM_SNOOZE_MENU_ITEMS] = {5, 10, 15, 30, 60}; stati...
nite loop if it never fires // // NB: this function is used only by the bootloader. static volatile int s_int_fired; void dialog_spi_wait_for_int(void) { while (s_int_fired == 0) { delay_us(1000); } __disable_irq(); s_int_fired--; __enable_irq(); } // NB: this function is used only by the bootloader. st...
dialog_spi_assert_chip_select(true)
; s_dma_pending_transfer = true; spi_ll_slave_spi_enable(DIALOG_SPI); spi_ll_slave_read_write_dma_start(DIALOG_SPI, tx_buffer, rx_buffer, size, prv_dma_handler, NULL); // Don't do any set up after this point, chances are the DMA transfer complete interrupt fires // before any code that you've put here fini...
/* * 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...
string_list_get_at(list, 2)
); cl_assert_equal_s("", string_list_get_at(list, 3)); // non-null-terminated string is treated as one string - this is the standard case // please note that the string will only be terminated if there's another \0 following // when deserializing the data, the deserializer will append the needed \0 list->ser...
/* * 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...
accessory_mfg_mode_handle_char(c)
; case AccessoryInputStateIdle: return accessory_idle_mode_handle_char(c); case AccessoryInputStateImaging: return accessory_imaging_handle_char(c); case AccessoryInputStateMic: // fallthrough default: break; } return false; } bool accessory_manager_handle_break_from_isr(void) { // NOTE: ...
tic bool check_for_fw_start_failure() { // Add more failure conditions here. if (!watchdog_check_reset_flag() && !boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { // We're good, we're just starting normally. PBL_LOG_VERBOSE("We're good, we're just starting normally."); boot_bit_clear(BOOT_BIT_FW_ST...
dbgserial_putstr("i2c inited")
L); if (is_existing_intent) { if (intent->client[c].is_used) { return BTErrnoInvalidState; } } else { // Create intent for device and add to list: const size_t alloc_size = sizeof(GAPLEConnectionIntent) + (request->is_bonding_based ? sizeof(GAPLEConnectionIntentBon...
{ // Send virtual disconnection event: const PebbleTaskBitset task_mask = ~gap_le_pebble_task_bit_for_client(c); prv_put_connection_event(task_mask, device, hci_reason, false /* connected */, bonding_id); }
turn s_text_styles[content_size].fonts[font]; fail: PRIVILEGE_WAS_ELEVATED ? syscall_failed() : WTF; } //////////////////// // Public API // *** WARNING WARNING WARNING *** // Be very careful when modifying this syscall. It currently returns a pointer // to constant data in flash, which unprivileged apps are allowe...
(ANALYTICS_DEVICE_METRIC_SYSTEM_THEME_TEXT_STYLE, content_size, AnalyticsClient_System)
/* * 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...
(ctx, text_buffer, error_code_face, text_dest_rect, GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL)
; } static void prv_panic_reset_callback(void* data) { RebootReason reason = { .code = RebootReasonCode_LauncherPanic, .extra = launcher_panic_get_current_error() }; reboot_reason_set(&reason); system_reset(); } static void prv_panic_button_click_handler(ClickRecognizerRef recognizer, void *context) ...
e're in the kernel, or the app locale is the system locale. const bool use_i18n = !locale || (strncmp(locale, app_get_system_locale(), ISO_LOCALE_LENGTH) == 0); while (left) { // Copy up to the next '%' char *ptr = strchr(fmt, '%'); if (ptr == NULL) { // Get the ending \0 ...
{ goto _out_of_size; }
ex) ? MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT : MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT)); } static void prv_draw_mark_with_inversion(GContext *ctx, GBitmap *mark, const GRect *box, bool inverted) { graphics_context_s...
GSize(title_and_icon_width, fcc_title_height - fcc_title_font_cap_padding)
}; if (cell_is_selected) { // Note that we don't subtract the subtitle font's cap padding from the container height // because it exactly matches the vertical spacing we want between the title and subtitle container_rect.size.h += fcc_number_subtitle_height; } grect_align(&container_rect, cell_laye...
/* * 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...
(BITS_BETWEEN(0, 0), erased_sector)
; cl_assert(flash_locked); } void test_system_flash__erase_some_sectors_from_beginning(void) { cl_assert(system_flash_erase(FLASH_BASE, 128 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_full_flash(void) { cl_assert(system_fl...
<= 0 || delay > 0xFFFF) { prompt_send_response("Nope."); return; } struct WasteTimerData data = { count, delay }; uintptr_t data_pack; memcpy(&data_pack, &data, sizeof data_pack); if (s_abusive_timer == TIMER_INVALID_ID) { s_abusive_timer = new_timer_create(); } if (new_timer_start(s_abusive...
{ bt_lock(); { ATTHandleRange range = { .start = atoi(start_handle), .end = atoi(end_handle) }; GAPLEConnection *conn = prv_get_le_connection_and_print_info(); if (conn) { gatt_client_discovery_discover_range(conn, &range); } } bt_unlock(); }
void command_bt_disc_stop(void) { bt_lock(); { GAPLEConnection *conn = prv_get_le_connection_and_print_info(); if (conn) { bt_driver_gatt_stop_discovery(conn); } } bt_unlock(); } #if BT_CONTROLLER_DA14681 static TimerID s_sleep_test_timer = TIMER_INVALID_ID; static uint32_t s_num_sleep_iter...
opped_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, d), 1); cl_assert_equal_i(prv_count_handler_entries(&s_st...
animation_get_duration(a, false, false)
, duration_a); cl_assert_equal_i(animation_get_duration(a, false, true), play_count_a * duration_a); cl_assert_equal_i(animation_get_duration(a, true, false), delay_a + duration_a); cl_assert_equal_i(animation_get_duration(a, true, true), total_duration_a); cl_assert_equal_i(animation_get_duration(b, false, fa...
/* * 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...
layer_mark_dirty(&data->test_window.layer)
; } } static void update_test_case_status(struct FlashTestData *data) { switch (data->test_case_status) { case FLASH_TEST_STATUS_INIT: snprintf(data->status_text, STATUS_TEXT_SIZE, "Test Initialized"); break; case FLASH_TEST_STATUS_RUNNING: snprintf(data->status_text, STATUS_TEXT_SIZE, "T...
this by checking the last event, which should have been a focus // lost event. PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT); cl_assert_equal_i(event.app_focus.in_focus, false); cl_assert_equal_i(window_stack_count(app_stack), 1); // Pop the m...
(window1->on_screen, false)
; cl_assert_equal_i(window_stack_count(app_stack), 0); window_destroy(window1); window_destroy(window2); } // Tests modal and app transitions with an unfocusable modal window void test_window_stack__unfocusable_modal_and_app(void) { Window *window1 = window_create(); Window *window2 = window_create(); cl_...