prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
_LOOP_DETECT_ONE); boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_THREE); break; case 5: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 6: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); ...
{ periph_config_enable(RCC_APB1PeriphClockCmd, RCC_APB1Periph_PWR); if (PWR_GetFlagStatus(PWR_FLAG_SB) == SET) { // We just woke up from standby. For some reason this leaves the system in a funny state, // so clear the flag and reboot again to really clear things up. PWR_ClearFlag(PWR_FLAG_SB); dbg...
void boot_main(void) { gpio_enable_all(); check_and_handle_resuming_from_standby(); dbgserial_init(); dbgserial_putstr(""); dbgserial_putstr(" ___ _ _ _ "); dbgserial_putstr("/ __><_>| || |__"); dbgserial_putstr("\\__ \\| || || / /"); dbgserial_putstr("<___/|_||_||_\\_\\"); dbgserial_putstr(...
r.id, true /* send_event */)); cl_assert(reminder_db_get_len((uint8_t *) &item3, sizeof(Uuid)) == 0); memset(&temp, 0, sizeof(TimelineItem)); cl_assert(S_SUCCESS == reminder_db_next_item_header(&temp)); temp.attr_list.attributes = NULL; cl_assert(memcmp(&item4, &temp, sizeof(TimelineItem)) == 0); ...
cl_assert_equal_b(reminder_db_find_by_timestamp_title(0, title_item1.attr_list.attributes[0].cstring, NULL, &reminder), false)
; // Confirm proper item is returned for search criteria cl_assert_equal_b(reminder_db_find_by_timestamp_title(title_item1.header.timestamp, title_item1.attr_list.attributes[0].cstring, NULL, &reminder), true); cl_assert(uuid_equal(&reminder.header.id, &title_item1.header.id)); } void test_reminder_db__is...
* 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 writing, software * distributed ...
{ WhitelistEntry *e = s_head; while (e) { WhitelistEntry *next = (WhitelistEntry *) e->node.next; free(e); e = next; } s_head = NULL; s_whitelist_error_count = 0; }
void cc2564A_advert_no_sleep_wa(void) { }
---------------------------------------------------------------------------- //! Semaphore that is signaled when data has been consumed by the transport, //! when it calls to comm_default_kernel_sender_consume(). This semaphore is used to block calls to //! comm_session_send_buffer_begin_write() in case there is not en...
{ SendBuffer *sb = (SendBuffer *)send_job; const size_t length_remaining = prv_get_remaining_length(sb); const size_t length_after_offset = (length_remaining - start_offset); const size_t length_to_copy = MIN(length_after_offset, length); memcpy(data_out, prv_get_read_pointer(sb) + start_offset, length_to_cop...
static size_t prv_send_job_impl_get_read_pointer(const SessionSendQueueJob *send_job, const uint8_t **data_out) { SendBuffer *sb = (SendBuffer *)send_job; *data_out = prv_get_read_pointer(sb); return prv_get_remaining_length(sb); } static void prv_send_job_impl_...
if (cleanup->ptr != NULL) cleanup->ptr(); _clar.test_count++; /* remove any local-set cleanup methods */ _clar.local_cleanup = NULL; _clar.local_cleanup_payload = NULL; if (_clar.report_errors_only) clar_report_errors(); else clar_print_ontest( test->name, _clar.test_count, ...
clar_run_test(test, &suite->initialize, &suite->cleanup)
; break; } case 'q': _clar.report_errors_only = 1; break; case 'Q': _clar.exit_on_error = 1; break; case 'i': { int offset = (argument[2] == '=') ? 3 : 2; if (strcasecmp("all", argument + offset) == 0) clar_category_enable_all(_clar_suite_count, _cla...
pdate_proc); GContext ctx = {.lock = true}; root_layer->update_proc(root_layer, &ctx); if (s_tictoc_callback_is_color) { cl_assert_equal_i(1, s_graphics_fill_rect.call_count); cl_assert_equal_i(4, s_graphics_line_draw_precise_stroked.call_count); cl_assert_equal_i(0, s_graphics_draw_line.call_count);...
("local_day", 4.0)
ut)); cl_assert_equal_s(name_1, name_out); cl_assert_equal_i(platform_bits_1, platform_bits_out); ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_2, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr...
bt_persistent_storage_store_bt_classic_pairing(&addr_4, &link_key_4, name_4, NULL)
; cl_assert(id_4 != BT_BONDING_ID_INVALID); cl_assert_equal_i(fake_shared_prf_storage_get_bt_classic_store_count(), 4); // Update with platform bits id_4 = bt_persistent_storage_store_bt_classic_pairing(&addr_4, NULL, NULL, &platform_bits_4); cl_assert(id_4 != BT_BONDING_ID_INVALID); } void test_bluetooth_p...
UT 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 "util/circular_cache.h" #include "util/size.h" #include "clar.h" #include <string.h> #define NUM_TEST_ITEMS (3) typedef struct {...
circular_cache_contains(&s_test_cache, &s_test_item[2])
); circular_cache_push(&s_test_cache, &s_test_item[0]); circular_cache_push(&s_test_cache, &s_test_item[1]); cl_assert(!circular_cache_contains(&s_test_cache, &s_test_item[2])); cl_assert(circular_cache_contains(&s_test_cache, &s_test_item[0])); cl_assert(circular_cache_contains(&s_test_cache, &s_test_item[...
ack); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_ny_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_x_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("ou...
graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y + 3))
; } // Draws two columns of colors (first 32 colors in first column, second 32 colors in second column) // Offsets the two color columns based on input transparency static void prv_draw_boxes(GContext *ctx, uint8_t transparency) { int column = 3 - transparency; for (uint8_t color_index = 0; color_index < 64; color...
/* * 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...
(&data->ambient_reading[0])
; layer_mark_dirty(window_get_root_layer(data->window)); app_timer_register(500, timer_callback, NULL); } static void handle_init(void) { AmbientLightAppData *data = task_malloc_check(sizeof(AmbientLightAppData)); data->window = window_create(); Layer *window_layer = window_get_root_layer(data->window); ...
yticsClient_System); if (backlight_is_motion_enabled()) { light_enable_interaction(); } return; case PEBBLE_PANIC_EVENT: launcher_panic(e->panic.error_code); break; case PEBBLE_APP_LAUNCH_EVENT: if (!app_install_is_app_running(e->launch_app.id)) { process_ma...
if (running_uuid != NULL) { app_run_state_send_update(running_uuid, RUNNING); }
} #endif return; } default: return; } } //! Tasks that have to be done in between each event. static void event_loop_upkeep(void) { modal_manager_event_loop_upkeep(); } // NOTE: Marking this as NOINLINE saves us 150+ bytes on the KernelMain stack static void NOINLINE prv_handle_event(P...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
utf8_get_bounds(&success, (char[]) { 0x10, 0x0 })
; cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, }; // Init mutable types word_iter_init(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start); // Tests cl_assert(word_iter_state.current.start == word_iter_state.current....
false); set_dnd_timer_id(TIMER_INVALID_ID); } void test_do_not_disturb__manually_enable(void) { cl_assert(do_not_disturb_is_active() == false); bool enabled = do_not_disturb_is_manually_enabled(); cl_assert(enabled == false); do_not_disturb_set_manually_enabled(true); enabled = do_not_disturb_is_manually...
(WeekdaySchedule, true)
; active = do_not_disturb_is_active(); cl_assert(active == true); // !Manual && !Scheduled && Smart do_not_disturb_set_manually_enabled(false); // Overrides all DND and disables do_not_disturb_set_schedule_enabled(WeekdaySchedule, false); // Clears overrides active = do_not_disturb_is_active(); cl_assert...
e 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 languag...
strncat(dst, src, remaining)
; } dst[dst_space-1] = 0; } // ----------------------------------------------------------------------------------------- static void prv_display_scalar_history_alert(HealthAPITestAppData *data, const char *title, HealthMetric metric) { strcpy(data->debug_card.dialog_...
s_app_name_title_dict), (uint8_t *)s_app_name_title_dict); s_num_ds_notifications_received++; } else if (uid == unknown_app_message_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_unknown_app_dict), (uint8_t *)s_unknown_app_dict); s_num_ds_notifications_received++; } else if (uid == unknow...
(fake_kernel_services_notifications_ancs_notifications_count(), 4 + 4 + 4)
; } void test_ancs__should_handle_message_size_attribtue(void) { prv_send_notification((uint8_t *)&s_message_size_attr_dict); cl_assert_equal_i(s_num_requested_notif_attributes, 1); cl_assert_equal_i(s_num_ds_notifications_received, 1); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_co...
(options, "second")
; JS_VAR minute = jerry_get_object_field(options, "minute"); JS_VAR hour = jerry_get_object_field(options, "hour"); JS_VAR day = jerry_get_object_field(options, "day"); JS_VAR month = jerry_get_object_field(options, "month"); JS_VAR year = jerry_get_object_field(options, "year"); JS_VAR hour12 = jerry_get_o...
/* * 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...
(&data->x_icon)
; kernel_free(data); } static WindowStack *prv_get_window_stack(void) { return modal_manager_get_window_stack(ModalPriorityAlert); } static void prv_worker_crash_button_up_handler(ClickRecognizerRef recognizer, void *context) { WorkerCrashDialogData *data = context; // Push an event to launch the app for the...
erials__hw_version(void) { const char* hw_version; // Initially, bunch of XXs: hw_version = mfg_get_hw_version(); cl_assert(strcmp(hw_version, "XXXXXXXX") == 0); // Test writing & reading back: const char* written_hw_version1 = "ABCDEFG"; command_hwver_write(written_hw_version1); hw_version = mfg_get_...
cl_assert_equal_i(r, MfgSerialsResultFailIncorrectLength)
- static void debug_window_load(Window *window) { ActivityDemoAppData *data = window_get_user_data(window); Layer *window_layer = window_get_root_layer(window); const GRect *root_bounds = &window_layer->bounds; static SimpleMenuItem menu_items[] = { { .title = "Tracking", .callback = prv_debug_...
simple_menu_layer_destroy(data->debug_card.menu_layer)
; } // ------------------------------------------------------------------------------- static void deinit(void) { ActivityDemoAppData *data = app_state_get_user_data(); window_destroy(data->debug_window); app_free(data); } // ------------------------------------------------------------------------------- stat...
76, -80}, { 840, 208, -88}, { 840, 184, -72}, { 896, 152, -40}, { 1040, 160, 16}, { 1048, 152, 40}, { 1168, 136, 56}, { 1352, 136, 112}, { 1160, 176, 160}, { 1024, 104, 64}, { 960, 72, 8}, { 936, 112, 24}, { 896, 152, 24}, { 936, 216, 72}, { 896, 208, 144}, { ...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-09-25 15:20:22 local AccelRawData *activity_sample_100_steps_ron_2(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_ron_2 //> TEST_EXPECTED 1...
Ellipsis, GTextAlignmentLeft, NULL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_jja22.${BIT_DEPTH_NAME}.pbi")); // Test when clipping/drawing and text bounds are all at (2, 0) setup_test_aa_sw(&ctx, fb, RECT_TEXT_2_0, RECT_TEXT_2_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); gra...
(&ctx, fb, RECT_NULL_W, RECT_NULL_W, false, 1)
; graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_TEXT_0_0, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_null_null", fb, GColorWhite)); setup_test_aa_sw(&ctx, fb, RECT_NULL_H, R...
/* * 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, &path_layer->path)
; } if (!gcolor_is_transparent(path_layer->stroke_color)) { graphics_context_set_stroke_color(ctx, path_layer->stroke_color); gpath_draw_outline(ctx, &path_layer->path); } } void path_layer_init(PathLayer *path_layer, const GPathInfo *path_info) { gpath_init(&path_layer->path, path_info); const GRect...
// No record found return false; } static status_t cleanup_partial_transactions(SettingsFile *file) { for (settings_raw_iter_begin(&file->iter); !settings_raw_iter_end(&file->iter); settings_raw_iter_next(&file->iter)) { if (partially_written(&file->iter.hdr)) { // Compact will remove partially wr...
if (key_len > SETTINGS_KEY_MAX_LEN) { return E_RANGE; }
if (val_len > SETTINGS_VAL_MAX_LEN) { return E_RANGE; } const bool is_delete = (val_len == 0); const int rec_size = sizeof(SettingsRecordHeader) + key_len + val_len; if (!is_delete && file->used_space + rec_size > file->max_used_space) { return E_OUT_OF_STORAGE; } if (file->used_space + file->dea...
CREEN_HEIGHT); ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled.${BIT_DEPTH_NAME}.pbi")); printf("-- left\n"); prv_reset(); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = ...
GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 2)
; graphics_context_set_antialiased(&ctx, true); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_bolt_aa.8bit.pbi")); // Duplicate points in GPath test - makes sure theres no division by zero ;) prv_reset(); test_graphics_context_init(&ct...
if (prv_should_ignore_because_time_reminder(app_id, timestamp, title, uid, negative_action)) { PBL_LOG(LOG_LEVEL_DEBUG, "Ignoring ANCS reminders notification because existing " "time-based reminder was found in db"); return true; } // filter out s...
void ancs_notifications_handle_message(uint32_t uid, ANCSProperty properties, ANCSAttribute **notif_attributes, ANCSAttribute **app_attributes) { PBL_ASSERTN(notif_attributes && app_attributes); c...
wnMenuItem); } static GBitmap * prv_get_icon_for_test(MfgTest test) { #if MFG_INFO_RECORDS_TEST_RESULTS const bool passed = mfg_info_get_test_result(test); if (passed) { return s_menu_icons[ICON_IDX_CHECK]; } return s_menu_icons[ICON_IDX_X]; #else return NULL; #endif } static void prv_load_icons(void) {...
(data->window)
; GRect bounds = window_layer->bounds; #ifdef PLATFORM_SPALDING bounds.origin.x += 25; bounds.origin.y += 25; bounds.size.w -= 50; bounds.size.h -= 25; #endif SimpleMenuItem* menu_items; size_t num_items = prv_create_menu_items(&menu_items); data->menu_section = (SimpleMenuSection) { .num_items = ...
/* * 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_get("No location information available. To see weather, add "\ "locations in your Pebble mobile app.", data)
; const bool exit_on_pop = true; prv_show_warning_dialog(data, exit_on_pop, warning_text); weather_app_layout_set_down_arrow_visible(layout, false); weather_app_layout_set_data(layout, NULL); } } static void prv_main_window_appear(Window *window) { WeatherAppData *data = app_state_get_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...
i18n_free_all(data)
; prv_log_analytic_if_toggled(VibePatternFeature_Notifications, VibeClient_Notifications, data); prv_log_analytic_if_toggled(VibePatternFeature_PhoneCalls, VibeClient_PhoneCalls, data); prv_log_analytic_if_toggled(VibePatternFeature_Alarms, VibeClient_Alarms, data); app_free(data); } static void prv_draw_row_c...
ord (smallest first), and finally Install ID (smallest first). Verify that this is true. // This also tests that the Settings app (a special case) respects storage order if it exists // in the storage order list. AppInstallId storage_order[] = {APP_ID_NOTIFICATIONS, BG_COUNTER_APP_ID, APP_ID_SETTINGS}; AppInst...
ARRAY_LENGTH(app_menu_nodes)
; for (uint16_t i = 0; i < num_apps; i++) { app_list = (AppMenuNode *)list_sorted_add(&app_list->node, &app_menu_nodes[i].node, prv_app_node_comparator, true /* ascending */); } for (uint16_t i = 0; i < num_apps; i++) { AppMenuNode *node = (AppMenuNode *)list...
/* * 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...
{ *data = (WakeupUICbData) { .count = missed_apps_count, .app_ids = missed_app_ids, }; launcher_task_add_callback(prv_show_dialog, data); }
// don't really care if it fails. }
_container); // Status bar status_bar_layer_init(&s_phone_ui_data->status_bar); layer_set_frame(&s_phone_ui_data->status_bar.layer, &GRect(0, 0, window->layer.bounds.size.w - PBL_IF_RECT_ELSE(ACTION_BAR_WIDTH, 0), STATUS_BAR_LAYER_HEIGHT)); status_bar_layer_set_colors...
(caller->number, source)
; } uint8_t actions = PhoneCallActions_Decline; if (can_reply) { actions |= PhoneCallActions_Reply; } if (can_answer) { actions |= PhoneCallActions_Answer; } prv_action_bar_setup(actions); prv_start_ringing(); } void phone_ui_handle_outgoing_call(PebblePhoneCaller *caller) { if (s_phone_ui_...
f (!disconnected) { PBL_LOG(LOG_LEVEL_INFO, "Ignoring end call. A call is not in progress"); } } static void prv_handle_caller_id(PebblePhoneEvent *event) { if (s_call_in_progress) { phone_ui_handle_caller_id(event->caller); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Ignoring caller id. A call is not in prog...
{ analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_DECLINE_COUNT, AnalyticsClient_System); PBL_LOG(LOG_LEVEL_INFO, "Call declined"); if (prv_call_is_ancs()) { ancs_perform_action(s_call_identifier, ActionIDNegative); ancs_phone_call_temporarily_block_missed_calls(); prv_cancel_call_watchdog(); } el...
/* * 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_window_handlers(s_data.window, (WindowHandlers) { .load = window_load, .unload = window_unload, })
; const bool animated = true; window_stack_push(s_data.window, animated); } static void deinit(void) { window_destroy(s_data.window); } int main(void) { init(); app_event_loop(); deinit(); }
ped_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), ANIMATION_NORMALIZED_MAX); #endif } // ------------------------------------------...
prv_count_handler_entries(&s_setup_handler_calls, a)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, inner_seq), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_ca...
/* * 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...
(__dtcm_bss_start, 0, __dtcm_bss_end - __dtcm_bss_start)
; #endif SystemInit(); icache_enable(); dcache_enable(); main(); // Main shouldn't return while (true) {} }
EST_OFFSET_X, COMPOSITE_TEST_OFFSET_Y)); graphics_context_set_compositing_mode(ctx, compositing_mode); graphics_draw_bitmap_in_rect(ctx, bitmap, &destination); } static void prv_composite_test(const char *unit_test_name, GCompOp compositing_mode) { for...
GPoint(0, -25)
(sizeof(GAPLEAdvertisingJob) + payload->ad_data_length + payload->scan_resp_data_length)
; *job = (const GAPLEAdvertisingJob) { .unscheduled_callback = callback, .unscheduled_callback_data = callback_data, .term_time_elapsed_secs = 0, .num_terms = num_terms, .tag = tag, .payload = { .ad_data_length = payload->ad_data_length, .scan_resp_data_length = payload->scan_resp...
ross_y(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, 20, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_clip_across_y_second_line(Layer* me, GC...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_y.${BIT_DEPTH_NAME}.pbi"))
; test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_nx); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); ...
x == HORIZ_ADVANCE_PX * 3); line_reset(&line, utf8_bounds.start); cl_assert(line_add_words(&line, &word_iter, NULL)); cl_assert(line.height_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 3); cl_assert(line.origin.x == 0); cl_assert(line.origin.y == 0); cl_assert(line.suffix_codepoint == 0); c...
cl_assert(line.suffix_codepoint == 0)
; cl_assert(*line.start == 'l'); } void test_line_layout__test_walk_lines_down(void) { // Allocate mutable types Iterator line_iter = ITERATOR_EMPTY; LineIterState line_iter_state = { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "\n\n\0"...
16, 296, -136}, { 976, 344, -200}, { 1136, 392, -272}, { 1064, 400, -304}, { 1064, 360, -264}, { 1224, 392, -248}, { 1056, 352, -208}, { 1128, 328, -168}, { 1208, 336, -112}, { 1192, 296, -64}, { 1056, 256, -8}, { 896, 208, 16}, { 776, 184, 0}, { 752, 160, 0}, { 7...
{ 1064, 280, -152}, { 720, 264, -168}, { 504, 256, -144}, { 440, 192, -152}, // 88 seconds { 520, 208, -104}, { 720, 248, -168}, { 936, 280, -192}, { 1112, 312, -288}, { 1056, 288, -296}, { 1176, 304, -272}, { 1344, 344, -296}, { 1064, 312, -240}, { 1072, 304, -16...
{ 1056, 336, -256}, { 1304, 384, -232}, { 1200, 384, -240}, { 992, 336, -168}, { 1032, 336, -168}, { 1152, 312, -144}, { 1112, 264, -80}, { 904, 200, -56}, { 728, 168, -64}, { 640, 168, -72}, { 664, 160, -32}, { 752, 152, -8}, // 91 seconds { 864, 104, 0}, { ...
/* * 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 NULL; }
if ((sequence->play_count != GDRAW_COMMAND_SEQUENCE_PLAY_COUNT_INFINITE_STORED) && (elapsed >= gdraw_command_sequence_get_total_duration(sequence))) { // return the last frame if the elapsed time is longer than the total duration return gdraw_command_sequence_get_frame_by_index(sequence, sequence->num...
look at the // gatt service state PBL_ASSERTN(0); #endif } return; } } prv_enter_awaiting_reset_complete(client, true /* self_initiated */); } // ------------------------------------------------------------------------------------------------- static void prv_handle_reset_request(...
{ client->out.timeouts_counter = 0; client->out.ack_timeout_state = AckTimeoutState_Inactive; // Ack'd one of the packets in flight const uint32_t next_sn = prv_next_sn(sn); const uint16_t num_bytes_acked = prv_total_num_bytes_awaiting_ack_up_to(client, next_sn); comm_session_send_queue_consume...
else if (sn == prv_prev_sn(client->out.next_expected_ack_sn)) { // Data we had sent got dropped causing the other side to re-ACK the last data it had received. // Don't roll back directly to avoid creating an Sorcerer's Apprentice bug // https://en.wikipedia.org/wiki/Sorcerer%27s_Apprentice_Syndrome //...
activity_algorithm_enable_activity_tracking(false /* disable */); PBL_LOG(LOG_LEVEL_INFO, "Starting a workout with type: %d", type); prv_put_event(PebbleWorkoutEvent_Started); } unlock: prv_unlock(); return rv; } // ---------------------------------------------------------------------------------------...
if (!workout_service_is_workout_type_supported(session->type)) { rv = false; goto unlock; }
/* * 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...
(af_config.gpio)
/* * 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...
{ HcProtocolMessage *msg = hc_protocol_enqueue_with_payload_and_expect( HcEndpointID_Analytics, HcMessageID_Analytics_GetConnEventStats, NULL, 0); if (!msg) { // Should be a basic log for timed out expect in hc_protocol layer return false; } memcpy(stats, &msg->payload[0], sizeof(*stats));...
static void prv_analytics_bt_chip_boot_cb(void *context) { HcAnalyticsRebootInfo *info = context; analytics_event_bt_chip_boot(info->build_id, info->last_crash_lr, info->reboot_reason_code); kernel_free(info); } void hc_endpoint_analytics_host_handler(const HcProtocolMessage *msg) { switch (msg->command_id) ...
MBUF_EMPTY }; list_init(&new_attr->list_node); mbuf_set_data(&new_attr->mbuf, buffer, buffer_length); // add the node to our list mutex_lock(s_attr_list_lock); s_attr_head = (SmartstrapAttributeInternal *)list_prepend(&s_attr_head->list_node, &new...
prv_start_transaction(attr, AttributeTransactionEndWrite)
) { // they didn't call smartstrap_begin_write first return SmartstrapResultInvalidArgs; } } attr->write_length = write_length; attr->request_type = type; attr->timeout_ms = timeout_ms; smartstrap_connection_kick_monitor(); return SmartstrapResultOk; } DEFINE_SYSCALL(void, sys_smartstrap_a...
was sent. If a calendar event has multiple notifications, // for example, 15 mins before and 5 minutes before, ANCS will send 2x ANCS notifications. // Because our dupe detection is based on the ANCS timestamp field, it filters out any calendar // event reminder following the initial one. Therefore, skip dupe fi...
prv_should_ignore_because_apple_mail_dot_app_bug(app_id, message)
) { PBL_LOG(LOG_LEVEL_ERROR, "Ignoring ANCS notification because Mail.app bug"); return true; } // Calendar and time-based Reminders app reminders are handled through the mobile app and are // added to reminder_db, so we filter them out to avoid doubling up. Notifications from other // apps and locatio...
his file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIO...
if (data->battery_icon_id != new_battery_icon_id) { data->battery_icon_id = new_battery_icon_id; kino_layer_set_reel_with_resource(&data->battery_icon, data->battery_icon_id); }
} /////////////////// // Events static void prv_event_handler(PebbleEvent *e, void *context) { LauncherMenuData *data = (LauncherMenuData *) context; prv_reload_status_bar_icons(data); } static void prv_subscribe_to_event(EventServiceInfo *result, PebbleEventType type, ...
/* * 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...
{ NotifList * node = (NotifList *)list_get_head((ListNode*)s_presented_notifs); return node ? &node->notif.id : NULL; }
Uuid *notifications_presented_list_last(void) { NotifList * node = (NotifList *)list_get_tail((ListNode*)s_presented_notifs); return node ? &node->notif.id : NULL; } Uuid *notifications_presented_list_relative(Uuid *id, int offset) { NotifList *const start_node = prv_find_listnode_for_notif(id); NotifList *c...
ce_type_valid(serialized_slice->type) || !WITHIN(serialized_slice->total_size, APP_GLANCE_DB_SLICE_MIN_SIZE, APP_GLANCE_DB_SLICE_MAX_SIZE)) { return false; } // Deserialize the AttributeList from `serialized_slice` AttributeList attr_list = {}; char *attr_list_data_buffer = NULL; if (...
if (rv == S_SUCCESS) { *time_out = serialized_glance_header.creation_time; }
return rv; } status_t app_glance_db_delete_glance(const Uuid *uuid) { return app_glance_db_delete((uint8_t *)uuid, UUID_SIZE); } ////////////////////// // Settings helpers ////////////////////// // TODO PBL-38080: Extract out settings file opening/closing and mutex locking/unlocking for BlobDB static status_t ...
, mark_synced); if (rv == S_SUCCESS) { TimelineItemId parent_id = ((CommonTimelineItemHeader *)val)->parent_id; if (timeline_get_private_data_source(&parent_id)) { goto done; } // Not a private data source, must be a PBW AppInstallId install_id = app_install_get_id_for_uuid(&parent_id); ...
(read_buf)
; return (S_SUCCESS); cleanup: task_free(read_buf); return status; } bool pin_db_exists_with_parent(const TimelineItemId *parent_id) { return timeline_item_storage_exists_with_parent(&s_pin_db_storage, parent_id); } status_t pin_db_read_item_header(TimelineItem *item_out, TimelineItemId *id) { SerializedTi...
/* * 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...
malloc(sizeof(FrameBuffer))
; framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); ctx = (GContext){}; // Setup resources fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); re...
------------------------------------------------------------------- //! Log when the CC2564x BT chip becomes unresponsive void analytics_event_bt_cc2564x_lockup_error(void) { AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_BtLockupError, }; ANALYTICS_LOG_DEBUG("CC2564x lockup event"); analytics_...
{ // Format the event specifc info in the blob. The analytics_logging_log_event() method will fill // in the common fields AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_HealthInsightResponse, .health_insight_response = { .time_utc = timestamp, .insight_type = insight_type, .a...
// ------------------------------------------------------------------------------------------ // Log an App Crash event void analytics_event_app_crash(const Uuid *uuid, uint32_t pc, uint32_t lr, const uint8_t *build_id, bool is_rocky_app) { AnalyticsEventBlob event_blob = { .event...
{ // settings has to be at the beginning. The app_menu_data_source module enforces it AppInstallId app_order[] = {APP_ID_SETTINGS, APP_ID_MUSIC, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, APP_ID_WATCHFACES, APP_ID_WORKOUT, BG_COUNTER_APP_ID}; uint8_t num_entr...
void test_app_menu_data_source__floating_music_app(void) { // settings has to be at the beginning. The app_menu_data_source module enforces it // This test will move the music app to the second position AppInstallId written_order[] = {APP_ID_SETTINGS, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, ...
/* * 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...
(index < NUM_ACTION_BAR_ITEMS, "Index: %"PRIu8, index)
; const uint8_t bit = (1 << index); if (action_bar_is_highlighted(action_bar, index) == highlighted) { return; } if (highlighted) { action_bar->is_highlighted |= bit; } else { action_bar->is_highlighted &= ~bit; prv_register_redraw_timer(action_bar); } action_bar->state_change_times[index...
break; default: PBL_CROAK("reset loop boot bits overrun"); break; } return false; } static bool check_for_recovery_start_failure() { return boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS); } static bool check_for_fw_start_failure() { // Add more failure conditions here. if (!watchdog_check_r...
(" \\/_\\__ \\ /' _ `\\ \\ \\ \\ \\/\\ \\/\\ \\/\\ \\/\\ \\/\\ \\")
/* * 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...
((ListNode *)s_read_head, &read->node)
; } else { s_read_head = read; } return BTErrnoOK; } void gatt_client_consume_read_response(uintptr_t object_ref, uint8_t value_out[], uint16_t value_length, GAPLEClient client) { } typedef s...
acheEntry; ////////////////////////////////////// // KinoPlayer callbacks static void prv_glance_reel_player_frame_did_change_cb(KinoPlayer *player, void *context) { LauncherAppGlanceService *service = context; launcher_app_glance_service_notify_glance_changed(service); } /////////////////////////// // Slice exp...
kino_player_get_reel(glance_reel_player)
NES = 2; static const int SHORT_ITEM_MAX_ROWS_SPALDING = 3; static GFont prv_get_item_font(void) { return system_theme_get_font(TextStyleFont_MenuCellTitle); } //! Only used on round displays to achieve a fish-eye effect static GFont prv_get_unfocused_item_font(void) { return system_theme_get_font(TextStyleFont_H...
menu_cell_basic_horizontal_inset()
); GContext *ctx = graphics_context_get_current_context(); // On rectangular displays, if the indicator is present, the indicator also will be offset, // so we add another nudge between the text and the indicator. #if PBL_RECT if (!item->is_leaf) { const GSize indicator_size = graphics_text_layout_get_max_u...
NULL); #else const GFont font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle); GRect box = cell_layer->bounds; box.origin.y += 6; graphics_draw_text(ctx, i18n_get("Clear All", data), font, box, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL);...
menu_layer_reload_data(&s_data->menu_layer)
; prv_update_text_layer_visibility(s_data); } // we don't handle reminders within the notifications app } /////////////////// // Window callbacks static void prv_window_appear(Window *window) { NotificationsData *data = window_get_user_data(window); prv_update_text_layer_visibility(data); } static void ...
-16, 456, -904}, { -16, 456, -912}, { -16, 440, -904}, { -24, 448, -904}, { -16, 440, -912}, { -16, 440, -904}, { -16, 448, -904}, { -8, 448, -904}, { 0, 432, -912}, // 5 seconds { -16, 432, -904}, { -16, 448, -912}, { -8, 472, -904}, { -8, 456, -912}, { -8, 448,...
{ -8, 488, -888}, { -16, 472, -896}, { -8, 464, -896}, { -8, 480, -888}, { -8, 480, -896}, { 0, 480, -904}, { -8, 480, -888}, { -16, 480, -880}, { -16, 496, -888}, { -16, 472, -880}, { -8, 480, -888}, { -16, 480, -880}, { -8, 480, -888}, { -16, 480, -888}, { -...
{ 32, 488, -872}, { 24, 496, -880}, { 32, 488, -888}, { 24, 496, -880}, { 16, 496, -880}, { 24, 488, -888}, { 16, 488, -880}, { 24, 488, -872}, { 24, 488, -880}, { 16, 488, -888}, { 16, 488, -880}, { 40, 528, -920}, { -8, 512, -912}, { 64, 640, -1104}, { 256,...
/* * 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...
GPointPrecise(center.x.raw_value - radius_x, center.y.raw_value)
; } } // This algorthm operates on angle starting at our 90° mark, so we add 90° // and flip x/y coordinates (see last line of this function) angle = (angle + (TRIG_MAX_ANGLE / 4)) % TRIG_MAX_ANGLE; // This is going to be divided by fixed-point precision number so division here is unnecessary int32_t ...
2d__fill(void) { rocky_global_init(s_graphics_api); prv_create_global_ctx(); EXECUTE_SCRIPT( "ctx.moveTo(1, 2);\n" "ctx.lineTo(3, 4);\n" "ctx.fill();\n" ); // only 2 points cl_assert_equal_i(0, s_gpath_draw_filled.call_count); EXECUTE_SCRIPT( "ctx.lineTo(5, 6);\n" "ctx.fill();\n" ...
{ rocky_global_init(s_graphics_api); prv_create_global_ctx(); EXECUTE_SCRIPT_EXPECT_UNDEFINED("ctx.arcTo"); EXECUTE_SCRIPT_EXPECT_UNDEFINED("ctx.bezierCurveTo"); EXECUTE_SCRIPT_EXPECT_UNDEFINED("ctx.quadraticCurveTo"); }
extern size_t s_rocky_path_steps_num; extern RockyAPIPathStep *s_rocky_path_steps; void test_rocky_api_graphics_path2d__state_initialized_between_renders(void) { rocky_global_init(s_graphics_api); s_rocky_path_steps_num = 2; EXECUTE_SCRIPT("_rocky.on('draw', function(e) {});"); Layer *l = &app_window_stack...
l_assert_equal_p(write_sb, NULL); // ..send_buffer_destroy() is already called in the yield cb } void test_session_send_buffer__write_beyond_available_space(void) { s_valid_session = &s_session; // Fill the send buffer completely: const size_t max_length = comm_session_send_buffer_get_max_payload_length(&s_s...
(memcmp(pp_data_out + sizeof(PebbleProtocolHeader) - offset, fake_data_payload, max_payload_length - offset), 0)
; // ..._get_read_pointer(): uint16_t bytes_read = 0; uint16_t read_space; const uint8_t *data_out; while ((read_space = s_default_kernel_send_job_impl.get_read_pointer(job, &data_out))) { PebbleProtocolHeader *header = (PebbleProtocolHeader *) data_out; if (bytes_read == 0) { cl_assert(read_s...
icense, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distribut...
uint32_t bytes_written = data_at - stop_read_address; if (bytes_written == 0) { goto cleanup; } // TODO: We are perpetuating the defective crc here. Maybe this is as good an excuse as any // for the mobile apps to implement flash_crc32 uint32_t crc = flash_calc...
bool pb_storage_raw_init(PutBytesStorage *storage, PutBytesObjectType object_type, uint32_t total_size, PutBytesStorageInfo *info, uint32_t append_offset) { const MemoryLayout *layout = prv_get_layout_for_type(object_type); storage->impl_data = (void*) layout; storage->current_offset =...
0]; uint32_t bytes_left[10]; const int item_size = 1; for (int i = 0; i < 10; i++) { logging_sessions[i] = data_logging_create(i, DATA_LOGGING_UINT, item_size, false); cl_assert(logging_sessions[i]); fake_system_task_callbacks_invoke_pending(); buf_size[i] = bytes_left[i] = rand() % (50 * 300); ...
data_logging_create(0x1234, DATA_LOGGING_UINT, 4, false)
BUFFER_SIZE - 1)); cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // One callback event scheduled: assert_num_callback_events(1); prv_process_callback_events(); assert_num_callback_events(0); // Expect 3rd message callbacks and still 1 drop callbac...
(AppInboxServiceTagUnitTest, 1, s_writer)
_screen, true); cl_assert_equal_i(windows[1][0]->is_click_configured, false); cl_assert_equal_p(s_last_click_configured_window, windows[3][1]); for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) { for (int i = 0; i < num_windows_per_stack; i++) { window_stack_remove(windows[idx...
cl_assert_equal_i(windows[3][0]->on_screen, false)
; cl_assert_equal_i(windows[3][0]->is_click_configured, false); cl_assert_equal_i(windows[2][1]->on_screen, false); cl_assert_equal_i(windows[2][1]->is_click_configured, false); cl_assert_equal_p(s_last_click_configured_window, windows[3][0]); // Add priority 1 opaque window 0 cl_assert(NumModalPriorities ...
cl_assert_equal_i(mfg_info_get_rtc_freq(), 4); char buffer[MFG_INFO_MODEL_STRING_LENGTH] = { 0 }; mfg_info_get_model(buffer); cl_assert_equal_s(buffer, ""); cl_assert_equal_i(mfg_info_get_disp_offsets().x, 0); cl_assert_equal_i(mfg_info_get_disp_offsets().y, 0); // Set x and y offsets and make su...
(result_model)
; cl_assert_equal_s(model, result_model); // Make sure the boot fpga is still correct 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); // Now invalidate the section and write it back. Make sure it c...
n); return animation; } static void prv_push_pin_window(TimelineAppData *data, TimelineIterState *state, bool animated) { TimelineLayout *timeline_layout = timeline_layer_get_current_layout(&data->timeline_layer); if (!timeline_layout) { return; } // Animation structure: // - Scheduled simultaneously ...
{ return; }
animation_unschedule(data->current_animation); Animation *day_sep_hide = timeline_layer_create_day_sep_hide(&data->timeline_layer); animation_set_handlers(day_sep_hide, (AnimationHandlers){ .stopped = prv_hide_day_sep_stopped, }, data); data->current_animation = day_sep_hide; animation_schedule(day_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...
psleep((SECTOR_SIZE_BYTES > (64 * 1024)) ? 20 : 4)
; } if (feed_watchdog) { task_watchdog_bit_set(pebble_task_get_current()); } } static void prv_erase_optimal_range(uint32_t min_start, uint32_t max_start, uint32_t min_end, uint32_t max_end, bool feed_watchdog) { PBL_LOG(LOG_LEVEL_DEBUG, "flash_region_erase_optimal_rang...
%d minutes"); char snooze_buf[32]; snprintf(snooze_buf, sizeof(snooze_buf), i18n_get(snooze_text, dialog), alarm_get_snooze_delay()); i18n_free(snooze_text, dialog); dialog_set_text(dialog, snooze_buf); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE); dialog_set_background_color(dialog, GCo...
{ s_alarm_popup_data->vibe_count = 0; unsigned int vibe_repeat_interval_ms = TINTIN_VIBE_REPEAT_INTERVAL_MS; #if CAPABILITY_HAS_VIBE_SCORES if (low_power_is_active()) { s_alarm_popup_data->vibe_score = vibe_client_get_score(VibeClient_AlarmsLPM); } else { s_alarm_popup_data->vibe_score = vibe_client_get...
// ---------------------------------------------------------------------------------------------- //! Click Handler static void prv_dismiss_click_handler(ClickRecognizerRef recognizer, void *data) { alarm_dismiss_alarm(); prv_show_dismiss_confirm_dialog(); actionable_dialog_pop(s_alarm_popup_data->alarm_popup);...
There are 10 lights"); // Variable length digits output snprintf(dstbuf, 256, "There are %.*o lights", 3, 8); cl_assert_equal_s(dstbuf, "There are 010 lights"); // Variable length digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.*ozero%.*o", -3, 0, -3, 1); cl_assert_equal_s(dstbuf, ...
(dstbuf, 256, "There are %03X lights, %03X", 16, -4)
; cl_assert_equal_s(dstbuf, "There are 010 lights, FFFFFFFC"); // Space padded minimum character output snprintf(dstbuf, 256, "There are %3X lights, %3X", 16, -4); cl_assert_equal_s(dstbuf, "There are 10 lights, FFFFFFFC"); // Space for positive signed // No signed conversion occurs, so this is a no-op ...
/* * 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...
kino_reel_create_with_resource_system(SYSTEM_APP, dialog->icon_id)
he format of the binary core dump is streamable and is read until we reach a chunk key // of 0xFFFFFFFF (what gets placed into flash after an erase). vTaskListWalk(prvTaskInfoCallback, NULL); // If we core dumped from an ISR, we make up a special "ISR" thread to hold the registers if (!RETURNS_TO_PSP(s_saved_r...
{ s_test_force_bus_fault = true; }
tack), &current_stack, true); cl_assert_equal_p(aaa, actual); cl_assert_equal_i(2, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(aa, stack[1]); cl_assert_equal_p(aaa, stack[2]); // go to child if possible actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &...
GPoint(9, 9)
), &child_a); cl_assert_equal_p(layer_find_layer_containing_point(&child_a, &GPoint(0, 0)), &child_a); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(9, 9)), &child_a); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(10, 10)), &parent); layer_add_child(&child_a, &chi...
r(uint32_t num_dropped_messages) {} //////////////////////////////////////////////////////////////////////////////////////////////////// // Tests static CommSession *s_session = (CommSession *)0xaabbccdd; void test_app_message_receiver__initialize(void) { s_kernel_receiver_available = true; s_kernel_receiver = (...
app_message_receiver_close()
; } void test_app_message_receiver__receive_push(void) { Receiver *r = prv_create_inbox_prepare_and_write(); s_rcv_imp->finish(r); prv_process_events(); cl_assert_equal_b(false, s_kernel_receiver_is_receiving); cl_assert_equal_b(false, s_kernel_receiver_finish_called); cl_assert_equal_m(&s_push, s_app_me...
e - 1)); graphics_draw_line( ctx, GPoint(radial_padding_size, layer->bounds.size.h / 2), GPoint(layer->bounds.size.w - radial_padding_size - 1, layer->bounds.size.h / 2)); prv_draw_border(layer, ctx, radial_padding_size); } static void prv_draw_bitmap(struct Layer *layer, GContext *ctx, uint32_t res) ...
if (app_manager_get_current_app_md() == mfg_display_app_get_info()) { process_manager_send_callback_event_to_process(PebbleTask_App, prv_change_pattern, data); } else { app_manager_launch_new_app(&(AppLaunchConfig) { .md = mfg_display_app_get_info(), .common.args = data, }); }
} void command_display_set(const char *color) { const char * const ARGS[] = { [TestPattern_Black] = "black", [TestPattern_Gray] = "gray", [TestPattern_White] = "white", [TestPattern_Crosshair] = "crosshair", #if PBL_COLOR [TestPattern_Veggies] = "veggies", [TestPattern_Pinwheel] = "pinwheel"...
/* * 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...
alerts_get_mask()
== AlertMaskAllOn); // Should not allow any notifications through alerts_set_mask(AlertMaskAllOff); cl_assert(!alerts_should_notify_for_type(AlertInvalid)); cl_assert(!alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_notify_fo...
/* * 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...
{ init(false /* disconnected */); check_disconnected(); //! Get connected event prv_send_connection_event(true); // Event put prv_assert_event_received(true); check_connected(); }
ataLoggingSession *logging_session) { if (uuid_is_system(&logging_session->app_uuid)) { PBL_LOG(LOG_LEVEL_WARNING, "Deleting the system data logging session with tag %"PRIu32, logging_session->tag); } mutex_lock_recursive(s_list_mutex); DataLoggingSession **iter = &s_logging_sessions; while ...
(s_list_mutex)
; if (cur == NULL) { // Return the head mutex_unlock_recursive(s_list_mutex); return s_logging_sessions; } DataLoggingSession *logging_session = ((DataLoggingSession *)cur)->next; mutex_unlock_recursive(s_list_mutex); return logging_session; } bool dls_list_for_each_session(bool (callback(DataLo...
amples); memset(activity_private_state()->hr.weights, 100, num_samples); for (int i = 0; i < num_minutes; i++) { prv_minute_system_task_cb(NULL); } } static bool prv_is_hr_elevated(void) { return activity_private_state()->hr.metrics.is_hr_elevated; } void test_activity__update_time_in_hr_zones(void) { ...
cl_assert_equal_i(zone1_minutes, 4)
; activity_get_metric(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes); cl_assert_equal_i(zone2_minutes, 2); activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes); cl_assert_equal_i(zone3_minutes, 2); // Advance to a new day. The HR zone stats should get reset time_t utc_sec = ...
atic BTBondingID prv_get_bonding_id_for_intent(const GAPLEConnectionIntent *intent) { if (intent->is_bonding_based) { return intent->bonding->id; } return BT_BONDING_ID_INVALID; } // ------------------------------------------------------------------------------------------------- static void prv_start_connec...
if (request->is_bonding_based) { // Create bonding info cache if it has not been created yet: intent->is_bonding_based = true, *intent->bonding = request->bonding; if (connected_device) { intent->device = *connected_device; } } else { intent->device = *request->device; ...
} intent->client[c].is_used = true; intent->client[c].auto_reconnect = auto_reconnect; intent->client[c].is_pairing_required = is_pairing_required; intent->client[c].connected = false; // starting state if (!is_already_connected) { return BTErrnoOK; } if (is_pairing_required && !is_already_encr...
me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(-5, 15)); } void outside_x_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(15, -5)); } void outside_nx_ny_layer_u...
(0, 0, 10, 10)
l(30, 40, 10, 30, 0, 2 * Math.PI);\n" ); cl_assert_equal_i(2, s_graphics_fill_radial_precise_internal.call_count); cl_assert_equal_point_precise(PP(29.5, 39.5), lc->fill_radial_precise.center); cl_assert_equal_i(10*8, lc->fill_radial_precise.radius_inner.raw_value); cl_assert_equal_i(30*8, lc->fill_radial_pr...
{ prv_global_init_and_set_ctx(); EXECUTE_SCRIPT_EXPECT_ERROR( "ctx.lineWidth = -1;", "TypeError: Argument at index 0 is invalid: Value out of bounds for native type" ); EXECUTE_SCRIPT_EXPECT_ERROR( "ctx.lineWidth = 256;", "TypeError: Argument at index 0 is invalid: Value out of bounds ...
void test_rocky_api_graphics__fill_and_stroke_styles(void) { prv_global_init_and_set_ctx(); EXECUTE_SCRIPT( "ctx.fillStyle = '#f00';\n" "ctx.strokeStyle = 'white';\n" "var c = ctx.fillStyle;\n" ); cl_assert_equal_i(1, s_graphics_context_set_fill_color.call_count); cl_assert_equal_i(GColorRedAR...
data->complete_callback(EDITED, data->alarm_id, data->callback_context); } app_window_stack_pop(true); } } else { // selecting a day of the week // day_of_week index starts from sunday, and printed list starts from monday uint16_t day_of_week = (cell_index->row) % DAYS_PER_WEEK; dat...
i18n_get(label, data)
, .range = { .update = true, .text = is_smart ? i18n_get(range_text, data) : NULL, .duration_m = SMART_ALARM_RANGE_S / SECONDS_PER_MINUTE, .enabled = is_smart, }, }; time_selection_window_configure(&data->time_picker_window, &config); // Reset the selection layer to the first cell ...
/* * 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(21845, f(two_third, half, ANIMATION_NORMALIZED_MAX))
ct(), .expected_output = "[object Object]", }, }; for (int i = 0; i < ARRAY_LENGTH(cases); ++i) { jerry_value_t input = cases[i].input; JERRY_ARGS_MAKE(input); // Exercise ROCKY_ARG (automatic binding creation, defaults to malloc'd string for char *): { char *output = NULL; R...
for (int i = 0; i < ARRAY_LENGTH(cases); ++i) { jerry_value_t *argv = cases[i].argv; jerry_length_t argc = cases[i].argc; GRectPrecise output; memset(&output, 0x55, sizeof(output)); ROCKY_ARGS_ASSIGN(ROCKY_ARG(output)); ASSERT_JS_ERROR(error_value, cases[i].error_msg); if (!cases[i].error_...
i18n_noop("Workout")
; case ActivitySessionType_Walk: /// Walk Label return i18n_noop("Walk"); case ActivitySessionType_Run: /// Run Label return i18n_noop("Run"); case ActivitySessionType_Sleep: case ActivitySessionType_RestfulSleep: case ActivitySessionType_Nap: case ActivitySessionType_Res...
boot_version_read()
>= SHUTDOWN_MIN_BOOT_VERSION; } static void prv_shutdown_confirm_cb(ClickRecognizerRef recognizer, void *context) { actionable_dialog_pop((ActionableDialog *) context); battery_ui_handle_shut_down(); } static void prv_shutdown_back_cb(ClickRecognizerRef recognizer, void *context) { actionable_dialog_pop((Actio...
5), GPoint(45, 10), 2)); #endif setup_test(&context, true, 2, 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, 2, GColorBlack, GColorBlack, false); graphics_draw_circle(&context, ...
GRect(10, 20, 40, 10)
); ASSERT_CALLED(prv_fill_rect_non_aa(&context, &GRect(10, 20, 40, 10), 0, GCornerNone, GColorBlack)); setup_test(&context, false, 5, GColorBlack, GColorBlack, false); graphics_fill_circle(&context, GPoint(50, 50), 10); ASSERT_CALLED(graphics_circle_fill_non_aa(&context, GPoint(50, 50), 10)); setup_test(&co...
est // Pick an arbitrary identifier to send in ack identifier = this->state->next_terminate_id++; } else { // Update the next-terminate-id so that the next ack sent not in response to // a Terminate-Request does not look like a retransmission. this->state->next_terminate_id = identifier + 1; } ...
{ // Only configure requests with no options are sent at the moment. // If the length is greater than four, there are options in the Ack // which means that the Ack'ed options list does not match the // options list from the request. The Ack packet is invalid. PBL_LOG(LOG_LEVEL_WARNING, ...
EBUG, "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 bool is_running = ((app_run_state->state == RUNNING) ? true : false); launcher...
system_task_add_callback(prv_send_response, app_run_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...
prompt_send_response(" BTDeviceInternal: ")
; PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, (uint8_t *)&info->identity, sizeof(BTDeviceInternal)); prompt_send_response(" SMConnectionSignatureResolvingKey: "); PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, (uint8_t *)&info->csrk, si...
_assert_equal_s(tmbuf, "013 0001"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%01j %05m %03M %05p", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "002 00001 000 PM"); #if EXTENSION_GNU tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%05P", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "pm"...
(tmbuf, "Hola Hola Hola Hola")
; tmbuf[0] = '\0'; localized_strftime(tmbuf, sizeof(tmbuf), "%c", &jan_2_2015__13_00_00, i18n_get_locale()); cl_assert_equal_s(tmbuf, "Hola"); s_i18n_translate = false; s_i18n_locale_other = false; }
handle_server_notification & // gatt_client_subscriptions_consume_notification void test_gatt_client_subscriptions__notification_but_no_subscribers(void) { const uint8_t value = 0xAA; gatt_client_subscriptions_handle_server_notification(s_connection, s_handle, ...
fake_event_get_count()
, 1); // Assert 2 events can be read out: prv_assert_notification_event(characteristic, value, sizeof(value), true /* kernel */, true /* app */); prv_assert_notification_event(characteristic, value, sizeof(value), true /* kernel */, true /* app */);...
----------------------------------------- void app_manager_handle_app_fetch_request_event(const PebbleAppFetchRequestEvent *const evt) { PBL_ASSERTN(evt); if (!evt->with_ui) { return; } const AppFetchUIArgs *const fetch_args = evt->fetch_args; app_manager_launch_new_app(&(AppLaunchConfig) { .md = app_...
{ return s_next_app.common.reason; }
ButtonId app_manager_get_launch_button(void) { return s_next_app.common.button; } void app_manager_get_framebuffer_size(GSize *size) { if (size == NULL) { return; } if (!s_app_task_context.app_md) { // No app has been started yet, so just use the default system size *size = GSize(DISP_COLS, DISP...
------------------ static Animation *prv_create_custom_animation(void) { // Create a custom animation with a custom update procedure Animation *d = animation_create(); animation_set_implementation(d, &s_custom_implementation); animation_set_duration(d, DURATION); return d; } static void click_handler(ClickR...
GRect(84, 0, 60, 60)
; GRect to_rect_b = GRect(0, 92, 60, 60); s_text_layer_a = text_layer_create(from_rect_a); text_layer_set_text(s_text_layer_a, "Started!"); layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_text_layer_a)); s_text_layer_b = text_layer_create(from_rect_b); text_layer_set_text(s_text_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...
for (int y = 0; y < framebuffer_bitmap_height; y++) { const GBitmapDataRowInfo row_info = gbitmap_get_data_row_info(framebuffer_bitmap, (uint16_t)y); result->mask_row_infos[y] = (GDrawMaskRowInfo) { .type = transparent ? GDrawMaskRo...
} return result; #else return NULL; #endif } bool graphics_context_mask_record(GContext *ctx, GDrawMask *mask) { #if CAPABILITY_HAS_MASKING if (!ctx) { return false; } if (ctx->draw_state.draw_mask && !mask) { // TODO PBL-33766: Update the ctx->draw_state.draw_mask's .mask_row_infos } const...
r uuid_str[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&s_app_uuid, uuid_str); PBL_LOG(LOG_LEVEL_INFO, "Starting app-initiated voice dictation session for app %s", uuid_str); } #if !defined(TARGET_QEMU) // TODO: replace stub #endif // TODO: replace fake values AudioTransferInfoSpeex transfer_info = (Au...
if (app_initiated) { PBL_LOG(LOG_LEVEL_WARNING, "Received session setup result for app initiated session when it " "was not expected"); } else { PBL_LOG(LOG_LEVEL_WARNING, "Received session setup result for non-app session when an app " "session result was expected"); }
prv_send_event(VoiceEventTypeSessionSetup, VoiceStatusErrorGeneric, NULL); goto done; } has_error = false; done: if (has_error) { new_timer_stop(s_timeout); } else { prv_handle_subsystem_started(SessionState_VoiceEndpointSetupReceived); } unlock: mutex_unlock(s_lock); } static bool prv_g...