prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
it(0, 0x1000000); pfs_init(false); } void test_settings_file__cleanup(void) {} #include <stdio.h> #define PRIb8 "%d%d%d%d%d%d%d%d" #define TO_BINARY(byte) \ (byte & 0x80 ? 1 : 0), \ (byte & 0x40 ? 1 : 0), \ (byte & 0x20 ? 1 : 0), \ (byte & 0x10 ? 1 : 0), \ (byte & 0x08 ? 1 : 0), \ (byte & 0x04 ? 1 : 0...
for (uint32_t i = 0; i < NUMBER_ENTRIES; i++) { settings_file_set(&file, (uint8_t *)&i, sizeof(uint32_t), (uint8_t *)&value, sizeof(uint32_t)); }
for (uint32_t i = 0; i < LOOPS; i++) { // increment value of all NUMBER_ENTRIES entries for (uint32_t j = 0; j < NUMBER_ENTRIES; j++) { if (manual && (j % 10 == 0)) { cl_must_pass(settings_file_compact(&file)); } settings_file_get(&file, (uint8_t *)&j, sizeof(uint32_t), ...
/* * 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...
(context, (GPoint){0, 0}, (GPoint){100, 100})
; graphics_draw_line(context, (GPoint){0, 10}, (GPoint){100, 10}); graphics_draw_line(context, (GPoint){0, 20}, (GPoint){100, 20}); graphics_draw_line(context, (GPoint){0, 30}, (GPoint){100, 30}); graphics_draw_circle(context, (GPoint){50, 50}, 20); app_event_loop(); return 0; }
tivity/activity_algorithm.h" #include "services/normal/activity/activity_private.h" #include "services/normal/activity/kraepelin/activity_algorithm_kraepelin.h" #include "services/normal/data_logging/data_logging_service.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/protobuf_log/protobuf_log....
cl_assert(session < s_hrm_next_session_ref)
; s_hrm_manager_update_interval = update_interval_s; s_hrm_manager_expire_s = expire_s; s_hrm_manager_num_update_interval_changes++; return true; } HRMSessionRef sys_hrm_manager_app_subscribe(AppInstallId app_id, uint32_t update_interval_s, uint16_t expire_s, HRMFeat...
-168}, { 112, 976, 0}, // 2 seconds { 120, 1096, -120}, { 128, 936, -184}, { 80, 888, -184}, { 16, 832, -88}, { -8, 864, -72}, { -96, 936, 168}, { -32, 880, -64}, { -56, 952, 64}, { -56, 904, 80}, { -64, 840, -24}, { -120, 808, 32}, { -184, 824, 80}, { -104, 8...
{ -688, 288, -16}, { -760, 208, 56}, { -736, 176, 48}, { -688, 168, 80}, { -960, 376, -8}, { -1152, 360, 0}, { -1984, 672, -144}, { -1088, 536, -360}, { -1440, 528, -512}, // 8 seconds { -1480, 448, -496}, { -1320, 360, -464}, { -1088, 144, -328}, { -920, -56, -16...
{ -992, 120, -88}, { -992, 104, -16}, { -1040, 56, 32}, { -1088, 72, 8}, { -1112, 112, 0}, { -1184, 112, 8}, { -984, -64, 8}, { -1024, -128, -80}, { -1064, 40, -344}, { -960, 32, -504}, { -1272, -136, -392}, { -1384, -240, -160}, { -1424, -32, -136}, { -1192, 248...
), 2, PebbleTask_App); load_fixture_on_pfs(APP2_APP_FIXTURE_NAME, filename_buf); resource_storage_get_file_name(filename_buf, sizeof(filename_buf), 2); load_fixture_on_pfs(APP2_RESOURCES_FIXTURE_NAME, filename_buf); } void test_app_install_manager__cleanup(void) { } /***************...
(false, app_install_has_worker(music_id))
; cl_assert_equal_b(false, app_install_has_worker(sports_id)); cl_assert_equal_b(true, app_install_has_worker(bg_counter_id)); cl_assert_equal_b(false, app_install_has_worker(menu_layer_id)); cl_assert_equal_b(false, app_install_has_worker(CRAZY_ID)); } void test_app_install_manager__is_hidden(void) { cl_a...
ership mutex_lock_recursive(s_activity_state.mutex); { SettingsFile *file = activity_private_settings_open(); if (file && (s_activity_state.update_settings_counter <= 0)) { // Peridocically save current stats into settings, so that if watch resets or crashes we // don't lose too much info ...
// Send the history update event now if history has changed if (need_history_update_event) { PBL_LOG(LOG_LEVEL_DEBUG, "Sending history update event"); PebbleEvent e = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = HealthEventSignificantUpdate, .data.significant_...
graphics_draw_rotated_bitmap(&ctx, test_image_color, GPointZero, DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_assign_corner_45.Xbit.pbi")); // Top-left center rotation point, Angle 45 setup_test_rotate_...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_color_center_45.Xbit.pbi")
); } void test_graphics_draw_rotated_bitmap__offset_edge(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // bottom edge center rotation point, Angle 2 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_color,...
left, top_left); } // This takes care of all routines since it re-uses existing AA and SW functionality in draw line // and draw circle T_STATIC void prv_draw_round_rect(GContext* ctx, const GRect *rect, uint16_t radius) { const GPoint origin = rect->origin; const int16_t width = rect->size.w; const int16_t heig...
{ // Antialiased and Stroke Width > 1 // Note: stroke width == 2 is rounded down to stroke width of 1 prv_draw_round_rect_aa_stroked(ctx, rect, radius, ctx->draw_state.stroke_width); return; }
ddr == base_addr)) { if (display_logs) { PBL_LOG(LOG_LEVEL_DEBUG, ">> Erasing Addr 0x%"PRIx32, test_addr); } flash_erase_sector_blocking(test_addr); // Verify data was erased status = prv_read_verify_byte(test_addr, 0xFF, FLASH_TEST_ERR_ERASE, 0, display_lo...
(LOG_LEVEL_DEBUG, "Skipping test address 0x%"PRIx32" which is out of range", test_addr)
; break; } // If test_pattern was written over the data_pattern, then return data should be 0 since // data cannot transition from 0 to 1 without an erase; else it will be initial data_pattern status = prv_read_verify_byte(test_addr, data_pattern, FLASH_TEST_ERR_STUCK_AT_HIGH, bitpos, ...
ubtitle_icon_offset_y; // Achieves the design spec'd 6 px horizontal spacing b/w the battery icon and charging icon battery_icon_node->node.margin.w = 7; GTextNode *vertically_centered_battery_icon_node = prv_wrap_text_node_in_vertically_centered_container(&battery_icon_node->node); graphics_text_node_co...
prv_set_glance_icon(settings_glance, new_icon_resource_id)
; } static bool prv_is_pebble_app_connected(void) { return (comm_session_get_system_session() != NULL); } static void prv_event_handler(PebbleEvent *event, void *context) { LauncherAppGlanceStructured *structured_glance = context; PBL_ASSERTN(structured_glance); LauncherAppGlanceSettings *settings_glance = ...
ble the HR sensor in case we turned it off for a while static void prv_update_enable_timer_cb(void *context) { system_task_add_callback(prv_update_hrm_enable_system_cb, NULL); } //! The system task needs its own handler for HRM data since we can't queue up generic events. static void prv_system_task_hrm_handler(void...
(state->queue, &e, 0)
; } else { prv_queue_system_task_event(event); success = system_task_add_callback(prv_system_task_hrm_handler, NULL); } return success; } T_STATIC void prv_charger_event_cb(PebbleEvent *e, void *context) { const PebbleBatteryStateChangeEvent *evt = &e->battery_state; mutex_lock_recursive(s_...
nt8_t *)dest_ptr) = val; return true; case RockyArgTypeInt16: *((int16_t *)dest_ptr) = val; return true; case RockyArgTypeInt32: *((int32_t *)dest_ptr) = val; return true; case RockyArgTypeInt64: *((int64_t *)dest_ptr) = val; return true; case RockyArgTypeDouble...
if (jerry_value_is_number(argv[0])) { return true; }
; *type_error_out = (RockyArgTypeCheckError) { .expected_type_name = ECMA_STRING_TYPE_NUMBER, .arg_offset = 0, }; return false; } static bool prv_check_type_any(const jerry_value_t argv[], RockyArgTypeCheckError *type_error_out) { return true; } static bool prv_check_4x_...
RecognizerEvent rec_event = -1; TouchEvent last_touch_event = { .type = TouchEvent_Liftoff }; RecognizerState new_state; bool updated = false; s_test_impl_data.last_touch_event = &last_touch_event; s_test_impl_data.new_state = &new_state; s_test_impl_data.updated = &updated; NEW_RECOGNIZER(r) = test_re...
(r, &(TouchEvent) { .type = TouchEvent_Touchdown })
; cl_assert_equal_i(last_touch_event.type, TouchEvent_Touchdown); cl_assert_equal_b(updated, true); cl_assert_equal_i(r->state, new_state); } bool s_simultaneous = false; static bool prv_simultaneous_with_cb(const Recognizer *recognizer, const Recognizer *simultaneous_with) {...
, 0, sizeof(s_data)); for (int y = 0; y < HEIGHT; ++y) { for (int x = 0; x < WIDTH; ++x) { packed_pixel_set(s_data, x /* color_index */, x, y, BITS_PER_PIXEL, s_bmp.row_size_bytes); } } memset(dest_bitmap_data, GColorWhite.argb, sizeof(dest_bitmap_data)); #if SCREEN_COLOR_DEPTH_BITS == 8 char pr...
for (int y = 0; y < HEIGHT; ++y) { for (int x = 0; x < WIDTH; ++x) { packed_pixel_set(s_data, x /* color_index */, x, y, BITS_PER_PIXEL, s_bmp.row_size_bytes); } }
memset(dest_bitmap_data, GColorWhite.argb, sizeof(dest_bitmap_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, &s_bmp, GPointZero, compositing_mode, color); switch (compositing_mode) { case GCompOpSet: { if (transparent) { memset(s_palette, color.argb, sizeof(s_palette)); } break;...
te_proc(&layer, &draw_text_single_line_ellipsis_clip_across_nx); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellip...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_nx.${BIT_DEPTH_NAME}.pbi")
); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_outside_x); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_x.${BIT_DEPTH_NAME}.pbi")); } #define RECT_TEXT_0_0 GRect(0, 0, 140,...
either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "services/common/cron.h" #include <pebbleos/cron.h> #include "os/mutex.h" #include "system/passert.h" #include "services/common/regular_timer.h" #include "system/logging.h"...
PBL_ASSERTN(s_list_mutex)
; mutex_lock(s_list_mutex); // can't schedule an already scheduled job PBL_ASSERTN(!prv_is_scheduled(new_job)); // can't schedule after an unscheduled job PBL_ASSERTN(prv_is_scheduled(job)); // copy schedule info from existing job CronJob temp_job = *job; list_init(&temp_job.list_node); temp_job.cb...
ar test_object[] = "var t = typeof _rocky"; // global doesn't exist in plain Jerry context EXECUTE_SCRIPT(test_object); ASSERT_JS_GLOBAL_EQUALS_S("t", "undefined"); // rocky_global_init() injects global... static const RockyGlobalAPI *apis[] = { NULL, }; rocky_global_init(apis); EXECUTE_SCRIPT(te...
jerry_create_external_function(prv_listener_b)
); cl_assert_equal_b(true, rocky_global_has_event_handlers("a")); cl_assert_equal_b(true, rocky_global_has_event_handlers("b")); prv_add_event_listener_to_list("a", jerry_create_external_function(prv_listener_a2)); cl_assert_equal_b(true, rocky_global_has_event_handlers("a")); cl_assert_equal_b(true, rocky_g...
/////////// // ARROW LAYER FUNCTIONS ///////////////////////// //! Hides or shows the arrow (or two arrows, on S4) depending on where the layouts sit within the //! primary layer. static void prv_update_arrow(SwapLayer *swap_layer) { bool hide_it = true; // If there is a current layout, then we will need to compu...
(result, curve->curve)
; break; case ScrollAnimationCurveKind_Interpolator: animation_set_custom_interpolation(result, curve->interpolator); break; } } #endif return result; } static void prv_swap_up_start(Animation *animation, void *context) { SwapLayer *swap_layer = (SwapLayer *)context; prv_annou...
ACY_CMD_REQUEST_INTERVAL = 0x1, // for backwards compatibility CMD_SET_INTERVAL = 0x2, CMD_REQUEST_POLL = 0x3, } PollRemoteCommand; // Deprecated -- used to set the mail poll interval typedef struct PACKED { uint8_t cmd; uint8_t interval_minutes; } PollLegacySetIntervalMessage; // Poll a service at a specific...
(msg->service, MIN_INTERVAL_MINUTES, msg->interval_minutes)
; break; } default: { PBL_LOG(LOG_LEVEL_ERROR, "Invalid command."); return; } } } /* * Public */ static void poll_service_system_task_callback(void *data) { PBL_ASSERTN(s_running); for_each_context(context_interval_check); } static void poll_service_timer_callback(void *data) { ...
t i = 0; i < 5; i++) { // Each write is 1/8 to 1/4 of the initial file size. int num_bytes = DLS_FILE_INIT_SIZE_BYTES/8 + (rand() % DLS_FILE_INIT_SIZE_BYTES/8); // By doing 16 loops, we are sure to cycle through the allocated file size at least twice. for (int j=0; j<16; j++) { prv_log_consume_ra...
while (did_some) { did_some = false; for (int i = 0; i < 10; i++) { unsigned int nb = rand() % 300; nb = MIN(nb, bytes_left[i]); if (!nb) { continue; } did_some = true; prv_data_log_chain(logging_sessions[i], buf[i], item_size, nb); bytes_left[i] -= nb; bu...
for (int i = 0; i < 10; i++) { prv_check_session_data(logging_sessions[i], crcs[i], buf_size[i]); } } // ---------------------------------------------------------------------------------------- static void prv_do_recovery_test(int num_sessions) { unsigned int num_bytes[num_sessions]; uint32_t crcs[num_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_last_event.type, PEBBLE_NULL_EVENT)
; cl_assert(!s_times_callback_executed); for (int i = 0; i < 10; ++i) { // Fire the timer on "the timer task" stub_new_timer_fire(sys_timer_id); // We know have an event to run on "the app task" cl_assert_equal_i(s_last_event.type, PEBBLE_CALLBACK_EVENT); cl_assert(s_times_callback_executed ==...
AppUIState ui_state; } ReminderAppData; static void prv_create_reminder(ReminderAppData *data) { AttributeList pin_attr_list = {0}; attribute_list_add_uint32(&pin_attr_list, AttributeIdIconTiny, TIMELINE_RESOURCE_NOTIFICATION_REMINDER); attribute_list_add_cstring(&pin_attr_list, Attri...
strlen(data->reminder_str)
; const size_t date_time_len = 32; // "September 19th 9:05pm", "Yesterday 12:33pm" const size_t required_buf_size = sentence_len + date_time_len + 2 /* \n\n */ + 1 /* \0 */; data->dialog_text = app_zalloc_check(required_buf_size); // The string that is being built below looks something like: // "Take out the...
/* * 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...
CREATE_DMA_STREAM(2, 4)
em_task_callbacks_invoke_pending(); uint8_t buffer[num_ops * VALID_OBJECT_SIZE]; for (size_t i = 0; i < sizeof(buffer); i += VALID_OBJECT_SIZE) { uint32_t towrite = i; memcpy(&buffer[i], &towrite, sizeof(towrite)); } // Make sure we can receive new data in the middle of a pb_storage_append operation ...
(ObjectFirmware, VALID_OBJECT_SIZE)
; } //////////////////////////////////////////////////////////////////////////////////////////////////// // Install Message void test_put_bytes__install_message_while_not_idle(void) { prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); prv_process_and_reset_test_counters(); prv_receive_install(s_last_response...
ose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = ANIMATION_DURATION_INFINITE; kino_player_play(test_player); animation_set_elapsed(test_player->animation, 20); animation_set_duration(test_player->animation, 300);...
(test_player->animation, 0)
; // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 300 - 20); } void test_kino_player__create_infinite_animation_finite_reel_reverse(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->...
et("Steps", headings), headings_buf_size); string_list_add_string(values, values_buf_size, step_str, values_buf_size); } static void prv_add_active_calories_metric_info(StringList *headings, int headings_buf_size, StringList *values, int values_buf_size, ...
{ type = ActivityInsightType_ActivitySessionRun; icon = TIMELINE_RESOURCE_RUN; prv_add_metric_duration_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_avg_pace_metric_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_distance_metric_info(headi...
else if (session->type == ActivitySessionType_Walk) { type = ActivityInsightType_ActivitySessionWalk; icon = TIMELINE_RESOURCE_ACTIVITY; prv_add_metric_duration_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_avg_pace_metric_info(headings, headings_buf_size, values, values...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
flash_read_bytes((void *)&header, BOOT_FPGA_FLASH_ADDR, sizeof header)
-------------------------------------------------------- // Verify that the settings are what we expected from prv_save_known_settings() void prv_assert_known_settings(void) { struct tm time_tm = s_init_time_tm; time_t utc_sec = mktime(&time_tm); rtc_set_time(utc_sec); prv_activity_init_and_set_enabled(true); ...
pfs_close(fd)
; // Save it to the local file system FILE *file = fopen(out_path, "wb"); cl_assert(file != NULL); cl_assert_equal_i(fwrite(buf, size, 1, file), 1); fclose(file); free(buf); printf("\nSaved current settings file to %s", out_path); } // ------------------------------------------------------------------...
////////////////////////////////////////////////////////////////// // Functions for UTF-8 encoded string values //////////////////////////////////////////////////////////////////////////////// jerry_size_t jerry_get_utf8_string_size(const jerry_value_t value) { if (!jerry_value_is_string(value)) { return 0; } ...
EM_ASM_INT({ return __jerry_create_external_function($0); }, handler_p)
; } jerry_value_t jerry_create_number(double value) { return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.ref($0); }, value); } jerry_value_t jerry_create_number_infinity(bool negative) { if (negative) { return JERRY_CREATE_VALUE(-Infinity); } else { return JERRY_CREATE_VALUE(Infinity); } ...
efore we traverse the layer hierarchy to render it. // Also see window_calc_frame() DrawingStateOrigins saved_state; prv_adjust_drawing_state_for_legacy2_apps(&saved_state, ctx, window); layer_render_tree(&window->layer, ctx); prv_restore_drawing_state(&saved_state, ctx); prv_render_legacy2_system_status...
prv_call_click_provider(window)
system/passert.h" #include "util/list.h" #include "util/math.h" #include "util/time/time.h" #include <stdbool.h> #include <string.h> typedef struct DoNotDisturbData { TimerID update_timer_id; bool is_in_schedule_period; bool manually_override_dnd; bool was_active; } DoNotDisturbData; static DoNotDisturbData ...
{ struct tm time; rtc_get_time_tm(&time); return ((time.tm_wday == Saturday || time.tm_wday == Sunday) ? WeekendSchedule : WeekdaySchedule); }
BIT_DEPTH_NAME}.pbi")); #endif } extern uint16_t prv_clamp_corner_radius(GSize size, GCornerMask corner_mask, uint16_t radius); void test_graphics_fill_rect__corner_radius(void) { // Test 0 radius cases cl_assert_equal_i(prv_clamp_corner_radius(GSize(0, 0), GCornerNone, 0),...
(&ctx, 0, 0, 0)
GPoint* rot_points = applib_malloc(path->num_points * sizeof(GPoint)); if (!rot_points) { APP_LOG(APP_LOG_LEVEL_ERROR, GPATH_ERROR); return; } int min_x, max_x, min_y, max_y; GPoint rot_start, rot_end; bool found_start_direction = false; bool start_is_down = false; int16_t *intersections_up = NU...
(intersections_down, intersection_down_count)
; // draw the line segments for (int j = 0; j < MIN(intersection_up_count, intersection_down_count); j++) { int16_t x_a = intersections_up[j]; int16_t x_b = intersections_down[j]; if (x_a != x_b) { if (x_a > x_b) { swap16(&x_a, &x_b); } cb(ctx, i, (Fixed_S16_...
ut, 0, sizeof(name_out)); SMPairingInfo pairing_info_out = {}; bool requires_address_pinning_out = true; uint8_t flags = 0; cl_assert_equal_b(shared_prf_storage_get_ble_pairing_data(&pairing_info_out, name_out, &requires_address_pinning_out, ...
(device_name_out, sizeof(device_name_out))
, true); cl_assert_equal_s(DEVICE_NAME, device_name_out); cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 0); shared_prf_storage_set_local_device_name(NULL); cl_assert_equal_b(shared_prf_storage_get_local_device_name(device_name_out, si...
/* * 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...
(text_layer)
; const GColor bg_color = text_layer->background_color; if (!(gcolor_equal(bg_color, GColorClear))) { graphics_context_set_fill_color(ctx, bg_color); graphics_fill_rect(ctx, &text_layer->layer.bounds); } if (text_layer->text && strlen(text_layer->text) > 0) { graphics_context_set_text_color(ctx, tex...
clock_get_timezone_region_id(void) { return rtc_get_timezone_id(); } void clock_set_timezone_by_region_id(uint16_t region_id) { TimezoneInfo tz_info; prv_clock_get_timezone_info_from_region_id(region_id, rtc_get_time(), &tz_info); prv_update_time_info_and_generate_event(NULL, &tz_info); } void clock_get_frien...
i18n_noop("%b %e, %R")
; } else { time_fmt = i18n_noop("%B %e"); } break; } } else { switch (style) { case FullStyleLower12h: case FullStyleCapital12h: if (with_fulltime) { time_fmt = i18n_noop("%a, %l:%M %p"); } else { time_fmt = i18n_noop("%A"); ...
ime_info->dst_changed || ABS(set_time_info->utc_time_delta) > 15) { alarm_handle_clock_change(); wakeup_handle_clock_change(); cron_service_handle_clock_change(set_time_info); } // TODO: evaluate if these need to change on every time update do_not_disturb_handle_cloc...
(PebbleTask_KernelMain)
; // We make this PebbleEvent static to save stack space static PebbleEvent e; if (event_take_timeout(&e, 1000)) { const PebbleTaskBitset kernel_main_task_bit = (1 << PebbleTask_KernelMain); const bool is_not_masked_out_from_kernel_main = !(e.task_mask & kernel_main_task_bit); if (is_not_...
action_data; time_t new_time = rtc_get_time() + (15 * SECONDS_PER_MINUTE); prv_invoke_remote_action(action_menu, action, pin, (void *)(uintptr_t)new_time); } static void prv_postpone_later_today(ActionMenu *action_menu, const ActionMenuItem *action_menu_item, ...
{ action_menu_level_add_action(root_level, label, prv_action_menu_cb, action); }
} ActionMenuLevel *timeline_actions_create_action_menu_root_level(uint8_t num_items, uint8_t separator_index, TimelineItemActionSource source) { kernel_ui_set_current_timeline_item_action_...
sizeof(s_short_data_fragment) - sn), true); ppogatt_send_next(transport); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment) - sn); if (sn == 0 || sn ...
regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS)
; } fake_comm_session_process_send_next(); prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment) - sn); } // The last straw: for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) { regular_timer_fire_secon...
/* * 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(fpc_pinstrap_get_value() == 0x0)
; s_pinstrap_results[1] = PinstrapResult_Vplus; cl_assert(fpc_pinstrap_get_value() == 0x1); s_pinstrap_results[1] = PinstrapResult_Float; cl_assert(fpc_pinstrap_get_value() == 0x2); s_pinstrap_results[0] = PinstrapResult_Vplus; s_pinstrap_results[1] = PinstrapResult_GND; cl_assert(fpc_pinstrap_get_va...
et_off(); hw_watchdog_freeze(); while (true) { __WFI(); } __builtin_unreachable(); } // Timer0 is very limited -- there is no way to reset the count until it's triggered, so it's // not useful as a generic one-shot. We'll let it run free and calculate deltas. static void prv_timer_enable(void) { timer...
host_transport_set_mcu_int(true)
; prv_wait_for_dma(false); host_transport_set_mcu_int(false); } static void prv_send_response(const uint8_t *buffer, uint16_t len) { uint32_t crc = crc32(CRC32_INIT, buffer, len); s_spi_dma_complete = false; hw_spi_write_buf(s_spi->bus_id, buffer, len, prv_spi_dma_tx_cb, NULL); // Now signal the host tha...
/* * 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...
circular_cache_push(&s_test_cache, &s_test_item[1])
; cl_assert_equal_m(&s_cache_buffer[0], &s_test_item[0], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[1], &s_test_item[2], sizeof(TestCacheItem)); cl_assert_equal_m(&s_cache_buffer[2], &s_test_item[1], sizeof(TestCacheItem)); circular_cache_push(&s_test_cache, &s_test_item[1]); cl_assert_equal_m...
only contains filenames of resource files that don't have corresponding // entries in the app cache. We can safely delete these files. PFSFileListEntry *iter = *resource_list; while (iter) { PBL_LOG(LOG_LEVEL_INFO, "Orphaned resource file removed: %s", iter->name); pfs_remove(iter->name); iter = (PFSF...
mutex_unlock_recursive(s_app_cache_mutex)
; return rv; } void app_cache_flush(void) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); mutex_lock_recursive(s_app_cache_mutex); { pfs_remove(APP_CACHE_FILE_NAME); prv_delete_cached_files(); } mutex_unlock_recursive(s_app_cache_mutex); } //////////////////////////////// // Testing only ////////...
/* * 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...
DEFINE_SYSCALL(DataLoggingResult, sys_data_logging_log, DataLoggingSessionRef session_ref, void* data, uint32_t num_items)
unique // is then one greater than the largest found. status_t rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { WTF; } struct AppDBInitData data = { 0 }; settings_file_each(&s_app_db.settings_file, prv_each_inspect_ids, &data); if (data.max_id == INSTALL_ID_INVALID) { s_next_unique_...
(INSTALL_ID_INVALID)
; if (rv != S_SUCCESS) { return rv; } } app_install_do_callbacks(APP_DB_CLEARED, INSTALL_ID_INVALID, NULL, NULL, NULL); // let app install manager deal with deleting the cache and removing related timeline pins app_install_clear_app_db(); // remove the settings file mutex_lock(s_app_db.mute...
/* * 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...
RCC_GetFlagStatus(RCC_FLAG_IWDGRST)
!= RESET; }
} void menu_layer_update_proc(Layer *scroll_content_layer, GContext* ctx) { MenuLayer *menu_layer = (MenuLayer*)(((uint8_t*)scroll_content_layer) - offsetof(MenuLayer, scroll_layer.content_sublayer)); const GSize frame_size = menu_layer->scroll_layer.layer.frame.size; const int16_t content_top_y = -scroll_...
layer_set_hidden(inverter_layer_get_layer(&menu_layer->inverter), true)
; #if PBL_ROUND prv_set_center_focused(menu_layer, true); #endif } MenuLayer* menu_layer_create(GRect frame) { MenuLayer *layer = applib_type_malloc(MenuLayer); if (layer) { menu_layer_init(layer, &frame); } return layer; } void menu_layer_pad_bottom_enable(MenuLayer *menu_layer, bool enable) { menu_...
oad that is arriving will fill our job queue pre_ack = ((put_jobs->num_ops_pending + 1) < put_jobs->num_allocated_pb_jobs); } put_jobs->need_to_ack_later = !pre_ack; } prv_unlock_pb_job_state(); if (pre_ack) { prv_send_response(ResponseAck, s_pb_state.token); } else if (put_jobs->enable_preac...
{ xSemaphoreTake(s_pb_semaphore, portMAX_DELAY); prv_cleanup(); xSemaphoreGive(s_pb_semaphore); }
static void prv_cleanup_async(void) { system_task_add_callback(prv_cleanup_from_system_task, NULL); } static void prv_fail(uint32_t token) { prv_cleanup_async(); prv_add_nack_system_callback(token); } static void prv_timer_callback(void* data) { PBL_LOG(LOG_LEVEL_WARNING, "Put bytes Tok: %"PRIu32" timed out...
_service_handle_measurement_call_count = 0; s_ble_hrm_push_sharing_request_window_call_count = 0; s_ble_hrm_push_reminder_popup_call_count = 0; s_last_session_ref = ~0; s_next_session_ref = 1234; s_last_disconnected = (BTDeviceInternal) {}; s_last_sharing_request = NULL; s_last_ble_hrm_measurement = (BleH...
(s_sys_hrm_manager_unsubscribe_call_count, 1)
; } void test_ble_hrm__sub_unsub_resub(void) { // Device A subscribes: bt_driver_cb_hrm_service_update_subscription(s_device_a, true); // Expect permissions UI to be presented: prv_assert_permissions_ui_and_respond(true /* is_granted */); // Device A unsubscribes: bt_driver_cb_hrm_service_update_subscrip...
C_AHB3PeriphResetCmd(ahb3_periphs, DISABLE); const uint32_t apb1_periphs = 0 | RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM4 | RCC_APB1Periph_TIM5 | RCC_APB1Periph_TIM6 | RCC_APB1Periph_TIM7 | RCC_APB1Periph_TIM12 | RCC_APB1Periph_TIM13 | RCC_APB1Periph_TIM14 ...
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE)
AttributeList list = {}; prv_set_timeline_icon(&list, TIMELINE_RESOURCE_TIMELINE_SPORTS, 0); attribute_list_add_uint8(&list, AttributeIdSecondaryColor, secondary_color.argb); attribute_list_add_cstring(&list, AttributeIdTitle, "Avalanche at Sharks"); attribute_list_add_cstring(&list, AttributeIdSubtitle, "Q4...
(&list, AttributeIdLocationName, "145 Williams John\n" "Palo Alto")
nclude "graphics_common_stubs.h" #include "stubs_applib_resource.h" static FrameBuffer *fb = NULL; // Setup void test_graphics_draw_stroke_${BIT_DEPTH_NAME}__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); } // Teardown void test_graphics_draw_stroke_${...
{ GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_WIDTH); graphics_draw_line(&ctx, START_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT); ...
#define OFFSET_RECT_NO_CLIP GRect(10, 10, 144, 168) #define OFFSET_RECT_CLIP_XY GRect(10, 10, 30, 40) #define OFFSET_RECT_CLIP_NXNY GRect(10, 10, 30, 40) void test_graphics_draw_stroke_${BIT_DEPTH_NAME}__offset_layer(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Fix o...
UT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "kino_reel_gbitmap_sequence.h" #include "applib/applib_malloc.auto.h" #include "applib/graphics/gbitmap_sequence.h" #include "syscal...
gbitmap_sequence_get_bitmap_size(sequence)
, GBitmapFormat8Bit); // Render initial frame upon load prv_elapsed_setter((KinoReel *)reel, 0); } return (KinoReel *)reel; } KinoReel *kino_reel_gbitmap_sequence_create_with_resource(uint32_t resource_id) { ResAppNum app_num = sys_get_current_resource_num(...
RECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 2); test_num = (int32_t)((float)-0.625 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 3); test_num =...
memcmp(&num, &test_num, sizeof(Fixed_S16_3))
== 0); // overflowing positively from 4095.875 results in going to -4096 num.raw_value++; cl_assert(num.integer == -4096); cl_assert(num.fraction == 0); } void test_math_fixed__Fixed_S16_3_rounded_int(void) { cl_assert_equal_i(0, Fixed_S16_3_rounded_int(Fixed_S16_3(0))); cl_assert_equal_i(0, Fixed_S16_3_r...
_points(&center, s_fill_points, s_path_num_points)); prv_reset(); // restore stroke color and set radius to zero - only a stroke should be drawn gdraw_command_set_stroke_color(command, GColorPurple); gdraw_command_set_radius(command, 0); gdraw_command_draw(NULL, command); cl_assert_equal_i(s_stroke_color.a...
(ctx, command_list)
; cl_assert_equal_i(s_path_stroke_count, 1); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_circle_stroke_count, 1); cl_assert_equal_i(s_circle_fill_count, 1); prv_reset(); gdraw_command_list_get_command(command_list, 0)->hidden = true; gdraw_command_list_draw(ctx, command_list); cl_asser...
too short to be valid!"); return false; } const size_t payload_size = (tuple->length - sizeof(PostMessageChunkPayload)); const bool is_expecting_first = (s_state.in.reassembly_buffer == NULL); if (chunk->is_first != is_expecting_first) { PBL_LOG(LOG_LEVEL_ERROR, "Chunk reassembly out of sync! is_first=...
dict_write_data(it, node->key, node->data, node->length)
; dict_write_end(it); PBL_ASSERTN(s_state.out.msg_type == OutboxMsgTypeNone); s_state.out.msg_type = OutboxMsgTypeControl; PBL_ASSERTN(APP_MSG_OK == app_message_outbox_send()); } static void prv_control_message_queue_add(uint32_t key, const void *data, const size_t length) { MessageNode *node = (MessageNod...
/* * 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...
list_insert_before(list_get_head(node), new_node)
; } ListNode* list_get_next(ListNode* node) { if (node == NULL) { return NULL; } return node->next; } ListNode* list_get_prev(ListNode* node) { if (node == NULL) { return NULL; } return node->prev; } ListNode* list_get_tail(ListNode* node) { if (node == NULL) { return NULL; } while (nod...
DictionaryIterator *it = NULL; app_message_outbox_begin(&it); if (!it) { // FIXME: Handle not being able to open inbox ?? WTF; } dict_write_data(it, node->key, node->data, node->length); dict_write_end(it); PBL_ASSERTN(s_state.out.msg_type == OutboxMsgTypeNone); s_state.out.msg_type = OutboxMsg...
APP_LOG(APP_LOG_LEVEL_WARNING, "Failed to send message: Reason %d", reason)
; ++s_state.out.failure_count; prv_handle_outbox_result(reason); } //////////////////////////////////////////////////////////////////////////////// // Unsupported Protocol //////////////////////////////////////////////////////////////////////////////// static bool prv_is_version_supported(const PostMessageResetCo...
t_args_for_mock = (ArgsForMock){ .ctx = *ctx, .r0 = *rect, .radius = 0, .corner_mask = GCornerNone }; strncpy(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func)); } void prv_draw_rect_aa_stroked(GContext *ctx, const GRect *rect, uint8_t stroke_width) { s_last_args_for_mock = (...
memcpy(actual_args, last_args, sizeof(ArgsForMock))
; } // Zero out the arguments from the last run static void reset_last_args_for_mock() { memset(&s_last_args_for_mock, 0x00, sizeof(s_last_args_for_mock)); } // Validate the arguments based on the shape that is drawn static bool validate_args(ArgsForMock *actual_args, ArgsForMock *valid_args) { if (memcmp(actual_...
/* * 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_data->ready_to_send = false; }
else { PBL_LOG(LOG_LEVEL_DEBUG, "Error sending message: %s", prv_translate_error(result)); } } static void prv_send_status_and_version(void) { AppData *app_data = app_state_get_user_data(); PBL_LOG(LOG_LEVEL_DEBUG, "Sending status and version to mobile app"); AppMessageResult result = app_message_outbox_...
printf if we don't have sufficient stack space, so fill in // a default log message uint32_t stack_space = sys_stack_free_bytes(); if (stack_space < LOGGING_MIN_STACK_FOR_SPRINTF) { strncpy(msg->message, LOGGING_STACK_FULL_MSG, max_message_length); msg->message[max_message_length-1] = 0; msg->message...
(bin_args, args)
/* * 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...
((i * ANIMATION_NORMALIZED_MAX) / num_frames, -20000, 20000)
, expected[i]); } } void test_animation_interpolate__moook_in(void) { const int expected[] = {-20000, -19999, -19980}; const int num_frames = ARRAY_LENGTH(expected); for (int i = 0; i < num_frames; i++) { printf("frame: %d\n", i); cl_assert_equal_i(interpolate_moook_in_only((i * ANIMATION_NORMALIZED_MA...
ck); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__color(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 20, 10...
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 4); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw4_clip_xy.$...
_set_valid_page_number(SPRF_NUM_PAGES - 1); shared_prf_storage_set_getting_started_complete(GETTING_STARTED_COMPLETE); flash_write_bytes((uint8_t *)&new_crc, SPRF_PAGE_FLASH_OFFSET(shared_prf_storage_get_valid_page_number()) + offsetof(SharedPRFData, ge...
(&PAIRING_INFO, DEVICE_NAME, true /* requires_address_pinning */, true /* auto_accept_re_pairing */)
; // It should detect the fields were already blank in the current page so the index should not // increment cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 2); } // Test that if we try to write the same data, the system does not force a rewrite of the page void test_shared_prf_storage_v3__write_re...
ostFunctionsTestProcessor *processor_with_data = (PreAndPostFunctionsTestProcessor *)processor; // Record the existing compositing mode and tint color and check that they are what we expect cl_assert(ctx->draw_state.compositing_mode == EXPECTED_COMPOSITING_MODE_BEFORE_AND_AFTER_PRE_FUNCTION); p...
(gcolor_equal(s_ctx.draw_state.tint_color, EXPECTED_TINT_COLOR_BEFORE_AND_AFTER_PRE_FUNCTION))
/* * 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 resource_id = sys_resource_load_file_as_resource(TEST_IMAGES_PATH, TEST_PDC_FILE); cl_assert(resource_id != UINT32_MAX); // Test Command_Image GDrawCommandImage *image = gdraw_command_image_create_with_resource(resource_id); cl_assert(image == NULL); // Test Command Sequence GDrawCommandS...
12, 0), .future_fin_offset_y = PBL_IF_ROUND_ELSE(-20, 0), .past_top_margin = PBL_IF_RECT_ELSE(10, 18), .future_top_margin = PBL_IF_RECT_ELSE(10, 39), .left_margin = MARGIN_MEDIUM, .right_margin = MARGIN_MEDIUM, .icon_right_margin = MARGIN_MEDIUM, .fat_pin_height = 110, // PBL-42540: This property is dep...
prv_get_style()
; GRect frame; prv_get_frame(layer, index, &frame); frame.origin.y += style->icon_offset_y; // Remove sidebar and apply icon margin frame.size.w += style->right_margin - style->icon_right_margin; timeline_layout_get_icon_frame(&frame, layer->scroll_direction, icon_frame); } static void prv_get_icon_frame_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...
cl_assert(list_contains((const ListNode *) s_session_head, &session->node))
; if (session->temp_write_buffer) { kernel_free(session->temp_write_buffer); } list_remove(&session->node, (ListNode **) &s_session_head, NULL); kernel_free(session); ++s_session_close_call_count; } void comm_session_receive_router_write(CommSession *session, const ...
0); // CRG_TOP REG_SETF(CRG_TOP, BANDGAP_REG, BYPASS_COLD_BOOT_DISABLE, 0x0); REG_SETF(CRG_TOP, BANDGAP_REG, LDO_SLEEP_TRIM, 0x0); REG_SETF(CRG_TOP, BANDGAP_REG, BGR_ITRIM, 0x0); REG_SETF(CRG_TOP, BANDGAP_REG, BGR_TRIM, 0x0); REG_SETF(CRG_TOP, BOD_STATUS_REG, BOD_VBAT_LOW, 0x0); REG_SETF(CRG_TOP, BOD_S...
(QSPIC, QSPIC_BURSTBRK_REG, QSPIC_SEC_HF_DS, 0x0)
/* * 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_scroll_layer_is_paging_enabled(scroll_layer)
date_text(data); // Subscribe to health update events health_service_events_subscribe(prv_health_event_handler, data); // Set a heart rate alert HealthMetricAlert *alert = health_service_register_metric_alert(HealthMetricHeartRateBPM, 80); APP_LOG(APP_LOG_LEVEL_INFO, "health metric alert: %p", alert); if ...
{ HealthAPITestAppData *data = (HealthAPITestAppData *)context; window_stack_pop(true); window_stack_push(data->steps_window, true /* Animated */); }
// ------------------------------------------------------------------------------- static void prv_hr_down_click_handler(ClickRecognizerRef recognizer, void *context) { HealthAPITestAppData *data = (HealthAPITestAppData *)context; window_stack_pop(true); window_stack_push(data->sleep_window, true /* Animated *...
* Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in ...
{ GATT_LOG_DEBUG("gatt_wrapper_write_no_resp: handle: %d", handle); const GattRespDest resp_dest = GattRespDestNone; if (!prv_enqueue(conn_idx, 0, resp_dest, GattOpType_Write)) { return BLE_ERROR_NOT_CONNECTED; } const bool signed_write = false; ble_error_t rv = ble_gattc_write_no_resp(conn_idx, handle...
c bool prv_get_key_for_bt_classic_addr_itr(SettingsFile *file, SettingsRecordInfo *info, void *context) { // check entry is valid if (info->val_len == 0 || info->key_len != sizeof(BTBondingID)) { return true; // continue iterating } KeyForBTCAddrData *itr_dat...
{ BtPersistBondingData deleted_data; if (!prv_delete_pairing_with_type_by_id(bonding, BtPersistBondingTypeBTClassic, &deleted_data)) { return; } prv_call_bt_classic_bonding_change_handlers(bonding, BtPersistBondingOpWillDelete); // TODO: Check that the address matches the one we have stored shared_prf_...
void bt_persistent_storage_delete_bt_classic_pairing_by_addr(const BTDeviceAddress *bd_addr) { if (!bd_addr) { return; } BTBondingID key = prv_get_key_for_bt_classic_addr(bd_addr); bt_persistent_storage_delete_bt_classic_pairing_by_id(key); } bool bt_persistent_storage_get_bt_classic_pairing_by_id(BTBo...
ure the files are still there! for (int i = 0; i < pages_to_write; i+=2) { snprintf(file_small, sizeof(file_small), "file%d", i); uint8_t buf[PFS_SECTOR_SIZE * 2]; uint8_t bufcmp[PFS_SECTOR_SIZE * 2]; memset(&bufcmp[0], i, sizeof(bufcmp)); int fd = pfs_open(file_small, OP_FLAG_READ, FILE_TYPE_...
(filename)
; } } test_force_garbage_collection(pages_per_sector); for (int i = 0; i < expected_remaing_files; i++) { char filename[20]; sprintf(filename, "test%d", i + start_page_offset); int fd = pfs_open(filename, OP_FLAG_READ, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); pfs_close(fd); } } void...
/* * 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(system_flash_erase(FLASH_BASE + 25 KiB, 871 KiB - 1, NULL, NULL))
; cl_assert_equal_i(BITS_BETWEEN(1, 10), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_sectors_1_thru_11(void) { cl_assert(system_flash_erase(FLASH_BASE + 25 KiB, 871 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(1, 10), erased_sector); cl_assert(flash_locked); } void callback...
graphics_draw_vertical_line_dotted(&ctx, GPoint(50, 90), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(46, 95), 5); // T facing right - odd vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(71, 91), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(67, 96), 5); // T facing lef...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_dotted_line_cross_color")))
; } static void draw_lines_same_point(GContext *ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_stroke_width(ctx, 1); graphics_draw_line(ctx, GPoint(10,10), GPoint(10,10)); graphics_context_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, 1); graphics_draw_line(...
ing = false; #endif int16_t offset = prv_get_current_notification_offset(swap_layer); int16_t max_dy = prv_get_max_scroll_dy(swap_layer); // distance to scroll int16_t dy = 0; // check if we are going to go off screen, if so get a new layer and set it up, then animate. switch (direction) { case Scrol...
prv_get_current_notification_offset(swap_layer)
; if (offset != 0) { prv_announce_interaction(swap_layer); prv_attempt_swap(swap_layer, ScrollDirectionDown, true /* to_top */); } } static void prv_raw_click_handler(ClickRecognizerRef recognizer, void *context) { SwapLayer *swap_layer = (SwapLayer *)context; // Ignore any press that isn't the start 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...
{ config->common.button = click_recognizer_get_button_id(recognizer); app_manager_put_launch_app_event(config); }
#if CAPABILITY_HAS_SDK_SHELL4 static void prv_launch_launcher(ClickRecognizerRef recognizer, void *data) { static const LauncherMenuArgs s_launcher_args = { .reset_scroll = true }; prv_launch_app_via_button(&(AppLaunchEventConfig) { .id = APP_ID_LAUNCHER_MENU, .common.args = &s_launcher_args, }, recogni...
896}, { -424, 288, -904}, { -424, 288, -896}, { -424, 280, -896}, { -424, 280, -896}, { -424, 280, -896}, { -424, 280, -904}, { -424, 280, -896}, { -424, 288, -904}, { -432, 280, -896}, { -424, 288, -896}, { -424, 288, -904}, // 164 seconds { -424, 280, -896}, { -...
{ -416, 176, -944}, { -416, 168, -944}, // 169 seconds { -408, 176, -944}, { -416, 168, -944}, { -408, 176, -936}, { -416, 176, -936}, { -416, 168, -936}, { -416, 176, -936}, { -416, 168, -936}, { -440, 160, -920}, { -352, 224, -1000}, { -272, 336, -1096}, { -424,...
{ -832, -1040, 1016}, { -488, -2832, -48}, { -976, 696, -1024}, { -336, -256, -1168}, { -616, -360, -912}, { -816, -208, -664}, { -800, -216, -768}, { -808, -160, -800}, { -816, -80, -792}, { -792, -48, -600}, { -736, 464, -896}, { -944, 488, -344}, { -784, 1048, -56...
rocky_global_init(s_graphics_api); cl_assert_equal_b(false, rocky_global_has_event_handlers("draw")); EXECUTE_SCRIPT("_rocky.on('draw', function() {});"); cl_assert_equal_b(true, rocky_global_has_event_handlers("draw")); } void test_rocky_api_graphics__draw_event_has_ctx(void) { rocky_global_init(s_graphics...
(10*8, lc->fill_radial_precise.radius_inner.raw_value)
; cl_assert_equal_i(20*8, lc->fill_radial_precise.radius_outer.raw_value); cl_assert_equal_i(TRIG_MAX_ANGLE * 1 / 4, lc->fill_radial_precise.angle_start); cl_assert_equal_i(TRIG_MAX_ANGLE * 3 / 4, lc->fill_radial_precise.angle_end); EXECUTE_SCRIPT( "ctx.rockyFillRadial(30, 40, 10, 30, 0, 2 * Math.PI);\n" ...
); } case ActivitySessionType_Open: { static const InsightCopyVariants s_open_intros = { .num_variants = 5, .variants = { i18n_noop("Workin' up a sweat?"), i18n_noop("Well done 💪"), i18n_noop("Endorphin rush?"), i18n_noop("Can't stop, won't stop 👊...
(step_str, step_buf_size, "%d", session->step_data.steps)
; string_list_add_string(headings, headings_buf_size, i18n_get("Steps", headings), headings_buf_size); string_list_add_string(values, values_buf_size, step_str, values_buf_size); } static void prv_add_active_calories_metric_info(StringList *headings, int headings_buf_size, ...
analytics_heartbeat_set(device_hb, ANALYTICS_DEVICE_METRIC_DEVICE_UP_TIME, current_ticks)
; analytics_heartbeat_set(device_hb, ANALYTICS_DEVICE_METRIC_TIME_INTERVAL, dt_ms); AnalyticsHeartbeatList *app_hb_node = app_hbs; while (app_hb_node) { AnalyticsHeartbeat *app_hb = app_hb_node->heartbeat; analytics_heartbeat_set(app_hb, ANALYTICS_APP_METRIC_TIMESTAMP, timestamp); analytics_heartbeat...
(i, DATA_LOGGING_BYTE_ARRAY, item_size, false /*buffered*/, false /*resume*/, &system_uuid)
; cl_assert(logging_sessions[i]); } // Log Consume for (int i = 0; i < 10; i++) { prv_log_consume_random(logging_sessions[i], item_size, rand() % 16); } } // ---------------------------------------------------------------------------------------- void test_data_logging__log_consume_large_items(void) ...
t, radius); } #endif // SCREEN_COLOR_DEPTH_BITS T_STATIC void prv_draw_round_rect_stroked(GContext* ctx, const GRect *rect, uint16_t radius, uint8_t stroke_width) { // Assumes AA and stroke_width is set appropriately in ctx prv_draw_round_rect(ctx, rect, radius); } static...
PBL_ASSERTN(ctx)
PBL_LOG(LOG_LEVEL_WARNING, "No attributes in message"); voice_handle_dictation_result(VoiceEndpointResultFailInvalidMessage, session_id, NULL, app_initiated, app_uuid); return false; } *app_uuid_out = app_uuid; return true; } static void prv_handle_dictation_result(Voic...
{ case MsgIdSessionSetup: { if (size >= sizeof(SessionSetupResultMsg)) { SessionSetupResultMsg *msg = (SessionSetupResultMsg *) data; bool app_initiated = (msg->flags.app_initiated == 1); voice_handle_session_setup_result(msg->result, msg->session_type, app_initiated); } else { ...
} #else void voice_endpoint_protocol_msg_callback(CommSession *session, const uint8_t* data, size_t size) { } #endif void voice_endpoint_setup_session(VoiceEndpointSessionType session_type, AudioEndpointSessionId session_id, AudioTransferInfoSpeex *info, Uuid *app_uuid) { CommSession *comm_session = comm_sess...
/* * 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(num.raw_value == num2.raw_value)
; } void test_graphics_gtransform_${BIT_DEPTH_NAME}__types_precise(void) { GPointPrecise pointP = GPointPreciseFromGPoint(GPoint(2, 5)); GPointPrecise pointP_c = GPointPrecise((2 % GPOINT_PRECISE_MAX) << GPOINT_PRECISE_PRECISION, (5 % GPOINT_PRECISE_MAX) << GPOINT_PRECISE_...
to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "apps/system_apps/health/health...
prv_create_card_and_render(&health_data)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_activity_summary_card__render_current_behind_typical2(void) { HealthData health_data = { .step_data = 320, .step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10...
/////////////////// // API: "postmessageerror" event //////////////////////////////////////////////////////////////////////////////// static void prv_free_json_buffer_associated_with_postmessageerror_event(const uintptr_t ptr) { task_free((char *)ptr); } JERRY_FUNCTION(prv_postmessageerror_data_getter) { char *js...
if (!data_buffer) { return prv_create_oom_error(); }
tification_layout.h" #include "kernel/ui/kernel_ui.h" #include "process_state/app_state/app_state.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" #include <string.h> // Initial pixel scroll amount, paging_height (LAYOUT_HEIGHT) for circular display #define INITIAL_SCROLL_PX PBL_IF_RE...
{ swap_layer->swap_in_progress = true; if (swap_layer->callbacks.layout_will_appear_handler) { return swap_layer->callbacks.layout_will_appear_handler(swap_layer, layout, swap_layer->context); } }
static void prv_announce_layout_did_appear(SwapLayer *swap_layer, LayoutLayer *layout, int8_t rel_change) { swap_layer->swap_in_progress = false; if (swap_layer->callbacks.layout_did_appear_handler) { swap_layer->callbacks.layout_did_appear_handler(swap_layer, layout...
loc_check(max_attr_length); char *short_subtitle = kernel_zalloc_check(max_attr_length); const uint32_t duration_s = session->length_min * SECONDS_PER_MINUTE; health_util_format_hours_and_minutes(elapsed, max_attr_length, duration_s, &pin_attr_list); const char *short_subtitle_fmt = i18n_get("%s of sleep", &pin...
prv_create_and_push_notification(&config)
; kernel_free(body); } // ----------------------------------------------------------------------------------------- static void prv_push_nap_session(time_t now_utc, ActivitySession *session) { Uuid pin_uuid = UUID_INVALID; TimelineItem *pin_item = prv_create_nap_pin(now_utc, session); if (prv_push_pin(pin_ite...
/* * 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, length)
; } static void prv_endpoint_handler_b( CommSession *session, const uint8_t *data, size_t length) { s_handler_call_count[HandlerB]++; prv_assert_data_matches_expected(data, length); } static void prv_endpoint_handler_c( CommSession *session, const uint8_t *data, size_t length) { s_handler_call_count[Han...
.button_id = button }; event_put(&e); } void command_button_press_short(const char* button_index) { uintptr_t button = (uintptr_t)atoi(button_index); launcher_task_add_callback(prv_button_press_short_launcher_task_cb, (void *)button); prompt_send_response("OK"); } void command_factory_reset(void) { prompt...
flash_expect_program_failure(false)
; watchdog_feed(); } } task_watchdog_bit_set(pebble_task_get_current()); __enable_irq(); } #endif static TimerID s_abusive_timer = TIMER_INVALID_ID; struct WasteTimerData { uint16_t count; uint16_t delay; }; _Static_assert(sizeof(struct WasteTimerData) <= sizeof(uintptr_t), "struct...
app_window_stack_remove(&option_menu->window, true /* animated */); } static void prv_filter_menu_push(SettingsNotificationsData *data) { AlertMask mask = alerts_get_mask(); size_t cycle_len = ARRAY_LENGTH(s_alert_mode_values); size_t index = 0; // TODO PBL-24306: update once AlertMask logic is made safer ...
i18n_noop("10 Minutes")
: %d", s_gc_block.gc_start_page); return (true); } return (false); } return (true); // gc block must be valid to get here } static bool watch_list_find_str(ListNode *node, void *data) { PFSFileChangedCallbackNode *filechg_node = (PFSFileChangedCallbackNode *)node; return (strcmp(filechg_node->n...
mutex_lock_recursive(s_pfs_mutex)
; status_t res = E_UNKNOWN; if (!FD_VALID(fd)) { res = E_INVALID_ARGUMENT; } else { File *f = &PFS_FD(fd).file; char file_name[f->namelen + 1]; file_name[f->namelen] = '\0'; memcpy(file_name, f->name, f->namelen); if ((res = pfs_close(fd)) >= 0) { res = pfs_remove(file_name); }...
void test_rocky_api_app_message__post_message_multi_chunk(void) { prv_init_and_goto_session_open_with_tiny_buffers(); EXECUTE_SCRIPT("var x = { \"x\" : 123 }; _rocky.postMessage(x);"); const char * const expected_json = "{\"x\":123}"; const size_t expected_json_size = strlen(expected_json) + 1; size_t jso...
EXECUTE_SCRIPT_EXPECT_ERROR("_rocky.postMessage({toJSON: function() {throw 'toJSONError';}});", "toJSONError")
; } void test_rocky_api_app_message__postmessage_no_args(void) { prv_init_api(false /* start_connected */); EXECUTE_SCRIPT_EXPECT_ERROR("_rocky.postMessage();", "TypeError: Not enough arguments"); } void test_rocky_api_app_message__postmessage_oom(void) { prv_init_api(false /* start_connected */); fake_mallo...
/* * 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_render(window, &s_ctx)
; return window; } // Tests ////////////////////// void test_health_detail_card__render_no_data(void) { prv_create_card_and_render(&(HealthDetailCardConfig) {}); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_detail_card__render_one_heading(void) { HealthDetailCardConfig conf...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(mfg_info_get_watch_color(), WATCH_INFO_COLOR_RED)
; mfg_info_set_watch_color(WATCH_INFO_COLOR_GREEN); cl_assert_equal_i(mfg_info_get_watch_color(), WATCH_INFO_COLOR_GREEN); } void test_spalding_mfg_info__rtc_freq(void) { cl_assert_equal_i(mfg_info_get_rtc_freq(), 0); mfg_info_set_rtc_freq(0xfefefefe); cl_assert_equal_i(mfg_info_get_rtc_freq(), 0xfefef...
g_default_kernel_receiver_implementation.write(rcv->kernel_receiver, data, header_bytes_to_write)
; rcv->header_bytes_remaining -= header_bytes_to_write; } if (rcv->is_writing_to_app_inbox) { prv_write(data, length); } } static void prv_finally(AppMessageReceiver *receiver, void (*kernel_receiver_finally_cb)(Receiver *)) { kernel_receiver_finally_cb(receiver->kernel_receive...
uffer_size = strlen(message) + 1; data->dialog.message = applib_malloc(message_buffer_size); if (!data->dialog.message) { return false; } strncpy(data->dialog.message, message, message_buffer_size); data->dialog.icon = timeline_res_id; data->dialog.success = success; return true; } static bool prv_sh...
applib_zalloc(sizeof(ActionResultData))
static bool s_kernel_receiver_available; static Receiver *s_kernel_receiver; static bool s_kernel_receiver_is_receiving; static uint8_t s_kernel_receiver_buffer[MAX_HEADER_SIZE]; static off_t s_kernel_receiver_buffer_idx; static bool s_kernel_receiver_finish_called; static bool s_kernel_receiver_cleanup_called; stat...
(s_session, &s_app_message_endpoint, sizeof(AppMessagePush))
; cl_assert(r != NULL); cl_assert_equal_b(true, s_kernel_receiver_is_receiving); s_rcv_imp->write(r, (const uint8_t *)&s_push, sizeof(s_push)); // Expect only up to MAX_HEADER_SIZE bytes has been written: cl_assert_equal_i(s_kernel_receiver_buffer_idx, MAX_HEADER_SIZE); // Check that the header is receive...