prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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...
system_reset_prepare(reason == RebootReasonCode_DialogBootFault)
; #if PLATFORM_SILK && RECOVERY_FW // For Silk PRF & MFG firmwares, fully shutdown the watch using the bootloader. // Always entering full shutdown in these two situations will guarantee a much // better shelf-life, and ensure that watches are shipped in full shutdown mode. // // Request the bootloader to co...
GSize mask_size = ctx->dest_bitmap.bounds.size; for (int16_t x = 0; x < mask_size.w; x++) { const uint8_t mask_pixel_value = (uint8_t)((x % hline_applying_test_column_width) / num_pixels_per_mask_value); for (int16_t y = 0; y < mask_size.h; y++) { test_...
{ GContext *ctx = s_ctx; prv_prepare_canvas_for_vline_applying_test(ctx); graphics_context_set_antialiased(ctx, true); GDrawMask *mask = prv_create_mask_for_vline_applying_test(ctx); cl_assert(graphics_context_mask_use(ctx, mask)); for (int16_t x = 0; x < num_src_colors; x++) { GColor src_color = (...
e_ad_copy_local_name(s_ad_data, local_name, 6); cl_assert_equal_s(local_name, "Light"); cl_assert_equal_i(size, strlen("Light") + 1); // Test ble_ad_includes_service: Uuid included_uuid = bt_uuid_expand_16bit(0x7b29); cl_assert(ble_ad_includes_service(s_ad_data, &included_uuid)); Uuid missing_uuid = bt_uui...
bt_uuid_expand_32bit(0x12346700 + i)
t_cache, WILDCARD_CODEPOINT, &s_font_info); cl_assert(horiz_advance != 0); cl_assert_equal_i(horiz_advance, text_resources_get_glyph_horiz_advance(&s_font_cache, WILDCARD_CODEPOINT, &s_font_info)); const GlyphData *glyph = text_resources_get_g...
text_resources_get_glyph(&s_font_cache, PHONE_CODEPOINT, &s_font_info)
; cl_assert(glyph != NULL); glyph_size_bytes = glyph_get_size_bytes(glyph); cl_assert_equal_m(phone_bytes, glyph->data, glyph_size_bytes); } void DISABLED_test_text_resources__test_emoji_fallback(void) { const uint8_t phone_bytes[] = {0xfe, 0x81, 0x81, 0x3c, 0x66, 0x42, 0xc3, 0xe7, 0xff, 0x00, 0x00, 0x00}; ...
orityMax); modal_manager_event_loop_upkeep(); cl_assert_equal_i(modal_manager_get_properties(), ModalProperty_Transparent | ModalProperty_Unfocused); // Re-enable all modals modal_manager_set_min_priority(ModalPriorityMin); modal_manager_event_loop_upkeep(); cl_assert_equal_i(modal_ma...
(s_app_idle, false)
; // Assert that the window pushed onto the app stack has regained focus, // this is also done by checking the last event. event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT); cl_assert_equal_i(event.app_focus.in_focus, true); cl_assert_equal_i(window1->on_scr...
/* * 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 (shared_prf_storage_get_ble_pinned_address(&addr)) { prompt_send_response_fmt(buf, DISPLAY_BUF_LEN, "\nPinned address: "BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE_PTR(&addr)); }
SM128BitKey link_key; uint8_t platform_bits; if (bt_driver_supports_bt_classic()) { if (shared_prf_storage_get_bt_classic_pairing_data(&addr, &name[0], &link_key, &platform_bits)) { bluetooth_persistent_storage_debug_dump_classic_pairing_info( ...
. */ #include "recovery_first_use_app.h" #include "getting_started_button_combo.h" #include "apps/core_apps/spinner_ui_window.h" #include "applib/fonts/fonts.h" #include "comm/ble/gap_le_connection.h" #include "comm/ble/gap_le_device_name.h" #include "comm/ble/gap_le_connect.h" #include "drivers/backlight.h" #inclu...
getting_started_button_combo_button_pressed(&data->button_combo_state, click_recognizer_get_button_id(recognizer))
; } static void prv_raw_up_handler(ClickRecognizerRef recognizer, void *context) { RecoveryFUAppData *data = app_state_get_user_data(); getting_started_button_combo_button_released(&data->button_combo_state, click_recognizer_get_button_id(recognizer)); } static void...
ta * stored before the starting address within the page. * */ static void flash_write_page(const uint8_t* buffer, uint32_t start_addr, uint16_t buffer_size) { // Ensure that we're not trying to write more data than a single page (256 bytes) PBL_ASSERTN(buffer_size <= FLASH_PAGE_SIZE); PBL_ASSERTN(buffer_size);...
MIN(buffer_size, first_page_available_bytes)
...", status, name); pfs_close_and_remove(fd); return prv_open(file, name, flags, max_used_space); } // There's a chance that the caller increased the desired size of the settings file since // the file was originally created (i.e. the file was created in an earlier version of the // firmware). If we d...
{ file->used_space += record_size(&file->iter.hdr); }
if (total_size == 0) { // a file of size zero is valid at the moment return true; }
int fd = pfs_open(info->filename, OP_FLAG_READ | OP_FLAG_WRITE, FILE_TYPE_STATIC, total_size); storage->impl_data = (void*)(uintptr_t) fd; return fd >= 0; } uint32_t pb_storage_file_get_max_size(PutBytesObjectType object_type) { return get_available_pfs_space(); } void pb_storage_file_write(PutBytesStorage...
/* * 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...
htonl(time_seconds)
; msg->log_level = log_level; msg->line_number = htons(src_line_number & 0xffff); msg->message_length = 0; // Ensure we only send the last 15 characters of a filename const char* filename = GET_FILE_NAME(src_filename_path); int filename_length = strlen(filename); if (filename_length > 15) { // If we...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
analytics_storage_give_lock()
; } void analytics_set_for_uuid(AnalyticsMetric metric, int64_t value, const Uuid *uuid) { analytics_storage_take_lock(); AnalyticsHeartbeat *heartbeat = analytics_storage_find(metric, uuid, AnalyticsClient_Ignore); if (heartbeat) { // We allow only a limited number of app heartbeats to accumulate. A NULL m...
IDR_LINESIZE_Msk) >> SCB_CCSIDR_LINESIZE_Pos) #define CCSIDR_WAYS(x) (((x) & SCB_CCSIDR_ASSOCIATIVITY_Msk) >> SCB_CCSIDR_ASSOCIATIVITY_Pos) #define CSSELR_L1_DCACHE 0 #define CSSELR_L1_ICACHE 1 #if __ICACHE_PRESENT static uint32_t s_icache_cssidr; #endif #if __DCACHE_PRESENT static uint32_t s_dcache_cssidr; #end...
(&SCB->DCCIMVAC, dcache_line_size(), (uintptr_t)addr, size)
gatt_client_copy_service_refs_by_discovery_generation( const BTDeviceInternal *device, BLEService services_out[], uint8_t num_services, uint8_t discovery_gen); static void prv_send_event(PebbleBLEGATTClientServiceEventInfo *info) { PebbleEvent e = (const PebbleEvent) { .type = PEBBLE_BLE_GATT_CLIENT_EVEN...
list_remove((ListNode *)service_node, head, NULL)
; kernel_free(service_node->service); service_node->service = NULL; kernel_free(service_node); prv_send_event(info); } static void prv_free_service_nodes(GAPLEConnection *connection) { GATTServiceNode *node = connection->gatt_remote_services; while (node) { GATTServiceNode *next = (GATTServiceNode *) ...
/* * 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...
(first_app == launcher_menu_app_get_app_info_result)
; }
ve(fname) == E_DOES_NOT_EXIST); cl_assert(pfs_open(fname, OP_FLAG_READ, 0, 0) == E_DOES_NOT_EXIST); } #define NUM_ENTRIES 3 void test_pfs__close_and_remove(void) { cl_assert(pfs_close_and_remove(-1) == E_INVALID_ARGUMENT); // there shouldn't be any fd open at this point cl_assert(pfs_close_and_remove(2) == E_I...
cl_assert(pfs_close(fd) == S_SUCCESS)
; } cl_assert(pfs_active_in_region(0, pfs_get_size())); // delete every page and make sure pfs is active for (int i = 0; i < num_pages(); i++) { snprintf(file_name, sizeof(file_name), "file%d", i); cl_assert(pfs_remove(file_name) == S_SUCCESS); } cl_assert(pfs_active_in_region(0, pfs_get_size()));...
s = 5; const GPoint result = gpoint_from_polar_internal(NULL, radius, 0); cl_assert_equal_gpoint(result, GPointZero); } void test_graphics_circle__gpoint_from_polar_returns_correct_points(void) { const uint16_t radius = 5; GPoint result; const GPoint origin_center = GPointZero; // 90 degrees should be (5,...
(&p1, GSize(2, 2))
); // Repeat for an offset center point GPointPrecise p2 = GPointPreciseFromGPoint(GPoint(5, 5)); // GRectZero + standardize cl_assert_equal_grect(GRect(5, 5, 0, 0), grect_centered_internal(&p2, GSize(0, 0))); cl_assert_equal_grect(GRect(5, 4, 1, 2), grect_centered_internal(&p2, GSize(-1, -2))); // handl...
---------------------------------------------------------------------------- // Run a set of samples through and verify that we got the right minute data static void prv_test_minute_data(AccelRawData *samples, int num_samples, TestMinuteData *exp_minutes, int exp_num_minutes) { int mi...
time_t last_processed_utc = kalg_activity_last_processed_time(s_kalg_state, KAlgActivityType_Sleep); // Get summary of the sleep SleepTestResults result = { }; prv_get_sleep_summary(&result, test_start_utc, test_end_utc, last_processed_u...
// Make sure we discovered at least 1 test cl_assert(num_tests > 0); // Let's sort the tests by name qsort(&test_entry[0], num_tests, sizeof(test_entry[0]), prv_qsort_sleep_test_entry_cb); // --------------------------------------------------------------------------------- // Print results in a table ...
ue); // Manual && Scheduled && !Smart do_not_disturb_set_schedule_enabled(WeekdaySchedule, true); DoNotDisturbSchedule schedule = { .from_hour = 0, .from_minute = 0, .to_hour = 11, .to_minute = 30, }; do_not_disturb_set_schedule(WeekdaySchedule, &schedule); cl_assert(do_not_disturb_is_manua...
cl_assert(do_not_disturb_is_manually_enabled() == false)
; cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == false); active = do_not_disturb_is_active(); cl_assert(active == false); do_not_disturb_set_manually_enabled(true); do_not_disturb_set_schedule_enabled(WeekdaySchedule, true); cl_assert(do_not_disturb_is_manually_enabled() == true); cl_ass...
(1bitpalette)
); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(1bitpalette))); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat1BitPalette); } // Tests 1-bit red&white palettized PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__color_1_bit(void) { GBitmap *bitmap = ...
168, 360}, { -1192, 176, 424}, { -928, 352, 616}, { -1232, 312, 624}, { -1200, 376, 528}, { -1120, 464, 352}, // 86 seconds { -1360, 472, 320}, { -1640, 472, 312}, { -1528, 280, 400}, { -1344, 120, 392}, { -1248, 48, 400}, { -1192, 40, 368}, { -1096, 64, 328}, { ...
{ -1152, 568, 976}, { -1152, 480, 328}, { -1008, 352, 336}, { -984, 208, 400}, { -968, 288, 512}, { -872, 208, 496}, { -1680, 440, 408}, { -1000, 664, 320}, { -1184, 552, 352}, { -1464, 344, 344}, { -1568, 256, 400}, { -1352, 128, 344}, { -1272, 88, 312}, { -1312,...
{ -1488, 160, 272}, { -1336, 40, 80}, { -1256, 144, 128}, { -1216, 184, 136}, { -1096, 152, 120}, // 94 seconds { -1024, 160, 128}, { -1280, 32, 96}, { -1296, -184, -104}, { -1192, -200, -192}, { -1320, 48, -224}, { -1392, 360, -192}, { -1400, 216, -56}, { -1440,...
/ TIMER_INTERRUPT_HZ) // How many ticks have elapsed since we fed the HW watchdog static uint8_t s_ticks_since_successful_feed = 0; // We use this interrupt vector for our lower priority interrupts #define WATCHDOG_FREERTOS_IRQn CAN2_SCE_IRQn #define WATCHDOG_FREERTOS_IRQHandler CAN2_SCE_IRQHandler static vo...
pebble_task_get_name(PebbleTask_App)
; // if an app results in system throttling, log it at the INFO level at least // once to aid in debug if (strcmp(last_throttled_task, curr_task) != 0) { strcpy(last_throttled_task, curr_task); PBL_LOG(LOG_LEVEL_INFO, "Starting App Throttling for %s", curr_task); } else { PBL_LOG(LOG_LEVEL_DEBUG, "...
120}, { -592, 280, 112}, { -696, 296, 40}, { -736, 312, 40}, { -1056, 344, 32}, { -1112, 368, 8}, { -1320, 392, -16}, { -1112, 328, 0}, { -992, 424, -104}, { -992, 472, -216}, { -728, 400, -152}, { -448, 272, -120}, { -408, 272, -120}, { -456, 296, -104}, { -560,...
{ -1016, 520, -240}, { -1016, 1064, -296}, { -616, -8, 272}, { -528, 376, -104}, { -576, 480, 8}, // 42 seconds { -488, 216, 112}, { -472, 232, 104}, { -496, 232, 96}, { -544, 280, 80}, { -888, 320, 72}, { -1048, 376, 0}, { -1328, 320, 48}, { -1512, 376, -128}, ...
buffer), "0x%"PRIx32" = 0x%"PRIx32, address, word); } void command_format_flash(void) { flash_erase_bulk(); } void command_erase_flash(const char *address_str, const char *length_str) { int32_t address = str_to_address(address_str); if (address < 0) { prompt_send_response("Invalid address"); return; }...
{ page[i] = (uint8_t)(value++ & 0xFF); }
NumbersTestCase *c = &cases[i]; // Initialize to something that's not the expected value: u8 = 1 + (uint8_t)c->u8; u16 = 1 + (uint16_t)c->u16; u32 = 1 + (uint16_t)c->u32; u64 = 1 + (uint16_t)c->u64; s8 = 1 + (int8_t)c->s8; s16 = 1 + (int16_t)c->s16; s32 = 1 + (int16_t)c->s32; s...
jerry_create_external_function(prv_dummy)
, .expected_output = true, }, }; for (int i = 0; i < ARRAY_LENGTH(cases); ++i) { bool output = !cases[i].expected_output; jerry_value_t input = cases[i].input; JERRY_ARGS_MAKE(input); ROCKY_ARGS_ASSIGN(ROCKY_ARG(output)); cl_assert_equal_b(output, cases[i].expected_output); ASSE...
ated); cl_assert_equal_i(r->state, RecognizerState_Updated); cl_assert(!s_manager_state_change); recognizer_transition_state(r, RecognizerState_Completed); cl_assert_equal_i(event_type, RecognizerEvent_Completed); cl_assert_equal_i(r->state, RecognizerState_Completed); cl_assert_passert(recognizer_transiti...
cl_assert_equal_b(reset, true)
; cl_assert_equal_b(cancelled, false); reset = false; r->state = RecognizerState_Cancelled; recognizer_reset(r); cl_assert_equal_i(r->state, RecognizerState_Possible); cl_assert_equal_b(reset, true); cl_assert_equal_b(cancelled, false); reset = false; r->state = RecognizerState_Completed; recogniz...
prv_trigger_cassette_icon_switch(&data->image_cassette, animated); } } static void prv_update_ui_state_skipping(MusicAppData *data, bool animated) { action_bar_layer_set_click_config_provider(&data->action_bar, prv_skipping_click_config_provider); action_bar_laye...
{ music_command_send(MusicCommandTogglePlayPause); }
static void prv_play_pause_click_handler(ClickRecognizerRef recognizer, void *context) { reset_action_bar_revert_timer(context); prv_toggle_playing(); } static void prv_handle_volume_repeat(void *context) { MusicAppData *data = context; if (!data->volume_repeat_timer) { return; } data->volume_repeat_...
112}, { 128, 936, 112}, { 88, 1128, 200}, { 80, 1336, 496}, { -232, 1416, 568}, { -144, 1144, 448}, { -40, 936, 16}, { 40, 656, 312}, { 8, 1008, 144}, { -72, 1016, 360}, { -80, 1000, 208}, { -48, 848, 224}, // 8 seconds { -16, 760, 88}, { 8, 736, 112}, { 72, 6...
{ -968, 120, 96}, { -1248, 160, 224}, { -1424, 128, -120}, { -1864, 328, -64}, { -1672, 480, -160}, { -976, 408, -32}, { -872, 944, 8}, { -1104, 576, 152}, { -1048, 448, 280}, { -760, 400, 216}, { -664, 376, 160}, { -640, 216, 120}, { -688, 312, 200}, { -632, 248,...
{ -1056, 248, -40}, { -992, 264, 0}, // 16 seconds { -1000, 160, 24}, { -912, 336, -104}, { -872, 376, -256}, { -1224, 352, -32}, { -1696, 512, 168}, { -1280, 744, -24}, { -1016, 320, -104}, { -1072, 344, 16}, { -1168, 392, 112}, { -1312, 280, 96}, { -1272, 336, ...
e_cookie, EXPECTED_CRC); prv_process_and_reset_test_counters(); prv_receive_install(s_last_response_cookie); } // Tests /////////////////////////////////////////////////////////// static void prv_system_msg_sent_callback(uint16_t endpoint_id, const uint8_t* data, unsigned...
assert_ack_count(0)
; assert_nack_count(1); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Init Message void test_put_bytes__init_firmware(void) { prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware); // All good! assert_ack_count(1); assert_nack_count(0); // Expect...
if (service && service->handlers.glance_changed) { service->handlers.glance_changed(service->handlers_context); }
} void launcher_app_glance_service_init(LauncherAppGlanceService *service, uint32_t generic_glance_icon_resource_id) { if (!service) { return; } *service = (LauncherAppGlanceService) {}; prv_reset_slice_expiration_timer(service); service->glance_event_info = (Eve...
sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 11 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ct...
(&ctx, &OFFSET_DRAW_RECT_CLIP_XY)
(timer_id)
/ 1000); rtc_set_time(35 * 60); cl_assert(stub_new_timer_fire(timer_id)); cl_assert_equal_i(fake_event_get_count(), 4); cl_assert(!prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(65*60, stub_new_timer_timeout(timer_id) / 1000); rtc_set_time(100 * 60); ...
Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 timeline_model_init(first_time, &model); cl_assert(timeline_model_iter_next(NULL, NULL)); cl_assert(timeline_model_iter_next(NULL, NULL)); cl_assert(timeline_model_iter_next(NULL, NULL)); cl_assert(timeline_model_iter_next(NULL, NULL)); cl_assert(timeline_mod...
cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(2))
; cl_assert(!timeline_model_iter_prev(&new_idx, NULL)); } void test_timeline_model__graceful_delete_middle(void) { TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; time_t first_time = 1421178000; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 timeline_model_init(first_time, &m...
cl_assert(s_watch_file_callback_called_count == 0); } extern status_t test_scan_for_last_written(void); void test_pfs__last_written_page(void) { pfs_format(true); pfs_init(false); // we just formatted so we shouldn't have a last written page cl_assert(test_scan_for_last_written() < 0); // set up an envi...
pfs_delete_file_list(dir_list)
; // Do another search using a filter dir_list = pfs_create_file_list(prv_filename_filter_a_prefix_cb); // Should have 2 entries in it cl_assert_equal_i(list_count(&dir_list->list_node), 2); cl_assert(list_find(&dir_list->list_node, prv_find_name, "a_test_0")); cl_assert(list_find(&dir_list->list_node, p...
e.g. PMIC power rails. // The backup domain is not reset; that would be foolish. const uint32_t ahb1_periphs = RCC_AHB1Periph_CRC | RCC_AHB1Periph_DMA1 | RCC_AHB1Periph_DMA2 | RCC_AHB1Periph_DMA2D | RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_OTG_HS; const uint32_t ahb2_periphs = RCC_AHB2Periph_DCMI | RC...
(BOOT_BIT_RESET_LOOP_DETECT_TWO)
408, 64}, { 1248, 472, 40}, { 960, 368, 32}, { 1024, 352, -16}, { 1136, 328, -40}, { 1168, 240, 8}, { 1104, 216, 0}, { 1080, 200, 0}, { 1064, 192, 0}, { 1080, 168, -16}, { 1064, 160, -56}, { 1024, 136, -72}, { 1032, 104, -64}, { 1032, 96, -64}, // 52 seconds ...
{ 1520, 400, -128}, { 1152, 344, -152}, { 1112, 264, -48}, { 1160, 208, -8}, { 1040, 200, 48}, { 840, 240, 88}, { 768, 240, 88}, { 776, 208, 104}, { 816, 176, 144}, { 848, 160, 136}, { 856, 168, 112}, { 1032, 128, 104}, { 1104, 72, 80}, { 1440, 8, 192}, { 1488...
{ 1400, 40, 112}, { 1464, 280, -216}, // 60 seconds // elapsed: 1 minutes { 1328, 232, -312}, { 1656, 384, -392}, { 1592, 584, -312}, { 1168, 416, -160}, { 888, 352, -128}, { 752, 336, -112}, { 688, 352, -56}, { 760, 440, -64}, { 824, 456, -40}, { 952, 456, -16},...
.all_day = 1, .layout = LayoutIdTest, }, .attr_list = { .num_attributes = 0, .attributes = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, }, { .header = { .id = {0x02}, .parent_id = {0}, ...
(&state.pin.header.id, &s_items[3].header.id)
); // check rollover behaviour cl_assert(!iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id)); cl_assert(state.node); cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); } void test_timeline__forward_and_back(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...
(written_hw_version1, hw_version)
ntCenter); { // do all this in a block so we enforce that nobody uses these variables outside of the block // when dealing with round displays, sizes change depending on location. const GRect probe_rect = GRect(x, y + text_single_line_text_offset_px, w, max_text_line_hei...
{ applib_free(workout_dialog->subtext_buffer); }
if (workout_dialog->dialog.destroy_on_pop) { applib_free(workout_dialog); } } void workout_dialog_init(WorkoutDialog *workout_dialog, const char *dialog_name) { PBL_ASSERTN(workout_dialog); *workout_dialog = (WorkoutDialog){}; dialog_init(&workout_dialog->dialog, dialog_name); Window *window = &work...
xt); } else if (highlight) { ctx->draw_state.fill_color = menu_layer->highlight_colors[MenuLayerColorBackground]; graphics_fill_rect(ctx, bounds); } else { ctx->draw_state.fill_color = menu_layer->normal_colors[MenuLayerColorBackground]; graphics_fill_rect(ctx, bounds); } graphics_context_set_d...
menu_layer_set_normal_colors(menu_layer, GColorWhite, GColorBlack)
; menu_layer_set_highlight_colors(menu_layer, GColorBlack, GColorWhite); InverterLayer *inverter = &menu_layer->inverter; inverter_layer_init(inverter, &GRectZero); scroll_layer_add_child(scroll_layer, &inverter->layer); // Hide inverter layer by default for 3.0 apps layer_set_hidden(inverter_layer_get_la...
= points[0]; (*far_left) = points[2]; (*far_right) = points[1]; } else { // Line heading up right (*far_top) = points[2]; (*far_bottom) = points[1]; (*far_left) = points[0]; (*far_right) = points[3]; } } // Since we already rotated the vector by 90 degrees, delta ...
(bottom_point >> FIXED_S16_3_PRECISION, clip_min_y, clip_max_y)
; // Blending of first line if (fraction_for_top != 0) { int16_t y = y_min; if (y > lm_p1.y.integer) { // We're crossing far_left point, time to swap... lm_p0 = far_left; lm_p1 = far_bottom; } if (y > rm_p1.y.integer) { // We're crossing far_right point...
cted); prv_put_phone_event(PhoneEventType_Incoming, source, ANCS_CALL_UID); } static void prv_call_end(void) { // Note: the source doesn't matter here, phone_call.c ignores it prv_put_phone_event(PhoneEventType_End, PhoneCallSource_PP, ANCS_CALL_UID); } static void prv_call_start(void) { // Note: the source d...
prv_put_incoming_call_event(PhoneCallSource_ANCS, true)
; ASSERT_LAST_EVENT(PhoneEventType_Invalid); // Losing connection to mobile app should have no effect if iOS 9 prv_put_comm_session_event(false /* app_connected */); ASSERT_LAST_EVENT(PhoneEventType_Invalid); // Losing ANCS here should end the call prv_ancs_disconnect(); ASSERT_LAST_EVENT(PhoneEventType...
/* * 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...
(&msg_buf, OS_QUEUE_FOREVER)
== pdPASS); return result; } void hci_rom_passthrough_handle_evt(hci_evt_msg_t *hci_evt) { uint16_t payload_len = sizeof(hci_evt_msg_t) + hci_evt->param_length - sizeof(hci_evt->param); PBL_LOG(LOG_LEVEL_DEBUG, "HCI Event Response:"); PBL_HEXDUMP(LOG_LEVEL_DEBUG, (uint8_t *)hci_evt, payload_len); hc_endpoi...
tions Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); Animation *c = prv_create_test_animation(); animation_set_duration(c, duration_c); // Create a spawn out of b and c Animation *sp...
prv_count_handler_entries(&s_teardown_handler_calls, b)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 2); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, c)...
nvoke // system tasks again to get th actual callback to trigger. cl_assert_equal_i(s_out_sent_call_count, 1); // Check that the state is reset properly after everything cl_assert_equal_b(app_message_is_accepting_outbound(), true); } void test_app_message__send_happy_case_ack_then_outbox_sent(void) { prv_se...
cl_assert_equal_i(app_message_outbox_begin(&iter), APP_MSG_BUSY)
; cl_assert_equal_i(app_message_outbox_send(), APP_MSG_BUSY); } void test_app_message__send_disconnected(void) { prv_set_remote_receive_handler(prv_nack_sent_callback); // Disconnect the comm session s_is_connected = false; // The return value should be APP_MSG_OK, even though we already know it's going to...
estination = session->destination; return (destination == TransportDestinationSystem || destination == TransportDestinationHybrid) && !prv_is_transport_type(session->transport, session->transport_imp, CommSessionTransportType_QEMU) && !prv_is_transport_type(sess...
(s_session_head == NULL)
; } //! Must (only) be called when going into airplane mode (disabling Bluetooth). void comm_session_deinit(void) { // If this assert fires, it means a Transport has not cleaned up properly after itself by closing // all the CommSessions it has opened. PBL_ASSERTN(s_session_head == NULL); } DEFINE_SYSCALL(void,...
)); } void test_put_bytes__init_watch_app_okay_while_not_in_fw_update_mode(void) { s_firmware_update_is_in_progress = false; prv_receive_init_cookie(VALID_OBJECT_SIZE, ObjectWatchApp, EXPECTED_COOKIE); assert_ack_count(1); assert_nack_count(0); cl_assert_equal_i(EXPECTED_COOKIE, put_bytes_get_index()); } v...
(ObjectWatchApp, VALID_OBJECT_SIZE)
; if (prv_put_bytes_get_max_batched_pb_ops() > 1) { // With pre-acking, the put will have already been ack'ed and then a Nack will follow assert_ack_count(1); } else { assert_ack_count(0); } assert_nack_count(1); } void test_put_bytes__chunk_written_to_storage_and_progress_event_put(void) { prv_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&data->launcher_menu_layer, true)
; } } static void prv_will_focus(bool in_focus) { LauncherAppWindowData *data = app_state_get_user_data(); if (!in_focus) { launcher_menu_layer_set_selection_animations_enabled(&data->launcher_menu_layer, false); } } //////////////////////////////// // AppMenuDataSource callbacks static bool prv_app_filt...
duled_head) + list_count(state->scheduled_head); } // -------------------------------------------------------------------------------------- // Count how many animations have been scheduled static uint32_t prv_count_scheduled_animations(void) { AnimationState *state = kernel_applib_get_animation_state(); return li...
property_animation_get_animation(prop_h)
; void *context = &layer; animation_set_handlers(h, handlers, context); animation_set_duration(h, duration); animation_set_auto_destroy(h, false); // Clone it and make sure the clone is correct PropertyAnimation *clone_h = (PropertyAnimation *)animation_clone((Animation *)prop_h); property_animation_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...
{ bt_local_addr_pin(&bonding->pinned_address); }
const uint8_t flags = bonding->flags; if (flags) { PBL_LOG(LOG_LEVEL_INFO, "flags: 0x02%x", flags); } BTBondingID bonding_id = bt_persistent_storage_store_ble_pairing(&bonding->pairing_info, bonding->is_gateway, NULL, ...
// HRM so we can read off the version. PBL_LOG(LOG_LEVEL_DEBUG, "Booting AS7000..."); gpio_output_init(&dev->en_gpio, GPIO_OType_PP, GPIO_Speed_2MHz); #if HRM_FORCE_FLASH // Force the HRM into loader mode which will cause the firmware to be // reflashed on every boot. If the HRM is loaded with a broken // f...
(&HRM->en_gpio, true)
; psleep(NORMAL_BOOT_DELAY_MS); bool success = prv_start_loader(HRM) && prv_wait_for_loader_ready(HRM) && prv_write_register_block(HRM, ADDR_LOADER_STATUS, erase_magic_record, strlen(erase_magic_re...
rtc_get_time()); // Second alarm goes off. First one should be up again s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 2); cl_assert_equal_i(s_num_alarm_events_put, 2); cl_assert_equal_i(s_num_timeline_adds, 20); cl_assert_equal_i(s_num_timelin...
(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_WEEKENDS })
; prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_WEEKENDS, s_weekend_schedule); cl_assert_equal_i(s_num_timeline_adds, 2); // First alarm goes off. Second one should be up s_current_hour = 10; s_current_minute = 30; s_current_day = s_saturday; cron_service_wakeup(); cl_assert_equal_i(s_num_alar...
t(TEST_PNG_FILE); GBitmap *native_framebuffer = graphics_context_get_bitmap(ctx); cl_assert(native_framebuffer->info.format == GBitmapFormat8BitCircular); cl_assert(DISPLAY_FRAMEBUFFER_BYTES == 25944); bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbi...
(ctx, GColorBlack)
; graphics_fill_rect(ctx, &framebuffer_bounds); // Shift the output by non-power-of-2 values for testing bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPoint(33, 10), GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE)); }
OLOR(LOG_LEVEL_DEBUG, LOG_COLOR_CYAN, "last PPG TIA sample is 0!"); } if (hrm->debug->ppg_data.num_samples != 20) { PBL_LOG_COLOR(LOG_LEVEL_DEBUG, LOG_COLOR_CYAN, "Only got %"PRIu16" samples!", hrm->debug->ppg_data.num_samples); } if (hrm->debug->accel_data.num_sa...
(bpm_tl, GTextAlignmentCenter)
; text_layer_set_text(bpm_tl, app_data->bpm_string); layer_add_child(&window->layer, &bpm_tl->layer); bounds.origin.y += 35; TextLayer *quality_tl = &app_data->quality_text_layer; text_layer_init(quality_tl, &bounds); text_layer_set_font(quality_tl, fonts_get_system_font(FONT_KEY_GOTHIC_18)); text_layer_...
SSERTN(!s_send_info.sent_escape); s_send_info.sent_escape = true; s_send_info.escaped_byte = data; data = HDLC_ESCAPE; } return prv_send_byte_and_check(data); } static bool prv_send_stream_callback(void *context) { // NOTE: THIS IS RUN WITHIN AN ISR if (smartstrap_fsm_state_get() != SmartstrapState...
mbuf_set_data(&footer_mbuf, &checksum, sizeof(checksum))
; mbuf_append(&start_flag_mbuf, &footer_mbuf); // End_Flag MBuf end_flag_mbuf = MBUF_EMPTY; mbuf_set_data(&end_flag_mbuf, &flag_data, sizeof(flag_data)); mbuf_set_flag(&end_flag_mbuf, MBUF_FLAG_IS_FRAMING, true); mbuf_append(&start_flag_mbuf, &end_flag_mbuf); // send off the frame mbuf_iterator_init(&...
gle glyph_buffer that contains the last used // glyph. If this matches the glyph we're looking for right now, that's what we want to use. // Potentially this also has the bitmap loaded already. #if !CAPABILITY_HAS_GLYPH_BITMAP_CACHING if (font_cache->glyph_buffer_key == cache_key) { cached = (LineCacheData *)...
memcpy(font_cache->glyph_buffer, data, sizeof(LineCacheData))
; font_cache->glyph_buffer_key = cache_key; final_data = (LineCacheData *)(font_cache->glyph_buffer); #else final_data = data; #endif if (need_bitmap && !prv_load_glyph_bitmap(codepoint, font_res, final_data)) { return NULL; } // We push `data`, which will be cooked data if the bitmap is stored...
>list_head); cl_check(!modal_stack->list_head); // Switch to the app state to push a window stub_pebble_tasks_set_current(PebbleTask_App); window_stack_push(app_stack, window1, true); cl_assert_equal_i(window_stack_count(app_stack), 1); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_p(s_l...
fake_event_get_last()
; cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT); cl_assert_equal_i(event.app_focus.in_focus, false); cl_assert_equal_i(window_stack_count(app_stack), 1); // Pop the modal window off the stack window_stack_remove(window2, true); cl_assert_equal_i(window_stack_count(modal_stack), 0); ...
lip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled.${BIT_DEPTH_NAME}.pbi")); } // AA section void test_graphics_gpath_${BIT_DEPTH_NAME}__filled_aa(void) { GContext ctx; Layer layer; // House path - tests horizontal ...
(&ctx.dest_bitmap, "gpath_filled_crossing_aa.8bit.pbi")
); // Infinite path - shows an example where path seems to be crossing itself but // in fact it does not prv_reset(); s_current_path = s_infinite_path; gpath_move_to(s_infinite_path, GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)); test_graphics_context_init(&ctx, fb); graphics_context_set_antialiased(&ct...
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 in writing, softw...
{ return -1; }
else { // bigger applications to have a lower priority if (b_node->size < a_node->size) { return 1; } else if (b_node->size > a_node->size) { return -1; } else { return 0; } } } //! Trim the applications with highest priority while still keeping (bytes_in_list > bytes_needed) s...
&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2), GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fil...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r3_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi")); se...
/* * 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...
LOG_LOCKED(handle->common.lr, myLR)
; } void mutex_unlock(PebbleMutex * handle) { OS_ASSERT(!mcu_state_is_isr()); LOG_UNLOCKED(handle->common.lr, 1) xLightMutexUnlock(handle->common.freertos_mutex); } static void prv_assert_held_by_curr_task(PebbleMutex * handle, bool is_held, uint32_t lr) { LightMutexHandle_t mutex = handle->common.freertos_mu...
power_cached = 12; // ----------------------------------------------------------------------------- //! Prototypes static void prv_perform_next_job(bool force_refresh); // ----------------------------------------------------------------------------- static const char * prv_string_for_debug_tag(GAPLEAdvertisingJobTa...
(job->tag)
); kernel_free(job->terms); kernel_free(job); *job_ptr = NULL; } } } static void prv_increment_time_elapsed_for_all_silent_terms_except_current(void) { if (!s_jobs) { return; } GAPLEAdvertisingJob *job = s_jobs; do { GAPLEAdvertisingJob *next = (GAPLEAdvertisingJob *) job->node....
snprintf(dstbuf, 256, "There are %+i lights, the absolute value of %+i", 4, -4); cl_assert_equal_s(dstbuf, "There are +4 lights, the absolute value of -4"); // Minimum digits output snprintf(dstbuf, 256, "There are %.2i lights, %.2i", 4, -4); cl_assert_equal_s(dstbuf, "There are 04 lights, -04"); // Minim...
(dstbuf, "There are 004 lights")
; // Variable length digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.*uzero%.*u", -3, 0, -3, 1); cl_assert_equal_s(dstbuf, "zero1"); // Length modifiers uint64_t hurf = 0x123456789ABCDEF0ULL; snprintf(dstbuf, 256, "%hhu,%hu,%u,%lu", hurf, hurf, hurf, hurf); cl_assert_equal_s(dstbu...
map, "draw_rect_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__color(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 20, 10)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_ren...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw4_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 4); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, tr...
property_animation_create_layer_frame(layer, from_frame, to_frame); animation_set_duration(anim, interpolate_moook_soft_duration(NUM_MID_FRAMES)); animation_set_custom_interpolation(anim, prv_interpolate_moook_soft); return anim; } // Create animation static void prv_schedule_slide_animation(HealthCardView *heal...
(&health_card_view->window)
; // create and add all card layers to window root layer for (int i = 0; i < CardCount; i++) { health_card_view->card_layers[i] = s_card_view_create[i](health_data); layer_add_child(window_root, health_card_view->card_layers[i]); } // set starting card based on launch args HealthLaunchArgs launch_ar...
/* * 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...
Fixed_S32_16_mul(t1->b, t2->d)
test_message_handler, NOT_PERMITTED_DROP_HANDLER)); } void test_app_inbox__app_inbox_create_and_register_happy_case(void) { void *result = app_inbox_create_and_register(BUFFER_SIZE, 1, ...
cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, BUFFER_SIZE, s_writer))
; cl_assert_equal_b(true, app_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest)); // Call ...begin() again: cl_assert_equal_b(false, app_inbox_service_begin(AppInboxServiceTagUnitTest, BUFFER_SIZE, s_writer)); cl_assert_equal_b(true, app_inbox...
remaining space in worker_segment is assigned to the worker's // heap. Worker state needs to be configured before initializing the // heap as the WorkerState struct holds the worker heap's Heap object. Heap *worker_heap = worker_state_get_heap(); PBL_LOG(LOG_LEVEL_DEBUG, "Worker heap init %p %p", work...
process_manager_process_cleanup(PebbleTask_Worker)
; // Notify the app install manager that we finally exited app_install_notify_worker_closed(); // If the worker was closed gracefully, launch any next/default worker and return if (gracefully) { // Reset the data tracking the last worker that crashed since the closing worker did not crash prv_reset_la...
License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific ...
layer_render_tree(&layer, &ctx)
// One slot is 625us: const uint32_t min_interval_ms = ((next->terms[next->cur_term].min_interval_slots * 5) / 8); const uint32_t max_interval_ms = ((next->terms[next->cur_term].max_interval_slots * 5) / 8); BLE_LOG_DEBUG("Enable Ad job %s", prv_string_for_debug_tag(next->tag)); bool result =...
memcpy(job->terms, terms, sizeof(GAPLEAdvertisingJobTerm) * num_terms)
e new implementation uses up to 72 bytes more stack space than the previous implementation. //! Might need to do some extra work to get a "thinner" stack, if this causes issues. //! Executes on App task. void app_message_app_protocol_msg_callback(CommSession *session, const ui...
{ return false; }
69: This should be moved to send_text.c #if !PLATFORM_TINTIN && defined(APP_ID_SEND_TEXT) static void prv_capabilities_changed_event_handler(PebbleEvent *event, void *context) { // We only care if send text support changed right now if (!event->capabilities.flags_diff.send_text_support) { return; } const P...
resource_load_byte_range_system(SYSTEM_APP, reg_entry->bin_resource_id, 0, (uint8_t *)app_header, sizeof(*app_header))
!= sizeof(*app_header)) { PBL_LOG(LOG_LEVEL_WARNING, "Stored app with resource id %d not found in resources", reg_entry->bin_resource_id); goto done; } *entry = (AppInstallEntry) { .install_id = reg_entry->id, .type = AppInstallStorageResources, .visibility = process_metadata_flags_...
fixedS16_3(v, f) \ cl_assert_equal_i((v).raw_value, (int)((f) * FIXED_S16_3_ONE.raw_value)) #define cl_assert_gpoint_precise(p, px, py) \ do { \ cl_assert_fixedS16_3(p.x, px); \ cl_assert_fixedS16_3(p.y, py); \ } while(0) void test_graphics_circle__grect_polar_calc_values_handles_null(void) { GPointP...
cl_assert_fixedS16_3(s_radius, 0)
; graphics_draw_arc(NULL, GRect(0, 0, 10, 12), GOvalScaleModeFitCircle, 0, 0); cl_assert_gpoint_precise(s_center, 4.5, 5.5); cl_assert_fixedS16_3(s_radius, 4.5); } void test_graphics_circle__fill_oval(void) { cl_assert_gpoint_precise(s_center, 0, 0); cl_assert_fixedS16_3(s_radius_inner, 0); cl_assert_fixe...
TimelineLayout *card_timeline_layout) { KinoReel *from_reel = kino_reel_create_with_resource_system( pin_timeline_layout->icon_res_info.res_app_num, pin_timeline_layout->icon_res_info.res_id); if (!from_reel) { return; } const uint32_t duration = TIMELINE_CARD_TRANSITION_MS; GRect icon_fr...
layer_set_frame((Layer *)&layout->icon_layer, &frame)
; // Clip for the static icon layer_set_clips(&layout->icon_layer.layer, true); } KinoReel *new_reel = kino_reel_create_with_resource_system(layout->icon_res_info.res_app_num, layout->icon_res_info.res_id); prv_change_reel(layout, new_reel); ...
.show_notification = true, \ .activity = { \ .trigger_elapsed_minutes = 20, \ .trigger_cooldown_minutes = 10, \ }, \ } \ } typedef struct { const char *key; ActivityInsightSettings default_val; } AISDefault; static const AISDefault AIS_DEFAULTS[] = { { .key = ACTIVITY_INSIGHTS_SETTINGS...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Using default for insight %s", insight_name); *settings_out = AIS_DEFAULTS[i].default_val; rv = true; }
} } return rv; } bool activity_insights_settings_write(const char *insight_name, ActivityInsightSettings *settings) { bool rv = false; SettingsFile file; if (prv_open_settings_and_lock(&file)) { if (settings_file_set(&file, insight_nam...
/* * 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_single_click_subscribe(BUTTON_ID_UP, prv_worker_crash_button_up_handler); window_single_click_subscribe(BUTTON_ID_DOWN, prv_worker_crash_button_down_handler); }
//! Configure a crash dialog with the given crash reason text //! @param dialog The dialog to configure //! @param crash_reason The crash reason text static void prv_configure_crash_dialog(Dialog *dialog, const char *crash_reason) { dialog_set_text(dialog, i18n_get(crash_reason, dialog)); i18n_free(crash_reason, ...
NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_bw, GPointZero, DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_bw_set_corner_45.Xbit.pbi")); // Top-left center rotation po...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_set_0.Xbit.pbi")
); // Top-left corner rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_color, GPointZero, DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ...
} void test_alarm__alarm_create_just_once(void) { AlarmId id; // It's currently Thursday @ 00:00 bool just_once_schedule_thursday[7] = {false, false, false, false, true, false, false}; id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_JUST_ONCE }); prv_assert_alarm_config(id, 3, 14...
(id, 3, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule)
; alarm_set_kind(id, ALARM_KIND_WEEKENDS); prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule); bool custom_schedule1[7] = {true, false, true, false, false, true, true}; id = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &custom...
efore killing ourselves. prv_log_event_put_failure(queue_type, saved_lr, event); #if EVENT_DEBUG prv_queue_dump(queue); #endif reset_due_to_software_failure(); } } void event_deinit(PebbleEvent* event) { void **buffer = event_get_buffer(event); if (buffer && *buffer) { kernel_free(*buffer); ...
{ return (void **)&event->sys_notification.notification_id; }
break; case PEBBLE_BLOBDB_EVENT: return (void **)&event->blob_db.key; case PEBBLE_BT_PAIRING_EVENT: if (event->bluetooth.pair.type == PebbleBluetoothPairEventTypePairingUserConfirmation) { return (void **)&event->bluetooth.pair.confirmation_info; } break; ...
/* * 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...
.size = GSize(max_text_container_frame.size.w, max_text_container_frame.size.h - title_line_height) }; instruction_frame.size = graphics_text_layout_get_max_used_size(ctx, instruction_text, instruction_font, ...
void prv_draw_border_stripe(Layer *layer, GContext *ctx, GAlign alignment) { const int16_t stripe_inset = 6; const int16_t stripe_width = 2; const GRect *layer_bounds = &layer->bounds; const bool is_horizontal = ((alignment == GAlignTop) || (alignment == GAlignBottom)); GRect rect = (GRect) { .size = (...
/* * 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 *spinner_window = spinner_ui_window_get(PBL_IF_COLOR_ELSE(GColorBlue, GColorDarkGray)); app_window_stack_push(spinner_window, false /* animated */); // Factory reset on KernelBG so the animation gets priority system_task_add_callback(prv_factory_reset, NULL); }
#ifdef RECOVERY_FW static void prv_mfg_mode_cb(void *data) { #if CAPABILITY_HAS_ACCESSORY_CONNECTOR accessory_imaging_enable(); #endif mfg_enter_mfg_mode_and_launch_app(); } #endif static void prv_timeout_expired(void *data) { PBL_LOG(LOG_LEVEL_INFO, "Button combo timeout expired!"); // Timeout expired, jum...
pling_interval_us; } void accel_set_num_samples(uint32_t num_samples) { s_num_samples = num_samples; } int accel_peek(AccelDriverSample *data) { return 0; } void accel_enable_shake_detection(bool on) { } bool accel_get_shake_detection_enabled(void) { return false; } void accel_enable_double_tap_detection(bool on...
printf("Testing: ")
; for (int i = 0; i < count; i++) { printf("%d ", sample_rates[i]); } printf("\n"); prv_run_accel_test(test_rates, count); } } void test_accel_manager__jitterfree(void) { // Force the fake accel to only support the 125hz sample rate. s_force_sampling_interval = true; s_sampling_interval_...
rmat(false); cl_assert(!pfs_active_in_region(0, pfs_get_size())); // erase every page and make sure pfs is active pfs_format(true); cl_assert(pfs_active_in_region(0, pfs_get_size())); // write something on every page and make sure pfs is active char file_name[10]; for (int i = 0; i < num_pages(); i++) {...
{ cl_assert(pfs_remove(file_small) == S_SUCCESS); }
} } int original_page_count = num_pages(); ftl_populate_region_list(); // make sure something was added PBL_LOG(LOG_LEVEL_DEBUG, "original pages %u, num pages: %u", original_page_count, num_pages()); cl_assert(original_page_count < num_pages()); for (int i = 0; i < original_page_count; i++) { s...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, data->device_serial, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD), GRect(bounds->origin.x, (bounds->origin.x + bounds->size.w) / 2, bounds->size.w, bounds->size.h), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL)
; } static void prv_display_saving_message(Layer *layer, GContext *ctx) { AppData *data = app_state_get_user_data(); const GRect *bounds = &data->window.layer.bounds; graphics_context_set_text_color(ctx, GColorWhite); graphics_draw_text(ctx, "Saving...", fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD), ...
/* * 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...
kino_layer_set_reel_with_resource(&data->connectivity_icon, data->connectivity_icon_id)
; } // Get the connectivity ResourceId const uint32_t new_battery_icon_id = prv_get_resource_id_for_battery_charge_state(battery_get_charge_state()); // replace the image if the battery ResourceId has changed if (data->battery_icon_id != new_battery_icon_id) { data->battery_icon_id = new_battery_i...
the SYNC-byte (register 57). // Reading the SYNC-byte causes the AS7000 to release the handshake-signal // and allows deep-sleep mode (if the AS7000 is configured for this). // This step must be the last read for this handshake-pulse. static void prv_handle_handshake_pulse(void *unused_data) { PPG_DBG...
{ if (app_ids & AS7000AppId_Loader) { PBL_LOG(LOG_LEVEL_DEBUG, " - Loader"); } if (app_ids & AS7000AppId_HRM) { PBL_LOG(LOG_LEVEL_DEBUG, " - HRM"); } if (app_ids & AS7000AppId_PRV) { PBL_LOG(LOG_LEVEL_DEBUG, " - PRV"); } if (app_ids & AS7000AppId_GSR) { PBL_LOG(LOG_LE...
} static bool prv_get_and_log_device_info(HRMDevice *dev, AS7000InfoRecord *info, bool log_version) { // get the device info if (!prv_read_register_block(dev, ADDR_INFO_START, info, sizeof(AS7000InfoRecord))) { return false; } if (log_version) { // print out th...
_BSS_size__); // ROCKY_BSS is inside APP_RAM to make the syscall buffer checks pass. // However, we want to avoid overlapping with any splits we're about to make: app_ram.end = __ROCKY_BSS__; // Reduce the size available for the code + app heap, on Spalding the "padding" we had left // isn't enoug...
if ((s_app_task_context.install_id != INSTALL_ID_INVALID) && ((launch_reason == APP_LAUNCH_PHONE) || (launch_reason == APP_LAUNCH_USER))) { AppInstallEntry entry; if (!app_install_get_entry_for_install_id(s_app_task_context.install_id, &entry)) { // cant retrieve app install entry for id PBL_L...
app_manager_set_minimum_run_level(process_metadata_get_run_level(app_md)); // Use the static app event queue: s_app_task_context.to_process_event_queue = s_to_app_event_queue; // Init services required for this process before it starts to execute process_manager_process_setup(PebbleTask_App); char task...
ow->background_color; if (!gcolor_is_transparent(bg_color)) { GDrawState prev_state = graphics_context_get_drawing_state(ctx); graphics_context_set_fill_color(ctx, bg_color); graphics_fill_rect(ctx, &layer->bounds); graphics_context_set_drawing_state(ctx, prev_state); } } //! helper struct to move ...
{ handler(window); }
} void window_schedule_render(Window *window) { window->is_render_scheduled = true; } GRect window_calc_frame(bool fullscreen) { GContext *ctx = graphics_context_get_current_context(); GRect result = (GRect) { .origin = { 0, 0 }, .size = graphics_context_get_framebuffer_size(ctx) }; result.size.h -...
ffer, &client1, 2)); cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 0); // Should fail, not enough room because client 2 is full cl_assert(!shared_circular_buffer_write(&buffer, (uint8_t*) "gh", 2, false)); // This should pass and reset client 2's read index cl_assert(shared_...
(out_buffer, "5q", 2)
.origin = { .x = cursor.origin.x + glyph_metrics.origin.x, .y = cursor.origin.y + glyph_metrics.origin.y }, .size = { .w = glyph_metrics.size.w, .h = glyph_metrics.size.h } }; // The destination bitmap's x-coordinate and row advance. Used in the loop below. GBitmap* dest_bi...
{ glyph_block += bits_to_skip / 32; src = *glyph_block; // Simulate the rotate that happens at the bottom of the bitblt loop so our source value is set // up just as if we actually rendered those first few lines. rotl32(src, (dest_shift_at_line_begin + ((0 - ((uint8_t)glyph_metrics.size.w)) % 32) *...
for (int dest_y = clipped_glyph_target.origin.y; dest_y != clipped_glyph_target.origin.y + clipped_glyph_target.size.h; ++dest_y) { dest_shift = dest_shift_at_line_begin; // Number of bits to render on this line. uint8_t glyph_line_bits_left = clipped_glyph_target.size.w; uint32_t *dest_block = (u...
/* * 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_ad_data, local_name, 6)
; cl_assert_equal_s(local_name, "Light"); cl_assert_equal_i(size, strlen("Light") + 1); // Test ble_ad_includes_service: Uuid included_uuid = bt_uuid_expand_16bit(0x7b29); cl_assert(ble_ad_includes_service(s_ad_data, &included_uuid)); Uuid missing_uuid = bt_uuid_expand_16bit(0xabcd); cl_assert(!ble_ad_in...
{ .size = 4, .offset = 0 }, { .size = 20, .offset = 0 }, { .size = 60, .offset = 0 }, { .size = 127, .offset = 0 }, { .size = 128, .offset = 0 }, }; void command_flash_apicheck(const char *len_str) { QSPIFlash *dev = QSPI_FLASH; const int buf_size = 64; char buf[buf_size]; int failures = 0; ...
prompt_send_response_fmt(buf, buf_size, "SUCCESS: run %d tests and all passeed", passes)
a weekday result = health_service_sum_averaged(HealthMetricStepCount, time_util_get_midnight_of(now), time_util_get_midnight_of(now) + SECONDS_PER_DAY, HealthServiceTimeScopeDailyWeekdayOrWeekend); ...
(value, exp_value)
__to_square.8bit.pbi")); } // re-enable this "test" to debug per-frame transitions void _test_gdraw_command_transforms__to_square_sequence(void) { GContext ctx; test_graphics_context_init(&ctx, fb); graphics_context_set_antialiased(&ctx, true); int32_t dt = ANIMATION_NORMALIZED_MAX / 16; int32_t t = 0; ...
gdraw_command_image_draw(&ctx, l, GPoint(0, 192))
; free(index_lookup); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "test_gdraw_command_transforms__segmented_scale.8bit.pbi")); } // re-enable this "test" to debug per-frame transitions void _test_gdraw_command_transforms__scale_segmented_sequence(void) { GContext ctx; test_graphics_context_init(&ctx, fb); g...
AttributeList *attr_list, void *group_ptr, uint8_t *buffer, uint8_t *buf_end, const uint8_t *payload, size_t payload_size) { ...
prv_serialize_address( &((AddressList *)group_ptr)->addresses[i], &buffer)
column_width); prv_prepare_canvas(ctx, bitmap_size); // Fill the canvas so each row (of width vline_applying_test_row_height) is set to one of the // different possible dest_colors for (int16_t x = 0; x < bitmap_size.w; x++) { for (int16_t row_index = 0; row_index < num_dest_colors; row_index++) { co...
(ctx, y, x1_fixed, x2_fixed, color)
; } void test_graphics_context_mask__record_assign_horizontal_line_raw(void) { prv_mask_record_hline_test_pattern(prv_hline_pattern_record_assign_horizontal_line_raw); CHECK_EXPECTED_TEST_IMAGE(s_ctx); }; void prv_mask_recording_blend_horizontal_line_raw(GContext *ctx, int16_t y, int16_t x1, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
((const uint8_t*) &chunk_header, get_current_address(s_current_chunk, 0), sizeof(chunk_header))
; s_current_offset = sizeof(LogChunkHeader); } static void make_space_for_log(int length) { if (s_current_offset + sizeof(LogHeader) + length + sizeof(LogHeader) < CHUNK_SIZE_BYTES) { // We got space, nothing to do here return; } // Need to roll over to the next chunk // Seal off the current chunk...
" ); ASSERT_JS_GLOBAL_EQUALS_S("s", "00:04:05"); } void test_rocky_api_datetime__locale(void) { rocky_global_init(s_api); EXECUTE_SCRIPT( "var d = new Date();\n" "d.toLocaleTimeString(undefined);\n" ); EXECUTE_SCRIPT_EXPECT_ERROR( "d.toLocaleTimeString('en-us');", "TypeError: Unsupported ...
("s", "25")
; EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'short'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Mon"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'long'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Monday"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: 'numeric'});"); ASSERT...
t *transport) { return launcher_task_is_current_task(); } //! Defined in session.c extern void comm_session_set_capabilities( CommSession *session, CommSessionCapability capability_flags); bool pulse_transport_is_connected(void) { return (s_transport.session != NULL); } // -----------------------------------...
{ case PULSE_PP_OPCODE_DATA: prv_pulse_pp_handle_data(&packet->data[0], length - sizeof(PulsePPPacket)); break; case PULSE_PP_OPCODE_OPEN: prv_pulse_pp_send(PULSE_PP_OPCODE_OPEN, NULL, 0); prv_pulse_pp_transport_set_connected(true); break; case PULSE_PP_OPCODE_CLOSE: prv_...
}
tring_size(subtitle); if (has_multimedia) { required_space_for_strings += MULTIMEDIA_INDICATOR_LENGTH; } required_space_for_strings += prv_max_ellipsified_cstring_size(message); required_space_for_strings += prv_max_ellipsified_cstring_size(positive_action); required_space_for_strings += prv_max_ellipsifi...
if (dismiss) { attribute_list_init_list(NUM_NATIVE_ANCS_ACTION_ATTRS + 1, &dismiss->attr_list); uint8_t *string_buffer = NULL; prv_fill_native_ancs_action(&string_buffer, dismiss, ActionIDNegative, attr_action_neg, NULL, ANCSProperty_None); // Add ancs ID as attribute s...