prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
0x0D reply_action_attrs, AttributeIdTitle, 0x05, 0x00, // Length 0x52, 0x65, 0x70, 0x6c, 0x79, // "Reply" AttributeIdEmojiSupported, 0x01, 0x00, // Length 0x01, // "Supported" }; int val_len = sizeof(val)...
(s_sent_action)
; } void test_ancs_pebble_actions__test_sms_reply_no_emoji(void) { prv_support_sms_replies_no_emoji(); ANCSAttribute *notif_attributes[NUM_FETCHED_NOTIF_ATTRIBUTES] = {0}; ANCSAttribute *app_attrs[NUM_FETCHED_APP_ATTRIBUTES] = {0}; const size_t header_len = sizeof(GetNotificationAttributesMsg); bool error ...
hSleepSummaryCardData *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_VALUE); prv_render_sleep_sessions(ctx, data); prv_render_typical_markers(ctx, data); // Th...
prv_render_no_sleep_data_text(ctx, base_layer)
NULL, NULL), true); cl_assert_equal_i(strcmp(device_name, name_out), 0); cl_assert_equal_b(pairing_info->is_remote_signing_info_valid, pairing_info_out.is_remote_signing_info_valid); cl_assert_equal_b(pairing_info->is_remote_identity_info_valid, ...
shared_prf_storage_store_bt_classic_pairing_data(&addr, device_name, &link_key, 0x00)
; prv_fire_writeback_timer(); shared_prf_storage_store_platform_bits(0xaa); BTDeviceAddress out_addr = {}; char device_name_out[BT_DEVICE_NAME_BUFFER_SIZE]; memset(device_name_out, 0, BT_DEVICE_NAME_BUFFER_SIZE); SM128BitKey link_key_out = {}; uint8_t platform_bits_out = 0; cl_assert_equal_p(shared_prf...
failed mid-way): BleAddressAndIRKChange e = {}; if (!prv_get_device_and_irk_by_conn_idx(evt->conn_idx, &e.is_resolved, &e.irk)) { // Disconnected in the mean time return; } e.is_address_updated = true; dialog_utils_bd_address_to_bt_device(&evt->address, &e.device); dialog_utils_bd_address_to_bt_dev...
{ PBL_ASSERTN(xTaskGetCurrentTaskHandle() == DialogTaskList[DialogTask_Ble]); }
static void prv_configure_irk(const BTDriverConfig *config) { // Use the Identity Root directly as the local Identity Resolving Key: PBL_LOG(LOG_LEVEL_DEBUG, "Setting local IRK:"); PBL_HEXDUMP(LOG_LEVEL_DEBUG, (const uint8_t *)&config->root_keys[SMRootKeyTypeIdentity], sizeof(config->root_keys[SMR...
/* * 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...
(custom_res_read_4, custom_res_size_4)
; ASSERT(emx_resources_get_size(1, id_4) == 4); buf = 0; ASSERT(emx_resources_read(1, id_4, 0, (uint8_t *)&buf, 1) == 4); ASSERT(buf == 4); ASSERT(s_read_4_called == 3); ASSERT(s_size_4_called == 2); // remove 4 again emx_resources_remove_custom(id_4); ASSERT(emx_resources_get_size(1, id_4) == 0); ...
_calls, a), 1); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); // ------------------------------------------------------------------------------------- // Build up a sequence out of a + b Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); animatio...
(&s_started_handler_calls, b)
, 1); animation_schedule(c); // Create the spawn using a, b, c, and d prv_advance_to_ms_with_timers(start_ms + 680); Animation *spawn = animation_spawn_create(a, b, c, d, NULL); animation_set_delay(spawn, delay_spawn); animation_set_handlers(spawn, handlers, spawn); animation_schedule(spawn); // Chec...
le[ISO_LOCALE_LENGTH - 1] = '\0'; versions_msg.lang_version = htons(i18n_get_version()); PBL_LOG(LOG_LEVEL_DEBUG, "Sending lang version: %d", versions_msg.lang_version); // Set the capabilities as zero, effectively saying that we don't support anything. versions_msg.capabilities.flags = 0; // Assign the indi...
mfg_info_get_serialnumber(serial_number, sizeof(serial_number))
; char hw_version[MFG_HW_VERSION_SIZE + 1]; mfg_info_get_hw_version(hw_version, sizeof(hw_version)); const uint32_t* mcu_serial = mcu_get_serial(); prompt_send_response_fmt(buffer, sizeof(buffer), "MCU Serial: %08"PRIx32" %08"PRIx32" %08"PRIx32, mcu_serial...
malloc(sizeof(FrameBuffer))
; framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_init(&s_ctx, fb); graphics_context_set_antialiased(&s_ctx, true); // Setup resources fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FI...
ification_storage in case of an action/remove if (data->notifications_modified) { data->notifications_modified = false; prv_reload_swap_layer(data); } } static void prv_window_disappear(Window *window) { NotificationWindowData *data = window_get_user_data(window); prv_cleanup_timer(&data->pop_timer_id)...
{ if (s_notification_window_data.is_modal && s_in_use) { prv_set_dnd_icon_visible(dnd_is_active); } }
/////////////////////////// // Notification Window API /////////////////////////// static void prv_init_notification_window(bool is_modal) { NotificationWindowData *data = &s_notification_window_data; // init_notification_window() can be called from KernelMain when displaying an incoming // notification and a...
e/app_state/app_state.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" #include <string.h> // Initial pixel scroll amount, paging_height (LAYOUT_HEIGHT) for circular display #define INITIAL_SCROLL_PX PBL_IF_RECT_ELSE(LAYOUT_BANNER_HEIGHT_RECT, LAYOUT_HEIGHT) // Max pixel scroll amoun...
(swap_layer, layout, swap_layer->context)
; } } static void prv_announce_layout_did_appear(SwapLayer *swap_layer, LayoutLayer *layout, int8_t rel_change) { swap_layer->swap_in_progress = false; if (swap_layer->callbacks.layout_did_appear_handler) { swap_layer->callbacks.layout_did_appear_handler(swap_layer,...
ble setting bool dls_get_send_enable(void) { return prv_sends_enabled(); } // ---------------------------------------------------------------------------------------- // Set the send_enable setting void dls_set_send_enable_pp(bool setting) { s_sends_enabled_pp = setting; } // ------------------------------------...
(logging_session)
; logging_session = NULL; } if (logging_session == NULL) { logging_session = dls_list_create_session(tag, item_type, item_size, uuid, rtc_get_time(), DataLoggingStatusActive); if (logging_session == NULL) { // No need to log again here, dls_list_creat...
uture_failure(0, NULL); extern void pfs_reset_all_state(void); pfs_reset_all_state(); pfs_init(false); // Reopen the file we were in the middle of writing. SettingsFile file_new; cl_must_pass(settings_file_open(&file_new, "test_file_atomic", 4096)); settings_file_dump(&file_new); int ...
settings_file_open(&file, "test_file_each", 4096)
); uint8_t key[5]; int key_len = 4; uint8_t val[5]; int val_len = 4; for (int i = 0; i < 255; i++) { snprintf((char *)key, sizeof(key), "k%03d", i); snprintf((char *)val, sizeof(val), "v%03d", i); printf("Iteration %d key %s val %s\n", i, key, val); set_and_verify(&file, key, key_len, val, va...
insight response event: timestamp: %"PRIu32", type:%"PRIu8 \ ", response:%"PRIu8, timestamp, insight_type, response_id); #endif analytics_logging_log_event(&event_blob); } // ------------------------------------------------------------------------------------------ // Log an App Crash event v...
{ AnalyticsEventBlob event_blob = { .event = event_type, .alarm = { .hour = info->hour, .minute = info->minute, .is_smart = info->is_smart, .kind = info->kind, }, }; memcpy(event_blob.alarm.scheduled_days, info->scheduled_days, sizeof(event_blob.alarm.scheduled_days))...
// ------------------------------------------------------------------------------------------ void analytics_event_bt_chip_boot(uint8_t build_id[BUILD_ID_EXPECTED_LEN], uint32_t crash_lr, uint32_t reboot_reason_code) { AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_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...
interpolate_moook_duration()
+ num_frames_mid * ANIMATION_TARGET_FRAME_INTERVAL_MS; } uint32_t interpolate_moook_custom_duration(const MoookConfig *config) { PBL_ASSERTN(config); return ((config->num_frames_in + config->num_frames_mid + config->num_frames_out) * ANIMATION_TARGET_FRAME_INTERVAL_MS); } static int64_t prv_interpolate...
/* * 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_LOG_LEVEL_DEBUG, "app sending outbox")
; do { result = send_app_msg(); } while (result == -1); APP_LOG(APP_LOG_LEVEL_DEBUG, "outbox result code: %d", result); } } static void up_click_handler(ClickRecognizerRef recognizer, void *context) { text_layer_set_text(s_text_layer, "Up"); for (int i=0; i<10; i++) { APP_LOG(APP_LOG_LEVEL_...
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, total_seconds, &uuid); uuid = UUID_INVALID; prv_push_sleep_summary_pin(now_utc, exit_utc, enter_seconds, exit_second...
activity_insights_push_activity_session_notification(now_utc, &open_session, avg_open_hr, open_hr_zone_time_s)
; } static void prv_test_push_nap_session(void *unused) { const time_t now_utc = rtc_get_time(); const int length_min = MINUTES_PER_HOUR + MINUTES_PER_HOUR / 2; ActivitySession session = { .type = ActivitySessionType_Nap, .start_utc = now_utc - length_min * SECONDS_PER_MINUTE, .length_min = length_mi...
/* * 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 s_is_ongoing; }
bool workout_service_start_workout(ActivitySessionType type) { s_is_ongoing = true; return true; } bool workout_service_pause_workout(bool should_be_paused) { s_is_paused = should_be_paused; return true; } bool workout_service_stop_workout(void) { s_is_ongoing = false; return true; } bool workout_servi...
/* * 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...
(FW_REVISION_LEN >= sizeof(TINTIN_METADATA.version_tag), "Size mismatch")
; static void prv_set_model_number(DisInfo *info) { mfg_info_get_hw_version(info->model_number, MODEL_NUMBER_LEN); } static void prv_set_manufacturer_name(DisInfo *info) { strncpy(info->manufacturer, MANUFACTURER_STR, MANUFACTURER_LEN); } static void prv_set_serial_number(DisInfo *info) { mfg_info_get_serialnu...
/* * 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 (connection && connection->gatt_service_changed_indication_timer) { stub_new_timer_fire(connection->gatt_service_changed_indication_timer); } fake_system_task_callbacks_invoke_pending(); }
v_start_loader(HRMDevice *dev) { // check if the loader is already running if (!prv_is_app_running(dev, AS7000AppId_Loader)) { PBL_LOG(LOG_LEVEL_DEBUG, "Switching to loader"); // we need to start the loader if (!prv_set_running_apps(dev, AS7000AppId_Loader)) { return false; } psleep(35); ...
if (!prv_wait_for_loader_ready(dev)) { PBL_LOG(LOG_LEVEL_ERROR, "Loader not ready"); return false; }
system_task_watchdog_feed(); cursor += load_length; write_address += load_length; bytes_remaining -= load_length; } } // Write the EOF record, telling the loader that the image has been // fully written. uint8_t eof_record[IHEX_RECORD_LENGTH(0)]; ihex_encode(eof_record, IHEX_TY...
GRect(0,0,180,180)
; GPoint center = grect_center_point(&bounds); int16_t radius = bounds.size.w / 2; // test robustness of perimeter_horizontal_range_for_circle for (int y = 0; y < bounds.size.h; y++) { GRangeHorizontal h_range = perimeter_for_circle( (GRangeVertical) {.origin_y = y, .size_h = 0}, center, radius); ...
/* * 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...
{ regular_timer_add_multisecond_callback(&session->timeout_timer, SYNC_TIMEOUT_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...
{ Window *window = &data->window; window_init(window, WINDOW_NAME("FS Resource Demo")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); const bool animated = true; app_window_stack_push(window, animated); }
//////////////////// // App boilerplate static void handle_init(void) { FSResourceAppData *data = (FSResourceAppData*) app_malloc_check(sizeof(FSResourceAppData)); if (data == NULL) { PBL_CROAK("Out of memory"); } app_state_set_user_data(data); push_window(data); } static void handle_deinit(void) { F...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ KinoLayerDemoData *data = context; kino_layer_pause(&data->kino_layer); int index = ++data->resource_index % ARRAY_LENGTH(resources); kino_layer_set_reel_with_resource(&data->kino_layer, resources[index]); kino_layer_play(&data->kino_layer); }
{ shared_prf_storage_set_ble_pinned_address(&pinned_address); } } static void prv_load_local_data_from_prf(void) { char name[BT_DEVICE_NAME_BUFFER_SIZE]; if (shared_prf_storage_get_local_device_name(name, BT_DEVICE_NAME_BUFFER_SIZE)) { bt_persistent_storage_set_local_device_name(name, BT_DEVICE_NAME_BUF...
prv_load_ble_pairing_from_prf()
; } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Common Helper Functions BtPersistBondingType prv_get_type_for_id(BTBondingID id) { BtPersistBondingData data; prv_file_get(&id, sizeof(id), &data, sizeof(data)); return data.type; } bool prv_delete_pair...
24); cl_assert_equal_i(s_command_list_index, 2); cl_assert_equal_i(s_command_list[0].addr, 60 * 1024); cl_assert_equal_i(s_command_list[0].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[1].addr, 64 * 1024); cl_assert_equal_i(s_command_list[1].type, SectorEraseCommand); s_command_list_index...
(s_command_list[8].type, SectorEraseCommand)
; s_command_list_index = 0; } void test_flash_region__erase_optimal_range_watch_and_learn(void) { // Test cases stolen from Alvin's watch and learn app that originally hit this bug flash_region_erase_optimal_range(0x320000, 0x320000, 0x33177c, 0x338000); cl_assert_equal_i(s_command_list_index, 3); cl_as...
/* * 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...
strcmp(filename + APP_FILE_NAME_PREFIX_LENGTH, "persist")
== 0; } // Designed to be called once during reset void persist_service_init(void) { persist_map_init(); s_mutex = mutex_create(); // Find and delete any AppInstallId-indexed persist files. Due to PBL-16663 // (affecting FW 3.0-dp5 thru -dp7), the AppInstallId in the file name may not // correspond to the ...
tics[0][PPoGATTCharacteristicData]); // Expect "Reset Complete" to be sent by FW: prv_assert_sent_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]); // Expect Session to be opened now: cl_assert_equal_i(fake_comm_session_open_call_count(), 1); } void test_ppogatt__ignore_zero_length_notificatio...
prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn, s_short_data_fragment, sizeof(s_short_data_fragment))
; } void test_ppogatt__receive_ack_for_all_packets_in_flight(void) { test_ppogatt__open_session_when_found_pebble_app(); uint8_t sn = 0; Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); // Get s_tx_window_size packets in flight: for (sn = 0; sn < s_tx_window_size; ++sn) { cl_a...
_add__callcount); cl_assert_equal_b(true, rocky_global_has_event_handlers("foo")); s_prv_api_add__result = false; s_log_internal__expected = (const char *[]){ "Unknown event 'bar'", NULL }; EXECUTE_SCRIPT("_rocky.on('bar', function(){})"); cl_assert_equal_i(2, s_prv_api_add__callcount); cl_assert_e...
jerry_create_external_function(prv_listener_a1)
b_set_schedule_enabled(WeekdaySchedule, false); do_not_disturb_set_schedule_enabled(WeekendSchedule, false); if (do_not_disturb_is_smart_dnd_enabled()) { do_not_disturb_toggle_smart_dnd(); } alerts_preferences_check_and_set_first_use_complete(FirstUseSourceSmartDND); s_event_ongoing = false; s_num_dnd...
calendar_init()
; cl_assert(do_not_disturb_is_smart_dnd_enabled() == false); do_not_disturb_toggle_smart_dnd(); cl_assert(do_not_disturb_is_smart_dnd_enabled() == true); active = do_not_disturb_is_active(); cl_assert(active == false); s_event_ongoing = true; // Manual && !Scheduled && Smart do_not_disturb_set_manually...
{ cl_assert(GColorGreen.r == 0b00); cl_assert(GColorGreen.g == 0b11); cl_assert(GColorGreen.b == 0b00); cl_assert(GColorGreen.a == 0b11); }
void test_graphics_colors__blue(void) { cl_assert(GColorBlue.r == 0b00); cl_assert(GColorBlue.g == 0b00); cl_assert(GColorBlue.b == 0b11); cl_assert(GColorBlue.a == 0b11); } void test_graphics_colors__equal(void) { cl_assert(gcolor_equal(GColorBlue, GColorBlue)); cl_assert(gcolor_equal(GColorRed, GColorR...
//////////////////////////////////////////////// // Galois LFSR random number generator for dithering static int16_t prv_get_lfsr(int16_t prev) { uint16_t lfsr = (uint16_t)prev; lfsr = (lfsr >> 1) ^ (-(lfsr & 1) & 0xB400); return (int16_t)lfsr; } static bool prv_dma_handler(DMARequest *request, void *context, b...
prv_enable_gpio(MIC, GPIO_PuPd_DOWN)
C_CTRL_0_REG, DCDC_IDLE_CLK_DIV, 0x1); REG_SETF(DCDC, DCDC_CTRL_0_REG, DCDC_PRIORITY, 0xE4); REG_SETF(DCDC, DCDC_CTRL_0_REG, DCDC_FW_ENABLE, 0x1); REG_SETF(DCDC, DCDC_CTRL_0_REG, DCDC_MODE, 0); REG_SETF(DCDC, DCDC_CTRL_1_REG, DCDC_STARTUP_DELAY, 0xA); REG_SETF(DCDC, DCDC_CTRL_1_REG, DCDC_GLOBAL_MAX_IDLE_TIME...
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V14, 0x0)
; REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_FW, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_NSW, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_PSW, 0x0); REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_COMP_CLK, 0x0); REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_TEST_CURRENT, 0x0); REG_SETF(DCDC, DCDC_TEST_1_REG, DC...
or sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt " "ut labore et dolore magna aliqua.\0" "Ryan Case\nBrad Murray\0Sarah Otten"); attribute_list_add_string_list(&list, AttributeIdHeadings, &headings); attribute_list_add_string_list(&list, AttributeIdParagraphs, &paragraphs); a...
pin_db_insert_item_without_event(item)
; timeline_item_destroy(item); attribute_list_destroy_list(&list); } static void prv_launch_timeline(void) { app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = APP_ID_TIMELINE }); } static void prv_launch_notifications(void) { app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = APP_...
er, 100); cl_assert_equal_i(items_read, 4); cl_assert_equal_m(out_buffer, "0a3d5f8i", 8); cl_assert(shared_circular_buffer_write( &buffer, (uint8_t*)"9j0k1m2n3o4p5q", 7*item_size, false)); items_read = shared_circular_buffer_read_subsampled( &buffer, &client, item_size, out_buffer, 2); cl_assert_...
shared_circular_buffer_add_subsampled_client(&buffer, &client, 1, 2)
; cl_assert(shared_circular_buffer_write( &buffer, (uint8_t*)"0a1b2c3d4e5f6g7h8i9j", 10*item_size, false)); // Consume "0a1b2c3d4e" cl_assert_equal_i(shared_circular_buffer_read_subsampled( &buffer, &client, item_size, out_buffer, 3), 3); cl_assert_equal_m(out_buffer, "0a2c4e", 6); // This shoul...
"hr_util.h" #include "apps/system_apps/workout/workout_utils.h" #include "applib/app.h" #include "applib/health_service.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "services/common/evented_timer.h" #include "services/common/regular_timer.h" #include "system/passert.h" #include "util/time/tim...
workout_service_is_paused()
assert(!gdraw_command_sequence_validate(sequence, size)); sequence->num_frames = 3; cl_assert(!gdraw_command_sequence_validate(sequence, size)); sequence->num_frames = 2; sequence->version = 0xFF; cl_assert(!gdraw_command_sequence_validate(sequence, size)); free(sequence); } void test_gdraw_command_seque...
cl_assert_equal_p(gdraw_command_sequence_clone(NULL), NULL)
; GDrawCommandSequence *sequence; prv_create_test_sequence(&sequence); GDrawCommandSequence *clone = gdraw_command_sequence_clone(sequence); cl_assert(clone != sequence); size_t expected_size = gdraw_command_sequence_get_data_size(sequence); cl_assert_equal_i(gdraw_command_sequence_get_data_size(clone), e...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(DLS_MAX_CHUNK_SIZE_BYTES < DLS_CHUNK_HDR_NUM_BYTES_UNINITIALIZED, "DLS_MAX_CHUNK_SIZE_BYTES must be less than DLS_CHUNK_HDR_NUM_BYTES_UNINITIALIZED")
; // Forward declarations static bool prv_realloc_storage(DataLoggingSession *session, uint32_t new_size); static bool prv_get_session_file(DataLoggingSession *session, uint32_t space_needed); static void prv_release_session_file(DataLoggingSession *session); // ------------------------------------------------------...
AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "board/board.h" #include "drivers/flash/flash_impl.h" #include "drivers/flash/qspi_flash.h" #include "drivers/f...
{ return qspi_flash_is_erase_complete(QSPI_FLASH); }
status_t flash_impl_erase_subsector_begin(FlashAddress subsector_addr) { return qspi_flash_erase_begin(QSPI_FLASH, subsector_addr, true /* is_subsector */); } status_t flash_impl_erase_sector_begin(FlashAddress sector_addr) { return qspi_flash_erase_begin(QSPI_FLASH, sector_addr, false /* !is_subsector */); } st...
se; s_warning_window_shown = false; s_in_low_power = false; s_stop_mode_allowed = true; fake_rtc_init(0, 0); fake_rtc_auto_increment_ticks(0); } void test_battery_monitor__cleanup(void) { } // Tests //////////////////////////////////// int32_t battery_curve_lookup_percent_with_scaling_factor( int batte...
(charge_mv, true, true)
; battery_monitor_init(); periodic_timer_trigger(1); fake_battery_set_millivolts(charge_terminate_mv); fake_battery_set_charging(false); periodic_timer_trigger(1); cl_assert_equal_i(battery_get_charge_state().charge_percent, 100); fake_battery_set_millivolts(full_mv); periodic_timer_trigger(1); c...
/* * 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...
{ KinoReelImplCustom *custom_reel = (KinoReelImplCustom *)reel; if (custom_reel->impl->get_gbitmap_sequence) { return custom_reel->impl->get_gbitmap_sequence(reel); } return NULL; }
static const KinoReelImpl KINO_REEL_IMPL_CUSTOM = { .reel_type = KinoReelTypeCustom, .destructor = prv_destructor, .get_elapsed = prv_elapsed_getter, .set_elapsed = prv_elapsed_setter, .get_duration = prv_duration_getter, .get_size = prv_size_getter, .draw_processed = prv_draw_processed_func, .get_gdr...
static void prv_update_colors_handler(SwapLayer *swap_layer, GColor bg_color, bool status_bar_filled, void *context) { NotificationWindowData *data = context; GColor status_color = (status_bar_filled) ? bg_color : GColorWhite; // Status bar is clear on round, because the ba...
swap_layer_set_callbacks(swap_layer, data, (SwapLayerCallbacks) { .get_layout_handler = prv_get_layout_handler, .layout_removed_handler = prv_layout_removed_handler, .layout_did_appear_handler = prv_layout_did_appear_handler, #if PBL_COLOR .update_colors_handler = prv_update_colors_handler, #endif ....
; swap_layer_set_click_config_onto_window(swap_layer, window); layer_add_child(root_layer, swap_layer_get_layer(swap_layer)); StatusBarLayer *status_layer = &data->status_layer; status_bar_layer_init(status_layer); status_bar_layer_set_colors(status_layer, PBL_IF_RECT_ELSE(GColorBlack, GColorClear), ...
ection"), RESOURCE_ID_CHECK_INTERNET_CONNECTION_LARGE, dialog_bg_color); data->error_exit_status = DictationSessionStatusFailureConnectivityError; } else { prv_exit_and_send_result_event(data, DictationSessionStatusFailureConnectivityError); } } static void prv_handle_bt_conn_resu...
(data->message)
; data->message = NULL; } data->message = sys_voice_get_transcription_from_event(event, data->message, data->buffer_size, &data->message_len); if (data->session_type == VoiceEndpointSessionTypeNLP) { data->timestamp = event->data->timestamp; } if (!data->message) { VOICE_LOG("Empty sentence...
= { .size = framebuffer_get_size(app_state_get_framebuffer()) }; grect_clip(area_out, &display_frame); } //! Currently, the unobstructed area is derived from the origin of the obstruction. //! This is equivalent to the height of the unobstructed area. static void prv_origin_y_to_area(int16_t origin_y, GRect *area_ou...
(app_state_get_unobstructed_area_state(), &handlers, context)
; } void app_unobstructed_area_service_unsubscribe(void) { unobstructed_area_service_unsubscribe(app_state_get_unobstructed_area_state()); }
/* * 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_m(dest + buffer_length, GUARD_REFERENCE, buffer_length)
; } void test_phone_formatting__overflowing_initial(void) { const size_t buffer_length = 12; char dest[NAME_LENGTH]; memset(dest, GUARD_CHAR, NAME_LENGTH); phone_format_caller_name("Katharine Berry", dest, buffer_length); cl_assert_equal_s(dest, "Katharine"); cl_assert_equal_m(dest + buffer_length, GUARD...
/* * 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 CAPABILITY_HAS_MASKING if (!ctx) { return false; } if (ctx->draw_state.draw_mask && !mask) { // TODO PBL-33766: Update the ctx->draw_state.draw_mask's .mask_row_infos } const GDrawRawImplementation *draw_implementation_to_set = mask ? &g_mask_recording_draw_implementation : &g_default_draw...
bool graphics_context_mask_use(GContext *ctx, GDrawMask *mask) { #if CAPABILITY_HAS_MASKING if (!ctx) { return false; } // Stop any recording graphics_context_mask_record(ctx, NULL); // If a valid mask is set, the default draw implementation routines will respect it ctx->draw_state.draw_mask = mask;...
/* * 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...
(&keys[SMRootKeyTypeIdentity], SMRootKeyTypeIdentity)
; } void test_ble_root_keys__regenerate_if_key_not_present(void) { // Pretend one of the root keys isn't there: cl_will_return_count(bt_persistent_storage_get_root_key, true, 1); cl_will_return_count(bt_persistent_storage_get_root_key, false, 1); cl_will_return_count(rng_rand, true, RNG_ROUNDS * SMRootKeyType...
32_INIT, buffer, length); if (crc != s_rx_crc) { return false; // TODO: At least one memory region will crc fail because of changing counter // variables in the crc32/SPI code. We'll need to move the core dump code to its own region. } } return true; } static void prv_core_dump_main(void) { ...
if (flash_addr_max < (flash_addr + sizeof(chunk_hdr) + chunk_hdr.size)) { PBL_LOG(LOG_LEVEL_ERROR, "Insufficient space for BLE core dump -- TIB"); goto powerdown; }
cmd.cmd = CoreDumpCmd_ReadRunningThreadInfo; if (!prv_spi_transaction(&cmd, s_rx_buffer, sizeof(CoreDumpThreadInfo))) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to get Thread Info"); goto spi_failed; } flash_write_bytes((const uint8_t *)&chunk_hdr, flash_addr, sizeof(chunk_hdr)); flash_addr += sizeof(chunk_h...
/* * 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_connection)
; s_connection->gatt_connection_id = s_connection_id; } void test_gatt_service_changed_server__cleanup(void) { if (s_connection) { gap_le_connection_remove(&s_device); s_connection = NULL; } gap_le_connection_deinit(); stub_new_timer_cleanup(); } void test_gatt_service_changed_server__unsubscribe(vo...
/* * 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...
milliseconds_to_ticks(millis)
); }
ff-wrist if (s_manager_state.sensor_start_ticks == 0) { s_manager_state.sensor_start_ticks = rtc_get_ticks(); } // When first powering up, we can get "Excellent" quality readings the first few seconds, even // though the BPM is 0. Let's fix the quality if the BPM is too low to be valid HRMQuality quality...
(s_manager_state.accel_state, HRM_MANAGER_ACCEL_RATE_MILLIHZ)
; sys_accel_manager_set_sample_buffer( s_manager_state.accel_state, s_manager_state.accel_manager_buffer, HRM_MANAGER_ACCEL_MANAGER_SAMPLES_PER_UPDATE); hrm_enable(HRM); // Don't need the re-enable timer to fire new_timer_stop(s_manager_state.update_enable_timer_id); }...
cl_assert_equal_i(s_bonding_change_ops[0], BtPersistBondingOpDidAdd)
; // Read it back ret = bt_persistent_storage_get_ble_pairing_by_id(id_1, &irk_out, &device_out, NULL /* name */); cl_assert(ret); cl_assert_equal_m(&irk_out, &pairing_1.irk, sizeof(irk_out)); cl_assert_equal_m(&device_out, &pairing_1.identity, sizeof(device_out)); // Re-pair device 1 again: // In case ...
al_last_day = 33142, })); } void test_health__range_to_day_id_respects_local_time(void) { const time_t now = rtc_get_time(); bool result; HealthServiceTimeRange range; // some time yesterday + today - as if UTC == localtime result = prv_calculate_time_range(now - SECONDS_PER_DAY, now, &range); cl_asser...
(result, 2000)
; // yesterday and today result = health_service_sum(HealthMetricStepCount, time_util_get_midnight_of(now) - SECONDS_PER_DAY, now); cl_assert_equal_i(result, 1000 + 2000); } void test_health__process_range(void) { HealthValue values[4] = {1000, 1000,...
to identify screen if (radial_padding_size >= 2) { GRect identifier_area = GRect(40, 40, 20, 20); char identifier[] = {'A' + radial_padding_size - 2, 0}; graphics_context_set_text_color(ctx, GColorWhite); graphics_draw_text(ctx, identifier, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD), ...
window_init(&data->results_window, "")
; window_set_fullscreen(&data->results_window, true); mfg_results_ui_init(&data->results_ui, MfgTest_Display, &data->results_window); #endif } static void s_main(void) { light_enable(true); prv_handle_init(); app_event_loop(); light_enable(false); } const PebbleProcessMd* mfg_display_app_get_info(void)...
m = 10; m_rec->distance_cm = ROUND(minute_distance_mm, k_mm_per_cm); // Fill in heart rate, heart rate sample weight, then reset it int32_t median, heart_rate_total_weight_x100; activity_metrics_prv_get_median_hr_bpm(&median, &heart_rate_total_weight_x100); m_rec->heart_rate_bpm = (uint8_t)median; m_rec->h...
prv_unlock()
; } // ---------------------------------------------------------------------------------------------- // This structure contains the context used by the activity_algorithm_get_minute_history() call typedef struct { HealthMinuteData *minute_data; uint32_t array_size; uint32_t oldest_key; uint32_t newest_key; ...
state->prev_timestamp_ms = timestamp_ms; ACCEL_LOG_DEBUG("got %d samples for task %d at %ld (%lu ms delta)", (int)num_samples, (int)pebble_task_get_current(), (uint32_t)timestamp_ms, time_since_last_sample); for (unsigned int i=0; i<num_samples; i++) { ACCEL_LOG_DEBUG(" ...
(PebbleTask_Unknown)
; accel_session_raw_data_subscribe(session, ACCEL_SAMPLING_25HZ, samples_per_update, handler); } // ---------------------------------------------------------------------------------------------- void accel_data_service_subscribe__deprecated(uint32_t samples_per_update, AccelRawDataHandler__deprecated handler) { A...
UM_VALID_CODEPOINTS = sizeof(s_valid_test_codepoints) / sizeof(uint32_t); bool is_valid = utf8_is_valid_string(s_valid_test_string); cl_assert(is_valid); utf8_t* valid_test_string_utf8 = (utf8_t*)s_valid_test_string; for (int i = 0; i < NUM_VALID_CODEPOINTS; ++i) { uint32_t decoded_codepoint = utf8_peek_...
cl_assert_equal_i(0, utf8_get_size_truncate("", 1))
se for the specific language governing permissions and * limitations under the License. */ #include "animation.h" #include "animation_interpolate.h" #include "animation_private.h" #include "applib/graphics/gtypes.h" #include "system/passert.h" #include "util/math.h" #include "util/size.h" int64_t interpolate_int64...
{ return from; }
else if (frame_idx < num_frames_in) { return from + (frames_in ? (direction * frames_in[frame_idx]) : 0); } else if ((frame_idx < (num_frames_in + num_frames_mid)) && (num_frames_mid > 0)) { const int64_t shifted_normalized = normalized - (((int64_t) num_frames_in * ANIMATION_NORMALIZED_MAX) / num_fr...
te or else we'll just hit an INVSTATE UsageFault immediately. The only bit we leave // set is the bit that says we're in thumb state, which must always be set on Cortex-M3, since the micro doesn't // even support non-thumb instructions. // See: https://pebbletech.campfirenow.com/room/508662/transcript/message/111...
__set_MSP((uint32_t)stacked_args)
(AppMessageSenderErrorSuccess, 1)
; cl_assert_equal_i(s_app_install_timestamp_update_count, 1); app_free(outbox_data); } void test_app_message_sender__byte_by_byte_copy_with_offset(void) { AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(NULL /* auto-select */, ALLOWED_ENDPOINT_ID, ...
ntext_init(&ctx, fb); // No Clip, Angle 0 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_color, GPointZero, DEG_TO_TRIGANGLE(0), GPoint(20, 20)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,...
GPoint(71, 71)
, DEG_TO_TRIGANGLE(45), center); cl_check(gbitmap_pbi_eq(&ctx->dest_bitmap, "draw_rotated_bitmap_stamp_45deg.Xbit.pbi")); // Top-left corner rotation point, Angle 180 setup_test_rotate_bitmap(ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(ctx, test_image, ...
ributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* This file should probably go in the stm32f4 folder */ #include "driv...
{ // Failed to read the current register value return false; }
if (enable) { if (*ref_count) { (*ref_count)++; return true; } else { // Set the register byte to XXXXX01X to enable the rail, mask and set register_value = (register_value & ~0x06) | 0x02; success = prv_write_register(rail_control_reg, register_value); if (success) { ...
ppear at the bottom because data rows are vertically flipped) const GSize top_rects_size = GSize(bitmap_bounds_size->w / 4, bitmap_bounds_size->h * 2 / 5); const int16_t top_rects_x_offset = ((bitmap_bounds_size->w / 2) - top_rects_size.w) / 2; GColor top_rects_color = GColorGreen; top_rects_color.a = 2; cons...
test_graphics_context_init(&ctx, fb)
; setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1); prv_draw_hline_test_pattern(&ctx, prv_hline_pattern_assign_horizontal_line_raw); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_core_assign_horizontal_line_raw"))); }; void prv_blend_h...
/* * 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_DEBUG, "Updated timer while callback running.")
; return S_SUCCESS; } TimelineItem item = {{{0}}}; status_t rv = reminder_db_next_item_header(&item); if (rv == S_NO_MORE_ITEMS) { PBL_LOG(LOG_LEVEL_DEBUG, "No more reminders to add to queue."); return S_SUCCESS; } else if (rv) { return rv; } rv = prv_set_timer(&item); if (rv) { re...
lude "applib/ui/click_internal.h" #include "applib/ui/window.h" #include "applib/ui/window_private.h" #include "applib/ui/window_stack.h" #include "applib/ui/window_stack_animation.h" #include "applib/ui/window_stack_private.h" #include "applib/graphics/graphics.h" #include "applib/graphics/graphics_private.h" #include...
callback(&s_modal_window_stacks[idx], data)
r the License. */ #include "clar.h" #include "services/normal/voice_endpoint_private.h" #include "fake_pebble_tasks.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_rand_ptr.h" // setup and teardown void test_generic_attribute__initialize(void) { } void test_generic_attribute__cleanup(voi...
(attr_list2, VEAttributeIdTranscription, sizeof(data2))
; cl_assert(attr2); cl_assert_equal_i(attr2->id, VEAttributeIdTranscription); cl_assert_equal_i(attr2->length, 0x2F); offset = sizeof(GenericAttributeList) + sizeof(GenericAttribute) + attr1->length + sizeof(GenericAttribute); cl_assert_equal_p(attr2->data, &data2[offset]); GenericAttribute *attr3 = ...
icks > elapsed) { return timeout_ticks - elapsed; } return 0; } static bool prv_still_processing_enqueues(void) { bool done; prv_lock(); { done = (s_outstanding_enqueues != 0); } prv_unlock(); return done; } // Only to be called by prv_enqueue(). This function keeps track of how many // enqueu...
(semaphore)
ax; agg++) { for (HealthServiceTimeScope scope = HealthServiceTimeScopeOnce; scope <= HealthServiceTimeScopeDaily; scope++) { // Figure out the expected value HealthServiceStats *stats = NULL; char *scope_str; switch (scope) { case HealthServiceTimeScopeOnce: stat...
(min_value, value)
0, 80}, { 880, -24, 48}, { 1064, 64, -40}, { 1304, 0, 8}, { 1776, -72, 248}, { 1312, 336, -8}, { 1144, 464, -168}, { 920, 264, -8}, { 640, 48, 152}, { 776, 104, 128}, { 792, 208, 152}, { 856, 368, 64}, { 784, 376, 56}, { 864, 392, 32}, // 48 seconds { 976, 34...
{ 1208, 360, -32}, { 1272, 328, 16}, { 1952, 264, 80}, { 1296, 384, 96}, { 1000, 264, 72}, { 1096, 144, 160}, { 1176, 56, 240}, { 944, 40, 232}, { 792, 24, 152}, { 800, 16, 152}, { 784, 0, 88}, { 784, -48, 112}, { 880, -64, 80}, { 1040, -72, 40}, { 1064, -32, ...
/* * 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...
(" Address:", send_data_cmd_payload.copy_address)
, .layout.icon = RESOURCE_ID_SETTINGS_ICON_AIRPLANE, .layout.subtitle_template_string = "Test subtitle", }; cl_assert(app_glance_add_slice(session, slice) & APP_GLANCE_RESULT_INVALID_ICON); // Check that adding a slice with a subtitle that's too long fails const char *really_long_subtitle = "This is a ...
(app_glance_service_get_current_slice(&APP_GLANCE_TEST_UUID, &slice_out), true)
; cl_assert_equal_m(&slice_out, &glance.slices[1], sizeof(slice_out)); // Let some time "pass" so that the creation time of this next reload doesn't get ignored fake_rtc_increment_time(10); // Reload the glance using the provided callback; this should empty the slices in the glance app_glance_reload(reload_...
(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { #if CAPABILITY_HAS_MICROPHONE TimelineActionMenu *timeline_action_menu = context; action_menu_freeze(action_menu); VoiceResponseData *data = applib_malloc(sizeof(VoiceRespons...
prv_invoke_remote_action(action_menu, action, pin, (void *)(uintptr_t)new_time)
------------------------------------------------------ void accel_session_shake_unsubscribe(AccelServiceState *state) { event_service_client_unsubscribe(&state->accel_shake_info); state->shake_handler = NULL; } // ----------------------------------------------------------------------------------------------- void...
applib_free(old_buf)
; return result; }
aredPRFData *data = kernel_zalloc_check(sizeof(SharedPRFData)); prv_fetch_struct(data); return data; } static void prv_dealloc_struct(SharedPRFData *data) { kernel_free(data); } static void prv_persist_field(uint8_t *field, size_t offset, size_t field_size, bool calc_crc) { SharedPRFData *data = prv_alloc_and...
SPRF_PAGE_FLASH_ADDR(i)
, sizeof(data)); if (prv_valid_struct(&data)) { s_valid_page_idx = i; break; } } } // Keep a write offset, this won't work when we try to roll over to the other 25% of the sectors if (s_valid_page_idx == SPRF_PAGE_IDX_INVALID) { prv_erase_region_and_save(NULL...
SubBytes()
; ShiftRows(); AddRoundKey(Nr); } static void InvCipher(void) { uint8_t round=0; // Add the First round key to the state before starting the rounds. AddRoundKey(Nr); // There will be Nr rounds. // The first Nr-1 rounds are identical. // These Nr-1 rounds are executed in the loop below. for(round=Nr...
ime_range(now - SECONDS_PER_DAY, now, &range); cl_assert(result); cl_assert_equal_range(range, ((HealthServiceTimeRange){ .last_day_idx = 0, .num_days = 2, .seconds_first_day = 53258, .seconds_last_day = 33142, .seconds_total_last_day = 33142, })); } void test_health__range_to_day_id_respects...
(result, 1000)
; // yesterday result = health_service_sum(HealthMetricStepCount, time_util_get_midnight_of(now) - SECONDS_PER_DAY, time_util_get_midnight_of(now)); cl_assert_equal_i(result, 2000); // yesterday and today result = health_service_sum(HealthMetricSte...
distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "mbuf.h" #include "kernel/pbl_malloc.h" #include "system/l...
{ total += m->length; m = m->next; }
return total; } // MBuf chain management //////////////////////////////////////////////////////////////////////////////// void mbuf_append(MBuf *m, MBuf *new_mbuf) { PBL_ASSERTN(m); // advance to the tail while (m->next) { m = m->next; } m->next = new_mbuf; } void mbuf_clear_next(MBuf *m) { PBL_A...
\n" " add r0, r0, #4 \n" : [regs] "+r" (regs) : : "r0", "r1" ); } else if (g_stacked_regs != NULL) { // Copy the stacked registers from the stacked register set s_thread_info.ti.registers[portCANONICAL_REG_INDEX_R0] = g_stacked_regs[Stacked_Register_R0]; ...
printf(".text CRC32 does not match!\n")
; } // Reset the DMA controller for (HW_DMA_CHANNEL channel = HW_DMA_CHANNEL_0; channel < HW_DMA_CHANNEL_INVALID; channel++) { hw_dma_channel_enable(channel, HW_DMA_STATE_DISABLED); } // Configure the SPI module. hw_spi_reset(s_spi->bus_id); hw_spi_init(s_spi->bus_id, &s_spi->hw_init); // Configu...
/* * 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...
ble_root_keys_get_and_generate_if_needed(config->root_keys)
; dis_get_info(&config->dis_info); #if CAPABILITY_HAS_BUILTIN_HRM config->is_hrm_supported_and_enabled = ble_hrm_is_supported_and_enabled(); PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing prefs: is_enabled=%u", config->is_hrm_supported_and_enabled); #endif s_comm_is_running = bt_driver_start(config); kern...
ired */, GAPLEClientApp); cl_assert_equal_i(e, BTErrnoOK); // Device isn't connected. Verify no event was caused as a result of the // registration. prv_assert_no_event(); // Connect & verify the client task gets the event: prv_fake_connect(&device, false /*...
(&device, false /* connected */, (1 << PebbleTask_App), GAPLEConnectHCIReasonExtensionAirPlaneMode)
; } // ----------------------------------------------------------------------------- // Auto-reconnect Tests void __disabled_test_gap_le_connect__single_client_no_autoreconnect(void) { BTDeviceInternal device = prv_dummy_device(1); // Register connection intent for app: gap_le_connect_connect(&device, ...
l prv_get_value(uint16_t conn_idx, uint16_t value_handle, uint8_t response[READ_RESPONSE_BUFFER_SIZE], size_t *response_length_out) { if (value_handle == s_pps_ctx.att_hdl.conn_status) { *response_length_out = prv_handle_connection_state_read(conn_idx, response)...
{ connection_set_subscribed_to_conn_param_notifications(connection, is_subscribed); value_handle = s_pps_ctx.att_hdl.conn_params; }
else { PBL_LOG(LOG_LEVEL_ERROR, "Unknown CCCD handle %u!", evt->handle); return ATT_ERROR_INVALID_HANDLE; } if (is_subscribed) { prv_send_notification(evt->conn_idx, value_handle); } return ATT_ERROR_OK; } static att_error_t prv_handle_mtu_value_write(const ble_evt_gatts_write_req_t *evt) { if...
ebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable); TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(touch_event, 0, TouchEvent_Touchdown, &GPoint(15, 100), 3686400, ...
(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(10, 10), 20, 5, true)
; // No touch event generated when finger remains stationary touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686420); touch_event = touch_event_queue_get_event(0, 1); cl_assert_equal_p(touch_event, NULL); } void test_touch__handle_update_merge_position(void) { touch_set_touch_state(0, Touc...
->qspi, instruction, 0, dummy_cycles, buffer_pol, size, is_ddr); profiler_stop(); uint32_t pol_time = profiler_get_total_duration(true); if (memcmp(buffer_dma, buffer_pol, size) != 0) { prompt_send_response("FAILURE: buffer_dma != buffer_pol"); success = false; } if (memcmp(buffer_dma, buffer_mmap, s...
{ ++passes; }
(is_selected ? MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT : MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT)); } // Settings Window: //////////////////////// static void prv_settings_window_load(Window *window) { SettingsData *data = window_get_user_data(window...
(&data->menu_layer)
); } } void settings_menu_reload_data(SettingsMenuItem category) { SettingsData *data = app_state_get_user_data(); if (data->current_category == category) { menu_layer_reload_data(&data->menu_layer); } } int16_t settings_menu_get_selected_row(SettingsMenuItem category) { SettingsData *data = app_state_g...
-------------------------------------- static void cl_assert_equal_gtransform(const GTransform a, const GTransform b) { cl_assert_equal_i(a.a.raw_value, b.a.raw_value); cl_assert_equal_i(a.b.raw_value, b.b.raw_value); cl_assert_equal_i(a.c.raw_value, b.c.raw_value); cl_assert_equal_i(a.d.raw_value, b.d.raw_valu...
prv_advance_by_ms_no_timers(dst_time - now)
ingFormatYear2Digit: // yes, we want to keep leading zeros in both cases for year as we control the format // exclusively via the strftime format return false; } return false; } static size_t prv_to_locale_buffer(jerry_value_t this_val, jerry_length_t argc, cons...
{ return prv_to_locale_time_or_date_string(this_val, argc, argv, ToStringFormatLocaleDate, ToStringFormatEmpty); }
cess(task, &event); } // --------------------------------------------------------------------------------------------- //! Init the context variables for a task. void process_manager_init_context(ProcessContext* context, const PebbleProcessMd *app_md, const void *args) { PBL_ASSERT...
if ((config->common.reason == APP_LAUNCH_WAKEUP) && (config->common.args != NULL)) { fetch_args->wakeup_info = *(WakeupInfo *)config->common.args; fetch_args->common.args = &fetch_args->wakeup_info; }
PebbleEvent e = { .type = PEBBLE_APP_FETCH_REQUEST_EVENT, .app_fetch_request = { .id = id, .with_ui = true, .fetch_args = fetch_args, }, }; event_put(&e); return; } else { // tell the app cache that we are launching this applicati...
, -888}, { -184, -504, -888}, { -184, -496, -888}, { -184, -488, -904}, { -192, -504, -888}, { -184, -496, -896}, { -184, -512, -896}, { -184, -496, -896}, { -192, -488, -888}, { -184, -512, -888}, { -184, -488, -896}, { -184, -496, -888}, { -184, -480, -896}, { -184,...
{ -152, -144, -1008}, { -160, -152, -976}, { -152, -144, -1008}, { -152, -136, -992}, { -160, -152, -984}, { -160, -160, -984}, { -152, -168, -992}, { -144, -168, -1008}, { -160, -176, -984}, { -160, -168, -992}, { -160, -168, -992}, { -160, -168, -1000}, // 71 second...
{ -152, -136, -992}, // 73 seconds { -152, -152, -992}, { -168, -136, -992}, { -168, -120, -984}, { -160, -128, -1000}, { -152, -144, -992}, { -144, -144, -1000}, { -152, -136, -992}, { -152, -136, -984}, { -160, -136, -1008}, { -152, -136, -992}, { -160, -152, -976}...
the core dump typedef struct { void* start; uint32_t length; bool word_reads_only; // Some peripherals can only be read 32 bits at a // time, or you BusFault (maybe). Set this to true // for memory regions where reads smaller than 32 ...
(ctx, msg)
; pulse_logging_log_sync_append(ctx, buffer); pulse_logging_log_sync_send(ctx); #else int max_length = 256; while (*msg && max_length--) { dbgserial_putchar(*msg); ++msg; } dbgserial_putstr(buffer); #endif } static NORETURN prv_reset(void) { dbgserial_flush(); system_hard_reset(); } // -------...
/* * 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_handle_result_common(msg->result, app_initiated, msg->session_id, &msg->attr_list, attr_list_size, &app_uuid)
) { return; } GenericAttribute *transcription_attr = generic_attribute_find_attribute(&msg->attr_list, VEAttributeIdTranscription, attr_list_size); if (!transcription_attr || transcription_attr->length == 0) { PBL_LOG(LOG_LEVEL_WARNING, "No transcription attribute found"); voice_handle_dictati...
/* * 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_get_user_data(window)
; Layer *layer = &data->text_layer.layer; GRect to_rect; if (data->toggle) { to_rect = GRect(4, 4, 120, 60); } else { to_rect = GRect(84, 92, 60, 60); } data->toggle = !data->toggle; // Does nothing if prop_animation is NULL if (data->prop_animation) { animation_unschedule(property_animati...
/* * 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...
health_data_update(health_app_data->health_data)
; } health_card_view_mark_dirty(health_app_data->health_card_view); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Initialization and Termination // //! Initialize application static void prv_finish_initilization_cb(bool in_focus) { if (in_focus) { ...
<btutil/bt_device.h> #include <stdio.h> #include <string.h> #define HEADER_BUFFER_SIZE 22 #define SHARING_HEART_RATE_EXTRA_HEIGHT_PX (18) typedef enum SettingsBluetooth { SettingsBluetoothAirplaneMode, SettingsBluetoothTotal, } SettingsBluetooth; enum { BluetoothIconIdx, BluetoothAltIconIdx, AirplaneIcon...
{ bt_persistent_storage_for_each_bt_classic_pairing(prv_add_bt_classic_remote, data); }
static bool dual_remote_filter(ListNode *node, void *data) { StoredRemote *classic_remote = (StoredRemote *) node; BTDeviceInternal *device = (BTDeviceInternal *) data; BTDeviceInternal le_device_with_classic_address = (const BTDeviceInternal) { .address = classic_remote->classic.bd_addr, .is_random_add...
ction if (rot_end.y.integer != rot_start.y.integer) { start_is_down = rot_end.y.integer > rot_start.y.integer; found_start_direction = true; } rot_end = rot_start; } const int16_t clip_min_x = ctx->draw_state.clip_box.origin.x - ctx->draw_state.drawing_box.origin.x; const int16_t c...
intersections_down[intersection_down_count].x.raw_value = x.raw_value; intersections_down[intersection_down_count].delta = delta; intersection_down_count++; } else { intersections_up[intersection_up_count].x.raw_value = x.raw_value; intersections_up[...
} // sort the intersections sortIntersections(intersections_up, intersection_up_count); sortIntersections(intersections_down, intersection_down_count); // draw the line segments for (int j = 0; j < MIN(intersection_up_count, intersection_down_count); j++) { Intersection x_a = intersecti...
terval = prv_get_supported_sampling_interval(interval_us); // FIXME: For now, tie us to 125Hz. 125Hz is a rate that is easy enough to // subsample to all of our supported accel service rates, and also cuts down power consumption // from the 140uA range to 100uA. // Being able to sample at a lower rate like 38H...
bma255_write_register(BMA255Register_INT_EN_1, en_value)
; prv_update_accel_interrupts(enable_int, AccelOperatingMode_Data); } void accel_set_num_samples(uint32_t num_samples) { // Disable interrupts so they won't fire while we change sampling rate prv_configure_fifo_interrupts(false, false); // Workaround some bma255 issues: // Need to use Standby Mode to read/...
er_set_selected_next(&l, false, MenuRowAlignNone, false); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section); cl_assert_equal_i(4, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(4 * basic_cell_height, l.selection.y); menu_layer_set_selected_next(&l, false, MenuRowAlignNone, false); cl...
GPoint(0, cell_index->row * 44)
); cl_assert_equal_gpoint(actual, expected); } int prv_num_sublayers(const Layer *l) { int result = 0; Layer *child = l->first_child; while (l) { l = l->next_sibling; result++; } return result; } void test_menu_layer__menu_cell_is_part_of_hierarchy(void) { menu_layer_init(&s_menu_layer_hierarchy...
storage__find_ancs_id(void) { Uuid i1; uuid_generate(&i1); TimelineItem e1 = { .header = { .id = i1, .type = TimelineItemTypeNotification, .status = 0, .ancs_uid = 0, .layout = LayoutIdGeneric, .timestamp = 0x53f0dda5, }, .attr_list = { .num_attributes = ARRAY...
(notification_storage_find_ancs_notification_by_timestamp(&test, &h))
gestas libero. Aliquam luctus, metus quis ultricies sagittis, " "nisi orci viverra felis, vitae luctus massa dolor sit amet dolor. Cras " "mattis velit vitae pretium pulvinar. Pellentesque auctor, turpis at cras " "amet."; _Static_assert(sizeof(lipsum) > PERSIST_STRING_MAX_LENGTH, "lipsum string is...
PASSED(persist_write_int(0, 0))
/* * 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; }
// Update the relevant mask row pixel values for (int x = min_x; x <= max_x; x++) { const GPoint p = GPoint(x, y); // Calculate the new mask pixel value const GColor8Component src_color_luminance = gcolor_get_luminance(color); const uint8_t current_mask_value = graphics_private_raw_mask_get_value...
{ // Simulate the client goes away: s_can_handle_characteristic = false; PebbleEvent e = (PebbleEvent) { .type = PEBBLE_BLE_GATT_CLIENT_EVENT, .bluetooth.le.gatt_client = { .object_ref = TestCharacteristicInstanceCompleteOne, .value_length = 1, .gatt_error = BLEGATTErrorSuccess, ....
void test_kernel_le_client__service_added(void) { uint8_t num_services_added = ARRAY_LENGTH(s_service_handles); PebbleBLEGATTClientServiceEventInfo *info = kernel_malloc(sizeof(PebbleBLEGATTClientServiceEventInfo) + (num_services_added * sizeof(BLEService))); *info = (PebbleBLEGATTCli...