prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
///////////////////////////////////////////////////////////// // Stubs & Fakes #include "fake_event_service.h" #include "fake_pebble_tasks.h" #include "fake_pbl_malloc.h" #include "fake_regular_timer.h" #include "stubs_analytics.h" #include "stubs_bt_lock.h" #include "stubs_logging.h" #include "stubs_passert.h" void...
{ return true; }
static int s_sys_hrm_manager_unsubscribe_call_count; bool sys_hrm_manager_unsubscribe(HRMSessionRef session) { ++s_sys_hrm_manager_unsubscribe_call_count; cl_assert_equal_i(session, s_last_session_ref); return true; } /////////////////////////////////////////////////////////////////////////////////////////////...
true, false, false, false, false, false}; id2 = alarm_create(&(AlarmInfo) { .hour = 13, .minute = 15, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_2 }); prv_assert_alarm_config(id2, 13, 15, false, ALARM_KIND_CUSTOM, schedule_2); cl_assert_equal_i(s_num_alarms_fired, 1); s_current_day = s_tuesday; s...
alarm_create(&(AlarmInfo) { .hour = 9, .minute = 30, .kind = ALARM_KIND_WEEKDAYS })
ctx.dest_bitmap, "draw_rect_origin_aa_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // AA = true, SW = 5 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 5); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw5_no_cl...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 3); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 3); ...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 5); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 5);...
/* * 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 (!codepoint_is_zero_width(codepoint)) { horiz_advance = text_resources_get_glyph_horiz_advance(font_cache, codepoint, font); }
return MAX(horiz_advance, 0); } //////////////////////////////////////////////////////////// // Init functions //! @note can be init to a null-termination character void char_iter_init(Iterator* char_iter, CharIterState* char_iter_state, const TextBoxParams* const text_box_params, utf8_t* start) { Iterator* utf8...
1256, 8, -16}, { 1264, 232, -208}, { 1512, 232, -192}, { 1576, 248, -392}, { 1144, 248, -320}, { 920, 120, -184}, // 32 seconds { 1064, 216, -104}, { 1192, 304, -16}, { 1216, 408, -96}, { 1136, 464, -104}, { 1504, 552, 0}, { 1032, 800, 64}, { 1184, 760, -224}, { 1...
{ 1008, 272, -136}, { 1016, 344, -16}, { 1120, 360, -80}, { 1032, 328, -112}, { 1336, 480, 16}, { 1416, 800, -24}, { 872, 928, -152}, { 1280, 504, -152}, { 1104, 472, -184}, { 1000, 488, -160}, { 1376, 624, 0}, { 1704, 520, 56}, { 1448, 320, 96}, { 1368, 64, 128},...
{ 1224, 72, 56}, { 1112, 48, 80}, { 1104, 120, 56}, { 1080, 176, -16}, { 952, 208, -8}, { 1104, 168, 24}, { 1096, 152, -112}, { 952, 144, -160}, { 1192, 56, -24}, { 1280, 152, -88}, { 1200, 192, -248}, { 1472, 176, -248}, { 1344, 208, -280}, { 1000, 224, -184}, ...
phics_line_draw_precise_stroked_aa(&ctx, START_ON_ORIGIN_RECT_XY, END_ON_ORIGIN_RECT_XY, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_x_origin_layer_aa.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 10); graphics_line_draw_pr...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 10)
; graphics_line_draw_precise_stroked_non_aa(&ctx, START_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_inside_offset_layer_non_aa.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 10); graphics_line_dra...
_ERROR, "Failed handling PPoGATT meta: len=%u ver=%x err=%x", (unsigned int) value_length, value_length ? value[0] : ~0, error); prv_delete_client(client, false /* is_disconnected */, DeleteReason_MetaDataInvalid); } // --------------------------------------------------------------------------------------...
(characteristic, BLESubscriptionNone, GAPLEClientKernel)
e "system/logging.h" #include <stdio.h> #define NUM_SNOOZE_MENU_ITEMS 5 typedef enum DetailMenuItemIndex { DetailMenuItemIndexEnable = 0, DetailMenuItemIndexDelete, DetailMenuItemIndexChangeTime, DetailMenuItemIndexChangeDays, #if CAPABILITY_HAS_HEALTH_TRACKING DetailMenuItemIndexConvertSmart, #endif Det...
{ ActionMenuLevel *level = task_malloc(sizeof(ActionMenuLevel) + DetailMenuItemIndexNum * sizeof(ActionMenuItem)); if (!level) return NULL; *level = (ActionMenuLevel) { .num_items = DetailMenuItemIndexNum, .parent_level = NULL, .display_mode = ActionMenuLevelDisplayModeWide, }; return level;...
static ActionMenuLevel *prv_create_snooze_menu(ActionMenuLevel *parent_level) { ActionMenuLevel *level = task_malloc(sizeof(ActionMenuLevel) + NUM_SNOOZE_MENU_ITEMS * sizeof(ActionMenuItem)); if (!level) return NULL; *level = (ActionMenuLevel) { .num_items = NUM_SNOOZE_MENU_ITEMS, .parent_level = ...
awn = 170; const AnimationHandlers handlers = { .started = prv_started_handler, .stopped = prv_stopped_handler }; prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); // Create the animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); anim...
animation_set_auto_destroy(a, auto_destroy)
; animation_schedule(a); Animation *b = prv_create_test_animation(); animation_set_implementation(b, &implementation); animation_set_duration(b, duration_a); animation_set_delay(b, delay_a); animation_set_auto_destroy(b, auto_destroy); animation_schedule(b); Animation *c = prv_create_test_animation();...
void prv_handle_connection_event(const PebbleBLEConnectionEvent *event) { PBL_LOG(LOG_LEVEL_DEBUG, "PEBBLE_BLE_CONNECTION_EVENT: reason=0x%x, conn=%u, bond=%u", event->hci_reason, event->connected, event->bonding_id); const bool connected = event->connected; // FIXME: When PPoGATT is supported add a ch...
{ prv_connect_gateway_bonding(gateway_bonding); }
e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClientKernel); cl_assert_equal_i(e, BTErrnoOK); fake_event_clear_last(); fake_kernel_malloc_mark(); // Un-subscribe, while subscribing process is still pending: e = gatt_clien...
(e, BTErrnoOK)
; cl_assert_equal_i(s_last_cccd_value, BLESubscriptionIndications); // Simulate getting confirmation from remote: prv_confirm_cccd_write(BLEGATTErrorSuccess); fake_event_clear_last(); // Subscribe app: e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, ...
iscovery_rediscover_all(&device), BTErrnoOK); // Assert the previous process has been stopped: cl_assert_equal_i(stop_count_before_rediscovery + 1, fake_gatt_is_service_discovery_stop_count()); // Expect "Database Changed" event: prv_assert_event(&device, BTErrnoServiceDiscoveryDatabaseChanged); // Put one...
(1, fake_gatt_is_service_discovery_stop_count())
; // Expect "Database Changed" event: prv_assert_event(&device, BTErrnoServiceDiscoveryDatabaseChanged); prv_simulate_and_assert_discovery_of_one_service(&device); // None of the batched up jobs should have run cl_assert_equal_i(2, fake_gatt_is_service_discovery_start_count()); // nothing should still b...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_manager_get_task_context()
->to_process_event_queue; } else if (task == PebbleTask_Worker) { event_queue = worker_manager_get_task_context()->to_process_event_queue; } else if (task == PebbleTask_KernelMain) { // The event service always runs from KernelMain event_queue = event_kernel_to_kernel_event_queue(); } else { WTF; ...
/* * 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...
(watchfaces_glance->subtitle, entry.name, watchfaces_subtitle_size)
; watchfaces_glance->subtitle[watchfaces_subtitle_size - 1] = '\0'; } } static const LauncherAppGlanceStructuredImpl s_watchfaces_structured_glance_impl = { .get_icon = prv_get_icon, .get_title = prv_get_title, .create_subtitle_node = prv_create_subtitle_node, .destructor = prv_destructor, }; LauncherAp...
32, 200, -912}, { 32, 184, -928}, { 32, 128, -920}, { 40, 176, -912}, { 48, 80, -912}, { 48, 136, -904}, { 48, 192, -952}, { 56, 112, -904}, { 48, 144, -928}, { 56, 120, -920}, { 48, 96, -920}, { 48, 128, -920}, { 56, 144, -920}, { 48, 152, -928}, { 32, 56, -912},...
{ 48, 272, -888}, // 107 seconds { 40, 256, -888}, { 40, 256, -888}, { 40, 256, -888}, { 48, 256, -888}, { 40, 248, -888}, { 48, 248, -888}, { 40, 232, -888}, { 40, 256, -896}, { 40, 248, -888}, { 40, 232, -896}, { 40, 240, -904}, { 40, 248, -896}, { 40, 232, ...
{ 88, 104, -928}, { 80, 136, -952}, { 72, 144, -952}, { 48, 120, -896}, { 56, 328, -928}, { 40, 160, -912}, // 110 seconds { 48, 120, -904}, { 32, 256, -912}, { 24, 208, -920}, { 32, 176, -904}, { 40, 216, -912}, { 32, 144, -912}, { 24, 144, -904}, { 40, 160,...
/* * 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...
(BOARD_CONFIG_POWER.battery_vmon_scale.denominator)
; return battery_convert_reading_to_millivolts(info, BOARD_CONFIG_POWER.battery_vmon_scale.numerator, BOARD_CONFIG_POWER.battery_vmon_scale.denominator); } bool battery_charge_controller_thinks_we_are_charging_impl(void) { ...
ation_get_duration(seq, true, true); cl_assert_equal_i(duration, duration_a + delay_a + duration_b + delay_b); // The position of seq should be the amount we already played of a, including the 'a' delay // since a is embedded within seq int32_t position; animation_get_elapsed(seq, &position); cl_assert_eq...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1); cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MAX); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1); #endif } // ----------------------------------------------------------------...
000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 0, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 0, -1000}, { 48, 8, -1008}, { 48, 8, -1000}, { 48, 0, -1000}, { 40, 0, -1000}, { 40, 8, -1000}, { 48, 0, -1000}, { 48, 8, -1008}, { 48, 8, -1000},...
{ 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 40, 8, -1000}, { 40, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 0, -1000}, { 40, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1008}, { 40, 8, -1000}, { 48, 8, -1000}, {...
{ 48, 8, -1000}, { 48, 0, -1000}, { 40, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 8, -1000}, { 48, 0, -1008}, { 48, 8, -1008}, { 48, 8, -1000}, ...
&GRect(x, y, w, h)); } x = left_margin_px; w = bounds->size.w - left_margin_px - right_margin_px; GTextAttributes *text_attributes = NULL; #if PBL_ROUND // Create a GTextAttributes for the TextLayer. Note that the matching // graphics_text_attributes_destroy() will not need to be called here, as the owne...
if (show_action_bar) { x = grect_get_max_x(bounds) - action_bar_width - content_and_action_bar_horizontal_spacing - icon_size.w; } else { x = (grect_get_max_x(bounds) - action_bar_width - icon_size.w) / 2; }
#endif y = icon_top_margin_px; if (dialog_init_icon_layer(dialog, icon, GPoint(x, y), false)) { layer_add_child(window_root_layer, &dialog->icon_layer.layer); } dialog_load(dialog); } static void prv_workout_dialog_appear(Window *window) { WorkoutDialog *workout_dialog = window_get_user_data(window);...
te; if (!prv_set_state(data, TimelineAppStateExit)) { return; } #if ANIMATION_SLIDE prv_launch_watchface(data); #elif ANIMATION_DOT const uint32_t duration = interpolate_moook_in_duration(); animation_unschedule(data->current_animation); layer_remove_child_layers((Layer *)&data->timeline_layer); An...
timeline_model_get_current_state()
tringFont_Gothic18, TestStringFont_Gothic24B, TestStringFont_Other, TestStringFontCount, }; // A very big number #define STRING_LENGTH_MAX 99999 typedef struct PerftestTextString { const char *string; size_t lengths[TestStringFontCount]; } PerftestTextString; static const PerftestTextString s_perftest_text...
text_layer_init_with_parameters(text_layer, &GRect(0, 0, DISP_COLS, DISP_ROWS), dialog->buffer, font, GColorBlack, GColorClear, TEXT_ALIGNMENT, TEXT_OVERFLOW)
; layer_add_child(&window->layer, &text_layer->layer); #if PBL_ROUND text_layer_enable_screen_text_flow_and_paging(text_layer, TEXT_FLOW_INSET_PX); #endif dialog_load(dialog); } static Dialog s_test_dialog; static void prv_display_modal(WindowStack *stack, const char *string) { Dialog *new_dialog = &s_test_d...
layer_set_update_proc(&layer, &across_x_layer_update_callback)
; layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_x_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.des...
/* * 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_p(text_node->overflow, overflow_mode)
void test_graphics_draw_text_flow__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); ctx = (GContext){}; // Setup resources fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(true /* write erase headers */); load_resource_fixture_in_...
(gbitmap_pbi_eq(s_dest_bitmap, "test_graphics_draw_text_flow__flow_no_paging.pbi"))
ic); uint8_t glance_out[glance_size]; // Trying to read the basic glance blob back with an invalid key length should fail const size_t invalid_key_length = 1337; cl_assert_equal_i(app_glance_db_read((uint8_t *)&APP_GLANCE_TEST_UUID, invalid_key_length, glance_out, glance_...
{ const size_t original_glance_size = sizeof(s_app_glance_with_too_many_slices); const size_t excess_slices_size = 11; const size_t trimmed_glance_size = original_glance_size - excess_slices_size; // Insert the glance blob with too many slices; this should succeed cl_assert_equal_i(app_glance_db_insert((uint...
static void prv_check_invalid_version_code_blob_not_inserted(uint8_t version) { const SerializedAppGlanceHeader app_glance = (SerializedAppGlanceHeader) { .version = version, }; cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, (uin...
settings_file_each(&file, prv_remove_matching_resource_file_callback, resource_list)
; settings_file_close(&file); mutex_unlock_recursive(s_app_cache_mutex); // resource_list now only contains filenames of resource files that don't have corresponding // entries in the app cache. We can safely delete these files. PFSFileListEntry *iter = *resource_list; while (iter) { PBL_LOG(LOG_LEVEL...
R_LINE_WIDTH stroke width line.origin.x = layer_bounds.origin.x + layer_bounds.size.w - REL_BAR_LINE_HORIZ_OFFSET; line.origin.y = second_icon_frame.origin.y - (REL_BAR_VERT_MARGIN + line_length) - prev_offset; line.size.w = REL_BAR_LINE_WIDTH; line.size.h = line_length - curr_offset; graphics_fill_rect(ctx, ...
(ctx, &notch)
; } #define REL_BAR_OVERLAP_STROKE_WIDTH 2 #define REL_BAR_OVERLAP_SIDE_MARGIN 2 #define REL_BAR_OVERLAP_NUDGE_X 1 #define REL_BAR_OVERLAP_LINE2_HORIZ_OFFSET ((2 * REL_BAR_OVERLAP_SIDE_MARGIN) + 1) static void prv_draw_rel_bar_overlap(TimelineLayer *timeline_layer, GContext* ctx, b...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ cl_assert(system_flash_erase(FLASH_BASE, 1024 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 7), erased_sector); cl_assert(flash_locked); }
ModalProperty_RenderRequested); // Disable all modals modal_manager_set_min_priority(ModalPriorityMax); modal_manager_event_loop_upkeep(); cl_assert_equal_i(modal_manager_get_properties(), ModalProperty_Transparent | ModalProperty_Unfocused); // Re-enable all modals modal_manager_se...
modal_manager_event_loop_upkeep()
b/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "clar.h" #include "util.h" #include <stdio.h> // Helper Functions //////////////////////////////////// #include "test_graphics.h" #include "${BIT_DEPTH_NAME}/test_framebuffer....
layer_set_update_proc(&layer, &across_nx_layer_update_callback)
success = false; prv_finished(data, success); } static void prv_show_peek_layer(ProgressWindow *data) { if (data->is_peek_layer_used) { Layer *root_layer = window_get_root_layer(&data->window); PeekLayer *peek_layer = &data->peek_layer; peek_layer_play(peek_layer); layer_add_child(root_layer, (Lay...
property_animation_get_animation(prop_anim)
; // If we failed, pause on the screen for a little. animation_set_delay(animation, delay); animation_set_duration(animation, SCROLL_OUT_MS); animation_set_curve(animation, AnimationCurveEaseOut); animation_set_handlers(animation, (AnimationHandlers) { .stopped = prv_animation_stopped_failure, }, data);...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return; }
menu_cell_basic_header_draw(ctx, cell_layer, title); } static void select_click(MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) { (void)menu_layer; SimpleMenuLayer *simple_menu = (SimpleMenuLayer*)callback_context; SimpleMenuLayerSelectCallback cb = simple_menu->sections[cell_index->sec...
ineNode *head = NULL; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 // check first timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check second ...
cl_assert_equal_i(pin_db_insert_item(&s_long_items[i]), 0)
; } } void test_timeline__long_middle_past(void) { prv_insert_long_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // initialize it to be 11 min after item cc has started timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, Ti...
eader_size); const size_t snapshot_size = jerry_parse_and_save_snapshot((const jerry_char_t *)script, strlen(script), true, /* is_for_global */ ...
rocky_event_loop_with_string_or_snapshot(source, strlen(source))
); cl_assert_equal_i(s_app_heap_analytics_log_stats_to_app_heartbeat_call_count, 1); } void test_js__jmem_heap_stats_largest_free_block_bytes(void) { jmem_heap_stats_t stats = {}; jmem_heap_get_stats(&stats); // Note: this might fail in the future if JerryScript would happen to cause fragmentation right // u...
State_Updated; rec_event = -1; recognizer_cancel(r); cl_assert_equal_i(r->state, RecognizerState_Cancelled); cl_assert_equal_b(cancelled, true); cl_assert_equal_i(rec_event, RecognizerEvent_Cancelled); } void test_recognizer__handle_touch_events(void) { RecognizerEvent rec_event = -1; TouchEvent last_tou...
{ RecognizerState new_state; bool updated = false; TouchEvent last_touch_event = { .type = TouchEvent_Liftoff }; s_test_impl_data.new_state = &new_state; s_test_impl_data.updated = &updated; s_test_impl_data.last_touch_event = &last_touch_event; bool allow = false; NEW_RECOGNIZER(r) = test_recognizer_c...
bool s_simultaneous = false; static bool prv_simultaneous_with_cb(const Recognizer *recognizer, const Recognizer *simultaneous_with) { return s_simultaneous; } void test_recognizer__set_simultaneous_with(void) { NEW_RECOGNIZER(r1) = test_recognizer_create(&s_test_impl_data, N...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return NULL; }
void ios_notif_pref_db_free_prefs(iOSNotifPrefs *prefs) { return; } void ancs_filtering_record_app(iOSNotifPrefs *app_notif_prefs, const ANCSAttribute *app_id, const ANCSAttribute *display_name, const ANCSAttribute *title)...
/* * 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...
memcpy(job->data, data, length)
; } return (SessionSendQueueJob *)job; } // Tests //////////////////////////////////////////////////////////////////////////////////////////////////// static const uint8_t TEST_DATA[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; void test_session_send_queue__initialize(void) { s_valid_session = &s_session; s_free...
ute_file_get_settings_key(k_newest_valid_utc) + 1, .oldest_valid_utc = k_oldest_valid_utc, .newest_valid_utc = k_newest_valid_utc, }; // Feed in the saved data, reading chunks out of the saved minute data and compressing // it into algorithm sleep minute structures. status_t status = settings_file_each...
PBL_LOG(LOG_LEVEL_WARNING, "Detected invalid minute data file, deleting it"); pfs_remove(ALG_MINUTE_DATA_FILE_NAME); } return 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...
(&s_kernel_heap, &_heap_start, &_heap_end, true)
; heap_set_lock_impl(&s_kernel_heap, (HeapLockImpl) { .lock_function = prv_heap_lock, .unlock_function = prv_heap_unlock }); } void analytics_external_collect_kernel_heap_stats(void) { uint32_t headroom = heap_get_minimum_headroom(&s_kernel_heap); // Reset the high water mark so we can see if there are...
m_session/session.h" #include "services/common/regular_timer.h" #include "services/common/system_task.h" #include "syscall/syscall.h" #include "system/logging.h" #include "os/mutex.h" #include "system/passert.h" #include "kernel/util/sleep.h" #include "util/string.h" #include <string.h> #include <stdlib.h> static boo...
dls_get_session_status(logging_session)
== DataLoggingStatusInactive); PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "de-logging session %"PRIu8", tag %"PRIu32 " (inactive %s tot_bytes %"PRIu32" empty %s)", logging_session->comm.session_id, logging_session->tag, bool_to_str(inactive), total_bytes, boo...
//// Num Descriptors 0x00, //// GATTCharacteristic 0x10, 0x00, 0x00, 0x01, 0x32, 0x8e, 0x0f, 0xbb, 0xc6, 0x42, 0x1a, 0xa6, 0x69, 0x9b, 0xda, 0xda, //// Offset EMULATED_DATA_CHAR_OFFSET, //// Properties 0x14, //// Num Descriptors 0x01, ////// Data descriptor 0x00, 0x00, 0x29, 0x02, 0x00, 0x00, 0...
if (!state->remote_did_subscribe) { return; // Gotta wait for remote to subscribe. }
if (!state->pending_response_data) { return; // Gotta wait for FW to subscribe / write the emulated CCCD. } PBL_LOG(LOG_LEVEL_ALWAYS, "Phone & Watch have hit CCCD, initiate PPoGatt WA!"); hc_protocol_enqueue_with_payload(HcEndpointID_Gatt, HcMessageID_Gatt_WriteCompleted, ...
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 "gatt_client_discovery.h" #include "gatt_service_changed.h" #include "gap_le_connection.h" #include "ble_l...
(connection)
!= BTErrnoOK) { // Handle the race: Bluetopia service discovery has stopped in the mean time, for example // because of a disconnection, internal error or it completed right when the timer fired. goto unlock; } if (connection->gatt_service_discovery_retries == GATT_CLIENT_DISCOVERY_MAX_RETRY...
enderDef; extern void app_message_outbox_handle_app_outbox_message_sent(AppOutboxStatus status, void *cb_ctx); #ifdef UNITTEST extern void test_app_outbox_sent_handler(AppOutboxStatus status, void *cb_ctx); #endif //! Constant array defining the allowed handlers and their restrictions: static const AppOutboxSenderDe...
list_count((ListNode *)consumer->head)
; } static AppOutboxConsumer *prv_find_consumer_with_message(const AppOutboxMessage *message) { AppOutboxMessage *head = (AppOutboxMessage *)list_get_head((ListNode *)message); for (AppOutboxServiceTag tag = 0; tag < NumAppOutboxServiceTag; ++tag) { if (s_app_outbox_consumer[tag].head == head) { return &...
/* * 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(is_complete == false)
; cl_assert(should_store == false); cl_assert(is_invalid == false); data = HDLC_FLAG; is_complete = hdlc_streaming_decode(&ctx, &data, &should_store, &is_invalid); cl_assert(is_complete == true); cl_assert(should_store == false); cl_assert(is_invalid == true); } void test_hdlc__decode_escaped_special(voi...
me, GColor color) { const GPoint line_outer_point = prv_steps_to_point(current_progress, total_progress, frame); #if PBL_RECT const GPoint line_inner_point = prv_inset_point(&frame, line_outer_point, line_length); #elif PBL_ROUND const GRect inner_bounds = grect_inset(frame, GEdgeInsets(line_length)); const GP...
( am_pm_buffer, am_pm_font, GColorWhite, container)
; } #if PBL_BW bounds.origin.y = screen_is_obstructed ? (has_bpm ? 13 : 23) : (has_bpm ? 36 : 53); #elif ROBERT_SCREEN_RES bounds.origin.y = screen_is_obstructed ? -12 : 6; #elif SNOWY_SCREEN_RES bounds.origin.y = screen_is_obstructed ? 4 : 47; #elif SPALDING_SCREEN_RES bounds.origin.y = 50; #endif graphi...
/* * 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_init(&window, "Timeline")
; TimelineLayer timeline_layer = {}; const TimelineScrollDirection scroll_direction = config->past ? TimelineScrollDirectionUp : TimelineScrollDirectionDown; timeline_layer_init(&timeline_layer, &window.layer.frame, scroll_direction); const GColor color = config->past ? TIMELINE_PAST_COLOR : TIMELINE_FUT...
(GAPLEConnection *) connection->node.next; prv_destroy_connection(connection); connection = next_connection; } s_connections = NULL; s_le_connection_module_initialized = false; } bt_unlock(); } // ------------------------------------------------------------------------------------...
if (connection) { connection->bonding_id = BT_BONDING_ID_INVALID; }
bt_unlock(); } void gap_le_connection_copy_device_name( const GAPLEConnection *connection, char *name_out, size_t name_out_len) { bt_lock(); { if (!gap_le_connection_is_valid(connection)) { goto unlock; } if (connection->device_name != NULL) { strncpy(name_out, connection->device_nam...
s_alg_state->dls_session = dls_create(DlsSystemTagActivityMinuteData, DATA_LOGGING_BYTE_ARRAY, sizeof(AlgMinuteDLSRecord), buffered, resume, &system_uuid); if (!s_alg_state->dls_session) { // This can happen when you are no...
PBL_ASSERTN(success)
; // See if we need to zero out steps in this record. We check that the start of the minute // is within the sleep bounds. The WITHIN macro returns true if the test value is // <= end_value, so we need to subract one minute from the end to see if the start of this // test minute is entirely within the ...
oint framebuffer_bottom_right_point = GPoint(grect_get_max_x(&s_ctx.dest_bitmap.bounds), grect_get_max_y(&s_ctx.dest_bitmap.bounds)); GPoint offset_point = gpoint_sub(framebuffer_bottom_right_point, GPoint(bitmap->bounds.size.w, bitmap->bounds.size.h)); of...
GPoint(-25, 0)
); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__offset_bitmap_layer_across_y(void) { prv_offset_bitmap_layer_test(GPoint(0, 75)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__offset_bitmap_layer_across_ny(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...
memset(&s_vars, 0, sizeof(s_vars))
Y, ORIGIN_RECT_CLIP_NXNY, true, 3); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BI...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 2)
eway = true, }; if (!shared_prf_storage_get_ble_pairing_data(&bonding.pairing_info, NULL, NULL, NULL)) { return; } bt_driver_handle_host_removed_bonding(&bonding); } void bt_persistent_storage_delete_ble_pairing_by_id(BTBondingID bonding) { prv_remove_ble_bonding_from_bt_driver(); shared_prf_storage_er...
prv_call_bt_classic_bonding_change_handlers(bonding, BtPersistBondingOpWillDelete)
; bt_pairability_update_due_to_bonding_change(); } void bt_persistent_storage_delete_bt_classic_pairing_by_addr(const BTDeviceAddress *bd_addr) { if (!bd_addr) { return; } bt_persistent_storage_delete_bt_classic_pairing_by_id(BT_CLASSIC_BONDING_ID); } bool bt_persistent_storage_get_bt_classic_pairing_by_...
{ -456, 400, -176}, { -664, 296, 48}, { -776, 152, -368}, { -1216, -72, 96}, { -1440, 400, -288}, { -1264, 96, -32}, // 83 seconds { -1600, 120, -112}, { -576, -40, -152}, { -760, 328, -280}, { -912, 104, -176}, { -512, 248, -72}, { -296, 304, -112}, { -344, 472, -12...
{ -320, 136, -400}, { -408, 216, -520}, { -824, -40, -464}, { -1120, 16, -368}, { -792, -512, -624}, { -1088, 1112, -840}, { -920, -328, -40}, { -1576, 768, -640}, { -1568, 0, -16}, { -1264, 144, -32}, { -960, 128, -184}, { -680, -40, 40}, { -448, 80, -8}, { -440,...
{ -976, 424, -320}, { -1080, 568, -224}, { -1288, 472, -128}, { -1208, 72, 16}, { -1408, 24, 16}, { -1096, 56, -160}, // 91 seconds { -1024, 128, -208}, { -1024, 88, -168}, { -736, 72, -160}, { -456, 16, -168}, { -464, 96, -176}, { -608, 184, -200}, { -776, 312, ...
/* * 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 (PASSED(open_status)) { settings_file_get(&settings_file, &app_uuid, sizeof(app_uuid), &cached_capabilities, sizeof(cached_capabilities)); }
uint64_t new_capabilities = cached_capabilities; if (app_session) { // Connected, grab fresh capabilities data: new_capabilities = comm_session_get_capabilities(app_session); if (FAILED(open_status)) { // File open failed, return live data without saving to cache goto done; } if ...
}, // 780: Local time: 2015-11-15 09:40:00 AM { 0, 0x46, 20, 199, 0}, { 0, 0x46, 6, 198, 0}, { 0, 0x46, 24, 198, 0}, { 0, 0x46, 358, 199, 0}, { 0, 0x46, 505, 197, 0}, { 0, 0x46, 5, 196, 0}, { 0, 0x46, 0, 196, 0}, { 0, 0x47, 339, 199, 0}, { 0, 0x56, 2127, 202, 0}, { 0, 0x56, 7...
{ 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, // 885: Local time: 2015-11-15 11:25:00 AM { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, { 0, 0x48, 0, 143, 0}, ...
when: // - We reach the end of our maximum time on, ACTIVITY_DEFAULT_HR_ON_TIME_SEC // - We get ACTIVITY_MIN_NUM_SAMPLES_SHORT_CIRCUIT samples before the time runs out // - e.g. We get X samples >= ACTIVITY_MIN_HR_QUALITY_THRESH in our current minute, // go ahead and turn off the sensor co...
if (valid_hr_reading || hrm_event->bpm.quality == HRMQuality_OffWrist) { mutex_lock_recursive(s_activity_state.mutex); { // Post a health service heart rate changed event PebbleEvent event = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = Heal...
// Modify our sampling period now if necessary // NOTE: Must be kept at the bottom of the function, or at least below // `activity_metrics_prv_add_median_hr_sample` prv_heart_rate_subscription_update(now_uptime_ts); } #endif // CAPABILITY_HAS_BUILTIN_HRM } // ------------------------------------...
/* * 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...
{ char title[BUFFER_SIZE]; sniprintf(title, BUFFER_SIZE, "Section Header (%i)", section_index); menu_cell_basic_header_draw(ctx, cell_layer, title); (void)data; }
static void detail_window_load(Window *window) { AppData *data = window_get_user_data(window); TextLayer *text_layer = &data->detail_text; text_layer_init(text_layer, &window->layer.bounds); text_layer_set_text(text_layer, data->detail_text_buffer); layer_add_child(&window->layer, &text_layer->layer); } st...
/* * 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_glance_service_get_current_slice(NULL, &slice_out)
, false); // Requesting the current slice with an invalid UUID should return false cl_assert_equal_b(app_glance_service_get_current_slice(&UUID_INVALID, &slice_out), false); // Requesting the current slice with a NULL slice_out argument should return false cl_assert_equal_b(app_glance_service_get_current_slic...
bool, sys_activity_get_step_averages, DayInWeek day_of_week, ActivityMetricAverages *averages) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(averages, sizeof(*averages)); } return activity_get_step_averages(day_of_week, averages); } // ---------------------------------------...
(LOG_LEVEL_ERROR, "not in test mode")
; return false; } PBL_ASSERT(s_activity_state.started, "not started"); while (num_samples) { while (s_activity_state.pending_test_cb) { sys_psleep(1); // Wait for kernelBG to process prior data } uint32_t chunk_size = MIN(ACTIVITY_ALGORITHM_MAX_SAMPLES, num_samples); // Alloc...
rv_calculate_time_range( time_util_get_midnight_of(now - SECONDS_PER_DAY), time_util_get_midnight_of(now), &range); cl_assert(result); cl_assert_equal_range(range, ((HealthServiceTimeRange){ .last_day_idx = 1, .num_days = 1, .seconds_first_day = 86400, .seconds_last_day = 86400, .seconds_tot...
health_service_sum(HealthMetricStepCount, time_util_get_midnight_of(now), now)
ime_buf); // June 9th 2015, 14:00:00 (T-02:00:00) rtc_set_time(event_time - (2 * SECONDS_PER_HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("In 2 hours", time_buf); // June 9th 2015, 15:59:00 (T-00:01:00) rtc_set_time(event_time - (1 * SECONDS_PER...
(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
fset_even_rows_no_clip"))); // Odd rows of different lengths setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 1), MAX_NUM_COLS); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 3), MAX_NUM_COLS + 4); graphics_draw_horizontal_lin...
GPoint(1, 0)
, MAX_NUM_ROWS); graphics_draw_vertical_line_dotted(&ctx, GPoint(3, 0), MAX_NUM_ROWS + 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(5, 0), 0); graphics_draw_vertical_line_dotted(&ctx, GPoint(7, 0), 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(9, 0), 2); graphics_draw_vertical_line_dotted(&ctx, G...
DIV_X(frame.size.h * MULT_X((cur - limit_b), (limit_c - limit_b)))); } else if (cur <= limit_d) { // zone c - d return GPoint(frame.origin.x + DIV_X(frame.size.w * (1000 - MULT_X((cur - limit_c), (limit_d - limit_c)))), frame.origin.y + frame.size...
graphics_context_set_stroke_color(ctx, color)
; gpath_draw_outline(ctx, &path); #else graphics_context_set_stroke_color(ctx, GColorWhite); GRect inner_bounds = grect_inset(outer_bounds, GEdgeInsets(fill_thickness)); graphics_draw_rect(ctx, &inner_bounds); inner_bounds = grect_inset(inner_bounds, GEdgeInsets(-1)); graphics_draw_rect(ctx, &inner_bounds);...
/* * 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...
is_app_file_name(filename)
&& !strcmp(filename + APP_FILE_NAME_PREFIX_LENGTH, APP_RESOURCES_FILENAME_SUFFIX); } //! Parses an app-file name to get the AppInstallId. //! Assumes the file is indeed an app-file AppInstallId app_file_parse_app_id(const char *filename) { return (AppInstallId)strtol(filename + 1, NULL, 16); // + 1 to skip...
er_get_properties(), ModalProperty_Exists | ModalProperty_CompositorTransitions | ModalProperty_RenderRequested); cl_assert_equal_i(windows[2][0]->on_screen, true); cl_assert_equal_i(windows[2][0]->is_click_configured, true); cl_assert_equal_p(s_last_click_configured_window...
(windows[2][1]->is_click_configured, false)
; cl_assert_equal_i(windows[1][0]->on_screen, true); cl_assert_equal_i(windows[1][0]->is_click_configured, false); cl_assert_equal_p(s_last_click_configured_window, windows[3][1]); for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) { for (int i = 0; i < num_windows_per_stack; i++) ...
Attribute *attr) { switch (prv_attribute_type(attr->id)) { case AttributeTypeString: return strlen(attr->cstring) + 1; // +1 for null char case AttributeTypeStringList: return sizeof(StringList) + attr->string_list->serialized_byte_length + 1; // +1 for null char case AttributeTypeUint32List:...
(list, id)
->uint32 = resource_id; } void attribute_list_add_uint8(AttributeList *list, AttributeId id, uint8_t uint8) { if (prv_attribute_type(id) != AttributeTypeUint8) { PBL_LOG(LOG_LEVEL_WARNING, "Adding attribute with type uint8 for non-uint8_t attribute"); } prv_add_attribute(list, id)->uint8 = uint8; } void att...
h" #include "resource/resource_ids.auto.h" #include "font_resource_keys.auto.h" #include "applib/fonts/fonts_private.h" #include "applib/graphics/text_resources.h" #include "util/math.h" #include "util/size.h" #include <string.h> #include "clar_asserts.h" typedef struct { const char *key; uint32_t handle; Fon...
{ return prv_get_font(font_key); }
uint8_t fonts_get_font_height(GFont font) { return font->max_height; } int16_t fonts_get_font_cap_offset(GFont font) { if (!font) { return 0; } // FIXME PBL-25709: Actually use font-specific caps and also provide function for baseline offsets return (int16_t)(((int16_t)font->max_height) * 22 / 100); }...
r.h" #include "stubs_battery_state_service.h" #include "stubs_bluetooth_ctl.h" #include "stubs_bootbits.h" #include "stubs_click.h" #include "stubs_clock.h" #include "stubs_do_not_disturb.h" #include "stubs_events.h" #include "stubs_event_service_client.h" #include "stubs_health_util.h" #include "stubs_i18n.h" #include...
(&launcher_menu_layer, selected_index, row_align, animated)
t dist = serial_distance32(0x0, 0x1); cl_assert_equal_i(dist, 1); } { int32_t dist = serial_distance32(0x1, 0x0); cl_assert_equal_i(dist, -1); } { int32_t dist = serial_distance32(0x0, 0xffffffff); cl_assert_equal_i(dist, -1); } { int32_t dist = serial_distance32(0xffffffff, 0x0);...
gcd(10, 10)
); }
(APP_LOG_LEVEL_DEBUG, "Error with \"H\": %s", buf)
; } r = strftime(buf, buf_size, "%I", &good_data); if (r == 0 || strncmp(buf, "11", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"I\": %s", buf); } r = strftime(buf, buf_size, "%j", &good_data); if (r == 0 || strncmp(buf, "125", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&buffer, (uint8_t*) "123", 3, false)
); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 5); cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "456", 3, false)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 2); cl_assert(!shared_circular_buffer_write(&buffer, (uint8_t*) "789", 3,...
const GRect window_bounds = s_phone_ui_data->window.layer.bounds; GRect offscreen = GRect(window_bounds.size.w, 0, PBL_IF_RECT_ELSE(ACTION_BAR_WIDTH, 0), window_bounds.size.h); Animation *action_bar_animation = property_animation_get_animation( property_animation_create_layer_frame(...
{ return false; }
// Add attributes to the timeline item for contact lookup AttributeList attributes = {}; attribute_list_add_cstring(&attributes, AttributeIdSender, number); attribute_list_add_cstring(&attributes, AttributeIdiOSAppIdentifier, app_id); TimelineItem *item = timeline_item_create_with_attributes(0, 0, Timelin...
/* * 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...
(false /* should_shutdown */)
; break; default: PBL_LOG(LOG_LEVEL_ERROR, "Invalid reset msg, data[0] %u", data[0]); break; } } void fw_prepare_for_reset(bool unsafe_reset) { if (!unsafe_reset) { // Tear down Bluetooth, to avoid confusing the phone: services_set_runlevel(RunLevel_BareMinimum); #if PULSE_EVERYWHERE...
ng, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/graphics/gbitmap_png.h" #include "...
TEST_PNG_FILE_FMT(4bitpalette)
); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(4bitpalette))); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat4BitPalette); } // Tests 8-bit transparent palettized PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__color_8_bit_transparent(void) { GBit...
i = 0; i<count; ++i) { stub_new_timer_fire(timer_id); fake_system_task_callbacks_invoke_pending(); } } static bool standby_timer_is_scheduled() { TimerID timer_id = battery_monitor_get_standby_timer_id(); return timer_id != TIMER_INVALID_ID && stub_new_timer_is_scheduled(timer_id); } static uint32_t st...
battery_get_charge_state()
.charge_percent, low_percent); } void test_battery_monitor__connection_reset(void) { // Test for PBL-19951: Reset charge percent on reconnection events int percent = 10; int charge_mv = battery_curve_lookup_voltage_by_percent(percent, true); int discharge_mv = battery_curve_lookup_voltage_by_percent(percent, f...
/* * 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...
launcher_menu_layer_init(launcher_menu_layer, data_source)
; launcher_menu_layer_set_click_config_onto_window(launcher_menu_layer, window); layer_add_child(window_root_layer, launcher_menu_layer_get_layer(launcher_menu_layer)); // If we have a saved launcher selection state, restore it if (s_launcher_app_persisted_data.valid) { launcher_menu_layer_set_selection_st...
mm; const int k_mm_per_cm = 10; m_rec->distance_cm = ROUND(minute_distance_mm, k_mm_per_cm); // Fill in heart rate, heart rate sample weight, then reset it int32_t median, heart_rate_total_weight_x100; activity_metrics_prv_get_median_hr_bpm(&median, &heart_rate_total_weight_x100); m_rec->heart_rate_bpm = (...
(s_alg_state->k_state, enable)
ory and load the app into it. size_t app_segment_size = prv_get_app_segment_size(app_md); // The stack guard is counted as part of the app segment size... const size_t stack_guard_size = prv_get_stack_guard_size(); // ...and is carved out of the stack. const size_t stack_size = prv_get_app_stack_size(app_md) ...
app_state_get_heap()
; PBL_LOG(LOG_LEVEL_DEBUG, "App heap init %p %p", app_segment.start, app_segment.end); heap_init(app_heap, app_segment.start, app_segment.end, enable_heap_fuzzing); heap_set_lock_impl(app_heap, (HeapLockImpl) { .lock_function = prv_heap_lock, }); process_heap_set_exception_handlers(app_heap, a...
_get_ms_since_system_start(); animation->abs_start_time_ms = now + animation->delay_ms; if (animation->implementation->setup != NULL) { animation->implementation->setup(animation); } const bool old_head_is_animating = animation_legacy2_scheduler->head ? (((AnimationLegacy2 *)animation_legacy2_sched...
{ // AnimationLegacy2s are ordered by abs_start_time_ms. // We've reached an animation that should not start yet, so // everything after and including this animation shouldn't run yet. break; }
// Get a pointer to next now, because after unscheduling this animation won't have a next. AnimationLegacy2 *next = (AnimationLegacy2*) list_get_next(&animation->list_node); if (animation->is_completed) { // Unschedule + call animation.stopped callback: const bool finished = true; anima...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(mfg_info_get_rtc_freq(), 1337)
; } void test_spalding_mfg_info__model(void) { // Intentionally make the buffer too long so we can check for truncation. char buffer[MFG_INFO_MODEL_STRING_LENGTH + 1] = { 0 }; mfg_info_get_model(buffer); cl_assert_equal_s(buffer, ""); mfg_info_set_model("test_model"); mfg_info_get_model(buffer); ...
/* * 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_destroy(window)
; } int main(void) { init(); app_event_loop(); deinit(); }
layer_destroy(base_layer)
; } GColor health_sleep_summary_card_get_bg_color(Layer *layer) { return CARD_BACKGROUND_COLOR; } bool health_sleep_summary_show_select_indicator(Layer *layer) { HealthSleepSummaryCardData *health_sleep_summary_card_data = layer_get_data(layer); return prv_has_sleep_data(health_sleep_summary_card_data->health_d...
est_gap_le_connect__single_client_no_autoreconnect(void) { BTDeviceInternal device = prv_dummy_device(1); // Register connection intent for app: gap_le_connect_connect(&device, false /* no auto_reconnect */, false /* is_pairing_required */, ...
(&device, true /* is_master */)
; // Verify the app task got a (virtual) disconnection event: prv_assert_client_event(&device, false /* connected */, (1 << PebbleTask_App), GAPLEConnectHCIReasonExtensionCancelConnect); // Verify there are no more intents: cl_assert_equal_i(gap_le_connect_connection_intents_count(), ...
id) { const int k_num_records = 2; const int num_minutes = k_num_records * ALG_MINUTES_PER_DLS_RECORD; // The test data AlgMinuteDLSSample minute_data[num_minutes]; prv_create_test_data(num_minutes, minute_data); // Call the minute handler, which computes the minute stats and saves them to data logging ...
for (int i = 0; i < max_minutes; i++) { fake_rtc_increment_time(SECONDS_PER_MINUTE); s_alg_next_steps = 0x1234; AccelRawData samples[100] = { }; uint64_t timestamp = 0; activity_algorithm_handle_accel(samples, s_sample_rate, timestamp); s_alg_next_vmc = 0x11; s_alg_next_orientation = 0x22; ...
// Get the size of the sleep data and make sure it is within the expected range uint32_t num_records; uint32_t data_bytes; uint32_t minutes; bool success = activity_algorithm_minute_file_info(false /*compact_first*/, &num_records, &data_bytes, &minutes); ...
/* * 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_initialized) { return; } periph_config_acquire_lock(); if (BOARD_CONFIG_VIBE.options & ActuatorOptions_Ctl) { gpio_output_init(&BOARD_CONFIG_VIBE.ctl, GPIO_OType_PP, GPIO_Speed_2MHz); gpio_output_set(&BOARD_CONFIG_VIBE.ctl, false); s_initialized = true; } if (BOARD_CONFIG_VIBE.opt...
ut(); } void accessory_block(void) { prv_lock(); accessory_send_stream_stop(); uart_deinit(ACCESSORY_UART); } void accessory_unblock(void) { // We want to restore the previous baudrate, but clear s_baudrate in order to force a complete // re-init of the peripheral. prv_set_baudrate(s_baudrate, true /* for...
{ // wait for the TC flag to be set uart_wait_for_tx_complete(ACCESSORY_UART); // wait a little for the lines to settle down const uint32_t us_to_wait = (1000000 / s_baudrate) * 2; delay_us(us_to_wait); s_sent_data = false; }
// Read data and throw it away to clear the state. We don't want to handle data we received // while input was disabled uart_read_byte(ACCESSORY_UART); s_input_enabled = true; prv_unlock(); } void accessory_use_dma(bool use_dma) { prv_lock(); s_use_dma = use_dma; if (s_use_dma) { prv_enable_dma(...
_initialize_exti(void) { s_stop_mode_monitor.timer = new_timer_create(); gpio_input_init(&BOARD_CONFIG_ACCESSORY.int_gpio); exti_configure_pin(BOARD_CONFIG_ACCESSORY.exti, ExtiTrigger_Falling, prv_exti_cb); exti_enable(BOARD_CONFIG_ACCESSORY.exti); } static void prv_initialize_uart(uint32_t baudrate) { #if RE...
if (UNLIKELY(temporarily_disabled)) { accessory_disable_input(); }
/* * 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(parent.first_child == &child_a)
; layer_add_child(&parent, &child_b); cl_assert(parent.first_child == &child_a); cl_assert(child_a.next_sibling == &child_b); cl_assert(child_a.parent == &parent); cl_assert(child_b.parent == &parent); layer_add_child(&parent, &child_c); cl_assert(child_c.parent == &parent); cl_assert(child_b.next_sibli...
/* * 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...
{ Uuid uuid = {0, 1, 2, 3}; const char *key = "workerId"; int key_len = strlen(key); cl_assert_equal_i(prefs_db_insert((uint8_t *)key, key_len, (uint8_t *)&uuid, sizeof(uuid)), 0); cl_assert_equal_i(prefs_db_get_len((uint8_t *)key, key_len), sizeof(uuid)); }
void test_prefs_db__insert_and_read(void) { uint32_t set_value = 42; // NOTE: We intentionally put one garbage character after the key to catch errors // that assume the key is 0 terminated const char *key = "lightTimeoutMsX"; int key_len = strlen(key) - 1; // Set initial value backlight_set_timeout_...
prv_process_sent_data(); // No app_message callbacks are expected to be called, as we closed the context cl_assert_equal_i(s_out_sent_call_count, 0); cl_assert_equal_b(s_nack_sent_is_called, false); cl_assert_equal_i(s_out_failed_call_count, 0); cl_assert_equal_b(app_message_is_closed_outbound(), true); } ...
app_message_outbox_begin(&iterator)
, APP_MSG_OK); cl_assert_equal_i(app_message_outbox_begin(&iterator), APP_MSG_INVALID_STATE); } void test_app_message__begin_null_iterator(void) { cl_assert_equal_i(app_message_outbox_begin(NULL), APP_MSG_INVALID_ARGS); } void test_app_message__send_while_not_begun(void) { cl_assert_equal_i(app_message_outbox_s...
action_analytics(voice_data->context, &item); ActionResultData *action_result = prv_invoke_remote_action(voice_data->action_menu, voice_data->action_data, voice_data->context, ...
voice_window_create(NULL, 0, VoiceEndpointSessionTypeDictation)
, }; PBL_ASSERTN(data->voice_window); data->event_service_info = (EventServiceInfo) { .type = PEBBLE_DICTATION_EVENT, .handler = prv_handle_voice_transcription_result, .context = data, }; event_service_client_subscribe(&data->event_service_info); voice_window_transcription_dialog_keep_alive_on...
/* * 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 false; }
*data_out = &buffer->buffer[buffer->read_index]; const uint16_t remaining_length = buffer->buffer_size - buffer->read_index; *length_out = MIN(remaining_length, length); return true; } uint16_t circular_buffer_copy(const CircularBuffer* buffer, void *data_out, ...
&mgr->recognizers[button_id].config; cfg->multi_click.min = (min_clicks == 0) ? 2 : min_clicks; cfg->multi_click.max = (max_clicks == 0) ? min_clicks : max_clicks; cfg->multi_click.timeout = (timeout == 0) ? 300 : timeout; cfg->multi_click.last_click_only = last_click_only; cfg->multi_click.handler = handler...
{ window->is_render_scheduled = false; window->is_waiting_for_click_config = false; window->is_click_configured = false; }
if (call_window_appear_handlers) { if (window->on_screen) { prv_window_load(window); // In our load handler, we may unload ourselves; this is perfectly fine! However, // if we do that, we never appear on the screen! In that case, window->on_screen // may have changed between the time w...
ty_insights.h" #include "activity_private.h" // ------------------------------------------------------------------------------------ // Figure out the cutoff times for sleep and step activities for today given the current time static void prv_get_earliest_end_times_utc(time_t utc_sec, time_t *sleep_earliest_end_utc, ...
(LOG_LEVEL_WARNING, "Invalid duration: %"PRIu16" ", session->length_min)
; return false; } // The flags must be valid if (session->reserved != 0) { PBL_LOG(LOG_LEVEL_WARNING, "Invalid flags: %d", (int)session->reserved); return false; } return true; } // ------------------------------------------------------------------------------------ // Return true if two activ...
/* * 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...
(info->interlock)
; } void command_window_stack_info(void) { struct WindowStackInfoContext info = { .interlock = xSemaphoreCreateBinary(), }; if (!info.interlock) { prompt_send_response("Couldn't allocate semaphore for window stack"); return; } // FIXME: Dumping the app window stack from another task without a /...
d_result); prv_read_register(PmicRegisters_INT_STATUS_2, &throwaway_read_result); } static void prv_pmic_state_change_cb(void *null) { prv_clear_pending_interrupts(); new_timer_start(s_debounce_charger_timer, CHARGER_DEBOUNCE_MS, prv_handle_charge_state_change, NULL, 0 /*flags*/); } static voi...
(PmicRegisters_SD1_VOLTAGE, &sd1_vsel)
) { const uint8_t sd1_vsel_mask = 0x3f; // sd1_vsel is in first 6 bits sd1_vsel &= ~sd1_vsel_mask; // V_SD1 = 1.4V + (sd1_vsel - 0x40) * 25mV = 1.4V + (0x51 - 0x40) * 25mV = 1.825V sd1_vsel |= (0x51 & sd1_vsel_mask); prv_write_register(PmicRegisters_SD1_VOLTAGE, sd1_vsel); } } static uint8_t s_la...
ist_count() > 1)); const bool has_quiet_time_action = true; // Always true const bool has_ancs_mute_action = prv_has_mute_action(item); uint8_t num_local_actions = 0; num_local_actions += (has_snooze_action) ? 1 : 0; num_local_actions += (has_dismiss_all_action) ? 1 : 0; num_local_actions += (has_quiet_tim...
ios_notif_pref_db_free_prefs(notif_prefs)
; } if (has_dismiss_all_action) { action_menu_level_add_action(root_level, i18n_get("Dismiss All", root_level), prv_dismiss_all_action_cb, window_data); } if (has_quiet_time_action) { action_menu_level_ad...
o_request->endpoint_id; response->command_id = to_request->command_id; response->transaction_id.is_response = true; response->transaction_id.sn = to_request->transaction_id.sn; if (response_payload_length) { memcpy(response->payload, response_payload, response_payload_length); } bool rv = prv_enqueue(re...
prv_update_hc_state(HcProtoclStateIsInitialized)
/* * 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 (out_metadata == NULL) { return false; }
FirmwareDescription firmware_description = firmware_storage_read_firmware_description(flash_address); if (!firmware_storage_check_valid_firmware_description(&firmware_description)) { memset(out_metadata, 0, sizeof(FirmwareMetadata)); return false; } // The FirmwareMetadata is stored at the end of the ...
PreemptionPriority = 0x0f; nvic_config.NVIC_IRQChannelSubPriority = 0x00; nvic_config.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&nvic_config); DMA_ITConfig(FLASH_DMA_STREAM, DMA_IT_TC, ENABLE); // enable the DMA stream to start the transfer SPI_I2S_DMACmd(FLASH_SPI, SPI_I2S_DMAReq_Tx | SPI_I2S_DMAReq_Rx, ENA...
flash_write_enable()
; flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_PAGE_PROGRAM); flash_send_24b_address(start_addr); while (buffer_size--) { flash_send_and_receive_byte(*buffer); buffer++; } flash_end_cmd(); flash_wait_for_write(); prv_check_protection_flag(); } // Public interface // From here o...