prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
_for_default_size(TextStyleFont_MenuCellTitle); } static ALWAYS_INLINE GFont prv_get_cell_subtitle_font(const MenuCellLayerConfig *config) { return config->subtitle_font ?: system_theme_get_font_for_default_size(TextStyleFont_MenuCellSubtitle); } static ALWAYS_INLINE GFont prv_get_cell_value_font(const MenuCe...
{ // Update the text color to Black for legacy apps - this is to maintain existing behavior for // 2.x compiled apps - no need to restore original since original 2.x did not do any restore ctx->draw_state.text_color = GColorBlack; }
/* * 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...
psleep(100)
; } } // ================================================================================ // We install this ISR which does an infinite loop to test that the core dump captures the right // task information if we get it while stuck in an ISR void OTG_FS_WKUP_IRQHandler(void) { if (s_call_core_dump_from_isr) { ...
t_init(&input_config); } } void uart_set_baud_rate(UARTDevice *dev, uint32_t baud_rate) { PBL_ASSERTN(dev->state->initialized); RCC_ClocksTypeDef RCC_ClocksStatus; RCC_GetClocksFreq(&RCC_ClocksStatus); uint64_t scaled_apbclock = DIV_PRECISION; if ((dev->periph == USART1) || (dev->periph == USART6)) { ...
prv_set_interrupt_enabled(dev, true)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(*(msg++))
; } } void serial_console_set_state(SerialConsoleState new_state) { PBL_ASSERTN(s_serial_console_initialized); PBL_ASSERTN(new_state < SERIAL_CONSOLE_NUM_STATES); // This function is called from the USART3 IRQ, the new timer thread, // and the system task. It thus needs a critical section. portENTER_CRITI...
------------------------ void activity_metrics_prv_init(SettingsFile *file, time_t utc_now) { ActivityState *state = activity_private_state(); // Roll back the history if needed and init each of the metrics for today for (ActivityMetric metric = ActivityMetricFirst; metric < ActivityMetricNumMetrics; metri...
{ ActivityState *state = activity_private_state(); bool success = true; // Default results for (uint32_t i = 0; i < history_len; i++) { history[i] = -1; } mutex_lock_recursive(state->mutex); { if (!activity_prefs_tracking_is_enabled() && pebble_task_get_current() == PebbleTask_App) { healt...
sizeof(setting_history)); for (uint32_t i = 1; i < history_len; i++) { history[i] = m_info.converter(setting_history.values[i]); ACTIVITY_LOG_DEBUG("get metric %"PRIi32" %"PRIu32" days ago: %"PRIi32"", (int32_t)metric, i, history[i]); } ...
audrate; if (is_open_drain) { uart_init_open_drain(ACCESSORY_UART); } else { uart_init(ACCESSORY_UART); } uart_set_rx_interrupt_handler(ACCESSORY_UART, prv_rx_irq_handler); uart_set_tx_interrupt_handler(ACCESSORY_UART, prv_tx_irq_handler); uart_set_baud_rate(ACCESSORY_UART, s_baudrate); uart_set_r...
xSemaphoreTake(s_send_semaphore, milliseconds_to_ticks(SEND_BYTE_TIMEOUT_MS))
!= pdPASS) { if (!s_has_sent_byte) { // we haven't sent a byte in the last timeout period, so time out the whole send s_stream_cb = NULL; s_stream_context = NULL; success = false; PBL_LOG(LOG_LEVEL_ERROR, "Timed-out while sending"); break; } s_has_sent_byte = false; } ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ANALYTICS_APP_METRIC_MEM_NATIVE_HEAP_SIZE, heap_size(heap), AnalyticsClient_CurrentTask)
; sys_analytics_max(ANALYTICS_APP_METRIC_MEM_NATIVE_HEAP_PEAK, heap->high_water_mark, AnalyticsClient_CurrentTask); #if CAPABILITY_HAS_JAVASCRIPT && !RECOVERY_FW if (is_rocky_app) { jmem_heap_stats_t jerry_mem_stats = {}; jmem_heap_get_stats(&jerry_mem_stats); sys_analytics_max(ANAL...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ cl_assert(!circular_cache_get(&s_test_cache, &s_test_item[0])); cl_assert(!circular_cache_get(&s_test_cache, &s_test_item[1])); cl_assert(!circular_cache_get(&s_test_cache, &s_test_item[2])); circular_cache_push(&s_test_cache, &s_test_item[0]); circular_cache_push(&s_test_cache, &s_test_item[1]); cl_ass...
void test_circular_cache__contains(void) { cl_assert(!circular_cache_contains(&s_test_cache, &s_test_item[0])); cl_assert(!circular_cache_contains(&s_test_cache, &s_test_item[1])); cl_assert(!circular_cache_contains(&s_test_cache, &s_test_item[2])); circular_cache_push(&s_test_cache, &s_test_item[0]); circ...
WorkoutActiveWindow *active_window, void *i18n_owner) { GRect label_box = *box; GTextOverflowMode overflow_mode = GTextOverflowModeWordWrap; if (metric_type == WorkoutMetricType_Custom) { // I seriously have no idea why the height is hardcoded to 40 and overflow is set to word // wrap when there's a no...
graphics_text_node_destroy(text_node)
; } static void prv_static_layer_update_proc(struct Layer *layer, GContext *ctx) { WorkoutActiveWindow *active_window = window_get_user_data(layer_get_window(layer)); WorkoutMetricType metric_type = WorkoutMetricType_None; if (layer == &active_window->top_metric_layer) { metric_type = active_window->top_met...
r_event_info; WeatherAppWarningDialog *warning_dialog; } WeatherAppData; static bool prv_is_weather_forecast_recent(WeatherLocationForecast *forecast) { if (!forecast) { return false; } const time_t current_time_utc = rtc_get_time(); const int recent_threshold_seconds = 5 * SECONDS_PER_HOUR / 2; // 2.5 h...
weather_service_locations_list_get_location_at_index(data->forecasts_list_head, data->current_forecast_index)
; weather_app_layout_animate(&data->layout, &node->forecast, is_down_pressed); } static void prv_main_window_click_provider(void *context) { window_single_click_subscribe(BUTTON_ID_UP, prv_up_down_click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, prv_up_down_click_handler); } static void prv_main_wi...
/* * 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...
{ vibe_intensity_set(vibe_intensity_get()); }
void vibe_intensity_set(VibeIntensity intensity) { vibes_set_default_vibe_strength(get_strength_for_intensity(intensity)); } VibeIntensity vibe_intensity_get(void) { return alerts_preferences_get_vibe_intensity(); } const char *vibe_intensity_get_string_for_intensity(VibeIntensity intensity) { switch (intensi...
t_storage_store_ble_pairing(&pairing_3, true /* is_gateway */, NULL, false /* requires_address_pinning */, false /* auto_accept_re_pairin...
fake_shared_prf_storage_get_ble_store_count()
, 1); cl_assert_equal_i(fake_shared_prf_storage_get_ble_delete_count(), 1); // Delete the Pairing bt_persistent_storage_delete_ble_pairing_by_id(id); cl_assert_equal_i(s_ble_bonding_change_delete_count, 1); cl_assert_equal_i(fake_shared_prf_storage_get_ble_delete_count(), 2); // Try to read it back ret ...
tp://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 IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permi...
{ break; }
case PROGRESS_UI_SOURCE_LOGS: { break; } case PROGRESS_UI_SOURCE_FW_UPDATE: { if (firmware_update_current_status() == FirmwareUpdateFailed) { prv_handle_finished(data, false /* success */); return; } else if (firmware_update_current_status() == FirmwareUpdateStopped) { ...
ured *structured_glance) { LauncherAppGlanceWorkout *workout_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(workout_glance, title, NULL); } static void prv_workout_glance_subtitle_dynamic_text_node_update( UNUSED GContext *ctx, UNUSED GTextNode *node, U...
(structured_glance)
; } // Bail since no workout is going on return; } // Set icon for the ongoing workout type prv_set_glance_icon(workout_glance, prv_get_workout_icon_resource_id_for_type(workout_type)); // Zero out the glance's subtitle buffer memset(workout_glance->subtitle, 0, sizeof(workout_glance->subtitle)...
graphics_draw_text(ctx, "FG", font, GRect(92, 90 - 16, 62, 16), GTextOverflowModeFill, GTextAlignmentLeft, NULL)
; } if (data->alpha < ALPHA_100) { graphics_context_set_fill_color(ctx, data->fg_color); graphics_fill_rect(ctx, &GRect(124, 0, 20, 40)); graphics_context_set_text_color(ctx, GColorWhite); graphics_draw_text(ctx, "FG", font, GRect(124, 40 - 16, 20, 16), GTextOverflowModeFill,...
return ((AnimationLegacy2 *)animation_h)->context; } AnimationPrivate *animation = prv_find_animation_by_handle(NULL, animation_h, false /*quiet*/); if (!animation) { return NULL; } return animation->context; } // ---------------------------------------------------------------------------------------...
animation_private_using_legacy_2(state)
) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. animation_legacy2_set_curve((AnimationLegacy2 *)animation_h, curve); return true; } AnimationPrivate *animation = prv_find_animation_by_handle(...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_check(prv_get_emoji_icon_by_string(s_emoji_table, " 😀 ") == RESOURCE_ID_EMOJI_BIG_OPEN_SMILE_LARGE)
; // Double emoji is ignored cl_check(prv_get_emoji_icon_by_string(s_emoji_table, "😀😂") == INVALID_RESOURCE); // LTR indicator is ignored cl_check(prv_get_emoji_icon_by_string(s_emoji_table, "\u200E😂") == RESOURCE_ID_EMOJI_LAUGHING_WITH_TEARS_LARGE); // Zero-width-no-break at the end is ignor...
/* * 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...
DEFINE_SYSCALL(void, sys_analytics_inc, AnalyticsMetric metric, AnalyticsClient client)
{ analytics_inc(metric, client); } DEFINE_SYSCALL(void, sys_analytics_stopwatch_start, AnalyticsMetric metric, AnalyticsClient client) { analytics_stopwatch_start(metric, client); } DEFINE_SYSCALL(void, sys_analytics_stopwatch_stop, AnalyticsMetric metric) { ...
tx.dest_bitmap, "draw_round_rect_origin_r3_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_r...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r0_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"))
; 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, 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r1_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT...
); // Capture steps before sleep int32_t steps_before; activity_get_metric(ActivityMetricStepCount, 1, &steps_before); // Do some light and deep sleep prv_feed_deep_sleep_min(60); prv_feed_light_sleep_min(180); prv_feed_deep_sleep_min(20); // Capture steps before sleep activity_get_metric(ActivityM...
prv_test_end(context, passed)
; } // --------------------------------------------------------------------------------- static void prv_count_sleep_sessions(time_t after_time, int *num_sleep, int *num_nap) { *num_sleep = 0; *num_nap = 0; ActivitySession sessions[ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT]; uint32_t session_entries = ARRAY_LENGT...
dle_disconnection(void) { if (s_state.state == PostMessageStateDisconnected) { // Handle the race. See comment in prv_init_apis(). return; } DBG("Transport Disconnected"); const bool did_exit_session_open = (s_state.state == PostMessageStateSessionOpen); s_state.state = PostMessageStateDisconnected; ...
(s_state.out.msg_type == OutboxMsgTypeNone)
chgstat == 0x03 || // Fast charge, CC chgstat == 0x04 || // Fast charge, CV chgstat == 0x05) { // Maintain charge return true; } else { return false; } } bool pmic_is_usb_connected(void) { uint8_t val; if (!prv_read_register(PmicRegisters_STATUSB, &val)) { #if defined (TARGET_QEMU...
prv_write_register(PmicRegisters_INT_MASK_A, 0x08)
; prv_clear_any_pending_interrupts(); } static void register_dump(int start_reg, int stop_reg) { int reg; uint8_t val; char buffer[16]; for (reg = start_reg; reg <= stop_reg; reg ++) { prv_read_register(reg, &val); prompt_send_response_fmt(buffer, sizeof(buffer), "Reg 0x%02X: 0x%02X", reg, val); }...
/* * 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_weather_db, 0, sizeof(s_weather_db))
; s_weather_db.mutex = mutex_create(); } status_t weather_db_flush(void) { if (!weather_service_supported_by_phone()) { // return E_RANGE, so the phone receives BLOB_DB_INVALID_DATABASE_ID and stops sending // unwelcome weather records return E_RANGE; } mutex_lock(s_weather_db.mutex); pfs_remove...
t *and* last pixel if line length is 1) if (y2.fraction != 0) { prv_blend_color_and_update_mask(ctx, y1.integer, x, x, color, (uint8_t)y2.fraction); } } T_STATIC void prv_mask_recording_blend_horizontal_line_raw(GContext *ctx, int16_t y, int16_t x1, in...
prv_blend_color_and_update_mask(ctx, y, x1.integer, x1.integer, color, (uint8_t)(FIXED_S16_3_ONE.raw_value * (right_aa_offset - i) / right_aa_offset))
; x1.integer++; } } } const GDrawRawImplementation g_mask_recording_draw_implementation = { .assign_horizontal_line = prv_mask_recording_assign_horizontal_line, .assign_vertical_line = prv_mask_recording_assign_vertical_line, .blend_horizontal_line = prv_mask_recording_blend_horizontal_line_raw, .b...
.type = ProtobufLogType_Measurements, .measurements = { .num_types = input->msrmt.num_types, .types = input->msrmt.types, } }; ProtobufLogRef session_ref = protobuf_log_create(&log_config, transport_cb, 0); cl_assert(session_ref != NULL); return session_ref; } static TestPLParsedMsg *p...
prv_test_decode_payload(&input, false /*use_data_logging*/, ref)
; } // A simple message with 1 type, 1 sample. Large sample values { ProtobufLogMeasurementType types[] = {ProtobufLogMeasurementType_BPM}; uint32_t offset_sec[] = {2, 4}; uint32_t values[] = {0x11223344, 0x22334455}; TestPLParsedMsg input = { .type = ProtobufLogType_Measurements, .m...
ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10)))
; setup_test(&context, false, 1, GColorBlack, GColorBlack, false); graphics_draw_circle(&context, GPoint(50, 50), 10); ASSERT_CALLED(graphics_circle_draw_1px_non_aa(&context, GPoint(50, 50), 10)); setup_test(&context, false, 1, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, ...
kernel_zalloc_check(sizeof(*sharing_request))
; sharing_request->connection = connection; launcher_task_add_callback(prv_push_sharing_request_window_kernel_main_cb, sharing_request); } static void prv_put_sharing_state_updated_event(int subscription_count) { // 2 purposes of this event: // - refresh the Settings/Bluetooth UI whenever a device (un)subscrib...
ndow->top_metric_layer); } else if (active_window->layout == WorkoutLayout_StaticAndScrollable) { // Two metrics. 1 big static metric above a smaller scrollable metric GRect top_metric_bounds = base_layer_bounds; top_metric_bounds.size.h = PBL_IF_RECT_ELSE(90, 77); layer_init(&active_window->top_metri...
(active_window)
; active_window->update_timer = app_timer_register(1000, prv_update_timer_callback, active_window); } //////////////////////////////////////////////////////////////////////////////////////////////////// //! Public API WorkoutActiveWindow *workout_active_create_single_layout(WorkoutMetricType metric, ...
->event_type]; if (s_event_services[subscription->event_type] == NULL) { // service does not exist PBL_LOG(LOG_LEVEL_WARNING, "Attempted to unsubscribe from %d, no service found", subscription->event_type); return; } if (service->subscribers[subscription->task] == NULL) { // not subscrib...
{ EventServiceBuffer *esb = kernel_zalloc_check(sizeof(EventServiceBuffer)); esb->ptr = buf; esb->intents_pending = intents_pending; list_init(&esb->list_node); s_event_service_buffers = (EventServiceBuffer *)list_prepend( (ListNode *)s_event_service_buffers, (ListNode *)esb); return tru...
else { return false; } } void event_service_handle_event(PebbleEvent *e) { EventServiceEntry *service = s_event_services[e->type]; if (service == NULL) { return; } bool stolen = false; void **buf_ptr = event_get_buffer(e); if (buf_ptr && *buf_ptr) { stolen = prv_steal_buffer(*buf_ptr, servi...
TALL_ID_INVALID, app_install_get_id_for_uuid(&made_up)); cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&UUID_INVALID)); cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&(const Uuid)UUID_SYSTEM)); } void test_app_install_manager__compare_app_entry_retrieve_methods(void) { App...
cl_assert_equal_b(false, app_install_is_hidden(menu_layer_id))
get_user_data(s_window); data->property = (data->property + 1) % PROPERTY_MAX; layer_mark_dirty(s_canvas_layer); } static void down_handler(ClickRecognizerRef recognizer, void *context) { AppData *data = window_get_user_data(s_window); if (data->property == PROPERTY_FG_COLOR) { data->fg_color_index = (data...
window_get_root_layer(window)
, text_layer_get_layer(data->alpha_text)); // Other properties s_color_table = color_table_hsv; data->alpha = ALPHA_100; data->fg_color.argb = s_color_table[data->fg_color_index] | ALPHA_100; data->bg_color = GColorBlack; set_text_layers(data); } static void main_window_unload(Window *window) { // Destr...
terval_slots, advert_terms_a[3].max_interval_slots); regular_timer_fire_seconds(1); // Expect A to be done as well: cl_assert_equal_i(s_unscheduled_cb_count, 2); cl_assert_equal_p(s_unscheduled_job, job_a); cl_assert_equal_b(s_unscheduled_completed, true); } void test_...
cl_assert(job)
/ Get some new data but out stats shouldn't change (except HR) prv_inc_time(10); prv_inc_steps_and_put_event(10); prv_put_bpm_event(110, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); ...
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone))
// remove it via BlobDB blob_db_delete(BlobDBIdPins, (uint8_t *)&item->header.id, UUID_SIZE); // TODO: PBL-23915 // We leak this i18n'd string because not leaking it is really hard. // We make sure we only ever allocate it once though, so it's not the end of the world. prv_put_notification_action_...
i18n_get("Thanks!", &i18n_key)
); const uint32_t timeline_res_id = attribute_get_uint32(&action->attr_list, AttributeIdIconLarge, TIMELINE_RESOURCE_THUMBS_UP); prv_put_notification_action_result(&item->header.id, message, timeline_res_id, ActionResultT...
/* * 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...
gdraw_command_list_get_command(list, 3)
; *c3 = *c2; memcpy(c3->points, c3_points, sizeof(c3_points)); GDrawCommand *c4 = gdraw_command_list_get_command(list, 4); *c4 = *c2; memcpy(c4->points, c4_points, sizeof(c4_points)); return image; } #define COPY_POINTS(target, source) \ for (size_t i=0; i < ARRAY_LENGTH(source); i++) { \ (target)[...
larm_events_put, 0); s_current_minute = 10; cl_assert_equal_i(s_num_alarm_events_put, 1); } void test_alarm__get_string_for_kind(void) { bool all_caps = false; cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_EVERYDAY, all_caps), "Every Day"); cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_WEEK...
cl_assert_equal_i(s_num_alarms_fired, 1)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pfs_remove(buffer)
; } bool app_storage_app_exists(AppInstallId id) { return true; } AppInstallId s_test_id_ql_up; AppInstallId s_test_id_ql_down; AppInstallId s_test_id_watchface; AppInstallId s_test_id_worker; AppInstallId quick_launch_get_app(ButtonId button) { if (button == BUTTON_ID_UP) { return s_test_id_ql_up; } else ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ARRAY_LENGTH(data)
; const StatsBasicOp op = StatsBasicOp_Count; int32_t result; stats_calculate_basic(op, data, num_data, prv_filter, &s_context, &result); cl_assert_equal_i(result, 14); } void test_stats__filtered_consecutive(void) { const int32_t data[] = { 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0 }; ...
E_Connection_Complete_Event_Data = &event_data, }; if (is_master) { prv_fake_gap_le_create_connection_event_put(&event); } else { prv_fake_gap_le_adv_connection_event_put(&event); } } void fake_gap_put_disconnection_event(uint8_t status, uint8_t reason, bool is_ma...
{ s_encrypted_device = BTDeviceAddressToBDADDR(device->address); }
ruct lc_time_T *time_locale = time_locale_get(); cell_text = i18n_get(time_locale->weekday[day_index], &data->custom_day_picker_window); if (data->scheduled_days[(cell_index->row) % DAYS_PER_WEEK]) { ptr_bitmap = &data->selected_icon; } else { ptr_bitmap = &data->deselected_icon; } grap...
gbitmap_init_with_resource(&data->selected_icon, RESOURCE_ID_CHECKBOX_ICON_CHECKED)
; gbitmap_init_with_resource(&data->deselected_icon, RESOURCE_ID_CHECKBOX_ICON_UNCHECKED); gbitmap_init_with_resource(&data->checkmark_icon, RESOURCE_ID_CHECKMARK_ICON_BLACK); data->current_checkmark_icon_resource_id = RESOURCE_ID_CHECKMARK_ICON_BLACK; app_window_stack_push(&data->custom_day_picker_window, true...
/////////////////// //! BLE Root Keys bool shared_prf_storage_get_root_key(SMRootKeyType key_type, SM128BitKey *key_out) { SharedPRFData data; prv_fetch_struct(&data); bool result = false; SM128BitKey nil_key = {}; if (0 == memcmp(&nil_key, &data.root_keys[key_type], sizeof(nil_key))) { goto done; } ...
strncpy(data->name, name, BT_DEVICE_NAME_BUFFER_SIZE)
; } } static void prv_shared_prf_storage_store_ble_pairing_data(BLEPairingData *data) { #ifdef RECOVERY_FW // The callers of bt_persistent_storage expect this store to be synchronous. // In PRF bt_persistent_storage is just a wrapper for this prv_update_and_cleanup_struct(data, sizeof(*data), ...
is 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 IS" BASIS, * WITHOUT WARRANTIES OR CONDITION...
(str, fp_msg)
/* * 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 *app_data = context; free(app_data->result); if (result == DictationSessionStatusSuccess) { size_t size = strlen(transcription) + 11; app_data->result = malloc(size); if (!app_data->result) { APP_LOG(APP_LOG_LEVEL_ERROR, "Failed to allocated memory for transcription"); result = 9...
static void prv_select_click_handler(ClickRecognizerRef recognizer, void *context) { AppData *app_data = context; dictation_session_start(app_data->session); } static void prv_down_click_handler(ClickRecognizerRef recognizer, void *context) { AppData *app_data = context; dictation_session_destroy(app_data->s...
/* * 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...
pfs_init(false /* run filesystem check */)
; pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Setup content indicator ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); 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...
(s_list_mutex)
{ -1064, 352, 128}, // 15 seconds { -1056, 368, -224}, { -1088, 616, -176}, { -1344, 624, 0}, { -1352, 744, 32}, { -1144, 736, -48}, { -1344, 792, 0}, { -1064, 616, 8}, { -1088, 488, -64}, { -1184, 488, -48}, { -1336, 424, 8}, { -1280, 368, 56}, { -1192, 280, 112...
{ -1216, 744, -464}, { -1568, 912, -200}, { -1040, 616, -32}, { -1104, 584, -32}, { -1328, 384, 104}, { -1336, 208, 128}, { -1048, 232, 144}, { -896, 200, 120}, { -936, 208, 144}, { -1008, 104, 272}, { -1120, 112, 232}, { -1288, 24, 328}, { -1208, 56, 296}, { -119...
// 23 seconds { -1032, -304, -16}, { -1248, -144, -200}, { -1112, 32, -248}, { -1112, -104, -192}, { -1256, -24, -16}, { -1248, 0, 24}, { -1064, 96, -8}, { -1008, 168, 104}, { -1152, 224, 128}, { -1312, 320, 88}, { -1264, 400, 8}, { -1216, 656, -160}, { -1344, 68...
er express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/graphics.h" #include "stubs_applib_resource.h" #include "stubs_app_state.h" #include "stubs_compiled_with...
cl_assert_equal_i(GColorRedARGB8, ctx.draw_state.fill_color.argb)
; graphics_context_set_fill_color(&ctx, (GColor8){.a= 1, .r = 3}); cl_assert_equal_i(GColorClearARGB8, ctx.draw_state.fill_color.argb); graphics_context_set_fill_color(&ctx, (GColor8){.a= 0, .r = 3}); cl_assert_equal_i(GColorClearARGB8, ctx.draw_state.fill_color.argb); }
----------------------------------------------- static BTErrno prv_subscribe(BLECharacteristic characteristic_ref, BLESubscription subscription_type, GAPLEClient client, bool is_cleaning_up) { BLESubscription previous_prevailing_type = BLESubscriptionNone; GAPLEConnectio...
(connection, subscription)
_put_bpm_event(50, HRMQuality_OffWrist); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 0); cl_assert_equal_i(hr_zone, HRZone_Zone0); // Put a good quality reading. Verify it was ...
prv_inc_time(30)
ing the health_service API static uint32_t s_health_sessions_count; static uint32_t s_health_sessions_max; static ActivitySession *s_health_sessions; static time_t s_health_sessions_sleep_time; static time_t s_health_sessions_awake_time; static bool prv_activity_iterate_cb(HealthActivity activity, time_t time_start, t...
(0, 0x1000000)
; pfs_init(false); pfs_format(false); prv_activity_algorithm_erase_minute_data(); prv_activity_init_and_set_enabled(true); // Set default user settings activity_prefs_set_height_mm(ACTIVITY_DEFAULT_HEIGHT_MM); activity_prefs_set_weight_dag(ACTIVITY_DEFAULT_WEIGHT_DAG); activity_prefs_set_gender(ACTIVI...
= true; } } static int prv_comparator(void *a, void *b) { return ((TestCacheItem *)a)->id - ((TestCacheItem *)b)->id; } // setup and teardown void test_circular_cache__initialize(void) { memset(s_cache_buffer, 0, sizeof(s_cache_buffer)); circular_cache_init(&s_test_cache, (uint8_t *)s_cache_buffer, sizeof(Te...
(&s_test_cache, &s_test_item[0])
; circular_cache_flush(&s_test_cache); cl_assert(*s_test_item[0].freed); cl_assert(!(*s_test_item[1].freed)); cl_assert(!(*s_test_item[2].freed)); memset(s_cache_buffer, 0, sizeof(s_cache_buffer)); *s_test_item[0].freed = false; circular_cache_push(&s_test_cache, &s_test_item[0]); circular_cache_push...
WARNING, "Calculated the CRC again, got 0x%"PRIx32, calculated_crc_again); return calculated_crc_again == manifest->version.crc; } return true; } static void prv_get_store_entry(ResAppNum app_num, uint32_t resource_id, ResourceStoreEntry *entry) { *entry = (ResourceStoreEntr...
entry->impl->get_resource(entry)
) { *entry = (ResourceStoreEntry){0}; return; } PBL_ASSERTN(entry->length != ENTRY_LENGTH_UNSET); } ResourceCallbackHandle resource_watch(ResAppNum app_num, uint32_t resource_id, ResourceChangedCallback callback, void* data) { ResourceStoreEntry entry; prv_get_stor...
mpositing_mode_combo_is_valid(GBitmapFormat bitmap_format, GCompOp compositing_mode) { return !((bitmap_format != GBitmapFormat1Bit) && ((compositing_mode == GCompOpAssignInverted) || (compositing_mode == GCompOpOr) || ...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_graphics_draw_bitmap__origin_bitmap_layer_inside(void) { prv_origin_bitmap_layer_test(GPointZero); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__origin_bitmap_layer_across_x(void) { prv_origin_bitmap_layer_test(GPoint(25, 0)); cl_check(gbitmap_pb...
tic void prv_base_layer_update_proc(struct Layer *layer, GContext *ctx) { WorkoutSummaryWindow *summary_window = window_get_user_data(layer_get_window(layer)); prv_render_activity_type(ctx, layer, summary_window->icon, summary_window->name); } //////////////////////////////////////////////////////////////////////...
workout_summary_update_activity_type(summary_window, activity_type)
0 GMT const time_t advance = 1450659600 - s_2015_dec19_123456_gmt; prv_basic_test(&s_timezone_gmt, &test_cron, s_2015_dec19_123456_gmt, advance, advance, 1); } void test_cron__dst_rollover_to(void) { // Nov 20th, 03:00:00 local CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .m...
cron_service_wakeup()
; cl_assert_equal_i(cron_service_get_job_count(), 0); } void test_cron__offset_negative_seconds_one_wday(void) { CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 30, .hour = 0, .mday = CRON_MDAY_ANY, .month = CRON_MONTH_ANY, .offset_seconds = -SECONDS_PER_D...
uint16_t section_index, void *callback_context) { return DAYS_PER_WEEK + 1; } static int16_t prv_custom_day_picker_get_cell_height(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_cont...
(CREATED, data->alarm_id, data->callback_context)
; } else { alarm_set_custom(data->alarm_id, data->scheduled_days); data->complete_callback(EDITED, data->alarm_id, data->callback_context); } app_window_stack_pop(true); } } else { // selecting a day of the week // day_of_week index starts from sunday, and printed list starts...
/* * 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...
event_put(event)
; } } DEFINE_SYSCALL(void, sys_current_process_schedule_callback, CallbackEventCallback async_cb, void *ctx) { // No userspace buffer assertion for ctx needed, because it won't be accessed by the kernel. PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
bt_ctl_is_bluetooth_active()
); if (bt_test_bt_sig_rf_test_mode()) { app_data->test_state = BtTestStateStarted; } else { app_data->test_state = BtTestStateFailed; } break; } case BtTestStateStopping: { PBL_ASSERTN(bt_ctl_is_bluetooth_active()); app_data->test_state = BtTestStateStopped; ...
flash_region.h" #include "process_management/app_install_manager.h" #include "process_management/pebble_process_md.h" #include "services/normal/filesystem/pfs.h" #include "services/normal/persist.h" #include "system/logging.h" // Stubs //////////////////////////////////// #include "fake_rtc.h" #include "fake_spi_flash...
pfs_init(false)
; persist_service_init(); persist_service_client_open(&test_uuid_a); } void test_persist__cleanup(void) { persist_service_client_close(&test_uuid_a); } void test_persist__int(void) { const uint32_t key = 0; const uint32_t value = ~0; cl_assert_equal_i(persist_read_int(key), 0); cl_assert_equal_i(persis...
l_assert_equal_i(s_num_timeline_removes, 30); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. First one should be up again s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 6); cl_assert_equa...
cl_assert_equal_i(s_num_timeline_adds, 11); cl_assert_equal_i(s_num_timeline_removes, 7); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. First one should be up again, but not until Saturday s_current_hour = 11; s_current_minute = 30; cron_servic...
/* * 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...
(CLAR_FIXTURE_PATH)
+ 1 + strlen(GRAPHICS_FIXTURE_PATH) + 1 + strlen(png_filename_without_extension) + 1]; sprintf(png_file_path, "%s/%s/%s.png", CLAR_FIXTURE_PATH, GRAPHICS_FIXTURE_PATH, png_filename_without_extension); FILE *fp = fopen(png_file_path, "r"); if (fp) { // Go to the end of the file to discover the ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return 0; }
int64_t last_res = 0x3fff; uint16_t iterations = 0; while ((last_res > 0) && (iterations < 15)) { last_res = ((x / last_res) + last_res)/2; iterations++; } return (last_res); } static void solution_and_estimate_match(int16_t *solution, int16_t *correction) { for (int i = 0; i < 3; i++) { int d...
erase headers */); // start with an empty flash pfs_init(false); char file_small[10], file_large[10]; char buf[50]; for (int i = 0; i < num_pages(); i++) { snprintf(file_small, sizeof(file_small), "file%d", i); snprintf(buf, sizeof(buf), "This is small buf %d!", i); int len = strlen(buf); int ...
(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, f_size)
) < 0) { break; } for (int i = 0; i < num_vals; i++) { st_val = st_val + i; rv = pfs_write(fd, (uint8_t *)&st_val, sizeof(st_val)); cl_assert_equal_i(rv, sizeof(st_val)); } pfs_close(fd); idx++; } cl_assert_equal_i((status_t)fd, E_OUT_OF_STORAGE); // read back files t...
ite); text_layer_set_text_color(text_layer, GColorBlack); } else { text_layer_set_background_color(text_layer, GColorClear); text_layer_set_text_color(text_layer, GColorWhite); } text_layer_set_text_alignment(text_layer, GTextAlignmentLeft); text_layer_set_text(text_layer, text_buffer); } static vo...
graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
i18n_noop("%m/%d")
, timestamp); } size_t clock_get_day_date(char *buffer, int buf_size, time_t timestamp) { return prv_format_time(buffer, buf_size, i18n_noop("%d"), timestamp); } void clock_hour_and_minute_add(int *hour, int *minute, int delta_minutes) { const int new_minutes = positive_modulo(*hour * MINUTES_PER_HOUR + *minute +...
e( HealthMetric metric, time_t time_start, time_t time_end, HealthAggregation aggregation, HealthServiceTimeScope scope) { #if !CAPABILITY_HAS_HEALTH_TRACKING return HealthServiceAccessibilityMaskNotSupported; #else if (prv_is_heart_rate_metric(metric) && !sys_activity_prefs_heart_rate_is_enabled()) { retur...
{ return 0; }
sys_activity_get_metric(ActivityMetricHeartRateFilteredBPM, 1, &value); return value; } else if (valid_hr_sample_num) { // If this is scope-once, the metric is BPM, and the time range is less than // HS_MAX_MINUTE_DATA_SEC, we can use minute history since the amount of data is manageable. ...
c GBitmap s_default_app_icon_bitmap; void app_menu_data_source_enable_icons(AppMenuDataSource *source, uint32_t fallback_icon_id) { cl_assert(source); source->show_icons = true; gbitmap_deinit(&s_default_app_icon_bitmap); gbitmap_init_with_resource_system(&s_default_app_icon_bitmap, SYSTEM_APP, fallback_icon_id...
(true /* write erase headers */)
; load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Setup content indicators buffer ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); content_indicator_init_buffer(buffer); ...
4, 744, 280}, { -432, 736, 272}, { -456, 776, 256}, { -416, 784, 312}, { -416, 704, 296}, { -424, 768, 240}, { -456, 712, 280}, { -456, 736, 280}, { -432, 704, 288}, { -408, 768, 320}, { -400, 736, 280}, { -432, 744, 280}, // 88 seconds { -448, 736, 288}, { -448, ...
{ -416, 744, 264}, { -408, 752, 264}, { -432, 752, 264}, { -424, 744, 248}, { -432, 744, 248}, { -416, 744, 248}, { -416, 744, 264}, { -424, 744, 256}, { -424, 744, 264}, { -424, 744, 272}, { -424, 752, 256}, { -424, 744, 264}, { -424, 744, 264}, { -432, 736, 264}...
{ -424, 744, 264}, { -432, 744, 256}, { -432, 744, 264}, { -424, 744, 256}, { -432, 744, 264}, // 96 seconds { -432, 752, 264}, { -424, 744, 264}, { -424, 744, 264}, { -416, 752, 264}, { -416, 752, 264}, { -424, 744, 264}, { -424, 744, 256}, { -424, 744, 264}, ...
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); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATIO...
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 cl_assert_equal_i(animation_get_duration(seq, true, true), 0); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms();...
-256}, { 840, -528, -48}, { 1048, -368, -32}, { 1448, -328, 8}, { 1584, -176, -48}, { 1496, -128, 40}, { 1264, -96, 104}, { 1152, -16, 88}, { 1296, -8, 64}, { 1728, -24, -48}, { 1800, 168, 80}, { 1784, 560, 136}, { 1512, 488, 56}, { 1216, 608, 0}, { 1408, 312, 0},...
{ 920, -232, 40}, { 1032, -272, -64}, { 912, -448, -40}, { 1008, -576, -40}, { 864, -456, 128}, { 1448, -312, 152}, { 1584, -104, 24}, // 32 seconds { 1560, -80, 80}, { 1296, -48, 104}, { 1096, -80, 224}, { 1048, 152, 16}, { 1376, 56, 112}, { 1648, 280, 96}, {...
{ 1568, -208, 216}, { 1360, -160, 168}, { 1240, -184, 168}, { 1152, -248, 112}, { 1048, -392, 64}, { 1040, -488, 8}, { 1056, -488, -88}, { 1144, -664, -8}, { 696, -512, 104}, { 1184, -320, 0}, { 1440, -248, 32}, { 1592, -240, 24}, { 1392, -152, 112}, { 1192, -112...
///////////////////////// static int round_up_to_nearest_subsector(uint32_t addr) { // - 1 because if we're currently on a subsector border we don't want to round up to the // next one. return (addr + SUBSECTOR_SIZE_BYTES - 1) & SUBSECTOR_ADDR_MASK; } static bool is_cursor_at_active_registry(uint32_t cursor) { ...
{ PBL_LOG_VERBOSE("Active:\n\t"); if (r->active) { PBL_LOG_VERBOSE("True"); } else { PBL_LOG_VERBOSE("False"); } PBL_LOG_VERBOSE("\n"); PBL_LOG_VERBOSE("Key is:\n\t"); for (int i = 0; i < r->key_length; i++) { PBL_LOG_VERBOSE("'%c'", r->key[i]); } PBL_LOG_VERBOSE("\n"); PBL_LOG_VERBOSE...
static bool record_compare(Record* r, const char* key, const uint8_t key_length, const uint8_t* uuid) { if ((r->key_length == key_length) && (memcmp(r->uuid, uuid, UUID_SIZE_BYTES) == 0) && (memcmp(r->key, key, r->key_length) == 0)) { return true; } return false; } static int record_get_index(c...
qual_i(value, 23 * SECONDS_PER_HOUR /* 11pm */); activity_get_metric(ActivityMetricSleepTotalSeconds, 1, &value); cl_assert_equal_i(value, 330 * SECONDS_PER_MINUTE); activity_get_metric(ActivityMetricSleepExitAtSeconds, 1, &value); cl_assert_equal_i(value, 4 * SECONDS_PER_HOUR + 45 * SECONDS_PER_MINUTE /* 4:4...
time_start_of_today()
; steps = health_service_sum( HealthMetricStepCount, time_start_of_today() - (12 * SECONDS_PER_HOUR), time_start_of_today() + (elapsed_today / 2)); cl_assert_equal_i(steps, 1500); } // --------------------------------------------------------------------------------------- // Test distance using various sp...
96, 936, -168}, // 2 seconds { 1024, 904, -96}, { 1424, 728, -56}, { 2000, 792, 72}, { 2752, 552, 128}, { 2648, 264, 200}, { 2472, 168, 216}, { 2104, 136, 192}, { 1776, 200, 72}, { 1288, 160, 40}, { 1040, 136, -8}, { 936, 56, 64}, { 736, -96, -8}, { 456, -232, -56...
{ 784, -712, 424}, { 704, -472, -272}, { 1136, -96, -224}, { 1456, 144, -256}, { 1160, 56, -248}, { 1128, -8, -128}, { 1328, 296, -224}, { 1608, 464, -200}, { 1816, 544, -256}, { 1792, 800, -248}, { 1568, 880, -416}, { 976, 1112, -528}, { 968, 1104, -368}, { 1136,...
{ 1704, 336, -32}, { 1488, 272, -72}, { 1544, 240, -72}, { 1496, 192, -16}, { 1528, 152, -24}, { 1408, 120, -32}, { 1208, 32, -48}, { 800, -512, -56}, { 960, -544, -48}, { 592, -576, -112}, { 1256, -64, -200}, { 1464, 80, -184}, { 1376, 176, -168}, { 1448, 152, -...
28}, { -136, 928, 328}, { -144, 920, 368}, { -128, 968, 368}, { -144, 1032, 400}, { -144, 1080, 320}, { -152, 984, 224}, { -144, 920, 120}, { -128, 968, -40}, { -96, 952, -96}, { -104, 1096, -224}, { -120, 1064, -192}, { -104, 976, -312}, { -112, 1016, -256}, // 6...
{ 32, 328, -744}, { 32, 328, -736}, { 32, 464, -760}, { -64, 656, -704}, { -40, 616, -720}, { -152, 792, -536}, { -88, 640, -560}, { -248, 672, -456}, { -152, 680, -672}, { -200, 784, -496}, { -56, 744, -736}, { 64, 744, -712}, { -208, 944, -744}, { -208, 864, -53...
{ -48, 744, -592}, { -32, 800, -600}, { -24, 800, -544}, { -56, 632, -592}, { -72, 680, -576}, { -112, 768, -616}, // 6 seconds { -80, 776, -616}, { -48, 616, -632}, { -88, 784, -592}, { -104, 696, -640}, { -80, 688, -680}, { -72, 712, -624}, { -72, 632, -640}, ...
DISP_ROWS}); } // Teardown void test_graphics_stroke_circle_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } // Tests //////////////////////////////////// #define RADIUS_BIG 15 #define RADIUS_MEDIUM 8 #define RADIUS_MIN_CALCULATED 3 #define RADIUS_MAX_PRECOMPUTED 2 #define RADIUS_SMALL 1 #define RADIUS_NONE 0 #defin...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_THREE)
; graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_NONE); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r0_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif // SCREEN_COLOR_DEPTH_BITS == 8 } #define OFFSET_RECT_NO_CLIP GRect(10, 10, 40, 50) #define OFFSET_RECT_CLIP_XY GRect...
et_aa_r8_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_t...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL)
; graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornersLeft); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quads_left.${BIT_DEPTH_NAME}.pbi")); #endif // SCREEN_COLOR_DEPTH_BITS == 8 } extern void graphics_circle_quadrant_draw_stroked...
_window, WorkoutMetricType metric_type, bool prefer_larger_font, void *i18n_owner) { GTextNodeHorizontal *horiz_container = graphics_text_node_create_horizontal(MAX_TEXT_NODES); GTextNodeContainer *c...
i18n_owner, active_window->workout_data); #if PBL_RECT /// MI/KM units string const char *units_string = active_window->workout_controller->get_distance_string( i18n_noop("MI"), i18...
TEXT_COLOR, container); active_window->workout_controller->metric_to_string(metric_type, (char *)number_text_node->text, buffer_size, i18n_owner, active_window->workout_data); if (strlen(number_text_node->text) > 5) { /...
6, -736}, { -448, 688, -608}, { -392, 800, -400}, { -400, 744, -392}, // 2 seconds { -544, 752, -408}, { -496, 776, -384}, { -464, 808, -256}, { -408, 728, -240}, { -344, 664, -272}, { -352, 696, -224}, { -616, 952, -344}, { -1056, 944, -472}, { -1160, 1152, -488}, ...
{ 1000, 312, -152}, { 1144, 216, -168}, { 1072, 272, -112}, { 1008, 240, -112}, { 920, 224, -112}, { 832, 168, -96}, { 736, 208, -152}, { 512, 168, -296}, { 664, 208, -224}, { 768, 256, -328}, { 928, 296, -496}, { 1432, 440, -560}, { 1408, 328, -352}, { 1096, 360,...
k(EWD1000->i2c, len, data)); i2c_release(EWD1000->i2c); } static void prv_read_data(uint8_t *data, size_t len) { i2c_use(EWD1000->i2c); PBL_ASSERTN(i2c_read_block(EWD1000->i2c, len, data)); i2c_release(EWD1000->i2c); } static void prv_wait_for_interrupt(void) { const RtcTicks timeout = rtc_get_ticks() + RTC...
((uint8_t *)&packet, sizeof(packet))
; prv_wait_for_interrupt(); prv_read_data((uint8_t *)&packet, sizeof(packet)); PBL_ASSERTN(packet.packet_id == PACKET_ID_FLASH_RESPONSE); PBL_ASSERTN(packet.address == address); PBL_ASSERTN(packet.footer == RAM_FLASH_FOOTER); return ntohs(packet.value); } #endif // Interrupt / Callback ///////////////////...
_pin_last_state; SettingsFile *file = activity_private_settings_open(); if (file) { prv_restore_state(file, ActivitySettingsKeyInsightSleepRewardTime, &s_sleep_reward_state.common.last_triggered_utc, sizeof(s_sleep_reward_state.common.last_triggered_utc)); prv_res...
(now_utc, exit_utc, enter_seconds, exit_seconds, total_seconds, total_seconds, &uuid)
; uuid = UUID_INVALID; prv_push_sleep_summary_pin(now_utc, exit_utc, enter_seconds, exit_seconds, total_seconds - deviate_seconds, total_seconds, &uuid); uuid = UUID_INVALID; prv_push_sleep_summary_pin(now_utc, exit_utc, enter_seconds, exit_seconds, tota...
/* * 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...
itoa_int(0, buf, 10)
ts(s_kalg_state, &minute_data.vmc, &minute_data.orientation, &still); PBL_ASSERTN(num_minutes_captured < *minute_data_len); minute_data_array[num_minutes_captured++] = minute_data; // ---------------------------------------------------- // Free state kernel_free(s_kalg_state); s_kalg_state = NULL; *minu...
if (token[0] == '#') { continue; }
// If this is a comment skip it if (strcmp(token, "//") == 0) { continue; } // If this is an AccelRawData line, get the name if (strcmp(token, "AccelRawData") == 0) { PBL_ASSERT(state->test_entry.name[0] == 0, "Unexpected start of new samples"); token = strtok(NULL, "("); ...
/* * 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...
gpio_release(FLASH_GPIO)
; } void flash_end_cmd(void) { gpio_use(FLASH_GPIO); GPIO_SetBits(FLASH_GPIO, FLASH_PIN_SCS); gpio_release(FLASH_GPIO); // 50ns required between SCS going high and low again, so just delay here to be safe delay_us(1); } uint8_t flash_send_and_receive_byte(uint8_t byte) { // Ensure that there are no other...
/* * 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...
window_get_user_data(window)
/* * 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_fb, &(GSize) {DISP_COLS, DISP_ROWS})
ns if it is not deleted, otherwise skip it and look for // the next match if (compare_func(header, data)) { return true; } } if (pfs_seek(fd, header->payload_length, FSeekCur) < 0) { break; } } return false; } static bool prv_uuid_equal_func(SerializedTimelineItemHeade...
if ((result == E_RANGE) || (uuid_is_invalid(&iter_state->header.common.id))) { return false; } else if (result < 0) { PBL_LOG(LOG_LEVEL_ERROR, "Error reading notification header while iterating %d", result); return false; }
if (iter_state->header.common.status & TimelineItemStatusDeleted) { return true; } return prv_get_notification(&iter_state->notification, &iter_state->header, iter_state->fd); } static void prv_set_header_status(SerializedTimelineItemHeader *header, uint8_t status, int fd) { // Seek to the status field ...
void prv_day_sep_anim_stopped(Animation *anim, bool finished, void *context) { TimelineLayer *timeline_layer = context; if (finished) { timeline_layer_unfold_day_sep(timeline_layer); } } // TODO: PBL-21717 Day separator on Spalding Animation *timeline_layer_create_day_sep_show(TimelineLayer *timeline_layer) ...
{ TimelineLayer *layer = context; prv_update_pins_mode(layer); prv_set_layouts_to_final_position(layer); prv_destroy_nonvisible_items(layer); prv_place_day_separator(layer); prv_place_end_of_timeline(layer); }
static void prv_mode_change_update(Animation *animation, AnimationProgress normalized) { TimelineLayer *timeline_layer = animation_get_context(animation); const AnimationProgress bounce_back_length = (interpolate_moook_out_duration() * ANIMATION_NORMALIZED_MAX) / interpolate_moook_duration(); if (normaliz...
th]; memset(fake_data, 0, max_length); cl_assert_equal_b(comm_session_send_buffer_write(write_sb, fake_data, max_length), true); // Try writing another byte (expect false returned): cl_assert_equal_b(comm_session_send_buffer_write(write_sb, fake_data, max_length), false); comm_session_send_buffer_end_write(...
while ((read_space = s_default_kernel_send_job_impl.get_read_pointer(job, &data_out))) { PebbleProtocolHeader *header = (PebbleProtocolHeader *) data_out; if (bytes_read == 0) { cl_assert(read_space >= sizeof(PebbleProtocolHeader)); cl_assert_equal_i(header->length, htons(max_payload_length)); ...
cl_assert_equal_i(bytes_read, expected_bytes_incl_pebble_protocol_header); cl_assert_equal_i(comm_session_send_queue_get_length(s_valid_session), 0); prv_cleanup_send_buffer(write_sb); }
{ 64, 16, -1000}, { 72, 24, -1000}, { 72, 24, -1000}, { 72, 24, -1000}, { 72, 16, -1000}, { 72, 24, -1000}, { 72, 16, -1000}, { 72, 32, -1000}, { 64, 16, -1000}, { 72, 24, -992}, { 72, 24, -1000}, { 72, 24, -1000}, { 64, 24, -1000}, { 72, 24, -1000}, { 64, 24, -1...
{ 64, 16, -1000}, { 64, 24, -1000}, { 64, 16, -1000}, { 64, 24, -1000}, { 72, 16, -1008}, { 64, 16, -1000}, { 64, 16, -1008}, { 64, 16, -1000}, { 56, 16, -1000}, { 64, 16, -1000}, { 64, 24, -1000}, { 72, 24, -1000}, { 64, 16, -1000}, { 64, 16, -1000}, { 64, 16...
{ 64, 16, -992}, { 64, 24, -1000}, { 64, 24, -1000}, { 64, 16, -992}, { 56, 24, -1000}, { 64, 24, -1000}, { 64, 24, -1000}, { 64, 24, -1000}, { 64, 16, -1000}, { 64, 8, -1008}, { 64, 32, -1000}, { 64, 8, -1000}, { 64, 24, -1000}, { 56, 24, -1000}, { 64, 24, -...
n the stroke color with antialiasing enabled setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 0); graphics_context_set_stroke_color(&ctx, GColorBlack); prv_draw_circles(&ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_aa_swX_black.${BIT_DEPTH_NAME}.pbi")); } void test...
(framebuffer_is_empty(NULL, ctx.parent_framebuffer, GColorWhite))
; // table with most popular angles to test typedef struct { char *filename_part; uint32_t angle; } TestAngles; TestAngles test_angles[] = { { .filename_part = "__1_degrees", .angle = TRIG_MAX_ANGLE / 360, }, { .filename_part = "__6_degrees", .angle = TRIG_MAX_ANGLE...
/* * 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...
{ fake_spi_flash_init(0, 0x1000000); pfs_init(false); app_db_init(); // add all three cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app1.uuid, sizeof(Uuid), (uint8_t*)&app1, sizeof(AppDBEntry))); cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app2.uuid, sizeof(Uuid), (uint8_t*)&...
essionRef session_ref = sys_hrm_manager_app_subscribe(app_id, update_interval_s, expire_s, features); fake_system_task_callbacks_invoke_pending(); HRMSubscriberState *subscriber = prv_get_subscriber_state_from_ref(session_ref); cl_assert(subscriber); ...
prv_get_subscriber_state_from_ref(session_ref)
== NULL); cl_assert(sys_hrm_manager_get_app_subscription(app_id) == HRM_INVALID_SESSION_REF); } // Test that system subscriptions expire correctly void test_hrm_manager__kernel_expiration(void) { stub_pebble_tasks_set_current(PebbleTask_KernelBackground); const uint16_t expire_s = SECONDS_PER_MINUTE; HRMSess...
CALLED(prv_fill_rect_aa(&context, &GRect(10, 20, 40, 10), 0, GCornerNone, GColorBlack)); #endif setup_test(&context, true, 5, GColorBlack, GColorBlack, false); graphics_fill_circle(&context, GPoint(50, 50), 10); #if PBL_COLOR ASSERT_CALLED(graphics_internal_circle_quadrant_fill_aa(&context, GPoint(50, 50), 10, G...
GPoint(50, 50)
, 10)); ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4)); ASSERT_NO_CHANGE(graphics_fill_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_fill_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHANGE(graphics_fill_round_rect(&context, &GRect(20, 80, 40, 10), 4, GC...
il_log_two(uint32_t n) { int ours = ceil_log_two(n); int theirs = ceil(log_two(n)); cl_assert(ours == theirs); } void test_math__initialize(void) { } void test_math__cleanup(void) { } void test_math__atan2(void) { check_atan2(10, 14); check_atan2(3, 5); check_atan2(5, 3); check_atan2(10, 10); check_a...
WITHIN(min, min, max)
) { if (irk_out && irk_in) { *irk_out = *irk_in; } if (device_out && device_in) { *device_out = *device_in; } if (name_out && name_in) { strncpy(name_out, name_in, BT_DEVICE_NAME_BUFFER_SIZE); name_out[BT_DEVICE_NAME_BUFFER_SIZE - 1] = '\0'; } } bool bt_persistent_storage_get_ble_pairing_b...
if (info->val_len == 0 || info->key_len != sizeof(BTBondingID)) { return true; // continue iterating }
BTBondingID *first_ancs_supported_bonding_found = (BTBondingID *) context; BtPersistBondingData stored_data; info->get_val(file, (uint8_t*) &stored_data, MIN((unsigned)info->val_len, sizeof(stored_data))); if (stored_data.type == BtPersistBondingTypeBLE && stored_data.ble_data.supports_ancs) { // Save ...
8, 920, 248}, { -48, 912, 248}, { -48, 920, 248}, { -48, 912, 256}, { -48, 912, 248}, { -56, 920, 248}, { -48, 920, 256}, { -48, 912, 256}, { -56, 920, 256}, { -48, 920, 256}, { -56, 912, 248}, { -48, 920, 256}, { -48, 912, 240}, { -48, 920, 264}, // 156 seconds ...
{ -40, 920, 248}, { -40, 920, 240}, { -40, 920, 248}, { -40, 920, 248}, { -40, 920, 248}, { -40, 920, 248}, { -48, 920, 248}, { -40, 912, 240}, { -40, 920, 248}, { -48, 912, 248}, { -40, 920, 240}, { -40, 920, 248}, { -40, 920, 240}, { -40, 920, 248}, { -40, 9...
{ -40, 920, 240}, { -40, 928, 248}, { -48, 920, 248}, { -40, 920, 248}, { -40, 920, 256}, { -48, 920, 256}, { -40, 920, 256}, { -48, 912, 256}, { -48, 912, 256}, { -40, 920, 248}, { -32, 920, 248}, { -40, 920, 248}, { -48, 920, 240}, { -40, 920, 248}, { -40, ...
qual_i(item->action_group.actions[1].attr_list.num_attributes, 2); cl_assert_equal_i(item->action_group.actions[1].attr_list.attributes[0].id, AttributeIdTitle); cl_assert_equal_s(item->action_group.actions[1].attr_list.attributes[0].cstring, "Like"); cl_assert_equal_i(item->action_group.actions[1].attr_list.attr...
string_list_get_at(list, 3)
); // 4 strings (first and last two are empty) list->serialized_byte_length = 4; list->data[0] = '\0'; list->data[1] = 'b'; list->data[2] = '\0'; list->data[3] = '\0'; // end of data list->data[4] = '\0'; cl_assert_equal_i(4, string_list_count(list)); cl_assert_equal_s("", string_list_get_at(list, 0)...
e 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 "menu_layer_right_icon.h" #include "applib/app.h" #include "applib/ui/ui.h" #i...
{ AppData *data = app_malloc_check(sizeof(AppData)); app_state_set_user_data(data); push_window(data); }
static void handle_deinit() { AppData *data = app_state_get_user_data(); menu_layer_deinit(&data->menu_layer); app_free(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* menu_layer_right_icon_app_get_info() { static const PebbleProcessMdSyst...
toLocaleTimeString(undefined, " "{hour: undefined, minute: undefined, second: undefined});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "20:04:05"); EXECUTE_SCRIPT_EXPECT_ERROR( "d.toLocaleTimeString(undefined, {minute: 'numeric', hour: '2-digit'})", "TypeError: Unsupported options" ); } void te...
EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'short'});")
om version 1 to version 2, where all we // we need to do is recreate the file in a bigger size static void prv_settings_rewrite_cb(SettingsFile *old_file, SettingsFile *new_file, SettingsRecordInfo *info, void *context) { if (info->key_len != sizeof(ActivitySettingsKey)) { PBL_...
{ ActivityMetricInfo m_info; activity_metrics_prv_get_metric_info(metric, &m_info); if (m_info.has_history) { ActivitySettingsValueHistory history; settings_file_get(file, &m_info.settings_key, sizeof(m_info.settings_key), &history, sizeof(history...