prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ish(receiver); // CBs shouldn't immediately execute since they are pended on KernelBG prv_assert_no_handler_calls(); prv_set_expected_data(data, strlen(data)); fake_system_task_callbacks_invoke_pending(); cl_assert_equal_i(s_handler_call_count[HandlerA], 1); cl_assert_equal_i(fake_pbl_malloc_num_net_alloc...
{ char *data = "cleanup but finish ran first!"; Receiver *receiver = g_default_kernel_receiver_implementation.prepare( 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_...
rn S_SUCCESS; } #define APP_GLANCE_TEST_UUID \ (UuidMake(0x3d, 0xc6, 0xb9, 0x4c, 0x4, 0x2, 0x48, 0xf4, \ 0xbe, 0x14, 0x81, 0x17, 0xf1, 0xa, 0xa9, 0xc4)) // Setup //////////////////////////////////////////////////////////////// void test_app_glance_service__initialize(void) { fake_settings_file_re...
(&APP_GLANCE_TEST_UUID, &glance)
, S_SUCCESS); // This is the slice we expect to get when we request the current slice // Note that we don't expect the pointer to the slice but rather the data behind the pointer const AppGlanceSliceInternal *expected_slice_data = &glance.slices[1]; // Set the current time to 5 seconds before the slice we exp...
ed */); // Peek should now be off-screen. cl_assert(layer->frame.origin.y >= DISP_ROWS); } void test_timeline_peek__peek_visible_to_hidden_outside_of_watchface(void) { TimelineItem *item = prv_set_timeline_item(&(TimelinePeekItemConfig) { .title = "CoreUX Design x Eng", .subtitle = "ConfRM-Missile Comman...
(NULL, true /* animated */)
; TimelinePeek *peek = timeline_peek_get_peek(); const Layer *layer = &peek->layout_layer; // Peek should be off-screen. cl_assert(layer->frame.origin.y >= DISP_ROWS); // Transition away from the watchface s_is_watchface_running = false; timeline_peek_set_visible(false, false /* animated */); // Peek s...
ual_range(range, ((HealthServiceTimeRange){ .last_day_idx = ACTIVITY_HISTORY_DAYS - 1, .num_days = 1, .seconds_first_day = 13, .seconds_last_day = 13, .seconds_total_last_day = 86400, })); } void test_health__sum_full_days(void) { // use values structured as binary mask so we can detect if we s...
(values[2], 1000)
; cl_assert_equal_i(values[3], 1000 / 10); } void test_health__sum_fraction_days(void) { // use values structured as binary mask so we can detect if we sum up currect days s_sys_activity_get_metric_values.out.history[0] = 1000; s_sys_activity_get_metric_values.out.history[1] = 2000; s_sys_activity_get_metric...
/* * 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_lock()
; { done = (s_outstanding_enqueues != 0); } prv_unlock(); return done; } // Only to be called by prv_enqueue(). This function keeps track of how many // enqueues are outstanding. If an enqueue is about to start but the stack is // no longer up, it does NOT bump the job count as we expect prv_enqueue() to /...
w_mask.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "util/graphics.h" #include "util/trig.h" #include "clar.h" #include "util.h" #include <stdio.h> // Helper Includes //////////////////////////////////// #i...
record_func(ctx, y, x1, x2, src_color)
; } } cl_assert(graphics_context_mask_record(ctx, NULL)); test_graphics_context_mask_debug(ctx, mask); graphics_context_mask_destroy(ctx, mask); } /////////////////////////////////////// // RECORDING VERTICAL LINE HELPERS // /////////////////////////////////////// static void prv_prepare_canvas_for_v...
y2_destroy((AnimationLegacy2 *)animation_h); return true; } AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/); if (!animation || animation->parent) { // Only top-level animations can be destroyed return false; } // If we're being called from the stop...
prv_animation_state_get(PebbleTask_Current)
; if (animation_private_using_legacy_2(state)) { // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. animation_legacy2_unschedule_all(); return; } while (state->scheduled_head) { AnimationPriva...
/* * 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_i(BITS_BETWEEN(0, 7), erased_sector)
; cl_assert(flash_locked); } void test_system_flash__erase_sector_0(void) { cl_assert(system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_16KB_sectors(void) { cl_assert(system_flash_erase(FLASH_BA...
/* * 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...
strcat(str, entry->name)
include "applib/voice/transcription_dialog.h" #include "applib/voice/voice_window.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "process_state/app_state/app_state.h" #include "resource/resource_ids.auto.h" #include "resource/timeline_resource_ids.auto.h" #include "services/common/bluetooth/bluet...
i18n_free_all(dialog)
; } static void prv_confirm_cb(void *context) { ReminderAppData *data = context; data->ui_state = ReminderAppUIState_Exit; prv_create_reminder(data); prv_push_success_dialog(); } static void prv_push_transcription_dialog(ReminderAppData *data) { TranscriptionDialog *transcription_dialog = &data->transcripti...
tic void prv_configure_local_device_properties(const BTDriverConfig *config) { ble_error_t e; e = ble_gap_appearance_set(BLE_GAP_APPEARANCE_GENERIC_WATCH, ATT_PERM_READ); if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_appearance_set: %u", e); } #if 0 // FIXME: PBL-36556 -- How to configure t...
(s_ble_perip_wdog_id)
; hc_protocol_process_receive_buffer(); extern bool should_log_about_mic_error(uint32_t *max_subsequent_failures); uint32_t num_subsequent_failures = 0; if (should_log_about_mic_error(&num_subsequent_failures)) { hc_endpoint_analytics_log_mic_error_detected(num_subsequent_failures); } /...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(28, 14), 12); }
void across_nx_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(-14, 14), 12); } void across_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_col...
reschedule_ack_timeout() will call check_ack_timeout() (which we are already in) if // any other timers have already expired. update_session_state(session, DataLoggingSessionCommStateIdle, false /*reschedule*/); } return true; } static void check_ack_timeout(void) { RtcTicks current_ticks = rtc_get_tic...
if (!session) { return; }
DataLoggingCloseSessionMessage msg = { .command = DataLoggingEndpointCmdClose, .session_id = session_id, }; dls_endpoint_print_message((uint8_t *)&msg, 0); comm_session_send_data(session, ENDPOINT_ID_DATA_LOGGING, (uint8_t *)&msg, sizeof(DataLoggingCloseSessionMessage), ...
PBL_LOG(LOG_LEVEL_INFO, "Starting BLE Service Discovery: 0x%x to 0x%x", node->hdl.start, node->hdl.end); ATTHandleRange hdl = { .start = node->hdl.start, .end = node->hdl.end }; BTErrno rv = bt_driver_gatt_start_discovery_range(connection, &hdl); if (rv == BTErrnoOK) { // if we are ba...
(sizeof(PebbleBLEGATTClientServiceEventInfo))
; *info = (PebbleBLEGATTClientServiceEventInfo) { .type = PebbleServicesInvalidateAll, .device = connection->device, .status = status }; prv_send_event(info); } extern void gatt_client_service_get_all_characteristics_and_descriptors( GAPLEConnection *connection, GATTService *service, BLECha...
dField; typedef bool (*SearchCallback)(PersistMapIdField *field, void *data); static const uint16_t PERSIST_MAP_VERSION = 1; // Start off with a file which can hold 256 UUIDs #define PMAP_FILE_SIZE \ ((sizeof(PersistMapHeader) + sizeof(PersistMapIdField)) * 256) static const char *s_map_filename = "pmap"; #if IS...
pfs_write(new_fd, buf, bytes_to_read)
) != (int)bytes_to_read) { rv = (rv > 0) ? E_INTERNAL : rv; break; } curr_file_len -= bytes_to_read; } pfs_close(*fd); pfs_close(new_fd); *fd = prv_pmap_open_debug_wrapper(s_map_filename, OP_FLAG_READ | OP_FLAG_WRITE, 0, 0); if (*fd < 0) { PBL_LOG(LOG_LEVEL_WARNING, "pmap enlarge (re...
n_menu->normal_colors.foreground = foreground; menu_layer_set_normal_colors(&option_menu->menu_layer, option_menu->normal_colors.background, option_menu->normal_colors.foreground); } void option_menu_set_highlight_colors(OptionMenu *option_menu, GColor ba...
applib_type_malloc(OptionMenu)
; if (!option_menu) { return NULL; } option_menu_init(option_menu); return option_menu; } void option_menu_destroy(OptionMenu *option_menu) { option_menu_deinit(option_menu); applib_free(option_menu); } void option_menu_system_draw_row(OptionMenu *option_menu, GContext *ctx, const Layer *cell_layer, ...
_storage_find(metric, uuid, AnalyticsClient_Ignore); if (heartbeat) { // We allow only a limited number of app heartbeats to accumulate. A NULL means we reached the // limit analytics_heartbeat_set(heartbeat, metric, value); } analytics_storage_give_lock(); } void analytics_set_entire_array(Analytic...
PBL_LOG(LOG_LEVEL_DEBUG, "Analytics stopwatch for metric %d already stopped!", metric)
; goto unlock; } analytics_add(metric, prv_stopwatch_elapsed_ms(stopwatch, rtc_get_ticks()), stopwatch->client); list_remove(&stopwatch->node, &s_stopwatch_list, NULL); kernel_free(stopwatch); unlock: analytics_storage_give_lock(); } void analytics_stopwatches_update(uint64_t current_ticks) { PBL_AS...
E(18, DISP_ROWS - (ACTION_BAR_WIDTH + RIGHTSIDE_PADDING) - ICON_WIDTH) #if PBL_ROUND #define ICON_POSITION_CENTERED_X (DISP_ROWS / 2 - ICON_WIDTH / 2) #endif static const int16_t DOT_SIZE = 8; static const uint32_t UNFOLD_DURATION = 300; static const int16_t UNFOLD_EXPAND = 8; static const uint32_t ANIMATION_FRAME_M...
(&s_phone_ui_data->window, ModalPriorityNotification, false /* don't animate */)
; } //! Icon setters. // This one will make sure the *previously* set icon resource is destroyed. // The final icon set must still be destroyed alongside the reel. static void prv_set_icon_resource(TimelineResourceId timeline_res_id) { TimelineResourceInfo timeline_res = { .res_id = timeline_res_id, }; AppRe...
(0, 0, DISP_COLS, 200); const GRect area = GRect(0, 0, DISP_COLS, 200); const AnimationProgress progress = ANIMATION_NORMALIZED_MAX / 2; unobstructed_area_service_change(area.size.h, to_area.size.h, progress); fake_event_service_handle_last(); cl_assert_equal_i(s_data.num_will_change_calls, 1); cl_assert_eq...
(&root_layer, &layer)
; GRect unobstructed_bounds; layer_get_unobstructed_bounds(&layer, &unobstructed_bounds); cl_assert_equal_grect(unobstructed_bounds, layer.bounds); } void test_unobstructed_area_service__nested_layer_clip_x_y(void) { app_state_get_unobstructed_area_state()->area = GRect(0, 0, 400, 400); Layer root_layer = { ...
is NULL: response = expectation->response; // Set request to NULL, so it can't be matched any longer (important in timeout scenario) expectation->request = NULL; } prv_unlock(); if (response) { s_num_consec_request_failures = 0; } else { s_num_consec_request_failures++; PBL_LOG(LOG_LEVE...
((ListNode *)s_expectations_head, prv_expectation_for_message_list_filter_cb, message)
/* * 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(head == &a)
; } void test_list__pop_head(void) { ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL; list_insert_after(&a, &b); ListNode *new_head = list_pop_head(&b); cl_assert(new_head == &b); cl_assert(list_get_next(&a) == NULL); cl_assert(list_get_head(&b) == &b); } void test_list__pop_tail(void) { ListNode a = LI...
index, int32_t value, void *context) { cl_assert_equal_p(context, &s_context); return (value > 0); } void test_stats__filtered_count(void) { const int32_t data[] = { 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0 }; const size_t num_data = ARRAY_LENGTH(data); const StatsBasicOp op = StatsBasi...
(op, data, num_data, prv_filter, &s_context, &result.sum)
; cl_assert_equal_i(result.sum, 0); cl_assert_equal_i(result.avg, 0); cl_assert_equal_i(result.min, INT32_MAX); cl_assert_equal_i(result.max, INT32_MIN); cl_assert_equal_i(result.count, 0); cl_assert_equal_i(result.max_streak, 0); cl_assert_equal_i(result.first_streak, 0); cl_assert_equal_i(result.media...
Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writ...
(iter->fd, 0, FSeekCur)
; PBL_LOG(LOG_LEVEL_ERROR, "Could not write from %p, %d bytes at pos %d: %"PRId32, data, data_len, pos, status); fatal_logic_error(iter); } /////////////////////////// // Actual Iteration Code // /////////////////////////// void settings_raw_iter_init(SettingsRawIter *iter, int fd, const char *file_n...
lighted) { PBL_ASSERT(index < NUM_ACTION_BAR_ITEMS, "Index: %"PRIu8, index); const uint8_t bit = (1 << index); if (action_bar_is_highlighted(action_bar, index) == highlighted) { return; } if (highlighted) { action_bar->is_highlighted |= bit; } else { action_bar->is_highlighted &= ~bit; prv_...
(action_bar, index)
) { offset = prv_get_button_press_offset(action_bar, index); } else { const int64_t state_change_time = action_bar->state_change_times[index]; offset = prv_offset_since_time(state_change_time, PRESS_ANIMATION_DURATION_MS, prv_get_button_press_offset(a...
pp_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest)); } //////////////////////////////////////////////////////////////////////////////////////////////////// // app_inbox_service_write / app_inbox_service_end static const uint8_t s_test_data[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0...
cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, 1, s_writer))
; cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1)); cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)); // No space: cl_assert_equal_b(false, app_inbox_service_begin(AppInboxServiceTagUnitTest, ...
pp_storage_get_file_name(filename_buf, sizeof(filename_buf), 1, PebbleTask_App); load_fixture_on_pfs(APP1_APP_FIXTURE_NAME, filename_buf); app_storage_get_file_name(filename_buf, sizeof(filename_buf), 1, PebbleTask_Worker); load_fixture_on_pfs(APP1_WORKER_FI...
(CRAZY_ID)
); } void test_app_install_manager__get_uuid_for_install_id(void) { Uuid uuid = {}; cl_assert_equal_b(false, app_install_get_uuid_for_install_id(INSTALL_ID_INVALID, &uuid)); cl_assert_equal_uuid(uuid, UUID_INVALID); cl_assert_equal_b(true, app_install_get_uuid_for_install_id(tictoc_id, &uuid)); cl_assert_eq...
/* * 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...
layer_process_tree_level(node->first_child, ctx, iterator_func)
) { return false; }; node = node->next_sibling; } return true; } void layer_process_tree(Layer *node, void *ctx, LayerIteratorFunc iterator_func) { layer_process_tree_level(node, ctx, iterator_func); } inline static Layer __attribute__((always_inline)) *prv_layer_tree_traverse_next(Layer *stack[]...
n_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, }, { .header = { // [4] .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb5}, .parent_id = {0}, .timestamp = 1421178061, /...
cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3))
; cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(has_next); cl_assert_equal_i(new_idx, 4); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(...
000, -56}, { 296, 1000, -56}, { 296, 1016, -48}, { 296, 1008, -48}, { 288, 1008, -40}, { 280, 1008, -48}, { 280, 1000, -56}, { 288, 1000, -48}, { 288, 1008, -48}, { 288, 1008, -40}, { 280, 1000, -40}, { 272, 1016, -32}, { 280, 1008, -32}, { 280, 1008, -40}, { 280,...
// 154 seconds { 232, 1016, 0}, { 232, 1016, -8}, { 232, 1024, 0}, { 232, 1032, 0}, { 232, 1016, 0}, { 232, 1024, -8}, { 224, 1024, 0}, { 232, 1024, 0}, { 232, 1024, -8}, { 232, 1024, -8}, { 232, 1024, -8}, { 240, 1016, -8}, { 240, 1016, 0}, { 232, 1032, -8}, ...
{ 232, 1016, -48}, { 232, 1024, -48}, { 232, 1008, -32}, { 216, 1032, -24}, { 216, 1048, -16}, // 157 seconds { 216, 1032, -24}, { 224, 1016, -8}, { 224, 1016, -24}, { 224, 1024, -24}, { 216, 1032, -24}, { 216, 1040, -16}, { 224, 1024, -24}, { 216, 1032, -24}, ...
cmd_success; // check for INSERT cl_assert(BLOB_DB_COMMAND_INSERT == *(uint8_t*)cmd_ptr); cmd_ptr += sizeof(uint8_t); // check for token uint16_t token = *(uint16_t*)cmd_ptr; cl_assert(0 < token); cmd_ptr += sizeof(uint16_t); // check for a Database entry cl_assert(TEST_DB_ID == *(uint8_t*)cmd_ptr)...
(s_insert_cmd_no_value_size, sizeof(s_insert_cmd_no_value_size))
r); layer_init(&pin_window->action_button_layer, &window_layer->bounds); layer_set_clips(&pin_window->action_button_layer, false); pin_window->action_button_layer.update_proc = action_button_update_proc; layer_add_child(&pin_window->layer, &pin_window->action_button_layer); StatusBarLayer *status_layer = &p...
uuid_equal(id, &pin_window->item_detail_layer.item->header.id)
) { window_stack_remove((Window *)pin_window, true /* animated */); } } } void timeline_pin_window_push_modal(TimelineItem *item) { TimelinePinWindow *pin_window = kernel_zalloc_check(sizeof(TimelinePinWindow)); timeline_pin_window_init(pin_window, item, time_util_get_midnight_of(rtc_get_time())); wi...
c const PropertyAnimationImplementation implementation = { .base = { .setup = prv_setup_handler, .update = (AnimationUpdateImplementation) property_animation_update_int16, .teardown = prv_teardown_handler }, .accessors = { .setter = { .int16 = (const Int16Setter) prv_int16_setter, },...
animation_set_auto_destroy(h, false)
; prv_clear_handler_histories(); animation_schedule(h); int max_loops = 20; int num_loops = 0; uint64_t start_ms = prv_now_ms(); uint64_t time_ms; while (s_stopped_handler_calls.num_calls == 0) { num_loops++; prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("%"PRIu64": valu...
/* * 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...
((Layer *)kino_layer)
; } static void prv_player_did_stop(KinoPlayer *player, bool finished, void *context) { KinoLayer *kino_layer = context; if (kino_layer->callbacks.did_stop) { kino_layer->callbacks.did_stop(kino_layer, finished, kino_layer->context); } } /////////////////////////////////////////// // Kino Layer API ////////...
ator2, &state2, &head, TimelineIterDirectionFuture, 1421178000), 0); // should have one alloc for each node in list, + 1 for the current timelineitem cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), init_net_allocs + ARRAY_LENGTH(s_items) + 2); // deinit should free all the memory ti...
timeline_add(&multiday_item)
); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; cl_assert_equal_i(timeline_init(&head), S_SUCCESS); // 1425272400 is 21:00 March 1 2015 PST cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1425272400), S_SUCCESS); time_...
fely use the legacy2 behavior const uint16_t alt_radius = 8; FillCircleImplFunc circle_func = graphics_circle_quadrant_fill_non_aa; prv_fill_rect_internal(ctx, rect, radius, corner_mask, fill_color, alt_radius, circle_func); } #if PBL_COLOR T_STATIC void prv_fill_rect_aa(GContext* ctx, const GRect *rect, uint16_...
(ctx, rect, ctx->draw_state.stroke_width)
; } void graphics_draw_rect_by_value(GContext* ctx, GRect rect) { graphics_draw_rect(ctx, &rect); } void graphics_draw_rect_precise(GContext* ctx, const GRectPrecise *rect) { const Fixed_S16_3 right = grect_precise_get_max_x(rect); const Fixed_S16_3 bottom = grect_precise_get_max_y(rect); const GPointPrecise...
sert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); // ...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 3)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NULL), 3); // If we keep going, we should repeat the whole sequence another time prv_advance_to_ms_with_timers(start_ms + 2 * (duration_total + 4 * MIN_FRAME_INTERVAL_MS)); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_cal...
/* * 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...
{ start_offset -= job_length; }
else { const size_t copied_length = job->impl->copy(job, start_offset, remaining_length, data_out); remaining_length -= copied_length; data_out += copied_length; start_offset = 0; } job = (SessionSendQueueJob *)job->node.next; } return (length - remaining_length); } size_t comm_ses...
int32_t s_angle_start; static int32_t s_angle_end; //////////////////////////// void test_graphics_circle__initialize(void) { s_center = (GPointPrecise){}; s_radius = (Fixed_S16_3){}; s_radius_inner = (Fixed_S16_3){}; s_radius_outer = (Fixed_S16_3){}; } void test_graphics_circle__gpoint_from_polar_returns_ze...
(GRect(0, 0, 0, 0), grect_centered_internal(&p1, GSize(0, 0)))
; cl_assert_equal_grect(GRect(0, -1, 1, 2), grect_centered_internal(&p1, GSize(-1, -2))); // handles fixed point cl_assert_equal_grect(GRect(-1, -1, 2, 2), grect_centered_internal(&p1, GSize(2, 2))); p1.x.raw_value += FIXED_S16_3_HALF.raw_value; cl_assert_equal_grect(GRect(0, -1, 2, 2), grect_centered_intern...
const size_t header_size = offsetof(TimezoneCBData, region_name); const uint8_t *timezone_length_ptr = data + offsetof(TimezoneCBData, region_name_len); if (length != (sizeof(uint8_t) + header_size + *timezone_length_ptr)) { PBL_LOG(LOG_LEVEL_WARNING, "Set timezone message invalid length"); ...
rtc_get_time()
l_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); // ------------------------------------------------------------------------------------- // Build up a sequence out of the leftover a + b Animation *b = prv_create_test...
(seq, delay_seq)
; animation_set_handlers(seq, handlers, seq); animation_schedule(seq); // The duration of seq should include all of b uint32_t duration = animation_get_duration(seq, true, true); cl_assert_equal_i(duration, duration_b + delay_b + delay_seq); // The position of seq should be at -delay_seq int32_t positio...
200; VoiceUiData *data = context; loading_layer_shrink(&data->mic_window.progress_bar, SHRINK_DELAY, SHRINK_DURATION, prv_handle_animation_stop, data); } // shrink the progress bar from the left after animating the progress % to 100% static void prv_shrink_progress_bar(VoiceUiData *data) { animation_unsch...
(transcription_dialog, data->transcription_dialog_keep_alive_on_select)
; Dialog *dialog = expandable_dialog_get_dialog((ExpandableDialog *)transcription_dialog); dialog_set_destroy_on_pop(dialog, false /* free_on_pop */); transcription_dialog_push(transcription_dialog, prv_get_window_stack()); sys_light_reset_to_timed_mode(); } else { prv_exi...
mpt_send_response_fmt(buffer, sizeof(buffer), "(Sub)Sector at addr: 0x%"PRIX32" not really erased. is_subsector: %d", addr, is_subsector); goto done; } } } } done: return erased; } // ARG: // 0 - Only show sectors // 1 - Show subsectors too if sector is not ...
{ prompt_send_response("invalid bit number"); return; }
bit_number += next_digit; } int bit_mask = 1 << bit_number; if (value[0] == '0') { boot_bit_clear(bit_mask); } else if (value[0] == '1') { boot_bit_set(bit_mask); } else { prompt_send_response("invalid bit value, pick 1 or 0"); return; } prompt_send_response("OK bit assigned"); } t...
eturn prv_write_register(PmicRegisters_MON_CFG, value); } static bool prv_set_mon_config(const PmicMonConfig *config) { const uint8_t ratio_config = 4 - config->ratio; // 4:1 is 0b00, 1:1 is 0b11. const uint8_t register_value = (ratio_config << 4) | config->source_config; bool result = prv_set_mon_config_regist...
(GPIOF, GPIO_Pin_2, enabled?Bit_SET:Bit_RESET)
; gpio_release(GPIOF); } void set_6V6_power_state(bool enabled) { gpio_use(GPIOF); GPIO_WriteBit(GPIOF, GPIO_Pin_3, enabled?Bit_SET:Bit_RESET); gpio_release(GPIOF); } void set_accessory_power_state(bool enabled) { gpio_use(GPIOF); GPIO_WriteBit(GPIOF, GPIO_Pin_13, enabled?Bit_SET:Bit_RESET); gpio_releas...
/* * 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...
PBL_LOG(LOG_LEVEL_DEBUG, "Current time is <%s>", rtc_get_time_string(buffer))
; #endif } void rtc_calibrate_frequency(uint32_t frequency) { // Nothing to do here! (yet) } void rtc_init_timers(void) { // Nothing to do here! } RtcTicks rtc_get_ticks(void) { static TickType_t s_last_freertos_tick_count = 0; static RtcTicks s_coarse_ticks = 0; bool ints_enabled = mcu_state_are_interrup...
tail(time_t utc_sec) { bool need_history_update_event; uint16_t cur_day_index; mutex_lock_recursive(s_activity_state.mutex); { cur_day_index = time_util_get_day(utc_sec); need_history_update_event = (cur_day_index != s_activity_state.cur_day_index); // Call the activity sessions minute handler ...
{ activity_insights_process_sleep_data(utc_sec); activity_insights_process_minute_data(utc_sec); }
mutex_unlock_recursive(s_activity_state.mutex); } // ------------------------------------------------------------------------------------------------ // Runs on the timer task. Simply register a callback for the KernelBG task from here. static void prv_minute_cb(CronJob *job, void *data) { system_task_add_callba...
MPLES (40 * MINUTES_PER_HOUR) typedef struct { SampleDiscoveryState common; AlgMinuteFileSample samples[ACTIVITY_SAMPLES_DISCOVERY_MAX_SAMPLES]; ActivityFileTestEntry test_entry; } ActivitySampleDiscoveryState; static ActivitySampleDiscoveryState s_activity_sample_discovery_state; // --------------------------...
strtok(line, " \t\n")
/* * 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...
(REBOOT_REASON_REGISTER_1)
) { // It's not safe to log if we're called from an ISR or from a FreeRTOS critical section (basepri != 0) if (!mcu_state_is_isr() && __get_BASEPRI() == 0 && xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) { PBL_LOG(LOG_LEVEL_WARNING, "Reboot reason is already set"); } return; } ...
{ 1008, 504, -184}, { 696, 464, -168}, { 456, 600, -72}, { 304, 744, -216}, { -32, 912, -144}, { 64, 1040, -80}, { 184, 1048, -56}, { 72, 952, 88}, { -40, 832, -88}, { -240, 752, -104}, { -376, 840, 0}, { -512, 1128, -24}, { -640, 1024, -64}, { -472, 1112, -432}, ...
{ -504, 744, 144}, // 116 seconds { -408, 800, 288}, { -408, 896, 368}, { -360, 912, 456}, { -344, 864, 424}, { -352, 888, 376}, { -368, 872, 368}, { -376, 840, 400}, { -320, 800, 336}, { -280, 784, 376}, { -232, 672, 240}, { -184, 800, 368}, { -208, 824, 368}, ...
y_offset = PBL_IF_RECT_ELSE(22, 25); #endif width = window_width; break; case BTPairingUIStateFailed: case BTPairingUIStateSuccess: alignment = GAlignTop; #if PLATFORM_ROBERT || PLATFORM_CALCULUS x_offset = 0; y_offset = 59; #else x_offset = 2; y_offset = PBL_IF_...
(&data->info_text_mask_layer, &GRect(x_offset, info_text_y_offset, width, 26))
; #endif layer_set_clips(&data->info_text_mask_layer, true); layer_add_child(&window->layer, &data->info_text_mask_layer); TextLayer *info_text_layer = &data->info_text_layer; text_layer_init_with_parameters(info_text_layer, &pair_text_area, d...
)) / TRIG_MAX_RATIO) * sin_lookup(roll)) / TRIG_MAX_RATIO; mx_rot += (((mz * sin_lookup(pitch)) / TRIG_MAX_RATIO) * cos_lookup(roll)) / TRIG_MAX_RATIO; my_rot = mz * sin_lookup(roll) - my * cos_lookup(roll); my_rot /= TRIG_MAX_RATIO; int32_t heading = (atan2_lookup(-my_rot, mx_rot) + corr) % TRIG_...
(PEBBLE_COMPASS_DATA_EVENT, &prv_compass_data_service_start, &prv_compass_data_service_stop)
; } void ecompass_service_handle(void) { static int samples_collected = 0; // read magnetometer sample MagData mag_data; MagReadStatus rv = mag_read_data(&mag_data); if (rv != MagReadSuccess) { if (rv == MagReadCommunicationFail) { // heavy hammer fix for now // FIXME: move the restart logic...
new_state = RecognizerState_Completed; recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_Touchdown }); cl_assert_equal_i(last_touch_event.type, TouchEvent_Liftoff); cl_assert_equal_b(updated, false); fail->state = RecognizerState_Failed; recognizer_handle_touch_event(r, &(TouchEvent) { .typ...
NEW_RECOGNIZER(r1)
= test_recognizer_create(&s_test_impl_data, "R1"); NEW_RECOGNIZER(r2) = test_recognizer_create(&s_test_impl_data, "R2"); NEW_RECOGNIZER(r3) = test_recognizer_create(&s_test_impl_data, "R3"); RecognizerList list = { NULL }; recognizer_add_to_list(r1, &list); recognizer_add_to_list(r2, &list); recognizer_ad...
/* * 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_handle_fault()
; } void UsageFault_HandlerC(uint32_t *fault_args) { debug_print_str("Usage fault"); prv_handle_fault(); } void BusFault_HandlerC(uint32_t *fault_args) { debug_print_str("Bus fault"); prv_handle_fault(); } void MemManag_HandlerC(uint32_t *fault_args) { debug_print_str("MemManag fault"); prv_handle_fault(...
kernel/pebble_tasks.h" #include "os/mutex.h" #include "process_management/app_install_manager.h" #include "process_management/app_manager.h" #include "services/normal/accessory/smartstrap_attribute.h" #include "services/normal/accessory/smartstrap_comms.h" #include "services/normal/accessory/smartstrap_link_control.h" ...
{ const uint16_t service_id = ReservedServiceManagement; const uint16_t attribute_id = ManagementServiceAttributeServiceDiscovery; if (s_reserved_read_mbuf) { // already a read in progress return; } s_reserved_read_mbuf = mbuf_get(s_read_buffer, sizeof(s_read_buffer), MBufPoolSmartstrap); Smartstrap...
static void prv_set_connected(bool connected) { s_has_done_service_discovery = false; } static bool prv_handle_management_attribute_read(bool success, ManagementServiceAttribute attr, void *data, uint32_t length) { if (!success) { PBL_LOG(LOG_LEVEL_DEBUG, "Rea...
y = false, .layout = LayoutIdCalendar, }, .attr_list = { .num_attributes = 1, .attributes = &title_attr, }, }; // NOT A CALENDAR PIN static TimelineItem item5 = { .header = { .id = {0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, ....
timeline_remove(&item1.header.id)
); 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_past_event(void) { cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); rtc_s...
oth Host Transport WTF"); AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_BtLockupError, }; analytics_logging_log_event(&event_blob); #endif } static void prv_int_exti_cb(bool *should_context_switch) { // The controller responded -- stop the watchdog. prv_watchdog_stop(); switch (s_spi_trans...
if (!s_is_host_transport_initialized) { return HostTransportEnqueueStatus_Failure; }
if (s_spi_transport.state == SPITransportState_CoreDump) { PBL_LOG(LOG_LEVEL_INFO, "Skipping host transport enqueue .. waiting for reset"); return HostTransportEnqueueStatus_Failure; } PBL_ASSERTN(length < HOST_TRANSPORT_HOST_TX_BUFFER_SIZE && length < HOST_TRANSPORT_CTLR_RX_BUFFER_SIZE);...
E_STATIC, 10); cl_assert(fd >= 0); pfs_close(fd); cl_assert(s_watch_file_callback_called_count == 0); } extern status_t test_scan_for_last_written(void); void test_pfs__last_written_page(void) { pfs_format(true); pfs_init(false); // we just formatted so we shouldn't have a last written page cl_assert(te...
cl_assert(list_find(&dir_list->list_node, prv_find_name, "b_test_1"))
et_changed_handler }); scroll_layer_set_context(scroll_layer, expandable_dialog); #if PBL_ROUND scroll_layer_set_paging(scroll_layer, true); #endif if (show_action_bar) { // Icons for up and down on the action bar. #ifndef RECOVERY_FW expandable_dialog->up_icon = gbitmap_create_with_resource_syste...
if (expandable_dialog->show_action_bar) { action_bar_layer_deinit(&expandable_dialog->action_bar); }
gbitmap_destroy(expandable_dialog->up_icon); gbitmap_destroy(expandable_dialog->down_icon); if (*expandable_dialog->header) { text_layer_deinit(&expandable_dialog->header_layer); } scroll_layer_deinit(&expandable_dialog->scroll_layer); if (expandable_dialog->dialog.destroy_on_pop) { applib_free(exp...
/* * 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_private_using_legacy_2(NULL))
; PropertyAnimationPrivate *property_animation = prv_find_property_animation(property_animation_h); if (!property_animation) { return; } uint32_t result = interpolate_uint32(distance_normalized, property_animation->values.from.uint32, ...
, -168}, { 1008, 352, -152}, { 1152, 400, -64}, { 1192, 448, -40}, { 1040, 464, -64}, { 1264, 504, -72}, { 1616, 648, -64}, { 1008, 752, 144}, { 1360, 784, -184}, { 800, 536, -144}, // 91 seconds { 984, 552, -104}, { 1024, 624, -16}, { 1248, 608, 48}, { 1536, 456,...
{ 1176, 368, -120}, { 976, 360, -88}, { 1032, 336, -48}, { 1264, 328, -72}, { 1208, 400, -72}, { 1000, 424, -120}, { 1008, 440, -152}, { 1248, 528, -112}, { 1016, 504, -64}, { 984, 504, -56}, { 1240, 640, -120}, { 1200, 712, -136}, { 944, 504, -48}, { 1000, 480, -...
{ 1192, 608, 136}, // 99 seconds { 1048, 632, 144}, { 816, 688, 40}, { 768, 776, 8}, { 1008, 584, 24}, { 1176, 576, 160}, { 1576, 632, 152}, { 1624, 472, 128}, { 1552, 336, 104}, { 1584, 328, 56}, { 1384, 392, -232}, { 1184, 424, -384}, { 960, 488, -408}, { 9...
const Layer *layer = &peek->layout_layer; // For text flow, the whole screen is needed. Render the screen, then reduce to the layer. const bool use_screen = PBL_IF_ROUND_ELSE(true, false); prv_render_layer(&peek->window.layer, &(GRect) { gpoint_neg(layer->frame.origin), layer->frame.size }, ...
{ prv_set_timeline_item(NULL, false /* animated */); TimelinePeek *peek = timeline_peek_get_peek(); const Layer *layer = &peek->layout_layer; // Normally it is animated, but for this unit test, we don't request `animated` cl_assert(layer->frame.origin.y >= DISP_ROWS); // Peek service shows the peek UI. Not...
void test_timeline_peek__peek_visible_to_hidden_outside_of_watchface(void) { TimelineItem *item = prv_set_timeline_item(&(TimelinePeekItemConfig) { .title = "CoreUX Design x Eng", .subtitle = "ConfRM-Missile Command", .icon = TIMELINE_RESOURCE_TIMELINE_CALENDAR, .num_concurrent = 0, }, false /* an...
void test_put_bytes__put_message_length_field_too_long(void) { prv_receive_init_fw_object(); prv_process_and_reset_test_counters(); const size_t payload_size = 2; const uint8_t chunk[] = { 0xaa, 0xbb }; uint8_t buffer[sizeof(PutRequest) + payload_size]; PutRequest *put_msg = (PutRequest *)buffer; *put...
fake_comm_session_process_send_next()
; fake_system_task_callbacks_invoke_pending(); uint8_t buffer[num_ops * VALID_OBJECT_SIZE]; for (size_t i = 0; i < sizeof(buffer); i += VALID_OBJECT_SIZE) { uint32_t towrite = i; memcpy(&buffer[i], &towrite, sizeof(towrite)); } // Make sure we can receive new data in the middle of a pb_storage_appen...
t(sizeof(DotTransitionAnimationConfiguration) == sizeof(void *), ""); static void prv_collapse_animation_update_rect(GContext *ctx, DotTransitionAnimationConfiguration config, uint32_t distance_normalized) { GPathDrawFilled...
(ctx, distance_normalized, config.background_color, config.collapse_dot_color)
ed_is_usb_connected) { // disconnection event // - put the watch charger into a sane state // - disable fast-charge and re-enable the charger battery_set_charge_enable(true); battery_set_fast_charge(false); } PebbleEvent event = { .type = PEBBLE_BATTERY_CONNECTION_EVENT, .battery_connec...
(BOARD_CONFIG_POWER.chg_stat.gpio)
; bool state = !GPIO_ReadInputDataBit(BOARD_CONFIG_POWER.chg_stat.gpio, BOARD_CONFIG_POWER.chg_stat.gpio_pin); gpio_release(BOARD_CONFIG_POWER.chg_stat.gpio); periph_config_release_lock(); return state; } static bool battery_is_usb_connected_raw(void) { periph_config_acquire_lock(); gpio_use(BOARD_CONFIG_P...
ticsMetric last = ANALYTICS_METRIC_INVALID; switch (kind) { case ANALYTICS_HEARTBEAT_KIND_DEVICE: last = ANALYTICS_DEVICE_METRIC_END - 1; break; case ANALYTICS_HEARTBEAT_KIND_APP: last = ANALYTICS_APP_METRIC_END - 1; break; } PBL_ASSERTN(last != ANALYTICS_METRIC_INVALID); return analytics_me...
prv_location_set_value(location, val, analytics_metric_element_type(metric))
; } void analytics_heartbeat_set_entire_array(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric, const void* data) { uint8_t *location = prv_heartbeat_get_array_location(heartbeat, metric, 0); uint32_t size = analytics_metric_size(metric); memcpy(location, data, size); } ///////// // Get int64_t analytics_h...
/* * 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...
{ char dest[NAME_LENGTH]; phone_format_caller_name("Katharine Claire Berry", dest, NAME_LENGTH); cl_assert_equal_s(dest, "Katharine C. B."); }
void test_phone_formatting__name_double_space(void) { char dest[NAME_LENGTH]; phone_format_caller_name("Katharine Berry", dest, NAME_LENGTH); cl_assert_equal_s(dest, "Katharine B."); } void test_phone_formatting__name_trailing_space(void) { char dest[NAME_LENGTH]; phone_format_caller_name("Katharine Berr...
glance) { glance = prv_load_glance_for_node(node, service); if (!glance) { // Just bail out and don't modify the cache if we fail return NULL; } // Add the new glance to the cache prv_glance_cache_put(service, uuid, glance); } // Update the slice expiration timer if the glance's cu...
if (!service) { return; }
*service = (LauncherAppGlanceService) {}; prv_reset_slice_expiration_timer(service); service->glance_event_info = (EventServiceInfo) { .type = PEBBLE_APP_GLANCE_EVENT, .handler = prv_handle_glance_event, .context = service, }; event_service_client_subscribe(&service->glance_event_info); ser...
rge file const char *name = g_file_resource_stores[i].name; const uint8_t op_flags = OP_FLAG_READ | OP_FLAG_SKIP_HDR_CRC_CHECK | OP_FLAG_USE_PAGE_CACHE; const int fd = prv_file_open_by_name(name, op_flags); const uint32_t file_length = prv_file_common_get_length_and_close(fd); PBL_LOG(LOG_LEVEL_INF...
{ const uint8_t op_flags = OP_FLAG_READ | OP_FLAG_SKIP_HDR_CRC_CHECK | OP_FLAG_USE_PAGE_CACHE; return prv_file_common_read(prv_app_file_open(entry, op_flags), offset, data, num_bytes); }
const ResourceStoreImplementation g_app_file_impl = { .type = ResourceStoreTypeAppFile, .init = resource_storage_generic_init, .clear = resource_storage_app_file_clear, .check = resource_storage_generic_check, .metadata_size = resource_storage_generic_metadata_size, .find_resource = resource_storage_app...
s = 1, }; // Minimum interval boundary (no scan resp): job = gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert_equal_p(job, NULL); advert_term.min_interval_slots = 32; adve...
(regular_timer_seconds_count(), 0)
; free(ad); } void test_gap_le_advert__cant_schedule_after_deinit(void) { gap_le_advert_deinit(); BLEAdData *ad = create_ad(NULL, NULL); GAPLEAdvertisingJobTerm advert_term = { .min_interval_slots = 160, .max_interval_slots = 320, .duration_secs = 10, }; GAPLEAdvertisingJobRef job; job = gap_...
// Schedule a wakeup for 5 windows into the future time_t early_event = start_time + WAKEUP_EVENT_WINDOW * 5; WakeupId early_wakeup_id = sys_wakeup_schedule(early_event, 0, false); cl_assert_equal_i(sys_wakeup_query(early_wakeup_id), early_event); cl_assert_equal_i(early_wakeup_id, wakeup_get_next_scheduled(...
((stub_new_timer_timeout(gap_timer) / 1000) > WAKEUP_CATCHUP_WINDOW, true)
; } void test_wakeup__handle_clock_change_not_scheduled(void) { // Test clock change without wakeup event scheduled wakeup_handle_clock_change(); // Make sure no wakeup event is scheduled cl_assert_equal_i(sys_wakeup_query(wakeup_get_next_scheduled()), E_DOES_NOT_EXIST); // There should be no wakeup event...
limitations under the License. */ #include "applib/graphics/gtypes.h" #include "clar.h" #include "stubs_app_state.h" #include "stubs_heap.h" #include "stubs_passert.h" #include "stubs_process_manager.h" void test_graphics_colors__black(void) { cl_assert(GColorBlack.r == 0b00); cl_assert(GColorBlack.g == 0b00);...
gcolor_get_grayscale(GColorWhite)
nclude "voice_window.h" #include "voice_window_private.h" #include "loading_layer.h" #include "transcription_dialog.h" #include "applib/applib_malloc.auto.h" #include "applib/app_timer.h" #include "applib/event_service_client.h" #include "applib/fonts/fonts.h" #include "applib/graphics/text_render.h" #include "applib...
if (pebble_task_get_current() == PebbleTask_App) { return app_state_get_window_stack(); }
return modal_manager_get_window_stack(ModalPriorityVoice); } static void prv_put_analytics_event(VoiceUiData *data, bool success) { size_t response_size = 0; uint16_t response_len_chars = 0; if (data->message) { // If an error occurred and the owner of the voice window did not specify a buffer, // dat...
er_mark_dirty.call_count++; s_layer_mark_dirty.last_call = (MockCallRecording){.layer = layer}; } static MockCallRecordings s_graphics_context_set_fill_color; void graphics_context_set_fill_color(GContext* ctx, GColor color) { s_graphics_context_set_fill_color.call_count++; s_graphics_context_set_fill_color.last...
{ jerry_cleanup(); rocky_runtime_context_deinit(); }
void test_js__initialize(void) { fake_pbl_malloc_clear_tracking(); s_skip_mem_leak_check = false; fake_app_timer_init(); prv_init(); s_app_window_stack_get_top_window = (Window){}; s_app_state_get_graphics_context = NULL; s_layer_mark_dirty = (MockCallRecordings){}; s_graphics_context_set_fill_color...
{ if (BOARD_CONFIG.i2c_bus_configs[bus_idx].rail_ctl_fn == NULL) { return; } BOARD_CONFIG.i2c_bus_configs[bus_idx].rail_ctl_fn(false); // Drain through pull-ups bus_pin_cfg_output(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_scl, false); bus_pin_cfg_output(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_sda, ...
NVIC_Init(&NVIC_InitStructure)
; NVIC_InitStructure.NVIC_IRQChannel = BOARD_CONFIG.i2c_bus_configs[i].er_irq_channel; NVIC_Init(&NVIC_InitStructure); I2C_DeInit(i2c_buses[i].i2c); } s_initialized = true; for (uint32_t i = 0; i < ARRAY_LENGTH(i2c_buses); i++) { if (BOARD_CONFIG.i2c_bus_configs[i].rail_cfg_fn) { BOARD_C...
d_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw2_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 2); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DE...
graphics_draw_round_rect(&ctx, &ORIGIN_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_origin_r4_aa_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 11); graphics_dr...
t zero: 32-bit UUID, Bluetooth base UUID based: return sizeof(uint32_t); } // If byte0 and byte1 are zero: 16-bit UUID, Bluetooth base UUID based: return sizeof(uint16_t); } // ----------------------------------------------------------------------------- //! Finds the largest common UUID width. For UUIDs tha...
prv_write_element_to_ad_data(ad, element)
; } // ----------------------------------------------------------------------------- bool ble_ad_set_tx_power_level(BLEAdData *ad) { uint8_t element_buffer[sizeof(BLEAdElement) + sizeof(int8_t)]; BLEAdElement *element = (BLEAdElement *) element_buffer; element->header.length = sizeof(int8_t) + 1 /* +1 Type byte ...
/hc_endpoint_bonding_sync.h" #include "kernel/pbl_malloc.h" #include "ppogatt_emulated_server_wa.h" #include "system/logging.h" #include "system/passert.h" // Dialog SDK: #include "ble_common.h" #include "ble_gap.h" #include "storage.h" static key_ltk_t *prv_create_remote_ltk_from_info(const SMRemoteEncryptionInfo *e...
if (dev && dev->bonded) { // The LTK that's used when the local device is the master. if (dev->ltk) { memcpy(&info->remote_encryption_info.ltk, dev->ltk->key, sizeof(info->remote_encryption_info.ltk)); info->remote_encryption_info.rand = dev->ltk->rand; info->remote_encryption_inf...
info->is_mitm_protection_enabled = dev->mitm; bonding.is_gateway = connection_is_gateway(connection); if (connection_should_pin_address(connection)) { bonding.should_pin_address = true; connection_get_local_address(connection, &bonding.pinned_address); } BleBondingFlag flags = 0; ...
/* * 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...
{ ancs_app_storage_deinit(); }
void test_ancs_app_storage__one_app(void) { ANCSAppData app_data = { .bundle_id = "com.getpebble.PebbleApp", .display_name = "Pebble", .flags = ANCSAppIsBlocked, }; app_data.is_meta_changed = true; ancs_app_storage_save(&app_data); ANCSAppData app_data_out = { 0 }; ancs_app_storage_load(app_d...
/* * 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...
{ strncpy(buffer + avg_len, EN_DASH, buffer_size - avg_len); }
else { health_util_format_hours_and_minutes(buffer + avg_len, buffer_size - avg_len, daily_avg, i18n_owner); } } Window *health_sleep_detail_card_create(HealthData *health_data) { HealthSleepDetailCardData *card_data = app_zalloc_check(sizeof(HealthSleepDetailCardData)...
the underflow to produce the correct result. return start_ticks - end_ticks; } static bool prv_timer_check_delta(uint16_t start_ticks, uint16_t delta_ticks) { uint16_t curr_ticks = prv_timer_get_ticks(); bool s = (prv_timer_delta(start_ticks, curr_ticks) < delta_ticks); return s; } static void prv_timer_dela...
{ // Don't spin for too long, just in case the host doesn't clock out our response if (!prv_timer_check_delta(tx_start_ticks, TIMER0_10_MS)) { break; } continue; }
hw_spi_fifo_write8(s_spi->bus_id, core_dump_connect_response[tx_index++]); if (tx_index == sizeof(core_dump_connect_response)) { return true; } } } // Pulse the INT line to wake the host host_transport_set_mcu_int(true); prv_timer_delay_1ms(); // The timer IRQ j...
} return prv_app_switch(!config->forcefully); } // --------------------------------------------------------------------------------------------- void app_manager_handle_app_fetch_request_event(const PebbleAppFetchRequestEvent *const evt) { PBL_ASSERTN(evt); if (!evt->with_ui) { return; } const AppFet...
{ return process_metadata_get_res_bank_num(s_app_task_context.app_md); }
AppLaunchReason app_manager_get_launch_reason(void) { return s_next_app.common.reason; } ButtonId app_manager_get_launch_button(void) { return s_next_app.common.button; } void app_manager_get_framebuffer_size(GSize *size) { if (size == NULL) { return; } if (!s_app_task_context.app_md) { // No app...
35 ...0.A04 925 uint8_t volume_update[] = { 0x00, 0x02, 0x00, 0x30, 0x2e, 0x41, 0x30, 0x34, 0x39, 0x32, 0x35, }; prv_receive_entity_update(volume_update, sizeof(volume_update)); cl_assert_equal_i(music_get_volume_percent(), 0); } // Tests: Receiving Track updates ////////////////////...
stub_pebble_tasks_set_current(PebbleTask_KernelMain)
; ams_create(); cl_assert_equal_s(music_get_connected_server_debug_name(), NULL); } void test_ams__cleanup(void) { ams_destroy(); fake_gatt_client_op_deinit(); fake_gatt_client_subscriptions_deinit(); }
* Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
cl_will_return_count(bt_persistent_storage_get_root_key, true, 1)
; cl_will_return_count(bt_persistent_storage_get_root_key, false, 1); cl_will_return_count(rng_rand, false, RNG_MAX_RETRIES); cl_will_return_count(rand, 0x55, sizeof(SM128BitKey)); cl_will_return_count(rand, 0xaa, sizeof(SM128BitKey)); cl_will_return_count(bt_persistent_storage_set_root_keys, true, 1); S...
ler when we detect a high water mark on our receive // buffer or a footer signature. // // Parses the ISR's circular buffer and collects assembled message into a message buffer. If // a complete packets has been assembled, it returns a pointer to the message buffer, // the size of the packet (in *msg_bytes), and the pr...
state->hdr.protocol = ntohs(state->hdr.protocol); state->hdr.len = ntohs(state->hdr.len); // Validity checking if (state->hdr.len > QEMU_MAX_DATA_LEN) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid header data size %d", state->hdr.len); state->recv_state = QemuRecvState_Waiting...
shared_circular_buffer_read_consume(&state->isr_buffer, &state->isr_buffer_client, sizeof(footer), (uint8_t *)&footer, &bytes_read); bytes_avail -= bytes_read; footer.signature = ntohs(footer.signature); if (footer.signature != QEMU_FOOTER_SIGNATURE) { ...
/* * 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...
(test0, 0, 0, 1, 8)
== 192); cl_assert(raw_image_get_value_for_bitdepth(test0, 0, 0, 1, 1) == 1); cl_assert(raw_image_get_value_for_bitdepth(test0, 1, 0, 1, 1) == 1); cl_assert(raw_image_get_value_for_bitdepth(test1, 0, 3, 1, 2) == 3); cl_assert(raw_image_get_value_for_bitdepth(test1, 0, 3, 1, 1) == 1); cl_assert(raw_image_get...
uld be so it doesn't resize based // on its changing content (e.g. scrolling subtitle) vertical_node->container.size.w = glance_frame->size.w - structured_glance->icon_horizontal_margin - structured_glance->icon_max_size.w; return &vertical_node->container.node; } // NOINLINE to save stack; on S...
{ return false; }
if (!structured_glance->selection_animation_disabled) { structured_glance->selection_animation_elapsed_ms = elapsed_ms; } // We assume the selection animation loops so that it's last frame is the same as its first frame, // so let's enforce that here so the animation update code above works properly if (...
ctx, GPoint(0, 9), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 11), 3); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 13), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 15), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 17), 21); graphics_draw_horizontal_line_dotted(...
GPoint(15, 0)
, 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21); graphics_draw_vertical_line_dotted(&ctx, GPoint(19, 0), 22); graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.d...
ted, translated, english, translated, translated, ... if (data->num_strings_shown % 3 == 0) { prv_update_text_layer_with_translation(&data->info_text_layer, &english_translation); } else { prv_update_text_layer_with_translation(&data->info_text_layer, &translations...
{ strncpy(data->info_text_layer_buffer, (char *)i18n_get("Pair?", data), MAX_PAIR_STR_LEN); }
static void prv_deinitialize_info_text(BTPairingUIData *data) { i18n_free_all(data); } #endif static uint32_t prv_resource_id_for_state(BTPairingUIState state) { switch (state) { case BTPairingUIStateAwaitingUserConfirmation: return RESOURCE_ID_BT_PAIR_CONFIRMATION; case BTPairingUIStateAwaitingRe...
const jerry_value_t object, jerry_char_t *buffer_p, jerry_size_t buffer_size) { jerry_value_t str_ref = (jerry_value_t)EM_ASM_INT({ var str = __jerryRefs.ref(String(__jerryRefs.get($0))); return str...
__jerryRefs.ref(new Object(__jerryRefs.get($0)))
; }, value); } jerry_value_t jerry_value_to_primitive(const jerry_value_t value) { if (jerry_value_has_error_flag(value)) { return TYPE_ERROR_FLAG; } return (jerry_value_t)EM_ASM_INT({ var val = __jerryRefs.get($0); var rv; if ((typeof val === 'object' && val != null) || (type...
-352, 368, -1048}, { -256, -144, -1120}, { -56, -616, -928}, { 168, -288, -480}, { 72, 608, -536}, { -184, 656, -656}, { -464, 408, -496}, { -344, 464, -664}, { 32, 184, -1000}, { 176, 8, -1016}, // 75 seconds { 416, -104, -1184}, { 408, 56, -1272}, { 232, 16, -1088}...
{ -216, 352, -864}, { -104, 120, -1032}, { -72, -392, -1056}, { -280, 296, -720}, { -248, 64, -880}, { -232, -416, -520}, { -408, 592, 80}, { -288, 976, -296}, { -280, 744, -176}, { -288, 848, 328}, { -272, 1024, 424}, { -88, 720, 104}, { -216, 928, 96}, { -272, 1...
{ 192, 1152, -8}, { -80, 800, 184}, { -192, 752, 200}, // 83 seconds { -248, 944, 160}, { -304, 984, 192}, { -328, 944, 176}, { -312, 896, 280}, { -296, 800, 168}, { -248, 832, 232}, { -216, 784, 360}, { -8, 704, 200}, { -208, 552, 640}, { -144, 576, 720}, { ...
argc; GRectPrecise expected_output; char *error_msg; } cases[] = { { .argv = { [0] = jerry_create_number(0.0), [1] = jerry_create_number(0.0), [2] = jerry_create_number(0.0), [3] = jerry_create_number(0.0), }, .argc = 4, .expected_output = PP(0, 0, ...
ROCKY_ARGS_ASSIGN(ROCKY_ARG(output))
; ASSERT_JS_ERROR(error_value, cases[i].error_msg); if (!cases[i].error_msg) { cl_assert_equal_i(output.a, cases[i].expected_output.a); cl_assert_equal_i(output.r, cases[i].expected_output.r); cl_assert_equal_i(output.g, cases[i].expected_output.g); cl_assert_equal_i(output.b, cases[i].e...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const size_t size_maximum = app_message_inbox_size_maximum(); if (size_inbound > size_maximum) { // Truncate if it's more than the max: size_inbound = size_maximum; } else if (size_inbound == size_maximum) { APP_LOG(LOG_LEVEL_INFO, "app_message_open() called with app_message_inbox_size_maximum().");...
* buffer, uint32_t start_addr, uint32_t buffer_size) {} // Fakes /////////////////////////////////////////////////////////// typedef enum EraseCommandType { SectorEraseCommand, SubsectorEraseCommand } EraseCommandType; typedef struct EraseCommand { uint32_t addr; EraseCommandType type; } EraseCommand; stati...
(s_command_list[0].addr, 0)
; cl_assert_equal_i(s_command_list[0].type, SectorEraseCommand); s_command_list_index = 0; // App that's in an aligned bank but larger than than 64k flash_region_erase_optimal_range(0, 0, 69 * 1024, 96 * 1024); cl_assert_equal_i(s_command_list_index, 3); cl_assert_equal_i(s_command_list[0].addr, 0); cl...
32_t key, const uint16_t value) { return dict_write_data_internal(iter, key, (const uint8_t * const) &value, sizeof(value), TUPLE_UINT); } DictionaryResult dict_write_uint32(DictionaryIterator *iter, const uint32_t key, const uint32_t value) { return dict_write_data_internal(iter, key, (const uint8_t * const) &val...
dict_calc_buffer_size_from_tuplets(tuplets, tuplets_count)
&s_graphics_fill_radial_precise_internal.last_call; cl_assert_equal_point_precise(PP(29.5, 39.5), lc->fill_radial_precise.center); cl_assert_equal_i(10*8, lc->fill_radial_precise.radius_inner.raw_value); cl_assert_equal_i(20*8, lc->fill_radial_precise.radius_outer.raw_value); cl_assert_equal_i(TRIG_MAX_ANGLE *...
ASSERT_JS_GLOBAL_EQUALS_I("w", 2)
; EXECUTE_SCRIPT_EXPECT_ERROR( "ctx.lineWidth = -4;\n", "TypeError: Argument at index 0 is invalid: Value out of bounds for native type" ); EXECUTE_SCRIPT("var w = ctx.lineWidth;\n"); ASSERT_JS_GLOBAL_EQUALS_I("w", 2); } void test_rocky_api_graphics__line_styles_check_bounds(void) { prv_global_init_...
x, bool highlighted) { PBL_ASSERT(index < NUM_ACTION_BAR_LEGACY2_ITEMS, "Index: %"PRIu8, index); const uint8_t bit = (1 << index); if (highlighted) { action_bar->is_highlighted |= bit; } else { action_bar->is_highlighted &= ~bit; } } static void action_bar_legacy2_changed_proc(ActionBarLayerLegacy2 ...
click_recognizer_get_button_id(recognizer)
nt(app_stack), 1); // Pop the modal window off the stack window_stack_remove(window2, true); cl_assert_equal_i(window_stack_count(modal_stack), 0); cl_assert_equal_i(window2->on_screen, false); // Switch to app happens via the compositor compositor_transition(NULL); // Call the upkeep function so the c...
window_create()
; window_set_window_handlers(window, &(WindowHandlers){ .load = prv_window_load, .unload = prv_window_unload, .appear = prv_window_appear, .disappear = prv_window_disappear }); window_set_click_config_provider(window, prv_click_config_provider); cl_check(window->is_waiting_for_click_config); ...
/* * 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...
test_graphics_context_init(&ctx, fb)
; GBitmap *background_0_100 = get_gbitmap_from_pbi("blendtest_0_100_backdrop.pbi"); GBitmap *background_33_66 = get_gbitmap_from_pbi("blendtest_33_66_backdrop.pbi"); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_bitmap_in_rect(&ctx, background_0_100, &ORIGIN_RECT...
AXIS_NAMES[axis], before, positive, negative, delta, SELFTEST_THRESHOLDS[axis]); if (delta < SELFTEST_THRESHOLDS[axis]) { PBL_LOG(LOG_LEVEL_ERROR, "Self test failed for axis %c: %d < %d", AXIS_NAMES[axis], delta, SELFTEST_THRESHOLDS[axis]); return false; } if ((new_data + ne...
prompt_send_response_fmt(buf, 64, "(0x18) Int EN 2: 0x%"PRIx8, int_en_2)
; prompt_send_response_fmt(buf, 64, "(0x0a) Int Status 0: 0x%"PRIx8, int_status_0); prompt_send_response_fmt(buf, 64, "(0x0a) Int Status 1: 0x%"PRIx8, int_status_1); prompt_send_response_fmt(buf, 64, "(0x0b) Int Status 2: 0x%"PRIx8, int_status_2); prompt_send_response_fmt(buf, 64, "(0x0c) Int Status 3: 0x%"PRI...
time_us = (195 - 1); prv_write_register(PmicRegisters_PWM_CNTL_H, pwm_high_low_time_us); prv_write_register(PmicRegisters_PWM_CNTL_L, pwm_high_low_time_us); bool success = false; uint8_t ref_cntl; if (prv_read_register(PmicRegisters_REFERENCE_CNTL, &ref_cntl)) { ref_cntl |= 0x3; // Divisor of 16 prv_...
prv_set_register_bit(PmicRegisters_REFERENCE_CNTL, 5, false)
; return true; } // On the as3701b, a power_off will cut power to all rails. We want to keep the // RTC alive, so rather than performing a sw_power_off, enter the pmic's standby // mode, powering down all but LDO2. bool pmic_power_off(void) { // Only enable interrupts that should be able to wake us out of standby...
the string, insert a space before the word if (strlen(sentence) != 0) { strcat(sentence, " "); } strncat(sentence, (char *) word->data, word->length); } return true; } static bool prv_handle_dictation_nlp_result_common(VoiceEndpointResult result, ...
PBL_LOG(LOG_LEVEL_INFO, "Transcription received (%"PRIu32" B)", (uint32_t)sentence_size)
; } prv_send_event(VoiceEventTypeSessionResult, VoiceStatusSuccess, event_data); unlock: prv_reset(); mutex_unlock(s_lock); } // receiving this ends the session, sending an event to the main task with the result void voice_handle_nlp_result(VoiceEndpointResult result, AudioEndpointSessionId session_id, ...