prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
timing.h" #include "property_animation_private.h" #include "applib/legacy2/ui/animation_legacy2.h" #include "applib/legacy2/ui/animation_private_legacy2.h" #include "applib/app_logging.h" #include "applib/applib_malloc.auto.h" #include "process_state/app_state/app_state.h" #include "kernel/kernel_applib_state.h" #i...
list_find(state->unscheduled_head, prv_parent_list_filter, &info)
; if (!node) { node = list_find(state->scheduled_head, prv_parent_list_filter, &info); } if (!node) { return NULL; } return (AnimationPrivate *)node; } // ------------------------------------------------------------------------------------------- // Remove from being iterated after unscheduling. This...
ry.version == 3) { sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d, %d", &steps, &orientation, &vmc, &light, &plugged_in); } else { cl_assert(false); } fflush(stdout); PBL_ASSERTN(state->test_entry.num_samples < SLEEP_SAMPLES_DISCOVERY_MAX_SAMPLES); stat...
if (strcmp(token, "TEST_WEIGHT") == 0) { sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight); } else if (strcmp(token, "TEST_NAME") == 0) { sscanf(token + strlen(token) + 1, "%s", state->test_entry.name); }
} // If this is a "static AlgDlsMinuteData samples[] = {" line, skip it if (strcmp(token, "static") == 0) { continue; } // Grab a sample if (strcmp(token, "{") == 0) { PBL_ASSERTN(state->test_entry.name[0] != 0); int steps = 0; int orientation = 0; int vmc = 0; ...
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM", .lengths = { #if PLATFORM_ROBERT [TestS...
(window, new_dialog)
; dialog_push(new_dialog, stack); } #endif static char s_text_test_str[1024]; static void prv_perftest_test_main(void *data) { profiler_init(); GFont font = fonts_get_system_font(s_perftest_text_arguments.font_key); int text_index; int font_index; if (strcmp(s_perftest_text_arguments.string_type, "best")...
/* * 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...
(&inverter->layer, true)
; layer_mark_dirty(&(inverter->layer)); } InverterLayer* inverter_layer_create(GRect frame) { InverterLayer* layer = applib_type_malloc(InverterLayer); if (layer) { inverter_layer_init(layer, &frame); } return layer; } void inverter_layer_deinit(InverterLayer *inverter_layer) { if (inverter_layer == N...
* 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 * limitations under the License....
(ctx, mask_colors[i])
; // Fill the mask shape prv_fill_mask_shape(ctx, &layer_bounds, &shape_size, current_angle); } // Activate the mask and fill the entire layer with a red rectangle graphics_context_mask_use(ctx, mask); graphics_context_set_fill_color(ctx, GColorRed); graphics_fill_rect(ctx, &layer_bounds); graph...
ct { SemaphoreHandle_t semph; const BTDriverConfig *config; } BleTaskInitInfo; /* * Main code */ typedef struct { uint16_t conn_idx; //! The connection that has the demo server uint16_t write_hdl; uint16_t write_cccd_hdl; uint16_t notify_hdl; uint16_t notify_cccd_hdl; uint32_t expected_read_heade...
if (event->status == BLE_STATUS_OK) { // We'll be getting an conn_param_update very soon, no need to alert the host. return; }
PBL_LOG(LOG_LEVEL_WARNING, "Connection parameter update request failed with status: %d", event->status); Connection *conn = connection_by_idx(event->conn_idx); if (conn == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "No connection for idx=%d", event->conn_idx); return; } BTDeviceInternal addr; co...
, sizeof(pc_str), "%p", (void*) crash_info->pc); } else { strncpy(pc_str, "???", sizeof(pc_str)); } char buffer[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&crash_info->app_uuid, buffer); char *process_string = (crash_info->task == PebbleTask_Worker) ? "Worker" : "App"; APP_LOG(APP_LOG_LEVEL_ERROR, "%...
xTaskGetCurrentTaskHandle()
); } DEFINE_SYSCALL(NORETURN, sys_app_fault, uint32_t stashed_lr) { // This is the privileged side of handling a failed assert/croak from unprivileged code. // Always run on the current task. CrashInfo crash_info = make_crash_info_pc(stashed_lr); setup_log_app_crash_info(crash_info); system_task_add_callba...
/* * 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...
(atol("500hurf"), 500)
; cl_assert_equal_i(atol("765berserker"), 765); cl_assert_equal_i(atol("573888 redmage"), 573888); cl_assert_equal_i(atol("713713 4 job fiesta111"), 713713); } void test_atol__sign(void) { cl_assert_equal_i(atol("+500"), 500); cl_assert_equal_i(atol("-765"), -765); cl_assert_equal_i(atol(" -573888"), -57...
st_impl, &s_test_impl_data, sizeof(s_test_impl_data), dummy, NULL)); s_test_impl.reset = dummy; s_test_impl.cancel = NULL; cl_assert_passert(recognizer_create_with_data(&s_test_impl, &s_test_impl_data, ...
(recognizer_transition_state(r, RecognizerState_Failed))
; cl_assert_passert(recognizer_transition_state(r, RecognizerState_Possible)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Started)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Updated)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Cancelled)); c...
ee the License for the specific language governing permissions and * limitations under the License. */ #include "app_menu_data_source.h" #include "applib/fonts/fonts.h" #include "applib/ui/menu_layer.h" #include "apps/system_app_ids.h" #include "kernel/pbl_malloc.h" #include "process_management/app_manager.h" #incl...
if (app_node->record_order != new_node->record_order) { // Record order (smallest first) return prv_comparator_ascending_zero_last(app_node->record_order, new_node->record_order); } else { // AppInstallId (smallest first) return new_node->install_id - app_node->install_id; }
} static void prv_set_storage_order(AppMenuDataSource *source, AppMenuNode *menu_node, AppMenuOrderStorage *storage, bool update_and_take_ownership) { if (!storage) { return; } for (int i = 0; i < storage->list_length; i++) { const AppInstallId storage_app_id = storage...
GContext* ctx, GPoint p, uint16_t radius) { prv_fill_horizontal_line(ctx, GPoint(p.x - radius, p.y), 2 * radius + 1); graphics_fill_half_circle(ctx, p.x, p.y, radius, GCornersAll); } #if PBL_COLOR MOCKABLE void graphics_internal_circle_quadrant_fill_aa(GContext* ctx, GPoint p, uint16_t radius, ...
if (quadrant & GCornersTop) { if (center.y.raw_value - y.raw_value <= bottom.y.raw_value) { if (center.y.raw_value - y.raw_value >= top.y.raw_value) { *top_edge = prv_intersection_between_horizontal_and_line((Fixed_S16_3){.raw_value = (center.y.raw_value - y.raw_value)}, top, bottom); ...
} T_STATIC EllipsisDrawConfig prv_calc_draw_config_ellipsis(int32_t angle_start, int32_t angle_end) { PBL_ASSERTN(angle_start <= angle_end); EllipsisDrawConfig config = (EllipsisDrawConfig){(EllipsisPartDrawConfig){0, GCornerNone}, GCornerNone, (EllipsisPartDrawConfig){0, GCornerNone}}; // Nothing to d...
R error_value = rocky_args_assign(argc, argv, &binding, 1); // Canvas APIs do a no-op if the color string is invalid if (!jerry_value_has_error_flag(error_value)) { func(rocky_api_graphics_get_gcontext(), color); }; return jerry_create_undefined(); } #define COLOR_BUFFER_LENGTH (12) T_STATIC void prv_grap...
(ctx_prototype, ROCKY_CONTEXT2D_CANVAS, jerry_create_undefined())
; rocky_add_function(ctx_prototype, ROCKY_CONTEXT2D_CLEARRECT, prv_clear_rect); rocky_add_function(ctx_prototype, ROCKY_CONTEXT2D_FILLRECT, prv_fill_rect); rocky_add_function(ctx_prototype, ROCKY_CONTEXT2D_FILLRADIAL, prv_fill_radial); rocky_add_function(ctx_prototype, ROCKY_CONTEXT2D_STROKERECT, prv_stroke_rec...
inner_seq, 0); animation_set_handlers(inner_seq, handlers, inner_seq); // Create the outer sequence Animation *c = prv_create_test_animation(); animation_set_duration(c, duration_c); Animation *d = prv_create_test_animation(); animation_set_duration(d, duration_d); Animation *seq = animation_sequence_c...
prv_count_handler_entries(&s_update_handler_calls, b)
, 0); // Complete sequence prv_advance_to_ms_with_timers(start_ms + duration_a + duration_b + 5 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count...
// Grab lock on timer structures, create a unique ID for this timer and put it into our idle // timers list mutex_lock(manager->mutex); *timer = (TaskTimer) { .id = manager->next_id++, }; // We don't expect to wrap around, this would take over 100 years if we allocated a timer every // second PBL_AS...
{ mutex_lock(manager->mutex); // Find this timer in our list TaskTimer* timer = prv_find_timer(manager, timer_id); PBL_ASSERTN(!timer->defer_delete); // Move it to the idle list if it's currently running if (timer->expire_time) { PBL_ASSERTN(list_contains(manager->running_timers, &timer->list_node)); ...
// -------------------------------------------------------------------------------- // Delete a timer void task_timer_delete(TaskTimerManager *manager, TaskTimerID timer_id) { mutex_lock(manager->mutex); // Find this timer in our list TaskTimer* timer = prv_find_timer(manager, timer_id); // If it's already...
(const uint8_t *) &rsp, sizeof(rsp), COMM_SESSION_DEFAULT_TIMEOUT); if (!success) { PBL_LOG(LOG_LEVEL_ERROR, "GET_BYTES: aborted"); s_get_bytes_in_progress = false; return false; } if (result != GE...
prv_gather_and_record_stats(state)
; // If all done, mark the image as "read" and free up our state structure gb_storage_cleanup(&state->storage, true /* successful */); kernel_free(state); s_get_bytes_in_progress = false; prv_put_status_event(DebugInfoStateFinished); comm_session_set_responsiveness(state->session, BtConsumerP...
emoves, 8); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); } void test_alarm__custom_alarm_no_alarm(void) { AlarmId id1; bool schedule_1[7] = {false, false, false, false, false, false, false}; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_CUST...
cl_assert_equal_i(s_num_alarms_fired, 0)
; // Alarm should go off on the weekend s_current_day = s_saturday; s_current_hour = 10; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); } void test_alarm__alarm_get_next_enabled_alarm(void) { // Declarations time_t next_alarm = 0; time_t time_until_alarm = 0;...
_animation__auto_destroy_reschedule(void) { #ifdef TEST_INCLUDE_BASIC PropertyAnimation *prop_h; Layer layer; GRect from_r; GRect to_r; const int duration = 100; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler_reschedule }; memset(&layer, 0, ...
cl_assert_equal_i(prv_count_animations(), 0)
; } // -------------------------------------------------------------------------------------- // Test that animation_destroy can be called from the stopped handler void test_animation__destroy_from_stopped_handler_with_auto_destroy(void) { #ifdef TEST_INCLUDE_BASIC prv_test_destroy_from_stopped_handler(true); #endi...
.constructor = launcher_app_glance_alarms_create, }, { // Watchfaces .uuid = {0x18, 0xe4, 0x43, 0xce, 0x38, 0xfd, 0x47, 0xc8, 0x84, 0xd5, 0x6d, 0x0c, 0x77, 0x5f, 0xbe, 0x55}, .constructor = launcher_app_glance_watchfaces_create, }, { // Workout .uuid = {0xfe, 0...
{ launcher_app_glance_update_current_slice(glance_in_cache); // If necessary, update the slice expiration timer with the updated current slice prv_update_slice_expiration_timer_if_necessary(service, glance_in_cache->current_slice.expiration_time); }
/* * 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...
dict_write_end(iter)
; app_message_outbox_send(); } static void up_click_handler(ClickRecognizerRef recognizer, AppData *data) { send_golf_cmd(CMD_PREV); } static void down_click_handler(ClickRecognizerRef recognizer, AppData *data) { send_golf_cmd(CMD_NEXT); } static void select_click_handler(ClickRecognizerRef recognizer, AppDa...
events to itself while processing another // event. // 2.) The ONLY task that posts events to s_from_kernel_event_queue is the KernelMain task. // 3.) Whenever KernelMain wants to post an event to itself, it MUST use this queue. // 4.) The KernelMain task will always service this queue first, before servicing the ...
{ prv_log_event_put_failure(queue_type, saved_lr, event); #ifdef NO_WATCHDOG enable_mcu_debugging(); while (1); #endif reset_due_to_software_failure(); }
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_health_activity_summary_card__render_current_above_typical3(void) { HealthData health_data = { .step_data = 780, .step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, ...
ive total_size in our init message assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__init_msg_incomplete(void) { const uint8_t incomplete_init_msg = CmdInit; prv_receive_data(s_session, (const uint8_t *) &incomplete_init_msg, sizeof(incomplete_init_msg)); ass...
prv_receive_put(~s_last_response_cookie, chunk, sizeof(chunk))
; assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__not_in_fw_update_mode(void) { prv_receive_init_fw_object(); prv_process_and_reset_test_counters(); s_firmware_update_is_in_progress = false; const uint8_t chunk[] = { 0xaa, 0xbb, 0xcc }; prv_receive_put(s_last_response_cookie, chunk, ...
e) { if (!alerts_should_notify_for_type(prv_alert_type_for_notification_type(type))) { return; } NotificationWindowData *data = &s_notification_window_data; // will fail and return early if already init'ed. prv_init_notification_window(true /*is_modal*/); if (data->is_modal) { WindowStack *window...
prv_cancel_reminder_watchdog(&s_notification_window_data)
; } if (prv_should_pop_due_to_inactivity()) { // Re-schedule the window pop timer after leaving DND mode prv_refresh_pop_timer(&s_notification_window_data); } } // This function is only used by the notifications_app. // When it calls this function, it knows it is a valid notification already. void app_n...
true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoOK); // Verify (only) the app task got a (virtual) connection event: prv_assert_client_event(&device, true /* connected */, (1 << PebbleTask_App), ...
(&device, true /* is_master*/)
; // Register one-shot connection intent for app: gap_le_connect_connect(&device, false /* no auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); prv_fake_disconnect(&device, true /* is_master */); // Verify both app tas...
/* * 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...
(menu_layer, MenuIndex(0, row), MenuRowAlignCenter, false)
; window_set_on_screen(window, true, true); window_render(window, &s_ctx); } // Tests ////////////////////// void test_workout_selection__render_run_selected(void) { prv_create_window_and_render(0); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_selection__render_walk_selec...
(false /* success */); } static void prv_pairing_timeout_timer_callback(void *unused) { PBL_LOG(LOG_LEVEL_WARNING, "SSP timeout fired!"); launcher_task_add_callback(prv_show_failure_kernel_main_cb, NULL); } static void prv_pop_window(void) { if (s_data_ptr) { window_stack_remove(&s_data_ptr->window, true /*...
window_set_click_config_provider(&data->window, prv_success_or_failure_click_config_provider)
ooth/ble_hrm.h" #include "services/normal/notifications/action_chaining_window.h" #include "services/normal/notifications/alerts_preferences.h" #include "services/normal/notifications/ancs/ancs_notifications.h" #include "services/normal/notifications/notification_constants.h" #include "services/normal/notifications/not...
{ timeline_item_destroy(data->chaining_data.notif); data->chaining_data.notif = NULL; }
if (data->progress_window) { progress_window_destroy(data->progress_window); data->progress_window = NULL; } applib_free(data->dialog.message); data->dialog.message = NULL; event_service_client_unsubscribe(&data->event_service_info); prv_cancel_response_timer(data); applib_free(data); } stati...
04, 424, -752}, { 472, 480, -832}, { 408, 520, -656}, { 376, 472, -704}, { 408, 512, -736}, { 376, 504, -736}, { 320, 520, -720}, { 312, 576, -736}, { 328, 568, -744}, { 336, 544, -728}, { 360, 544, -744}, { 320, 544, -736}, { 344, 520, -744}, // 87 seconds { 320,...
{ 560, 400, -736}, { 616, 296, -816}, { 728, 384, -1064}, { 728, 360, -1048}, { 672, 440, -848}, { 672, 480, -776}, { 624, 504, -592}, { 664, 392, -576}, { 728, 368, -552}, { 792, 256, -536}, { 816, 248, -568}, { 800, 264, -552}, { 856, 256, -568}, { 816, 216, -67...
enabled; timeline_peek_set_enabled(*enabled); return true; } static bool prv_set_s_timeline_peek_before_time_m(uint16_t *before_time_m) { s_timeline_peek_before_time_m = *before_time_m; timeline_peek_set_show_before_time(*before_time_m * SECONDS_PER_MINUTE); return true; } #endif // ------------------------...
settings_file_close(&file)
; } // ------------------------------------------------------------------------------------ // Find the PrefsTableEntry for the given key static const PrefsTableEntry *prv_prefs_entry(const uint8_t *key, size_t key_len) { uint32_t num_entries = ARRAY_LENGTH(s_prefs_table); const PrefsTableEntry *entry = s_prefs_t...
er_app.uuid); app_cache_add_entry(bg_counter_app_id, 10701); cl_assert_equal_i(BG_COUNTER_APP_ID, bg_counter_app_id); // simulate installing menu_layer_app on flash app_db_insert((uint8_t *)&menu_layer_app.uuid, sizeof(Uuid), (uint8_t *)&menu_layer_app, sizeof(AppDBEntry)); menu_layer_app_id ...
app_menu_data_source_deinit(&data_source)
; } void test_app_menu_data_source__check_default_order_watchfaces(void) { static const AppInstallId watchface_default_order[] = {APP_ID_TICTOC, BIG_TIME_APP_ID}; app_menu_data_source_init(&data_source, &(AppMenuDataSourceCallbacks) { .changed = prv_menu...
for (int i = 0; i < ACTIVITY_NUM_METRIC_AVERAGES; i++) { if (averages->average[i] != ACTIVITY_METRIC_AVERAGES_UNKNOWN) { use_default = false; break; } } } // Compute the default average value uint16_t default_value = 0; if (use_default) { HealthServiceMetricStats stats;...
sys_time_utc_to_local(time_end)
; // we use this value as a reference to calculate the range of valid data entries const time_t midnight_after_now = prv_get_midnight_of_local_time(now) + SECONDS_PER_DAY; // never work with values in the future time_end = MIN(time_end, now); // never work with values older than the supported history of dat...
/* * 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...
syscall_internal_elevate_privilege()
; char test = buf[0]; do_stuff(&test, size); } void bind_syscall(char * buf, int size) { syscall_internal_elevate_privilege(); char * new = buf; do_stuff(new, size); } void malloc_syscall() { syscall_internal_elevate_privilege(); void *buf = app_malloc(5); syscall_assert_userspace_buffer(buf, 5);...
prv_app_resource_info_equal(&res_info_to_load, &generic_glance->default_icon_resource_info)
) { res_info_to_load = generic_glance->default_icon_resource_info; generic_glance->displayed_icon = prv_create_glance_icon(&res_info_to_load, legacy_icon_size_limit); } // If we don't have a valid icon at this point, use the fallback ico...
) { uint32_t zero_flags = 0; uint32_t expire_ms; menu_callback_prefix(index, ctx); // Multiple timers int timer_idx_0 = 0; s_app_data->timer[timer_idx_0] = new_timer_create(); bool success = new_timer_start(s_app_data->timer[timer_idx_0], 300, timer_callback, (void*)timer_idx_0, zero_flags); PBL_ASS...
(0x12345678, 100, timer_callback, cb_data, zero_flags)
; } // ================================================================================= void reg_timer_schedule_1sec_from_cb_menu_cb(int index, void *ctx) { menu_callback_prefix(index, ctx); s_app_data->reg_timers[0].cb = reg_timer_1_callback; regular_timer_add_seconds_callback(&s_app_data->reg_timers[0]); } ...
lt from light get brightness as it sometimes // will round down/up by a % static uint8_t prv_get_scaled_brightness(void) { return BACKLIGHT_SCALE_GRANULARITY * ((backlight_get_intensity_percent() + BACKLIGHT_SCALE_GRANULARITY - 1) / BACKLIGHT_SCALE_GRANULARITY); } static int prv_intensity_get_se...
prv_intensity_menu_push(data)
; break; case SettingsDisplayBacklightTimeout: prv_timeout_menu_push(data); break; #if PLATFORM_SPALDING case SettingsDisplayAdjustAlignment: settings_display_calibration_push(app_state_get_window_stack()); break; #endif default: WTF; } settings_menu_reload_data(Setti...
_activity_last_processed_time(KAlgState *state, KAlgActivityType activity) { return rtc_get_time(); } // Set these to simulate a sleep session (that should result in zeroing out any steps taken) static time_t s_kalg_sleep_start_utc; static uint16_t s_kalg_sleep_m; void kalg_get_sleep_stats(KAlgState *alg_state, KAl...
rtc_get_time()
+ delay); } s_alg_next_vmc = minute_data[i].base.vmc; s_alg_next_orientation = minute_data[i].base.orientation; s_alg_next_light = minute_data[i].base.light; s_alg_next_plugged_in = minute_data[i].base.plugged_in; s_activity_next_distance_mm += minute_data[i].distance_cm * 10; s_activity_ne...
/* * 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 (event->type == PEBBLE_BATTERY_STATE_CHANGE_EVENT) { battery_monitor_handle_state_change_event(event->battery_state.new_state); } else if (event->type == PEBBLE_BATTERY_CONNECTION_EVENT) { battery_state_handle_connection_event(event->battery_connection.is_connected); periodic_timer_trigger(1); }
} // Setup //////////////////////////////////// void test_battery_monitor__initialize(void) { //g_pbl_log_enabled = true; //g_pbl_log_level = 255; s_entered_standby = false; s_error_window_shown = false; s_warning_window_shown = false; s_in_low_power = false; s_stop_mode_allowed = true; fake_rtc_init...
ient's session_ref. This is used to lookup // the corresponding AccelSubscriberState SharedCircularBufferClient buffer_client; AccelSamplingRate sampling_rate; uint16_t samples_per_update; uint16_t subsample_numerator; uint16_t subsample_denominator; //! Which ta...
{ PBL_ASSERTN(highest_rate == ACCEL_SAMPLING_25HZ && state->sampling_rate == ACCEL_SAMPLING_10HZ); new_num = 2; new_den = 5; }
if (state->subsample_numerator != new_num || state->subsample_denominator != new_den) { state->subsample_numerator = new_num; state->subsample_denominator = new_den; } PBL_LOG(LOG_LEVEL_DEBUG, "set subsampling for session %d to %d/%d", (int)state->session_ref, state->subsample_nume...
a = context; launcher_menu_layer_reload_data(&data->launcher_menu_layer); } //! We're not 100% sure of the order of the launcher list yet, so use this function to transform //! the row index to achieve the desired list ordering static uint16_t prv_transform_index(AppMenuDataSource *data_source, uint16_t original_ind...
app_event_loop()
; } const PebbleProcessMd *launcher_menu_app_get_app_info(void) { static const PebbleProcessMdSystem s_launcher_menu_app_info = { .common = { .main_func = prv_main, // UUID: dec0424c-0625-4878-b1f2-147e57e83688 .uuid = {0xde, 0xc0, 0x42, 0x4c, 0x06, 0x25, 0x48, 0x78, 0xb1, 0xf2, ...
o_event(); cl_assert_equal_b(fake_gatt_is_service_discovery_running(), true); const int stop_count_before_rediscovery = fake_gatt_is_service_discovery_stop_count(); // Re-discovery: cl_assert_equal_i(gatt_client_discovery_rediscover_all(&device), BTErrnoOK); // Assert the previous process has been stopped: ...
(connection, &range)
; } // kick off a full discovery cl_assert_equal_i(gatt_client_discovery_rediscover_all(&device), BTErrnoOK); // Assert the previous process has been stopped: cl_assert_equal_i(1, fake_gatt_is_service_discovery_stop_count()); // Expect "Database Changed" event: prv_assert_event(&device, BTErrnoServiceD...
/* * 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)
; } 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(app_state_get_window_stack(), animated); } bool app_window_stack_remove(Window *window, bool animated) { return window_s...
} if (s_call_in_progress) { prv_call_end_common(); phone_ui_handle_call_end(false /*call accepted*/, disconnected); } else if (!disconnected) { PBL_LOG(LOG_LEVEL_INFO, "Ignoring end call. A call is not in progress"); } } static void prv_handle_caller_id(PebblePhoneEvent *event) { if (s_call_in_pr...
PBL_LOG(LOG_LEVEL_INFO, "Call declined")
; if (prv_call_is_ancs()) { ancs_perform_action(s_call_identifier, ActionIDNegative); ancs_phone_call_temporarily_block_missed_calls(); prv_cancel_call_watchdog(); } else { pp_decline_call(s_call_identifier); } if (s_call_in_progress) { s_call_in_progress = false; analytics_stopwatch_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...
(&data->time_picker_window.window)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(NULL, NULL, NULL, NULL)
, true); shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_ble_pairing_data(NULL, NULL, NULL, NULL), false); } void test_shared_prf_storage_v2__getting_started_complete(void) { shared_prf_storage_wipe_all(); cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), false); 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...
(s_free_list_lock, true)
; MBuf *m = s_free_list; while (m) { PBL_ASSERTN(mbuf_is_flag_set(m, MBUF_FLAG_IS_MANAGED)); PBL_ASSERTN(mbuf_is_flag_set(m, MBUF_FLAG_IS_FREE)); PBL_ASSERTN(!mbuf_get_data(s_free_list)); PBL_ASSERTN(mbuf_get_length(m) == 0); m = mbuf_get_next(m); } } MBuf *mbuf_get(void *data, uint32_t lengt...
file %s...", iter->file_name); // Remove the file that caused us to get into this state before we reboot, // that way we should be able to avoid getting into a reboot loop. pfs_close_and_remove(iter->fd); PBL_LOG(LOG_LEVEL_INFO, "Data at address %p. Rebooting...", contents); PBL_CROAK("Internal logic error.")...
(iter, iter->hdr_pos + sizeof(SettingsRecordHeader) + iter->hdr.key_len, FSeekSet)
; sfs_read(iter, val_out, val_len); } void settings_raw_iter_write_header(SettingsRawIter *iter, SettingsRecordHeader *hdr) { PBL_ASSERTN(hdr->key_len <= SETTINGS_KEY_MAX_LEN); PBL_ASSERTN(hdr->val_len <= SETTINGS_VAL_MAX_LEN); sfs_seek(iter, iter->hdr_pos, FSeekSet); sfs_write(iter, (uint8_t*)hdr, sizeof(*h...
_private_send_session(entry->session, false)); } else { // Session has disappeared between the time that the reopen list was // created and now. This ideally shouldn't happen, but there's a lot // that's broken about datalogging. See PBL-37078. success = true; } kernel_free(entry); if (success)...
PBL_LOG(LOG_LEVEL_INFO, "Report already in progress")
core_dump_mark_read(data->core_dump_base)
; } kernel_free(storage->impl_data); } bool is_unread_coredump_available(void) { uint32_t flash_base = prv_coredump_flash_base(true); return core_dump_is_unread_available(flash_base); }
move_size); const GBitmap app_bitmap = compositor_get_app_framebuffer_as_bitmap(); GBitmap sys_bitmap = compositor_get_framebuffer_as_bitmap(); const GPoint point = vertical ? GPoint(0, -current_offset_px) : GPoint(-current_offset_px, 0); // Make sure the undrawn ar...
(s_data.first_anim, SHUTTER_TRANSITION_FIRST_DURATION_MS)
; duration += SHUTTER_TRANSITION_FIRST_DURATION_MS; animation_set_curve(s_data.first_anim, AnimationCurveEaseIn); } s_data.second_anim = animation_create(); if (s_data.second_anim) { anim_array[anim_count++] = s_data.second_anim; static const AnimationImplementation s_second_animation_impl = { ...
v, AS7000AppId app) { uint8_t running_apps = 0; if (!prv_read_register(dev, ADDR_APP_IDS, &running_apps)) { return false; } PBL_LOG(LOG_LEVEL_DEBUG, "Apps running: 0x%"PRIx8, running_apps); if (app == AS7000AppId_Idle) { // no apps should be running return running_apps == AS7000AppId_Idle; } r...
(dev->state->lock)
; if (dev->state->enabled_state != HRMEnabledState_Enabled) { goto exit; } // If we have gone too long without getting an interrupt, let's reset the device if (s_missing_interrupt_count >= AS7000_MAX_WATCHDOG_INTERRUPTS) { PBL_LOG(LOG_LEVEL_ERROR, "Watchdog logic detected frozen sensor. Resetting now."...
t = GRect(x, y + text_single_line_text_offset_px, w, max_text_line_height_px); text_height = graphics_text_layout_get_max_used_size(ctx, dialog->buffer, dialog_text_fo...
PBL_ASSERTN(workout_dialog)
; *workout_dialog = (WorkoutDialog){}; dialog_init(&workout_dialog->dialog, dialog_name); Window *window = &workout_dialog->dialog.window; window_set_window_handlers(window, &(WindowHandlers) { .load = prv_workout_dialog_load, .unload = prv_workout_dialog_unload, .appear = prv_workout_dialog_appear...
Note that Sunday is on the right side, at the end const int thin_offset_x = WITHIN(weekday, Monday, Thursday) ? 1 : 0; const int thin_width = 5; thin_box.origin.x += thin_offset_x + (box->size.w - thin_width) / 2; thin_box.size.w = thin_width; graphics_context_set_fill_color(ctx, bar_color); graphics_fill_...
{ return; }
const int offset_y = LABEL_OFFSET_Y - MAX(prv_convert_to_graph_height(graph_card, avg), AVG_LINE_HEIGHT / 2); graphics_context_set_fill_color(ctx, AVG_LINE_COLOR); graphics_fill_rect(ctx, &(GRect) {{ offset_x, offset_y - AVG_LINE_HEIGHT / 2 }, ...
w object as `this` var bindArgs = [null].concat(args); var boundConstructor = func_obj.bind.apply(func_obj, bindArgs); var rv = new boundConstructor(); return __jerryRefs.ref(rv); }, func_obj_val, args_p, args_count); } jerry_size_t jerry_string_to_char_buffer(const jerry_value_t va...
if (jerry_value_has_error_flag(value)) { return false; }
return (bool)EM_ASM_INT({ return Boolean(__jerryRefs.get($0)); }, value); } jerry_value_t jerry_value_to_number(const jerry_value_t value) { if (jerry_value_has_error_flag(value)) { return TYPE_ERROR_FLAG; } return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.ref(Number(__jerryRefs.get...
/* * 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 (flags & GAP_LE_AD_FLAGS_GEN_DISCOVERABLE_MASK) { return GAP_DISC_MODE_GEN_DISCOVERABLE; } else if (flags & GAP_LE_AD_FLAGS_LIM_DISCOVERABLE_MASK) { return GAP_DISC_MODE_LIM_DISCOVERABLE; } else { return GAP_DISC_MODE_NON_DISCOVERABLE; } }
ble_error_t advert_set_interval(uint16_t min_slots, uint16_t max_slots) { // No need to lock / take here, this API just sets a couple vars in ble_mgr_dev_params, // while holding the ble_mgr_dev_params lock. ble_error_t rv = ble_gap_adv_intv_set(min_slots, max_slots); if (rv != BLE_STATUS_OK) { PBL_LOG(LO...
SET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 11 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 1...
prv_draw_rects(&ctx, 4, 3 * CLIP_OFFSET, 1)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ layer_mark_dirty(window_get_root_layer(window)); app_timer_register(1000 / FPS, timed_update, NULL); }
static void init(void) { window = window_create(); Layer *window_layer = window_get_root_layer(window); GRect window_bounds = layer_get_bounds(window_layer); TextLayer *text_layer = text_layer_create(window_bounds); text_layer_set_text(text_layer, "Unplug and plug in the charger. You will see that the sy...
"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 distributed on an "AS IS" BASIS, ...
{ fake_spi_flash_init(FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, SPRF_REGION_SIZE); shared_prf_storage_init(); }
void test_shared_prf_storage_v3__cleanup(void) { fake_spi_flash_cleanup(); prv_assert_mutexes_unlocked(); } void test_shared_prf_storage_v3__init_all_zeros(void) { uint8_t *flash_buf = kernel_zalloc(SPRF_REGION_SIZE); flash_write_bytes(flash_buf, FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, SPRF_REGION_SIZE); sh...
_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, jerry_value_t listener, void *data) { ListenerQueryData *query_data = dat...
(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'", event_name); } return jerry_create_undefined(); } JERRY_FUNCTION(prv_event_cons...
//! TimelineSettingsVersion is an increasing version number. TimelineSettingsVersionCurrent must //! not decrement. This should ensure that the current version is always the latest. TimelineSettingsVersionCurrent = TimelineSettingsVersionCount - 1, } TimelineSettingsVersion; typedef struct SettingsTimelinePeekData...
timeline_peek_prefs_get_enabled()
? i18n_noop("On") : /// Shows up in the Timeline settings as the status under the "Quick View" toggle. i18n_noop("Off"); break; case TimelinePeekMenuIndex_Timing: /// Shows up in the Timeline settings as the title for the menu item that control...
// Sample captured: 2015-10-05 15:42:20 local AccelRawData *activity_sample_walk_100_pbl_25660_1(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25660_1 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 ...
{ 856, 768, -192}, { 784, 784, -496}, { 656, 792, -512}, { 616, 792, -632}, { 576, 432, -664}, { 456, 336, -744}, { 368, 256, -776}, { 312, 40, -720}, { 288, 48, -792}, { 152, -72, -776}, // 5 seconds { 104, -120, -920}, { -16, -176, -848}, { -56, -184, -952}, ...
NumModalPriorities; idx++) { ModalContext *modal = &s_modal_window_stacks[idx]; WindowStack *stack = &modal->window_stack; iter.current_idx = idx; iter.current_top_window = window_stack_get_top_window(stack); if (!iter.current_top_window) { continue; } const bool should...
{ return true; }
VisibleContext *ctx = data; ctx->visible = (ctx->window == iter->current_top_window); return !ctx->visible; } bool modal_manager_is_window_visible(Window *window) { VisibleContext context = { .window = window }; prv_each_modal_stack(prv_is_window_visible_callback, &context); return context.visible; } ty...
{ rv = true; break; }
} } mutex_unlock_recursive(state->mutex); return rv; } // ------------------------------------------------------------------------------------------------ DEFINE_SYSCALL(bool, sys_activity_sessions_is_session_type_ongoing, ActivitySessionType type) { return activity_sessions_is_session_type_ongoing(type);...
to with something // like window_set_on_screen(), the window is first rendered at position (0,0); // then this function shifts it to its correct position of (0, STATUS_BAR_HEIGHT). // Either this function should set the window not on screen, or we should provide // an alternate function for initializing the window that...
prv_check_is_in_click_config_provider(window_manager_get_top_window(), "subscribe")
; if (button_id == BUTTON_ID_BACK) { return; } ClickManager *mgr = prv_get_current_click_manager(); ClickConfig *cfg = &mgr->recognizers[button_id].config; cfg->click.repeat_interval_ms = repeat_interval_ms; cfg->click.handler = handler; } void window_multi_click_subscribe(ButtonId button_id, uint8_t ...
5), 10); // T facing down graphics_draw_vertical_line_dotted(&ctx, GPoint(101, 11), 5); graphics_draw_horizontal_line_dotted(&ctx, GPoint(96, 16), 10); // cross - even vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 32), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(4, 36), 1...
graphics_context_set_stroke_width(ctx, 5)
; graphics_draw_line(ctx, GPoint(100,100), GPoint(100,100)); } void test_graphics_draw_line__same_point(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); draw_lines_same_point(&ctx); cl_check(gbitmap_pbi_eq(&ctx.dest...
32, 240}, { -104, 1304, 104}, { -104, 1472, 424}, { 88, 1096, 88}, { 80, 832, 208}, { 112, 728, 136}, { 168, 736, -16}, { 216, 608, -24}, { 232, 616, 64}, { 304, 760, 112}, { 288, 880, 48}, // 8 seconds { 400, 880, 176}, { 376, 1160, 216}, { 120, 1240, 240}, {...
{ 224, 1064, 312}, { 296, 1264, 400}, { 96, 768, 384}, { 328, 1168, -168}, { 280, 752, 288}, { 272, 808, -24}, { 320, 792, 24}, { 288, 552, 16}, { 352, 640, 56}, { 384, 928, 264}, { 480, 992, 248}, { 552, 1224, 416}, { 432, 1368, 800}, { 120, 1256, 520}, { 424...
{ 400, 1064, 464}, { 344, 1088, 280}, { 288, 1264, 272}, { 176, 1040, 360}, { 176, 1208, 24}, { 184, 952, 136}, { 168, 792, 48}, { 240, 712, -16}, { 272, 560, 24}, { 312, 600, 72}, { 304, 712, 160}, { 328, 760, 104}, { 344, 816, -88}, { 592, 1232, 192}, { 216...
/* * 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(s_did_send_byte); }
} void fake_accessory_get_buffer(uint8_t **buffer, int *length) { *buffer = s_buffer; *length = s_buffer_index; }
"A B C D E F G"; char third_page_two_lines[] = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z " "a b c d e f g h j k l m n o p q r s t u v w x y z " "A B C D E F G I J K L M N O P"; char third_page_full[] = "A B C D E F G H I J K L M N ...
(s_dest_bitmap, TEST_PBI_FILE)
); prv_prepare_fb_steps_xy(GSize(180, 300), 1, 1); ctx.draw_state.avoid_text_orphans = true; ctx.draw_state.clip_box.origin.y = 48; ctx.draw_state.clip_box.size.h = 85; ctx.draw_state.drawing_box.origin.y = -183; graphics_draw_text(&ctx, text, &s_font_info, GRect(0, 0, 180, 1000), GTex...
orrect) that two colors with // zero alpha values but different RGB values are not considered equal GColor8 color1 = GColorBlue; color1.a = 0; GColor8 color2 = GColorRed; color2.a = 0; cl_assert(!gcolor_equal__deprecated(color1, color2)); } void test_graphics_colors__inverted_readable_color(void) { GColo...
prv_test_get_luminance(GColorRed, 2)
; prv_test_get_luminance(GColorBlue, 1); } void test_graphics_colors__tint_luminance_lookup_table_init(void) { GColor8 tint_color = GColorClear; GColor8 lookup_table_out[GCOLOR8_COMPONENT_NUM_VALUES]; // Passing in NULL for lookup_table_out should assert cl_assert_passert(gcolor_tint_luminance_lookup_table_...
_shading) { // Check to see if this item spans more than max number of visible lines, // in which case we want to make it scroll. const int16_t item_height = aml->layout_cache.item_heights[aml->selected_index]; const int16_t line_height = fonts_get_font_height(aml->layout_cache.font); #if SCREEN_COLOR_DEPTH_BI...
*draw_bottom_shading = (item_animation->current_offset_y != item_animation->top_offset_y); // update the rect height and offset based on the current animation state label_text_frame->origin.y += item_animation->current_offset_y; label_text_frame->size.h = item_height; }
} // Menu Layer Drawing Routines /////////////////////////////// static bool prv_should_center(ActionMenuLayer *aml) { // We only center an ActionMenuLayer's items if the user has specified to // center the items or there is only one item in the ActionMenuLayer. if (aml->num_items == 1 || aml->layout_cache.ali...
OP_FLAG_READ; bool is_tmp = ((op_flags & OP_FLAG_OVERWRITE) != 0); if ((is_read_only || is_tmp) && (res == E_DOES_NOT_EXIST)) { goto cleanup; } // Prepare the new FD FileDesc *file_desc = &PFS_FD(fd); File *file = &PFS_FD(fd).file; file_desc->fd_status = FD_STATUS_UNREFERENCED; // set to IN_USE on ...
(&hdr, sizeof(hdr), base_addr)
, { -2147483647LL, 14, "-1652ca931", }, { 2147483646LL, 15, "C87E66B6", }, { 2147483646LL, 15, "c87e66b6", }, { -2147483647LL, 15, "-C87E66B7", }, { -2147483647LL, 15, "-c87e66b7", }, { 2147483646LL, 16, "7FFFFFFE", }, { 2147483646LL, 16, "7ffffffe", }, { -2147483647LL, 16, "-7FFFFFFF", }, { -21474836...
cl_assert_equal_i(strtol(" -0573faf", NULL, 0), -0573)
; } void test_strtol__bogus(void) { cl_assert_equal_i(strtol(" ", NULL, 10), 0); cl_assert_equal_i(strtol(" -", NULL, 10), 0); cl_assert_equal_i(strtol("-", NULL, 10), 0); cl_assert_equal_i(strtol(" +", NULL, 10), 0); cl_assert_equal_i(strtol("+", NULL, 10), 0); cl_assert_equal_i(strtol(" -+123", NULL, 10)...
tricSleepExitAtSeconds, Monday, &val_out)); cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalWakeupTime]); } void test_health_db__hr_zone_data(void) { const char *key = "monday_heartRateZoneData"; cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_h...
(average_sleep_key)
, (uint8_t *)&average_sleep_val, sizeof(average_sleep_val)), S_SUCCESS); cl_assert(health_db_get_monthly_average_value(ActivityMetricSleepTotalSeconds, &val_out)); cl_assert_equal_i(val_out, average_sleep_val); } void test_health_db__notify_listeners(void) ...
_interval_within_last_minute(now_utc, time_start, time_end); const bool valid_hr_sample_num = ((now_utc - time_start) <= HS_MAX_MINUTE_DATA_SEC); if (metric == HealthMetricHeartRateBPM) { if (query_cur_minute) { // If the client is querying the service for the most recent Stable/Median/Filtered value ...
(APP_LOG_LEVEL_ERROR, "Unsupported scope: %d", (int) scope)
; result = 0; } if (num_sums > 0) { result = ROUND(result, num_sums); } return result; } // -------- // Default handling is to use daily totals if (scope == HealthServiceTimeScopeOnce) { return prv_compute_aggregate_using_daily_totals(state, metric, time_start, time_end, ...
void *context) { prv_mute_notification(action_menu_item, MuteBitfield_Always); } static void prv_mute_notification_weekdays(ActionMenu *action_menu, const ActionMenuItem *action_menu_item, void *context) { ...
timeline_actions_add_action_to_root_level(action, root_level)
; } } if (has_ancs_mute_action) { const char *app_id = attribute_get_string(&item->attr_list, AttributeIdiOSAppIdentifier, ""); iOSNotifPrefs *notif_prefs = ios_notif_pref_db_get_prefs((uint8_t *)app_id, strlen(app_id)); char *display_name = ""; if (notif_prefs) { display_name = (char *)at...
, -48, -992}, { -72, -48, -992}, { -64, -24, -1008}, { -72, -40, -976}, { -64, -16, -984}, { -88, -72, -1024}, { -64, -40, -1000}, { -80, -24, -992}, { -64, -56, -992}, { -72, -24, -1000}, { -72, -16, -1000}, { -80, -24, -1000}, { -72, -32, -1000}, { -72, -8, -984}, ...
{ -48, -200, -928}, { -72, -136, -984}, { -88, -200, -1024}, { -64, -200, -1000}, { -80, -176, -1008}, { -72, -160, -976}, { -72, -168, -992}, { -64, -176, -984}, { -56, -176, -984}, // 241 seconds { -56, -152, -968}, { -72, -152, -984}, { -72, -168, -992}, { -80,...
{ -80, -232, -1000}, { -64, -240, -976}, { -72, -216, -976}, { -64, -272, -944}, { -80, -224, -1016}, { -88, -216, -1000}, { -80, -248, -992}, { -80, -256, -984}, { -56, -280, -984}, { -80, -208, -976}, { -72, -200, -968}, { -64, -216, -976}, { -72, -240, -984}, ...
t_icon(&s_phone_ui_data->action_bar, button, storage); } // Returns the appropriate app id for the given phone number and call source static const char *prv_get_app_id(const char *number, PhoneCallSource source) { if (!number) { return NULL; } // Select appropriate app id switch (source) { case PhoneC...
(BUTTON_ID_DOWN, down_icon, &s_phone_ui_data->down_bitmap)
/* * 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...
prv_screen_on()
; } void boot_display_show_firmware_update_progress( uint32_t numerator, uint32_t denominator) { static uint8_t last_bar_fill = UINT8_MAX; // Scale progress to the number of pixels in the progress bar, // rounding half upwards. uint8_t bar_fill = ((numerator * UPDATE_PROGRESS_MAX) + ((denominator+1)/...
ont, box, GTextOverflowModeWordWrap, GTextAlignmentLeft, (void*)&layout); cl_assert_equal_i(layout.box.size.w, box.size.w); cl_assert_equal_i(layout.max_used_size.w, 2 * HORIZ_ADVANCE_PX); // Back to only JR - as the line being layed out from y=20-30px is empty (and the line from 30-40, Whop, is truncated as it ca...
cl_assert_equal_i(l.flow_data.paging.page_on_screen.size_h, 0)
; } void test_text_layout__enable_paging(void) { TextLayoutExtended l = {}; graphics_text_attributes_enable_paging((GTextLayoutCacheRef) &l, GPoint(1, 2), GRect(3, 4, 5, 6)); cl_assert_equal_i(l.flow_data.paging.origin_on_screen.x, 1); cl_assert_equal_i(l.flow_data.paging.origin_on_screen.y, 2); cl_assert_e...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
while (total_bytes > 0) { watchdog_feed(); uint32_t erase_size = 0; if (((start_addr & SECTOR_ADDR_MASK) == start_addr) && (total_bytes >= SECTOR_SIZE_BYTES)) { erase_size = SECTOR_SIZE_BYTES; flash_impl_erase_sector_begin(start_addr); } else if ((start_addr & SUBSECTOR_ADDR_MASK) =...
watchdog_feed(); } uint32_t cd_flash_write_bytes(const void *buffer_ptr, uint32_t start_addr, const uint32_t buffer_size) { CD_ASSERTN(((start_addr + buffer_size) <= CORE_DUMP_FLASH_END) && (int)start_addr >= CORE_DUMP_FLASH_START); const uint8_t *buffer = buffer_ptr; uin...
f (data_in) { if (settings_file_get_len(&fd, key, key_len) == (int)data_len) { uint8_t curr_val[data_len]; settings_file_get(&fd, key, key_len, &curr_val[0], data_len); // Don't bother rewriting the exact same info. Pairing info is precious, // we want to minimize cases where we ...
shared_prf_storage_get_local_device_name(name, BT_DEVICE_NAME_BUFFER_SIZE)
) { bt_persistent_storage_set_local_device_name(name, BT_DEVICE_NAME_BUFFER_SIZE); } SM128BitKey keys[SMRootKeyTypeNum]; if (shared_prf_storage_get_root_key(SMRootKeyTypeEncryption, &keys[SMRootKeyTypeEncryption]) && shared_prf_storage_get_root_key(SMRootKeyTypeIdentity, &keys[SMRootKeyTypeIdentity])) ...
E, 1024 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 7), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_sector_0(void) { cl_assert(system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test...
if (return_status == FLASH_COMPLETE) { flash_written_data[address - flash_data_start] = data; }
return return_status; } extern void dbgserial_print(char *str) { fprintf(stderr, "%s", str); } extern void dbgserial_print_hex(uint32_t num) { fprintf(stderr, "0x%.08x", num); } extern void dbgserial_putstr(char *str) { fprintf(stderr, "%s\n", str); }
// Handle any heap corruption that may have been detected while the heap was locked. if (heap->corrupt_block != NULL) { heap->corruption_handler(heap->corrupt_block); heap->corrupt_block = NULL; } } static void prv_handle_corruption(Heap * const heap, void *ptr) { if (heap->corruption_handler) { h...
{ heap->double_free_handler = double_free_handler; }
void heap_set_corruption_handler(Heap *heap, CorruptionHandler corruption_handler) { heap->corruption_handler = corruption_handler; } void *heap_malloc(Heap* const heap, unsigned long nbytes, uintptr_t client_pc) { // Check to make sure the heap we have is initialized. UTIL_ASSERT(heap->begin); /* Convert t...
_equal_i(hr_zone_time_s[HRZone_Zone2], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 10); prv_inc_time(10); prv_put_bpm_event(ZONE_1_HR, HRMQuality_Good); workout_service_get_current_workout_hr_zone_time(hr_zone_time_s); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 10); cl_assert_equal_i(hr_zone_...
(30 * SECONDS_PER_MINUTE)
; // Make sure notification is not sent yet and the workout is still ongoing cl_assert_equal_b(s_abandoned_workout_notification_sent, false); cl_assert_equal_b(workout_service_is_workout_ongoing(), true); // Wait 25 minutes, call evented timer callback and make sure the notification is sent prv_inc_time(25 ...
(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 + duration_a + 2 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 2); cl_assert_equal_i(prv_count_handler_e...
size_t length) { if (!s_layer_up) { return; } if (length < sizeof((ReliablePacket){0}.s)) { PBL_LOG(LOG_LEVEL_DEBUG, "Received malformed response packet"); prv_bounce_ncp_state(); return; } ReliablePacket *packet = raw_packet; if (!packet->is_supervisory) { PBL_LOG(LOG_LEVEL_DEBUG, "Re...
(s_tx_lock)
; #define ON_PACKET(...) #define ON_TRANSPORT_STATE_CHANGE(UP_HANDLER, DOWN_HANDLER) \ DOWN_HANDLER(); #include "console/pulse2_reliable_protocol_registry.def" #undef ON_PACKET #undef ON_TRANSPORT_STATE_CHANGE } static void prv_on_receive_code_reject(PPPControlProtocol *this, ...
Prepare the new FD FileDesc *file_desc = &PFS_FD(fd); File *file = &PFS_FD(fd).file; file_desc->fd_status = FD_STATUS_UNREFERENCED; // set to IN_USE on success if ((file->name = kernel_strdup(name)) == NULL) { res = E_OUT_OF_MEMORY; goto cleanup; } file->namelen = strlen(name); file->start_offset...
MIN(data_len - i, copy_buf_size)
; if (do_copy) { prv_flash_read(buf, to_copy, base_addr + i); pfs_write(fd, buf, to_copy); } else { pfs_read(fd, buf, to_copy); prv_flash_write(buf, to_copy, base_addr + i); } } } kernel_free(buf); return (S_SUCCESS); } static void recover_region_from_file(i...
_timestamp(sensor_timestamp_before); uint32_t end_time = prv_sensortime_to_timestamp(sensor_timestamp_after); uint32_t sample_time_bit = prv_get_sample_collection_bit(); // see if the upper bits oveflowed uint32_t upper_bits_mask = ~((0x1 << sample_time_bit) - 1); start_time &= upper_bits_mask; end_time &...
if (!anymotion) { BMI160_DBG("Wahh, no motion/tap?: INT0: 0x%"PRIx8", INT2: 0x%"PRIx8, int0_status, int2_status); prv_dump_int_stats(); }
if (toggled_power_mode) { bmi160_set_accel_power_mode(BMI160_Accel_Mode_Low); } } // TODO: strictly for debug, remove when done static void prv_dump_int_stats(void) { for (uint8_t addr = 0x1b; addr <= 0x1f; addr++) { BMI160_DBG("0x%"PRIx8" = 0x%"PRIx8, addr, bmi160_read_reg(addr)); } BMI160_DBG("La...
prv_handle_receiving_footer_complete_isr); } static void prv_handle_status_exchange_complete_isr(bool *should_context_switch) { uint32_t crc = crc32(CRC32_INIT, &s_spi_transport.status_remote, sizeof(s_spi_transport.status_remote)); if (crc != CRC32_RESIDUE) { PBL_LOG...
analytics_logging_log_event(&event_blob)
; #endif } static void prv_int_exti_cb(bool *should_context_switch) { // The controller responded -- stop the watchdog. prv_watchdog_stop(); switch (s_spi_transport.state) { case SPITransportState_Idle: // If the RX buffer is full, defer ack'ing the Dialog INT until we have // some room to actua...
new remote StoredRemote *remote = stored_remote_create(); remote->classic.bd_addr = *addr; prv_copy_device_name_with_fallback(remote, name); if (is_connected && (0 == memcmp(addr, &active_addr, sizeof(*addr)))) { remote->classic.connected = true; } else { remote->classic.connected = false; } ad...
if (!data->remote_list_head) { strncpy(data->header_buffer, i18n_get("Pairing Instructions", data), HEADER_BUFFER_SIZE); } else { const unsigned int num_remotes = list_count(data->remote_list_head); sniprintf(data->header_buffer, HEADER_BUFFER_SIZE, (num_remotes != 1) ? i18n_get("%u Paired P...
} void settings_bluetooth_update_remotes(SettingsBluetoothData *data) { settings_bluetooth_update_remotes_private(data); settings_menu_reload_data(SettingsMenuItemBluetooth); } ////////// static void prv_settings_bluetooth_event_handler(PebbleEvent *event, void *context) { SettingsBluetoothData* settings_data...
p, "draw_round_rect_across_nx_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_across_y_offset_layer.${BIT_DEPTH_NAME}.pbi"));...
(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")
window_destroy(window)
; } int main(void) { init(); app_event_loop(); deinit(); }
/* * 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...
{ strcpy(buffer, "{NULL UUID}"); return; }
// For reference... // {12345678-1234-5678-1234-567812345678} *buffer++ = '{'; for (uint32_t i = 0; i < sizeof(Uuid); i++) { if ((i >= 4) && (i <= 10) && ((i % 2) == 0)) { *buffer++ = '-'; } buffer += snprintf(buffer, 3, "%02"PRIx8, ((uint8_t *)uuid)[i]); } *buffer++ = '}'; *buffer =...
{ //> TEST_NAME raise_arm //> TEST_EXPECTED 0 //> TEST_EXPECTED_MIN 0 //> TEST_EXPECTED_MAX 50 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { { 153, 301, -947}, { 91, 263, -925}, { 126, 235, -938}, { 136, 199, -947}, { 153, 201, -943}, { 152, 209, -931}, { 107, 198, -925},...
{ -170, -277, -822}, { -185, -270, -831}, { -201, -275, -867}, { -194, -282, -886}, { -203, -285, -887}, { -197, -281, -885}, { -201, -257, -896}, { -202, -269, -875}, { -202, -239, -890}, { -209, -237, -866}, { -196, -238, -866}, { -186, -238, -841}, { -187, -249, -...
emaphoreCreateBinary(); } // ------------------------------------------------------------------------------------------------- // Helpers static uint32_t prv_remaining_ms(uint32_t timeout_ms_in, RtcTicks start_ticks) { const RtcTicks now = rtc_get_ticks(); const uint32_t elapsed_ms = (((now - start_ticks) * 1000...
comm_session_is_valid(session)
) { max_length = DEFAULT_KERNEL_SENDER_MAX_PAYLOAD_SIZE; } } bt_unlock(); return max_length; } SendBuffer * comm_session_send_buffer_begin_write(CommSession *session, uint16_t endpoint_id, size_t required_payload_length, ...
/* * 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...
(size == sizeof(Dictionary))
s active, ensure that asking if a sleep session is ongoing returns false cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Sleep)); cl_assert_equal_i(0, health_service_peek_current_activities()); // Start on known boundary struct tm start_tm = { // Jan 1, 2015, 5am ...
(ActivitySessionType_Sleep)
); cl_assert_equal_i(HealthActivityRun | HealthActivityWalk | HealthActivitySleep , health_service_peek_current_activities()); } static void prv_set_median_hr_for_minutes(int bpm, int num_minutes) { const int num_samples = 15; activity_private_state()->hr.num_samples = num_samples; memset(activity_private_stat...
ou may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See th...
{ return s_next_app.wakeup_info; }
// --------------------------------------------------------------------------------------------- //! This is the wrapper function for all apps here. It's not allowed to return as it's //! the top frame on the stack created for the application. static void prv_app_task_main(void *entry_point) { app_state_init(); t...
"😟", "😩", "😭", "😴", "😐", "😯", "👍", "👎", "👌", "💩", "🎉", "🍺", }; ActionMenuLevel *root_level = action_menu_level_create(ARRAY_LENGTH(thin_values)); action_menu_level_set_display_mode(root_le...
action_menu_level_create(1)
; action_menu_level_add_action(voice_level, "This won't be seen", prv_noop_action_callback, NULL); action_menu_level_add_child(root_level, voice_level, "I will text back"); ActionMenuLevel *template_level = action_menu_l...
more than needed, see comment with the `final_size` test uint8_t buffer[size + surplus]; // Write: DictionaryIterator iter; DictionaryResult result; result = dict_write_begin(&iter, buffer, sizeof(buffer)); cl_assert(result == DICT_OK); result = dict_write_data(&iter, SOME_DATA_KEY, SOME_DATA, sizeof(SO...
(int8_found)
; cl_assert(int16_found); cl_assert(int32_found); cl_assert(null_cstring_found); cl_assert(empty_cstring_found); } void test_dict__out_of_storage(void) { uint8_t buffer[1]; DictionaryIterator iter; DictionaryResult result; result = dict_write_begin(&iter, buffer, 0); cl_assert(result == DICT_NOT_ENOU...
nal pull-up, so we should always be open-drain const bool is_open_drain = true; #else // If we raise the baud rate above 115200 we need to configure as push-pull to ensure we are // sufficiently driving the line. Ideally, the accessory would have a strong-enough pull-up, but // now that we've released use of th...
(xSemaphoreTake(s_send_semaphore, portMAX_DELAY) == pdPASS)