prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
rial.h" #include "stubs_passert.h" #include "stubs_sleep.h" #include "stubs_mutex.h" #include "stubs_hexdump.h" #include "stubs_pebble_process_md.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stubs_task_watchdog.h" #include "stubs_compiled_with_legacy2_sdk.h" #include "stubs_memory_layout.h" #defi...
(wakeup_entry_v2.repeating == wakeup_entry_v1.repeating)
; cl_assert(wakeup_entry_v2.notify_if_missed == wakeup_entry_v1.notify_if_missed); uuid_equal(&wakeup_entry_v2.uuid, &wakeup_entry_v2.uuid); close_settings_file(&file); }
/* * 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_text_color(ctx, color)
; graphics_draw_text(ctx, text, font, (GRect) { .origin = text_center, .size = text_size }, GTextOverflowModeFill, GTextAlignmentCenter, NULL); } static void prv_draw_watch_hand_rounded(GContext *ctx, ClockHand *hand, GPointPrecise center) { GPointPrecise watch_hand_end = prv_gpoint_from_polar...
stributed 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 "ble_ibeacon.h" #include "applib/applib_malloc.auto.h" #include "util/net.h" #include <strin...
htons(ibeacon_in->major)
, .minor = htons(ibeacon_in->minor), .calibrated_tx_power = ibeacon_in->calibrated_tx_power, }; // Uuid is stored Big Endian on Pebble, so just copy over: memcpy(&raw_ibeacon.uuid, &ibeacon_in->uuid, sizeof(Uuid)); return ble_ad_set_manufacturer_specific_data(ad_out, COMPANY_ID_APPLE, ...
on = { .activity = KAlgActivityType_Walk, .start_utc = now + 10 * SECONDS_PER_MINUTE, .steps = len * 80, // 80 steps/min .len_minutes = len, .resting_calories = len * 100, .active_calories = len * 200, .distance_mm = len * 1000, }; prv_insert_artificial_activity_sessio...
cl_assert_equal_i(s_num_captured_activity_sessions, 2)
; ASSERT_ACTIVITY_SESSION_PRESENT(s_captured_activity_sessions, s_num_captured_activity_sessions, &exp_session_walk); ASSERT_ACTIVITY_SESSION_PRESENT(s_captured_activity_sessions, s_num_captured_activity_sessions, &exp_session_run); } ...
/* * 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 &s_ctx; }
void test_health_sleep_detail_card__initialize(void) { // Setup graphics context framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); framebuffer_clear(&s_fb); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); s_app_state_get_graphics_context = &s_ctx; // Setup resources fake_s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ unsigned char task_char = pebble_task_get_char(pebble_task_get_current()); if (mcu_state_is_privileged()) { task_char = toupper(task_char); } char buffer[] = { pbl_log_get_level_char(log_level), ' ', task_char, ' ', 0 }; serial_console_write_log_message(buffer); }
// Start out with the timestamp prv_log_timestamp(); // Write out the filename src_filename = GET_FILE_NAME(src_filename); serial_console_write_log_message(src_filename); // Write out the line number { char line_number_buffer[12]; itoa_int(src_line_number, line_number_buffer, 10); serial_c...
24, -224, -1040}, { -80, -280, -896}, { -168, -328, -784}, { -248, -360, -792}, { -280, -400, -888}, // 71 seconds { -240, -464, -928}, { -232, -432, -1008}, { -200, -376, -1200}, { -192, -528, -1176}, { -328, -464, -1192}, { -184, -352, -1336}, { -232, -328, -1032}, ...
{ 1432, 768, -152}, { 1304, 632, -464}, { 1032, 1048, -232}, { 936, 1352, -144}, { 1128, 1128, -264}, { 936, 784, -216}, { 976, 792, -160}, { 1232, 784, -88}, { 1480, 488, -40}, { 1392, 344, -80}, { 1368, 256, -152}, { 1344, 400, -136}, { 1432, 296, -56}, { 1272, ...
{ 744, -344, -88}, { 904, -40, -88}, { 528, -160, -264}, { 1016, 104, -352}, { 1192, 208, -232}, { 1240, 336, -224}, // 79 seconds { 1144, 320, -216}, { 1216, 408, -184}, { 1432, 576, -80}, { 1632, 832, -72}, { 1584, 616, -56}, { 1256, 832, -168}, { 1088, 1144, -...
ata->current_bpm_timestamp_ts - prev_bpm_timestamp_ts; wrkt_data->hr_samples_count++; wrkt_data->hr_samples_sum += event->current_bpm; } } return; } // --------------------------------------------------------------------------------------- bool workout_service_is_workout_type_supported(ActivitySess...
time_get_uptime_seconds()
; prv_put_event(PebbleWorkoutEvent_FrontendOpened); } prv_unlock(); } // --------------------------------------------------------------------------------------- // FIXME: We should probably handle this on KernelBG and not use the official app subscription void workout_service_frontend_closed(void) { PBL_ASS...
TimelineItemActionSourceModalNotification : TimelineItemActionSourceNotificationApp); config.root_level = prv_create_action_menu_for_item(item, window_data, source); if (config.root_level == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "Couldn't create notification action menu"); return; } window_data-...
layer_set_hidden(&data->action_button_layer, !prv_should_provide_action_menu_for_item(data, n))
; } // update status bar to the current info prv_update_status_layer(data); kino_layer_play(&((NotificationLayout *)layout)->icon_layer); } static void prv_update_colors_handler(SwapLayer *swap_layer, GColor bg_color, bool status_bar_filled, void *context) { Notification...
{ 0, 0x47, 20, 0x0}, // 780: Local time: 07:51:01 AM { 0, 0x47, 14, 0x0}, { 0, 0x47, 23, 0x0}, { 0, 0x47, 213, 0x0}, { 0, 0x47, 0, 0x0}, { 0, 0x47, 19, 0x0}, { 0, 0x47, 0, 0x0}, { 0, 0x47, 0, 0x0}, { 0, 0x47, 14, 0x0}, { 0, 0x47, 47, 0x0}, { 0, 0x47, 0, 0x0}, { 0, 0x...
{ 12, 0x73, 2444, 0x0}, { 0, 0x72, 3960, 0x0}, { 0, 0x79, 2595, 0x0}, { 0, 0x7b, 663, 0x0}, { 0, 0x75, 2151, 0x0}, { 8, 0x55, 3572, 0x0}, // 900: Local time: 09:51:00 AM { 6, 0x35, 3930, 0x0}, { 16, 0x43, 4216, 0x0}, { 0, 0x45, 3276, 0x0}, { 0, 0x44, 3404, 0x0}, { 0, 0x62...
{ 18, 0x76, 3155, 0x0}, { 0, 0x7e, 618, 0x0}, { 0, 0x71, 448, 0x0}, { 0, 0x53, 330, 0x0}, { 0, 0x63, 1650, 0x0}, { 0, 0x86, 1037, 0x0}, { 0, 0x75, 5635, 0x0}, { 37, 0x62, 3328, 0x0}, { 0, 0x44, 1407, 0x0}, { 0, 0x44, 2311, 0x0}, { 0, 0x75, 2339, 0x0}, { 0, 0x57, 1764, 0x...
- ctx->start_pressure; uint32_t queue_idx; if (!prv_queue_is_full(ctx)) { queue_idx = (ctx->touch_queue.read_idx + ctx->touch_queue.count) % ARRAY_LENGTH(ctx->touch_queue.events); ctx->touch_queue.count++; } else { // overwrite the last event queue_idx = prv_get_idx_last_item(ctx); if...
(s_touch_mutex)
/* * 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 (*get_erase_status_fn)(void)
= return_success; status_t flash_impl_get_erase_status(void) { get_erase_status_calls++; return get_erase_status_fn(); } int blank_check_subsector_calls = 0; status_t blank_check_subsector_return = S_FALSE; status_t flash_impl_blank_check_subsector(FlashAddress addr) { blank_check_subsector_calls++; return bl...
to_frame); } // ----------------------------------------------------------------------------------------- PropertyAnimation *property_animation_create_bounds_origin(Layer *layer, GPoint *from, GPoint *to) { // no legacy2 support as this was never exposed on 2.x PropertyAnimation *result = proper...
(property_animation_h)
; if (!property_animation) { return false; } if (size > MEMBER_SIZE(PropertyAnimationPrivate, values.from)) { APP_LOG(APP_LOG_LEVEL_WARNING, "invalid size"); return false; } if (set) { memcpy(&property_animation->values.from, value, size); } else { memcpy(value, &property_animation->val...
3297, 2137}, { -746, 115, 989}, { -1022, 309, 186}, { -1293, -1018, 1007}, { -1704, -1832, 810}, { -1699, -224, 677}, { -1657, -395, 583}, { -3369, 598, 1556}, { -3999, 3999, -606}, { -1072, 3222, -249}, { 69, 1881, -191}, { 537, 767, -303}, { 825, 583, -724}, { 2720...
{ -3826, 3999, -513}, { -790, 3434, -250}, { 420, 1917, -33}, { 1001, 1309, -315}, { 2524, 816, -717}, { 1461, 333, -684}, { 912, 68, -357}, { 411, 1088, -454}, { -313, 3999, -1011}, { -918, 3999, -1224}, { -3999, 3999, -110}, { -1147, 517, 784}, { -1388, 291, -157}, ...
{ -1100, 3350, -242}, { -2568, 1747, 604}, { -754, 95, 313}, { -1122, -10, 734}, { -1493, -1421, 883}, { -1320, -431, 470}, { -1300, -300, 182}, { -1790, -390, 725}, { -3999, 3999, 115}, { -1815, 3999, -206}, { 36, 2400, -186}, { 413, 995, -45}, { 656, 658, -20}, ...
leep recomputation prv_feed_steps_min(ACTIVITY_SESSION_UPDATE_MIN + 1); int32_t before_total, before_deep; activity_get_metric(ActivityMetricSleepTotalSeconds, 1, &before_total); activity_get_metric(ActivityMetricSleepRestfulSeconds, 1, &before_deep); PBL_LOG(LOG_LEVEL_DEBUG, "start total: %d, start deep: %d"...
prv_feed_steps_min(90)
; prv_feed_steps_min(20); // wake up // Make sure we registered sleep int32_t value; activity_get_metric(ActivityMetricSleepTotalSeconds, 1, &value); PBL_LOG(LOG_LEVEL_DEBUG, "sleep total: %"PRIi32" ", value); if (value < (60 * SECONDS_PER_MINUTE) || value > (100 * SECONDS_PER_MINUTE)) { passed = fal...
, sizeof(script)); cl_assert(*s_log_internal__expected == NULL); } AppTimer *rocky_timer_get_app_timer(void *data); void test_js__init_deinit(void) { // PBL-40702: test_js__init_deinit is leaking memory... s_skip_mem_leak_check = true; prv_deinit(); char *script = "var num_times = 0;" "var extra_a...
( "var s1 = 100 + 50 * Math.sin(0);\n" "var s2 = 100 + 50 * Math.sin(2 * Math.PI);\n" "var c1 = 100 + 50 * Math.cos(0);\n" "var c2 = 100 + 50 * Math.cos(2 * Math.PI);\n" )
; cl_assert_equal_i(100, (int32_t)jerry_get_number_value(prv_js_global_get_value("s1"))); cl_assert_equal_i(99, (int32_t)jerry_get_number_value(prv_js_global_get_value("s2"))); cl_assert_equal_i(150, (int32_t)jerry_get_number_value(prv_js_global_get_value("c1"))); cl_assert_equal_i(150, (int32_t)jerry_get_numbe...
CHED; } if (!prv_check_valid_firmware_crc( flash_new_fw_addr + sizeof(FirmwareDescription), &firmware_description)) { dbgserial_putstr("Invalid firmware CRC in SPI flash!"); return UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED; } bool new_world = prv_check_firmware_world(flash_new_fw_addr + sizeof(Fir...
boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO)
; recovery_fw_ok = false; } break; } boot_bit_clear(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS); return recovery_fw_ok; }
/* * 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, &endptr, 0)
prv_confirm_cccd_write(BLEGATTErrorSuccess)
; // Expect one event for both Kernel + App: prv_assert_subscription_event(characteristic, BLESubscriptionIndications, BLEGATTErrorSuccess, true /* kernel */, true /* app */); } void test_gatt_client_subscriptions__unsubscribe_last_subscriber(void) { BTErrno e; BLECharacteristic characteris...
MenuIndex *cell_index, void *callback_context) { ActionMenuLayer *aml = callback_context; if (aml->separator_index && cell_index->row == aml->separator_index) { const PreferredContentSize runtime_platform_default_size = system_theme_get_default_content_size_for_runtime_platform(); const...
menu_layer_get_layer(&aml->menu_layer)
, &menu_layer_frame); } static void prv_update_proc(Layer *layer, GContext *ctx) { #if PBL_ROUND ActionMenuLayer *aml = (ActionMenuLayer *)layer; const int num_rows = prv_get_num_rows(&aml->menu_layer, 0, aml); if (prv_aml_is_short(aml) && (num_rows > SHORT_ITEM_MAX_ROWS_SPALDING)) { // draw some "content in...
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. */ //! This file displays the main Quick Launc...
app_launch_button()
] : 0; } static void prv_select_click_cb(SettingsCallbacks *context, uint16_t row) { PBL_ASSERTN(row < NUM_BUTTONS); quick_launch_app_menu_window_push(s_button_order[row]); } static uint16_t prv_num_rows_cb(SettingsCallbacks *context) { return NUM_BUTTONS; } static void prv_appear(SettingsCallbacks *context) {...
e { title = NULL; } } if (title && title->length > 0) { *buffer = prv_add_pstring_to_attribute(*buffer, title, TITLE_MAX_LENGTH, &item->attr_list.attributes[attr_idx], AttributeIdTitle); attr_idx++; } if (di...
{ for (int i = 0; i < pebble_actions->num_actions; i++) { TimelineItemAction *pbl_action = &pebble_actions->actions[i]; if (prv_should_hide_reply_because_group_sms(pbl_action, app_id, subtitle)) { continue; } *buffer = prv_fill_pebble_ancs_action(buffer, buf_end, action, pbl_action)...
} TimelineItem *ancs_item_create_and_populate(ANCSAttribute *notif_attributes[], ANCSAttribute *app_attributes[], const ANCSAppMetadata *app_metadata, iOSNotifPrefs *notif_prefs, ...
); } void test_rocky_api_datetime__locale_time_string_date_options(void) { rocky_global_init(s_api); EXECUTE_SCRIPT("var d = new Date();"); EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {day: 'short'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Mon, 8:04:05 PM"); } void test_rocky_api_datetime__locale_date...
("s", "7")
; EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: '2-digit'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "07"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: 'short'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Jul"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: 'long'});"); ASSERT...
item, &bad_item.common.id)); } void test_reminder_db__find_by_timestamp_title(void) { prv_insert_default_reminders(); // Add items with title attributes for searching (out of order for worst-case scenario) cl_assert(S_SUCCESS == reminder_db_insert_item(&title_item2)); cl_assert(S_SUCCESS == reminder_db_insert...
reminder_db_read((uint8_t *)&item1.header.id, sizeof(Uuid), (uint8_t *)&item, sizeof(SerializedTimelineItemHeader))
); cl_assert_equal_i(item.common.status & 0xFF, TimelineItemStatusReminded); }
/* * 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...
{ // The client is also KernelMain, just subscribe immediately without putting an event event_service_subscribe_from_kernel_main(&event.subscription); }
indow_set_click_config_provider_with_context(Window *window, ClickConfigProvider click_config_provider, void *context) {} void window_set_click_context(ButtonId button_id, void *context) {} void content_indicator_dest...
cl_assert_equal_i(0, l.selection.y)
; // Test disabled first l.selection_animation_disabled = true; menu_layer_set_selected_index(&l, MenuIndex(0, 1), MenuRowAlignTop, true); cl_assert_equal_i(1, menu_layer_get_selected_index(&l).row); cl_assert(!l.animation.animation); // Test enabled l.selection_animation_disabled = false; menu_layer_...
) #define NUM_WEATHER_LOCATIONS (4) #define WEATHER_DATA_SIZE (sizeof(SerializedWeatherAppPrefs) + \ (sizeof(Uuid) * NUM_WEATHER_LOCATIONS)) static uint8_t s_weather_prefs[WEATHER_DATA_SIZE]; // Setup //////////////////////////////////////////////////////////////// void test_watch_app_prefs_...
(WEATHER_KEY, WEATHER_KEY_LEN, s_weather_prefs, sizeof(s_weather_prefs))
, S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_delete(WEATHER_KEY, WEATHER_KEY_LEN), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_get_len(WEATHER_KEY, WEATHER_KEY_LEN), 0); } void test_watch_app_prefs_db__flush(void) { cl_assert_equal_i(watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_t...
TrailingEllipsis, GTextAlignmentCenter, NULL); grect_align(&box, &cell_layer->bounds, GAlignCenter, true /* clip */); box.origin.y -= fonts_get_font_cap_offset(font); graphics_draw_text(ctx, text, font, box, ...
{ data->show_limit_reached_text = false; }
} #if CAPABILITY_HAS_HEALTH_TRACKING /////////////////////////////////////////////////////////////////////////////////////////////////// //! Smart Alarm first use dialog typedef struct FirstUseDialog { ExpandableDialog dialog; AlarmsAppData *data; } FirstUseDialog; static void prv_alarms_app_opened_click_handle...
art activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); // Advance to 6pm EST prv_feed_cannned_accel_data(6 * SECONDS_PER_HOUR, ...
(ActivityMetricStepCount, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){0, 1000, 0, 0, 0, 0, 0}))
; // Feed in 100 steps/min over 20 minutes, for a total of 2000 steps for today prv_feed_cannned_accel_data(20 * SECONDS_PER_MINUTE, 100, ActivitySleepStateAwake); ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount, ((const uint32_t [ACTIVITY_HISTORY_DAYS]){2000, 1000, 0, 0, 0, 0, 0})); // If we ask...
/* * 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 str_len = strlen(str); strncpy(buf, str, str_len); itoa_int(num, buf + str_len, 10); }
void toupper_str(char *str) { int len = strlen(str); for (int i = 0; i < len; i++) { str[i] = toupper((unsigned char)str[i]); } } void byte_stream_to_hex_string(char *out_buf, size_t out_buf_len, const uint8_t *byte_stream, size_t byte_stream_len, bool print_backward) { size_t bytes_left = byte_strea...
/* * 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...
{ *dest++ = *src++; }
return s1; } void *memmove(void * restrict s1, const void * restrict s2, size_t n) { char *dest = (char*)s1; const char *src = (const char*)s2; if (dest <= src) { while (n--) { *dest++ = *src++; } } else { while (n--) { dest[n] = src[n]; } } return s1; }
/* * 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 prv_format_time(buffer, buf_size, i18n_noop("%m/%d"), timestamp); }
size_t clock_get_day_date(char *buffer, int buf_size, time_t timestamp) { return prv_format_time(buffer, buf_size, i18n_noop("%d"), timestamp); } void clock_hour_and_minute_add(int *hour, int *minute, int delta_minutes) { const int new_minutes = positive_modulo(*hour * MINUTES_PER_HOUR + *minute + delta_minutes,...
frame buffer to the // system frame buffer and the time spent sending the system frame buffer to the display. __profiler_stop(); __profiler_print_stats(); int64_t time_rendered = prv_time_64() - data->time_started; APP_LOG(APP_LOG_LEVEL_INFO, "## %d frames rendered", (int)data->rendered_frames); if (time...
(GRect(0, 0, navbar_width, navbar_width))
; bitmap_layer_set_background_color(data->topleft_layer, GColorWhite); bitmap_layer_set_bitmap(data->topleft_layer, &s_fps_topleft_bitmap); layer_add_child(root_layer, (Layer *)data->topleft_layer); const GRect menu_layer_rect = GRect(navbar_width, 0, full_rect.size.w - navbar_width, full_rect.size.h); ...
_data_size) : SPRF_UNWRITTEN_CRC; const bool same_data = (0 == memcmp(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 un...
prv_invalidate_current_page()
n) { gatt_client_discovery_discover_range(conn, &range); } } bt_unlock(); } void command_bt_disc_stop(void) { bt_lock(); { GAPLEConnection *conn = prv_get_le_connection_and_print_info(); if (conn) { bt_driver_gatt_stop_discovery(conn); } } bt_unlock(); } #if BT_CONTROLLER_DA146...
if (!hc_endpoint_logging_get_level(&log_level)) { prompt_send_response("Unable to get Ble Log level"); } else { prompt_send_response_fmt(buffer, 32, "Ble Log level: %d", log_level); }
GColor color, Uuid *uuid) { #if PLATFORM_TINTIN || PLATFORM_SILK return GColorClear; #endif color = gcolor_closest_opaque(color); if (!gcolor_equal(color, GColorClear)) { return color; } color = prv_hard_coded_color_for_3rd_party_apps(uuid); if (!gcolor_equal(color, GColorClear)) { return color; ...
{ return false; }
/* * 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...
{ LauncherAppGlanceNotifications *notifications_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(notifications_glance, icon, NULL); }
/* * 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 (s_do_before_write) { s_do_before_write(); s_do_before_write = NULL; }
memcpy(s_storage_data.buffer + offset, buffer, length); } static uint32_t fake_pb_storage_mem_calculate_crc(PutBytesStorage *storage, PutBytesCrcType crc_type) { PBL_ASSERTN(storage->impl_data == &s_storage_data); return s_storage_data.crc; } static void prv_cleanup(void) { kernel_free(s_storage_data.info);...
ry) {}; strcpy(entry->name, file_name); head = list_insert_before(head, &entry->list_node); } mutex_unlock_recursive(s_pfs_mutex); return (PFSFileListEntry *)head; } void pfs_delete_file_list(PFSFileListEntry *head) { ListNode *node = (ListNode *)head; ListNode *next; while (node) { next = node...
(curr_page, &next_page)
== S_SUCCESS) { if (next_page == (curr_page + 1)) { curr.contiguous_pgs++; } else { update_page_cache(&fpc[0], &cur_idx, &curr); // reset logic for next entry curr.virtual_pg = virtual_pg + 1; curr.physical_pg = next_page; curr.contiguous_pgs = 0; } curr_page = nex...
window_init(&dialog->window, dialog_name); window_set_background_color(&dialog->window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite)); // initial values dialog->icon_anim_direction = DialogIconAnimationFromRight; dialog->destroy_on_pop = true; dialog->text_color = GColorBlack; } void dialog_pop(Dialog...
if (dialog->timeout != DIALOG_TIMEOUT_INFINITE && // Don't shorten infinite dialogs icon_duration != PLAY_DURATION_INFINITE && // Don't extend dialogs with infinite animations icon_duration > dialog->timeout) { // The finite image animation is longer, increase the finite dialog timeout dialog_set_ti...
/* * 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_num, resource_id, offset, seek_framedata, found_actl)
; } int32_t png_seek_chunk_in_resource_system(ResAppNum app_num, uint32_t resource_id, uint32_t offset, bool seek_framedata, bool *found_actl) { uint32_t current_offset = offset; bool actl_chunk_found = false; // ACTL chunk indicates PNG is an APNG struct png_chunk_mar...
ASIS, * 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. */ #define FILE_LOG_COLOR LOG_COLOR_BLUE #include "ble_client.h" #include "ble_app_support.h" #include "applib/applib_malloc.aut...
(value_length)
; if (!value) { gatt_error = BLEGATTErrorLocalInsufficientResources; value_length = 0; } // If there is a read response, we *must* consume it, // otherwise the events and associated awaiting responses will // get out of sync with each other. sys_ble_client_consume_read(object_ref, va...
E_ADDRESS + sector_address))[COMMAND_ADDRESS] = cmd; } static void prv_software_reset(void) { prv_issue_command(0, S29VSCommand_SoftwareReset); } // Note: If this command has been executed at least once, all sectors are // locked. They then must be unlocked before and relocked after each program // operation (i.e w...
{ if (pin_source == 2) { continue; } GPIO_PinAFConfig(GPIOD, pin_source, GPIO_AF_FMC); }
gpio_init.GPIO_Pin = GPIO_Pin_All & (~GPIO_Pin_2); GPIO_Init(GPIOD, &gpio_init); for (uint8_t pin_source = 2; pin_source < 16; ++pin_source) { GPIO_PinAFConfig(GPIOE, pin_source, GPIO_AF_FMC); } gpio_init.GPIO_Pin = GPIO_Pin_All & (~GPIO_Pin_0) & (~GPIO_Pin_1); GPIO_Init(GPIOE, &gpio_init); // We h...
uration_b; // Create 2 animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animation_set_play_count(b, play_count_b); // Create a sequence Animation *seq = animation_sequence_c...
cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MAX)
; cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq)...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
kernel_zalloc(prefs_len)
; if (!*prefs_out) { return 0; } status_t rv = prv_read_serialized_prefs(file, app_id, key_len, (void *) *prefs_out, prefs_len); if (rv != S_SUCCESS) { kernel_free(*prefs_out); return 0; } return (prefs_len - sizeof(SerializedNotifPrefs)); } static void prv_free_serialzed_prefs(SerializedNoti...
ion; } else { // first item has correct timestamp, duration should make it last for the rest of the day const time_t until_midnight = midnight_first + SECONDS_PER_DAY - header->timestamp; nodes[0]->duration = until_midnight / SECONDS_PER_MINUTE; // last item at end of event, duration 0 time_t end...
(&(TimelineNode *) { node_out }, header, 1 /* num_nodes */)
; } int timeline_item_time_comparator(CommonTimelineItemHeader *new_common, CommonTimelineItemHeader *old_common, TimelineIterDirection direction) { TimelineNode new_node; TimelineNode old_node; prv_set_node_from_header(new_common, &new_node); ...
/* * 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)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_DEBUG, "Attempting to update timer.")
// are as follows: // R0-R12 = Unknown // MSP = VECTOR_TABLE[0] (main stack pointer) // PSP = Unknown (process stack pointer) // LR = 0xFFFFFFFF // PC = VECTOR_TABLE[1] // PRIMASK = 0x0 // FAULTMASK = 0x0 // BASEPRI = 0x0 // CONTROL = 0x0 // // Attempt to put ...
(BUTTON_ID_BACK)
) { dbgserial_putstr("Hold down UP + BACK for 5 secs. to force-boot PRF"); for (int i = 0; i < 5000; ++i) { if (!(button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK))) { // stop waiting if not held down any longer return false; } delay_ms(1); } return ...
{0xff, 0x00, 0xff}; static const uint8_t s_inactive_header[] = {0x00, 0x00, 0x00}; //////////////////////////////////////////////////////////// // Functions for manipulating the cursor in flash //////////////////////////////////////////////////////////// static int round_up_to_nearest_subsector(uint32_t addr) { // -...
PBL_LOG_VERBOSE("False")
; } PBL_LOG_VERBOSE("\n"); PBL_LOG_VERBOSE("Key is:\n\t"); for (int i = 0; i < r->key_length; i++) { PBL_LOG_VERBOSE("'%c'", r->key[i]); } PBL_LOG_VERBOSE("\n"); PBL_LOG_VERBOSE("UUID is:\n\t"); for (int i = 0; i < UUID_SIZE_BYTES; i++) { PBL_LOG_VERBOSE("%#.2hx, ",r->uuid[i]); } PBL_LOG_V...
ting, 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. */ //! Overview: //! - Summary of text layout and...
{ new_state = WordStateIdeograph; }
else if (codepoint == WORD_JOINER_CODEPOINT) { new_state = WordStateJoining; } else { new_state = WordStateGrowing; } break; case WordStateEnd: new_state = WordStateEnd; break; } return new_state; } //! @return true if init to new word, false otherwise (ie end of...
-32}, { 1112, 280, -64}, { 1048, 312, -96}, { 1280, 344, -32}, { 1176, 424, -8}, { 824, 352, 32}, { 1024, 368, 16}, { 1136, 528, 8}, { 1120, 480, -16}, { 1232, 352, 120}, { 1528, 304, 112}, { 1456, 208, 128}, { 1344, 80, 176}, { 1400, -16, 128}, // 74 seconds ...
{ 1248, 568, 272}, { 912, 792, 80}, { 1208, 424, 144}, { 1048, 392, 0}, { 1120, 336, 24}, { 1280, 416, 104}, { 1536, 360, 136}, { 1400, 240, 120}, { 1368, 104, 184}, { 1464, -16, 136}, { 1424, -40, 24}, { 1264, -8, -8}, { 960, -8, -64}, { 832, -160, -32}, { 67...
// 82 seconds { 728, -104, -88}, { 672, -160, -72}, { 1048, -40, -8}, { 1200, 72, -40}, { 1408, 152, -104}, { 1528, 144, -192}, { 1448, 136, -88}, { 1096, 128, -192}, { 1000, 112, -224}, { 1048, 192, -96}, { 1088, 224, -24}, { 976, 280, -56}, { 856, 336, -16}, ...
/* * 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...
prompt_send_response("Invalid rtcfreq")
; return; } mfg_info_set_rtc_freq(rtc_freq); } void command_model_read(void) { char model_buffer[MFG_INFO_MODEL_STRING_LENGTH]; mfg_info_get_model(model_buffer); // Just send it straight out, as it's already null-terminated prompt_send_response(model_buffer); } void command_model_write(const char* m...
{ 112, 920, 152}, { 128, 904, 144}, { 112, 920, 160}, { 112, 904, 152}, { 120, 888, 120}, { 144, 880, 88}, { 128, 912, 152}, { 104, 904, 152}, { 104, 904, 136}, { 96, 888, 120}, { 104, 912, 112}, { 128, 912, 120}, { 120, 912, 128}, { 120, 896, 120}, { 120, 912, ...
{ -48, 968, 32}, { -16, 936, 56}, { -16, 896, 72}, { 24, 936, 48}, { 0, 880, 48}, { 32, 920, 48}, // 307 seconds { 96, 976, -16}, { 96, 936, -16}, { 120, 888, 24}, { 96, 864, 64}, { 48, 896, 136}, { 24, 888, 128}, { 56, 952, 80}, { 72, 928, 88}, { 64, 888,...
{ -96, 752, 400}, { -88, 848, 440}, { 8, 1000, 528}, { 176, 1184, 648}, { 440, 1216, 520}, { 344, 1088, 104}, { 352, 1144, -216}, { 320, 680, 96}, // 310 seconds { 240, 720, 184}, { 320, 792, 176}, { 232, 696, 120}, { 168, 792, 56}, { 208, 856, 80}, { 272, 87...
/* * 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...
{ (void)data; (void)menu_layer; return 4; }
ponse(msg, (uint8_t *)&rv, sizeof(rv)); // ack the write prv_build_write_complete_payload(hdr, ((HcGattWriteData *)hdr)->att_handle, state); prv_enqueue_write_complete_if_ready(state); return true; } static bool prv_handle_emulated_write(uint16_t conn_idx, const HcProtocolMessage *msg) { PBL_ASSERTN(msg->com...
((const uint8_t[]){PEBBLE_BT_UUID_EXPAND( PEBBLE_BT_PPOGATT_WATCH_SERVER_DATA_CHARACTERISTIC_UUID_32BIT)}, &uuid)
; PBL_ASSERTN(ble_gatts_add_characteristic(&uuid, GATT_PROP_WRITE_NO_RESP | GATT_PROP_NOTIFY, ATT_PERM_WRITE, data_wr_size, enable_read_cb_flag, NULL, ...
/* * 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...
{ i18n_get_with_buffer(string, buffer, length); }
size_t sys_i18n_get_length(const char *string) { return i18n_get_length(string); } // Tests //////////////////////////////////// // (SU) = Single UNIX Specification extension // (GNU)= glibc extension // (TZ) = Olson's timezone package extension? // (C99)= C99 extension // We support them all~ #define EXTENSION...
ification->uid, properties); } // See analytics_external_collect_ancs_info() s_ns_flags_used_bitset |= nsnotification->event_flags; break; case EventIDNotificationModified: BLE_LOG_DEBUG("Modified ANCS notification!"); prv_notif_queue_push_attr_request(nsnotification->uid, prop...
prv_write_control_point_request((const CPDSMessage *) &action_msg, sizeof(action_msg))
; if (!success) { prv_reset_and_next(); } } static void prv_serialize_action(const PerformNotificationActionMsg *action_msg) { if (!s_ancs_client) { PBL_LOG(LOG_LEVEL_ERROR, "No ANCS client"); return; } prv_notif_queue_push_action(action_msg->notification_uid, action_msg->action_id); } void prv...
/* * 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...
{ rocky_runtime_context_init(); jerry_init(JERRY_INIT_EMPTY); s_log_internal__expected = NULL; }
void test_rocky_api_console__cleanup(void) { jerry_cleanup(); rocky_runtime_context_deinit(); } void test_rocky_api_console__functions_exist(void) { rocky_global_init(s_api); EXECUTE_SCRIPT( "var c = typeof console;\n" "var cl = typeof console.log;\n" "var cw = typeof console.warn;\n" "var 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...
(PWR, RCC_APB1Periph_PWR)
ion_is_scheduled(animation), false); animation_schedule(animation); animation_set_reverse(animation, true); animation_set_duration(animation, 300); animation_set_elapsed(animation, 20); prv_play_animation_update(animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel),...
(test_player->reel, test_reel)
; cl_assert_equal_i(s_num_destructor_calls, 0); kino_player_set_reel(test_player, NULL, true); cl_assert_equal_p(test_player->reel, NULL); cl_assert_equal_i(s_num_destructor_calls, 0); }
#include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_status_bar_layer.h" #include "stubs_syscalls.h" #include "stubs_system_theme.h" #include "stubs_task_watchdog.h" #include "stubs_window_manager.h" #include "stubs_window_stack.h" // Helper Functions ///////////////////// #inc...
{ const bool is_current_location = true; prv_render_long_strings_test(is_current_location); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); }
/* * 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...
{ ActionToggleDialogConfig config = { .message = ctx->config.impl->result_messages[prv_get_toggled_state_index(ctx)], }; prv_setup_state_config(ctx, &config, ActionToggleDialogType_Result); SimpleDialog *simple_dialog = simple_dialog_create(config.window_name); prv_setup_dialog(simple_dialog_get_dialog(si...
file_size; uint16_t start_page; //!< the physical page at which the file begins uint16_t start_offset; //!< offset at which file data begins uint8_t file_type; // items dynamically changing uint8_t op_flags; bool is_tmp; uint32_t offset; // the current offset within t...
{ prv_flash_read(&s_pfs_page_flags_cache[pg], sizeof(s_pfs_page_flags_cache[pg]), prv_page_to_flash_offset(pg) + page_flags_offset); }
Assert it got filtered out: cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); } void test_ancs__should_filter_out_duplicate_messages(void) { // With an empty db, new notifications should be added as usual prv_send_notification((uint8_t *)&s_complete_dict); cl_assert_equal_i(...
(s_num_requested_notif_attributes, 4)
OOT_BIT_FW_START_FAIL_STRIKE_TWO); return true; } else if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_ONE)) { dbgserial_putstr("Failed to start firmware, strike two."); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); } else { dbgserial_putstr("Failed to start firmware, strike one."); boot_bit_...
delay_us(80000)
/* * 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 rv = reminder_db_insert_item(reminder); return rv; }
status_t reminders_init(void) { if (s_reminder_timer) { new_timer_delete(s_reminder_timer); } s_reminder_timer = new_timer_create(); if (s_reminder_timer == TIMER_INVALID_ID) { return E_ERROR; } else { return reminders_update_timer(); } } status_t reminders_delete(ReminderId *reminder_id) { ...
/* * 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 (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(handler, sizeof(*handler)); syscall_assert_userspace_buffer(state, sizeof(*state)); }
GColorARGB8FromHEX(0x4682b4)}, {"tan", GColorARGB8FromHEX(0xd2b48c)}, {"thistle", GColorARGB8FromHEX(0xd8bfd8)}, {"tomato", GColorARGB8FromHEX(0xff6347)}, {"turquoise", GColorARGB8FromHEX(0x40e0d0)}, {"violet", GColorARGB8FromHEX(0xee82ee)}, {"wheat", GColorARGB8FromHEX(0xf5deb3)}, {"whitesmoke", GColorAR...
{ ch = ch - 'a' + 10; }
else { // This will also catch '\0' return false; } value = value * 16 + ch; } *value_out = value; return true; } static bool prv_parse_hex_comps(const char *color_value, size_t len, int32_t *r, int32_t *g, int32_t *b, int32_t *a) { return prv_parse_hex_comp(color...
bitblt_bitmap_into_bitmap_tiled_8bit_to_8bit( &dest_bitmap, src_bitmap, dest_rect, GPointZero, GCompOpAssign, GColorWhite)
; cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_wrap_x-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Test vertical wrapping when dest_rect taller than src_bitmap. // Setup: // - Source is 25 x 10 // - 4 rows red, 2 rows blue, 4 rows black. // - Dest is Green, 50 x 50 // - Dest Rect is...
ader) || info->key_len != UUID_SIZE) { // malformed values; deleted values have their lengths set to 0 if (info->key_len != UUID_SIZE) { PBL_LOG(LOG_LEVEL_WARNING, "Found malformed item with invalid key/val sizes; ignoring."); } return true; } SerializedTimelineItemHeader hdr; info->g...
(&storage->file)
; } status_t timeline_item_storage_insert(TimelineItemStorage *storage, const uint8_t *key, int key_len, const uint8_t *val, int val_len, bool mark_as_synced) { if (key_len != UUID_SIZE || val_len > SETTINGS_VAL_MAX_LEN || val_len < (int)sizeof(SerializedTimelineItemHeader)) { return E_INVALID_AR...
return; } // len needs +1 in order for i18n_get_with_buffer to write all the characters we want. // It's ok that it writes the NUL at the end because we've already reserved that space. sys_i18n_get_with_buffer(str, state->output, len + 1); state->output += len; state->output_remaining -= len; } static voi...
("TmplStringPlur", " months")
activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); // No sessions active, ensure that asking if a run is ongoing returns false cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Run)); cl_assert_equal_i(0, health_service_peek_current_...
activity_start_tracking(false /*test_mode*/)
; fake_system_task_callbacks_invoke_pending(); // No sessions active, ensure that asking for run,walk,sleep returns false cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Run)); cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Walk)); ...
_APB1Periph_I2C3 | RCC_APB1Periph_CAN1 | RCC_APB1Periph_CAN2 | RCC_APB1Periph_PWR | RCC_APB1Periph_DAC | RCC_APB1Periph_UART7 | RCC_APB1Periph_UART8; const uint32_t apb2_periphs = RCC_APB2Periph_TIM1 | RCC_APB2Periph_TIM8 | RCC_APB2Periph_USART1 | RCC_APB2Periph_USART6 | RCC_APB2Periph_ADC | RCC_APB2P...
if (boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { dbgserial_putstr("Software failure caused a reset"); }
// Clean up after the last failure. boot_bit_clear(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED); // We have a "three strikes" algorithm: if the watch fails three times, return true // to tell the parent we should load the recovery firmware. A reset for any other reason // will reset this algorithm. if (boot_bit_t...
assembly_ctx.buffer, data, length) != 0); } static uint8_t prv_current_command_id(const uint8_t* data) { return ((const CPDSMessage *)data)->command_id; } static bool prv_reassembly_is_complete(const uint8_t* data, const size_t length, bool* out_error) { switch (prv_current_command_id(data)) { case CommandIDG...
(LOG_LEVEL_WARNING, "Error parsing app attributes")
; goto fail; } // cache the app name ANCSAttribute *app_id = s_ancs_client->attributes[FetchedNotifAttributeIndexAppID]; ANCSAttribute *app_name = app_attrs[FetchedAppAttributeIndexDisplayName]; ancs_app_name_storage_store(app_id, app_name); fail: prv_put_ancs_message(app_attrs); prv_reset_and_next(...
ER_ALIGNMENT = PBL_IF_RECT_ELSE(GAlignTopLeft, GAlignTopRight); bitmap_layer_set_alignment(&data->cassette_layer, CASSETTE_LAYER_ALIGNMENT); bitmap_layer_set_compositing_mode(&data->cassette_layer, GCompOpSet); layer_add_child(&data->cassette_container, &data->cassette_layer.layer); progress_layer_init(&data->...
(&data->icon_volume_up, RESOURCE_ID_MUSIC_ICON_VOLUME_UP)
; gbitmap_init_with_resource(&data->icon_volume_down, RESOURCE_ID_MUSIC_ICON_VOLUME_DOWN); gbitmap_init_with_resource(&data->image_cassette, RESOURCE_ID_MUSIC_LARGE_CASSETTE); gbitmap_init_with_resource(&data->image_pause, RESOURCE_ID_MUSIC_LARGE_PAUSED); gbitmap_init_with_resource(&data->image_volume_up, RESOU...
/* * 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(strtol(" 500", NULL, 10), 500)
; cl_assert_equal_i(strtol(" 765", NULL, 10), 765); cl_assert_equal_i(strtol(" 573888", NULL, 10), 573888); cl_assert_equal_i(strtol(" 713713", NULL, 10), 713713); } void test_strtol__suffix(void) { cl_assert_equal_i(strtol("500hurf", NULL, 10), 500); cl_assert_equal_i(strtol("765berse...
x; } // Stubs ///////////////////// #include "stubs_analytics.h" #include "stubs_app_install_manager.h" #include "stubs_app_state.h" #include "stubs_app_timer.h" #include "stubs_bootbits.h" #include "stubs_buffer.h" #include "stubs_click.h" #include "stubs_heap.h" #include "stubs_layer.h" #include "stubs_logging.h" #...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
DIRECTED); if (rv != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_adv_start: status = 0x%x", rv); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Adverts (re)started"); } return rv; } static ble_error_t prv_advert_disable(void) { ble_error_t rv = ble_gap_adv_stop(); if (rv != BLE_STATUS_OK) { PBL_LOG(...
(LOG_LEVEL_DEBUG, "Pausing advertisements, state = 0x%x", s_adv_state)
; if (s_adv_state == AdvertState_Running) { prv_advert_disable(); } s_adv_state = AdvertState_Pausing; } else if (s_adv_state == AdvertState_Paused) { // It's safe to call the cb cb(ctx); cb_executed = true; prv_resume_if_needed(); } } prv_unlock(); retur...
////////////////////// static void prv_create_layout_for_forecast(const WeatherLocationForecast *forecast, WeatherAppLayout *layout, Window *window) { window_init(window, WINDOW_NAME("Weather")); weather_app_layout_init(layout, &s_ctx.dest_bitmap.bounds); weather_app_la...
{ const WeatherLocationForecast forecast = { .location_name = "PALO ALTO", .current_temp = -88, .today_high = -88, .today_low = -88, .current_weather_type = WeatherType_LightRain, .current_weather_phrase = "Light Rain", .tomorrow_high = -99, .tomorrow_low = -99, .tomorrow_weather_t...
void test_weather_app_layout__render_generic_generic(void) { const WeatherLocationForecast forecast = { .location_name = "HOUSTON", .current_temp = 110, .today_high = 120, .today_low = 85, .current_weather_type = WeatherType_Generic, .current_weather_phrase = "Humid AF", .t...
ruct IntNode { ListNode list_node; int value; } IntNode; int sorting_comparator(IntNode* a, IntNode* b) { return b->value - a->value; } void test_list__sort_ascending(void) { IntNode bar1 = { .value = 1 }; IntNode bar2 = { .value = 2 }; IntNode bar3 = { .value = 3 }; ListNode* head = 0; head = list_...
cl_assert_equal_p(b.next, &c)
; cl_assert_equal_p(c.prev, &b); cl_assert_equal_p(list_concatenate(&e, &f), &e); cl_assert_equal_p(list_concatenate(&d, &f), &d); cl_assert_equal_p(list_concatenate(&f, &d), &d); cl_assert_equal_p(list_concatenate(NULL, &d), &d); cl_assert_equal_p(list_concatenate(NULL, &f), &d); cl_assert_equal_p(list...
ffer(); s_drop_rest_of_frame = false; s_keepalive_timer = new_timer_create(); PBL_ASSERTN(s_keepalive_timer != TIMER_INVALID_ID); pulse_init(); serial_console_set_state(SERIAL_CONSOLE_STATE_PULSE); pulse_llc_send_link_opened_msg(); prv_reset_keepalive_timer(); prv_handlers_notify_state_changed(PulseL...
(PULSE_MAX_SEND_SIZE)
] = protocol; // Expose only the payload of the message return s_tx_buffer + COBS_OVERHEAD(PULSE_MAX_SEND_SIZE) + 1; } void pulse_best_effort_send(void *buf, const size_t payload_length) { prv_assert_tx_buffer(buf); PBL_ASSERT(payload_length <= PULSE_MAX_SEND_SIZE, "PULSE frame payload too long"); // Rewin...
d prv_handle_notification_removed(Uuid *id) { prv_remove_notification(s_data, id); app_notification_window_remove_notification_by_id(id); } static void prv_handle_notification_acted_upon(Uuid *id) { app_notification_window_handle_notification_acted_upon_by_id(id); } static void prv_handle_notification_added(Uui...
layer_add_child(&window->layer, &status_bar->layer)
; #endif menu_layer_set_selected_index(menu_layer, MenuIndex(0, 1), PBL_IF_RECT_ELSE(MenuRowAlignNone, MenuRowAlignCenter), false); } static void prv_push_window(NotificationsData *data) { Window *window = &data->window; window_init(window, WINDOW_NAME("Notifications")); window...
KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "debug/power_tracking.h" #include "drivers/mcu.h" #include "drivers/rtc.h" #include "drivers/task_watchdog.h" #include "kernel/memory_layout.h" #include "kernel/pbl_m...
{ if (xExpectedIdleTime < MIN_STOP_TICKS || !stop_mode_is_allowed()) { // We assume that a WFI to trigger sleep mode will not last longer than 1 // SysTick. (The SysTick INT doesn't automatically get suppressed) Thus, // we use the SysTick timer to get a better estimate of our sleep time // ...
RtcTicks ticks_elapsed = rtc_alarm_get_elapsed_ticks(); 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((...
8_t num_services, BTErrno status) { const BTDeviceAddress address = bt_device_get_address(device); char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; for (unsigned int i = 0; i < num_services; ++i) { Uuid service_uuid = ble_service_get_uuid(services[i]); uuid_to_string(&serv...
ble_client_set_service_change_handler(service_change_handler)
; s_scan_window = ble_demo_scan_window_create(); window_stack_push(s_scan_window, true /* Animated */); app_event_loop(); window_destroy(s_scan_window); }
left_margin; GRect value_box = box; if (config->overflow_mode != GTextOverflowModeWordWrap) { box.origin.y += vertical_margin; box.size.h = title_height + 4; value_box.origin.y = box.origin.y; } else { // Value box is centered when drawing with GTextOverflowModeWordWrap. value_box.origin.y = ...
gsize_add(icon_frame_size, config->icon_box_model->margin)
; } } const bool can_use_two_lines_for_title = !(render_subtitle || render_icon); const bool can_use_many_lines_for_title = (config->overflow_mode == GTextOverflowModeWordWrap); const int16_t intitial_title_text_lines = can_use_two_lines_for_title ? 2 : 1; int16_t title_text_frame_height = can_use_many_l...
copies the app frame buffer to the system frame buffer op_3) System sends the system frame buffer to the display hardware (using DMA). op_3 can happen in parallel with op_1, so the effective frame period is: frame_period = MAX(op_1_time + op_2_time, op2_time + op_3_time) This app measures op_1_time + op_2...
__profiler_start()
/* * 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 *window = window_create(); const bool animated = true; window_stack_push(window, animated); app_timer_register(100, log_data, 0); app_event_loop(); }
d = analytics_uuid_for_client(client); analytics_storage_take_lock(); AnalyticsHeartbeat *heartbeat = analytics_storage_find(metric, uuid, AnalyticsClient_Ignore); if (heartbeat) { const int64_t prev_value = analytics_heartbeat_get(heartbeat, metric); if (prev_value < val) { analytics_heartbeat_se...
rtc_get_ticks()
RESOURCES_FIXTURE_PATH, PUG_FIXTURE_NAME, "pug"); size_t pug_size = resource_size(SYSTEM_APP, RESOURCE_ID_PUG); cl_assert_equal_i(pug_size, sizeof(pug)); uint8_t pug_buf[pug_size]; cl_assert_equal_i( resource_load_byte_range_system(SYSTEM_APP, RESOURCE_ID_PUG, 0, pug_buf, pug_size), pug_size); for...
prv_get_store_length(&entry, &manifest)
, 0); }
irplane_event_info; EventServiceInfo bt_connection_event_info; EventServiceInfo bt_pairing_event_info; EventServiceInfo ble_device_name_updated_event_info; #if CAPABILITY_HAS_BUILTIN_HRM EventServiceInfo ble_hrm_sharing_event_info; #endif } SettingsBluetoothData; // BT stack interaction stuff /////////////////...
(data->remote_list_head, dual_remote_filter, true, device)
; if (remote) { // The remote is also a ble device, promote to a dual remote const bool classic_connected = remote->classic.connected; remote->type = StoredRemoteTypeBTDual; remote->dual.classic.connected = classic_connected; // Note: We update remote->dual.ble.connected outside this cb remote...
oad_count(void) { return s_load_count - s_unload_count; } static int16_t prv_get_appear_disappear_count(void) { return s_appear_count - s_disappear_count; } static void prv_reset_counts(void) { s_load_count = 0; s_unload_count = 0; s_appear_count = 0; s_disappear_count = 0; } static void prv_click_config...
stub_pebble_tasks_set_current(PebbleTask_App)
; cl_check(app_state_get_window_stack()); cl_check(!app_state_get_window_stack()->list_head); app_window_stack_push(window1, true); cl_assert_equal_i(app_window_stack_count(), 1); cl_assert_equal_i(window1->on_screen, true); app_window_stack_push(window2, true); cl_assert_equal_i(app_window_stack_cou...
/* * 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...
{ ResponsivenessGrantedHandler granted_handler = fake_comm_session_get_last_responsiveness_granted_handler(); cl_assert_equal_i(s_setup_complete_call_count, 0); granted_handler(); cl_assert_equal_i(s_setup_complete_call_count, 1); granted_handler(); cl_assert_equal_i(s_setup_complete_call_count, 1);...
void test_audio_endpoint__dont_call_setup_complete_callback_if_session_stopped(void) { ResponsivenessGrantedHandler granted_handler = fake_comm_session_get_last_responsiveness_granted_handler(); audio_endpoint_stop_transfer(s_session_id); granted_handler(); cl_assert_equal_i(s_setup_complete_call_count, 0)...
); if (week == 0) { return -1; } else if (week > prv_year_week_count(year, t, 4, 3)) { // 53 weeks if the current year started on a Thursday, // orrrrr Wednesday and this year is a leap year. return 1; } else { return 0; } } static int prv_iso8601_year(const struct tm *t) { const int year...
FMT_STRCOPY_I18N(time_locale->weekday[t->tm_wday % DAYS_PER_WEEK])
; break; case 'h': // SU case 'b': FMT_STRCOPY_I18N(time_locale->mon[t->tm_mon % MONTHS_PER_YEAR]); break; case 'B': FMT_STRCOPY_I18N(time_locale->month[t->tm_mon % MONTHS_PER_YEAR]); break; case 'c': FMT_RECURSE_I18N(time_locale->c_fmt); _fmt_recu...
/* * 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...
{ caller_is_privileged = false; if (pebble_task_get_current() == PebbleTask_Worker) { // Not allowed from workers syscall_failed(); } // num_bytes_out is optional, so it's perfectly safe for an app to pass in NULL here. if (num_bytes_out) { syscall_assert_userspace_buffer(num_byte...
return resource_get_readonly_bytes(app_num, resource_id, num_bytes_out, caller_is_privileged); } DEFINE_SYSCALL(bool, sys_resource_is_valid, ResAppNum app_num, uint32_t resource_id) { return resource_is_valid(app_num, resource_id); } DEFINE_SYSCALL(uint32_t, sys_resource_get_and_cache, ResAppNum app_num, uint32...
(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 * distributed under the License is distributed on an "AS IS" BAS...
(s_data_subscribers, prv_session_ref_list_filter, (void*)session)
include "kernel/events.h" #include "clar.h" #include <btutil/bt_device.h> // Fakes /////////////////////////////////////////////////////////// #include "fake_GAPAPI.h" #include "fake_GATTAPI.h" #include "fake_GATTAPI_test_vectors.h" #include "fake_events.h" #include "fake_new_timer.h" #include "fake_pbl_malloc.h" #...
cl_assert_equal_b(fake_gatt_is_service_discovery_running(), true)
; // Start again (expect to fail): cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoInvalidState); // take down the connection and a disconnection event should be emitted gap_le_connection_remove(&device); prv_assert_event(&device, BTErrnoServiceDiscoveryDisconnected...
- 1].type = 0; s_ready_to_install[ObjectSysResources - 1].type = 0; bool set_res_bit = true; if (set_res_bit) { boot_bit_set(BOOT_BIT_NEW_SYSTEM_RESOURCES_AVAILABLE); } boot_bit_set(BOOT_BIT_NEW_FW_AVAILABLE); } static void prv_do_install(uint32_t token) { struct InstallableObject* o = NULL; for ...
if (init_request->index >= MAX_APP_BANKS) { PBL_LOG(LOG_LEVEL_ERROR, "Attempting to put byte in invalid bank #%d", init_request->index); return false; }
single_line_text_offset_px; icon_top_margin_px += icon_single_line_text_offset_px; } else { text_top_margin_px += status_layer_offset; icon_top_margin_px += status_layer_offset; } } y = text_top_margin_px; h = bounds->size.h - y; // Set up the text. TextLayer *text_layer = &dialog-...
(actionable_dialog->down_icon)
; } else { // DialogActionBarConfirm || DialogActionBarDecline gbitmap_destroy(actionable_dialog->select_icon); } } if (actionable_dialog->dialog.destroy_on_pop) { applib_free(actionable_dialog); } } Dialog *actionable_dialog_get_dialog(ActionableDialog *actionable_dialog) { return &actionabl...
sion) { mutex_lock_recursive(s_list_mutex); if (session->status != DataLoggingStatusActive) { mutex_unlock_recursive(s_list_mutex); return false; } PBL_ASSERTN(session->data); // Incrementing open_count insures that no one else can do a dls_unlock_session(inactivate=true) // on it and cause it to ...
(s_list_mutex)
; return (NULL); } void dls_list_remove_session(DataLoggingSession *logging_session) { if (uuid_is_system(&logging_session->app_uuid)) { PBL_LOG(LOG_LEVEL_WARNING, "Deleting the system data logging session with tag %"PRIu32, logging_session->tag); } mutex_lock_recursive(s_list_mutex); DataLo...