prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
int duration_a = 300; const int duration_b = 500; const int play_count_seq = 0; // Create 2 animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); // Create a sequence Animatio...
(&s_stopped_handler_calls, a)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls,...
/* * 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_set_click_config_provider(s_data.window, click_config_provider)
; window_set_window_handlers(s_data.window, (WindowHandlers) { .load = window_load, .unload = window_unload, }); const bool animated = true; window_stack_push(s_data.window, animated); } static void deinit(void) { window_destroy(s_data.window); } int main(void) { init(); app_event_loop(); dein...
/* * 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...
ARRAY_LENGTH(array)
/* * 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_calculate_incremental_start(); // First calculate the CRC of the whole words, since the hardware works 4 // bytes at a time. uint32_t* data_words = (uint32_t*) data; const unsigned int num_words = data_length / 4; crc_calculate_incremental_words(data_words, num_words); const unsigned int num_remai...
uint32_t crc_calculate_flash(uint32_t address, unsigned int num_bytes) { crc_calculate_incremental_start(); const unsigned int chunk_size = 128; uint8_t buffer[chunk_size]; while (num_bytes > chunk_size) { flash_read_bytes(buffer, address, chunk_size); crc_calculate_incremental_words((const uint32_t...
S); cl_assert(!alerts_should_enable_backlight_for_type(AlertPhoneCall)); s_dnd_active = true; alerts_set_dnd_mask(AlertMaskPhoneCalls); alerts_set_mask(AlertMaskAllOn); cl_assert(alerts_should_notify_for_type(AlertPhoneCall)); cl_assert(alerts_should_vibrate_for_type(AlertPhoneCall)); alerts_set_notific...
(AlertMaskAllOn)
; alerts_set_dnd_mask(AlertMaskAllOff); cl_assert(alerts_should_notify_for_type(AlertPhoneCall)); cl_assert(alerts_should_vibrate_for_type(AlertPhoneCall)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(alerts_should_enable_backli...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return; }
ws draw appropriately setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(6, 12), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(6, 23), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 13), 10); graphics_draw_horizontal_...
GPoint(6, 12)
, 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(6, 23), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 13), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(7, 24), 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_no_clip")))...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (PRIVILEGE_WAS_ELEVATED) { if (!list_contains(g_profiler.nodes, (ListNode *)node)) { // Instead of calling syscall_failed(), simply return. If PROFILE_INIT has not been // executed yet, there won't be any nodes in the list. return; } }
node->start = DWT->CYCCNT; } DEFINE_SYSCALL(void, sys_profiler_node_stop, ProfilerNode *node) { // Capture the cycle count as soon as possible, before we validate the node argument uint32_t dwt_cyc_cnt = DWT->CYCCNT; if (PRIVILEGE_WAS_ELEVATED) { if (!list_contains(g_profiler.nodes, (ListNode *)node)) ...
The initiating side is supposed have detected the version // incompatibility and not sent the ResetComplete (and send an Error message), but apparently // we did get the ResetComplete somehow? prv_awaiting_reset_request__enter(); return; } prv_session_open__enter(rc); } else if (dict_...
if (inbox_rcv) { inbox_rcv(it, context); } else { DBG_VERBOSE("No inbox_received handler for state %d", s_state.state); }
} static void prv_inbox_dropped(AppMessageResult reason, void *context) { // Q: We don't know what got dropped here. Should we send/initiate a ResetRequest? // A: No, a drop will be a NACK to the other side, so the other side should retry. PBL_LOG(LOG_LEVEL_WARNING, "inbox dropped msg in state %u because %u", s...
ialog->dialog.dialog; dialog_set_destroy_on_pop(dialog, false /* free_on_pop */); bt_conn_dialog_push(bt_dialog, prv_handle_bt_conn_result, data); } static uint64_t prv_get_time_ms(void) { time_t now_s; uint16_t now_ms; sys_get_time_ms(&now_s, &now_ms); uint64_t ms = (now_s * 1000) + now_ms; return ms; ...
VOICE_LOG("No speech detected! Exiting...")
th = 1, .fill_color = GColorBlue, .path_open = false, .num_points = 2, }; GPoint points1[] = { { 3, 97 }, {5, 5} }; memcpy(command_list->commands[0].points, points1, sizeof(points1)); command = gdraw_command_list_get_command(command_list, 1); *command = (GDrawCommand) { .type = GDrawCommandTy...
free(command_list)
; } void test_gdraw_command__validate_image(void) { size_t size = sizeof(GDrawCommandImage) + (3 * sizeof(GDrawCommand)) + (sizeof(GPoint) * 6); GDrawCommandImage *image = malloc(size); GDrawCommandList *command_list = prv_create_command_list_3(); memcpy(&image->command_list, command_list, sizeof(GDrawC...
r->number.text_layer, layer_bounds.size); const GSize number_size = text_layer_get_content_size(ctx, &peek_layer->number.text_layer); const GSize title_size = text_layer_get_content_size(ctx, &peek_layer->title.text_layer); const GSize subtitle_size = text_layer_get_content_size(ctx, &peek_layer->subtitle.text_l...
(peek_layer->hidden_fields_timer)
; peek_layer->hidden_fields_timer = EVENTED_TIMER_INVALID_ID; kino_layer_deinit(&peek_layer->kino_layer); text_layer_deinit(&peek_layer->title.text_layer); text_layer_deinit(&peek_layer->number.text_layer); text_layer_deinit(&peek_layer->subtitle.text_layer); layer_deinit(&peek_layer->layer); } void peek_l...
/* * 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...
(&word_iter)
); cl_assert(word_iter_state.current.width_px == 0); } void test_word_iterator__test_unprintable(void) { // Allocate mutable types Iterator word_iter = (Iterator) { 0 }; WordIterState word_iter_state = (WordIterState) { 0 }; // Allocate immutable types bool success = false; const Utf8Bounds utf8_bounds ...
_BYTES_CMD_OBJECT_INFO, .hdr.transaction_id = transaction_id, .error_code = result, .num_bytes = htonl(0), }; bool success = comm_session_send_data(session, GET_BYTES_ENDPOINT_ID, (const uint8_t *) &rsp, ...
(state->num_bytes)
, }; comm_session_send_buffer_write(sb, (const uint8_t *) &rsp, sizeof(rsp)); state->sent_header = true; } comm_session_send_buffer_end_write(sb); if (state->storage.current_offset >= state->num_bytes) { prv_gather_and_record_stats(state); // If all done, mark the image as "read" and free up...
{ BTErrno e = gap_le_connect_connect_by_bonding(~0, true /* auto_reconnect */, false /* is_pairing_required */, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoInvalidParamet...
gap_le_connect_has_connection_intent(&device, GAPLEClientApp)
; cl_assert_equal_b(registered, true); registered = gap_le_connect_has_connection_intent(&device, GAPLEClientKernel); cl_assert_equal_b(registered, true); // Only one registration (co-owned by the 2 clients): cl_assert_equal_i(gap_le_connect_connection_intents_count(), 1); } void test_gap_le_connect__unregi...
luetoothWatchdog); } prv_unlock(); } static void prv_trigger_core_dump_from_isr(void) { bool should_context_switch; s_spi_transport.state = SPITransportState_CoreDump; prv_give_semamphore_from_isr(&should_context_switch); } #if !defined(DIALOG_TIMER_IRQ_HANDLER) #error "DIALOG_TIMER_IRQ_HANDLER must be defi...
(NULL, &s_spi_transport.rx_footer, sizeof(s_spi_transport.rx_footer), prv_handle_receiving_footer_complete_isr)
; } static void prv_handle_status_exchange_complete_isr(bool *should_context_switch) { uint32_t crc = crc32(CRC32_INIT, &s_spi_transport.status_remote, sizeof(s_spi_transport.status_remote)); if (crc != CRC32_RESIDUE) { PBL_LOG(LOG_LEVEL_ERROR, "CRC failed on remote SPITransportMsgStatus...
_t *evt) { PBL_LOG(LOG_LEVEL_DEBUG, "Received pairing request."); const uint16_t conn_idx = evt->conn_idx; Connection *conn = connection_by_idx(conn_idx); if (conn == NULL) { PBL_LOG(LOG_LEVEL_ERROR, "No connection for idx=%d", conn_idx); return; } BTDeviceInternal device = {}; connection_get_ad...
memcpy(&own_addr.addr, addr, sizeof(own_addr.addr))
; e = ble_gap_address_set(&own_addr, 0); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_address_set: %u", e); } #endif e = ble_gap_mtu_size_set(ATT_MAX_SUPPORTED_MTU); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_mtu_size_set: %u", e); } e = ble_gap_role_set(GAP_PERI...
/* * 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)
); } static uint32_t resource_storage_file_get_crc(ResourceStoreEntry *entry, uint32_t num_bytes, uint32_t entry_offset) { const uint8_t op_flags = OP_FLAG_READ; return prv_file_common_get_crc(prv_file_open(entry, op_flags), num_bytes, entry_offset); } static uint32_t...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
mutex_unlock_recursive(mutex)
; mutex_unlock_recursive(mutex); mutex_unlock_recursive(mutex); cl_assert_equal_b(fake_mutex_all_unlocked(), true); } void test_fake_mutex__recursive_mismatched_counts(void) { PebbleRecursiveMutex *mutex = mutex_create_recursive(); mutex_lock_recursive(mutex); mutex_lock_recursive(mutex); mutex_unlock_re...
V14_CUR_LIM_MIN, 0x4); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_ENABLE_HV, 0x1); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_ENABLE_LV, 0x1); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_CUR_LIM_MAX_LV, 0x6); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_IDLE_HYST, 0x4); REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_IDLE_MIN, 0x1...
(DCDC, DCDC_IRQ_MASK_REG, DCDC_VDD_TIMEOUT_IRQ_MASK, 0x0)
; REG_SETF(DCDC, DCDC_IRQ_MASK_REG, DCDC_V18_TIMEOUT_IRQ_MASK, 0x0); REG_SETF(DCDC, DCDC_IRQ_MASK_REG, DCDC_V14_TIMEOUT_IRQ_MASK, 0x0); // CRG_TOP REG_SETF(CRG_TOP, BANDGAP_REG, BYPASS_COLD_BOOT_DISABLE, 0x0); REG_SETF(CRG_TOP, BANDGAP_REG, LDO_SLEEP_TRIM, 0x0); REG_SETF(CRG_TOP, BANDGAP_REG, BGR_ITRIM, 0...
d = (uintptr_t) data; const GAPLEConnection *connection = (const GAPLEConnection *) found_node; return (connection->gatt_connection_id == connection_id); } static GAPLEConnection * prv_find_connection_by_gatt_id(uintptr_t connection_id) { return (GAPLEConnection *) list_find(&s_connections->node, ...
gatt_client_discovery_cleanup_by_connection(connection, BTErrnoServiceDiscoveryDisconnected)
; gatt_client_subscriptions_cleanup_by_connection(connection, false /* should_unsubscribe */); gatt_client_cleanup_discovery_jobs(connection); list_remove(&connection->node, (ListNode **) &s_connections, NULL); bt_conn_mgr_info_deinit(&connection->conn_mgr_info); kernel_free(connection->connection_parameter_...
't need to worry about being blocked return; } mutex_lock_recursive(s_blocked_lock); } static void prv_unlock(void) { if (mcu_state_is_isr()) { // assume we're in an ISR for the UART and don't need to worry about being blocked return; } mutex_unlock_recursive(s_blocked_lock); } static void prv_e...
{ periph_config_acquire_lock(); gpio_output_init(&BOARD_CONFIG_ACCESSORY.power_en, GPIO_OType_PP, GPIO_Speed_2MHz); gpio_output_set(&BOARD_CONFIG_ACCESSORY.power_en, false); // Turn power off accessory_set_baudrate(DEFAULT_BAUD); periph_config_release_lock(); prv_initialize_exti(); }
static void prv_set_baudrate(uint32_t baudrate, bool force_update) { if ((baudrate != s_baudrate) || force_update) { PBL_LOG(LOG_LEVEL_DEBUG, "Changing accessory connector baud rate to %"PRIu32, baudrate); prv_initialize_uart(baudrate); if (s_dma_enabled) { // we need to reset DMA after resetting ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_destroy(window)
; } int main(void) { init(); app_event_loop(); deinit(); }
ut of b and c Animation *c = prv_create_test_animation(); Animation *spawn = animation_spawn_create(c, b, NULL); cl_assert(spawn == NULL); // We should be able to create one out of c and d Animation *d = prv_create_test_animation(); spawn = animation_spawn_create(c, d, NULL); cl_assert(spawn != NULL); ...
(h, &elapsed_ms)
); cl_assert_equal_i(elapsed_ms, duration / 2); cl_must_pass(animation_get_progress(h, &progress)); cl_assert_equal_i(progress, 32768); // Rounding occurs within, this is close to MAX / 2 animation_destroy(h); #endif } void test_animation__completed(void) { #ifdef TEST_INCLUDE_BASIC const int duration_a = ...
(inbox->event_handler_task, &event)
; if (!is_event_enqueued) { PBL_LOG(LOG_LEVEL_ERROR, "Event queue full"); } inbox->has_pending_event = is_event_enqueued; } static void prv_mark_failed_if_no_writer(AppInboxNode *inbox) { if (!inbox->writer) { // See PBL-41464 // App message has been reset (closed and opened again) while a message ...
lineItemAction *action = item->action_data; // Record action in the analytics if (action->type == TimelineItemActionTypeOpenWatchApp) { analytics_event_pin_app_launch(pin->header.timestamp, &pin->header.parent_id); } else { Uuid app_uuid; timeline_get_originator_id(pin, &app_uuid); analytics_even...
(FirstUseSourceDismiss)
) { return; } const char* tutorial_msg = i18n_get("Quickly dismiss all notifications by holding the " \ "Select button for 2 seconds from any incoming " \ "notification.", action_menu); ExpandableDialog *first_use_dialog = expandabl...
{ SettingsFile file; status_t rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE); if (rv != S_SUCCESS) { goto unlock; } exists = settings_file_exists(&file, (uint8_t *)&app_id, sizeof(AppInstallId)); if (exists && !app_storage_app_exists(app_id)) { settings_fil...
unlock: mutex_unlock_recursive(s_app_cache_mutex); return exists; } //! Removes an entry with the given AppInstallId from the cache status_t app_cache_remove_entry(AppInstallId app_id) { status_t rv; mutex_lock_recursive(s_app_cache_mutex); { SettingsFile file; rv = settings_file_open(&file, APP_CAC...
6}, { 784, 456, 344}, { 800, 488, 272}, { 752, 552, 288}, { 736, 592, 328}, { 784, 568, 344}, { 800, 536, 392}, { 832, 536, 456}, { 856, 632, 432}, { 872, 728, 552}, { 1016, 848, 568}, { 944, 760, 512}, { 888, 456, 464}, { 800, 288, 320}, { 792, -16, 304}, { 1...
{ 784, 832, 600}, { 736, 552, 520}, { 776, 344, 416}, { 760, 360, 440}, { 760, 432, 432}, { 792, 528, 360}, { 800, 560, 256}, { 728, 576, 280}, { 728, 552, 360}, { 784, 512, 368}, { 816, 456, 416}, { 872, 504, 464}, { 832, 544, 432}, { 920, 624, 464}, { 800, 8...
, 280, -832}, { 304, 280, -840}, { 312, 288, -840}, { 304, 280, -832}, { 312, 288, -840}, { 312, 288, -840}, { 312, 288, -840}, { 312, 272, -832}, { 312, 280, -840}, { 312, 272, -832}, { 304, 280, -840}, { 312, 280, -832}, { 304, 280, -832}, { 312, 280, -848}, { 3...
{ 480, 96, -808}, { 480, 96, -816}, { 480, 88, -816}, // 78 seconds { 472, 96, -808}, { 480, 88, -800}, { 480, 96, -808}, { 480, 88, -808}, { 480, 80, -816}, { 480, 88, -808}, { 472, 88, -808}, { 480, 88, -808}, { 480, 72, -824}, { 488, 80, -808}, { 472, 72, -...
{ 488, 48, -808}, { 488, 56, -816}, { 488, 56, -816}, { 480, 56, -816}, { 488, 56, -816}, { 480, 48, -800}, { 488, 72, -808}, { 488, 72, -800}, // 81 seconds { 488, 72, -808}, { 488, 64, -808}, { 488, 64, -808}, { 488, 72, -808}, { 480, 72, -816}, { 488, 80, ...
&selection_clipper); grect_clip((GRect *const)&ctx->draw_state.clip_box, &selection_clipper); // Render with highlight prv_prepare_and_draw_row(ctx, menu_layer, cell_layer, cursor, true); } // Restore current drawing state: graphics_context_set_drawing_state(ctx, prev_state); } static inline void p...
prv_menu_layer_get_num_rows(it->menu_layer, it->cursor.index.section)
; for (;;) { // rows if (it->cursor.index.row >= num_rows_in_section) { // Reached last row break; } if (it->row_callback_before_geometry) { it->row_callback_before_geometry(it); } it->cursor.h = prv_menu_layer_get_cell_height(it->menu_layer, &it->cursor.index...
tentIndicatorDirectionDown]); menu_layer_set_selected_index(&l, MenuIndex(0, 1), MenuRowAlignNone, false); cl_assert_equal_i(1 * NORMAL, l.selection.y); cl_assert_equal_i(2 * NORMAL - FOCUSED, scroll_layer_get_content_offset(&l.scroll_layer).y); cl_assert_equal_i(FOCUSED, l.selection.h); cl_assert_equal_b(fa...
(0 * basic_cell_height, l.selection.y)
; cl_assert_equal_i(initial_scroll_offset, l.scroll_layer.content_sublayer.bounds.origin.y); // and updated impl->update(l.animation.animation, ANIMATION_NORMALIZED_MAX * 9 / 10); cl_assert_equal_i(2, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(2 * basic_cell_height, l.selection.y); cl_assert...
opy 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 the License for the...
cl_assert_equal_i(end.ds_label, 'S')
; cl_assert_equal_i(end.month, 10); cl_assert_equal_i(end.mday, 1); cl_assert_equal_i(end.hour, 2); } void test_timezone_database__kazakhstan(void) { { const int almaty_region = FIND_REGION("Asia/Almaty"); TimezoneInfo tz_info; bool result = timezone_database_load_region_info(almaty_region, &tz_in...
ns; for (uint32_t i = 0; i < state->activity_sessions_count; i++, session++) { // Get info on this activity uint32_t session_len_sec = session->length_min * SECONDS_PER_MINUTE; time_t session_exit_utc = session->start_utc + session_len_sec; ActivityClassParams *params = NULL; switch (session->typ...
{ if (!memcmp(session, &null_session, sizeof(null_session))) { // Empty session detected, we are done break; } if (!prv_is_valid_activity_session(session)) { // NOTE: We check for full validity as well as we can (rather than just checking for a // non-null activity start time for exa...
// Remove any activities that don't belong to "today" or that are ongoing activity_sessions_prv_remove_out_of_range_activity_sessions(utc_now, true /*remove_ongoing*/); PBL_LOG(LOG_LEVEL_INFO, "Restored %"PRIu16" activities from storage", state->activity_sessions_count); } // ----------------------...
_STARTED_COMPLETE = true; shared_prf_storage_set_getting_started_complete(GETTING_STARTED_COMPLETE); cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 0); SharedPRFData data; flash_read_bytes((uint8_t *)&data, SPRF_PAGE_FLASH_OFFSET(shared_prf_storage_get_valid_page_number()), ...
{ shared_prf_storage_store_ble_pairing_data(&PAIRING_INFO, NULL, true /* requires_address_pinning */, true /* auto_accept_re_pairing */); shared_prf_storage_store_ble_pairing_data(&PAIRING_INFO, DEVICE_NAME, ...
// Test that when deleting the ble_data, both the data and name are deleted. // Test that when rewriting the ble_data, the same page is used (since they were previously // marked with 0xFF's void test_shared_prf_storage_v3__write_ble_data_name_delete_rewrite(void) { shared_prf_storage_store_ble_pairing_data(&PAIRIN...
/* * 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 (config) { AttributeList list; attribute_list_init_list(0 /* num_attributes */, &list); attribute_list_add_cstring(&list, AttributeIdTitle, config->title); if (config->subtitle) { attribute_list_add_cstring(&list, AttributeIdSubtitle, config->subtitle); } attribute_list_add_uint32(&list...
if (item) { pin_db_insert_item(item); timeline_item_destroy(item); } } static void prv_create_list_view_and_render(ListViewConfig *config) { pin_db_init(); for (int i = 0; i < (int)ARRAY_LENGTH(config->pins); i++) { if (config->pins[i]) { prv_add_timeline_item(config->pins[i], config->past)...
define STM32F7_COMPATIBLE #include <mcu.h> #include "FreeRTOS.h" #include "semphr.h" #define MAX_VOLUME (256) #define LFSR_SEED (0x3AEF) static bool prv_dma_handler(DMARequest *request, void *context, bool is_complete); static void prv_enable_clocks(MicDevice *this) { // Enable the device clocks periph_config_a...
DFSDM_ConfigClkOutputSource(DFSDM_ClkOutSource_SysClock)
; DFSDM_ConfigClkOutputDivider(prescaler); DFSDM_SelectRegularChannel(this->filter, this->regular_channel); DFSDM_FastModeCmd(this->filter, ENABLE); } // must have initialized both the DFSDM and DMA static void prv_dfsdm_enable(MicDevice *this) { // Enable DFSDM and DMA DFSDM_Cmd(ENABLE); DFSDM_ChannelCm...
/* * 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_test_cache, s_test_data[index].key, &s_test_data[index].item)
empt to reconnect once: if (bt_ctl_is_airplane_mode_on() == false) { bt_driver_reconnect_try_now(true /*ignore_paused*/); } } static void settings_bluetooth_toggle_airplane_mode(SettingsBluetoothData* data) { const bool airplane_mode = bt_ctl_is_airplane_mode_on(); bt_ctl_set_airplane_mode_async(!airplane_...
if (remote) { // The remote is also a ble device, promote to a dual remote const bool classic_connected = remote->classic.connected; remote->type = StoredRemoteTypeBTDual; remote->dual.classic.connected = classic_connected; // Note: We update remote->dual.ble.connected outside this cb remote->du...
} //! This must be called after updating classic remotes for remote consolidation static void prv_add_and_merge_ble_remotes(SettingsBluetoothData *data) { bt_persistent_storage_for_each_ble_pairing(prv_add_and_merge_ble_remote, data); StoredRemote *remote = (StoredRemote *)data->remote_list_head; while (remote...
/* * 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...
(&t, NULL)
id); struct PACKED { uint8_t command; uint8_t session_id; } msg = { .command = DataLoggingEndpointCmdTimeout, .session_id = logging_session->comm.session_id, }; comm_session_send_data(session, ENDPOINT_ID_DATA_LOGGING, (uint8_t *)&msg, sizeof(msg), COMM_SESSION_DEFAULT...
PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Message type 0x%x not recognized", message[0])
; } } bool dls_endpoint_open_session(DataLoggingSession *session) { CommSession *comm_session = comm_session_get_system_session(); if (!session) { return false; } DataLoggingOpenSessionMessage msg = { .command = DataLoggingEndpointCmdOpen, .session_id = session->comm.session_id, .app_uuid = ...
-216}, // 18 seconds { 1272, 144, -112}, { 1392, 112, -80}, { 1344, 216, -168}, { 1320, 288, -336}, { 1256, 136, -248}, { 936, 112, -168}, { 704, 288, -240}, { 576, 376, -232}, { 560, 376, -160}, { 648, 448, -224}, { 776, 536, -264}, { 760, 680, -328}, { 952, 672...
{ 816, 208, -112}, { 808, 152, -56}, { 872, 120, -80}, { 912, 104, -88}, { 904, 128, -184}, { 1072, 88, -328}, { 1104, 96, -184}, { 1128, 152, -296}, { 1264, 240, -280}, { 1312, 232, -224}, { 1088, 304, -248}, { 864, 392, -304}, { 744, 424, -264}, { 744, 448, -264...
{ 1224, 48, -192}, { 888, 152, -328}, { 696, 256, -376}, { 640, 176, -304}, { 608, 136, -336}, { 752, 248, -384}, { 904, 408, -440}, { 872, 352, -416}, { 816, 432, -424}, { 872, 440, -344}, { 920, 504, -184}, { 1208, 696, -176}, { 1232, 896, -312}, { 1504, 896, -...
_cccd_write(BLEGATTError error) { gatt_client_subscriptions_handle_write_cccd_response(s_last_cccd_ref, error); } // Tests /////////////////////////////////////////////////////////// void test_gatt_client_subscriptions__initialize(void) { s_write_descriptor_cccd_result = BTErrnoOK; fake_pbl_malloc_clear_tracki...
{ BTErrno e; BLECharacteristic characteristic = prv_get_indicatable_characteristic(); e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClientKernel); cl_assert_equal_i(e, BTErrnoOK); fake_event_clear_last(); fake_ker...
void test_gatt_client_subscriptions__unsubscribe_pending_subscription(void) { BTErrno e; BLECharacteristic characteristic = prv_get_indicatable_characteristic(); e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClientKernel); c...
OSTMESSAGE_PROTOCOL_MAX_VERSION + 1, .max_supported_version = POSTMESSAGE_PROTOCOL_MAX_VERSION + 1, .max_tx_chunk_size = POSTMESSAGE_PROTOCOL_MAX_TX_CHUNK_SIZE, .max_rx_chunk_size = POSTMESSAGE_PROTOCOL_MAX_RX_CHUNK_SIZE, }; RCV_APP_MESSAGE(TupletBytes(PostMessageKeyResetComplete, ...
(rocky_api_app_message_get_state(), PostMessageStateSessionOpen)
; } void test_rocky_api_app_message__session_open__rcv_reset_request(void) { prv_init_and_goto_session_open(); EXECUTE_SCRIPT("var isCalled = false;" "_rocky.on('postmessagedisconnected', function() { isCalled = true; });"); ASSERT_JS_GLOBAL_EQUALS_B("isCalled", false); RCV_RESET_REQUEST();...
ows_in_section - 1 || it->cursor.index.section < num_sections - 1) { it->cursor.y += it->cursor.sep; } ++(it->cursor.index.row); } // for() rows // Next section: ++(it->cursor.index.section); if (it->cursor.index.section >= num_sections) { break; // Reached last section ...
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_drawing_state(ctx, prev_state); } void menu_layer_update_proc(Layer *scroll_content_layer, GContext* ctx) { MenuLayer *menu_layer = (MenuLayer*)(((uint8_t*)scroll_content_layer) - offsetof(MenuLayer, scroll_layer.content_sublayer)); const GSize frame_size = menu_layer->scroll_layer.l...
/* * 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_find_whitelist_entry(&model)
; // Already present if (e) { ++s_whitelist_error_count; return -1; } } WhitelistEntry *e = (WhitelistEntry *) malloc(sizeof(WhitelistEntry)); *e = (const WhitelistEntry) { .Address_Type = Address_Type, .Address = Address, }; s_head = (WhitelistEntry *) list_prepend(&s_head->n...
internal.h" #include "system/logging.h" #include "system/passert.h" #include "system/profiler.h" #include "util/uuid.h" #include <string.h> #define SPEEX_BITSTREAM_VERSION (4) #define TIMEOUT_SESSION_SETUP (8000) #define TIMEOUT_SESSION_RESULT (15000) #define VOICE_LOG(fmt, args...) PBL_LOG_D(LOG_DOMAIN_VOICE, L...
PBL_ASSERTN((s_state == SessionState_VoiceEndpointSetupReceived || s_state == SessionState_AudioEndpointSetupReceived) && (transition_to_state != s_state))
; s_state = SessionState_Recording; new_timer_stop(s_timeout); // Indicate to the UI that we have started recording PBL_LOG(LOG_LEVEL_INFO, "Session setup successfully"); prv_send_event(VoiceEventTypeSessionSetup, VoiceStatusSuccess, NULL); prv_start_recording(); } } static void prv_audio_...
register_address, uint8_t value) { i2c_use(I2C_DEVICE_AS3701B); bool rv = i2c_write_register(I2C_DEVICE_AS3701B, AS3701B_WRITE_ADDR, register_address, value); i2c_release(I2C_DEVICE_AS3701B); return rv; } static bool prv_register_set_bit(uint8_t register_address, uint8_t bit) { uint8_t val; if (!prv_read_r...
prv_write_register(PmicRegisters_INT_MASK_2, 0xff)
; // Clear interrupt status so we're not woken immediately (read the regs) prv_clear_pending_interrupts(); // Set Reg_Standby_mod1 to specify which rails to turn off / keep on // - SD1, LDO1 off // - LDO2 on // - Disable regulator pulldowns prv_write_register(PmicRegisters_REG_STANDBY_MOD1, 0xa); ...
/* * 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_prev_send_data_bytes = 0; }
} } // ---------------------------------------------------------------------------------------- // Setup static void prv_init_fake_flash(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(false /* write erase headers */); PBL_LOG(LOG_LEVEL_INFO, "\nFile system size: %d, avail: %d", (in...
-------------------------------------------------------------------------------------------- static bool prv_characteristic_filter_callback(ListNode *found_node, void *data) { const PPoGATTClient *client = (const PPoGATTClient *) found_node; const BLECharacteristic characteristic = (const BLECharacteristic) data; ...
{ // Set our desired window sizes // // Note: as of PBL-38806 (which is in Android 4.0), the Android app will negotiate the MTU size // before starting up a PPoG session so we can use this info to dynamically change the window // size. The iOS app has no control over when the MTU size is negotiated ...
MIN(PPOGATT_V1_DESIRED_RX_WINDOW_SIZE, PPOGATT_SN_MOD_DIV - 1); client->out.rx_window_size = desired_rx_window; } else { client->out.tx_window_size = client->out.rx_window_size = PPOGATT_V0_WINDOW_SIZE; } if (self_initiated) { client->out.reset_packet_to_send.type = PPoGATTPacketTypeResetReq...
OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "kernel/pulse_logging.h" // How many bytes are in a log message before the actual message content in pulse log messages const ...
pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTest")
l prv_dummy_device(uint8_t octet) { BTDeviceAddress address = { .octets = { [0] = octet, [1] = octet, [2] = octet, [3] = octet, [4] = octet, [5] = octet, }, }; BTDevice device = bt_device_init_with_address(address, true /* is_random */); return *(BTDeviceInternal *)(&...
(characteristic_ref)
, service_ref); // Test gatt_client_characteristic_get_device(): BTDeviceInternal returned_device = gatt_client_characteristic_get_device(characteristic_ref); cl_assert(bt_device_equal(&returned_device.opaque, &device.opaque)); // Test gatt_client_characteristic_get_descriptors(): const ...
{ HealthAPITestAppData *data = malloc(sizeof(HealthAPITestAppData)); s_data = data; memset(data, 0, sizeof(HealthAPITestAppData)); data->steps_offset = 0; // Create our windows // Steps window data->steps_window = window_create(); window_set_background_color(data->steps_window, GColorBlack); window_...
window_set_click_config_provider_with_context(data->results_window, results_click_config_provider, data); window_set_window_handlers(data->results_window, (WindowHandlers) { .load = results_window_load, .unload = results_window_unload, }); // Heart rate ...
(LAUNCHER_MENU_LAYER_TITLE_FONT)
; launcher_menu_layer->subtitle_font = fonts_get_system_font(LAUNCHER_MENU_LAYER_SUBTITLE_FONT); Layer *container_layer = &launcher_menu_layer->container_layer; layer_init(container_layer, &frame); launcher_menu_layer->data_source = data_source; GRect menu_layer_frame = frame; #if PBL_ROUND const int top...
{ spi_ll_slave_acquire(slave); spi_ll_slave_scs_assert(slave); } static void prv_spi_release_helper(const SPISlavePort *slave) { spi_ll_slave_scs_deassert(slave); spi_ll_slave_release(slave); } uint8_t spi_slave_read_write(const SPISlavePort *slave, uint8_t out) { prv_spi_acquire_helper(slave); uint8_t re...
(slave->slave_state->acquired)
= 11, .tm_mday = 5, .tm_mon = 4, .tm_year = 115, .tm_wday = 2, .tm_yday = 124, .tm_isdst = 1 }; static struct tm bad_data = { .tm_sec = 49756567, .tm_min = 49756567, .tm_hour = 49756567, .tm_mday = 49756567, .tm_mon = 49756567, .tm_year = 49756567, .tm_wday = 49756567, .tm_yday = 49756567,...
(APP_LOG_LEVEL_DEBUG, "Error with \"S\": %s", buf)
; } r = strftime(buf, buf_size, "%T", &good_data); if (r == 0 || strncmp(buf, "11:04:49", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"T\": %s", buf); } r = strftime(buf, buf_size, "%u", &good_data); if (r == 0 || strncmp(buf, "2", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Er...
HRMFeature_BPM); if (hrm_session == HRM_INVALID_SESSION_REF) { PBL_LOG(LOG_LEVEL_ERROR, "Error subscribing"); return false; } return true; #endif } // ---------------------------------------------------------------------------------------------- uint16_t...
if (callback == NULL || activity_mask == HealthActivityNone) { return; }
uint32_t num_sessions = ARRAY_LENGTH(state->cache->sessions); if (!sys_activity_get_sessions(&num_sessions, state->cache->sessions)) { return; } const uint32_t actual_num_sessions = MIN(num_sessions, ARRAY_LENGTH(state->cache->sessions)); prv_sessions_sort(state->cache->sessions, actual_num_sessions, 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...
gbitmap_get_bounds(sequence_reel->render_bitmap)
; bounds.origin = gpoint_add(bounds.origin, offset); // Save compositing mode GCompOp prev_compositing_mode = ctx->draw_state.compositing_mode; graphics_context_set_compositing_mode(ctx, GCompOpSet); // Enable compositing graphics_draw_bitmap_in_rect_processed(ctx, sequence_reel->render_bitmap, &bounds, ...
{ 992, 760, 120}, // 68 seconds { 1152, 272, 96}, { 1120, 320, -16}, { 1104, 392, -40}, { 1168, 376, 48}, { 1464, 312, 72}, { 1432, 232, 40}, { 1336, 128, 128}, { 1320, 8, 144}, { 1248, -16, 96}, { 1112, 16, 64}, { 936, 32, 72}, { 1096, 16, 104}, { 1024, 0, 9...
{ 1024, 368, 16}, { 1136, 528, 8}, { 1120, 480, -16}, { 1232, 352, 120}, { 1528, 304, 112}, { 1456, 208, 128}, { 1344, 80, 176}, { 1400, -16, 128}, // 74 seconds { 1392, -32, 8}, { 1200, 48, -112}, { 952, 16, -120}, { 872, -112, -48}, { 712, -224, -8}, { 504, ...
{ 536, -128, -112}, { 936, -104, -8}, { 1240, 32, 8}, { 1392, 160, -152}, { 1608, 184, -192}, { 1520, 144, -72}, { 1032, 144, -64}, { 872, 80, -80}, { 1040, 168, -88}, { 1144, 168, -24}, { 1168, 224, -32}, { 1016, 296, -64}, { 1000, 312, 0}, { 1200, 488, 40}, ...
vent *event, void *context) { if (s_num_cb_events_1 >= ARRAY_LENGTH(s_cb_events_1)) { return; } s_cb_events_1[s_num_cb_events_1++] = *event; } static PebbleHRMEvent s_cb_events_2[16]; static int s_num_cb_events_2 = 0; static void prv_fake_hrm_2_cb(PebbleHRMEvent *event, void *context) { if (s_num_cb_events...
(ret_expire_s, HRM_MANAGER_APP_EXIT_EXPIRATION_SEC)
; sys_hrm_manager_unsubscribe(session_ref); } // Test that app subscriptions expire correctly void test_hrm_manager__app_expiration(void) { AppInstallId app_id = 1; const uint16_t expire_s = SECONDS_PER_MINUTE; HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, 1, expire_s, HRMFeature_BPM); ...
SETTINGS_KEY_MAX_LEN) { return E_RANGE; } // Find the record settings_raw_iter_resume(&file->iter); if (!search_forward(&file->iter, key, key_len) || file->iter.hdr.val_len == 0) { return E_DOES_NOT_EXIST; } PBL_ASSERTN(offset < file->iter.hdr.val_len); settings_raw_iter_write_byte(&file->...
(file, key, key_len, NULL, 0)
; } static void prv_get_key(SettingsFile *file, void *key, size_t key_len) { PBL_ASSERTN(key_len <= file->iter.hdr.key_len); settings_raw_iter_set_current_record_pos(&file->iter, file->cur_record_pos); settings_raw_iter_read_key(&file->iter, key); } static void prv_get_val(SettingsFile *file, void *val, size_t v...
unds = layer_get_bounds(window_layer); data->sleep_card.text_layer = text_layer_create(root_bounds); text_layer_set_text_alignment(data->sleep_card.text_layer, GTextAlignmentCenter); text_layer_set_background_color(data->sleep_card.text_layer, GColorClear); text_layer_set_font(data->sleep_card.text_layer, ...
{ snprintf(data->steps_card.delta_step_text, sizeof(data->steps_card.delta_step_text), "%d", (int) (data->cur_steps - data->lap_steps)); text_layer_set_text(data->steps_card.delta_step_layer, data->steps_card.delta_step_text); }
} } // ------------------------------------------------------------------------------- static void prv_health_event_handler(HealthEventType event, void *context) { HealthAPITestAppData *data = (HealthAPITestAppData *)context; if (event == HealthEventMovementUpdate) { /...
m_rows(SettingsActivityTrackerData *data) { if (data->data_source) { return app_menu_data_source_get_count(data->data_source); } else { return 0; } } static void prv_reload_menu_data(void *context) { SettingsActivityTrackerData *data = context; const uint16_t count = prv_num_rows(data); const bool ...
("No background apps", data)
; PBL_IF_RECT_ELSE(prv_draw_no_activities_cell_rect, prv_draw_no_activities_cell_round) (ctx, cell_layer, no_background_apps_string); return; } const char *title = NULL; if (row == 0) { title = i18n_get("None", data); } else { AppMenuNode *node = app_me...
) { prv_render_timeline_peek(&(TimelinePeekItemConfig) { .title = ":parrot: :parrot:", .subtitle = ":parrot: :parrot: :parrot:", .icon = TIMELINE_RESOURCE_GENERIC_CONFIRMATION, .num_concurrent = 3, }); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_timeline_peek__peek_title_o...
prv_set_timeline_item(NULL, false /* animated */)
; TimelinePeek *peek = timeline_peek_get_peek(); const Layer *layer = &peek->layout_layer; // Normally it is animated, but for this unit test, we don't request `animated` cl_assert(layer->frame.origin.y >= DISP_ROWS); // Transition away from the watchface s_is_watchface_running = false; timeline_peek_set...
qual_i(layout.box.size.w, box.size.w); cl_assert_equal_i(layout.max_used_size.w, 8 * HORIZ_ADVANCE_PX); } void test_text_layout__cache_vert_overflow(void) { GContext gcontext = (GContext) { }; GFont font = (GFont) { 0 }; GRect box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 4 * HORIZ_ADVANCE_PX + 1, 2 * FONT_HEIG...
(layout.box.size.w, box.size.w)
; cl_assert_equal_i(layout.max_used_size.w, 2 * HORIZ_ADVANCE_PX); // only the JR, since Whop is not being layed out cl_assert_equal_i(layout.max_used_size.h, 2 * FONT_HEIGHT); // Nothing - save for the first line - will be rendered below the box graphics_text_layout_get_max_used_size(&gcontext, "JR\n\nWhop", f...
{"purpureus", GColorPurpureusARGB8}, {"lavenderindigo", GColorLavenderIndigoARGB8}, {"limerick", GColorLimerickARGB8}, {"brass", GColorBrassARGB8}, {"lightgray", GColorLightGrayARGB8}, {"babyblueeyes", GColorBabyBlueEyesARGB8}, {"springbud", GColorSpringBudARGB8}, {"inchworm", GColorInchwormARGB8}, {"mi...
{ if (jerry_value_is_number(value)) { *result = (GColor) {.argb = jerry_get_int32_value(value)}; return true; } if (jerry_value_is_string(value)) { char color_str[50] = {0}; jerry_string_to_utf8_char_buffer(value, (jerry_char_t *)color_str, sizeof(color_str)); return rocky_api_graphics_color_p...
/* * 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...
strncpy(buffer, prefix, sizeof(buffer))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ chunk_size = MIN(MAX_CHUNK_SIZE, firmware_length - i); flash_read_bytes(buffer, flash_new_fw_start + i, chunk_size); if (!system_flash_write(FIRMWARE_BASE + i, buffer, chunk_size, NULL, NULL)) { dbgserial_putstr("We're dead"); return false; } prv_display_write_progress(i + chunk_size, ...
return true; } static bool check_firmware_crc(FirmwareDescription* firmware_description) { dbgserial_print("Checksumming "); dbgserial_print_hex(firmware_description->firmware_length); dbgserial_print(" bytes\r\n"); const uint32_t crc = crc32(CRC32_INIT, (const uint8_t *)FIRMWARE_BASE, ...
DITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "session_receive_router.h" #include "services/common/comm_session/meta_endpoint.h" #include "services/common/comm_session/session_analytics.h" #include ...
{ // Eat any bytes from an ignored, previous message: if (rtr->bytes_to_ignore) { const uint32_t num_ignored_bytes = MIN(*data_size_p, rtr->bytes_to_ignore); rtr->bytes_to_ignore -= num_ignored_bytes; *data_size_p -= num_ignored_bytes; if (*data_size_p == 0) { return true; // we're done }...
static bool prv_prepare_receiver(const uint32_t payload_length, const PebbleProtocolEndpoint *endpoint, const uint16_t endpoint_id, CommSession *session, ReceiveRouter *rtr) { Receiver *receiver = endpoint->receiver_imp->prepare(session, endpoint, ...
tmap, "fill_rect_origin_r4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 5, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r5_no_clip.${BIT_DEPTH_NAME}.pbi")); ...
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 8, GCornersAll)
u_level_add_child(root_level, emoji_level, "Emoji"); const unsigned int selected_index = 1; prv_prepare_canvas_and_render_action_menus_static(root_level, selected_index, 0); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_action_menu_window__wide_display_mode_with_chevron_and_long_labels(voi...
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
; }
bort); case PutBytesPut: return (command == PutBytesPut || command == PutBytesCommit || command == PutBytesAbort); case PutBytesCommit: case PutBytesAbort: case PutBytesInstall: default: return false; } } static bool prv_is_invalid_command_for_current_state(PutBytesCommand command) { if (!prv_is_...
prv_unlock_pb_job_state()
; if (do_ack) { // If we did not pre-ack, we need to ack the packet now! prv_send_response(ResponseAck, token); } } static void prv_process_msg_system_task_callback(void *unused) { xSemaphoreTake(s_pb_semaphore, portMAX_DELAY); if (!s_pb_state.receiver.buffer || s_pb_state.receiver.length == 0) { ...
_i(state.pin.header.timestamp, 1421136000); // back to the first cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&first_all_day_event, &state.pin.header.id)); cl_assert(state.node->all_day); // correct end of line behaviour cl_assert(!iter_prev(&iterator)); } void test_timeline__all_day_future_with...
(&iterator)
); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check all day events cl_assert(iter_next(&iterator)); 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]....
ent->is_bonding_based) { // Clear out connection address (more for debugging than any else): intent->device = (const BTDeviceInternal) {}; } } } intent = next; } gap_le_connection_remove(&event->peer_address); break; } default...
GAP_LE_Create_Connection(stack_id, 10240, 10240, fpWhiteList, 0 /* fpWhiteList ignores remote addr type */, NULL /* fpWhiteList ignores remote addr */, local_addr_type, &connection_params, ...
w); cl_assert_equal_i(window->on_screen, true); s_appear_count++; cl_check(s_appear_count >= 1); } static void prv_window_disappear(Window *window) { cl_check(window); cl_assert_equal_i(window->on_screen, false); s_disappear_count++; cl_check(s_appear_count >= 0); } static void prv_window_load(Window *w...
cl_assert_equal_i(window2->on_screen, true)
; app_window_stack_pop(true); cl_assert_equal_i(window1->on_screen, true); cl_assert_equal_i(window2->on_screen, false); app_window_stack_pop(true); cl_assert_equal_i(window1->on_screen, false); window_destroy(window1); window_destroy(window2); } void test_window_stack__basic_window_pop_under(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...
(ctx, text_color)
; graphics_draw_text(ctx, typical_text, font, rect, GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); rect.origin.y += 16; graphics_draw_text(ctx, value_text, font, rect, GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); }
w_state.stroke_color; graphics_fill_rect(ctx, &GRect(rect->origin.x, rect->origin.y, rect->size.w, 1)); // top graphics_fill_rect(ctx, &GRect(rect->origin.x, rect->origin.y + rect->size.h - 1, rect->size.w, 1)); // bottom graphics_fill_rect(ctx, &GRect(rect->origin.x, rect->origin...
(origin.x + radius + width_actual - 1, origin.y)
; const GPoint bottom_l = GPoint(origin.x + radius, origin.y + height - 1); const GPoint bottom_r = GPoint(origin.x + radius + width_actual - 1, origin.y + height - 1); const GPoint left_t = GPoint(origin.x, origin.y + radius); const GPoint left_b = GPoint(origin.x, origin.y + radius + height_actual - 1); ...
/* * 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...
handle_sentence(sentence, data)
) { // end iteration if callback returns false break; } sentence = transcription_iterate_words(sentence->words, sentence->word_count, NULL, NULL); } return (void *)sentence; } void *transcription_iterate_words(const TranscriptionWord *words, size_t count, TranscriptionWordIterateCb handle_...
uint8_t error_count, uint8_t num_sessions, Uuid *app_uuid) { PBL_ASSERTN((event_type >= AnalyticsEvent_VoiceTranscriptionAccepted) && (event_type <= AnalyticsEvent_VoiceTranscriptionAutomaticallyAccepted)); // Format the event specific info in the blob. The analytics_log...
{ analytics_event_bt_error(AnalyticsEvent_BtAppLaunchError, gatt_error); }
// ------------------------------------------------------------------------------------------ //! Log when a Pebble Protocol session is closed. void analytics_event_session_close(bool is_system_session, const Uuid *optional_app_uuid, CommSessionCloseReason reason, uint16_t session_d...
test_graphics_context_init(&ctx, fb)
; s_current_path = s_duplicates_path; ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 2); graphics_context_set_antialiased(&ctx, true); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_duplicates_aa.8bit.pbi")); // Cro...
return pfs_active_in_region(0, s_pfs_size); } // Scans through the filesystem to see if we rebooted while a file was in the // middle of being created and cleans up these partial files. void pfs_reboot_cleanup(void) { static uint16_t curr_pg = 0; for (; curr_pg < s_pfs_page_count; curr_pg++) { uint8_t page_...
(s_head_callback_node_list, &callback_node->list_node)
); list_remove(&callback_node->list_node, &(s_head_callback_node_list), NULL); // if no one is watching the file anymore, free the string ListNode *find_str = list_find(s_head_callback_node_list, watch_list_find_str, (char *)callback_node->name); if (find_str == NULL) { kernel_free((void *)(callback_...
/* * 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_erase_sector_blocking(i)
; } // Erase the trailing subsectors for (int32_t i = sector_end; i < subsector_end; i += SUBSECTOR_SIZE_BYTES) { flash_erase_subsector_blocking(i); } } else { // Can't erase any full sectors, just erase subsectors the whole way. for (int32_t i = subsector_start; i < subsector_end; i +=...
de "services/common/light.h" #include "services/normal/app_cache.h" #include "services/normal/app_inbox_service.h" #include "services/normal/app_outbox_service.h" #include "shell/normal/app_idle_timeout.h" #include "shell/normal/watchface.h" #include "shell/shell.h" #include "shell/system_app_state_machine.h" #include ...
{ PBL_ASSERT_TASK(PebbleTask_App); }
void prv_dump_start_app_info(const PebbleProcessMd *app_md) { char *app_type = ""; switch (process_metadata_get_app_sdk_type(app_md)) { case ProcessAppSDKType_System: app_type = "system"; break; case ProcessAppSDKType_Legacy2x: app_type = "legacy2"; break; case ProcessAppSDKTyp...
s == FLASH_TEST_SUCCESS) { data->test_case_status = FLASH_TEST_STATUS_PASSED; } else { PBL_LOG(LOG_LEVEL_DEBUG, ">>>>>FAILED TEST CASE<<<<<"); data->test_case_status = FLASH_TEST_STATUS_FAILED; } update_test_case_status(data); } static void select_click_handler(ClickRecognizerRef recognizer, void ...
app_state_get_user_data()
; simple_menu_layer_deinit(&data->simple_menu_layer); app_free(data); stop_flash_test_case(); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* flash_test_demo_get_app_info(void) { static const PebbleProcessMdSystem s_app_info = { .common.m...
* See the License for the specific language governing permissions and * limitations under the License. */ #include "sports_layout.h" #include "timeline_layout.h" #include "applib/fonts/fonts.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/text.h" #include "applib/ui/ui.h" #include "drivers/rtc.h" #...
PBL_IF_RECT_ELSE(-2, 0)
; const int16_t min_y = box->origin.y + offset_top; const int16_t max_y = box->origin.y + box->size.h + offset_bottom; const int16_t offset_x = box->origin.x + box->size.w / 2; graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_line(ctx, GPoint(offset_x, min_y), GPoint(offset_x, max_y)); *si...
cl_assert(NULL == bmp->data_row_infos)
; bmp = gbitmap_create_blank(s10, GBitmapFormat8Bit); cl_assert(NULL == bmp); bmp = gbitmap_create_blank(s10, GBitmapFormat1BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat2BitPal...
/* * 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, buf, user_stack_end)
&& process_manager_is_address_in_region( task, (uint8_t *)buf + num_bytes -1, user_stack_end)) { return; } APP_LOG(APP_LOG_LEVEL_ERROR, "syscall failure! %p..%p is not in app space.", buf, (char *)buf + num_bytes); PBL_LOG(LOG_LEVEL_ERROR, "syscall failure! %p..%p is not in app space.", buf,...
s_len, KAlgTestActivitySession *session) { time_t now = rtc_get_time(); int start_idx = ((session->start_utc - now) / SECONDS_PER_MINUTE) + 1; int len = session->len_minutes; cl_assert(start_idx + len < samples_len); for (int i = start_idx; i < start_idx + ...
cl_assert_equal_i(s_num_captured_activity_sessions, 1)
; ASSERT_ACTIVITY_SESSION_PRESENT(s_captured_activity_sessions, s_num_captured_activity_sessions, &exp_session); } // -------------------------------------------------------------------------------------- // Test a short walk that should not register { memset(minute_raw_data, 0, k_minute_data_bytes); ...
DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_bw_assign_center_45.Xbit.pbi")); } void test_graphics_draw_rotated_bitmap__origin_bw_set(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // No Clip, Angle 0 setup_t...
(&ctx, &GRect(0, 0, 20, 10))
the minimum latency for 10s: comm_session_set_responsiveness(comm_session_get_system_session(), BtConsumerTimelineActionMenu, ResponseTimeMin, MIN_LATENCY_MODE_TIMEOUT_TIMELINE_ACTION_MENU_SECS); } static void prv_reset_session_responsiveness(void)...
(dialog, icon_res_info.res_id)
; dialog_set_icon_animate_direction(dialog, DialogIconAnimationFromLeft); const uint32_t dialog_timeout_ms = use_simple_dialog ? DIALOG_TIMEOUT_DEFAULT : DIALOG_TIMEOUT_INFINITE; dialog_set_timeout(dialog, dialog_timeout_ms); if (data->action_menu) { ...
&s_sleep_reward_state.common.last_triggered_utc, sizeof(s_sleep_reward_state.common.last_triggered_utc)); prv_restore_state(file, ActivitySettingsKeyInsightActivityRewardTime, &s_activity_reward_state.common.last_triggered_utc, sizeof(s_acti...
(now_utc, exit_utc, enter_seconds, exit_seconds, total_seconds - deviate_seconds, total_seconds, &uuid)
; uuid = UUID_INVALID; prv_push_sleep_summary_pin(now_utc, exit_utc, enter_seconds, exit_seconds, total_seconds - 3 * deviate_seconds, total_seconds, &uuid); if (activity_prefs_sleep_insights_are_enabled()) { for (int i = 0; i < NUM_COPY_VARIANTS; i++) { prv_push_sleep_summa...
bpm_quality = 0; static uint16_t led_current = 0; if (hrm->event_type == HRMEvent_BPM) { snprintf(app_data->bpm_string, sizeof(app_data->bpm_string), "%"PRIu8" BPM", hrm->bpm.bpm); text_layer_set_text(&app_data->quality_text_layer, prv_get_quality_string(hrm->bpm.quality)); layer_mark_dirty(&...
text_layer_set_text(&app_data->quality_text_layer, "Loading...")
if (s_color_table == color_table_hsv) { s_color_table = color_table_hvs; } else if (s_color_table == color_table_hvs) { s_color_table = color_table_hsv; } } layer_mark_dirty(s_canvas_layer); } static void select_handler(ClickRecognizerRef recognizer, void *context) { AppData *data = window_...
(window_get_root_layer(window), text_layer_get_layer(data->bg_text))
; data->bg_color_text = text_layer_create(GRect(2, 70, 64, 20)); layer_add_child(window_get_root_layer(window), text_layer_get_layer(data->bg_color_text)); data->bg_color_index = 0; data->alpha_text = text_layer_create(GRect(2, 92, 64, 20)); layer_add_child(window_get_root_layer(window), text_layer_get_lay...
for_activity_type( ActivitySessionType_Run, &s_workout_data, &s_workout_controller); prv_create_window_and_render(active_window, 0); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__workout_render_open_workout(void) { s_workout_data = (WorkoutData) { .steps = 0, ...
(active_window, 0)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__sports_pace_long_values(void) { s_sports_data = (SportsData) { .current_bpm = 71, .duration_string = "04:20:39", .distance_string = "115.12", .pace_string = "12:34", }; WorkoutMetricType top_metric = Wor...
on all rows creates checkerboard pattern setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FIL...
{ graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); }
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_checkerboard_no_clip"))); // Clipping on even boundaries - no offset setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_EVEN, ORIGIN_RECT_NO_CLIP, false, 1); for (int16_t col = 0; col < MAX_NUM_COLS; col++) { grap...
atform_devices.h" #include "util/build_id.h" #include "util/crc32.h" #include "host_transport_impl.h" #include "host_transport_protocol.h" #include "reboot_reason.h" #define TIMER0_CLK_RATE (32000) #define TIMER0_RELOAD_VALUE (65535) #define TIMER0_1_S (TIMER0_CLK_RATE / 1) #define TIMER0_1_MS (TIMER0_CLK_RATE / 1000...
hw_timer0_get_on()
; } static uint16_t prv_timer_delta(uint16_t start_ticks, uint16_t end_ticks) { // The timer is configured to repeatedly count down from 65535, resetting at 0 back to 65535. // The delta calculated here takes advantage of the underflow to produce the correct result. return start_ticks - end_ticks; } static bool...
s // are as follows: // R0-R12 = Unknown // MSP = VECTOR_TABLE[0] (main stack pointer) // PSP = Unknown (process stack pointer) // LR = 0xFFFFFFFF // PC = VECTOR_TABLE[1] // PRIMASK = 0x0 // FAULTMASK = 0x0 // BASEPRI = 0x0 // CONTROL = 0x0 // // Attempt to pu...
button_is_pressed(BUTTON_ID_DOWN)
); } static bool prv_check_force_boot_recovery(void) { if (boot_bit_test(BOOT_BIT_FORCE_PRF)) { boot_bit_clear(BOOT_BIT_FORCE_PRF); return true; } if (prv_prf_button_combination_is_pressed()) { dbgserial_putstr("Hold down UP + BACK + SELECT for 5 secs. to force-boot PRF"); for (int i = 0; i < 50...
(tmbuf), "%z", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "-0100"); jan_2_2015__13_00_00.tm_gmtoff = -4200; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%z", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "-0110"); jan_2_2015__13_00_00.tm_gmtoff = -36000; tmbuf[0] = '\0'; strftime(tmbuf, s...
(tmbuf, "013 0001")
; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%01j %05m %03M %05p", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "002 00001 000 PM"); #if EXTENSION_GNU tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%05P", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "pm"); #endif tmbuf[0] = '\0'; st...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(bus, SpiI2sFlag_TXE)
; } static bool prv_spi_receive_is_ready(const SPIBus *bus) { return prv_spi_get_flag_status(bus, SpiI2sFlag_RXNE); } void prv_spi_send_data(const SPIBus *bus, uint16_t Data) { #if MICRO_FAMILY_STM32F7 // STM32F7 needs to access as 8 bits in order to actually do 8 bits. // This _does_ work on F4, but QEMU doesn...
r->type = type; if (data_length > 0) { if (data == NULL) { return DICT_INVALID_ARGS; } memcpy(iter->cursor->value->data, data, data_length); } iter->cursor = next_cursor; ++iter->dictionary->count; return DICT_OK; } DictionaryResult dict_write_data(DictionaryIterator *iter, const uint32_t k...
(vl, unsigned int)
+ sizeof(Tuple); } va_end(vl); return total_size; } uint32_t dict_calc_buffer_size_from_tuplets(const Tuplet * const tuplets, const uint8_t tuplets_count) { uint32_t total_size = sizeof(Dictionary); if (tuplets_count == 0) { return total_size; } for (unsigned int i = 0; i < tuplets_count; ++i) { ...
ls_finish(DataLoggingSession *logging_session) { if (logging_session == (DataLoggingSession *)TEST_PL_DLS_SESSION_ID) { s_dls_session_created = false; } else { cl_assert(false); } } // // MFG/Version Fakes // #define TEST_PL_SERIAL_NUM "ABC01234567" const char* mfg_get_serial_number(void) { return TES...
LOG("payload_sender_type: %s", s_parsed_msg.payload_sender_type)
; LOG("payload_sender_id: %s", s_parsed_msg.payload_sender_id); LOG("payload_sender_version: major: %"PRIu32", minor: %"PRIu32", patch: %s", s_parsed_msg.payload_sender_v_major, s_parsed_msg.payload_sender_v_minor, s_parsed_msg.payload_sender_version_patch); LOG("payload_send_time: %"PRIu32"", s_par...