prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
t BTDeviceInternal *device); void test_gatt_client_discovery__rediscover_not_already_running(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); prv_simulate_and_assert_discovery_of_one_service(&device)...
(&device, BTErrnoOK)
/* * 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...
for (uint32_t i = 0; (i < count) && !failed; i++) { failed = (indices[i] != ((RecognizerHandled *)node)->idx); node = list_get_next(node); }
} if (failed) { node = *list; printf(" != { "); for (uint32_t i = 0; i < count; i++) { printf("%d, ", ((RecognizerHandled *)node)->idx); node = list_get_next(node); } printf("}"); } printf("\n"); cl_assert(!failed); prv_clear_recognizers_processed(list); } static void prv_...
_length != header.value_length)) { PBL_LOG(LOG_LEVEL_ERROR, "Couldn't copy the number of requested byes (%u vs %u)", header.value_length, copied_length); } *characteristic_ref_out = header.characteristic; *value_length_in_out = copied_length; } else { PB...
{ const GATTClientSubscriptionNode *subscription = (const GATTClientSubscriptionNode *) node; const BLECharacteristic characteristic_ref = (BLECharacteristic) data; return (subscription->characteristic == characteristic_ref); }
static GATTClientSubscriptionNode * prv_find_subscription_for_characteristic( BLECharacteristic characteristic_ref, GAPLEConnection *connection) { ListNode *head = (ListNode *) connection->g...
eeded(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_driv...
prv_track_quick_airplane_mode_toggles(!enabled)
; bt_persistent_storage_set_airplane_mode_enabled(enabled); s_comm_airplane_mode_on = enabled; bool should_schedule_eval = false; if (!s_comm_state_change_eval_is_scheduled) { should_schedule_eval = true; s_comm_state_change_eval_is_scheduled = true; } mutex_unlock(s_comm_state_change_mutex); if (...
ed on a Thursday, // orrrrr Wednesday and this year is a leap year. return 1; } else { return 0; } } static int prv_iso8601_year(const struct tm *t) { const int year = prv_full_year(t->tm_year); return year + prv_iso8601_adjust(t, year); } static int prv_iso8601_week(const struct tm *t) { const ...
(time_locale->mon[t->tm_mon % MONTHS_PER_YEAR])
; break; case 'B': FMT_STRCOPY_I18N(time_locale->month[t->tm_mon % MONTHS_PER_YEAR]); break; case 'c': FMT_RECURSE_I18N(time_locale->c_fmt); _fmt_recurse: if (!use_i18n && i18nstr) { cpystr = i18nstr; i18nstr = NULL; } if (i18nstr) ...
{ -1128, 576, -208}, { -1176, -8, -40}, { -1008, 104, -112}, { -1920, 136, -80}, { -1112, 144, 24}, { -1080, 344, -304}, { -1008, 192, -224}, { -768, 56, -112}, { -512, 216, -232}, { -456, 304, -248}, { -616, 408, -336}, { -792, 416, -360}, { -944, 264, -368}, { -46...
{ -440, 152, -136}, { -328, 224, -144}, { -392, 208, 16}, { -440, 560, -64}, { -576, 688, -8}, { -568, 896, -72}, { -464, 992, -48}, { -472, 1016, -56}, // 70 seconds { -600, 928, 0}, { -736, 904, 8}, { -1264, 1088, 104}, { -1232, 784, 360}, { -1312, 1200, -240}, ...
{ -152, 608, 112}, { -8, 536, 48}, { -16, 448, 96}, { -48, 672, 24}, { -144, 896, 120}, { -232, 1048, 40}, { -464, 1056, 120}, { -576, 992, -192}, { -328, 1056, -240}, { -504, 960, -8}, { -456, 1208, 16}, { -448, 1120, 32}, { -384, 1040, 48}, { -88, 688, -128}, ...
ndler_t handler_p) { return (jerry_value_t)EM_ASM_INT({ return __jerry_create_external_function($0); }, handler_p); } jerry_value_t jerry_create_number(double value) { return (jerry_value_t)EM_ASM_INT({ return __jerryRefs.ref($0); }, value); } jerry_value_t jerry_create_number_infinity(bool ne...
if (jerry_value_has_error_flag(value_to_set) || !jerry_value_is_object(obj_val) || !jerry_value_is_string(prop_name_val)) { return TYPE_ERROR_ARG; }
num_consec_request_failures++; PBL_LOG(LOG_LEVEL_ERROR, "HC request timed out (endpoint:%d, command:%"PRIu8")", end_id, cmd_id); if (prv_check_initialized() && (s_num_consec_request_failures >= NUM_CONSEC_FAILURES)) { core_dump_and_reset_or_reboot(); } } return response; } HcProtocol...
if (!expectation) { prv_unlock(); return false; }
// Make a heap copy if needed, or transfer ownership if the message is already heap-allocated: HcProtocolMessage *response_heap_copy; if (*should_free) { *should_free = false; response_heap_copy = message; } else { response_heap_copy = (HcProtocolMessage *) kernel_malloc_check(message->message_len...
ce with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expr...
{ HcAnalyticsRebootInfo *info = (HcAnalyticsRebootInfo *) &msg->payload[0]; HcAnalyticsRebootInfo *copy = kernel_malloc(sizeof(*info)); if (copy) { memcpy(copy, info, sizeof(*info)); // We put to system task because analytics need to be init'ed first system_task_add_callback(pr...
case HcMessageID_Analytics_LogBleMicErrorEvent: { HcAnalyticsLogBleMicErrorEvent *info = (HcAnalyticsLogBleMicErrorEvent *)&msg->payload[0]; bluetooth_analytics_ble_mic_error(info->num_subsequent_mic_errors); break; } default: break; } }
memset(workout_glance->subtitle, 0, sizeof(workout_glance->subtitle))
; glance_changed = true; } // Broadcast to the service that we changed the glance if it was changed if (glance_changed) { launcher_app_glance_structured_notify_service_glance_changed(structured_glance); } // Bail since no workout is going on return; } // Set icon for the ongoi...
/* * 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...
dbgserial_putstr(buffer)
; }
led */, s_intensity_labels, data); } // Timeout Settings ///////////////////////////// static const uint32_t s_timeout_values[] = { 3000, 5000, 8000 }; static const char *s_timeout_labels[] = { i18n_noop("3 Seconds"), i18n_noop("5 Seconds"), i18n_noop("8 Seconds") }; static int prv_timeout_get_selection_index...
{ SettingsDisplayData *data = (SettingsDisplayData*) context; const char *title = NULL; const char *subtitle = NULL; switch (prv_get_item_from_row(row)) { case SettingsDisplayLanguage: title = i18n_noop("Language"); subtitle = i18n_get_lang_name(); break; case SettingsDisplayBacklightM...
/* * 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 (!advance_slackers) { return false; }
return true; } status_t app_cache_app_launched(AppInstallId id) { return 0; } void app_manager_put_launch_app_event(const AppLaunchEventConfig *config) { app_run_state_send_update(&app_manager_get_current_app_md()->uuid, RUNNING); } void process_manager_put_kill_process_event(PebbleTask task, bool gracefully)...
app_run_state_protocol_msg_callback(&session, (uint8_t*)&msg, sizeof(msg))
; cl_assert_equal_i(s_launcher_deprecated_messages, 0); cl_assert_equal_i(s_app_run_state_messages, msg_count); } app_run_state_protocol_msg_callback(NULL, (uint8_t*)&msg, sizeof(msg)); cl_assert_equal_i(s_launcher_deprecated_messages, 1); }
_health_service_state(); } else if (task == PebbleTask_Worker) { result = worker_state_get_health_service_state(); } else { WTF; } // clients can free the cache by calling health_service_events_unsubscribe() if (result && ensure_cache_initialized && result->cache == NULL) { result->cache = applib...
sys_get_current_app_sdk_version()
/* * 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_test_backing_data(2, 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...
{ return false; }
ue.h" #include "semphr.h" // Structure of a timer typedef struct TaskTimer { //! Entry into either the running timers (manager->running_timers) list or the idle timers //! (manager->idle_timers) ListNode list_node; //! The tick value when this timer will expire (in ticks). If the timer isn't currently //! ...
{ mutex_unlock(manager->mutex); return false; }
// Remove it from its current list if (timer->expire_time) { PBL_ASSERTN(list_contains(manager->running_timers, &timer->list_node)); list_remove(&timer->list_node, &manager->running_timers /* &head */, NULL /* &tail */); } else { PBL_ASSERTN(list_contains(manager->idle_timers, &timer->list_node)); ...
_x, clip_max_x)) { goto cleanup; } // x-intersections of path segments whose direction is up intersections_up = applib_zalloc(path->num_points * sizeof(int16_t)); // x-intersections of path segments whose direction is down intersections_down = applib_zalloc(path->num_points * sizeof(int16_t)); // If e...
{ if (!points) { return; } // draw precise path (no real support currently for paths with GPointPrecise) for (uint16_t i = 0; i < (open ? (num_points - 1) : num_points); ++i) { size_t i2 = (i + 1) % num_points; graphics_line_draw_precise_stroked(ctx, points[i], points[i2]); } }
/* * 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...
(option_menu)
uded_services[att_idx] = item->i.start_h; att_idx++; PBL_LOG(LOG_LEVEL_DEBUG, "Found Include, Start Handle 0x%x", item->i.start_h); } } return payload; failure: kernel_free(payload); return NULL; } static void prv_write_cccd_cb(const ble_evt_gattc_write_completed_t *evt) { if (evt->status !...
(PEBBLE_BT_PPOGATT_SERVICE_UUID_32BIT)
}; if (uuid_equal(&payload->service.uuid, &ppogatt_uuid)) { PBL_LOG(LOG_LEVEL_DEBUG, "PPoGATT found"); ppogatt_emulated_notify_phone_ppogatt_server_found(connection); } kernel_free(payload); prv_search_service_changed_handle(connection, service); } void gatt_client_discovery_handle_complete(const ble...
// StateStartWaitForReady StateWaitForReady, StateRecording, // StateStopWaitForReady StateRecording, StateWaitForResponse, // StateStopRecording StateWaitForResponse, StateTransitionToText, // StateStopWaitForResponse StateTransitionToText, StateError, StateFinished, ...
graphics_context_set_fill_color(ctx, GColorBlack)
; graphics_fill_circle(ctx, grect_center_point(&layer->bounds), data->mic_window.mic_dot_radius); } static void prv_set_dot_width(void *subject, int16_t radius) { VoiceUiData *data = subject; data->mic_window.mic_dot_radius = radius; layer_mark_dirty(&data->mic_window.mic_dot_layer); } static PropertyAnimatio...
{ // Created / Edited prv_update_alarm_list(data); prv_update_menu_layer(data, id); } } static void prv_handle_alarm_event(PebbleEvent *e, void *callback_context) { AlarmsAppData *data = (AlarmsAppData *)callback_context; prv_update_alarm_list(data); } static void prv_create_new_alarm(AlarmsAppData* da...
list_get_at((ListNode*)data->alarm_list_head, cell_index->row - 1)
; // Format 1: 10:34 AM // Format 2: 14:56 char alarm_time_text[9]; clock_format_time(alarm_time_text, sizeof(alarm_time_text), node->info.hour, node->info.minute, true); const char *enabled = node->info.enabled ? i18n_get("ON", data) : i18n_get("OFF", data); graphics_context_set_compo...
/* * 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...
load_system_resources_fixture()
; s_data = (TimelineTestData) {}; } void test_timeline_no_events__cleanup(void) { } // Helpers ////////////////////// void prv_init_peek_layer(TimelineAppData *data); void prv_setup_no_events_peek(TimelineAppData *data); static void prv_create_no_events_and_render(bool past) { Window *window = &s_data.app.time...
/* * 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_ERROR, "ble_gap_channel_map_get err: %x", e)
; } HcAnalyticsCollectBleParameters data = { .success = success, .le_chan_map_res = channel_map, }; hc_protocol_enqueue_response(msg, (uint8_t *)&data, sizeof(data)); } static void prv_handle_get_connection_quality(const HcProtocolMessage *msg) { HcAnalyticsGetConnectionQuality data = {}; const ...
oard.h" #include "console/prompt.h" #include "drivers/battery.h" #include "drivers/gpio.h" #include "drivers/i2c.h" #include "drivers/exti.h" #include "drivers/periph_config.h" #include "system/logging.h" #include "os/mutex.h" #include "system/passert.h" #include "kernel/util/delay.h" #include "util/size.h" #include "k...
(I2C_MAX14690, register_address, result)
; i2c_release(I2C_MAX14690); return (rv); } static bool prv_write_register(uint8_t register_address, uint8_t value) { i2c_use(I2C_MAX14690); bool rv = i2c_write_register(I2C_MAX14690, register_address, value); i2c_release(I2C_MAX14690); return (rv); } // Configure PMIC's charger settings (different from d...
_FLASH_FINALIZE (0x15) #define OPCODE_FLASH_READ (0x16) // flash regions #define REGION_PRF (0x01) #define REGION_RESOURCES (0x02) #define REGION_FW_SCRATCH (0x03) #define REGION_PFS (0x04) #define REGION_COREDUMP (0x05) // flash read flags #define FLASH_READ_FLAG_ALL_SAME (1 << 0) typedef struct PACKED { uint8_t ...
crc32(checksum, &header, sizeof(header))
; if (payload && length) { checksum = crc32(checksum, payload, length); } prv_encode_and_send_data(&checksum, sizeof(checksum)); accessory_send_byte(HDLC_FLAG); accessory_enable_input(); } // Request processing //////////////////////////////////////////////////////////////////// static void prv_erase_...
(uuid_equal(&state.pin.header.id, &s_items[0].header.id))
; cl_assert(state.node); } void test_timeline__none_forwards(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421188000), 2); } void test_timelin...
_peek_current_activities()); // Start on known boundary struct tm start_tm = { // Jan 1, 2015, 5am .tm_hour = 5, .tm_mday = 1, .tm_mon = 0, .tm_year = 115 }; time_t utc_sec = mktime(&start_tm); rtc_set_time(utc_sec); // Add a run session const time_t time_elapsed = (20 * SECONDS_PER_...
activity_sessions_is_session_type_ongoing(ActivitySessionType_Walk)
); cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Sleep)); cl_assert_equal_i(0, health_service_peek_current_activities()); // Start on known boundary struct tm start_tm = { // Jan 1, 2015, 5am .tm_hour = 5, .tm_mday = 1, .tm_mon = 0, .tm_year = 115 ...
/* * 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...
(16, 2, 28, 20)
, 4); } void across_nx_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_round_rect(ctx, &GRect(-14, 2, 28, 20), 4); } void across_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_conte...
eck_for_recovery_start_failure() { return boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS); } static bool check_for_fw_start_failure() { // Add more failure conditions here. if (!watchdog_check_reset_flag() && !boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { // We're good, we're just starting normally...
dbgserial_putstr("<___/|_||_||_\\_\\")
(GRect) { { 5, 5}, { 10, 10 } }; uint8_t dest_data[50*50]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = 50, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = { { 0, 0 }, { 50, 50 } } }; memset(dest_data, GColorGreen.argb, sizeof(dest_data))...
memset(dest_data, GColorGreen.argb, sizeof(dest_data))
; const GRect dest_rect = GRect(4, 4, 140, 55); const GPoint src_origin_offset = GPoint(39, 11); src_bitmap->bounds = (GRect) { { 37, 3}, { 63, 23 } }; bitblt_bitmap_into_bitmap_tiled_1bit_to_8bit(&dest_bitmap, src_bitmap, dest_rect, src_origin_offset, GCompOpAssi...
ter_state->node = orig; return false; } } while (!prv_show_event(timeline_iter_state->node, timeline_iter_state->start_time, timeline_iter_state->midnight, timeline_iter_state->direction, timeline_iter_state->show_all_day_events) || !timeline_exists(&timeline_iter_state->node->id)); tim...
time_util_get_midnight_of(now)
RSION_SIZE) || hwver[hwver_size] != '\0') { return MfgSerialsResultFailIncorrectLength; } return prv_mfg_write_data_to_slot(OTP_HWVER_SLOT_INDICES, ARRAY_LENGTH(OTP_HWVER_SLOT_INDICES), hwver, hwver_size, out_index); } void command_serial_read(void) { prompt_send_response(...
{ return; }
ion; } GAPLEConnection *gap_le_connection_by_gatt_id(unsigned int connection_id) { return &s_connection; } bool gap_le_connection_is_valid(const GAPLEConnection *conn) { return true; } GAPLEConnection *gap_le_connection_any(void) { return NULL; } uint16_t gaps_get_starting_att_handle(void) { return 4; } GA...
fake_gatt_put_discovery_indication_gatt_profile_service(TEST_GATT_CONNECTION_ID, false /* has_service_changed_characteristic */)
; cl_assert_equal_i(s_last_handle_discovery_result, Handled); } // Characteristic Value Indications /////////////////////////////////////////////////////////// void test_gatt_service_changed_client__handle_indication_non_service_changed(void) { fake_gatt_put_discovery_indication_gatt_profile_service(TEST_GATT_CON...
= { .num_attributes = 1, .attributes = &title_attr, }, }; static TimelineItem item2 = { .header = { .id = {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, .timestamp = 15*60, .duration = 20, .type = TimelineItemTypePin, .all_d...
cl_assert(timeline_add(&item1))
; timeline_event_handle_blobdb_event(); rtc_set_time(15 * 60); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert(timer_id != TIMER_INVALID_ID); cl_assert(stub_new_timer_is_scheduled(timer_i...
} graphics_context_set_text_color(ctx, TEXT_COLOR); graphics_draw_text(ctx, i18n_get(prv_get_label_for_metric(metric_type, active_window), i18n_owner), fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD), label_box, overflow_mode, ...
active_window->workout_controller->get_metric_value( metric_type, active_window->workout_data)
); const bool draw_zones = (metric_type == WorkoutMetricType_Hr) && hr_zone > HRZone_Zone0; const bool prefer_larger_font = active_window->layout == WorkoutLayout_SingleMetric || active_window->layout == WorkoutLayout_StaticAndScrollable; prv_render_metric(ctx, metric_type, laye...
t of GBitmap palette = NULL; } // Set the image or pixel data gbitmap_set_data(bitmap, upng_buffer, format, gbitmap_format_get_row_size_bytes(width, format), true); gbitmap_set_bounds(bitmap, (GRect){.origin = {0, 0}, .size = {width, height}}); bitmap->info.version = GBITMAP_VERSION_CURRENT; if ...
if (upng) { upng_format png_format = upng_get_format(upng); if ((png_format >= UPNG_INDEXED1 && png_format <= UPNG_INDEXED8) || (png_format >= UPNG_LUMINANCE1 && png_format <= UPNG_LUMINANCE8)) { return true; } }
return false; } int32_t gbitmap_png_get_transparent_gray_value(upng_t *upng) { int32_t transparent_gray = -1; // default to invalid value // Handle grayscale transparency value (1 single transparent gray) uint8_t *alpha_palette = NULL; uint16_t alpha_palette_entries = upng_get_alpha_palette(upng, &alpha_p...
close(fd); } void test_app_cache__delete_binaries_for_id_with_no_entry(void) { // confirm binaries get created prv_create_file_for_id(17); cl_assert_equal_b(true, prv_file_for_id_exists(17)); // confirm binaries are deleted app_cache_remove_entry(17); cl_assert_equal_b(false, prv_file_for_id_exists(17)); ...
("@00000000/res", OP_FLAG_READ, FILE_TYPE_STATIC, 0)
< 0); cl_assert(pfs_open("@00000001/res", OP_FLAG_READ, FILE_TYPE_STATIC, 0) < 0); cl_assert(pfs_open("@ffffffff/res", OP_FLAG_READ, FILE_TYPE_STATIC, 0) < 0); // let's make sure the app and res files in the cache weren't deleted for (uint32_t i = 0; i < 15; ++i) { char filename[15]; int id = (i + 1) *...
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); // -------------------------...
prv_pfs_get_file_size(session->storage.fd)
; prv_release_session_file(session); } } return true; } // ---------------------------------------------------------------------------------------- // Get total amount of space we have allocated from the file system. This is the sum of the // file sizes of all the DLS files. static uint32_t prv_get_tota...
33) { // Make sure combinations of vmc/orient are mostly unique, so don't wrap at the same // module 256 boundary. next_vmc = 0; } minute_data[i].base.orientation = next_orient++; minute_data[i].base.light = next_light++; minute_data[i].base.plugged_in = next_plugged_in; next_plugg...
prv_create_test_data(num_minutes, minute_data)
(data); } static void prv_handle_tick_timer(struct tm *tick_time, TimeUnits units_changed) { prv_update_ui(app_state_get_user_data()); } #if !CAPABILITY_HAS_SDK_SHELL4 static void prv_launch_last_installed_app(ClickRecognizerRef recognizer, void *data) { const AppInstallId app_id = shell_sdk_get_last_installed_ap...
{ static const PebbleProcessMdSystem s_app_md = { .common = { .main_func = s_main, // UUID: 1197fc39-47e7-439b-82be-f56d9ba1dbd8 .uuid = { 0x11, 0x97, 0xfc, 0x39, 0x47, 0xe7, 0x43, 0x9b, 0x82, 0xbe, 0xf5, 0x6d, 0x9b, 0xa1, 0xdb, 0xd8 }, #if CAPABILITY_HAS_SDK_SHELL4 .proces...
e time into the clock prv_inc_time(1 * SECONDS_PER_MINUTE); // Open the app, confirm that we are now subscribed with no end in sight workout_service_frontend_opened(); cl_assert_equal_b(s_hrm_subscribed, true); cl_assert_equal_i(s_hrm_expiration, 0); prv_inc_time(1 * SECONDS_PER_MINUTE); cl_assert(worko...
(hr_zone_time_s[HRZone_Zone2], 10)
; cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 10); // Unpause workout cl_assert(workout_service_pause_workout(false)); prv_inc_time(10); prv_put_bpm_event(ZONE_3_HR, HRMQuality_Good); cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s)); cl_assert_equal_i(hr_zone_time_s[HRZone_...
vTaskInfoCallback( const xPORT_TASK_INFO * const task_info, void * data) { CoreDumpChunkHeader chunk_hdr; CoreDumpThreadInfo packed_info; void *current_task_id = (void *)xTaskGetCurrentTaskHandle(); prv_debug_str_str("CD: Th info ", task_info->pcName); // Unit testing various types of fault? if (s_test_f...
(&chunk_hdr, s_flash_addr, sizeof(chunk_hdr))
; s_flash_addr += prv_flash_write_bytes(&packed_info, s_flash_addr, chunk_hdr.size); } static void prv_write_memory_regions(const MemoryRegion *regions, unsigned int count, uint32_t flash_base) { CoreDumpChunkHeader chunk_hdr; chunk_hdr...
(SmartstrapAttributeInternal)); if (!new_attr) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to allocate attribute"); return false; } *new_attr = (SmartstrapAttributeInternal) { .service_id = service_id, .attribute_id = attribute_id, .mbuf = MBUF_EMPTY }; list_init(&new_attr->list_node); mbuf_set_...
{ return SmartstrapResultBusy; }
/* * 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...
{ AppData *data = app_malloc_check(sizeof(AppData)); *data = (AppData) { .vibe_count = 0 }; app_state_set_user_data(data); Window *window = &data->window; window_init(window, ""); window_set_fullscreen(window, true); TextLayer *title = &data->title; text_layer_init(title, &window->layer.bounds)...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ cl_must_pass(settings_file_open(file, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE)); }
void close_settings_file(SettingsFile *file) { settings_file_close(file); } // Tests //////////////////////////////////// void test_migrate_wakeup__initialize(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(false); // Load pre-migration wakeup entry onto pfs SettingsFile file; ...
{ 112, 464, -368}, { 272, 312, -232}, { 400, 224, -200}, { 440, 232, -272}, { 544, 216, -248}, { 568, 304, -272}, { 600, 480, -368}, { 504, 896, -424}, { 520, 1176, -248}, { 584, 1264, -504}, { 472, 1112, -568}, { 368, 800, -368}, { 448, 824, -232}, { 376, 936, -232},...
{ 96, 1048, -104}, { 200, 928, -264}, { 224, 688, -368}, { 256, 480, -272}, // 13 seconds { 272, 416, -216}, { 256, 392, -80}, { 352, 568, -16}, { 384, 600, -40}, { 448, 680, 8}, { 440, 848, -144}, { 472, 1000, -104}, { 424, 1520, 336}, { 440, 1824, 376}, { 40...
{ 840, 1160, 0}, { 632, 1016, -24}, { 480, 952, 144}, { 456, 880, 152}, { 232, 816, 40}, { 152, 616, -96}, { 224, 448, -104}, { 280, 344, -104}, { 360, 384, -152}, { 408, 456, -152}, // 16 seconds { 536, 544, -128}, { 688, 776, -152}, { 760, 944, -280}, { 728...
N_CHECK); #endif action_bar_layer_set_context(action_bar, window); action_bar_layer_set_icon(action_bar, BUTTON_ID_SELECT, actionable_dialog->select_icon); } else if (actionable_dialog->action_bar_type == DialogActionBarDecline) { #if !defined(RECOVERY_FW) actionable_dialog->select_icon = gbitmap_create_w...
(sizeof(ActionableDialog))
; if (actionable_dialog) { actionable_dialog_init(actionable_dialog, dialog_name); } return actionable_dialog; } void actionable_dialog_set_action_bar_type(ActionableDialog *actionable_dialog, DialogActionBarType action_bar_type, ...
layer = NULL; } static void prv_fail_then_reset_if_no_active_recognizers(RecognizerManager *manager) { bool other_recognizers_active = prv_fail_other_recognizers(manager); // Reset if all recognizers are complete or failed if (!recognizer_is_active(manager->triggered) && !other_recognizers_active) { prv_res...
layer_find_layer_containing_point(root, &touch_event->start_pos)
false); cl_assert_equal_i(s_path_fill_count, 0); cl_assert_equal_i(s_path_stroke_count, 0); cl_assert_equal_p(s_stroke_points, NULL); cl_assert_equal_p(s_fill_points, NULL); free(command); } void test_gdraw_command__draw_precise_path(void) { GDrawCommand *command = malloc(sizeof(GDrawCommand) + (sizeof(GP...
(s_path_num_points, 1)
; cl_assert_equal_b(s_radius, 300); cl_assert_equal_i(s_circle_fill_count, 0); cl_assert_equal_i(s_circle_stroke_count, 1); cl_assert(prv_compare_points(&center, s_stroke_points, s_path_num_points)); cl_assert_equal_p(s_fill_points, NULL); prv_reset(); // set stroke color to be transparent and restore fi...
meters(&s_phone_ui_data->call_status_text_layer, &call_status_text_rect, NULL, s_phone_ui_data->status_font, GColorBlack, PBL_IF_COLOR_ELSE(GColorClear, GColorWhite), PBL_IF_RECT_ELSE(...
prv_stop_ringing()
; prv_stop_call_duration_timer(); // This must be called before prv_set_status_text, otherwise the text will not be centered prv_action_bar_setup(PhoneCallActions_None); if (call_accepted) { prv_set_icon_resource(TIMELINE_RESOURCE_DURING_PHONE_CALL); prv_set_window_color(ACCEPT_COLOR, true); prv_...
prv_set_node_from_header(header, &node)
; const time_t now = rtc_get_time(); const time_t midnight = time_util_get_midnight_of(now); return prv_show_event(&node, now, midnight, direction, false /* show_all_day */); } #ifdef TIMELINE_SERVICE_DEBUG static void prv_debug_print_pins(TimelineNode *node0) { TimelineNode *node = (TimelineNode *)list_get_he...
prv_issue_command_argument(0, S29VSCommand_SectorLock)
; int lock_flag = (lock ? 0 : 1) << 7; // set A6 to 0 to lock and 1 to unlock ((__IO uint16_t*) (FMC_BANK_1_BASE_ADDRESS + sector_addr + lock_flag))[0] = S29VSCommand_SectorLock; } static uint16_t prv_read_manufacturer_id(void) { // Issue the DeviceIDEntry command to change to the ID-CFI Address Map...
s, and we // run into 5+ second erases pretty regularly. We're not holding the flash lock while we're // doing this, so other threads are allowed to use flash, but it's pretty common to hold // other locks while waiting for a flash operation to complete, leading to other tasks // triggering thei...
(num_locks)
&generic_glance->default_icon_resource_info)) { res_info_to_load = generic_glance->default_icon_resource_info; generic_glance->displayed_icon = prv_create_glance_icon(&res_info_to_load, legacy_icon_size_limit); } // If we don't have...
launcher_app_glance_structured_get_data(structured_glance)
; const TimelineResourceId timeline_res_id = (TimelineResourceId)glance->current_slice.icon_and_subtitle.icon_resource_id; // Initialize the resource info to be the default icon AppResourceInfo resource_info = generic_glance->default_icon_resource_info; // Override it if we have a valid timeline resourc...
timeline_iter_state->node->id)); timeline_item_free_allocated_buffer(&timeline_iter_state->pin); timeline_iter_state->pin = (TimelineItem){}; status_t rv = pin_db_get(&timeline_iter_state->node->id, &timeline_iter_state->pin); timeline_iter_state->current_day = time_util_get_midnight_of( timeline_iter_sta...
timeline_item_free_allocated_buffer(&pin)
t fpga image #include "mfg/spalding/spalding_boot.fpga.auto.h" // Stubs for fake_crc.c #include "services/normal/filesystem/pfs.h" int pfs_read(int fd, void *buf, size_t size) { return 0; } int pfs_seek(int fd, int offset, FSeekType seek_type) { return 0; } // Test Code! void test_spalding_mfg_info__initialize(void)...
cl_assert_equal_i(mfg_info_get_disp_offsets().x, -2)
; cl_assert_equal_i(mfg_info_get_disp_offsets().y, 1); cl_assert_equal_i(mfg_info_get_watch_color(), 3); cl_assert_equal_i(mfg_info_get_rtc_freq(), 4); mfg_info_get_model(buffer); cl_assert_equal_s(buffer, ""); // Make sure we have space for the model. mfg_info_set_model("test_model"); cl_as...
db_read, .del = ios_notif_pref_db_delete, .flush = ios_notif_pref_db_flush, .is_dirty = ios_notif_pref_db_is_dirty, .get_dirty_list = ios_notif_pref_db_get_dirty_list, .mark_synced = ios_notif_pref_db_mark_synced, }, [BlobDBIdPrefs] = { .init = prefs_db_init, .insert = prefs_db_insert, ...
(BlobDBEventTypeDelete, db_id, key, key_len)
/* * 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_gatts_service_changed_ind(device->conn_idx, start_handle, end_handle)
; } } }
/* * 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 (cur_entry == NULL) { // cache is not full new = entry_for_index(c, i); break; } else if (cur_entry->key == key) { // key already in cache, update *cur_ptr = cur_entry->more_recent; new = cur_entry; }
if (*cur_ptr == NULL) { break; } cur_ptr = &cur_entry->more_recent; } // cur_ptr should point to the last pointer in the list PBL_ASSERTN(*cur_ptr == NULL); if (new == NULL) { // cache full, evict LRU new = c->least_recent; c->least_recent = new->more_recent; } new->more_re...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const bool assert_all_unlocked = false; fake_mutex_reset(assert_all_unlocked); }
void test_fake_mutex__normal_mutex(void) { PebbleMutex *mutex = mutex_create(); mutex_lock(mutex); mutex_unlock(mutex); cl_assert_equal_b(fake_mutex_all_unlocked(), true); } void test_fake_mutex__leave_unlocked(void) { PebbleMutex *mutex = mutex_create(); mutex_lock(mutex); cl_assert_equal_b(fake_mutex...
/* * 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...
free(xQueue)
; } QueueHandle_t xQueueCreateMutex(unsigned char ucQueueType) { return (QueueHandle_t)1; } portBASE_TYPE xQueueTakeMutexRecursive(QueueHandle_t pxMutex, TickType_t xBlockTime) { return pdTRUE; } portBASE_TYPE xQueueGiveMutexRecursive(QueueHandle_t xMutex) { return pdTRUE; } BaseType_t xQueueGenericReset(Queu...
ency // covers 4 bit greyscale with transparency (black, white, dark_grey, light_grey, transparent) // Tests 1-bit jazzberry_jam colored palettized PNG loading into gbitmap // tests covers an old bug in image tooling where 1 color was 2 power 0 // so bitdepth was detected as 0 (incorrectly) // Result: // - gbitmap ...
TEST_PNG_FILE_FMT(1bitpalette)
); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(1bitpalette))); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat1BitPalette); } // Tests 2-bit greyscale PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__greyscale_2_bit(void) { GBitmap *bitmap = setup_p...
const uint16_t value_length) { const int32_t idx = prv_parse_queue_value(update->value_str, value_length); PBL_LOG(LOG_LEVEL_DEBUG, "Queue index update: %"PRId32, idx); // TODO: Do something with this info } static void prv_handle_queue_count_update(const AMSEntityUpdateNotification *update, ...
prv_handle_queue_shuffle_mode_update(update, value_length)
; return; case AMSQueueAttributeIDRepeatMode: prv_handle_queue_repeat_mode_update(update, value_length); return; default: break; } break; case AMSEntityIDTrack: switch (update->attribute_id) { case AMSTrackAttributeIDArtist: ...
- ctx->draw_state.drawing_box.origin.y; const int16_t clip_max_y = ctx->draw_state.clip_box.size.h + clip_min_y; min_y = MAX(min_y, clip_min_y); max_y = MIN(max_y, clip_max_y); // filling color hack GColor tmp = ctx->draw_state.stroke_color; ctx->draw_state.stroke_color = ctx->draw_state.fill_color; /...
(intersections_down)
; } #endif // PBL_COLOR void gpath_draw_filled_with_cb(GContext *ctx, GPath *path, GPathDrawFilledCallback cb, void *user_data) { //Protect against apps calling with no points to draw (Upright watchface) if (!path || path->num_points < 2) { return; } GPoint* rot_points = app...
free_flags[2] }, }; static const TestCacheItem ZERO_ITEM = {}; static void prv_destructor(void *item) { if (((TestCacheItem *)item)->freed) { *((TestCacheItem *)item)->freed = true; } } static int prv_comparator(void *a, void *b) { return ((TestCacheItem *)a)->id - ((TestCacheItem *)b)->id; } // setup an...
(&s_cache_buffer[2], &s_test_item[1], sizeof(TestCacheItem))
; } void test_circular_cache__flush(void) { circular_cache_set_item_destructor(&s_test_cache, prv_destructor); circular_cache_push(&s_test_cache, &s_test_item[0]); circular_cache_flush(&s_test_cache); cl_assert(*s_test_item[0].freed); cl_assert(!(*s_test_item[1].freed)); cl_assert(!(*s_test_item[2].freed...
// Configure SCS to be controlled in software; pull up to high when inactive gpio_cfg.GPIO_Mode = GPIO_Mode_OUT; gpio_cfg.GPIO_Pin = (1 << FLASH_CONFIG.scs_pin); gpio_cfg.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(FLASH_CONFIG.spi_gpio, &gpio_cfg); // Set up a SPI bus on SPI1 SPI_InitTypeDef spi_cfg; SPI_I2...
prv_enable_flash_spi_clock()
; prv_flash_start(); // Assume that last time we shut down we were asleep. Come back out. prv_flash_deep_sleep_exit(); prv_disable_flash_spi_clock(); prv_flash_whoami(); } bool flash_sanity_check(void) { return prv_is_whoami_correct(); } void flash_read_bytes(uint8_t* buffer, uint32_t start_addr, uint...
o profile power of the chip under certains states // NOTE: If you did not configure with `--nowatchdog`, the HW watchdog will reboot you in ~8s void command_enter_stop(void) { dbgserial_putstr("Entering stop mode indefinitely ... reboot your board to get out!!"); __disable_irq(); RTC_ITConfig(RTC_IT_WUT, DISABLE)...
atoi(iters)
; // It seems like advertising while doing this makes the issue more likely to happen // (I suspect because there are even more enters/exits from sleep happening) if (bt_test_chip_in_test_mode()) { prompt_send_response("You must run \"bt test stop\" to conduct sleep test!"); return; } prompt_send_re...
t's assume that's // the max worst case wait time. To account for some variance, let's wait // 100ms to play it safe. #define DIALOG_BOOTROM_DEFAULT_CHAR_TIMEOUT_MS (100) // For the revAE silicon, usually it takes ~220ms from deasserting RST to getting the // first chip ID character over the UART RX, but I've observed ...
{ PBL_LOG(LOG_LEVEL_ERROR, "Failed to load patch from system resources"); return false; }
for (uint32_t i = 0; i < read_len; i++) { running_xor ^= data_buf[i]; prv_send_char(data_buf[i]); } curr_offset += read_len; } // Note: As soon as we send the last byte, the bootROM will send the crc which is // simply an xor of the bytes transmitted char c; if (!prv_bootrom_wait_...
/* * 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...
(-153, 217)
; check_atan2(-28, -133); check_atan2(323, -229); check_atan2(245, 196); check_atan2(65, -3); check_atan2(331, -320); check_atan2(-151, 284); check_atan2(111, -98); check_atan2(-44, -17); check_atan2(269, -356); check_atan2(-78, 268); check_atan2(-247, 37); check_atan2(-119, 33); check_atan2(2...
elineResourceSize icon_res_size, TimelineResourceId resource, TimelineResourceId fallback_resource, const Uuid *app_id) { timeline_layout->icon_info = (TimelineResourceInfo) { .res_id = resource, .app_id = app_id, .fallback_id = fallback_resource }; AppResourceInfo *res_info = &timeline_layout->ic...
{ return &((TimelineLayout *)layout_ref)->colors; }
//////////////////////// // View //////////////////////// void timeline_layout_init_view(TimelineLayout *layout, LayoutLayerMode mode) { GTextNode *view_node = NULL; switch (mode) { case LayoutLayerModeCard: view_node = layout->impl->card_view_constructor(layout); break; case LayoutLayerModeP...
palding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, GBitmapFormat8BitCircular); cl_assert(NULL == bmp); bmp = gbitmap_create_blank(s180, GBitmapFormat8BitCircular); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos == bmp->data_row_infos);...
{ cl_assert_equal_i( 40, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat1Bit)); cl_assert_equal_i(130, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat8Bit)); cl_assert_equal_i( 20, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat1BitPalette)); cl_assert_equal_i( 40, prv_gbitmap_size_for_data...
fake_rtc_init(0, 0); pfs_init(false); // Note: creating a settings file is going to result in one malloc for the FD name pin_db_init(); time_util_update_timezone(&tz); fake_pbl_malloc_clear_tracking(); for (unsigned int i = 0; i < ARRAY_LENGTH(s_items); ++i) { cl_assert_equal_i(pin_db_insert_item(&s_ite...
timeline_model_get_iter_state(0)
== timeline_model_get_iter_state_with_timeline_idx(4)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(5)); cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(!has_next); cl_assert_equal_i(timeline_model_get_num_items(), 1); cl_assert(uuid_equa...
(s_circle_stroke_count, 1)
; cl_assert(prv_compare_points(&center, s_stroke_points, s_path_num_points)); cl_assert_equal_p(s_fill_points, NULL); prv_reset(); // set stroke color to be transparent and restore fill - fill should be drawn, but no outline // should be drawn gdraw_command_set_fill_color(command, GColorRed); color = gdr...
e, OP_FLAG_READ, 0, 0); cl_assert(fd >= 0); rv = pfs_read(fd, &read_buf[0], strlen(string)); cl_assert_equal_i(rv, strlen(string)); cl_assert(memcmp(string, read_buf, strlen(string)) == 0); pfs_close(fd); tmp_fd = pfs_open(file, OP_FLAG_OVERWRITE, FILE_TYPE_STATIC, strlen(overwrite_string)); cl_assert(tm...
(false /* write erase headers */)
ytics.h" #include "stubs_hexdump.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stu...
(key, value)
, sizeof(int)); cl_assert_equal_i(persist_get_size(key), sizeof(int)); cl_assert_equal_i(persist_read_int(key), value); } void test_persist__bool(void) { const uint32_t key = 0; cl_assert_equal_i(persist_read_bool(key), false); cl_assert_equal_i(persist_write_bool(key, true), sizeof(bool)); cl_assert_equal...
name_out, &platform_bits_out); cl_assert(!ret); } void test_bluetooth_persistent_storage_prf__delete_bt_classic_pairing_by_addr(void) { bool ret; // Output variables BTDeviceAddress addr_out; SM128BitKey link_key_out; char name_out[BT_DEVICE_NAME_BUFFER_SIZE]; uint8_t platform_bits_out; // Store a new...
cl_assert(ret)
; cl_assert_equal_i(type_out, BtPersistBondingTypeBTClassic); ret = bt_persistent_storage_has_active_bt_classic_gateway_bonding(); cl_assert(ret); ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(!ret); // Delete the pairing. bt_persistent_storage_delete_bt_classic_pairing_by_id(i...
(TIMELINE_CARD_MARGIN, 0, frame->size.w - 2 * TIMELINE_CARD_MARGIN, TIMELINE_MAX_BOX_HEIGHT)
; } static void prv_render_view(TimelineLayout *layout, GContext *ctx, bool render, GSize *size_out) { const bool is_card = (layout->layout_layer.mode == LayoutLayerModeCard); const bool is_peek = (layout->layout_layer.mode == LayoutLayerModePeek); const bool UNUSED paging = PBL_IF_ROUND_ELSE((is_card || is_peek...
RGB8}, {"bulgarianrose", GColorBulgarianRoseARGB8}, {"imperialpurple", GColorImperialPurpleARGB8}, {"indigo", GColorIndigoARGB8}, {"electricultramarine", GColorElectricUltramarineARGB8}, {"armygreen", GColorArmyGreenARGB8}, {"darkgray", GColorDarkGrayARGB8}, {"liberty", GColorLibertyARGB8}, {"verylightb...
{ case 4: { // #RGB if (prv_parse_hex_comps(color_value + 1, 1, &r, &g, &b, NULL)) { *parsed_color = GColorFromRGB(r * (255/15), g * (255/15), b * (255/15)); return true; } } case 5: { // #RGBA if (prv_parse_hex_comps(color_value + 1, 1, &r, &g, &b, &a)) { *parsed_c...
(no_subscribers_before) { sys_vibe_history_start_collecting(); } // Add as a consumer to the accel buffer shared_circular_buffer_add_subsampled_client( &s_buffer, &state->buffer_client, 1, 1); // Update the sampling rate and num samples of the driver considering the new // subscriber...
(LOG_LEVEL_ERROR, "Consuming more samples than exist %d vs %d!", (int)samples, (int)state->num_samples)
; success = false; } else if (samples != state->num_samples) { PBL_LOG(LOG_LEVEL_DEBUG, "Dropping %d accel samples", (int)(state->num_samples - samples)); success = false; } state->event_posted = false; state->num_samples = 0; // Fill it again from circular buffer prv_dispatch_data(); mutex_...
-656}, { -712, -272, -680}, { -672, -288, -664}, { -720, -240, -648}, { -688, -240, -648}, { -752, -48, -664}, { -728, -144, -632}, { -640, -208, -600}, { -656, -256, -664}, { -616, -336, -664}, { -536, -440, -704}, { -512, -424, -696}, { -552, -384, -736}, { -768, -...
{ -384, -168, -752}, { -464, -128, -784}, { -464, -152, -792}, { -528, -40, -880}, { -504, -104, -864}, { -416, -96, -872}, { -464, -88, -912}, { -536, -88, -872}, { -488, -88, -824}, { -472, -128, -904}, { -480, -144, -832}, { -584, -104, -768}, { -488, -144, -776}, ...
{ -584, -240, -808}, { -576, -256, -712}, { -608, -208, -720}, { -600, -240, -680}, { -616, -280, -752}, { -512, -296, -728}, { -592, -328, -696}, { -544, -288, -720}, { -608, -200, -768}, { -592, -248, -800}, { -552, -248, -712}, { -600, -264, -760}, { -568, -240, -...
t opcode, const void *payload, uint32_t length) { accessory_disable_input(); accessory_send_byte(HDLC_FLAG); // send the header const ImagingHeader header = { .flags = FLAG_IS_SERVER | FLAG_VERSION, .opcode = opcode }; prv_encode_and_send_data(&header, sizeof(header)); // send the pyaload prv_...
{ response.address = FLASH_REGION_FIRMWARE_SCRATCH_BEGIN; response.length = FLASH_REGION_FIRMWARE_SCRATCH_END - response.address; }
else if (request->region == REGION_PFS) { response.address = FLASH_REGION_FILESYSTEM_BEGIN; response.length = FLASH_REGION_FILESYSTEM_END - response.address; } else if (request->region == REGION_COREDUMP) { if (!prv_coredump_flash_base(&response.address, &response.length)) { response.address = 0; ...
n; // Haven't received both FW and System Resources yet } PBL_LOG(LOG_LEVEL_DEBUG, "Got both FW bin and sys resources!"); s_ready_to_install[ObjectFirmware - 1].type = 0; s_ready_to_install[ObjectSysResources - 1].type = 0; bool set_res_bit = true; if (set_res_bit) { boot_bit_set(BOOT_BIT_NEW_SYSTEM...
{ if (init_request->has_cookie) { // Currently cookie is only used with the app fetch endpoint. This app fetch will send a cookie // along with the message, and when put_bytes is done later my the mobile apps, it will send // the same cookie back in the Init message. *index_out = ntohl(init_request->...
static void prv_create_timer_if_needed(void) { if (s_pb_state.timer_id != TIMER_INVALID_ID) { new_timer_stop(s_pb_state.timer_id); } else { s_pb_state.timer_id = new_timer_create(); } } static bool prv_setup_storage_for_init_request(const InitRequest *request, uint32_t index) { PutBytesStorageInfo *s...
-368}, { -1072, -136, -32}, { -2152, 656, -544}, { -1320, -64, -88}, { -1232, 16, -208}, { -848, -176, -88}, { -480, -48, -96}, { -392, 96, -88}, { -536, 144, -88}, { -632, 56, 32}, { -696, 264, -112}, { -1224, 88, -40}, { -1168, -160, -40}, { -912, 120, -208}, {...
{ -976, 424, -320}, { -1080, 568, -224}, { -1288, 472, -128}, { -1208, 72, 16}, { -1408, 24, 16}, { -1096, 56, -160}, // 91 seconds { -1024, 128, -208}, { -1024, 88, -168}, { -736, 72, -160}, { -456, 16, -168}, { -464, 96, -176}, { -608, 184, -200}, { -776, 312, -...
{ -992, 128, -352}, { -1080, 0, -120}, { -1848, 728, -768}, { -1696, -96, 56}, { -1192, -88, -80}, { -768, 184, -160}, { -560, -32, -80}, { -560, -48, 40}, { -680, 80, 8}, { -704, 128, 16}, { -784, -96, 0}, { -840, 40, 24}, { -1168, 168, -120}, { -1088, -40, -72}...
ffer__multiple_smaller_messages(void) { s_valid_session = &s_session; // This length excludes the sizeof(PebbleProtocolHeader). size_t bytes_free = comm_session_send_buffer_get_max_payload_length(&s_session); bytes_free += sizeof(PebbleProtocolHeader); const int num_sbs = 1 + (bytes_free / (sizeof(PebblePro...
comm_session_send_buffer_end_write(write_sb)
; // Set a yield callback that gives the semph in time but closes the session: SemaphoreHandle_t write_semph = comm_session_send_buffer_write_semaphore(); fake_queue_set_yield_callback(write_semph, prv_session_closed_yield_cb); // Try to begin writing again, requesting only one byte: write_sb = comm_session...
cl_assert(success); const TextBoxParams text_box_params = (TextBoxParams) { .utf8_bounds = &utf8_bounds, }; // Init mutable types word_iter_init(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start); // Tests cl_assert(word_iter_state.current.start == word_iter_state.current.en...
(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start)
ion_get_semaphore(), prv_consume_in_time_yield_cb); gatt_client_subscriptions_handle_server_notification(s_connection, s_handle, value, 1 /* one byte */); prv_assert_notification_event(characteristic, value, 1 /* one byte */, ...
(characteristic_out, ~0)
; cl_assert_equal_i(value, 0xff); cl_assert_equal_b(has_more, false); } // ------------------------------------------------------------------------------------------------- // gatt_client_subscriptions_cleanup_by_client void test_gatt_client_subscriptions__cleanup_by_client(void) { fake_kernel_malloc_mark(); ...
/* * 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...
assert_decode_completed(SIZE_MAX)
; }
messages are handled by QEMU directly }; // ----------------------------------------------------------------------------------------- // Find handler from s_qemu_endpoints for a given protocol static const QemuMessageHandler* prv_find_handler(uint16_t protocol_id) { for (size_t i = 0; i < ARRAY_LENGTH(s_qemu_endpo...
if (!s_qemu_state.callback_pending) { s_qemu_state.callback_pending = true; PebbleEvent e = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = prv_process_receive_buffer, .data = NULL } }; should_context_switch = event_put_isr(&e); }
e_t health_graph_format_weekday_prefix(HealthGraphCard *graph_card, char *buffer, size_t buffer_size) { if (prv_is_selection_last_weekday(graph_card)) { // The graph starts on Monday, so wrap around the selection and current_day for Sunday const time_t selection_time ...
health_graph_card_configure(graph_card, config)
; graph_card->title_font = fonts_get_system_font(PBL_IF_RECT_ELSE(FONT_KEY_GOTHIC_24_BOLD, FONT_KEY_GOTHIC_18_BOLD)); graph_card->legend_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD); graph_card->current_day = prv_get_weekday(graph_...
/* * 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_list_mutex)
{ *storage = (TimelineItemStorage){ .name = filename, .max_size = max_size, .max_item_age = max_age, .mutex = mutex_create(), }; status_t rv = settings_file_open(&storage->file, storage->name, storage->max_size); if (FAILED(rv)) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to create settings file %s,...
(&storage->file, key, key_len, offset, status)
; mutex_unlock(storage->mutex); return rv; } status_t timeline_item_storage_delete(TimelineItemStorage *storage, const uint8_t *key, int key_len) { if (key_len != UUID_SIZE) { return E_INVALID_ARGUMENT; } mutex_lock(storage->mutex); status_t rv = settings_file_delete(&storage->file, key, key_len);...
_pairing_by_id(id, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(!ret); } void test_bluetooth_persistent_storage_prf__delete_bt_classic_pairing_by_addr(void) { bool ret; // Output variables BTDeviceAddress addr_out; SM128BitKey link_key...
(id_2 != BT_BONDING_ID_INVALID)
; ret = bt_persistent_storage_get_active_gateway(&id_out, &type_out); cl_assert(ret); cl_assert_equal_i(type_out, BtPersistBondingTypeBTClassic); ret = bt_persistent_storage_has_active_bt_classic_gateway_bonding(); cl_assert(ret); ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(!...
bscriptionNotifications, BLEGATTErrorSuccess); // Expect to unsubscribe from the unknown characteristic: fake_gatt_client_subscriptions_assert_subscribe(s_unknown_characteristics, BLESubscriptionNone, GAPLEClientKernel); } void test_ppog...
(s_characteristics[0][PPoGATTCharacteristicData])
; // Expect Session to be opened now: cl_assert_equal_i(fake_comm_session_open_call_count(), 1); } void test_ppogatt__start_reset_upon_out_of_range_ack(void) { test_ppogatt__open_session_when_found_pebble_app(); // Simulate getting an Ack that's outside of the window of outstanding SNs: prv_receive_ack(s_ch...
}; cl_assert_equal_i(app_glance_db_insert_stale((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, (uint8_t *)&app_glance, sizeof(app_glance)), S_SUCCESS); // Verify that trying to read the blob back fails due to it not existing SerializedAppGlanceH...
app_glance_db_insert_glance(NULL, &glance)
PIOPuPd_TypeDef data_pupd) { gpio_af_init(&this->ck_gpio, GPIO_OType_PP, GPIO_Medium_Speed, GPIO_PuPd_NOPULL); // During normal operation it is probably more power-efficient to let // the data pin float (no pull) as no current would be wasted pulling // against the data signal. But the mic's dat...
DFSDM_StartSoftwareRegularConversion(this->filter)
; dma_request_start_circular(this->dma, this->state->in_buffer, (void *)&this->filter->RDATAR, sizeof(this->state->in_buffer), prv_dma_handler, (void *)this); } static void prv_dfsdm_disable(MicDevice *this) { // Disable DMA and DFSDM dma_request_stop(this->dma); DFSDM_ChannelCmd(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...
(version_compare((Version) { 6, 0 }, (Version) { 5, 1 }) > 0)
; }
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 "peek.h" #include "drivers/rtc.h" #include "kernel/event_loop.h" #include "k...
if (timeline_item_should_show(&header->common, TimelineIterDirectionFuture)) { update->future_has_event = true; }
if ((now > start) && (time_util_get_midnight_of(now) == time_util_get_midnight_of(start))) { update->today_timed_event_passed = true; } if (now >= end) { return false; } if (header->common.dismissed) { // Ignore dismissed events return false; } const bool peeking = prv_is_in_peeking_time_...
gpio_use(input_config->gpio)
; uint8_t bit = GPIO_ReadInputDataBit(input_config->gpio, input_config->gpio_pin); gpio_release(input_config->gpio); return bit != 0; } void gpio_analog_init(const InputConfig *input_config) { GPIO_InitTypeDef gpio_init = { .GPIO_Pin = input_config->gpio_pin, .GPIO_Mode = GPIO_Mode_AN, .GPIO_Speed...