prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
bs_gatt_client_subscriptions.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stubs_regular_timer.h" uint16_t gaps_get_starting_att_handle(void) { return 4; } BLEService gatt_client_att_handle_get_service( GAPLECo...
{ gatt_service_changed_server_handle_fw_update(); gap_le_connection_remove(&s_device); s_connection = NULL; static const int max_times = 5; for (int i = 0; i < max_times + 1; ++i) { gap_le_connection_add(&s_device, NULL, false /* local_is_master */); s_connection = gap_le_connection_by_device(&s_de...
void test_gatt_service_changed_server__disconnect_during_delay(void) { gatt_service_changed_server_handle_fw_update(); prv_cccd_write(true /* is_subscribing */); // Grab the timer ID: TimerID t = s_connection->gatt_service_changed_indication_timer; s_connection->gatt_service_changed_indication_timer = TIME...
t bool is_mute_weekdays = mute_option == MuteBitfield_Weekdays; const bool is_mute_weekends = mute_option == MuteBitfield_Weekends; if (is_mute_weekdays || is_mute_weekends) { action_menu_level_add_action(root_level, mute_label_buf, pr...
window_long_click_subscribe(BUTTON_ID_SELECT, 1000, prv_select_long_click_handler, NULL)
if (option_menu->callbacks.draw_row) { option_menu->callbacks.draw_row(option_menu, ctx, cell_layer, &remaining_rect, cell_index->row, is_selected, option_menu->context); } } static void prv_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { ...
(option_menu, config->content_type)
; option_menu_set_status_colors(option_menu, config->status_colors.background, config->status_colors.foreground); option_menu_set_highlight_colors(option_menu, config->highlight_colors.background, config->highlight_colors.foreground); option_menu_...
/* * 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...
(InhibitorCommMode)
(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, STROKE_SMALL)
; graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_SMALL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RE...
_state = WordStateIdeograph; } else if (codepoint == WORD_JOINER_CODEPOINT) { new_state = WordStateJoining; } else { new_state = WordStateGrowing; } break; case WordStateEnd: new_state = WordStateEnd; break; } return new_state; } //! @return true if init to ...
{ PBL_ASSERTN(utf8_iter_state->current == utf8_iter_state->bounds->end); return false; }
if (!iter_next(char_iter)) { break; } } return true; } static bool prv_line_iter_is_vertical_overflow(const LineIterState* const line_iter_state, const TextBoxParams* const text_box_params) { int16_t next_line_y_extent; // Normally, we lay out the...
DEFAULT_SHOW_BEFORE_TIME_S; CHECK_EVENT( .count = 2, .item_id = item->header.id, .num_concurrent = 0, .timeout_ms = timeout_s * MS_PER_SECOND, .time_type = TimelinePeekTimeType_SomeTimeNext, .is_first_event = true ); prv_invoke_timer(timeout_s); timeout_s = TIMELINE_PEEK_DEFAULT_SHOW...
prv_invoke_timer(timeout_s)
er *swap_layer = &s_notification_window_data.swap_layer; for (int i = 0; i < num_down_scrolls; i++) { prv_attempt_scroll(swap_layer, ScrollDirectionDown, false /* is_repeating */); fake_animation_complete(swap_layer->animation); swap_layer->animation = NULL; } // Force the display of the action butto...
prv_prepare_canvas_and_render_notification_windows(num_down_scrolls)
; FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE(); } void test_notification_window__title_subtitle_body(void) { s_test_data = (NotificationWindowTestData) { .icon_id = TIMELINE_RESOURCE_NOTIFICATION_GOOGLE_INBOX, .title = "Henry Levak", .subtitle = "Henry Levak sent you a 1-1 message", .body = "Good...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_install_entry_is_watchface(app_entry)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gpio_release(af_config->gpio)
; } void gpio_af_configure_fixed_output(const AfConfig *af_config, bool asserted) { GPIO_InitTypeDef init = { .GPIO_Pin = af_config->gpio_pin, .GPIO_Mode = GPIO_Mode_OUT, .GPIO_Speed = GPIO_Speed_2MHz, .GPIO_OType = GPIO_OType_PP, .GPIO_PuPd = GPIO_PuPd_NOPULL }; gpio_use(af_config->gpio); ...
izeof(exp_history)); exp_history[i] = 100; ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount, exp_history); prv_advance_by_days(1); } } // --------------------------------------------------------------------------------------- // Derived metrics like distance, calories, and walking minutes that are ...
fake_system_task_callbacks_invoke_pending()
; const int k_height_mm_2 = 1830; activity_prefs_set_height_mm(k_height_mm_2); activity_prefs_set_weight_dag(9100); activity_prefs_set_gender(ActivityGenderMale); activity_prefs_set_age_years(40); // Another day utc_sec += SECONDS_PER_DAY; rtc_set_time(utc_sec); prv_activity_init_and_set_enabled(tru...
} T_STATIC void prv_scroll_layer_set_content_offset_internal( ScrollLayer *scroll_layer, GPoint offset) { const GSize frame_size = scroll_layer->layer.frame.size; GRect bounds = scroll_layer->content_sublayer.bounds; const GPoint old_offset = bounds.origin; const int16_t min_x_offset = frame_size.w - bound...
{ return scroll_layer->content_sublayer.bounds.size; }
void scroll_layer_scroll(ScrollLayer *scroll_layer, ScrollDirection direction, bool animated) { GPoint offset = scroll_layer_get_content_offset(scroll_layer); int32_t scroll_height = 32; // If process is 3.x and has enabled paging if (prv_scroll_layer_is_paging_enabled(scroll_layer)) { uint16_t page_heig...
CS_LOG_DEBUG("Event %d - BT disconnection: Reason: %"PRIu8, event_blob.event, event_blob.bt_connection_disconnection.reason); analytics_logging_log_event(&event_blob); } // ------------------------------------------------------------------------------------------ // Log a bluetooth error void...
{ AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_BtLeAMS, .ams = { .type = type, .aux_info = aux_info, }, }; ANALYTICS_LOG_DEBUG("Event %d - AMS: type:%d aux_info: %"PRId32, event_blob.event, type, aux_info); analytics_logging_log_event(&event_blob); }
// ------------------------------------------------------------------------------------------ // Log stationary mode events void analytics_event_stationary_state_change(time_t timestamp, uint8_t state_change) { AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_StationaryModeSwitch, .sd = { .ti...
unfocusable modal, it should remain active cl_assert_equal_b(s_app_idle, false); // The app should retain focus PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT); cl_assert_equal_i(event.app_focus.in_focus, true); cl_assert_equal_i(window_stack_c...
{ window_stacks[idx] = modal_manager_get_window_stack(idx); windows[idx] = window_create(); window_stack_push(window_stacks[idx], windows[idx], true); // Modals are visible as we push from lowest priority to top most cl_assert_equal_b(windows[idx]->on_screen, true); }
// Only the top modal is visible modal_manager_event_loop_upkeep(); for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) { cl_assert_equal_b(windows[idx]->on_screen, (idx == NumModalPriorities - 1)); } // Pop all modals modal_manager_pop_all(); modal_manager_event_loop_upkeep...
ta, sizeof(s_test_impl_data), NULL, NULL)); s_test_impl.handle_touch_event = NULL; cl_assert_passert(recognizer_create_with_data(&s_test_impl, &s_test_impl_data, sizeof(s_test_impl_data), dummy, ...
(r, RecognizerState_Updated)
); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Cancelled)); cl_assert_passert(recognizer_transition_state(r, RecognizerState_Completed)); r->state = RecognizerState_Updated; recognizer_transition_state(r, RecognizerState_Cancelled); cl_assert_equal_i(event_type, RecognizerEvent_Cancelled...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
memset(dest_data, GColorGreen.argb, sizeof(dest_data))
; bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAssignInverted, GColorWhite); cl_assert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_assign-expect.8bit.pbi")); memset(dest_data, GColorGreen.argb, sizeof(dest_data)); bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCo...
un-aligned w.r.t. JerryScript's requirements: uint8_t *rocky_runtime_context_buffer; //! Aligned w.r.t. JerryScript's requirements, pointing into rocky_runtime_context_buffer. RockyRuntimeContext *rocky_runtime_context; RockyMemoryAPIContext *rocky_memory_api_context; #if CAPABILITY_HAS_APP_GLANCES AppGlanc...
s_app_state_ptr->initial_obstruction_origin_y); #if CAPABILITY_HAS_APP_GLANCES && !RECOVERY_FW app_glance_service_init_glance(app_state_get_glance()); #endif s_app_state_ptr->current_timeline_item_action_source = TimelineItemActionSourceModalNotification; }
NOINLINE void app_state_deinit(void) { animation_private_state_deinit(&s_app_state_ptr->animation_state); #if CAPABILITY_HAS_ACCESSORY_CONNECTOR app_smartstrap_cleanup(); #endif #if CAPABILITY_HAS_HEALTH_TRACKING health_service_state_deinit(app_state_get_health_service_state()); #endif unobstructed_area_servi...
BUTTON_ID_DOWN, ActionBarLayerIconPressAnimationMoveDown); action_bar_layer_add_to_window(data->action_bar, data->window); data->status_layer = status_bar_layer_create(); // Change the status bar width to make space for the action bar ...
(par_box_x_offset, par_label_y_offset, stroke_box_width, label_height)
); prv_setup_text_layer(text[TextParLabel], font_key_label, i18n_get("PAR", data), GTextAlignmentCenter); layer_add_child(background, text_layer_get_layer(text[TextParLabel])); // Par value. text[TextPar] = text_layer_create(GRect(par_box_x_offset, par_value_y_offset, ...
fo = { 6, (GPoint[]) { {40, 0}, {40, 0}, {0, 40}, {0, 40}, {80, 40}, {80, 40} } }; static const GPathInfo s_single_duplicate_path_info = { 2, (GPoint[]) { {40, 0}, {40, 0} } }; static const GPathInfo s_crossing_path_info = { 6, (GPoint[]) { {0, 40}, {20, 20}, ...
prv_reset()
; test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_left_clipped.${BIT_DEPTH_NAME}.pbi")); prv_reset(); test_graph...
{ s_prv_api_remove__callcount++; }
int s_prv_listener_a1__callcount; JERRY_FUNCTION(prv_listener_a1) { s_prv_listener_a1__callcount++; return jerry_create_undefined(); } int s_prv_listener_a2__callcount; JERRY_FUNCTION(prv_listener_a2) { s_prv_listener_a2__callcount++; return jerry_create_undefined(); } int s_prv_listener_b__callcount; JERRY...
EventServiceInfo fetch_event_info; EventServiceInfo connect_event_info; bool failed; } AppFetchUIData; static void prv_set_progress(AppFetchUIData *data, int16_t progress) { progress_window_set_progress(&data->window, progress); } // Launch the desired app static void prv_app_fetch_launch_app(AppFetchUIData *...
(&data->fetch_event_info)
; event_service_client_unsubscribe(&data->connect_event_info); } //! Used when the app fetch process has failed static void prv_app_fetch_failure(AppFetchUIData *data, uint8_t error_code) { PBL_LOG(LOG_LEVEL_WARNING, "App Fetch: prv_app_fetch_failure: %d", error_code); if (error_code == AppFetchResultUserCancel...
/* * 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...
("Default_Handler")
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 "applib/graphics/framebuffer.h" #include "applib/graphics/graphics.h" #include "apps/sys...
weather_app_layout_set_down_arrow_visible(&layout, true)
; window_render(&window, &s_ctx); } // Tests ////////////////////// void test_weather_app_layout__render_palo_alto(void) { const WeatherLocationForecast forecast = { .location_name = "PALO ALTO", .current_temp = 68, .today_high = 68, .today_low = 58, .current_weather_type = WeatherType_Sun, ...
/* * 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...
(ANIMATION_NORMALIZED_MAX, -20000, 20000)
, 20000); } void test_animation_interpolate__moook_out(void) { const int expected[] = {20004, 20002, 20001, 20000}; const int num_frames = ARRAY_LENGTH(expected); for (int i = 0; i < num_frames; i++) { printf("frame: %d\n", i); cl_assert_equal_i(interpolate_moook_out((i * ANIMATION_NORMALIZED_MAX) / num_...
"Animation state larger than allowed for 2.0 compatibility"); #endif // If this a legacy 2.0 application, instantiate the 2.0 legacy animation support #ifndef RECOVERY_FW if (process_manager_compiled_with_legacy2_sdk()) { animation_legacy2_private_init_scheduler((AnimationLegacy2Scheduler *)state); return...
{ if (animation_private_using_legacy_2(NULL)) { // 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. return (Animation *)animation_legacy2_create(); } AnimationPrivate *animation = applib_type_malloc(Ani...
// ------------------------------------------------------------------------------------------- bool animation_destroy(Animation *animation_h) { AnimationState *state = prv_animation_state_get(PebbleTask_Current); if (animation_private_using_legacy_2(state)) { // We need to enable other applib modules like sc...
/* * 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(grect_get_max_y(&(GRect){.origin.y = 1, .size.h = INT16_MAX}) < 0)
; text_layer.layer.frame.origin.y = 1; layer_add_child(&window.layer, &text_layer.layer); GPoint origin; GRect page; cl_assert(text_layer_calc_text_flow_paging_values(&text_layer, &origin, &page)); cl_assert_equal_i(page.origin.y, text_layer.layer.frame.origin.y); // must not overflow cl_assert(grect...
/* * 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...
(average_ms, 0)
; interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 0); cl_assert_equal_i(average_ms, 0); fake_rtc_increment_time_ms(1000); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_asse...
s_resources.h" #include "stubs_syscalls.h" // Stubs void graphics_context_set_stroke_color(GContext* ctx, GColor color) {} void graphics_context_set_fill_color(GContext* ctx, GColor color) {} void graphics_context_set_stroke_width(GContext* ctx, uint8_t stroke_width) {} void gpath_draw_stroke(GContext* ctx, GPath* pat...
(!gdraw_command_sequence_validate(sequence, size + 1))
; cl_assert(!gdraw_command_sequence_validate(sequence, 0)); sequence->num_frames = 0; cl_assert(!gdraw_command_sequence_validate(sequence, size)); sequence->num_frames = 1; cl_assert(!gdraw_command_sequence_validate(sequence, size)); sequence->num_frames = 3; cl_assert(!gdraw_command_sequence_validate(se...
/* * 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...
(clock_cmd)
) PERIPH_CONFIG_LOG("Disabling clock %s", prv_string_for_cmd(clock_cmd)); #endif portENTER_CRITICAL(); clock_cmd(rcc_bit, DISABLE); portEXIT_CRITICAL(); }
/* * 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...
free(node)
; node = next; } s_event_head = NULL; } static void prv_process_callback_events(void) { prv_process_callback_events_alt(true /* should_execute_callback */); } static void prv_cleanup_callback_events(void) { prv_process_callback_events_alt(false /* should_execute_callback */); } #define assert_num_callbac...
jerry_size_t buffer_size) { const jerry_size_t str_size = jerry_get_utf8_string_size(value); if (str_size == 0 || buffer_size < str_size || buffer_p == NULL) { return 0; } EM_ASM_INT({ var str = __jerryRefs.get($0); // Add one onto the buffer size, since Module....
{ return JERRY_CREATE_VALUE(new Object()); }
tart_row; dest_row != end_row; dest_row += delta) { src_bitmap->bounds = (GRect) { .origin.y = (dupe_row >= 0 ? dupe_row : dest_row) - shift_amount, .size = { DISP_COLS, 1 }, }; bitblt_bitmap_into_bitmap(dest_bitmap, src_bitmap, GPoint(0, dest_row), GCompOpAssign, G...
{ prv_duplicate_framebuffer_row(&dest_bitmap, app_dupe_row, app_offset_y + app_dupe_row, &app_bitmap, app_dupe_row); }
} framebuffer_dirty_all(compositor_get_framebuffer()); // Update modal position for transparent modals compositor_set_modal_transition_offset(GPoint(0, app_offset_y)); } static void prv_slide_transition_animation_init(Animation *animation) { // Give a regular moook more time to stretch the anticipation c...
>subject, result); } // ----------------------------------------------------------------------------------------- #if !defined(PLATFORM_TINTIN) void property_animation_update_gtransform(PropertyAnimation *property_animation_h, const uint32_t distance_normalized) { PBL_ASSER...
(Fixed_S32_16Setter)((PropertyAnimationImplementation*) property_animation->animation.implementation)
->accessors.setter.int16; setter(property_animation->subject, result); } // ----------------------------------------------------------------------------------------- static void prv_init(PropertyAnimationPrivate *property_animation, const PropertyAnimatio...
/* * 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 (recognizer->config.long_click.handler != NULL || recognizer->config.long_click.release_handler != NULL); }
static void prv_auto_repeat_single_click(ClickRecognizer *recognizer) { if (!recognizer->is_button_down) { // If this button isn't being held down anymore, don't re-register the timer. return; } ++(recognizer->number_of_clicks_counted); // Start the repetition timer: // Note: We're not using the tim...
/* * 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_equal_b(s_last_driver_addr_is_null, false)
; cl_assert_equal_m(&s_last_driver_addr, &TEST_PINNED_ADDR_2, sizeof(s_last_driver_addr)); } void test_local_addr__initialize(void) { memset(&s_last_bt_persist_pinned_addr, 0xff, sizeof(s_last_bt_persist_pinned_addr)); memset(&s_last_driver_addr, 0xff, sizeof(s_last_driver_addr)); s_last_bt_persist_pinned_addr...
2, CommSessionCloseReason_UnderlyingDisconnection); // The transport's .close is supposed to call this. // The stub in this test doens't, so clean up manually: comm_session_close(system_session, CommSessionCloseReason_UnderlyingDisconnection); } void test_session__get_app_session_multiple(void) { Transport *s...
(session, CommSessionCloseReason_UnderlyingDisconnection)
; } void test_session__send_next_not_called_when_session_closed_in_mean_time(void) { Transport *transport = (Transport *) TransportID1; CommSession *session = comm_session_open(transport, &s_transport_imp, TransportDestinationSystem); cl_assert_equal_b(comm_session_is_v...
: WTF; } // set the mode and enable the appropriate interrupts switch (transfer_type) { case DMARequestTransferType_Direct: this->stream->periph->CR &= ~DMA_SxCR_CIRC; this->stream->periph->CR |= DMA_SxCR_TCIE; break; case DMARequestTransferType_Circular: this->stream->peri...
(this->stream == stream)
; bool has_tc; bool has_ht; prv_get_and_clear_interrupt_flags(this, &has_tc, &has_ht); if (!has_tc && !has_ht) { // we shouldn't be here portEND_SWITCHING_ISR(should_context_switch); return; } switch (this->state->transfer_type) { case DMARequestTransferType_Direct: if (has_tc) { ...
= can_expire; } else { RecentApp app = { .id = install_id, .last_activity = cur_time, .can_expire = can_expire, }; circular_cache_push(&s_recent_apps.cache, &app); } } mutex_unlock_recursive(s_recent_apps.mutex); } #if UNITTEST void app_install_manager_flush_recen...
{ if (app_install_get_entry_for_install_id(APP_RECORDS[i].id, entry)) { // if a false is returned from the function, then stop iterating. if (cb(entry, data) == false) { kernel_free(entry); return; } } }
96, -304}, { 1040, -56, -296}, { 1096, -64, -288}, { 1424, -80, -304}, { 1592, -56, -328}, { 1224, -40, -232}, { 880, 16, -200}, { 904, 64, -264}, { 1088, -32, -176}, { 1280, -48, -120}, { 1160, -96, -80}, { 1056, -96, -96}, { 1008, -72, -96}, { 928, -80, -104}, {...
{ 848, 24, -472}, { 984, 72, -400}, { 1072, -32, -208}, { 992, -56, -176}, { 896, -48, -128}, { 936, -24, -120}, { 928, -16, -144}, { 960, -56, -128}, // 73 seconds { 968, -88, -160}, { 992, -72, -176}, { 1024, -64, -216}, { 1088, -96, -264}, { 1080, -96, -248}, ...
{ 960, -64, -32}, { 1144, -16, -32}, { 1832, -24, -152}, { 1760, 48, -72}, { 1464, 144, -272}, { 1032, 184, -376}, { 784, 248, -432}, { 984, 160, -312}, { 1072, 8, -176}, { 1136, -40, -136}, { 992, -40, -120}, { 912, -16, -192}, { 856, -32, -144}, { 968, -24, -23...
er_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert(prv_count_handler_entries(&s_update_handler_calls, a) >= test_duration/MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a),...
(&s_stopped_handler_calls, b)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0); // Complete B prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_e...
ox_service.h" #include "services/normal/app_outbox_service.h" #include "services/normal/music.h" #include "services/normal/music_endpoint.h" #include "services/normal/notifications/do_not_disturb.h" #include "services/normal/stationary.h" #include "services/normal/timeline/event.h" #include "shell/normal/app_idle_timeo...
(&e->bluetooth.app_info_event)
; analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_APP_INFO_COUNT, AnalyticsClient_System); return; case PEBBLE_MEDIA_EVENT: if (e->media.playback_state == MusicPlayStatePlaying) { app_install_mark_prioritized(APP_ID_MUSIC, true /* can_expire */); } return; case PEBBLE_HEALTH_...
->draw_state.tint_color = processor_with_data->saved_tint_color; } GColor launcher_app_glance_structured_get_highlight_color( LauncherAppGlanceStructured *structured_glance) { return PBL_IF_COLOR_ELSE(GColorBlack, structured_glance->glance.is_highlighted ? GColorWhite : GColorBlack); }...
fonts_get_font_height(font)
; return &underlying_text_node_text->node; } static void prv_structured_glance_title_dynamic_text_node_update( UNUSED GContext *ctx, UNUSED GTextNode *node, UNUSED const GRect *box, UNUSED const GTextNodeDrawConfig *config, UNUSED bool render, char *buffer, size_t buffer_size, void *user_data) { Launch...
/* * 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 ((const PebbleProcessMdFlash*) md)->process_version; }
return (Version) { 0, 0 }; } Version process_metadata_get_sdk_version(const PebbleProcessMd *md) { if (md->process_storage == ProcessStorageFlash) { return ((const PebbleProcessMdFlash*) md)->sdk_version; } return (Version) { PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR, PROCESS_INFO_CURRENT_SDK_VERSION_MINOR }...
e // window stack. WindowStack *window_stack = modal_manager_get_window_stack(ModalPriorityAlert); simple_dialog_push(crash_dialog, window_stack); #if PBL_ROUND // For circular display, reduce app name length until message fits on the screen // This has to occur after the dialog window load has been called t...
process_metadata_get_name(s_next_app.md)
); } PBL_LOG(LOG_LEVEL_WARNING, "Failed to start app <%s>! Restarting launcher", process_metadata_get_name(s_next_app.md)); prv_app_start(system_app_state_machine_system_start(), NULL, APP_LAUNCH_SYSTEM); } compositor_transition(s_next_app.common.transition); // Check if we've exited gr...
ializedTimelineItemHeader header = { .common.id = UUID_INVALID }; if (prv_find_next_notification(&header, prv_uuid_equal_func, (void *) uuid, fd)) { size = header.payload_length + sizeof(SerializedTimelineItemHeader); } else { PBL_LOG(LOG_LEVEL_DEBUG, "notification not found"); } prv_file_close(fd); ...
prv_find_next_notification(&header, prv_uuid_equal_func, (void *) id, fd)
) { prv_set_header_status(&header, status, fd); } prv_file_close(fd); } void notification_storage_remove(const Uuid *id) { notification_storage_set_status(id, TimelineItemStatusDeleted); } bool notification_storage_find_ancs_notification_id(uint32_t ancs_uid, Uuid *uuid_out) { PBL_ASSERTN(s_notif_storage...
GColor color) { PBL_ASSERTN(ctx); if (gcolor_is_invisible(color)) { return; } GDrawMask *mask = ctx->draw_state.draw_mask; PBL_ASSERTN(mask); const GBitmap *framebuffer = &ctx->dest_bitmap; const GBitmapDataRowInfo current_data_row_info = gbitmap_get_data_row_info(framebuffer, ...
if (!WITHIN(x, data_row_info.min_x, data_row_info.max_x)) { continue; }
ics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 3 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 3); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap...
(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 1)
"last boot. Restarting the erase...", erase_in_progress_address); // When an erase is interrupted, subsequent erases of the same sector tend to // take an exceptionally long time and may even outright fail. Try the erase a // few times before giving up. int attempt = 1; while (true) { status...
PBL_ASSERT(FAILED(status), "flash write unexpectedly succeeded: %" PRId32, status)
; } else { #endif PBL_ASSERT(PASSED(status), "flash_impl_get_write_status returned %" PRId32, status); #ifdef TEST_FLASH_LOCK_PROTECTION } #endif buffer += written; start_addr += written; buffer_size -= written; // Give higher-priority tasks a chance to access the flash in bet...
LOBAL_EQUALS_S("t", "function"); // rocky.off exists EXECUTE_SCRIPT( "t = typeof _rocky.off;\n" "var eq = _rocky.off === _rocky.removeEventListener;\n" ); ASSERT_JS_GLOBAL_EQUALS_S("t", "function"); ASSERT_JS_GLOBAL_EQUALS_B("eq", true); // from MDN docs: // Calling removeEventListener() with ar...
rocky_global_init(apis)
; s_prv_api_add__result = true; EXECUTE_SCRIPT("var is_called = false; _rocky.on('a', function(e) { is_called = true; });"); jerry_value_t a_event = rocky_global_create_event("a"); rocky_global_call_event_handlers_async(a_event); ASSERT_JS_GLOBAL_EQUALS_B("is_called", false); s_process_manager_callback(s_...
orked Mc'Rib", .common = { .is_unprivileged = true, .process_storage = ProcessStorageFlash, // UUID: 25a9e7ff-de9e-4dda-b745-afdd75aaa53b .uuid = {0x25, 0xa9, 0xe7, 0xff, 0xde, 0x9e, 0x4d, 0xda, 0xb7, 0x45, 0xaf, 0xdd, 0x75, 0xaa, 0xa5, 0x3b}, }, .sdk_version = {.major = PROCESS_INFO_CURRENT_SDK_V...
{ if (app_md == (PebbleProcessMd *)&s_borked_app) { return NULL; } else { return __APP_RAM__; } }
void quick_launch_handle_analytics(void) { } void reboot_set_slot_of_last_launched_app(uint32_t app_slot) { } void sys_exit(int status) { } RockyResourceValidation rocky_app_validate_resources(const PebbleProcessMd *md) { return RockyResourceValidation_NotRocky; } status_t app_cache_app_launched(AppInstallId id...
gin.x + frame.size.w, frame.origin.y + DIV_X(frame.size.h * MULT_X((cur - limit_b), (limit_c - limit_b)))); } else if (cur <= limit_d) { // zone c - d return GPoint(frame.origin.x + DIV_X(frame.size.w * (1000 - MULT_X((cur - limit_c), (limit_d - li...
gpath_draw_filled(ctx, &path)
; #if PBL_COLOR graphics_context_set_stroke_color(ctx, color); gpath_draw_outline(ctx, &path); #else graphics_context_set_stroke_color(ctx, GColorWhite); GRect inner_bounds = grect_inset(outer_bounds, GEdgeInsets(fill_thickness)); graphics_draw_rect(ctx, &inner_bounds); inner_bounds = grect_inset(inner_bou...
8:15 event void test_timeline__extra_case_middle_past(void) { prv_insert_extra_case_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast, s_feb_5_midnig...
iter_next(&iterator)
); cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id)); cl_assert(iter_prev(&iterator)); cl_assert(!iter_prev(&iterator)); cl_assert(state.node); timeline_iter_deinit(&iterator, &state, &head); } void test_timeline__delete_last_items(void) { Iterator iterator = {0}; TimelineIterState stat...
&layer, &draw_text_single_line_ellipsis_clip_across_x); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_x.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_o...
(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_x.${BIT_DEPTH_NAME}.pbi")
); } #define RECT_TEXT_0_0 GRect(0, 0, 140, 1000) #define RECT_TEXT_2_0 GRect(2, 0, 140, 1000) void test_graphics_draw_text_${BIT_DEPTH_NAME}__clipping_letters(void) { GContext ctx; prv_setup_resources(); uint32_t gothic_18_handle = RESOURCE_ID_GOTHIC_18_BOLD; cl_assert(text_resources_init_font(0, gothic_18...
/* * 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...
(MAG_XY_CORRECTION_VALS, valxy)
; RTC_WriteBackupRegister(MAG_Z_CORRECTION_VAL, valz); for (int i = 0; i < 3; i++) { s_saved_corr[i] = corr[i]; } s_saved_corr_present = true; } // Loads the calibration values. Returns true if loads successfully, // otherwise false. static bool prv_load_calibration_values(void) { uint32_t valxy = RTC_...
up events at same time) //! repeating and repeat_hours_offset were included for future use //! and use in repeat support for alarms typedef struct PACKED { Uuid uuid; //!< UUID of app that scheduled the wakeup event int32_t reason; //!< App provided value to differentiate wakeup event bool repeating; //!< Enable ...
{ s_wakeup_state.timestamp = entry.timestamp; s_wakeup_state.current_wakeup_id = wakeup_id; }
return true; // continue iterating } // Checks for the next pending wakeup event and sets up a timer for the event static void prv_wakeup_timer_next_pending(void) { if (!s_wakeup_enabled) { return; } // If there is already a wakeup timer scheduled, cancel it. There will be a // new timer scheduled fo...
/* * 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...
(info->app_locale_strings, locale)
; prv_update_locale(info->app_locale_time, locale); return info->app_locale_strings; case LC_TIME: prv_update_locale(info->app_locale_time, locale); return info->app_locale_time; default: /* not implemented */ break; } return NULL; } static const struct lconv pbl_lconv ...
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 permissions and * limitations under the License. *...
{ char *msg = msg_arr[i]; uint32_t addr = flash_logging_log_start(strlen(msg)); cl_assert(addr != FLASH_LOG_INVALID_ADDR); bool rv = flash_logging_write((uint8_t *)msg, addr, strlen(msg)); cl_assert(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...
framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS})
; } // Teardown void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__cleanup(void) { free(fb); } // Tests //////////////////////////////////// void inside_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); grap...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_update_locale(info->app_locale_strings, locale)
; prv_update_locale(info->app_locale_time, locale); return info->app_locale_strings; case LC_TIME: prv_update_locale(info->app_locale_time, locale); return info->app_locale_time; default: /* not implemented */ break; } return NULL; } static const struct lconv pbl_lconv ...
ent_service_handle_last(); unobstructed_area_service_did_change(to_area.size.h); fake_event_service_handle_last(); cl_assert_equal_i(s_data.num_did_change_calls, 1); } void test_unobstructed_area_service__did_change_after_subscribe(void) { const GRect from_area = GRect(0, 0, DISP_COLS, 400); const GRect to_...
(-110, -130, 300, 290)
, }; layer_add_child(&root_layer, &layer); GRect unobstructed_bounds; layer_get_unobstructed_bounds(&layer, &unobstructed_bounds); cl_assert_equal_grect(unobstructed_bounds, GRect(150, 120, 40, 40)); }
st_num = (int16_t)((float)-1 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == -1); cl_assert(num.fraction == 0); test_num = (int16_t)((float)-0.875 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == ...
{ Fixed_S16_3 num; int16_t test_num; // This equates to -0.125 num = (Fixed_S16_3){ .raw_value = 0xFFFF }; cl_assert(num.integer == -1); cl_assert(num.fraction == 7); test_num = (int32_t)((float)-0.125 * (1 << FIXED_S16_3_PRECISION)); cl_assert(memcmp(&num, &test_num, sizeof(Fixed_S16_3)) == 0); num...
void test_math_fixed__Fixed_S16_3_rounded_int(void) { cl_assert_equal_i(0, Fixed_S16_3_rounded_int(Fixed_S16_3(0))); cl_assert_equal_i(0, Fixed_S16_3_rounded_int(Fixed_S16_3(3))); cl_assert_equal_i(1, Fixed_S16_3_rounded_int(Fixed_S16_3(4))); cl_assert_equal_i(1, Fixed_S16_3_rounded_int(Fixed_S16_3(8))); cl...
LC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distri...
app_storage_get_file_name(process_name, sizeof(process_name), id, PebbleTask_App)
; pfs_remove(process_name); // remove resources resource_storage_clear(id); } bool app_storage_app_exists(AppInstallId id) { PBL_ASSERTN(id > 0); char process_name[APP_FILENAME_MAX_LENGTH]; // check app binary first app_storage_get_file_name(process_name, sizeof(process_name), id, PebbleTask_App); int...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
APP_LOG(APP_LOG_LEVEL_INFO, "%d days ago steps: %d", i, (int)steps)
/* * 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...
{ record_mock_call(s_graphics_context_set_stroke_color) { .ctx = ctx, .color = color, }; }
e children running, then we // run again so that the parents can check again if their children finished on the first run. AnimationPrivate *animation = (AnimationPrivate *) state->scheduled_head; while (animation) { #ifdef UNITTEST // This is to ensure unit test fails in case of bad behaviour - no n...
{ // Exceed max # of children allowed? return NULL; }
bool success = true; AnimationPrivate *parent = animation_private_animation_find(parent_h); parent->type = type; // Keep track of which children we added so we can restore them in case of error bool used_children[array_len]; memset(used_children, 0, sizeof(bool) * array_len); // Set the parent on eac...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_get_fw_reset_vector(&reset_handler, &initial_stack_pointer)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_dialog_discoverable_type_for_flag(*iter)
; // Move iter past the flags iter += 1; adv_bytes = iter; adv_bytes_len -= 3; } ble_error_t rv = ble_gap_adv_mode_set(disc_mode); if (rv != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "Error: ble_gap_adv_mode_set - rv: %d", rv); // Not returning, probably better to try to advertise regar...
att_max_version = 0xff; prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], (const uint8_t *) &future_meta_non_compatible, sizeof(future_meta_non_compatible), ...
(BTErrnoInvalidParameter)
// TODO: check reason and act upon it const OutboxMsgType sent_msg_type = s_state.out.msg_type; s_state.out.msg_type = OutboxMsgTypeNone; const bool is_sent_successfully = (reason == APP_MSG_OK); // Process the (N)ACK: switch (sent_msg_type) { case OutboxMsgTypeControl: { if (is_sent_successfu...
{ DBG("No handler registered for %s", event_type); }
} static void prv_session_open__enter(const PostMessageResetCompletePayload *rc) { PBL_ASSERTN(s_state.state == PostMessageStateAwaitingResetCompleteRemoteInitiated || s_state.state == PostMessageStateAwaitingResetCompleteLocalInitiated); s_state.protocol_version = MIN(rc->max_supported_version, PO...
ASSERT_JS_GLOBAL_EQUALS_S("t", "function")
; ASSERT_JS_GLOBAL_EQUALS_B("eq", true); // from MDN docs: // Calling removeEventListener() with arguments that do not identify // any currently registered EventListener on the EventTarget has no effect. EXECUTE_SCRIPT( "_rocky.off('foo', f2);\n" "_rocky.off('unknownevent', f1);\n" ); cl_assert_e...
E}.pbi")); prv_reset(); test_graphics_context_init(&ctx, fb); s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_right_clipped.${BIT_DEPTH_N...
test_graphics_context_init(&ctx, fb)
; s_current_path = s_house_path; ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); graphics_context_set_antialiased(&ctx, true); prv_filled_update_proc(NULL, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_left_clipped_aa.${BIT_DEPTH_NAME}.pbi")); prv_reset(); ...
yer_bounds->size.w, stripe_width) : GSize(stripe_width, layer_bounds->size.h) }; for (int i = stripe_inset - stripe_width; i >= -MAX_OFFSET_MAGNITUDE; i -= stripe_width) { // alternate yellow and red stripes graphics_context_set_stroke_color(ctx, (i % (2 * stripe_width)) ? GColo...
CLIP(data->offset.y + to_add, -MAX_OFFSET_MAGNITUDE, MAX_OFFSET_MAGNITUDE)
; break; case DisplayCalibrationState_Confirm: break; } layer_mark_dirty(&data->window.layer); } static void prv_config_provider(void *data) { const uint16_t interval_ms = 50; window_single_repeating_click_subscribe(BUTTON_ID_UP, interval_ms, prv_up_down_click_handler); window_single_repeati...
reate_test_inbox_and_begin_write(); cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, BUFFER_SIZE)); // After ending the write, expect num_success to be incremented by one: app_inbox_service_end(AppInboxServiceTagUnitTest); ...
app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1)
ANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "console/pulse_protocol_impl.h" #include <stdint.h> #include <string.h> #include "drivers/flash.h" #include "flash_region/flash_region.h" ...
pulse_best_effort_send(message, sizeof(EraseAndWriteAck))
; uint32_t end_address = cmd->erase.address + cmd->erase.length; flash_erase_optimal_range( cmd->erase.address, cmd->erase.address, end_address, (end_address + SECTOR_SIZE_BYTES - 1) & SECTOR_ADDR_MASK, prv_erase_complete, NULL); } } static void prv_erase_complete(void *ignored, stat...
= localtime result = prv_calculate_time_range(now - SECONDS_PER_DAY, now, &range); cl_assert(result); cl_assert_equal_range(range, ((HealthServiceTimeRange){ .last_day_idx = 0, .num_days = 2, .seconds_first_day = 53258, .seconds_last_day = 33142, .seconds_total_last_day = 33142, })); // s...
cl_assert_equal_i(result, 1000 + 2000)
; } void test_health__process_range(void) { HealthValue values[4] = {1000, 1000, 1000, 1000}; HealthServiceTimeRange range = { .num_days = 3, .seconds_first_day = SECONDS_PER_DAY / 10, .seconds_last_day = SECONDS_PER_DAY / 5, .seconds_total_last_day = SECONDS_PER_DAY, }; // make sure we treat ...
Y, false, 2); 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_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 3 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 3); graphics_draw_round...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 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_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, ...
UID, UUID_SIZE, (uint8_t *)&app_glance_2, glance_2_size), E_INVALID_ARGUMENT); } void test_app_glance_db__glance_blob_with_too_many_slices_inserted_but_trimmed(void) { const size_t original_glance_size = sizeof(s_app_glance_with_too_many_slices); const s...
{ // Force the insertion of a stale glance blob (outdated version) const SerializedAppGlanceHeader app_glance = (SerializedAppGlanceHeader) { .version = APP_GLANCE_DB_CURRENT_VERSION - 1, }; cl_assert_equal_i(app_glance_db_insert_stale((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
FAILED(open_status)
) { // File open failed, return live data without saving to cache goto done; } if (new_capabilities != cached_capabilities) { settings_file_set(&settings_file, &app_uuid, sizeof(app_uuid), &new_capabilities, sizeof(new_capabilities)); } }...
/* * 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_set_text(text_heap_info, s_text_buf)
; layer_add_child(window_layer, text_layer_get_layer(text_heap_info)); } static void deinit(void) { // Don't free anything } int main(void) { init(); app_event_loop(); deinit(); }
cl_check(gbitmap_pbi_eq(&ctx->dest_bitmap, "draw_rotated_bitmap_stamp_0deg.Xbit.pbi"))
; // Top-left corner rotation point, Angle 45 setup_test_rotate_bitmap(ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(ctx, test_image, GPoint(71, 71), DEG_TO_TRIGANGLE(45), center); cl_check(gbitmap_pbi_eq(&ctx->dest_bitmap, "draw...
cond half static int16_t prv_interpolate_two_ways(AnimationProgress normalized_progress, int16_t end) { const int16_t from = s_data.is_first_half ? 0 : -end; const int16_t to = s_data.is_first_half ? end : 0; return interpolate_int16(normalized_progress, from, to); } // Draws the shutters based on the path defin...
(ctx, draw_shutter ? movement_size : -movement_size, progress, direction_vertical)
DS = BUF_SIZE_BYTES / sizeof(uint32_t); uint32_t buffer[BUF_SIZE_WORDS]; for (uint32_t offset = 0; offset < size_bytes; offset += BUF_SIZE_BYTES) { flash_impl_read_sync(buffer, addr + offset, BUF_SIZE_BYTES); for (uint32_t i = 0; i < BUF_SIZE_WORDS; ++i) { if (buffer[i] != FLASH_RESET_WORD_VALUE) { ...
(dev->qspi, dev->state->part->instructions.block_lock_status, addr, 0, &status, sizeof(status), 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...
alerts_preferences_dnd_is_smart_enabled()
); s_data.manually_override_dnd = false; prv_do_update(); } static void prv_toggle_manual_dnd_from_action_menu(void *e_dialog) { do_not_disturb_toggle_push(ActionTogglePrompt_NoPrompt, false /* set_exit_reason */); } static void prv_toggle_manual_dnd_from_settings_menu(void *e_dialog) { do_not_disturb_set_man...
= context; prv_display_scalar_history_alert(data, "Distance(m)", HealthMetricWalkedDistanceMeters); } // ----------------------------------------------------------------------------------------- static bool prv_activity_iterate_cb(HealthActivity activity, time_t time_start, time_t time_end, ...
{ utc_end = time(NULL); num_minutes = health_service_get_minute_history(minute_data, k_size, &utc_start, &utc_end); char time_start_text[64]; local_tm = localtime(&utc_start); strftime(time_start_text, sizeof(time_start_text), "%F %r", local_tm); char time_end_text[64]; local_tm = localtim...
// Print summary APP_LOG(APP_LOG_LEVEL_DEBUG, "Retrieved %d minute data records", (int)num_records); // Print detail on the last few minutes const int k_print_batch_size = 30; APP_LOG(APP_LOG_LEVEL_DEBUG, "Fetching last %d minutes", k_print_batch_size); utc_start = time(NULL) - (k_print_batch_size * SEC...
count < MAX_ERROR_COUNT) { prv_set_mic_window_state(data, StateError); prv_push_bt_dialog(data); } else { prv_push_final_error_dialog(data); data->error_exit_status = DictationSessionStatusFailureConnectivityError; } } else { prv_handle_dictation_err...
(data, StateFinished)
; } } // Microphone Window /////////////////////////////////////////////////////////////////////////// #if (0) // https://pebbletechnology.atlassian.net/browse/PBL-20406 static void prv_short_vibe(void) { static const uint32_t VIBE_DURATIONS[] = { 50 }; VibePattern pattern = { .durations = VIBE_DURATIONS, ...
_arrow(layer, ctx, &data->arrow_up, GAlignTop); } if (data->offset.y < MAX_OFFSET_MAGNITUDE) { prv_draw_arrow(layer, ctx, &data->arrow_down, GAlignBottom); } break; case DisplayCalibrationState_Confirm: break; } } static void prv_layer_update_proc(Layer *layer, GContext *ctx...
window_set_click_config_provider_with_context(window, prv_config_provider, data)
; window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .unload = prv_window_unload }); window_set_background_color(window, GColorBlack); Layer *root_layer = window_get_root_layer(window); Layer *layer = &data->layer; layer_init(layer, &root_layer->bounds); layer_set_...
// First, read the version from the firmware update resource. const uint32_t update_length = resource_size( SYSTEM_APP, RESOURCE_ID_AS7000_FW_IMAGE); if (update_length == 0) { // We don't have a firmware to write so there's no point in booting // the HRM. PBL_LOG(LOG_LEVEL_DEBUG, "No HRM FW up...
mutex_lock(dev->state->lock)
false); graphics_context_set_fill_color(ctx, GColorClear); graphics_fill_round_rect(ctx, &GRect(2, 2, 28, 20), 4, GCornersAll); } void corners_clipped_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_rou...
(&ctx, fb)
; layer_set_update_proc(&layer, &corners_all_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_corners_all.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &clear_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_emp...
e 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; } xSemaphoreGive(s_send_semaphore); prv_unlock(); return success; } void accessory_send_stream_stop(voi...
{ // we are receiving data we just sent since the RX/TX lines are tied together if (s_send_history.has_data) { if (s_send_history.data != data) { // The byte we are receiving doesn't match the next byte in the send queue. s_bus_contention_detected = true; } s_send_history.has_d...
if (s_stream_cb) { // enable the TXE interrupt for sending the next byte uart_set_tx_interrupt_enabled(dev, true); } return should_context_switch; } static bool prv_tx_irq_handler(UARTDevice *dev) { bool should_context_switch = false; if (s_stream_cb && !s_send_history.has_data) { s_did_send_byt...
bool activity_get_metric(ActivityMetric metric, uint32_t history_len, int32_t *history) { *history = 0; return true; } int s_metric_updated_count = 0; void activity_metrics_prv_set_metric(ActivityMetric metric, DayInWeek day, int32_t value) { printf("s_metric_updated_count: %d\n", s_metric_updated_count); s_m...
cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalSleepDuration])
; // delete cl_assert_equal_i(health_db_delete((uint8_t *)key, strlen(key)), S_SUCCESS); // check cl_assert(!health_db_get_typical_value(ActivityMetricSleepTotalSeconds, Monday, &val_out)); // insert again cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key), ...
en; } PACKED msg = { .response_code = code, .token = htonl(token) }; bool success = comm_session_send_data(comm_session_get_system_session(), PB_ENDPOINT_ID, (uint8_t*) &msg, sizeof(msg), COMM_SESSION_DEFAULT_TIMEOUT); if (!success) { PBL_LOG(LOG_LEVEL_WARNIN...
PBL_LOG(LOG_LEVEL_ERROR, "%d: Token does not match; got 0x%" PRIx32 ", expected 0x%" PRIx32, command, request_token, s_pb_state.token)
; return true; } return false; } static size_t prv_expected_minimum_length_by_command(const PutBytesCommand command) { switch (command) { case PutBytesInit: return offsetof(InitRequest, index); case PutBytesPut: return sizeof(PutRequest); case PutBytesCommit: return sizeof(Commi...
/* * 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...
__builtin_return_address(0)
, "ASSERT", message, fmt_args); va_end(fmt_args); } void passert_failed_no_message(const char* filename, int line_number) { handle_passert_failed(filename, line_number, (uintptr_t)__builtin_return_address(0), "ASSERTN", NULL); } void wtf(void) { uintptr_t saved_lr = (uintptr_t) __builtin_return_address(0);...
; layout_destroy(layout); } T_STATIC LayoutLayer *prv_get_layout_handler(SwapLayer *swap_layer, int8_t rel_position, void *context) { NotificationWindowData *data = context; Uuid *id = notifications_presented_list_relative( notifications_presented_list_current()...
prv_refresh_pop_timer_with_timeout(data, delay_ms, true)
session, uint16_t endpoint_id, const uint8_t *payload, size_t payload_length) { const size_t outbox_data_size = sizeo...
assert_consumed(AppMessageSenderErrorDisconnected, 1)
; app_free(outbox_data); } void test_app_message_sender__no_sessions_connected(void) { s_system_session_ptr = NULL; s_app_session_ptr = NULL; AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(NULL /* auto-select */, ALLOWED_ENDPOINT_ID, TES...
bytes_to_copy + sizeof(PulsePPPacket)); comm_session_send_queue_consume(session, bytes_to_copy); bytes_remaining -= bytes_to_copy; } else { // Reliable transport went down while waiting to send. // The CommSession has already been closed so simply return without doing // anything fur...
bt_unlock()
; } static void prv_pulse_pp_send_cb(void *data) { PulsePPCallbackPacket *cb_data = data; uint8_t *resp = pulse_reliable_send_begin(PULSE2_PEBBLE_PROTOCOL); memcpy(resp, &cb_data->packet, cb_data->packet_length); pulse_reliable_send(resp, cb_data->packet_length); kernel_free(data); } static void prv_pulse_p...
not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES O...
fake_gap_le_connect_params_reset_last_requested()
; conn_mgr_set_ble_conn_response_time( &s_hdl, BtConsumerUnitTests, ResponseTimeMax, 0); prv_regular_timer_spend_seconds(BT_CONN_MGR_INACTIVITY_TIMEOUT_SECS); state = conn_mgr_get_latency_for_le_connection(&s_hdl, &secs_to_wait); cl_assert_equal_i(state, ResponseTimeMax); cl_assert_equal_i(fake_gap_le_...
app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, (uint8_t *)&app_glance, sizeof(app_glance))
, E_INVALID_ARGUMENT); } void test_app_glance_db__lower_version_blob_not_inserted(void) { for (uint8_t version = 0; version < APP_GLANCE_DB_CURRENT_VERSION; version++) { prv_check_invalid_version_code_blob_not_inserted(version); } } void test_app_glance_db__higher_version_not_blob_inserted...
tBytesStorageInfo) + strlen(filename) + 1); strcpy(storage_info->filename, filename); break; } #else case ObjectFile: case ObjectWatchApp: case ObjectWatchWorker: case ObjectAppResources: return false; #endif case ObjectFirmware: case ObjectSysResources: // Clear out,...
if (prv_check_putrequest_for_errors(request, request_size) || (data_length > remaining_bytes)) { prv_fail(token); return false; }
PBL_LOG(LOG_LEVEL_DEBUG, "PutBytes put CB. type: %"PRIu32", length: %"PRIu32, (uint32_t)s_pb_state.type, data_length); pb_storage_append(&s_pb_state.storage, request->data, data_length); xSemaphoreTake(s_pb_semaphore, portMAX_DELAY); s_pb_state.remaining_bytes -= data_length; xSemaphoreGive(s_pb...
8, 256, -96}, { 1400, 320, -240}, { 1456, 304, -176}, { 1288, 248, -176}, { 976, 360, -280}, { 816, 424, -320}, { 704, 384, -256}, // 85 seconds { 728, 416, -272}, { 840, 496, -360}, { 888, 520, -400}, { 896, 584, -464}, { 920, 608, -448}, { 952, 528, -336}, { 115...
{ 1056, 48, 64}, { 1168, 144, 8}, { 1272, 312, -264}, { 1520, 296, -184}, { 1464, 192, -88}, { 1176, 240, -248}, { 896, 376, -384}, { 688, 344, -256}, { 640, 328, -288}, { 696, 368, -240}, { 832, 456, -352}, { 904, 448, -360}, { 976, 480, -408}, { 1064, 560, -440}...
// 93 seconds { 744, 504, -360}, { 864, 488, -344}, { 960, 536, -408}, { 1040, 616, -440}, { 936, 528, -352}, { 1120, 496, -272}, { 1200, 552, -296}, { 1432, 592, -312}, { 1576, 488, -136}, { 1848, 384, -48}, { 1488, 320, -104}, { 1032, 304, -128}, { 728, 272, -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...
prv_add_notification_common(id, type)
; s_presented_notifs = (NotifList *) list_sorted_add(&s_presented_notifs->list_node, &new_entry->list_node, comparator, ascending); } NotificationType notifications_presented_list_get_type(Uuid *id) { NotifList *node = prv_find_listnode_for_notif(id); if (!node) { return NotificationInvalid; } retu...