prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
_RAM_end__; } else if (task == PebbleTask_Worker) { ram_start = __WORKER_RAM__; ram_end = __WORKER_RAM_end__; } else { WTF; } // check for vulnerability: lower_bound outside of task's region PBL_ASSERTN(lower_bound >= ram_start); return (address >= lower_bound && address < ram_end); } // ----...
(Version, sys_get_current_process_sdk_version, void)
{ return process_metadata_get_sdk_version(sys_process_manager_get_current_process_md()); } DEFINE_SYSCALL(PlatformType, process_manager_current_platform, void) { PebbleTask task = pebble_task_get_current(); if (task != PebbleTask_App && task != PebbleTask_Worker) { return PBL_PLATFORM_TYPE_CURRENT; } c...
rv_rect) { TRY_ALLOCATE_STEPS_OR_RETURN_ERROR(5); if (argc >= 4) { GRectPrecise rect; ROCKY_ARGS_ASSIGN_OR_RETURN_ERROR(ROCKY_ARG(rect)); grect_precise_standardize(&rect); // shift rectangle into coordinate system const int16_t half_pt = FIXED_S16_3_HALF.raw_value; rect.origin.x.raw_value ...
jerry_create_undefined()
, jerry_create_undefined(), NULL, 0); }
_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_CUSTOM, all_caps), "Custom"); all_caps = true; cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_EVERYDAY, all_caps), "EVERY DAY"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_WEEKDAYS, all_caps), "WEEKDAYS"); cl_assert_equal_s(alarm_get_stri...
(s_num_alarms_fired, 1)
; } void test_alarm__recurring_daily_alarm(void) { time_t next_alarm_time = 0; alarm_get_next_enabled_alarm(&next_alarm_time); cl_assert_equal_i(next_alarm_time, 0); AlarmId id1, id2; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id1, 1...
ssert(stub_new_timer_timeout(get_reminder_timer_id()) == 100 * 1000); now = 100; stub_pebble_tasks_set_current(PebbleTask_NewTimers); cl_assert(stub_new_timer_fire(get_reminder_timer_id())); stub_pebble_tasks_set_current(PebbleTask_KernelBackground); fake_system_task_callbacks_invoke(1); cl_assert_equal_i(n...
cl_assert(uuid_equal(&s_all_day_reminder.header.id, (Uuid *)stub_new_timer_callback_data(get_reminder_timer_id())))
; } void test_reminders__stale_all_day(void) { time_util_update_timezone(&s_tz); // set time to 21:00 PST March 5, when s_all_day_reminder should be rejected for being stale now = 1425618000; cl_assert_equal_i(reminders_insert(&s_all_day_reminder), E_INVALID_OPERATION); // set time to 21:00 PST March 4 no...
f (info->key_len != sizeof(ActivitySettingsKey)) { PBL_LOG(LOG_LEVEL_WARNING, "Unexpected key len: %"PRIu32" ", (uint32_t)info->key_len); return; } // rewrite this entry ActivitySettingsKey key; info->get_key(old_file, &key, info->key_len); void *data = kernel_malloc_check(info->val_len); info->ge...
if (m_info.settings_key != ActivitySettingsKeyInvalid) { settings_file_set(file, &m_info.settings_key, sizeof(m_info.settings_key), m_info.value_p, sizeof(*m_info.value_p)); }
} } if (s_activity_state.need_activities_saved) { // Save stored activities ActivitySettingsKey key = ActivitySettingsKeyStoredActivities; settings_file_set(file, &key, sizeof(key), s_activity_state.activity_sessions, sizeof(s_activity_state.activi...
clude "fake_system_task.h" #include "fake_time.h" #include "stubs_analytics.h" #include "stubs_events.h" #include "stubs_language_ui.h" #include "stubs_logging.h" #include "stubs_print.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_passert.h" #include "stubs_pebble_process_md.h" #include "stubs...
(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST)
; } // work around system_task_add_callback extern void wakeup_dispatcher_system_task(void *data); void test_wakeup__out_of_order_schedule(void) { const time_t start_time = sys_get_time(); sys_wakeup_cancel_all_for_app(); // Schedule a wakeup for 10 windows into the future time_t late_event = start_time + WA...
///////////////////////////////////////////////////////// //! BT Classic Pairing Info void test_bluetooth_persistent_storage__bt_classic_store_and_get(void) { bool ret; // Output variables BTDeviceAddress addr_out; SM128BitKey link_key_out; char name_out[BT_DEVICE_NAME_BUFFER_SIZE]; uint8_t platform_bits_...
(platform_bits_2, platform_bits_out)
; // Add a thrid pairing BTDeviceAddress addr_3 = {{0x31, 0x32, 0x33, 0x34, 0x35, 0x36}}; SM128BitKey link_key_3 = {{0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30}}; char name_3[BT_DEVICE_NAME_BUFFER_SIZE] = "Device 3"; uint8_t pla...
) { // Do inverse if (data->up_down_direction) { frame.origin.y++; } else { frame.origin.x++; } } else if (data->select_index == SelectIndexDirection) { data->up_down_direction = !(data->up_down_direction); } else if (data->select_index == SelectIndexOverflow) { ...
layer_add_child(&data->canvas, &data->text_layer.layer)
; // Setup children for main window canvas layer_add_child(&window->layer, &data->direction_layer.layer); layer_add_child(&window->layer, &data->word_wrap_layer.layer); // Setup update proc to draw clipping box layer_set_update_proc(&window->layer, update_window); } static void push_window(struct AppState ...
v_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 10, ActivitySleepStateAwake); activity_get_metric(ActivityMetricActiveSeconds, 1, &value); cl_assert_equal_i(value, SECONDS_PER_HOUR + (2 * SECONDS_PER_MINUTE)); cl_assert_equal_i(health_service_sum_today(HealthMetricActiveSeconds), SECONDS_PER...
(10 * SECONDS_PER_MINUTE, 20, ActivitySleepStateAwake)
; } // 30 minute "morning walk" 4 hours later at 2:30am prv_feed_cannned_accel_data(30 * SECONDS_PER_MINUTE, 50, ActivitySleepStateAwake); activity_get_metric(ActivityMetricSleepState, 1, &value); cl_assert_equal_i(value, ActivitySleepStateAwake); cl_assert_equal_i(health_service_peek_current_activities(),...
. prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_single_duplicate_path; ctx.draw_state.clip_box = 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_...
(s_infinite_path, GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2))
/* * 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 == GCompOpAssign) { color.a = 3; } else if (compositing_mode == GCompOpTint) { prv_apply_tint_color(&color, tint_color); } else if (compositing_mode == GCompOpTintLuminance) { color = gcolor_tint_using_luminance_and_multiply_alpha(color, tint_color); }
color = gcolor_get_grayscale(color); for (unsigned int row_number = 0; row_number < ARRAY_LENGTH(*look_up); row_number++) { (*look_up)[row_number].palette_pattern[palette_index] = graphics_private_get_1bit_grayscale_pattern(color, row_number); (*look_up)[row_number].transparent_mask[palette...
root_level; } static void prv_cleanup_action_menu(ActionMenu *action_menu) { ActionMenuLevel *root_level = action_menu_get_root_level(action_menu); action_menu_hierarchy_destroy(root_level, NULL, NULL); i18n_free_all(root_level); prv_reset_session_responsiveness(); } static void prv_timeline_action_menu_did_c...
if (notif_list[i].type == NotificationMobile) { if (!notification_storage_get(&notif_list[i].id, &item)) { PBL_LOG(LOG_LEVEL_ERROR, "Trying to dismiss all an invalid notification"); continue; } }
const TimelineItemAction *action = timeline_item_find_dismiss_action(&item); if (action) { timeline_invoke_action(&item, action, NULL); performed_actions = true; // FIXME: PBL-34338 There are other actions that should also use bulk mode to avoid crashes // such as dismissing notificat...
63, 47043, 47321, 47597, 47872, 48144, 48415, 48684, 48951, 49217, 49480, 49742, 50002, 50260, 50516, 50770, 51023, 51273, 51521, 51768, 52013, 52255, 52496, 52735, 52972, 53207, 53440, 53670, 53899, 54126, 54351, 54574, 54794, 55013, 55230, 55444, 55657, 55867, 56076, 56282, 56486, 56688, 56888, 57086, 57281, 57475, 5...
if (y_wide < 0) { x_wide = -x_wide; y_wide = -y_wide; angle += 4; }
if (x_wide <= 0) { uint32_t t = x_wide; x_wide = y_wide; y_wide = -t; angle += 2; } if (x_wide <= y_wide) { uint32_t t = y_wide - x_wide; x_wide = x_wide + y_wide; y_wide = t; angle += 1; } angle *= TRIG_PI / 4; uint32_t ratio = (y_wide << TRIG_FP) / x_wide; return (angl...
path->points[i].y; } } return GRect(min_x, min_y, (max_x - min_x), (max_y - min_y)); } #if PBL_COLOR void prv_fill_path_with_cb_aa(GContext *ctx, GPath *path, GPathDrawFilledCallback cb, void *user_data) { /* * Filling gpaths with antialiasing for integral-coordinates based ...
(max_y, clip_max_y)
; // filling color hack GColor tmp = ctx->draw_state.stroke_color; ctx->draw_state.stroke_color = ctx->draw_state.fill_color; // find all of the horizontal intersections and draw them for (int16_t i = min_y; i <= max_y; ++i) { // initialize with 0 intersections intersection_down_count = 0; inter...
0Min, } PeekBeforeTimingMenuIndex; static const char *s_before_time_strings[PeekBeforeTimingMenuIndexCount] = { /// Shows up in the Timeline settings as a "Timing" subtitle and submenu option. i18n_noop("Start Time"), /// Shows up in the Timeline settings as a "Timing" subtitle and submenu option. i18n_noop("5...
timeline_peek_prefs_set_enabled(!timeline_peek_prefs_get_enabled())
; goto done; case TimelinePeekMenuIndex_Timing: prv_push_before_time_menu(data); goto done; case TimelinePeekMenuIndexCount: break; } WTF; done: settings_menu_reload_data(SettingsMenuItemTimeline); } static Window *prv_create_settings_window(void) { SettingsTimelinePeekData *dat...
ntity = pairing_info->identity, .csrk = pairing_info->csrk, .is_local_encryption_info_valid = pairing_info->is_local_encryption_info_valid, .is_remote_encryption_info_valid = pairing_info->is_remote_encryption_info_valid, .is_remote_identity_info_valid = pairing_info->is_remote_identity_info_valid, ...
prv_update_and_cleanup_struct_async(&data, sizeof(BTClassicPairingData), offsetof(SharedPRFData, bt_classic_data))
; } else { // Just updating the name prv_update_and_cleanup_struct_async(device_name, MEMBER_SIZE(BTClassicPairingData, name), offsetof(SharedPRFData, bt_classic_data) + offsetof(BTClassicPairingData, name)); } } void shared_prf_storage_store_bt_classic_pairing_data( BTDeviceAddress *ad...
pMessagePhaseOut phase = outbox->phase; *iterator = NULL; if (prv_is_message_pending(phase)) { PBL_LOG(LOG_LEVEL_ERROR, "Can't call app_message_outbox_begin() now, wait for sent_callback!"); // See https://pebbletechnology.atlassian.net/browse/PBL-10146 // Workaround for apps that sit in a while() loop...
((const uint8_t *)app_outbox_message, sizeof(AppMessageAppOutboxData) + transmission_size, app_message_outbox_handle_app_outbox_message_sent, NULL)
; return APP_MSG_OK; } void app_message_out_handle_ack_nack_received(const AppMessageHeader *header) { AppMessageCtxOutbox *outbox = &app_state_get_app_message_ctx()->outbox; if (!prv_is_awaiting_ack(outbox->phase)) { PBL_LOG(LOG_LEVEL_ERROR, "Received (n)ack, but was not expecting one"); return; } ...
{ 1480, 1184, 88}, { 864, 16, 288}, { 568, -200, 368}, { 752, 264, 336}, { 600, 672, 480}, { 752, 752, 472}, { 816, 624, 352}, { 840, 464, 312}, { 864, 368, 408}, { 768, 456, 400}, { 760, 496, 336}, { 760, 520, 256}, { 720, 568, 224}, { 728, 592, 256}, { 784, 5...
{ 1040, 736, 16}, { 1168, 680, 0}, { 944, 448, 32}, { 984, 408, -40}, { 1504, 1000, 24}, { 960, 112, 264}, { 600, -72, 400}, { 640, 120, 496}, { 672, 480, 552}, { 936, 848, 488}, { 792, 648, 448}, { 792, 344, 368}, { 776, 344, 400}, { 760, 448, 408}, { 800, 55...
{ 536, 232, -32}, { 608, 272, -16}, { 776, 464, -48}, { 864, 696, -16}, { 896, 688, 24}, { 1048, 696, 56}, { 1112, 512, 32}, { 848, 416, 48}, { 1024, 688, 16}, { 1544, 1272, 160}, { 688, -208, 432}, { 616, -176, 440}, { 784, 272, 344}, { 656, 728, 504}, { 760...
{ 1272, 424, -208}, { 1080, 376, -144}, { 1072, 216, -104}, { 1192, 224, -112}, // 18 seconds { 1296, 264, -104}, { 1176, 192, -24}, { 1280, 304, -136}, { 1256, 128, -80}, { 880, -168, -344}, { 1272, -144, 96}, { 1184, -232, -304}, { 1256, 56, -328}, { 1296, -16,...
{ 960, 64, -128}, { 1264, 80, -312}, { 1576, 96, -376}, { 1344, 144, -384}, { 1056, 168, -280}, { 984, 288, -280}, { 1152, 384, -320}, { 1200, 360, -296}, { 1224, 520, -408}, { 1360, 904, -440}, { 944, 752, -392}, { 1408, 872, -440}, { 1256, 656, -392}, { 1600, 56...
{ 1344, 432, -328}, { 1312, 288, -208}, { 1208, 264, -160}, // 26 seconds { 1336, 256, -200}, { 1448, 216, -184}, { 1312, 152, -216}, { 1128, 128, -248}, { 1104, 24, -200}, { 760, -144, -216}, { 928, -160, -224}, { 1040, -104, -112}, { 1152, 112, -336}, { 1368, 1...
auto_accept_re_pairing */); cl_assert(id_2 != BT_BONDING_ID_INVALID); cl_assert_equal_i(s_ble_bonding_change_add_count, 2); cl_assert_equal_i(fake_shared_prf_storage_get_ble_store_count(), 1); // This wasn't a gateway // Read both pairings back ret = bt_persistent_storage_get_ble_pairing_by_id(id_1, &irk_out...
(&pairing_3, true)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_ALWAYS, "Preparing to enter standby mode."); RebootReason reboot_reason = { reason, 0 }; reboot_reason_set(&reboot_reason); // Wipe display display_clear(); /* skip BT teardown if BT isn't working */ system_reset_prepare(reason == RebootReasonCode_DialogBootFault); #if PLATFORM_SIL...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(app_state_get_window_stack(), window, animated)
; } void app_window_stack_insert_next(Window *window) { window_stack_insert_next(app_state_get_window_stack(), window); } Window *app_window_stack_pop(bool animated) { return window_stack_pop(app_state_get_window_stack(), animated); } void app_window_stack_pop_all(const bool animated) { window_stack_pop_all(ap...
/* * 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...
{ hw_spi_write_buf(HOST_SPI->spi.peripheral, byte_buffer, num_bytes, prv_expect_byte_spi_int_cb, NULL); }
else { hw_spi_read_buf(HOST_SPI->spi.peripheral, byte_buffer, num_bytes, prv_expect_byte_spi_int_cb, NULL); } hw_gpio_set_active(HOST_SPI->mcu_int.port, HOST_SPI->mcu_int.pin); // Probably not necessary but add a little delay so its easier to catch INT // on logic analyzer ...
ctivity_activation_delay_insight_bitmask = 0; } // ============================================================================================= // Start of unit tests void test_activity_insights__initialize(void) { prv_set_time(&s_init_time_tm); fake_kernel_services_notifications_reset(); s_activation_time = 0...
(fake_kernel_services_notifications_ancs_notifications_count(), 0)
; // Advance the clock some and make sure we still don't get notifications for (int i = 0; i < 100; ++i) { rtc_set_time(rtc_get_time() + 2 * SECONDS_PER_MINUTE); activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); ...
che.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 language governing permissions and ...
ARRAY_LENGTH(ranges)
; i++) { if (strncmp(serial, ranges[i], strlen(ranges[i])) == 0) { return true; } } return false; } static bool prv_is_potentially_misaligned_watch() { return !prv_display_has_user_offset() && prv_is_known_misaligned_serial_number(mfg_get_serial_number()); } void display_calibration_promp...
ServiceIndefinite].state, ResponseTimeMiddle); cl_assert_equal_i(s_conn_mgr_states[BtConsumerMusicServiceIndefinite].max_period_secs, MAX_PERIOD_RUN_FOREVER); music_request_reduced_latency(false /* reduced_latency */); cl_assert_equal_i(s_conn_mgr_states[BtConsumerMusicSer...
music_get_playback_state()
, MusicPlayStateUnknown); uint32_t track_pos_ms; uint32_t track_duration_ms; music_get_pos(&track_pos_ms, &track_duration_ms); cl_assert_equal_i(track_pos_ms, 0); cl_assert_equal_i(track_duration_ms, 0); cl_assert_equal_i(music_get_playback_rate_percent(), 0); } void test_ams__receive_non_numeric_player_...
_reading = res; } // make sure that when we compute the largest possible (100% - 0%) and lowest possible // (0% - 100%) battery delta that we don't overflow the computation int32_t start_percent = battery_curve_lookup_percent_with_scaling_factor( 2000, false, scaling_factor); int32_t end_percent = ba...
(battery_get_charge_state().charge_percent, 80)
; } /* good -> lpm lpm -> good good -> critical critical -> lpm lpm -> critical critical -> good */ typedef enum { PowerStateGood, PowerStateLowPower, PowerStateCritical, PowerStateStandby } PowerStateID; extern PowerStateID s_power_state; void test_battery_monitor__transitions(void) { int good_mv = batte...
k_layer_timer = evented_timer_register_or_reschedule(data->peek_layer_timer, PEEK_LAYER_HIDE_DELAY, prv_hide_peek_layer, data); ...
(notifications_presented_list_current(), notif_id)
&& data->action_menu && ((Window *)data->action_menu)->on_screen && !action_menu_is_frozen(data->action_menu)) { action_menu_close(data->action_menu, true); } // Setting the next ID is handled by the service notifications_presented_list_remove(notif_id); if ((notifications_presented_list_curr...
, { -744, 128, 632}, { -744, 112, 616}, { -752, 96, 600}, { -736, 96, 592}, { -720, 120, 576}, { -688, 104, 584}, { -688, 112, 576}, { -688, 104, 592}, { -744, 128, 632}, { -768, 144, 616}, { -768, 152, 560}, { -776, 112, 592}, { -792, 136, 592}, // 455 seconds ...
{ -808, -120, -232}, { -848, 120, -8}, // 460 seconds { -1056, 512, 296}, { -1416, 360, 520}, { -912, 192, 160}, { -1096, 504, 576}, { -1104, 336, 496}, { -928, 320, 256}, { -816, 248, 184}, { -800, 256, 168}, { -808, 224, 200}, { -864, 288, 248}, { -888, 384, 248...
{ -880, 424, 152}, { -864, 440, 144}, { -856, 416, 160}, { -864, 432, 152}, { -856, 456, 136}, { -864, 440, 120}, { -864, 432, 136}, { -864, 440, 136}, { -864, 448, 144}, { -856, 432, 136}, // 463 seconds { -856, 432, 144}, { -856, 424, 144}, { -856, 424, 152}, ...
sizes_up_to(client, next_sn); client->out.next_expected_ack_sn = next_sn; if (prv_get_payload_size_for_sn(client, next_sn) != 0) { // Still awaiting ACKs prv_reset_ack_timeout(client); } prv_send_next_packets(client); } else if (sn == prv_prev_sn(client->out.next_expected_ack_sn)) { // Da...
{ goto handle_error; }
if (value_length < sizeof(PPoGATTMetaV0)) { goto handle_error; } const PPoGATTMetaV0 *meta = (const PPoGATTMetaV0 *) value; if (meta->ppogatt_min_version > PPOGATT_MAX_VERSION /* || meta->ppogatt_max_version < PPOGATT_MIN_VERSION // always true at the moment */) { goto handle_error; } if (uu...
rigin_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif } #define OFFSET_RECT_NO_CLIP GRect(20, 10, 144, 168) #define OFFSET_RECT_CLIP_XY GRect(20, 10, 20, 20) #define OFFSET_RECT_CLIP_NXNY GRect(20, 10, 144, 168) #define OFFSET_DRAW_RECT_NO_CLIP GRect(6, 6, 30, 40) #define OFFSET_DRAW_RECT_CLIP_X...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 5); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if ...
p_into_bitmap(&dest_bitmap, &cropped_src_bitmap, (GPoint) { 0, 2 }, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__bitmap_into_bitmap_sub_bitmap-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Test: // - source orig...
(dest_data, 0b00000000, sizeof(dest_data))
; bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorBlack); cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_black_on_black-expect.1bit.pbi")); gbitmap_destroy(src_bitmap); } // Test: // - source origin offset // - source bounds origin and size // ...
// make icon hidden (return true) if app has not recently communicated return !app_install_is_prioritized(entry->install_id); case ProcessVisibilityShown: return false; case ProcessVisibilityQuickLaunch: return true; } return false; } bool app_install_entry_is_quick_launch_visible_only(co...
{ return id; }
return INSTALL_ID_INVALID; } static void prv_app_install_delete(AppInstallId id, Uuid *uuid, bool app_upgrade, bool delete_cache) { if (!app_upgrade) { // remove settings associated with the app pin_db_delete_with_parent(uuid); } if (delete_cache) { // only log...
/* * 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(!circular_cache_get(&s_test_cache, &s_test_item[2]))
; cl_assert_equal_p(circular_cache_get(&s_test_cache, &s_test_item[0]), &s_cache_buffer[0]); cl_assert_equal_p(circular_cache_get(&s_test_cache, &s_test_item[1]), &s_cache_buffer[1]); circular_cache_push(&s_test_cache, &s_test_item[1]); cl_assert(!circular_cache_get(&s_test_cache, &s_test_item[2])); cl_asser...
sert(timeline_add(&all_day_item)); Iterator iterator = {}; TimelineIterState state = {}; TimelineNode *head = NULL; cl_assert_equal_i(timeline_init(&head), S_SUCCESS); const time_t time_21_00_march_1_pst = 1425272400; cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFutu...
(uuid_equal(&state.pin.header.id, &all_day_item.header.id))
bool is_gateway, const char *device_name, bool requires_address_pinning, uint8_t flags) { // We only have one slot in PRF and all pairing info (except the device // name) will arrive in one-shot so anytime this ...
{ BTDeviceInternal device_out = {}; bool rv = bt_persistent_storage_get_ble_pairing_by_id(BLE_BONDING_ID, IRK_out, &device_out, name); return (rv && bt_device_equal(&device->opaque, &device_out.opaque)); }
976, 352, -136}, { 1048, 376, -144}, { 1056, 392, -176}, { 1048, 432, -120}, { 1384, 528, -40}, { 1072, 664, 40}, { 1336, 736, -104}, { 1152, 600, -136}, { 928, 568, -200}, { 1128, 624, -24}, { 1552, 624, 8}, // 51 seconds { 1504, 408, 104}, { 1408, 232, 160}, { 1...
{ 1544, 288, -144}, { 1096, 240, -200}, { 1184, 120, -136}, { 1304, 232, -192}, { 1352, 240, -72}, { 1112, 416, -136}, { 1120, 408, 48}, { 1560, 704, 168}, { 992, 968, 176}, { 1272, 936, -160}, { 1176, 552, 8}, { 752, 576, -136}, { 912, 608, 24}, { 1336, 704, 144}...
{ 1224, 528, -160}, { 1160, 680, -168}, { 1368, 712, 0}, { 1680, 696, 200}, { 1960, 520, 304}, // 59 seconds { 1888, 464, 96}, { 1608, 528, 8}, { 1448, 752, -200}, { 1256, 832, -128}, { 968, 688, -48}, { 672, 528, -176}, { 472, 256, -296}, { 328, 8, -424}, { ...
tionDelayInsightType_Day4] = { // https://pebbletechnology.atlassian.net/browse/PBL-28581 .day_lag = 4, .hour = 20, .minute = 30, .trigger = prv_create_day_4_insight, .insight_type = ActivityInsightType_Day4, }, [ActivationDelayInsightType_Day10] = { // https://pebbletechnology.atlassian...
if (!insight_state->history_valid) { return false; }
time_t time_next_trigger = insight_state->last_triggered_utc + insight_settings->reward.notif_min_interval_seconds; if (time_next_trigger > now_utc) { // Stop here if not enough time has passed to trigger this reward INSIGHTS_LOG_DEBUG("Not triggering activity reward - too soon to trigger"); ret...
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Complete A the first time prv_advance_to_ms_with_timers(start_ms + ...
(prv_count_handler_entries(&s_started_handler_calls, a), 2)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 2); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 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...
(ctx, GColorBlack)
; graphics_draw_pixel(ctx, GPoint(5, -5)); } void outside_x_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(15, 15)); } void outside_nx_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color...
sWindow *window, int16_t max_fake_progress_percent) { window->max_fake_progress_percent = CLIP(max_fake_progress_percent, 0, MAX_PROGRESS_PERCENT); } void progress_window_set_progress(ProgressWindow *window, int16_t progress) { if (window->state == ProgressWindowState_Fak...
progress_window_init(window)
; return window; } void progress_window_destroy(ProgressWindow *window) { if (window) { progress_window_pop(window); } progress_window_deinit(window); applib_free(window); }
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...
{ // Prescaler is PRESC + 1. This subtracts one so that exact dividers are correct, but if there // is an integer remainder, the prescaler will ensure that the clock frequency is within spec. prescaler -= 1; }
// Make sure all the values fit in their corresponding fields PBL_ASSERTN((duty_cycle_low <= TIMINGR_MASK_SCLL) && (duty_cycle_high <= TIMINGR_MASK_SCLH) && (prescaler <= TIMINGR_MASK_PRESC)); periph_config_enable(bus->hal->i2c, bus->hal->clock_ctrl); // We currently don't need to...
t. */ heap_info_ptr = previous_block; } } /* Calculate the pointer to the next segment. */ HeapInfo_t *next_block = get_next_block(heap, heap_info_ptr); /* If we are pointing at the end of the heap, then use the */ /* begin as the n...
{ prv_sanity_check_block(heap, heap_info_ptr); /* Check to see if the current entry is free and is large*/ /* enough to hold the data being requested. */ if (heap_info_ptr->is_allocated || (heap_info_ptr->Size < n_units)) { /* If the requested size is larger than the limit then*/ ...
// make sure the space we found is within the bounds of the heap UTIL_ASSERT((heap_info_ptr >= heap->begin) && (heap_info_ptr <= heap->end)); return heap_info_ptr; } //! Split a block into two smaller blocks, returning a pointer to the new second block. //! The first block will be available at the same ...
/* * 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...
(iter->fd, 0, FSeekCur)
; PBL_LOG(LOG_LEVEL_ERROR, "Could not read data to %p of length %d at pos %d: %"PRId32, data, data_len, pos, status); fatal_logic_error(iter); } static int sfs_write(SettingsRawIter *iter, const uint8_t *data, int data_len) { status_t status = pfs_write(iter->fd, data, data_len); if (status >= 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...
layer_set_update_proc(window_layer, prv_update_proc)
; } static void init(void) { __profiler_init(); window = window_create(); window_set_window_handlers(window, (WindowHandlers) { .load = window_load, }); window_stack_push(window, true); } static void deinit(void) { window_destroy(window); } int main(void) { init(); app_event_loop(); deinit(); }...
le law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #incl...
app_cache_get_next_eviction()
); cl_assert_equal_i(fake_event_get_count(), 2); } /************************************* * Add 3, update 2, evict 1 * *************************************/ void test_app_cache__add_update_evict(void) { // add all three cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app1.id, app1.size)); cl_assert_equal_...
JS_VAR listeners = prv_get_or_create_listener_array(event_name); const uint32_t num_entries = jerry_get_array_length(listeners); JS_UNUSED_VAL = jerry_set_property_by_index(listeners, num_entries, listener); } static bool prv_remove_listener(jerry_value_t event_listeners, uint32_t idx, ...
(arg_result)
; } const bool removed = prv_remove_event_listener_from_list(event_name, func); if (removed) { API_REFS_FOREACH(api_ref) { if ((*api_ref)->remove_handler) { (*api_ref)->remove_handler(event_name, func); } } } else { APP_LOG(LOG_LEVEL_WARNING, "Unknown handler for event '%s'", ev...
connection(&s_conn_a)); prv_assert_event_service_subscribed(true); cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 1); cl_assert_equal_i(s_sys_hrm_manager_unsubscribe_call_count, 0); // Device B unsubscribes, expect to be unsubscribed from HRM manager, because there are no more // devices...
(&s_conn_a)
; // Fake reconn & subscribe: bt_driver_cb_hrm_service_update_subscription(s_device_a, true); // No sharing request UI: cl_assert_equal_p(NULL, s_last_sharing_request); // Still declined: cl_assert_equal_b(false, ble_hrm_is_sharing_to_connection(&s_conn_a)); } void test_ble_hrm__unsub_upon_deinit(void) ...
; } void spi_slave_burst_read_write_scatter(const SPISlavePort *slave, const SPIScatterGather *sc_info, size_t num_sg) { prv_spi_acquire_helper(slave); spi_ll_slave_burst_read_write_scatter(slave, sc_info, num_sg); prv_spi_release_helper(slave); } void s...
while (len--) { prv_spi_send_data(slave->spi_bus, *(cptr++)); prv_spi_transmit_flush_blocking(slave->spi_bus); }
/* * 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...
{ ActionableDialog *actionable_dialog = actionable_dialog_create("Confirm Dialog"); Dialog *dialog = actionable_dialog_get_dialog(actionable_dialog); dialog_set_text(dialog, "Confirmation"); dialog_set_background_color(dialog, GColorGreen); dialog_set_icon(dialog, data->resource_id_80); dialog_show_status_b...
///////////////// // Decline Dialog static void prv_decline_click_handler(ClickRecognizerRef recognizer, void *context) { app_window_stack_pop(true); } static void prv_decline_config_provider(void *context) { window_single_click_subscribe(BUTTON_ID_SELECT, prv_decline_click_handler); } static void prv_show_dec...
ount_to_head_from(&a) == 1); } typedef struct IntNode { ListNode list_node; int value; } IntNode; int sorting_comparator(IntNode* a, IntNode* b) { return b->value - a->value; } void test_list__sort_ascending(void) { IntNode bar1 = { .value = 1 }; IntNode bar2 = { .value = 2 }; IntNode bar3 = { .value = 3...
cl_assert_equal_p(list_concatenate(&b, &c), &a)
; cl_assert_equal_p(b.next, &c); cl_assert_equal_p(c.prev, &b); cl_assert_equal_p(list_concatenate(&e, &f), &e); cl_assert_equal_p(list_concatenate(&d, &f), &d); cl_assert_equal_p(list_concatenate(&f, &d), &d); cl_assert_equal_p(list_concatenate(NULL, &d), &d); cl_assert_equal_p(list_concatenate(NULL, &...
ize_out, void *user_data); //////////////////////////////////////////////////////////////////////////////////////////////////// //! Helpers static void prv_add_scrollable_metrics(WorkoutActiveWindow *active_window, int num_scrollable_metrics, ...
fonts_get_system_font(FONT_KEY_LECO_38_BOLD_NUMBERS)
: fonts_get_system_font(FONT_KEY_LECO_26_BOLD_NUMBERS_AM_PM); } static GTextNode* prv_create_text_node(WorkoutActiveWindow *active_window, WorkoutMetricType metric_type, bool prefer_larger_font, ...
minute: undefined, second: undefined});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "20:04:05"); EXECUTE_SCRIPT_EXPECT_ERROR( "d.toLocaleTimeString(undefined, {minute: 'numeric', hour: '2-digit'})", "TypeError: Unsupported options" ); } void test_rocky_api_datetime__locale_time_string_date_options(void) { rocky...
("s", "Mon")
; EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'long'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Monday"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: 'numeric'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "7"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: '2-digit'});"); ASSE...
/* * 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(*output == i)
; } } void test_lru_cache__use_and_evict(void) { int i; for (i = 0; i < CACHE_BUFFER_SIZE / (sizeof(CacheEntry) + sizeof(uint32_t)); ++i) { uint32_t input = i; lru_cache_put(&s_cache, i, &input); } // use entry 0 to keep it around uint32_t *output = lru_cache_get(&s_cache, 0); cl_assert(output); ...
sure our median is fairly low AVERAGE_SLEEP, AVERAGE_SLEEP, AVERAGE_SLEEP, AVERAGE_SLEEP, AVERAGE_SLEEP, AVERAGE_SLEEP, AVERAGE_SLEEP, AVERAGE_SLEEP }; memcpy(&s_data.metric_history[ActivityMetricSleepTotalSeconds], sleep_history, sizeof(sleep_history)); } // --------------...
activity_insights_init(rtc_get_time())
; // Provide non-zero step count s_data.metric_history[ActivityMetricStepCount][0] = 500; activity_insights_process_minute_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 0); } // --------------------------------------------------------------------------------------- void test_activity_insights__sl...
/* * 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...
notification_storage_init()
; } void notifications_add_notification(TimelineItem *notification) { notification_storage_store(notification); Uuid *uuid = kernel_malloc_check(sizeof(Uuid)); *uuid = notification->header.id; notifications_handle_notification_added(uuid); }
// See if we have a stepping rate update from the algorithm. If so, accumulate the distance // covered. uint16_t rate_steps; uint32_t rate_elapsed_ms; time_t rate_update_time; activity_algorithm_get_step_rate(&rate_steps, &rate_elapsed_ms, &rate_update_time); if (rate_update_time != s_acti...
activity_algorithm_metrics_changed_notification()
; // Register our minutes callback cron_job_schedule(&s_activity_job); s_activity_state.started = true; PBL_LOG(LOG_LEVEL_INFO, "Activity tracking started"); PebbleEvent event = { .type = PEBBLE_ACTIVITY_EVENT, .activity_event = { .type = PebbleActivityEvent_TrackingStarted, ...
lid resource API return values if (bytes_read < 0) { bytes_read = 0; } } pfs_close(fd); return bytes_read; } /////////////////////////////////////////////////////////////////////////////// // ResourceStoreTypeFile implementation static int prv_file_open_by_name(const char *name, uint8_t op_flags)...
PBL_LOG(LOG_LEVEL_ERROR, "System resource file %"PRIu32" corrupt!!!", resource_id)
; } const uint32_t large_file_size_threshold = 200 * 1024; if (file_length > large_file_size_threshold) { // If this file is over 200KB, it's going to take a while to CRC. Let's sleep a bit // between entries so we don't starve out our background task. See PBL-24560 for a real ...
{ 648, 496, -136}, { 776, 544, -208}, { 936, 576, -360}, { 904, 544, -336}, { 960, 592, -448}, { 904, 640, -488}, { 1072, 600, -384}, { 1424, 712, -464}, { 1280, 720, -400}, // 13 seconds { 1456, 592, -208}, { 1600, 544, -192}, { 1432, 384, -56}, { 1120, 360, -48}, ...
{ 1256, 136, -248}, { 936, 112, -168}, { 704, 288, -240}, { 576, 376, -232}, { 560, 376, -160}, { 648, 448, -224}, { 776, 536, -264}, { 760, 680, -328}, { 952, 672, -368}, { 1128, 600, -264}, { 1696, 576, -256}, { 1128, 584, -360}, { 1320, 536, -512}, { 1424, 392,...
{ 1232, 344, -304}, { 1312, 528, -416}, { 1296, 552, -472}, { 1320, 392, -288}, { 1440, 296, -256}, // 21 seconds { 1216, 240, -248}, { 896, 248, -224}, { 760, 240, -224}, { 696, 216, -208}, { 688, 144, -192}, { 688, 144, -176}, { 744, 112, -200}, { 1048, 184, -2...
(&config, window_stack)
; } void timeline_actions_dismiss_all(NotificationInfo *notif_list, int num_notifications, ActionMenu *action_menu, ActionCompleteCallback dismiss_all_complete_callback, void *dismiss_all_cb_data) { ActionResultData...
s_alg_state->num_minute_records); exit: if (file && (need_close || nuke_file)) { prv_minute_data_file_close(file); file = NULL; } if (nuke_file) { PBL_LOG(LOG_LEVEL_WARNING, "Detected invalid minute data file, deleting it"); pfs_remove(ALG_MINUTE_DATA_FILE_NAME); } return file; } /...
if (s_alg_state->dls_session == NULL) { // We don't need to be buffered since we are logging from the KernelBG task and this // saves having to allocate another buffer from the kernel heap. const bool buffered = false; const bool resume = false; Uuid system_uuid = UUID_SYSTEM; s_alg_state->dls_s...
return s_alg_state->dls_session; } // ------------------------------------------------------------------------------------- // We use NOINLINE to reduce the stack requirements during the minute handler (see PBL-38130) static void NOINLINE prv_set_dls_minute_record_entry(AlgMinuteDLSRecord *dls_record, ...
/* * 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...
voice_handle_dictation_result(VoiceEndpointResultFailInvalidMessage, session_id, NULL, app_initiated, app_uuid)
; return false; } *app_uuid_out = app_uuid; return true; } static void prv_handle_dictation_result(VoiceSessionResultMsg *msg, size_t size) { const size_t attr_list_size = size - sizeof(VoiceSessionResultMsg) + sizeof(GenericAttributeList); const bool app_initiated = (msg->flags.app_initiated == 1); U...
h> T_STATIC bool prv_scroll_layer_is_paging_enabled(ScrollLayer *scroll_layer) { PBL_ASSERTN(scroll_layer); if (process_manager_compiled_with_legacy2_sdk() || !scroll_layer->shadow_sublayer.hidden) { return false; } return !scroll_layer->paging.paging_disabled; } T_STATIC uint16_t prv_scroll_layer_get_pag...
(property_animation_get_animation(scroll_layer->animation))
; content_indicator_destroy_for_scroll_layer(scroll_layer); layer_deinit(&scroll_layer->layer); } void scroll_layer_destroy(ScrollLayer *scroll_layer) { if (scroll_layer == NULL) { return; } scroll_layer_deinit(scroll_layer); applib_free(scroll_layer); } Layer* scroll_layer_get_layer(const ScrollLayer...
str_length == ps2->str_length) && (memcmp(ps1->str_value, ps2->str_value, ps1->str_length) == 0); } bool pstring_equal_cstring(const PascalString16 *pstr, const char *cstr) { return pstr && cstr && (pstr->str_length == strlen(cstr)) && (memcmp(pstr->str_value, cstr, pstr->str_length) == 0); } //--...
pstring_print_pstring(pstring)
; } }
/ Add a thrid pairing BTDeviceAddress addr_3 = {{0x31, 0x32, 0x33, 0x34, 0x35, 0x36}}; SM128BitKey link_key_3 = {{0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30}}; char name_3[BT_DEVICE_NAME_BUFFER_SIZE] = "Device 3"; uint8_t platform_...
(&addr_in, &link_key_out, name_out, &platform_bits_out)
; cl_assert(id_out == BT_BONDING_ID_INVALID); } void test_bluetooth_persistent_storage__delete_bt_classic_pairing_by_id(void) { bool ret; // Output variables BTDeviceAddress addr_out; SM128BitKey link_key_out; char name_out[BT_DEVICE_NAME_BUFFER_SIZE]; uint8_t platform_bits_out; // Store a new pairin...
(inactive %s tot_bytes %"PRIu32" empty %s)", logging_session->comm.session_id, logging_session->tag, bool_to_str(inactive), total_bytes, bool_to_str(empty)); if (inactive && (total_bytes == 0)) { prv_remove_logging_session(logging_session); return true; } else if (!empty && !inacti...
(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Inactivating session: %"PRIu8, session->comm.session_id)
tual - 1, origin.y + height - 1); const GPoint left_t = GPoint(origin.x, origin.y + radius); const GPoint left_b = GPoint(origin.x, origin.y + radius + height_actual - 1); const GPoint right_t = GPoint(origin.x + width - 1, origin.y + radius); const GPoint right_b = GPoint(origin.x + width - 1, origin.y + rad...
PBL_ASSERTN(context)
; PBL_ASSERTN(framebuffer); *context = (GContext) { // For apps, this is run before the app has a chance to run, so there's no concern here of the // app changing its framebuffer size. .dest_bitmap = framebuffer_get_as_bitmap(framebuffer, &framebuffer->size), .parent_framebuffer = framebuffer, ...
hEventConfig *config) { app_run_state_send_update(&app_manager_get_current_app_md()->uuid, RUNNING); } void process_manager_put_kill_process_event(PebbleTask task, bool gracefully) { app_run_state_send_update(&app_manager_get_current_app_md()->uuid, NOT_RUNNING); } CommSession *comm_session_get_system_session(voi...
(s_app_run_state_messages, msg_count)
; } app_run_state_protocol_msg_callback(NULL, (uint8_t*)&msg, sizeof(msg)); cl_assert_equal_i(s_launcher_deprecated_messages, 1); }
pdate_proc; } void layer_set_frame(Layer *layer, const GRect *frame) { if (grect_equal(frame, &layer->frame)) { return; } const bool bounds_in_sync = gpoint_equal(&layer->bounds.origin, &GPointZero) && gsize_equal(&layer->bounds.size, &layer->frame.size); layer->frame = *fram...
window_schedule_render(child->window)
; } Layer *sibling = parent->first_child; if (sibling == NULL) { parent->first_child = child; return; } for (;;) { // Prevent setting the child to point to itself, causing infinite loop the next time this is // called if (sibling == child) { PBL_LOG(LOG_LEVEL_DEBUG, "Layer has alread...
forget to add it here case WorkoutMetricType_None: case WorkoutMetricTypeCount: break; } return &container->node; } static void prv_set_action_bar_icons(WorkoutActiveWindow *active_window) { ActionBarLayer *action_bar = &active_window->action_bar; bool is_paused = false; bool can_stop = false;...
(active_window->hr_measuring_icon)
; bounds.origin = box->origin; bounds.size.w = s_hr_measuring_widths[active_window->cur_hr_measuring_width_idx]; prv_draw_heart_icon(ctx, active_window->hr_measuring_icon, &bounds, render, size_out); } static void prv_render_separator(GContext *ctx, Layer *layer) { graphics_context_set_stroke_color(ctx, GColor...
ge); } } bt_unlock(); } void command_bt_disc_stop(void) { bt_lock(); { GAPLEConnection *conn = prv_get_le_connection_and_print_info(); if (conn) { bt_driver_gatt_stop_discovery(conn); } } bt_unlock(); } #if BT_CONTROLLER_DA14681 static TimerID s_sleep_test_timer = TIMER_INVALID_ID; s...
{ prompt_send_response_fmt(buffer, 32, "Ble Log level: %d", log_level); }
} // ARG: // 0 - Request BLE firmware to coredump // 1 - Force BLE firmware to hard fault // 2 - Force the BLE chip to watchdog (by wedging a task) void command_ble_core_dump(const char *command) { int option = atoi(command); if ((option < 0) || (option >= BtleCoreDumpCount)) { prompt_send_response("Invalid BL...
oreSleep", 0, 0, false}, [PowerSystemMcuCoreRun] = { "McuCoreRun", 0, 0, false}, [PowerSystemMcuGpioA] = { "McuGpioA", 0, 0, false}, [PowerSystemMcuGpioB] = { "McuGpioB", 0, 0, false}, [PowerSystemMcuGpioC] = { "McuGpioC", 0, 0, false}, [PowerSystemMcuGpioD] = { "McuGpioD...
PBL_LOG(LOG_LEVEL_WARNING, "repeat call to start ticks without stopping from %s", current_profile->name)
; // Someone was careless: two cases: // 1) someone forgot to call stop // 2) someone re-enters a function that calls start before stop is called. return; } current_profile->start_ticks = rtc_get_ticks(); current_profile->dirty = true; } void power_tracking_stop(PowerSystem system) { if (!s_i...
-32}, { 816, 120, -32}, { 880, 96, 0}, { 1032, 72, -8}, // 77 seconds { 1056, 96, -16}, { 1136, 88, -16}, { 1248, 120, -40}, { 1160, 120, -32}, { 1120, 136, -96}, { 1304, 232, -96}, { 1200, 256, -168}, { 936, 264, -184}, { 656, 240, -160}, { 512, 200, -184}, ...
{ 1056, 352, -208}, { 1128, 328, -168}, { 1208, 336, -112}, { 1192, 296, -64}, { 1056, 256, -8}, { 896, 208, 16}, { 776, 184, 0}, { 752, 160, 0}, { 776, 144, 8}, { 800, 136, 16}, { 856, 128, 16}, { 1072, 160, -24}, { 1032, 96, 0}, { 1160, 144, -80}, // 83 seco...
{ 776, 136, -8}, { 864, 128, 24}, { 1088, 136, -16}, { 1136, 128, 0}, { 1080, 96, 0}, { 1304, 144, -64}, { 1128, 120, 24}, { 1168, 176, -56}, { 1352, 200, -32}, { 1248, 256, -112}, { 904, 264, -176}, { 576, 216, -176}, { 432, 216, -160}, { 416, 176, -144}, { ...
tatic void prv_update_events_callback(SettingsFile *old_file, SettingsFile *new_file, SettingsRecordInfo *info, void *context) { // Check if valid entry if (!context || info->key_len != sizeof(WakeupId)) { return; } bool struct_size_mismatch = info->val_len != sizeof(WakeupEntry); bool struct_migrati...
process_metadata_get_sdk_version( sys_process_manager_get_current_process_md())
; if (version_compare(app_sdk_version, first_utc_version) < 0) { return true; } return false; } DEFINE_SYSCALL(WakeupId, sys_wakeup_schedule, time_t timestamp, int32_t reason, bool notify_if_missed) { if (prv_compiled_without_utc_support()) { // Legacy a...
en not called from a touch event handler recognizer_transition_state(r, RecognizerState_Failed); cl_assert_equal_i(r->state, RecognizerState_Failed); cl_assert(s_manager_state_change); cl_assert_equal_i(event_type, -1); r->state = RecognizerState_Possible; s_manager_state_change = false; recognizer_trans...
(!s_manager_state_change)
; r->state = RecognizerState_Started; recognizer_transition_state(r, RecognizerState_Completed); cl_assert_equal_i(event_type, RecognizerEvent_Completed); cl_assert_equal_i(r->state, RecognizerState_Completed); cl_assert(!s_manager_state_change); r->state = RecognizerState_Possible; recognizer_transitio...
Layer *text_layer; Layer *line_layer; static char g_text[100]; // Return current time in ms static uint64_t prv_ms(void) { time_t cur_sec; uint16_t cur_ms = time_ms(&cur_sec, NULL); return ((uint64_t)cur_sec * 1000) + cur_ms; } static void steps_event_handler(uint16_t type, AppWorkerMessage *data) { //APP_L...
(APP_LOG_LEVEL_INFO, "app: Retrieved %d minute records in %"PRIu32" ms:", num_records_returned, (uint32_t)elapsed_ms)
; for (int i = 0; i < num_records_returned; i++) { APP_LOG(APP_LOG_LEVEL_INFO, " steps: %"PRIu8", orient: 0x%"PRIx8", vmc: %"PRIu16", " "light: %d, valid: %d", minute_data[i].steps, minute_data[i].orientation, minute_data[i].vmc, (int)minute_data[i].light, (int)(!minute_data[i].is...
//!< used to persist the response value while waiting for result bool ignore_failures; } response; struct { Window *action_chaining_window; TimelineItem *notif; } chaining_data; struct { char *message; TimelineResourceId icon; bool success; } dialog; struct { ActionCompleteCa...
{ goto cleanup; }
dialog = simple_dialog_get_dialog(simple_dialog); } else { expandable_dialog = expandable_dialog_create("Action Result"); if (!expandable_dialog) { goto cleanup; } expandable_dialog_show_action_bar(expandable_dialog, false); dialog = expandable_dialog_get_dialog(expandable_dialog); } ...
((event->source != PhoneCallSource_ANCS) && !s_mobile_app_is_connected) { PBL_LOG(LOG_LEVEL_INFO, "Ignoring incoming call. Mobile app is not connected. Call source: %d ", event->source); return; } s_call_in_progress = true; s_call_source = event->source; s_call_identifier = event->call_iden...
prv_handle_incoming_call(&event)
; break; case PhoneEventType_Outgoing: prv_handle_outgoing_call(&event); break; case PhoneEventType_Missed: prv_handle_missed_call(&event); break; case PhoneEventType_Ring: // Just ignore these. We can ring on our own. break; case PhoneEventType_Start: prv...
/* * 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...
gpio_use(af_config->gpio)
; GPIO_Init(af_config->gpio, &init); GPIO_WriteBit(af_config->gpio, af_config->gpio_pin, asserted? Bit_SET : Bit_RESET); gpio_release(af_config->gpio); } void gpio_input_init(const InputConfig *input_config) { if (input_config->gpio == NULL) { return; } gpio_input_init_pull_up_down(inp...
///////////////// // Set up dialog labels and callbacks typedef struct DialogNode { const char *label; void (*show)(DialogsData *data); } DialogNode; static const DialogNode nodes[] = { { .label = "D1 - Confirm", .show = prv_show_confirm_dialog, }, { .label = "D2 - Decline", ...
(&data->menu_layer)
; i18n_free_all(data); app_free(data); } //////////////////// // App boilerplate static void s_main(void) { prv_handle_init(); app_event_loop(); prv_handle_deinit(); } const PebbleProcessMd* dialogs_demo_get_app_info() { static const PebbleProcessMdSystem s_app_md = { .common = { .main_func = s...
(void *)device); } static void prv_upsert_permission(const BTDeviceInternal *device, HrmSharingPermission permission) { BLEHRMSharingPermission *p = prv_find_permission_by_device(device); if (!p) { p = kernel_zalloc_check(sizeof(*p)); p->device = *device; s_permission...
(&s_ble_hrm_session.service_info)
; analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BLE_HRM_SHARING_TIME); } static void prv_execute_on_kernel_main(CallbackEventCallback cb) { if (pebble_task_get_current() != PebbleTask_KernelMain) { launcher_task_add_callback(cb, NULL); } else { cb(NULL); } } static void prv_push_sharing_request_wi...
w = frame.size.w - right_margin_px - left_margin_px - action_bar_offset - right_aligned_box_reduction; #else x = 0; w = frame.size.w - right_margin_px - action_bar_offset - right_aligned_box_reduction; #endif y = icon ? icon_offset + icon_size.h : -HEADER_OFFSET; TextLayer *header_layer = ...
action_bar_layer_add_to_window(action_bar, window)
; } else { window_set_click_config_provider_with_context(window, prv_config_provider, expandable_dialog); } x = PBL_IF_RECT_ELSE(left_margin_px, (show_action_bar) ? (frame.size.w - right_margin_px - left_margin_px - action_bar_offset - right_aligned_box_reduction - icon_size.h) : (90 - ico...
_next_page(file->curr_page, &file->curr_page) != S_SUCCESS) { PBL_LOG(LOG_LEVEL_WARNING, "R:Couldn't find next page for %d", file->curr_page); res = E_INTERNAL; goto cleanup; } } res = bytes_read; cleanup: mutex_unlock_recursive(s_pfs_mutex); return (res); } int pfs_seek(int fd...
if (IS_PAGE_TYPE(hdr.page_flags, PAGE_FLAG_ERASED_PAGE) || IS_PAGE_TYPE(hdr.page_flags, PAGE_FLAG_START_PAGE) || IS_PAGE_TYPE(hdr.page_flags, PAGE_FLAG_CONT_PAGE) || page_is_deleted(hdr.page_flags)) { return (true); }
} // pfs filesystem is not active return (false); } // migration utility // Returns true if valid PFS file found, false otherwise bool pfs_active(void) { return pfs_active_in_region(0, s_pfs_size); } // Scans through the filesystem to see if we rebooted while a file was in the // middle of being created and...
TextLayout* const layout) { PBL_ASSERTN(layout); bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, text); if (!success) { layout->max_used_size = GSizeZero; PBL_LOG(LOG_LEVEL_DEBUG, "Invalid UTF8"); return; } int str_len_bytes = (utf8_bounds.end - utf8_bounds...
grect_to_global_coordinates(box, ctx)
; GRect temp_box = global_box; grect_clip(&temp_box, &ctx->draw_state.clip_box); if (temp_box.size.h <= 0) { // the text is not ever going to make it on screen. Bail early. return; } if (layout) { layout->box.origin = global_box.origin; } WalkLinesCallbacks callbacks = { .render_line_c...
(b, play_count_b)
; // Create a sequence Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); // Setup started/stopped handlers for the sequence const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; animation_set_handlers(seq, handlers, 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...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME sleep_1_v1 //> TEST_VERSION 1 //> TEST_TOTAL 325 //> TEST_TOTAL_MIN 300 //> TEST_TOTAL_MAX 350 //> TEST_DEEP 180 //> TEST_DEEP_MIN 170 //> TEST_DEEP_MAX 200 //> TEST_START_AT 27 //> TEST_START_AT_MIN 20 //> TEST...
state); VOICE_LOG("Event received: %"PRIu8"; state:%"PRIu8, event->type, simple_state); switch (simple_state) { case StateWaitForReady: if (event->type == VoiceEventTypeSessionSetup) { prv_handle_ready_event(data, event); } break; case StateWaitForResponse: if (event->type =...
(anim, &from)
; property_animation_set_to_int16(anim, &to); animation_set_duration((Animation *) anim, duration); animation_set_curve((Animation *) anim, AnimationCurveEaseInOut); return anim; } static const PropertyAnimationImplementation s_animated_dot_impl = { .base = { .update = (AnimationUpdateImplementa...
/* * 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...
(FLASH_CONFIG.spi_gpio, FLASH_CONFIG.mosi_pin, altfunc)
; // Setup MISO/MOSI GPIO_InitTypeDef gpio_cfg; gpio_cfg.GPIO_OType = GPIO_OType_PP; gpio_cfg.GPIO_PuPd = GPIO_PuPd_NOPULL; gpio_cfg.GPIO_Mode = GPIO_Mode_AF; gpio_cfg.GPIO_Speed = GPIO_Speed_50MHz; gpio_cfg.GPIO_Pin = (1 << FLASH_CONFIG.miso_pin) | (1 << FLASH_CONFIG.mosi_pin); GPIO_Init(FLASH_CONFIG....
/* * 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...
ble_gap_device_name_set(name, ATT_PERM_READ)
; if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_DEBUG, "Unexpected error setting name: %d", (int)e); } } static void prv_gap_le_device_name_request(Connection *connection) { att_uuid_t name_id; ble_uuid_create16(ATT_CHAR_DEVICE_NAME, &name_id); uint16_t conn_idx = connection_get_idx(connection); ble_er...
/* * 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_IF_BW_ELSE(43, 38)
, 43); const int x_center_offset = PBL_IF_BW_ELSE(19, 18); kino_reel_draw(data->icon, ctx, GPoint(base_layer->bounds.size.w / 2 - x_center_offset, y)); } static void prv_render_current_steps(GContext *ctx, Layer *base_layer) { HealthActivitySummaryCardData *data = layer_get_data(base_layer); char buffer[8]; ...
ck_config(void *context) { window_single_click_subscribe(BUTTON_ID_UP, prv_coredump_confirm_cb); window_single_click_subscribe(BUTTON_ID_DOWN, prv_confirm_pop); window_single_click_subscribe(BUTTON_ID_BACK, prv_confirm_pop); } static void prv_coredump_reset_confirm_cb(ClickRecognizerRef recognizer, void *context...
menu_layer_get_layer(menu_layer)
); } static void prv_information_window_unload(Window *window) { SettingsSystemData *data = (SettingsSystemData*) window_get_user_data(window); menu_layer_deinit(&data->menu_layer); prv_deinit_status_bar(&data->status_layer); } static void prv_information_window_push(SettingsSystemData *data) { SystemInformat...
er_is_empty("outside_nx_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_y_offset_layer", ctx.parent_framebuffer, GColorWhite)); ...
(ctx, GPoint(p.x + 7, p.y + 2))
; graphics_draw_pixel(ctx, GPoint(p.x + 0, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 1, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 2, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y + 3)); graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y ...
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.regulatory_marks); app_free(data->certification_data.menu_items); prv_deinit_status_bar(&data->status_layer)...
(&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 void prv_shutdown_confirm_cb(ClickRecognizerRef reco...
{ .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKENDS }); prv_assert_alarm_config(id1, 10, 30, false, ALARM_KIND_WEEKENDS, s_weekend_schedule); // Only 1 pin should be added (for Saturday) cl_assert_equal_i(s_num_timeline_adds, 1); id2 = alarm_create(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KI...
(s_num_alarm_events_put, 2)
; cl_assert_equal_i(s_num_timeline_adds, 11); cl_assert_equal_i(s_num_timeline_removes, 7); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // First alarm goes off. Second one should be up s_current_hour = 10; s_current_minute = 30; s_current_day = s_friday; cron_servic...
; s_pending_did_read = (PendingInfo) { .active = true, .attribute = attribute, .length = read_length }; } static void prv_did_read_handler(SmartstrapAttribute *attribute, SmartstrapResult result, const uint8_t *data, size_t length) { cl_assert(data == (uint8_t *)attri...
cl_assert(app_smartstrap_attribute_get_attribute_id(attr) == 0x2222)
ze); } else { prv_copy_time_string_timestamp(number_buffer, number_buffer_size, word_buffer, word_buffer_size, timestamp); } } else { // past time_t difference = now - timestamp; if (now < timestamp || difference < SECONDS_PER_MINUTE) { i18n_get_with_buffer("Now", word_buffer, wor...
{ int region_id = clock_get_timezone_region_id(); if (region_id != UNKNOWN_TIMEZONE_ID) { timezone_database_load_region_name(region_id, region_name); } else { // Show something like UTC-4 or UTC-10.25 // This will typically happen in the emulator when we know the UTC offset, but not ...
else { strncpy(region_name, "---", buffer_size); } } int16_t clock_get_timezone_region_id(void) { return rtc_get_timezone_id(); } void clock_set_timezone_by_region_id(uint16_t region_id) { TimezoneInfo tz_info; prv_clock_get_timezone_info_from_region_id(region_id, rtc_get_time(), &tz_info); prv_update_...
e; prv_cleanup_action_result(data, success); return; } char uuid_string[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&action_result->id, uuid_string); PBL_LOG(LOG_LEVEL_INFO, "Received action result: Item ID - %s; type - %" PRIu8, uuid_string, (uint8_t)action_result->type); // Each action re...
(action_menu)
, 0, -784}, { 320, -80, -808}, { 352, -32, -656}, { 496, 368, -928}, { 544, 112, -864}, { 760, 528, -1328}, { 728, 384, -1208}, { 584, 368, -1016}, { 376, 216, -824}, { 224, 168, -704}, { 128, 248, -712}, { 72, 288, -752}, { 72, 392, -856}, { 48, 360, -856}, { 16,...
{ 1024, 88, -280}, { 1160, 64, -152}, // 13 seconds { 1584, 176, 16}, { 1808, 448, -136}, { 1800, 400, -232}, { 1880, 496, -192}, { 1456, 552, -192}, { 1064, 544, -232}, { 784, 624, -296}, { 672, 656, -352}, { 632, 608, -416}, { 704, 528, -448}, { 744, 560, -448},...
ProtobufLogType_Measurements, .measurements = { .num_types = input->msrmt.num_types, .types = input->msrmt.types, } }; ProtobufLogRef session_ref = protobuf_log_create(&log_config, transport_cb, 0); cl_assert(session_ref != NULL); return session_ref; } static TestPLParsedMsg *prv_flush_get...
(&input, false /*use_data_logging*/, ref)
; } // A simple message with 1 type, 1 sample. Large sample values { ProtobufLogMeasurementType types[] = {ProtobufLogMeasurementType_BPM}; uint32_t offset_sec[] = {2, 4}; uint32_t values[] = {0x11223344, 0x22334455}; TestPLParsedMsg input = { .type = ProtobufLogType_Measurements, .m...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_pairability_timer_info)
; bt_pairability_release_ble(); } void bt_pairability_use_ble_for_period(uint16_t duration_secs) { if (!regular_timer_is_scheduled(&s_pairability_timer_info)) { // If this function is called multiple times before the timer is unscheduled, limit to calling // "use" only once: bt_pairability_use_ble(); ...