prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ies(&s_stopped_handler_calls, a2), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a3), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a3), 1); // None of the b's should finish yet cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b0), 0)...
animation_get_elapsed(a, &elapsed_ms)
; cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a)); animation_get_elapsed(b, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a + duration_a + delay_b)); // Start prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, ...
/* * 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_install_get_entry_for_install_id(next_app_id, app_entry)
&& app_install_entry_is_watchface(app_entry)) { if (current_app_id == APP_ID_LAUNCHER_MENU) { res = prv_get_watchface_compositor_animation(CompositorTransitionDirectionLeft); goto done; } else if (current_app_id == APP_ID_HEALTH_APP) { res = prv_get_health_compositor_animation(Composito...
i_bounceback = property_animation_get_animation( property_animation_create_bounds_origin( &s_phone_ui_data->core_ui_container, &overshoot, &GPoint(PBL_IF_RECT_ELSE(ACTION_BAR_WIDTH / 2, 0), 0))); animation_set_curve(ui_bounceback, AnimationCurveEaseOut); animation_set_duration(ui_bounceback, 2...
attribute_list_destroy_list(&attributes)
; ios_notif_pref_db_free_prefs(notif_prefs); return rv; } //! Action bar click configurations static void prv_click_config_provider(void *context) { if (s_phone_ui_data->up_action) { window_single_click_subscribe(BUTTON_ID_UP, s_phone_ui_data->up_action); } if (s_phone_ui_data->select_action) { win...
.minute = 14, .kind = ALARM_KIND_WEEKDAYS }); s_current_hour = 12; s_current_minute = 14; alarm_handle_clock_change(); s_current_hour = 13; s_current_minute = 14; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); } ////////////////////////////////////////////////////////////////////////...
(id2, 11, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule)
; cl_assert_equal_i(s_num_timeline_adds, 6); cl_assert_equal_i(s_num_timeline_removes, 0); alarm_get_next_enabled_alarm(&next_alarm_time); cl_assert_equal_i(next_alarm_time, s_current_day + 10 * SECONDS_PER_HOUR + 30 * SECONDS_PER_MINUTE); // First alarm goes off. Second one should be up...
} GenericAttribute *repeat_delay_attribute = generic_attribute_find_attribute(&score->attr_list, VibeAttributeId_RepeatDelay, score->attr_list_size); if (repeat_delay_attribute) { if (repeat_delay_attribute->length != sizeof(uint16_t)) { return false; }...
sys_vibe_pattern_enqueue_step_raw(note->brake_duration_ms, vibe_get_braking_strength())
; } } sys_vibe_pattern_trigger_start(); } VibeScore *vibe_score_create_with_resource(uint32_t resource_id) { ResAppNum app_num = sys_get_current_resource_num(); return vibe_score_create_with_resource_system(app_num, resource_id); } void vibe_score_destroy(VibeScore *score) { if (!score) { return; ...
1) * sizeof(*s_precise_lines)); s_precise_lines[s_num_precise_lines].p0 = p0; s_precise_lines[s_num_precise_lines].p1 = p1; s_num_precise_lines++; } void prv_reset(void) { s_fill_color = GColorClear; s_stroke_color = GColorClear; s_stroke_width = 0; s_path_num_points = 0; if (s_stroke_points) { ...
(s_fill_points, NULL)
; prv_reset(); // set stroke color to be transparent and restore fill - fill should be drawn, but no outline // should be drawn gdraw_command_set_fill_color(command, GColorGreen); color = gdraw_command_get_stroke_color(command); color.a = 0; gdraw_command_set_stroke_color(command, color); gdraw_command...
ne_layer); } static void prv_set_layout_hidden(TimelineLayout *layout, bool hidden) { layer_set_hidden((Layer *)layout, hidden); layer_set_hidden((Layer *)&layout->icon_layer, hidden); } static LayoutLayerMode prv_get_mode(int index) { switch (index) { default: case 1: return LayoutLayerModePinned...
(info, item, state->current_day)
; info->scroll_direction = layer->scroll_direction; info->app_id = item->header.parent_id; GRect rect; prv_get_frame(layer, index, &rect); const LayoutLayerConfig config = { .frame = &rect, .attributes = &item->attr_list, .mode = prv_get_mode(index), .app_id = &item->header.parent_id, .co...
age governing permissions and * limitations under the License. */ #include "kino_reel_pdcs.h" #include "applib/applib_malloc.auto.h" #include "applib/graphics/gdraw_command_frame.h" #include "applib/graphics/gdraw_command_private.h" #include "applib/graphics/gdraw_command_sequence.h" #include "resource/resource_ids...
kino_reel_pdcs_create_with_resource_system(app_num, resource_id)
= prv_started_handler, .stopped = prv_stopped_handler }; static const PropertyAnimationImplementation implementation = { .base = { .setup = prv_setup_handler, .update = (AnimationUpdateImplementation) property_animation_update_int16, .teardown = prv_teardown_handler }, .accessors...
animation_set_duration(h, duration)
; animation_set_delay(h, delay); animation_set_auto_destroy(h, false); prv_clear_handler_histories(); animation_schedule(h); int max_loops = 20; int num_loops = 0; uint64_t start_ms = prv_now_ms(); uint64_t time_ms; while (s_stopped_handler_calls.num_calls == 0) { num_loops++; prv_fire_an...
/* * 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...
pmic_disable_battery_measure()
; PBL_ASSERTN(BOARD_CONFIG_POWER.battery_vmon_scale.denominator); return battery_convert_reading_to_millivolts(info, BOARD_CONFIG_POWER.battery_vmon_scale.numerator, BOARD_CONFIG_POWER.battery_vmon_scale.denominator); } ...
NOT_PERMITTED_MSG_HANDLER, test_dropped_handler)); } void test_app_inbox__app_inbox_create_and_register_drop_handler_not_permitted(void) { // The syscall_failed() fake will trigger passert: cl_assert_passert(app_inbox_create_and_register(BUFF...
app_inbox_service_begin(AppInboxServiceTagUnitTest, BUFFER_SIZE, s_writer)
------------------- // Sample captured: 2015-08-06 15:10:23 GMT AccelRawData *activity_sample_30_steps_hand_in_pocket(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_30_hand_in_pocket //> TEST_EXPECTED 30 //> TEST_EXPECTED_MIN 25 //> TEST_EXPECTED_MAX 35 //...
{ -710, 1507, -142}, { -642, 742, -259}, { -432, 369, 42}, { -519, 627, -27}, { -494, 731, -168}, { -491, 625, -223}, { -442, 773, -172}, { -402, 875, -144}, { -410, 784, -64}, { -504, 735, -72}, { -569, 708, -42}, { -626, 876, -41}, { -733, 847, -23}, { -662, 866...
{ -484, 763, -1}, { -455, 820, -53}, { -510, 886, -83}, { -580, 858, -81}, { -657, 744, -142}, { -514, 903, -134}, { -528, 1209, -110}, { -449, 1110, -112}, { -591, 714, -244}, { -735, 493, -140}, { -905, 656, -73}, { -752, 747, -86}, { -545, 666, -141}, { -440, ...
ta *data = context; prv_handle_error_retries(data); } static void prv_init_dialog(VoiceUiData *data, Dialog *dialog, const char *text, uint32_t resource_id, bool has_timeout, GColor color) { dialog_set_callbacks(dialog, &(DialogCallbacks) { .unload = prv_error_dialog_unload, }, data); sys_i18n_get_with...
(dialog, false /* free_on_pop */)
; bt_conn_dialog_push(bt_dialog, prv_handle_bt_conn_result, data); } static uint64_t prv_get_time_ms(void) { time_t now_s; uint16_t now_ms; sys_get_time_ms(&now_s, &now_ms); uint64_t ms = (now_s * 1000) + now_ms; return ms; } static void prv_update_analytics_metrics(VoiceUiData *data) { data->elapsed_m...
3); graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 0), 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(14, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(16, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(18, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(20, 0), MAX_NUM...
GPoint(66, 36)
/* * 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...
(b, &b1, sizeof(uint8_t))
; buffer_add(b, &b2, sizeof(uint8_t)); buffer_add(b, &b3, sizeof(uint8_t)); buffer_add(b, &b4, sizeof(uint8_t)); // handles out of bounds cases cl_assert_passert(buffer_remove(b, 0, 5)); cl_assert_passert(buffer_remove(b, 1, 4)); cl_assert_equal_i(4, b->bytes_written); cl_assert_equal_i(b->data[0], b1...
"07"},{1188086400,"34","07"},{1188172800,"35","07"},{1188259200,"35","07"},{1188345600,"35","07"},{1188432000,"35","07"},{1188518400,"35","07"}, {1188604800,"35","07"},{1188691200,"35","07"},{1188777600,"36","07"},{1188864000,"36","07"},{1188950400,"36","07"},{1189036800,"36","07"},{1189123200,"36","07"}, {11892096...
(tmbuf, "+0000")
; jan_2_2015__13_00_00.tm_gmtoff = 60; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%z", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "+0001"); jan_2_2015__13_00_00.tm_gmtoff = 600; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%z", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "+0010");...
h" #include "process_management/app_manager.h" #include "process_management/app_manager.h" #include "services/common/battery/battery_monitor.h" #include "services/common/system_task.h" #include "services/runlevel.h" #include "system/bootbits.h" #include "system/logging.h" #include "system/passert.h" #include "system/re...
prv_legacy_completion_status_init(event)
) { return; } s_current_completion_status.use_legacy_mode = false; FwUpdateCompletionStatus *status = &s_current_completion_status.status; *status = (FwUpdateCompletionStatus) { .bytes_transferred = event->bytes_transferred, .total_size = event->total_transfer_size }; } // Initialization for a f...
(rtc_get_time()); // s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateAwake; // s_data.metric_history[ActivityMetricSleepTotalSeconds][0] = GOOD_SLEEP; // activity_insights_process_sleep_data(rtc_get_time()); // cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 3...
rtc_get_time()
); // This would trigger the insights if they weren't disabled s_data.steps_per_minute = 80; s_data.metric_history[ActivityMetricStepCount][0] = HIGH_STEPS; prv_minute_update(ACTIVE_MINUTES); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); // // This tests multi day tri...
/* * 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...
(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params))
; cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 7 * HORIZ_ADVANCE_PX); cl_assert(!line_...
TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, // Width for first word only: .box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 3 * HORIZ_ADVANCE_PX, 10 } } }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; // Init mutable t...
(*line.start == 'F')
; // b cl_assert(*word_iter_state.current.start == 'b'); 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_a...
, sizeof(hdr)); pfs_read(fd, &data_len, sizeof(data_len)); prv_flash_write(&hdr, sizeof(hdr), base_addr); } base_addr += sizeof(PageHeader); for (int i = 0; i < (int)data_len; i += copy_buf_size) { size_t to_copy = MIN(data_len - i, copy_buf_size); if (do_copy) { prv_flash_r...
recover_region_from_file(fd)
; } // find a free region if (!prv_update_gc_reserved_region()) { PBL_LOG(LOG_LEVEL_ERROR, "No free flash erase units!"); // Note: It should not be possible for this to happen since start of day no // files will be written on then flash. We could also try to force apps to // be flushed out of the...
40, 10), 4, SW_EVEN)); #else ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_EVEN)); #endif } void test_graphics_context_${BIT_DEPTH_NAME}__draw_antialiased_stroke_width_odd(void) { // Stroke width odd > 1, antialiased setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack...
GRect(20, 80, 40, 10)
animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); animation_set_delay(a, delay_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_delay(b, delay_b); Animation *c = prv_create_test_animation(); animation_set_...
(b, delay_a)
; animation_set_auto_destroy(b, auto_destroy); animation_schedule(b); Animation *c = prv_create_test_animation(); animation_set_duration(c, duration_a); animation_set_delay(c, delay_a); animation_set_auto_destroy(c, auto_destroy); animation_schedule(c); prv_advance_to_ms_with_timers(start_ms + duratio...
ending(); } // This should fill up the file system int bytes_per_session = 2 * DLS_TOTAL_STORAGE_BYTES / num_sessions; for (int i = 0; i < num_sessions; i++) { prv_log_random_data(logging_sessions[i], item_size, bytes_per_session); } // Check the total capacity, it should be no more than DLS_TOTAL_STO...
dls_list_remove_all()
; DataLoggingSessionRef logging_session = dls_list_get_next(NULL); cl_assert(logging_session == NULL); // Reset regular timer. dls_init() will add the same timer info again regular_timer_deinit(); regular_timer_init(); // Rebuild the list from flash dls_init(); fake_system_task_callbacks_invoke_pendin...
2, -96}, { 872, -16, -176}, { 888, -56, -184}, { 960, -80, -200}, { 1008, -104, -224}, { 1008, -112, -256}, { 1016, -96, -296}, { 1024, -96, -304}, { 1040, -104, -288}, { 1072, -104, -272}, { 1080, -80, -272}, { 1088, -64, -232}, { 1304, -56, -216}, { 1456, -16, -256}...
{ 968, -112, -264}, { 968, -96, -256}, { 984, -80, -264}, { 968, -80, -272}, { 952, -64, -296}, // 68 seconds { 968, -80, -328}, { 1128, -128, -352}, { 1272, -136, -384}, { 1288, -144, -344}, { 1200, -120, -400}, { 968, -104, -360}, { 1000, -96, -320}, { 1144, -13...
{ 992, -112, -32}, { 1048, -136, -64}, { 1392, -120, -104}, { 1232, -120, -136}, { 1144, -112, -192}, { 1016, -96, -320}, { 896, -88, -352}, { 1016, -96, -336}, { 1152, -136, -304}, { 1112, -168, -224}, { 1008, -128, -216}, { 984, -120, -200}, { 928, -128, -168}, ...
/* * 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...
{ bool success = false; bt_lock(); { if (s_is_scanning) { success = bt_driver_stop_le_scan(); kernel_free(s_reports_buffer); s_reports_buffer = NULL; s_is_scanning = false; if (s_dropped_reports) { PBL_LOG(LOG_LEVEL_INFO, "LE Scan -- Dropped reports: %" PRIu32, s_droppe...
// ----------------------------------------------------------------------------- bool gap_le_is_scanning(void) { bt_lock(); const bool is_scanning = s_is_scanning; bt_unlock(); return is_scanning; } // ----------------------------------------------------------------------------- //! Copies over the pending r...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const TimelineItemAction *action = timeline_item_find_dismiss_action(notification); if (action) { timeline_invoke_action(notification, action, NULL); } else { char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&notification->header.id, uuid_buffer); PBL_LOG(LOG_LEVEL_ERROR, "Failed to ...
static void prv_handle_new_ancs_notif(TimelineItem *notification) { uuid_generate(&notification->header.id); notifications_add_notification(notification); timeline_item_destroy(notification); } static void prv_handle_ancs_update(TimelineItem *notification, CommonTimelineItemH...
te) { acc_odr = BMI160AccODR_800_HZ; } else { // any interval < min supported must saturate to 1600Hz acc_odr = BMI160AccODR_1600_HZ; } return acc_odr; } static BMI160SampleRate prv_get_supported_sample_rate(uint32_t interval_us) { BMI160SampleRate sample_rate; if (BMI160SampleRate_12p5_HZ <= interv...
prv_get_fifo_frame_size()
; // x,y,z accel data uint16_t max_num_samples = (BMI160_FIFO_LEN_BYTES / fifo_frame_size); max_num_samples = (max_num_samples / BMI160_FIFO_WM_UNIT_BYTES) * BMI160_FIFO_WM_UNIT_BYTES; if (num_samples > max_num_samples) { num_samples = max_num_samples; } uint16_t curr_sample_size = bmi160_read_reg...
log); dialog_set_text(dialog, i18n_get(text, confirmation_dialog)); dialog_set_background_color(dialog, GColorRed); dialog_set_text_color(dialog, GColorWhite); dialog_set_icon(dialog, resource_id); i18n_free_all(confirmation_dialog); return confirmation_dialog; } // Information Window //////////////////...
(confirmation_dialog)
; confirmation_dialog_pop((ConfirmationDialog *)context); } static void prv_information_click_config(void *context) { window_single_click_subscribe(BUTTON_ID_UP, prv_coredump_reset_confirm_cb); window_single_click_subscribe(BUTTON_ID_DOWN, prv_coredump_reset_decline_cb); } static void prv_information_long_click...
pitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 2 MIN", time_buf); // June 10th 2015, 04:00:00 (T+12:00:00) rtc_set_time(event_time + (12 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equa...
("Tue, 4:00 PM", time_buf)
Pairing characteristic. The second part of the condition may not be true in case a user //! updated the phone to an Android version that does not have the bug (PBL-39369). static bool prv_is_auto_accept_repairing_mode(Connection *conn, uint16_t conn_idx) { bool should_auto_accept_re_pairing; storage_acquire(); {...
(connection, event->conn_idx)
; hc_endpoint_gap_service_mtu_changed(connection, event->mtu); } static void prv_configure_local_device_properties(const BTDriverConfig *config) { ble_error_t e; e = ble_gap_appearance_set(BLE_GAP_APPEARANCE_GENERIC_WATCH, ATT_PERM_READ); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_appeara...
&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 }); prv_assert_alarm_config(id1, 3, 14, false, ALARM_KIND_CUSTOM, schedule_1); alarm_get_custom_days(id1, verify_schedule_1); prv_assert_alarm_config(id1, 3, 14, false, ALARM_KIND_CUSTOM, verify_schedule_1); bool s...
(s_num_timeline_removes, 9)
; } void test_alarm__alarm_delete(void) { AlarmId id1, id2, id3, id4, id5, id6, id7; id1 = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_EVERYDAY }); id2 = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_EVERYDAY }); alarm_delete(id1); prv_assert_alarm_config...
r(int count) { TimerID timer_id = battery_monitor_get_standby_timer_id(); cl_assert(timer_id != TIMER_INVALID_ID); cl_assert(stub_new_timer_is_scheduled(timer_id)); for (int i = 0; i<count; ++i) { stub_new_timer_fire(timer_id); fake_system_task_callbacks_invoke_pending(); } } static bool standby_tim...
periodic_timer_trigger(1)
ing the transparent top window // Top here throughout means that it is the top window of the window stack it is in // Test: An opaque top window above a transparent top window removes Transparent // i.e. A transparent top window below an opaque top window does not result in Transparent modal_manager_event...
(window_stacks[2], windows[2][0], false)
; // Add priority 2 unfocusable window 1 window_set_focusable(windows[2][1], false); window_stack_push(window_stacks[2], windows[2][1], false); // An unfocusable window is now the top window // Test: Opaque windows that are not the top window have no affect on unfocusable // Test: One unfocusable top wind...
6}, { 784, 520, -400}, { 880, 496, -392}, { 968, 456, -352}, { 1168, 504, -224}, { 1216, 600, -216}, { 1264, 760, -376}, { 1592, 720, -200}, { 1584, 480, -16}, { 1352, 392, -96}, { 1040, 336, -88}, { 880, 296, -40}, { 800, 232, -40}, { 736, 176, 0}, { 688, 160, 0}...
{ 1384, 304, -288}, { 1200, 200, -56}, { 936, 512, -136}, { 760, 600, -240}, { 680, 696, -288}, { 560, 616, -296}, { 520, 568, -256}, { 616, 584, -304}, { 712, 656, -320}, { 696, 752, -416}, // 116 seconds { 616, 712, -472}, { 640, 656, -520}, { 712, 584, -448}, ...
{ 1352, 384, -168}, { 1248, 360, -144}, { 1208, 496, -176}, { 1144, 616, -96}, { 1056, 744, -184}, { 944, 712, -200}, { 864, 656, -240}, { 848, 624, -296}, { 808, 584, -320}, { 744, 544, -336}, { 776, 520, -368}, { 824, 480, -328}, { 984, 432, -256}, { 1136, 456,...
/ This fixes an integer rounding problem when the value is very small (PBL-43717) const int min_daily_steps_avg = 100; data->daily_steps_avg = MAX(data->daily_steps_avg, min_daily_steps_avg); // increase daily avg 5% more than current steps if current steps is more than 95% of daily avg if (data->current_steps...
gbitmap_deinit(&data->shoe_blue_small)
basic_cell_height(); const int row0_vertically_centered = (height - basic_cell_height)/2; cl_assert_equal_i(row0_vertically_centered, scroll_layer_get_content_offset(&l.scroll_layer).y); menu_layer_set_selected_index(&l, MenuIndex(0, 1), MenuRowAlignTop, false); cl_assert_equal_i(1, menu_layer_get_selected_ind...
(false, s_content_available[ContentIndicatorDirectionUp])
; cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]); // WTF?! menu_layer_set_selected_index(&l, MenuIndex(0, 1), MenuRowAlignNone, false); cl_assert_equal_i(2 * FOCUSED - NORMAL, l.selection.y); cl_assert_equal_i(NORMAL, l.selection.h); cl_assert_equal_b(false, s_content_available...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
comm_session_get_system_session()
; if (!session) { PBL_LOG(LOG_LEVEL_ERROR, "No system session"); return; } comm_session_send_data(session, MUSIC_CTRL_ENDPOINT, (const uint8_t *)&cmd, 1, COMM_SESSION_DEFAULT_TIMEOUT); } static const uint8_t* prv_read_ptr_and_length_from_buffer(const uint8_t *iter, ...
rts_should_notify_for_type(AlertMobile)); cl_assert(alerts_should_notify_for_type(AlertReminder)); cl_assert(alerts_should_notify_for_type(AlertPhoneCall)); // Should not allow invalid Notifications though cl_assert(!alerts_should_notify_for_type(AlertInvalid)); } void test_alerts__disabled(void) { cl_asser...
cl_assert(!alerts_should_vibrate_for_type(AlertMobile))
; alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile)); cl_assert(alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts_should_vibrate_for_type(AlertReminder)); alerts_set...
/* * 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_ERROR, "Error: ble_gap_adv_intv_set - rv: %d", rv)
; } return rv; } static ble_error_t prv_set_mode_and_data(void) { const BLEAdData *ad_data = &s_desired_ad_data.ad_data; // FIXME PBL-34428: We are chopping off the beginning of the advertisement data because that is // where the flags are stored. We parse the flags and translate to a specific type of discov...
LIKELY(write_space >= required_length)) { if (UNLIKELY(did_stall)) { PBL_LOG(LOG_LEVEL_DEBUG, "GATT notification stalled for %d ms...", (int)(timeout_ms - ticks_to_milliseconds(timeout_end_ticks - rtc_get_ticks()))); analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_GATT_STALLED_NOTIFICATI...
{ task_mask &= ~gap_le_pebble_task_bit_for_client(c); s_is_notification_event_pending[c] = true; }
} prv_unlock(); } if (UNLIKELY(task_mask != task_mask_none)) { prv_send_notification_event(task_mask); } unlock: bt_unlock(); } // ------------------------------------------------------------------------------------------------- static GATTClientSubscriptionNode * prv_find_subscription_and_conne...
oints, .num_points = num_points, }, .iter = { .lookup = lookup, }, }; gdraw_command_list_iterate(list, prv_gdraw_command_create_point_index_lookup, &ctx); applib_free(points); return lookup; } typedef struct { const GPoint origin; const int32_t angle; } AngleComparatorContext; sta...
( prv_int_scale_and_translate_to(point.x, size.w, from.size.w, to.size.w, from.origin.x, to.origin.x, normalized, interpolate), prv_int_scale_and_translate_to(point.y, size.h, from.size.h, to.size.h, from.origin.y, to.origin.y, normalized, interpolate))
; } typedef struct { GRect from; GRect to; GSize size; GPoint offset; } ScaleToGValues; typedef struct { const struct { ScaleToGValues integer; ScaleToGValues precise; Fixed_S32_16 duration_fraction; GPointIndexLookup *lookup; AnimationProgress normalized; InterpolateInt64Function i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_set_click_context(BUTTON_ID_DOWN, context)
; } static void prv_window_load(Window *window) { MorphSquareDemoData *data = window_get_user_data(window); Layer *window_layer = window_get_root_layer(window); kino_layer_init(&data->icon_layer, &window_layer->bounds); KinoReel *from_image = kino_reel_create_with_resource(RESOURCE_ID_NOTIFICATION_GENERIC_LA...
uint32_t s_num_hr_events; static PebbleHealthEvent s_last_hr_event; static void prv_fake_hr_event_handler(PebbleEvent *e) { s_num_hr_events++; s_last_hr_event = e->health_event; } // --------------------------------------------------------------------------------------- // Test that some HRM events aren't passed o...
(metric_values[0], 60)
; activity_metrics_prv_set_metric(ActivityMetricDistanceMeters, Thursday, 66); activity_metrics_prv_set_metric(ActivityMetricDistanceMeters, Wednesday, 22); activity_get_metric(ActivityMetricDistanceMeters, 2, metric_values); cl_assert_equal_i(metric_values[0], 66); cl_assert_equal_i(metric_values[1], 22); ...
/* * 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; }
if (current->type != previous->type || (current->type != ActivitySessionType_RestfulNap && current->type != ActivitySessionType_RestfulSleep)) { // We only merge sessions if they are "deep" sleep/nap return; } // [FBO]: note that this only works because sleep sessions are // all we care ...
pedef struct { const char name[MAX_FILTER_NAME_LENGTH]; // Filters must manually advance state->position to the parenthesis that indicates the end of // the filter arguments. void (*cb)(TemplateStringState *state); } FilterImplementation; static void prv_filter_format(TemplateStringState *state); static void p...
i18n_ctx_noop("TmplStringSep", ":")
, }, /// The first separator in `<hour> hr <minute> min <second> sec` { i18n_ctx_noop("TmplStringSep", " "), /// The second separator in `<hour> hr <minute> min <second> sec` i18n_ctx_noop("TmplStringSep", " "), }, /// The first separator in `<hour> hours, <minute> minutes, and <second> seconds` { i18n_ct...
prv_load_sms_reply_action(caller->number, source)
; } uint8_t actions = PhoneCallActions_Decline; if (can_reply) { actions |= PhoneCallActions_Reply; } if (can_answer) { actions |= PhoneCallActions_Answer; } prv_action_bar_setup(actions); prv_start_ringing(); } void phone_ui_handle_outgoing_call(PebblePhoneCaller *caller) { if (s_phone_ui_...
/* * 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...
{ // We need the QEMU serial driver qemu_serial_init(); bt_lock_init(); }
bool bt_driver_start(BTDriverConfig *config) { // The first time the stack starts, use the QemuSetting_DefaultConnected setting. // Subsequent times, always auto-connect when the stack starts. static bool s_should_auto_connect = false; // Have KernelMain set us to connected once the event loop starts up, thi...
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 "services/common/put_bytes/put_bytes.h" #include "services/common/comm_session/session_rece...
{ Receiver *r = g_put_bytes_receiver_impl.prepare(session, &s_put_bytes_endpoint, length); if (r) { if (s_do_before_write) { s_do_before_write(); } g_put_bytes_receiver_impl.write(r, data, length); g_put_bytes_receiver_impl.finish(r); } else { PBL_LOG(LOG_LEVEL_ERROR, "No receiver return...
static void prv_receive_init(uint32_t total_size, PutBytesObjectType object_type) { InitRequest init_msg = (InitRequest) { .cmd = CmdInit, .total_size = htonl(total_size), .type = object_type, .cookie = htonl(1), }; prv_receive_data(s_session, (const uint8_t *) &init_msg, sizeof(init_msg)); } s...
_tuple->value->cstring, sizeof(data->custom_label_string)); prv_update_scrollable_metrics(data); } break; } case SPORTS_CUSTOM_VALUE_KEY: { if (strncmp(new_tuple->value->cstring, data->custom_value_string, sizeof(data->custom_valu...
TupletInteger(SPORTS_ACTIVITY_STATE_KEY, state)
, TupletInteger(SPORTS_HRM_KEY, 0), TupletCString(SPORTS_CUSTOM_LABEL_KEY, ""), TupletCString(SPORTS_CUSTOM_VALUE_KEY, "") }; app_sync_init(&data->sync, data->sync_buffer, sizeof(data->sync_buffer), initial_values, ARRAY_LENGTH(initial_values), prv_sync_tuple_changed_callback, ...
Black, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10))); setup_test(&context, false, 2, GColorBlack, GColorBlack, false); graphics_draw_circle(&context, GPoint(50, 50), 10); ASSERT_CALLED(graphics_circle_draw_stroked_non...
(&context, true, SW_EVEN, GColorBlack, GColorBlack, false)
lgMinuteRecord *minute_rec) { // Store the minute data into our circular buffer. The only place we ever read from this buffer // is below in this same method (during prv_send_minute_data) only from the KernelBG task, so no // need for a lock. bool success = shared_circular_buffer_write(&s_alg_state->minute_data...
("procesing activity %d, start_min: %u, len: %"PRIu16"", (int)session->type, start_minute, session->length_min)
; // Skip if not a sleep session if (!activity_sessions_prv_is_sleep_activity(session->type)) { ACTIVITY_LOG_DEBUG("Not a sleep session"); continue; } // Skip if still ongoing if (session->ongoing) { ACTIVITY_LOG_DEBUG("Still ongoing"); continue; } // Skip if alrea...
ributed 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 "drivers/dbgserial.h" #include "drivers/periph_config.h" #inc...
(CRC32_INIT, raw_packet, raw_length - sizeof(crc))
; memcpy(&raw_packet[raw_length - sizeof(crc)], &crc, sizeof(crc)); unsigned char cooked_packet[MAX_SIZE_AFTER_COBS_ENCODING(raw_length)]; size_t cooked_length = cobs_encode(cooked_packet, raw_packet, raw_length); prv_putchar(FRAME_DELIMITER); for (size_t i = 0; i < cooked_length; ++i) { if (cooked_pack...
hat was last communicated to Pebble by the server. //! @note This is not necessarily the actual position. See music_get_pos() uint32_t track_pos_ms; //! The time when track_pos_ms was last updated. RtcTicks track_pos_updated_at; //! The current playback rate in percent units. //! Example values: //! 10...
mutex_lock_recursive(s_music_ctx.mutex)
; char *buffer = ((char *) &s_music_ctx) + offset; copy_and_truncate(buffer, value, value_length); mutex_unlock_recursive(s_music_ctx.mutex); prv_put_now_playing_changed_event(); } void music_update_player_name(const char *player_name, size_t player_name_length) { // TODO: actually do something with this o...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_invalidate_size, 0x20)
; cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Valid); } void test_cpu_cache__userspace_fail_from_size(void) { cl_will_return(icache_is_enabled, true); cl_will_return(dcache_is_enabled, true); cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_size, 1); cl_will_return(syscall_internal_c...
/* * 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...
(pin_config.gpio)
; GPIO_InitTypeDef GPIO_InitStructure; GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = pin_config.gpio_pin; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPI...
/* * 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...
kernel_malloc_check(alloc_size)
; *request = (HcProtocolMessage) { .message_length = alloc_size, .endpoint_id = HcEndpointID_Advert, .command_id = HcMessageID_Advert_Enable, }; HcAdvertEnableData *request_data = (HcAdvertEnableData *)&request->payload[0]; *request_data = (HcAdvertEnableData) { .min_interval_ms = min_interval_m...
raw_line_inside_origin_layer"))); layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &inside_layer_update_ca...
TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_origin_checkerboard_no_clip")
)); // Clipping on even boundaries - no offset setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_EVEN, ORIGIN_RECT_NO_CLIP, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ...
pped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_tear...
prv_advance_to_ms_with_timers(start_ms + 2 * (duration_total + 4 * MIN_FRAME_INTERVAL_MS))
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 3); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 2); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2...
ither express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stddef.h> #include <stdio.h> #include <string.h> #include "drivers/crc.h" #include "drivers/flash.h" #include "flash_region.h" #include "git_version.auto.h" #include "system...
version_get_build_id(&build_id_bytes_left)
; while (buffer_bytes_left >= 3 /* 2 hex digits, plus zero terminator */ && build_id_bytes_left > 0) { snprintf(buffer, buffer_bytes_left, "%02x", *build_id); buffer += 2; buffer_bytes_left -= 2; build_id += 1; build_id_bytes_left -= 1; } } static void version_fw_version_to_major_min...
rticalConfig *config) { const int capacity = config->container.num_nodes + config->container.extra_capacity; GTextNodeVertical *vertical_node = graphics_text_node_create_vertical(capacity); if (vertical_node) { if (config->vertical_alignment) { vertical_node->vertical_alignment = ToGVerticalAlignment(co...
PBL_IF_RECT_ELSE(0, -1)
; const LayoutNodeExtentConfig timeline_icon_config = { .node.type = LayoutNodeType_TimelineIcon, .offset.x = icon_offset_x, .offset.y = icon_offset_y, .margin.w = icon_margin_w, .margin.h = icon_margin_h, }; const LayoutNodeIconConfig icon_config = { .extent.node.type = LayoutNodeType_Ico...
ol has_notification = prv_get_next_notification_header(client, &header); if (LIKELY(has_notification)) { if (LIKELY(*value_length_in_out >= header.value_length)) { const uint16_t copied_length = circular_buffer_copy_offset(s_circular_buffer[client], ...
circular_buffer_init(circular_buffer, (uint8_t *) (circular_buffer + 1), GATT_CLIENT_SUBSCRIPTIONS_BUFFER_SIZE)
; s_circular_buffer[client] = circular_buffer; } ++s_circular_buffer_retain_count[client]; } unlock: prv_unlock(); return rv; } // ------------------------------------------------------------------------------------------------- static bool prv_find_subscription_cb(ListNode *node, void *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...
{ jerry_release_value(timer_data->argv[i]); }
task_free(timer_data); } static void prv_timer_callback(void *data) { RockyTimerCbData *timer_data = data; if (jerry_value_is_function(timer_data->callback)) { rocky_util_call_user_function_and_log_uncaught_error( timer_data->callback, jerry_create_undefined(), timer_data->argv, timer_data->argc); ...
ctx, bounds); } static void prv_render_metric_label(GContext *ctx, GRect *box, WorkoutMetricType metric_type, WorkoutActiveWindow *active_window, void *i18n_owner) { GRect label_box = *box; GTextOverflowMode overflow_mode = GTextOverflowModeWordWrap; if (metric_type == Workout...
rect.origin.x -= PBL_IF_RECT_ELSE(1, 46); rect.size.w += (rl_margin * 2); GTextNode *text_node = prv_create_text_node(active_window, metric_type, prefer_larger_font, layer); graphics_text_node_draw(text_node, ctx, &rect, NULL, NULL); graphics_text_node_destroy(te...
static void prv_static_layer_update_proc(struct Layer *layer, GContext *ctx) { WorkoutActiveWindow *active_window = window_get_user_data(layer_get_window(layer)); WorkoutMetricType metric_type = WorkoutMetricType_None; if (layer == &active_window->top_metric_layer) { metric_type = active_window->top_metric...
duration_b + delay_b); // The position of seq should be the amount we already played of a, including the 'a' delay // since a is embedded within seq int32_t position; animation_get_elapsed(seq, &position); cl_assert_equal_i(position, 100); // Now, advance sequence to almost the end of seq. Positions don...
(prv_count_handler_entries(&s_stopped_handler_calls, b), 1)
; cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MAX); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1); #endif } // -------------------------------------------------------------------------------------- // Test creating a spawn where where some children are al...
ABS, it'll be unsigned. This makes the compiler behave. const uint32_t change_diff = ABS(set_time_info->utc_time_delta); // Need to re-build the list somewhere else ListNode *newlist = NULL; while (s_scheduled_jobs != NULL) { CronJob* job = (CronJob*)s_scheduled_jobs; s_scheduled_jobs = list_pop_head(s_...
(&s_regular)
; } uint32_t cron_service_get_job_count(void) { uint32_t count = 0; mutex_lock(s_list_mutex); count = list_count(s_scheduled_jobs); mutex_unlock(s_list_mutex); return count; } void cron_service_wakeup(void) { prv_timer_callback(NULL); } // -----------------------------------------------------------------...
6; static uint32_t s_spi_clock_hz; bool display_busy(void) { bool busy = GPIO_ReadInputDataBit(DISP_GPIO, DISP_PIN_BUSY); return busy; } static void prv_configure_spi(uint32_t spi_clock_hz) { // Set up a SPI bus on SPI6 SPI_InitTypeDef spi_cfg; SPI_I2S_DeInit(DISP_SPI); SPI_StructInit(&spi_cfg); spi_cfg...
set_6V6_power_state(false)
; delay_ms(2); } //! //! Write a single byte synchronously to the display. Use this //! sparingly, as it will tie up the micro duing the write. //! void display_write_byte(uint8_t d) { // Block until the tx buffer is empty while (!SPI_I2S_GetFlagStatus(DISP_SPI, SPI_I2S_FLAG_TXE)) continue; SPI_I2S_SendData(D...
/* * 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...
pulse_link_send_begin(this->protocol_number)
_event_get_count(), 2); cl_assert(!prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000); cl_assert(timeline_remove(&item1.header.id)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(fake_event_get_count(), ...
(prv_get_calendar_ongoing())
; cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(15*60, stub_new_timer_timeout(timer_id) / 1000); rtc_set_time(35 * 60); cl_assert(stub_new_timer_fire(timer_id)); cl_assert_equal_i(fake_event_get_count(), 4); cl_assert(!prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_schedul...
oid test_app_db__basic_test(void) { // confirm all three are there cl_assert(app_db_get_len((uint8_t*)&app1.uuid, sizeof(Uuid)) > 0); cl_assert(app_db_get_len((uint8_t*)&app2.uuid, sizeof(Uuid)) > 0); cl_assert(app_db_get_len((uint8_t*)&app3.uuid, sizeof(Uuid)) > 0); // remove #1 and confirm it's deleted c...
app_db_insert((uint8_t*)&app1.uuid, sizeof(Uuid), (uint8_t*)&app1, sizeof(AppDBEntry))
); cl_assert(app_db_check_next_unique_id() == 4); // add two more duplicates of a different app. Confirm it only increments by 1. cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app2.uuid, sizeof(Uuid), (uint8_t*)&app2, sizeof(AppDBEntry))); cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app...
); } // --------------------------------------------------------------------------------------- // Test that we report the that multiple sessions are ongoing. void test_activity__activity_sessions_ongoing_multiple(void) { // Start activity tracking. This method assumes it can be called from any task, so we must //...
(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes)
; cl_assert_equal_i(zone2_minutes, 0); activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes); cl_assert_equal_i(zone3_minutes, 0); // Add some "very elevated" heart rates. // The zone should wait 1 minute, move up 1 zone per minute, stop at the top prv_set_median_hr_for_minutes(185 /*...
/* * 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...
{ uint32_t delay_loops = us * s_loops_per_us; __asm volatile ( "spinloop: \n" " subs %[delay_loops], #1 \n" " bne spinloop \n" : [delay_loops] "+r" (delay_loops) // read-write operand : : "cc" ); }
void delay_init(void) { // The loop above consists of 2 instructions (output of arm-none-eabi-objdump -d // delay.X.o): // // subs r0, #1 // bne.w 4 <spinloop> // // Subtract consumes 1 cycle & the conditional branch consumes 1 + P (pipeline fill delay, // 1-3 cycles) if the branch is taken, or 1 i...
ool validate_args(ArgsForMock *actual_args, ArgsForMock *valid_args) { if (memcmp(actual_args, valid_args, sizeof(ArgsForMock)) == 0) { return true; } return false; } // This macro will call the expected code_block and then validate the arguments set in code_block // match what was expected from the last mo...
cl_assert_equal_i(context.draw_state.fill_color.argb, GColorOrange.argb)
; #else cl_assert_equal_i(context.draw_state.fill_color.argb, GColorDarkGray.argb); #endif color.a = 2; graphics_context_set_fill_color(&context, color); #if PBL_COLOR cl_assert_equal_i(context.draw_state.fill_color.argb, GColorOrange.argb); #else cl_assert_equal_i(context.draw_state.fill_color.argb, GColorD...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured: 2015-10-03 09:03:09 local AccelRawData *activity_sample_walk_200_pbl_25530_9(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25530_9 //> TEST...
_size packets in flight: for (sn = 0; sn < s_tx_window_size; ++sn) { cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragme...
{ regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); }
// Simulate receiving an ack for the last, after the roll-back, but before the packets are // retransmitted (the last part shouldn't matter much, but simplifies the test a bit) prv_receive_ack(s_characteristics[0][PPoGATTCharacteristicData], (sn - 1) % PPOGATT_SN_MOD_DIV); // Some new data ...
s_graphics_context_set_fill_color = (MockCallRecordings){0}; s_graphics_fill_rect = (MockCallRecordings){0}; s_graphics_fill_rect__color = GColorClear; s_graphics_draw_rect_precise = (MockCallRecordings){0}; s_graphics_fill_radial_precise_internal = (MockCallRecordings){0}; s_layer_mark_dirty = (MockCallReco...
("uow", 7)
; ASSERT_JS_GLOBAL_EQUALS_I("uoh", 8); } static const jerry_value_t prv_global_init_and_set_ctx(void) { rocky_global_init(s_graphics_api); // make this easily testable by putting it int JS context as global Layer l = {.bounds = GRect(0, 0, 144, 168)}; const jerry_value_t ctx = prv_create_canvas_context_2d_f...
window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, prv_up_click_handler)
; window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, prv_down_click_handler); if (expandable_dialog->select_click_handler) { window_single_click_subscribe(BUTTON_ID_SELECT, expandable_dialog->select_click_handler); } } static void prv_expandable_dialog_load(Window *window) { ExpandableDialog *exp...
ics_write_bytes_count += buffer_size; s_system_analytics_write_bytes_count += buffer_size; prv_erase_pause(); new_timer_start(s_erase_suspend_timer, 50, prv_erase_suspend_timer_cb, NULL, 0); while (buffer_size) { int written = flash_impl_write_page_begin(buffer, start_addr, buffer_size); PBL_ASSERT( #if...
{ stop_mode_enable(InhibitorFlash); s_erase.in_progress = false; mutex_unlock(s_flash_lock); xSemaphoreGive(s_erase_semphr); // Only run the callback with no locks held so that the callback won't // deadlock if it kicks off another sector erase. on_complete_cb(context, status); return 0;...
} // Returns non-zero expected remaining time if the erase has not finished. If the erase // has finished it will re-enable stop-mode, clear the in_progress flag and call the // completed callback before returning 0. static uint32_t prv_flash_erase_poll(void) { mutex_lock(s_flash_lock); status_t status = flash_im...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_set_window_handlers(app_data->window, (WindowHandlers) { .load = prv_window_load, .unload = prv_window_unload, })
me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_draw_rect(ctx, &GRect(4, 2, 16, 8)); } static void clear_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorClear); graphics_draw_rect(ctx, &GRect(4, 2, 16, 8)); } static void across_...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_inside_origin_layer.${BIT_DEPTH_NAME}.pbi"))
; layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&la...
ey(file, (uint8_t*) &key, info->key_len); info->get_val(file, (uint8_t*) &stored_data, MIN((unsigned)info->val_len, sizeof(stored_data))); if (stored_data.type == BtPersistBondingTypeBLE) { internal_itr_data->cb(key, &stored_data, internal_itr_data->cb_data); } return true; } void bt_persistent_storage_f...
prv_get_free_key()
; if (key == BT_BONDING_ID_INVALID) { // We are out of keys.... return BT_BONDING_ID_INVALID; } } else { // Load the existing data so the optional fields don't get overwritten bt_persistent_storage_get_bt_classic_pairing_by_addr(address, ...
VoiceEventType event_type = (s_state <= SessionState_StartSession) ? VoiceEventTypeSessionSetup : VoiceEventTypeSessionResult; prv_send_event(event_type, VoiceStatusErrorGeneric, NULL); goto done; } if (session_type >= VoiceEndpointSessionTypeCount) { PBL_LOG(LOG_LEVEL_WARNING, "Session setup...
uuid_equal(&s_app_uuid, app_uuid)
)) { if (app_initiated) { PBL_LOG(LOG_LEVEL_WARNING, "Received session result for app initiated session when a " "non-app session result was expected"); } else { PBL_LOG(LOG_LEVEL_WARNING, "Received session result for non-app session when an app " "session result was expe...
/* * 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...
(t, &t_c, sizeof(GTransform))
== 0) { return true; } return false; } bool gtransform_is_only_scale(const GTransform * const t) { if (!t) { return false; } if ((t->b.raw_value == GTransformNumberZero.raw_value) && (t->c.raw_value == GTransformNumberZero.raw_value) && (t->tx.raw_value == GTransformNumberZero.raw_valu...
unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert_equal_p(job, NULL); // Loop-around in the first term: advert_term.min_interval_slots = 200; advert_term.max_interval_slots = 200; advert_term.duration_secs = GAPLE_ADVERTISING_DURATION_LOOP_AROUND; job = gap_le_advert_schedule(ad, &ad...
regular_timer_fire_seconds(1)
; cl_assert_equal_b(gap_le_is_advertising_enabled(), true); free(ad); } void test_gap_le_advert__unschedule_job_types(void) { BLEAdData *ad = create_ad(NULL, NULL); GAPLEAdvertisingJobTerm advert_term = { .min_interval_slots = 160, .max_interval_slots = 320, .duration_secs = 10, }; GAPLEAdvert...
/* * 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...
_Static_assert(sizeof((ReliablePacket){0}.i) == 6, "sizeof ReliablePacket.i is wrong")
; _Static_assert(sizeof((ReliablePacket){0}.s) == 2, "sizeof ReliablePacket.s is wrong"); _Static_assert(sizeof((ReliablePacket){0}.i) == sizeof(ReliablePacket), "Something is really wrong here"); static bool s_layer_up = false; static ReliableInfoBuffer *s_tx_buffer; static SemaphoreHand...
issing character, then get the start of the next codepoint. *transcription_dialog->zero = transcription_dialog->missing; while (current_idx++ < to_idx) { cursor = utf8_get_next(cursor); } char *next = (char *)cursor; if (next == dialog->buffer + transcription_dialog->buffer_len) { return; } // M...
{ TranscriptionDialog *transcription_dialog = context; app_timer_cancel(transcription_dialog->pop_timer); prv_stop_text_animation(transcription_dialog); }
static void prv_transcription_dialog_load(void *context) { TranscriptionDialog *transcription_dialog = context; transcription_dialog->was_pushed = true; if (transcription_dialog->buffer_len > 0) { Dialog *dialog = expandable_dialog_get_dialog((ExpandableDialog *)transcription_dialog); transcription_dial...
/* * 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...
(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Freeing buffer storage ptr: %p", p)
; task_free(p); } // --------------------------------------------------------------------------------------- static void prv_free_storage_buffer(DataLoggingSession *session) { if (!session->data->buffer_storage) { // Skip if no buffer to free. return; } if (session->data->buffer_in_kernel_heap) { ...
////// // Md Builders ////////////////////// static void prv_init_from_info_common(PebbleProcessMd *common, const PebbleProcessInfo *info, PebbleTask task, ProcessStorage process_storage) { memcpy(&common->uuid, &info->uuid, sizeof(Uuid)); common->process_storage = process_storage; // Flags common->pro...
{ return (flags & PROCESS_INFO_PLATFORM_MASK); }
static const Version first_3x_version = { PROCESS_INFO_FIRST_3X_SDK_VERSION_MAJOR, PROCESS_INFO_FIRST_3X_SDK_VERSION_MINOR, }; static const Version first_4x_version = { PROCESS_INFO_FIRST_4X_SDK_VERSION_MAJOR, PROCESS_INFO_FIRST_4X_SDK_VERSION_MINOR, }; static const Version first_4_2_version = { PROCESS_INF...
um_samples(uint8_t num_samples) { if (num_samples == 0) { // peek mode, no FIFO lis3dh_set_fifo_mode(MODE_BYPASS); lis3dh_disable_fifo(); } else { lis3dh_set_fifo_wtm(num_samples - 1); // clear fifo lis3dh_set_fifo_mode(MODE_BYPASS); // wait 1 ms psleep(10); lis3dh_set_fifo_mode(...
(&s_buffer, client, sizeof(AccelRawData), max_samples, subsample_num, subsample_den, (uint8_t *)data, &items_read)
; } lis3dh_unlock(); ACCEL_LOG_DEBUG("%"PRIu16" samples (from %"PRIu32" requested) were read for %p", items_read, max_samples, client); return (items_read); } int accel_peek(AccelData* data) { if (!s_running) { return (-1); } // No peeking if we're in FIFO mode. if (lis3dh_get_fifo_mode() =...
-88}, { 664, 152, -64}, { 640, 216, -104}, { 760, 192, -128}, { 888, 152, -64}, { 992, 144, -8}, { 1120, 104, -56}, { 1040, 48, 56}, { 1064, 120, -72}, { 1200, 144, -48}, { 1136, 160, -8}, { 1256, 216, -88}, { 1384, 272, -152}, { 1200, 248, -192}, { 816, 240, -208...
{ 1200, 320, -184}, { 1336, 248, -144}, { 1288, 320, -136}, { 1104, 312, -32}, // 13 seconds { 872, 256, -40}, { 736, 216, -16}, { 688, 200, 0}, { 800, 192, 40}, { 800, 184, 72}, { 832, 128, -8}, { 1000, 120, 24}, { 992, 104, 32}, { 1112, 104, -64}, { 1136, 12...
{ 840, 128, -24}, { 1008, 168, -56}, { 1040, 144, -104}, { 1112, 152, -160}, { 1232, 224, -136}, { 1112, 184, -112}, { 1176, 208, -136}, { 1272, 288, -128}, { 1160, 256, -136}, { 864, 304, -176}, { 560, 264, -208}, { 440, 240, -160}, // 16 seconds { 440, 208, -12...
des = max_nodes ? (GTextNode **)((uint8_t *)container_node + size) : NULL, }; } return container_node; } GTextNodeHorizontal *graphics_text_node_create_horizontal(size_t max_nodes) { return (GTextNodeHorizontal *)prv_create_container(GTextNodeType_Horizontal, ...
{ graphics_text_layout_get_max_used_size(ctx->gcontext, text_node->text, text_node->font, ctx->box, text_node->overflow, text_node->alignment, (TextLayout *)&layout); }
if (ctx->size_out) { *ctx->size_out = layout.max_used_size; } } static void prv_draw_text_node_text_dynamic(GTextNodeDrawContext *ctx) { GTextNodeTextDynamic *text_node = (GTextNodeTextDynamic *)ctx->node; text_node->update(ctx->gcontext, &text_node->text.node, &ctx->box, ctx->config, ctx->render, ...
ustom_label_string, sizeof(data->custom_label_string)) != 0) { strncpy(data->custom_label_string, new_tuple->value->cstring, sizeof(data->custom_label_string)); prv_update_scrollable_metrics(data); } break; } case SPORTS_CUSTOM_VALUE_...
TupletCString(SPORTS_TIME_KEY, "00:00")
, TupletInteger(SPORTS_UNITS_KEY, is_metric), TupletInteger(SPORTS_LABEL_KEY, is_pace), TupletInteger(SPORTS_ACTIVITY_STATE_KEY, state), TupletInteger(SPORTS_HRM_KEY, 0), TupletCString(SPORTS_CUSTOM_LABEL_KEY, ""), TupletCString(SPORTS_CUSTOM_VALUE_KEY, "") }; app_sync_init(&data->sync, data...
(uint16_t)y); if (x1 && x2) { x1->raw_value = MAX(x1->raw_value, current_data_row_info.min_x << FIXED_S16_3_PRECISION); x2->raw_value = MIN(x2->raw_value, current_data_row_info.max_x << FIXED_S16_3_PRECISION); return x1->integer <= x2->integer; } return false; } // Clip the provided x valu...
prv_update_mask(ctx, y1.integer, x, x, color)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
hw_cpm_disable_debugger()
; OS_TIMER_DELETE(s_dbg_disable_timer, OS_QUEUE_FOREVER); s_dbg_disable_timer = NULL; } static void prv_disable_debugger_with_delay(void) { s_dbg_disable_timer = OS_TIMER_CREATE("dbg", OS_MS_2_TICKS(DISABLE_DEBUG_DELAY_MS), false /* repeat */, NULL, prv_disable_debugger_cb...
ounds, GEdgeInsets(0, 20)); } #endif GRect icon_bounds = gbitmap_get_bounds(shoe_icon); icon_bounds.origin = bounds.origin; #if PBL_BW icon_bounds.origin.x += 23; // icon left offset icon_bounds.origin.y += 9; // icon top offset #elif ROBERT_SCREEN_RES icon_bounds.origin.y += (46 - icon_bounds.size.h); // ...
PBL_IF_COLOR_ELSE(GColorRed, GColorWhite)
); graphics_draw_text(ctx, bpm_text, font, bounds, GTextOverflowModeFill, alignment, NULL); } #endif //////////////////////////////////////////////////////////////////////////////////////////////////// // Update Proc static void prv_base_layer_update_proc(Layer *layer, GContext *ctx) { KickstartData *data = windo...
/* * 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...
health_sleep_summary_card_get_bg_color(card_layer)
); window_set_on_screen(&window, true, true); window_render(&window, &s_ctx); } // Tests ////////////////////// void test_health_sleep_summary_card__render_no_data(void) { prv_create_card_and_render(&(HealthData) {}); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_sleep_summa...
uintptr_t object_ref; // Consume, even if we didn't have enough memory, this will eat the notification and free up // the space in the buffer. const uint16_t next_value_length = sys_ble_client_consume_notification(&object_ref, valu...
event_service_client_subscribe(&ble_app_state->gatt_client_service_info)
; } } } else { if (!new_handler) { if (--ble_app_state->gatt_client_num_handlers == 0) { // Last GATT handler to be de-registered. // Unsubscribe from GATT Client event service: event_service_client_unsubscribe(&ble_app_state->gatt_client_service_info); } } } ...
/* * 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 (data->test_complete) { if (--data->seconds_remaining == 0) { app_window_stack_pop(true); } return; }
const bool test_passed = (data->buttons_pressed == 0x0f); if (data->seconds_remaining == 0 || test_passed) { data->test_complete = true; #if MFG_INFO_RECORDS_TEST_RESULTS mfg_info_write_test_result(MfgTest_Buttons, test_passed); #endif if (test_passed) { // pass sniprintf(data->status_st...
p = NULL; } // Helpers ////////////////////// void prv_push_and_render_simple_dialog(Dialog *dialog) { gbitmap_destroy(s_dest_bitmap); const int16_t bitmap_width = DISP_COLS; const int16_t bitmap_height = DISP_ROWS; const GSize bitmap_size = GSize(bitmap_width, bitmap_height); s_dest_bitmap = gbitmap_creat...
(simple_dialog)
; dialog_set_text(dialog, "Calendar Unmuted"); dialog_set_icon(dialog, RESOURCE_ID_RESULT_MUTE_LARGE); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT); prv_push_and_render_simple_dialog(dialog); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_simple_dialog__does_text_fit(void) { con...
app_smartstrap_attribute_end_write(attr, 0, true)
); // start the write request again write_buffer = NULL; write_length = 0; assert_result_ok(app_smartstrap_attribute_begin_write(attr, &write_buffer, &write_length)); cl_assert(write_buffer == (uint8_t *)attr); cl_assert(write_length == 100); // end the write request with request_read=true assert_resu...