prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
pTotalSeconds: *value_out = data.typical_sleep_duration; break; case ActivityMetricSleepRestfulSeconds: *value_out = data.typical_deep_sleep_duration; break; case ActivityMetricSleepEnterAtSeconds: *value_out = data.typical_fall_asleep_time; break; case ActivityMetricSlee...
PBL_HEXDUMP(LOG_LEVEL_DEBUG, key, key_len)
; PBL_LOG(LOG_LEVEL_DEBUG, "val: "); PBL_HEXDUMP(LOG_LEVEL_DEBUG, val, val_len); #endif // Only store typicals / averages in this settings file. "Current" values are stored in the // activity settings file. // Sleep data contains a mix of current and typical values. The current values are just stored // fo...
----------------------------------------------------------- void accel_data_service_unsubscribe(void) { AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown); accel_session_data_unsubscribe(session); } // -------------------------------------------------------------------------------...
kernel_free(session)
; } void accel_session_delete(AccelServiceState * session) { prv_assert_session_task(); // we better have unsubscribed at this point PBL_ASSERTN(session->manager_state == NULL); // A deferred free means one lingering event was posted. We will free the session once the event // gets drained in 'prv_do_data_...
ration_secs = 1; job = gap_le_advert_schedule(NULL, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert_equal_p(job, NULL); free(ad); free(ad_scannable); } void test_gap_le_a...
gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, GAPLEAdvertisingJobTagReconnection)
; GAPLEAdvertisingJobRef job_c; job_c = gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, GAPLEAdvertisingJobTagReconnection); // run some Ad cycling for (int i = 0; i < 3; i++) { regul...
5, 457, -110}, { -955, 463, -115}, { -914, 431, -86}, { -1064, 447, -36}, { -1068, 509, -51}, { -999, 499, 27}, { -961, 451, 18}, { -752, 419, -8}, { -857, 444, 25}, { -909, 409, 75}, { -885, 376, 99}, { -835, 344, 123}, { -760, 307, 120}, { -767, 296, 143}, { -76...
if (minute_idx != samples_remaining / (60 * SAMPLES_PER_SECOND)) { activity_test_run_minute_callback(); minute_idx = samples_remaining / (60 * SAMPLES_PER_SECOND); prv_clear_event_queue(); }
} } // ------------------------------------------------------------------------------- // Feed in N minutes of light sleep static void prv_feed_light_sleep_min(uint32_t minutes) { // Light sleep produces minute statistics with step:0, variance:17-22, with // one minute of high variance (511) every 3-10 minutes....
; } void system_task_add_callback(void (*callback)(void *data), void *data) { callback(data); } void process_manager_send_callback_event_to_process(PebbleTask task, void (*callback)(void *data), void *data) { callback(data); } void accessory_imaging_enable(bool...
prv_release_button(BUTTON_ID_UP)
; prv_press_button(BUTTON_ID_UP); StubTimer *timer = prv_find_combo_timer(); cl_assert(timer); cl_assert_equal_i(stub_new_timer_timeout(timer->id), 5000); stub_new_timer_fire(timer->id); cl_assert(s_mfg_mode_entered); cl_assert(!s_factory_reset_called); }
nfo->handler; } void event_service_client_unsubscribe(EventServiceInfo *info) { cl_assert(info->type == PEBBLE_SMARTSTRAP_EVENT); s_event_handler = NULL; } bool process_manager_send_event_to_process(PebbleTask task, PebbleEvent *e) { cl_assert(task == PebbleTask_App); cl_assert(e->type == PEBBLE_SMARTSTRAP_EV...
assert_result_invalid(app_smartstrap_attribute_end_write(attr, 100, false))
vail); } if (PFS_FD(fd).fd_status == FD_STATUS_UNREFERENCED) { if ((unref == -1) || (PFS_FD(fd).time_closed < curr_time_closed)) { unref = fd; curr_time_closed = PFS_FD(fd).time_closed; } } } *fdp = unref; if (unref != -1) { mark_fd_free(unref); // clean up previous fi...
get_next_page(file->curr_page, &file->curr_page)
!= S_SUCCESS) { PBL_LOG(LOG_LEVEL_WARNING, "W:Couldn't find next page for %d", file->curr_page); res = E_INTERNAL; goto cleanup; } } res = bytes_written; cleanup: mutex_unlock_recursive(s_pfs_mutex); return (res); } uint32_t pfs_get_size(void) { // one sector is needed for i...
ted_timer_register(show_progress_timeout_ms, false, prv_show_progress_window, data); } static void prv_set_action_result(TimelineActionMenu *timeline_action_menu, ...
(pin, action, NULL)
; break; } return data; } // invoke actions that are immediately handled locally static void prv_invoke_local_action(const TimelineItemAction *action, const TimelineItem *pin) { timeline_invoke_action(pin, action, NULL); } static void prv_do_action_analytics(const TimelineItem *pin, const ActionMenuItem ...
/* * 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 (status == E_DOES_NOT_EXIST) { // item was removed blob_db_sync_next(session); } else { // something went terribly wrong PBL_LOG(LOG_LEVEL_ERROR, "Failed to read blob DB during sync. Error code: 0x%"PRIx32, status); blob_db_sync_cancel(session); }
// only one writeback in flight at a time session->state = BlobDBSyncSessionStateWaitingForAck; if (session->session_type == BlobDBSyncSessionTypeDB) { session->current_token = blob_db_endpoint_send_writeback(session->db_id, dirty_item->last_upd...
a bonding. Pebble will not try to collate these, // because there are many addresses that resolve to the same bonding. The current implementation // uses one address or one bonding per intent. BTErrno e; bool registered; BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk(); BTBondingID ...
prv_assert_client_event(&device, true /* connected */, (1 << PebbleTask_App), HCI_ERROR_CODE_SUCCESS)
; // Disconnect & verify the client task gets the event: prv_fake_disconnect(&device, true /* is_master */); prv_assert_client_event(&device, false /* connected */, (1 << PebbleTask_App), HCI_ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST); } void test_gap_le_connect__connection_event_...
680}, { 336, 304, -840}, { 312, 472, -712}, { 336, 360, -744}, { 416, 400, -784}, { 464, 416, -824}, { 456, 328, -776}, { 464, 264, -928}, { 472, 224, -840}, { 400, 304, -752}, { 416, 200, -704}, { 336, 392, -744}, { 272, 416, -688}, { 112, 744, -904}, { 112, 344,...
{ 344, 456, -800}, { 296, 408, -864}, // 307 seconds { 312, 416, -824}, { 360, 384, -800}, { 336, 352, -832}, { 328, 392, -776}, { 328, 336, -800}, { 336, 384, -856}, { 320, 392, -824}, { 320, 392, -824}, { 320, 376, -824}, { 328, 392, -832}, { 296, 376, -816}, ...
{ 336, 352, -832}, { 344, 336, -832}, { 344, 344, -824}, { 336, 368, -832}, { 336, 344, -832}, { 344, 336, -832}, { 344, 344, -840}, { 336, 352, -824}, { 344, 352, -840}, { 344, 344, -824}, // 310 seconds { 352, 360, -840}, { 336, 344, -848}, { 336, 352, -832}, ...
sBarLayer *status_layer = &data->status_layer; status_bar_layer_init(status_layer); const char *title = settings_menu_get_status_name(data->current_category); status_bar_layer_set_title(status_layer, i18n_get(title, data), false, false); status_bar_layer_set_colors(status_layer, GColorWhite, GColorBlack); sta...
app_state_get_user_data()
{ 1064, 280, 96}, { 1176, 136, 216}, { 936, 160, 224}, { 808, 176, 160}, { 728, 80, 152}, { 696, 80, 96}, { 688, 48, 96}, { 728, 16, 88}, { 912, -24, 48}, { 1056, 64, -16}, { 1376, -144, 216}, { 1896, 0, 360}, { 1304, 560, -208}, { 960, 496, -216}, { 896, 192, ...
{ 1144, 640, -376}, { 696, 200, 56}, { 888, 0, 176}, { 712, 120, 136}, { 752, 168, 200}, { 792, 352, 112}, { 768, 376, 96}, { 848, 352, 0}, { 936, 280, -56}, { 1192, 352, -184}, { 1280, 328, -96}, { 1832, 264, -8}, { 1472, 344, 56}, { 800, 416, -8}, { 1064, 31...
{ 896, 96, 144}, // 33 seconds { 768, 56, 96}, { 744, 96, 8}, { 688, 0, 16}, { 736, -32, 48}, { 952, -80, -8}, { 984, 32, -72}, { 1128, -144, 16}, { 1496, -176, 248}, { 1368, 256, -80}, { 1200, 448, -224}, { 936, 392, -224}, { 728, -96, 48}, { 704, 152, 24}, ...
---------------------------------------------------- // Init the sample discovery iterator static bool prv_sample_discovery_init(SampleDiscoveryState *state, SampleFileType samples_type, const char *test_files_path) { // Free prior one if (state->dp) { if (state->file) { ...
{ // No more in this file fclose(state->common.file); state->common.file = NULL; }
} } // -------------------------------------------------------------------------------------- // Callback provided to the qsort() routine for sorting step tests by name int prv_qsort_step_test_entry_cb(const void *a, const void *b) { StepFileTestEntry *entry_a = (StepFileTestEntry *)a; StepFileTestEntry *entry...
/* * 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...
memchr(testbuf, 0x78, 8)
ec*/, 0 /*hr*/, HRMQuality_Good, true /*force_continuous*/); activity_metrics_prv_get_median_hr_bpm(&median, &total_weight); cl_assert_equal_i(median, 0); cl_assert_equal_i(total_weight, 0); // Our previous median should be since we have no data (valid data) activity_get_metric(ActivityMetricHeartRateFiltere...
(s_last_hr_event.data.heart_rate_update.current_bpm, 120)
; cl_assert_equal_i(s_last_hr_event.data.heart_rate_update.quality, HRMQuality_Excellent); // Should not fire off an event. Bad HR reading prv_advance_time_hr(1 /*sec*/, 20 /*hr*/, HRMQuality_Excellent, true /*force_continuous*/); cl_assert_equal_i(s_num_hr_events, 4); } // -----------------------------------...
no Rocky.js APIs that need to be called while in privileged mode, so run // in unprivileged mode for the built-in Rocky.js apps (Tictoc) as well: const bool is_rocky_app = s_app_task_context.app_md->is_rocky_app; if (is_unprivileged || is_rocky_app) { mcu_state_set_thread_privilege(false); } const Pebb...
(PebbleTask_KernelMain)
O_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 5); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw5_cl...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 4); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, fal...
uint8_t hci_reason) { if (!intent->client[c].is_used) { // No intent that is owned by the given client return BTErrnoInvalidParameter; } // Only send disconnection event if a connection event has been sent to the // client in the past: const bool is_connected_virtual ...
prv_unregister_intent(intent, client, true /* should_send_disconnection_event */, GAPLEConnectHCIReasonExtensionCancelConnect)
; } bt_unlock(); return ret_value; } // ------------------------------------------------------------------------------------------------- BTErrno gap_le_connect_connect_by_bonding(BTBondingID bonding_id, bool auto_reconnect, bool is_pairing_required, GAPLEClient client)...
esponse("FAILURE: buffer_dma != buffer_pol"); success = false; } if (memcmp(buffer_dma, buffer_mmap, size) != 0) { prompt_send_response("FAILURE: buffer_dma != buffer_mmap"); success = false; } const int buf_size = 64; char buf[buf_size]; prompt_send_response_fmt(buf, buf_size, "Size: %d DMA: %...
qspi_flash_blank_check(QSPI_FLASH, FLASH_REGION_FIRMWARE_SCRATCH_BEGIN, SUBSECTOR_SIZE_BYTES)
; qspi_release(QSPI); profiler_stop(); uint32_t blank = profiler_get_total_duration(true); prompt_send_response_fmt(buf, buf_size, "Sector blank check via read took: %"PRIu32, blank); if (is_blank != S_TRUE) { ++failures; prompt_send_response("FAILURE: sector not blank!?!"); } else { ++passes; ...
= CRON_HOUR_ANY, .mday = CRON_MDAY_ANY, .month = CRON_MONTH_ANY, .may_be_instant = true, .clock_change_tolerance = 0, }; CronJob *job = &test_cron; time_t base = s_2015_nov12_123456_gmt; prv_set_rtc(base, &s_timezone_gmt); // 2015 Nov 12, 12:35:00 int32_t target = 1447331700; cron_clear...
for (int i = 0; i < 4; i++) { CronJob *job = &test_cron[4 - i - 1]; cron_job_schedule(job); cl_assert_equal_i((uintptr_t)job->cb_data, 0); cl_assert_equal_i(job->cached_execute_time, timestamps[4 - i - 1]); cl_assert_equal_i(cron_service_get_job_count(), i+1); }
time_t left = s_2015_nov12_123456_gmt; for (int i = 0; i < 4; i++) { fake_rtc_increment_time(timestamps[i] - left); left = timestamps[i]; cron_service_wakeup(); cl_assert_equal_i(cron_service_get_job_count(), 4 - i - 1); for (int l = 0; l < 4; l++) { cl_assert_equal_i((uintptr_t)test_cro...
interpolate_function); } // ------------------------------------------------------------------------------------------- static void *prv_animation_get_custom_function(Animation *animation_h, AnimationCurve curve) { if (animation_private_using_legacy_2(NULL)) { if (curve != Animatio...
prv_is_mutable(state, animation)
) { return false; } if (play_count == ANIMATION_PLAY_COUNT_INFINITE) { animation->play_count = ANIMATION_PLAY_COUNT_INFINITE_STORED; } else if (play_count > ANIMATION_PLAY_COUNT_INFINITE_STORED) { // We can't support play counts greater than ANIMATION_PLAY_COUNT_INFINITE_STORED return false; } ...
ect_offset_r4_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // AA = true, SW = 3 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 3); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREE...
(&ctx, fb)
; // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 1 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 1); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "dra...
prv_draw_indicator_round(GContext *ctx, const ActionMenuLayer *aml, const GRect *label_text_container) { const int indicator_height = fonts_get_font_height(aml->layout_cache.font); const int text_height = aml->layout_cache.item_heights[aml->selected_index]; const int content_h...
grect_get_max_y(&label_text_container)
- (fade_height + VERTICAL_PADDING); graphics_draw_bitmap_in_rect(ctx, &aml->item_animation.fade_bottom, &bottom_bounds); } #endif } static void prv_draw_row(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *callback_context) { ActionMenu...
/* * 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 (exti_line <= 4) { return EXTI0_IRQn + exti_line; }
if (exti_line <= 9) { return EXTI9_5_IRQn; } if (exti_line <= 15) { return EXTI15_10_IRQn; } if (exti_line == ExtiLineOther_RTCAlarm) { return RTC_Alarm_IRQn; } if (exti_line == ExtiLineOther_RTCWakeup) { return RTC_WKUP_IRQn; } WTF; } static void prv_configure_nvic_channel(IRQn_Type...
fer(const jerry_value_t object, jerry_char_t *buffer_p, jerry_size_t buffer_size) { jerry_value_t str_ref = (jerry_value_t)EM_ASM_INT({ var str = __jerryRefs.ref(String(__jerryRefs.get($0))); return...
{ return __jerryRefs.ref(new Object(__jerryRefs.get($0))); }
, value); } jerry_value_t jerry_value_to_primitive(const jerry_value_t value) { if (jerry_value_has_error_flag(value)) { return TYPE_ERROR_FLAG; } return (jerry_value_t)EM_ASM_INT({ var val = __jerryRefs.get($0); var rv; if ((typeof val === 'object' && val != null) || (typeof val ...
return ActionResultTypeFailure; } } static PebbleSysNotificationActionResult *prv_action_result_create_from_serial_data( ResponseHeader *header, uint8_t num_attributes, uint8_t num_actions, const uint8_t *data, size_t size) { size_t string_alloc_size; uint8_t attributes_per_action[num_actions]; ...
PBL_LOG(LOG_LEVEL_WARNING, "Invalid command id")
; return; } if (uuid_is_system(&header->item_id)) { PBL_LOG(LOG_LEVEL_DEBUG, "Automatic SMS msg response: 0x%02X", header->response); return; } PBL_LOG(LOG_LEVEL_DEBUG, "Action Endpoint Response: 0x%02X", header->response); PebbleSysNotificationActionResult *action_result = NULL; PBL_HEXDUMP...
ges; static uint16_t s_hrm_manager_expire_s; HRMSessionRef hrm_manager_subscribe_with_callback(AppInstallId app_id, uint32_t update_interval_s, uint16_t expire_s, HRMFeature features, HRMSubscriberCallback callback, void *context) { s_h...
if (s_num_dls_activity_records >= 100) { cl_assert(false); }
cl_assert(s_num_dls_activity_records < ARRAY_LENGTH(s_dls_activity_records)); s_dls_activity_records[s_num_dls_activity_records++] = records[i]; } } else { return DATA_LOGGING_INVALID_PARAMS; } return DATA_LOGGING_SUCCESS; } DataLoggingSession *dls_create(uint32_t tag, DataLoggingItemType ...
version(); cl_assert_equal_s(written_hw_version3, hw_version); // Write fourth time const char* written_hw_version4 = "VWXYZ12"; command_hwver_write(written_hw_version4); hw_version = mfg_get_hw_version(); cl_assert_equal_s(written_hw_version4, hw_version); // Write fifth time const char* written_hw_v...
mfg_get_serial_number()
/* * 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_mbuf_pool_space) == NumMBufPools, "s_mbuf_pool_space array does not match MBufPool enum")
; // Init //////////////////////////////////////////////////////////////////////////////// void mbuf_init(void) { s_free_list_lock = mutex_create(); } // Allocation / free list management //////////////////////////////////////////////////////////////////////////////// //! Bug-catcher checks that nobody has corr...
ck(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorClear); graphics_context_set_antialiased(ctx, false); graphics_draw_round_rect(ctx, &GRect(2, 2, 28, 20), 4); } void across_x_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); grap...
layer_init(&layer, &GRect(0, 0, 32, 24))
; layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(fra...
tion); // Set for Connection connection_set_gateway(connection, is_gateway); // Set for `device_t` storage_acquire(); device_t *dev = find_device_by_conn_idx(conn_idx); if (dev) { dev->is_gateway = is_gateway; } storage_release(); BTDeviceInternal device; connection_get_address(connection, &d...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Trigger pairing! should_pin_address=%d, no_slave_security_request=%d, auto_acc=%d " "rev_ppogatt=%d", req->should_pin_address, req->no_slave_security_request, req->should_auto_accept_re_pairing, req->is_reversed_ppogatt_enabled); gap_sec_...
static uint8_t prv_handle_handle_cccd_read(uint16_t handle, uint16_t conn_idx, uint8_t response_buffer[READ_RESPONSE_BUFFER_SIZE]) { Connection *connection = connection_by_idx_check(conn_idx); bool notifications_enabled = false; if (handle == s_pps_ctx.att_hdl.conn_sta...
cl_assert_equal_i(to, 1)
; // Make sure a copy with a negative size is a no-op. to = 0; pbl_memcpy(&to, &from, -sizeof(from)); cl_assert_equal_i(to, 0); } void test_pbl_std__verify_difftime_double_conversion(void) { // Can only test positive diffs because of 64 bit vs 32 bit time_t cl_assert_equal_i(pbl_override_difftime(30, 10),...
on_cell_round(ctx, cell_layer, &frame, font, title, NULL, NULL, NULL); } static void prv_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *data) { NotificationsData *notifications_data = data; if ((notifications_data->notification_list) && (cell_index->row == 0)) ...
{ return; }
LoadedNotificationNode *loaded_node = prv_loaded_notification_list_load_item( &notifications_data->loaded_notification_list, node); if (!loaded_node) { return; } TimelineItem *notification = &loaded_node->notification; const char *title = attribute_get_string(&notification->attr_list, AttributeId...
+ direction; } // if heart rate is diabled, change the order of cards to Activiy <-> Sleep <-> HR else if (activity_is_hrm_present() && !activity_prefs_heart_rate_is_enabled()) { if (current == Card_ActivitySummary) { next = up ? Card_SleepSummary : BACK_TO_WATCHFACE; } else if (current == Card_Slee...
interpolate_moook_out_duration()
* ANIMATION_NORMALIZED_MAX) / interpolate_moook_soft_duration(NUM_MID_FRAMES); if (normalized >= ANIMATION_NORMALIZED_MAX - bounce_back_length) { prv_set_window_background_color(health_card_view); } } static void prv_bg_animation_started_handler(Animation *animation, void *context) { HealthCardView *...
ype = TimelineItemTypePin, .all_day = true, .layout = LayoutIdCalendar, }, .attr_list = { .num_attributes = 1, .attributes = &title_attr, }, }; // Setup //////////////////////////////////////////////////////////////// void test_calendar__initialize(void) { s_in_calendar_event = false; rtc_se...
cl_assert_equal_i(fake_event_get_count(), 1)
; cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert_equal_i(timer_id, TIMER_INVALID_ID); cl_assert(!stub_new_timer_is_scheduled(timer_id)); cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(fake_event_get_count(), 2); ...
/* * 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...
(now_utc, 0, TimelineItemTypeNotification, LayoutIdNotification, &notif_attr_list, &action_group)
; i18n_free_all(&notif_attr_list); attribute_list_destroy_list(&notif_attr_list); attribute_list_destroy_list(&end_workout_attr_list); attribute_list_destroy_list(&open_workout_attr_list); return item; } void workout_utils_send_abandoned_workout_notification(void) { TimelineItem *item = prv_create_abando...
s in KernelBG processing? int delay = 0; if (simulate_bg_delays) { delay = (((i / ALG_MINUTES_PER_FILE_RECORD) + 1) % 30); rtc_set_time(rtc_get_time() + delay); } s_alg_next_vmc = minute_data[i].base.vmc; s_alg_next_orientation = minute_data[i].base.orientation; s_alg_next_light = mi...
prv_create_test_data(num_minutes, minute_data)
; // Write first half of the data prv_feed_minute_data(num_minutes / 2, minute_data, false /*simulate_bg_delays*/); // Now, simulate a reboot, re-initialize of the algorithm. This will trigger a re-read // of the sleep data file activity_algorithm_deinit(); activity_algorithm_init(&s_sample_rate); // 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...
if ((ad_data->ad_data_length >= 3) && (*adv_bytes >= 2) && *(adv_bytes + 1) == GAP_DATA_TYPE_FLAGS) { // Start the iter at the flags byte const uint8_t *iter = adv_bytes + 2; disc_mode = prv_dialog_discoverable_type_for_flag(*iter); // Move iter past the flags iter += 1; adv_bytes ...
ble_error_t rv = ble_gap_adv_mode_set(disc_mode); if (rv != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "Error: ble_gap_adv_mode_set - rv: %d", rv); // Not returning, probably better to try to advertise regardless of this error. } rv = ble_gap_adv_data_set(adv_bytes_len, adv_bytes, ...
ayer, GColorBlack); const GColor progress_bg_color = PBL_IF_COLOR_ELSE(GColorDarkGray, GColorWhite); progress_layer_set_background_color((ProgressLayer *)loading_layer, progress_bg_color); layer_add_child(&window->layer, (Layer *)loading_layer); layer_set_hidden((Layer *)loading_layer, true); StatusBarLayer...
(window, &(WindowHandlers) { .load = prv_mic_window_load, .unload = prv_mic_window_unload, .appear = prv_mic_window_appear, .disappear = prv_mic_window_disappear })
; window_set_user_data(window, data); prv_window_push(window); } // External interface ///////////////////////////////////////////////////////////////////////////////// VoiceWindow *voice_window_create(char *buffer, size_t buffer_size, VoiceEndpointSessionType session_type) { /...
// Check zero termination: cl_assert(tuple->value->cstring[strlen(SOME_STRING)] == 0); string_found = true; break; case SOME_UINT8_KEY: cl_assert(tuple->length == sizeof(uint8_t)); cl_assert(tuple->value->uint8 == 8); uint8_found = true; break; ca...
(new_tuple->length == sizeof(SOME_DATA))
show_action_bar ? SM_LEFT_MARGIN_PX : NM_LEFT_MARGIN_PX; uint16_t right_margin_px = left_margin_px; bool has_header = *expandable_dialog->header ? true : false; const GFont header_font = expandable_dialog->header_font; int32_t header_content_height = has_header ? DISP_ROWS : 0; uint16_t status_layer_offset...
text_layer_get_content_size(ctx, text_layer)
.h; text_content_height += 4; // See PBL-1741 text_layer_set_size(text_layer, GSize(w, text_content_height)); uint16_t scroll_height = icon_offset + icon_size.h + header_content_height + text_content_height + (icon ? BOTTOM_MARGIN_PX : 0); scroll_layer_set_content_size(scroll_layer, GSize(frame.size.w, ...
if (!(expr)) { prv_handle_corruption(heap, log_addr); } //! Lock the heap, using whatever behaviour the heap has configured using heap_set_lock_impl static void heap_lock(Heap* heap) { if (heap->lock_impl.lock_function) { heap->lock_impl.lock_function(heap->lock_impl.lock_context); } } //! Unlock the heap, ...
MIN(SEGMENT_SIZE_MAX, heap_size)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 6), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 8), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20);...
GPoint(10, 0)
, 3); graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 0), 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(14, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(16, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(18, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(20, 0), MAX_N...
sn != sn_end_excl; sn = prv_next_sn(sn)) { prv_set_payload_size_for_sn(client, sn, 0); } } // ------------------------------------------------------------------------------------------------- // Ack Time-out related things. // The effective timeout duration will be between 2 and 3 seconds, depending on when in t...
if (!regular_timer_is_scheduled(&s_ack_timer)) { s_ack_timer.cb = prv_timer_callback; regular_timer_add_multisecond_callback(&s_ack_timer, PPOGATT_TIMEOUT_TICK_INTERVAL_SECS); }
return client; } // ------------------------------------------------------------------------------------------------- static void prv_delete_client(PPoGATTClient *client, bool is_disconnected, DeleteReason reason) { // Unsubscribe from Data characteristic: if (client->state > StateDisconnectedSubscribingData &...
", alert); if (alert == NULL) { passed = false; goto exit; } bool success = health_service_cancel_metric_alert(alert); APP_LOG(APP_LOG_LEVEL_DEBUG, "Result from cancel_metric_alert: %d", (int)success); if (!success) { passed = false; goto exit; } exit: strncpy(data->debug_card.dialog_t...
{ simple_menu_layer_destroy(s_data->debug_card.menu_layer); }
// ------------------------------------------------------------------------------- static void deinit(void) { window_destroy(s_data->steps_window); free(s_data); s_data = NULL; } // ------------------------------------------------------------------------------- static void init(void) { HealthAPITestAppData...
ITConfig(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, TIM_IT_Update, ENABLE); } static void prv_watchdog_deinit(void) { TIM_Cmd(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, DISABLE); TIM_ITConfig(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, TIM_IT_Update, DISABLE); periph_config_disable(BOARD_BT_WATCHDOG_TIMER.timer.peri...
{ prv_watchdog_start(); s_spi_transport.state = SPITransportState_WaitingForSending; }
else { // Nothing to send, we're done: s_spi_transport.state = SPITransportState_Idle; should_give_semaphore = true; } prv_handle_circular_buffer_write_complete(); if (should_give_semaphore) { prv_give_semamphore_from_isr(should_context_switch); } } static void prv_handle_receiving_complete_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
APP_LOG(APP_LOG_LEVEL_INFO, "percent: %d, is_charging: %d, is_plugged: %d", charge.charge_percent, charge.is_charging, charge.is_plugged)
; AppWorkerMessage battery_data = { .data0 = charge.charge_percent, .data1 = charge.is_charging, .data2 = charge.is_plugged, }; app_worker_send_message(1 /*type*/, &battery_data); } // ----------------------------------------------------------------------------------------------- static void connec...
*structured_glance) { LauncherAppGlanceMusic *music_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(music_glance, title, NULL); } static void prv_music_glance_subtitle_dynamic_text_node_update( UNUSED GContext *ctx, UNUSED GTextNode *node, UNUSED const G...
{ // Get the artist and title strings for the music playing or paused char artist_buffer[MUSIC_BUFFER_LENGTH] = {}; char title_buffer[MUSIC_BUFFER_LENGTH] = {}; music_get_now_playing(title_buffer, artist_buffer, NULL /* album_buffer */); // Only populate the glance with music info if we have both a...
// Update the glance icon prv_set_glance_icon(music_glance, new_icon_resource_id); // Broadcast to the service that we changed the glance launcher_app_glance_structured_notify_service_glance_changed(structured_glance); } static void prv_music_event_handler(PebbleEvent *event, void *context) { switch (even...
/* * 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_content_size = PreferredContentSizeDefault; }
settings_file_close(&file); cleanup: mutex_unlock(s_mutex); } static bool prv_pref_set(const char *key, const void *val, size_t val_len) { SettingsFile file = {}; status_t rv; if ((rv = settings_file_open(&file, SHELL_PREFS_FILE_NAME, SHELL_PREFS_FILE_LEN)) != S_SUCCESS) { goto cleanup; } rv = setti...
/* * 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...
(is_complete == true)
ete_ble_pairing_by_id(9); cl_assert_equal_i(s_ble_bonding_change_delete_count, 1); cl_assert_equal_i(fake_shared_prf_storage_get_ble_delete_count(), 3); // Make sure the pairing is actually still there ret = bt_persistent_storage_get_ble_pairing_by_id(id, &irk_out, &device_out, NULL); cl_assert(ret); // A...
cl_assert_equal_i(ancs_id, id2)
ep_sleep; activity_get_metric(ActivityMetricSleepTotalSeconds, 1, &total_sleep); total_sleep -= before_total; activity_get_metric(ActivityMetricSleepRestfulSeconds, 1, &deep_sleep); deep_sleep -= before_deep; PBL_LOG(LOG_LEVEL_DEBUG, "total: %d, deep: %d", (int)total_sleep / SECONDS_PER_MINUTE, (in...
PBL_LOG(LOG_LEVEL_DEBUG, "Done looking for sessions")
; } // ------------------------------------------------------------------------------- static void prv_test_nap(void *context) { bool passed = true; activity_prefs_sleep_insights_set_enabled(true); const time_t now_utc = rtc_get_time(); PBL_LOG(LOG_LEVEL_DEBUG, "test start time: %d", (int)now_utc); const...
stem/logging.h" #include "util/attributes.h" #include "util/build_id.h" #include "util/crc32.h" #include "util/math.h" #include <os/tick.h> #if PLATFORM_ROBERT #define CORE_DUMP_RX_BUFFER_SIZE (16 * 1024) // Place in DTCM on Robert static unsigned char DMA_BSS DMA_READ_BSS s_rx_buffer[CORE_DUMP_RX_BUFFER_SIZE]; #else...
PBL_LOG(LOG_LEVEL_ERROR, "Unable to get Text CRC")
nds { 1104, 0, 272}, { 1024, 96, 152}, { 1032, 64, 160}, { 1000, 24, 200}, { 976, -88, 240}, { 776, -304, 208}, { 792, -176, -24}, { 880, 56, -224}, { 1336, 0, -144}, { 1512, -104, 152}, { 1440, 208, 72}, { 1520, 256, -96}, { 1480, 120, 112}, { 1392, 208, 264}, ...
{ 800, -40, 184}, { 704, -40, 136}, { 608, -56, 72}, { 576, -72, -16}, { 752, 16, -104}, { 976, 56, -112}, // 100 seconds { 1528, -272, 208}, { 1800, -32, 408}, { 1472, 560, -16}, { 1472, 568, -168}, { 1320, 160, 152}, { 1112, 32, 384}, { 1040, 168, 392}, { 97...
oot_layer(&window); Layer *card_layer = health_activity_summary_card_create(health_data); layer_set_frame(card_layer, &window_layer->bounds); layer_add_child(window_layer, card_layer); window_set_background_color(&window, health_activity_summary_card_get_bg_color(card_layer)); window_set_on_screen(&window, tr...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_health_activity_summary_card__render_current_behind_typical4(void) { HealthData health_data = { .step_data = 699, .step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,...
/* * 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...
i18n_noop("INTENSITY")
, i18n_noop("Intensity")); settings_option_menu_push( title, OptionMenuContentType_SingleLine, index, &callbacks, ARRAY_LENGTH(s_intensity_labels), true /* icons_enabled */, s_intensity_labels, data); } // Timeout Settings ///////////////////////////// static const uint32_t s_timeout_values[] = { 3000, ...
abled first l.selection_animation_disabled = true; menu_layer_set_selected_index(&l, MenuIndex(0, 1), MenuRowAlignTop, true); cl_assert_equal_i(1, menu_layer_get_selected_index(&l).row); cl_assert(!l.animation.animation); // Test enabled l.selection_animation_disabled = false; menu_layer_set_selected_ind...
cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row)
; cl_assert_equal_i(0, l.selection.y); const int row0_vertically_centered = (height - FOCUSED)/2; cl_assert_equal_i(row0_vertically_centered, scroll_layer_get_content_offset(&l.scroll_layer).y); cl_assert_equal_i(FOCUSED, l.selection.h); cl_assert_equal_b(false, s_content_available[ContentIndicatorDirectionUp...
/////////////////////////////////// //! Smart alarms #define SMART_ALARM_UPDATE_MIN (SMART_ALARM_SNOOZE_DELAY_S / SECONDS_PER_MINUTE) void test_alarm_smart__trigger_30_min_early_awake(void) { AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_EVERYDAY, .is_smart = true }); ...
(s_num_alarms_fired, 1)
; cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_equal_i(s_num_timeline_adds, 6); cl_assert_equal_i(s_num_timeline_removes, 3); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); } void test_alarm_smart__trigger_at_timeout(void) { AlarmId id; id = alarm_create(&(Alarm...
a; // This is the initial position that takes into account destination delta shift const int16_t src_initial_x = src_bitmap->bounds.origin.x + dest_delta_begin_x; const int16_t src_begin_x = MAX(src_row_info.min_x, src_bitmap->bounds.origin.x); const int16_t src_end_x = MIN(grect_get_max...
MIN(src_line_start_end_idx, src_line_start_idx + row_bits_left)
_number(c->u8), jerry_create_number(c->u16), jerry_create_number(c->u32), jerry_create_number(c->u64), jerry_create_number(c->s8), jerry_create_number(c->s16), jerry_create_number(c->s32), jerry_create_number(c->s64), jerry_create_number(c->d), ); ...
jerry_release_value(input)
; cases[i].input = 0; } } void test_rocky_api_util_args__string(void) { struct { jerry_value_t input; char *expected_output; } cases[] = { { .input = jerry_create_boolean(false), .expected_output = "false", }, { .input = jerry_create_number(0.0), .expected_output =...
//#include "comm/remote.h" #include "process_management/app_run_state.h" #include "services/common/comm_session/protocol.h" #include "system/passert.h" #include "util/attributes.h" #include "util/list.h" #include <stdlib.h> // Stubs /////////////////////////////////////// #include "stubs_logging.h" #include "stubs_...
cl_assert_equal_i(s_launcher_deprecated_messages, 1)
; // When app_run_state is supported, should use app_run_state prv_set_expected(NOT_RUNNING); prv_set_remote_capability(CommSessionRunState); app_run_state_send_update(&s_app_uuid, NOT_RUNNING); cl_assert_equal_i(s_launcher_deprecated_messages, 1); cl_assert_equal_i(s_app_run_state_messages, 1); // Chan...
ext.h" #include "applib/tick_timer_service.h" #include "applib/ui/animation_private.h" #include "applib/ui/app_window_click_glue.h" #include "applib/ui/ui.h" #include "applib/ui/window.h" #include "applib/ui/window_private.h" #include "comm/ble/kernel_le_client/kernel_le_client.h" #include "console/serial_console.h" #i...
(LOG_LEVEL_DEBUG, "Force killing app.")
; app_manager_force_quit_to_launcher(); } static void back_button_force_quit_handler(void *data) { launcher_task_add_callback(launcher_force_quit_app, NULL); } static void launcher_handle_button_event(PebbleEvent* e) { ButtonId button_id = e->button.button_id; const bool watchface_running = app_manager_is_wat...
ake_flash_assert_region_untouched(FLASH_REGION_DEBUG_DB_END, size); fake_spi_flash_cleanup(); } typedef struct { char **msg_arr; int curr_msg_idx; int num_items; int num_processed; } ExpectedMessage; static ExpectedMessage s_msg; void test_flash_logging_get_info(uint32_t *tot_size, uint32_t *erase_unit_siz...
MIN(strlen(buf), log_len - j)
); } msg[log_len] = '\0'; msg_arr[i] = task_strdup(msg); } return (msg_arr); } static void free_logs(char **msg_arr, int num_logs) { for (int i = 0; i < num_logs; i++) { free(msg_arr[i]); } free(msg_arr); } // // Actual Tests // //! Simple test to confirm that we can log and read back se...
ial_activity_session(KAlgTestActivityMinute *samples, int samples_len, KAlgTestActivitySession *session) { time_t now = rtc_get_time(); int start_idx = ((session->start_utc - now) / SECONDS_PER_MINUTE) + 1; int len = session->len_minutes; cl_assert(start_idx +...
prv_feed_activity_minutes(minute_raw_data, k_minute_data_len)
; cl_assert_equal_i(s_num_captured_activity_sessions, 1); ASSERT_ACTIVITY_SESSION_PRESENT(s_captured_activity_sessions, s_num_captured_activity_sessions, &exp_session); } // -------------------------------------------------------------------------------------- // Test a short walk that should not regist...
{ 40, 1248, -280}, { -280, 1160, -360}, { -448, 896, -320}, { -608, 488, -112}, // 82 seconds { -672, 272, 352}, { 400, 488, -616}, { -272, 448, -800}, { -608, -224, -280}, { -688, -112, -224}, { -840, -344, -336}, { -888, -432, -584}, { -960, -400, -616}, { -800, -...
{ -912, 256, -232}, { -904, 224, -256}, { -888, 256, -296}, { -840, 240, -400}, { -864, 200, -408}, { -944, 240, -216}, { -1032, 336, -112}, { -896, 248, -144}, { -944, 144, -160}, { -920, 72, -272}, { -904, 160, -360}, { -912, 168, -408}, { -888, 96, -368}, { -86...
{ -912, 88, -328}, { -920, 72, -320}, // 90 seconds { -912, 56, -296}, { -912, 120, -336}, { -880, 120, -360}, { -880, 112, -384}, { -904, 160, -392}, { -896, 136, -368}, { -896, 144, -376}, { -880, 120, -368}, { -888, 128, -352}, { -896, 112, -328}, { -904, 128,...
scribers[i], e)) { PBL_LOG(LOG_LEVEL_INFO, "Queue full! %d not delivered to task %d!", (int)e->type, (int)i); #if !RELEASE // For 3rd party apps, just close them. For a 1st party app or other task, reboot // the watch if (i == PebbleTask_App && app_manager_get_c...
mutex_unlock(s_plugin_list_mutex)
; return result; } //! @param uuid the UUID of the plugin service, or NULL to use uuid of the current process //! @return non-negative service index, or -1 if error DEFINE_SYSCALL(int16_t, sys_event_service_get_plugin_service_index, const Uuid * uuid) { if (PRIVILEGE_WAS_ELEVATED && uuid != NULL) { syscall_as...
althActivity activity, time_t time_start, time_t time_end, void *context) { if (s_health_sessions_count >= s_health_sessions_max) { return false; } // Update bed and awake time if appropriate if (activity == HealthActivitySleep) { if (s_health_sessions_sleep_time == ...
(ACTIVITY_DEFAULT_WEIGHT_DAG)
; activity_prefs_set_gender(ACTIVITY_DEFAULT_GENDER); activity_prefs_set_age_years(ACTIVITY_DEFAULT_AGE_YEARS); } // --------------------------------------------------------------------------------------- void test_activity__cleanup(void) { activity_stop_tracking(); fake_system_task_callbacks_invoke_pending()...
!Manual && Scheduled && Smart do_not_disturb_set_manually_enabled(false); do_not_disturb_set_schedule_enabled(WeekdaySchedule, true); active = do_not_disturb_is_active(); cl_assert(active == true); } void test_do_not_disturb__disabling_manual_dnd_should_override_scheduled(void) { bool active; // Time 00:0...
(active == true)
; // Scheduled ON DoNotDisturbSchedule schedule_3 = { .from_hour = 14, .from_minute = 0, .to_hour = 15, .to_minute = 0, }; do_not_disturb_set_schedule(WeekdaySchedule, &schedule_3); cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true); cl_assert(do_not_disturb_is_manually_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const Uuid system = UUID_SYSTEM; const Uuid invalid = UUID_INVALID; cl_assert(uuid_equal(&system, &system)); cl_assert(uuid_equal(&invalid, &invalid)); cl_assert(!uuid_equal(&system, &invalid)); const Uuid test_uuid_1 = (Uuid) { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; // Different at ...
/* * 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...
spi_find_prescaler(spi_clock_hz, DISPLAY_SPI_CLOCK_PERIPH)
ices, uint8_t discovery_gen); static void prv_send_event(PebbleBLEGATTClientServiceEventInfo *info) { PebbleEvent e = (const PebbleEvent) { .type = PEBBLE_BLE_GATT_CLIENT_EVENT, .task_mask = 0, .bluetooth = { .le = { .gatt_client_service = { .info = info, .subtype = Pebb...
prv_send_event(info)
; } static void prv_free_service_nodes(GAPLEConnection *connection) { GATTServiceNode *node = connection->gatt_remote_services; while (node) { GATTServiceNode *next = (GATTServiceNode *) node->node.next; kernel_free(node->service); node->service = NULL; kernel_free(node); node = next; } con...
TransportDestinationSystem); memset(s_protocol_callback_counts, 0, sizeof(s_protocol_callback_counts)); s_prepare_count = 0; s_finish_count = 0; s_cleanup_count = 0; s_write_length = 0; s_last_meta_response_info = (const MetaResponseInfo) {}; s_prepare_return_null = false; } void test_...
(s_prepare_count, 0)
; assert_meta_response_sent(MetaResponseCodeDisallowed); // Length: 1, Endpoint ID: PUBLIC_TEST_ENDPOINT_ID, Payload: 0x55 RECEIVE(0x00, 0x01, PUBLIC_TEST_ENDPOINT_ID >> 8, PUBLIC_TEST_ENDPOINT_ID & 0xff, 0x55); cl_assert_equal_i(s_prepare_count, 1); } void test_session_receive_router__ignore_message_if_no_re...
6, true, "1 hr 1 min 6 sec", 1, }, { "'%auT')", 3666, true, "1 hour, 1 minute, and 6 seconds", 1, }, { "'%0uT')", 3666, true, "01 hour, 01 minute, and 06 seconds", 1, }, { "'%fT')", 129666, true, "36:01:06", 1, }, { "'%T')", 129666, true, "12:01:06", 1, }, //...
cl_assert_equal_i(s_cond.eval_time, test->expect_eval_time); #if DEBUG_PRINTING printf("\n"); #endif } }
//////////////////////////////////////////////////////////////////////////////////////////////////// // Test pipeline parser static const struct { const char *instr; time_t intime; const char *expect_str; time_t expect_time; bool expect_rv; TemplateStringErrorStatus expect_status; size_t expect_index; ...
h, bool open) { s_stroke_points = prv_copy_points(path->points, path->num_points, s_offset); s_path_open = open; s_path_stroke_count++; } void gpath_fill_precise_internal(GContext *ctx, GPointPrecise *points, size_t num_points) { s_fill_points = prv_copy_points((GPoint*)points, num_points, s_offset); s_path_...
(points, s_fill_points, s_path_num_points)
); cl_assert_equal_p(s_stroke_points, NULL); prv_reset(); // make fill color transparent (nothing should be drawn because the stroke width is zero and the // fill is transparent GColor color = gdraw_command_get_fill_color(command); color.a = 0; gdraw_command_set_fill_color(command, color); gdraw_comman...
x # of children allowed? return NULL; } bool success = true; AnimationPrivate *parent = animation_private_animation_find(parent_h); parent->type = type; // Keep track of which children we added so we can restore them in case of error bool used_children[array_len]; memset(used_children, 0, sizeof(bo...
if (from->is_property_animation) { PropertyAnimationPrivate *prop = property_animation_private_clone( (PropertyAnimationPrivate *)from); if (prop) { clone = &prop->animation; clone->is_property_animation = true; } } el...
if (!clone) { return NULL; } clone_h = animation_private_animation_init(clone); } // Copy the values into the clone clone->implementation = from->implementation; clone->handlers = from->handlers; clone->context = from->context; clone->delay_ms = from->delay_ms; clone->duration_ms = fro...
return; } } printf("\nFound records:"); for (int i = 0; i < s_num_dls_activity_records; i++) { printf("\ntype: %d, start_utc: %"PRIu32", elapsed: %"PRIu32", utc_to_local: %"PRIu32" ", (int)s_dls_activity_records[i].activity, (uint32_t)s_dls_activity_records[i].start_utc, s_dls_activ...
{ printf("\nFound: type: %d, start_utc: %d, len: %"PRIu16" ", (int)sessions[i].type, (int)sessions[i].start_utc, sessions[i].length_min); }
printf("\nLooking for: type: %d, start_utc: %d, len: %"PRIu16" ", (int)exp_session->type, (int)exp_session->start_utc, exp_session->length_min); clar__assert(false, file, line, "Missing sleep activity record", "", true); } #define ASSERT_STEP_ACTIVITY_SESSION_PRESENT(session) \ prv_asser...
Wraps the .update function of the current CompositorTransition. static void prv_animation_update(Animation *animation, const AnimationProgress distance_normalized); //! Call this function whenever a transition completes to change the state to one of the stable //! states (CompositorState_App or CompositorState_Modal)...
PBL_ASSERTN((bezel_width > 0) && (bezel_height > 0))
; uint8_t *dst = (uint8_t *)s_framebuffer.buffer; uint8_t *app_buffer = (uint8_t *)app_framebuffer->buffer; // Set all the black pixels from the start, which is the sum of the following: // - app_offset_y * DISP_COLS - the top part of the bezel // - bezel_width - the left bezel for the first row o...
time_t midnight = time_util_get_midnight_of(rtc_get_time()); time_t previous_exit_utc; if (s_data.num_sessions > 0) { previous_exit_utc = s_data.activity_sessions[prev].start_utc + (s_data.activity_sessions[prev].length_min * SECONDS_PER_MINUTE); } else { previous_exit_utc = mi...
{ return s_health_app_opened_version; }
ActivityScalarStore activity_metrics_prv_steps_per_minute(void) { return s_data.steps_per_minute; } // ========================================================================================= // PFS stubs static PFSFileChangedCallback pfs_watch_cb = NULL; PFSCallbackHandle pfs_watch_file(const char* filename, PF...
on = db_entry->sdk_version, }; strncpy(entry->name, db_entry->name, APP_NAME_SIZE_BYTES); return true; } static bool prv_app_install_entry_from_resource_registry_entry(const AppRegistryEntry *reg_entry, AppInstallEntry *entry) { PebbleProcessInfo *app_header = kernel_malloc_check(sizeof(PebbleProcessInfo)...
app_install_get_entry_for_install_id(app_id, &entry)
) { return false; } return app_install_entry_is_watchface(&entry); } static const PebbleProcessMd *prv_get_md_for_reg_entry(const AppRegistryEntry *reg_entry) { switch (reg_entry->type) { case AppInstallStorageFw: // If its a FW app, just return the Md return reg_entry->md_fn(); case AppI...
.num_attributes = 3, .attributes = (Attribute[]) { { .id = AttributeIdAppName, .cstring = "Awesome" }, { .id = AttributeIdMuteDayOfWeek, .uint8 = MuteBitfield_None }, { .id = AttributeIdLastUpdated, .uint32 = s_now }, } }; s_expected_attributes = &attr_list; ancs_filtering_record_app(...
(&existing_prefs, s_app_id_attr, s_display_name_attr, s_title_attr)
; cl_assert(s_performed_store); // Make sure the our existing prefs got updated iOSNotifPrefs expected_prefs = { .attr_list = expected_attributes, }; prv_compare_notif_prefs(existing_prefs, &expected_prefs); } void test_ancs_filtering__should_ignore_because_muted(void) { iOSNotifPrefs mute_always = { ...
eAndPostFunctionsTestProcessor *processor_with_data = (PreAndPostFunctionsTestProcessor *)processor; // Record the existing compositing mode and tint color and check that they are what we expect cl_assert(ctx->draw_state.compositing_mode == EXPECTED_COMPOSITING_MODE_BEFORE_AND_AFTER_PRE_FUNCTION)...
cl_assert(gcolor_equal(s_ctx.draw_state.tint_color, EXPECTED_TINT_COLOR_BEFORE_AND_AFTER_PRE_FUNCTION))
; // Note that additional checks are performed in the .pre and .post functions } typedef struct PostFunctionCalledEvenIfPreFunctionCausesNothingToBeDrawnTestProcessor { GBitmapProcessor processor; const GBitmap *expected_bitmap_in_post; bool post_func_called; } PostFunctionCalledEvenIfPreFunctionCausesNothing...
, just doesn't perform any reads, it just returns the # of bytes // of data available for reading. Returns -1 on error. // On exit, *new_read_offset contains the new read_offset int32_t dls_storage_read(DataLoggingSession *logging_session, uint8_t *buffer, int32_t num_bytes, uint32_t *new_read_...
{ consumed_bytes = -1; // error goto exit; }
if (!prv_pfs_read(logging_session->storage.fd, &chunk_hdr, sizeof(chunk_hdr))) { consumed_bytes = -1; // error goto exit; } if (chunk_hdr.valid && chunk_hdr.num_bytes == DLS_CHUNK_HDR_NUM_BYTES_UNINITIALIZED) { // End of valid data break; } if (chunk_hdr.valid) { ...
/* * 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...
jerry_acquire_value(result)
; } } else { box_width = large_int; } GContext *const ctx = rocky_api_graphics_get_gcontext(); GRect box = { .origin.x = x, .origin.y = y, .size.w = box_width, .size.h = large_int, }; // adjust box to accommodate for alignment switch (s_rocky_text_state.alignment) { case GTex...
/* * 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...
(emx_resources_get_size(1, id_4) == 0)
fter bitbang reset", slave->bus->name); } prv_bus_pins_cfg_i2c(slave->bus); prv_bus_reset(slave->bus); mutex_unlock(slave->bus->state->bus_mutex); return recovered; } /*--------------------DATA TRANSFER FUNCTIONS--------------------------*/ //! Wait a short amount of time for busy bit to clear static boo...
i2c_hal_abort_transfer(bus)
; complete = true; PBL_LOG(LOG_LEVEL_ERROR, "I2C Error: too many NACKs received on bus %s", bus->name); break; } } else { // Timeout, abort transfer i2c_hal_abort_transfer(bus); complete = true; PBL_LOG(LOG_LEVEL_ERROR, "Transfer timed out on bus %s", bus->name...
more data uint32_t samples_drained = 0; while (state->num_samples < state->samples_per_update) { // Read available data. AccelManagerBufferData data; if (!shared_circular_buffer_read_subsampled( &s_buffer, &state->buffer_client, sizeof(data), &data, 1)) { // we have drained a...
analytics_external_collect_accel_xyz_delta()
; } static void prv_copy_accel_sample_to_accel_data(AccelDriverSample const *accel_sample, AccelData *accel_data) { *accel_data = (AccelData) { .x = accel_sample->x, .y = accel_sample->y, .z = accel_sample->z, .timestamp /* ms */ = (accel_sample->timest...
ific language governing permissions and * limitations under the License. */ #include "layout_node.h" #include "timeline_layout.h" #include "kernel/pbl_malloc.h" #include "services/common/i18n/i18n.h" #include "system/passert.h" #include "util/size.h" #include "util/string.h" static GTextNodeText *prv_create_text_n...
if (config->use_i18n) { i18n_free(config->str, layout); }
return text_node; } typedef struct { const LayoutLayer *layout; LayoutNodeTextDynamicConfig config; char buffer[]; } TextDynamicContext; static void prv_text_dynamic_node_callback(GContext *ctx, GTextNode *node, const GRect *box, const GTextNodeDrawConfig *config, b...
blt__1bit_to_8bit_comptint_black_cross_lightgray_corners-expect.8bit.pbi")); gbitmap_destroy(src_bitmap); } // Setup: // - Source is 25x25. // - Source has alternating white / black lines. // - Dest is Blue, 100x100. // - Dest offset is set to 8x10 clipped in the bottom right corner. // Result: // - There...
{ GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__1bit_to_8bit_dest_origin_offset_clip.1bit.pbi"); uint8_t dest_data[100*100]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = 100, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSION_CURRENT, .bounds = ...
// Setup: // - Source width is 32 pixels (ie. a word in source) // - Source starts with 2 rows and 4 columns of black pixels. // - Dest is all blue. // - Src origin is set to (4, 2) // - dest origin is set to 10, 25 // - dest size is twice the height / width of the source. void test_bitblt__1bit_to_8bit_...
mark. line->suffix_codepoint = HYPHEN_CODEPOINT; utf8_t* last_visited = walk_line(ctx, line, text_box_params, (CharVisitorCallback) update_dimensions_char_visitor_cb); last_visited = (last_visited == NULL) ? (word->start) : last_visited; // Trim the word int suffix_width_px = prv_codepoint...
if (is_ellipsis_on_overflow) { callbacks->last_line_cb = set_ellipsis_on_overflow_last_line_cb; } else { callbacks->last_line_cb = NULL; }
ctx->text_draw_state.line = (Line) { .start = utf8_bounds->start, // set initial bounding values for line .origin = text_box->box.origin, //<! Needs to be in global co-ords! .max_width_px = text_box->box.size.w, .height_px = fonts_get_font_height(text_box->font) }; Iterator line_iter; lin...
T_NO_CLIP, false, 1); graphics_context_set_stroke_color(&ctx, GColorRed); // cross - even vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 10), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(5, 15), 10); // cross - odd vert, even horiz graphics_draw_vertical_line_dotted(&ctx, GPo...
(ctx, GPoint(60,60), GPoint(60,60))
; graphics_context_set_antialiased(ctx, false); graphics_context_set_stroke_width(ctx, 4); graphics_draw_line(ctx, GPoint(70,70), GPoint(70,70)); graphics_context_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, 4); graphics_draw_line(ctx, GPoint(80,80), GPoint(80,80)); graphics_conte...
/* * 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...
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...
mmand__draw_circle(void) { GDrawCommand *command = malloc(sizeof(GDrawCommand) + sizeof(GPoint)); *command = (GDrawCommand){ .type = GDrawCommandTypeCircle, .hidden = false, .stroke_color = GColorGreen, .stroke_width = 1, .fill_color = GColorOrange, .radius = 300, .num_points = 1, }; ...
cl_assert_equal_b(s_radius, 0)
; cl_assert_equal_i(s_circle_fill_count, 0); cl_assert_equal_i(s_circle_stroke_count, 1); cl_assert(prv_compare_points(&center, s_stroke_points, s_path_num_points)); cl_assert_equal_p(s_fill_points, NULL); prv_reset(); // restore radius and set hidden - nothing should be drawn gdraw_command_set_radius(co...
ck_config_provider(SelectionLayer *selection_layer) { // Config UP / DOWN button behavior: window_set_click_context(BUTTON_ID_UP, selection_layer); window_set_click_context(BUTTON_ID_DOWN, selection_layer); window_set_click_context(BUTTON_ID_SELECT, selection_layer); window_single_repeating_click_subscribe(B...
window_set_click_config_provider_with_context(window, (ClickConfigProvider) prv_click_config_provider, selection_layer)
rt(timeline_add(&item1)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(fake_event_get_count(), 2); cl_assert(!prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000); cl_assert(timeline_remove(&item1.header....
stub_new_timer_fire(timer_id)
); cl_assert_equal_i(fake_event_get_count(), 3); cl_assert(prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(15*60, stub_new_timer_timeout(timer_id) / 1000); rtc_set_time(35 * 60); cl_assert(stub_new_timer_fire(timer_id)); cl_assert_equal_i(fake_event_get_co...
/* * 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_context_set_stroke_color(ctx, path_layer->stroke_color); gpath_draw_outline(ctx, &path_layer->path); }
f (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK)) { dbgserial_putstr("Hold down UP + BACK for 5 secs. to force-boot PRF"); for (int i = 0; i < 5000; ++i) { if (!(button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK))) { // stop waiting if not held down any lon...
display_error_code(0x8badf00d)
; delay_us(200000); display_error_code(0xbad1ce40); delay_us(200000); display_error_code(0xbeefcace); delay_us(200000); display_error_code(0x0defaced); delay_us(200000); display_error_code(0xd15ea5e5); delay_us(200000); display_error_code(0xdeadbeef); delay_us(200000); di...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
comm_session_send_data(session, GET_BYTES_ENDPOINT_ID, (const uint8_t *) &rsp, sizeof(rsp), COMM_SESSION_DEFAULT_TIMEOUT)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ AppData *data = app_state_get_user_data(); Layer *inverter = &data->inverter.layer; layer_set_hidden(inverter, !layer_get_hidden(inverter)); }
static void prv_vibe_timer_callback(void *data) { static const uint32_t SECOND_PULSE_DURATIONS[] = { 1000 }; VibePattern pat = { .durations = SECOND_PULSE_DURATIONS, .num_segments = ARRAY_LENGTH(SECOND_PULSE_DURATIONS) }; vibes_enqueue_custom_pattern(pat); app_timer_register(INTER_VIBE_PERIOD_MS, p...
rnel_malloc_check(size); heartbeat->kind = kind; analytics_heartbeat_clear(heartbeat); return heartbeat; } AnalyticsHeartbeat *analytics_heartbeat_device_create() { AnalyticsHeartbeat *hb = analytics_heartbeat_create(ANALYTICS_HEARTBEAT_KIND_DEVICE); analytics_heartbeat_set(hb, ANALYTICS_DEVICE_METRIC_BLOB_K...
PBL_LOG(LOG_LEVEL_DEBUG, "Unable to print heartbeat: Unrecognized kind %d", heartbeat->kind)