prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
stom_interpolation(anim, prv_interpolate_moook_soft); return anim; } // Create animation static void prv_schedule_slide_animation(HealthCardView *health_card_view, Card next_card_index, bool slide_up) { animation_unschedule(health_card_view->slide_animation); health_card_...
for (int i = 0; i < CardCount; i++) { health_card_view->card_layers[i] = s_card_view_create[i](health_data); layer_add_child(window_root, health_card_view->card_layers[i]); }
// set starting card based on launch args HealthLaunchArgs launch_args = { .args = app_launch_get_args() }; health_card_view->current_card_index = (launch_args.card_type == HealthCardType_Sleep) ? Card_SleepSummary : Card_ActivitySummary; // set window background prv_set_window_background_color(heal...
/* * 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_get_config(PebbleTask_Unknown)
/* * 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...
graphics_context_set_antialiased(ctx, false)
; graphics_draw_round_rect(ctx, &GRect(2, 2, 28, 20), 4); } void across_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_round_rect(ctx, &GRect(16, 2, 28, 20), 4); } void across_nx_layer_update_...
/* * 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(0, grect_longest_side(GRectZero)); cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, 10, 20))); cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, 20, 10))); cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, 10, -20))); cl_assert_equal_i(20, grect_longest_side(GRect(0, 0, -20, 10))...
void test_gtypes__grect_shortest_side(void) { cl_assert_equal_i(0, grect_shortest_side(GRectZero)); cl_assert_equal_i(10, grect_shortest_side(GRect(0, 0, 10, 20))); cl_assert_equal_i(10, grect_shortest_side(GRect(0, 0, 20, 10))); cl_assert_equal_i(10, grect_shortest_side(GRect(0, 0, 10, -20))); cl_assert_eq...
/* * 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...
(&utf8_iter, &utf8_iter_state, &utf8_bounds, utf8_bounds.start)
; // Tests int i = 0; do { cl_assert(utf8_iter_state.current < utf8_bounds.end); cl_assert(i < NUM_VALID_CODEPOINTS); uint32_t decoded_codepoint = utf8_iter_state.codepoint; uint32_t actual_codepoint = s_valid_test_codepoints[i]; cl_assert_equal_i(decoded_codepoint, actual_codepoint); ...
/* * 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...
{ // phase 3 use_mutex = true; }
if (use_mutex) { // Logging operations shouldn't take long to complete. Use a timeout in case we run into // an unlikely deadlock situation (one task doing a synchronous log to flash and another task // trying to log from flash code) bool success = mutex_lock_recursive_with_timeout(s_log_state_mutex...
Rule NZ 2008 max - Apr Sun>=1 2:00s 0 S Sep 27th 2014 14:00 UTC ~ Apr 4th 2015 14:00 UTC, GMT+12 */ [24]={ 1411826400, 1428156000,12 * SECONDS_PER_HOUR }, /* Namibia (Namibia) [Africa/Windhoek] Rule Namibia 1994 max - Sep Sun>=1 2:00 1:00 S Rule Namibia 1995 max - Apr ...
if (tz_info.dst_start != s_dst_correct_values[dstid][0]) { printf("start [%d] tz_info: %ld s_dst_correct_values: %ld\n", dstid, tz_info.dst_start, s_dst_correct_values[dstid][0]); }
if (tz_info.dst_end != s_dst_correct_values[dstid][1]) { printf(" end [%d] tz_info: %ld s_dst_correct_values: %ld\n", dstid, tz_info.dst_end, s_dst_correct_values[dstid][1]); } cl_check(tz_info.dst_start == s_dst_correct_values[dstid][0]); cl_check(tz_info.dst_end == s_dst_correct_...
/* * 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...
{ uint8_t *fb_offset = (uint8_t*)compositor_get_framebuffer()->buffer + address; memcpy(fb_offset, buf, length); return length; }
static int framebuffer_domain_stat(uint8_t *resp, size_t resp_max_len, void *context) { FramebufferStatResp *stat_resp = (FramebufferStatResp*) resp; *stat_resp = (FramebufferStatResp) { .flags = 0, .length = FRAMEBUFFER_SIZE_BYTES, .width = DISP_COLS, .height = DISP_ROWS, .bpp = SCREEN_COLOR_...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_launcher_menu_layer__long_title_pdc(void) { s_use_pdc_icons = true; prv_render_launcher_menu_layer(LauncherMenuLayerTestApp_LongTitle); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_launcher_menu_layer__no_icon_pdc(void) { s_use_pdc_icons = true; prv_render_launcher_...
0, GCornerNone, fill_color); // Bottom Rect prv_fill_rect_legacy2(ctx, GRect(bottom_rect_origin_x, rect->origin.y + rect->size.h - radius, bottom_rect_size_w, radius), 0, GCornerNone, fill_color); } } T_STATIC void prv_fill_r...
{ return; }
if (ctx->draw_state.stroke_width <= 2) { // Note: stroke width == 2 is rounded down to stroke width of 1 prv_draw_rect(ctx, rect); return; } #if PBL_COLOR if (ctx->draw_state.antialiased) { // Antialiased and Stroke Width > 2 prv_draw_rect_aa_stroked(ctx, rect, ctx->draw_state.stroke_width);...
s the following: // .x : the number of steps to increment by (either 0 or 1) // .y : the current sleep state // .z : 0 static void prv_feed_cannned_accel_data(uint32_t num_sec, uint32_t steps_per_minute, ActivitySleepState sleep_state) { uint32_t num_steps = (steps_per_minute * num_sec...
(!(record->flags & ACTIVITY_RAW_SAMPLE_FLAG_LAST_RECORD))
; } // Uncompress the entries into samples uint32_t num_samples_seen = 0; for (int j = 0; j < record->num_entries; j++) { uint32_t encoded = record->entries[j]; uint32_t run_size = ACTIVITY_RAW_SAMPLE_GET_RUN_SIZE(encoded); AccelRawData sample = (AccelRawData) { .x = ACTIVITY...
struct LCPPacket *packet) { if (this->state->link_state == LinkState_AckReceived || this->state->link_state == LinkState_AckSent) { prv_transition_to(this, LinkState_RequestSent); } else if (this->state->link_state == LinkState_Opened) { this->state->restart_count = 0; prv_start_timer(...
(this->state->lock)
Unsupported locale" ); } void test_rocky_api_datetime__locale_time_string_options(void) { rocky_global_init(s_api); EXECUTE_SCRIPT("var d = new Date();"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {second: 'numeric'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "5"); EXECUTE_SCRIPT("s = d.toLocaleTimeSt...
("s", "July")
; EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {year: 'numeric'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "2005"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {year: '2-digit'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "05"); } void test_rocky_api_datetime__locale_date_string_time_options(void) { rocky_g...
s_manager_state.sensor_stable = true; s_manager_state.off_wrist_when_stable = (quality == HRMQuality_OffWrist); } } return s_manager_state.sensor_stable; } T_STATIC bool prv_can_turn_sensor_on(void) { #if IS_BIGBOARD || RECOVERY_FW return true; #endif return s_manager_state.enabled_run_level ...
new_timer_stop(s_manager_state.update_enable_timer_id)
; } } } mutex_unlock_recursive(s_manager_state.lock); } // Timer callback that we use to re-enable 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...
/* * 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...
MIN(pos + read_size/2, file_size)
; int start_offset = end_offset - read_size; int status = pfs_seek(iter->fd, start_offset, FSeekSet); if (status < 0) { PBL_LOG(LOG_LEVEL_ERROR, "Debug seek failed: %d", status); kernel_free(contents); return NULL; } int actual_read_size = pfs_read(iter->fd, contents, read_size); PBL_LOG(LOG_LEV...
vTaskStepTick(ticks_elapsed); // Update the task watchdog every time we come out of STOP mode (which is // at least once/second) since the timer peripheral will not have been // incremented task_watchdog_step_elapsed_time_ms((ticks_elapsed * 1000) / RTC_TICKS_HZ); s_analytics_device_sto...
ticks_to_milliseconds(s_analytics_device_stop_ticks)
; uint32_t sleep_ms = mcu_cycles_to_milliseconds(s_analytics_device_sleep_cpu_cycles); uint32_t now_ticks = rtc_get_ticks(); uint32_t running_ms = ticks_to_milliseconds(now_ticks - s_last_ticks) - stop_ms - sleep_ms; uint32_t tot_time = running_ms + sleep_ms + stop_ms; char buf[80]; dbgserial_putst...
non-aa uint32_t graphics_private_get_1bit_grayscale_pattern(GColor color, uint8_t row_number) { const GColor8Component luminance = (color.r + color.g + color.b) / 3; switch (luminance) { case 0: return 0x00000000; case 1: case 2: // This is done to create a checkerboard pattern for gray ...
Fixed_S16_3(x1 << FIXED_S16_3_PRECISION)
ION_RADIUS 13 #define DOT_COMPOSITOR_RADIUS 7 #define DOT_OFFSET 25 #define UPDATE_INTERVAL 200 #define UPDATE_AMOUNT 2 #define FAILURE_PERCENT 15 #define INITIAL_PERCENT 0 //! App data typedef struct { //! UI ProgressWindow window; //! App fetch result AppFetchResult result; //! Data AppInstallEntry ins...
{ AppFetchUIData *data = context; if (success) { prv_app_fetch_launch_app(data); } }
//////////////////////////// // Internal Helper Functions //////////////////////////// //! Used to clean up the application's data before exiting static void prv_app_fetch_cleanup(AppFetchUIData *data) { PBL_LOG(LOG_LEVEL_DEBUG, "App Fetch: prv_app_fetch_cleanup"); event_service_client_unsubscribe(&data->fetch_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...
dbgserial_putstr("Stuck button register is invalid, clearing.")
/* * 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...
( distance_normalized, property_animation->values.from.grect.size.h, property_animation->values.to.grect.size.h)
; ((PropertyAnimationLegacy2Implementation*) property_animation->animation.implementation) ->accessors.setter.grect(property_animation->subject, result); } void property_animation_legacy2_init( PropertyAnimationLegacy2 *property_animation, const PropertyAnimationLegacy2Implementation *implementation, ...
/* * 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...
graphics_context_set_fill_color(&ctx, GColorGreen)
; graphics_fill_radial(&ctx, radial_container_rect, GOvalScaleModeFillCircle, inset_thickness, 0, TRIG_MAX_ANGLE / 2); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("off_screen_right_aa_clipping"))); };
_name_val); } bool jerry_has_own_property(const jerry_value_t obj_val, const jerry_value_t prop_name_val) { if (!jerry_value_is_object(obj_val) || !jerry_value_is_string(prop_name_val)) { return false; } return (bool)EM_ASM_INT({ var obj = __jerryRefs.get($0); var name = __jerryRefs.get($1); ...
{ if (!jerry_value_is_object(obj_val) && !jerry_value_is_string(obj_val)) { return TYPE_ERROR_ARG; } if ((pdp->is_writable_defined || pdp->is_value_defined) && (pdp->is_get_defined || pdp->is_set_defined)) { return TYPE_ERROR_ARG; } if (pdp->is_get_defined && !jerry_value_is_function(pdp->getter...
pdp->is_enumerable, /* $6 */ pdp->is_configurable_defined, /* $7 */ pdp->is_configurable, /* $8 */ pdp->value, /* $9 */ pdp->getter, /* $10 */ pdp->setter, /* $11 */ obj_val, /* $12 */ prop_name_val /* $13 */ )); } jerry_value_t e...
*data_size_p -= num_ignored_bytes; if (*data_size_p == 0) { return true; // we're done } *data_p += num_ignored_bytes; } return false; } static bool prv_prepare_receiver(const uint32_t payload_length, const PebbleProtocolEndpoint *endpoint, const uint16_t endpoin...
if (rtr->receiver_imp) { rtr->receiver_imp->cleanup(rtr->receiver); }
n(anim, timeline_animation_interpolate_moook_soft); peek_layer_clear_fields(&timeline_layer->day_separator); peek_layer_play(&timeline_layer->day_separator); return anim; } void timeline_layer_set_day_sep_frame(TimelineLayer *timeline_layer, const GRect *frame) { layer_set_hidden((Layer *)&timeline_layer->da...
{ Animation *animations[MAX_UP_DOWN_ANIMATIONS] = {}; int num_animations = 0; for (int i = 0; i < TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER; i++) { if (layer->layouts[i]) { animations[num_animations++] = prv_create_layout_up_down_animation(layer->layouts[i], i, layer, duration, interpolate); ...
static void prv_place_day_separator(TimelineLayer *layer) { if (!layer_get_hidden((Layer *)&layer->day_separator)) { // already on screen return; } GRect day_sep_frame = ((Layer *)&layer->day_separator)->frame; // substitute the day separator for the hidden pin TimelineLayout *prev = layer->layouts...
*/, NULL, NULL); // Walk a little first prv_feed_steps_min(15); // Sleep for 100 minutes: 20 light, 30 deep, 10 light, 30 deep, 10 light prv_feed_light_sleep_min(20); prv_feed_deep_sleep_min(30); prv_feed_light_sleep_min(10); prv_feed_deep_sleep_min(30); prv_feed_light_sleep_min(10); // We should h...
{ bool passed = true; // TODO: is this needed here? // Hack to get around midnight rollover bug (only affects tests) rtc_set_time(time_util_get_midnight_of(rtc_get_time())); bool prev_insights_enabled = activity_prefs_activity_insights_are_enabled(); activity_prefs_activity_insights_set_enabled(true); ...
activity_insights_settings_write(ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD, &disabled_settings); prv_feed_steps_min(k_num_minutes); activity_insights_settings_write(ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD, &original_settings); activity_prefs_activity_insights_set_enabled(prev_insights_enabled); prv_tes...
" #include "hrm_manager_private.h" #include "console/prompt.h" #include "drivers/hrm.h" #include "kernel/pbl_malloc.h" #include "mfg/mfg_info.h" #include "os/tick.h" #include "process_management/app_manager.h" #include "process_management/worker_manager.h" #include "services/common/analytics/analytics.h" #include "ser...
( s_manager_state.accel_state, &timestamp_ms)
et; } void graphics_line_draw_precise_stroked(GContext* ctx, GPointPrecise p0, GPointPrecise p1) { s_precise_lines = realloc(s_precise_lines, (s_num_precise_lines + 1) * sizeof(*s_precise_lines)); s_precise_lines[s_num_precise_lines].p0 = p0; s_precise_lines[s_num_precise_lines].p1 = p1; s_num_precise_l...
cl_assert_equal_i(s_path_fill_count, 0)
void text_layer_init(TextLayer *text_layer, const GRect *frame) { text_layer_init_with_parameters(text_layer, frame, NULL, NULL, GColorBlack, GColorWhite, GTextAlignmentLeft, GTextOverflowModeTrailingEllipsis); } TextLayer* text_layer_create(GRect frame) { TextLayer* layer = app...
PBL_ASSERTN(text_layer)
; GContext* ctx = app_state_get_graphics_context(); return text_layer_get_content_size(ctx, text_layer); } void text_layer_set_line_spacing_delta(TextLayer *text_layer, int16_t delta) { PBL_ASSERTN(text_layer); // Initialize cached layout if not already initialized text_layer_set_should_cache_layout(text_lay...
type: %d", data->operation); break; } layer_mark_dirty(data->canvas_layer); PBL_LOG(LOG_LEVEL_DEBUG, "line(p1(%d, %d), p2(%d, %d), width=%d), angle=%d)", data->p1.x, data->p1.y, data->p2.x, data->p2.y, data->stroke_width, (int)(data->rotation_angle * 360 / TRIG_MAX_ANGLE)); } static ...
graphics_draw_line(ctx, GPoint(70, 100), GPoint(70, 101))
; return; } if (data->operation == OP_ROTATE2) { int line_length = 60; time_t now; uint16_t now_ms = time_ms(&now, NULL); uint32_t seconds = pbl_override_localtime(&now)->tm_sec; uint32_t miliseconds = seconds * 1000 + now_ms; uint32_t rotation = miliseconds * TRIG_MAX_ANGLE / (60 * 1...
ogle 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 writing, software * ...
if (content_size.h > lines * line_height) { frame = text_layer->layer.frame; frame.origin.y += -line_height / 2 + extra_line_offset_y; layer_set_frame(&text_layer->layer, &frame); }
} static void prv_update_label_text_layer(TimeSelectionWindowData *time_selection_window) { TextLayer *label_text_layer = &time_selection_window->label_text_layer; if (label_text_layer->text) { const int label_origin_y = prv_selection_config()->label_origin_y; const int lines = 1; const int extra_line...
child(&window->window.layer, &window->text_layer.layer); window_set_click_config_provider(&window->window, prv_no_music_window_click_config); return window; } static void prv_push_no_music_window(MusicAppData *data) { if (data->no_music_window) { return; } data->no_music_window = prv_create_no_music_wind...
layer_set_bounds(&text_layer->layer, &GRect(0, -y_offset, rect->size.w, rect->size.h + y_offset))
; } static void prv_init_ui(Window *window) { MusicAppData *data = window_get_user_data(window); window_set_background_color(window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite)); const GSize WINDOW_SIZE = window->layer.bounds.size; const GTextAlignment ARTIST_TITLE_TEXT_ALIGNMENT = PBL_IF_RECT_ELSE(GTex...
oReel base; uint32_t canary; const KinoReelImpl *impl; void *data; } KinoReelImplCustom; static void prv_destructor(KinoReel *reel) { KinoReelImplCustom *custom_reel = (KinoReelImplCustom *)reel; if (custom_reel->impl->destructor) { custom_reel->impl->destructor(reel); } applib_free(custom_reel); } ...
{ if (!prv_kino_reel_custom_is_custom(reel)) { return NULL; } KinoReelImplCustom *custom_reel = (KinoReelImplCustom *)reel; return custom_reel->data; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
memcmp(s1, s2, n)
; } int strncmp(const char *s1, const char *s2, size_t n) { size_t strn = strlen(s1) + 1; if (strn < n) { n = strn; } return memcmp(s1, s2, n); }
/* * 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...
task_init()
; // about to start the worker in earnest. No longer safe to kill. s_worker_task_context.safe_to_kill = false; // Enter unprivileged mode! const bool is_unprivileged = s_worker_task_context.app_md->is_unprivileged; if (is_unprivileged) { mcu_state_set_thread_privilege(false); } const PebbleMain mai...
/* * 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...
HCI_OPCODE(ocf, ogf)
, .param_length = param_length, }; if (param_length != 0) { memcpy(&hci_cmd->param, param_buf, param_length); } PBL_LOG(LOG_LEVEL_DEBUG, "Sending HCI CMD to ROM stack:"); PBL_HEXDUMP(LOG_LEVEL_DEBUG, (uint8_t *)hci_cmd, msg_buf->msg_size); bool result = (ad_ble_command_queue_send(&msg_buf, OS_QUE...
nts.h" #include "resource/resource.h" #include "services/common/new_timer/new_timer.h" #include "services/common/system_task.h" #include "services/common/system_task.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/notifications/alerts_preferences_private.h" #include "services/normal/settings/se...
(s_thursday_00_00)
; alerts_preferences_init(); do_not_disturb_init(); do_not_disturb_set_manually_enabled(false); do_not_disturb_set_schedule_enabled(WeekdaySchedule, false); do_not_disturb_set_schedule_enabled(WeekendSchedule, false); if (do_not_disturb_is_smart_dnd_enabled()) { do_not_disturb_toggle_smart_dnd(); } ...
ns static void prv_txrx_menu_update(AppData *data); //-------------------------------------------------------------------------------- // Running Tests //-------------------------------------------------------------------------------- // Running the actual test is an asynchronous operations which expects a // callback...
(MIC, &prv_mic_cb, NULL, data->mic_buffer, BUFFER_SIZE)
) { failed = true; goto cleanup; } } #endif if (!prv_run_test_step(BTLETestStep_BTStart, data)) { failed = true; goto cleanup; } switch (data->current_test) { case BTLETestType_TX: if (!prv_run_test_step(BTLETestStep_BTLETransmitStart, data)) { failed = true; ...
POINT_ID, (uint8_t *) &header, sizeof(header), COMM_SESSION_DEFAULT_TIMEOUT); } else { // Otherwise, just send a "done" message header.command = 0x81; comm_session_send_data(s_bt_dump_chunk_callback_data.comm_session, ENDPOINT_ID, ...
{ DEBUG_LOG(LOG_LEVEL_INFO, "Last launched app: %s", last_launched_app.name); PBL_HEXDUMP(LOG_LEVEL_INFO, build_id, sizeof(build_id)); }
} }
(&e->device)
; if (!connection) { PBL_LOG(LOG_LEVEL_ERROR, "Got address & IRK update for non-existent connection. " "Old addr:"BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(e->device.address)); goto unlock; } if (e->is_address_updated) { connection->device = e->new_device;...
n't want to permanently consume data SharedCircularBufferClient *cbuf_client = &s_alg_state->file_minute_data_client; SharedCircularBufferClient cbuf_client_bck = *cbuf_client; AlgMinuteRecord *cbuf_record = &s_alg_state->cbuf_record; int16_t avail_minutes = (shared_circular_buffer_get_read_space_remaining( ...
{ AlgMinuteFileInfoContext *context = (AlgMinuteFileInfoContext *)context_arg; context->num_records++; return true; }
bool activity_algorithm_minute_file_info(bool compact_first, uint32_t *num_records, uint32_t *data_bytes, uint32_t *minutes) { if (!prv_lock()) { return false; } bool success = false; SettingsFile *file = NULL; file = prv_minute_data_file_open(); if (file && c...
s Heap object. // Don't fuzz 3rd party app heaps because likely many of them rely on accessing free'd memory bool enable_heap_fuzzing = (sdk_type == ProcessAppSDKType_System); Heap *app_heap = app_state_get_heap(); PBL_LOG(LOG_LEVEL_DEBUG, "App heap init %p %p", app_segment.start, app_segment.end); ...
app_comm_set_sniff_interval(SNIFF_INTERVAL_NORMAL)
; app_manager_set_minimum_run_level(ProcessAppRunLevelNormal); app_install_cleanup_registered_app_callbacks(); app_install_notify_app_closed(); timeline_peek_handle_process_kill(); } // --------------------------------------------------------------------------------------------- //! On watchface crashes, we ...
/* * 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...
{ 16, 816, -392}, { -40, 864, -376}, { -40, 952, -392}, { -8, 976, -368}, { 192, 1104, -376}, { 336, 1168, -360}, { 304, 968, -288}, { 144, 688, -240}, { 104, 680, -160}, { 112, 752, -48}, { 240, 960, -16}, { 280, 1128, -64}, { 168, 992, -104}, { 104, 880, -224}, ...
{ 560, 144, -176}, // 5 seconds { 536, 112, -24}, { 592, 96, -72}, { 752, 200, -152}, { 976, 176, -184}, { 1208, 88, -144}, { 1632, 104, -224}, { 984, 360, -208}, { 1016, 240, -376}, { 1232, 328, -320}, { 1104, 264, -248}, { 768, 224, -240}, { 576, 200, -176}, ...
/* * 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...
{ uint8_t flags; uint8_t width; uint8_t height; uint8_t bpp; uint32_t 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...
audio_endpoint_stop_transfer(s_session_id)
; fake_transport_set_sent_cb(s_transport, prv_test_stop_transfer_msg); fake_comm_session_process_send_next(); } void test_audio_endpoint__buffer_overflow(void) { // add a huge number of frames (1 kB) to the buffer to cause it to overflow for (unsigned int i = 0; i < 1024 / (sizeof(DataTransferMsg) + sizeof(s_t...
/////////////////////////////////////////////////////////////////////// // Handlers static void prv_health_service_events_handler(HealthEventType event, void *context) { if (event == HealthEventMovementUpdate) { prv_update_current_steps(context); } } static void prv_tick_handler(struct tm *tick_time, TimeUnit...
{ static const PebbleProcessMdSystem s_app_md = { .common = { // UUID: 3af858c3-16cb-4561-91e7-f1ad2df8725f .uuid = {0x3a, 0xf8, 0x58, 0xc3, 0x16, 0xcb, 0x45, 0x61, 0x91, 0xe7, 0xf1, 0xad, 0x2d, 0xf8, 0x72, 0x5f}, .main_func = prv_main, .process_type = ProcessTypeWatchface, ...
hics_fill_rect.call_count); cl_assert_equal_i(0, s_graphics_line_draw_precise_stroked.call_count); cl_assert_equal_i(0, s_graphics_draw_line.call_count); cl_assert_equal_i(1, s_graphics_context_set_fill_color.call_count); cl_assert_equal_i(0, s_graphics_context_set_stroke_color.call_count); cl_asser...
prv_js_global_get_value("e3")
prv_file_close_and_unlock(&file); return alarm_is_scheduled; } // ---------------------------------------------------------------------------------------------- bool alarm_get_kind(AlarmId id, AlarmKind *kind_out) { SettingsFile file; if (!prv_file_open_and_lock(&file)) { return false; } AlarmConfig co...
for (int i = 0; i < MAX_CONFIGURED_ALARMS; ++i) { AlarmConfig config; if (!prv_alarm_get_config(&file, i, &config)) { rv = true; break; } }
>closing_state == ProcessRunState_ForceClosing) { PBL_LOG(LOG_LEVEL_DEBUG, "Hit syscall exit trap!"); context->safe_to_kill = true; process_manager_put_kill_process_event(task, false); vTaskSuspend(xTaskGetCurrentTaskHandle()); } } // ----------------------------------------------------------------...
rocky_app_validate_resources(*md)
== RockyResourceValidation_Invalid) { PBL_LOG(LOG_LEVEL_DEBUG, "App has incompatible JavaScript bytecode"); // TODO: do we need to purge the app cache here? return true; } return false; } #endif void process_manager_launch_process(const ProcessLaunchConfig *config) { PBL_ASSERT_TASK(PebbleTask_Ke...
/* * 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...
for (int32_t i = subsector_start; i < subsector_end; i += SUBSECTOR_SIZE_BYTES) { flash_erase_subsector_blocking(i); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_app_db.mutex)
; } static status_t prv_cancel_app_fetch(AppInstallId app_id) { if (pebble_task_get_current() == PebbleTask_KernelBackground) { // if we are on kernel_bg, we can go ahead and cancel the app fetch instantly app_fetch_cancel_from_system_task(app_id); return S_SUCCESS; } else { // ignore the deletion ...
ude "syscall/syscall.h" #include "syscall/syscall_internal.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" #include "FreeRTOS.h" #include "task.h" #include "queue.h" // Define this to install an accel subscription from the KernelMain task for testing //#define TEST_KERNEL_SUBSCRIPTIO...
{ highest_rate = state->sampling_rate; }
GPoint(-2, 5)
, GPoint(5, -2)); // top left corner graphics_draw_line(ctx, GPoint(10, -2), GPoint(10, 2)); // top graphics_draw_line(ctx, GPoint(15, -2), GPoint(22, 5)); // top right corner graphics_draw_line(ctx, GPoint(18, 10), GPoint(22, 10)); // right graphics_draw_line(ctx, GPoint(22, 15), GPoint(15, 22)); // bott...
k(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_top.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersLeft); cl_check(gbitmap_pbi_eq(&ctx.d...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_topleft.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerTopRight); cl_check(gbi...
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), 0); cl_assert_equal_i(prv_cla...
form_health_response_action(const TimelineItem *item, const TimelineItemAction *action) { const uint8_t insight_type = attribute_get_uint8(&item->attr_list, AttributeIdHealthInsightType, ActivityInsightType_Unknown); c...
PBL_LOG(LOG_LEVEL_INFO, "Opening parent pin %s", uuid_buffer)
; } break; } case TimelineItemActionTypeAncsDial: { const char *caller_id = attribute_get_string(&item->attr_list, AttributeIdTitle, "Unknown"); prv_put_outgoing_call_event(item->header.ancs_uid, caller_id); notifications_handl...
(fb, &(GSize) {DISP_COLS, DISP_ROWS})
; } // Teardown void test_graphics_draw_circle_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } // Tests //////////////////////////////////// void inside_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics...
/* * 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...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_health_hr_summary_card__render_timestamp(void) { rtc_set_time(SECONDS_PER_DAY + (SECONDS_PER_HOUR * 12)); HealthData health_data = { .current_hr_bpm = 110, .hr_last_updated = rtc_get_time() - (SECONDS_PER_MINUTE * 5), }; prv_create_card_and_render(&health_data); cl_check(gbitmap_pbi_e...
lude "services/normal/timeline/attributes_actions.h" #include "system/logging.h" #include "system/passert.h" #include "util/attributes.h" #include "util/units.h" #include <stdio.h> T_STATIC const char *iOS_NOTIF_PREF_DB_FILE_NAME = "iosnotifprefdb"; T_STATIC const int iOS_NOTIF_PREF_MAX_SIZE = KiBYTES(10); typedef ...
(serialized_prefs)
; return NULL; } const size_t alloc_size = attributes_actions_get_required_buffer_size(serialized_prefs->num_attributes, serialized_prefs->num_actions, attributes_per_action, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ s_blobdb_id = id; }
void blob_db_init_dbs(void) { test_db_init(); } void blob_db_get_dirty_dbs(uint8_t *ids, uint8_t *num_ids) { bool is_dirty = false; test_db_is_dirty(&is_dirty); if (is_dirty) { ids[0] = s_blobdb_id; *num_ids = 1; } else { *num_ids = 0; } } status_t blob_db_insert(BlobDBId db_id, const ui...
airing_1, }; bonding_sync_add_bonding(&ble_bonding); BTBondingID id = bt_persistent_storage_store_ble_pairing(&pairing_1, true /* is_gateway */, NULL, true /* requires_address_pinning */, false /*...
cl_assert_equal_m(&device_out, &pairing_2.identity, sizeof(device_out))
ct->origin.y + rect->size.h - 1); const GPoint br = GPoint(rect->origin.x + rect->size.w - 1, rect->origin.y + rect->size.h - 1); graphics_line_draw_stroked_aa(ctx, tl, tr, stroke_width); graphics_line_draw_stroked_aa(ctx, tl, bl, stroke_width); graphics_line_draw_stroked_aa(ctx, tr, br, stroke_width); graph...
(origin.x + radius, origin.y + radius)
; const GPoint tr = gpoint_add(tl, GPoint(width_actual - 1, 0)); const GPoint bl = gpoint_add(tl, GPoint(0, height_actual - 1)); const GPoint br = gpoint_add(tl, GPoint(width_actual - 1, height_actual - 1)); graphics_circle_quadrant_draw(ctx, tl, radius, GCornerTopLeft); graphics_circle_quadrant_draw(ctx, bl...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return E_DOES_NOT_EXIST; }
*((uint64_t *)val_out) = s_get_value; return S_SUCCESS; } static uint64_t s_set_value; status_t settings_file_set(SettingsFile *file, const void *key, size_t key_len, const void *val, size_t val_len) { cl_assert_equal_i(val_len, sizeof(uint64_t)); s_set_value = *(uint64_t *)val; r...
n out to flash. We skip over and ignore overwritten // records. static bool partially_written(SettingsRecordHeader *hdr) { return !flag_is_set(hdr, SETTINGS_FLAG_WRITE_COMPLETE); } static bool partially_overwritten(SettingsRecordHeader *hdr) { return flag_is_set(hdr, SETTINGS_FLAG_OVERWRITE_STARTED) && !f...
(new_file.name)
; settings_file_close(&new_file); status = prv_open(file, name, OP_FLAG_READ | OP_FLAG_WRITE, file->max_used_space); kernel_free(name); return status; } T_STATIC status_t settings_file_compact(SettingsFile *file) { return settings_file_rewrite_filtered(file, NULL, NULL); } static bool key_matches(SettingsRa...
fake_rtc_init(0, 0); workout_service_reset(); // Start the step value for the day at X s_total_step_count = 5000; s_hrm_expiration = 0; s_hrm_subscribed = false; s_abandoned_workout_notification_sent = false; const bool assert_all_unlocked = true; fake_mutex_reset(assert_all_unlocked); workout_ser...
(distance_m, 1600)
an_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "+1100"); jan_2_2015__13_00_00.tm_gmtoff = -60; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%z", &jan_2_2015__13_00_00); #if !OUR_STRFTIME_BUGS cl_assert_equal_s(tmbuf, "-0001"); #else // BUG!! cl_assert_equal_s(tmbuf, "+0001"); #endif jan_2_2015__13_0...
(tmbuf, sizeof(tmbuf), "%12d", &jan_2_10015__13_00_00)
{ 0, 0x76, 3081, 0x0}, { 0, 0x79, 5856, 0x0}, { 25, 0x41, 3896, 0x0}, { 0, 0x41, 2862, 0x0}, { 12, 0x41, 3643, 0x0}, { 70, 0x40, 5558, 0x0}, { 77, 0x40, 6180, 0x0}, // 30: Local time: 07:22:00 PM { 27, 0x40, 4019, 0x0}, { 31, 0x4f, 3790, 0x0}, { 22, 0x41, 4540, 0x0}, { 20, ...
{ 36, 0x52, 6815, 0x0}, { 14, 0x53, 6078, 0x0}, { 0, 0x74, 1111, 0x0}, { 0, 0x74, 2156, 0x0}, { 0, 0x65, 1844, 0x0}, { 0, 0x74, 210, 0x0}, { 0, 0x75, 621, 0x0}, { 0, 0x76, 642, 0x0}, { 0, 0x75, 1306, 0x0}, { 0, 0x75, 957, 0x0}, { 0, 0x75, 504, 0x0}, { 0, 0x75, 509, 0x0}, ...
{ 0, 0x3b, 45, 0x0}, { 0, 0x3b, 0, 0x0}, // 195: Local time: 10:07:00 PM { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x3b, 0, 0x0}, { 0, 0x2c, 1093, 0x0}, { 0, 0x2d, ...
, { 2147483646LL, 13, "282ba4aa9", }, { -2147483647LL, 13, "-282BA4AAA", }, { -2147483647LL, 13, "-282ba4aaa", }, { 2147483646LL, 14, "1652CA930", }, { 2147483646LL, 14, "1652ca930", }, { -2147483647LL, 14, "-1652CA931", }, { -2147483647LL, 14, "-1652ca931", }, { 2147483646LL, 15, "C87E66B6", }, { 214...
(" +0x573ghghghgh", NULL, 0)
, 0x573); cl_assert_equal_i(strtol(" +0573faf", NULL, 0), 0573); cl_assert_equal_i(strtol(" -573bb", NULL, 0), -573); cl_assert_equal_i(strtol(" -0x573ghghghgh", NULL, 0), -0x573); cl_assert_equal_i(strtol(" -0573faf", NULL, 0), -0573); } void test_strtol__bogus(void) { cl_assert_equal_i(strtol(" ", NULL...
t_height > 0) { const GRect area_above_selection_rect = GRect(-selection_rect->origin.x, 0, DISP_COLS, area_above_selection_rect_height); prv_move_region_of_bitmap_horizontally(&ctx->dest_bitmap, &area_above_selection_rect, -delta); const GRect stretch_rect...
if (!is_right) { // Manipulate the launcher's pixels in the system framebuffer so the selection moves right // and everything else moves left so everything comes to rest at its final position prv_manipulate_launcher_in_system_framebuffer(ctx, &selection_rect, -delta_x_after_cut, ...
} // Technically the whole framebuffer may not be dirty after each frame (and thus not need to be // marked as such so we don't flush every scan line to the display), but let's make it easy and // just dirty the whole framebuffer on each frame anyway since most pixels do change framebuffer_dirty_all(composi...
/* * 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...
{ status_t status = pfs_seek(iter->fd, amount, whence); if (status >= 0) { return status; } int pos = pfs_seek(iter->fd, 0, FSeekCur); PBL_LOG(LOG_LEVEL_ERROR, "Could not seek by %d from whence %d at pos %d: %"PRId32, amount, whence, pos, status); fatal_logic_error(iter); }
/* * 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...
("Double free detected on pointer <%p>", ptr)
; } static void prv_warn_on_heap_corruption(void *ptr) { // They're using 3.2 SDK or older, just let them off with a log message. APP_LOG(APP_LOG_LEVEL_ERROR, "Error: Heap corrupt around <%p>", ptr); } static void prv_croak_on_heap_corruption(void *ptr) { APP_LOG(APP_LOG_LEVEL_ERROR, "Error: Heap corrupt around...
rence s_catchup_enabled = (time_difference < 0) ? true : false; // Enforces the catchup gap to be at least WAKEUP_CATCHUP_WINDOW gap time_difference = MAX(time_difference, WAKEUP_CATCHUP_WINDOW); } // timers are in milliseconds, set main callback dispatch for wakeup // WakeupId is used to...
(PEBBLE_WAKEUP_EVENT, NULL, NULL)
; // Create single reusable timer for wakeup events s_current_timer_id = new_timer_create(); s_wakeup_state.next_wakeup_id = rtc_get_time(); s_wakeup_state.timestamp = -1; SettingsFile wakeup_settings; if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) != S_SUCCESS) { PBL...
0) && (hdr->last_modified <= (utc_time() - DELETED_LIFETIME)); } static void compute_stats(SettingsFile *file) { file->dead_space = 0; file->used_space = 0; file->last_modified = 0; file->used_space += sizeof(SettingsFileHeader); file->used_space += sizeof(SettingsRecordHeader); // EOF Marker for (s...
if (memcmp(key, hdr_key, hdr->key_len) == 0) { return true; }
return false; } static bool prv_is_desired_hdr(SettingsRawIter *iter, const uint8_t *key, int key_len) { if (overwritten(&iter->hdr) || partially_written(&iter->hdr)) { return false; } return key_matches(iter, key, key_len); } static bool search_forward(SettingsRawIter *iter, const uint8_t *key, int key...
/* * 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...
{ // Pretend to send out all the data: size_t read_space = comm_session_send_queue_get_length(session); comm_session_send_queue_consume(session, read_space); }
static bool s_is_current_task_send_next_task = false; bool comm_session_is_current_task_send_next_task(CommSession *session) { return s_is_current_task_send_next_task; } // Tests /////////////////////////////////////////////////////////// static const uint16_t ENDPOINT_ID = 1234; static const uint32_t TIMEOUT_MS ...
ching timeline in past mode."); s_timeline_args.direction = TimelineIterDirectionPast; analytics_inc(ANALYTICS_DEVICE_METRIC_TIMELINE_PAST_LAUNCH_COUNT, AnalyticsClient_System); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Launching timeline in future mode."); s_timeline_args.direction = TimelineIterDirectionFu...
{ watchface_launch_default(NULL); }
void command_watch(void) { launcher_task_add_callback(kernel_callback_watchface_launch, NULL); } void watchface_start_low_power(void) { app_manager_set_minimum_run_level(ProcessAppRunLevelNormal); prv_watchface_launch_low_power(); } void watchface_reset_click_manager(void) { click_manager_reset(&s_click_man...
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 the License for the specific language ...
{ return sc; }
block_addr += block_size; } return S_SUCCESS; } status_t flash_impl_unprotect(void) { return qspi_flash_unlock_all(QSPI_FLASH); } status_t flash_impl_init(bool coredump_mode) { qspi_flash_init(QSPI_FLASH, &QSPI_FLASH_PART, coredump_mode); qspi_flash_unlock_all(QSPI_FLASH); return S_SUCCESS; } statu...
ort_imp, CommSessionTransportType_PULSE); } static bool prv_find_session_is_type_filter(ListNode *found_node, void *data) { CommSession *session = (CommSession *) found_node; CommSessionTransportType required_session_type = (CommSessionTransportType) data; return prv_is_transp...
DEFINE_SYSCALL(void, sys_app_comm_set_responsiveness, SniffInterval interval)
{ CommSession *comm_session = comm_session_get_current_app_session(); switch (interval) { case SNIFF_INTERVAL_REDUCED: comm_session_set_responsiveness(comm_session, BtConsumerApp, ResponseTimeMiddle, MAX_PERIOD_RUN_FOREVER); return; case SNIFF_INTERVAL_NOR...
ro; layout->hash = text_hash; layout->box = box; layout->overflow_mode = overflow_mode; layout->alignment = alignment; layout->font = font; WalkLinesCallbacks callbacks = { .layout_update_cb = update_all_layout_update_cb }; int16_t line_spacing_delta = prv_layout_get_line_spacing_delta(layout); ...
prv_layout_get_line_spacing_delta(layout)
0xf0, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, /* bytes 32 - 48 */ 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, /* bytes 48 - 64 */ 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x1f, 0x00, 0x7f, 0xfc, 0x00, 0x00, 0x7f, 0x7c, 0x00, ...
(data, cell_index, true)
; (void)menu_layer; } static void prv_window_load(Window *window) { AppData *data = window_get_user_data(window); MenuLayer *menu_layer = &data->menu_layer; menu_layer_init(menu_layer, &window->layer.bounds); menu_layer_set_callbacks(menu_layer, data, &(MenuLayerCallbacks) { .get_num_sections = (MenuLay...
/* * 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 (__builtin_floor(d) == d) { return d; }
nclude "applib/app.h" #include "applib/graphics/graphics.h" #include "applib/graphics/text.h" #include "applib/tick_timer_service.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/text_layer.h" #include "applib/ui/vibes.h" #include "applib/ui/window.h" #include "console/prompt.h" #include "kernel/event_loo...
(ctx, &layer->bounds)
; // Draw crosshair graphics_context_set_stroke_color(ctx, GColorWhite); graphics_draw_line( ctx, GPoint(layer->bounds.size.w / 2, radial_padding_size), GPoint(layer->bounds.size.w / 2, layer->bounds.size.h - radial_padding_size - 1)); graphics_draw_line( ctx, GPoint(radial_padding_size, laye...
..] // uint32 TIME_INTERVAL // Uuid UUID // uint8 SDK_MAJOR_VERSION // [...] // } void test_analytics_heartbeat__test_read_write_sanity(void) { // Set Metrics AnalyticsHeartbeat *heartbeat = analytics_heartbeat_app_create(&test_uuid); int64_t time_interval = 0x10111213; analytics_heartbeat_...
analytics_heartbeat_print(heartbeat)
; i = 0x80; for (AnalyticsMetric metric = ANALYTICS_APP_METRIC_START + 1; metric < ANALYTICS_APP_METRIC_END; metric++) { if (analytics_metric_is_array(metric)) { for (int j = 0; j < analytics_metric_num_elements(metric); j++) { verify_metric(heartbeat, metric, i, j); i++; } ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return NULL; }
GAPLEConnection *gap_le_connection_get_gateway(void) { return NULL; } void launcher_task_add_callback(void (*callback)(void *data), void *data) { callback(data); } bool comm_session_is_valid(const CommSession *session) { return true; } CommSessionTransportType comm_session_analytics_get_transport_type(CommSe...
&album_ptr, &album_length); if (!read_iter) { return; } const char* title_ptr; size_t title_length; read_iter = prv_read_ptr_and_length_from_buffer(read_iter, msg + length, &title_ptr, &title_length); if (!r...
{ case MusicEndpointCmdIDNowPlayingInfoResponse: prv_update_now_playing_info(session, msg, length); break; case MusicEndpointCmdIDPlayStateInfoResponse: prv_update_play_state_info(session, msg, length); break; case MusicEndpointCmdIDVolumeInfoResponse: prv_update_volume_info(se...
ntext; window_stack_pop(true); window_stack_push(data->hr_window, true /* Animated */); } // ------------------------------------------------------------------------------- static void steps_down_long_click_handler(ClickRecognizerRef recognizer, void *context) { HealthAPITestAppData *data = (HealthAPITestAppDat...
graphics_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, 15, 0, TRIG_MAX_ANGLE)
; graphics_context_set_stroke_color(ctx, GColorJaegerGreen); graphics_context_set_fill_color(ctx, GColorJaegerGreen); graphics_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, 15, 0, TRIG_MAX_ANGLE * percent / 100); } // ------------------------------------------------------------------------------- static vo...
)); ble_root_keys_get_and_generate_if_needed(config->root_keys); dis_get_info(&config->dis_info); #if CAPABILITY_HAS_BUILTIN_HRM config->is_hrm_supported_and_enabled = ble_hrm_is_supported_and_enabled(); PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing prefs: is_enabled=%u", config->is_hrm_supported_and_enabl...
(s_comm_state_change_mutex)
200); check_atan2(-1508, 299); check_atan2(1020, 1002); } void test_math__ceil_log_two(void) { check_ceil_log_two(4); check_ceil_log_two(5); check_ceil_log_two(100); check_ceil_log_two(256); check_ceil_log_two(123456); } void test_math__sign_extend(void) { cl_assert_equal_i(sign_extend(0, 32), 0); c...
{ cl_assert_equal_i(10, distance_to_mod_boundary(10, 100)); cl_assert_equal_i(50, distance_to_mod_boundary(50, 100)); cl_assert_equal_i(10, distance_to_mod_boundary(90, 100)); cl_assert_equal_i(10, distance_to_mod_boundary(110, 100)); cl_assert_equal_i(10, distance_to_mod_boundary(210, 100)); cl_assert_equ...
void test_math__gcd_zero(void) { cl_assert_equal_i(0, gcd(0, 0)); } void test_math__gcd_coprime(void) { cl_assert_equal_i(1, gcd(8, 27)); } void test_math__gcd_basic(void) { cl_assert_equal_i(9, gcd(9, 18)); } void test_math__gcd_basic_reversed(void) { cl_assert_equal_i(9, gcd(18, 9)); } void test_math__g...
(workout_glance->icon_resource_id == new_icon_resource_id) { // Nothing to do, bail out return false; } // Destroy the existing icon kino_reel_destroy(workout_glance->icon); // Set the new icon and record its resource ID workout_glance->icon = kino_reel_create_with_resource(new_icon_resource_id); ...
{ PBL_ASSERTN(node); LauncherAppGlanceWorkout *workout_glance = app_zalloc_check(sizeof(*workout_glance)); // Copy the name of the Workout app as the title const size_t title_size = sizeof(workout_glance->title); strncpy(workout_glance->title, node->name, title_size); workout_glance->title[title_size - 1]...
ed_glance, serialized_glance_size); if (rv != S_SUCCESS) { goto cleanup; } rv = prv_deserialize_glance((SerializedAppGlanceHeader *)serialized_glance, (size_t)serialized_glance_size, glance_out); cleanup: kernel_free(serialized_glance); return rv; } status_t app_glance_db_...
if (validation_context.is_at_least_one_slice_invalid) { PBL_LOG(LOG_LEVEL_WARNING, "Tried to insert AppGlanceDB entry with at least one invalid slice"); return E_INVALID_ARGUMENT; }
// Trim the serialized glance of excess slices by shrinking `val_len` to `validated_size` // We do this if the glance entry has more slices than the max number of slices per glance. // This can happen for glance entries sent to us by the mobile apps because they don't have a way // of knowing the max number 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...
gbitmap_get_data_row_info(&bmp, 1)
.data); cl_assert_equal_i(11, gbitmap_get_data_row_info(&bmp, 3).min_x); cl_assert_equal_i(12, gbitmap_get_data_row_info(&bmp, 3).max_x); }
/* * 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_b(true, rocky_app_has_compatible_bytecode_res(123))
; }
us, name); pfs_close_and_remove(fd); return prv_open(file, name, flags, max_used_space); } // There's a chance that the caller increased the desired size of the settings file since // the file was originally created (i.e. the file was created in an earlier version of the // firmware). If we detect that...
record_size(&file->iter.hdr)
; } if (file->iter.hdr.last_modified > file->last_modified) { file->last_modified = file->iter.hdr.last_modified; } } } status_t settings_file_rewrite_filtered( SettingsFile *file, SettingsFileRewriteFilterCallback filter_cb, void *context) { SettingsFile new_file; status_t status = prv_ope...
/* * 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...
simple_dialog_get_dialog(simple_dialog)
include <string.h> #include "applib/data_logging.h" #include "comm/bt_lock.h" #include "drivers/rtc.h" #include "os/tick.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "services/normal/data_logging/data_logging_service.h" #include "services/common/new_timer/new_timer.h" #include "services/...
(device_hb)
; AnalyticsHeartbeatList *app_hb_node = app_hbs; while (app_hb_node) { AnalyticsHeartbeat *app_hb = app_hb_node->heartbeat; #ifdef ANALYTICS_DEBUG analytics_heartbeat_print(app_hb); #endif dls_log(s_app_heartbeat_session, app_hb->data, 1); AnalyticsHeartbeatList *next = (AnalyticsHeartbeatList*)ap...
ot_keys, sizeof(data->root_keys)) && prv_field_valid((uint8_t *)&data->ble_pairing_data, sizeof(data->ble_pairing_data)) && prv_field_valid((uint8_t *)&data->ble_pairing_name, sizeof(data->ble_pairing_name)) && prv_field_valid((uint8_t *)&data->pinned_address, sizeof(data->pinned_address)) && ...
(SPRF_FIELD_DATA(field), SPRF_FIELD_DATA(((uint8_t *)data) + offset), field_data_size)
); if (data->magic == SprfMagic_UnpopulatedEntry) { // Struct that is written is currently unpopulated. Set it up and write // the struct's Magic and Version prv_write_to_current_page(data, true); } else if ((old_crc == new_crc) && same_data) { // We are trying to write the same data, ignore the wr...
"Index: %"PRIu8, index); const uint8_t bit = (1 << index); if (action_bar_is_highlighted(action_bar, index) == highlighted) { return; } if (highlighted) { action_bar->is_highlighted |= bit; } else { action_bar->is_highlighted &= ~bit; prv_register_redraw_timer(action_bar); } action_bar->...
prv_get_button_press_offset(action_bar, index)
/* * 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_LOG_LEVEL_INFO, "Horizontal lines")
; start = GPoint(bounds.origin.x, bounds.size.h / 2); end = GPoint(bounds.size.w, bounds.size.h / 2); break; case LineDirection_Vertical: APP_LOG(APP_LOG_LEVEL_INFO, "Vertical lines"); start = GPoint(bounds.size.w / 2, bounds.origin.y); end = GPoint(bounds.size.w / 2, bounds.size...
INLINE to reduce the stack requirements during the minute handler (see PBL-38130) static void NOINLINE prv_process_minute_data_tail(time_t utc_sec) { bool need_history_update_event; uint16_t cur_day_index; mutex_lock_recursive(s_activity_state.mutex); { cur_day_index = time_util_get_day(utc_sec); need_h...
{ if (!s_activity_state.started) { return; } ACTIVITY_LOG_DEBUG("running minute system task"); // Get the current time time_t utc_sec = rtc_get_time(); // Do our minute processing prv_process_minute_data(utc_sec); // Process insights mutex_lock_recursive(s_activity_state.mutex); { activit...
// ------------------------------------------------------------------------------------------------ // Runs on the timer task. Simply register a callback for the KernelBG task from here. static void prv_minute_cb(CronJob *job, void *data) { system_task_add_callback(prv_minute_system_task_cb, data); cron_job_sche...
signed int* stacked_args) { unsigned int stacked_r0 = ((unsigned long) stacked_args[0]); unsigned int stacked_r1 = ((unsigned long) stacked_args[1]); unsigned int stacked_r2 = ((unsigned long) stacked_args[2]); unsigned int stacked_r3 = ((unsigned long) stacked_args[3]); unsigned int stacked_r12 = ((unsigned...
( buffer, 80, "Task: %s", pebble_task_get_name(pebble_task_get_current()))
; } static void hard_fault_handler_c(unsigned int* hardfault_args) { // Log the lr instead of the pc. We frequently crash due to PC being madness. While the lr may be a little further // than the actual crash, it should give us enough context. const unsigned int stacked_lr = ((unsigned long) hardfault_args[5]); ...
ault_vibe_intensity = vibe_intensity_get(); subtitle = vibe_intensity_get_string_for_intensity(current_system_default_vibe_intensity); break; } default: { WTF; } } // We need to set the subtitle to the name of a vibe score if it's NULL at this point if (!subtitle) { subtitle = v...
app_zalloc_check(sizeof(SettingsVibePatternsData))
; data->callbacks = (SettingsCallbacks) { .deinit = prv_deinit_cb, .draw_row = prv_draw_row_cb, .selection_changed = prv_selection_changed_cb, .select_click = prv_select_click_cb, .num_rows = prv_num_rows_cb, .expand = prv_expand_cb, .hide = prv_hide_cb, }; return settings_window_cre...
/* * 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...
(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_ASSERTN(timer->id != TASK_TIMER_INVALID_ID); manager->idle_timers = list_insert_before(manager->idle_timers, &timer->list_node); mutex_u...
ocate immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "Foo bar"); cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, .box = (GRect) { GPointZero, (GSize) { 7 * HORIZ_ADVANCE_PX, 10 } } }; line.max_w...
cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params))
; cl_assert(line.height_px == 10); cl_assert(line.width_px == 1 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 1 * HORIZ_ADVANCE_PX); // reset line ...