prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
e; } cursor += sizeof(segment_header); // Write all the data bytes in the segment to the HRM. uint16_t write_address = segment_header.address; uint32_t bytes_remaining = segment_header.len_minus_1 + 1; while (bytes_remaining) { uint8_t chunk[MAX_HEX_DATA_BYTES]; const size_t load_len...
if (!prv_set_accel_sample_frequency(dev, HRM_MANAGER_ACCEL_RATE_MILLIHZ)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to set accel frequency"); goto failed; }
// Set the presence detection threshold uint8_t pres_detect_thrsh; WatchInfoColor model_color = mfg_info_get_watch_color(); switch (model_color) { case WATCH_INFO_COLOR_PEBBLE_2_HR_BLACK: case WATCH_INFO_COLOR_PEBBLE_2_HR_FLAME: pres_detect_thrsh = PRES_DETECT_THRSH_BLACK; break; case ...
tc) : session->start_utc; if ((session_exit_utc > stats->today_exit_utc) && (session_exit_utc <= max_end_utc)) { stats->today_exit_utc = session_exit_utc; } } stats->last_exit_utc = MAX(session_exit_utc, stats->last_exit_utc); ...
if ((sleep_data->total_minutes != prev_sleep_data.total_minutes) || (sleep_data->restful_minutes != prev_sleep_data.restful_minutes)) { // Post a sleep changed event PebbleEvent e = { .type = PEBBLE_HEALTH_SERVICE_EVENT, .health_event = { .type = HealthEventSleepUpdate, ...
if (sleep_data->cur_state != prev_sleep_data.cur_state) { // Debug logging ACTIVITY_LOG_DEBUG("total_min: %"PRIu16", deep_min: %"PRIu16", state: %"PRIu16", " "state_min: %"PRIu16"", sleep_data->total_minutes, sleep_data->restfu...
///////////////////////////////////////////////////////////////////////////// //! Setup void test_alarm__initialize(void) { s_num_timer_register_calls = 0; s_num_timeline_adds = 0; s_num_timeline_removes = 0; s_num_alarm_events_put = 0; s_alarm_timer_timeout_ms = 0; s_snooze_timer_timeout_ms = 0; s_num_a...
alarm_create(&(AlarmInfo) { .hour = 6, .minute = 14, .kind = ALARM_KIND_JUST_ONCE })
; prv_assert_alarm_config(id, 6, 14, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday); } void test_alarm__alarm_create_recurring_custom(void) { AlarmId id; bool custom_schedule1[7] = {true, false, true, false, false, true, true}; id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_...
d test_timeline__skip_deleted_item(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0); cl_assert_equal_i(pin_db_delete((uint8_t *)&s_ite...
(!iter_next(&iterator))
t_window_stack); cl_assert_equal_i(window->on_screen, true); cl_assert_equal_i(window->is_loaded, false); window_stack_push(window->parent_window_stack, new_window, true); } static void prv_pop_window_load(Window *window) { prv_window_load(window); cl_check(window->parent_window_stack); cl_assert_equal_i...
app_window_stack_count()
, 2); cl_assert_equal_i(window1->on_screen, false); cl_assert_equal_i(window2->on_screen, true); app_window_stack_remove(window1, false); cl_assert_equal_i(app_window_stack_count(), 1); cl_assert_equal_i(window2->on_screen, true); cl_assert_equal_i(window1->on_screen, false); app_window_stack_remove(wi...
h_sensitivity(bool high_sensitivity) { mutex_lock_recursive(s_accel_manager_mutex); accel_set_shake_sensitivity_high(high_sensitivity); mutex_unlock_recursive(s_accel_manager_mutex); } /* * Driver Callbacks - See accel.h header for more context */ static bool prv_shared_buffer_empty(void) { bool empty = tru...
prompt_send_response_fmt(buffer, sizeof(buffer), "Y: %"PRId16, data.y)
; prompt_send_response_fmt(buffer, sizeof(buffer), "Z: %"PRId16, data.z); } void command_accel_num_samples(char *num_samples) { int num = atoi(num_samples); mutex_lock_recursive(s_accel_manager_mutex); accel_set_num_samples(num); mutex_unlock_recursive(s_accel_manager_mutex); } #if UNITTEST /* * Helper rou...
ce_id = RESOURCE_ID_CHECKMARK_ICON_BLACK; app_window_stack_push(&data->custom_day_picker_window, true); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Time Picker static void prv_time_picker_window_unload(Window *window) { AlarmEditorData *data = (AlarmEd...
{ AlarmEditorData *data = settings_option_menu_get_context(context); data->alarm_type = selection; #if CAPABILITY_HAS_HEALTH_TRACKING if (selection == AlarmType_Smart && !activity_prefs_tracking_is_enabled()) { // Notify about Health and keep the menu open health_tracking_ui_feature_show_disabled(); ...
static void prv_setup_type_menu_window(AlarmEditorData *data) { const OptionMenuCallbacks callbacks = { .select = prv_type_menu_select, .unload = prv_type_menu_unload, }; static const char *s_type_labels[AlarmTypeCount] = { [AlarmType_Basic] = i18n_noop("Basic Alarm"), [AlarmType_Smart] = i18n_n...
ager_mutex); AccelDriverSample data; int result = accel_peek(&data); if (result == 0 /* success */) { prv_copy_accel_sample_to_accel_data(&data, accel_data); prv_update_last_accel_data(&data); } mutex_unlock_recursive(s_accel_manager_mutex); return result; } DEFINE_SYSCALL(AccelManagerState*, sy...
{ return -1; }
if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(buffer, samples_per_update * sizeof(AccelRawData)); } mutex_lock_recursive(s_accel_manager_mutex); { state->raw_buffer = buffer; state->samples_per_update = samples_per_update; state->num_samples = 0; prv_update_driver_config()...
s distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <bluetooth/bt_driver_comm.h> #include "services/common/comm_session/session.h" #include "...
(&capabilities)
; } } //! Resets the session (close and attempt re-opening the session) //! @note If the underlying transport is iAP, this will end up closing all the sessions on top of //! the transport, since we don't really have the ability to close a single iAP session. void comm_session_reset(CommSession *session) { bt_lock...
outLayerConfig config = { .frame = &data->window.layer.bounds, .attributes = &item->attr_list, .mode = LayoutLayerModeCard, .app_id = &data->notification_app_id, .context = &layout_info }; NotificationLayout *notification_layout = (NotificationLayout *)layout_create(layout_id, &config); return...
regular_timer_is_scheduled(&data->reminder_watchdog_timer_id)
|| !do_not_disturb_is_active()) { return; } data->reminder_watchdog_timer_id = (const RegularTimerInfo) { .cb = prv_clear_stale_reminders_timer_cb, .cb_data = data, }; regular_timer_add_minutes_callback(&data->reminder_watchdog_timer_id); } /////////////////////// // Clicks ///////////////...
_text), "%I:%M", local_tm); text_layer_set_text(data->steps_card.time_layer, data->steps_card.time_text); } if (data->lap_steps > data->cur_steps) { // We probably encountered a midnight rollover, reset the persistent storage too data->lap_steps = data->cur_steps; persist_write_int(Ap...
(data->steps_card.cur_step_layer, GColorWhite)
; layer_add_child(window_layer, text_layer_get_layer(data->steps_card.cur_step_layer)); // Time data->steps_card.time_layer = text_layer_create(TIME_RECT); text_layer_set_text_alignment(data->steps_card.time_layer, GTextAlignmentCenter); text_layer_set_font(data->steps_card.time_layer, ...
Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in wri...
prv_wipe_receiver_data(impl)
; kernel_free(impl); } static void prv_default_kernel_receiver_finish(Receiver *receiver) { DefaultReceiverImpl *impl = (DefaultReceiverImpl *)receiver; impl->handler_scheduled = true; if ((int)impl->total_payload_size != impl->curr_pos) { PBL_LOG(LOG_LEVEL_WARNING, "Got fewer bytes than expected for hand...
#define HELLO_MESSAGE_DATA (0x55555555) #define MESSAGE_PADDING (0xFFFFFFFF) // addresses in RAM of interesting settings #define RAM_ADDR_UNLOCK (0xFFF1) #define RAM_ADDR_LOCK (0xFFF0) #define RAM_ADDR_PALM_DETECTION (0x04F1) #define RAM_ADDR_TOUCHDOWN_RETRIES (0x0474) #define RAM_ADDR_LIFTOFF_RETRIES (0x04D3) // mag...
(response.data[0] == address)
; PBL_ASSERTN((response.data[2] & 0x0F) == PACKET_FOOTER); *(uint16_t *)result = response.data[1] | ((uint16_t)(response.data[2] & 0xF0) << 4); } else if (type == StatusReadType_16bit) { // The 3 data bytes are SP QR S1 (in hex) with S being the first 4-bits of the address and PQRS // being the value....
ll corners setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 0, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r0_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1)
; graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 4, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r4_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix left corners PBL-15915 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_rou...
valxy & CORRECTION_VAL_MASK; s_saved_corr[1] = (valxy >> BITS_PER_CORRECTION_VAL) & CORRECTION_VAL_MASK; s_saved_corr[2] = valz & CORRECTION_VAL_MASK; } return (is_valid); } static void prv_get_roll_and_pitch(AccelRawData *d, int32_t *rollp, int32_t *pitchp) { if ((d->x == 0) && (d->y == 0) && (d->...
accel_session_delete(s_accel_session)
; s_accel_session = NULL; mag_release(); } } PBL_LOG(LOG_LEVEL_DEBUG, "subscribers %"PRIu8, s_compass_subscribers_count); } static void prv_compass_data_service_start(PebbleTask task) { prv_compass_data_service_stop(task); s_compass_subscribers[task] = true; if (++s_compass_subscribers_count ...
{ PBL_ASSERT_TASK(PebbleTask_KernelBackground); bool test_mode = (bool)context; activity_prefs_set_activated(); s_activity_state.should_be_started = true; if (!prv_activity_allowed_to_be_enabled() || s_activity_state.started) { return; } AccelSamplingRate sampling_rate; if (activity_algorithm_init...
PBL_LOG(LOG_LEVEL_INFO, "Activity tracking started"); PebbleEvent event = { .type = PEBBLE_ACTIVITY_EVENT, .activity_event = { .type = PebbleActivityEvent_TrackingStarted, }, }; event_put(&event); } } // --------------------------------------------------------------------...
= 0; i < 30; i++) { HealthValue value = health_service_sum(metric, day_start, day_start + SECONDS_PER_DAY); APP_LOG(APP_LOG_LEVEL_DEBUG, "%d: %d", i, (int)value); char temp[32]; snprintf(temp, sizeof(temp), "\n%d: %d", i, (int)value); prv_safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->...
(data->sleep_card.text, sizeof(data->sleep_card.text), "Zzz..\ntotal: %s\ndeep: %s\nenter: %s\nexit: %s", total_sleep_str, deep_sleep_str, bed_time_str, wake_time_str)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(prv_get_gpoint(), prv_get_gpoint())
; } // GSize ///////////////////////// #define EX_GSIZE GSize(5, 6) static GSize prv_get_gsize(void) { return EX_GSIZE; } void test_clar__equal_gsize(void) { // test with local variable GSize a = EX_GSIZE; GSize b = EX_GSIZE; cl_assert_equal_gsize(a, b); // test with reference cl_assert_equal_gsize(p...
--------------------------------------------------------------------------- // Log a health insight response event. void analytics_event_health_insight_response(time_t timestamp, ActivityInsightType insight_type, ActivitySessionType activity_type, ...
(&event_blob)
; } // ------------------------------------------------------------------------------------------ #if !PLATFORM_TINTIN void analytics_event_vibe_access(VibePatternFeature vibe_feature, VibeScoreId pattern_id) { AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_VibeAccess, . vibe_access_data = { ...
are just modifying a copy of the original notification reply_action->type = TimelineItemActionTypeResponse; GColor color = (GColor) attribute_get_uint8(&item->attr_list, AttributeIdBgColor, SMS_REPLY_COLOR.argb); // Lack of an action menu means this was a standalone...
evented_timer_register(show_progress_timeout_ms, false, prv_show_progress_window, data)
; } static void prv_set_action_result(TimelineActionMenu *timeline_action_menu, ActionResultData *action_result) { PBL_ASSERTN(!timeline_action_menu->action_result); timeline_action_menu->action_result = action_result; } // invoke actions that require a response from a connected ...
/* * 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 (s[i] == ch) { return (char*)&s[i]; }
} while (i--); return NULL; }
//////////////////////////////////////////////////////// void test_list__initialize(void) { } void test_list__cleanup(void) { } void test_list__insert_after(void) { ListNode *tail = NULL; ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL; tail = list_insert_after(tail, &a); cl_assert(tail == &a); tail = list...
cl_assert(head == &bar3.list_node)
; cl_assert(list_get_next(head) == &bar2.list_node); cl_assert(list_get_tail(head) == &bar1.list_node); } static bool is_odd(IntNode *node, void *data) { return (node->value & 1); (void)data; } static bool is_even(IntNode *node, void *data) { return ((node->value & 1) == 0); (void)data; } void test_list_...
yright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing...
(pin_db_get(&id1, &item_temp), 0)
true; // initialize the DMA request if (dev->rx_dma) { dma_request_init(dev->rx_dma); } } void uart_init(UARTDevice *dev) { prv_init(dev, false /* !is_open_drain */, UARTCR1Flags_Duplex); } void uart_init_open_drain(UARTDevice *dev) { prv_init(dev, true /* is_open_drain */, UARTCR1Flags_Duplex); } voi...
{ return dev->periph->SR & USART_SR_TC; }
void uart_wait_for_tx_complete(UARTDevice *dev) { while (!uart_is_tx_complete(dev)) continue; } // Interrupts //////////////////////////////////////////////////////////////////////////////// static void prv_set_interrupt_enabled(UARTDevice *dev, bool enabled) { if (enabled) { PBL_ASSERTN(dev->state->tx_irq...
///////////////////////////////////////////////////////// //! BT Classic Pairing Data bool shared_prf_storage_get_bt_classic_pairing_data(BTDeviceAddress *addr_out, char *device_name_out, SM128BitKey *link_key_out, ...
prv_cleanup_struct(&data)
; return is_complete; } void shared_prf_storage_set_getting_started_complete(bool is_complete) { prv_update_and_cleanup_struct_async(&is_complete, sizeof(is_complete), offsetof(SharedPRFData, getting_started_is_complete)); } /////////////...
, 328}, { 272, 904, 224}, { 328, 768, 152}, { 304, 760, 352}, { 256, 712, 448}, { 64, 760, 832}, { 0, 624, 880}, { -56, 728, 792}, { -32, 728, 784}, { 72, 680, 640}, { 64, 808, 440}, { 184, 472, 272}, { 168, 928, 232}, { -32, 704, 512}, { -40, 704, 496}, { -72...
{ -488, 784, 256}, { -568, 1016, 160}, { -760, 1000, -280}, { -1048, 1072, -168}, { -672, 1088, -200}, { -256, 1224, -168}, { -64, 1144, -96}, { 40, 872, -216}, // 8 seconds { -24, 752, -192}, { -80, 672, -176}, { -168, 792, -240}, { -272, 720, -240}, { -408, 880,...
{ 432, 200, -712}, { 456, 368, -1016}, { 360, 616, -1200}, { 128, 728, -1160}, { 248, 728, -1112}, { 96, 848, -664}, { 56, 904, -512}, { 112, 680, -360}, { 24, 664, -304}, { -72, 640, -200}, { -72, 880, -168}, { -104, 976, 16}, { -176, 896, 80}, { -272, 1000, 96}...
48}, { 288, 600, 16}, { 256, 464, -40}, { 280, 376, -96}, { 344, 472, -152}, { 480, 544, -168}, { 696, 656, -272}, { 696, 952, -280}, { 728, 1240, -392}, { 568, 1376, -336}, { 288, 1320, -384}, { 160, 1096, -304}, { 176, 976, -232}, { 248, 640, -272}, { 368, 256,...
{ 72, 528, -24}, { 104, 408, -48}, { 144, 424, -96}, { 192, 472, -104}, { 304, 552, -160}, // 24 seconds { 344, 696, -328}, { 280, 1024, -416}, { 80, 1360, -680}, { 72, 1648, -632}, { 72, 1328, -824}, { 32, 1008, -552}, { 72, 944, -360}, { 72, 656, -192}, { 16...
{ -184, 960, -312}, { -24, 904, -368}, { 32, 592, -368}, { 152, 240, -176}, { 168, 320, -120}, { 200, 312, -32}, { 288, 240, -8}, { 376, 160, -48}, { 440, 304, -56}, { 464, 648, 16}, { 504, 1040, 168}, { 784, 1480, 104}, // 27 seconds { 552, 1672, 8}, { 352, ...
image header!"); return; } PBL_LOG(LOG_LEVEL_DEBUG, "FW update image is v%" PRIu8 ".%" PRIu8 ".%" PRIu8, HRM_SW_VERSION_PART_MAJOR(image_header.sw_version_major), HRM_SW_VERSION_PART_MINOR(image_header.sw_version_major), image_header.sw_version_minor); // Now that we know what v...
mutex_unlock(dev->state->lock)
; } // Prompt Commands // =============== #include "console/prompt.h" #include <string.h> void command_hrm_wipe(void) { // HEX records to write 0xFFFFFFFF to the magic number region. const char *erase_magic_record = ":047FFC00FFFFFFFF85"; const char *eof_record = ":00000001FF"; mutex_lock(HRM->state->lock);...
plateStringState *state) { prv_filter_time_until(state); if (state->error->status != TemplateStringErrorStatus_Success) { return; } state->filter_state = -state->filter_state; state->time_was_until = false; } static void prv_filter_end(TemplateStringState *state) { state->filters_complete = true; } T_...
prv_template_eval(&state)
; if (state.error->status != TemplateStringErrorStatus_Success) { break; } state.time_was_until = false; state.filter_state = 0; state.filters_complete = false; } } if (state.error->status != TemplateStringErrorStatus_Success) { // get the position index. state.err...
IRMATION_LARGE); dialog_set_background_color(dialog, GColorJaegerGreen); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DISMISS); simple_dialog_push(simple_dialog, prv_get_window_stack()); } // ---------------------------------------------------------------------------------------------- //! Main Window typedef stru...
actionable_dialog_pop(s_alarm_popup_data->alarm_popup)
; } static void prv_click_provider(void *context) { window_single_click_subscribe(BUTTON_ID_DOWN, prv_dismiss_click_handler); window_single_click_subscribe(BUTTON_ID_UP, prv_snooze_click_handler); window_single_click_subscribe(BUTTON_ID_BACK, prv_snooze_click_handler); } // -------------------------------------...
/* * 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...
(QSPIFlag_ClearTC)
; delay_us(50000); // 50ms reset if busy with an erase! // Return the flash to Quad SPI mode, all our commands are quad-spi and it'll just cause // problems/bugs for someone if it comes back in single spi mode prv_quad_enable(); } #include "system/passert.h" static bool prv_flash_check_whoami(void) { 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...
if (!gdraw_command_sequence_validate(draw_command_sequence, data_size)) { gdraw_command_sequence_destroy(draw_command_sequence); return NULL; }
return draw_command_sequence; } GDrawCommandSequence *gdraw_command_sequence_clone(GDrawCommandSequence *sequence) { if (!sequence) { return NULL; } // potentially extracting into a generic task_ptrdup(void *, size_t) size_t size = gdraw_command_sequence_get_data_size(sequence); GDrawCommandSequence...
for (unsigned i = 0; i < num_samples * num_values_per_sample; i++) { values[i] = i * 3; } // Create a session with an artifically small buffer size which will cause it to flush // automatically time_t start_time = rtc_get_time(); ProtobufLogConfig log_config = { .type = ProtobufLogType_Measurements,...
protobuf_log_hr_create(transport_cb)
g to be enabled qspi_poll_bit(dev->qspi, dev->state->part->instructions.read_status, dev->state->part->status_bit_masks.write_enable, true /* set */, QSPI_NO_TIMEOUT); } static bool prv_check_whoami(QSPIFlash *dev) { // The WHOAMI is 3 bytes const uint32_t whoami_length = 3; uint32_t read_whoam...
prv_read_register(dev, dev->state->part->instructions.read_status, &status_reg, 1)
; if (!(status_reg & dev->state->part->status_bit_masks.busy)) { // no erase in progress qspi_release(QSPI); return S_NO_ACTION_REQUIRED; } prv_write_cmd_no_addr(dev, dev->state->part->instructions.erase_suspend); qspi_release(QSPI); if (dev->state->part->suspend_to_read_latency_us) { delay...
{ src_y = src_begin_y; }
const GBitmapDataRowInfo dest_row_info = gbitmap_get_data_row_info(dest_bitmap, dest_y); uint8_t *dest = dest_row_info.data; const int16_t dest_delta_begin_x = MAX(dest_row_info.min_x - dest_rect.origin.x, 0); const int16_t dest_begin_x = dest_delta_begin_x ? dest_row_info.min_x : dest...
t = {0}; attribute_list_add_cstring(&end_workout_attr_list, AttributeIdTitle, i18n_get("End Workout", &notif_attr_list)); attribute_list_add_uint32(&end_workout_attr_list, AttributeIdLaunchCode, WorkoutLaunchArg_EndWorkout); AttributeList open_workout_attr...
if (session_out) { memcpy(session_out, &sessions[i], sizeof(ActivitySession)); }
found_session = true; break; } } app_free(sessions); return found_session; }
-82}, { 1055, 376, -100}, { 1045, 337, 6}, { 957, 322, 10}, { 876, 257, 36}, { 807, 282, 42}, { 809, 305, 38}, { 881, 322, 38}, { 875, 328, 6}, { 853, 355, -54}, { 991, 391, -74}, { 1254, 424, -71}, { 1242, 384, 4}, { 1367, 441, 28}, { 1317, 564, -21}, { 1200,...
{ 871, 411, -1}, { 837, 365, -32}, { 786, 287, -49}, { 973, 255, -24}, { 1297, 304, 38}, { 1236, 387, 20}, { 1254, 510, -49}, { 1399, 688, -48}, { 1147, 463, 101}, { 1164, 421, 79}, { 1175, 369, 124}, { 1028, 324, 168}, { 910, 229, 183}, { 853, 198, 178}, { 84...
{ return; }
uint32_t num_sessions = ARRAY_LENGTH(state->cache->sessions); if (!sys_activity_get_sessions(&num_sessions, state->cache->sessions)) { return; } const uint32_t actual_num_sessions = MIN(num_sessions, ARRAY_LENGTH(state->cache->sessions)); prv_sessions_sort(state->cache->sessions, actual_num_sessions, d...
0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3088 - 3104 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3104 - 3120 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff...
for (unsigned int i = 0; i < sizeof(no_litter); i++) { cl_assert(no_litter[i] == image_buf[i]); }
return; } void test_resource__read_last_byte_resource(void) { char filename[32]; resource_storage_get_file_name(filename, sizeof(filename), resource_bank); load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, APP_RESOURCES_FIXTURE_NAME, filename); size_t image_size = resource_size(resource_bank, no_litter_...
ccessibilityMaskNoPermission } }, }; // Run all the tests HealthServiceAccessibilityMask accessible; for (int i = 0; i < ARRAY_LENGTH(tests); i++) { const TestInputOutput *test = &tests[i]; s_activity_prefs_heart_rate_enabled = !test->in.hr_disabled; accessible = health_service_metric_averaged_...
for (int i = 0; i < ARRAY_LENGTH(tests); i++) { const TestInputOutput *test = &tests[i]; s_activity_prefs_heart_rate_enabled = !test->in.hr_disabled; accessible = health_service_metric_aggregate_averaged_accessible(test->in.metric, test->i...
} void test_health__sleep_session_matches(void) { const time_t now = rtc_get_time(); ActivitySession session = { .type = ActivitySessionType_Sleep, .start_utc = now - (10 * SECONDS_PER_MINUTE), .length_min = 10, }; bool (*fun)(const ActivitySession *, HealthActivityMask, time_t, time_t) = prv_...
task_callbacks_invoke_pending(); prv_assert_last_event(PhoneEventType_Incoming, true /* check_cookie */, true /* check_name_number */, "Unknown", NULL); } void test_phone_pp__incoming_no_name(void) { uint8_t pp_msg[] = {0x04, 0x1a, 0xd4, 0x77, 0x08, 0x0d, 0x35, 0x35, 0...
(s_transport, prv_assert_get_phone_call_state_sent_cb)
; pp_get_phone_state(); fake_comm_session_process_send_next(); } void test_phone_pp__get_phone_call_state_response_no_calls(void) { pp_get_phone_state_set_enabled(true); uint8_t pp_msg[] = {0x83}; phone_protocol_msg_callback(s_session, pp_msg, sizeof(pp_msg)); fake_system_task_callbacks_invoke_pending(); ...
/* * 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...
{ snprintf(buffer, buf_size, "5 MIN AGO"); }
= (!value_length || ams_util_float_string_parse(update->value_str, value_length, MS_PER_SECOND, &duration_ms)); if (success) { music_update_track_duration(duration_ms); } else { PBL_LOG(LOG_LEVEL_ERROR, "AMS duration failed to parse"); prv_analytics_log_event_with_info(AMSAnalyticsEventErro...
(s_ams_client->characteristics, characteristics, sizeof(BLECharacteristic) * NumAMSCharacteristic)
ash_state.mutex, true /* is_held */); // Writing a zero-length buffer is a no-op. if (buffer_size < 1) { return; } flash_write_enable(); flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_PAGE_PROGRAM); flash_send_24b_address(start_addr); while (buffer_size--) { flash_send_and_receive...
while (bytes_to_write) { flash_write_page(buffer, start_addr, bytes_to_write); start_addr += bytes_to_write; buffer += bytes_to_write; buffer_size -= bytes_to_write; bytes_to_write = MIN(buffer_size, FLASH_PAGE_SIZE); }
disable_flash_spi_clock(); power_tracking_stop(PowerSystemFlashWrite); flash_unlock(); } void flash_erase_subsector_blocking(uint32_t subsector_addr) { assert_usable_state(); PBL_LOG(LOG_LEVEL_DEBUG, "Erasing subsector 0x%"PRIx32" (0x%"PRIx32" - 0x%"PRIx32")", subsector_addr, subsector_addr &...
uint8_t write_val, uint8_t expected_val, bool disp_logs) { uint8_t write_buffer = write_val; uint8_t read_buffer = 0; // Write test pattern if (disp_logs) { PBL_LOG(LOG_LE...
if (status != 0) { PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Data bit %d not returning correct data value", bitpos); return status; }
bitpos++; addr_region += 4; // increment to the next address to avoid extra erases } PBL_LOG(LOG_LEVEL_DEBUG, ">PASS - DATA TEST 1: Data bus test"); return status; } /***********************************************************/ /******************* Addr Test Functions *******************/ /***********...
s[j].steps); cl_assert_equal_i(minute_data[j].orientation, exp_minutes[j].orientation); cl_assert_equal_i(minute_data[j].vmc, exp_minutes[j].vmc); } } // --------------------------------------------------------------------------------------- void test_kraepelin_algorithm__sleep_tests(void) { bool success...
(" exp_%-8s act_%-7s", metrics[i], metrics[i])
; } printf(" %-10s %-10s", "weight_err", "status"); printf("\n------------------------"); for (int i = 0; i < ARRAY_LENGTH(metrics); i++) { printf("| ---------------------- "); } float weighted_sum = 0.0; int pass_count = 0; int fail_count = 0; SleepFileTestEntry *entry = &test_entry[0]; Sleep...
tion(); animation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); // Create a sequence Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); animation_set_play_count(seq, play_count_seq); // Check the duration ...
prv_count_handler_entries(&s_teardown_handler_calls, a)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a),...
on 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS ...
if (iter == NULL) { return result; }
ap to free the underlying data legacy_bitmap->is_heap_allocated = false; } else { *sub_bitmap = *base_bitmap; // it's the responsibility of the parent bitmap to free the underlying data and palette sub_bitmap->info.is_palette_heap_allocated = false; sub_bitmap->info.is_bitmap_heap_allocated = fals...
{ return NULL; }
if (!prv_platform_supports_format(size, format)) { return NULL; } return prv_gbitmap_create_blank_internal_no_platform_checks(size, format); } GBitmapLegacy2* gbitmap_create_blank_2bit(GSize size) { return (GBitmapLegacy2 *) gbitmap_create_blank(size, GBitmapFormat1Bit); } GBitmap* gbitmap_create_blank...
static void prv_get_icon_frame_centered(TimelineLayer *layer, int index, GRect *icon_frame) { const int center_index = 1; const GRect *bounds = &((Layer *)layer)->bounds; prv_get_icon_frame_exact(layer, center_index, icon_frame); icon_frame->origin.y += prv_get_scroll_delta(layer) * (index - center_index) * b...
{ GRect frame; prv_get_frame(layer, i + 1, &frame); layer_set_frame((Layer *)layout, &frame); }
} } static void prv_hide_non_current_day_items(TimelineLayer *layer) { for (int i = 0; i < TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER; i++) { TimelineLayout *layout = layer->layouts[i]; TimelineIterState *state = timeline_model_get_iter_state(i - 1); if (layout && state->current_day != layer->current_day) {...
/* * 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...
(player, finished, player->context)
/* * 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 (*str != '\r') { s_message_buffer[s_message_length++] = *str; }
} } void dbgserial_newline(void) { uint32_t crc; size_t raw_length = sizeof(PulseFrame) + sizeof(PushPacket) + sizeof(s_message_header) + s_message_length + sizeof(crc); unsigned char raw_packet[raw_length]; PulseFrame *frame = (PulseFrame *)raw_packet; frame->protocol = hton16(PULS...
gcontext, empty_string, font, box, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, (void*)&layout); cl_assert_equal_i(layout.box.size.w, box.size.w); cl_assert_equal_i(layout.max_used_size.h, 0); cl_assert_equal_i(layout.max_used_size.w, 0); graphics_text_layout_get_max_used_size(&gcontext, doubl...
cl_assert_equal_i(layout.max_used_size.h, 2 * (FONT_HEIGHT + FONT_LINE_DELTA))
; graphics_text_layout_get_max_used_size(&gcontext, "JR Whopper", font, box, GTextOverflowModeWordWrap, GTextAlignmentLeft, (void*)&layout); cl_assert(layout.box.size.w == box.size.w); cl_assert_equal_i(layout.max_used_size.w, 4 * HORIZ_ADVANCE_PX); // 3 lines - one line extra being layed out so that it will c...
- 0.5, 168 / 2 - 0.5); cl_assert_fixedS16_3(radius, 144 / 2 - 0.5); grect_polar_calc_values(&r, GOvalScaleModeFillCircle, &center, &radius); cl_assert_gpoint_precise(center, 144 / 2 - 0.5, 168 / 2 - 0.5); cl_assert_fixedS16_3(radius, 168 / 2 - 0.5); } void graphics_draw_arc_precise_internal(GContext *ctx, GPo...
(TRIGANGLE_TO_DEG(0), 0)
; }
ActionMenuSeparatorConfig; static const ActionMenuSeparatorConfig s_separator_configs[NumPreferredContentSizes] = { [PreferredContentSizeSmall] = { .separator = {100, 1}, }, [PreferredContentSizeMedium] = { .separator = {100, 1}, }, [PreferredContentSizeLarge] = { .separator = {162, 2}, }, [P...
(aml->layout_cache.font)
; const int16_t cell_padding = prv_get_cell_padding(aml); const int num_visible_rows = MIN(prv_get_num_rows(&aml->menu_layer, 0, aml), SHORT_ITEM_MAX_ROWS_SPALDING); menu_layer_frame.size.h = (font_height * num_visible_rows) + (cell_padding ...
nd_continues_after_returning(); } void command_btle_unmod_tx_start(char *tx_channel) { bt_driver_start_unmodulated_tx(atoi(tx_channel)); } void command_btle_unmod_tx_stop(void) { bt_driver_stop_unmodulated_tx(); } void command_btle_test_le_tx_start( char *tx_channel, char *tx_packet_length, char *packet_payl...
GPoint(DISP_COLS, DISP_ROWS)
); // ~53 degrees graphics_draw_line(ctx, GPoint(DISP_COLS/4, 0), GPoint(DISP_COLS, DISP_ROWS)); // ~39 degrees graphics_draw_line(ctx, GPoint(0, DISP_ROWS/5), GPoint(DISP_COLS, DISP_ROWS)); profiler_stop(); uint32_t total_time = profiler_get_total_duration(false); uint32_t us = profiler_get_total_durati...
rn rv; } bool exists = settings_file_exists(&s_app_db.settings_file, (uint8_t *)&app_id, sizeof(AppInstallId)); prv_close_file_and_unlock_mutex(); return exists; } typedef struct { AppDBEnumerateCb cb; void *data; AppDBEntry *entry_buf; } EnumerateData; static bool...
prv_lock_mutex_and_open_file()
al_i(s_path_num_points, 2); cl_assert_equal_b(s_path_open, false); cl_assert_equal_i(s_path_fill_count, 1); cl_assert_equal_i(s_path_stroke_count, 0); cl_assert_equal_p(s_stroke_points, NULL); cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points)); prv_reset(); // restore stroke color an...
(s_stroke_width, 1)
; cl_assert_equal_i(s_path_num_points, 1); cl_assert_equal_b(s_radius, 300); cl_assert_equal_i(s_circle_fill_count, 1); cl_assert_equal_i(s_circle_stroke_count, 1); cl_assert(prv_compare_points(&center, s_stroke_points, s_path_num_points)); cl_assert(prv_compare_points(&center, s_fill_points, s_path_num_poi...
w, true /* animated */); } static void prv_window_pop(Window *window) { window_stack_remove(window, true); } static void prv_teardown(VoiceUiData *data) { // The state is only set to StateExiting in this function, so check that teardown has not already // been performed before carrying on if (data->state == S...
{ prv_exit_and_send_result_event(data, DictationSessionStatusFailureSystemAborted); }
} static void prv_show_generic_error_dialog(VoiceUiData *data) { prv_show_error_dialog(data, i18n_noop("Error occurred. Try again.")); } static void prv_show_connectivity_error_and_exit(VoiceUiData *data) { data->error_count = MAX_ERROR_COUNT; // exit UI after the dialog is shown if (data->show_error_dialog)...
ons = task_zalloc_check(num_sessions * sizeof(ActivitySession)); if (activity_get_sessions(&num_sessions, sessions)) { for (unsigned int i = 0; i < num_sessions; i++) { if (sessions[i].ongoing) { // Don't process incomplete events continue; } switch (sessions[i].type) { ...
if (type == BlobDBEventTypeDelete) { if (uuid_equal(id, &s_activity_pin_state.uuid)) { s_activity_pin_state.removed = true; } else if (uuid_equal(id, &s_sleep_pin_state.uuid)) { s_sleep_pin_state.removed = true; } }
tion and then clips a full-screen red rectangle to the resulting mask static void prv_left_flip_first_quarter_frame_clipping(GContext *ctx) { compositor_round_flip_transitions_flip_animation_update(ctx, ANIMATION_NORMALIZED_MAX / 4, CompositorTransitionDirect...
compositor_round_flip_transitions_flip_animation_update(ctx, ANIMATION_NORMALIZED_MAX * 3 / 4, CompositorTransitionDirectionRight, GColorWhite)
; } void test_graphics_window_stack_animation__right_flip_first_quarter_frame_clipping(void) { prv_test_clipping_mask(prv_right_flip_first_quarter_frame_clipping, "right_flip_first_quarter_frame_clipping"); }; // This test records a clipping mask of the half progress frame of the right "rou...
/* * 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...
console_switch_to_prompt()
; } } void serial_console_init(void) { if (s_serial_console_initialized) { return; } dbgserial_register_character_callback(logging_handle_character); s_serial_console_state = SERIAL_CONSOLE_STATE_LOGGING; s_serial_console_initialized = true; } bool serial_console_is_prompt_enabled(void) { if (!s_s...
{ .node.type = LayoutNodeType_TimelineIcon, .margin.h = PREFERRED_CONTENT_SIZE_SWITCH(PreferredContentSizeDefault, //! @note this is the same as Medium until Small is designed /* small */ 3, /* medium */ 3, /* large */ 0, //! @note this is the same as Large until ExtraLarge is desi...
{ WeatherLayout *layout = task_zalloc_check(sizeof(WeatherLayout)); static const TimelineLayoutImpl s_timeline_layout_impl = { .attributes = { AttributeIdTitle, AttributeIdSubtitle }, .default_colors = { { .argb = GColorBlackARGB8 }, { .argb = GColorClearARGB8 }, ...
ontext = context; } static void action_bar_legacy2_raw_up_down_handler(ClickRecognizerRef recognizer, ActionBarLayerLegacy2 *action_bar, bool is_highlighted) { const ButtonId button_id = click_recognizer_get_button_...
layer_remove_from_parent(&action_bar->layer)
; window_set_click_config_provider_with_context(action_bar->window, NULL, NULL); action_bar->window = NULL; } void action_bar_layer_legacy2_set_background_color_2bit(ActionBarLayerLegacy2 *action_bar, GColor2 background_color) { GColor native_background_color = get_native_color(background_color); if (gcolo...
d.active = false; } // Setup void test_app_smartstrap__initialize(void) { smartstrap_attribute_init(); app_smartstrap_subscribe((SmartstrapHandlers) { .did_read = prv_did_read_handler, .did_write = prv_did_write_handler, .notified = prv_notified_handler }); } void test_app_smartstrap__cleanup(void...
(!s_pending_did_write.active)
; // attempt to issue another read request (should report busy) assert_result_busy(app_smartstrap_attribute_read(attr)); // check that it was sent successfully SmartstrapRequest request = { .service_id = 0x1111, .attribute_id = 0x2222, .write_mbuf = NULL, .read_mbuf = NON_NULL_MBUF, .timeo...
//////// void test_compositor__initialize(void) { s_animation_implementation = NULL; s_last_event = (PebbleEvent) { .type = 0 }; s_modal_window_present = false; s_count_animation_create = 0; s_count_animation_schedule = 0; s_count_animation_destroy = 0; s_scheduled_animation = NULL; s_count_display...
prv_handle_display_update_complete()
; cl_assert_equal_i(s_count_animation_create, 1); cl_assert_equal_i(s_count_animation_schedule, 1); } void test_compositor__app_no_animation(void) { // Start a transition. We shouldn't update the screen because the app hasn't rendered // yet. compositor_transition(NULL); cl_assert_equal_i(s_count_display_u...
/* * 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\n", string)
/* * 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...
{ // Reschedule animations prv_animate_info_text(s_data_ptr); }
} static void prv_cleanup_prf_animations(BTPairingUIData *data) { animation_unschedule(property_animation_get_animation(data->info_text_in_animation)); animation_unschedule(property_animation_get_animation(data->info_text_out_animation)); layer_set_hidden(&data->info_text_layer2.layer, true); } typedef struct...
/* * 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...
(region_count * sizeof(char *))
; uint16_t continent_index = 0; // Iterate through the region IDs to sort out the region IDs into continents. // We have sorted the region IDs by name, so each continent _will_ be separate from each other. data->continent_start[continent_index] = 0; for (uint16_t i = 0; i < region_count; i++, cursor += TIMEZO...
eq(&ctx.dest_bitmap, "draw_circle_across_y_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_ny_origin_layer.${BIT_DEPTH_NA...
// Radius of 0 - draw a single pixel setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_NONE); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r0_no_clip.${BIT_DEPTH_NAME}.pbi")); }
void test_graphics_draw_circle_${BIT_DEPTH_NAME}__offset_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(10, 15, 28, 28)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx....
i")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 3); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r3_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 1); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_...
IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "kino_player.h" #include <limits.h> #include "applib/ui/animation_interpolate.h" #include "system/logging.h" #i...
(player, new_reel, true)
; } KinoReel *kino_player_get_reel(KinoPlayer *player) { return player->reel; } static void prv_create_play_animation(KinoPlayer *player, uint32_t from_value, uint32_t to_value) { // stop any ongoing animation kino_player_pause(player); player->from_elapsed_ms = from_value; player->to_elapsed_ms = to_value...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_align(parent->start)
; void *child_end = child_start + size; if (child_end > parent->end) { // Requested size is too big to fit in the parent segment. return NULL; } void *adjusted_parent_start = prv_align(child_end); if (adjusted_parent_start > parent->end) { // The child has left no room for the adjusted parent. ...
cl_assert_equal_i(3, s_tick_timer_service_subscribe.call_count); cl_assert_equal_i(MINUTE_UNIT | HOUR_UNIT | DAY_UNIT | MONTH_UNIT | YEAR_UNIT, s_tick_timer_service_subscribe.last_call.tick_units); // register for minute again EXECUTE_SCRIPT("_rocky.on('minutechange', function() {});"); cl...
EXECUTE_SCRIPT( "_rocky.on('secondchange', function(e) { throw e.type; });" )
; cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_tickservice__provides_event_date(void) { rocky_global_init(s_api); s_log_internal__expected = (const char *[]){ NULL }; const time_t cur_time = 1458250851; // Thu Mar 17 21:40:51 2016 UTC // Thu Mar ...
mented */ void accel_manager_enable(bool on) { } void accel_manager_exit_low_power_mode(void) { } // Return true if we are "idle", defined as seeing no movement in the last hour. bool accel_is_idle(void) { // It was idle recently, see if it's still idle. Note we avoid reading the accel hardware // again here to...
(s_accel_manager_mutex)
; bool rv = accel_run_selftest(); mutex_unlock_recursive(s_accel_manager_mutex); return rv; } #if !defined(PLATFORM_SILK) // Note: This selftest is only used for MFG today. When we start to build out a // gyro API, we will need to come up with a more generic way to handle locking // for a gyro only part vs gyro ...
entionally not // freeing the data->buffer_storage because it was allocated on the client's heap, and the // client is being destroyed. if (session->data->buffer_in_kernel_heap) { kernel_free(session->data->buffer_storage); } // All the lock/unlock session calls are made from priv...
{ // non buffered sessions can only be created/used from KernelBG PBL_ASSERT_TASK(PebbleTask_KernelBackground); }
} // send an open message dls_endpoint_open_session(logging_session); return (logging_session); } // ---------------------------------------------------------------------------------------- DataLoggingSession* dls_create(uint32_t tag, DataLoggingItemType item_type, uint16_t item_size, ...
ns and * limitations under the License. */ #include "console/pulse_bulkio_domain_handler.h" #include "console/pulse_protocol_impl.h" #include "console/pulse2_transport_impl.h" #include <stdbool.h> #include <stdint.h> #include "kernel/pbl_malloc.h" #include "services/common/system_task.h" #include "system/passert.h...
(resp + 1, message, message_len)
; size_t response_len = sizeof(*resp) + message_len; size_t command_len = MIN(length, PULSE_MAX_SEND_SIZE - response_len); memcpy(resp + response_len, cmd, command_len); response_len += command_len; pulse_reliable_send(resp, response_len); } static void prv_respond_internal_error(Command *cmd, size_t len...
al_i(r->state, RecognizerState_Completed); cl_assert(!s_manager_state_change); r->state = RecognizerState_Possible; recognizer_transition_state(r, RecognizerState_Completed); cl_assert_equal_i(r->state, RecognizerState_Completed); cl_assert(!s_manager_state_change); } void test_recognizer__set_failed(void) ...
recognizer_cancel(r)
; cl_assert_equal_i(r->state, RecognizerState_Cancelled); cl_assert_equal_b(cancelled, true); cl_assert_equal_i(rec_event, RecognizerEvent_Cancelled); cancelled = false; r->state = RecognizerState_Updated; rec_event = -1; recognizer_cancel(r); cl_assert_equal_i(r->state, RecognizerState_Cancelled); c...
get_system_font.call_count); s_fonts_get_system_font__result = (GFont)123; rocky_global_init(s_graphics_api); cl_assert_equal_i(1, s_fonts_get_system_font.call_count); cl_assert_equal_p((GFont)123, s_rocky_text_state.font); // make this easily testable by putting it int JS context as global Layer l = {.bou...
(1, s_fonts_get_system_font.call_count)
; cl_assert_equal_i(GTextAlignmentLeft, s_rocky_text_state.alignment); cl_assert_equal_i(GTextOverflowModeWordWrap, s_rocky_text_state.overflow_mode); cl_assert_equal_p(NULL, s_rocky_text_state.text_attributes); } void test_rocky_api_graphics__context_2d_prototype_wrap_function(void) { prv_global_init_and_set_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
CREATE_DMA_STREAM(1, 1)
; // DMA1_STREAM1_DEVICE - Debug UART RX CREATE_DMA_STREAM(1, 2); // DMA1_STREAM2_DEVICE - Accessory UART RX CREATE_DMA_STREAM(2, 0); // DMA2_STREAM0_DEVICE - Dialog SPI RX CREATE_DMA_STREAM(2, 1); // DMA2_STREAM1_DEVICE - Dialog SPI TX CREATE_DMA_STREAM(2, 2); // DMA2_STREAM2_DEVICE - Compositor DMA CREATE_DMA_STREAM(...
tainer || session->start_utc < enter_utc) { enter_utc = session->start_utc; } if (first_container || session_exit_utc > exit_utc) { exit_utc = session_exit_utc; } first_container = false; } else { // Insure that restful sessions are inside the previous container ...
(entry->name, SLEEP_TEST_ONLY)
) { continue; } #endif entry->test_idx = num_tests; printf("\n\n========================================================"); printf("\nRunning sleep sample set: \"%s\"\n", entry->name); // It's easier to understand the algorithm log messages if we start at 0 time rtc_set_time(0); mems...
)PebblePairingServiceGATTError_ConnParamsSupervisionTimeoutTooSmall; } } } return ATT_ERROR_OK; } static att_error_t prv_validate_set_desired_state_cmd( const PebblePairingServiceRemoteDesiredState *desired_state, size_t length) { if (length < sizeof(PebblePairingServiceRemoteDesiredState)) { r...
if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gatts_write_cfm: %u", e); }
} void pebble_pairing_service_handle_status_change(Connection *connection, uint16_t conn_idx) { if (!connection_is_subscribed_to_connection_status_notifications(connection)) { return; } prv_send_notification(conn_idx, s_pps_ctx.att_hdl.conn_status); } void pebble_pairing_service_handle_gatt_mtu_change(Conn...
" // (i.e. one that won't fit a single line at the default font size). const int16_t fudge_some_pixels = 30; const bool line_contains_newline = (strchr(s_phone_ui_data->caller_id_text_buf, '\n') != NULL); int16_t test_width = s_phone_ui_data->caller_id_text_layer.layer.bounds.size.w + fu...
(s_phone_ui_data->vibe_score)
+ vibe_score_get_repeat_delay_ms(s_phone_ui_data->vibe_score); vibe_repeat_interval_sec = DIVIDE_CEIL(vibe_interval_ms, MS_PER_SECOND); #else vibe_repeat_interval_sec = 2; #endif prv_ring(NULL); regular_timer_add_multisecond_callback(&s_phone_ui_data->ring_timer, vibe_repeat_interval_sec); } static void...
= FLASH_TEST_ADDR_START; uint32_t test_addr = base_addr; uint32_t addr_mask = FLASH_TEST_ADDR_MSK; uint8_t read_buffer = 0; uint32_t bit_offset; uint32_t test_offset = 0; FlashTestErrorType status = FLASH_TEST_SUCCESS; /////////////////////////////////////////////////// /// Test 1: Check for address bi...
(special_case_addr, 0xFF, FLASH_TEST_ERR_STUCK_AT_HIGH, base_addr_pos, true)
; if (status != FLASH_TEST_SUCCESS) { stuck_at_high = true; } // If any bits are stuck at high, return error if (stuck_at_high) { return FLASH_TEST_ERR_STUCK_AT_HIGH; } PBL_LOG(LOG_LEVEL_DEBUG, ">PASS - ADDR TEST 1: Check for address bits stuck at high"); //////////////////////////////////...
/* * 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...
(LOG_LEVEL_ERROR, "!!!SAD WATCH 0x%"PRIX32" SAD WATCH!!!", error_code)
; if (modal_manager_get_top_window()) { modal_manager_pop_all(); } modal_manager_set_min_priority(ModalPriorityMax); system_app_state_machine_panic(); } uint32_t launcher_panic_get_current_error(void) { return s_current_error; } void command_sim_panic_cb(void* data) { PebbleEvent event = { .typ...
00, 0x07, 0x00, 0x24, 0x01, 0x0c, 0x02, 0x7c, 0x01, 0xa4, /* bytes 16 - 32 */ 0x00, 0x44, 0x01, 0x6c, 0x00, 0x64, 0x00, 0x6c, 0x00, 0x0c, 0x00, 0xd4, 0x01, 0x44, 0x00, 0x0c, /* bytes 32 - 48 */ 0x02, 0x24, 0x01, 0x0c, 0x02, 0x03, 0x00, 0xc0, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00, 0xac, 0x00, /* bytes 48 - 64 */ 0x6c...
(aligned (8))
) static const uint8_t VOICE_MICROPHONE_LARGE_builtin_bytes[] = { 0x50, 0x44, 0x43, 0x49, 0x09, 0x01, 0x00, 0x00, 0x01, 0x00, 0x50, 0x00, 0x50, 0x00, 0x0d, 0x00, /* bytes 0 - 16 */ 0x03, 0x00, 0xc0, 0x04, 0xff, 0x00, 0x00, 0x09, 0x00, 0x64, 0x01, 0xdc, 0x01, 0xa4, 0x01, 0x9c, /* bytes 16 - 32 */ 0x01, 0xa4, 0x01,...
implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/graphics/graphics.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "clar.h" #include "util.h" #include <stdio...
GRect(10, 10, 60, 60)
); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_inside_offset_layer"))); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); ...
torage_store(&e); TimelineItem r; cl_assert(notification_storage_get(&i, &r)); compare_notifications(&e, &r); free(r.allocated_buffer); notification_storage_remove(&i); cl_assert_equal_b(notification_storage_get(&i, &r), false); } void test_notification_storage__set_actioned_flag(void) { Uuid i; uuid...
(notification_storage_get(&i1, &r))
; compare_notifications(&e1, &r); free(r.allocated_buffer); cl_assert_equal_b(notification_storage_get(&i2, &r), false); notification_storage_store(&e3); cl_assert(notification_storage_get(&i1, &r)); compare_notifications(&e1, &r); free(r.allocated_buffer); cl_assert_equal_b(notification_storage_get...
/* * 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...
strlen(string)
; if (length == 0) { // Empty string pstring_out->str_length = length; pstring_out->str_value[0] = '\0'; } else { pstring_out->str_length = length; strncpy(pstring_out->str_value, string, length); } } bool pstring_equal(const PascalString16 *ps1, const PascalString16 *ps2) { return ps1 && p...
), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Complete A the first time prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 2); cl_assert_equal_i(prv_count_hand...
(prv_count_handler_entries(&s_setup_handler_calls, a), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 0)...
otifprefdb"; T_STATIC const int iOS_NOTIF_PREF_MAX_SIZE = KiBYTES(10); typedef struct PACKED { uint32_t flags; uint8_t num_attributes; uint8_t num_actions; uint8_t data[]; // Serialized attributes followed by serialized actions } SerializedNotifPrefs; static PebbleMutex *s_mutex; static status_t prv_file_op...
(serialized_prefs->num_attributes, serialized_prefs->num_actions, attributes_per_action, string_alloc_size)
; iOSNotifPrefs *notif_prefs = kernel_zalloc_check(sizeof(iOSNotifPrefs) + alloc_size); uint8_t *buffer = (uint8_t *)notif_prefs + sizeof(iOSNotifPrefs); uint8_t *const buf_end = buffer + alloc_size; attributes_actions_init(&notif_prefs->attr_list, &notif_prefs->action_group, &buffe...
nt->characteristics.data; } BLECharacteristic char1 = num_characteristics > 0 ? characteristics[0] : 0; BLECharacteristic char2 = num_characteristics > 1 ? characteristics[1] : 0; PBL_LOG(LOG_LEVEL_WARNING, "No ppog client removed? 0x%x 0x%x vs 0x%x 0x%x", (int)meta, (int)data, (...
if (max_payload_size == 0) { return NULL; }
packet = (PPoGATTPacket *) kernel_malloc_check(sizeof(PPoGATTPacket) + max_payload_size); *heap_packet_in_out = packet; } return packet; } // ------------------------------------------------------------------------------------------------- static const PPoGATTPacket * prv_prepare_next_reset_packet(const ...
ed_prf_storage_set_getting_started_complete(toggle); cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), toggle); cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), i); toggle = !toggle; } } } void test_shared_prf_storage_v3__save_all_data_confirm_all_data_correct(...
SPRF_PAGE_FLASH_OFFSET(shared_prf_storage_get_valid_page_number())
+ offsetof(SharedPRFData, getting_started) + offsetof(SprfGettingStarted, crc), sizeof(new_crc)); // Confirm new CRC was written flash_read_bytes((uint8_t *)&data, SPRF_PAGE_FLASH_OFFSET(sh...
/* * 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...
(sizeof(AnimationPrivate))
; memset(animation, 0, sizeof(AnimationPrivate)); return animation; } bool WEAK animation_destroy(Animation *animation) { if (!animation) { return false; } free(animation); return true; } bool WEAK animation_set_elapsed(Animation *animation, uint32_t elapsed_ms) { if (!animation) { return false;...
ribute_list_destroy_list(&response_item->attr_list); } kernel_free(action_group.actions); attribute_list_destroy_list(&open_attr_list); attribute_list_destroy_list(&remove_attr_list); return item; } // ------------------------------------------------------------------------------------------------ static Ti...
(percent_config->detail_text, &pin_attr_list)
; } else { detail_text = config->detail_text; } attribute_list_add_cstring(&pin_attr_list, PBL_IF_RECT_ELSE(AttributeIdLocationName, AttributeIdTitle), detail_text); attribute_list_add_cstring(&pin_attr_list, AttributeIdBody, ...
greed 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. */ #include "fake_fonts.h" #include "...
for (uint32_t i = 0; i < ARRAY_LENGTH(s_emoji_fonts); i++) { if (font_height >= s_emoji_fonts[i].min_height) { return prv_get_font(s_emoji_fonts[i].key_name); } }
reboot_reason_clear()
; reboot_reason_set(&reason); // If getting reset by the watchdog timer is imminent (it will reset the // CPU if not fed at least once every 7 seconds), then just coredump now if (s_ticks_since_successful_feed >= (6 * TIMER_INTERRUPT_HZ)) { #if defined(NO_WATCHDOG) PBL_LOG(LOG_LEVEL_DEBUG, ...
o.min_x : dest_rect.origin.x; const int16_t dest_end_x = MIN(grect_get_max_x(&dest_rect), dest_row_info.max_x + 1); if (dest_end_x < dest_begin_x) { continue; } const int16_t corrected_src_x = src_bitmap->bounds.origin.x + src_origin_offset.x + dest_delta_begin_x; const uint32_t * const...
src_end_idx = MIN(src_line_wrap_end_idx, src_start_idx + row_bits_left); } else { src_start_idx = 0; src_end_idx = MIN(32, row_bits_left); } src = *src_block; } } } }
void bitblt_bitmap_into_bitmap_tiled(GBitmap* dest_bitmap, const GBitmap* src_bitmap, GRect dest_rect, GPoint src_origin_offset, GCompOp compositing_mode, GColor tint_color) { if (bitblt_compositing_mode_is_noop(compositing_mode, tint_color))...
_hr(1 /*sec*/, 120 /*hr*/, HRMQuality_OffWrist, true /*force_continuous*/); cl_assert_equal_i(s_num_hr_events, 2); cl_assert_equal_i(s_last_hr_event.data.heart_rate_update.current_bpm, 0); cl_assert_equal_i(s_last_hr_event.data.heart_rate_update.quality, HRMQuality_OffWrist); // Should fire off an event. OffWr...
(activity_metrics_prv_get_resting_calories(), 2000 * ACTIVITY_CALORIES_PER_KCAL)
(const uint8_t *) &s_meta_v0_system, sizeof(s_meta_v0_system), BLEGATTErrorSuccess); // Client created: cl_assert_equal_i(ppogatt_client_count(), 1); cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), true); Tran...
ppogatt_client_count()
, 0); cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), false); } static void prv_discover_and_read_meta_and_reset(void) { prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], (const...