prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ata; /////////////////////////////////////////////////////////////////////////////////////////////////// //! Settings File #define BT_PERSISTENT_STORAGE_FILE_NAME "gap_bonding_db" #define BT_PERSISTENT_STORAGE_FILE_SIZE (4096) //! All of the actual pairings use a BTBondingID as a key. This is because with BLE pairin...
if (data_len > buf_len || settings_file_get(&fd, key, key_len, data_out, buf_len) != S_SUCCESS) { data_len = 0; }
settings_file_close(&fd); } cleanup: prv_unlock(); return data_len; } //! @return the value that was read at that key or `default_value` if the key does not exist, //! or if the stored data has been corrupted. static bool prv_file_get_bool(const void *key, size_t key_len, bool default_value) { uint8_t bo...
_handle_dismiss_all_complete, data); kernel_free(notif_list); } static void prv_dismiss_all_action_cb(ActionMenu *action_menu, const ActionMenuItem *item, void *context) { NotificationWindowData *window_data...
PBL_IF_RECT_ELSE(500, 400)
; data->peek_layer_timer = evented_timer_register_or_reschedule(data->peek_layer_timer, PEEK_LAYER_HIDE_DELAY, prv_hide_peek_layer, ...
bounds->size.w - left_margin_px - right_margin_px; GTextAttributes *text_attributes = NULL; #if PBL_ROUND // Create a GTextAttributes for the TextLayer. Note that the matching // graphics_text_attributes_destroy() will not need to be called here, as the ownership // of text_attributes will be transferred to t...
if (actionable_dialog->action_bar_type == DialogActionBarConfirmDecline) { #if !defined(RECOVERY_FW) actionable_dialog->up_icon = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_CHECK); actionable_dialog->down_icon = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_X); #endif action_bar_lay...
action_bar_layer_add_to_window(action_bar, window); // Icon // On rectangular displays we just center it horizontally b/w the left edge of the display and // the left edge of the action bar #if PBL_RECT x = (grect_get_max_x(bounds) - ACTION_BAR_WIDTH - icon_size.w) / 2; #else // On round displays we right...
/* * 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...
(logging_handle_character)
; s_serial_console_state = SERIAL_CONSOLE_STATE_LOGGING; s_serial_console_initialized = true; } bool serial_console_is_prompt_enabled(void) { if (!s_serial_console_initialized) { return false; } return (s_serial_console_state == SERIAL_CONSOLE_STATE_PROMPT); } bool serial_console_is_logging_enabled(vo...
_SIZE_WIDTH (100) #define COMPOSITE_TEST_OFFSET_X (COMPOSITE_TEST_IMAGE_SIZE_WIDTH / 2) #define COMPOSITE_TEST_OFFSET_Y (0) static bool prv_gbitmap_format_and_compositing_mode_combo_is_valid(GBitmapFormat bitmap_format, GCompOp compositing_mode) { r...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_graphics_draw_bitmap__origin_layer_across_ny(void) { prv_origin_layer_test(GPoint(0, -40)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__origin_bitmap_layer_inside(void) { prv_origin_bitmap_layer_test(GPointZero); cl_check(gbitmap_pbi_eq(&s_ctx....
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ advert_disable(); prv_send_response(msg, BLE_STATUS_OK); }
ll_internal.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" #include <stdint.h> // TODO: // - device name // - connection speed (?) // - app_info.json // - airplane mode service / BT HW state // - API to detect that accessory is currently already connected to the phone? // - How...
(object_ref, value, value_length, 0 /* value_offset (future proofing) */, gatt_error)
; } applib_free(value); } static void prv_consume_notifications(const PebbleBLEGATTClientEvent *e, GenericReadHandler handler) { uint8_t *value = NULL; BLEGATTError gatt_error = e->gatt_error; uint16_t heap_buffer_size = 0; uint16_t value_length = 0; bool has_more =...
lank(size, format); if (bitmap) { gbitmap_set_palette(bitmap, palette, free_on_destroy); } return bitmap; } // Adapted from http://aggregate.org/MAGIC/#Bit%20Reversal T_STATIC uint8_t prv_byte_reverse(uint8_t b) { b = (b & 0xaa) >> 1 | (b & 0x55) << 1; b = (b & 0xcc) >> 2 | (b & 0x33) << 2; b = (b & 0...
(data, data + addr_offset, data_size - addr_offset)
; bitmap->addr = data; bitmap->info.is_bitmap_heap_allocated = true; // Move where the palette now points to, palette is positioned right after the pixel data if (gbitmap_get_palette_size(format) > 0) { bitmap->palette = (GColor*)((uint8_t*)bitmap->addr + (bitmap->row_size_bytes * bitmap->bounds.si...
int32_t sleep_average_seconds, int variant) { static InsightCopyVariants s_tier_config[PercentTierCount] = { [PercentTier_AboveAverage] = { .num_variants = 5, .variants = { /// Sleep notification on wake up, slept above their typical sleep duration ...
if (fmt == NULL) { // invalid variant return; }
char *body = kernel_malloc_check(max_notif_length); snprintf(body, max_notif_length, i18n_get(fmt, body), hours, minutes, ABS(percentage)); i18n_free_all(body); const NotificationConfig config = { .notif_time = notif_time, .insight_type = ActivityInsightType_SleepSummary, .icon_id = TIMELINE_RESO...
/* * 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...
audio_endpoint_setup_transfer(prv_test_setup_complete_callback, prv_test_stop_transfer_callback)
; cl_assert(s_session_id != AUDIO_ENDPOINT_SESSION_INVALID_ID); } void test_audio_endpoint__setup_complete_callback_call_once(void) { ResponsivenessGrantedHandler granted_handler = fake_comm_session_get_last_responsiveness_granted_handler(); cl_assert_equal_i(s_setup_complete_call_count, 0); granted_han...
tion } const char *title = attribute_get_string(&reminder->attr_list, AttributeIdTitle, ""); if (strcmp(title, reminder_info->title) != 0) { timeline_item_free_allocated_buffer(reminder); return true; // continue iteration } if (reminder_info->filter_cb && !reminder_info->filter_cb(&header, context)...
(ANALYTICS_DEVICE_METRIC_REMINDER_RECEIVED_COUNT, AnalyticsClient_System)
; // Records inserted from the phone are synced const bool mark_synced = true; return prv_insert_reminder(key, key_len, val, val_len, mark_synced); } int reminder_db_get_len(const uint8_t *key, int key_len) { return timeline_item_storage_get_len(&s_storage, key, key_len); } status_t reminder_db_read(const ui...
t8_t *write_ptr = buffer; // serialize the header timeline_item_serialize_header(item, (SerializedTimelineItemHeader *) write_ptr); write_ptr += sizeof(SerializedTimelineItemHeader); // serialize the attributes / actions size_t bytes_serialized = timeline_item_serialize_payload(item, write_ptr, payload_size...
{ return timeline_item_storage_get_len(&s_pin_db_storage, key, key_len); }
status_t pin_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_len) { return timeline_item_storage_read(&s_pin_db_storage, key, key_len, val_out, val_len); } status_t pin_db_delete(const uint8_t *key, int key_len) { status_t rv = timeline_item_storage_delete(&s_pin_db_storage, key, key_len); i...
: case ActivitySessionType_Open: break; case ActivitySessionType_None: case ActivitySessionTypeCount: PBL_LOG(LOG_LEVEL_WARNING, "Invalid activity type: %d", (int)session->type); return false; } // The length must be reasonable if (session->length_min > ACTIVITY_SESSION_MAX_LENGTH_M...
{ ActivityState *state = activity_private_state(); mutex_lock_recursive(state->mutex); { // Look for this activity int found_session_idx = -1; ActivitySession *stored_session = state->activity_sessions; for (uint16_t i = 0; i < state->activity_sessions_count; i++, stored_session++) { if (prv...
// -------------------------------------------------------------------------------------------- // Compute the total number of restful sleep seconds within a range of time static uint32_t prv_sleep_restful_seconds(uint32_t num_sessions, ActivitySession *sessions, time_t sta...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, &peek_layer->subtitle.text_layer)
; GPoint cursor = { (layer_bounds.size.w - subtitle_size.w) / 2, -(subtitle_size.h + MAX(number_size.h, title_size.h)) / 2 }; const int font_height_fuzz = 5; // Replace with font descenders layer_set_frame((Layer *)&peek_layer->subtitle.text_layer, &(GRect) { { cursor.x, cur...
g__invalid_session_garbage(void) { uint32_t data[] = { 1, 2, 3 }; // Make sure logging to bogus sessions does the right thing. cl_assert_equal_i(data_logging_log(0, data, ARRAY_LENGTH(data)), DATA_LOGGING_INVALID_PARAMS); cl_assert_equal_i(data_logging_log(&data, data, ARRAY_LENGTH(data)), DATA_LOGGING_INVALID...
fake_comm_session_process_send_next()
; cl_assert(s_prev_send_data_bytes <= buf_size - rcv_bytes); memcpy(rcv_buffer + rcv_bytes, s_prev_send_data, s_prev_send_data_bytes); rcv_bytes += s_prev_send_data_bytes; s_prev_send_data_bytes = 0; // Provide acknowledgement from phone, this should trigger another dls_private_send_session dat...
ItemId))); } void test_reminder_db__wrong_type_test(void) { TimelineItem not_a_reminder = { .header = { .id = {0x99, 0xcb, 0x7c, 0x75, 0x8a, 0x35, 0x44, 0x87, 0x90, 0xa4, 0x91, 0x3f, 0x1f, 0xa6, 0x76, 0x01}, .timestamp = 0, .duration = 0, .type = TimelineItemTypeNotificatio...
(reminder_db_is_dirty(&is_dirty), S_SUCCESS)
; cl_assert(is_dirty); BlobDBDirtyItem *dirty_list = reminder_db_get_dirty_list(); cl_assert(dirty_list); cl_assert(list_count((ListNode *)dirty_list) == num_reminders); // Mark some items as synced reminder_db_mark_synced((uint8_t *)&item1.header.id, sizeof(TimelineItemId)); reminder_db_mark_synced((ui...
; graphics_context_set_fill_color(&ctx, GColorFromHEX(0x55aaff)); graphics_context_set_antialiased(&ctx, true); graphics_fill_rect(&ctx, &ctx.dest_bitmap.bounds); GDrawCommandImage *l = weather_app_resource_create_sun(); gdraw_command_image_draw(&ctx, l, GPoint(0, 0)); int32_t dt = ANIMATION_NORMALIZED_MA...
GRect(90, 0, s, s)
; GPointIndexLookup *index_lookup = gdraw_command_list_create_index_lookup_by_distance( gdraw_command_image_get_command_list(l), GPoint(s, s / 2)); Fixed_S32_16 f = Fixed_S32_16(FIXED_S32_16_ONE.raw_value / 2); l = weather_app_resource_create_sun(); gdraw_command_image_scale_segmented_to(l, from, to, t ...
* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the Licens...
(PULSE2_LCP, packet, length)
ion break; } } // go back to the state we were in before the function prv_layout_version_add_all_regions(true); return flash_version; } void ftl_add_region(uint32_t region_start, uint32_t region_end, bool erase_new_region) { // check if this region equals the next region, if so, then add next reg...
pfs_set_size(s_ftl_size, false)
; extern void test_force_recalc_of_gc_region(void); test_force_recalc_of_gc_region(); }
mTypePin, .flags = 0, .layout = LayoutIdTest, } } }; // all day item static TimelineItem s_all_day_items[] = { { .header = { .id = {0x01}, .parent_id = {0}, .timestamp = 1421020800, // midnight jan 12, 2015 UTC .duration = MINUTES_PER_DAY, .type = Timeli...
cl_assert(iter_next(&iterator))
; cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id)); // check fifth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id)); // check sixth cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.heade...
edule (E_DOES_NOT_EXIST) wakeup_id = sys_wakeup_schedule(sys_get_time() + ((MAX_WAKEUP_EVENTS_PER_APP + 1) * WAKEUP_EVENT_WINDOW), 0, false); cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); } void test_wakeup__gap(void) { WakeupId wakeup_id = 0; sys_wakeup_cancel_all_for_app(); // Schedule...
(fourth_event, 0, false)
; cl_assert_equal_i(sys_wakeup_query(fourth_wakeup_id), fourth_event); // Jump to the future right before the 3rd event rtc_set_time(sys_get_time() + 170); // Force wakeup to check for current wakeup event wakeup_enable(false); wakeup_enable(true); // fire the first wakeup event, as it is still current...
edef struct { Window window; TextLayer percent_done_text_layer; char percent_done_text_buffer[5]; //<! Text for progress percentage label, format %02d%% SimpleDialog finished_dialog; ProgressLayer progress_layer; AppTimer *timer; unsigned int percent_complete; ProgressUISource progress_source; bool is...
(data->timer)
; app_free(data); } } static void prv_window_load_handler(Window* window) { ProgressUIData *data = window_get_user_data(window); const ProgressUIAppArgs* app_args = app_manager_get_task_context()->args; data->progress_source = app_args->progress_source; simple_dialog_init(&data->finished_dialog, "Updat...
/* * 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...
{ static uint8_t build_id[20] = { 0xee, 0xd2, 0xbf, 0x50, 0x5b, 0x59, 0x04, 0xb5, 0x14, 0x98, 0x28, 0xb9, 0x56, 0x6d, 0x26, 0xc5, 0x9b, 0x68, 0xe9, 0xcc }; if (out_len) { *out_len = sizeof(build_id); } return (uint8_t *)&build_id[0]; }
void version_copy_current_build_id_hex_string(char *buffer, size_t buffer_bytes_left) { size_t build_id_bytes_left; const uint8_t *build_id = version_get_build_id(&build_id_bytes_left); byte_stream_to_hex_string(buffer, buffer_bytes_left, build_id, build_id_bytes_left, false); } int pbl_log_get_bin_f...
now lets search in the app_db id = app_db_get_install_id_for_uuid(uuid); if (id != INSTALL_ID_INVALID) { return id; } return INSTALL_ID_INVALID; } static void prv_app_install_delete(AppInstallId id, Uuid *uuid, bool app_upgrade, bool delete_cache) { if (!app_upgrade) {...
s_install_callback_data.callback_paused_for_worker) { // We're trying to remove or upgrade our currently running app. We now have // to wait until the app actually closes before continuing to notify the rest // of the system that we've removed or upgraded the app. return; ...
/* * 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...
comm_session_send_data(comm_session_get_system_session(), HEALTH_SYNC_ENDPOINT_ID, (uint8_t*)&msg, sizeof(HealthSyncEndpointAckMsg), COMM_SESSION_DEFAULT_TIMEOUT)
_write(&session->send_buffer, session->temp_write_buffer, session->bytes_written); kernel_free(session->temp_write_buffer); session->temp_write_buffer = NULL; session->endpoint_id = ~0; session->bytes_written = 0; } static uint32_t s_responsiveness_max_period_s; static bool s_responsiveness_latency_is_reduced...
circular_buffer_consume(&session->send_buffer, sizeof(pp_header) + pp_header.length)
; } kernel_free(buffer); } static void prv_fake_transport_reset(Transport *transport) { cl_assert_(false, "Not implemented: prv_fake_transport_reset"); } static const TransportImplementation s_fake_transport_implementation = { .send_next = prv_fake_transport_send_next, .reset = prv_fake_transport_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...
cl_assert_equal_i(s_font_info.base.md.codepoint_bytes, 2)
ation(void) { // Start a transition. We shouldn't update the screen because the app hasn't rendered // yet. compositor_transition(NULL); cl_assert_equal_i(s_count_display_update, 0); cl_assert_equal_i(s_count_animation_create, 0); // Now the app has rendered something and we should actually update the disp...
compositor_transition(&s_transition_b)
; // Create and schedule a new modal animation, destroying the old one cl_assert_equal_i(s_count_animation_create, 2); cl_assert_equal_i(s_count_animation_schedule, 2); cl_assert_equal_i(s_count_animation_destroy, 1); // The app framebuffer should still be locked while we're animating away cl_assert_equal_i...
inttypes.h> #include <stdbool.h> #define TIMEOUT_MS (3000) #define VERSION (1) #define NUM_RX_BUFFERS (3) #define MAX_DATA_LENGTH (2048) #define CHECKSUM_LENGTH (4) #define MAX_FRAME_LENGTH (MAX_DATA_LENGTH + sizeof(ImagingHeader) + CHECKSUM_LENGTH) // flags #define FLAG_IS_SERVER (1 << 0) #define FLAG_VERSION (VERSI...
hdlc_encode(&byte)
) { accessory_send_byte(HDLC_ESCAPE); } accessory_send_byte(byte); } } static void prv_send_frame(uint8_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 | F...
x(); EXECUTE_SCRIPT("ctx.fillText('some text', 0, 1.5);"); cl_assert_equal_rect((GRect(0, 2, large_int, large_int)), s_graphics_draw_text.last_call.draw_text.box); EXECUTE_SCRIPT("ctx.fillText('some text', -0.2, 1.2, 10.5);"); cl_assert_equal_rect((GRect(0, 1, 11, large_int)), ...
EXECUTE_SCRIPT("ctx.font = '14px bold Gothic';\n")
; cl_assert_equal_i(2, s_fonts_get_system_font.call_count); cl_assert_equal_p(FONT_KEY_GOTHIC_14_BOLD, s_fonts_get_system_font.last_call.font_key); EXECUTE_SCRIPT("ctx.font = '28px Gothic';\nvar f = ctx.font;\n"); ASSERT_JS_GLOBAL_EQUALS_S("f", "28px Gothic"); } extern T_STATIC void prv_graphics_color_to_char...
get_max_x(&bitmap->bounds) - 1); const int16_t num_pix_data_row = max_x - min_x + 1; const int16_t pixels_to_move = num_pix_data_row - abs_delta; switch (bpp) { case 1: { // Note: this doesn't care about the bounding, because we don't have any round 1bpp // devices to support, and it s...
(&bitmap->bounds)
- 1; const int16_t max_x = grect_get_max_x(&bitmap->bounds) - 1; const int16_t iterate_dir = delta_neg ? -1 : 1; const int16_t end_y = delta_neg ? max_y : min_y; const int16_t start_y = delta_neg ? min_y + abs_delta : max_y - abs_delta; if ((!delta_neg && (start_y < end_y)) || (delta_neg && (start_y > end_y...
const BtPersistBondingData *stored_data) { *bonding = (BleBonding){}; bt_persistent_storage_assign_sm_pairing_info(&bonding->pairing_info, &stored_data->ble_data.pairing_info); bonding->is_gateway = stored_data->ble_data.is_gat...
if (stored_data.type == BtPersistBondingTypeBLE && bt_device_equal(&itr_data->device.opaque, &stored_data.ble_data.pairing_info.identity.opaque)) { itr_data->irk_out = stored_data.ble_data.pairing_info.irk; strncpy(itr_data->name_out, stored_data.ble_data.name, BT_DEVICE_NAME_BUFFER_...
return true; // continue iterating } bool bt_persistent_storage_get_ble_pairing_by_addr(const BTDeviceInternal *device, SMIdentityResolvingKey *irk_out, char name_out[BT_DEVICE_NAME_BUFFER_SIZE]) { FindByAddrItr...
fication_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); }
uspend the chip? } static void prv_enable_operating_mode(AccelOperatingMode mode, BMI160SampleRate sample_rate) { s_operating_states[mode].enabled = true; s_operating_states[mode].sample_interval = sample_rate; prv_configure_operating_mode(); } static void prv_disable_operating_mode(AccelOperatingMode mode) { ...
(BMI160_REG_INT_MOTION_1, BOARD_CONFIG_ACCEL.accel_config.shake_thresholds[AccelThresholdHigh])
; } } static void prv_enable_shake_detection(void) { // don't automatically power-up the gryo when an anymotion interrupt fires! prv_write_reg(BMI160_REG_PMU_TRIGGER, 0x0); // Enable the anymotion detection interrupt uint8_t en_val = BMI160_INT_MAP_ANYMOTION_EN_MASK; prv_read_modify_write(BMI160_REG_INT_...
eviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); // Simulate getting one service indication... fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_CONNECTION_ID); // ... then a failure: fake_...
prv_connected_dummy_device(1)
; // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); // Make Bluetopia's GATT_Start_Service_Discovery fail: // (Disconnected in the mean time, ...) fake_gatt_set_start_return_value(BTGATT_ERROR_INVALID_PARAMETER); // Fire the watchdog timer: const TimerID wat...
ARD = BUTTON_ID_DOWN; static const ButtonId BUTTON_BACKWARD = BUTTON_ID_UP; static const int16_t BOUNCEBACK_OFFSET = 6; // These offsets get rid of the empty space above the first line of text, // enabling neater animations by clipping immediately at the top of the text. static const int16_t TITLE_BOUNDS_OFFSET = 5; s...
(&data->title_text_layer.layer, TITLE_BOUNDS_OFFSET)
36, -104}, { 1232, 144, -64}, { 1160, 192, -96}, { 912, 208, -120}, { 664, 200, -144}, { 536, 176, -168}, { 512, 152, -152}, { 616, 184, -120}, // 91 seconds { 760, 208, -168}, { 1000, 256, -264}, { 1112, 312, -352}, { 1088, 352, -304}, { 1336, 360, -232}, { 1240,...
{ 912, 104, 24}, { 1104, 88, 40}, { 1040, 80, 0}, { 1072, 64, -56}, { 1232, 64, -96}, { 1176, 80, -24}, { 1048, 112, -80}, { 1208, 144, -120}, { 1232, 208, -144}, { 1032, 256, -160}, { 720, 232, -184}, { 560, 184, -160}, { 520, 160, -112}, { 576, 152, -88}, { ...
{ 1184, 192, -120}, { 944, 208, -176}, { 664, 192, -176}, { 568, 184, -168}, { 560, 160, -168}, { 656, 176, -160}, { 768, 208, -192}, { 904, 248, -232}, { 1048, 272, -304}, { 1120, 288, -288}, { 1416, 320, -248}, { 1264, 352, -264}, { 1072, 280, -152}, { 1160, 31...
/* * 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...
{ // We store how many times each button has been pressed on previous boots in this // rtc backup register. Every time when we boot without that button pressed that // counter gets cleared. If the byte reaches 5, return a failure. uint32_t button_counter_register = RTC_ReadBackupRegister(STUCK_BUTTON_REGISTER)...
bool is_flash_broken(void) { return !flash_sanity_check(); }
est_phone_formatting__name_trailing_space(void) { char dest[NAME_LENGTH]; phone_format_caller_name("Katharine Berry ", dest, NAME_LENGTH); cl_assert_equal_s(dest, "Katharine B."); memset(dest, 0, NAME_LENGTH); phone_format_caller_name("Katharine Berry ", dest, NAME_LENGTH); cl_assert_equal_s(dest, "Kath...
cl_assert_equal_s(dest, "+1 (608)\n555-1212")
{ -1224, 528, -192}, { -1104, 672, -296}, { -1592, 680, -264}, { -1272, 328, -320}, // 23 seconds { -1160, 424, -376}, { -1360, 400, -152}, { -1552, 168, 48}, { -1344, 240, 48}, { -1136, 168, 48}, { -1064, 152, 88}, { -1120, 192, 112}, { -1128, 176, 96}, { -1168, ...
{ -1168, 600, -208}, { -1424, 520, -48}, { -1464, 376, 8}, { -1136, 264, -32}, { -1024, 232, 8}, { -1088, 184, 72}, { -1176, 144, 96}, { -1256, 144, 48}, { -1496, 32, 104}, { -1344, -144, 248}, { -1056, -384, 176}, { -1448, 88, -128}, { -1128, 128, -160}, { -1080,...
{ -1040, 96, -320}, { -1184, 80, -304}, { -1272, 8, -200}, { -1176, 48, -136}, { -1064, 152, -72}, // 31 seconds { -1072, 320, -48}, { -1160, 384, -120}, { -1176, 408, -128}, { -1056, 472, -136}, { -1096, 408, -176}, { -1072, 328, -136}, { -1376, 456, -144}, { -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...
if (tag == DlsSystemTagProtobufLogSession) { s_dls_session_created = true; cl_assert_equal_i(item_size, sizeof(TestPLDLSRecord)); return (DataLoggingSession *)TEST_PL_DLS_SESSION_ID; } else { return NULL; }
} void dls_finish(DataLoggingSession *logging_session) { if (logging_session == (DataLoggingSession *)TEST_PL_DLS_SESSION_ID) { s_dls_session_created = false; } else { cl_assert(false); } } // // MFG/Version Fakes // #define TEST_PL_SERIAL_NUM "ABC01234567" const char* mfg_get_serial_number(void) { ...
duration = whole_number test_reel_data->duration_ms = 300; kino_player_play(test_player); animation_set_reverse(test_player->animation, true); animation_set_duration(test_player->animation, ANIMATION_DURATION_INFINITE); animation_set_elapsed(test_player->animation, 20); prv_play_animation_update(test_play...
{ test_reel_data->duration_ms = 300; Animation *animation = (Animation *)kino_player_create_play_animation(test_player); cl_assert_equal_i(animation_is_scheduled(animation), false); cl_assert_equal_i(animation_is_immutable(animation), true); }
void test_kino_player__create_animation_is_unscheduled_by_play_pause_rewind(void) { test_reel_data->duration_ms = 300; Animation *animation = (Animation *)kino_player_create_play_animation(test_player); cl_assert_equal_i(animation_is_scheduled(animation), false); animation_schedule(animation); // Play play...
_session(double offset_hours, double length_hours) { const uint32_t length_min = length_hours * MINUTES_PER_HOUR; s_data.activity_sessions[s_data.num_sessions++] = (ActivitySession) { .type = ActivitySessionType_Walk, .length_min = length_min, .start_utc = rtc_get_time(), .step_data = { .step...
{ return true; }
window_set_click_context(BUTTON_ID_SELECT, data); window_single_click_subscribe(BUTTON_ID_BACK, prv_back_button_single_click_handler); window_set_click_context(BUTTON_ID_BACK, data); if (s_notification_window_data.is_modal) { Window *window = &s_notification_window_data.window; window_set_overrides_b...
gbitmap_get_bounds(&data->dnd_icon)
ration = prv_duration_getter }; test_reel = kino_reel_custom_create(test_reel_impl, test_reel_data); cl_assert(test_reel != NULL); test_player = malloc(sizeof(KinoPlayer)); memset(test_player, 0, sizeof(KinoPlayer)); kino_player_set_reel(test_player, test_reel, true); } // Teardown void test_kino_player...
prv_play_animation_update(animation, 0)
; // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 20); } void test_kino_player__infinite_animation_finite_reel_forward(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms =...
/* * 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 (event->bluetooth.le.gatt_client.subtype == PebbleBLEGATTClientEventTypeServiceChange) { return (void **)(&event->bluetooth.le.gatt_client_service.info); }
break; default: break; // Nothing to do! } return NULL; } void event_put(PebbleEvent* event) { fake_event_clear_last(); s_last_pebble_event = *event; ++s_fake_event_count; if (s_fake_event_cb) { s_fake_event_cb(event); } } bool event_put_isr(PebbleEvent* event) { return false; } ...
PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_set_sec_level: %u", e); } } } static uint8_t prv_handle_handle_cccd_read(uint16_t handle, uint16_t conn_idx, uint8_t response_buffer[READ_RESPONSE_BUFFER_SIZE]) { Connection *connection = connection_by_idx_check(conn_idx); boo...
{ if (evt->length < sizeof(uint16_t)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid CCCD value length %u!", evt->length); return ATT_ERROR_INVALID_VALUE_LENGTH; } uint16_t cccd_value = 0; memcpy(&cccd_value, evt->value, sizeof(cccd_value)); bool is_subscribed = (cccd_value & GATT_CCC_NOTIFICATIONS); Connectio...
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_i...
/* * 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...
CREATE_DMA_STREAM(2, 4)
; // DMA2_STREAM4_DEVICE - DFSDM CREATE_DMA_STREAM(2, 5); // DMA2_STREAM5_DEVICE - ICE40LP TX CREATE_DMA_STREAM(2, 7); // DMA2_STREAM7_DEVICE - QSPI // DMA Requests // - On DMA1 we have "Debug UART RX" and "Accessory UART RX". The former is never used in a sealed // watch, and the latter is only sometimes used in a ...
ransform(value, start_value); // Halfway through prv_advance_to_ms_with_timers(start_ms + duration/2); cl_assert_close_gtransform(value, mid_value); // End prv_advance_to_ms_with_timers(start_ms + duration + MIN_FRAME_INTERVAL_MS*2); cl_assert_equal_gtransform(value, end_value); #endif } // -----------...
prv_clear_handler_histories()
actoryResetShutdown: reason_string = "%s%sFactoryResetShutdown"; break; case RebootReasonCode_MfgShutdown: reason_string = "%s%sMfgShutdown"; break; case RebootReasonCode_Serial: reason_string = "%s%sSerial"; break; case RebootReasonCode_RemoteReset: reason_string = "%s%sa Remote Reset...
crashed_ui_show_pebble_reset()
; } #endif reboot_reason_clear(); }
30, 30) == 1); #elif SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gcolor_equal(get_bitmap_color(test_image_bw, 8, 16), GColorWhite)); cl_check(gcolor_equal(get_bitmap_color(test_image_bw, 8, 24), GColorBlack)); cl_check(gcolor_equal(get_bitmap_color(test_image_color, 30, 2), GColorClear)); cl_check(gcolor_equal(get_b...
GPoint(20, 20)
G(LOG_LEVEL_ERROR, "Resetting because got RC while open"); prv_session_open__exit_and_initiate_reset(); } } //////////////////////////////////////////////////////////////////////////////// // Awaiting Reset Complete Local Initiated //////////////////////////////////////////////////////////////////////////////// ...
(it, PostMessageKeyResetComplete)
; if (tuple) { if (!prv_is_tuple_valid_reset_complete(tuple)) { // TODO: document this in statechart prv_send_unsupported_protocol_error_and_enter_await_reset_req(PostMessageErrorMalformedResetComplete); return; } const PostMessageResetCompletePayload *rc = (const PostMessageRese...
/* * 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, "Error writing notification header %d", result)
; return result; } bytes_written += result; if (!header->payload_length) { return result; } uint8_t *write_buffer = kernel_malloc_check(header->payload_length); timeline_item_serialize_payload(notification, write_buffer, header->payload_length); result = pfs_write(fd, write_buffer, header->payl...
fake_comm_session_cleanup(); } // ---------------------------------------------------------------------------------------- void test_data_logging__log_consume(void) { DataLoggingSessionRef logging_sessions[10]; const int item_size = 1; // Create sessions for (int i = 0; i < 10; i++) { logging_sessions[i] ...
(LOG_LEVEL_INFO, "Size of session %d: %d", i, size)
; total_bytes += size; } PBL_LOG(LOG_LEVEL_INFO, "total bytes: %d", total_bytes); cl_assert(total_bytes < DLS_TOTAL_STORAGE_BYTES); // We should still be able to create more sessions up to the max for (int i = num_sessions; i < DLS_MAX_NUM_SESSIONS; i++) { logging_sessions[i] = data_logging_create(i...
db_get_dirty_dbs(ids, &num_ids); cl_assert_equal_i(num_ids, 0); cl_assert(blob_db_get_dirty_list(BlobDBIdTest) == NULL); } static bool prv_list_key_comparator(ListNode *cur_node, void *data) { BlobDBDirtyItem *dirty_item = (BlobDBDirtyItem *)cur_node; char *key = data; return (memcmp(dirty_item->key, key, di...
blob_db_mark_synced(BlobDBIdTest, (uint8_t *)keys[i], key_len)
; } } cl_assert(blob_db_sync_db(BlobDBIdTest) == S_SUCCESS); prv_generate_responses_from_phone(); cl_assert_equal_i(s_num_writebacks, 3); } void test_blob_db_sync__timeout_and_retry(void) { char *keys[] = { "key1", "key2", "key3", "key4", "key5" }; int key_len = strlen(keys[0]); char *values[] = { ...
rial.h" #include "util/attributes.h" #include "util/delay.h" #include "stm32f4xx_dma.h" #include "stm32f4xx_gpio.h" #include "stm32f4xx_rcc.h" #include "stm32f4xx_spi.h" #include <stdbool.h> #include <stdint.h> // Bootloader images #include "drivers/display/resources/hex_digits.h" #include "drivers/display/resources...
(DISP_GPIO, &s_disp_gpio_init)
; // Init LCD Control s_disp_gpio_init.GPIO_Mode = GPIO_Mode_OUT; s_disp_gpio_init.GPIO_OType = GPIO_OType_PP; s_disp_gpio_init.GPIO_Pin = DISP_PIN_LCD; GPIO_Init(DISP_LCD_GPIO, &s_disp_gpio_init); // Set up a SPI bus on SPI2 SPI_I2S_DeInit(DISP_SPI); SPI_Init(DISP_SPI, &s_disp_spi_init); SPI_Cmd(D...
mapFormat8Bit) { for (uint32_t i = 0; i < width * height; i++) { upng_buffer[i] = palette[upng_buffer[i]].argb; // De-palettize the image data } applib_free(palette); // Free the palette to avoid storing it as part of GBitmap palette = NULL; } // Set the image or pixel data gbitmap_set_da...
prv_gbitmap_png_create_palette_for_grayscale(upng, palette_out)
; } } return 0; } bool gbitmap_png_is_format_supported(upng_t *upng) { 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; } ...
/* * 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...
{ SessionSendQueueJob *job = *job_ptr_ptr; if (!comm_session_is_valid(session)) { job->impl->free(job); *job_ptr_ptr = NULL; goto unlock; } ListNode *head = (ListNode *)session->send_queue_head; PBL_ASSERTN(!list_contains(head, (const ListNode *)job)); if (head) { list_ap...
unlock: bt_unlock(); } // ------------------------------------------------------------------------------------------------- // Interface towards Transport // bt_lock is assumed to be taken by the caller of each of the below functions: size_t comm_session_send_queue_get_length(const CommSession *session) { size_t...
create a spawn out of b and c Animation *c = prv_create_test_animation(); Animation *spawn = animation_spawn_create(c, b, NULL); cl_assert(spawn == NULL); // We should be able to create one out of c and d Animation *d = prv_create_test_animation(); spawn = animation_spawn_create(c, d, NULL); cl_assert(sp...
cl_must_pass(animation_get_elapsed(h, &elapsed_ms))
; cl_assert_equal_i(elapsed_ms, duration / 2); cl_must_pass(animation_get_progress(h, &progress)); cl_assert_equal_i(progress, 32768); // Rounding occurs within, this is close to MAX / 2 animation_destroy(h); #endif } void test_animation__completed(void) { #ifdef TEST_INCLUDE_BASIC const int duration_a = 3...
->selection.index = MenuIndex(0, 0); } prv_menu_layer_walk_downward_from_iterator(&it.it); int16_t total_height = it.it.cursor.y; if (menu_layer->pad_bottom) { total_height += MENU_LAYER_BOTTOM_PADDING; } // Set the content size on the scroll layer, so all the rows will fit onto the content layer: c...
animation_set_duration(a2, 250)
; animation_set_curve(a2, AnimationCurveEaseOut); animation_set_auto_destroy(a2, true); Animation *a = animation_sequence_create(a1, a2, NULL); animation_set_auto_destroy(a, true); // [MJ] false? animation_set_handlers(a, (AnimationHandlers) { .stopped = prv_selection_complete }, menu_layer); menu_layer-...
_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(19, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ...
(&ctx, GPoint(10, 96), 5)
/* * 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...
(PebbleTask_Unknown)
; return state->aux->current_animation; } InterpolateInt64Function animation_private_current_interpolate_override(void) { AnimationPrivate *animation = prv_animation_get_current(); if (animation && animation->curve == AnimationCurveCustomInterpolationFunction) { return animation->custom_interpolation_functio...
/* * 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...
kernel_malloc_check(sizeof(PebbleLaunchAppEventExtended))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
kino_reel_scale_segmented_create(from_reel, take_ownership, screen_frame)
; if (reel) { const bool take_ownership = true; kino_reel_scale_segmented_set_delay_lookup_creator(reel, prv_create_lookup_by_angle, ctx, take_ownership); kino_reel_scale_segmented_set_point_duration(reel, UNFOLD_DEFAULT_POINT_DURATION); kino_reel...
--------------------------------------------- // Test that our periodic minute callback correctly detects the midnight rollover void test_activity__day_rollover(void) { // Start activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callba...
for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) { if (i == 0) { exp_resting_kcalories[i] = 1; } else if (i == 1) { exp_resting_kcalories[i] = ROUND(s_exp_full_day_resting_kcalories * (MINUTES_PER_DAY - 1), MINUTES_PER_DAY); } else { exp_resting_kcalor...
ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricRestingKCalories, exp_resting_kcalories); // Verify that the expired and invalid activity session have been removed ASSERT_NUM_ACTIVITY_SESSIONS(0); // Verify that we have the right history capacity uint32_t exp_history[ACTIVITY_HISTORY_DAYS]; for (int i = 1; i <...
/* * 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...
memcmp(header, s_active_header, REGISTRY_HEADER_SIZE_BYTES)
== 0; } static uint32_t get_next_cursor_position(uint32_t old_address, Registry* registry) { const uint32_t new_address = round_up_to_nearest_subsector(old_address + registry->total_buffer_size_bytes); const bool is_space_for_registry = new_address + registry->total_buffer_size_bytes < registry->curs...
all DND and disables do_not_disturb_set_schedule_enabled(WeekdaySchedule, false); // Clears overrides active = do_not_disturb_is_active(); cl_assert(active == true); // !Manual && Scheduled && Smart do_not_disturb_set_manually_enabled(false); do_not_disturb_set_schedule_enabled(WeekdaySchedule, true); ac...
do_not_disturb_handle_clock_change()
_push(workout_dialog); } //////////////////////////////////////////////////////////////////////////////////////////////////// //! Handlers static void prv_handle_pause_button(WorkoutActiveWindow *active_window) { bool is_paused = false; if (active_window->workout_controller) { is_paused = active_window->worko...
WINDOW_NAME("Workout Active Info")
); window_set_user_data(window, active_window); window_set_background_color(window, BACKGROUND_COLOR); window_set_window_handlers(window, &(WindowHandlers){ .unload = prv_window_unload_handler, }); GRect base_layer_bounds = window->layer.bounds; #if PBL_RECT base_layer_bounds.size.w -= ACTION_BAR_WIDTH...
/* * 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...
heap_calloc(heap, count, size, saved_lr)
; const size_t bytes = count * size; if (!mem && bytes != 0) { PBL_CROAK_OOM(bytes, saved_lr, heap); } return mem; } char *task_strdup(const char *s) { register uintptr_t lr __asm("lr"); uintptr_t saved_lr = lr; return prv_strdup(task_heap_get_for_current_task(), s, saved_lr); } // app_* functions...
6, 128, 288}, { 848, -112, 400}, { 976, 56, 328}, { 1032, 328, 184}, { 944, 312, 248}, { 968, 128, 280}, { 976, 128, 224}, { 976, 216, 136}, { 936, 232, 152}, { 992, 216, 128}, { 1008, 128, 176}, { 1048, 144, 200}, { 1088, 248, 232}, { 1256, 384, 336}, { 1448, 472...
{ 1536, 424, 200}, { 1184, 296, 104}, { 840, 328, 280}, { 752, 216, 280}, { 856, 16, 376}, { 968, 96, 440}, { 1000, 296, 304}, { 936, 240, 344}, { 928, 296, 344}, { 984, 240, 216}, { 984, 192, 192}, { 960, 256, 200}, { 968, 216, 200}, { 1008, 152, 240}, { 992,...
{ 960, 224, -64}, { 888, 256, -24}, { 896, 256, 64}, { 920, 248, 64}, { 936, 144, 40}, // 68 seconds { 976, 144, -40}, { 992, 248, -64}, { 1000, 296, -40}, { 1000, 232, -24}, { 1032, 208, -24}, { 1208, 216, 8}, { 1464, 48, 16}, { 1432, 56, 24}, { 896, 416, 20...
_for_strings += prv_max_ellipsified_cstring_size(subtitle); if (has_multimedia) { required_space_for_strings += MULTIMEDIA_INDICATOR_LENGTH; } required_space_for_strings += prv_max_ellipsified_cstring_size(message); required_space_for_strings += prv_max_ellipsified_cstring_size(positive_action); required_...
{ TimelineItemAction *dismiss = timeline_item_find_dismiss_action(item); if (dismiss) { attribute_list_init_list(NUM_NATIVE_ANCS_ACTION_ATTRS + 1, &dismiss->attr_list); uint8_t *string_buffer = NULL; prv_fill_native_ancs_action(&string_buffer, dismiss, ActionIDNegative, attr_action_neg, ...
bs_graphics_context.h" #include "stubs_gbitmap.h" #include "stubs_heap.h" #include "stubs_text_resources.h" #include "stubs_text_render.h" #include "stubs_pbl_malloc.h" #include "stubs_reboot_reason.h" #include "stubs_resources.h" #include "stubs_syscalls.h" #include "stubs_compiled_with_legacy2_sdk.h" ///////////////...
cl_assert(*word_iter_state.current.start == '\n')
; cl_assert(*word_iter_state.current.end == 'N'); cl_assert(iter_next(&word_iter)); cl_assert(*word_iter_state.current.start == 'N'); cl_assert(*word_iter_state.current.end == '\n'); cl_assert(iter_next(&word_iter)); cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*word_iter_state.current.e...
; } void test_app_inbox__app_inbox_service_begin_happy_case(void) { prv_create_test_inbox(); cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, BUFFER_SIZE, s_writer)); cl_assert_equal_b(true, app_inbox_service_is_being_written_for_tag(Ap...
prv_create_test_inbox_and_begin_write()
; // Message 1: cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1)); cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // Message 2: cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, 1, s_writer)); cl_assert_equal...
/* * 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...
{ // Wrap-around source bitmap vertically if (src_y >= src_end_y) { src_y = src_begin_y; } const GBitmapDataRowInfo dest_row_info = gbitmap_get_data_row_info(dest_bitmap, dest_y); uint8_t *dest = dest_row_info.data; const int16_t dest_delta_begin_x = MAX(dest_row_info.min_x - dest_rect.or...
((src_x - src_bitmap->bounds.origin.x) % src_bitmap->bounds.size.w); } else { // Increment source but don't draw continue; } } // src points to the info for the row, so y and stride are 0 for raw_image_get_value uint8_t cindex = raw_image_get_value_for...
for (num_children = 0; num_children < ANIMATION_MAX_CHILDREN; num_children++) { AnimationPrivate *child = prv_find_animation_by_parent_child_idx(state, from, num_children); if (!child) { break; } }
// Allocate array to hold the children and allocate each of them. Animation *children[num_children]; for (int child_idx = 0; child_idx < num_children; child_idx++) { AnimationPrivate *child = prv_find_animation_by_parent_child_idx(state, from, child_idx); children[child_idx] = prv_animation_cl...
rame_time); BMI160_DBG("Reading %d bytes", len); uint8_t fifo_frame_len = prv_get_fifo_frame_size(); bmi160_begin_burst(BMI160_REG_FIFO_DATA | BMI160_READ_FLAG); uint8_t curr_num_samples = (len / fifo_frame_len); uint32_t curr_sampling_interval_us = prv_get_min_sampling_interval_us(); uint64_t start_time...
{ gpio_input_init(&BOARD_CONFIG_ACCEL.accel_int_gpios[0]); gpio_input_init(&BOARD_CONFIG_ACCEL.accel_int_gpios[1]); exti_configure_pin(BOARD_CONFIG_ACCEL.accel_ints[0], ExtiTrigger_Rising, bmi160_IRQ1_handler); exti_configure_pin(BOARD_CONFIG_ACCEL.accel_ints[1], ExtiTrigger_Rising, bmi160_IRQ2_han...
Point(x_range_begin.integer, y), GCompOpAssign, GColorWhite); } static int prv_get_rounded_corner_width(int row_index, int num_rows) { if (row_index >= num_rows) { return 0; } if (row_index < (int)ARRAY_LENGTH(s_rounded_corner_width)) { return s_rounded_corner_width[row_index]...
// Set the right-side corner and bezel of this row and left-size corner and bezel of the next. const int next_corner_width = prv_get_rounded_corner_width(app_row + 1, app_height); const int bezel_length = corner_width + bezel_width * 2 + next_corner_width; memset(dst, GColorBlack.argb, bezel_len...
void compositor_render_modal(void) { GContext *ctx = kernel_ui_get_graphics_context(); // We make this GDrawState static to save stack space, thus the declaration and init must be // performed on two separate lines because the initializer value is not constant static GDrawState prev_state; prev_state = ct...
ERY_FW #include "services/prf/accessory/accessory_manager.h" #else #include "services/normal/accessory/accessory_manager.h" #endif #include "system/logging.h" #include "system/passert.h" #include "util/circular_buffer.h" #include "util/legacy_checksum.h" #include "system/profiler.h" static int s_timeout = 0; static bo...
MIN(volume, 1024)
ECT_HEIGHT) void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__offset_aa_sw(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 1 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFS...
(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT)
P_NXNY, OFFSET_RECT_CLIP_NXNY, true, 2); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // AA = true, SW = 3 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSE...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); } void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__offset_sw(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 1 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, fals...
ata + addr_offset, data_size - addr_offset); bitmap->addr = data; bitmap->info.is_bitmap_heap_allocated = true; // Move where the palette now points to, palette is positioned right after the pixel data if (gbitmap_get_palette_size(format) > 0) { bitmap->palette = (GColor*)((uint8_t*)bitmap->addr + ...
if (!process_manager_compiled_with_legacy2_sdk()) { if (gbitmap_get_info(bitmap).is_palette_heap_allocated) { applib_free(bitmap->palette); } bitmap->palette = NULL; }
} void gbitmap_destroy(GBitmap* bitmap) { if (!bitmap) { return; } gbitmap_deinit(bitmap); applib_free(bitmap); }
/////////////////// void test_health_db__blob_db_api(void) { const char *key = "monday_sleepData"; // insert one cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), (uint8_t *)s_sleep_data, sizeof(s_sleep_data)), S_SUCCESS); // check int3...
(ActivityMetricHeartRateZone2Minutes, Monday, &val_out)
); cl_assert(!health_db_get_typical_value(ActivityMetricHeartRateZone3Minutes, Monday, &val_out)); } void test_health_db__step_averages(void) { const struct { const char *key; const char *val; } entries[] = { { .key = "sunday_steps", .val = "l4tHpFsFGE6UINneFPMnf2lgINlYuXlDS6xh6vizK9jbDen...
CON_ALIGN}, {"The Lord of the Rings", NULL, NULL, &s_tictoc_icon_bitmap, DEFAULT_ICON_ALIGN}, {"The Matrix", "Revolutions", NULL, &s_tictoc_icon_bitmap, DEFAULT_ICON_ALIGN}, {"8:00 AM", "Weekdays", "OFF", NULL, DEFAULT_ICON_ALIGN}, {"8:00 AM", "Weekdays", NULL, &s_tictoc_icon_bitmap, MenuCellLayerIconAlign_Righ...
(&cell_layer, &cell_frame)
; cell_layer.is_highlighted = is_selected; s_cell_is_highlighted = is_selected; const MenuCellLayerConfig config = { .title_font = column_data->title_font ? fonts_get_system_font(column_data->title_font) : NULL, .subtitle_font = column_data->subtitle_font ? fonts_get_system_font(column_data->subtitle_fon...
rrent_stack, true); cl_assert_equal_p(b, actual); cl_assert_equal_i(0, current_stack); cl_assert_equal_p(b, stack[0]); // no more siblings on root level actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(NULL, actual); cl_assert_equal_i...
(&parent, &child_b)
; layer_add_child(&parent, &child_c); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(9, 9)), &child_a); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(6, 6)), &child_b); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(15, 15)), &child_c); layer...
/* * 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 (!env) continue;
if (is_valid_tmp_path(env)) { strncpy(buffer, env, length); return 0; } } /* If the environment doesn't say anything, try to use /tmp */ if (is_valid_tmp_path("/tmp")) { strncpy(buffer, "/tmp", length); return 0; } #else if (GetTempPath((DWORD)length, buffer)) return 0; #endif /* This system ...
/* * 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...
GColorARGB8FromHEX(0xff0000)
}, // {"purple", GColorARGBFromHEX(0x800080)}, inconsistent with Pebble color {"fuchsia", GColorARGB8FromHEX(0xff00ff)}, // {"green", GColorARGBFromHEX(0x008000)}, inconsistent with Pebble color {"lime", GColorARGB8FromHEX(0x00ff00)}, {"olive", GColorARGB8FromHEX(0x808000)}, {"yellow", GColorARGB8FromHEX(0xff...
dlers) {0}; } return animation->handlers; } // ------------------------------------------------------------------------------------------- bool animation_set_implementation(Animation *animation_h, const AnimationImplementation *implementation) { AnimationState *state = prv_ani...
prv_find_animation_by_handle(NULL, animation_h, false /*quiet*/)
; if (!animation) { return 0; } return animation->abs_start_time_ms; } // ------------------------------------------------------------------------------------------- bool animation_set_duration(Animation *animation_h, uint32_t duration_ms) { AnimationState *state = prv_animation_state_get(PebbleTask_Curre...
ion_send_data(session, GET_BYTES_ENDPOINT_ID, (const uint8_t *) &rsp, sizeof(rsp), COMM_SESSION_DEFAULT_TIMEOUT); if (!success) { PBL_LOG(LOG_LEVEL_ERROR,...
comm_session_send_buffer_end_write(sb)
; if (state->storage.current_offset >= state->num_bytes) { prv_gather_and_record_stats(state); // If all done, mark the image as "read" and free up our state structure gb_storage_cleanup(&state->storage, true /* successful */); kernel_free(state); s_get_bytes_in_progress = false; prv_put_s...
ice.h" #include "process_management/app_install_manager.h" #include "clar.h" // Fakes ////////////////////////////////////////////////////////// #include "fake_app_manager.h" #include "fake_rtc.h" #include "fake_new_timer.h" #include "fake_pbl_malloc.h" #include "fake_spi_flash.h" #include "fake_system_task.h" #inclu...
(sys_get_time() + WAKEUP_EVENT_WINDOW + 59, 0, false)
; cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); // Test that another event < 1 minute away fails to schedule (E_DOES_NOT_EXIST) wakeup_id = sys_wakeup_schedule(sys_get_time() + 1, 0, false); cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); } // work around system_task_add_...
ude "drivers/rtc.h" #include "kernel/pebble_tasks.h" #include "services/normal/accessory/smartstrap_comms.h" #include "services/normal/accessory/smartstrap_link_control.h" #include "services/normal/accessory/smartstrap_profiles.h" #include "services/normal/accessory/smartstrap_state.h" #include "system/logging.h" #incl...
{ prv_fatal_error_strike(); }
else if (!s_profiles) { smartstrap_link_control_disconnect(); } return false; } s_strikes = 0; if (header->type == LinkControlTypeStatus) { // status message const LinkControlStatus status = header->data[0]; if (status == LinkControlStatusOk) { PBL_LOG(LOG_LEVEL_DEBUG, "Got link ...
ter; // Use larger distance from the center to min_x or max_x as half of the width (odd num pixels) const int16_t width = 2 * MAX(left_width, right_width); // starting point of text needs to be half width left of the center. const int16_t x_start = center - width / 2; // Position the text vertically offset fr...
(status_bar_layer->config.mode == StatusBarLayerModeClock)
; const StatusBarTextFormat text_format = prv_get_text_format(); char time_text_buffer[TITLE_TEXT_BUFFER_SIZE]; clock_copy_time_string(time_text_buffer, sizeof(time_text_buffer)); GContext *ctx = graphics_context_get_current_context(); return graphics_text_layout_get_max_used_size(ctx, ...
_idle_begin(); flash_wait_for_write(); flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_READ); flash_send_24b_address(start_addr); // There is delay associated with setting up the stm32 dma, using FreeRTOS // sempahores, handling ISRs, etc. Thus for short reads, the cost of using // DMA is far...
disable_flash_spi_clock()
; power_tracking_stop(PowerSystemFlashErase); flash_unlock(); } // It is dangerous to leave this built in by default. #if 0 void flash_erase_bulk(void) { assert_usable_state(); flash_lock(); if (!s_flash_state.enabled) { flash_unlock(); return; } flash_prf_set_protection(false); power_tra...
/* * 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_ctx; }
void test_health_card_view__initialize(void) { // Setup graphics context framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); framebuffer_clear(&s_fb); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); s_app_state_get_graphics_context = &s_ctx; // Setup resources fake_spi_flash...
cl_assert_equal_i(bpm, 80); prv_inc_time(10); prv_inc_steps_and_put_event(10); prv_put_bpm_event(117, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(steps, 20);...
(steps, 1010)
; // Pretend we wrap around midnight. Midnight will reset the step count. s_total_step_count = 0; // Put some steps and make sure we don't delete or freak out, and append the new step count. prv_inc_steps_and_put_event(50); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m,...
/* * 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...
{ xSemaphoreGiveFromISR(s_spi_int_semph, NULL); }
static void prv_dma_cb(bool *should_context_switch) { portBASE_TYPE was_higher_task_woken = false; xSemaphoreGiveFromISR(s_spi_dma_semph, &was_higher_task_woken); *should_context_switch = (was_higher_task_woken != false); } static bool prv_spi_send_and_receive_dma( const uint8_t *tx_buffer, uint8_t *rx_buf...
include "system/logging.h" #include "system/passert.h" #include "kernel/util/delay.h" #include "kernel/util/sleep.h" #include "util/attributes.h" #include "util/likely.h" #include "util/size.h" #include "FreeRTOS.h" /* FreeRTOS Kernal Prototypes/Constants. */ #include "semphr.h" #define STM32F4_COMPATI...
mcu_state_is_isr()
) { // assume we're in an ISR for the UART and don't need to worry about being blocked return; } mutex_lock_recursive(s_blocked_lock); } static void prv_unlock(void) { if (mcu_state_is_isr()) { // assume we're in an ISR for the UART and don't need to worry about being blocked return; } mutex_...
_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 7: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; default: PBL_CROAK("reset loop boot bits overrun"); break; } return false; } static bool check_for_recovery_start_failure() { return boot_bit_test...
("/\\ _`\\ /'__`\\")
/* * 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 (progress <= ANIMATION_NORMALIZED_MIN) { return (AnimationProgress) getter(array, 0); }
if (progress >= ANIMATION_NORMALIZED_MAX) { return (AnimationProgress) getter(array, max_entry); } // Linear interpolate from the easing table. const size_t stride = ANIMATION_NORMALIZED_MAX / max_entry; const size_t index = (progress * max_entry) / ANIMATION_NORMALIZED_MAX; const int64_t from = gette...
reboot_reason_get_last_reboot_reason()
; if (reason == RebootReasonCode_Shutdown || reason == RebootReasonCode_Unknown) { // Don't send the reboot reason to analytics for insignificant data. return; } HcAnalyticsRebootInfo info = { .last_crash_lr = reboot_reason_get_crash_lr(), .reboot_reason_code = reason, }; memcpy(info.build_id...
t_stroked(&context, &GRect(20, 80, 40, 10), 4, 2)); } void test_graphics_context_${BIT_DEPTH_NAME}__draw_stroke_width_even(void) { // Stroke width even > 2, non-antialiased setup_test(&context, false, SW_EVEN, GColorBlack, GColorBlack, false); graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)); ASSERT_...
(10, 20, 40, 10)