prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ad Size: %"PRIu32, (uint32_t) payload_size); const bool is_last_chunk = (s_state.in.received_size_bytes == s_state.in.total_size_bytes); if (is_last_chunk) { if (rocky_global_has_event_handlers(ROCKY_EVENT_MESSAGE)) { // Last chunk MUST be zero terminated: if (s_state.in.reassembly_buffer[s_state.i...
PBL_LOG(LOG_LEVEL_ERROR, "Failed to send msg with key %"PRIu32, node ? node->key : 0)
; prv_control_message_queue_pop_head(); } else { // Retry happens below by calling prv_control_message_queue_send_head() } } break; } case OutboxMsgTypeChunk: { if (is_sent_successfully) { prv_object_queue_handle_chunk_sent(); } else { ...
/* * 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...
{ switch (msg->command_id) { case HcMessageID_GapService_SetName: gap_le_device_name_handle_set((const char *)&msg->payload[0]); break; case HcMessageID_GapService_DeviceNameRequest: { BTDeviceInternal addr; memcpy(&addr, &msg->payload[0], sizeof(BTDeviceInternal)); gap_le_...
/* * 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_will_return(icache_is_enabled, true); cl_will_return(dcache_is_enabled, true); cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_size, 1); cl_will_return(syscall_internal_check_return_address, true); s_user_start = 0x00; s_user_size = 0x20; memory_cache_flush((void*)0x20, 0x1); ...
void test_cpu_cache__userspace_aligned_fail(void) { cl_will_return(icache_is_enabled, true); cl_will_return(dcache_is_enabled, true); cl_will_return(icache_line_size, 8); cl_will_return(dcache_line_size, 8); cl_will_return(syscall_internal_check_return_address, true); s_user_start = 0x24; s_user_size ...
et(start_page) + FILE_NAME_OFFSET); if (!f->is_tmp) { update_curr_state(f->start_page, TMP_STATE_OFFSET, TMP_STATE_DONE); } // finally, mark the creation as complete update_curr_state(start_page, CREATE_STATE_OFFSET, CREATE_STATE_DONE); return (S_SUCCESS); } static status_t scan_to_offset(File *f, uin...
if (FD_VALID(fd)) { res = PFS_FD(fd).file.file_size; }
mutex_unlock_recursive(s_pfs_mutex); return (res); } int pfs_read(int fd, void *buf_ptr, size_t size) { uint8_t *buf = buf_ptr; mutex_lock_recursive(s_pfs_mutex); int res = E_UNKNOWN; if (!FD_VALID(fd) || (buf == NULL) || (size == 0)) { res = E_INVALID_ARGUMENT; goto cleanup; } File *file =...
/* * 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_update_state(state)
; } void getting_started_button_combo_button_released(GettingStartedButtonComboState *state, ButtonId button_id) { bitset8_clear(&state->buttons_held_bitset, button_id); prv_update_state(state); }
0, .kind = ALARM_KIND_EVERYDAY }); prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule); // Delete the 10:30 alarm alarm_delete(id1); // The 10:30 alarm should not go off s_current_hour = 11; s_current_minute = 0; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_...
alarm_is_next_enabled_alarm_smart()
, false); } void test_alarm__skip_two_alarms(void) { AlarmId id1, id2; bool just_once_schedule_thursday[7] = {false, false, false, false, true, false, false}; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 10, .kind = ALARM_KIND_JUST_ONCE }); prv_assert_alarm_config(id1, 10, 10, false, ALARM_KIND_JUST...
esign spec'd 6 px horizontal spacing b/w the percent text and battery icon battery_percent_text_node->margin.w = 4; GTextNode *vertically_centered_battery_percent_text_node = prv_wrap_text_node_in_vertically_centered_container(battery_percent_text_node); graphics_text_node_container_add_child(&horiz...
prv_mute_notifications_allow_calls_only()
) { return RESOURCE_ID_CONNECTIVITY_BLUETOOTH_CALLS_ONLY; } else if (settings_glance->glance_state.is_pebble_app_connected) { return RESOURCE_ID_CONNECTIVITY_BLUETOOTH_CONNECTED; } else { WTF; } } static void prv_refresh_glance_content(LauncherAppGlanceSettings *settings_glance) { // Update the bat...
AppDBEntry))); AppDBEntry temp; cl_assert_equal_i(S_SUCCESS, app_db_read((uint8_t*)&app1.uuid, sizeof(Uuid), (uint8_t*)&temp, sizeof(AppDBEntry))); cl_assert_equal_i(5, app_db_check_next_unique_id()); // check app 1 memset(&temp, 0, sizeof(AppDBEntry)); cl_assert_equal_i(S_SUCCESS, app_db_get_app_e...
(false, app_db_exists_install_id(0))
; cl_assert_equal_b(true, app_db_exists_install_id(1)); cl_assert_equal_b(true, app_db_exists_install_id(2)); cl_assert_equal_b(true, app_db_exists_install_id(3)); cl_assert_equal_b(false, app_db_exists_install_id(4)); } static const uint8_t some_data[] = {0x01, 0x02, 0x17, 0x54}; void prv_enumerate_entries(A...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
conn_mgr_set_ble_conn_response_time( &s_hdl, BtConsumerUnitTests, ResponseTimeMiddle, 30)
/* * 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_print("address "); dbgserial_print_hex(address); dbgserial_print(" is outside system flash\r\n"); return -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...
("@00000001/abc")
); cl_assert_fixedS16_3(radius, 1); } void test_graphics_circle__grect_polar_calc_values_edge_cases(void) { GPointPrecise center = {}; Fixed_S16_3 radius = {}; const GOvalScaleMode mode = GOvalScaleModeFillCircle; GRect r = GRect(0, 5, 0, 0); grect_polar_calc_values(&r, mode, &center, &radius); cl_asser...
(NULL, GRect(10, 12, -10, -12), GOvalScaleModeFitCircle)
----------------------- // Execute about half of A prv_advance_to_ms_with_timers(start_ms + duration_a/2); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_...
cl_assert_equal_i((uint32_t)entry->context, ANIMATION_NORMALIZED_MAX)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_draw_pixel(ctx, GPoint(5, 15))
; } void outside_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(5, -5)); } void outside_x_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx,...
s_handler_call_count[NumHandlers] = { 0 }; typedef struct { size_t len; uint8_t *buf; } ExpectedData; static ExpectedData s_expected_data; static void prv_set_expected_data(void *data, size_t len) { s_expected_data.buf = data; s_expected_data.len = len; } static void prv_assert_data_matches_expected(const ...
strlen(data[i])
); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(s_handler_call_count[i], 1); } cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0); } //! It's possible the same session can receiver multiple messages before any //! are processed on kernel BG. Make sure they do not interfere with one /...
atus(&item->header.id, TimelineItemStatusDismissed); break; } case TimelineItemActionTypeDismiss: analytics_inc(ANALYTICS_DEVICE_METRIC_NOTIFICATION_DISMISSED_COUNT, AnalyticsClient_System); // This is a notification that was sourced from timeline. The mobile phone does not care // abou...
if (uuid_equal(&header.parent_id, &uuid_calendar_data_source)) { analytics_info->visible_count.calendar++; analytics_info->hourly_count.calendar += within_hour; } else if (!timeline_get_private_data_source(&header.parent_id) && !uuid_is_system(&header.parent_id) && app_get_...
} return true; // continue iteration } void analytics_external_collect_timeline_pin_stats(void) { PinAnalyticsInfo analytics_info = { .timestamp = rtc_get_time() }; pin_db_each(prv_count_each, &analytics_info); analytics_set(ANALYTICS_DEVICE_METRIC_TIMELINE_PINS_VISIBLE_CALENDAR_COUNT, ...
ion_Disabled; DFSDM_InitStruct.DFSDM_PackingMode = DFSDM_PackingMode_Standard; DFSDM_InitStruct.DFSDM_DataRightShift = right_shift; DFSDM_InitStruct.DFSDM_Offset = 0; DFSDM_InitStruct.DFSDM_CLKAbsenceDetector = DFSDM_CLKAbsenceDetector_Disable; DFSDM_InitStruct.DFSDM_ShortCircuitDetector = DFSDM_ShortCircuitD...
{ this->mic_power_state_fn(false); }
stop_mode_enable(InhibitorMic); this->state->running = false; PBL_LOG(LOG_LEVEL_DEBUG, "Stopped microphone, dropped samples: %"PRIu32" bytes received: %"PRIu32, this->state->overflow_cnt, this->state->bytes_received); unlock: mutex_unlock_recursive(this->state->mic_mutex); } bool mic_is...
hrm() && activity_prefs_heart_rate_is_enabled()); } static void prv_reset_subscriptions(void); static bool prv_free_permission_for_each_cb(ListNode *node, void *unused) { kernel_free(node); return true; // continue iteration } static void prv_free_all_permissions(void) { list_foreach((ListNode *)s_p...
(sharing_to_devices)
); bt_driver_hrm_service_handle_measurement(&measurement, sharing_to_devices, num_devices); } static void prv_start_hrm_kernel_main(void *unused) { PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing started"); s_ble_hrm_session.service_info = (EventServiceInfo) { .type = PEBBLE_HRM_EVENT, .handler = prv_ble_hrm_ha...
/* * 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_ctx, &s_fb, GContextInitializationMode_App)
; s_app_state_get_graphics_context = &s_ctx; // Setup resources fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */); pfs_init(false /* run filesystem check */); pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, ...
return peek_layer; } void peek_layer_destroy(PeekLayer *peek_layer) { if (peek_layer) { peek_layer_deinit(peek_layer); } task_free(peek_layer); } void peek_layer_init(PeekLayer *peek_layer, const GRect *frame) { *peek_layer = (PeekLayer) { .icon_offset_y = PEEK_LAYER_ICON_OFFSET_Y, .subtitle_m...
grect_equal(&icon_from, &GRectZero)
) { icon_from = (GRect) { .origin.x = layer_frame.origin.x + (layer_frame.size.w - UNFOLD_DOT_SIZE_PX) / 2, .origin.y = layer_frame.origin.y + (layer_frame.size.h - UNFOLD_DOT_SIZE_PX) / 2, .size = UNFOLD_DOT_SIZE, }; } GSize size = kino_reel_get_size(from_reel); GRect icon_to = { ....
ize_names, data); } // Text Size //////////////////////// // NOTE: Keep the following two arrays in sync and with the same size. static const uint32_t s_window_timeouts_ms[] = { 15 * MS_PER_SECOND, 1 * MS_PER_MINUTE, NOTIF_WINDOW_TIMEOUT_DEFAULT, 10 * MS_PER_MINUTE, NOTIF_WINDOW_TIMEOUT_INFINITE }; static...
i18n_get(subtitle, data)
, NULL); } static void prv_deinit_cb(SettingsCallbacks *context) { SettingsNotificationsData *data = (SettingsNotificationsData *)context; i18n_free_all(data); app_free(data); } static void prv_select_click_cb(SettingsCallbacks *context, uint16_t row) { SettingsNotificationsData *data = (SettingsNotifications...
Off; #define PREF_KEY_VIBE "vibe" static bool s_vibe_on_notification = true; #define PREF_KEY_VIBE_INTENSITY "vibeIntensity" static VibeIntensity s_vibe_intensity = DEFAULT_VIBE_INTENSITY; #if CAPABILITY_HAS_VIBE_SCORES #define PREF_KEY_VIBE_SCORE_NOTIFICATIONS ("vibeScoreNotifications") static VibeScoreId s_vibe_sc...
DELETE_PREF(PREF_KEY_LEGACY_DND_SCHEDULE_ENABLED)
; #undef DELETE_PREF } } #if !PLATFORM_TINTIN static void prv_migrate_legacy_first_use_settings(SettingsFile *file) { // These don't need to be initialized since settings_file_get will clear them on error uint8_t manual_dnd_first_use_complete; bool smart_dnd_first_use_complete; // Migrate the old first use ...
andler_entries(&s_stopped_handler_calls, d), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, spawn), 1); #endif } void prv_update_unschedule_all_handler(Animation *animation, const AnimationProgress distance) { prv_add_handler_entry(&s_update_handler_calls, animation, false, ...
(c, auto_destroy)
; animation_schedule(c); prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); animation_destroy(a); animation_destroy(b); animation_destroy(c); } // -------------------------------------------------------------------------------------- // Test unscheduling animations arbitraril...
/* * 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...
(&countdown_window->base_layer, prv_base_layer_update_proc)
; layer_add_child(&window->layer, &countdown_window->base_layer); countdown_window->images[0] = kino_reel_create_with_resource(RESOURCE_ID_WORKOUT_APP_ONE); countdown_window->images[1] = kino_reel_create_with_resource(RESOURCE_ID_WORKOUT_APP_TWO); countdown_window->images[2] = kino_reel_create_with_resource(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...
GPointPrecise(a.x.raw_value - b.x.raw_value, a.y.raw_value - b.y.raw_value)
; } bool gvector_equal(const GVector * const vector_a, const GVector * const vector_b) { return (vector_a->dx == vector_b->dx && vector_a->dy == vector_b->dy); } bool gvectorprecise_equal(const GVectorPrecise * const vectorP_a, const GVectorPrecise * const vectorP_b) { return ((vectorP_...
a; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed((int[]) { 0 }, 1, &s_recognizers_handled); prv_compare_recognizers_processed((int[]) { 4, 0, 1 }, 3, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown); cl_assert_equal_p(man...
(r1, &layer_a.recognizer_list)
; recognizer_add_to_list(r2, &layer_a.recognizer_list); RecognizerManager manager2; recognizer_set_manager(r1, &manager2); recognizer_manager_deregister_recognizer(&manager, r1); cl_assert_equal_p(manager.active_layer, &layer_a); cl_assert_equal_p(recognizer_get_manager(r1), &manager2); recognizer_set...
data[BMA255_FIFO_MAX_FRAMES]; const uint64_t timestamp_us = prv_get_curr_system_time_ms() * 1000; const uint32_t sampling_interval_us = accel_get_sampling_interval(); uint8_t fifo_status = bma255_read_register(BMA255Register_FIFO_STATUS); BMA255_DBG("Drain %"PRIu8" samples", num_samples_available); const u...
ARRAY_LENGTH(s_operating_states)
; i++) { if (s_operating_states[i].using_interrupts) { enable_interrupts = true; break; } } if (enable_interrupts) { exti_enable(BOARD_CONFIG_ACCEL.accel_ints[0]); exti_enable(BOARD_CONFIG_ACCEL.accel_ints[1]); } else { exti_disable(BOARD_CONFIG_ACCEL.accel_ints[0]); exti_disa...
s_1, 1); cl_assert_equal_i(s_cb_events_1[0].event_type, HRMEvent_BPM); cl_assert_equal_i(s_cb_events_1[0].bpm.bpm, s_hrm_event_data.hrm_bpm); cl_assert_equal_i(s_cb_events_1[0].bpm.quality, s_hrm_event_data.hrm_quality); // Now advance time to just before the expiration time rtc_set_time(rtc_get_time() + ex...
(app_id + 3, 1, expire_s, 0 /* no features */)
; prv_fake_send_new_data(); fake_system_task_callbacks_invoke_pending(); // Expect 4 events: 1 for BPM, 1 for LED, 2 for subscribing to all, none for no feature. cl_assert_equal_i(s_event_count, 4); sys_hrm_manager_unsubscribe(bpm_session); sys_hrm_manager_unsubscribe(led_session); sys_hrm_manager_unsu...
/* * 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, GColorBlack)
ate(RtcIntervalTicks current_rtc_ticks) { // Floor it to the latest second const RtcIntervalTicks current_rtc_ticks_at_second = (current_rtc_ticks / RTC_TICKS_HZ) * RTC_TICKS_HZ; save_rtc_time_state_exact(current_rtc_ticks_at_second, ticks_to_time(s_coarse_ticks + current_rtc_ticks)); } static void initialize_f...
exti_enable_other(ExtiLineOther_RTCAlarm)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gbitmap_create_blank(GSize(DISP_COLS, DISP_ROWS), GBitmapFormat1Bit)
; s_gfx_rotated_bitmap_64_bitmap = gbitmap_create_blank(GSize(64, 64), GBitmapFormat1Bit); uint32_t size_full = (DISP_COLS*DISP_ROWS)/8; #else s_gfx_rotated_bitmap_bitmap = gbitmap_create_blank(GSize(DISP_COLS, DISP_ROWS), GBitmapFormat8Bit); s_gfx_rotated_bi...
of(SharedPRFData, ble_data)); #endif } void shared_prf_storage_store_ble_pairing_data( const SMPairingInfo *pairing_info, const char *name, bool requires_address_pinning, uint8_t flags) { if (!pairing_info || sm_is_pairing_info_empty(pairing_info)) { PBL_LOG(LOG_LEVEL_WARNING, "PRF Storage: Attempting to...
{ shared_prf_storage_erase_bt_classic_pairing_data(); prv_load_bt_classic_pairing_data(&s_pending_bondings.pending_data.bt_classic_data, addr, device_name, link_key, platform_bits); s_pending_bondings.has_bt_classic_pairing_pending = true; prv_shared_prf_reschedule_w...
/* * 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...
(bool, sys_mobile_app_is_connected_debounced, void)
{ return s_debounced_state_is_connected[MobileAppDebounce]; } DEFINE_SYSCALL(bool, sys_pebblekit_is_connected_debounced, void) { return s_debounced_state_is_connected[PebbleKitDebounce]; } #define DISCONNECT_HIDE_DURATION_SECS 25 void debounced_connection_service_handle_event(PebbleCommSessionEvent *e) { Debou...
nses received from the smartstrap static int s_strikes; static void prv_do_send(LinkControlType type) { FrameHeader header = (FrameHeader) { .version = LINK_CONTROL_VERSION, .type = type }; s_type = type; MBuf send_mbuf = MBUF_EMPTY; mbuf_set_data(&send_mbuf, &header, sizeof(header)); PBL_ASSERTN(...
PBL_LOG(LOG_LEVEL_DEBUG, "Invalid response type (%d)", header->type)
; smartstrap_link_control_disconnect(); success = false; } return success; } void smartstrap_link_control_connect(void) { prv_do_send(LinkControlTypeProfiles); accessory_set_baudrate(AccessoryBaud9600); } void smartstrap_link_control_disconnect(void) { s_strikes = 0; s_profiles = 0; accessory_se...
en(file, key, key_len); cl_must_pass(val_len_out); cl_assert_equal_i(val_len, val_len_out); const bool is_immediate_delete = (val_len == 0 && DELETED_LIFETIME <= 0); uint8_t *val_out = malloc(val_len_out); cl_assert_equal_i(settings_file_get(file, key, key_len, val_out, val_len_out), is_i...
(manual_compaction)
; } static void prv_print_stats(SettingsFile *file) { printf("file max used space = %d\n", file->max_used_space); printf("file max space total = %d\n", file->max_space_total); printf("file used space = %d\n", file->used_space); printf("file dead space = %d\n", file->dead_space); } void test_settings_file__com...
ER_OFFSET (sizeof(PageHeader)) #define METADATA_OFFSET (FILEHEADER_OFFSET + sizeof(FileHeader)) #define FILEDATA_LEN (sizeof(FileHeader) + sizeof(FileMetaData)) #define FILE_NAME_OFFSET (FILEHEADER_OFFSET + FILEDATA_LEN) // defines & struct for data that needs to be tracked once a file ...
{ if ((offset + size) <= s_pfs_size) { ftl_read(buffer, size, offset); } else { PBL_LOG(LOG_LEVEL_ERROR, "FS read out of bounds 0x%x", (int)offset); } }
/* * 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...
shell_prefs_should_prompt_display_calibration()
) { return; } launcher_task_add_callback(prv_push_calibration_dialog, NULL); } T_STATIC bool prv_is_known_misaligned_serial_number(const char *serial) { // Filter watches known to be misaligned based on the serial number. This is possible because // Serial numbers are represented as strings as described i...
ONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "text_layout.h" #include "applib/app.h" #include "applib/fonts/fonts.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "process_man...
window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, })
ed, }, data); data->current_animation = move_animation; animation_schedule(move_animation); } static void prv_hide_day_sep(void *context) { TimelineAppData *data = context; data->day_separator_timer_id = EVENTED_TIMER_INVALID_ID; if (!prv_set_state(data, TimelineAppStateHideDaySeparator)) { return; ...
(&data->timeline_layer)
&& prv_set_state(data, TimelineAppStateShowDaySeparator)) { Animation *day_sep_show = timeline_layer_create_day_sep_show(&data->timeline_layer); move_animation = animation_spawn_create(move_animation, day_sep_show, NULL); animation_set_handlers(move_animation, (AnimationHandlers) { .stopped = p...
for (int i = 1; i < 50; i++) { printf("Iteration %3d... ", i); RecordResult result = write_and_change_record_aborting_after_bytes(i); switch (result) { case RecordResultOld: have_hit_old_value = true; break; case RecordResultNew: have_hit_new_value = true; brea...
("Iteration %d key %s val %s\n", i, key, val)
; set_and_verify(&file, key, key_len, val, val_len); } uint8_t cur_val = 0; settings_file_each(&file, prv_each_cb_quit_early, (void *)&cur_val); cl_assert_equal_i(STOPPING_NUM, cur_val); } void test_settings_file__in_place(void) { printf("Testing that we can update a setting file in place\n"); Setti...
_top_margin_px += status_layer_offset; icon_top_margin_px += status_layer_offset; } } y = text_top_margin_px; h = bounds->size.h - y; // Set up the text. TextLayer *text_layer = &dialog->text_layer; text_layer_init_with_parameters(text_layer, &GRect(x, y, w, h), ...
gbitmap_destroy(actionable_dialog->select_icon)
; } } if (actionable_dialog->dialog.destroy_on_pop) { applib_free(actionable_dialog); } } Dialog *actionable_dialog_get_dialog(ActionableDialog *actionable_dialog) { return &actionable_dialog->dialog; } void actionable_dialog_push(ActionableDialog *actionable_dialog, WindowStack *window_stack) { dia...
/* * 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 E_RANGE, so the phone receives BLOB_DB_INVALID_DATABASE_ID and stops sending // unwelcome weather records return E_RANGE; }
icon(GContext *ctx, Layer *base_layer) { HealthHrSummaryCardData *data = layer_get_data(base_layer); GDrawCommandFrame *frame = gdraw_command_sequence_get_frame_by_index( data->pulsing_heart, data->pulsing_heart_frame_index); if (frame) { const GPoint offset = GPoint(-1, -23); gdraw_command_frame_d...
layer_get_data(base_layer)
; layer_set_update_proc(base_layer, prv_base_layer_update_proc); // set health data *data = (HealthHrSummaryCardData) { .health_data = health_data, .pulsing_heart = gdraw_command_sequence_create_with_resource(RESOURCE_ID_HEALTH_APP_PULSING_HEART), .progress_bar = { .num_segments = ARRAY_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(config.units, 31)
; cl_assert_equal_i(config.sign, RTC_CalibSign_Negative); } void test_rtc_calibration__different_target_frequency_not_fast_enough(void) { // Approximately +1.017ppm RTCCalibConfig config = rtc_calibration_get_config(1000001017, ALTERNATE_FREQUENCY_mHZ); cl_assert_equal_i(config.units, 0); } void test_rtc_cali...
(num_minutes, minute_data)
; // Zero out the first hour of data. The sleep algorithm takes an hour to figure out that // you are sleeping, so it has no chance of zeroing out all the steps in that first hour. for (int i = 0; i < 60; i++) { minute_data[i].base.steps = 0; } // --------------------------------------------------------...
find_next_notification(&header, prv_uuid_equal_func, (void *) uuid, fd)) { size = header.payload_length + sizeof(SerializedTimelineItemHeader); } else { PBL_LOG(LOG_LEVEL_DEBUG, "notification not found"); } prv_file_close(fd); return (size); } bool notification_storage_get(const Uuid *id, TimelineItem...
(&header, status, fd)
; } prv_file_close(fd); } void notification_storage_remove(const Uuid *id) { notification_storage_set_status(id, TimelineItemStatusDeleted); } bool notification_storage_find_ancs_notification_id(uint32_t ancs_uid, Uuid *uuid_out) { PBL_ASSERTN(s_notif_storage_mutex != NULL); int fd = prv_file_open(OP_FLAG...
eturn (GDrawState){}; } void graphics_context_set_drawing_state(GContext* ctx, GDrawState draw_state) {} void graphics_context_set_fill_color(GContext* ctx, GColor color){} Layer* inverter_layer_get_layer(InverterLayer *inverter_layer) { return &inverter_layer->layer; } void inverter_layer_init(InverterLayer *inve...
(&l, MenuIndex(0, 1), MenuRowAlignTop, false)
; cl_assert_equal_i(1, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(basic_cell_height, l.selection.y); const int y_center_of_row_1 = basic_cell_height + basic_cell_height / 2; const int row1_vertically_centered = height / 2 - y_center_of_row_1; cl_assert_equal_i(row1_vertically_centered, scroll_...
/* * 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_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_x_origin_layer_aa.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 10); graphics_line_draw_precise_stroked_aa(&ctx, START_ON_ORIGIN_RECT_NXNY, END_ON_ORIGIN_RECT_NXNY, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_origin_layer_aa.${BIT_DEPTH_NAME}.pbi")); // TOD...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "blendtest_0_100_backdrop.pbi"))
; // 0% alpha channel blend test uint8_t color = 0x0; uint8_t alpha = 0x0; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_bitmap_in_rect(&ctx, background_0_100, &ORIGIN_RECT_NO_CLIP); for (int i=0; i < 64; i++) { prv_test_plot_horizontal_line(&ctx.dest_b...
, 2, GColorBlack, GColorBlack, false); graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)); #if PBL_COLOR ASSERT_CALLED(graphics_line_draw_stroked_aa(&context, GPoint(5, 5), GPoint(45, 10), 2)); #else ASSERT_CALLED(graphics_line_draw_stroked_non_aa(&context, GPoint(5, 5), GPoint(45, 10), 2)); #endif setu...
ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_ODD))
; #endif } void test_graphics_context_${BIT_DEPTH_NAME}__fill(void) { // Fill shape, non-antialiased (Stroke width/color N/A) setup_test(&context, false, 5, GColorBlack, GColorBlack, false); graphics_fill_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_fill_rect_non_aa(&context, &GRect(10, 20, 40, 10...
| RCC_APB1Periph_UART8; const uint32_t apb2_periphs = RCC_APB2Periph_TIM1 | RCC_APB2Periph_TIM8 | RCC_APB2Periph_USART1 | RCC_APB2Periph_USART6 | RCC_APB2Periph_ADC | RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2 | RCC_APB2Periph_ADC3 | RCC_APB2Periph_SDIO | RCC_APB2Periph_SPI1 | RCC_APB2Periph_SPI4 | R...
(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)
(seq); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(clone); // Start A prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_call...
prv_count_handler_entries(&s_started_handler_calls, a3)
/* * 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...
stop_mode_disable(InhibitorVibes)
; } else { stop_mode_enable(InhibitorVibes); } stop_mode_disabled = on; } } static uint16_t prv_get_vsys_mv(void) { if (battery_get_charge_state().is_plugged) { // Plugged in, use Vsys rather than Vbat return pmic_get_vsys(); } // Not plugged in, use latest battery reading return ba...
/* * 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...
{ // These values come from time_t (which suffers from the 2038 problem) and our hardware which // only stores a 2 digit year, so we only represent values after 2000. // Remember tm_year is years since 1900. if (t->tm_year < 100) { // Bump it up to the year 2000 to work with our hardware. t->tm_year = ...
bool rtc_sanitize_time_t(time_t *t) { struct tm time_struct; gmtime_r(t, &time_struct); const bool result = rtc_sanitize_struct_tm(&time_struct); *t = mktime(&time_struct); return result; } void rtc_get_time_tm(struct tm* time_tm) { time_t t = rtc_get_time(); localtime_r(&t, time_tm); } const char* ...
ore than one bus // with controllable power. // https://pebbletechnology.atlassian.net/browse/PBL-32232 should address this power_tracking_start(PowerSystem2v5Reg); // wait for the bus supply to stabilize and the peripherals to start up. // the MFI chip requires its reset pin to be stable for at lea...
{ PBL_ASSERTN(bus); *bus->state = (I2CBusState) { .event_semaphore = xSemaphoreCreateBinary(), .bus_mutex = mutex_create(), }; // Must give token before one can be taken without blocking xSemaphoreGive(bus->state->event_semaphore); i2c_hal_init(bus); if (bus->rail_gpio.gpio) { gpio_output_...
void i2c_use(I2CSlavePort *slave) { PBL_ASSERTN(slave); mutex_lock(slave->bus->state->bus_mutex); if (slave->bus->state->user_count == 0) { prv_bus_enable(slave->bus); } slave->bus->state->user_count++; mutex_unlock(slave->bus->state->bus_mutex); } void i2c_release(I2CSlavePort *slave) { PBL_ASSE...
m_is_equal(&t, &t_c)); t = GTransformRotation(0); // Should return identity if angle == 0 cl_assert(gtransform_is_identity(&t)); } void test_graphics_gtransform_${BIT_DEPTH_NAME}__concat(void) { GTransform t_new; GTransform t1; GTransform t2; GTransform t_c; // matrix to compare against // Test identit...
GTransformNumberFromNumber(10)
, GTransformNumberFromNumber(10)); gtransform_rotate(&t_new, &t1, DEG_TO_TRIGANGLE(45)); cl_assert(gtransform_is_equal(&t_new, &t_c)); cl_assert(gtransform_is_equal(&t1, &t2)); // ensure t1 has not changed // Test pointer re-use gtransform_rotate(&t1, &t1, DEG_TO_TRIGANGLE(45)); cl_ass...
/* * 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...
(*reg, accumulator[1])
; *reg = prv_crc_byte(*reg, accumulator[0]); *accumulated_length = 0; } } for (; length >= 4; length -= 4) { *reg = prv_crc_byte(*reg, data_bytes[3]); *reg = prv_crc_byte(*reg, data_bytes[2]); *reg = prv_crc_byte(*reg, data_bytes[1]); *reg = prv_crc_byte(*reg, data_bytes[0]); da...
//////////////////////////// uint32_t time_get_uptime_seconds(void) { return rtc_get_time(); } // Tests //////////////////////////////////// static MenuLayer menu_layer; static AppMenuDataSource data_source; static bool app_filter_callback(struct AppMenuDataSource *source, AppInstallEntry *entry) { if (app_instal...
(&data_source, i)
; cl_assert_equal_i(node->install_id, app_default_order[i]); } app_menu_data_source_deinit(&data_source); } static uint16_t prv_reverse_index(AppMenuDataSource *data_source, uint16_t original_index, void *context) { return app_menu_data_source_get_count(data_source) - 1 - o...
itmap* src_bitmap, GRect dest_rect, GPoint src_origin_offset, GCompOp compositing_mode, GColor tint_color) { if (!src_bitmap->palette) { return; } cons...
(dest_bitmap)
; if (dest_fmt != GBitmapFormat1Bit) { return; } switch (src_fmt) { case GBitmapFormat1Bit: bitblt_bitmap_into_bitmap_tiled_1bit_to_1bit(dest_bitmap, src_bitmap, dest_rect, src_origin_offset, compositing_mode, tint_color); break; case GBi...
t8_t flags) { hdr->flags &= ~flags; } static void clear_flag(SettingsRecordHeader *hdr, uint8_t flags) { hdr->flags |= flags; } static bool flag_is_set(SettingsRecordHeader *hdr, uint8_t flags) { return (hdr->flags & flags) == 0; } // Records have 4 possible states: // - EOF marker: Header is all 1s // - partial...
kernel_malloc(hdr->key_len)
; settings_raw_iter_read_key(&file->iter, key); uint8_t *val = kernel_malloc(hdr->val_len); settings_raw_iter_read_val(&file->iter, val, hdr->val_len); // Include in re-written file if it passes the filter if (!filter_cb || filter_cb(key, hdr->key_len, val, hdr->val_len, context)) { settings_...
->awake_time_utc); strftime(wake_time_str, sizeof(wake_time_str), "%H:%M", local_tm); char total_sleep_str[8]; char deep_sleep_str[8]; prv_convert_seconds_to_time(sleep_total_sec, total_sleep_str, sizeof(total_sleep_str)); prv_convert_seconds_to_time(sleep_deep_sec, deep_sleep_str, sizeof(deep_sleep_str));...
text_layer_set_text(data->steps_card.cur_step_layer, data->steps_card.cur_step_text)
; } // Show time if (data->steps_card.time_layer) { time_t now = time(NULL); APP_LOG(APP_LOG_LEVEL_DEBUG, "new time: %d", (int) now); struct tm *local_tm = localtime(&now); strftime(data->steps_card.time_text, sizeof(data->steps_card.time_text), "%I:%M", local_tm); text_layer_set...
IXEL_BIT, ATTRIBUTE_X, ATTRIBUTE_Y, ATTRIBUTE_COUNT } LineAttribute; typedef struct AppData { Layer *canvas_layer; // UI state LineAttribute selection; // Line attributes PixelBit pixel_bit; LineHue hue; GPoint intersection; } AppData; static void up_handler(ClickRecognizerRef recognizer, void ...
{ AppData *data = window_get_user_data(s_window); GRect bounds = layer->bounds; // Fill background graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_rect(ctx, &bounds); // Draw UI draw_ui_element(ctx, GRect(30, 80, 20, 20), "R", data->hue == HUE_RED, data->selection == A...
data->selection == ATTRIBUTE_Y, data->selection == ATTRIBUTE_Y); // Draw the lines uint8_t saturation; if (data->pixel_bit == PIXEL_BIT_MSB) { saturation = 0b10101010; } else if (data->pixel_bit == PIXEL_BIT_LSB) { saturation = 0b01010101; } else { saturation ...
{ Uuid *uuid = NULL; switch (button) { case BUTTON_ID_UP: uuid = &s_quick_launch_up.uuid; break; case BUTTON_ID_DOWN: uuid = &s_quick_launch_down.uuid; break; case BUTTON_ID_SELECT: uuid = &s_quick_launch_select.uuid; break; case BUTTON_ID_BACK: uuid = &s_qu...
void quick_launch_set_app(ButtonId button, AppInstallId app_id) { QuickLaunchPreference pref = (QuickLaunchPreference) { .enabled = true, }; app_install_get_uuid_for_install_id(app_id, &pref.uuid); const char *key = NULL; switch (button) { case BUTTON_ID_UP: key = PREF_KEY_QUICK_LAUNCH_UP; ...
/* * 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_state_mutex = mutex_create(); }
/* * 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_free(entry->key)
; kernel_free(entry->val); kernel_free(entry); } status_t ram_storage_insert(RamStorage *storage, const uint8_t *key, int key_len, const uint8_t *val, int val_len) { // delete entry if it already exists RamStorageEntry *entry = prv_get_entry(storage->entries, key, key_len); if (entry) { prv_delete(&s...
rect.origin.y == (rect.origin.y + rect.size.h) - radius) && (corner_mask & GCornersBottom)) { if (corner_mask & GCornerBottomLeft) { corner_insets_left = round_bottom_corner_lookup[radius]; } if (corner_mask & GCornerBottomRight) { corner_insets_right = round_bottom_corner_lookup[radiu...
GRect(bottom_rect_origin_x, rect->origin.y + rect->size.h - radius, bottom_rect_size_w, radius)
, 0, GCornerNone, fill_color); } } T_STATIC void prv_fill_rect_non_aa(GContext* ctx, const GRect *rect, uint16_t radius, GCornerMask corner_mask, GColor fill_color) { // for radii <= 8 we can safely use the legacy2 behavior const uint16_t alt_radius =...
privilege mode, we tell the syscall machinery to set the safe to kill boolean as //! soon as the current syscall returns and set another timer. Once that timer expires, if the task is no longer //! in privilege mode we post another KILL event (graceful = false). If the task is still in privilege mode then, //! we croak...
APP_LOG(APP_LOG_LEVEL_INFO, "Heap Usage for %s: Total Size <%dB> Used <%uB> Still allocated <%uB>", pebble_task_get_name(task), (int) heap_size(heap), heap->high_water_mark, heap->current_size)
; } // Let the task manager know we're done cleaning up. context->safe_to_kill = true; // Tell the task manager that we want to be killed. This may be redundant if we're responding to a DEINIT // message, but just in case we're exiting on our own (someone found the sys_exit syscall and called in when // w...
ing drives the duration of the overall glance selection animation //! because we only scroll once, and since we don't know what we're scrolling until this function //! is called, we need to record the duration of the scrolling animation in this function so the //! glance's KinoReel reports the correct duration for the ...
(max_vertical_nodes)
; vertical_node->vertical_alignment = GVerticalAlignmentCenter; GTextNode *title_node = prv_structured_glance_create_title_text_node(structured_glance); // We require a valid title node PBL_ASSERTN(title_node); // Push the title node a little up or down to match the relevant design spec #if PLATFORM_ROBERT ...
teResponse; typedef struct PACKED CRCResponse { uint8_t opcode; uint8_t fd; uint32_t address; uint32_t length; uint32_t crc; } CRCResponse; typedef struct PACKED StatResponse { uint8_t opcode; uint8_t fd; uint8_t data[0]; } StatResponse; typedef struct PACKED EraseResponse { uint8_t opcode; uint8...
(PULSE2_BULKIO_PROTOCOL)
; resp->opcode = BULKIO_RESP_DOMAIN_READ; resp->offset = pulse_fd->transfer_state.offset; int ret = pulse_fd->impl->read_proc(resp->data, resp->offset, read_len, pulse_fd->domain_state); if (ret > 0) { read_len = ret; pulse_fd->transfer_state.bytes_left -= read_len; pulse_fd->transfer_state.offset ...
ht 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 in writing, so...
OS_TASK_DELETE(OS_GET_CURRENT_TASK())
; } /*-----------------------------------------------------------*/ /** * @brief Basic initialization and creation of the system initialization task. */ uint8_t *ucHeap; static void prv_init_main_heap(void) { // We get the location of the heap from a variable provided by the linker script. // The heap is zero-i...
ble(bus->spi, bus->state->spi_clock_periph); } static void prv_spi_clear_flags(const SPIBus *bus) { prv_spi_receive_data(bus); prv_spi_get_flag_status(bus, (SpiI2sFlag)0); } static void prv_spi_dma_cmd(const SPIBus *bus, SpiI2sDma dma_bits, bool enable) { if (enable) { bus->spi->CR2 |= (uint16_t)dma_bits; ...
(&bus->spi_miso, GPIO_OType_PP, bus->spi_sclk_speed, GPIO_PuPd_NOPULL)
; } } static void prv_spi_slave_init(const SPISlavePort *slave) { prv_spi_enable_peripheral_clock(slave->spi_bus); SPIBus *bus = slave->spi_bus; // Grab existing configuration uint16_t tmpreg = bus->spi->CR1; // Clear BIDIMode, BIDIOE, RxONLY, SSM, SSI, LSBFirst, BR, MSTR, CPOL and CPHA bits tmpreg &= CR...
ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 4); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // SW = 5 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 5); ...
(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 3)
; graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 3); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitma...
_RECT_ODD, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_odd_clip"))); } void test_graphics_draw_line___origin_v...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_odd_clip")))
; } void test_graphics_draw_line___even_offset_vertical_dotted(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Test odd and even cols draw appropriately setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 6), 10); gra...
nd_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 7, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r7_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 8, GCornersAll); c...
MIN(RECT_WIDTH, RECT_HEIGHT)
) / 2) - 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2), GCornersAl...
s); ++i) { accel_test_axis[i].positive_value = bmi160_read_16bit_reg(accel_test_axis[i].register_address); PBL_LOG(LOG_LEVEL_DEBUG, "+ %c: %"PRId16, accel_test_axis[i].axis_name, accel_test_axis[i].positive_value); } // Verify each axis saw a big enough delta in response to the self test mode. ...
{ acc_odr = BMI160AccODR_100_HZ; }
else if (BMI160SampleRate_200_HZ == sample_rate) { acc_odr = BMI160AccODR_200_HZ; } else if (BMI160SampleRate_400_HZ == sample_rate) { acc_odr = BMI160AccODR_400_HZ; } else if (BMI160SampleRate_800_HZ == sample_rate) { acc_odr = BMI160AccODR_800_HZ; } else { // any interval < min supported must satur...
/* * 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...
(&data->progress_layer, DOT_TRANSITION_RADIUS)
; mid.size.w = DOT_TRANSITION_RADIUS * 2; mid.size.h = DOT_TRANSITION_RADIUS * 2; mid.origin.x = DOT_OFFSET - DOT_TRANSITION_RADIUS + 2; mid.origin.y = BAR_HEIGHT - DOT_TRANSITION_RADIUS + 1; // shift to accommodate growing radius end.size.w = DOT_COMPOSITOR_RADIUS * 2; end.size.h = DOT_COMPOSITOR_RADIUS ...
bounded(volatile int cycles_to_wait) { prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_READ_STATUS_REG); uint8_t status_register = 0; do { if (cycles_to_wait-- < 1) { break; } status_register = prv_flash_read_next_byte(); } while (status_register & 0x1); prv_flash_end_c...
(sector_addr)
; prv_flash_end_cmd(); prv_flash_wait_for_write(); } static void prv_flash_erase_subsector(uint32_t sector_addr) { prv_flash_write_enable(); prv_flash_start_cmd(); prv_flash_send_and_receive_byte(FLASH_CMD_ERASE_SUBSECTOR); prv_flash_send_24b_address(sector_addr); prv_flash_end_cmd(); prv_flash_wait...
hc_endpoint_discovery_service_changed_handle(&address, characteristic_info->c.value_handle)
; } } void gatt_client_discovery_process_service(const ble_evt_gattc_browse_svc_t *service) { uint32_t payload_size; HcProtocolDiscoveryServiceFoundPayload *payload = prv_gatt_client_discovery_build_gatt_service(service, &payload_size); if (!payload) { return; } Connection *connection = connectio...
_deinit(); // make sure we haven't leaked any memory! fake_pbl_malloc_check_net_allocs(); } // ----------------------------------------------------------------------------- // Edge cases void test_gatt_client_discovery__not_connected(void) { BTDeviceInternal device = prv_dummy_device(1); cl_assert_equal_i(ga...
bt_driver_gatt_get_watchdog_timer_id()
; stub_new_timer_fire(watchdog_timer); // Check whether GATT_Stop_Service_Discovery has been called: cl_assert_equal_i(stop_count + 1, fake_gatt_is_service_discovery_stop_count()); if (i < GATT_CLIENT_DISCOVERY_MAX_RETRY) { // Check whether GATT_Start_Service_Discovery has been called, except fo...
_cmd_activity_insights(int index, void *context) { ActivityDemoAppData *data = context; bool enabled = activity_prefs_activity_insights_are_enabled(); enabled = !enabled; activity_prefs_activity_insights_set_enabled(enabled); data->debug_card.menu_items[index].subtitle = enabled ? "Enabled" : "Disabled"; ...
(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text), "After compaction\nRecords: %d\nData bytes: %d\nMinutes: %d", (int)num_records, (int)data_bytes, (int)minutes)
/* * 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...
(&state->isr_buffer, &state->isr_buffer_client)
; // Allocate buffer for the received message state->msg_buffer = kernel_malloc_check(QEMU_MAX_DATA_LEN); state->msg_buffer_bytes = 0; } // ----------------------------------------------------------------------------------------- // Helper function triggred by our ISR handler when we detect a high water mark ...
16, 304}, { 152, 1152, 88}, // 35 seconds { 168, 720, 192}, { 104, 920, 96}, { 176, 896, 152}, { 200, 848, 96}, { 240, 768, 112}, { 240, 840, 112}, { 248, 840, 112}, { 224, 880, 40}, { 216, 872, 40}, { 232, 856, 56}, { 160, 1032, 112}, { 192, 1112, 80}, { 272,...
{ 312, 1136, 248}, { 288, 1024, 176}, { 168, 1248, 432}, { 200, 1304, 160}, { 152, 912, 144}, // 41 seconds { 168, 944, 104}, { 184, 848, 120}, { 232, 808, 120}, { 256, 784, 120}, { 288, 816, 128}, { 288, 792, 120}, { 280, 808, 48}, { 296, 784, 24}, { 256, 904...
{ 424, 784, 96}, { 384, 840, 112}, { 360, 816, 40}, { 344, 832, 40}, { 384, 768, 88}, { 408, 976, 16}, { 416, 896, 64}, { 456, 1016, -24}, { 472, 952, 200}, { 288, 1656, 320}, { 240, 984, 480}, // 44 seconds { 368, 1128, 216}, { 256, 784, 360}, { 248, 816, 24...
enable stationary mode and disabled unneeded features if (s_stationary_count_down > 0) { PBL_LOG_D(DEBUG_STATIONARY, LOG_LEVEL_DEBUG, "Countdown to stationary: %d", s_stationary_count_down); s_stationary_count_down--; } else { analytics_inc(ANALYTICS_DEVICE_METRIC_STATIONARY_TIME_MINUTES,...
accel_session_delete(s_accel_session)
; s_accel_session = NULL; event_service_client_unsubscribe(&s_button_event_info); regular_timer_remove_callback(&s_accel_stationary_timer_info); s_current_state = StationaryStateDisabled; } static void prv_exit_disabled_state(void) { s_stationary_count_down = STATIONARY_WAIT_BEFORE_ENGAGING_TIME_MINS; PBL...
/* * 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...
layer_set_clips(&card_timeline_layout->icon_layer.layer, false)
(subscription->characteristic, BLESubscriptionNone, client, true /* is_cleaning_up */)
; } subscription = next_subscription; } return false /* should_stop */; } void gatt_client_subscriptions_cleanup_by_client(GAPLEClient client) { bt_lock(); { // Walk all the connections to find subscriptions to unsubscribe: gap_le_connection_find(prv_cleanup_subscriptions_for_client, (void *)(u...
Find the most recent notification which matches this ANCS UID - this will be the last entry in // the db. iOS can reset ANCS UIDs on reconnect, so we want to avoid finding an old notification bool found = false; while (prv_find_next_notification(&header, prv_ancs_id_compare_func, ...
prv_file_open(OP_FLAG_READ | OP_FLAG_WRITE)
; // Finally, close that new file as this fd is only known here prv_file_close(new_fd); } void notification_storage_iterate(bool (*iter_callback)(void *data, SerializedTimelineItemHeader *header), void *data) { PBL_ASSERTN(s_notif_storage_mutex != NULL); if (iter_callback == NULL) { return; } in...
uncher_menu_layer__no_icon_app_with_glance(void) { // Insert a glance with a slice for the app that doesn't have a default icon const AppGlance glance = (AppGlance) { .num_slices = 1, .slices = { { .expiration_time = 1464734484, // (Tue, 31 May 2016 22:41:24 GMT) .type = AppG...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_launcher_menu_layer__app_selected_and_apps_above_and_below_with_glances_pdc(void) { s_use_pdc_icons = true; prv_insert_glances_for_app_selected_and_apps_above_and_below_with_glances_test(); prv_render_launcher_menu_layer(LauncherMenuLayerTestApp_InteriorApp); cl_check(gbitmap_pbi_eq(&s_ctx.dest_b...
{.field = year, .value = ROCKY_DATE_FORMAT_NUMERIC, .format = ToStringFormatYearNumeric}, {.field = year, .value = ROCKY_DATE_FORMAT_2DIGIT, .format = ToStringFormatYear2Digit}, }; int found_options = 0; ToStringFormat result = default_format; for (size_t i = 0; i < ARRAY_LENGTH(option_values); i++) { ...
rocky_error_argument_invalid("Unsupported options")
; } return 0; } struct tm tm; prv_tm_from_js_date(this_val, &tm); const char *strftime_format = prv_strftime_format(format, is_24h_style); const size_t str_len = strftime(buffer, buffer_len, strftime_format, &tm); const bool strip_leading_char = buffer[0] == '0' && prv_strip_leading_zero(format, ...
#include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_syscall_internal.h" #include "stubs_syscalls.h" #include "stubs_system_reset.h" #include "stubs_task_watchdog.h" #include "stubs_ui_window.h" #include "stubs_unobstructed_area.h" ///////////////////////////////////////////////...
GRect(80, 4, 72, 32)
, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } // Word Wrap Tests void draw_text_single_line_wordwrap_clip_across_ny(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, -18, 72, 32), ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
fun(GColorBlack)
.argb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorWhite).argb); // // expectation as derived from Appfaces_all.psd cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0xff0000)).argb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0x00aaff)).argb); cl_assert_equal_i(GColorWhiteARGB8, fun(GColorF...
/* * 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; }
// Helpers //////////////////////////////////// void open_settings_file(SettingsFile *file) { 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_mi...
r.timestamp + 1; notification_storage_store(&e2); cl_assert(notification_storage_get(&i1, &r)); compare_notifications(&e1, &r); free(r.allocated_buffer); cl_assert(notification_storage_get(&i2, &r)); compare_notifications(&e2, &r); free(r.allocated_buffer); cl_assert(notification_storage_get(&i3, &r)...
notification_storage_get(&uuids[i], &r)
); compare_notifications(&e, &r); free(r.allocated_buffer); // Check that an expected number of notifications were removed erase_count += j; for (; j < erase_count; j++) { e.header.id = uuids[j]; e.header.timestamp = timestamp + j; cl_assert_equal_b(notification_storage_get(&uuids[j], &r), false)...
-264}, // 117 seconds { 904, 560, -376}, { 952, 576, -488}, { 1032, 512, -432}, { 904, 448, -336}, { 1024, 552, -264}, { 1208, 728, -296}, { 1232, 880, -272}, { 1504, 928, -80}, { 1696, 568, -24}, { 1616, 456, -40}, { 1432, 376, 24}, { 1256, 304, 32}, { 1008, 184...
{ 1784, 264, -24}, { 1648, 544, -16}, { 1472, 448, 72}, { 1216, 288, 72}, { 960, 208, 0}, { 704, 96, -40}, { 408, 56, -64}, { 224, 152, -224}, { 192, 104, -312}, { 312, 168, -456}, { 488, 256, -560}, { 600, 248, -480}, { 808, 320, -408}, // 123 seconds { 1080,...
{ 776, 360, -288}, { 792, 368, -336}, { 792, 400, -384}, { 736, 448, -360}, { 728, 544, -328}, { 688, 696, -240}, { 600, 768, -80}, { 512, 928, -8}, { 448, 1056, 112}, { 424, 968, 312}, { 448, 928, 312}, { 448, 968, 368}, { 464, 912, 424}, { 472, 880, 344}, {...
e typedef struct { GSize from; GSize to; } ScaleCBContext; T_STATIC bool prv_gdraw_command_scale(GDrawCommand *command, uint32_t index, void *context) { ScaleCBContext *scale = context; const uint16_t num_points = gdraw_command_get_num_points(command); for (uint16_t i = 0; i < num_points; i++) { command...
gdraw_command_list_collect_points(list, is_precise, &num_points)
; if (!points) { return NULL; } gpoint_sort(points, num_points, comparator, context, reverse); GPointIndexLookup *lookup = applib_malloc(sizeof(GPointIndexLookup) + num_points * sizeof(uint16_t)); if (!lookup) { applib_free(points); return lookup; } lookup->num_points = num_points; ...
.flags = 0, .layout = LayoutIdTest, } }, { .header = { .id = {0xcc}, .timestamp = 14000, .duration = 30, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, } }, { .header = { .id = {0xdd}, .timestamp = 16000, .duration = 3...
timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000)
, 0); cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id)); // check second cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); // check third cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id));...
(void *) (uintptr_t) bonding_id); } static bool prv_intent_filter_disconnected(ListNode *node, void *data) { const GAPLEConnectionIntent *intent = (const GAPLEConnectionIntent *) node; return !gap_le_connection_is_connected(&intent->device); } static bool prv_has_intents_for_disconnected_devices(void) {...
(&request->bonding.irk)
; if (!connection) { if (sm_is_pairing_info_irk_not_used(&request->bonding.irk)) { PBL_LOG(LOG_LEVEL_DEBUG, "register_intent: IRK not used, searching by addr"); connection = gap_le_connection_by_device(&request->bonding.device); } } if (connection) { is_already_connected = ...
464, 768, 232}, { -448, 744, 224}, { -424, 744, 208}, { -440, 736, 224}, { -448, 744, 224}, { -448, 744, 224}, { -440, 736, 224}, // 179 seconds { -448, 760, 224}, { -440, 736, 208}, { -448, 736, 216}, { -440, 744, 216}, { -440, 736, 208}, { -456, 736, 216}, { -44...
{ -424, 760, 200}, { -432, 752, 200}, { -440, 752, 200}, { -432, 752, 200}, { -432, 752, 200}, { -440, 760, 192}, { -432, 752, 200}, { -432, 752, 200}, { -432, 760, 192}, { -440, 752, 184}, { -440, 752, 192}, { -440, 760, 192}, { -424, 688, 248}, { -456, 808, 208}...
{ -416, 768, 176}, { -424, 760, 184}, // 187 seconds { -432, 752, 200}, { -424, 760, 184}, { -432, 752, 184}, { -440, 752, 192}, { -424, 760, 192}, { -424, 760, 184}, { -416, 760, 176}, { -424, 760, 192}, { -424, 760, 184}, { -432, 752, 184}, { -432, 760, 184}, ...
ata_signature, sizeof(data_signature)) != sizeof(data_signature)) { return false; } return (ntohl(data_signature) == TLUT_SIGNATURE); } T_STATIC uint32_t prv_get_app_resource_id(ResAppNum res_app_num, TimelineResourceId timeline_id, Timelin...
(UUID_STRING_BUFFER_LENGTH)
FMT_STRCOPY_I18N(time_locale->weekday[t->tm_wday % DAYS_PER_WEEK]); break; case 'h': // SU case 'b': FMT_STRCOPY_I18N(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; ...
(year % 100, 2, INTFMT_PADZERO)
; break; case 'Y': FMT_INTCOPY(year, 4, INTFMT_PADZERO); break; case 'z': { if (left < 5) { goto _out_of_size; } sprintf(dest_str, "%+.2d%02u", t->tm_gmtoff / 3600, (abs(t->tm_gmtoff) / 60) % 60); dest_str += 5; left -= 5; bre...
/* * 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...
new_timer_delete(s_timer)
; s_timer = TIMER_INVALID_ID; s_app_started = false; } } void app_idle_timeout_pause(void) { if (s_timer != TIMER_INVALID_ID) { new_timer_stop(s_timer); } s_app_paused = true; } void app_idle_timeout_resume(void) { s_app_paused = false; #ifndef NO_WATCH_TIMEOUT prv_start_timer(false /* do not ...