prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
nutes, 0); activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes); cl_assert_equal_i(zone3_minutes, 0); // Add some "regular" heart rates. This shouldn't affect our zone counts prv_set_median_hr_for_minutes(70 /* BPM */, 3 /* minutes */); cl_assert_equal_b(prv_is_hr_elevated(), false); ...
activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes)
; cl_assert_equal_i(zone3_minutes, 0); } // --------------------------------------------------------------------------------------- // Test that we can add / delete an activity session void test_activity__activity_sessions_add_delete_sessions(void) { ActivitySession empty_session = {}; ActivitySession walk_acti...
{ if (test_image_color->addr) { free(test_image_color->addr); } free(test_image_color); } } static void setup_test_rotate_bitmap(GContext *ctx, FrameBuffer *fb, GRect clip_box, GRect drawing_box, GCompOp compositing_mode) { ...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_bw_set_center_45.Xbit.pbi"))
; } void test_graphics_draw_rotated_bitmap__offset_bw(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // No Clip, Angle 0, Offset setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_bw, ...
app_state_get_user_data(); AppMessageResult result = app_message_outbox_send(); if (result == APP_MSG_OK) { app_data->ready_to_send = false; } else { PBL_LOG(LOG_LEVEL_DEBUG, "Error sending message: %s", prv_translate_error(result)); } } static void prv_send_status_and_version(void) { AppData *app_d...
{ PBL_LOG_COLOR(LOG_LEVEL_DEBUG, LOG_COLOR_CYAN, "last PPG TIA sample is 0!"); }
sis, GTextAlignmentCenter, NULL); } void draw_text_single_line_ellipsis_clip_outside_ny(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, -40, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCe...
(ctx, s_text_buffer, &s_font_info, GRect(80, 4, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL)
; } void canvas_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_rect(ctx, &GRect(39, 39, 82, 42)); } void test_graphics_draw_text_${BIT_DEPTH_NAME}__clipping(void) { GContext ctx; Layer canvas; Layer layer; prv_setup_resources(); uin...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return false; }
if (endpoint_id != TIMELINE_ACTION_ENDPOINT) { return false; } cl_assert_equal_m(s_expected_send_data, data, length); s_sent_action = true; return true; } // Setup ///////////////////////// void test_timeline_actions__initialize(void) { s_expected_send_data = NULL; s_sent_action = false; } void ...
(recognizer)
; } } void click_manager_clear(ClickManager* click_manager) { for (unsigned int button_id = 0; button_id < ARRAY_LENGTH(click_manager->recognizers); ++button_id) { prv_click_reset(&click_manager->recognizers[button_id]); click_manager->recognizers[button_id].config = (ClickConfig){}; } } void cli...
ALUE_LENGTH; } #if !SUPPORTS_PACKET_LENGTH_EXTENSION return ((att_error_t)PebblePairingServiceGATTError_DeviceDoesNotSupportPLE); #else if (ple_req->trigger_ll_length_req) { extern void hci_initiate_length_change(uint16_t conn_idx); hci_initiate_length_change(conn_idx); } else { PBL_LOG(LOG_LEVEL_D...
prv_send_notification(conn_idx, s_pps_ctx.att_hdl.conn_params)
; } static void prv_convert_uuid_to_little_endian(const uint8_t *buf, att_uuid_t *uuid) { uint8_t *reverse_uuid = (uint8_t *)&UuidMakeFromLEBytes(buf); ble_uuid_from_buf(reverse_uuid, uuid); } static void prv_register(PebblePairingServiceCtx *ctx, uint16_t start_hdl) { *ctx = (PebblePairingServiceCtx) { .sv...
, &it->cursor.index, true); it->cell_bottom_y = it->cursor.y + it->cursor.h; // ROW if (it->row_callback_after_geometry) { it->row_callback_after_geometry(it); } if (it->should_continue == false) { return; } // Next row: it->cursor.sep = prv_menu_layer_g...
it->menu_layer->callbacks.get_num_rows(it->menu_layer, it->cursor.index.section, it->menu_layer->callback_context)
; } // for() sections } static void NOINLINE prv_draw_background(MenuLayer *menu_layer, GContext *ctx, Layer *bg_layer, bool highlight) { GDrawState prev_state = graphics_context_get_drawing_state(ctx); const GRect *bounds = &bg_layer->bounds; ctx->draw_state.drawing_box.origi...
layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_nx_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb)...
framebuffer_init(&fb, &(GSize) {DISP_COLS, DISP_ROWS})
; test_graphics_context_init(&ctx, &fb); // AA = true, SW has no effect, all corners setup_test_aa_sw(&ctx, &fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_context_set_fill_color(&ctx, GColorBlue); graphics_fill_rect(&ctx, &GRect(10, 10, 100, 140)); graphics_context_set_fill_color(&ctx, ...
uted 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. */ #if PULSE_EVERYWHERE #include "pulse_protocol_impl.h" #include "pulse2_reliable_retransmit_timer.h" #inclu...
(&packet->i.information[0], information, info_length)
_point_add_vector_precise(&(pt).xy, &(pt).fill_delta)); for (size_t i = 0; i < s_rocky_path_steps_num; i++) { RockyAPIPathStep *const step = &s_rocky_path_steps[i]; switch (step->type) { case RockyAPIPathStepType_MoveTo: { prv_fill_points(points, points_num); points_num = 0; ADD...
if (s_rocky_path_steps_num < 2) { return jerry_create_undefined(); }
36}, { 1104, 32, 136}, { 1064, 48, 168}, { 1096, 104, 224}, { 1088, 216, 264}, { 1176, 224, 296}, { 1144, 248, 304}, { 1016, 312, 200}, { 1024, 248, 72}, { 1080, 48, -64}, { 1128, -152, -288}, { 1136, 32, -504}, { 984, 176, -368}, { 1008, 248, -288}, { 1008, 8, -8...
{ 936, 408, -168}, { 992, 256, -376}, { 912, 160, -216}, // 139 seconds { 920, 224, -120}, { 1016, 304, -144}, { 1096, 352, -96}, { 1088, 352, 24}, { 984, 328, 104}, { 1088, 336, 200}, { 1280, 328, 192}, { 960, 296, 176}, { 1104, 264, 72}, { 944, 104, 0}, { 92...
{ 1104, -56, -48}, { 1096, -16, -128}, { 1104, -88, -200}, { 1128, -168, -128}, { 1080, -160, -24}, { 1088, -176, 0}, { 1072, -144, -8}, { 1048, -104, -48}, { 1064, -120, -64}, { 1072, -168, -96}, // 142 seconds { 1064, -200, -128}, { 1080, -240, -144}, { 1048, -...
/* * 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_COMM_SESSION, &s_endpoints[0], strlen(data))
; cl_assert(receiver != NULL); g_default_kernel_receiver_implementation.write(receiver, (uint8_t *)data, strlen(data)); prv_assert_no_handler_calls(); g_default_kernel_receiver_implementation.finish(receiver); // CBs shouldn't immediately execute since they are pended on KernelBG prv_assert_no_handler_ca...
/* * 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; }
Animation *animation = property_animation_get_animation(prop_anim); animation_set_delay(animation, delay); animation_set_duration(animation, duration); animation_set_curve(animation, AnimationCurveEaseOut); loading_layer->animation = animation; animation_schedule(animation); }
turn false; // we found a valid entry } static bool prv_each_find_children(SettingsFile *file, SettingsRecordInfo *info, void *context) { FindChildrenInfo *find_info = (FindChildrenInfo *)context; if (info->val_len < (int)sizeof(SerializedTimelineItemHeader) || info->key_len != UUID_SIZE) { // malforme...
(&storage->file, storage->name, storage->max_size)
; if (FAILED(rv)) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to create settings file %s, rv = %"PRId32 "!", filename, rv); } } void timeline_item_storage_deinit(TimelineItemStorage *storage) { settings_file_close(&storage->file); } status_t timeline_item_storage_insert(TimelineItemStorage *storage, ...
_buffer_count = 0; s_dropped_char_count = 0; for (int i = 0; i < NUM_RX_BUFFERS; ++i) { prv_reset_buffer(&s_buffers[i]); } accessory_manager_set_state(AccessoryInputStateImaging); accessory_use_dma(true); s_timeout_timer = new_timer_create(); new_timer_start(s_timeout_timer, TIMEOUT_MS, prv_timeout_ti...
flash_read_bytes((uint8_t *)&region_hdr, base_address, sizeof(region_hdr))
; if (region_hdr.last_used > max_last_used) { max_last_used = region_hdr.last_used; last_used_idx = i; } } if (max_last_used == 0) { return false; } *addr = core_dump_get_slot_address(last_used_idx); if (core_dump_size(*addr, size) != S_SUCCESS) { return false; } *addr += si...
s_event(task, true); // Better to die in our sleep ... vTaskSuspend(NULL /* self */); // We don't expect someone to resume us. PBL_CROAK(""); } // --------------------------------------------------------------------------------------------- // Get the args for the current process const void *process_manager...
{ PBL_LOG(LOG_LEVEL_ERROR, "Failed to send event %u to app! Closing it!", e->type); // We could be called from a timer task callback, so post a kill event rather than call // process_manager_close_process directly. process_manager_put_kill_process_event(task, false); return false; }
tc_set_time(event_time - (2 * SECONDS_PER_HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("In 2 hours", time_buf); // June 9th 2015, 15:59:00 (T-00:01:00) rtc_set_time(event_time - (1 * SECONDS_PER_MINUTE)); clock_get_until_time(time_buf, sizeof(time_...
cl_assert_equal_s("Jun 16", time_buf)
n = ACTIVITY_INSIGHTS_SETTINGS_CURRENT_STRUCT_VERSION, \ .enabled = true, \ .summary = { \ .above_avg_threshold = 10, \ .below_avg_threshold = -10, \ .fail_threshold = -50, \ .activity = { \ .trigger_minute = (20 * MINUTES_PER_HOUR) + 30, \ .update_threshold_steps = 1000, \ .update...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Didn't find insight with key %s", insight_name); goto close; }
if (settings_out->version != ACTIVITY_INSIGHTS_SETTINGS_CURRENT_STRUCT_VERSION) { // versions don't match, bail out! PBL_LOG(LOG_LEVEL_WARNING, "activity insights struct version mismatch"); goto close; } rv = true; close: prv_close_settings_and_unlock(&file); } if (!rv) { /...
/* * 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 (is_subsector) { reg |= ERASE_IS_SUBSECTOR; }
RTC_WriteBackupRegister(RTC_BKP_FLASH_ERASE_PROGRESS, reg); return S_SUCCESS; } status_t flash_impl_clear_nvram_erase_status(void) { RTC_WriteBackupRegister(RTC_BKP_FLASH_ERASE_PROGRESS, 0); return S_SUCCESS; } status_t flash_impl_get_nvram_erase_status(bool *is_subsector, ...
364, -187}, { -456, 731, -348}, { -865, 975, -495}, { -1137, 1002, -509}, { -513, 661, -545}, { -1010, 835, -125}, { -920, 583, 200}, { -421, 534, 50}, { -645, 484, 175}, { -754, 548, -51}, { -660, 846, -81}, { -531, 649, -5}, { -469, 500, 96}, { -510, 365, 109}, ...
{ -905, 1160, -374}, { -781, 1186, -273}, { -1276, 551, 220}, { -683, 402, 145}, { -502, 411, 224}, { -716, 640, 20}, { -648, 767, -96}, { -542, 790, 33}, { -499, 638, 33}, { -474, 527, 115}, { -580, 422, 122}, { -672, 479, 106}, { -738, 661, 134}, { -831, 850, 13...
d test_app_inbox__multiple_writes_consume_from_message_handler(void) { prv_create_test_inbox_and_begin_write(); // Message 1: cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1)); cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // Message 2...
prv_create_test_inbox_and_begin_write()
; // One message, too large, so it should get dropped: cl_assert_equal_b(false, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, BUFFER_SIZE + 1)); cl_assert_equal_b(false, app_inbox_service_end(AppInboxServiceTagUnitTest)); // Begin another on...
r fired. bool data_seen_this_interval; } s_stop_mode_monitor; static bool prv_rx_irq_handler(UARTDevice *dev, uint8_t data, const UARTRXErrorFlags *err_flags); static bool prv_tx_irq_handler(UARTDevice *dev); static void prv_lock(void) { if (mcu_state_is_isr()) { // assume we're in an ISR for the UART and do...
(ACCESSORY_UART, prv_tx_irq_handler)
; uart_set_baud_rate(ACCESSORY_UART, s_baudrate); uart_set_rx_interrupt_enabled(ACCESSORY_UART, true); } static void prv_initialize_hardware(void) { periph_config_acquire_lock(); gpio_output_init(&BOARD_CONFIG_ACCESSORY.power_en, GPIO_OType_PP, GPIO_Speed_2MHz); gpio_output_set(&BOARD_CONFIG_ACCESSORY.power...
void test_graphics_draw_circle_${BIT_DEPTH_NAME}__origin_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 28, 28)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest...
(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 1)
me); const TimelineResourceSize icon_size = (config->mode == LayoutLayerModeCard) ? layout->impl->card_icon_size : TimelineResourceSizeTiny; prv_init_icon(layout, &icon_frame, icon_size, icon_resource, layout->impl->default_icon, config->app_id); timeline_layout_init_view(layout, layout->lay...
timeline_resources_get_gsize(icon_res_size)
; if ((icon_size.w > max_icon_size.w) || (icon_size.h > max_icon_size.h)) { // The icon is too large, use the fallback instead kino_reel_destroy(icon_reel); icon_reel = prv_create_kino_reel_with_timeline_resource( timeline_layout, icon_res_size, fallback_resource, TIMELINE_RESOURCE_NOTIFICATION_FL...
t->origin.x + (rect->size.w / 2), rect->origin.y + (rect->size.h / 2)); } bool grect_contains_point(const GRect *rect, const GPoint *point) { int16_t min_x = rect->origin.x; int16_t max_x = rect->origin.x + rect->size.w; if (min_x > max_x) { // edge case for non-standardized rects: int16_t temp = max_x; ...
{ GRect translated_rect = { .origin.x = ctx->draw_state.drawing_box.origin.x + rect.origin.x, .origin.y = ctx->draw_state.drawing_box.origin.y + rect.origin.y, .size = rect.size, }; return translated_rect; }
GRect grect_to_local_coordinates(const GRect rect, GContext *ctx) { GRect translated_rect = { .origin.x = -ctx->draw_state.drawing_box.origin.x + rect.origin.x, .origin.y = -ctx->draw_state.drawing_box.origin.y + rect.origin.y, .size = rect.size, }; return translated_rect; } bool grect_overlaps_gre...
y cautious to me, we shouldn't have to do this. stop_mode_disable(InhibitorMain); // Turn off power to internal flash when in stop mode periph_config_enable(PWR, RCC_APB1Periph_PWR); pwr_flash_power_down_stop_mode(true /* power_down */); periph_config_disable(PWR, RCC_APB1Periph_PWR); vTaskStartScheduler(...
task_init()
; memory_layout_setup_mpu(); board_early_init(); display_show_splash_screen(); kernel_applib_init(); system_task_init(); events_init(); new_timer_service_init(); regular_timer_init(); clock_init(); task_watchdog_init(); analytics_init(); register_system_timers(); system_task_timer_init(...
task) { if (s_compass_subscribers[task]) { s_compass_subscribers[task] = false; if (--s_compass_subscribers_count == 0) { // If this was the last subscribed process, then stop the compass // service if (s_high_freq_calib_active) { prv_calibration_time_expired_cb(NULL); s_ca...
ecomp_corr_add_raw_mag_sample((int16_t *)&mag_data, (s_saved_corr_present) ? s_saved_corr : NULL, new_corr)
; if (cal_status != MagCalStatusNoSolution) { PBL_LOG(LOG_LEVEL_INFO, "%s : %d %d %d (type = %d)", "Mag Corr", (int)new_corr[0], (int)new_corr[1], (int)new_corr[2], (int)cal_status); } bool locked_sol = (cal_status == MagCalStatusNewLockedSolutionAvail); if (locked_sol || ((cal_status ...
rt_equal_i(s_path_stroke_count, 0); cl_assert_equal_i(s_path_fill_count, 0); cl_assert_equal_i(s_circle_stroke_count, 1); cl_assert_equal_i(s_circle_fill_count, 1); prv_reset(); gdraw_command_list_get_command(command_list, 1)->hidden = true; gdraw_command_list_draw(ctx, command_list); cl_assert_equal_i(s...
(points, s_stroke_points, s_path_num_points)
); cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points)); prv_reset(); gdraw_command_image_draw(ctx, image, GPoint(-1, 1)); cl_assert_equal_i(s_path_num_points, 2); points[0] = GPoint(5, 2); points[1] = GPoint(4, -4); cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_poin...
/ Fakes //////////////////////////////////// #include "fake_spi_flash.h" // Stubs //////////////////////////////////// #include "stubs_analytics.h" #include "stubs_hexdump.h" #include "stubs_language_ui.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h"...
("Quiet Time", "Disabled", __FILE__)
; cl_assert_equal_i(strlen(first), i18n_ctx_get_length("badctxt", "Disabled")); cl_assert_equal_i(strlen(second), i18n_ctx_get_length("Quiet Time", "Disabled")); i18n_free_all(__FILE__); } void test_i18n__ctxt_notfound(void) { const char *first = i18n_ctx_get("badctxt", "Disabled", __FILE__); cl_assert(str...
00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, .timestamp = 10*60, .duration = 10, .type = TimelineItemTypePin, .all_day = false, .layout = LayoutIdCalendar, }, .attr_list = { .num_attributes = 1, .attributes = &title_attr, }, }; static Timelin...
timeline_event_handle_blobdb_event()
; cl_assert_equal_i(fake_event_get_count(), 3); cl_assert(!prv_get_calendar_ongoing()); cl_assert(!stub_new_timer_is_scheduled(timer_id)); } void test_calendar__init_with_ongoing_event(void) { cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); rtc_set_time(15 * 60); timeline_event_in...
uint8_t num_services = sys_ble_client_copy_services(device, services, BLE_GATT_MAX_SERVICES_CHANGED); if (num_services != 0) { handler(device.opaque, BLEClientServicesAdded, services, num_services, status); } } // TODO (PBL-22086): We should really mak...
applib_free(value)
ate granted_state); // Stubs ///// bool gap_le_connection_is_valid(const GAPLEConnection *conn) { return (conn != NULL); } GAPLEConnection *gap_le_connection_any(void) { return NULL; } void prv_regular_timer_spend_seconds(uint32_t seconds) { for (uint32_t i = 0; i < seconds; ++i) { fake_rtc_increment_ticks...
(state, ResponseTimeMin)
; cl_assert_equal_i(secs_to_wait, 25); cl_assert_equal_i(fake_gap_le_connect_params_get_last_requested(), ResponseTimeMin); // two requests at same high rate, longest time should be selected as timeout fake_gap_le_connect_params_reset_last_requested(); conn_mgr_set_ble_conn_response_time( &s_hdl, BtCon...
cache_buffer, sizeof(TestCacheItem), NUM_TEST_ITEMS, prv_comparator); for (int i = 0; i < ARRAY_LENGTH(s_test_item); i++) { s_free_flags[i] = false; } } void test_circular_cache__cleanup(void) { } // tests void test_circular_cache__push(void) { circular_cache_set_item_destructor(&s_tes...
(&s_test_cache, &s_test_item[0])
; circular_cache_push(&s_test_cache, &s_test_item[1]); circular_cache_push(&s_test_cache, &s_test_item[2]); 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); }
a = context; VOICE_LOG("Single session timeout"); prv_stop_dictation(data); } static void prv_handle_ready_error(VoiceUiData *data) { data->session_id = VOICE_SESSION_ID_INVALID; data->error_count++; if (data->error_count < MAX_ERROR_COUNT) { if (data->show_error_dialog) { prv_handle_error_retries...
(data, event)
; if (success) { if (data->state == StateRecording) { // Transition to unfold state (StateStopRecording) before pending a transition to the text // window prv_set_mic_window_state(data, StateTransitionToText); } prv_set_mic_window_state(data, StateTransitionTo...
EBUG("prv_assemble_packet, state:%d, bytes:%d", state->recv_state, bytes_avail); // Log message if we detected any receive errors if (state->recv_error_count) { PBL_LOG(LOG_LEVEL_ERROR, "%"PRIu32" receive errors detected", state->recv_error_count); state->recv_error_count = 0; } while (!ex...
*protocol = state->hdr.protocol; return state->msg_buffer; } else { return NULL; } }
n) { continue; } // use the first non-horizontal path segment's direction as the start direction if (rot_end.y != rot_start.y) { start_is_down = rot_end.y > rot_start.y; found_start_direction = true; } rot_end = rot_start; } const int16_t clip_min_x = ctx->draw_state.clip_b...
{ imprecise_points[i] = GPointFromGPointPrecise(points[i]); }
GPath path = { .num_points = (uint32_t)num_points, .points = imprecise_points }; gpath_draw_filled(ctx, &path); applib_free(imprecise_points); } void gpath_draw_outline_precise_internal(GContext *ctx, GPointPrecise *points, size_t num_points, bool open) { if...
buffer, last_save_time), last_save_time); PBL_LOG_VERBOSE("Restore RTC: current time: %s", time_t_to_string(buffer, s_time_base)); PBL_LOG_VERBOSE("Restore RTC: s_time_tick_base: %"PRId64, s_time_tick_base); #endif } static time_t ticks_to_time(RtcTicks ticks) { return s_time_base + ((ticks - s_time_tick_base) /...
if (ints_enabled) { __enable_irq(); }
ion_action_result( id, i18n_get("Can't connect. Relaunch Pebble Time app on phone.", &i18n_key), TIMELINE_RESOURCE_GENERIC_WARNING, ActionResultTypeFailure); } } static void prv_remove_pin_action(const TimelineItem *item, const TimelineItemAction *action, ...
analytics_event_health_insight_response(start_utc ?: item->header.timestamp, insight_type, activity_type, action->id)
(sb->written_length)
; comm_session_send_queue_add_job(session, (SessionSendQueueJob **)&sb); } // ------------------------------------------------------------------------------------------------- // Interfaces for testing SemaphoreHandle_t comm_session_send_buffer_write_semaphore(void) { return s_default_kernel_sender_write_semaphor...
_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 3); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r3_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&c...
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT)
; // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 3); graphics_draw...
) { return; } struct prv_missed_events_s *missed_events = (struct prv_missed_events_s*)context; WakeupId wakeup_id; info->get_key(old_file, (uint8_t*)&wakeup_id, sizeof(WakeupId)); WakeupEntry entry; info->get_val(old_file, (uint8_t*)&entry, info->val_len); if (struct_migration) { entry.timesta...
{ // Legacy apps get local time returned from the time() call. timestamp = time_local_to_utc(timestamp); }
time_t current_time = rtc_get_time(); int32_t time_difference = timestamp - current_time; WakeupId wakeup_id = s_wakeup_state.next_wakeup_id++; // Disallow scheduling past events if (time_difference <= 0) { return E_INVALID_ARGUMENT; } Uuid uuid = app_manager_get_current_app_md()->uuid; WakeupE...
const uint16_t endpoint_id) { MetaResponseInfo meta_response_info; meta_response_info.payload.error_code = prv_error_for_endpoint(endpoint, session); if (MetaResponseCodeNoError != meta_response_info.payload.error_code) { meta_response_info.payload.endpoint_id = endpoint_id; m...
{ if (prv_ignore_skipped_message_if_needed(&data, &data_size, rtr)) { return; // we're done } // Deal with the header: if (rtr->bytes_received < sizeof(PebbleProtocolHeader)) { if (prv_copy_header(rtr, &data_size, &data)) { return; // Incomplete header, wait for more data to come....
prv_cleanup_router(rtr); } } } void comm_session_receive_router_cleanup(CommSession *session) { ReceiveRouter *rtr = &session->recv_router; if (rtr->receiver_imp) { rtr->receiver_imp->cleanup(rtr->receiver); } // Wipe it, to avoid confusing ourselves when looking at core dumps: prv_cleanup...
/! - The app manager was not init, //! - The app's task handle or event queue aren't null //! - The app's metadata is null static bool prv_app_start(const PebbleProcessMd *app_md, const void *args, const AppLaunchReason launch_reason) { PBL_ASSERT_TASK(PebbleTask_KernelMain); PBL_ASSERTN(app_md); ...
(LOG_LEVEL_ERROR, "App state configuration failed")
; return false; } // The remaining space in app_segment is assigned to the app's heap. // app_state needs to be configured before initializing the app heap // as the AppState struct holds the app heap's Heap object. // Don't fuzz 3rd party app heaps because likely many of them rely on accessing free'd me...
stem/bootbits.h" #include "system/firmware_storage.h" #include "system/logging.h" #include "util/attributes.h" #include "util/net.h" #include <bluetooth/conn_event_stats.h> #include "FreeRTOS.h" #include "semphr.h" #include "clar.h" #include <limits.h> #include "fake_events.h" #include "fake_pbl_malloc.h" #include...
{ InitRequest init_msg = (InitRequest) { .cmd = CmdInit, .total_size = htonl(total_size), .type = object_type, .cookie = htonl(1), }; prv_receive_data(s_session, (const uint8_t *) &init_msg, sizeof(init_msg)); }
se { PBL_LOG(LOG_LEVEL_ERROR, "Invalid region (%"PRIu8")", request->region); } prv_send_frame(OPCODE_FLASH_GEOMETRY, &response, sizeof(response)); } static void prv_handle_flash_erase_request(const void *payload, uint32_t length) { if (length != sizeof(FlashEraseRequest)) { PBL_LOG(LOG_LEVEL_ERROR, "Inva...
{ boot_bit_set(BOOT_BIT_NEW_FW_AVAILABLE); }
else if (request->region == REGION_PFS) { // Do nothing! } else if (request->region == REGION_COREDUMP) { // Do nothing! } else { PBL_LOG(LOG_LEVEL_ERROR, "Invalid region (%"PRIu8")", request->region); } prv_send_frame(OPCODE_FLASH_FINALIZE, &response, sizeof(response)); } static void prv_process_...
BL_ASSERTN(session); size_t bytes_remaining = comm_session_send_queue_get_length(session); size_t mss = pulse_reliable_max_send_size() - sizeof(PulsePPPacket); while (bytes_remaining) { bt_unlock(); PulsePPPacket *resp = (PulsePPPacket*) pulse_reliable_send_begin(PULSE2_PEBBLE_PROTOCOL); bt_lock(); ...
{ PebbleEvent e = { .type = PEBBLE_BT_CONNECTION_EVENT, .bluetooth = { .connection = { .state = (s_transport.session) ? PebbleBluetoothConnectionEventStateConnected : PebbleBluetoothConnectionEventStateDisconnected } } }; event_put(&e); }
} static void prv_pulse_pp_transport_set_connected(bool connected) { bt_lock(); pulse_transport_set_connected(connected); bt_unlock(); } static void prv_pulse_pp_handle_data(void *data, size_t length) { bt_lock(); if (!s_transport.session) { PBL_LOG(LOG_LEVEL_ERROR, "Received PULSE serial data, but se...
tion_set_play_count(seq, repeat_count); // Now, clone it Animation *clone = animation_clone(seq); // Destroy the original animation_destroy(seq); prv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(clone); // Start A prv_advance_to_ms_with_timers(start_ms + 1); ...
(&s_started_handler_calls, a2)
/* * 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, animated)
; } static void handle_deinit(void) { struct AppState* data = app_state_get_user_data(); tick_timer_service_unsubscribe(); app_free(data); } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd* progress_app_get_info() { static const PebbleProcessMdSyst...
/* * 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_sector_addresses[i] <= address && address < s_sector_addresses[i+1]) { return i; }
} return ARRAY_LENGTH(s_sector_addresses)-1; } bool system_flash_erase( uint32_t address, size_t length, SystemFlashProgressCb progress_callback, void *progress_context) { dbgserial_print("system_flash_erase("); dbgserial_print_hex(address); dbgserial_print(", "); dbgserial_print_hex(length); db...
service_private_get_session(PebbleTask task) { if (task == PebbleTask_Unknown) { task = pebble_task_get_current(); } if (task == PebbleTask_App) { return app_state_get_accel_state(); } else if (task == PebbleTask_Worker) { return worker_state_get_accel_state(); } else { WTF; } } void accel...
if (state->deferred_free) { PBL_LOG(LOG_LEVEL_DEBUG, "Deferred free"); kernel_free(state); }
/* * 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...
(&result->command_list, 1)
->points, c1_points) COPY_POINTS(gdraw_command_list_get_command(&result->command_list, 2)->points, c2_points) COPY_POINTS(gdraw_command_list_get_command(&result->command_list, 3)->points, c3_points) COPY_POINTS(gdraw_command_list_get_command(&result->command_list, 4)->points, c4_points) return result; } GDrawC...
("s = d.toLocaleDateString(undefined, {hour: 'numeric'});")
; ASSERT_JS_GLOBAL_EQUALS_S("s", "07/25/05, 8 PM"); } void test_rocky_api_datetime__locale_string_options(void) { rocky_global_init(s_api); EXECUTE_SCRIPT("var d = new Date();"); s_clock_is_24h_style = false; EXECUTE_SCRIPT("s = d.toLocaleString(undefined, {});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "07/25/05,...
/* * 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 (!quiet) { APP_LOG(APP_LOG_LEVEL_ERROR, "Animation %d does not exist", (int)handle); } return NULL; }
return (AnimationPrivate *)node; } // ------------------------------------------------------------------------------------------- // Find animation by parent and child idx typedef struct { AnimationPrivate *parent; uint8_t child_idx; } ParentChildInfo; static bool prv_parent_list_filter(ListNode* node, void* ...
/////////////////////////////////// #if SCREEN_COLOR_DEPTH_BITS == 8 extern GColor get_bitmap_color(GBitmap *bmp, int x, int y); #endif // @param color_index the color index (the value) to put into the bitmap at (x, y). // @param bpp Bits per pixel. // @para line_stride how many bytes per line in the bitmap data. void...
for (int x = 0; x < WIDTH; ++x) { packed_pixel_set(s_data, x /* color_index */, x, y, BITS_PER_PIXEL, s_bmp.row_size_bytes); }
} memset(dest_bitmap_data, GColorWhite.argb, sizeof(dest_bitmap_data)); #if SCREEN_COLOR_DEPTH_BITS == 8 char print_buf[20]; for (int y = 0; y < HEIGHT; ++y) { for (int x = 0; x < WIDTH; ++x) { snprintf(print_buf, sizeof(print_buf), "Failed index = %d, %d", x, y); cl_check_(gcolor_equal(get_bi...
////////////////////// VoiceWindow *voice_window_create(char *buffer, size_t buffer_size, VoiceEndpointSessionType session_type) { // if buffer is NULL, buffer_size must be 0 and if it is not NULL, buffer_size must be non-zero PBL_ASSERTN((buffer != NULL) == (buffer_size > 0)); ...
(e->data->sentence)
; } else { // if the buffer is allocated, truncate sentence to buffer size len = utf8_get_size_truncate(e->data->sentence, buffer_size); } if (len == 0) { return NULL; } char *sentence; if (buffer) { // do not allocate a buffer is one is allocated already sentence = buffer; } else { ...
- s_samples[idx_a][0], s_samples[idx_b][1] - s_samples[idx_a][1], s_samples[idx_b][2] - s_samples[idx_a][2] }; int32_t dist_sq = v_ab[0] * v_ab[0] + v_ab[1] * v_ab[1] + v_ab[2] * v_ab[2]; return (dist_sq > (thresh * thresh)); } static bool pt_to_line_dist_under_thresh(int idx_line_a, int idx_lin...
if ((x_delta < max_delta_thresh) && (y_delta < max_delta_thresh) && (z_delta < max_delta_thresh)) { int corrs[N_AXIS] = { 0 }; for (int i = 0; i < N_AXIS; i++) { for (int j = 0; j < N_COMP_SAMPS; j++) { corrs[i] += calib_val[i][j]; } solution[i] = corrs[i] / N_COMP_...
} return (MagCalStatusNewSolutionAvail); } static int s_sample_idx = 0; static int s_no_fit_strikes = 0; static int s_samples_collected_for_fit = 0; void ecomp_corr_reset(void) { s_no_fit_strikes = 0; s_samples_collected_for_fit = 0; s_sample_idx = 0; } MagCalStatus ecomp_corr_add_raw_mag_sample(in...
{ -656, 184, -352}, { -944, 696, -360}, { -1152, -16, -208}, { -800, 128, -496}, { -1168, 216, -440}, { -1264, 0, -128}, { -1864, 360, -560}, { -1192, -160, -72}, { -1048, 152, -256}, { -880, 64, -56}, { -616, 16, 24}, { -560, 56, 40}, { -696, 40, 0}, { -776, 88, -...
{ -600, -168, -360}, { -952, -40, -104}, { -888, 152, -176}, { -1208, 288, -312}, { -1208, 232, -184}, { -1384, 440, -176}, { -992, 256, -136}, { -1048, 248, -256}, { -1120, 128, -280}, // 18 seconds { -736, 40, -208}, { -408, 88, -256}, { -416, 64, -200}, { -936,...
{ -1256, 296, -472}, { -1248, -80, -128}, { -1928, 136, -304}, { -968, 24, -104}, { -1008, 160, -320}, { -912, 64, -240}, { -624, -152, -88}, { -536, -232, 64}, { -520, -232, -128}, { -856, -64, 56}, { -1056, -8, -64}, { -1136, 88, -160}, { -1320, -24, -88}, { -8...
ER_HOUR - SECONDS_PER_MINUTE)) { const int num_minutes = prv_round(-difference, SECONDS_PER_MINUTE, RoundTypeAlwaysUp) / SECONDS_PER_MINUTE; const char *str_fmt; if (capitalized) { str_fmt = i18n_noop("IN %lu MIN"); } else if (num_minutes == 1) { str_fmt = i18n_noop("In %lu minute")...
("this afternoon")
}, // 12pm today {18, i18n_noop("this evening")}, // 6pm today {21, i18n_noop("tonight")}, // 9pm today {33, i18n_noop("tomorrow morning")}, // 9am tomorrow {36, i18n_noop("tomorrow afternoon")}, // 12pm tomorrow {42, i18n_noop("tomorrow evening")}, // 6pm tomorrow {45, i18n_noop("tomorrow night")}, /...
/* * 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 APP_WORKER_RESULT_NO_WORKER; }
// Is there a worker already running? const PebbleProcessMd *md = worker_manager_get_current_worker_md(); if (md != NULL) { const PebbleProcessMd *app_process = app_manager_get_current_app_md(); if (uuid_equal(&md->uuid, &app_process->uuid)) { return APP_WORKER_RESULT_ALREADY_RUNNING; } /...
h = vsniprintf(msg->message + msg->message_length, max_message_len - msg->message_length, fmt, fmt_args); msg->message_length += message_length; if (msg->message_length > max_message_len) { msg->message_length = max_message_len; } } // ----------------------------------------------------------...
(true, CORE_ID_MAIN_MCU, packed_loghash, fmt_args)
pandable_dialog_push(s_dialog); confirmation_dialog_pop((ConfirmationDialog *)context); } static void prv_coredump_reset_decline_cb(ClickRecognizerRef recognizer, void *context) { ConfirmationDialog *confirmation_dialog = prv_settings_confirm("Core Dump", i18n_noop("Core dump and reboot?"), RESOURCE_ID_GENER...
(info->boot_version_string, sizeof(info->boot_version_string), "0x%" PRIx32, boot_version_read())
; bt_local_id_copy_address_mac_string(info->bt_mac_addr); // Ensure OTP strings are null-terminated mfg_info_get_serialnumber(info->serial_string, MFG_SERIAL_NUMBER_SIZE + 1); mfg_info_get_hw_version(info->hw_version_string, MFG_HW_VERSION_SIZE + 1); prv_populate_uptime_string(info); sniprintf(info->langu...
required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #inc...
prv_test_get_hit(2, 1)
; prv_test_get_hit(3, 0); prv_push(0); prv_test_get_hit(0, 2); prv_test_get_miss(1); prv_test_get_hit(2, 1); prv_test_get_hit(3, 0); prv_push(1); prv_test_get_hit(0, 2); prv_test_get_hit(1, 0); prv_test_get_hit(2, 1); prv_test_get_miss(3); prv_push(3); prv_test_get_hit(0, 2); prv_test_get...
(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_asse...
(&uuids[i], &r)
); compare_notifications(&e, &r); free(r.allocated_buffer); //Ensure that compression does not remove old notifications e.header.id = uuids[j]; e.header.timestamp = timestamp + j; cl_assert(notification_storage_get(&uuids[j], &r)); compare_notifications(&e, &r); free(r.allocated_buffer); //Add anoth...
f } #define RADIUS_DEFAULT 4 #define RECT_WIDTH 30 #define RECT_HEIGHT 40 #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 20, 20) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 144, 168) #define ORIGIN_DRAW_RECT_NO_CLIP ...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 4); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif // AA = true, SW = 5 setup...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
dbgserial_putchar_lazy(payload[i])
; } } void hc_endpoint_enqueue_hci_cmd(const uint8_t *hci_buf, uint8_t payload_len) { // skip the HCI_CMD byte since that's already encoded in the message hci_buf++; payload_len -= 1; hc_protocol_enqueue_with_payload(HcEndpointID_Hci, HcMessageID_Hci_Cmd, hci_buf, payload_...
eck(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__workout_render_walk_no_hrm(void) { s_hrm_is_present = false; s_workout_data = (WorkoutData) { .steps = 567, .duration_s = 84, .distance_m = 1234, .avg_pace = health_util_get_pace(84, 1234), .bpm = 71, .hr_z...
( ActivitySessionType_Run, &s_workout_data, &s_workout_controller)
/* * 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...
while (xQueueReceive(queue, &event, 0) == pdTRUE) { PBL_LOG(LOG_LEVEL_DEBUG, "Event type: %u", event.type); }
int size = 32; int result = 4; while (size != region->size) { PBL_ASSERT(size < region->size || size == 0x400000, "Invalid region size: %"PRIu32, region->size); size *= 2; ++result; } return result; } void mpu_enable(void) { MPU->CTRL |= (MPU_CTRL_ENABLE_Msk | MPU_CTRL_PRIVDEFEN...
PBL_ASSERTN(mpu_region->region_num == region_num)
; // Our FreeRTOS port makes the assumption that the ulParameters field contains exactly what // should be placed into the MPU_RASR register. It will figure out the MPU_RBAR from the // pvBaseAddress field. mpu_get_register_settings(mpu_region, &base_reg, &attr_reg); } memory_regions[re...
) - radius.raw_value) >> FIXED_S16_3_PRECISION, clip_min_x, clip_max_x); const int16_t x_max = CLIP((MAX(p0.x.raw_value, p1.x.raw_value) + radius.raw_value) >> FIXED_S16_3_PRECISION, clip_min_x, clip_max_x); // Blending of first line if (fract...
Fixed_S16_3 bottom_margin = {.raw_value = INT16_MIN}; // Find edges for right cap GPointPrecise right_point_tmp = (p0.x.raw_value > p1.x.raw_value) ? p0 : p1; Fixed_S16_3 progress_line = (Fixed_S16_3){.raw_value = (x * FIXED_S16_3_ONE.raw_value - ...
static void prv_adjust_stroked_line_width(uint8_t *width) { PBL_ASSERTN(*width >= MINIMUM_PRECISE_STROKE_WIDTH); if (*width % 2 == 0) { (*width)++; } } static void prv_draw_stroked_line_override_aa(GContext* ctx, GPointPrecise p0, GPointPrecise p1, uint8_t wid...
ize = GSize(bitmap_width, bitmap_height); s_dest_bitmap = gbitmap_create_blank(bitmap_size, CANVAS_GBITMAP_FORMAT); s_ctx.dest_bitmap = *s_dest_bitmap; s_ctx.draw_state.clip_box.size = bitmap_size; s_ctx.draw_state.drawing_box.size = bitmap_size; // Fill the bitmap with pink (on color) or white (on b&w) so ...
(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
; } void test_simple_dialog__does_text_fit(void) { const bool use_status_bar = true; const GSize icon_size = timeline_resources_get_gsize(TimelineResourceSizeLarge); char *msg = "1 line error"; bool text_fits = simple_dialog_does_text_fit(msg, DISP_FRAME.size, icon_size, use_status_bar); cl_assert(text_fits...
, -88}, { -976, -152, -144}, { -1344, 112, -344}, { -1400, 296, -464}, // 15 seconds { -1392, -32, -136}, { -1560, -160, 24}, { -1536, 224, -64}, { -1312, 344, -96}, { -1144, 416, 16}, { -1064, 320, -56}, { -1104, 280, -16}, { -1088, 168, 40}, { -968, 384, 176}, {...
{ -1152, -104, 8}, { -984, 120, -48}, { -848, 144, -80}, { -840, 120, -16}, { -872, 136, 40}, { -840, 152, 0}, { -968, 144, 72}, { -1208, -248, 296}, { -1120, -128, 112}, { -1400, -24, 168}, { -1552, 432, -336}, { -1384, 256, -352}, { -1320, 104, -88}, { -1216, -1...
{ -1448, 96, -80}, { -1432, 40, -80}, { -1312, 248, -200}, // 23 seconds { -1080, 240, -56}, { -904, 392, 16}, { -976, 320, 16}, { -936, 184, 56}, { -824, 208, 56}, { -768, 232, 96}, { -1032, 328, 88}, { -1312, 288, 120}, { -1504, 1264, 72}, { -1192, 384, 224}, ...
d_connection( BLECharacteristic characteristic_ref, GAPLEConnection **connection); extern SemaphoreHandle_t gatt_client_subscription_get_semaphore(void); extern void gatt_client_subscription_cl...
gatt_client_subscriptions_get_notification_header(GAPLEClientApp, &header)
ELINE_RESOURCE_GENERIC_QUESTION, }; AppResourceInfo icon_res_info; timeline_resources_get_id(&timeline_res, TimelineResourceSizeLarge, &icon_res_info); dialog_set_icon(dialog, icon_res_info.res_id); dialog_set_icon_animate_direction(dialog, DialogIconAnimationFromRight); dialog_set_callbacks(dialog, &(Dialo...
grect_align(&text_box, outer_box, align, true)
; graphics_draw_text(ctx, text, font, text_box, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); return text_box.size.h; } //! box is passed as a pointer to save stack space //! after this call, box will point to the GRect where //! the notification title was drawn void prv_dr...
s for the current AppMessage. int failure_count; AppTimer *app_msg_retry_timer; } out; struct { uint8_t *reassembly_buffer; size_t received_size_bytes; size_t total_size_bytes; } in; } s_state; //////////////////////////////////////////////////////////////////////////////// // Forward Decl...
app_message_outbox_begin(&it)
; if (!it) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to outbox_begin"); return; } size_t bytes_remaining; size_t payload_size; prv_calc_current_chunk_size(&bytes_remaining, &payload_size); OutgoingObject *obj = s_state.out.object_queue; // There is no dict_write_... API that lets us write a Tuple's by...
today(HealthMetricStepCount); steps -= before; PBL_LOG(LOG_LEVEL_DEBUG, "steps: %"PRId32, steps); if (steps >= 27 && steps <= 33) { passed = true; } prv_test_end(context, passed); } // ------------------------------------------------------------------------------- static void prv_test_30_min_walk(void...
activity_get_metric(ActivityMetricSleepEnterAtSeconds, 1, &value)
; PBL_LOG(LOG_LEVEL_DEBUG, "entry minute: %d", (int)(value / SECONDS_PER_MINUTE)); activity_get_metric(ActivityMetricSleepExitAtSeconds, 1, &value); PBL_LOG(LOG_LEVEL_DEBUG, "exit minute: %d", (int)(value / SECONDS_PER_MINUTE)); activity_get_metric(ActivityMetricSleepState, 1, &value); PBL_LOG(LOG_LEVEL_DEB...
S, 0x5); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V18_CUR_LIM_RET, 0xA); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V14_RET_CYCLES, 0x2); REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V14_CUR_LIM_RET, 0x6); REG_SETF(DCDC, DCDC_TRIM_REG, DCDC_P_COMP_MAN_TRIM, 0x0); REG_SETF(DCDC, DCDC_TRIM_REG, DCDC_P_COMP_TRIM, 0x0); REG_SETF(D...
(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_EXT_TX_MD, 0x0)
/* * 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 172; }
AppInstallId app_get_app_id(void) { return 0; } // --------------------------------------------------------------------------------------- static bool s_hrm_subscribed; static uint32_t s_hrm_expiration; HRMSessionRef sys_hrm_manager_app_subscribe(AppInstallId app_id, uint32_t update_interval_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...
(&bitmap_layer, &bitmap_layer_frame)
; Layer *layer = bitmap_layer_get_layer(&bitmap_layer); GRect bitmap_layer_bounds = bitmap_layer_frame; bitmap_layer_bounds.origin = bounds_origin; layer_set_bounds(layer, &bitmap_layer_bounds); bitmap_layer_set_bitmap(&bitmap_layer, &test_image); bitmap_layer_set_compositing_mode(&bitmap_layer, GCompOpAs...
true, false); window_render(window, app_state_get_graphics_context()); } click_manager_reset(app_state_get_click_manager()); } else if (window) { // Do not call 'disappear' handler on window displaced by modal window window_set_on_screen(window, false, false); } } static void prv_app_button_d...
window_stack_pop_all(app_window_stack, false)
; window_stack_unlock_push(app_window_stack); } // Get the app_id for the current app or worker // @return INSTALL_ID_INVALID if unsuccessful AppInstallId app_get_app_id(void) { // Only support from app or workers PebbleTask task = pebble_task_get_current(); if ((task != PebbleTask_App) && (task != PebbleTask_...
ne 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_gap_le_advert__job_round_robin_multiple_terms(void) { GAPLEAdvertisingJobTerm advert_terms[2] = { { .min_interval_slots = 160, ...
create_ad(NULL, scan_resp_data)
; advert_term.min_interval_slots = 159; advert_term.max_interval_slots = 159; job = gap_le_advert_schedule(ad_scannable, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert_equ...
e_range_change(connection, range); // Let's spawn a new discovery gatt_client_discovery_discover_range(connection, range); return true; } //////////////////////////////////////////////////////////////////////////////////////////////////// // Server -- Pebble serving up the "Service Changed" characteristic to t...
{ bt_lock(); { connection->gatt_service_changed_att_handle = handle; } bt_unlock(); }
////////////////////////////////// // Prompt commands ////////////////////////////////// void command_ble_send_service_changed_indication(void) { prv_send_service_changed_indication(gap_le_connection_any()); } void command_ble_rediscover(void) { // assume we only have one connection for debug GAPLEConnection ...
opy if (left <= length) { goto _out_of_size; } memcpy(dest_str, fmt, length); dest_str += length; left -= length; fmt = ptr + 1; // End of string if (*ptr == '\0' || *fmt == '\0') { break; } char pad = '\0'; size_t width = 0; // Process flags // These a...
FMT_INTCOPY(prv_iso8601_year(t) % 100, 2, INTFMT_PADZERO)
/* * 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...
RTC_ReadBackupRegister(REBOOT_REASON_DROPPED_EVENT)
/* * 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...
prompt_send_response("Root Key hexdumps:")
; prompt_send_response(" IRK:"); if (irk) { PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, (uint8_t *)irk, sizeof(SM128BitKey)); } else { prompt_send_response(" None"); }; prompt_send_response(" ERK:"); if (erk) { PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, (uint8_t *)erk, sizeof(SM128BitKey)); } else { ...
S_SUCCESS); AppGlance read_back_glance = {}; cl_assert_equal_i(app_glance_db_read_glance(&APP_GLANCE_TEST_UUID, &read_back_glance), S_SUCCESS); cl_assert_equal_i(read_back_glance.slices[0].expiration_time, APP_GLANCE_SLICE_NO_EXPIRATION); } // Glance Tests //////////////////////////////////////////////...
(NULL, &time_out)
, E_INVALID_ARGUMENT); // NULL time_out fails cl_assert_equal_i(app_glance_db_read_creation_time(&APP_GLANCE_TEST_UUID, NULL), E_INVALID_ARGUMENT); } void test_app_glance_db__empty_glance_insert_after_basic_glance_insert_succeeds(void) { // Call the basic glance insert test to insert the bas...
ONT_KEY_GOTHIC_18), GColorBlack, GColorClear, text_alignment, GTextOverflowModeTrailingEllipsis); layer_add_child((Layer *)peek_layer, (Layer *)&peek_layer->subtitle.text_layer); // initialize labels with empty strings peek_layer_clear_fields(pe...
peek_layer_set_fields_hidden(peek_layer, false)
; } void peek_layer_set_scale_to_image(PeekLayer *peek_layer, const TimelineResourceInfo *timeline_res, TimelineResourceSize res_size, GRect icon_to, bool align_in_frame) { GRect icon_from = GRectZero; KinoReel *prev_reel = kino_layer_get_reel(&...
_timer(); time_ms = prv_now_ms(); DPRINTF("%"PRIu64": value at: %d\n", time_ms - start_ms, value); cl_assert(max_loops > 0); max_loops--; } // Make sure the frame reached the "to" state cl_assert_equal_i(value, 100); // Make sure our started and stopped handlers got called cl_assert_equal_i...
(prop_h, &test_value)
; cl_assert_equal_point(test_value, set_value); set_value = GPoint(44, 45); property_animation_set_to_gpoint(prop_h, &set_value); property_animation_get_to_gpoint(prop_h, &test_value); cl_assert_equal_point(test_value, set_value); // Destroy it animation_destroy(h); #endif } // ----------------------...
lpha = (data->alpha + 0x40) & ALPHA_100; set_text_layers(data); } else if (data->property == PROPERTY_COLOR_TABLE) { if (s_color_table == color_table_hsv) { s_color_table = color_table_hvs; } else if (s_color_table == color_table_hvs) { s_color_table = color_table_hsv; } } layer_mark_d...
{ AppData *data = window_get_user_data(s_window); Layer *window_layer = window_get_root_layer(window); GRect window_bounds = window_layer->bounds; // Create Layer s_canvas_layer = layer_create(GRect(0, 0, window_bounds.size.w, window_bounds.size.h)); layer_add_child(window_layer, s_canvas_layer); // Set...
static void main_window_unload(Window *window) { // Destroy Layer layer_destroy(s_canvas_layer); } static void init(void) { AppData *data = task_malloc(sizeof(AppData)); if (!data) { return; } memset(data, 0x00, sizeof(AppData)); s_window = window_create(); window_set_user_data(s_window, data); ...
/* * 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 (data->alpha == ALPHA_33) { alpha_percent = 25; // FIXME: Currenlty don't support 33 } else if (data->alpha == ALPHA_0) { alpha_percent = 0; }
snprintf(data->alpha_text_buffer, sizeof(data->alpha_text_buffer), " a = %d %%", alpha_percent); if (data->property == PROPERTY_ALPHA) { set_text_element(data->alpha_text, data->alpha_text_buffer, true); } else { set_text_element(data->alpha_text, data->alpha_text_buffer, false); } // Set FG Text ...
src_bitmap->bounds.size.w)); // how many 32-bit blocks do we need to bitblt on this row: const int16_t dest_end_x = (dest_rect.origin.x + dest_rect.size.w); const uint8_t num_dest_blocks_per_row = (dest_end_x / 32) + ((dest_end_x % 32) ? 1 : 0) - dest_begin_x; ...
(tint_color)
")); // TODO: Fix offset calculation and reenable this: - PBL-16509 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 10); graphics_line_draw_precise_stroked_aa(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_same_point_...
(&ctx.dest_bitmap, "draw_stroke_precise_across_x_offset_layer_non_aa.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 10); graphics_line_draw_precise_stroked_non_aa(&ctx, START_ON_ORIGIN_RECT_NXNY, END_ON_ORIGIN_RECT_NXNY, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_offset_layer_non_aa.${BIT_DEPTH_NAME}.pbi"));...
if (prv_can_turn_sensor_on()) { RtcTicks cur_ticks = rtc_get_ticks(); int32_t remaining_ticks = INT32_MAX; const int32_t spin_up_ticks = (int32_t)milliseconds_to_ticks( HRM_SENSOR_SPIN_UP_SEC * MS_PER_SECOND); // Loop through each of the subscribers ...
if (turn_sensor_on && !hrm_is_enabled(HRM)) { // Turn on the sensor now HRM_LOG("Turning on HR sensor"); s_manager_state.accel_state = sys_accel_manager_data_subscribe( ACCEL_SAMPLING_25HZ, prv_handle_accel_data, NULL, PebbleTask_NewTimers); accel_manager_set_jitterfree_sampling...
d(context, record_utc, &cbuf_record->data.base, cbuf_record->data.heart_rate_bpm); if (done) { // we are done goto exit; } } // Finally, get the data for the partial last minute that has not even been saved to the circular // buffer yet t...
prv_unlock()
; if (success) { *num_records = context.num_records; *minutes = context.num_records * ALG_MINUTES_PER_FILE_RECORD; *data_bytes = *minutes * sizeof(AlgMinuteFileSample); } else { *num_records = 0; *minutes = 0; *data_bytes = 0; } return success; } // -----------------------------------...
/* * 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...
{ for (int i = 0; i < num_instances && i < NUM_AMS_INSTANCES; i++) { ams_handle_service_discovered(&s_characteristics[i][0]); } }
else { ams_invalidate_all_references(); } } void test_ams__cannot_handle_any_characteristic_after_destroy(void) { prv_discover_ams(1); ams_destroy(); prv_assert_can_handle_characteristics(0, false /* expect_can_handle */); } void test_ams__cannot_handle_unknown_characteristic(void) { prv_discover_ams(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...
cl_assert_(*malformed_test_string_utf8 == 0xcd, "Failed to invalidate an invalid UTF-8 test 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...
{ text_layer_init_with_parameters(text_layer, frame, NULL, NULL, GColorBlack, GColorWhite, GTextAlignmentLeft, GTextOverflowModeTrailingEllipsis); }
back_node_list, watch_list_find_str, (char *)filename); if (find_str == NULL) { node->name = kernel_strdup_check(filename); } else { node->name = ((PFSFileChangedCallbackNode *)find_str)->name; } s_head_callback_node_list = list_prepend(s_head_callback_node_list, &node->list_node); mutex_unlock_recur...
{ PBL_CROAK("Cannot delete %s, it is currently in use", PFS_FD(fd).file.name); }
page = PFS_FD(fd).file.start_page; mark_fd_free(fd); } else if ((rv = locate_flash_file(name, &page)) != S_SUCCESS) { goto cleanup; // could not find the file on flash } rv = unlink_flash_file(page); // IMPORTANT: prv_invoke_watch_file_callbacks assumes that we already have s_pfs_mutex prv_invok...
Waiting(s_pulse_task_queue) == 0) { s_pulse_task_idle = true; xSemaphoreTake(s_pulse_task_service_semaphore, timeout); s_pulse_task_idle = false; // Read the timer state again in case it changed while we were waiting. timeout = prv_poll_timer(&timer_sequence_number); } // Even if...
(s_pulse_task_queue, &c, &tmp)
; xSemaphoreGiveFromISR(s_pulse_task_service_semaphore, &tmp); *should_context_switch = (tmp == pdTRUE); } static bool prv_safe_to_touch_mutex(void) { return !(portIN_CRITICAL() || mcu_state_is_isr() || xTaskGetSchedulerState() != taskSCHEDULER_RUNNING); } void *pulse_link_send_begin(const uint16_t p...
if (icon_align == GAlignTop) { icon_frame_size = GSizeZero; } } else { subtitle_text_frame_height = 0; } } else { icon_frame_size = GSizeZero; } } // We'll reuse this rect to conserve stack space; here it is used as the title text frame GRect rect = (GRect) { ...
if (icon_align == GAlignLeft) { subtitle_text_frame_origin_y += icon_on_left_title_subtitle_vertical_spacing_offset; }
// Reuse rect as the subtitle text frame rect = (GRect) { .origin = GPoint(cell_layer_bounds_origin_x, subtitle_text_frame_origin_y), .size = GSize(cell_layer_bounds_size.w, subtitle_text_frame_height) }; graphics_draw_text(ctx, config->subtitle, subtitle_font, rect, config->overflow_mode, ...