prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ifications.h" #include "launcher_app_glance_structured.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "process_management/app_install_manager.h" #include "services/normal/notifications/notification_storage.h" #include "services/normal/timeline/attribute.h" #include "system/passert.h" #include "...
if (!IS_EMPTY_STRING(subtitle)) { // Fallback to the subtitle string_to_use_in_glance_subtitle = subtitle; } else { // Fallback to the body string_to_use_in_glance_subtitle = body; }
// Copy the string to the glance const size_t glance_subtitle_size = sizeof(notifications_glance->subtitle); strncpy(notifications_glance->subtitle, string_to_use_in_glance_subtitle, glance_subtitle_size); notifications_glance->subtitle[glance_subtitle_size - 1] = '\0'; } static void prv_notification_event_h...
state/app_state/app_state.h" #include "process_state/worker_state/worker_state.h" #include "system/passert.h" #include "util/heap.h" #include <string.h> Heap *task_heap_get_for_current_task(void) { if (pebble_task_get_current() == PebbleTask_App) { return app_state_get_heap(); } else if (pebble_task_get_curre...
(app_state_get_heap(), size, saved_lr)
GB8FromHEX(0x7fffd4)}, {"azure", GColorARGB8FromHEX(0xf0ffff)}, {"beige", GColorARGB8FromHEX(0xf5f5dc)}, {"bisque", GColorARGB8FromHEX(0xffe4c4)}, {"blanchedalmond", GColorARGB8FromHEX(0xffebcd)}, {"blueviolet", GColorARGB8FromHEX(0x8a2be2)}, {"brown", GColorARGB8FromHEX(0xa52a2a)}, {"burlywood", GColorAR...
(0x7b68ee)
handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATI...
(spawn, play_count_spawn)
; // Check durations cl_assert_equal_i(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...
isable the mic and and stop the audio transfer session. We // expect voice_handle_dictation_result to be called next with a dictation response void voice_stop_dictation(VoiceSessionId session_id) { mutex_lock(s_lock); if ((s_state == SessionState_Idle) || (session_id != s_session_id) || (session_id == V...
{ // if this is not the beginning of the string, insert a space before the word if (strlen(sentence) != 0) { strcat(sentence, " "); } strncat(sentence, (char *) word->data, word->length); }
void *callback_context) { if (!command_list) { return NULL; } GDrawCommand *command = command_list->commands; for (uint32_t i = 0; i < command_list->num_commands; i++) { if ((handle_command) && (!handle_command(command, i, callback_context))) { break; } c...
{ size_t *num_gpoints = ctx; *num_gpoints += gdraw_command_get_num_points(command); return true; }
size_t gdraw_command_list_get_num_points(GDrawCommandList *command_list) { size_t num_gpoints = 0; gdraw_command_list_iterate(command_list, prv_get_num_points, &num_gpoints); return num_gpoints; } typedef struct { const struct { GPoint *points; bool is_precise; } values; struct { uint32_t cur...
/* * 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...
boot_bit_test(BOOT_BIT_INITIALIZED)
) { RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, BOOT_BIT_INITIALIZED); } } void boot_bit_set(BootBitValue bit) { uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR); current_value |= bit; RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value); } void boot_bit_clear(BootBitValue bit) { ...
/* * 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_ASSERT(y < FrameBuffer_MaxY, "Y coordinate is outside of framebuffer dimensions")
const pb_field_t *field, void **arg) { char *ret_sender_type = *(char **)arg; size_t str_len = stream->bytes_left; PBL_ASSERTN(str_len <= PLOG_MAX_SENDER_TYPE_LEN); return pb_read(stream, (uint8_t *)ret_sender_type, str_len); } // -------------------------------------------------------------------------------...
(&stream, pebble_pipeline_Payload_fields, &payload)
; *payload_send_time = payload.send_time_utc; if (payload.sender.has_version && payload_sender_v_major && payload_sender_v_minor) { *payload_sender_v_major = payload.sender.version.major; *payload_sender_v_minor = payload.sender.version.minor; } *type = ProtobufLogType_Measurements; return success; } ...
(prescaler <= TIMINGR_MASK_PRESC)); periph_config_enable(bus->hal->i2c, bus->hal->clock_ctrl); // We currently don't need to worry about the other TIMINGR fields (they come out to 0), but might // need to revisit this if we ever need FM+ speeds. TIMINGR timingr = { .PRESC = prescaler, .SCLH = ...
if ((i2c->ISR & I2C_ISR_TXIS) != 0) { i2c->TXDR = transfer->register_address; }
evel = prv_create_action_menu_for_item(item, window_data, source); if (config.root_level == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "Couldn't create notification action menu"); return; } window_data->action_menu = timeline_actions_push_action_menu( &config, window_manager_get_window_stack(NOTIFICATION_PRI...
prv_update_status_layer(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...
option_menu_create()
* * 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 * distribut...
alarm_get_next_enabled_alarm(&alarm_time_epoch)
16, 408, -560}, { -32, 504, -632}, { 8, 680, -848}, { 120, 808, -1064}, { 152, 664, -904}, { 328, 552, -896}, { 632, 568, -896}, { 736, 600, -872}, { 592, 608, -824}, { 376, 552, -736}, // 29 seconds { 160, 392, -640}, { 96, 360, -600}, { 128, 360, -616}, { 112, 4...
{ 368, 288, -632}, { 232, 200, -520}, { 168, 168, -512}, { 144, 192, -576}, { 112, 208, -680}, { 152, 344, -864}, { 232, 384, -968}, { 336, 336, -992}, { 464, 440, -1032}, { 544, 552, -1080}, { 584, 608, -928}, { 448, 544, -792}, { 272, 632, -840}, { 192, 520, -72...
{ 816, 456, -880}, // 37 seconds { 552, 392, -792}, { 272, 576, -888}, { 112, 496, -744}, { -8, 464, -656}, { -48, 424, -632}, { -80, 376, -576}, { -72, 416, -632}, { -40, 456, -712}, { 16, 544, -808}, { 32, 576, -856}, { 96, 608, -952}, { 80, 552, -912}, { 3...
graphics_context_get_drawing_state(GContext* ctx) { PBL_ASSERTN(ctx); return ctx->draw_state; } void graphics_context_set_drawing_state(GContext* ctx, GDrawState draw_state) { PBL_ASSERTN(ctx); ctx->draw_state = draw_state; } void graphics_context_move_draw_box(GContext* ctx, GPoint offset) { PBL_ASSERTN(ct...
{ result = gbitmap_create_blank(native_framebuffer->bounds.size, GBitmapFormat1Bit); }
void prv_set_expected_data(void *data, size_t len) { s_expected_data.buf = data; s_expected_data.len = len; } static void prv_assert_data_matches_expected(const void *data, size_t len) { cl_assert_equal_i(len, s_expected_data.len); cl_assert(memcmp(s_expected_data.buf, data, len) == 0); } static void prv_ass...
(fake_pbl_malloc_num_net_allocs(), 0)
; } //! It's possible the same session can receiver multiple messages before any //! are processed on kernel BG. Make sure they do not interfere with one //! another void test_default_kernel_receiver__same_session_batched(void) { const int batch_num = 10; char data = 'a'; for (int i = 0; i < batch_num; i++) { ...
blue); #else GBitmap *shoe = has_passed_goal ? &data->shoe_green : &data->shoe_blue; #endif // SNOWY_SCREEN_RES #else const GColor fill_color = GColorDarkGray; const GColor text_color = GColorWhite; GBitmap *shoe = &data->shoe; #endif // PBL_COLOR #if PBL_ROUND prv_draw_outer_dots(ctx, bounds); #endif // ...
prv_update_hrm_bpm(data)
; prv_normalize_data(data); layer_mark_dirty(&data->base_layer); } #if UNITTEST T_STATIC void prv_set_data(KickstartData *data, int32_t current_steps, int32_t typical_steps, int32_t daily_steps_avg, int32_t current_bpm) { data->current_steps = current_steps; data->typical_steps = typ...
/* * 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...
mbuf_iterator_is_finished(iter)
) { return false; } uint8_t *buffer = mbuf_get_data(iter->m); buffer[iter->data_index++] = data; return true; } MBuf *mbuf_iterator_get_current_mbuf(MBufIterator *iter) { return iter->m; }
*window) { ActionMenuData *data = window_get_user_data(window); // Init action menu layer ActionMenuLayer *action_menu_layer = &data->action_menu_layer; action_menu_layer_init(action_menu_layer, &GRectZero); action_menu_layer_set_callback(action_menu_layer, prv_action_callback, (void *)window); action_menu...
gcolor_legible_over(data->config.colors.background)
; } #else data->config.colors.background = GColorLightGray; data->config.colors.foreground = GColorBlack; #endif Window *window = &data->action_menu.window; window_init(window, WINDOW_NAME("Action Menu")); window_set_user_data(window, data); window_set_fullscreen(window, true); window_set_background_co...
escription->firmware_length); dbgserial_print(" bytes\r\n"); const uint32_t crc = crc32(CRC32_INIT, (const uint8_t *)FIRMWARE_BASE, firmware_description->firmware_length); dbgserial_print("Checksum - wanted "); dbgserial_print_hex(firmware_description->checksum); dbgserial_print...
(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)
; if (!boot_bit_test(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE)) { dbgserial_putstr("Failed to load recovery firmware, strike one. Try again."); boot_bit_set(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE); boot_bit_set(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED); system_reset(); } else if (!boot_bit_test...
/* * 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...
(fmt_args)
; gbitmap_deinit(&data->certification_data.weee_mark); gbitmap_deinit(&data->certification_data.r_mark); gbitmap_deinit(&data->certification_data.t_mark); gbitmap_deinit(&data->certification_data.aus_rcm_mark); gbitmap_deinit(&data->certification_data.nom_nyce_mark); app_free(data->certification_data.regul...
window_set_window_handlers(&data->kcc_window, &(WindowHandlers) { .load = prv_kcc_window_load, .unload = prv_kcc_window_unload, })
; app_window_stack_push(&data->kcc_window, true); } // Callbacks for the main settings filter list menu. //////////////////////////////////////////////////// #define SHUTDOWN_MIN_BOOT_VERSION 1354647953 static bool prv_shutdown_enabled(void) { return boot_version_read() >= SHUTDOWN_MIN_BOOT_VERSION; } static vo...
{ buffer[0] = '\0'; return 0; }
else { return prv_format_time(buffer, buffer_size, i18n_noop("%p"), timestamp); } } size_t clock_format_time(char *buffer, uint8_t size, int16_t hours, int16_t minutes, bool add_space) { if (size == 0 || buffer == NULL) { return 0; } bool is24h = clock_is_24h_style(); const...
.length_min = 20, .type = ActivitySessionType_RestfulSleep, .ongoing = true, }, }; uint16_t session_entries = ARRAY_LENGTH(sessions); activity_algorithm_post_process_sleep_sessions(session_entries, sessions); cl_assert_equal_i(sessions[0].type, ActivitySessionType_Sleep); c...
("\n Total: %d\n", steps_asleep_120m)
; // We should only get the steps counted from the last 20 minutes after waking cl_assert_equal_i(steps_asleep_120m, steps_awake_120m - steps_awake_100m); } // --------------------------------------------------------------------------------------- // Test to make sure that the minute data we save has no steps du...
CE_RESULT_TEMPLATE_STRING_TOO_LONG); // Check that adding a slice with a bad template string fails const char *invalid_template_subtitle = "How much time? {time_until(500)|format('%uS',)}"; slice = (AppGlanceSlice) { .expiration_time = APP_GLANCE_SLICE_NO_EXPIRATION, .layout.icon = APP_GLANCE_SLICE_DEFA...
(app_glance_service_get_current_slice(&APP_GLANCE_TEST_UUID, &slice_out), false)
; } void test_app_glance__reload_with_null_callback_empties_slices(void) { prv_glance_clear_test(NULL); } static void prv_reload_with_no_slices_added_cb(AppGlanceReloadSession *session, size_t limit, void *context) { // We don't add any slices in this callback on pur...
VAL = rocky_get_or_create_object(parent, name, prv_create_function, handler, &result); return result; } bool rocky_add_global_function(char *name, jerry_external_handler_t handler) { return rocky_add_function(jerry_create_undefined(), name, handler); } jerry_value_t rocky_add_constructor(char *name, jerry_externa...
(tick_time->tm_mday)
, jerry_create_number(tick_time->tm_hour), jerry_create_number(tick_time->tm_min), jerry_create_number(tick_time->tm_sec) }; date_obj = jerry_construct_object(date_constructor, args, ARRAY_LENGTH(args)); for (unsigned i = 0; i < ARRAY_LENGTH(args); ++i) { jerry_release_value(args[i]); } ...
IS.init(); EXECUTE_SCRIPT(script); prv_deinit(); } prv_init(); } static char *prv_load_js(char *suffix) { char path[512] = {0}; snprintf(path, sizeof(path), "%s/js/tictoc~rect~%s.js", CLAR_FIXTURE_PATH, suffix); FILE *f = fopen(path, "r"); cl_assert(f); fseek(f, 0, SEEK_END); size_t length = (...
jerry_get_int32_value(prv_js_global_get_value("s1"))
); cl_assert_equal_i(100, jerry_get_int32_value(prv_js_global_get_value("s2"))); cl_assert_equal_i(150, jerry_get_int32_value(prv_js_global_get_value("c1"))); cl_assert_equal_i(150, jerry_get_int32_value(prv_js_global_get_value("c2"))); } void test_js__date(void) { const time_t cur_time = 1458250851; // Thu Ma...
INFO_PLATFORM "platform" #define ROCKY_WATCHINFO_MODEL "model" #define ROCKY_WATCHINFO_LANG "language" #define ROCKY_WATCHINFO_FW "firmware" #define ROCKY_WATCHINFO_FW_MAJOR "major" #define ROCKY_WATCHINFO_FW_MINOR "minor" #define ROCKY_WATCHINFO_FW_PATCH "patch" #define ROCKY_WATCHINFO_FW_SUFFIX "suffix" static const...
("pebble_2_hr_lime")
; break; case WATCH_INFO_COLOR_PEBBLE_2_HR_FLAME: model_name = SILK_MODEL("pebble_2_hr_flame"); break; case WATCH_INFO_COLOR_PEBBLE_2_HR_WHITE: model_name = SILK_MODEL("pebble_2_hr_white"); break; case WATCH_INFO_COLOR_PEBBLE_2_HR_AQUA: model_name = SILK...
ample_idx = step_sample_idx % num_step_samples; } activity_test_feed_samples(data, chunk_size); rtc_set_time(rtc_get_time() + 1); samples_remaining -= chunk_size; if (minute_idx != samples_remaining / (60 * SAMPLES_PER_SECOND)) { activity_test_run_minute_callback(); minute_idx = samples...
(ACTIVITY_SESSION_UPDATE_MIN + 1)
; int32_t before_total, before_deep; activity_get_metric(ActivityMetricSleepTotalSeconds, 1, &before_total); activity_get_metric(ActivityMetricSleepRestfulSeconds, 1, &before_deep); PBL_LOG(LOG_LEVEL_DEBUG, "start total: %d, start deep: %d", (int)before_total, (int)before_deep); // Capture steps before sleep...
yer.layer); } static void prv_update_progress(ProgressUIData *data) { switch (data->progress_source) { case PROGRESS_UI_SOURCE_COREDUMP: { break; } case PROGRESS_UI_SOURCE_LOGS: { break; } case PROGRESS_UI_SOURCE_FW_UPDATE: { if (firmware_update_current_status() == FirmwareUpdat...
window_set_overrides_back_button(window, true)
; window_set_background_color(window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite)); window_set_window_handlers(window, &(WindowHandlers){ .load = prv_window_load_handler, .unload = prv_window_unload_handler, }); app_window_stack_push(window, false); } static void prv_main(void) { if (!app_manager...
ine TINTIN_MODEL(model_str) NULL #endif // PLATFORM_TINTIN #if PLATFORM_SNOWY # define SNOWY_MODEL(model_str) model_str #else # define SNOWY_MODEL(model_str) NULL #endif // PLATFORM_SNOWY #if PLATFORM_SPALDING # define SPALDING_MODEL(model_str) model_str #else # define SPALDING_MODEL(model_str) NULL #endif // PLA...
("pebble_time_2_black")
Layer *root_layer = &s_app_window_stack_get_top_window.layer; root_layer->bounds = GRect(10, 20, 30, 40); cl_assert(root_layer->update_proc); GContext ctx = {.lock = true}; root_layer->update_proc(root_layer, &ctx); if (s_tictoc_callback_is_color) { cl_assert_equal_i(1, s_graphics_fill_rect.call_count);...
EXECUTE_SCRIPT(script)
; ASSERT_JS_GLOBAL_EQUALS_D("now", (double)cur_time * 1000.0 + (double)cur_millis); ASSERT_JS_GLOBAL_EQUALS_D("local_day", 4.0); // Thursday ASSERT_JS_GLOBAL_EQUALS_D("local_hour", 14.0); // 1pm } void test_js__log_exception(void) { char *script = "var e1;\n" "var f1 = function(){throw new Error('test...
/* * 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...
strncpy(buffer + avg_len, EN_DASH, buffer_size - avg_len)
; } else { health_util_format_hours_and_minutes(buffer + avg_len, buffer_size - avg_len, daily_avg, i18n_owner); } } Window *health_sleep_detail_card_create(HealthData *health_data) { HealthSleepDetailCardData *card_data = app_zalloc_check(sizeof(HealthSleepDetailCard...
{ PBL_ASSERTN(session->storage.fd != DLS_INVALID_FILE); status_t status = pfs_close(session->storage.fd); if (status != S_SUCCESS) { PBL_LOG(LOG_LEVEL_ERROR, "Error %d closing file for session %d", (int)status, session->comm.session_id); } session->storage.fd = DLS_INVALID_FILE; } // ------...
MAX(session->storage.num_bytes/2, min_delta_size)
; if (dls_storage_consume(session, consume_bytes) < 0) { // We failed to lop off the used bytes goto exit; } // Reallocate which removes the consumed bytes from the beginning of the file. if (!prv_realloc_storage(session, file_size)) { goto exit; } // Re-open it now success = prv_open_file(&s...
0); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_x_offset_layer_aa.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 10); graphics_line_draw_precise_stroked_aa(&ctx, START_ON_ORIGIN_RECT_NXNY, END_ON_ORIGIN_RECT_NXNY, 10); cl_check...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 10)
; graphics_line_draw_precise_stroked_aa(&ctx, CLOSE_POINTS_LESS_THAN_1PX_START, CLOSE_POINTS_LESS_THAN_1PX_END, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_close_points_less_than_1px_aa.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 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...
RTC_WriteBackupRegister(BOOTLOADER_VERSION_REGISTER, s_bootloader_timestamp)
; } uint32_t boot_version_read(void) { return RTC_ReadBackupRegister(BOOTLOADER_VERSION_REGISTER); }
Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in wri...
(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(2bitpalette)))
; cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat2BitPalette); } // Tests 4-bit transparent palettized PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__color_4_bit_transparent(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(4bitpalette)); cl_ass...
fake_system_task_callbacks_invoke_pending()
; cl_assert(!hrm_is_enabled(HRM)); prv_put_battery_state_change_event(false /* is plugged in */); cl_assert(prv_can_turn_sensor_on()); fake_system_task_callbacks_invoke_pending(); cl_assert(hrm_is_enabled(HRM)); }
, .stopped = prv_stopped_handler_destroy }; static const AnimationImplementation implementation = { .setup = prv_setup_handler, .update = prv_update_handler, .teardown = prv_teardown_handler }; h = animation_create(); cl_assert(h != NULL); void *context = h; animation_set_handlers(h, han...
cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, a), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 0); // Should have been deleted automatically cl_assert_equal_i(prv_count_animations(), 0); #endif } // -------------------------------------------------------------------------------------- // Test setting a duration of infinite dur...
================= // Public interface // ----------------------------------------------------------------------------------------------- // Trigger a core dump NORETURN core_dump_reset(bool is_forced) { // Big problem if we re-enter here - it likely means we encountered an // exception during the core dump if (s...
prv_debug_str("CD: starting")
; // Feed the watchdog so that we don't get watchdog reset in the middle of dumping the core watchdog_feed(); prv_stash_regions(); // Init the flash and SPI bus s_use_cd_flash_driver = true; cd_flash_init(); // If there is a fairly recent unread core image already present, don't replace it. Once it is...
/* * 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...
(structured_glance)
/* * 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 false; }
uint32_t launcher_panic_get_current_error(void ) { return 0; } bool recovery_first_use_is_complete(void) { return true; } #include "system/bootbits.h" bool boot_bit_test(BootBitValue bit) { return false; } // Use this macro to define a PebbleProcessMd* getter function and an associated constant // that it wi...
[URL_BUFFER_SIZE]; bool is_showing_version; TextLayer name_text_layer; char name_text_buffer[NAME_BUFFER_SIZE]; AppTimer *spinner_close_timer; //! Is the mobile app currently connected (comm session is up?) bool is_pebble_mobile_app_connected; //! Has the mobile app ever connected during this boot? Used...
{ uint32_t icon_res_id; const char *url_string; GColor background; GRect kino_area; int16_t icon_x_offset; int16_t icon_y_offset; int16_t text_y_offset; // Have we gone through first use before? If not, show first use UI. Otherwise show recovery UI. const bool first_use_is_complete = shared_prf_stora...
96, -832, -296}, { -496, -840, -288}, { -496, -840, -288}, { -504, -848, -288}, { -496, -840, -288}, { -496, -840, -288}, { -496, -848, -288}, { -496, -840, -288}, { -496, -832, -296}, { -504, -840, -296}, { -496, -840, -296}, { -496, -840, -296}, { -496, -840, -288}, ...
{ -496, -840, -288}, { -496, -840, -288}, { -496, -848, -288}, { -496, -840, -288}, { -504, -848, -280}, { -504, -840, -288}, { -496, -840, -288}, { -496, -840, -288}, { -496, -840, -288}, { -496, -840, -280}, { -496, -840, -288}, { -504, -840, -280}, { -496, -840, -2...
{ -496, -840, -288}, { -496, -840, -288}, { -504, -840, -288}, { -496, -848, -288}, { -496, -840, -288}, { -496, -840, -288}, { -504, -840, -296}, { -496, -832, -296}, { -496, -848, -280}, { -504, -840, -280}, { -496, -840, -288}, { -496, -840, -288}, { -496, -840, -...
if (PRIVILEGE_WAS_ELEVATED) { if (info_out) { syscall_assert_userspace_buffer(info_out, sizeof(*info_out)); } } return prv_get_consumer_info(tag, info_out); } static void prv_consume(AppInboxConsumerInfo *consumer_info); DEFINE_SYSCALL(void, sys_app_inbox_service_consume, AppInboxConsumerInfo *consu...
{ if (!info_out) { return false; } bool success = false; prv_lock(); { AppInboxNode *inbox = prv_find_inbox_by_tag_and_log_if_not_found(tag); if (!inbox) { goto unlock; } *info_out = (const AppInboxConsumerInfo) { .tag = tag, .message_handler = inbox->message_handler, ...
stats_calculate_weighted_median(sample_buf, weight_buf, num_hr_samples); task_free(sample_buf); task_free(weight_buf); state->hr.metrics.last_stable_bpm = (uint8_t)median; state->hr.metrics.last_stable_bpm_update_time_utc = rtc_get_time(); state->hr.metrics.previous_median_bpm = (uint8_t)median; ...
prv_update_hr_derived_metrics()
; } // -------------------------------------------------------------------------------------------- ActivityScalarStore activity_metrics_prv_steps_per_minute(void) { ActivityState *state = activity_private_state(); return state->steps_per_minute; } // ------------------------------------------------------------...
]; char device_serial[MFG_SERIAL_NUMBER_SIZE + 1]; bool is_saving; } AppData; static void prv_draw_solid(Layer *layer, GContext *ctx, GColor color) { graphics_context_set_fill_color(ctx, color); graphics_fill_rect(ctx, &layer->bounds); } static void prv_display_offsets(Layer *layer, GContext *ctx) { AppData...
{ 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 - i, .y = pixel_mi...
} static void prv_layer_update_proc(Layer *layer, GContext *ctx) { AppData *data = app_state_get_user_data(); prv_draw_solid(layer, ctx, GColorBlack); ctx->draw_state.drawing_box.origin.x += data->axis_offsets[X_AdjustState]; ctx->draw_state.drawing_box.origin.y += data->axis_offsets[Y_AdjustState]; prv_...
one } else if (IS_EMPTY_STRING(title) && IS_EMPTY_STRING(subtitle)) { // we got neither, use the body if (IS_EMPTY_STRING(body)) { // we're screwed... empty message title = "[Empty]"; } else { // try to show as much content as possible in title + subtitle title = body; subtit...
layer_add_child(&window->layer, menu_layer_get_layer(menu_layer))
; TextLayer *text_layer = &data->text_layer; const int16_t horizontal_margin = 5; const GFont font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle); // configure text layer to be vertically aligned (15 is hacking around our poor fonts) text_layer_init_with_parameters(text_layer, ...
cular display #define SCROLL_PX PBL_IF_RECT_ELSE(48, LAYOUT_HEIGHT) // Max pixel scroll for repeating scrolls (button is held) #define REPEATING_SCROLL_PX 24 // Scroll animation speed // Same as the normal moook duration, but one frame shorter #define SCROLL_MS PBL_IF_RECT_ELSE(200, interpolate_moook_duration() - \ ...
if (swap_layer->callbacks.layout_did_appear_handler) { swap_layer->callbacks.layout_did_appear_handler(swap_layer, layout, rel_change, swap_layer->context); }
{ return prv_graphics_set_color(argc, argv, graphics_context_set_stroke_color); } JERRY_FUNCTION(prv_get_stroke_style) { return prv_graphics_get_color_string(rocky_api_graphics_get_gcontext()->draw_state.stroke_color); } JERRY_FUNCTION(prv_set_fill_style) { return prv_graphics_set_color(argc, argv, graphics_co...
rocky_define_property(ctx_prototype, ROCKY_CONTEXT2D_FILLSTYLE, prv_get_fill_style, prv_set_fill_style)
; rocky_api_graphics_path2d_add_canvas_methods(ctx_prototype); rocky_api_graphics_text_add_canvas_methods(ctx_prototype); // Create the CanvasElement constructor: JS_UNUSED_VAL = rocky_add_constructor(ROCKY_CANVAS_CONSTRUCTOR, prv_canvas_constructor); } static void prv_init_apis(void) { prv_configure_top_w...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ mutex_unlock_recursive(s_watch_app_prefs_db.mutex); }
return rv; } static void prv_close_file_and_unlock_mutex(void) { settings_file_close(&s_watch_app_prefs_db.settings_file); mutex_unlock_recursive(s_watch_app_prefs_db.mutex); } // WatchAppPrefDB API //////////////////////////////////////////////////////////////////////////////// static void *prv_get_prefs(con...
e called otherwise. //! For some reason, Bluetopia considers server notifications / indications the //! be "connection events", while they are really client events... //! @note bt_lock may be held by the caller. If the bt_lock is not held we will block for a little //! if the subscription buffer is full void gatt_clien...
prv_find_subscription_for_characteristic(characteristic_ref, *connection_out)
; } //! Internally used by gatt_client_operations.c, should not be called otherwise. //! This function handles the completion of pending (un)subscriptions (confirmations of the writing //! to the remote CCCD). //! @note bt_lock is assumed to be already been taken by the caller! void gatt_client_subscriptions_handle_wr...
(&manager, prv_handle_dummy_touch_event, NULL)
); prv_compare_recognizers_processed((int[]) {4, 2, 3}, 3, &s_recognizers_handled); // Recognizers attached to window processed before layer recognizers recognizer_add_to_list(recognizers[5], window_get_recognizer_list(&window)); cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NUL...
/* * 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 (s_free_list) { mbuf_append(s_free_list, m); } else { s_free_list = m; }
expired, immediately call the timer callback if (time_until_slice_expires <= 0) { prv_slice_expiration_timer_cb(service); return; } const uint64_t time_until_slice_expires_ms = (uint64_t)time_until_slice_expires * MS_PER_SECOND; if (time_until_slice_expires_ms > UINT32_MAX) { // Slice expiration t...
prv_glance_cache_destroy_entry(service, cache_entry_to_destroy)
; } // Initialize a new cache entry, add it to the head of the cache list, and return it LauncherAppGlanceCacheEntry *new_cache_entry = app_zalloc_check(sizeof(*new_cache_entry)); *new_cache_entry = (LauncherAppGlanceCacheEntry) { .glance = glance, }; service->glance_cache = list_insert_before(service-...
ode); } mutex_unlock(s_vibe_history_mutex); return rc; } // @param cutoff The time to cut off the list at. 0 means to clear the list. static void prv_vibe_history_clear(uint64_t cutoff) { PBL_ASSERTN(s_vibe_history_mutex); mutex_assert_held_by_curr_task(s_vibe_history_mutex, true); while (s_vibe_history &&...
(VIBE_STRENGTH_OFF)
; s_vibe_service_enabled = enable; } mutex_unlock(s_vibe_pattern_mutex); } static void prv_timer_callback(void* data) { if (s_vibe_queue_head == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "Tried to handle a vibe event with a null vibe queue"); return; } mutex_lock(s_vibe_pattern_mutex); // remove the e...
/* * 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; }
const SystemResourceBank * resource_storage_flash_get_unused_bank(void) { static const SystemResourceBank unused_bank = { .begin = FLASH_REGION_SYSTEM_RESOURCES_BANK_1_BEGIN, .end = FLASH_REGION_SYSTEM_RESOURCES_BANK_1_END, }; return &unused_bank; }
ernet connection", data); #endif break; case AppFetchResultIncompatibleJSFailure: // TODO: PBL-39752 make this a more expressive error message with a call to action icon = TIMELINE_RESOURCE_GENERIC_WARNING; message = i18n_get("Incompatible JS", data); break; case AppFetchResultGene...
(BUTTON_ID_BACK, (ClickHandler) prv_click_handler)
ate_number(0.0), .expected_output = false, }, { .input = jerry_create_string((const jerry_char_t *)""), .expected_output = false, }, { .input = jerry_create_null(), .expected_output = false, }, { .input = jerry_create_undefined(), .expected_output = fals...
jerry_create_number(0.0)
, [1] = jerry_create_number(0.0), [2] = jerry_create_number(0.0), [3] = jerry_create_number(0.0), }, .argc = 4, .expected_output = PP(0, 0, 0, 0), }, { .argv = { [0] = jerry_create_number(-0.5), [1] = jerry_create_number(-0.2), [2] = jerry_...
120}, { 1304, 552, 144}, { 1232, 384, 176}, { 1184, 248, 208}, { 1160, 168, 136}, { 1096, 168, 152}, { 992, 152, 136}, { 928, 128, 112}, { 880, 160, 120}, { 920, 128, 128}, { 1024, 120, 112}, { 1104, 96, 112}, { 1496, 120, 144}, { 1280, 288, -120}, { 920, 296, -24...
{ 912, 392, -32}, { 800, 376, -16}, { 808, 344, -24}, { 840, 312, 0}, { 864, 304, 0}, { 928, 320, -8}, { 1064, 376, -16}, { 1104, 376, -8}, { 1296, 280, 160}, { 1608, 480, 104}, { 1240, 616, 8}, { 968, 376, 80}, { 1208, 384, 80}, { 1280, 368, 104}, { 1104, 312...
{ 704, 584, 40}, { 680, 608, -24}, // 121 seconds { 704, 696, -104}, { 728, 736, -136}, { 720, 648, -248}, { 800, 656, -344}, { 784, 592, -360}, { 824, 560, -368}, { 952, 472, -592}, { 848, 344, -632}, { 728, 264, -616}, { 704, 232, -616}, { 720, 240, -688}, ...
); if (!user_has_migrated_to_vibe_scores) { // If the user previously set a vibration intensity, set the vibe scores based on that intensity if (settings_file_exists(file, PREF_KEY_VIBE_INTENSITY, strlen(PREF_KEY_VIBE_INTENSITY))) { prv_set_vibe_scores_based_on_legacy_intensity(s_vibe_intensity); }...
(&file, key, key_len, value, value_len)
; settings_file_close(&file); cleanup: mutex_unlock(s_mutex); } AlertMask alerts_preferences_get_alert_mask(void) { if (s_mask == AlertMaskAllOnLegacy) { // Migration for notification settings previously configured under // old bit setup. alerts_preferences_set_alert_mask(AlertMaskAllOn); } retur...
/* * 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_get_data_size(kino_reel)
, 2308); kino_reel_draw(kino_reel, &ctx, GPointZero); } void test_kino_reel__resource_gbitmap_sequence(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Test loading GBitmap Sequence Kino Reel uint32_t resource_id = sys_resource_load_file_as_resource( TEST_IMAGES_PATH, "test_kino_reel__r...
ntent/spike-man-monster // http://opengameart.org/content/platformer-baddies // http://opengameart.org/content/greyscale-special-effects-%E2%80%94-various-dimensions-and-flavours // http://opengameart.org/content/bouncing-ball-guy // http://opengameart.org/content/medals-3 // http://opengameart.org/content/open-pixel-p...
(bitmap_sequence)
, GBitmapFormat8Bit); cl_assert(bitmap); // first frame always shows at the beginning (0 ms) status = gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 0); cl_assert_equal_b(status, true); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(1))); // each frame ...
nt8(&pin_attr_list, AttributeIdBgColor, GColorSunsetOrangeARGB8); const int num_responses = 2; ResponseItem *response_items = kernel_zalloc_check(num_responses * sizeof(ResponseItem)); response_items[0] = (ResponseItem) { .type = ActivityInsightResponseTypePositive, .text = i18n_noop("I feel great!"), ...
{ if (!activity_prefs_sleep_insights_are_enabled()) { return; } if (s_sleep_pin_state.notified) { INSIGHTS_LOG_DEBUG("Not notifying sleep pin - already notified"); return; } // Notify about the pin after a certain amount of time const time_t since_exited = now_utc - sleep_exit_utc; if (since...
// ----------------------------------------------------------------------------------------- static void prv_do_sleep_summary(time_t now_utc) { if (!s_sleep_summary_settings.enabled) { return; } // Don't bother adding a summary if we don't have any history for an average if (s_sleep_stats.total_days == 0...
icSleepStateSeconds, 1, &sleep_state_seconds); if (sleep_state_seconds < s_sleep_reward_settings.reward.sleep.trigger_after_wakeup_seconds) { INSIGHTS_LOG_DEBUG("Not triggering sleep reward - haven't been awake long enough: %"PRId32, sleep_state_seconds); return; } // All criteria ...
{ AttributeList pin_attr_list = {}; attribute_list_add_resource_id(&pin_attr_list, AttributeIdIconPin, TIMELINE_RESOURCE_SLEEP); attribute_list_add_uint8(&pin_attr_list, AttributeIdHealthInsightType, ActivityInsightType_ActivitySessionNap); attribute_list_add_uint8(&pin_attr_list, At...
/* * 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 ((*compositing_mode == GCompOpTint) || (*compositing_mode == GCompOpTintLuminance)) { // Force our interpretation of the tint color to be black, white, or clear tint_color = gcolor_get_bw(tint_color); if (gcolor_equal(tint_color, GColorBlack)) { *compositing_mode = GCompOpAnd; } else if (gcolor...
} void bitblt_bitmap_into_bitmap_tiled_1bit_to_1bit(GBitmap* dest_bitmap, const GBitmap* src_bitmap, GRect dest_rect, GPoint src_origin_offset, GCompOp compositing_mode...
/* * 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 (APP_RECORDS[i].id == id) { if (record_order_out) { *record_order_out = i + 1; } return &APP_RECORDS[i]; } }
return NULL; } // optimization: sort the UUID's and then search more quickly. This will most likely // require many changes to the JSON generation script. AppInstallId app_get_install_id_for_uuid_from_registry(const Uuid *uuid) { for (uint16_t i = 0; i < ARRAY_LENGTH(APP_RECORDS); i++) { const AppRegistryEntr...
const TimelineItemAction *action, const TimelineItem *pin, void *context) { ActionResultData *data = applib_zalloc(sizeof(ActionResultData)); if (!data) { return NULL; } data->action_menu...
{ Uuid app_uuid; timeline_get_originator_id(pin, &app_uuid); analytics_event_pin_action(pin->header.timestamp, &app_uuid, action->type); }
AnalyticsMetric metric = ANALYTICS_DEVICE_METRIC_ACTION_INVOKED_FROM_TIMELINE_COUNT; const TimelineItemActionSource current_item_source = kernel_ui_get_current_timeline_item_action_source(); if (current_item_source == TimelineItemActionSourceModalNotification) { metric = ANALYTICS_DEVICE_METRIC_ACTION...
/* * 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(diff <= 1 && diff >= -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...
BT_DEVICE_ADDRESS_XPLODE(event->dev_address)
); } unlock: bt_unlock(); } void bt_driver_cb_gatt_handle_mtu_update(const GattDeviceMtuUpdateEvent *event) { bt_lock(); { GAPLEConnection *connection = gap_le_connection_by_addr(&event->dev_address); if (!connection) { goto unlock; } const bool has_mtu_changed = (connection->gatt_mtu != ...
client->characteristics.meta; data = client->characteristics.data; } BLECharacteristic char1 = num_characteristics > 0 ? characteristics[0] : 0; BLECharacteristic char2 = num_characteristics > 1 ? characteristics[1] : 0; PBL_LOG(LOG_LEVEL_WARNING, "No ppog client removed? 0x%x 0x%x vs ...
prv_get_max_payload_size(client)
; if (max_payload_size == 0) { return NULL; } packet = (PPoGATTPacket *) kernel_malloc_check(sizeof(PPoGATTPacket) + max_payload_size); *heap_packet_in_out = packet; } return packet; } // ------------------------------------------------------------------------------------------------- static...
Stroke width/color N/A) setup_test(&context, true, 5, GColorBlack, GColorBlack, false); graphics_fill_rect(&context, &GRect(10, 20, 40, 10)); #if SCREEN_COLOR_DEPTH_BITS == 1 ASSERT_CALLED(prv_fill_rect_non_aa(&context, &GRect(10, 20, 40, 10), 0, GCornerNone, GColorBlack)); #else ASSERT_CALLED(prv_fill_rect_aa...
(20, 80, 40, 10)
, 4)); setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHAN...
2, 480, -296}, { -904, 368, -168}, { -912, 432, -152}, { -928, 368, -48}, { -896, 304, 56}, { -912, 320, 176}, { -888, 248, 176}, { -872, 272, 152}, { -848, 320, 40}, { -824, 832, -936}, { -608, -112, 72}, { -1064, 992, -192}, { -888, 128, -24}, // 124 seconds { -...
{ 192, 984, 272}, { 200, 992, 280}, { 192, 984, 272}, { 208, 968, 264}, { 200, 992, 280}, { 192, 992, 280}, { 200, 984, 272}, { 192, 984, 272}, { 192, 976, 280}, { 192, 992, 272}, { 200, 984, 264}, { 192, 1000, 272}, { 192, 968, 264}, { 192, 1000, 280}, { 200,...
{ 176, 992, 296}, { 192, 968, 296}, { 184, 992, 304}, { 184, 976, 296}, { 184, 992, 312}, { 184, 968, 296}, { 176, 976, 304}, { 176, 976, 304}, { 184, 976, 312}, { 184, 984, 312}, { 176, 976, 312}, { 176, 976, 312}, { 184, 984, 312}, { 184, 984, 312}, { 176, ...
om_margin.raw_value = bm_p0.y.raw_value; } } // Find edges for both caps prv_calc_cap_vert(&p0, radius, x, &top_margin, &bottom_margin); prv_calc_cap_vert(&p1, radius, x, &top_margin, &bottom_margin); // Finally draw line if (top_margin.raw_value <= bottom_margin.raw_value)...
if (ctx->draw_state.antialiased) { if (ctx->draw_state.stroke_width > 1) { // Antialiased and Stroke Width > 1 graphics_line_draw_stroked_aa(ctx, p0, p1, ctx->draw_state.stroke_width); return; } else { // Antialiased and Stroke Width == 1 (not suppported on 1-bit color) graphics_li...
#endif if (ctx->draw_state.stroke_width > 1) { // Non-Antialiased and Stroke Width > 1 graphics_line_draw_stroked_non_aa(ctx, p0, p1, ctx->draw_state.stroke_width); } else { // Non-Antialiased and Stroke Width == 1 graphics_line_draw_1px_non_aa(ctx, p0, p1); } } static void prv_draw_dotted_line(...
for first word only: .box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 3 * HORIZ_ADVANCE_PX, 10 } } }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; // Init mutable types word_iter_init(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start); ...
cl_assert(*word_iter_state.current.end == '\n')
; cl_assert(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 1); 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 * 1); cl_assert(line.origin.x == 0); cl_assert(line.suffix_codepoin...
animation_create(&s_bounds_layer_implementation, layer, NULL, NULL); GRect value = layer->bounds; if (from) { value.origin = *from; } property_animation_set_from_grect(result, &value); value = layer->bounds; if (to) { value.origin = *to; } property_animation_set_to_grect(result, &value);...
(value, &property_animation->values.from, size)
; } return true; } // ----------------------------------------------------------------------------------------- bool property_animation_to(PropertyAnimation *property_animation_h, void *value, size_t size, bool set) { if (!value) { return false; } if (animation_private_using...
cl_assert_equal_i(e, BTErrnoOK)
; registered = gap_le_connect_has_connection_intent(&device, GAPLEClientApp); cl_assert_equal_b(registered, true); // Try registering the device again for different client: e = gap_le_connect_connect(&device, true /* auto_reconnect */, false /* is_pairing...
(Uuid *id) { TimelineItem notification; if (!notification_storage_get(id, &notification)) { return; } prv_add_notification(s_data, id); // NOTE: To avoid having two flash reads, we only read and validate the notification once. // We do it here, instead of in the function call below. If the above...
(window, WINDOW_NAME("Notifications"))
; window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, .appear = prv_window_appear, .disappear = prv_window_disappear, }); const bool animated = true; app_window_stack_push(window, animated); } //////////////////// // App boilerplate...
typedef struct RecognizerHandled { ListNode node; int idx; } RecognizerHandled; static ListNode *s_recognizers_handled; static ListNode *s_recognizers_reset; static bool prv_simultaneous_with_cb(const Recognizer *recognizer, const Recognizer *simultaneous_with) { return tru...
layer_init(&window.layer, &GRectZero)
; manager.window = &window; Layer layer_a, layer_b, layer_c; layer_init(&layer_a, &GRectZero); layer_init(&layer_b, &GRectZero); layer_init(&layer_c, &GRectZero); layer_add_child(&window.layer, &layer_a); layer_add_child(&layer_a, &layer_b); layer_add_child(&window.layer, &layer_c); manager.active_la...
/* * 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...
(builder, p3)
; gpath_builder_line_to_point(builder, p4); GPath *path = gpath_builder_create_path(builder); gpath_builder_destroy(builder); graphics_context_set_fill_color(ctx, color); gpath_draw_filled(ctx, path); gpath_destroy(path); } void health_progress_bar_fill(GContext *ctx, HealthProgressBar *progress_bar, GCol...
andle_read_or_notification) { goto log_error; } prv_consume_read_response(event, client); return; default: break; } log_error: PBL_LOG(LOG_LEVEL_ERROR, "Unhandled GATT event:%u ref:%"PRIu32" err:%"PRIu16" len:%"PRIu16" cl:%p", event->subtype, (uint...
if (op == BtPersistBondingOpWillDelete) { prv_cancel_connect_gateway_bonding(bonding); } else if (op == BtPersistBondingOpDidAdd) { prv_connect_gateway_bonding(bonding); }
} } // ------------------------------------------------------------------------------------------------- void kernel_le_client_init(void) { // Reset analytics ppogatt_reset_disconnect_counter(); BTBondingID gateway_bonding = bt_persistent_storage_get_ble_ancs_bonding(); if (gateway_bonding != BT_BONDING_ID...
License. */ #include "pulse_logging.h" #include "pebble_tasks.h" #include "logging_private.h" #include "util/stack_info.h" #include "console/console_internal.h" #include "console/prompt.h" #include "console/serial_console.h" #include "debug/advanced_logging.h" #include "drivers/rtc.h" #include "system/logging.h" ...
{ kernel_pbl_log_serial(log_message, async); if (!portIN_CRITICAL() && !mcu_state_is_isr() && xTaskGetSchedulerState() != taskSCHEDULER_SUSPENDED) { kernel_pbl_log_flash(log_message, async); } }
void kernel_pbl_log_from_fault_handler( const char *src_filename, uint16_t src_line_number, const char *message) { #if PULSE_EVERYWHERE pulse_logging_log_sync(LOG_LEVEL_ALWAYS, src_filename, src_line_number, message); #else serial_console_write_log_message(message); serial_console_w...
/* * 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...
(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos)
; // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat8BitCircular); cl_assert(NULL == bmp); bmp = gbitmap_create_blank(s180, GBitmapFormat8BitCircular); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos == bmp->data_row_infos); #endif } void test_gbitmap_formats__create_b...
cl_assert_equal_i(value, exp_value)
; // --- // Compute weekend step average from 4am to 9am. This should use the 15-minute // step averages that we stuffed in. exp_value = prv_averages_sum(4 * MINUTES_PER_HOUR, 9 * MINUTES_PER_HOUR, &s_sys_activity_get_step_averages_values_weekend.out.averages); // Since "today" is Mo...
mon.h" #include "ble_gap.h" #include "storage.h" static key_ltk_t *prv_create_remote_ltk_from_info(const SMRemoteEncryptionInfo *enc_info) { key_ltk_t *ltk = kernel_zalloc_check(sizeof(key_ltk_t)); ltk->rand = enc_info->rand; ltk->ediv = enc_info->ediv; memcpy(ltk->key, enc_info->ltk.data, sizeof(ltk->key)); ...
{ memcpy(&info->irk, dev->irk->key, sizeof(info->irk)); dialog_utils_bd_address_to_bt_device(&dev->addr, &info->identity); info->is_remote_identity_info_valid = true; }
else { // If the device did not exchange an IRK, we have been given the devices identity address and // this is how we will associate our connection with the device in the future. Therefore, mark // is_remote_identity_info_valid as true but leave the irk 0'ed out to indicate it is unused PBL_LO...
property_animation)); Animation *handle = animation_private_animation_init(&property_animation->animation); prv_init(property_animation, implementation, subject, from_value, to_value); return (PropertyAnimation *)handle; } // --------------------------------------------------------------------------------------...
(animation_h, &s_frame_layer_implementation, layer, from_frame, to_frame)
; } // ----------------------------------------------------------------------------------------- PropertyAnimation *property_animation_create_bounds_origin(Layer *layer, GPoint *from, GPoint *to) { // no legacy2 support as this was never exposed on 2.x PropertyAnimation *result = property_animation_create(&s_bou...
/* * 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...
(spinner_window, false /* animated */)
; } data->spinner_is_visible = true; data->spinner_should_close = false; } static void prv_hide_spinner(RecoveryFUAppData *data) { data->spinner_should_close = true; data->spinner_close_timer = app_timer_register(3000, prv_pop_spinner, data); } //////////////////////////////////////////////////////////// //...
tle delay so its easier to catch INT // on logic analyzer for (volatile int delay = 0; delay < 50; delay++) { } while (!s_expected_bytes_received) { }; hw_gpio_set_inactive(HOST_SPI->mcu_int.port, HOST_SPI->mcu_int.pin); } static void prv_handle_hi_command(void) { debug_print_str("HI CMD\n"); ...
hw_gpio_configure_pin(HOST_SPI->mcu_int.port, HOST_SPI->mcu_int.pin, HW_GPIO_MODE_OUTPUT, HOST_SPI->mcu_int.function, false)
re equal in priority to finite jobs, so it should get immediate air-time for one cycle: assert_ad_data("E"); // No jobs should been have been unscheduled: cl_assert_equal_i(s_unscheduled_cb_count, 0); // This is the last round for "C": regular_timer_fire_seconds(1); assert_ad_data("A"); regular_timer_fi...
{ GAPLEAdvertisingJobTerm advert_terms_a[] = { { .min_interval_slots = 160, .max_interval_slots = 320, .duration_secs = 1, }, { .min_interval_slots = 480, .max_interval_slots = 960, .duration_secs = 1, }, { .min_interval_slots = GAPLE_ADVERTISING_SILENCE...
BLEAdData *ad_b = create_ad("B", NULL); GAPLEAdvertisingJobRef job_b; job_b = gap_le_advert_schedule(ad_b, advert_terms_b, sizeof(advert_terms_b)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); // Even though B...
/* * 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_enable_input()
; #if RECOVERY_FW const AccessoryInputState input_state = AccessoryInputStateMfg; #else const AccessoryInputState input_state = AccessoryInputStateIdle; #endif PBL_ASSERTN(accessory_manager_set_state(input_state)); } } static void prv_mic_start(void *data) { const size_t BUFFER_SIZE = 24; new_timer_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(RTC_BKP_BOOTBIT_DR, current_value)
label; layer_set_frame(&time_selection_window->selection_layer.layer, &GRect(0, top_offset, time_selection_window->window.layer.bounds.size.w, selection_layer_default_cell_height())); } static void prv_vertical_align_text_layer(TimeSelectionWindowData *time_selection_window...
prv_update_range_text_layer(time_selection_window)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pebble_task_get_current()
== PebbleTask_App) { return app_state_get_window_stack(); } return modal_manager_get_window_stack(priority); } ClickManager *window_manager_get_window_click_manager(Window *window) { if (window_manager_is_app_window(window)) { return app_state_get_click_manager(); } return modal_manager_get_click_ma...
roperty_animation_update_int16, .accessors.setter.int16 = prv_curr_rel_bar_setter, .accessors.getter.int16 = prv_curr_rel_bar_getter, }; if (layer->relbar_layer.curr_rel_bar.rel_bar_type == RelationshipBarTypeOverlap) { curr_from_rel_bar_value = REL_BAR_CURR_OVERLAP_START_OFFSET; curr_to_rel_bar_va...
graphics_fill_rect(ctx, &line)
; // Top Notch for Bar 2 // Filled rect used to draw line of REL_BAR_LINE_WIDTH stroke width line2.origin.x = line.origin.x - REL_BAR_LINE_NOTCH_HORIZ_OFFSET + 1; line2.origin.y = line.origin.y; line2.size.w = REL_BAR_LINE_CHECK_LENGTH + REL_BAR_LINE_WIDTH; line2.size.h = REL_BAR_LINE_WIDTH; graphics_fil...
color_get_bw(GColorDarkGray).argb); cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_bw(GColorYellow).argb); cl_assert_equal_i(GColorBlackARGB8, gcolor_get_bw(GColorBlue).argb); cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_bw(GColorTiffanyBlue).argb); cl_assert_equal_i(GColorBlackARGB8, gcolor_get_bw(GColorOran...
{ // Passing in NULL for lookup_table should assert cl_assert_passert(gcolor_perform_lookup_using_color_luminance_and_multiply_alpha(GColorRed, NULL)); // A src_color of yellow should have a luminance that picks white from lookup_...
prv_test_tint_using_luminance_and_perform_lookup_using_color_luminance(GColorBlack, GColorBlack, GColorBlack); } void test_graphics_colors__component_multiply(void) { c...
, GPointZero, GCompOpTint, GColorBlue); cl_assert(gbitmap_eq(&dest_bitmap, &expect_bmp, "test_bitblt__8bit_comptint-expect.8bit.pbi")); // Rewrite the destination bitmap to be all black. memset(dest_data, GColorBlack.argb, sizeof(dest_data)); // Verify that if the tint color is clear, than the source bitmap s...
bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, &src_bmp, lower_right_legend_rect, GPointZero, GCompOpAssign, GColorWhite)
; } // RGB value should be discarded later on adding them here might relveal bugs. // .a is the important part GColor8 test_blend_colors[] = { (GColor8){.a = 0, .r = 3, .g = 2, .b = 1}, (GColor8){.a = 1, .r = 0, .g = 3, .b = 2}, (GColor8){.a = 2, .r = 1, .g = 0, .b = 3}, (GColor8){.a = 3, .r = ...
th; return true; } void comm_session_send_buffer_end_write(SendBuffer *sb) { CommSession *session = (CommSession *) sb; cl_assert(session); cl_assert(session->temp_write_buffer); const PebbleProtocolHeader pp_header = { .length = session->bytes_written, .endpoint_id = session->endpoint_id, }; c...
if (fake_transport->sent_cb) { fake_transport->sent_cb(pp_header.endpoint_id, buffer, pp_header.length); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Sending Data to PP endpoint %u (0x%x):", pp_header.endpoint_id, pp_header.endpoint_id); PBL_HEXDUMP(LOG_LEVEL_DEBUG, buffer, pp_header.length); ...
lows us to reduce the // number of times we have to send data for each session by batching it up into larger, fewer // messages. However, occasionally we do want to flush everything out. static int check_counter = 0; PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "send all sessions: empty %s connected %s ...
(&prv_check_all_sessions_timer_info)
fer_offset); } } else { // Original SVGs use Red for the stroke, replace it here const GColor8 key_stroke_color = GColorRed; gdraw_command_replace_color(processed_command, key_stroke_color, p->stroke_color); // replace surrounding color gdraw_command_replace_color(processed_command, p->key_col...
{ graphics_private_raw_mask_apply(output, mask, data_row_offset, x1.integer, 1, *input); input++; output++; }
#else memcpy((uint8_t *)output, (uint8_t *)input, width); input += width; output += width; #endif } // Last pixel with blending (don't render first AND last pixel if line length is 1) if (x2.fraction != 0) { graphics_private_raw_blend_color_factor(ctx, output, data_row_offset, *input, x2.integer...
0); // s_items[0] is the earliest pin, followed by s_items[4] cl_assert_equal_i(pin_db_delete((uint8_t *)&s_items[0].header.id, sizeof(Uuid)), 0); // next item should be items 4, going back should skip over items[0] cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].heade...
(iter_next(&iterator))
; cl_assert(uuid_equal(&state.pin.header.id, &multiday_item.header.id)); cl_assert(uuid_equal(&state.node->id, &multiday_item.header.id)); cl_assert(state.node->all_day); cl_assert_equal_i(state.node->timestamp, 1425369600); cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY); cl_assert_equal_i(state.c...