prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
Legacy2Scheduler *)app_state_get_animation_state(); } return (AnimationLegacy2Scheduler *)kernel_applib_get_animation_state(); } inline static uint32_t animation_legacy2_get_ms_since_system_start(void) { return (sys_get_ticks() * 1000 / RTC_TICKS_HZ); } static void animation_legacy2_timer_callback( ...
animation->implementation->teardown(animation)
; } } void animation_legacy2_private_unschedule_all(AppTaskCtxIdx idx) { AnimationLegacy2Scheduler *animation_legacy2_scheduler = animation_legacy2_scheduler_data_for_app_ctx_idx(idx); AnimationLegacy2 *animation = (AnimationLegacy2 *) animation_legacy2_scheduler->head; while ...
resource/resource_ids.auto.h" #include "services/common/comm_session/app_session_capabilities.h" #include "services/common/i18n/i18n.h" #include "services/normal/app_cache.h" #include "services/normal/blob_db/app_db.h" #include "services/normal/blob_db/pin_db.h" #include "services/normal/persist.h" #include "services/n...
{ app->last_activity = RECENT_APP_LAST_ACTIVITY_INVALID; }
} mutex_unlock_recursive(s_recent_apps.mutex); } void app_install_mark_prioritized(AppInstallId install_id, bool can_expire) { if (install_id == INSTALL_ID_INVALID) { return; } mutex_lock_recursive(s_recent_apps.mutex); { const time_t cur_time = time_get_uptime_seconds(); RecentApp *app = cir...
584, -128}, { -832, 400, 48}, { -520, 328, 64}, { -352, 360, -48}, { -320, 360, -56}, { -368, 304, 8}, // 18 seconds { -504, 352, 40}, { -608, 384, 48}, { -720, 464, 16}, { -1064, 528, 16}, { -1072, 480, 16}, { -1152, 568, -72}, { -1048, 592, -88}, { -904, 616, -2...
{ -1040, 680, -56}, { -1072, 656, -88}, { -1168, 672, -104}, { -808, 456, 32}, { -440, 472, -96}, { -336, 456, -192}, { -320, 384, -80}, { -440, 328, 0}, { -520, 328, 56}, { -632, 392, 64}, { -840, 448, 96}, { -1040, 488, 136}, { -960, 552, 16}, { -1032, 616, -104...
{ -888, 384, 64}, { -1136, 424, 104}, { -1296, 536, 0}, // 26 seconds { -1176, 584, -40}, { -704, 680, -320}, { -896, 640, -360}, { -816, 416, -80}, { -584, 328, -72}, { -376, 416, -192}, { -336, 424, -208}, { -352, 352, -128}, { -496, 376, -128}, { -624, 392, -6...
toLocaleTimeString(undefined, {});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "20:04:05"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, " "{hour: undefined, minute: undefined, second: undefined});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "20:04:05"); EXECUTE_SCRIPT_EXPECT_ERROR( "d.toLocaleTimeSt...
("s = d.toLocaleDateString(undefined, {day: '2-digit'});")
; ASSERT_JS_GLOBAL_EQUALS_S("s", "25"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'short'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Mon"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'long'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Monday"); EXECUTE_SCRIPT("s = d.toLocaleDateString(und...
uData *data = (LauncherMenuData *) context; prv_reload_status_bar_icons(data); } static void prv_subscribe_to_event(EventServiceInfo *result, PebbleEventType type, void *callback_context) { *result = (EventServiceInfo) { .type = type, .h...
(0, s_launcher_menu_persisted_data.menu_index_row)
, MenuRowAlignNone, false); scroll_layer_set_content_offset(&data->menu_layer.scroll_layer, GPoint(0, s_launcher_menu_persisted_data.scroll_offset_y), false); } else { //...
/* * 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_register_character_callback(prompt_handle_character)
/////////////// void test_alerts__enabled(void) { alerts_set_mask(AlertMaskAllOn); cl_assert(alerts_get_mask() == AlertMaskAllOn); // Should allow all notifications to go through cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_assert(alerts_should_notify_for_type(AlertReminder)); cl_assert(alert...
rtc_get_ticks()
+ NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(alerts_should_enable_backlight_for_type(AlertPhoneCall)); cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_vibrate_for_type(AlertMobile)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_...
ResponsivenessGrantedHandler granted_handler) { } // Referenced from protocol_endppints_table.auto.h override header: /////////////////////////////////////////////////////////// typedef enum { TestEndpointPrivate, TestEndpointPublic, TestEndpointAny, NumTestEndpoint, } TestEndpoint; static int s_protocol_c...
(MetaResponseCodeUnhandled)
; // Length: 1, Endpoint ID: OTHER_NON_EXISTENT_ENDPOINT_ID, Payload: 0x55 RECEIVE(0x00, 0x01, OTHER_NON_EXISTENT_ENDPOINT_ID >> 8, OTHER_NON_EXISTENT_ENDPOINT_ID & 0xff, 0x55); cl_assert_equal_i(s_prepare_count, 0); assert_meta_response_sent(MetaResponseCodeUnhandled); // Length: 1, Endpoint ID: ...
size_t info_length = ntoh16(packet->i.length) - sizeof(ReliablePacket); // This variable is read in the macro-expansion below, but linters // have a hard time figuring that out. (void)info_length; switch (ntoh16(packet->i.protocol)) { case PULSE_CONTROL_MESSAGE_PROTOCOL:...
{ // The PULSE task processes ACKs and retransmits timed-out packets. // We will deadlock if we ever have to wait on s_tx_lock from the PULSE task. PBL_ASSERT_NOT_TASK(PebbleTask_PULSE); if (!s_layer_up) { return NULL; } xSemaphoreTake(s_tx_lock, portMAX_DELAY); if (!s_layer_up) { // Transport wen...
void pulse_reliable_send_cancel(void *buf) { prv_assert_reliable_buffer(buf); xSemaphoreGive(s_tx_lock); } void pulse_reliable_send(void *buf, const size_t length) { if (!s_layer_up) { PBL_LOG(LOG_LEVEL_DEBUG, "Transport went down before send"); return; } prv_assert_reliable_buffer(buf); s_tx_bu...
*entry = state->test_entry; return true; } else { // No more in this file fclose(state->common.file); state->common.file = NULL; } } } // --------------------------------------------------------------------------------------- // Return info on the next set of samples static bool pr...
if ((activity_type == KAlgActivityType_Sleep) || (activity_type == KAlgActivityType_RestfulSleep)) { return; }
// If this activity already exists, update it KAlgTestActivitySession *session = s_captured_activity_sessions; for (int i = 0; i < s_num_captured_activity_sessions; i++, session++) { if (session->start_utc == start_utc && session->activity == activity_type) { entry_idx = i; break; } } 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...
handle_deinit()
g, void *context) { const char *msg = i18n_get(config->message, dialog); dialog_set_text(dialog, msg); i18n_free(msg, dialog); dialog_set_icon(dialog, config->icon); dialog_set_text_color(dialog, config->text_color); dialog_set_background_color(dialog, config->background_color)...
PBL_ASSERTN(context)
; *context = (ActionToggleContext) { .config = *config, }; prv_call_get_state_callback(context); if (prv_should_prompt(config)) { prv_push_prompt_dialog(context); } else { prv_push_result_dialog(context); prv_call_set_state_callback(context); } }
produce a delay 4ms delay_us(4); } //! These functions needed to be called around any commands that //! are sent to the display. NOINLINE only for code size savings. static NOINLINE void prv_enable_display_access(void) { prv_enable_display_spi_clock(); prv_enable_chip_select(); } static NOINLINE void prv_disabl...
{ return (x + 7) >> 3; }
st_message = message; ++s_num_message_handler_calls; } static int s_num_sent_handler_called; static AppOutboxStatus s_last_sent_status; static void *s_expected_cb_ctx = (void *)0x77777777; void test_app_outbox_sent_handler(AppOutboxStatus status, void *cb_ctx) { cl_assert_equal_p(s_expected_cb_ctx, cb_ctx); s_la...
(AppOutboxStatusOutOfMemory)
; } void test_app_outbox__send_but_null_sent_handler(void) { prv_register(); // Invalid data, so normally an event would get put to invoke the sent_handler, // but sent handler is NULL. Expect no events to be put. cl_assert_passert(app_outbox_send(NULL, 0, NULL, s_expected_cb_ctx)); cl_assert_equal_i(s_num_a...
); // Construct the crash reason string (copied by the dialog, so we don't have to free it ourselves) // "Worker " is 7, optional space is 1, up to 15 for app name, rest of string is 32, 1 for '\0' const uint8_t MAX_APP_NAME_STRING_LENGTH = 15; const uint8_t CRASH_REASON_BUFFER_SIZE = 7 + 1 + MAX_APP_NAME_STRI...
(prv_push_reset_dialog, YOUR_PEBBLE_RESET)
; } //! Restrict only to the two defines above //! Show the "Your Bluetooth is ..." void crashed_ui_show_bluetooth_stuck(void) { launcher_task_add_callback(prv_push_reset_dialog, PHONE_BT_CONTROLLER_WEDGED); } #endif
{ -1352, 304, -128}, { -1168, 176, 0}, { -1088, 48, 96}, { -1008, -32, 80}, { -952, 48, 32}, { -888, 56, 16}, { -904, 56, 128}, { -872, -184, 336}, { -1032, 304, 152}, { -1264, 232, 128}, { -1152, 560, -456}, { -1104, 624, -632}, { -1256, 448, -352}, { -1328, -88,...
{ -1088, 80, 240}, { -1056, 64, 200}, { -1080, 96, 184}, { -1104, 112, 184}, { -1224, -232, 248}, { -1008, -424, 224}, { -1032, -32, 96}, { -1480, 80, 144}, { -1336, 344, -144}, { -1472, 264, -56}, { -1568, 120, 88}, { -1392, 208, 120}, { -1192, 312, 136}, { -1032...
{ -920, 208, 48}, { -1072, 280, 104}, { -1232, 496, 48}, { -1192, 576, 48}, { -1072, 1152, 80}, { -1024, 832, -8}, { -1256, 800, -72}, { -1568, 720, 224}, { -1104, 728, -24}, { -1368, 704, 168}, { -1648, 624, 336}, { -1536, 720, 328}, { -1320, 432, 352}, { -1104,...
/* * 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, "Advancing to 300ms from the end of %d ms", (int)duration)
s_spi_transport.state = SPITransportState_WaitingForReceiving; } else if (s_spi_transport.bytes_sendable_count) { prv_watchdog_start(); s_spi_transport.state = SPITransportState_WaitingForSending; } else { // Nothing to send nor receive, back to idle: s_spi_transport.state = SPITransportState_Idle; ...
{ // Got INT while DMA TC interrupt hasn't happened yet. // This might happen if the Dialog side would be *extremely* fast and assert the INT line // faster than the DMA transfer complete interrupt happens. Probably very unlikely, but // in case we're worried about this: // FIXME: Maybe th...
case SPITransportState_CoreDump: // Do nothing. The proper authorities have already been notified. break; default: break; } } static size_t prv_host_transport_tx_get_length(void) { prv_lock(); size_t rx_length = circular_buffer_get_read_space_remaining(&s_spi_transport.tx); prv_unl...
.is_current_location = is_current_location, .current_temp = 68, .today_high = 68, .today_low = 58, .current_weather_type = WeatherType_PartlyCloudy, .current_weather_phrase = "Cloudy with 90% chance of meatballs", .tomorrow_high = 62, .tomorrow_low = 52, .tomorrow_we...
(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_weather_app_layout__render_all_unknown_values(void) { const WeatherLocationForecast forecast = { .location_name = "PALO ALTO", .current_temp = WEATHER_SERVICE_LOCATION_FORECAST_UNKNOWN_TEMP, .today_high = WEATHER_SERVICE_LOCATION_FORECAST_UNKNOWN_TEMP, .today_low = WEATHER_SERVICE_LOCAT...
vity_cb, NULL); cl_assert_equal_i(num_restfulsleep_sessions, s_prv_activity_cb__call_count); cl_assert_equal_b(s_prv_activity_cb__args[0].activity, HealthActivityRestfulSleep); // respect mask for Run/Walk s_prv_activity_cb__call_count = 0; s_sys_activity_get_sessions_values.out.num_sessions = 7; health_se...
cl_assert(0 > prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 10}, &(ActivitySession) {.start_utc = now + (2 * SECONDS_PER_MINUTE), .length_min = 5}, HealthIterationDirectionFuture))
; // b starts earlier cl_assert(0 < prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 10}, &(ActivitySession) {.start_utc = now - (2 * SECONDS_PER_MINUTE), .length_min = 5}, HealthIterationDirectionFuture)); // both end at the same time cl_assert(0 == prv_session_compare( ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const size_t str_length = str ? (strlen(str) + 1) : 0; GTextNodeText *text_node = graphics_text_node_create_text(str_length); if (text_node && str) { strncpy((char *)text_node->text, str, str_length); } return text_node; }
static GTextNodeText *prv_create_text_node_attribute(const LayoutLayer *layout, AttributeId attr_id) { const char *attr_str = attribute_get_string(layout->attributes, attr_id, ""); if (IS_EMPTY_STRING(attr_str) && attr_id != AttributeIdUnused) { return NULL...
memcpy(&buf[1], &s_hci_cmd_info.data_buf[0], payload_len); bool should_context_switch; system_task_add_callback_from_isr(prv_handle_hci_cmd, buf, &should_context_switch); // reset our state machine s_hci_cmd_info = (HciCmdInfo) { }; } } bool bt_driver_test_selftest(void) { DialogChipID chip_id; ...
{ s_response_callback = callback; }
void bt_driver_start_unmodulated_tx(uint8_t tx_channel) { if (!prv_in_test_mode()) { return; } hc_endpoint_test_unmodulated_tx_test_start(tx_channel); } void bt_driver_stop_unmodulated_tx(void) { if (!prv_in_test_mode()) { return; } hc_endpoint_test_unmodulated_tx_test_stop(); }
*bounds, GTextOverflowModeWordWrap, GTextAlignmentLeft, (GTextAttributes *)&text_layout); avg_text_size = text_layout.max_used_size; total_width += avg_text_size.w + AVG_LINE_LEGEND_WIDTH; // Draw the avg line legend cursor_x = (bounds->size.w - total...
{ if (graph_card->selection == HealthGraphIndex_Sunday) { // Sunday is the last day in the graph, show the average next graph_card->selection = HealthGraphIndex_Average; } else if (graph_card->selection == HealthGraphIndex_Average) { // Monday is the first day in the graph, show Monday after showing the...
TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 3); graphics_draw_round_rect...
(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 1); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw...
file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS ...
layer_add_child(&window->layer, &text_layer->layer)
; } // Window Setup void time_range_selection_window_init(TimeRangeSelectionWindowData *time_range_selection_window, GColor color, TimeRangeSelectionCompleteCallback complete_callback, void *callback_context) { // General window setup *time_range_selection_window = (TimeRangeSelectionWindowData) { .complet...
QSPIC_BURSTCMDB_REG, QSPIC_WRAP_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_INST_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_DMY_NUM, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_EXT_HF_DS, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_EXT_BYTE_EN, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCM...
REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_ASSOCIATIVITY_RESET_VALUE, 0x2)
istance = prv_last_update_distance(a); cl_assert(distance > TEST_ANIMATION_NORMALIZED_HIGH); // B should start high distance = prv_last_update_distance(b); cl_assert(distance > TEST_ANIMATION_NORMALIZED_HIGH); // Execute to the end of B prv_advance_to_ms_with_timers(start_ms + duration_total + 1 * MIN_FR...
(prv_count_handler_entries(&s_started_handler_calls, NULL), 7)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NULL), 6); // Unschedule the top-level animation_unschedule(clone); // Keep going, nothing new should happen except stop handlers for each component prv_advance_to_ms_with_timers(start_ms + 5 * (duration_total + 3 * MIN_FRAME_INTERVAL_...
tatic AnimationLegacy2Scheduler* get_current_scheduler(void) { if (pebble_task_get_current() == PebbleTask_App) { return (AnimationLegacy2Scheduler *)app_state_get_animation_state(); } return (AnimationLegacy2Scheduler *)kernel_applib_get_animation_state(); } inline static uint32_t animation_legacy2_get_ms_s...
if (animation->handlers.stopped) { animation->handlers.stopped(animation, finished, animation->context); }
if (animation->implementation->teardown != NULL) { animation->implementation->teardown(animation); } } void animation_legacy2_private_unschedule_all(AppTaskCtxIdx idx) { AnimationLegacy2Scheduler *animation_legacy2_scheduler = animation_legacy2_scheduler_data_for_app_ctx_id...
ded_notification(node); } } // Return true if successful static bool prv_push_notification_window(NotificationsData *data) { notification_window_init(false /*is_modal*/); // Bail if a notification came in ahead of us and created a modal window // before we had a chance to react to the select button event. i...
gdraw_command_get_stroke_color((GDrawCommand *)command)
)); gdraw_command_set_fill_color(processed_command, prv_invert_bw_color(gdraw_command_get_fill_color((GDrawCommand *)command))); } static void prv_draw_pdc_bw_inverted(GContext *ctx, GDrawCommandImage *image, GPoint offset) { GDrawCommandProcessor processor = { .command = prv_invert_pdc_colors, }; gd...
dbgserial_init()
; pulse_early_init(); print_splash_screen(); rtc_init(); #if BOOTLOADER_TEST_STAGE2 #define BLTEST_LOG(x...) pbl_log(LOG_LEVEL_ALWAYS, __FILE__, __LINE__, x) BLTEST_LOG("BOOTLOADER TEST STAGE 2"); boot_bit_set(BOOT_BIT_FW_STABLE); BLTEST_LOG("STAGE 2 -- Checking test boot bits"); if (boot_bit_test(BOOT...
nst GRect *bounds = &scroll_layer->layer.bounds; scroll_layer->layer.property_changed_proc = scroll_layer_property_changed_proc; layer_init(&scroll_layer->content_sublayer, bounds); layer_add_child(&scroll_layer->layer, &scroll_layer->content_sublayer); prv_setup_shadow_layer(scroll_layer); } ScrollLayer* sc...
if (was_running && !scroll_layer_get_paging(scroll_layer)) { animation_set_curve(animation, AnimationCurveEaseOut); }
} else { scroll_layer->animation = property_animation_create(&implementation, scroll_layer, NULL, &offset); animation = property_animation_get_animation(scroll_layer->animation); if (scroll_layer_get_paging(scroll_layer)) { animati...
ot support arc()"); } void test_rocky_api_graphics_path2d__fill_oom(void) { rocky_global_init(s_graphics_api); prv_create_global_ctx(); EXECUTE_SCRIPT( "ctx.moveTo(1, 2);\n" "ctx.lineTo(3, 4);\n" "ctx.lineTo(5, 6);\n" ); // OOM! fake_malloc_set_largest_free_block(0); // Call implementatio...
((GVectorPrecise(8, 0)), s_rocky_path_steps[3].pt.fill_delta)
; cl_assert_equal_vector_precise((GVectorPrecise(0, 8)), s_rocky_path_steps[5].pt.fill_delta); } void test_rocky_api_graphics_path2d__close_path(void) { rocky_global_init(s_graphics_api); prv_create_global_ctx(); cl_assert_equal_i(0, s_rocky_path_steps_num); EXECUTE_SCRIPT( "ctx.moveTo(1, 2);\n" "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...
analytics_set(ANALYTICS_DEVICE_METRIC_SYSTEM_CRASH_CODE, 0xDEAD0000 | reason.code, AnalyticsClient_System)
; uint32_t lr = reason.extra; // Leave this NULL to do your own printing. const char *reason_string = NULL; switch (reason.code) { // Normal stuff case RebootReasonCode_Unknown: reason_string = "We don't know why we %s rebooted."; lr = mcu_reboot_reason.reset_mask; break; case RebootReasonCod...
include "stubs_pbl_malloc.h" #include "stubs_resources.h" #include "stubs_syscalls.h" #include <stdio.h> // stubs InterpolateInt64Function animation_private_current_interpolate_override(void) { return NULL; } static FrameBuffer *fb = NULL; // Setup void test_gdraw_command_transforms__initialize(void) { fb = ma...
cl_assert_equal_i(y, -181 * 181)
; } void test_gdraw_command_transforms__segmented_scale(void) { GContext ctx; test_graphics_context_init(&ctx, fb); graphics_context_set_fill_color(&ctx, GColorFromHEX(0x55aaff)); graphics_context_set_antialiased(&ctx, true); graphics_fill_rect(&ctx, &ctx.dest_bitmap.bounds); GDrawCommandImage *l = weathe...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(layer->bounds, GEdgeInsets(0, rl_margin))
; const GSize icon_size = kino_reel_get_size(icon); const int icon_x = drawing_rect.origin.x + PBL_IF_RECT_ELSE(0, (rl_margin / 2)) + (drawing_rect.size.w / 2) - (icon_size.w / 2); const int icon_y = PBL_IF_RECT_ELSE(45, 49); kino_reel_draw(icon, ctx, GPoint(icon_x, icon_y)); const int na...
if (success) { return S_SUCCESS; } else { return E_INVALID_ARGUMENT; }
} int prefs_db_get_len(const uint8_t *key, int key_len) { size_t len = prefs_private_get_backing_len(key, key_len); if (len == 0) { return E_INVALID_ARGUMENT; } return len; } status_t prefs_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len) { bool success = prefs_private_read_b...
point_tmp.x, radius, progress_line, &left_margin, &right_margin); // Finally draw line if (left_margin.raw_value <= right_margin.raw_value) { graphics_private_plot_horizontal_line(ctx, y, left_margin, right_margin, (fraction_...
{ // Main part of the stroked line if (tm_p1.x.raw_value != tm_p0.x.raw_value) { top_margin.raw_value = tm_p0.y.raw_value + ((tm_p1.y.raw_value - tm_p0.y.raw_value) * (x - ((tm_p0.x.raw_value + add_top) / FIXED_S16_3_ONE.raw_value))) * FIXED_S16_3_ONE.raw_value / (t...
// Find edges for both caps prv_calc_cap_vert(&p0, radius, x, &top_margin, &bottom_margin); prv_calc_cap_vert(&p1, radius, x, &top_margin, &bottom_margin); // Finally draw line if (top_margin.raw_value <= bottom_margin.raw_value) { graphics_private_draw_vertical_line(ctx, x, top...
, 0); // Note: creating a settings file is going to result in one malloc for the FD name pin_db_init(); time_util_update_timezone(&tz); uint8_t num_net_allocs = fake_pbl_malloc_num_net_allocs(); for (unsigned int i = 0; i < ARRAY_LENGTH(s_items); ++i) { cl_assert_equal_i(pin_db_insert_item(&s_items[i]), 0...
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id))
; // check sixth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); } void test_timeline__none_backwards(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_ini...
imation() animated = false; } // scroll layer will take care of clipping if necessary scroll_layer_set_content_offset(&menu_layer->scroll_layer, GPoint(0, y), animated); } } typedef struct MenuSelectIndexIterator { MenuIterator it; MenuCellSpan selection; bool did_change_selection:1; } MenuSe...
( &state.menu_layer->selection.index, &state.menu_layer->animation.new_selection.index)
== 0; if (second_half) { if (!reached_second_half_before) { const MenuIndex prev_index = state.menu_layer->selection.index; state.menu_layer->selection = state.menu_layer->animation.new_selection; prv_announce_selection_changed(state.menu_layer, prev_index); } // this favors robustness...
tarting_ticks; uint32_t count_per_sec; AnalyticsClient client; } AnalyticsStopwatchNode; static ListNode *s_stopwatch_list = NULL; static bool prv_is_stopwatch_for_metric(ListNode *found_node, void *data); void analytics_init(void) { analytics_metric_init(); analytics_storage_init(); analytics_logging_init(...
analytics_storage_take_lock()
fs); kernel_free(notif_prefs); return NULL; } prv_free_serialzed_prefs(serialized_prefs); return notif_prefs; } void ios_notif_pref_db_free_prefs(iOSNotifPrefs *prefs) { kernel_free(prefs); } status_t ios_notif_pref_db_store_prefs(const uint8_t *app_id, int length, AttributeList *attr_list, ...
prv_file_open_and_lock(&file)
) { return NULL; } BlobDBDirtyItem *dirty_list = NULL; settings_file_each(&file, sync_util_build_dirty_list_cb, &dirty_list); prv_file_close_and_unlock(&file); return dirty_list; } status_t ios_notif_pref_db_mark_synced(const uint8_t *key, int key_len) { if (key_len == 0) { return E_INVALID_ARGU...
-728}, { -568, 424, -752}, { -680, 816, -632}, { -600, 888, -920}, { -232, 976, -992}, { -472, 424, -544}, { -600, 496, -416}, { -624, 472, -392}, // 64 seconds { -600, 592, -424}, { -360, 624, -632}, { -320, 680, -608}, { -328, 512, -624}, { -360, 456, -560}, { -...
{ 944, 944, 216}, { 560, 496, 112}, { 584, 464, 176}, { 840, 576, 88}, { 968, 568, -224}, { 1536, 472, -712}, { 1136, 344, -320}, { 1544, 512, -280}, { 1160, 800, -472}, { 832, 960, -352}, { 704, 848, -168}, { 1128, 552, 72}, { 1184, 32, 88}, { 1096, 168, -72}, ...
{ 1184, 600, -32}, { 1624, 528, 56}, { 1688, 360, 80}, // 72 seconds { 1504, 216, 96}, { 1488, 184, 96}, { 1472, 248, 40}, { 1304, 296, 0}, { 1040, 272, -32}, { 936, 216, -56}, { 912, 208, -120}, { 640, 8, -64}, { 856, -16, 24}, { 1080, 272, -96}, { 1248, 360...
applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h...
EXECUTE_SCRIPT("_rocky.on('bar', function(){})")
; cl_assert_equal_i(2, s_prv_api_add__callcount); cl_assert_equal_b(false, rocky_global_has_event_handlers("bar")); cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_global__can_unsubsribe_event_handlers(void) { static const RockyGlobalAPI api = { .add_handler = prv_api_add, .remove_h...
ed */); } GAPLEConnectionIntent *intent = s_intents; while (intent) { GAPLEConnectionIntent *next = (GAPLEConnectionIntent *) intent->node.next; if (prv_intent_matches_connection(intent, connection)) { // Notify clients: if (prv_update_clients(intent, event->reason...
{ PBL_LOG(LOG_LEVEL_ERROR, "Already connecting..."); return; }
BLE_GAP_LOG_DEBUG("Starting connecting.."); unsigned int stack_id = bt_stack_id(); // See Bluetooth Spec 4.0, Volume 2, Part E, Chapter 7.8.12: const GAP_LE_Address_Type_t local_addr_type = BleAddressType_Random; GAP_LE_Connection_Parameters_t connection_params = { .Connection_Interval_Min = 40, .Co...
_per_call; i++) { min_value = MIN(min_value, value); max_value = MAX(max_value, value); sum += value; count++; s_sys_activity_get_minute_history_values.out[1].records[i].heart_rate_bpm = value; value++; if (value > 200) { value = 50; } } int32_t avg_value = ROUND(sum, count); ...
health_service_metric_aggregate_averaged_accessible( HealthMetricHeartRateBPM, now, now, HealthAggregationAvg, HealthServiceTimeScopeOnce)
; cl_assert(accessible & HealthServiceAccessibilityMaskAvailable); // Create an alert for heart rate HealthMetricAlert *alert = health_service_register_metric_alert(HealthMetricHeartRateBPM, 65); cl_assert(alert != NULL); // If we try to register another for heart rate, it should fail HealthMetricAlert *f...
k_midnight = time_util_get_midnight_of(rtc_get_time() + SECONDS_PER_WEEK); const char *time_fmt = NULL; int style; if (clock_is_24h_style()) { if (capitalized) { style = FullStyleCapital24h; } else { style = FullStyleLower24h; } } else { if (capitalized) { style = FullStyleCap...
strncpy(buffer, capitalized ? i18n_get("NOW", buffer) : i18n_get("Now", buffer), buf_size)
; } else if (difference >= -(SECONDS_PER_HOUR - SECONDS_PER_MINUTE)) { const int num_minutes = prv_round(-difference, SECONDS_PER_MINUTE, RoundTypeAlwaysUp) / SECONDS_PER_MINUTE; const char *str_fmt; if (capitalized) { str_fmt = i18n_noop("IN %lu MIN"); } else if (num_minutes == 1) { ...
; } static void prv_app_button_up_handler(PebbleEvent *e, void *context) { if (window_stack_is_animating(app_state_get_window_stack())) { return; } click_recognizer_handle_button_up( &app_state_get_click_manager()->recognizers[e->button.button_id]); } // this handler is called via the legacy2_status_...
app_state_get_applib_internal_events_info()
; events_info->will_focus_event = (EventServiceInfo) { .type = PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT, .handler = prv_app_will_focus_handler, }; events_info->button_down_event = (EventServiceInfo) { .type = PEBBLE_BUTTON_DOWN_EVENT, .handler = prv_app_button_down_handler, }; events_info->button_up...
ending a status message //! and disconnecting if the smartstrap doesn't reply. This is in seconds. #define STATUS_CHECK_INTERVAL 5 //! The minimum number of seconds between connnection requests to avoid spamming the smartstrap. #define MIN_CONNECTION_REQUEST_INTERVAL 1 //! The minimum number of seconds be...
{ PBL_LOG(LOG_LEVEL_WARNING, "Got link control status: INVALID (%d)", status); smartstrap_link_control_disconnect(); success = false; }
uffer, else go */ /* forward. This will hopefully help to reduce */ /* fragmentataion problems. */ if (n_units >= LARGE_SIZE) { heap_info_ptr = get_previous_block(heap, heap_info_ptr); } else { heap_info_ptr = get_next_block(heap, heap_info_ptr);...
(heap, count * size, client_pc)
; } uint32_t heap_get_minimum_headroom(Heap *heap) { return (heap_size(heap) - heap->high_water_mark); } // Serial Commands /////////////////////////////////////////////////////////// #ifdef MALLOC_INSTRUMENTATION void heap_dump_malloc_instrumentation_to_dbgserial(Heap *heap) { char buffer[80]; unsigned long nu...
/* * 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 (!battery_is_usb_connected() && prv_is_allowed_to_run()) { prv_handle_action(StationaryActionEnableStationary); } else { prv_handle_action(StationaryActionDisableStationary); }
} void stationary_handle_battery_connection_change_event(void) { PBL_LOG_D(DEBUG_STATIONARY, LOG_LEVEL_DEBUG, "Stationary mode battery state change event received"); if (battery_is_usb_connected()) { analytics_event_stationary_state_change(rtc_get_time(), StationaryAnalyticsEnterCharging); } els...
ition is met before continuing without locking. static void prv_heap_lock(void* unused) { PBL_ASSERT_TASK(PebbleTask_App); } void prv_dump_start_app_info(const PebbleProcessMd *app_md) { char *app_type = ""; switch (process_metadata_get_app_sdk_type(app_md)) { case ProcessAppSDKType_System: app_type = ...
memset(__ROCKY_BSS__, 0, (size_t)__ROCKY_BSS_size__)
; // ROCKY_BSS is inside APP_RAM to make the syscall buffer checks pass. // However, we want to avoid overlapping with any splits we're about to make: app_ram.end = __ROCKY_BSS__; // Reduce the size available for the code + app heap, on Spalding the "padding" we had left // isn't enough to fit Roc...
, 328, 129}, { -916, 308, 157}, { -985, 295, 165}, { -905, 312, 83}, { -1069, 368, 131}, { -1014, 358, 120}, { -917, 443, -7}, { -762, 490, -147}, { -820, 544, -160}, { -753, 418, -100}, { -873, 373, -25}, { -828, 364, -24}, { -806, 406, -60}, { -757, 431, -105}, ...
(app_manager_get_task_context()->to_process_event_queue)
; } // ------------------------------------------------------------------------------- // Run the minute callback enough times to cause everything that is normally periodically // recomputed (walking rate, sleep, etc.) to be recomputed static void prv_force_periodic_updates(void) { for (int i = 0; i < ACTIVITY_SESS...
on_png_data)); data->click_bitmap = gbitmap_create_from_png_data(s_golf_api_click_icon_png_data, sizeof(s_golf_api_click_icon_png_data)); // Set up UI here Layer *window_layer = window_get_root_layer(window); TextLayer **text = &data->text_layers[0]; const ...
(54, background_width / 2)
; const int16_t stroke_box_height = PBL_IF_ROUND_ELSE(53, 50); const int16_t hole_box_x_offset = PBL_IF_ROUND_ELSE(73, 0); const int16_t hole_label_y_offset = STATUS_BAR_LAYER_HEIGHT + PBL_IF_ROUND_ELSE(18, 104); const int16_t hole_value_y_offset = hole_label_y_offset + PBL_IF_ROUND_ELSE(5, 2); const int16_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...
(buffer, "Today", buf_size)
; buffer[buf_size - 1] = '\0'; } } void clock_get_since_time(char *buffer, int buf_size, time_t timestamp) { if (buffer) { strncpy(buffer, "15 minutes ago", buf_size); buffer[buf_size - 1] = '\0'; } } // Stubs ///////////////////// #include "stubs_action_menu.h" #include "stubs_analytics.h" #includ...
bs_layer; GRect frame = window_get_root_layer(window)->frame; #if PBL_RECT // on round display, the layer fills a full circle // here (on rect) it's just a small vertical stripe on the left frame.size.w = crumbs_layer_width(); #endif crumbs_layer_init(&data->crumbs_layer, &frame, data->config.colors.backgroun...
window_set_window_handlers(window, &(WindowHandlers) { .load = prv_action_window_load, .unload = prv_action_window_unload, })
; prv_action_window_push(window_stack, &data->action_menu, true /* animated */); return &data->action_menu; } ActionMenu *app_action_menu_open(ActionMenuConfig *config) { return action_menu_open(app_state_get_window_stack(), config); }
*sc_info, size_t num_sg) { PBL_ASSERTN(slave->slave_state->initialized); PBL_ASSERTN(slave->slave_state->acquired); for (size_t elem = 0; elem < num_sg; ++elem) { const SPIScatterGather *sg = &sc_info[elem]; spi_ll_slave_burst_read_write(slave, sg->sg_out, sg->sg...
{ dma_request_set_memory_increment_disabled(slave->tx_dma, false); }
else { dma_request_set_memory_increment_disabled(slave->tx_dma, true); static const uint8_t s_zero = 0; out = &s_zero; } if (in) { slave->slave_state->dma_state = SPISlavePortDMAState_ReadWrite; // start the read DMA prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqRx, true); dma_request_s...
(true, rocky_global_has_event_handlers("foo"))
; s_prv_api_add__result = false; s_log_internal__expected = (const char *[]){ "Unknown event 'bar'", NULL }; EXECUTE_SCRIPT("_rocky.on('bar', function(){})"); cl_assert_equal_i(2, s_prv_api_add__callcount); cl_assert_equal_b(false, rocky_global_has_event_handlers("bar")); cl_assert(*s_log_internal_...
/* * 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...
va_end(fmt_args)
; } void passert_failed_no_message(const char* filename, int line_number) { prv_handle_passert_failed(filename, line_number, (uintptr_t)__builtin_return_address(0), "ASSERTN", NULL); } void wtf(void) { uintptr_t saved_lr = (uintptr_t) __builtin_return_address(0); dbgserial_print("*** WTF "); dbgserial_pri...
+ 1) { wait_time++; } } else if (!match && ((predicate_cond == cond_to_valid) || (predicate_cond == cond_to_valid + 1))) { // This predicate could become valid over time. // If the conditional is not equal, add 1 to the wait time, because only the equals case // becomes...
strtol(state->position, &endptr, 10)
; if (*endptr != ')') { state->error->status = TemplateStringErrorStatus_MissingClosingParen; return; } state->position = endptr; state->filter_state = target_time - state->vars->current_time; state->time_was_until = true; } static void prv_filter_time_since(TemplateStringState *state) { prv_filter...
: 66) : (has_bpm ? 114 : 96); #elif ROBERT_SCREEN_RES bounds.origin.y += screen_is_obstructed ? 113 : 158; #elif SNOWY_SCREEN_RES if (screen_is_obstructed) { bounds = grect_inset(bounds, GEdgeInsets(0, 20)); } #endif GRect icon_bounds = gbitmap_get_bounds(shoe_icon); icon_bounds.origin = bounds.origin; ...
PBL_IF_BW_ELSE(5, 8)
; // bpm text top offset const GTextAlignment alignment = PBL_IF_BW_ELSE(GTextAlignmentLeft, GTextAlignmentRight); graphics_context_set_text_color(ctx, PBL_IF_COLOR_ELSE(GColorRed, GColorWhite)); graphics_draw_text(ctx, bpm_text, font, bounds, GTextOverflowModeFill, alignment, NULL); } #endif /////////////////...
// and make sure that the contents of the settings_file are not corrupted // in any way. // Simulate a reboot by clearing out PFS's state. fake_spi_flash_force_future_failure(0, NULL); extern void pfs_reset_all_state(void); pfs_reset_all_state(); pfs_init(false); // Reopen the file we were...
(key_i, val_i)
; return true; } void test_settings_file__each(void) { printf("\nTesting if we can use each...\n"); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_each", 4096)); uint8_t key[5]; int key_len = 4; uint8_t val[5]; int val_len = 4; for (int i = 0; i < 255; i++) { snprintf((cha...
/* * 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...
{ switch (category) { case LC_ALL: return info->app_locale_strings; case LC_TIME: return info->app_locale_time; default: return NULL; } }
et_next(); cl_assert(timer_id != TIMER_INVALID_ID); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(5*60, stub_new_timer_timeout(timer_id) / 1000); } void test_calendar_handle__ongoing_event_added_and_removed(void) { rtc_set_time(15 * 60); timeline_event_init(); cl_assert_equal_i(fake_e...
cl_assert(prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000); rtc_set_time(110 * 60); cl_assert(stub_new_timer_fire(timer_id)); cl_assert_equal_i(fake_event_get_count(), 6); cl_assert(!prv_get_calendar_ongoing()...
void test_calendar__handle_non_calendar_pins(void) { // Insert a random pin (non calendar event) cl_assert(timeline_add(&item5)); timeline_event_handle_blobdb_event(); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_ne...
= 5, .from_minute = 0, .to_hour = 13, .to_minute = 0, }; do_not_disturb_set_schedule(WeekdaySchedule, &schedule_2); rtc_set_time(s_thursday_12_00); do_not_disturb_handle_clock_change(); // Should still be in scheduled period cl_assert(do_not_disturb_is_manually_enabled() == false); active = do...
rtc_set_time(s_saturday_01_30)
; do_not_disturb_handle_clock_change(); active = do_not_disturb_is_active(); cl_assert(active == false); // Timer will go off at 00:00 on Monday. (46.5 hours) cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 167400 * MS_PER_SECOND); rtc_set_time(s_thursday_00_00); do_not_disturb_handle_clock...
nused) { bt_lock(); { PPoGATTClient *client = s_ppogatt_head; while (client) { prv_increment_timeout_counter_if_necessary(client); prv_check_timeouts(client); client = (PPoGATTClient *) client->node.next; } } bt_unlock(); } // ------------------------------------------------------...
{ // Device got disconnected in the mean time return 0; }
const uint16_t num_bytes_overhead = 3 /* ATT header */ + sizeof(PPoGATTPacket); return (mtu - num_bytes_overhead); } // ------------------------------------------------------------------------------------------------- static void prv_enter_awaiting_reset_complete(PPoGATTClient *client, bool self_initiated) { i...
m_values; i++) { cl_assert_equal_i(metric_values->values[i], other->values[i]); } } static void prv_check_attribute_list_serialize(AttributeList *attr_list_to_serialize, const uint8_t *expected_attr_list_serialized, size_t expected_a...
attribute_get_string(&list, AttributeIdTitle, "")
uItem *action_menu_item, void *context) { prv_mute_notification(action_menu_item, MuteBitfield_Weekdays); } static void prv_mute_notification_weekends(ActionMenu *action_menu, const ActionMenuItem *action_menu_item, ...
ios_notif_pref_db_get_prefs((uint8_t *)app_id, strlen(app_id))
; char *display_name = ""; if (notif_prefs) { display_name = (char *)attribute_get_string(&notif_prefs->attr_list, AttributeIdAppName, ""); } const char *mute_label = i18n_noop("Mute %s"); static char mute_label_buf[32]; snprintf(mute_label_buf, sizeof(mute_label_buf), i18n_ge...
/* * 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...
pebble_task_get_current()
; if (task == PebbleTask_App || task == PebbleTask_Worker) { prv_put_event_from_process(task, event); } else { event_put(event); } } DEFINE_SYSCALL(void, sys_current_process_schedule_callback, CallbackEventCallback async_cb, void *ctx) { // No userspace buffer assertion for ctx needed, b...
/* * 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 100; }
uint8_t activity_prefs_heart_get_zone1_threshold(void) { return 130; } uint8_t activity_prefs_heart_get_zone2_threshold(void) { return 154; } uint8_t activity_prefs_heart_get_zone3_threshold(void) { return 172; } AppInstallId app_get_app_id(void) { return 0; } // ------------------------------------------...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(prv_get_uuid(), prv_get_uuid())
; } // EllipsisDrawConfig ///////////////////////// #define EX_QDC ((EllipsisDrawConfig) { \ .start_quadrant = { \ .angle = 1000, \ .quadrant = 1 \ }, \ .full_quadrants = GCornersAll, \ .end_quadrant = { \ ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_set_window_handlers(window, (WindowHandlers) { .load = window_load, .unload = window_unload, })
; const bool animated = true; window_stack_push(window, animated); } static void deinit(void) { window_destroy(window); } int main(void) { init(); app_event_loop(); deinit(); }
PBL_ASSERTN(result == APP_MSG_OK); if (bpm) { dict_write_uint8(app_data->out_iter, AppMessageKey_HeartRate, bpm); dict_write_uint8(app_data->out_iter, AppMessageKey_Confidence, bpm_quality); } if (led_current) { dict_write_uint16(app_data->out_iter, AppMessageKey_Current, le...
prv_translate_error(reason)
); AppData *app_data = app_state_get_user_data(); app_data->ready_to_send = true; } static void prv_remote_notify_timer_cb(void *data) { prv_send_status_and_version(); } static void prv_init(void) { AppData *app_data = app_malloc_check(sizeof(*app_data)); *app_data = (AppData) { .session = (HRMSessionRe...
/* * 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...
(address_str)
ue); const GColor arrow_fill_color = PBL_IF_RECT_ELSE(timeline_layer->sidebar_color, GColorWhite); graphics_context_set_fill_color(ctx, arrow_fill_color); gpath_draw_filled(ctx, &arrow_path); graphics_context_set_antialiased(ctx, false); } ///////////////////////////////////////// // Public functions /////////...
prv_place_end_of_timeline(layer)
; // TODO: PBL-21982: Only support rectangular screen for now #if PBL_RECT timeline_relbar_layer_reset(layer); #endif } void timeline_layer_set_sidebar_color(TimelineLayer *timeline_layer, GColor color) { timeline_layer->sidebar_color = color; } void timeline_layer_set_sidebar_width(TimelineLayer *timeline_layer...
s_selected = menu_cell_layer_is_highlighted(cell_layer); const bool draw_two_columns = (config->value || (config->icon && ((GAlign)config->icon_align == GAlignRight))); // Determine appropriate insets to match designs GRect cell_layer_bounds = cell_layer->bounds; const int16_t horizontal_inset = (cell_is...
fonts_get_system_font(FONT_KEY_GOTHIC_28)
; GRect box = cell_layer->bounds; box.origin.x = 3; box.origin.y -= 4; box.size.w -= 3; graphics_draw_text(ctx, title, font, box, GTextOverflowModeFill, GTextAlignmentLeft, NULL); } } ////////////////////// // Basic header cell void menu_cell_basic_header_draw(GContext* ctx, const Layer *cell_la...
/* * 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...
SPI_I2S_ReceiveData(FLASH_SPI)
/* * 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(buf, fb_offset, length); return length; }
static int framebuffer_domain_write(uint8_t *buf, uint32_t address, uint32_t length, void *context) { uint8_t *fb_offset = (uint8_t*)compositor_get_framebuffer()->buffer + address; memcpy(fb_offset, buf, length); return length; } static int framebuffer_domain_stat(uint8...
ess or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stddef.h> #include <stdio.h> #include <string.h> #include "drivers/crc.h" #include "drivers/flash.h" #include "flash_region.h" #include "git_version.auto.h" #include "system/firmware_...
(&build_id_bytes_left)
; while (buffer_bytes_left >= 3 /* 2 hex digits, plus zero terminator */ && build_id_bytes_left > 0) { snprintf(buffer, buffer_bytes_left, "%02x", *build_id); buffer += 2; buffer_bytes_left -= 2; build_id += 1; build_id_bytes_left -= 1; } } static void version_fw_version_to_major_min...
/* * 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(buffer, flash_new_fw_start + i, chunk_size)
; if (!system_flash_write(FIRMWARE_BASE + i, buffer, chunk_size, NULL, NULL)) { dbgserial_putstr("We're dead"); return false; } prv_display_write_progress(i + chunk_size, firmware_length, NULL); } return true; } static bool check_firmware_crc(FirmwareDescription* firmware_description) { d...
lse); graphics_draw_line(ctx, GPoint(40, 50), GPoint(35, 70)); } void across_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(5, -3...
graphics_draw_line(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT)
_init(&ctx, fb); // SW = 1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, OR...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 11); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, fa...
/* * 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...
passert_failed(filename, line_number, NULL)
return HealthServiceAccessibilityMaskNoPermission; } if (!prv_metric_aggregation_implemented(metric, time_start, time_end, aggregation, scope)) { return HealthServiceAccessibilityMaskNotSupported; } // Get our state HealthServiceState *state = prv_get_state(false); HealthServiceTimeRange time_rang...
if (valid_hr_sample_num) { // If this is scope-once, the metric is BPM, and the time range is less than // HS_MAX_MINUTE_DATA_SEC, we can use minute history since the amount of data is manageable. return prv_compute_aggregate_using_minute_history(state, metric, time_start, time_end, ...
} else if (metric == HealthMetricHeartRateRawBPM) { // We don't allow the user to gather data from raw HR samples. Only return the current and // return. If time_start and time_end were not for the current time, they are filtered out // by the function above `prv_metric_aggregation_implemented`. int3...
/* * 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, peek_layer->bg_color); // Fill the peek background as a circle on round displays; this is needed to animate the // peek moving right as a circle to become the side bar on timeline as well as moving up to // become the top banner in the notifications window #if PBL_...
if (peek_layer->show_dot) { graphics_context_set_fill_color(ctx, GColorBlack); GRect dot_rect = { .size = { peek_layer->dot_diameter, peek_layer->dot_diameter } }; grect_align(&dot_rect, &peek_layer->layer.bounds, GAlignCenter, false /* clip */); graphics_fill_radial(ctx, dot_rect, GOvalScaleModeFit...
unds); char bpm_text[16]; snprintf(bpm_text, sizeof(bpm_text), i18n_get("%d BPM", i18n_owner), current_bpm); #if PBL_BW bounds.origin.x += 62; // bpm text left offset #endif bounds.origin.y -= PBL_IF_BW_ELSE(5, 8); // bpm text top offset const GTextAlignment alignment = PBL_IF_BW_ELSE(GTextAlignmentLeft, G...
i18n_get("%d", data)
, hundreds); } layer_mark_dirty(&data->base_layer); } static void prv_update_current_steps(KickstartData *data) { data->current_steps = health_service_sum_today(HealthMetricStepCount); prv_update_steps_buffer(data); } static void prv_update_typical_steps(KickstartData *data) { data->typical_ste...
r agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "gdraw_command_sequence...
gdraw_command_frame_get_duration(frame)
; if (total > elapsed) { break; } frame = prv_next_frame(frame); } // return the last frame in the sequence if the elapsed time is longer than the total time of the // sequence return frame; } GDrawCommandFrame *gdraw_command_sequence_get_frame_by_index(GDrawCommandSequence *sequence, ...
; cl_assert(!gdraw_command_sequence_validate(sequence, size - 1)); cl_assert(!gdraw_command_sequence_validate(sequence, size + 1)); cl_assert(!gdraw_command_sequence_validate(sequence, 0)); sequence->num_frames = 0; cl_assert(!gdraw_command_sequence_validate(sequence, size)); sequence->num_frames = 1; cl...
(command->stroke_color.argb, GColorRedARGB8)
; cl_assert_equal_i(command->fill_color.argb, GColorBlackARGB8); cl_assert_equal_i(command->points[0].x, 7); cl_assert_equal_p(gdraw_command_sequence_get_frame_by_index(sequence, 2), NULL); free(sequence); } void test_gdraw_command_sequence__clone(void) { cl_assert_equal_p(gdraw_command_sequence_clone(NULL...
, and return false. //! //! The app manager and worker manager MUST call this before they call the code to kill the task and clean it up //! (most of that work is done by process_manager_process_cleanup()). If it returns false, they should abort the //! current process exit operation and wait for another KILL event to ...
PBL_ASSERTN(success)
r_state); } typedef enum { WordStateStart, WordStateIdeograph, WordStateGrowing, WordStateJoining, WordStateEnd, } WordState; WordState word_state_update(WordState state, Codepoint codepoint) { WordState new_state = state; switch (state) { case WordStateStart: if (codepoint == NEWLINE_CODEPOI...
(text_box_params->font)
+ text_box_params->line_spacing_delta; } static int16_t prv_layout_get_line_spacing_delta(GTextLayoutCacheRef layout) { if (process_manager_compiled_with_legacy2_sdk()) { return 0; } return (layout ? ((TextLayoutExtended *)layout)->line_spacing_delta: 0); } ////////////////////////////////////////////////...
is_current_term_silent(job)) { s_jobs = job; return true; } return false; } static void prv_unlink_job(GAPLEAdvertisingJob *job) { if (job->node.next == &job->node) { // Last job left... job->node.next = NULL; job->node.prev = NULL; s_jobs = NULL; } else { list_remove(&job->node, (L...
while (prv_is_current_term_silent(s_jobs) && s_jobs != job /* looped around */) { s_jobs = (GAPLEAdvertisingJob *) s_jobs->node.next; }
; prv_increment_elapsed_time_for_job(&job, &force_update); prv_perform_next_job(force_update); } unlock: bt_unlock(); } // ----------------------------------------------------------------------------- //! Timer start / stop utilities //! bt_lock is expected to be taken! static void prv_timer_start(void) ...
TimelineItemAction[]) { { .id = 0, .type = TimelineItemActionTypeComplete, .attr_list = completed_attr_list, }, { .id = 1, .type = TimelineItemActionTypePostpone, .attr_list = postpone_attr_list, }, { .id = 2, .type = Timeline...
strlen(tmp)
, 0); strncat(data->dialog_text, " ", buf_space_remaining); buf_space_remaining = MAX(buf_space_remaining - 1, 0);; clock_get_time_number(tmp, date_time_len, data->timestamp); strncat(data->dialog_text, tmp, buf_space_remaining); buf_space_remaining = MAX(buf_space_remaining - strlen(tmp), 0); clock_get_t...
{ if (event->type == PEBBLE_CALLBACK_EVENT) { return (uint32_t) event->callback.callback; } return event->type; }
static void prv_log_event_put_failure(const char *queue_name, uintptr_t saved_lr, const PebbleEvent *event) { PBL_LOG(LOG_LEVEL_ERROR, "Error, %s queue full. Type %u", queue_name, event->type); RebootReason reason = { .code = RebootReasonCode_EventQueueFull, .event_queue = { .destination_task = Peb...
layer_set_background_color(text_layer, GColorWhite); text_layer_set_text_color(text_layer, GColorBlack); } else { text_layer_set_background_color(text_layer, GColorClear); text_layer_set_text_color(text_layer, GColorWhite); } text_layer_set_text_alignment(text_layer, GTextAlignmentLeft); text_layer_...
(point.x, point.y + 1)
); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1)); } } static void draw_color_rect(GContext* ctx, AppData *data, GRect rect) { uint16_t width = rect.size.w; uint16_t height = rect.size.h; for (uint16_t row = 0; row < height; row += 2) { for (uint16_t col = 0; col < width; col += 2) { ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
rng_rand(&seed)
) { // Fallback, time XOR'd with an approximation of the current stack pointer: seed = rtc_get_time() ^ (uintptr_t) &seed; } srand(seed); }
(&free_page, false, false)
; mutex_unlock_recursive(s_pfs_mutex); // TODO: might be nice to only sleep here if we had to perform GC as part // of finding a free page if ((pages_to_find % 4) == 0) { psleep(2); } pages_to_find--; uint32_t elapsed_ticks = rtc_get_ticks() - start_ticks; if (max_elapsed_ticks !=...
ead_mbuf = NULL; } PBL_LOG(LOG_LEVEL_DEBUG, "Sent service discovery message (result=%d)", result); } static void prv_set_connected(bool connected) { s_has_done_service_discovery = false; } static bool prv_handle_management_attribute_read(bool success, ManagementServiceAttribute attr, ...
mbuf_get_data(s_read_header_mbuf)
; // get the length of the data buffer(s) which is the max length of data we could have received const uint32_t data_length = mbuf_get_chain_length(mbuf_get_next(s_read_header_mbuf)); mbuf_free(s_read_header_mbuf); s_read_header_mbuf = NULL; SmartstrapResult result = SmartstrapResultOk; if (!success) { ...
st time reward was triggered, saved to flash } InsightStateCommon; static struct { InsightStateCommon common; } s_sleep_reward_state; static struct { InsightStateCommon common; ActivityScalarStore active_minutes; } s_activity_reward_state; // Cached insight settings static ActivityInsightSettings s_sleep_rewar...
("Awesome!")
, .text_neutral_response = i18n_noop("Keep it up!"), .text_negative_response = i18n_noop("We'll get there!"), .icon_positive_response = TIMELINE_RESOURCE_REWARD_GOOD, .icon_neutral_response = TIMELINE_RESOURCE_REWARD_AVERAGE, .icon_negative_response = TIMELINE_RESOURCE_REWARD_BAD, }; // ---------------------...
al_i(s_num_timeline_removes, 0); s_sleep_state = ActivitySleepStateLightSleep; s_last_vmc = 1; prv_set_time(s_current_day, 10, 0); cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp,...
cl_assert_equal_i(s_num_alarms_fired, 1)
; cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_equal_i(s_num_timeline_adds, 6); cl_assert_equal_i(s_num_timeline_removes, 3); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); } void test_alarm_smart__across_midnight_boundary(void) { prv_set_time(s_sunday, 22, 0); ...
(uint32_t)time_stopped_ms); if (time_stopped_ms < MIN_STOP_TIME_MS) { I2C_DEBUG("Waiting %"PRIu32"ms before enabling I2C bus %s rail.", (uint32_t)(MIN_STOP_TIME_MS - time_stopped_ms), bus->name); psleep(MIN_STOP_TIME_MS - time_stopped_ms); } prv_bus_pins_cfg_input(bus); prv_rail...
gpio_input_init(&in_sda)
; OutputConfig out_scl = { .gpio = slave->bus->scl_gpio.gpio, .gpio_pin = slave->bus->scl_gpio.gpio_pin, .active_high = true }; gpio_output_init(&out_scl, GPIO_PuPd_NOPULL, GPIO_Speed_2MHz); gpio_output_set(&out_scl, true); bool recovered = false; for (int i = 0; i < MAX_TOGGLE_COUNT; ++i) { ...
(uint8_t*) "abcdef", 6, false)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 0); cl_assert(shared_circular_buffer_read(&buffer, &client1, 3, &out_buffer, &out_length)); cl_assert_equal_i(out_length, 3); cl_assert(memcmp(out_buffer, "56a", 3) == 0); cl_assert(shared_circular_...
( &buffer, &client, item_size, out_buffer, 100)
; cl_assert_equal_i(items_read, 4); cl_assert_equal_m(out_buffer, "0a3d5f8i", 8); cl_assert(shared_circular_buffer_write( &buffer, (uint8_t*)"9j0k1m2n3o4p5q", 7*item_size, false)); items_read = shared_circular_buffer_read_subsampled( &buffer, &client, item_size, out_buffer, 2); cl_assert_equal_i(...