prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
it = reminder_db_init, .insert = reminder_db_insert, .get_len = reminder_db_get_len, .read = reminder_db_read, .del = reminder_db_delete, .flush = reminder_db_flush, .is_dirty = reminder_db_is_dirty, .get_dirty_list = reminder_db_get_dirty_list, .mark_synced = reminder_db_mark_synced, ...
blob_db_event_put(BlobDBEventTypeInsert, db_id, key, key_len)
; } return rv; } return E_INVALID_OPERATION; } int blob_db_get_len(BlobDBId db_id, const uint8_t *key, int key_len) { if (!prv_db_valid(db_id)) { return E_RANGE; } const BlobDB *db = &s_blob_dbs[db_id]; if (db->get_len) { return db->get_len(key, key_len); } return E_INVALID_OPER...
_quick_launch) { // Quick Launch only apps are first return (is_app_quick_launch ? 1 : 0) - (is_new_quick_launch ? 1 : 0); } else if (override_cmp_rv) { // Apps that override storage, record, and install order return (override_cmp_rv); } else if (app_node->storage_order != new_node->storage_order) {...
(install_data)
; } void prv_send_callback_to_app(AppMenuDataSource *data_source, AppInstallId install_id, InstallEventType event_type) { InstallData *install_data = kernel_malloc_check(sizeof(InstallData)); *install_data = (InstallData) { .id = install_id, .source = data_source, .event_t...
st = &alarm_action->attr_list; const char *action_title = attribute_get_string(action_attr_list, AttributeIdTitle, NULL); cl_assert_equal_s(action_title, "Edit"); } void test_alarm__pin_remove(void) { const AlarmId dummy_alarm_id = 0; Uuid pin_uuid; alarm_pin_add(s_monday, dummy_alarm_id, AlarmType_Basic, A...
(s_num_timeline_removes, 24)
ashAddress addr) { get_sector_base_calls++; return addr & 0xfffff000; } int erase_subsector_begin_calls = 0; status_t erase_subsector_begin_return = S_SUCCESS; status_t flash_impl_erase_subsector_begin(FlashAddress addr) { erase_subsector_begin_calls++; return erase_subsector_begin_return; } int erase_sector_...
cl_assert_equal_i(erase_sector_begin_calls, 2)
LayoutIdNotification, &notif_attr_list, &action_group); i18n_free_all(&notif_attr_list); attribute_list_destroy_list(&notif_attr_list); attribute_list_destroy_list(&positive_attr_list); attribute_list_destroy_list(&ne...
{ ResponseItem *response_item = &response_items[i]; attribute_list_destroy_list(&response_item->attr_list); }
dupe_row, int16_t shift_amount) { const int16_t delta = start_row > end_row ? -1 : 1; for (int16_t dest_row = start_row; dest_row != end_row; dest_row += delta) { src_bitmap->bounds = (GRect) { .origin.y = (dupe_row >= 0 ? dupe_row : dest_row) - shift_amount, .size = { DISP_COLS, 1 }, }; bi...
{ GBitmap app_bitmap = compositor_get_app_framebuffer_as_bitmap(); bitblt_bitmap_into_bitmap(&dest_bitmap, &app_bitmap, GPoint(0, app_offset_y), GCompOpAssign, GColorWhite); if (app_should_dupe) { prv_duplicate_framebuffer_row(&dest_bitmap, app_dupe_row, app_offset_y + ap...
framebuffer_dirty_all(compositor_get_framebuffer()); // Update modal position for transparent modals compositor_set_modal_transition_offset(GPoint(0, app_offset_y)); } static void prv_slide_transition_animation_init(Animation *animation) { // Give a regular moook more time to stretch the anticipation const...
/* * 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...
{ GattServerSubscribeEvent event = { .connection_id = s_connection_id, .dev_address = s_device.address, .is_subscribing = is_subscribing, }; bt_driver_cb_gatt_service_changed_server_subscribe(&event); }
rintf(temp, sizeof(temp), "%s: min: %"PRIi32", max: %"PRIi32", avg: %"PRIi32" \n", ranges[i].desc, min, max, avg); APP_LOG(APP_LOG_LEVEL_DEBUG, "%s", temp); prv_safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text)); } prv_display_alert(data->debug_card.dialog_tex...
window_set_window_handlers(data->debug_window, (WindowHandlers) { .load = debug_window_load, .unload = debug_window_unload, })
; // Results window data->results_window = window_create(); window_set_background_color(data->results_window, GColorBlack); window_set_user_data(data->results_window, data); window_set_click_config_provider_with_context(data->results_window, results_click_config_provider, ...
_storage_update_ble_device_name(BTBondingID bonding, const char *device_name) { BtPersistBondingData data; if (!prv_file_get(&bonding, sizeof(bonding), &data, sizeof(data))) { return false; } if (data.type != BtPersistBondingTypeBLE) { PBL_LOG(LOG_LEVEL_ERROR, "Not getting BLE id %d. Type mismatch", bo...
( NULL, NULL, data.ble_data.name, NULL, NULL, name_out)
; return true; } typedef struct { BTDeviceInternal device; SMIdentityResolvingKey irk_out; char name_out[BT_DEVICE_NAME_BUFFER_SIZE]; bool found; } FindByAddrItrData; static bool prv_find_by_addr_itr(SettingsFile *file, SettingsRecordInfo *info, void *context) { // check e...
NSE_TIMEOUT_MS); if (end_id == HcEndpointID_Ctl) { time_ticks = milliseconds_to_ticks(HC_PROTOCOL_DEFAULT_CTL_ENDPOINT_RESPONSE_TIMEOUT_MS); } xSemaphoreTake(expectation->semaphore, time_ticks); prv_lock(); { // If we've timed out, expectation->response is NULL: response = expectation->response; ...
{ return false; }
/* * 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...
printf("Battery change period: %"PRId64"\n", value)
----------------------------------------------------------------- const char *alarm_get_string_for_kind(AlarmKind kind, bool all_caps) { const char *alarm_day_text = NULL; switch (kind) { case ALARM_KIND_EVERYDAY: alarm_day_text = all_caps ? /// A frequency option for alarms, i.e. the alarm would go...
i18n_free(day_strings[i % 7], day_strings)
; // copied in by strcat. We can free it } } if (num_days_scheduled == 1) { // Write the full day string const char *full_day_string = i18n_get(full_day_strings[latest_day_scheduled], full_day_strings); strcpy(alarm_day_text, full_day_string); i18n_free...
adius) {} void graphics_fill_circle(GContext* ctx, GPoint p, uint16_t radius) {} void graphics_context_move_draw_box(GContext* ctx, GPoint offset) {} void graphics_line_draw_precise_stroked(GContext* ctx, GPointPrecise p0, GPointPrecise p1) {} void gpath_fill_precise_internal(GContext *ctx, GPointPrecise *points, size_...
cl_assert(!gdraw_command_sequence_validate(sequence, size))
; free(sequence); } void test_gdraw_command_sequence__get_frame_by_elapsed(void) { GDrawCommandSequence *sequence; prv_create_test_sequence(&sequence); GDrawCommandFrame *frame = gdraw_command_sequence_get_frame_by_elapsed(sequence, 0); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_index(seq...
e_id = event.service_id; const bool is_available = (event.result == SmartstrapResultOk); state->handlers.availability_did_change(service_id, is_available); } } else { // All events other than SmartstrapConnectionEvent contain the attribute pointer SmartstrapAttribute *attr = event.attribute; ...
prv_state_deinit()
; } sys_smartstrap_attribute_unregister(attr); #endif } bool app_smartstrap_service_is_available(SmartstrapServiceId service_id) { #if USE_SMARTSTRAP return sys_smartstrap_is_service_connected(service_id); #else return false; #endif } SmartstrapServiceId app_smartstrap_attribute_get_service_id(SmartstrapAttri...
) { continue; } if (partially_overwritten(hdr)) { // The only case where we should hit this is if we are compacting a file // which has a record which was in the middle of being overwritten, but // the write of the new record didn't finish by the time we rebooted. // There should o...
search_forward(&file->iter, key, file->iter.hdr.key_len)
; if (!found_another) { // No other file->iter.hdr found, we must have rebooted in the middle of // writing the new record. Compacting the file will copy over the // previous record while clearing the overwrite bits for us, so that we // can still find the previous record. We could be smart...
h" #include "stubs_prompt.h" #include "stubs_sleep.h" #include "stubs_task_watchdog.h" #include "stubs_vibes.h" #include "stubs_vibe_score_info.h" #include "fake_rtc.h" // Overrides ///////////////////////////////// void do_not_disturb_init(void) { return; } void vibe_intensity_init(void) { return; } static boo...
{ s_dnd_active = true; alerts_set_dnd_mask(AlertMaskAllOff); alerts_set_mask(AlertMaskAllOn); cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_vibrate_for_type(AlertMobile)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HO...
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(alerts_should_enable_backlight_for_type(AlertPhoneCall)); cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_vibrate_for_type(AlertMobile)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_...
R1Flags_TE); } void uart_init_rx_only(UARTDevice *dev) { prv_init(dev, false /* !is_open_drain */, UARTCR1Flags_RE); } void uart_deinit(UARTDevice *dev) { dev->periph->CR1 &= ~USART_CR1_UE; periph_config_disable(dev->periph, dev->rcc_apb_periph); // Change the pins to be digital inputs rather than AF pins. We...
{ PBL_ASSERTN(dev->state->tx_irq_handler || dev->state->rx_irq_handler); // enable the interrupt NVIC_SetPriority(dev->irq_channel, dev->irq_priority); NVIC_EnableIRQ(dev->irq_channel); }
ude "os/mutex.h" #include "system/passert.h" #include "system/status_codes.h" #include "util/units.h" #include "util/uuid.h" #define SETTINGS_FILE_NAME "contactsdb" #define SETTINGS_FILE_SIZE (KiBYTES(30)) static struct { SettingsFile settings_file; PebbleMutex *mutex; } s_contacts_db; ////////////////////// // ...
mutex_unlock(s_contacts_db.mutex)
; return rv; }
nboxServiceTagUnitTest, 1, s_writer)); cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1)); cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // Only one callback event scheduled: assert_num_callback_events(1); s_num_messages_to_consume_from...
{ prv_create_test_inbox_and_begin_write(); // One message, too large, so it should get dropped: cl_assert_equal_b(false, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, BUFFER_SIZE + 1)); cl_assert_equal_b(false, app_inbox_service_end(AppInboxS...
void test_app_inbox__app_inbox_service_unregister_by_storage_unknown_storage(void) { uint8_t storage[BUFFER_SIZE]; cl_assert_equal_i(app_inbox_service_unregister_by_storage(storage), 0); }
) { assert_usable_state(); flash_lock(); if (!s_flash_state.enabled) { flash_unlock(); return; } flash_prf_set_protection(false); power_tracking_start(PowerSystemFlashErase); enable_flash_spi_clock(); handle_sleep_when_idle_begin(); flash_write_enable(); flash_start_cmd(); flash_se...
on_complete_cb(context, S_SUCCESS)
; }
prv_file_open_and_lock(&file)) { return; } if (id == s_most_recent_alarm_id) { PBL_LOG(LOG_LEVEL_DEBUG, "Canceling snooze timer on delete"); prv_clear_snooze_timer(); } AlarmStorageKey key = { .id = id, .type = ALARM_DATA_CONFIG }; settings_file_delete(&file, &key, sizeof(key)); prv_timeline_r...
{ return s_snooze_delay_m; }
// ---------------------------------------------------------------------------------------------- void alarm_set_snooze_delay(uint16_t delay_m) { SettingsFile file; if (!prv_file_open_and_lock(&file)) { return; } s_snooze_delay_m = delay_m; settings_file_set(&file, ALARM_PREF_KEY_SNOOZE_DELAY, ...
/* * 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->pulsing_heart)
; const uint32_t timer_duration = duration / num_frames; const uint32_t max_heart_beats = PULSING_HEART_TIMEOUT / duration; data->pulsing_heart_frame_index++; if (data->pulsing_heart_frame_index >= num_frames) { data->pulsing_heart_frame_index = 0; data->num_heart_beats++; } if (data->num_heart_b...
&s_next_alarm, s_next_alarm_time); } mutex_unlock(s_mutex); return alarm_is_scheduled; } // ---------------------------------------------------------------------------------------------- bool alarm_is_next_enabled_alarm_smart(void) { mutex_lock_with_timeout(s_mutex, portMAX_DELAY); const bool alarm_is_sch...
if (key.type != ALARM_DATA_CONFIG) { return true; }
AlarmConfig config; bool rv = prv_alarm_get_config(file, key.id, &config); if (!rv) { return true; } AlarmInfo alarm_info = { .hour = config.hour, .minute = config.minute, .kind = config.kind, .enabled = !config.is_disabled, .is_smart = config.is_smart, .scheduled_days = &config...
workout_service__working_out_past_midnight(void) { int32_t steps, duration_s, distance_m, bpm; HRZone hr_zone; cl_assert(workout_service_start_workout(ActivitySessionType_Run)); // Start with only 10 steps and make sure it updates. prv_inc_steps_and_put_event(10); cl_assert(workout_service_get_current_wor...
(s_hrm_subscribed, true)
; cl_assert_equal_i(s_hrm_expiration, 0); prv_inc_time(1 * SECONDS_PER_MINUTE); cl_assert(workout_service_start_workout(ActivitySessionType_Run)); // Workout of 120 seconds duration. Should be valid prv_inc_time(2 * SECONDS_PER_MINUTE); cl_assert(workout_service_stop_workout()); prv_inc_time(2 * SECONDS...
CURRENT_TEXT_COLOR, container); graphics_text_node_draw(&container->node, ctx, &rect, NULL, NULL); graphics_text_node_destroy(&container->node); } else { char buffer[16]; const GFont font = data->em_dash_font; snprintf(buffer, sizeof(buffer), EM_DASH); graphics_context_set_text_color(ctx, CURR...
i18n_free_all(base_layer)
; kino_reel_destroy(data->icon); layer_destroy(base_layer); } GColor health_sleep_summary_card_get_bg_color(Layer *layer) { return CARD_BACKGROUND_COLOR; } bool health_sleep_summary_show_select_indicator(Layer *layer) { HealthSleepSummaryCardData *health_sleep_summary_card_data = layer_get_data(layer); retu...
? 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(); ...
MIN(rc->max_rx_chunk_size, POSTMESSAGE_PROTOCOL_MAX_TX_CHUNK_SIZE)
ack size (go to sibling instead of child) stack[0] = a; current_stack = 0; actual = __layer_tree_traverse_next__test_accessor(stack, 1, &current_stack, true); cl_assert_equal_p(b, actual); cl_assert_equal_i(0, current_stack); cl_assert_equal_p(b, stack[0]); // test limited stack size (go to sibling of pa...
layer_find_layer_containing_point(&parent, &GPoint(15, 15))
, &child_e); } static bool prv_override_layer_contains_point(const Layer *layer, const GPoint *point) { return true; } void test_layer__find_layer_contains_point_override_layer_contains_point(void) { Layer parent, child_a, child_b; Layer *layers[] = {&parent, &child_a, &child_b}; for (int i = 0; i < ARRAY_LEN...
*value_length_in_out = 0; } has_more = has_notification && prv_get_next_notification_header(client, &next_header); } unlock: if (!has_more) { s_is_notification_event_pending[client] = false; } if (has_more_out) { *has_more_out = has_more; } prv_unloc...
{ if (subscription->pending_confirmation[c]) { return true; } }
return false; } static BLESubscription prv_prevailing_subscription_type(GATTClientSubscriptionNode *subscription) { const BLESubscription orred = subscription->subscriptions[GAPLEClientApp] | subscription->subscriptions[GAPLEClientKernel]; // Notifications wins over None and Indi...
48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -992}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 16, -100...
{ 48, 24, -1000}, { 48, 16, -1000}, { 48, 32, -992}, { 48, 16, -1000}, { 48, 32, -992}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -992}, { 48, 24, -1000}, { 48, 24, -...
cl_assert(result); } void test_js__rocky_tictoc_bw(void) { GContext ctx = {}; s_app_state_get_graphics_context = &ctx; prv_deinit(); // engine will be re-initialized in rocky_event_loop~ char *script = prv_load_js("bw"); s_tictoc_callback_is_color = false; s_app_event_loop_callback = prv_rocky_tictoc_c...
prv_load_js("color")
; uint8_t snapshot[65536] = { 0 }; // make sure snapshot data starts with expected Rocky header const size_t header_size = sizeof(ROCKY_EXPECTED_SNAPSHOT_HEADER); cl_assert_equal_i(8, header_size); // NOTE: the snapshot header in this unit test is fixed to // CAPABILITY_JAVASCRIPT_BYTECODE_VERSION=1 ...
nager.h" #include "services/normal/filesystem/pfs.h" #include "services/common/system_task.h" #include "system/logging.h" #include "system/passert.h" #define ORDER_FILE "lnc_ord" typedef struct { PebbleMutex *order_mutex; } AppOrderData; static AppOrderData s_data; void app_order_storage_init(void) { s_data.ord...
(PebbleTask_KernelBackground)
; int storage_size = sizeof(AppMenuOrderStorage) + (count * sizeof(AppInstallId)); AppMenuOrderStorage *storage = kernel_malloc(storage_size); memset(storage, 0, storage_size); UuidTranslateData data = { .uuid_list = uuid_list, .count = count, .storage = storage, }; // go through all install ...
get_metric(ActivityMetricHeartRateFilteredUpdatedTimeUTC, 1, &last_update_utc); cl_assert_equal_i(last_median, 51); cl_assert(last_update_utc >= rtc_get_time() - 1); cl_assert(last_update_utc <= rtc_get_time()); } static uint32_t s_num_hr_events; static PebbleHealthEvent s_last_hr_event; static void prv_fake_hr...
(metric_values[0], 4444)
; // Verify some other metrics work activity_metrics_prv_set_metric(ActivityMetricActiveSeconds, Thursday, 60); activity_get_metric(ActivityMetricActiveSeconds, 1, metric_values); cl_assert_equal_i(metric_values[0], 60); activity_metrics_prv_set_metric(ActivityMetricDistanceMeters, Thursday, 66); activity...
r implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "settings_file.h" #include "settings_raw_iter.h" #include "drivers/rtc.h" #include "kernel/pbl_malloc.h" #include "services/normal/filesystem/pfs.h" #include "system/logging.h" #include "sy...
compute_stats(file)
; return S_SUCCESS; } status_t settings_file_open(SettingsFile *file, const char *name, int max_used_space) { return prv_open(file, name, OP_FLAG_READ | OP_FLAG_WRITE, max_used_space); } void settings_file_close(SettingsFile *file) { settings_raw_iter_deinit(&file->iter); kernel_f...
0) && (header->version <= SMARTSTRAP_PROTOCOL_VERSION) && !header->flags.is_read && !header->flags.is_master && !header->flags.reserved && (header->profile > SmartstrapProfileInvalid) && (header->profile < NumSmartstrapProfiles) && (s_read_info.length >= FRAME_MIN_LENGTH) && ...
{ // we should no longer be sending return false; }
LE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_bw_assign_corner_45.Xbit.pbi")); // Top-left center rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bi...
graphics_draw_rotated_bitmap(&ctx, test_image_color, GPoint(30, 30), DEG_TO_TRIGANGLE(45), GPointZero)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_assign_center_45.Xbit.pbi")); // Test transparency setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_context_set_fill_color(&ctx, GColorBlue); graphics_fill_rect(&ctx, ...
{ 560, 168, -752}, { 552, 160, -744}, { 560, 192, -736}, { 552, 192, -760}, { 536, 224, -752}, { 536, 176, -760}, { 552, 152, -784}, { 552, 184, -752}, { 552, 192, -736}, { 552, 176, -736}, { 552, 184, -744}, { 560, 184, -744}, { 552, 168, -744}, { 560, 184, -744}...
// 13 seconds { 560, 248, -736}, { 560, 216, -728}, { 560, 216, -736}, { 568, 232, -728}, { 568, 224, -728}, { 560, 216, -720}, { 560, 232, -728}, { 560, 216, -728}, { 560, 232, -728}, { 560, 208, -728}, { 568, 224, -728}, { 560, 232, -728}, { 552, 216, -776}, ...
"services/common/clock.h" #include "system/passert.h" #include "util/size.h" #include <string.h> #define ROCKY_DATE_TOLOCALETIMESTRING "toLocaleTimeString" #define ROCKY_DATE_TOLOCALEDATESTRING "toLocaleDateString" #define ROCKY_DATE_TOLOCALESTRING "toLocaleString" #define ROCKY_DATE_FORMAT_NUMERIC "numeric" #define...
(options, "month")
; JS_VAR year = jerry_get_object_field(options, "year"); JS_VAR hour12 = jerry_get_object_field(options, "hour12"); if (!jerry_value_is_undefined(hour12)) { *is_24h_style = !jerry_get_boolean_value(hour12); } struct { const jerry_value_t field; const char *value; ToStringFormat format; } o...
const uint16_t num_hr_samples = hr->num_samples; if (num_hr_samples > 0) { int32_t median, total_weight; // Stats requires an int32_t array and we need one for both the samples and the weights int32_t *sample_buf = task_zalloc_check(num_hr_samples * sizeof(int32_t)); int32_t *weight_buf = task_zalloc...
prv_update_current_hr_zone(state)
prv_send_callback_to_app(data_source, install_id, APP_ICON_NAME_UPDATED); } //! Must be run from the app task static void prv_do_app_db_cleared(AppMenuDataSource *source) { AppMenuNode *iter = source->list; while (iter) { AppMenuNode *temp = (AppMenuNode *)list_get_next((ListNode *)iter); // if the node ...
{ if (node->install_id == install_id) { return node; } else { node = (AppMenuNode*)list_get_next((ListNode*)node); } }
return NULL; } //! @return True if there was app with install_id was found and removed from the list. static bool remove_app_with_install_id(const AppInstallId install_id, AppMenuDataSource *source) { if (source->is_list_loaded == false) { return false; } AppMenuNode *node = prv_find_node_with_install_id...
end_response_fmt(buffer, sizeof(buffer), "X: %"PRId16" Y: %"PRId16, mfg_info_get_disp_offsets().x, mfg_info_get_disp_offsets().y); } void command_disp_offset_write(const char* offset_x_str, const char* offset_y_str) { char *nonnumeric_x, *nonnumeric_y; int8_t o...
reboot_reason_set(&reason)
; system_hard_reset(); } #else void command_bootloader_test(void) { prompt_send_response("Not configured for bootloader test"); } #endif
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ARRAY_LENGTH(s_fetched_app_attributes)
prv_get_activity_type(cell_index->row); const char *title = workout_utils_get_name_for_activity(activity_type); const GBitmap *icon = &selection_window->workout_icons[cell_index->row]; const int icon_top_padding = 11; const int title_top_padding = PBL_IF_RECT_ELSE(11, cell_layer->is_highlighted ? 40 : 2); c...
(menu_layer, GColorWhite, GColorBlack)
; menu_layer_set_highlight_colors(menu_layer, PBL_IF_COLOR_ELSE(GColorYellow, GColorBlack), PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite)); menu_layer_set_click_config_onto_window(menu_layer, &selection_window->window); layer_add_child(&selection_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...
sys_wakeup_cancel_all_for_app()
; // Schedule a wakeup in 10 seconds wakeup_id = sys_wakeup_schedule(sys_get_time() + 10, 0, false); cl_assert_equal_i(sys_wakeup_query(wakeup_id), sys_get_time() + 10); // Cancel wakeup event sys_wakeup_delete(wakeup_id); cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); // Schedule ag...
/* * 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...
{ PebbleProcessMdFlash md = { .common.process_storage = ProcessStorageFlash, .common.is_unprivileged = true, .common.stored_sdk_platform = PROCESS_INFO_PLATFORM_BASALT, .sdk_version.major = PROCESS_INFO_FIRST_4_2_X_SDK_VERSION_MAJOR, .sdk_version.minor = PROCESS_INFO_FIRST_4_2_X_SDK_VERSION_MINOR,...
3(radius, 3.5); } void test_graphics_circle__grect_polar_calc_values_mode(void) { GPointPrecise center = {}; Fixed_S16_3 radius = {}; GRect r = GRect(0, 0, 144, 168); grect_polar_calc_values(&r, GOvalScaleModeFitCircle, &center, &radius); cl_assert_gpoint_precise(center, 144 / 2 - 0.5, 168 / 2 - 0.5); cl_...
(TRIGANGLE_TO_DEG(-TRIG_PI / 2), -90)
; cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_MAX_ANGLE / 2), 180); cl_assert_equal_i(TRIGANGLE_TO_DEG(-TRIG_MAX_ANGLE / 2), -180); cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_PI), 180); cl_assert_equal_i(TRIGANGLE_TO_DEG(-TRIG_PI), -180); cl_assert_equal_i(TRIGANGLE_TO_DEG(0), 0); }
if (ble_service_handle_event(hdr)) { goto handled; } switch (hdr->evt_code) { // GAP Events: case BLE_EVT_GAP_CONNECTED: handle_evt_gap_connected((ble_evt_gap_connected_t *) hdr); break; case BLE_EVT_GAP_DISCONNECTED: prv_handle_evt_gap_dis...
xTaskNotify(OS_GET_CURRENT_TASK(), BLE_APP_NOTIFY_MASK, eSetBits)
; } } } } void ble_task_init(const BTDriverConfig *config) { const BleTaskInitInfo init_info = { .semph = xSemaphoreCreateBinary(), .config = config, }; PBL_ASSERTN(init_info.semph); PBL_LOG(LOG_LEVEL_INFO, "Starting BLE Task..."); OS_TASK_CREATE("BT", prv_ble_peripheral_task, (void *)&...
d: %d", s_call_in_progress, s_mobile_app_is_connected); } } static void prv_handle_missed_call(PebblePhoneEvent *event) { if (s_call_in_progress) { prv_call_end_common(); phone_ui_handle_missed_call(); analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_INCOMING_COUNT, AnalyticsClient_System); } else { ...
{ prv_handle_call_end(true /* disconnected */); }
} T_STATIC void prv_handle_ancs_disconnected_event(PebbleEvent *e, void *context) { if (s_call_source == PhoneCallSource_ANCS) { prv_handle_call_end(true /* disconnected */); } } //! //! Phone Call API //! void phone_call_service_init() { static EventServiceInfo phone_event_info; phone_event_info = (Even...
} ///////////////////// // Peek Layer ///////////////////// static void prv_peek_anim_stopped(Animation *animation, bool finished, void *context) { NotificationWindowData *data = context; data->first_notif_loaded = true; peek_layer_destroy(data->peek_layer); data->peek_layer = NULL; TimelineItem *item = prv...
{ // reload everything, doesn't matter since it will be covered by the peek layer notification_window_focus_notification(id, false); // if the peek animation is already in progress, we've done all we need // data->peek_layer is only ever not null between the start and end of the peek // animation; it's clean...
e // sleeping static void prv_test_sleep_time_change(void *context) { bool passed = true; // Reset all stored data activity_test_reset(true /*reset_settings*/, true /*tracking_on*/, NULL, NULL); // Walk a little prv_feed_steps_min(15); // Get us into sleep mode time_t start_sleep_time = rtc_get_time();...
prv_count_sleep_sessions(test_start_utc, &sleep_count, &nap_count)
; PBL_LOG(LOG_LEVEL_DEBUG, "Found %d sleep sessions and %d nap sessions", sleep_count, nap_count); if (nap_count > 0 || sleep_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "FAILED: expected only sleep but got %d naps and %d sleep", nap_count, sleep_count); prv_test_end(context, false); return; } ...
ess 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 License. */ ...
(result, GPoint(4, 0))
; } void test_graphics_circle__grect_centered_from_polar(void) { GOvalScaleMode mode = GOvalScaleModeFillCircle; // Basic container rect with GPointZero origin const GRect container_rect1 = GRect(0, 0, 10, 10); const GRect resulting_rect1 = grect_centered_from_polar(container_rect1, mode, 0, GSize(3, 5)); c...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(hw_ver, no_support_hw_ver, strlen(no_support_hw_ver))
!= 0); #elif defined(BOARD_V1_5) // We fixed the issue for V3R2 (101-0-22-10-R3) const char* no_support_hw_ver = "V3R1"; return (memcmp(hw_ver, no_support_hw_ver, strlen(no_support_hw_ver)) != 0); #else return true; #endif } else { return false; } } static void prv_wait_until_buttons_are_relea...
3) #define BULKIO_CMD_DOMAIN_WRITE (4) #define BULKIO_CMD_DOMAIN_CRC (5) #define BULKIO_CMD_DOMAIN_STAT (6) #define BULKIO_CMD_DOMAIN_ERASE (7) #define BULKIO_RESP_DOMAIN_OPEN (128) #define BULKIO_RESP_DOMAIN_CLOSE (129) #define BULKIO_RESP_DOMAIN_READ (130) #define BULKIO_RESP_DOMAIN_WRITE (131) #define BULKIO_RESP_D...
(length, PULSE_MAX_SEND_SIZE - response_len)
dr < (s_user_start + s_user_size)) && (end >= s_user_start) && (end < (s_user_start + s_user_size))) { s_addr_result = UserSpaceBuffer_Valid; } else { s_addr_result = UserSpaceBuffer_Invalid; } } // Tests //////////////////////////////////// void test_cpu_cache__alignment(void) { cl_will_return(ic...
(dcache_is_enabled, false)
; cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_size, 1); s_invalidate_addr = s_flush_addr = 0xAA55; s_invalidate_size = s_flush_size = 0x55AA; cl_will_return(syscall_internal_check_return_address, true); s_user_start = 0x00; s_user_size = 0x20; memory_cache_flush((void*)0x20, 0x1)...
ount, AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_FLASH_WRITE_BYTES_COUNT, s_system_analytics_write_bytes_count, AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_FLASH_ERASE_COUNT, s_system_analytics_erase_count, AnalyticsClient_System); s_system_a...
mutex_unlock(s_flash_lock)
; } #if UNITTEST void flash_api_reset_for_test(void) { s_erase = (struct FlashEraseContext) {0}; s_flash_lock = NULL; } TimerID flash_api_get_erase_poll_timer_for_test(void) { return s_erase_poll_timer; } #endif //! Assumes that s_flash_lock is held. static void prv_erase_pause(void) { if (s_erase.in_progres...
eturn false; } if (!prv_is_alive()) { return false; } prv_config_charger(); prv_initialize_interrupts(); prv_update_rail_state(PmicRail_LDO2, true); // FW should bring this up #if BOARD_ROBERT_BB2 // On Robert BB2, the BLE chip is behind LDO3, which should always be on. prv_update_rail_state(Pm...
prv_mon_config_unlock()
; return result; } uint16_t pmic_get_vsys(void) { prv_mon_config_lock(); const PmicMonConfig *mon_config = &MON_CONFIG[PMIC_MON_CONFIG_VSYS_INDEX]; prv_set_mon_config(mon_config); ADCVoltageMonitorReading reading = battery_read_voltage_monitor(); uint32_t millivolts = battery_convert_reading_to_millivolt...
_t num_intervals; uint32_t average_ms; interval_timer_take_sample(&timer); fake_rtc_increment_time_ms(1000); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 1); cl_assert_equal_i(average_ms, 1000); // valid interval fake...
fake_rtc_increment_time_ms(1030)
; interval_timer_take_sample(&timer); } num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 16); // Close enough, rounding issues will prevent us from every actually hitting 1030 // = 1027 + (0.25 * (1030 - 1027)) // = 1027 + (0.25 * 3) // = 1027 cl_assert_equa...
GPoint(14, 14)
, 12); } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(14, 14), 12); } void clear_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_col...
/* * 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 (callbacks->selection_changed) { callbacks->selection_changed(callbacks, new_row, old_row); }
} static void prv_selection_will_change_callback(MenuLayer *menu_layer, MenuIndex *new_index, MenuIndex old_index, void *context) { SettingsData *data = context; const uint16_t old_row = old_index.row; SettingsCallbacks *callbacks = prv_get_current_callbacks(data...
PBL_ASSERTN(retries < 10)
; return 0; } static void prv_process_fifo_frame(const uint8_t *frame_buf, AccelDriverSample *data) { const int a_begin = 0; // index within the frame where accel data starts prv_convert_accel_raw_data_to_mgs(&frame_buf[a_begin], data); } static void prv_drain_fifo(void) { // we can't drain the fifo if we are...
d = i3, .type = TimelineItemTypeNotification, .status = 0, .ancs_uid = 0, .layout = LayoutIdGeneric, .timestamp = 0x53f0dda7, }, .attr_list = { .num_attributes = 1, .attributes = &attributes[2], }, .action_group = { .num_actions = 2, .actions = actio...
compare_notifications(&e2, &r)
; free(r.allocated_buffer); } void test_notification_storage__remove_add(void) { Uuid i1; uuid_generate(&i1); TimelineItem e1 = { .header = { .id = i1, .type = TimelineItemTypeNotification, .status = 0, .ancs_uid = 0, .layout = LayoutIdGeneric, .timestamp = 0x53f0dda5, ...
CT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 5, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r5_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix left corners PBL-15915 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RE...
(RECT_WIDTH, RECT_HEIGHT)
) / 2), GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax1_aa_clip_xy.${BIT_DEPTH_NAME}.pbi")); // Should draw same as rmax1 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, ((MIN(RECT_WIDTH, RE...
(s_ad_data, copied_uuids, 0)
; cl_assert_equal_i(found, 1); // Test ble_ad_get_tx_power_level returns false, when no TX Power Level: int8_t tx_power_level_out; cl_assert(!ble_ad_get_tx_power_level(s_ad_data, &tx_power_level_out)); } void test_ble_ad_parse__128_bit_uuid(void) { // AD Element, Length: 2, AD Type: Flags // AD Element, L...
mutex_unlock_recursive(s_log_state_mutex)
; } // Clear the re-entrancy flag for this task PebbleTask task = prv_get_current_task(); s_log_state_task_entered[task] = false; } // --------------------------------------------------------------------------------------------- EventServiceInfo* kernel_applib_get_event_service_state(void) { static EventSe...
zeof(buf) - off); cl_assert(rv == (sizeof(buf) - off)); rv = pfs_seek(fd, 0, FSeekSet); cl_assert(rv == 0); memset(buf, 0x00, sizeof(buf)); uint8_t bigbuf[11]; rv = pfs_write(fd, bigbuf, sizeof(bigbuf)); cl_assert(rv == E_RANGE); rv = pfs_read(fd, buf, sizeof(buf)); cl_assert(rv == sizeof(buf)); f...
cl_assert(fd >= 0)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
bt_driver_handle_le_connection_handle_update_address_and_irk(e)
.parent_id = {0}, .timestamp = 1421183642, // Tue Jan 13 13:14:02 2015 PST .duration = 2, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, }, .attr_list = { .num_attributes = 0, .attributes = NULL, }, .action_group = { ....
timeline_model_get_iter_state(0)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_create(layer_get_frame(window_layer))
; char *reason = get_launch_reason_str(); APP_LOG(APP_LOG_LEVEL_INFO, "Launch reason: %s", reason); text_layer_set_text(s_text_launch_reason, reason); layer_add_child(window_layer, text_layer_get_layer(s_text_launch_reason)); GRect frame = layer_get_frame(window_layer); frame.origin = GPoint(0, 50); s_te...
n, ANIMATION_DURATION_INFINITE); animation_set_elapsed(animation, 20); prv_play_animation_update(animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 300 - 20); } void test_kino_player__finite_animation_infinite_reel_reverse(void) { // Choose duration and elapsed to h...
animation_is_scheduled(animation)
, true); kino_player_pause(test_player); cl_assert_equal_i(animation_is_scheduled(animation), false); animation = (Animation *)kino_player_create_play_animation(test_player); cl_assert_equal_i(animation_is_scheduled(animation), false); animation_schedule(animation); // Rewind unschedules the current anima...
!= 0xFFFF) { PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Did not successfully erase the sector"); return FLASH_TEST_ERR_ERASE; } // Read and compare data that was written status = prv_write_read_verify_halfword(addr_region, data_buffer, data_buffer, true); if (status != 0) { PBL_LOG(LOG_LEVEL_D...
(test_addr, data_pattern, data_pattern, display_logs)
(int j = 0; j < BMA255_FIFO_FRAME_SIZE_BYTES; ++j) { buf[j] = bma255_send_and_receive_byte(0); } prv_convert_accel_raw_data_to_mgs(buf, &data[i]); } bma255_end_txn(); // Timestamp & Dispatch data for (int i = 0; i < num_samples_available; ++i) { // Make a timestamp approximation based on the...
MAX(odr_max, s_operating_states[i].odr)
; } } uint32_t sample_interval = 0; switch (odr_max) { case BMA255ODR_1HZ: sample_interval = BMA255SampleInterval_1HZ; break; case BMA255ODR_10HZ: sample_interval = BMA255SampleInterval_10HZ; break; case BMA255ODR_19HZ: sample_interval = BMA255SampleInterval_19HZ; ...
-8, 928, 16}, { -16, 952, 16}, { -32, 944, 56}, // 398 seconds { -16, 896, 64}, { -8, 920, 32}, { -8, 944, 24}, { -8, 920, 24}, { -32, 912, 64}, { -40, 920, 64}, { -16, 944, 24}, { -24, 968, 32}, { 0, 912, 48}, { -16, 904, 56}, { -8, 896, 24}, { -48, 944, 24}...
{ -16, 120, -936}, { -112, 440, -832}, { -160, 584, -712}, { -224, 784, -472}, { -280, 1224, -152}, { -440, 904, -336}, { -320, 536, -240}, { -336, 840, -8}, { -264, 960, -56}, { -256, 1112, -88}, { -208, 968, -64}, { -80, 920, -72}, { -56, 856, -16}, { -24, 1040,...
{ 48, 896, -40}, { 40, 936, -72}, { 64, 960, -64}, { 56, 904, -24}, { 48, 912, -24}, { 24, 912, -32}, { 32, 920, -88}, { 40, 952, -64}, { 24, 936, -32}, { 56, 912, -8}, { 80, 912, -48}, { 64, 912, -56}, { 24, 928, -32}, { 16, 928, -16}, { 56, 944, -40}, {...
f, "\n 01:00:00 PM"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%02R %06t %04T", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "13:00 \t 13:00:00"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%5u %3V", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "00005 001"); tmbuf[0] = '\0'; s...
(tmbuf, sizeof(tmbuf), "%a %A %b %B", &jan_2_2015__13_00_00, NULL)
; cl_assert_equal_s(tmbuf, "Fri Friday Jan January"); tmbuf[0] = '\0'; localized_strftime(tmbuf, sizeof(tmbuf), "%c", &jan_2_2015__13_00_00, NULL); cl_assert_equal_s(tmbuf, "Fri Jan 2 13:00:00 2015"); tmbuf[0] = '\0'; localized_strftime(tmbuf, sizeof(tmbuf), "%a %A %b %B", &jan_2_2015__13_00_00, i18n_get_l...
pp_state/app_state.h" #include "rocky_api_errors.h" #include "rocky_api_global.h" #include "rocky_api_graphics_color.h" #define ROCKY_EVENT_DRAW "draw" #define ROCKY_EVENT_DRAW_CONTEXT "context" #define ROCKY_REQUESTDRAW "requestDraw" #define ROCKY_CONTEXT2D_CONSTRUCTOR "CanvasRenderingContext2D" #define ROCKY_CONTEXT...
(rect->origin.x)
; const int16_t y = Fixed_S16_3_rounded_int(rect->origin.y); const int16_t w = Fixed_S16_3_rounded_int(grect_precise_get_max_x(rect)) - x; const int16_t h = Fixed_S16_3_rounded_int(grect_precise_get_max_y(rect)) - y; return GRect(x, y, w, h); } static jerry_value_t prv_rect_call(const jerry_length_t argc, con...
_context(void) { return &s_ctx; } void test_health_detail_card__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; ...
PBL_IF_COLOR_ELSE(GColorYellow, GColorBlack)
, }, .bg_color = BG_COLOR, .daily_avg = 900, .weekly_max = 1300, .num_zones = ARRAY_LENGTH(s_zones), .zones = s_zones, }; HealthDetailCard *card = (HealthDetailCard *)prv_create_card_and_render(&config); #if PBL_ROUND menu_layer_set_selected_index(&card->menu_layer, MenuIndex(0, 3), Menu...
l_sleep_end_12h = typical_sleep_end_24h % TWELVE_HOURS; const int typical_start = (typical_sleep_start_12h * HEALTH_PROGRESS_BAR_MAX_VALUE / TWELVE_HOURS); const int typical_end = (typical_sleep_end_12h * HEALTH_PROGRESS_BAR_MAX_VALUE / TWELVE_HOURS); #if PBL_COLOR const bool fell_asleep_l...
health_util_format_hours_and_minutes(sleep_text, sizeof(sleep_text), typical_sleep, base_layer)
; } else { snprintf(sleep_text, sizeof(sleep_text), EM_DASH); } health_ui_render_typical_text_box(ctx, base_layer, sleep_text); } static void prv_render_no_sleep_data_text(GContext *ctx, Layer *base_layer) { HealthSleepSummaryCardData *data = layer_get_data(base_layer); const int y = PBL_IF_RECT_ELSE(9...
/* * 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_connection; }
GAPLEConnection *gap_le_connection_by_gatt_id(unsigned int connection_id) { return &s_connection; } bool gap_le_connection_is_valid(const GAPLEConnection *conn) { return true; } GAPLEConnection *gap_le_connection_any(void) { return NULL; } uint16_t gaps_get_starting_att_handle(void) { return 4; } GAPLECon...
ult; } for (unsigned int i = 0; i < tuplets_count; ++i) { if ((result = dict_write_tuplet(iter, &tuplets[i])) != DICT_OK) { return result; } } *size_in_out = dict_write_end(iter); return DICT_OK; } // Legacy version to prevent previous app breakage, __deprecated preserves order DictionaryResult...
(orig_iter)
) { uint32_t key = orig->key; Tuple* new = dict_find(new_iter, key); if (new != NULL) { // We already wrote this key, above. continue; } Tuple* dest = dest_iter->cursor; result = dict_write_tuple(dest_iter, orig); if (result != DICT_OK) return result; update_key_callback(key,...
(&s_data.window, &s_ctx)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); #endif } void test_kickstart__render_hr_bpm_obstructed_24h(void) { #if (PLATFORM_SILK || PLATFORM_ROBERT) s_clock_is_24h_style = true; prv_set_data(&s_data, 10323, 7500, 13000, 82); prv_set_unobstructed_area_height(TIMELINE_PEEK_HEIGHT); window_...
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM...
(new_dialog, string)
; Window *window = &new_dialog->window; window_set_window_handlers(window, &(WindowHandlers) { .load = prv_dialog_load, .unload = prv_dialog_unload, .appear = prv_dialog_appear, }); window_set_user_data(window, new_dialog); dialog_push(new_dialog, stack); } #endif static char s_text_test_str[102...
me(&nov_7)); } void test_clock__today(void) { struct tm may_30 = { .tm_sec = 0, .tm_min = 59, .tm_hour = 7, .tm_mday = 30, .tm_mon = 4, // May .tm_year = 2016 - 1900, .tm_isdst = 1, .tm_gmtoff = -5 * SECONDS_PER_HOUR, }; struct tm may_31 = { .tm_sec = 0, .tm_min = 0, ...
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
qual_i(s_num_requested_notif_attributes, 8 + 4); cl_assert_equal_i(s_num_ds_notifications_received, 12 + 1 + 2 + 1 + 2); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 4 + 4 + 4); // Send a "corrupted" notification. prv_send_notification((uint8_t *)&s_invalid_attribute_length)...
(s_num_requested_app_attributes, 1)
; cl_assert_equal_i(s_num_ds_notifications_received, 2); } void test_ancs__ancs_invalid_param(void) { NSNotification ns_notification = { .event_id = EventIDNotificationAdded, .event_flags = 0, .category_id = CategoryIDSocial, .category_count = 1, .uid = 0, }; const uint32_t comple_dict_...
ng. static PebbleRecursiveMutex *s_mic_mutex; static struct Subscriber { MicDataHandlerCB callback; int16_t *buffer; void *context; size_t size; size_t idx; } s_subscriber; static bool prv_dma_handler(DMARequest *request, void *context, bool is_complete); //! Initialize power management for the microphone....
dma_request_init(MIC_I2S_RX_DMA)
; prv_i2s_gpio_init(); prv_mic_power_init(); s_mic_mutex = mutex_create_recursive(); s_initialized = true; } void mic_set_volume(MicDevice *this, uint16_t volume) { s_volume = volume; } bool mic_start(MicDevice *mic, MicDataHandlerCB data_handler, void *context, int16_t *audio_buffer, size...
/* * 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_line(ctx, GPoint(5, 35), GPoint(45, 40))
; } void white_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorWhite); graphics_context_set_stroke_width(ctx, 10); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(5, 35), GPoint(45, 40)); } void clear_layer_update_callback(Layer* me, ...
e "timeline_layout.h" #include "applib/fonts/fonts.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/text.h" #include "applib/ui/ui.h" #include "drivers/rtc.h" #include "font_resource_keys.auto.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/kernel_ui.h" #include "process_state/app_state/app_state...
PBL_IF_RECT_ELSE(&s_title_config.text.extent.node, &s_icon_config.node)
, PBL_IF_RECT_ELSE(&s_time_config.text.extent.node, &s_title_config.text.extent.node), PBL_IF_RECT_ELSE(&s_icon_config.node, &s_time_config.text.extent.node), &s_subtitle_config.text.extent.node, }; static const LayoutNodeVerticalConfig s_vertical_config = { .container.extent.node.type = LayoutNodeT...
setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NEG_H, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_neg_h", fb, ...
(&ctx, GColorBlue)
; graphics_draw_text(&ctx, "blue100", &s_font_info, GRect(10, 10, 100, 30), GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); ctx.draw_state.text_color.a = 2; graphics_draw_text(&ctx, "blue66", &s_font_info, GRect(10, 40, 100, 30), GTextOverflowModeTrailingEll...
pass = false; } } prv_run_command(BMI160_CMD_SOFTRESET); psleep(50); bmi160_enable_spi_mode(); return pass; } bool gyro_run_selftest(void) { prv_update_accel_interrupts(false); prv_run_command(BMI160_CMD_SOFTRESET); psleep(50); bmi160_enable_spi_mode(); bmi160_set_gyro_power_mode(BMI1...
if (BMI160SampleRate_800_HZ <= interval_us) { sample_rate = BMI160SampleRate_800_HZ; } else { // any interval < min supported must saturate to 1600Hz sample_rate = BMI160SampleRate_1600_HZ; }
return sample_rate; } static void prv_configure_operating_mode(void) { BMI160SampleRate interval_us = prv_get_min_sampling_interval_us(); uint8_t acc_odr = (uint8_t)prv_get_odr(interval_us); // should be able to write the sample range at any time prv_read_modify_write(BMI160_REG_ACC_CONF, acc_odr, BM...
{ if (*timeout_ms > 0) { s_backlight_timeout_ms = *timeout_ms; return true; } s_backlight_timeout_ms = DEFAULT_BACKLIGHT_TIMEOUT_MS; return false; }
static uint16_t prv_convert_backlight_percent_to_intensity(uint32_t percent_intensity); static bool prv_set_s_backlight_intensity(uint16_t *intensity) { if (*intensity > BACKLIGHT_BRIGHTNESS_OFF) { s_backlight_intensity = *intensity; return true; } s_backlight_intensity = prv_convert_backlight_perc...
internal.h" #include "session_transport.h" #include "applib/app_comm.h" #include "comm/ble/kernel_le_client/app_launch/app_launch.h" #include "comm/bt_lock.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/comm_session/protocol.h" #include "services/common/comm_session/se...
comm_session_is_valid(session)
sniprintf(addr_mac_str_out, BT_DEVICE_ADDRESS_FMT_BUFFER_SIZE, BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(s_local_address))
; } T_STATIC void prv_generate_address(BTDeviceAddress *addr_out) { const char *serial = mfg_get_serial_number(); const uint32_t full_len = strlen(serial); const uint32_t half_len = (full_len / 2); // Hash of the normal serial const uint32_t serial_hash = hash((uint8_t *)serial, full_len); // Hash of the...
y = false; i2c_buses[i].transfer.idx = 0; i2c_buses[i].transfer.size = 0; i2c_buses[i].transfer.data = NULL; i2c_buses[i].transfer.state = TRANSFER_STATE_INVALID; NVIC_InitTypeDef NVIC_InitStructure; NVIC_InitStructure.NVIC_IRQChannel = BOARD_CONFIG.i2c_bus_configs[i].ev_irq_channel; NVIC_I...
if (bus->user_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted access to disabled bus %d by device %d", bus_idx, device_id); bus_unlock(bus); return false; }
(elapsed_ms, -1 * (delay_seq))
; animation_get_elapsed(a, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a)); animation_get_elapsed(b, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a + duration_a + delay_b)); // Start prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_...
nt over put_bytes", s_fetch_state.total_size); // signify in the app cache that the app binaries are now loaded status_t added = app_cache_add_entry(s_fetch_state.app_id, s_fetch_state.total_size); if (added == S_SUCCESS) { const PebbleProcessMd *md = app_install_get_md(s_fetch_state.app_id, ...
(LOG_LEVEL_WARNING, "Error: No data on phone")
; prv_cleanup(AppFetchResultNoData); break; } } ///////////////////////// // Exported App Fetch API ///////////////////////// //! Called by the system that triggers an app fetch install request void app_fetch_binaries(const Uuid *uuid, AppInstallId app_id, bool has_worker) { if (s_fetch_state.in_progr...
USTOM_REEL_CANARY = 0xbaebaef8; typedef struct { KinoReel base; uint32_t canary; const KinoReelImpl *impl; void *data; } KinoReelImplCustom; static void prv_destructor(KinoReel *reel) { KinoReelImplCustom *custom_reel = (KinoReelImplCustom *)reel; if (custom_reel->impl->destructor) { custom_reel->impl...
prv_kino_reel_custom_is_custom(reel)
) { return NULL; } KinoReelImplCustom *custom_reel = (KinoReelImplCustom *)reel; return custom_reel->data; }
ectWatchApp, EXPECTED_COOKIE); assert_ack_count(1); assert_nack_count(0); cl_assert_equal_i(EXPECTED_COOKIE, put_bytes_get_index()); } void test_put_bytes__init_file_okay_while_not_in_fw_update_mode(void) { s_firmware_update_is_in_progress = false; const char fn[] = "test.txt"; prv_receive_init_file(VALID...
assert_ack_count(1)
; } else { assert_ack_count(0); } assert_nack_count(1); } void test_put_bytes__chunk_written_to_storage_and_progress_event_put(void) { prv_receive_init_fw_object(); prv_process_and_reset_test_counters(); const uint8_t chunk[] = { 0xaa, 0xbb, 0xcc }; prv_receive_put(s_last_response_cookie, chunk, siz...
/* * 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...
memset(&s_service_discovery_ctx, 0, sizeof(struct FakeGATTServiceDiscoveryContext))
; s_stack_id = 0; s_connection_callback_param = 0; s_connection_event_callback = NULL; s_start_count = 0; s_stop_count = 0; s_start_ret_val = 0; s_stop_ret_val = 0; s_service_changed_indication_count = 0; } int GATT_Service_Changed_CCCD_Read_Response(unsigned int BluetoothStackID, ...
itr_data->cb_data); } return true; } void bt_persistent_storage_for_each_bt_classic_pairing(BtPersistBondingDBEachBTClassic cb, void *context) { ForEachBTCPairingData itr_data = { .cb = cb, .cb_data = context, }; prv_file_each(bt_pe...
prv_file_set(&AIRPLANE_MODE_KEY, sizeof(AIRPLANE_MODE_KEY), &new_state, sizeof(bool))
; } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Remote Device Info static void prv_load_cached_system_capabilities(PebbleProtocolCapabilities *capabilities_out) { if (!capabilities_out) { return; } const int read_size = prv_file_get(&SYSTEM_CAPABI...
acy2_scheduler->head); list_remove(&animation->list_node, &animation_legacy2_scheduler->head, NULL); // Reschedule the timer if we're removing the head animation: if (was_old_head && animation_legacy2_scheduler->head != NULL) { animation_legacy2_reschedule_timer(animation_legacy2_scheduler, 0); } // Reset...
if (animation->curve >= AnimationCurveCustomFunction) { distance_normalized = prv_custom_curve_ptr_unpack( animation->custom_curve_function)(time_normalized); } else { distance_normalized = animation_timing_curve(time_normalized, animation->curve); }
animation->implementation->update(animation, distance_normalized); const bool completed = (time_normalized == ANIMATION_NORMALIZED_MAX); if (completed) { if (animation->duration_ms != ANIMATION_DURATION_INFINITE) { // Leave the animation on the list for now, we'll unschedule it the...
extern uint16_t prv_scroll_layer_get_paging_height(ScrollLayer *scroll_layer); // Setup //////////////////////////////////// void test_scroll_layer__initialize(void) {} void test_scroll_layer__cleanup(void) {} // Tests //////////////////////////////////// void test_scroll_layer__enable_paging(void) { GRect scroll...
(scroll_layer, true)
; cl_assert_equal_i(page_height, prv_scroll_layer_get_paging_height(scroll_layer)); int pages = 2; int offset = 0; // setup content size to be slightly more than 2 pages GSize content_size = GSize(180, page_height * pages + 10); scroll_layer_set_content_size(scroll_layer, content_size); // paging should...
e9, 0xe9, 0xea, 0xec, 0xed, 0xed, 0xee, 0xf4, 0xf5, 0xf5, 0xf6, 0xf4, 0xf5, 0xf5, 0xf6, 0xf8, 0xf9, 0xf9, 0xfa, 0xfc, 0xfd, 0xfd, 0xfe, 0xd4, 0xd5, 0xd6, 0xd6, 0xd4, 0xd5, 0xd6, 0xd6, 0xd8, 0xd9, 0xda, 0xda, 0xdc, 0xdd, 0xde, 0xde, 0xe4, 0xe5, 0xe6, 0xe6, 0xe4, 0xe5, 0xe6, 0xe6, 0xe8, 0xe9, 0xea, 0xea, 0xec, 0xed...
PBL_ASSERTN(lookup_table_out)
; // Inverting the tint color this way inverts the alpha channel too, but we set the alpha of all // colors in the lookup table to the original tint color's alpha in the loop below const GColor8 inverted_tint_color = (GColor8) { .argb = ~tint_color.argb }; for (GColor8Component luminance_index = 0; luminance_...
/* * 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_hex(address)