prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
---------------- // Sample captured: 2015-08-06 18:38:11 GMT AccelRawData *activity_sample_working_at_desk(int *len) { static AccelRawData samples[] = { { -26, -168, -982}, { 26, -185, -984}, { 34, -211, -990}, { -2, -202, -984}, { -49, -183, -967}, { -67, -189, -990}, { -82, -161, -985}, ...
{ 280, 374, -872}, { 287, 514, -875}, { 230, 263, -908}, { 258, 356, -900}, { 259, 371, -889}, { 261, 393, -897}, { 250, 325, -909}, { 268, 381, -908}, { 277, 383, -904}, { 256, 356, -906}, { 260, 364, -905}, { 262, 377, -901}, { 263, 370, -901}, { 256, 362, -903}...
{ 298, 253, -945}, { 299, 201, -945}, { 301, 214, -948}, { 310, 233, -930}, { 329, 260, -929}, { 322, 278, -927}, { 306, 209, -930}, { 303, 229, -929}, { 315, 249, -930}, { 303, 234, -936}, { 299, 236, -929}, { 309, 244, -933}, { 308, 244, -926}, { 302, 250, -938...
* you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT W...
if (is_up) { PBL_LOG(LOG_LEVEL_DEBUG, "Launching timeline in past mode."); s_timeline_args.direction = TimelineIterDirectionPast; } else { PBL_LOG(LOG_LEVEL_DEBUG, "Launching timeline in future mode."); s_timeline_args.direction = TimelineIterDirectionFuture; }
ts > 1)) || ((command->type == GDrawCommandTypePrecisePath) && (command->num_points > 1))); } static void prv_draw_path(GContext *ctx, GDrawCommand *command) { if (command->num_points <= 1) { return; } GPath path = { .num_points = command->num_points, .points = command->points }; // dra...
{ return; }
command->points[point_idx] = point; } GPoint gdraw_command_get_point(GDrawCommand *command, uint16_t point_idx) { if (!command || (point_idx >= command->num_points)) { return GPointZero; } else { return command->points[point_idx]; } } void gdraw_command_set_radius(GDrawCommand *command, uint16_t radi...
(out_buffer, "1234", 4) == 0); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 2); cl_assert(circular_buffer_consume(&buffer, 4)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 6); // Now there's just 56 in the buffer. Fill it to the brim cl_assert(circular_buff...
(&buffer, (uint8_t *)"456789", 6)
, true); cl_assert_equal_i(circular_buffer_copy_offset(&buffer, 2 /* start_offset */, data_out, data_out_size), 6); cl_assert(memcmp("456789", data_out, 6) == 0); } void test_circular_buffer__direct_write(void) { CircularBuffer buffer; uint8_t storage[8]; circu...
/* * 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_low_power_transition(true)
; } void low_power_exit(void) { prv_low_power_transition(false); } bool low_power_is_active(void) { return s_low_power_active; }
(token + strlen(token) + 1, "%d", &state->test_entry.in_deep_sleep.max); } else if (strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.force_shut_down_at); } else if (strcmp(token, "TEST_WEIGHT") == 0) { sscanf(token + strlen(token) ...
strlen(token)
+ 1, "%d", &state->test_entry.activity_type.max); } else if (strcmp(token, "TEST_LEN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.len.value); } else if (strcmp(token, "TEST_LEN_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.len.min); ...
try, sizeof(WakeupEntry)); // Migrate the entries to the new timezone if (entry.utc == false) { entry.timestamp -= *((int*)utc_diff); entry.utc = true; if (wakeup_id == s_wakeup_state.current_wakeup_id) { s_wakeup_state.timestamp = entry.timestamp; } } // Write the new entry to the setti...
PBL_LOG(LOG_LEVEL_DEBUG, "Not rewriting wakeup file because no entries were found")
; } settings_file_close(&wakeup_settings); // If wakeup events were missed by apps requesting notify_if_missed // popup a notification window displaying these apps if (missed_events.missed_apps_count) { wakeup_popup_window(missed_events.missed_apps_count, missed_events.missed_app_ids); } } static boo...
more room. //! Source: https://pebbletechnology.atlassian.net/wiki/display/DEV/PBW+3.0 #if PLATFORM_TINTIN || PLATFORM_SILK || UNITTEST #define APP_SPACE_BUFFER KiBYTES(300) #else #define APP_SPACE_BUFFER MiBYTES(4) #endif #define MAX_PRIORITY ((uint32_t)~0) // 4 quick launch apps, 1 default watchface, 1 default work...
(sizeof(EvictListNode))
; list_init((ListNode *)node); // give them an extremely high priority so that we only remove them if we really NEED to // This list contains defaults that we shouldn't be removing. uint32_t priority = 0; if (prv_is_in_list(id, data->do_not_evict, DO_NOT_EVICT_LIST_SIZE)) { priority = MAX_PRIORITY; } ...
anual and Scheduled DND both OFF DoNotDisturbSchedule schedule = { .from_hour = 0, .from_minute = 30, .to_hour = 12, .to_minute = 30, }; active = do_not_disturb_is_active(); cl_assert(active == false); // both OFF do_not_disturb_set_schedule(WeekdaySchedule, &schedule); do_not_disturb_set_s...
(do_not_disturb_is_manually_enabled() == false)
; active = do_not_disturb_is_active(); cl_assert(active == false); // Scheduled ON } void test_do_not_disturb__smart_dnd(void) { bool active; calendar_init(); cl_assert(do_not_disturb_is_smart_dnd_enabled() == false); do_not_disturb_toggle_smart_dnd(); // Only smart DND is on cl_assert(do_not_disturb_is...
ted(&ctx, GPoint(100, 90), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(100, 95), 5); // T facing left - odd vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 91), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(131, 96), 5); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST...
GPoint(20,20)
, GPoint(20,20)); graphics_context_set_antialiased(ctx, false); graphics_context_set_stroke_width(ctx, 2); graphics_draw_line(ctx, GPoint(30,30), GPoint(30,30)); graphics_context_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, 2); graphics_draw_line(ctx, GPoint(40,40), GPoint(40,40)); ...
ognizer_manager.h" #include "recognizer_private.h" #include "applib/applib_malloc.auto.h" #include "applib/ui/layer.h" #include "system/passert.h" #include "util/list.h" #include <stddef.h> static void prv_set_state(Recognizer *recognizer, RecognizerState new_state) { switch (recognizer->state) { case Recogniz...
(new_state < RecognizerStateCount)
; kino_reel_transform_set_to_frame(kino_reel, icon_to); kino_reel_transform_set_transform_duration(kino_reel, PEEK_LAYER_UNFOLD_DURATION); const int16_t expand = 8; kino_reel_scale_segmented_set_deflate_effect(kino_reel, expand); layer_set_hidden((Layer *)&peek_layer->kino_layer, true); peek_layer->show_do...
kino_reel_transform_set_to_reel(kino_reel, to_reel, take_ownership)
; } if (prv_is_dot_size(icon_to.size)) { kino_reel_scale_segmented_set_end_as_dot(kino_reel, peek_layer->dot_diameter / 2); } kino_layer_set_reel(&peek_layer->kino_layer, kino_reel, true); kino_layer_set_callbacks(&peek_layer->kino_layer, (KinoLayerCallbacks) { .did_stop = prv_scale_to_did_stop, },...
, 1, &sleep_state_seconds); if (sleep_state_seconds < s_sleep_reward_settings.reward.sleep.trigger_after_wakeup_seconds) { INSIGHTS_LOG_DEBUG("Not triggering sleep reward - haven't been awake long enough: %"PRId32, sleep_state_seconds); return; } // All criteria have been met, show...
(max_attr_length)
; char *short_subtitle = kernel_zalloc_check(max_attr_length); const uint32_t duration_s = session->length_min * SECONDS_PER_MINUTE; health_util_format_hours_and_minutes(elapsed, max_attr_length, duration_s, &pin_attr_list); const char *short_subtitle_fmt = i18n_get("%s of sleep", &pin_attr_list); /// "10H 30M ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(data->window)
; GRect bounds = window_layer->bounds; data->menu_layer = simple_menu_layer_create(bounds, data->window, &data->menu_section, 1, NULL); layer_add_child(window_layer, simple_menu_layer_get_layer(data->menu_layer)); } // ===========================================...
missions and * limitations under the License. */ #include "hc_protocol/hc_endpoint_gap_service.h" #include "comm/ble/gap_le_connection.h" #include "kernel/pbl_malloc.h" #include "services/common/system_task.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" #include <bluetooth/blueto...
{ HcProtocol_GapServiceGeneratePrivateResolvableAddressResponse *payload = (HcProtocol_GapServiceGeneratePrivateResolvableAddressResponse *) response->payload; *address_out = payload->address; success = true; }
kernel_free(response); return success; }
/* * 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...
{ break; }
cur_ptr = &cur_entry->more_recent; } // cur_ptr should point to the last pointer in the list PBL_ASSERTN(*cur_ptr == NULL); if (found) { found->more_recent = NULL; *cur_ptr = found; return (found->data); } else { return (NULL); } } void lru_cache_put(LRUCache* c, uint32_t key, void* ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
EXECUTE_SCRIPT(script)
; cl_assert(fake_app_timer_is_scheduled(timer) == false); } void test_rocky_api_timers__setTimeout(void) { char *script = "var num_times = 0;" "var f = function(extra) {" " num_times++;" "};" "var timer = setTimeout('f()', '1000');"; EXECUTE_SCRIPT(script); AppTimer *timer = (A...
uffer__cleanup(void) { } static void prv_read_and_consume(SharedCircularBuffer *buffer, SharedCircularBufferClient *client, uint8_t *data, uint32_t num_bytes) { while (num_bytes) { uint16_t chunk; const uint8_t *read_ptr; cl_assert(shared_circular_buffer_read(buffer, client, nu...
(&buffer, &client2)
; // We should start out empty cl_assert(!shared_circular_buffer_read(&buffer, &client1, 1, &out_buffer, &out_length)); cl_assert(!shared_circular_buffer_read(&buffer, &client2, 1, &out_buffer, &out_length)); // Fill with data cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "123456", 6, false)); ...
ount_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); animation_set_elapsed(a, duration_a - leftover_a); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_sto...
animation_schedule(a)
; // ------------------------------------------------------------------------------------- // Got partway through the delayof a prv_advance_to_ms_with_timers(start_ms + 100); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_h...
ep sleep duration 7777, // Typical fall asleep time 8888, // Typical wakeup time }; static uint32_t s_invalid_sleep_data[] = { 5, // Version NOW, // Timestamp 1234, // Sleep Duration 1111, // Deep Sleep Duration 2222, // Fall Asleep Time 3333,...
(health_db_get_typical_value(ActivityMetricSleepEnterAtSeconds, Monday, &val_out))
; cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalFallAsleepTime]); cl_assert(health_db_get_typical_value(ActivityMetricSleepExitAtSeconds, Monday, &val_out)); cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalWakeupTime]); } void test_health_db__hr_zone_data(void) { const char *key = "monday_heartRateZoneD...
lthServiceAccessibilityMaskAvailable) { passed = false; goto exit; } // Test registring and cancelling a metric alert HealthMetricAlert *alert = health_service_register_metric_alert(HealthMetricHeartRateBPM, 10); APP_LOG(APP_LOG_LEVEL_DEBUG, "Result from register_metric_alert: %p", alert); if (alert ...
data->debug_card.menu_layer = simple_menu_layer_create(bounds, window, sections, ARRAY_LENGTH(sections), data); layer_add_child(window_layer, simple_menu_layer_get_layer(data->debug_card.menu_layer)); }
// ------------------------------------------------------------------------------- static void debug_window_unload(Window *window) { simple_menu_layer_destroy(s_data->debug_card.menu_layer); } // ------------------------------------------------------------------------------- static void deinit(void) { window_d...
(10, 20, 40, 10)
)); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); setup_test(&context, false, 2, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CH...
44, 696, 8}, { -1176, 552, 168}, { -1704, 352, 328}, { -2032, 296, 120}, { -1872, 112, 272}, { -1712, -160, 152}, { -1616, 40, 112}, { -1488, 32, 136}, { -1288, 40, 104}, { -1064, 24, 88}, { -1000, -56, 48}, { -712, -632, 192}, { -1120, -920, 400}, { -1000, -368, -360...
{ 200, -112, -1352}, { 176, -200, -1200}, { 104, -72, -1184}, { 24, -48, -1072}, { -32, -96, -992}, { -56, -200, -840}, { 16, -272, -688}, { 72, -296, -600}, { 64, -296, -504}, { 64, -320, -424}, { 32, -304, -352}, { -32, -264, -336}, // 89 seconds { -320, -240, -...
{ -392, 392, 120}, { -272, 608, 24}, { -112, 640, 88}, { 8, 864, -40}, { 96, 1136, -112}, { 16, 1064, -16}, { -40, 1016, -8}, { -88, 984, -24}, { -8, 736, 16}, { 80, 592, -8}, { 112, 496, -64}, { 88, 408, 16}, { 80, 392, 80}, { 32, 576, 232}, { -48, 1096, 264...
ame rect.origin.y += cap_offsets_to_apply; return rect; } static ALWAYS_INLINE void prv_menu_cell_basic_draw_custom_two_columns_round( GContext *ctx, const GRect *cell_layer_bounds, const MenuCellLayerConfig *config, bool is_selected) { if (!cell_layer_bounds) { return; } const GSize icon_size =...
(ctx, cell_layer, config)
; } //! TODO: PBL-21467 Replace with MenuCellLayer void menu_cell_layer_draw(GContext *ctx, const Layer *cell_layer, const MenuCellLayerConfig *config) { prv_draw_cell(ctx, cell_layer, config); } static ALWAYS_INLINE void prv_draw_basic( GContext* ctx, const Layer *cell_layer, GFont co...
_animation_is_scheduled(state, animation); } // ------------------------------------------------------------------------------------------- bool animation_set_handlers(Animation *animation_h, AnimationHandlers handlers, void *context) { AnimationState *state = prv_animation_state_get(Peb...
prv_animation_state_get(PebbleTask_Current)
; if (animation_private_using_legacy_2(state)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. animation_legacy2_set_delay((AnimationLegacy2 *)animation_h, delay_ms); return true; } Animation...
/* * 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...
GRect(0, 0, bounds->size.w, title_height)
; #if PBL_ROUND // inset the drawing bounds if on round to account for the bezel drawing_box = grect_inset(drawing_box, GEdgeInsets(8)); const GSize text_size = graphics_text_layout_get_max_used_size(ctx, graph_card->title, graph_card->title_font, drawing_box, GTextOverflowModeWordWrap, GTextAlignmentCent...
RSIST_FILE_NAME_MAX_LENGTH sizeof("ps000001") static status_t prv_get_file_name(char *name, size_t buf_len, const Uuid *uuid) { // Firmware 2.x persist files are named "p%06d", the added "s" in the file // name prefix indicates that it is in SettingsFile format. int pid = persist_map_auto_id(uuid); if (FAILED(...
list_contains(s_client_stores, &store->list_node)
ace, .max_space_total = max_space_total, }; settings_raw_iter_init(&file->iter, fd, file->name); SettingsFileHeader file_hdr = file->iter.file_hdr; if (file_hdr_is_uninitialized(&file_hdr)) { // Newly created file, create & write out header. memcpy(&file_hdr.magic, SETTINGS_FILE_MAGIC, sizeof(file...
flag_is_set(hdr, SETTINGS_FLAG_WRITE_COMPLETE)
; } static bool partially_overwritten(SettingsRecordHeader *hdr) { return flag_is_set(hdr, SETTINGS_FLAG_OVERWRITE_STARTED) && !flag_is_set(hdr, SETTINGS_FLAG_OVERWRITE_COMPLETE); } static bool overwritten(SettingsRecordHeader *hdr) { return flag_is_set(hdr, SETTINGS_FLAG_OVERWRITE_STARTED) && flag_is_s...
2015, 13:00:00 (T+1DAY+01:00:00) rtc_set_time(event_time + SECONDS_PER_DAY + (1 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Yesterday, 12:00 PM", time_buf); // June 11th 2015, 13:00:00 (T+2DAY+01:00:00) rtc_set_time(even...
(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("2 MIN AGO", time_buf); // June 9th 2015, 15:00:00 (T-01:00:00) rtc_set_time(event_time - (1 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 1 H", time_buf); // June 9th 2015, 14:00:00 (T-02:00:00) ...
/* * 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...
{ dls_clear(); }
void command_dls_send_all(void) { // Use this to trigger a send of all data logging data to the phone, helpful for testing dls_send_all_sessions(); }
* SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 10 H", time_buf); } void test_clock__time_past_two_hour_relative(void) { char time_buf[64]; const int jun10th_noon_2015 = 1433937600; prv_clock_reset(0); rtc_set_time(...
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("59 MIN AGO", time_buf); // June 9th 2015, 13:00:00 (T+01:00:00) rtc_set_time(event_time + SECONDS_PER_HOUR); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS...
cl_assert_equal_s("12:00 PM", time_buf); // June 9th 2015, 23:59:59 (T+11:59:59) rtc_set_time(event_time + (11 * SECONDS_PER_HOUR) + (59 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("12:00 PM", time_buf); // Jun...
.reminder = { .type = type, .reminder_id = removed_id, } }; event_put(&event); } void reminders_handle_reminder_updated(const Uuid *reminder_id) { prv_put_reminder_event((ReminderId *)reminder_id, ReminderUpdated); } void reminders_handle_reminder_removed(const Uuid *reminder_id) { prv_pu...
{ return (prv_calculate_snooze_delay((TimelineItem *)reminder) > 0); }
status_t reminders_snooze(Reminder *reminder) { uint32_t snooze_delay = prv_calculate_snooze_delay((TimelineItem *)reminder); if (snooze_delay == 0) { return E_INVALID_OPERATION; } // Modify reminder timestamp TimelineItem *item = (TimelineItem*) reminder; item->header.timestamp = rtc_get_time() + (t...
we need to clean up, and if the item contains garbage // data we will try to free a garbage allocated buffer field and crash. memset(item_out, 0, sizeof(TimelineItem)); size_t string_alloc_size; char *buffer; if (!timeline_item_create_from_serial_data(item_out, h...
(LOG_LEVEL_ERROR, "Could not deserialize attributes to verify")
/* * 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...
{ RotBitmapLayer temp = pair->black_layer; pair->black_layer = pair->white_layer; pair->white_layer = temp; set_compositing(pair); }
od because the state machine does not transition through // all states in between the new and old states in a transition. if (s_power_state == PowerStateGood) { prv_resume_normal_operation(); } } static void prv_exit_lpm(void) { // Checking the state here is a bit of a hack because the state machine does n...
{ new_state = PowerStateGood; }
// All state transitions are valid in this state machine. prv_transition(new_state); prv_log_battery_state(state); s_first_run = false; } void battery_monitor_init(void) { s_standby_timer_id = new_timer_create(); s_power_state = PowerStateGood; s_low_on_first_run = false; s_first_run = true; // ...
/* * 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_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = app_id })
; } } static void prv_launch_timeline(ClickRecognizerRef recognizer, void *data) { static TimelineArgs s_timeline_args = { .launch_into_pin = false, .pin_id = UUID_INVALID_INIT, }; const bool is_up = (click_recognizer_get_button_id(recognizer) == BUTTON_ID_UP); if (is_up) { PBL_LOG(LOG_LEVEL_DEB...
(id != BT_BONDING_ID_INVALID)
; // And delete is again bt_persistent_storage_delete_bt_classic_pairing_by_addr(&addr_in); // Try to read it back ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(!ret); } //...
or(ctx, command->stroke_color); graphics_context_set_stroke_width(ctx, command->stroke_width); graphics_draw_circle(ctx, command->points[0], command->radius); } } static void prv_draw_precise_path(GContext *ctx, GDrawCommand *command) { if (command->num_points <= 1) { return; } // draw all values ...
{ if (!command) { return; } command->hidden = hidden; }
bool gdraw_command_get_hidden(GDrawCommand *command) { if (!command) { return false; } return command->hidden; } size_t gdraw_command_copy_points(GDrawCommand *command, GPoint *points, const size_t max_bytes) { const size_t actual_size = gdraw_command_get_num_points(command) * sizeof(GPoint); const siz...
heap(void) { return NULL; } QueueHandle_t xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType ) { static intptr_t counter = 0; // Return unique IDs for all the created queues return (void*) ++counter; } signed portBASE_TYPE xQueueGenericSend( ...
app_manager_close_current_app(true /* gracefully */)
; // The first app should still be running cl_assert(app_manager_get_current_app_md() == (PebbleProcessMd*) &s_launch_app); } void test_app_manager__start_third_party_and_force_close_back_to_first(void) { test_app_manager__start_third_party(); s_last_to_app_event = (PebbleEvent) {0}; // Make the app get ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
GColorARGB8FromHEX(0x7fff00)
( (TimelineResourceId)TimelineResourceTestTimelineId_AlarmClock, TimelineResourceSizeTiny, TimelineResourceTestAppId_ValidApp, NULL)
); // Calling the function with a valid system TimelineResourceId should return true and set res_info cl_assert(timeline_resources_get_id_system(TIMELINE_RESOURCE_AUDIO_CASSETTE, TimelineResourceSizeSmall, SYSTEM_APP, &res_info)); cl_assert_equal_i(res_info.res_app_nu...
mine whether adding this mark overflows the cell, necessitating // another cell for this mark. uint16_t mark_width = mark->bounds.size.w; if (cd->current_regulatory_marks_cell_width + mark_width >= DISP_COLS) { // Flush the current marks to a cell and start a new one. prv_append_certification_menu(cd, &(S...
(&cd->fcc_mark, RESOURCE_ID_SYSTEM_FCC_MARK)
; gbitmap_init_with_resource(&cd->kcc_mark, RESOURCE_ID_SYSTEM_KCC_MARK); gbitmap_init_with_resource(&cd->ce_mark, RESOURCE_ID_SYSTEM_CE_MARK); gbitmap_init_with_resource(&cd->weee_mark, RESOURCE_ID_SYSTEM_WEEE_MARK); gbitmap_init_with_resource(&cd->r_mark, RESOURCE_ID_SYSTEM_R_MARK); gbitmap_init_with_resour...
(!ret); } // /////////////////////////////////////////////////////////////////////////////////////////////////// // //! Local Device Info void test_bluetooth_persistent_storage_prf__test_active_gateway(void) { bool ret; BtPersistBondingType type_out; BTBondingID id_out; // Nothing is stored, so no active g...
cl_assert(!ret)
; ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(ret); }
sponseTimeMin, MAX_PERIOD_RUN_FOREVER); #endif break; } case HciStatusCode_UnknownConnectionIdentifier: { // Happens if "Connection Create" was cancelled. // See Bluetooth Spec 4.0, Volume 2, Part E, Chapter 7.8.13. break; } default: { PBL_LOG(LOG_LEVEL_ERROR, "Connection...
prv_update_clients(intent, HciStatusCode_Success, GAPLEConnectionEventConnectedAndEncrypted)
; } //! bt_lock is assumed to be taken before calling this function. void bt_driver_handle_le_encryption_change_event(const BleEncryptionChange *event) { bt_lock(); const bool is_encrypted = (event->encryption_enabled); if (!is_encrypted) { // The "Encryption Change" event can only enable encryption, there's...
animation_private_state_init(kernel_applib_get_animation_state())
; content_indicator_init_buffer(&s_kernel_content_indicators_buffer); s_kernel_current_timeline_item_action_source = TimelineItemActionSourceModalNotification; } GContext* kernel_ui_get_graphics_context(void) { PBL_ASSERT_TASK(PebbleTask_KernelMain); return &s_kernel_grahics_context; } GContext *graphics_con...
curr_ticks = rtc_get_ticks(); if (curr_ticks < timeout) { uint16_t wait_time = (timeout - curr_ticks) / RTC_TICKS_HZ; *secs_to_wait = MAX(1, wait_time); } else { *secs_to_wait = 0; } } return state; } /* * LE connection manager handling for a gateway connection */ static void prv...
list_remove(&curr_request->list_node, (ListNode **)&conn_mgr_info->requests, NULL)
; kernel_free(curr_request); } } curr_request = next; } // Note: As an optimization, we could track how long we have been in a lower // latency state and subtract that from higher latency requests, but most of // the time we should be in the maximum latency (low power) state anyway // ...
s_registered_for_all_entity_updates(), false); // Expect to have written the command to register for the Queue entity: fake_gatt_client_op_assert_write(entity_update, s_register_queue_entity, sizeof(s_register_queue_entity), GAPLEClientKernel, t...
(ams_is_registered_for_all_entity_updates(), true)
H(s_dls_records)); s_dls_records[s_num_dls_records++] = records[i]; } return DATA_LOGGING_SUCCESS; } DataLoggingSession *dls_create(uint32_t tag, DataLoggingItemType item_type, uint16_t item_size, bool buffered, bool resume, const Uuid *uuid) { if (tag == DlsSystemTagProtobufL...
protobuf_log_private_mset_decode( &s_parsed_msg.type, (uint8_t *)buffer + sizeof(*hdr), hdr->msg_size, s_parsed_msg.payload_sender_type, s_parsed_msg.payload_sender_id, s_parsed_msg.payload_sender_version_patch, &s_parsed_msg.payload_send_time, &s_parsed_msg.payload_sende...
; if (!success) { LOG("No encoded msg available"); } else { LOG("ProtobufLogType: %d", s_parsed_msg.type); LOG("payload_sender_type: %s", s_parsed_msg.payload_sender_type); LOG("payload_sender_id: %s", s_parsed_msg.payload_sender_id); LOG("payload_sender_version: major: %"PRIu32", minor: %"PRIu3...
or); #endif qspi_release(dev->qspi); return result ? S_TRUE : S_FALSE; } void qspi_flash_ll_set_register_bits(QSPIFlash *dev, uint8_t read_instruction, uint8_t write_instruction, uint8_t value, uint8_t mask) { // make sure we're not trying to set any bits not within the mask ...
qspi_indirect_read_dma(dev->qspi, instruction, 0, dummy_cycles, buffer_dma, size, is_ddr)
bool resume = false; Uuid system_uuid = UUID_SYSTEM; state->activity_dls_session = dls_create( DlsSystemTagActivitySession, DATA_LOGGING_BYTE_ARRAY, sizeof(dls_record), buffered, resume, &system_uuid); if (!state->activity_dls_session) { PBL_LOG(LOG_LEVEL_WARNING, "Error creating activ...
{ // Accumulate restful sleep stats stats->restful_minutes += session->length_min; }
stats->last_deep_exit_utc = MAX(stats->last_deep_exit_utc, session_exit_utc); } } return rv; } // -------------------------------------------------------------------------------------------- // Goes through a list of activity sessions and updates our sleep totals in the metrics // accordingly. We also...
/* * 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...
crc32(crc32(0, NULL, 0), message, 14)
, CRC32_RESIDUE); } void test_crc32__null_residue(void) { uint8_t data[4] = {0, 0, 0, 0}; crc = crc32(crc, data, 4); assert_equal_hex(crc, CRC32_RESIDUE); }
OLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r2_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 3); // TODO: Fix offset calculatio...
(&ctx.dest_bitmap, "draw_round_rect_origin_r0_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r1_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_R...
ce(device); if (!p) { return HrmSharingPermission_Unknown; } return p->permission; } void ble_hrm_handle_activity_prefs_heart_rate_is_enabled(bool is_enabled) { if (!prv_hw_and_sw_supports_hrm()) { return; } PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing prefs updated: is_enabled=%u", is_enabled); if ...
(sizeof(*sharing_request))
; sharing_request->connection = connection; launcher_task_add_callback(prv_push_sharing_request_window_kernel_main_cb, sharing_request); } static void prv_put_sharing_state_updated_event(int subscription_count) { // 2 purposes of this event: // - refresh the Settings/Bluetooth UI whenever a device (un)subscrib...
cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(4)); cl_assert(timeline_model_iter_prev(&new_idx, NULL)); cl_assert_equal_i(new_idx, 3); cl_ass...
cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(1)->pin.header.id))
; cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(0)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(2)); } void test_timeline_model__graceful_delete_first(void) { TimelineModel model = {0}; model.direction = Timeline...
store if necessary prv_update_storage(utc_sec); // If we are starting a new day, reset all metrics if (cur_day_index != s_activity_state.cur_day_index) { s_activity_state.step_data = (ActivityStepData) { 0 }; s_activity_state.sleep_data = (ActivitySleepData) { 0 }; memset(&s_activity_sta...
(prv_minute_system_task_cb, data)
; cron_job_schedule(job); } static CronJob s_activity_job = { .minute = CRON_MINUTE_ANY, .hour = CRON_HOUR_ANY, .mday = CRON_MDAY_ANY, .month = CRON_MONTH_ANY, .cb = prv_minute_cb, }; // ------------------------------------------------------------------------------------------------ // Capture raw accel ...
/* * 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...
framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS})
; } // Teardown void test_graphics_draw_stroke_precise_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } // Tests //////////////////////////////////// #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 30, 40) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 30, 40) ...
TRUCTED_AREA_EVENT)->handler); cl_assert_equal_p(app_state_get_unobstructed_area_state()->handlers.did_change, prv_did_change); const GRect from_area = GRect(0, 0, DISP_COLS, 400); const GRect to_area = GRect(0, 0, DISP_COLS, 200); unobstructed_area_service_will_change(from_area.size.h, to_area.size.h); fake...
GRect(110, 130, 140, 150)
); } void test_unobstructed_area_service__nested_layer_clip_nx_ny(void) { app_state_get_unobstructed_area_state()->area = GRect(0, 0, 400, 400); Layer root_layer = { .bounds = GRect(-150, -120, 10, 10), // The size of the parent layer has no affect }; Layer layer = { .bounds = GRect(-110, -130, 300, 29...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_ny.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_outside_y); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "...
(0, gothic_18_handle, 0, &s_font_info)
evice_address, .register_address = register_address, .direction = direction, .type = type, .size = size, .idx = 0, .data = data, }; i2c_hal_init_transfer(bus); bus->state->transfer_nack_count = 0; bool result = false; bool complete = false; do { i2c_hal_start_transfer(bus); ...
{ PBL_LOG(LOG_LEVEL_ERROR, "Write failed on bus %s", slave->bus->name); }
return result; } bool i2c_write_block(I2CSlavePort *slave, uint32_t write_size, const uint8_t* buffer) { PBL_ASSERTN(slave); PBL_ASSERTN(buffer); // Do transfer locks the bus bool result = prv_do_transfer(slave->bus, Write, slave->address, 0, write_size, (uint8_t*)buffer, N...
nd * limitations under the License. */ #include "clar.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/comm_session/session_internal.h" #include "services/common/comm_session/session_remote_os.h" #include "services/common/comm_session/session_remote_version.h" #includ...
session_remote_version_start_requests(&s_session)
; } void test_session_remote_version__cleanup(void) { s_launcher_task_callback = NULL; s_launcher_task_callback_data = NULL; fake_pbl_malloc_clear_tracking(); } void test_session_remote_version__receive_invalid_msg(void) { uint8_t invalid_msg = 0xff; session_remote_version_protocol_msg_callback(&s_session,...
/* * 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...
(action1_attributes)
, .attributes = action1_attributes }; AttributeList attr_list2 = { .num_attributes = ARRAY_LENGTH(action2_attributes), .attributes = action2_attributes }; AttributeList attr_list3 = { .num_attributes = ARRAY_LENGTH(attributes), .attributes = attributes }; static uint8_t attr_lis...
client->debug_name, range.start, range.end); } #endif client->handle_service_discovered(characteristics); } } } static void prv_handle_gatt_service_discovery_event(const PebbleBLEGATTClientServiceEvent *event) { PebbleBLEGATTClientServiceEventInfo *event_info = event->info; if (e...
PBL_LOG(LOG_LEVEL_ERROR, "OOM for GATT notification")
; return; } const uint16_t next_value_length = gatt_client_subscriptions_consume_notification(&header.characteristic, buffer, &header.value_length, GAPLEClientKernel, &has_mor...
app_uuid, (crash_info->pc_known) ? crash_info->pc : 0, (crash_info->lr_known) ? crash_info->lr : 0, crash_info->build_id, crash_info->is_rocky_app); } //! Converts an address from an absolute address in our memory space to one that's r...
(&s_current_app_crash_info)
; prv_kill_user_process(0); } static void prv_return_to_landing_zone(uintptr_t stacked_pc, uintptr_t stacked_lr, unsigned int* stacked_args) { // We got this! Let's redirect this task to a spin function and tell the app manager to kill us. // Log about the terrible thing that just happened. CrashInfo crash_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...
{ // We're priviledged, it's not safe to just kill the app task. vTaskResume((TaskHandle_t) context->task_handle); return false; }
context->safe_to_kill = true; return true; } // -------------------------------------------------------------------------------------------------- static void prv_force_close_timer_callback(void* data) { PebbleTask task = (PebbleTask)data; ProcessContext *context = prv_get_context_for_task(task); if (!pr...
/* * 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 (msg->command_id) { case HcMessageID_GapLEConnect_ConnectionComplete: { const HcGapLeConnectionData *e = (HcGapLeConnectionData *)msg->payload; bt_driver_handle_le_connection_complete_event(&e->connection_complete_event); const GattDeviceConnectionEvent gatt_event = { .dev_addre...
const BleRemoteVersionInfoReceivedEvent *e = (BleRemoteVersionInfoReceivedEvent *)msg->payload; bt_driver_handle_peer_version_info_event(e); break; } } } int hc_endpoint_gap_le_disconnect(const BTDeviceInternal *address) { HcProtocolMessage *resp = hc_protocol_enqueue_with_payload_...
ll attached recognizers recognizer_list_iterate(&layer->recognizer_list, prv_destroy_recognizer, layer); #endif } void layer_destroy(Layer* layer) { if (layer == NULL) { return; } layer_deinit(layer); applib_free(layer); } void layer_mark_dirty(Layer *layer) { if (layer->property_changed_proc) { l...
grect_clip(&ctx->draw_state.clip_box, &levels_layer_frame_in_ctx_space)
} else if (data->property == PROPERTY_ALPHA) { data->alpha = (data->alpha + 0x40) & ALPHA_100; set_text_layers(data); } else if (data->property == PROPERTY_COLOR_TABLE) { if (s_color_table == color_table_hsv) { s_color_table = color_table_hvs; } else if (s_color_table == color_table_hvs) { ...
layer_add_child(window_get_root_layer(window), text_layer_get_layer(data->fg_color_text))
// Store another pairing BTDeviceAddress addr_2 = {{0x21, 0x22, 0x23, 0x24, 0x25, 0x26}}; SM128BitKey link_key_2 = {{0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}}; char name_2[BT_DEVICE_NAME_BUFFER_SIZE] = "Device 2"; uint8_t pla...
cl_assert_equal_m(&link_key_2, &link_key_out, sizeof(link_key_out))
; cl_assert_equal_s(name_2, name_out); cl_assert_equal_i(platform_bits_2, platform_bits_out); ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_3, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_3, ...
e_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("12:00 PM", time_buf); // June 9th 2015, 23:59:59 (T+11:59:59) rtc_set_time(event_time + (11 * SECONDS_PER_HOUR) + (59 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time,...
clock_set_24h_style(false)
; // June 9th 2015, 17:00:00 (T+01:00:00) rtc_set_time(event_time + SECONDS_PER_HOUR); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("1 H AGO", time_buf); // June 9th 2015, 17:30:00 (T+01:30:00) rtc_set_time(event_time + SECONDS_PER_HOUR + (30...
ic attributes in the attribute list s_slice_type_impls[current_slice->type].init_attr_list_from_slice(current_slice, attr_list); // Record size of the attribute list in the data struct as well as the overall size accumulator current_attr_list_data->attr_list_size = attribute_list_get_serialized_size(attr_l...
if (!is_attr_list_valid) { PBL_LOG(LOG_LEVEL_WARNING, "Serialized slice AttributeList is invalid"); }
attribute_list_destroy_list(&attr_list); kernel_free(attr_list_data_buffer); return is_attr_list_valid; } typedef struct SliceValidationIteratorContext { bool is_at_least_one_slice_invalid; size_t validated_size; } SliceValidationIteratorContext; //! If any slices are invalid, context.is_at_least_one_sli...
*)(((Alignment_t *)block) - block->PrevSize); } static void prv_calc_totals(Heap* const heap, unsigned int *used, unsigned int *free, unsigned int *max_free) { HeapInfo_t *heap_info_ptr; uint16_t free_segments; uint16_t alloc_segments; /* Initialize the return values. ...
allocate_block(heap, allocation_size, free_block)
; if (allocated_block != NULL) { // We've allocated a new block, update our metrics #ifdef MALLOC_INSTRUMENTATION allocated_block->pc = client_pc; #endif heap->current_size += allocated_block->Size * ALIGNMENT_SIZE; if (heap->current_size > heap->high_water_mark) { heap->high_wate...
2, 0x22, 0xb4, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4, 0x8c, 0x31,...
cl_assert((resp_ptr - s_data) == s_sending_data_length)
; } /************************************************** * Checking for value size of zero INSERT command * * This is valid because one can ZERO out a value * **************************************************/ static const uint8_t s_insert_cmd_zero_value_size[] = { // Message Header 0x01, /...
r_response(s_chunked_dict_part_one, sizeof(s_chunked_dict_part_one), &error)); cl_assert(!error); } void test_ancs_util__should_not_parse_malformed_notif_attr_dict(void) { bool error = false; cl_assert(!ancs_util_is_complete_notif_attr_response(s_chunked_dict_part_two, sizeof(s_chunked_dict_part_two), ...
( attr_ptrs[FetchedAttributeIndexAppID], attr_ptrs[FetchedAttributeIndexTitle], attr_ptrs[FetchedAttributeIndexSubtitle], attr_ptrs[FetchedAttributeIndexMessage], attr_ptrs[FetchedAttributeIndexDate] )
; cl_assert(was_added_to_cache); free(b); #endif }
/* * 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...
{ // Invalid return -1; }
void shell_prefs_set_automatic_timezone_id(int16_t timezone_id) { } // Exported function used by blob_db API to set the backing store for a specific key. // Not used by the SDK shell bool prefs_private_write_backing(const uint8_t *key, size_t key_len, const void *value, int value_len)...
file, key, key_len); } } printf("Making sure we handle running out of storage gracefully...\n"); memcpy(key, "k255", 5); memcpy(val, "v255", 5); cl_assert_equal_i(settings_file_set(&file, key, key_len, val, val_len), E_OUT_OF_STORAGE); int val_len_out = settings_file_get_len(&file, key, key_len); cl_m...
printf("new! %d\n", new_value_length)
; cl_assert_equal_m(new_value, val_out, val_len_out); free(val_out); return RecordResultNew; } // Should not get here! This means that neither the old nor the new value // could be retreived, and thus the atomicity is broken! Aaaaaaaaaaaaaah!! cl_assert(false); } fake_spi_flash_for...
/* * 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...
sys_wakeup_schedule(sys_get_time() + 10, 0, false)
tes: EXECUTE_SCRIPT("var pileOfPooUTF8 = '\xF0\x9F\x92\xA9';"); // Expect a pair of surrogate code points: EXECUTE_SCRIPT_AND_ASSERT_RV_EQUALS_S("pileOfPooUTF8.charCodeAt(0).toString(16)", "d83d"); EXECUTE_SCRIPT_AND_ASSERT_RV_EQUALS_S("pileOfPooUTF8.charCodeAt(1).toString(16)", "dca9"); } void test_rocky_text...
(copied_size, cases[i].expected_utf_size)
; if (cases[i].expected_utf_size) { cl_assert_equal_m(utf8_buffer, cases[i].expected_utf_data, cases[i].expected_utf_size); } } else { // When buffer is too small, expect 0 bytes copied: cl_assert_equal_i(copied_size, 0); } jerry_release_value(s); free(...
int16_t end_row, int16_t dupe_row, int16_t shift_amount) { const int16_t delta = start_row > end_row ? -1 : 1; for (int16_t dest_row = start_row; dest_row != end_row; dest_row += delta) { src_bitmap->bounds = (GRect) { .origin.y = (dupe_row >= 0 ? dupe_row : dest_row...
GPoint(0, app_offset_y)
sage_is_accepting_outbound(), true); } void test_app_message__nack_then_outbox_sent(void) { // Sending ack on timeout, but reject the send prv_set_remote_receive_handler(prv_nack_sent_callback); prv_send_test_data(); prv_process_sent_data(); cl_assert_equal_b(app_message_is_accepting_outbound(), false); p...
for (int i = 1; i <= 128; i *= 2) { DictionaryIterator *iter; cl_assert_equal_i(app_message_outbox_begin(&iter), APP_MSG_BUSY); cl_assert_equal_i(MIN(i, 100), s_sys_psleep_last_millis); }
} // Test INBOUND (phone->watch): //////////////////////////////////// static void check_in_accepting_again(void) { cl_assert(app_message_is_accepting_inbound() == true); } void test_app_message__receive_happy_case(void) { prv_set_remote_receive_handler(prv_receive_ack_nack_callback); prv_receive_test_data(TES...
", (int)compositing_mode); return; } } } } void bitblt_bitmap_into_bitmap_tiled_8bit_to_8bit(GBitmap *dest_bitmap, const GBitmap *src_bitmap, GRect dest_rect, ...
MIN(grect_get_max_x(&dest_rect), dest_row_info.max_x + 1)
; if (dest_end_x < dest_begin_x) { continue; } const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(src_bitmap, src_y); const uint8_t *src = src_row_info.data; // This is the initial position that takes into account destination delta shift const in...
nge_animation(data); } } prv_update_layout(data); } static void prv_copy_time_period(char *buffer, size_t n, uint32_t period_s) { uint32_t hours = period_s / SECONDS_PER_HOUR; uint32_t minutes = (period_s % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE; uint32_t seconds = period_s % SECONDS_PER_MINUTE; if (ho...
(config->music_time_font_key)
); layer_add_child(&data->window.layer, &data->length_text_layer.layer); prv_configure_music_text_layer(&data->title_text_layer, data->title_buffer, &title_rect, TITLE_BOUNDS_OFFSET, ARTIST_TITLE_TEXT_ALIGNMENT, system_theme_get_font_for_default_siz...
the only practical //! way to write to the display in the bootloader since we don't have interrupts. static void prv_display_write_byte(uint8_t d) { // Block until the tx buffer is empty SPI_I2S_SendData(DISP_SPI, d); while (!SPI_I2S_GetFlagStatus(DISP_SPI, SPI_I2S_FLAG_TXE)) {} } // Since all these values are c...
for (unsigned i = 0; i < height; i++) { memcpy(buffer[i + y_offset] + x_offset, bitmap + i * width, width); }
} static void prv_display_buffer(uint8_t buffer[DISP_ROWS][DISP_LINE_BYTES]) { prv_display_start_write(); for (int i = 0; i < DISP_ROWS; i++) { prv_display_write_line(i, buffer[i]); } prv_display_end_write(); } void display_boot_splash(void) { uint8_t buffer[DISP_ROWS][DISP_LINE_BYTES]; // Draw black...
_t buffer[1]; DictionaryIterator iter; DictionaryResult result; result = dict_write_begin(&iter, buffer, 0); cl_assert(result == DICT_NOT_ENOUGH_STORAGE); result = dict_write_begin(&iter, buffer, sizeof(buffer)); cl_assert(result == DICT_OK); result = dict_write_cstring(&iter, SOME_STRING_KEY, SOME_STRING...
cl_assert(is_int8_updated == !should_update_existing_keys_only)
; cl_assert(is_string_updated == !test_not_enough_storage); cl_assert(is_data_updated == !test_not_enough_storage); enum { INT8_IDX, STRING_IDX, DATA_IDX, NUM_TUPLES, }; bool has_tuple[NUM_TUPLES] = { false, false, false }; Tuple *tuple = dict_read_begin_from_buffer(&des...
cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown)
; cl_assert_equal_p(manager.triggered, NULL); cl_assert_equal_p(manager.active_layer, NULL); prv_compare_recognizers_processed((int []) { 0, 1 }, 2, &s_recognizers_reset); recognizer_set_simultaneous_with(r[0], prv_simultaneous_with_cb); r[0]->state = RecognizerState_Started; r[1]->state = RecognizerState_...
t priority while still keeping (bytes_in_list > bytes_needed) static void prv_trim_top_priorities(EvictListNode **list_node, uint32_t *bytes_in_list, uint32_t bytes_needed) { EvictListNode *node = *list_node; while (node) { EvictListNode *temp = node; if (node->...
(&file, (uint8_t *)&app_id, sizeof(AppInstallId))
; } settings_file_close(&file); } unlock: mutex_unlock_recursive(s_app_cache_mutex); return rv; } //! Asks the app cache to remove 'bytes_needed' bytes of application binaries to free up space //! for other things. status_t app_cache_free_up_space(uint32_t bytes_needed) { if (bytes_needed == 0) { ...
anim_offset = prv_get_overlap_line_length(layer, NULL, NULL); } else if ((layer->relbar_layer.curr_rel_bar.rel_bar_type == RelationshipBarTypeBackToBack) || (layer->relbar_layer.curr_rel_bar.rel_bar_type == RelationshipBarTypeFreeTime)) { layer->relbar_layer.curr_rel_bar.anim_offset = REL_BAR_BACK_TO...
(rel_bar_anim, (AnimationHandlers) { .stopped = prv_rel_bar_stopped, }, layer)
; } return rel_bar_anim; } void timeline_relbar_layer_reset(TimelineLayer *layer) { prv_update_rel_bars(layer); if (layer->relbar_layer.curr_rel_bar.rel_bar_type == RelationshipBarTypeOverlap) { layer->relbar_layer.curr_rel_bar.anim_offset = prv_get_overlap_line_length(layer, NULL, NULL); } else if ((la...
length (%"PRIu32")", length); return; } const FlashReadRequest *request = payload; if (request->length > MAX_DATA_LENGTH) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid request length (%"PRIu32")", request->length); } // leave 1 byte at the start for flags static uint8_t buffer[1 + MAX_DATA_LENGTH]; flash_...
if (header->opcode == OPCODE_FLASH_ERASE) { prv_handle_flash_erase_request(payload, payload_length); } else if (header->opcode == OPCODE_FLASH_WRITE) { prv_handle_flash_write_request(payload, payload_length); } else if (header->opcode == OPCODE_FLASH_READ) { prv_handle_flash_read_request(payload, payloa...
l_manager_get_window_stack(ModalPriorityNotification); window_stack_pop_all(window_stack, true /* animated */); } event_service_client_unsubscribe(&ctx->event_info); kernel_free(ctx); } void timeline_invoke_action(const TimelineItem *item, const TimelineItemAction *action, const ...
prv_dismiss_local_notification_action(item); return; } // FALLTHROUGH case TimelineItemActionTypeGeneric: case TimelineItemActionTypeResponse: case TimelineItemActionTypeAncsResponse: case TimelineItemActionTypeAncsGeneric: case TimelineItemActionTypeHttp: case Timel...
} /////////////////////////////////// //! Timeline datasource functions /////////////////////////////////// typedef struct { Uuid id; const char *name; } PrivateDataSourceInfo; static const PrivateDataSourceInfo s_data_sources[] = { { .id = UUID_NOTIFICATIONS_DATA_SOURCE, .name = i18n_noop("Notificati...
/* * 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...
(&remove_attr_list, AttributeIdTitle, i18n_get("Remove", &pin_attr_list))
; const int num_actions = 3; TimelineItemActionGroup action_group = { .num_actions = num_actions, .actions = (TimelineItemAction[]) { { .id = 0, .type = TimelineItemActionTypeComplete, .attr_list = completed_attr_list, }, { .id = 1, .type = Timeline...
, { -224, 432, -912}, { -240, 464, -880}, { -184, 480, -968}, { -168, 360, -840}, { -152, 456, -896}, { -136, 496, -776}, { -184, 464, -848}, { -184, 424, -872}, { -192, 408, -992}, { -168, 504, -928}, { -200, 520, -1056}, { -208, 400, -1016}, // 279 seconds { -22...
{ -200, 192, -944}, { -168, -16, -896}, { -168, -80, -1008}, { -64, 64, -1048}, { -24, -16, -1088}, { 32, 32, -1048}, { -8, 80, -1128}, { -112, -48, -960}, { -104, -56, -1032}, { -80, -80, -1064}, { -56, -8, -1088}, { -56, -40, -1080}, { -40, -152, -1016}, { -32, ...
); if (axis_delta < accel_test_axis[i].pass_threshold) { PBL_LOG(LOG_LEVEL_WARNING, "Self test failed for axis %c: %d < %d", accel_test_axis[i].axis_name, axis_delta, accel_test_axis[i].pass_threshold); pass = false; } } prv_run_command(BMI160_CMD_SOFTRESET); psleep(50); bmi...
{ sample_rate = BMI160SampleRate_200_HZ; }
else if (BMI160SampleRate_400_HZ <= interval_us) { sample_rate = BMI160SampleRate_400_HZ; } else if (BMI160SampleRate_800_HZ <= interval_us) { sample_rate = BMI160SampleRate_800_HZ; } else { // any interval < min supported must saturate to 1600Hz sample_rate = BMI160SampleRate_1600_HZ; } return sam...
== NULL); // Insert child_c above child_b (next_sibling code path): // // +-parent // | // '->child_b->child_c->child_a // layer_insert_above_sibling(&child_c, &child_b); cl_assert(parent.first_child == &child_b); cl_assert(child_b.next_sibling == &child_c); cl_assert(child_c.parent == &pa...
(&child_b, &parent)
); cl_assert(!layer_is_descendant(&child_b, &child_a)); cl_assert(!layer_is_descendant(&child_c, &child_a)); layer_add_child(&child_a, &child_c); cl_assert(layer_is_descendant(&child_c, &child_a)); cl_assert(layer_is_descendant(&child_c, &parent)); cl_assert(!layer_is_descendant(&child_c, &child_b)); } vo...
bt permission after disconnection. // Request object should be freed and thing shouldn't crash. prv_assert_permissions_ui_and_respond(true /* is_granted */); cl_assert_equal_b(false, ble_hrm_is_sharing_to_connection(&s_conn_a)); } void test_ble_hrm__decline_permission_dont_ask_again_even_after_reconnecting(void...
(HRMEvent_BPM, 80, HRMQuality_OffWrist, true /* expect bt driver cb */, false /* expected_is_on_wrist */)
#define CLIP_RECT_RECT_BOX GRect(0, 0, BOX_SIZE, BOX_SIZE) #define CLIP_OFFSET 40 // yoffset if used to allow for multiple test cases to be drawn and tested on the same test image // nudge is used to move the drawn rectangle just outside each corner the clipping static void prv_draw_rects(GContext *ctx, uint8_t sw, uin...
(&ctx->dest_bitmap, "draw_multiple_rect_dithered.${BIT_DEPTH_NAME}.pbi")
); } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__dithering_gray(void) { #if SCREEN_COLOR_DEPTH_BITS == 1 GContext ctx; prv_draw_dither_rects(&ctx, GColorLightGray); prv_draw_dither_rects(&ctx, GColorDarkGray); #endif }
/* * 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_locked)
; } void test_system_flash__erase_sector_0(void) { cl_assert(system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_16KB_sectors(void) { cl_assert(system_flash_erase(FLASH_BASE, 48 KiB, NULL, 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...
mutex_create_recursive()
; PBL_ASSERTN(s_analytics_storage_mutex); s_device_heartbeat = analytics_heartbeat_device_create(); PBL_ASSERTN(s_device_heartbeat); } ////////// // Lock void analytics_storage_take_lock(void) { mutex_lock_recursive(s_analytics_storage_mutex); } bool analytics_storage_has_lock(void) { bool has_lock = mutex_...
tor_init(); periodic_timer_trigger(1); cl_assert_equal_i(battery_get_charge_state().charge_percent, percent); fake_battery_set_charging(true); fake_battery_set_millivolts(charge_mv); fake_battery_set_connected(true); cl_assert_equal_i(battery_get_charge_state().charge_percent, percent); fake_battery_set...
battery_monitor_critical_lockout()
); cl_assert_equal_i(standby_timer_get_timeout(), 2000); standby_timer_trigger(1); cl_assert(s_entered_standby); } void test_battery_monitor__critical(void) { int good_mv = battery_curve_lookup_voltage_by_percent(10, false); int critical_mv = battery_curve_lookup_voltage_by_percent(0, false); fake_batter...
{ if (f >= 0) { y--; ddF_y += 2; f += ddF_y; } x++; ddF_x += 2; f += ddF_x; if (quadrant & GCornerBottomLeft) { if (x == 1) { prv_fill_horizontal_line(ctx, GPoint(x0 - radius, y0), radius + 1); } prv_fill_horizontal_line(ctx, GPoint(x0 - x, y0 + y), ...
} static void graphics_fill_half_circle(GContext* ctx, int x0, int y0, uint16_t radius, uint8_t section) { int f = 1 - radius; int ddF_x = 1; int ddF_y = -2 * radius; int x = 0; uint16_t y = radius; while (x < y) { if (f >= 0) { y--; ddF_y += 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...
periph_config_release_lock()
sed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under th...
{ static const PebbleProcessMdSystem s_app_info = { .common = { .main_func = prv_main, // UUID: dfcafc64-0af1-4e4a-8e03-1901b54335c5 .uuid = {0xdf, 0xca, 0xfc, 0x64, 0xa, 0xf1, 0x4e, 0x4a, 0x8e, 0x3, 0x19, 0x1, 0xb5, 0x43, 0x35, 0xc5}, }, .name = "Sta...