prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
extension); if (!read_pbi(pbi_filename, &result)) { return NULL; } else { return &result; } } typedef GBitmap *(*CompositeTestGBitmapCreateFunc)(const char *filename); typedef struct CompositeTest { const char *test_name; GBitmapFormat expected_test_image_bitmap_format; CompositeTestGBitmapCreate...
(offset_point, GPoint(COMPOSITE_TEST_OFFSET_X, COMPOSITE_TEST_OFFSET_Y))
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, software * dist...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_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.dest_bitmap, "fill_rect_across_nx_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&lay...
, -720}, { -1176, -376, -664}, { -1032, -192, -632}, { -792, -88, -608}, { -568, -48, -736}, { -536, 104, -632}, { -648, 176, -392}, { -608, 208, -432}, { -576, 280, -376}, { -472, 232, -360}, { -368, 272, -432}, { -328, 184, -464}, { -224, 96, -760}, { -24, 24, -952}...
{ -224, 392, -848}, { -176, 496, -920}, { -216, 352, -944}, { -208, 232, -968}, { -200, 160, -856}, { -168, 128, -840}, { -144, 112, -928}, }; *len = ARRAY_LENGTH(samples); return samples; }
_CCR_IMODE | \ QUADSPI_CCR_ADMODE | \ QUADSPI_CCR_ADSIZE | \ QUADSPI_CCR_ABMODE | \ QUADSPI_CCR_ABSIZE | \ QUADSPI_CCR_DCYC | \ QUADSP...
{ dma_size = 0; leading_bytes = length; trailing_bytes = 0; }
prv_set_num_data_bytes(length); prv_config_indirect_read(dev, instruction, start_addr, dummy_cycles, is_ddr); if (leading_bytes > 0) { prv_read_bytes(buffer, leading_bytes); } if (dma_size > 0) { // Do 4 bytes at a time for DMA QSPI_SetFIFOThreshold(QSPI_DMA_READ_WORD_SIZE); QSPI_DMACmd(...
/* * 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...
stub_new_timer_is_scheduled(timer_id)
ist_idx = 1; while (cur_node) { if (cur_node->id == id) { return list_idx; } list_idx++; cur_node = (AlarmNode* )list_get_next((ListNode*) cur_node); } return 0; } static void prv_update_menu_layer(AlarmsAppData* data, AlarmId select_alarm) { MenuIndex selected_menu_index = {0, prv_get_...
{ if (data->show_limit_reached_text) { // Trying to add a new alarm when list is already full const GFont font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellSubtitle); box = GRect(0, 0, cell_layer->bounds.size.w, fonts_get_font_height(font)); ...
izerState_Started)); recognizer_transition_state(r, RecognizerState_Updated); cl_assert_equal_i(r->state, RecognizerState_Updated); cl_assert_equal_i(event_type, RecognizerEvent_Updated); cl_assert(!s_manager_state_change); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Failed)); cl_asser...
(impl_destroyed, true)
; cl_assert_equal_b(sub_destroyed, true); } void test_recognizer__reset(void) { bool reset = false; bool cancelled = false; s_test_impl_data.reset = &reset; s_test_impl_data.cancelled = &cancelled; NEW_RECOGNIZER(r) = test_recognizer_create(&s_test_impl_data, NULL); recognizer_reset(r); cl_assert_equa...
ing pmap to %d bytes", (int)new_size); int new_fd = prv_pmap_open_debug_wrapper(s_map_filename, OP_FLAG_OVERWRITE, FILE_TYPE_STATIC, new_size); if (new_fd < 0) { PBL_LOG(LOG_LEVEL_WARNING, "pmap enlarge (overwrite) failed: %d", new_fd); kernel_free(buf); return (new_fd); } size_t curr_file_le...
{ char uuid_string[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&field->uuid, uuid_string); PBL_LOG(LOG_LEVEL_INFO, "%s -> %d", uuid_string, field->id); return false; }
void persist_map_dump(void) { PBL_LOG(LOG_LEVEL_INFO, "Dumping persist map:"); search_map(prv_dump_callback, NULL); } status_t persist_map_init() { const char * const name = s_map_filename; status_t status = S_SUCCESS; // create a new map file if needed. We may fail on init so don't call it through the de...
44, 280, -48}, { 904, 240, -8}, // 85 seconds { 704, 192, -48}, { 640, 160, -32}, { 648, 136, 16}, { 776, 136, -8}, { 864, 128, 24}, { 1088, 136, -16}, { 1136, 128, 0}, { 1080, 96, 0}, { 1304, 144, -64}, { 1128, 120, 24}, { 1168, 176, -56}, { 1352, 200, -32}, ...
{ 1056, 336, -256}, { 1304, 384, -232}, { 1200, 384, -240}, { 992, 336, -168}, { 1032, 336, -168}, { 1152, 312, -144}, { 1112, 264, -80}, { 904, 200, -56}, { 728, 168, -64}, { 640, 168, -72}, { 664, 160, -32}, { 752, 152, -8}, // 91 seconds { 864, 104, 0}, { 1...
{ 696, 176, -24}, { 696, 176, -24}, { 744, 176, -16}, { 832, 136, -16}, { 928, 152, -32}, { 1016, 144, 0}, { 992, 136, -32}, { 1128, 160, -104}, { 1104, 168, -72}, { 1064, 192, -88}, { 1152, 224, -128}, { 1272, 240, -152}, { 1224, 272, -136}, { 936, 264, -144}, ...
/* * 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...
(GPIOC, GPIO_PinSource10, GPIO_AF_USART3)
; /* Connect PXx to USARTx_Rx*/ GPIO_PinAFConfig(GPIOC, GPIO_PinSource11, GPIO_AF_USART3); /* Configure USART Tx as alternate function */ GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Spee...
dvance_to_ms_with_timers(start_ms + delay_a + MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); animation_set_elapsed(a, duration_a - leftover_a); cl_assert_equal_i(prv_count_handler...
(a, duration_a)
/* * 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...
CRC_CalcCRC(last_word)
; } else { crc_value = CRC_GetCRC(); } return crc_value; } void crc_calculate_incremental_stop(void) { PBL_ASSERTN(s_initialized); disable_crc_clock(); } uint32_t crc_calculate_bytes(const uint8_t* data, unsigned int data_length) { crc_calculate_incremental_start(); // First calculate the CRC of ...
/* * 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 (!animation) { return false; }
((AnimationPrivate*)animation)->delay_ms = delay_ms; return true; } bool WEAK animation_set_immutable(Animation *animation) { if (!animation) { return false; } ((AnimationPrivate*)animation)->immutable = true; return true; } bool WEAK animation_is_immutable(Animation *animation) { if (!animation) {...
e 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...
(text_layer, data->detail_text_buffer)
; layer_add_child(&window->layer, &text_layer->layer); } static void push_detail_window(AppData *data, MenuIndex *index, bool is_long_click) { sniprintf(data->detail_text_buffer, 50, "SELECTION:\n\nSection %i, Row %i\nLong click: %c", index->section, index->row, is_long_click ? 'Y' : 'N'); Window *detail_window...
start_page_addr = log_start_addr; return (num_log_pages); } //! Update page in flash to reflect settings of s_curr_state static void prv_allocate_page_for_use(void) { FlashLoggingHeader hdr; hdr.magic = LOG_MAGIC; hdr.version = LOG_VERSION; hdr.log_file_id = s_curr_state.log_file_id; hdr.log_chunk_id = s_...
(s_curr_state.page_start_addr, LOG_PAGE_SIZE)
; uint32_t curr_sector = s_curr_state.page_start_addr / ERASE_UNIT_SIZE; uint32_t new_sector = new_flash_addr / ERASE_UNIT_SIZE; if (curr_sector != new_sector) { // have we crossed into a new erase region ? prv_erase_unit(prv_get_unit_base_address(new_flash_addr)); } s_curr_state.page_start_addr = new_f...
event_service_client_unsubscribe(&data->event_service_info)
; #if CAPABILITY_HAS_MICROPHONE voice_window_destroy(data->voice_window); #endif applib_free(data); } static void prv_cancel_response_timer(ActionResultData *data) { if (evented_timer_exists(data->response.timer)) { evented_timer_cancel(data->response.timer); } } static void prv_cleanup_action_result(Acti...
NULL, 0 /*flags*/); PBL_ASSERTN(success); } // ------------------------------------------------------------------------------------------- void regular_timer_add_multisecond_callback(RegularTimerInfo* cb, uint16_t seconds) { PBL_ASSERTN(s_callback_list_semaphore); mutex_lock(s_callback_list_semaphore); cb->p...
{ mutex_destroy((PebbleMutex *) s_callback_list_semaphore); s_callback_list_semaphore = NULL; new_timer_delete(s_timer_id); s_timer_id = TIMER_INVALID_ID; }
time: 2016-05-20 04:36:00 AM { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 408, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 0, 141, 0}, { 0, 0x4b, 28, 141, 0}, { 0, 0x4b, 0, 141, 0}...
{ 0, 0x2d, 0, 148, 0}, { 0, 0x2d, 0, 151, 0}, { 0, 0x2d, 0, 149, 0}, { 0, 0x2d, 0, 150, 0}, // 555: Local time: 2016-05-20 06:21:00 AM { 0, 0x2d, 0, 147, 0}, { 0, 0x2d, 0, 148, 0}, { 0, 0x2d, 0, 147, 0}, { 0, 0x4c, 1708, 166, 0}, { 0, 0x6b, 157, 167, 0}, ...
// 600: Local time: 2016-05-20 07:06:00 AM { 0, 0x1c, 0, 141, 0}, { 0, 0x1b, 404, 224, 0}, { 0, 0x1a, 893, 129, 0}, { 0, 0x1b, 0, 129, 0}, { 0, 0x1c, 0, 128, 0}, { 0, 0x1b, 0, 129, 0}, { 0, 0x1b, 115, 151, 0}, { 0, 0x3b, 1074, 158, 0}, { 0, 0x4b, 0, 160, 0}, ...
y_totals(state, metric, time_start, time_end, aggregation, scope); } #endif } // ---------------------------------------------------------------------------------------------- bool health_service_events_subscribe(HealthEventHandler handler, void *context)...
if (hrm_session == HRM_INVALID_SESSION_REF) { PBL_LOG(LOG_LEVEL_ERROR, "Error subscribing"); return false; }
return true; #endif } // ---------------------------------------------------------------------------------------------- uint16_t health_service_get_heart_rate_sample_period_expiration_sec(void) { #if !CAPABILITY_HAS_BUILTIN_HRM return 0; #else if (!sys_activity_prefs_heart_rate_is_enabled()) { return 0; ...
S); cl_assert_equal_s("1 MIN AGO", time_buf); // June 9th 2015, 16:02:00 (T+00:02:00) rtc_set_time(event_time + (2 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 MIN AGO", time_buf); // June 9th 2015, 15:00:00 (T-01:...
cl_assert_equal_s("IN 2 H", time_buf)
; // June 9th 2015, 15:59:00 (T-00:01:00) rtc_set_time(event_time - (1 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 1 MIN", time_buf); // June 9th 2015, 15:58:00 (T-00:02:00) rtc_set_time(event_time - (2 * SECONDS...
/* * 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_state_get_framebuffer_render_pending()
= true; PebbleEvent event = { .type = PEBBLE_RENDER_READY_EVENT, }; sys_send_pebble_event_to_kernel(&event); } static bool prv_window_is_render_scheduled(Window *window) { return window && window->is_render_scheduled; } static bool prv_app_is_render_scheduled() { Window *top_window = app_window_stack_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
flash_read_bytes(header, cursor, REGISTRY_HEADER_SIZE_BYTES)
; return memcmp(header, s_active_header, REGISTRY_HEADER_SIZE_BYTES) == 0; } static uint32_t get_next_cursor_position(uint32_t old_address, Registry* registry) { const uint32_t new_address = round_up_to_nearest_subsector(old_address + registry->total_buffer_size_bytes); const bool is_space_for_registry = ...
/* * 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...
task_to_dialogtask(xTaskGetCurrentTaskHandle())
; } void task_unregister_task(OS_TASK task) { DialogTask index = task_to_dialogtask(task); if (index >= DialogTask_Last) { return; } DialogTaskList[index] = NULL; } void task_unregister_dialogtask(DialogTask task) { if (task >= DialogTask_Last) { return; } DialogTaskList[task] = NULL; }
uint32_t write_rand = (use_rand && perform_writes) ? rand() : 0; PBL_LOG_SYNC(LOG_LEVEL_INFO, "%sChecking 0x%lx over 0x%lx 0x%lx", (perform_writes) ? "Writing and " : "", write_rand, region.begin, region.end); for (uint32_t i = region.begin; i < region.end; i += sizeof(uint32_t)) { uint32_t write...
app_timer_register(1000, app_timer_cb, NULL)
; // allow for animation to complete } else { // clean up state flash_region_erase_optimal_range(region.begin, region.begin, region.end, region.end); } } } static void stress_window_load(Window *data) { Layer *layer = window_get_root_layer(data); const int16_t width = layer->frame.size.w - ACTION_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...
(buffer, 80, "PSR = 0x%x", stacked_psr)
; //BREAKPOINT; // NOTE: If you want to get a stack trace at this point. Set a breakpoint here (you can compile in the above // BREAKPOINT call if you want) and issue the following commands in gdb: // set var $sp=<value of SP above> // set var $lr=<value of LR above> // set var $pc=<value of PC a...
/* * 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...
(quick_launch_get_app(button), data, subtitle_buf, APP_NAME_SIZE_BYTES)
; } } static void prv_draw_row_cb(SettingsCallbacks *context, GContext *ctx, const Layer *cell_layer, uint16_t row, bool selected) { QuickLaunchData *data = (QuickLaunchData *)context; PBL_ASSERTN(row < NUM_BUTTONS); const ButtonId button = s_button_order[row]; const char *title =...
_data[i].base.light = next_light++; minute_data[i].base.plugged_in = next_plugged_in; next_plugged_in = !next_plugged_in; minute_data[i].active_calories = next_active_calories++; minute_data[i].resting_calories = next_resting_calories++; minute_data[i].distance_cm = next_distance_cm++; minute_d...
(num_minutes, minute_data, false /*simulate_bg_delays*/)
; // Make sure the correct data got saved to data logging cl_assert_equal_i(s_num_dls_records, 2); for (int j = 0; j < k_num_records; j++) { cl_assert_equal_i(s_dls_records[j].hdr.version, ALG_DLS_MINUTES_RECORD_VERSION); for (int i = 0; i < ALG_MINUTES_PER_DLS_RECORD; i++) { cl_assert_equal_m(&s_d...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_WARNING, "Unrecognized version %d for file %s, removing...", file_hdr.version, name)
; pfs_close_and_remove(fd); return prv_open(file, name, flags, max_used_space); } status_t status = bootup_check(file); if (status < 0) { PBL_LOG(LOG_LEVEL_ERROR, "Bootup check failed (%"PRId32"), not good. " "Attempting to recover by deleting %s...", status, name); pfs_cl...
ui_and_respond(true /* is_granted */); // __cleanup() will do the deinit and also assert that there's no subscription to the HRM mgr. } // Test that we handle a races where a subscription/disconnection callback happens in after // deiniting the stack: void test_ble_hrm__sub_after_deinit(void) { ble_hrm_deinit();...
(true, s_bt_driver_hrm_service_is_enabled)
; } void test_ble_hrm__popup_after_long_continuous_use(void) { extern RegularTimerInfo *ble_hrm_timer(void); RegularTimerInfo *timer = ble_hrm_timer(); bt_driver_cb_hrm_service_update_subscription(s_device_a, true); prv_assert_permissions_ui_and_respond(true /* is_granted */); cl_assert_equal_b(true, regul...
* You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See...
(&p, &ctx_size, r, 5)
flash_erase_sector_blocking(test_addr); flash_erase_sector_blocking(special_case_addr); // Verify erase took place status = prv_read_verify_byte(test_addr, 0xFF, FLASH_TEST_ERR_ERASE, 0, true); VERIFY_TEST_STATUS(status); // Verify erase took place status = prv_read_verify_byte(special_case_addr, 0xFF, FL...
if (status != FLASH_TEST_SUCCESS) { stuck_at_low = true; }
} if (stuck_at_low) { // Restore data back to original if stuck at low occurred status = write_initial_pattern(false /*display_logs*/, false /*skip_base_addr*/, NULL /*base_addr*/); } VERIFY_TEST_STATUS(status); } if (stuck_at_low) { return FL...
SPRF_FIELD_DATA(field)
, SPRF_FIELD_DATA(((uint8_t *)data) + offset), field_data_size)); if (data->magic == SprfMagic_UnpopulatedEntry) { // Struct that is written is currently unpopulated. Set it up and write // the struct's Magic and Version prv_write_to_current_page(data, true); } else if ((old_crc == n...
while (!s_activity_state.started) { sys_psleep(1); } } return true; } // ------------------------------------------------------------------------------------------------ // Get info on the sleep file typedef struct { bool compact_first; uint32_t num_records; uint32_t data_bytes; uint32_t min...
activity_algorithm_metrics_changed_notification()
; // set all the step average values in the DB to 0 (except the first and last key) // The first key is set to the current_avg so that the current step average will always be at // current_avg. The last key is set to daily_avg - current_avg so that the total daily_avg will // always be at daily_avg ...
uint32_t duration, const PropertyAnimationImplementation *impl, void *subject); static void prv_handle_stop_transition(VoiceUiData *data); static void prv_voice_window_push(VoiceUiData *data); char *sy...
dialog_set_timeout(dialog, has_timeout ? ERROR_DIALOG_TIMEOUT : DIALOG_TIMEOUT_INFINITE)
; dialog_set_destroy_on_pop(dialog, false /* free_on_pop */); } static void prv_push_error_dialog(VoiceUiData *data, const char *text, uint32_t resource_id, GColor color) { prv_set_mic_window_state(data, StateError); SimpleDialog *simple_dialog = &data->short_error_dialog; simple_dialog_init(simple_dialog...
c_check(sizeof(*p)); p->device = *device; s_permissions_head = (BLEHRMSharingPermission *)list_prepend((ListNode *)s_permissions_head, (ListNode *)p); } p->permission = permission; } static HrmSharingPermission prv_get_permission_by_device(co...
(cb, NULL)
; } else { cb(NULL); } } static void prv_push_sharing_request_window_kernel_main_cb(void *ctx) { ble_hrm_push_sharing_request_window((BLEHRMSharingRequest *)ctx); } static void prv_request_sharing_permission(GAPLEConnection *const connection) { PBL_LOG(LOG_LEVEL_INFO, "Requesting BLE HRM sharing permissio...
/* * 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...
{ dst[code_idx] = code; code_idx = dst_idx++; code = 0x01; }
< num_apps; i++) { AppMenuNode *node = app_menu_data_source_get_node_at_index(&data_source, i); cl_assert_equal_i(node->install_id, app_default_order[i]); } app_menu_data_source_deinit(&data_source); } static uint16_t prv_reverse_index(AppMenuDataSource *data_source, uint16_t original_index, ...
{ // settings has to be at the beginning. The app_menu_data_source module enforces it AppInstallId app_order[] = {APP_ID_SETTINGS, APP_ID_MUSIC, APP_ID_NOTIFICATIONS, APP_ID_ALARMS, APP_ID_WATCHFACES, APP_ID_WORKOUT, BG_COUNTER_APP_ID, MENU_LAYER_APP_ID}; ...
void test_app_menu_data_source__change_order_watchfaces(void) { AppInstallId watchface_order[] = {BIG_TIME_APP_ID, APP_ID_TICTOC}; for (int i = 0; i < 10; i++) { uint8_t num_entries = ARRAY_LENGTH(watchface_order); prv_shuffle(watchface_order, num_entries); prv_test_new_order_with_filter_callback(wat...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_file_open(entry, op_flags)
, offset, data, num_bytes); } static const uint8_t *resource_storage_file_readonly_bytes_unsupported(ResourceStoreEntry *entry, bool has_privileged_access) { return NULL; } static bool resource_storage_file_find_resource(ResourceStoreEntry *entr...
c language governing permissions and * limitations under the License. */ #include "clar.h" #include "applib/graphics/gtypes.h" #include "mfg/mfg_info.h" #include "mfg/snowy/mfg_private.h" #include "flash_region/flash_region_s29vs.h" #include "fake_spi_flash.c" #include "stubs_logging.h" #include "stubs_pbl_malloc....
(mfg_info_get_rtc_freq(), 4)
; char buffer[MFG_INFO_MODEL_STRING_LENGTH] = { 0 }; mfg_info_get_model(buffer); cl_assert_equal_s(buffer, ""); cl_assert_equal_i(mfg_info_get_disp_offsets().x, 0); cl_assert_equal_i(mfg_info_get_disp_offsets().y, 0); // Set x and y offsets and make sure others don't change. mfg_info_set_disp_off...
_i(s_num_ds_notifications_received, 2); } void test_ancs__ancs_invalid_param(void) { NSNotification ns_notification = { .event_id = EventIDNotificationAdded, .event_flags = 0, .category_id = CategoryIDSocial, .category_count = 1, .uid = 0, }; const uint32_t comple_dict_uid = ((GetNotifica...
(&s_unknown_app_parsed_item)
; // Make sure both apps attributes were requested (Messages and FakeApp) cl_assert_equal_i(s_num_requested_app_attributes, 2); // Test a recognized app with a unique title prv_send_notification((uint8_t *)&s_message_dict); prv_cmp_last_received_notification(&s_message_parsed_item); // Test an unrecogniz...
ssert_equal_i(s_circle_stroke_count, 0); cl_assert_equal_p(s_stroke_points, NULL); cl_assert(prv_compare_points(&center, s_fill_points, s_path_num_points)); prv_reset(); // restore stroke color and set radius to zero - only a stroke should be drawn gdraw_command_set_stroke_color(command, GColorPurple); gdr...
prv_reset()
; gdraw_command_list_get_command(command_list, 2)->hidden = true; gdraw_command_list_draw(ctx, command_list); cl_assert_equal_i(s_path_stroke_count, 1); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_circle_stroke_count, 1); cl_assert_equal_i(s_circle_fill_count, 1); prv_reset(); gdraw_co...
if (allocated_block) { return &allocated_block->Data; } return NULL; } void heap_free(Heap* const heap, void *ptr, uintptr_t client_pc) { UTIL_ASSERT(heap->begin); if (!ptr) { // free(0) is a no-op, just bail return; } UTIL_ASSERT(heap_contains_address(heap, ptr)); // <ptr> not in range (h...
heap_unlock(heap)
; } bool heap_is_allocated(Heap* const heap, void* ptr) { bool rc = false; if (!heap_contains_address(heap, ptr)) { return rc; } HeapInfo_t *heap_info_ptr = heap->begin; // Iterate through the heap to see if this pointer is still allocated. heap_lock(heap); while (heap_info_ptr < heap->end) { i...
{ return 0; }
uint8_t gatt_client_copy_service_refs_by_discovery_generation( const BTDeviceInternal *device, BLEService services_out[], uint8_t num_services, uint8_t discovery_gen) { return 0; } void gatt_client_service_get_all_characteristics_and_descripto...
rtc_get_time(); // Send Get time response (0x01): const unsigned int response_buffer_length = 1 + 4; uint8_t response_buffer[response_buffer_length]; response_buffer[0] = 0x01; *(uint32_t*)(response_buffer + 1) = htonl(t); comm_session_send_data(session, protocol_time_endpoint_i...
(number_buffer, number_buffer_ptr, number_buffer_size - (number_buffer_ptr - number_buffer))
; return written - (number_buffer_ptr - number_buffer); } size_t clock_get_time_word(char *buffer, size_t buffer_size, time_t timestamp) { if (clock_is_24h_style()) { buffer[0] = '\0'; return 0; } else { return prv_format_time(buffer, buffer_size, i18n_noop("%p"), timestamp); } } static void prv_c...
e "mfg/mfg_serials.h" #include "mfg/snowy/mfg_private.h" #include "system/logging.h" //! Used to version this struct if we have to add additional fields in the future. #define CURRENT_DATA_VERSION 3 typedef struct { uint32_t data_version; uint32_t color; uint32_t rtc_freq; char model[MFG_INFO_MODEL_STRING_LE...
{ MfgData data = prv_fetch_struct(); return data.als_result; }
#endif
#include <bluetooth/pebble_bt.h> #include <bluetooth/pebble_pairing_service.h> #include <util/attributes.h> #include <util/math.h> #include <util/size.h> #include <util/uuid.h> // Dialog SDK #include "ble_gap.h" #include "ble_gatt.h" #include "ble_gattc.h" #include "ble_gatts.h" #include "ble_service.h" #include "bl...
connection_get_ppogatt_wa_state(conn)
; if (!state) { state = (PPoGATTWorkAroundState *)kernel_zalloc_check(sizeof(PPoGATTWorkAroundState)); connection_set_ppogatt_wa_state(conn, state); } return state; } void ppogatt_destroy_state(PPoGATTWorkAroundState *state) { if (state->pending_response_data) { kernel_free(state->pending_response_...
k control response (type=%d).", s_type); if (s_type == LinkControlTypeStatus) { prv_fatal_error_strike(); } else if (!s_profiles) { smartstrap_link_control_disconnect(); } return false; } s_strikes = 0; if (header->type == LinkControlTypeStatus) { // status message const LinkC...
accessory_bus_contention_detected()
) { PBL_LOG(LOG_LEVEL_WARNING, "Bus contention while sending status message"); // Count bus contention as a strike as it could be that the accessory is disconnected // or misbehaving. prv_fatal_error_strike(); } s_last_status_check_time = current_time; } return true; ...
3 = -27 = -3.375 * (1 << 8) num1 = (Fixed_S16_3){ .raw_value = (int16_t)((float)2.1 * (1 << FIXED_S16_3_PRECISION)) }; num2 = (Fixed_S16_3){ .raw_value = (int16_t)((float)-5.4 * (1 << FIXED_S16_3_PRECISION)) }; sum = Fixed_S16_3_add(num1, num2); sum_c = (Fixed_S16_3){ .raw_value = (int16_t)((float)-3.375 * (1 <...
(sum.raw_value == sum_c.raw_value)
; // sum = 2.1 - 5.4 = -3.3 // math is as follows: // 2.1 * (1 << 16) = 137625.6 = 137625 (drop fraction) // -5.4 * (1 << 16) = -353894.4 = -353894 (drop fraction) // 137625 - 353894 = -216269 ~= -3.3 num1 = (Fixed_S32_16){ .raw_value = (int32_t)((float)2.1 * (1 << FIXED_S32_16_PRECISION)) }; num2 = (Fix...
ine_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0); Uuid first_all_day_event = state.pin.header.id; cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[1].header.id) || uuid_equal(&state.pin.header.id, &s_all_day_items[2].he...
(&state.pin.header.id, &s_all_day_items[2].header.id)
); cl_assert(!uuid_equal(&first_all_day_event, &state.pin.header.id)); cl_assert(state.node->all_day); // yesterday's all day event cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[0].header.id)); cl_assert(!iter_next(&iterator)); } static void prv_insert_extra...
(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(0)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(1)); int new_idx; bool has_next; cl_assert(timeline_model_iter_next(&new_idx, &has_next)); c...
(timeline_model_iter_next(NULL, NULL))
on_id(recognizer) == BUTTON_ID_UP); prv_change_volume(is_volume_up); // Trigger haptic feedback only on repeat if (click_number_of_clicks_counted(recognizer) >= 2) { prv_do_haptic_feedback_vibe(context); } } static void prv_ellipsis_click_handler(ClickRecognizerRef recognizer, void *context) { MusicAppD...
layer_set_hidden(&data->length_text_layer.layer, hide_layer)
; } static void prv_unload_no_music_window(Window *window) { MusicNoMusicWindow *music_window = (MusicNoMusicWindow *)window; gbitmap_deinit(&music_window->bitmap); bitmap_layer_deinit(&music_window->bitmap_layer); text_layer_deinit(&music_window->text_layer); i18n_free_all(music_window); } static void prv_...
compare_color = data->fg_color; } else if (data->property == PROPERTY_BG_COLOR) { compare_color = data->bg_color; } else { compare = false; } for (uint8_t row = 0; row < 2; row++) { for (uint8_t color_index = row * ROW_LENGTH; color_index < (row + 1) * ROW_LENGTH; color_index++) { ...
(ctx, GColorWhite)
ll(&device), BTErrnoOK); cl_assert_equal_b(fake_gatt_is_service_discovery_running(), false); // Expect event: prv_assert_event(&device, BTErrnoOK); } void test_gatt_client_discovery__disconnected_during_discovery(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_asse...
(gatt_client_discovery_discover_all(&device), BTErrnoOK)
; // Make Bluetopia's GATT_Stop_Service_Discovery fail: // (Service discovery has finished in the mean time, disconnected, ...) fake_gatt_set_stop_return_value(BTGATT_ERROR_INVALID_PARAMETER); // Fire the watchdog timer: const TimerID watchdog_timer = bt_driver_gatt_get_watchdog_timer_id(); stub_new_timer...
vels_layer->frame.origin.y + levels_layer->bounds.origin.y; ctx->draw_state.drawing_box.size = levels_layer->bounds.size; } if (!grect_is_empty(&ctx->draw_state.clip_box)) { // call the current node's render procedure if (node->update_proc) { node->update_proc(node, ctx); } ...
{ return; }
if (child->parent->window) { window_schedule_render(child->parent->window); } Layer *node = child->parent->first_child; if (node == child) { child->parent->first_child = node->next_sibling; } else { while (node->next_sibling != child) { node = node->next_sibling; } node->next_siblin...
cl_assert_equal_i(recognizers[1]->state, RecognizerState_Failed)
; cl_assert_equal_i(recognizers[2]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[3]->state, RecognizerState_Failed); } static RecognizerState s_next_state = RecognizerStateCount; static int s_idx_to_change = -1; static void prv_handle_touch_event_test(Recognizer *recognizer, const TouchEvent *t...
dndManuallyEnabled"; prv_assert_settings_value((void*)key, strlen("dndManuallyEnabled"), (void*)&expected_value, sizeof(bool)); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Tests void test_do_not_disturb__initialize(void) { f...
(do_not_disturb_is_active() == false)
; do_not_disturb_toggle_scheduled(WeekdaySchedule); // see PBL-22011 cl_assert(do_not_disturb_is_active() == true); cl_assert(do_not_disturb_is_manually_enabled() == false); cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true); cl_assert(do_not_disturb_is_smart_dnd_enabled() == false); act...
ext_node->text, buffer_size, i18n_owner, active_window->workout_data); break; } case WorkoutMetricType_Distance: { GTextNodeText *number_text_node = health_util_create_text_node( ...
i18n_get(units_string, i18n_owner)
, units_font, TEXT_COLOR, container); units_text_node->node.offset.y = units_offset_y; #endif } break; } case WorkoutMetricType_Speed: { const size_t buffer_size = sizeof("00:00:00"); GTextNodeText *number_text_node = health_util_create_text_node(buffer_size, number_font, ...
clude "stubs_app_window_stack.h" #include "stubs_bootbits.h" #include "stubs_click.h" #include "stubs_event_service_client.h" #include "stubs_health_service.h" #include "stubs_layer.h" #include "stubs_logging.h" #include "stubs_memory_layout.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_mal...
(&s_data.window, &s_ctx)
/* * 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...
{ menu_layer_set_callbacks(menu_layer, callback_context, &(MenuLayerCallbacks) { .get_num_sections = callbacks.get_num_sections, .get_num_rows = callbacks.get_num_rows, .get_cell_height = callbacks.get_cell_height, .get_header_height = callbacks.get_header_height, .draw_row = c...
void menu_layer_legacy2_set_callbacks__deprecated(MenuLayer *menu_layer, void *callback_context, MenuLayerCallbacksLegacy2__deprecated callbacks) { menu_layer_set_callbacks(menu_layer, callback_context, &(MenuLayerCa...
board/board.h" #include "drivers/gpio.h" #include "drivers/periph_config.h" #include "drivers/rtc.h" #include "FreeRTOS.h" #include "kernel/pbl_malloc.h" #include "os/tick.h" #include "kernel/util/sleep.h" #include "kernel/util/stop.h" #include "os/mutex.h" #include "semphr.h" #include "services/common/analytics/analyt...
gpio_af_init(&bus->scl_gpio, GPIO_OType_OD, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL)
/* * 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...
(bounds.size.w / 2, bounds.size.h)
; break; case LineDirection_Diagonal: APP_LOG(APP_LOG_LEVEL_INFO, "Diagonal lines"); start = bounds.origin; end = GPoint(bounds.size.w, bounds.size.h); break; } __profiler_start(); for (uint32_t i = 0; i < num_lines; ++i) { graphics_draw_line(ctx, start, end); } __profil...
/* * 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(memcmp(new_ibeacon_ad_data->data, apple_ibeacon_ad_data->data, ad_data_size), 0)
; free(apple_ibeacon_ad_data); ble_ad_destroy(new_ibeacon_ad_data); } static BLEAdData *create_too_short_ad_data(void) { static const uint8_t too_short_ad_element[] = { 0x1a, // 26 bytes 0xff, // Manufacturer Specific AD Type 0x4c, 0x00, // Apple 0x02, // iBeacon 0x14, // Number of bytes to fol...
/* * 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_task_add_callback(erase_callback, (void *)ERASE_ALL)
; } #endif static void select_click_handler(ClickRecognizerRef recognizer, Window *window) { (void) recognizer; set_text(window, "Going down for reboot..."); system_task_add_callback(system_reset_callback, NULL); } static void down_click_handler(ClickRecognizerRef recognizer, Window *window) { (void) recogniz...
test_timer, 31, prv_sleep_timer_test_cb, (void *)(uintptr_t)count, 0); } } // Attempts to check that the Dialog chip sleep mode is working correctly by forcing wakeups at // different times. (See PBL-39777). The timeouts delays may seem a little random but I found with // this combo of values I was able to hit the i...
(fb->buffer, 0xff, FRAMEBUFFER_SIZE_BYTES)
; graphics_context_init(ctx, fb, GContextInitializationMode_App); return ctx; } void watchdog_feed(void); void command_perftest_line(const char *do_aa, const char *width) { watchdog_feed(); GContext *ctx = prv_perftest_get_context(); GColor color = { .argb = (uint8_t)0x33 }; graphics_context_set_stroke_c...
swap_layer->context); } } static void prv_refresh_next_layer(SwapLayer *swap_layer) { prv_remove_old_layout(swap_layer, swap_layer->next); LayoutLayer *new_next = prv_fetch_next_layout(swap_layer, +1); swap_layer->next = new_next; if (new_next) { const GRect *current_frame = &swap_layer->current->laye...
graphics_draw_bitmap_in_rect(ctx, &arrow_layer->arrow_bitmap, &arrow_bounds)
; } //////////////////////////////// // SWAPPING/ANIMATION FUNCTIONS //////////////////////////////// //! Returns the current offset of the notification //! Always returns a positive number. static int16_t prv_get_current_notification_offset(SwapLayer *swap_layer) { Layer *current = (Layer *)swap_layer->current; ...
); printf("{ "); for (uint32_t i = 0; i < count; i++) { printf("%d, ", indices[i]); } printf("}"); ListNode *node = *list; int list_num = list_count(node); bool failed = list_num != count; if (failed) { count = list_num; } if (!failed) { for (uint32_t i = 0; (i < count) && !failed; i++...
(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL))
; prv_compare_recognizers_processed((int[]) {0, 1}, 2, &s_recognizers_handled); // Recognizers that attached to layers other than the active layer and its ancestors will not be // processed recognizer_add_to_list(recognizers[2], &layer_a.recognizer_list); recognizer_add_to_list(recognizers[3], &layer_a.recog...
), false); } void test_music_endpoint__ignore_malformatted_messages(void) { // Android app connects: prv_receive_app_info_event(true /* is_android */); const uint8_t malformatted_artist[] = { 0x10, 14, 'o', 'n', 'e', 3, 't', 'w', 'o', 5, 't', 'h', 'r', 'e', 'e' }; const uint8_t malformatted_album[] = { ...
(true /* is_android */)
OMPATIBLE #define STM32F4_COMPATIBLE #define STM32F7_COMPATIBLE #include <mcu.h> //! Deduced by looking at the prescalers in stm32f2xx_spi.h #define SPI_FREQ_LOG_TO_PRESCALER(LG) (((LG) - 1) * 0x8) //! Bits in CR1 we intend to keep when updating it #define CR1_CLEAR_MASK ((uint16_t)0x3040) //! SPI / I2S DMA definitio...
{ bus->state->spi_clock_periph = RCC_APB2Periph_SPI6; bus->state->spi_clock_periph_speed = clocks.PCLK2_Frequency; bus->state->spi_apb = SpiAPB_2; #endif }
} static uint16_t prv_spi_find_prescaler(const SPIBus *bus) { int lg; if (bus->state->spi_clock_speed_hz > (bus->state->spi_clock_periph_speed / 2)) { lg = 1; // Underclock to the highest possible frequency } else { uint32_t divisor = bus->state->spi_clock_periph_speed / bus->state->spi_clock_speed_hz; ...
BLEService services[], uint8_t num_services, BTErrno status) { const BTDeviceAddress address = bt_device_get_address(device); char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; for (unsigned int i = 0; i < num_services; ++i) { Uuid service_uuid...
ble_central_set_connection_handler(connection_handler)
; ble_client_set_service_change_handler(service_change_handler); s_scan_window = ble_demo_scan_window_create(); window_stack_push(s_scan_window, true /* Animated */); app_event_loop(); window_destroy(s_scan_window); }
/* * 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 int direction = up ? 1 : -1; int next = current + direction; // Skip over the HR card if we don't support it #if CAPABILITY_HAS_BUILTIN_HRM if (next == Card_HrSummary && !activity_is_hrm_present()) { next = next + direction; } // if heart rate is diabled, change the order of cards to Activiy <-> ...
static void prv_select_indicator_layer_update_proc(Layer *layer, GContext *ctx) { action_button_draw(ctx, layer, SELECT_INDICATOR_COLOR); } static void prv_refresh_select_indicator(HealthCardView *health_card_view) { Layer *card_layer = health_card_view->card_layers[health_card_view->current_card_index]; cons...
{ 0, 0x1d, 0, 147, 0}, { 0, 0x1d, 0, 147, 0}, { 0, 0x1d, 0, 147, 0}, { 0, 0x1d, 0, 149, 0}, { 0, 0x1d, 0, 147, 0}, { 0, 0x1d, 0, 147, 0}, { 0, 0x1d, 0, 147, 0}, { 0, 0x1d, 0, 147, 0}, { 0, 0x1d, 0, 143, 0}, { 0, 0x1d, 0, 148, 0}, { 0, 0x1d, 0, 147, 0}, { 0, 0x1d, 0, 148, 0},...
{ 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 144, 0}, { 0, 0x8d, 0, 147, 0}, { 0, 0x8c, 0, 146, 0}, { 0, 0x8d, 0, 146, 0}, { 0, 0x8c, 0, 146, 0}, { 0, 0x8c, 0, 144, 0}, // 540: Local time: 2015-11-15 05:39:00 AM ...
{ 0, 0x24, 0, 149, 0}, { 0, 0x45, 2134, 145, 0}, // 585: Local time: 2015-11-15 06:24:00 AM { 0, 0x67, 0, 148, 0}, { 0, 0x67, 0, 149, 0}, { 0, 0x67, 0, 148, 0}, { 0, 0x67, 0, 149, 0}, { 0, 0x67, 0, 150, 0}, { 0, 0x67, 0, 149, 0}, { 0, 0x67, 0, 149, 0}, { 0, 0x67, 0, 149, 0},...
al_i(id_out, id_3); cl_assert_equal_i(type_out, BtPersistBondingTypeBLE); ret = bt_persistent_storage_has_active_bt_classic_gateway_bonding(); cl_assert(!ret); ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(ret); } void test_bluetooth_persistent_storage__test_is_faithful(void) { b...
(1, &keys_out[1])
; cl_assert_equal_m(&keys[0], &keys_out[0], sizeof(SM128BitKey)); cl_assert_equal_m(&keys[1], &keys_out[1], sizeof(SM128BitKey)); bt_persistent_storage_init(); bt_persistent_storage_get_root_key(0, &keys_out[0]); bt_persistent_storage_get_root_key(1, &keys_out[1]); cl_assert_equal_m(&keys[0], &keys_out[0]...
Recordings s_layer_mark_dirty; void layer_mark_dirty(Layer *layer) { s_layer_mark_dirty.call_count++; s_layer_mark_dirty.last_call = (MockCallRecording){.layer = layer}; } static MockCallRecordings s_graphics_context_set_fill_color; void graphics_context_set_fill_color(GContext* ctx, GColor color) { s_graphics_c...
jerry_init(JERRY_INIT_EMPTY)
; } static void prv_deinit(void) { jerry_cleanup(); rocky_runtime_context_deinit(); } void test_js__initialize(void) { fake_pbl_malloc_clear_tracking(); s_skip_mem_leak_check = false; fake_app_timer_init(); prv_init(); s_app_window_stack_get_top_window = (Window){}; s_app_state_get_graphics_context =...
/* * 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_plog_state.dls_session == NULL) { const bool buffered = true; const bool resume = false; Uuid system_uuid = UUID_SYSTEM; s_plog_state.dls_session = dls_create(DlsSystemTagProtobufLogSession, DATA_LOGGING_BYTE_ARRAY, PLOG_DLS_RECORD_SIZE, buffered, ...
return s_plog_state.dls_session; } // --------------------------------------------------------------------------------------------- // Our default transport, which sends the data over data logging static bool prv_dls_transport(uint8_t *buffer, size_t buf_size) { bool success = false; mutex_lock(s_plog_state.m...
e->sampling_rate > highest_rate) { highest_rate = state->sampling_rate; } if (state->samples_per_update > 0) { num_fifo_subscribers++; ms_per_update = state->samples_per_update * 1000 / state->sampling_rate; if (ms_per_update < lowest_ms_per_update) { lowest_ms_per_update = ms_pe...
{ int result; if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(accel_data, sizeof(*accel_data)); } analytics_inc(ANALYTICS_DEVICE_METRIC_ACCEL_PEEK_COUNT, AnalyticsClient_System); PebbleTask task = pebble_task_get_current(); if (task == PebbleTask_Worker || task == PebbleTask_App) { a...
accel_data->timestamp = accel_get_latest_timestamp(); if (accel_data->timestamp != old_timestamp_ms) { accel_get_latest_reading((AccelRawData *)accel_data); result = 0; break; } vTaskDelay(milliseconds_to_ticks(10)); } } } mutex_unlock_recursi...
eive_buffer(); s_drop_rest_of_frame = false; s_keepalive_timer = new_timer_create(); PBL_ASSERTN(s_keepalive_timer != TIMER_INVALID_ID); pulse_init(); serial_console_set_state(SERIAL_CONSOLE_STATE_PULSE); pulse_llc_send_link_opened_msg(); prv_reset_keepalive_timer(); prv_handlers_notify_state_changed...
COBS_OVERHEAD(PULSE_MAX_SEND_SIZE)
] = protocol; // Expose only the payload of the message return s_tx_buffer + COBS_OVERHEAD(PULSE_MAX_SEND_SIZE) + 1; } void pulse_best_effort_send(void *buf, const size_t payload_length) { prv_assert_tx_buffer(buf); PBL_ASSERT(payload_length <= PULSE_MAX_SEND_SIZE, "PULSE frame payload too long"); // Rewin...
/* * 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...
weather_shared_data_get_key(index)
; cl_assert_equal_i(S_SUCCESS, weather_db_read((uint8_t*)key, sizeof(WeatherDBKey), (uint8_t*)to_check, weather_shared_data_get_entry_size(index))); WeatherDBEntry ...
tocol, &s_tx_buffer->information[0], s_tx_buffer->length); prv_start_retransmit_timer(retransmit_sequence_number); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Reached maximum number of retransmit attempts."); prv_bounce_ncp_state(); } } static void prv_s...
{ ppp_control_protocol_init(PULSE2_TRAINCP); ppp_control_protocol_open(PULSE2_TRAINCP); s_tx_buffer = kernel_zalloc_check(sizeof(ReliableInfoBuffer) + pulse_reliable_max_send_size()); s_tx_lock = xSemaphoreCreateBinary(); xSemaphoreGive(s_tx_lock); }
static void prv_bounce_ncp_state(void) { ppp_control_protocol_lower_layer_is_down(PULSE2_TRAINCP); ppp_control_protocol_lower_layer_is_up(PULSE2_TRAINCP); } #endif
hs 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_line_dotted(&ctx, GPoint(0, 5), 0); graphics_draw_horizontal_l...
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, GPoint(11, 0), 3); graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4); graphics_...
alue exp_value = 0; char *agg_str; switch (agg) { case HealthAggregationSum: exp_value = 0; // error case agg_str = "sum"; break; case HealthAggregationAvg: exp_value = stats->avg; agg_str = "avg"; break; case HealthAggre...
(s_sys_activity_get_minute_history_values.in[0].utc_start, time_start)
; cl_assert_equal_i(s_sys_activity_get_minute_history_values.in[0].num_records, num_minutes_per_call); cl_assert_equal_i(s_sys_activity_get_minute_history_values.in[1].utc_start, time_start + SECONDS_PER_HOUR); cl_assert_equal_i(s_sys_activity_get_minute_history_v...
}, (GSize) { 7 * HORIZ_ADVANCE_PX + 1, FONT_HEIGHT - 1 } }, .font = (GFont) { 0 }, .overflow_mode = GTextOverflowModeWordWrap, .alignment = GTextAlignmentLeft, .max_used_size = (GSize) { 0, 0 } }; graphics_text_layout_get_max_used_size(&gcontext, "JR Whopper", font, box, GTextOverflowModeFill, GTe...
cl_assert_equal_i(layout.box.size.w, box.size.w)
1064, 816, 480}, { 968, 512, 624}, { 984, 392, 416}, { 808, 200, 240}, { 864, -64, 384}, { 1000, 96, 472}, { 1008, 424, 448}, { 984, 544, 352}, { 792, 440, 240}, { 656, 336, 64}, { 536, 232, -24}, { 592, 208, -40}, { 752, 488, -32}, { 856, 720, 56}, { 912, 680, 32...
{ -504, -272, -736}, { -512, -296, -720}, { -552, -232, -680}, { -520, -272, -784}, { -568, -112, -752}, { -552, -232, -760}, { -576, -184, -816}, { -528, -336, -744}, { -592, -320, -792}, { -512, -264, -728}, { -584, -328, -736}, { -496, -144, -720}, { -528, -272, -7...
{ -520, -200, -688}, { -456, -320, -720}, { -512, -176, -744}, { -512, -200, -776}, { -480, -216, -744}, { -504, -216, -784}, { -480, -224, -776}, { -456, -144, -800}, { -536, -232, -776}, { -568, -120, -744}, { -544, -224, -792}, { -560, -184, -824}, { -512, -192, -...
void test_health__sum_today(void) { s_sys_activity_get_metric_values.out.history[0] = 123; s_sys_activity_get_metric_values.out.history[1] = 456; HealthValue result = health_service_sum_today(HealthMetricStepCount); cl_assert_equal_i(123, result); cl_assert_equal_i(s_sys_activity_get_metric_values.in.metric,...
prv_calculate_time_range(now + 10, now + 20, NULL)
; cl_assert_equal_b(result, false); // too far in the past result = prv_calculate_time_range( now - (ACTIVITY_HISTORY_DAYS + 10) * SECONDS_PER_DAY, now - (ACTIVITY_HISTORY_DAYS + 2) * SECONDS_PER_DAY, NULL); cl_assert_equal_b(result, false); // start after end result = prv_calculate_time_range(no...
/* * 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...
task_zalloc_check(sizeof(WeatherAppWarningDialogData))
me 3 has delay 1000 ms, frame 4 and 5 have zero delay, so at time 2000 ms == frame 5 gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 2 * 1000); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5))); // Since loop only equals 1, make sure that huge elapsed time leaves us at final frame gbitmap_se...
cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5)))
; #endif } // Tests APNG file with 8-bit color, originally broke the updated upng+tinflate code // Result: // - gbitmaps matches platform decoded APNG void test_gbitmap_sequence__color_8bit_yoshi(void) { #if PLATFORM_SPALDING bool status = false; uint32_t resource_id = sys_resource_load_file_as_resource(TEST_IMA...
/* * 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...
gpio_release(DISP_GPIO)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ graphics_context_set_fill_color(ctx, highlighted_color); GCornerMask corner; switch (index) { case 0: corner = GCornerTopLeft; break; case NUM_ACTION_BAR_LEGACY2_ITEMS - 1: corner = GCornerBottomLeft; break; default: corner = GCornerNone; break; } ...
GRect icon_rect = icon->bounds; const bool clip = true; grect_align(&icon_rect, &rect, GAlignCenter, clip); const GCompOp op = (is_white != is_highlighted) ? GCompOpAssign : GCompOpAssignInverted; graphics_context_set_compositing_mode(ctx, op); graphics_draw_bitmap_in_rect(ctx, (GBi...
/* * 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...
(REBOOT_REASON_STUCK_TASK_CALLBACK, 0)
; RTC_WriteBackupRegister(REBOOT_REASON_DROPPED_EVENT, 0); } uint32_t reboot_get_slot_of_last_launched_app(void) { return RTC_ReadBackupRegister(SLOT_OF_LAST_LAUNCHED_APP); } void reboot_set_slot_of_last_launched_app(uint32_t app_slot) { RTC_WriteBackupRegister(SLOT_OF_LAST_LAUNCHED_APP, app_slot); }
+; } tz_info->dst_start = dst_start_stamps[start_idx]; tz_info->dst_end = dst_end_stamps[end_idx]; #endif // RECOVERY_FW } static void prv_clock_get_timezone_info_from_region_id( int16_t region_id, time_t utc_time, TimezoneInfo *tz_info) { #ifdef RECOVERY_FW *tz_info = (TimezoneInfo) { .dst_id = 0 }; #e...
if (clock_timezone_source_is_manual()) { prv_update_time_info_and_generate_event(&tz_data->utc_time, NULL); } else { prv_update_time_info_and_generate_event(&tz_data->utc_time, &tz_info); }
} static void prv_handle_set_time_msg(time_t new_time) { PBL_LOG(LOG_LEVEL_WARNING, "Mobile app calling deprecated API, time = %d", (int)new_time); if (clock_is_timezone_set()) { new_time = prv_migrate_local_time_to_UTC(new_time); } prv_update_time_info_and_generate_event(&new_time, NULL); } v...
GColorClear, GColorBlack)) #define CURRENT_TEXT_COLOR (PBL_IF_COLOR_ELSE(GColorVividCerulean, GColorBlack)) #define TYPICAL_TEXT_COLOR (PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite)) #define NO_DATA_TEXT_COLOR (PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack)) #define CARD_BACKGROUND_COLOR (PBL_IF_COLOR_ELSE(GColorOxfordBlue...
health_progress_bar_mark(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_end)
; #endif } } static void prv_render_progress_bar(GContext *ctx, Layer *base_layer) { HealthSleepSummaryCardData *data = layer_get_data(base_layer); // Renders the background health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_BACKGROUND_COLOR, 0, HEALTH_PROGRESS_BAR_MAX_VALU...
ics_draw_horizontal_line_dotted(&ctx, GPoint(10, 96), 5); // T facing right - even vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(50, 90), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(46, 95), 5); // T facing right - odd vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GP...
graphics_draw_line(ctx, GPoint(5, 22), GPoint(-2, 15))
; // bottom left corner } void test_graphics_draw_line__clipping_rect(void) { GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1); graphics_context_set_stroke_color(&ctx, GColorBlack); // Draw lines around boundaries of clipping...
ude "clar.h" #include "pebble_asserts.h" #include "applib/ui/menu_layer.h" #include "applib/ui/content_indicator_private.h" // Stubs ///////////////////// #include "stubs_app_state.h" #include "stubs_graphics.h" #include "stubs_heap.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h...
GRect(10, 10, height, 180)
); menu_layer_set_center_focused(&l, true); menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){ .draw_row = prv_draw_row, .get_num_rows = prv_get_num_rows, }); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(0, l.selection.y); const int16_t basic_cell_height ...
= &data->action_bar_layer; action_bar_layer_init(action_bar_layer); action_bar_layer_add_to_window(action_bar_layer, window); data->approve_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_CHECK); data->decline_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_X); action_bar_...
light_enable_interaction()
; // This timeout is 0.5s longer than the BT Spec's timeout, to decrease the chances of getting // a success confirmation right at the max allowed time of 30 secs: const uint32_t timeout_ms = (30 * 1000) + 500; data->timer = new_timer_create(); bool success = new_timer_start(data->timer, timeout_ms, prv_pair...
istic_to_find) { if (!s_ams_client) { return AMSCharacteristicInvalid; } const BLECharacteristic *characteristic = s_ams_client->characteristics; for (AMSCharacteristic id = 0; id < NumAMSCharacteristic; ++id, ++characteristic) { if (*characteristic == characteristic_to_find) { return id; } ...
if (has_error) { s_ams_client->connected = false; PBL_LOG(LOG_LEVEL_ERROR, "AMS could not (dis)connect to music service (%u)", connected); prv_analytics_log_event_with_info(AMSAnalyticsEventErrorMusicServiceConnect, connected ? 1 : 2); }
*window, WindowHandlers handlers) { window_set_window_handlers(window, &handlers); } void window_set_user_data(Window *window, void *data) { window->user_data = data; } void* window_get_user_data(const Window *window) { return window->user_data; } struct Layer* window_get_root_layer(const Window *window) { r...
{ return !window->is_unfocusable; }
const char* window_get_debug_name(Window *window) { #ifndef RELEASE return window->debug_name; #else return "?"; (void)window; #endif } // A simple wrapper so feedback can be given to developers if click config subscriptions are made from outside of the // click config configuration callback. void window_c...
MenuIndex *cell_index, void *callback_context) { #if PBL_ROUND MenuIndex selected_index = menu_layer_get_selected_index(menu_layer); bool is_selected = menu_index_compare(cell_index, &selected_index) == 0; return is_selected ? MENU_CELL_ROUND_FOCUSED_SHORT_CELL...
window_set_user_data(window, data)
; window_set_window_handlers(window, &(WindowHandlers) { .load = prv_chaining_window_load, .unload = prv_chaining_window_unload, }); window_stack_push(window_stack, window, true); }
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z " "a b c d e f g h j k l m n o p q r s t u v w x y z"; char *texts[] = { first_page_one_line, second_page_one_line, second_page_two_lines, second_page_full, third_page_one_line, third_page_two_lines, third_page_full, fourt...
graphics_draw_text(&ctx, text, &s_font_info, GRect(0, 0, 180, 1000), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, (GTextAttributes *const) &layout); cl_check(gbitmap_pbi_eq(s_dest_bitmap, namecat(namecat(__func__, "__with_orphan"), ".pbi"))); }
void test_graphics_draw_text_flow__max_used_size_draw_text_doom(void) { cl_assert(text_resources_init_font(0, RESOURCE_ID_GOTHIC_24_BOLD, 0, &s_font_info)); TextLayoutExtended layout = { .flow_data = { .perimeter.impl = &(GPerimeter){.callback = prv_perimeter_for_display_round}, .perimeter.inset ...
er)); // Lap counter data->steps_card.delta_step_layer = text_layer_create(DELTA_STEP_RECT); text_layer_set_text_alignment(data->steps_card.delta_step_layer, GTextAlignmentCenter); text_layer_set_font(data->steps_card.delta_step_layer, fonts_get_system_font(FONT_KEY_LECO_38_BOLD_NUMBERS))...
(data->results_card.text, text, sizeof(data->results_card.text))
; data->results_card.text[sizeof(data->results_card.text) - 1] = 0; text_layer_set_text(data->results_card.text_layer, data->results_card.text); layer_mark_dirty(text_layer_get_layer(data->results_card.text_layer)); } // ------------------------------------------------------------------------------- static 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...
(key, buffer, buffer_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...
(min_scl_high_ps, base_period_ps)
; // Calculate the number of extra cycles we have. const int32_t extra_cycles = total_scl_cycles - scl_low - scl_high - overhead_cycles; if (extra_cycles < 0) { // The base frequency is too slow to satisfy the target frequency, and continuing will only // get slower, so give up. return I2...