prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gdraw_command_image_create_with_resource(resource_id)
; cl_assert(image != NULL); } void test_gdraw_command_resources__load_pdcs(void) { uint32_t resource_id = sys_resource_load_file_as_resource(TEST_IMAGES_PATH, TEST_PDC_FILE); cl_assert(resource_id != UINT32_MAX); GDrawCommandSequence *sequence = gdraw_command_sequence_create_with_resource(resource_id); cl_as...
l_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_resources.h" #include "stubs_syscalls.h" #include "stubs_unobstructed_area.h" // Setup //////////////////////////////////// void test_layer__initialize(void) { } void test_layer__cleanup(void) { } GDrawState graphics_context_get_drawing_state(GContext *ctx...
(layers[i], &GRectZero)
; } // Create this hierarchy: // // +-parent // | // '->child_a // layer_add_child(&parent, &child_a); // Insert child_b below child_b (first_child code path): // // +-parent // | // '->child_b->child_a // layer_insert_below_sibling(&child_b, &child_a); cl_assert(child_b...
(0x00aaff)
).argb); cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0xaa0055)).argb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0x55aa55)).argb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0xff5555)).argb); cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0x0055aa)).argb); cl_assert_equ...
e data has been drained to the FIFO, // not when it actually gets drained. static void prv_write_or_read_bytes(void *byte_buffer, int num_bytes, bool do_write) { s_expected_bytes_received = false; if (do_write) { hw_spi_write_buf(HOST_SPI->spi.peripheral, byte_buffer, num_bytes, prv...
(HOST_SPI->spi.cs_2.port, HOST_SPI->spi.cs_2.pin, HW_GPIO_MODE_INPUT, HOST_SPI->spi.cs_2.function)
/* * 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...
(true, has_cap)
; cl_assert_equal_b(false, s_get_called); cl_assert_equal_b(false, s_close_called); } void test_app_session_capabilities__cache_file_and_not_connected(void) { s_has_cache = true; s_get_value = CommSessionInfiniteLogDumping; bool has_cap = comm_session_current_app_session_cache_has_capability(CommSessio...
be(&data->voice_event_sub); prv_disable_select_click(data); } // Mic window unload called last when UI is exited. Unsubscribe from events and free UI data static void prv_mic_window_unload(Window *window) { VoiceUiData *data = window_get_user_data(window); kino_layer_deinit(&data->mic_window.icon_layer); load...
(&voice_window->mic_window.window)
efore the previous write caused // a "send_next" callback to be scheduled. s_is_current_task_send_next_task = true; // Set a yield callback that gives the semph in time but does not clear out the send buffer: SemaphoreHandle_t write_semph = comm_session_send_buffer_write_semaphore(); fake_queue_set_yield_cal...
comm_session_send_buffer_write(write_sb, fake_data_payload, max_payload_length - second_write_length)
, true); cl_assert_equal_b(comm_session_send_buffer_write(write_sb, fake_data_payload + second_write_length, second_write_length), true); cl_assert_equal_i(s_send_next_count, 0); comm_session_send_buffer_end_wri...
); cl_assert_equal_i(animation_get_duration(a, true, false), delay_a + duration_a); cl_assert_equal_i(animation_get_duration(a, true, true), total_duration_a); cl_assert_equal_i(animation_get_duration(b, false, false), duration_b); cl_assert_equal_i(animation_get_duration(b, false, true), play_count_b * durati...
(spawn != NULL)
; // Create a primitive one Animation *e = prv_create_test_animation(); // Schedule them all animation_schedule(seq); animation_schedule(spawn); animation_schedule(e); // Verify count cl_assert_equal_i(prv_count_scheduled_animations(), 7); // Unschedule all animation_unschedule_all(); cl_asser...
N_ELAPSED_DURATION (600) #define TEXT_PADDING (4) #define MIC_DOT_MAX_RADIUS (9) #define MIC_DOT_LAYER_RADIUS (MIC_DOT_MAX_RADIUS + 1) #define MIC_DOT_LAYER_SIZE ((GSize){ .w = MIC_DOT_LAYER_RADIUS * 2, .h = MIC_DOT_LAYER_RADIUS * 2}) #define MAX_MESSAGE_LEN (500) #define MAX_ERROR_COUNT (4) #define ERROR_DIALOG_T...
VOICE_LOG("Restarting dictation after error")
; prv_start_dictation(data); } else { VOICE_LOG("Too many errors! Exiting..."); prv_exit_and_send_result_event(data, data->error_exit_status); } } static void prv_error_dialog_unload(void *context) { VoiceUiData *data = context; prv_handle_error_retries(data); } static void prv_init_dialog(VoiceUi...
action_bar_layer_set_icon(action_bar, BUTTON_ID_SELECT, actionable_dialog->select_icon); } else if (actionable_dialog->action_bar_type == DialogActionBarDecline) { #if !defined(RECOVERY_FW) actionable_dialog->select_icon = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_X); #endif action_bar_layer_...
{ actionable_dialog_init(actionable_dialog, dialog_name); }
nd = PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite); } // Create the icon KinoReel *icon_reel = kino_reel_create_with_resource(icon_res_id); if (!icon_reel) { PBL_CROAK("Couldn't create kino reel"); } // Position the icon kino_area = GRect(icon_x_offset, icon_y_offset, data->launch_app_window.layer...
layer_set_frame(&data->name_text_layer.layer, &frame); }
static void prv_window_load(Window* window) { struct RecoveryFUAppData *data = (struct RecoveryFUAppData*) window_get_user_data(window); KinoLayer *kino_layer = &data->kino_layer; kino_layer_init(kino_layer, &window->layer.bounds); layer_add_child(&window->layer, &kino_layer->layer); #if PLATFORM_ROBERT || ...
t_circular_cache__initialize(void) { memset(s_cache_buffer, 0, sizeof(s_cache_buffer)); circular_cache_init(&s_test_cache, (uint8_t *)s_cache_buffer, sizeof(TestCacheItem), NUM_TEST_ITEMS, prv_comparator); for (int i = 0; i < ARRAY_LENGTH(s_test_item); i++) { s_free_flags[i] = false; }...
(!(*s_test_item[2].freed))
; memset(s_cache_buffer, 0, sizeof(s_cache_buffer)); *s_test_item[0].freed = false; circular_cache_push(&s_test_cache, &s_test_item[0]); circular_cache_push(&s_test_cache, &s_test_item[1]); circular_cache_push(&s_test_cache, &s_test_item[2]); circular_cache_flush(&s_test_cache); cl_assert(*s_test_item[0...
ont_info, GRect(4, 20, 72, 32), GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } void draw_text_single_line_ellipsis_clip_across_nx(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(-44, 4,...
(ctx, GColorBlack)
; graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, 40, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_clip_outside_nx(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_...
't need to worry about being blocked return; } mutex_lock_recursive(s_blocked_lock); } static void prv_unlock(void) { if (mcu_state_is_isr()) { // assume we're in an ISR for the UART and don't need to worry about being blocked return; } mutex_unlock_recursive(s_blocked_lock); } static void prv_e...
gpio_output_set(&BOARD_CONFIG_ACCESSORY.power_en, false)
; // Turn power off accessory_set_baudrate(DEFAULT_BAUD); periph_config_release_lock(); prv_initialize_exti(); } static void prv_set_baudrate(uint32_t baudrate, bool force_update) { if ((baudrate != s_baudrate) || force_update) { PBL_LOG(LOG_LEVEL_DEBUG, "Changing accessory connector baud rate to %"PRI...
XNY GPoint(10, 15) void test_graphics_draw_circle_${BIT_DEPTH_NAME}__origin_layer_aa(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Big circles setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG); cl_c...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_x_offset_layer.${BIT_DEPTH_NAME}.pbi"))
py of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the ...
prv_assert_can_handle_characteristics(0, true /* expect_can_handle */)
rvices/common/new_timer/new_timer.h" #include "clar.h" #include <stdbool.h> // Stubs /////////////////////////////////////////////////////////// #include "stubs_logging.h" #include "stubs_passert.h" // Fakes /////////////////////////////////////////////////////////// typedef enum EraseCommandType { SectorEraseC...
{ prv_test_erase_optimal_range(0, 0, 0, 0, (EraseCommand[]){ { } }); }
void test_flash_erase__sectors_simple_1(void) { // Erase one sector 0x10000 - 0x20000 prv_test_erase_optimal_range( 64 * 1024, 64 * 1024, 2 * 64 * 1024, 2 * 64 * 1024, (EraseCommand[]) { { 64 * 1024, SectorEraseCommand }, { }, }); } void test_flash_erase__sectors_simple_2(void) ...
EXECUTE_SCRIPT("ctx.restore()\n"); // no-op cl_assert_equal_i(1, s_context.draw_state.fill_color.argb); } static const int16_t large_int = 10000; void test_rocky_api_graphics__fill_text(void) { prv_global_init_and_set_ctx(); // we do this in C and not JS as color binding is not linked in this unit-test // ...
EXECUTE_SCRIPT("ctx.textAlign = 'center';\nvar a = ctx.textAlign;\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...
PBL_LOG(LOG_LEVEL_INFO, "HcGap: no connection for "BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(resp->addr.address))
; return; } // The value is a non-zero-terminated UTF-8 string int device_name_buffer_length = MIN(resp->name_length + 1, BT_DEVICE_NAME_BUFFER_SIZE); char *device_name = (char *)kernel_zalloc_check(device_name_buffer_length); if (!device_name) { return; } memcpy(device_name, resp->name, device_n...
g/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limi...
(FONT_KEY_GOTHIC_24_BOLD, selected ? FONT_KEY_GOTHIC_24_BOLD : FONT_KEY_GOTHIC_18_BOLD)
); GFont const subtitle_font = fonts_get_system_font(FONT_KEY_GOTHIC_18); menu_cell_basic_draw_custom(ctx, cell_layer, title_font, node->name, NULL, NULL, subtitle_font, subtitle, bitmap, false, GTextOverflowModeTrailingEllipsis); } /////////////////// // Window callbacks static void...
/* * 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...
grect_union(&f->dirty_rect, &rect)
; } const GRect clip_rect = (GRect) { GPointZero, f->size }; grect_clip(&f->dirty_rect, &clip_rect); f->is_dirty = true; }
surements(session_ref, rtc_get_time(), input.msrmt.num_types, &input.msrmt.values[i * values_per_samples]); cl_assert(success); } // Flush it out now, this should end up in our transport method being called ms...
prv_test_encode_measurements(&input, false /*use_data_logging*/)
; prv_test_decode_payload(&input, false /*use_data_logging*/, ref); } // --------------------------------------------------------------------------------------------- // Test using the data logging transport void test_protobuf_log__hr_samples(void) { ProtobufLogMeasurementType types[] = {ProtobufLogMeasurementTyp...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
bt_lock_init()
; } bool bt_driver_start(BTDriverConfig *config) { // The first time the stack starts, use the QemuSetting_DefaultConnected setting. // Subsequent times, always auto-connect when the stack starts. static bool s_should_auto_connect = false; // Have KernelMain set us to connected once the event loop starts up, ...
160}, { 1176, 312, -72}, { 1128, 128, 16}, { 1064, 16, -8}, { 1136, 48, -16}, // 37 seconds { 1208, 104, -16}, { 1136, 96, 24}, { 1000, 72, 16}, { 1032, 80, -32}, { 944, 96, -184}, { 960, -40, -208}, { 1112, -120, -168}, { 944, 0, -232}, { 888, -88, -240}, { 1...
{ 1344, 360, -264}, { 1040, 400, -184}, { 912, 280, -160}, { 1088, 232, -128}, { 1320, 288, -80}, { 1256, 208, -64}, { 1128, 16, 8}, { 1136, 0, 0}, { 1120, 24, -64}, { 1056, 104, -72}, { 824, 56, -72}, { 768, 72, -160}, { 968, 64, -232}, { 784, 40, -272}, { 96...
/* * 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, GUARD_CHAR, NAME_LENGTH)
rphans(&resource_files); pfs_delete_file_list(resource_files); } ////////////////////////// // AppCache Settings API's ////////////////////////// //! Set up the app cache void app_cache_init(void) { s_app_cache_mutex = mutex_create_recursive(); mutex_lock_recursive(s_app_cache_mutex); { // if no cache fi...
{ SettingsFile file; status_t rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE); if (rv != S_SUCCESS) { goto unlock; } settings_file_each(&file, prv_each_get_size, &cache_size); settings_file_close(&file); }
unlock: mutex_unlock_recursive(s_app_cache_mutex); return cache_size; } typedef struct { AppInstallId id; uint32_t priority; } AppCacheEachData; //! Settings iterator function that finds the entry with the lowest calculated priority static bool prv_each_min_priority(SettingsFile *file, SettingsRecordInfo *in...
/* * 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...
{ mutex_assert_held_by_curr_task(s_free_list_lock, true); MBuf *m = s_free_list; while (m) { PBL_ASSERTN(mbuf_is_flag_set(m, MBUF_FLAG_IS_MANAGED)); PBL_ASSERTN(mbuf_is_flag_set(m, MBUF_FLAG_IS_FREE)); PBL_ASSERTN(!mbuf_get_data(s_free_list)); PBL_ASSERTN(mbuf_get_length(m) == 0); m = mbuf_get...
MBuf *mbuf_get(void *data, uint32_t length, MBufPool pool) { PBL_ASSERTN(pool < NumMBufPools); MBuf *m; mutex_lock(s_free_list_lock); // get an MBuf out of the free list if possible, or else allocate a new one if (s_free_list) { prv_check_free_list(); // remove the head of the free list to be return...
prefs); return NULL; } prv_free_serialzed_prefs(serialized_prefs); return notif_prefs; } void ios_notif_pref_db_free_prefs(iOSNotifPrefs *prefs) { kernel_free(prefs); } status_t ios_notif_pref_db_store_prefs(const uint8_t *app_id, int length, AttributeList *attr_list, ...
{ return NULL; }
t_impl_data.last_touch_event = &last_touch_event; s_test_impl_data.new_state = &new_state; s_test_impl_data.updated = &updated; NEW_RECOGNIZER(r) = test_recognizer_create(&s_test_impl_data, &rec_event); new_state = RecognizerState_Possible; recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_...
(r->state, new_state)
_inbox_service_write(AppInboxServiceTagAppMessageReceiver, data, length); } static Receiver *prv_app_message_receiver_prepare(CommSession *session, const PebbleProtocolEndpoint *endpoint, size_t total_payload_size) { ...
prv_finally(rcv, kernel_receiver_finally_cb)
; } static void prv_app_message_receiver_cleanup(Receiver *receiver) { AppMessageReceiver *rcv = (AppMessageReceiver *)receiver; if (rcv->is_writing_to_app_inbox) { // Cancel the write, we don't want to deliver a broken message to the watchapp: app_inbox_service_cancel(AppInboxServiceTagAppMessageReceiver...
_ERROR, "Failed to start loader"); return false; } // wait for the loader to be ready if (!prv_wait_for_loader_ready(dev)) { PBL_LOG(LOG_LEVEL_ERROR, "Loader not ready"); return false; } const uint32_t image_length = resource_size(SYSTEM_APP, RESOURCE_ID_AS7000_FW_IMAGE); PBL_ASSERTN(image...
if (!prv_get_and_log_device_info(dev, &info, false /* log_version */)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to query AS7000 device info"); goto failed; }
nimations++] = prv_create_bounce_back_animation( &layer->end_of_timeline.layer, fin_from, direction); Animation *animation = animation_spawn_create_from_array(animations, num_animations); return animation; } void timeline_layer_set_layouts_hidden(TimelineLayer *layer, bool hidden) { for (int i = 0; i < TI...
animation_unschedule_all()
; for (int i = 0; i < TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER; i++) { if (layer->layouts[i]) { prv_destroy_layout(layer, i); } } peek_layer_deinit(&layer->day_separator); kino_layer_deinit(&layer->end_of_timeline); // TODO: PBL-21982: Only support rectangular screen for now #if PBL_RECT timeline_r...
ed prv_assert_known_settings(); // Extract activity settings file from PFS and save to the local file system char out_path[strlen(CLAR_FIXTURE_PATH) + strlen(ACTIVITY_FIXTURE_PATH) + strlen(filename) + 3]; sprintf(out_path, "%s/%s/%s", CLAR_FIXTURE_PATH, ACTIVITY_FIXTURE_PATH, filename); // Open and read ...
activity_start_tracking(false /*test_mode*/)
; fake_system_task_callbacks_invoke_pending(); // ----------------------------------- // Test that we receive step update events fake_event_reset_count(); // Feed in 100 steps/minute over 1 minute. We should get some step update events prv_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 100, ActivitySleepS...
else if (font == fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)) { font_height = 18; } else if (font == fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)) { font_height = 14; } return (height / 2) - (font_height / 2) - font_top_padding; } ////////////////////////////////////////////////////////////////////...
for (unsigned i = 0; i < selection_layer->num_cells; i++) { if (selection_layer->selected_cell_idx == i) { break; } starting_x_offset += selection_layer->cell_widths[i] + selection_layer->cell_padding; }
// The slider moves horizontally (to the right only) from 1 cell to another. // In total we need to slide from our current x offset, to the x offset of the next cell int next_cell_width = selection_layer->cell_widths[selection_layer->selected_cell_idx + 1]; int slide_distance = next_cell_width + selection_lay...
s_animations; // Fake implementations of the real animation interface. ///////////////////////////////////////////////////////////// Animation *animation_create(void) { AnimationPrivate *animation = malloc(sizeof(AnimationPrivate)); *animation = (AnimationPrivate) {}; if (!s_animations) { s_animations = (L...
{ if (!animation) { return 0; } return ((AnimationPrivate *)animation)->duration_ms; }
ap_le_slave_discovery.h" #include "kernel/pebble_tasks.h" #include "services/common/bluetooth/bluetooth_ctl.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/bluetooth/local_addr.h" #include "services/common/bluetooth/pairability.h" #include "services/common/regular_timer....
if (!s_pairable_due_to_no_gateway_bondings) { bt_pairability_use(); s_pairable_due_to_no_gateway_bondings = true; }
} else { if (s_pairable_due_to_no_gateway_bondings) { bt_pairability_release(); s_pairable_due_to_no_gateway_bondings = false; } } } void bt_pairability_init(void) { bt_pairability_update_due_to_bonding_change(); prv_schedule_evaluation(); }
/* * 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...
{ // Read the beginning of the firmware off flash to see if it's new world or old world const unsigned world_length = FW_IDENTIFIER_OFFSET + sizeof(uint32_t); // NeWo read as uint32_t uint8_t buffer[world_length]; flash_read_bytes(buffer, flash_new_fw_addr, world_length); return firmware_is_new_world(buffer...
static bool prv_erase_old_firmware(bool new_world, uint32_t firmware_length) { dbgserial_putstr("erase_old_firmware"); uint32_t system_flash_base = FIRMWARE_NEWWORLD_BASE; uint32_t erase_length = firmware_length; if (!new_world) { // If the incoming firmware is an old world firmware, we need to not only ...
o be locked because they're the sole property of the process and no //! other tasks should be touching it. All this function does is verify that //! this condition is met before continuing without locking. static void prv_heap_lock(void* unused) { PBL_ASSERT_TASK(PebbleTask_Worker); } static size_t prv_get_worker_se...
(LOG_LEVEL_ERROR, "Worker state configuration failed")
; return false; } // The remaining space in worker_segment is assigned to the worker's // heap. Worker state needs to be configured before initializing the // heap as the WorkerState struct holds the worker heap's Heap object. Heap *worker_heap = worker_state_get_heap(); PBL_LOG(LOG_LEVEL_DEBUG, "Worker...
ds][0] = 30 * SECONDS_PER_MINUTE; s_data.metric_history[ActivityMetricSleepEnterAtSeconds][0] = 0; // Push a pin rtc_set_time(rtc_get_time() + 5 * SECONDS_PER_HOUR); prv_add_sleep_session(0, 7); activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 1); // Re-init (si...
prv_set_sleep_history_avg()
; activity_insights_init(rtc_get_time()); // Common metrics s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateAwake; s_data.metric_history[ActivityMetricSleepStateSeconds][0] = 30 * SECONDS_PER_MINUTE; s_data.metric_history[ActivityMetricSleepEnterAtSeconds][0] = 0; // Push a pin rt...
common/evented_timer.h" #include "services/common/i18n/i18n.h" #include "services/common/light.h" #include "services/common/regular_timer.h" #include "services/normal/blob_db/ios_notif_pref_db.h" #include "services/normal/blob_db/pin_db.h" #include "services/normal/blob_db/reminder_db.h" #include "services/normal/notif...
{ const int notif_count = notifications_presented_list_count(); if (notif_count <= 1) { // if less than one notification, clear the status bar info status_bar_layer_reset_info(&data->status_layer); } else { // if more than one, then show the current index in relation to the total number status_bar...
ubs_analytics.h" #include "stubs_hexdump.h" #include "stubs_logging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stubs_serial.h" #include "stubs_sleep.h" #incl...
{ const uint32_t key = 0; const uint32_t value = ~0; cl_assert_equal_i(persist_read_int(key), 0); cl_assert_equal_i(persist_write_int(key, value), sizeof(int)); cl_assert_equal_i(persist_get_size(key), sizeof(int)); cl_assert_equal_i(persist_read_int(key), value); }
E_INVALID_ARGUMENT; } const WeatherDBEntry *entry = (WeatherDBEntry *)val; if (entry->version != WEATHER_DB_CURRENT_VERSION) { PBL_LOG(LOG_LEVEL_WARNING, "Version mismatch on insert! Entry version: %" PRIu8 ", WeatherDB version: %u", entry->version, WEATHER_DB_CURRENT_VERSION); r...
prv_close_file_and_unlock_mutex()
; return rv; } #endif
in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,...
prv_test_get_hit(1, 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...
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE)
; RCC_RTCCLKCmd(ENABLE); RTC_InitTypeDef rtc_init_struct; RTC_StructInit(&rtc_init_struct); rtc_init_struct.RTC_AsynchPrediv = RTC_CLOCK_ASYNC_PRESCALER; rtc_init_struct.RTC_SynchPrediv = RTC_CLOCK_SYNC_PRESCALER; RTC_Init(&rtc_init_struct); } RTC_WaitForSynchro(); periph_config_release...
ash_sector_is_erased(sector_addr)) { PBL_LOG(LOG_LEVEL_DEBUG, "Sector %#"PRIx32" already erased", sector_addr); return; } flash_lock(); if (!flash_is_enabled()) { flash_unlock(); return; } power_tracking_start(PowerSystemFlashErase); enable_flash_spi_clock(); handle_sleep_when_idle_beg...
for (uint32_t addr = start_addr; addr < end_addr; addr += SECTOR_SIZE_BYTES) { flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_WRITE_LOCK_REGISTER); flash_send_24b_address(addr); flash_send_and_receive_byte(lock_bits); flash_end_cmd(); }
disable_flash_spi_clock(); flash_unlock(); } void flash_erase_sector(uint32_t sector_addr, FlashOperationCompleteCb on_complete_cb, void *context) { // TODO: implement nonblocking erase flash_erase_sector_blocking(sector_addr); on_complete_cb(context, S_SUCC...
recise starting_point = prv_get_rotated_precise_point(center, radius.raw_value, angle_start); GPointPrecise ending_point = prv_get_rotated_precise_point(center, radius.raw_value, angle_end); prv_fill_oval_precise(ctx, starting_point, half_stroke_width, half_stroke_width, ...
{ // Cast given values to precise point GPointPrecise center_fixed; center_fixed.x.integer = center.x; center_fixed.y.integer = center.y; center_fixed.x.fraction = 0; center_fixed.y.fraction = 0; Fixed_S16_3 radius_inner_fixed = (Fixed_S16_3){.integer = radius_inner, .fraction = 0}; Fixed_S16_3 radius_o...
void graphics_fill_radial(GContext *ctx, GRect rect, GOvalScaleMode scale_mode, uint16_t inset_thickness, int32_t angle_start, int32_t angle_end) { GPointPrecise center; Fixed_S16_3 radius_outer; grect_polar_calc_values(&rect, scale_mode, &center, &radius_oute...
, 20, 20), 4, GCornersAll); } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 20, 10)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_c...
(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite))
; } #define RECT_WIDTH 30 #define RECT_HEIGHT 40 #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 20, 20) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 144, 168) #define ORIGIN_DRAW_RECT_NO_CLIP GRect(6, 6, RECT_WIDTH, RECT_HEIGHT...
void* buf, size_t num_bytes) { uintptr_t addr = (uintptr_t)buf; uintptr_t end = addr + num_bytes - 1; if ((addr >= s_user_start) && (addr < (s_user_start + s_user_size)) && (end >= s_user_start) && (end < (s_user_start + s_user_size))) { s_addr_result = UserSpaceBuffer_Valid; } else { s_addr_resul...
(s_addr_result, UserSpaceBuffer_Invalid)
#include "stm32f2xx_rcc.h" #include "stm32f2xx_rtc.h" //! LSE startup time, about 4 seconds empirically, //! but we give it 30 seconds since it it fails we sadwatch static const int LSE_READY_TIMEOUT_MS = 30000; static const unsigned int LSE_FREQUENCY_HZ = 32768; static const int RTC_ASYNC_PRESCALER = 7; static const...
(RTC_Format_BIN, &rtc_time)
; } void rtc_speed_up(void) { if (!prv_slow_mode()) { // If we're not in slow mode there's nothing to do return; } // On standby the RTC is reset to date 0, so the RTC's time is really // the number of seconds we've been in standby int32_t elapsed_since_standby = prv_seconds_since_standby(); int32...
/* * 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...
{ GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD); text_layer_set_font(text_layer, font); if (highlight) { text_layer_set_background_color(text_layer, GColorWhite); text_layer_set_text_color(text_layer, GColorBlack); } else { text_layer_set_background_color(text_layer, GColorClear); ...
static void set_text_layers(AppData *data) { // Set Alpha Text uint8_t alpha_percent = 0; if (data->alpha == ALPHA_100) { alpha_percent = 100; } else if (data->alpha == ALPHA_66) { alpha_percent = 50; // FIXME: Currently don't support 66 } else if (data->alpha == ALPHA_33) { alpha_percent = 25; ...
/* * 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...
(num.fraction == 2)
{ window_single_click_subscribe(BUTTON_ID_UP, (ClickHandler) click_handler); window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler) click_handler); window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler) click_handler); }
static void init(void) { window = window_create(); window_set_click_config_provider(window, (ClickConfigProvider) config_provider); window_stack_push(window, false); GRect from_rect_a = GRect(0, 0, 60, 60); GRect to_rect_a = GRect(84, 92, 60, 60); GRect from_rect_b = GRect(84, 0, 60, 60); GRect to_re...
///////////////////////////////////////////////////////////// void test_stringlist__test(void) { StringList *list = malloc(20); memset(list, 0, 20); // no data list->serialized_byte_length = 0; cl_assert_equal_i(0, string_list_count(list)); list->serialized_byte_length = 3; // 4 empty strings cl_asser...
cl_assert_equal_i(3, string_list_count(list))
; cl_assert_equal_s("foo", string_list_get_at(list, 2)); // truncated because of the max list size string_list_add_string(list, 20, "abc", 10); cl_assert_equal_i(17, list->serialized_byte_length); cl_assert_equal_i(4, string_list_count(list)); cl_assert_equal_s("a", string_list_get_at(list, 3)); }
uld finish at the same time AnimationHandlers handlers = { .stopped = prv_info_text_animation_stopped, }; animation_set_handlers(animation, handlers, NULL); } static void prv_initialize_info_text(BTPairingUIData *data) { prv_animate_info_text(data); } static void prv_deinitialize_info_text(BTPairingUIData...
window_get_user_data(window)
; PBL_ASSERTN(data->ui_state == BTPairingUIStateAwaitingUserConfirmation); prv_exit_awaiting_user_confirmation(data); data->ui_state = BTPairingUIStateAwaitingResult; prv_send_response(true /* is_confirmed */); prv_adjust_background_frame_for_state(data); } static void prv_decline_click_handler(ClickRecogniz...
install_manager__compare_app_entry_retrieve_methods(void) { AppInstallEntry id_entry; AppInstallEntry uuid_entry; cl_assert_equal_b(true, app_install_get_entry_for_install_id(tictoc_id, &id_entry)); cl_assert_equal_b(true, app_install_get_entry_for_uuid(&tictoc_uuid, &uuid_entry)); cl_assert_equal_b(true, ap...
(true, app_install_id_from_system(-1))
; cl_assert_equal_b(false, app_install_id_from_system(0)); cl_assert_equal_b(false, app_install_id_from_system(1)); cl_assert_equal_b(false, app_install_id_from_system(1000000)); } void test_app_install_manager__is_from_app_db(void) { cl_assert_equal_b(false, app_install_id_from_app_db(-1000000)); cl_assert_...
ace_remaining(inbox); if (required_free_length > space_remaining) { PBL_LOG(LOG_LEVEL_ERROR, "Dropping data, not enough space %"PRIu32" vs %"PRIu32, (uint32_t)required_free_length, (uint32_t)space_remaining); return false; } return true; } static void prv_send_event_if_needed(AppInboxNode *in...
prv_unlock()
; return success; } void app_inbox_service_cancel(AppInboxServiceTag tag) { prv_lock(); { AppInboxNode *inbox = prv_find_inbox_by_tag_and_log_if_not_found(tag); if (!inbox) { goto unlock; } prv_finish(inbox); } unlock: prv_unlock(); } ///////////////////////////////////////////////////...
bt_driver_supports_bt_classic()
) ? s_local_le_device_name : s_local_device_name; strncpy(name_out, name, BT_DEVICE_NAME_BUFFER_SIZE); } void bt_local_id_copy_address(BTDeviceAddress *addr_out) { *addr_out = s_local_address; } void bt_local_id_copy_address_hex_string(char addr_hex_str_out[BT_ADDR_FMT_BUFFER_SIZE_BYTES]) { static const B...
->scheduled_days[i] ? (1 << i) : 0; } return cron_job_get_execute_time(cron); } // ---------------------------------------------------------------------------------------------- static void prv_assign_alarm(Alarm *alarm, CronJob *cron) { cron_job_unschedule(&s_next_alarm_cron); s_next_alarm_cron = *cron; s_n...
prv_should_smart_alarm_trigger(config)
; if (!trigger) { // Not triggering an event, increment to signify elapsed time and snooze s_smart_snooze_counter++; prv_snooze_alarm(SMART_ALARM_SNOOZE_DELAY_S); return; } } if (trigger) { prv_put_alarm_event(); // Alarm events are triggered for both the initial alarm time a...
/* * 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...
(&tim_config)
; tim_config.TIM_Period = period; // The timer is on ABP1 which is clocked by PCLK1 tim_config.TIM_Prescaler = prescaler; // tim_config.TIM_ClockDivision = TIM_CKD_DIV4; tim_config.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit(TIM7, &tim_config); TIM_ITConfig(TIM7, TIM_IT_Update, ENABLE); TIM_...
-256}, { 1352, 440, -208}, { 1200, 320, -216}, { 1312, 288, -248}, { 1344, 288, -240}, { 1360, 200, -248}, { 1232, 24, -192}, { 960, -216, -112}, { 880, -240, -232}, { 1016, -192, -112}, { 1032, 128, -448}, { 1288, 152, -448}, { 1216, 240, -432}, { 1080, 224, -352}, ...
{ 1448, 1104, -392}, { 1184, 1008, -232}, { 896, 1024, -392}, { 864, 1008, -288}, { 1080, 1168, -248}, { 896, 848, -176}, { 1072, 896, -176}, { 1320, 712, -160}, { 1416, 528, -72}, // 29 seconds { 1184, 408, -160}, { 1096, 232, -128}, { 1224, 360, -120}, { 1448, 2...
{ 784, -280, -168}, { 968, 176, -440}, { 1096, 80, -256}, { 976, 240, -272}, { 960, 256, -248}, { 1080, 416, -168}, { 1448, 576, -232}, { 1656, 744, -232}, { 1424, 1080, -280}, { 1048, 1104, -336}, { 704, 1112, -328}, { 1040, 1144, -288}, { 864, 928, -208}, { 108...
or_notification(BLECharacteristic characteristic, const uint8_t *value, size_t value_length, BLEGATTError error) { if (error != BLEGATTErrorSuccess) { PBL_LOG(LOG_LEVEL_ERROR, "Read or notification error: %d", error); prv_reset_due_to_bt_error(); return; } ANCSCh...
{ launcher_task_add_callback(prv_serialize_action_launcher_task_cb, action_msg_ptr); }
} void ancs_handle_ios9_or_newer_detected(void) { // The ANCSClient is created as soon as the gateway is connected (see kernel_le_client.c). PBL_ASSERTN(s_ancs_client); s_ancs_client->version = ANCSVersion_iOS9OrNewer; } // ---------------------------------------------------------------------------------------...
/* * 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(is_app_file_name("A12345678/jkl") == false)
; } void test_app_file__is_app_file_name_tricky_false_7(void) { cl_assert(is_app_file_name("@12345678.foo") == false); } void test_app_file__is_app_file_name_tricky_false_8(void) { cl_assert(is_app_file_name("@123456780bar") == false); } // Tests for app_file_get_app_id() void test_app_file__get_app_id_simple(v...
ubs_resources.h" #include "stubs_syscalls.h" extern size_t prv_get_list_max_command_size(GDrawCommandList *command_list); static GColor s_fill_color; static GColor s_stroke_color; static uint8_t s_stroke_width; static uint16_t s_path_num_points; static GPoint *s_stroke_points = NULL; static GPoint *s_fill_points = NU...
free(s_fill_points)
; s_fill_points = NULL; } if (s_precise_lines) { free(s_precise_lines); s_precise_lines = NULL; } } // tests void test_gdraw_command__draw_command_stroke(void) { GDrawCommand *command = malloc(sizeof(GDrawCommand) + (sizeof(GPoint) * 2)); *command = (GDrawCommand){ .type = GDrawCommandTypePa...
_equal_i(persist_read_int(key), value); } void test_persist__bool(void) { const uint32_t key = 0; cl_assert_equal_i(persist_read_bool(key), false); cl_assert_equal_i(persist_write_bool(key, true), sizeof(bool)); cl_assert_equal_i(persist_get_size(key), sizeof(bool)); cl_assert_equal_i(persist_read_bool(key),...
{ cl_assert(PASSED(persist_write_int(0, 1))); cl_assert(PASSED(persist_write_bool(0, false))); cl_assert(PASSED(persist_write_int(1, 2))); cl_assert(persist_read_int(1) == 2); }
/* * Confirm that loading a smaller amount of data, then a larger amount of data, * always returns the appropriate amount of data. */ void test_persist__partial_read_extension(void) { char buffer[] = "Hello thar"; // Write out data cl_assert_equal_i(persist_write_string(0, buffer), sizeof(buffer)); // Cle...
proc) < (test->duration * US_PER_S)) { PROFILER_NODE_START(gfx_test_update_proc); test->test_proc(layer, ctx); PROFILER_NODE_STOP(gfx_test_update_proc); } PROFILER_STOP; PROFILER_PRINT_STATS; if (test->teardown) { test->teardown(layer->window); } app_timer_register(0, prv_pop_test_window, ...
(window, &(WindowHandlers) { .load = prv_results_window_load, .unload = prv_results_window_unload, })
; window_set_click_config_provider(window, prv_results_window_click_config_provider); TextLayer *text = &app_data->results_text; text_layer_init(text, &window->layer.bounds); text_layer_set_text(text, ""); layer_add_child((Layer *) window, (Layer *) text); } static void s_main(void) { handle_init(); app...
tyMetricRestingKCalories, 1, &value); cl_assert_equal_i(value, ROUND(exp_resting_calories, ACTIVITY_CALORIES_PER_KCAL)); // Test that ActivityMetricStepMinutes responds correctly prv_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 100, ActivitySleepStateAwake); prv_feed_cannned_accel_data(1 * SECONDS_PER_MINU...
prv_feed_cannned_accel_data(60 * SECONDS_PER_MINUTE, 0, ActivitySleepStateLightSleep)
; activity_get_metric(ActivityMetricSleepState, 1, &value); cl_assert_equal_i(value, ActivitySleepStateLightSleep); prv_feed_cannned_accel_data(50 * SECONDS_PER_MINUTE, 0, ActivitySleepStateRestfulSleep); activity_get_metric(ActivityMetricSleepState, 1, &value); cl_assert_equal_i(value, ActivitySle...
/* * 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...
("num_times", d)
; cl_assert(fake_app_timer_is_scheduled(timer)); cl_assert(app_timer_trigger(timer)); ASSERT_JS_GLOBAL_EQUALS_I("extra_arg", 5.0); } script = "clearInterval(timer);"; EXECUTE_SCRIPT(script); cl_assert(fake_app_timer_is_scheduled(timer) == false); } void test_rocky_api_timers__setTimeout(void) { ...
fer_size); } else { prv_copy_time_string_timestamp(number_buffer, number_buffer_size, word_buffer, word_buffer_size, timestamp); } } else { // past time_t difference = now - timestamp; if (now < timestamp || difference < SECONDS_PER_MINUTE) { i18n_get_with_buffer("Now", word_buffe...
{ if (!region_name) { return; } if (clock_is_timezone_set()) { int region_id = clock_get_timezone_region_id(); if (region_id != UNKNOWN_TIMEZONE_ID) { timezone_database_load_region_name(region_id, region_name); } else { // Show something like UTC-4 or UTC-10.25 // This will typi...
int16_t clock_get_timezone_region_id(void) { return rtc_get_timezone_id(); } void clock_set_timezone_by_region_id(uint16_t region_id) { TimezoneInfo tz_info; prv_clock_get_timezone_info_from_region_id(region_id, rtc_get_time(), &tz_info); prv_update_time_info_and_generate_event(NULL, &tz_info); } void clock...
_from_app_message_send_job((AppMessageSendJob *)send_job); } // ------------------------------------------------------------------------------------------------- // Interfaces towards Send Queue: static size_t prv_get_length(AppMessageSendJob *app_message_send_job) { AppOutboxMessage *outbox_message = prv_ou...
(ANALYTICS_APP_METRIC_MSG_BYTE_OUT_COUNT, length, AnalyticsClient_App)
; } static void prv_send_job_impl_free(SessionSendQueueJob *send_job) { AppMessageSendJob *app_message_send_job = (AppMessageSendJob *)send_job; AppOutboxMessage *outbox_message = prv_outbox_message_from_send_job(send_job); const bool is_completed = (0 == prv_get_length(app_message_send_job)); if (is_completed...
clip the offset to valid bounds. prv_scroll_layer_set_content_offset_internal( scroll_layer, scroll_layer_get_content_offset(scroll_layer)); } GSize scroll_layer_get_content_size(const ScrollLayer *scroll_layer) { return scroll_layer->content_sublayer.bounds.size; } void scroll_layer_scroll(ScrollLayer *sc...
prv_scroll_layer_is_paging_enabled(scroll_layer)
; } ContentIndicator *scroll_layer_get_content_indicator(ScrollLayer *scroll_layer) { return content_indicator_get_or_create_for_scroll_layer(scroll_layer); } void scroll_layer_update_content_indicator(ScrollLayer *scroll_layer) { ContentIndicator *content_indicator = content_indicator_get_for_scroll_layer(scroll...
ter_stringify($0, $1))); } catch (e) { var error_ref = __jerryRefs.ref(e); __jerryRefs.setError(error_ref, true); return error_ref; } }, source_p, source_size); } jerry_value_t jerry_acquire_value(jerry_value_t value) { return (jerry_value_t)EM_ASM_INT({ return __jerryRe...
__jerryRefs.get($0)
; // Add one onto the buffer size, since Module.stringToUTF8 adds a null // character at the end. This will lead to truncation if we just use // buffer_size. Since the actual jerry-api does not do this, we are // always careful to allocate space for a null character at the end. // Allow st...
); if (repeat_delay_attribute) { if (repeat_delay_attribute->length != sizeof(uint16_t)) { return false; } uint16_t *delay = (uint16_t *)repeat_delay_attribute->data; if (*delay > VIBE_SCORE_MAX_REPEAT_DELAY_MS) { return false; } } return true; } VibeScore *vibe_score_create_with_...
sys_get_current_resource_num()
; return vibe_score_create_with_resource_system(app_num, resource_id); } void vibe_score_destroy(VibeScore *score) { if (!score) { return; } applib_free(score); }
/* * 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...
(abs(a.ty.integer - b.ty.integer) < 10)
ntry test_entry[k_max_tests]; memset(test_entry, 0, sizeof(test_entry)); while (prv_activity_sample_discovery_next(&test_entry[num_tests])) { ActivityFileTestEntry *entry = &test_entry[num_tests]; #ifdef ACTIVITY_TEST_ONLY if (strcmp(entry->name, ACTIVITY_TEST_ONLY)) { continue; } #endif entr...
{ pass_count++; }
/* * 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; }
ctx->counted_minutes++; if (has_max_interval_passed(ctx)) { prv_send_request(ctx); } } static void start(PollRemoteContext *ctx) { ctx->counted_minutes = 0; } static void set_intervals(PollRemoteContext *ctx, const uint8_t min_interval_minutes, const uint8_t max_interval_minutes) { ctx->min_interval...
language governing permissions and * limitations under the License. */ #include "applib/ui/animation_interpolate.h" #include "applib/ui/animation.h" #include "util/size.h" #include "clar.h" #include "stubs/stubs_logging.h" #include "stubs/stubs_passert.h" InterpolateInt64Function s_animation_private_current_inte...
(s_custom_moook_out)
, .num_frames_mid = 3, }; void test_animation_interpolate__moook_custom(void) { cl_assert_equal_i(330, interpolate_moook_custom_duration(&s_custom_moook)); cl_assert_equal_i(-20000, interpolate_moook_custom(0, -20000, 20000, &s_custom_moook)); // mid frame is closer to end due to more end frames cl_assert_...
_total_last_day = 86400, })); // some time yesterday + today 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 = 3314...
(HealthMetricStepCount, time_util_get_midnight_of(now), now + 12345)
; cl_assert_equal_i(result, 1000); // yesterday result = health_service_sum(HealthMetricStepCount, time_util_get_midnight_of(now) - SECONDS_PER_DAY, time_util_get_midnight_of(now)); cl_assert_equal_i(result, 2000); // yesterday and today result =...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (FAILED(pid)) { // Attempting to debug persist map failure PBL_LOG(LOG_LEVEL_WARNING, "Failed to get pid! %d", pid); persist_map_dump(); return pid; }
return snprintf(name, buf_len, "ps%06d", pid); } status_t persist_service_delete_file(const Uuid *uuid) { char name[PERSIST_FILE_NAME_MAX_LENGTH]; status_t status = prv_get_file_name(name, sizeof(name), uuid); if (FAILED(status)) { return status; } return pfs_remove(name); } static bool prv_bad_pers...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ if (pebble_task_get_current() == PebbleTask_Worker) { // not allowed from workers syscall_failed(); } if (!memory_layout_is_cstring_in_region(memory_layout_get_app_region(), string, 100) && !memory_layout_is_cstring_in_region(memory_layout_get_microflash_region(), string, 100)) { ...
nds for the next part of the animation. data->title_text_layer.layer.bounds.origin.y = -TITLE_BOUNDS_OFFSET; data->artist_text_layer.layer.bounds.origin.y = -ARTIST_BOUNDS_OFFSET; data->position_text_layer.layer.bounds.origin.y = -TIME_BOUNDS_OFFSET; data->length_text_layer.layer.bounds.origin.y = -TIME_BOUNDS_...
animation_set_duration(disappear_animation, 3 * ANIMATION_FRAME_MS)
; animation_set_curve(disappear_animation, AnimationCurveEaseIn); GRect origin = cassette_rect; origin.origin.y -= BOUNCEBACK_OFFSET; Animation *bounceback_animation = property_animation_get_animation( property_animation_create(&s_frame_layer_implementation, &data->cassette_layer.layer, ...
ask); s_is_notification_event_pending[c] = true; prv_unlock(); } // ------------------------------------------------------------------------------------------------- // Decrements ownership count static void prv_release_buffer(GAPLEClient client) { prv_lock(); { PBL_ASSERTN(s_circular_buffer_retain_count[...
{ if (*subscription_type == BLESubscriptionNone) { // None is always supported return true; } BLESubscription supported = BLESubscriptionNone; if (supported_properties & BLEAttributePropertyNotify) { supported |= BLESubscriptionNotifications; } if (supported_properties & BLEAttributePropertyIndi...
// ------------------------------------------------------------------------------------------------- static void prv_remove_subscription(GAPLEConnection *connection, GATTClientSubscriptionNode *subscription) { list_remove(&subscription->node, (ListNode **) &connect...
x, x1 + xi, y1, (weighting ^ weighting_complement_mask), stroke_color); } // Draw final pixel graphics_private_plot_pixel(framebuffer, &ctx->draw_state.clip_box, x2, y2, MAX_PLOT_OPACITY, stroke_color); } else { // It's an...
{ lookup[i].raw_value = s_circle_table[n + i]; }
er_cancel(data->dictation_timeout); } static void prv_cancel_dictation(VoiceUiData *data) { if ((data->state != StateStart) && (data->state != StateFinished) && (data->state != StateExiting) && (data->state != StateError)) { VOICE_LOG("Cancel dictation session"); sys_voice_cancel_dictation(data->sessio...
text_layer_set_text(&data->mic_window.text_layer, "")
; layer_set_hidden((Layer *)&data->mic_window.text_layer, true); } static void prv_show_mic_text(VoiceUiData *data, const char *msg) { layer_set_hidden((Layer *)&data->mic_window.text_layer, false); sys_i18n_get_with_buffer(msg, data->mic_window.text_buffer, sizeof(data->mic_window.text_buffer)); text_layer_se...
ernel/util/delay.h" #include "os/tick.h" #include "services/common/touch/touch.h" #include "system/logging.h" #include "system/passert.h" #include "util/attributes.h" #include "util/net.h" #include <stdint.h> // general constants for the controller #define INIT_TIMEOUT_S (1) // definition of active region on touch p...
prv_wait_for_interrupt()
; StatusRegisterResponse response = { }; prv_read_data((uint8_t *)&response, sizeof(response)); PBL_ASSERTN(response.packet_id == PACKET_ID_STATUS_RESPONSE); // TODO: remove this assert and footer ones below once we're sure the controller FW is stable PBL_ASSERTN(response.padding == MESSAGE_PADDING); // W...
// Description: // This test ensures that the flow of adding a window to the window stack is followed // correctly. That is, we add the window to the window stack, its load handler is // called, it calls to set the click config, and the click config is set properly. void test_window_stack__window_flow(void) { Window...
app_state_get_window_stack()
; // Switch to the app state to push a window stub_pebble_tasks_set_current(PebbleTask_App); cl_check(stack); cl_assert_equal_i(window_stack_count(stack), 0); window_stack_push(stack, window, true); cl_assert_equal_i(window_stack_count(stack), 0); // We popped the window off the screen, but the unloa...
24, 160}, { 1048, 120, 128}, { 1160, 168, 192}, { 1376, 192, 112}, { 1424, 320, 160}, // 40 seconds { 1424, 688, 120}, { 1432, 480, 200}, { 1216, 480, 200}, { 1192, 280, 128}, { 1592, 144, 184}, { 1768, -88, 376}, { 1560, -152, 264}, { 1320, -88, 216}, { 1184, -64...
{ 1008, -472, 48}, { 832, -544, 24}, { 1064, -608, 32}, { 872, -416, 48}, { 1320, -312, 56}, { 1728, -208, 64}, { 1696, -216, -8}, { 1336, -192, 32}, { 1160, -32, 136}, { 1128, 96, 168}, { 1168, 136, 104}, { 1336, 96, 72}, { 1400, 160, 160}, { 1552, 520, 208}, ...
{ 1928, -128, 328}, { 1752, -184, 224}, { 1496, -112, 168}, { 1328, -136, 176}, { 1248, -232, 152}, { 1152, -240, 120}, { 920, -304, -48}, { 816, -400, -48}, { 696, -504, -80}, { 1024, -520, -48}, { 952, -320, -96}, { 1464, -368, 64}, { 1768, -240, 72}, { 1648, -...
} const uint8_t *iter = data; BlobDBToken token; BlobDBId db_id; // Read token and db_id iter = endpoint_private_read_token_db_id(iter, &token, &db_id); // read key length and key bytes ptr uint8_t key_size; const uint8_t *key_bytes = NULL; iter = prv_read_key_size(iter, data + length, &key_size)...
PBL_ASSERT_TASK(PebbleTask_KernelBackground)
; analytics_inc(ANALYTICS_DEVICE_METRIC_BLOB_DB_EVENT_COUNT, AnalyticsClient_System); PBL_HEXDUMP_D(LOG_DOMAIN_BLOBDB, LOG_LEVEL_DEBUG, data, length); // Each BlobDB message is required to have at least a Command and a Token static const uint8_t MIN_RAW_DATA_LEN = sizeof(BlobDBCommand) + sizeof(BlobDBToken);...
izersTriggered; recognizer_manager_deregister_recognizer(&manager, r1); cl_assert_equal_p(manager.triggered, r2); cl_assert_equal_p(manager.active_layer, &layer_a); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered); cl_assert_equal_i(r2->state, RecognizerState_Started); cl_assert...
cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown)
; cl_assert_equal_p(manager.triggered, NULL); cl_assert_equal_p(manager.active_layer, NULL); prv_compare_recognizers_processed((int []) { 0, 1 }, 2, &s_recognizers_reset); recognizer_set_simultaneous_with(r[0], prv_simultaneous_with_cb); r[0]->state = RecognizerState_Started; r[1]->state = RecognizerState_...
R CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "template_string.h" #include "template_string_private.h" #include "services/common/i18n/i18n.h" #include "syscall/syscall.h" #include "system/passe...
{ *cond = PredicateCondition_G; }
else { WTF; } state->position++; if (*state->position == '=') { (*cond)++; state->position++; } else if (!isdigit(*state->position)) { state->error->status = TemplateStringErrorStatus_InvalidTimeUnit; return false; } *value = prv_template_predicate_time(state); if (state->error->sta...
<= text_box_params->box.size.w, "Line <%p>: max extent=<%u> exceeds text_box_params width=<%u>", line, line->width_px + line->origin.x, text_box_params->box.size.w); } //! Call char_visitor_cb on each character in the line //! Used to update line dimensions and render characters //! Traverse until end of...
break; } walked_width_px -= next_glyph_width_px; if (!iter_prev(&char_iter)) { break; } current_codepoint = utf8_iter_state->codepoint; } } if (line->suffix_codepoint) { GRect cursor = { .origin = line->origin, .size.w = next_glyph_width_px, ...
//////////////////////////////////////////////////////////// // Walk Lines void set_ellipsis_on_overflow_last_line_cb(GContext* ctx, Line* line, const TextBoxParams* const text_box_params, const bool is_text_remaining) { // Only...
/* * 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, "SELECT clicked!"); (void)data; (void)recognizer; }
#if 0 static void select_long_click_handler(ClickRecognizerRef recognizer, ScrollAppData *data) { PBL_LOG(LOG_LEVEL_DEBUG, "SELECT long clicked!"); (void)data; (void)recognizer; } #endif static void click_config_provider(ScrollAppData *data) { // The config that gets passed in, has already the UP and DOWN bu...
fake_system_task_callbacks_invoke_pending(); prv_assert_last_event(PhoneEventType_Incoming, true /* check_cookie */, true /* check_name_number */, "Unknown", NULL); } void test_phone_pp__incoming_no_name(void) { uint8_t pp_msg[] = {0x04, 0x1a, 0xd4, 0x77, 0x08, 0x0d, ...
fake_transport_set_sent_cb(s_transport, prv_assert_get_phone_call_state_sent_cb)
; pp_get_phone_state(); fake_comm_session_process_send_next(); } void test_phone_pp__get_phone_call_state_response_no_calls(void) { pp_get_phone_state_set_enabled(true); uint8_t pp_msg[] = {0x83}; phone_protocol_msg_callback(s_session, pp_msg, sizeof(pp_msg)); fake_system_task_callbacks_invoke_pending(); ...
// Tests //////////////////////////////////// void test_kino_reel__resource_gbitmap(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Test loading GBitmap Kino Reel uint32_t resource_id = sys_resource_load_file_as_resource( TEST_IMAGES_PATH, "test_kino_reel__resource_gbitmap.pbi"); cl_ass...
( kino_reel_get_gdraw_command_sequence(kino_reel), 100)
); cl_assert(list2 != NULL); cl_assert(list2 != list1); cl_assert(list2 == list2_direct); } static KinoReelProcessor s_dummy_processor; static void prv_dummy_impl_draw_processed(KinoReel *reel, GContext *ctx, GPoint offset, KinoReelProcessor *processor) { cl_assert_eq...
pe_Hybrid = 0x01, PPoGATTSessionTypeCount, } PPoGATTSessionType; typedef struct PACKED { uint8_t ppogatt_min_version; uint8_t ppogatt_max_version; Uuid app_uuid; PPoGATTSessionType pp_session_type:8; } PPoGATTMetaV1; typedef struct PPoGATTWorkAroundState { bool remote_did_subscribe; HcGattWriteRespData ...
prv_enqueue_write_complete_if_ready(state)
; } static void prv_ppogatt_handle_write_request(ble_service_t *svc, const ble_evt_gatts_write_req_t *evt) { // Dialog requires this even if its a Write without response: ble_gatts_write_cfm(evt->conn_idx, evt->handle, ATT_ERROR_OK); if (!ppogatt_emulated_server_wa_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...
(1, 10, 10)
_erase.suspended) { // If an erase is in progress, make sure it gets at least a mininum time slice to progress. // If not, the successive kicking of the suspend timer could starve it out completely psleep(100); task_watchdog_bit_set(s_erase.task); status_t status = flash_impl_erase_suspend(s_erase.a...
(s_erase.in_progress == false)
--------------------------------------------------------------------------- static void prv_display_averages_alert(ActivityDemoAppData *data, DayInWeek day) { ActivityMetricAverages *averages = app_malloc_check(sizeof(ActivityMetricAverages)); strcpy(data->debug_card.dialog_text, "Hourly avgs:"); activity_get_ste...
dls_get_send_enable()
; enabled = !enabled; dls_set_send_enable_pp(enabled); data->debug_card.menu_items[index].subtitle = enabled ? "Enabled" : "Disabled"; layer_mark_dirty(simple_menu_layer_get_layer(data->debug_card.menu_layer)); } // ----------------------------------------------------------------------------------------- sta...
/normal/weather/weather_service_private.h" #include "services/normal/weather/weather_types.h" #include "util/pstring.h" // Fixture //////////////////////////////////////////////////////////////// // Fakes //////////////////////////////////////////////////////////////// #include "fake_pbl_malloc.h" #include "fake_spi_...
cl_assert_equal_i(current->id, id)
; prv_assert_forecast_equal(&current->forecast, &s_forecasts[id]); id++; current = (WeatherDataListNode *)current->node.next; } cl_assert_equal_i(count_out, 4); cl_assert_equal_i(id, 4); weather_service_locations_list_destroy(head); } void test_weather_service__get_default_location_forecast_from_...
}, { 624, 168, -144}, { 800, 160, -168}, // 85 seconds { 880, 136, -160}, { 1048, 144, -304}, { 1320, 208, -248}, { 1648, 344, -368}, { 1784, 376, -528}, { 1512, 320, -376}, { 1088, 360, -168}, { 832, 544, -120}, { 696, 648, -120}, { 680, 640, -120}, { 752, 584, -...
{ 1280, 600, -232}, { 1624, 520, -184}, { 1720, 440, -136}, { 1440, 360, -144}, { 1152, 288, -120}, { 944, 248, -112}, { 800, 208, -104}, { 704, 176, -104}, { 648, 152, -112}, { 632, 120, -48}, { 752, 168, -72}, { 816, 176, -80}, { 952, 208, -80}, // 91 seconds ...
{ 1192, 328, -32}, { 984, 328, -48}, { 768, 240, -88}, { 624, 184, -136}, { 504, 128, -112}, { 480, 88, -120}, { 512, 88, -152}, { 616, 128, -168}, { 800, 168, -192}, { 1160, 192, -32}, { 1376, 312, -296}, { 1720, 304, -536}, { 1608, 112, -72}, { 1416, 96, -72}, ...
/* * 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...
ABS(solution[i] - correction[i])
; cl_assert(diff < 2); } } void test_compass_cal__sphere_fit(void) { int num_entries = sizeof(s_sample_data) / sizeof(SampleData); int16_t solution[3]; int rv; for (int i = 0; i < num_entries; i++) { for (int j = 0; j < 4; j++) { rv = ecomp_corr_add_raw_mag_sample(s_sample_data[i].raw_samples[...