prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ocessor_with_data->luminance_tint_lookup_table; // Luminance tint the fill color const GColor fill_color = gdraw_command_get_fill_color(processed_command); const GColor tinted_fill_color = gcolor_perform_lookup_using_color_luminance_and_multiply_alpha(fill_color, ...
kino_reel_draw_processed(icon, ctx, origin, &structured_glance_icon_processor)
; } static void prv_structured_glance_icon_node_draw_cb(GContext *ctx, const GRect *rect, UNUSED const GTextNodeDrawConfig *config, bool render, GSize *size_out, void *user_data) { LauncherAppGlanceStructured *str...
.install_id = 6, .sdk_version = (Version) { .major = PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR + 1, .minor = PROCESS_INFO_CURRENT_SDK_VERSION_MINOR + 10 } }, .should_pass = false }, { .entry = (AppInstallEntry) { .install_id = 7, .sdk_version = (Version) { ...
(0, s_app_manager_launch_new_app__callcount)
; cl_assert(s_event_put__event != NULL); cl_assert_equal_i(PEBBLE_APP_FETCH_REQUEST_EVENT, s_event_put__event->type); }
/* * 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 NULL; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(bus->hal->er_irq_channel, I2C_IRQ_PRIORITY)
_layer = &data->action_bar_layer; action_bar_layer_init(action_bar_layer); action_bar_layer_add_to_window(action_bar_layer, window); data->approve_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_CHECK); data->decline_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_X); actio...
{ BTPairingUIData *data = s_data_ptr; Window *window = &data->window; window_init(window, WINDOW_NAME("Bluetooth SSP")); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, .unload = prv_window_unload, }); window_set_user_data(window, data); window_set_overrides_back_bu...
n, logging_session->storage.num_bytes); analytics_inc(ANALYTICS_DEVICE_METRIC_DATA_LOGGING_FLUSH_COUNT, AnalyticsClient_System); logging_session->comm.nack_count = 0; } break; } update_session_state(logging_session, DataLoggingSessionCommStateIdle, true /*reschedule*/); mutex_unlock(...
prv_reopen_next_session_system_task_cb((void *)head)
; } //! Empty a session by session id static void prv_empty_session(uint8_t session_id) { PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Phone requested empty of session %u", session_id); DataLoggingSession *logging_session = dls_list_find_by_session_id(session_id); if (logging_session) { 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...
{ return E_UNKNOWN; }
_session; extern void session_remote_version_protocol_msg_callback(CommSession *session, const uint8_t *data, size_t length); // Fakes & Stubs //////////////////////////////////////////////////////////////////////////////////////////////////// #include "fake_p...
(&s_session, &invalid_msg, sizeof(invalid_msg))
; cl_assert_equal_i(fake_event_get_count(), 0); } static const CommSessionCapability s_expected_capabilities = (CommSessionAppMessage8kSupport | CommSessionVoiceApiSupport); void test_session_remote_version__system_session(void) { s_session_is_system = true; prv_receive_v3_response(3, 2, 1, s_expected_...
line_layer->layer.bounds; GRect line; line.origin.x = layer_bounds.origin.x + layer_bounds.size.w - REL_BAR_LINE_HORIZ_OFFSET; // Account for the size of the icon when positioning vertically line.origin.y = grect_get_max_y(&first_icon_frame) + REL_BAR_VERT_MARGIN - curr_offset - prev_offset; line.size.w...
line.size.h = solid_line_length + curr_offset; graphics_fill_rect(ctx, &line); // Bottom Notch for Bar 1 // Filled rect used to draw line of REL_BAR_LINE_WIDTH stroke width GRect notch; notch.origin.x = line.origin.x - REL_BAR_LINE_NOTCH_HORIZ_OFFSET + 1; notch.origin.y = grect_get_max_y(&line) - REL_BAR...
notch.size.h = REL_BAR_LINE_WIDTH; graphics_fill_rect(ctx, &notch); } #define REL_BAR_OVERLAP_STROKE_WIDTH 2 #define REL_BAR_OVERLAP_SIDE_MARGIN 2 #define REL_BAR_OVERLAP_NUDGE_X 1 #define REL_BAR_OVERLAP_LINE2_HORIZ_OFFSET ((2 * REL_BAR_OVERLAP_SIDE_MARGIN) + 1) static void prv_draw_rel_bar_overlap(TimelineLayer...
tack[0] = a; // go to child if possible Layer *actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(aa, actual); cl_assert_equal_i(1, current_stack); cl_assert_equal_p(a, stack[0]); cl_assert_equal_p(aa, stack[1]); // go to child i...
(2, 2, 6, 6)
); layer_set_frame(&child_e, &GRect(10, 10, 10, 10)); layer_set_frame(&child_f, &GRect(-10, -10, 40, 40)); layer_add_child(&parent, &child_a); cl_assert_equal_p(layer_find_layer_containing_point(&child_a, &GPoint(11, 11)), NULL); cl_assert_equal_p(layer_find_layer_containing_point(&child_a, &GPoint(10, 10)),...
{ transport->app_uuid = *app_uuid; }
s_fake_transport_head = (FakeTransport *) list_prepend((ListNode *) s_fake_transport_head, &transport->node); return (Transport *) transport; } CommSession *fake_transport_set_connected(Transport *transport, bool connected) { FakeTransport *fake_transport...
= fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD); const GTextOverflowMode overflow_mode = GTextOverflowModeWordWrap; const GTextAlignment alignment = GTextAlignmentCenter; const int16_t rl_margin = PBL_IF_RECT_ELSE(4, 16); GRect drawing_rect = grect_inset(layer->bounds, GEdgeInsets(0, rl_margin)); const GSi...
layer_add_child(&window->layer, status_bar_layer_get_layer(status_layer))
; #if PBL_RECT GRect status_layer_bounds = window->layer.bounds; status_layer_bounds.size.w -= ACTION_BAR_WIDTH; layer_set_frame(&status_layer->layer, &status_layer_bounds); #endif ActionBarLayer *action_bar = &summary_window->action_bar; action_bar_layer_init(action_bar); action_bar_layer_set_context(act...
nmentRight); HANDLE_CASE("center", GTextAlignmentCenter); // assuming left-to-right HANDLE_CASE("start", GTextAlignmentLeft); HANDLE_CASE("end", GTextAlignmentRight); #undef HANDLE_CASE // unknown value return false; } JERRY_FUNCTION(prv_set_text_align) { GTextAlignment alignment; if (argc >= 1 && ...
jerry_get_int32_value(argv[1])
: 0; const int16_t box_y = argc >= 3 ? (int16_t)jerry_get_int32_value(argv[2]) : 0; const int16_t box_width = argc >= 4 ? (int16_t)jerry_get_int32_value(argv[3]) : INT16_MAX; const GRect box = { .origin.x = box_x, .origin.y = box_y, .size.w = box_width, .size.h = INT16_MAX, }; const GSize si...
(compositing_mode == GCompOpAnd) || (compositing_mode == GCompOpClear))); } static void prv_composite_test_draw_bitmap(GContext *ctx, GBitmap *bitmap, GPoint offset, GCompOp compositing_mode) { GRect destination = bitmap->bounds; destination.origin = gpo...
(GPoint(25, 0))
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__origin_bitmap_layer_across_nx(void) { prv_origin_bitmap_layer_test(GPoint(-25, 0)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__origin_bitmap_layer_across_y(void) {...
le size at least twice. for (int j=0; j<16; j++) { prv_log_consume_random(logging_sessions[i], item_size, num_bytes); } } } // ---------------------------------------------------------------------------------------- // Filling up the file system. We should be limited to creating DLS_MAX_DATA_BYTES wor...
{ prv_check_session_data(logging_sessions[i], crcs[i], buf_size[i]); }
e License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distri...
{ return prv_gbitmap_get_data_row_info(bitmap, y); }
void gbitmap_init_with_data(GBitmap *bitmap, const uint8_t *data) { BitmapData* bitmap_data = (BitmapData*) data; memset(bitmap, 0, prv_gbitmap_size()); bitmap->row_size_bytes = bitmap_data->row_size_bytes; bitmap->info_flags = bitmap_data->info_flags; // Force this to false, just in case someone passes u...
ss_pinning_out = true; uint8_t flags = 0; cl_assert_equal_b(shared_prf_storage_get_ble_pairing_data(&pairing_info_out, name_out, &requires_address_pinning_out, &flags), true); cl_assert_equal_b(...
cl_assert_equal_s(DEVICE_NAME, device_name_out)
ual_s(output, cases[i].expected_output); ASSERT_JS_ERROR(error_value, NULL /* Never errors out! */); task_free(output); } // Exercise ROCKY_ARG (automatic binding creation, defaults to copy/no-malloc for char[]): { char output[16]; ROCKY_ARGS_ASSIGN(ROCKY_ARG(output)); cl_asse...
jerry_release_value(argv[j])
; } } } void test_rocky_api_util_args__gcolor(void) { const char *type_error_msg = "TypeError: Argument at index 0 is not a String ('color name' or '#hex') or Number"; const char *invalid_value_msg = "TypeError: Argument at index 0 is invalid: " \ "Expecting String ('color name' or '#hex') ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return false; }
} else { if (color != surround_color.argb) { return false; } } } } return true; } // Tests //////////////////////////////////// // setup and teardown void test_bitblt_palette__initialize(void) { framebuffer_init(&framebuffer, &(GSize) { DISP_COLS, DISP_ROWS }); test_...
/* * 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, 2, 3, 4)
, .info.format = GBitmapFormat8BitCircular, .data_row_infos = infos, }; cl_assert_equal_i(0, gbitmap_format_get_row_size_bytes(123, GBitmapFormat8BitCircular)); cl_assert_equal_i(123, gbitmap_get_bytes_per_row(&bmp)); cl_assert_equal_p(&some_addr + 1, gbitmap_get_data_row_info(&bmp, 0).data); cl_...
ame; } void layer_set_bounds(Layer *layer, const GRect *bounds) { if (grect_equal(bounds, &layer->bounds)) { return; } layer->bounds = *bounds; layer_mark_dirty(layer); } void layer_set_bounds_by_value(Layer *layer, GRect bounds) { layer_set_bounds(layer, &bounds); } void layer_get_bounds(const Layer *...
{ prev_sibling = prev_sibling->next_sibling; }
prev_sibling->next_sibling = layer_to_insert; } layer_to_insert->next_sibling = below_layer; } // Above means lower down in the hierarchy so it gets drawn later, // and as a result the drawn on top of what's below it. void layer_insert_above_sibling(Layer *layer_to_insert, Layer *above_layer) { if (above_la...
*(uint8_t*)cmd_ptr); cmd_ptr += sizeof(uint8_t); // check for a key size cl_assert(TEST_KEY_SIZE == *(uint8_t*)cmd_ptr); cmd_ptr += sizeof(uint8_t); // go past key_bytes cmd_ptr += TEST_KEY_SIZE; cl_assert((cmd_ptr - s_delete_cmd_success) == sizeof(s_delete_cmd_success)) ; // Process Command uint8...
{ s_expected_data = s_dirty_dbs_response; blob_db_protocol_msg_callback(NULL, s_dirty_dbs_request, sizeof(s_dirty_dbs_request)); }
static const uint8_t s_start_sync_request[] = { BLOB_DB_COMMAND_START_SYNC, // cmd 0x12, 0x34, // token }; static const uint8_t s_start_sync_response[] = { BLOB_DB_COMMAND_START_SYNC_RESPONSE, // cmd 0x12, 0x34, // token BLOB_DB_SUCCESS, // ...
e Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is...
(grand_child_a.parent == &child_a)
; // Return early when (parent->paren == NULL): layer_remove_from_parent(&parent); } void test_layer__remove_child_layers(void) { Layer parent, child_a, child_b; Layer *layers[] = {&parent, &child_a, &child_b}; for (int i = 0; i < ARRAY_LENGTH(layers); ++i) { layer_init(layers[i], &GRectZero); } // ...
orage.h" #include "system/logging.h" #include "system/passert.h" // TODO: this may be replaced once apps become more dynamic typedef struct { ListNode list_node; uint32_t id; ResourceStoreEntry stored_resource; } CachedResource; PebbleRecursiveMutex *s_resource_mutex = NULL; static CachedResource *s_resource_...
resource_storage_builtin_bytes_are_readonly(bytes)
|| resource_storage_flash_bytes_are_readonly(bytes); } const uint8_t *resource_get_readonly_bytes(ResAppNum app_num, uint32_t resource_id, size_t *num_bytes_out, bool has_privileged_access) { // we don't support memory-mapping for resources that don't belong to th...
us_init(slave->spi_bus, prv_is_bidrectional(slave)); // SCS gpio_output_init(&slave->spi_scs, GPIO_OType_PP, slave->spi_bus->spi_sclk_speed); gpio_output_set(&slave->spi_scs, false); // SCS not asserted (high) // Set up an SPI prv_spi_slave_deinit(slave); prv_spi_slave_init(slave); // Set up DMA if...
(&slave->spi_scs, true)
; // SCS asserted (low) } void spi_ll_slave_scs_deassert(const SPISlavePort *slave) { PBL_ASSERTN(slave->slave_state->initialized); PBL_ASSERTN(slave->slave_state->acquired); PBL_ASSERTN(slave->slave_state->scs_selected); slave->slave_state->scs_selected = false; gpio_output_set(&slave->spi_scs, false); //...
active_window); } heart_node->node.offset = heart_node_offset; graphics_text_node_container_add_child(container, &heart_node->node); break; } case WorkoutMetricType_Steps: { const size_t buffer_size = sizeof("000000"); GTextNodeText *number_text_node = health_...
{ if (active_window->workout_controller->get_metric_value( metric_type, active_window->workout_data) >= SECONDS_PER_HOUR) { GTextNodeText *text_node = health_util_create_text_node_with_text(EM_DASH, units_font, TEXT_COLOR, container); text_node->node.offset.x += 1; ...
case WorkoutMetricType_Speed: { const size_t buffer_size = sizeof("00:00:00"); GTextNodeText *number_text_node = health_util_create_text_node(buffer_size, number_font, TEXT_COLOR, container); active_window->workout_controlle...
; dialog_set_fullscreen(dialog, true); dialog_set_text(dialog, i18n_get("End Workout?", workout_dialog)); dialog_set_background_color(dialog, BACKGROUND_COLOR); dialog_set_text_color(dialog, TEXT_COLOR); dialog_set_icon(dialog, RESOURCE_ID_WORKOUT_APP_END); dialog_set_icon_animate_direction(dialog, DialogIc...
window_deinit(&active_window->window)
; i18n_free_all(active_window); app_free(active_window); } } //////////////////////////////////////////////////////////////////////////////////////////////////// //! Common Setup static void prv_create_window_common(WorkoutActiveWindow *active_window, void *workout_data, ...
imitations under the License. */ #include "services/common/bluetooth/ble_root_keys.h" #include "clar.h" #include <string.h> /// Stubs #include "stubs_hexdump.h" #include "stubs_logging.h" static const SM128BitKey s_retrieved_keys[SMRootKeyTypeNum] = { [SMRootKeyTypeEncryption] = { 0xee, 0xee, 0xee, 0xee, 0x...
memset(&rand_id, 0xaa, sizeof(SM128BitKey))
; cl_assert_equal_m(&keys[SMRootKeyTypeEncryption], &rand_enc, sizeof(SM128BitKey)); cl_assert_equal_m(&keys[SMRootKeyTypeIdentity], &rand_id, sizeof(SM128BitKey)); cl_assert_equal_m(&s_stored_keys[SMRootKeyTypeEncryption], &rand_enc, sizeof(SM128BitKey)); cl_assert_equal_m(&s_stored_keys[SMRootKeyTypeIdentity]...
/* * 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...
GTransformFromNumbers(1, 2, 3, 4, 5, 6)
2016-03-02 12:50:00 AM { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 133, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 149, 0}, { 0, 0x7d, 0, 150, 0}, { 0, 0x7d, 0, 146, 0}, { 0, 0x7d, 0, 149, 0}, ...
{ 0, 0x23, 1895, 148, 0}, { 0, 0x9, 0, 149, 0}, { 0, 0x9, 0, 148, 0}, { 0, 0x9, 0, 148, 0}, { 0, 0x9, 0, 148, 0}, { 0, 0x9, 0, 148, 0}, { 0, 0x9, 0, 144, 0}, { 0, 0x9, 0, 148, 0}, { 0, 0x9, 0, 148, 0}, { 0, 0x9, 0, 148, 0}, { 0, 0x9, 0, 148, 0}, { 0, 0x9, 0, 144, 0}, ...
{ 0, 0x78, 258, 148, 0}, { 0, 0x69, 0, 144, 0}, // 450: Local time: 2016-03-02 03:35:00 AM { 0, 0x6a, 0, 148, 0}, { 0, 0x78, 302, 148, 0}, { 0, 0x78, 73, 148, 0}, { 0, 0x78, 0, 148, 0}, { 0, 0x78, 1155, 149, 0}, { 0, 0x77, 0, 148, 0}, { 0, 0x68, 1171, 148, 0}, { 0, 0x69, 0, ...
l_assert_equal_s(dstbuf, "There are 10 lights"); // Variable length digits output snprintf(dstbuf, 256, "There are %.*x lights", 3, 16); cl_assert_equal_s(dstbuf, "There are 010 lights"); // Variable length digits output (negative digits, acts as zero) snprintf(dstbuf, 256, "%.*xzero%.*x", -3, 0, -3, 1); ...
snprintf(dstbuf, 256, "Hur%+c", 'f')
; cl_assert_equal_s(dstbuf, "Hurf"); // Variable length character output snprintf(dstbuf, 256, "Hur%*c", 2, 'f'); cl_assert_equal_s(dstbuf, "Hur f"); } void test_sprintf__percent_s(void) { char dstbuf[256]; // Simple %s snprintf(dstbuf, 256, "You know Bagu? %s", "Then I can let you cross"); cl_assert...
i18n__initialize(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(true /* write erase headers */); load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, FRENCH_FIXTURE_NAME, "lang"); shell_prefs_set_language_english(false); i18n_set_resource(RESOURCE_ID_STRINGS); } void test_i18n__clea...
("Quiet Time", "Enabled", buffer, sizeof(buffer))
; cl_assert_equal_s(buffer, "Activé"); } void test_i18n__reset_language(void) { // allocate some crap, to test that freeing works const char *first = i18n_get("Music", (void *)0x12345); const char *second = i18n_get("abcd", (void *)0x12345); shell_prefs_set_language_english(true); i18n_set_resource(RESOURC...
uteList *attr_list, size_t attr_list_size, Uuid **app_uuid_out) { GenericAttribute *uuid_attr = generic_attribute_find_attribute(attr_list, VEAttributeIdAppUuid, ...
(reminder_str, reminder_attr->data, reminder_attr->length)
; reminder_str[reminder_attr->length] = '\0'; voice_handle_nlp_result(msg->result, msg->session_id, reminder_str, timestamp); kernel_free(reminder_str); } #if CAPABILITY_HAS_MICROPHONE void voice_endpoint_protocol_msg_callback(CommSession *session, const uint8_t* data, size_t size) { MsgId msg_id = data[0]; ...
disp_gpio_init.GPIO_OType = GPIO_OType_OD; s_disp_gpio_init.GPIO_Pin = DISP_PIN_LCD; GPIO_Init(DISP_GPIO, &s_disp_gpio_init); // Set up a SPI bus on SPI2 SPI_I2S_DeInit(DISP_SPI); SPI_Init(DISP_SPI, &s_disp_spi_init); SPI_Cmd(DISP_SPI, ENABLE); // +5V to 5V_EN pin GPIO_WriteBit(PWR_CTL_GPIO, PWR_CTL_...
if (pixel) { prv_set_bit(x_offset_bits + x, cur_y, buffer); }
int8_t status; prv_read_register(dev, dev->state->part->instructions.read_protection_status, &status, 1); return (status & dev->state->part->block_lock.protection_enabled_mask); } status_t qspi_flash_write_protection_enable(QSPIFlash *dev) { #if TARGET_QEMU return S_NO_ACTION_REQUIRED; #endif qspi_use(dev->qsp...
(buffer_pol)
; kernel_free(buffer_mmap); return success; } struct FlashReadTestValues { int size; int offset; }; const struct FlashReadTestValues FLASH_READ_TEST_TABLE[] = { { .size = 1024, .offset = 0 }, { .size = 1025, .offset = 0 }, { .size = 1026, .offset = 0 }, { .size = 1027, .offset = 0 }, { .size = 1024...
72}, { 888, 80, -304}, { 1016, 136, -336}, { 1136, 200, -376}, { 1200, 264, -400}, { 1440, 376, -400}, { 1240, 512, -392}, { 1400, 424, -352}, { 1168, 432, -376}, { 936, 328, -360}, { 1080, 304, -360}, { 1296, 264, -280}, { 1232, 40, -112}, // 13 seconds { 1048, 4...
{ 1008, 376, -368}, { 1144, 320, -312}, { 1328, 192, -168}, { 1080, 88, -96}, { 864, 88, -72}, { 952, 160, -184}, { 1136, 120, -128}, { 1216, 192, -112}, { 936, -16, 112}, { 1048, -152, 32}, { 896, -248, 120}, { 1280, -224, 248}, { 1224, -136, -48}, { 1256, -88, -...
/* * 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...
{ SMIdentityResolvingKey irk; const ble_dev_params_t *dev_params = ble_mgr_dev_params_acquire(); memcpy(irk.data, dev_params->irk.key, sizeof(irk.data)); ble_mgr_dev_params_release(); // rand() returns between 0 and RAND_MAX, but only the 24 LSBits are used anyway. const int prand = rand(); pra_generate...
ruption_handler(heap->corrupt_block); heap->corrupt_block = NULL; } } static void prv_handle_corruption(Heap * const heap, void *ptr) { if (heap->corruption_handler) { heap->corrupt_block = ptr; return; } UTIL_ASSERT(0); // Error: Heap corrupt around <ptr> } static HeapInfo_t *find_segment(Heap* c...
{ heap->corruption_handler = corruption_handler; }
void *heap_malloc(Heap* const heap, unsigned long nbytes, uintptr_t client_pc) { // Check to make sure the heap we have is initialized. UTIL_ASSERT(heap->begin); /* Convert the requested memory allocation in bytes to alignment */ /* size. */ u...
nt_put(&event); } prv_wakeup_timer_next_pending(); } // This callback is the system dispatcher that wakes up the application by AppInstallId // OR queues a wakeup callback for that application // and is triggered by NewTimer static void prv_wakeup_dispatcher(void *data) { // Place actual work on system_task to ...
if (entry.utc == false) { entry.timestamp -= *((int*)utc_diff); entry.utc = true; if (wakeup_id == s_wakeup_state.current_wakeup_id) { s_wakeup_state.timestamp = entry.timestamp; } }
// Write the new entry to the settings file. We always write as there's no // chance of it being invalid. settings_file_set(new_file, (uint8_t*)&wakeup_id, sizeof(WakeupId), (uint8_t*)&entry, sizeof(WakeupEntry)); } static bool prv_check_for_events(SettingsFile *file, SettingsRecordInfo *info, void *con...
in state is handled modal_manager_event_loop_upkeep(); // The app is unobstructed, it should not be idle cl_assert_equal_b(s_app_idle, false); // Assert that the window pushed onto the app stack has regained focus, // this is also done by checking the last event. event = fake_event_get_last(); cl_asse...
(ModalPriorityGeneric)
; cl_check(app_stack); cl_check(modal_stack); cl_check(!app_stack->list_head); cl_check(!modal_stack->list_head); // Switch to the app state to push a window stub_pebble_tasks_set_current(PebbleTask_App); window_stack_push(app_stack, window1, true); cl_assert_equal_i(window_stack_count(app_stack), ...
GTextOverflowModeFill, GTextAlignmentLeft, NULL); graphics_draw_text(&gcontext, "\n\n", font, box, GTextOverflowModeFill, GTextAlignmentLeft, NULL); graphics_draw_text(&gcontext, "\1\n", font, box, GTextOverflowModeFill, GTextAlignmentLeft, NULL); graph...
(attributes->hash, 0)
; graphics_text_attributes_destroy(attributes); } void test_text_layout__get_default_flow_data(void) { const TextLayoutFlowData *data1 = graphics_text_layout_get_flow_data(NULL); cl_assert(data1 != NULL); cl_assert_equal_p(data1->perimeter.impl, NULL); cl_assert_equal_i(data1->paging.page_on_screen.size_h, 0...
-------------------------------------------- // Queue Fakes // ----------------------------------------------------------------------------- static const QueueHandle_t FAKE_APP_QUEUE = (QueueHandle_t) 1337; static uint32_t s_event_count; static PebbleEvent s_events_received[16]; signed portBASE_TYPE xQueueGenericSend(...
{ AppInstallId app_id = 1; const uint32_t update_interval_s = 1; const uint16_t expire_s = SECONDS_PER_MINUTE; HRMFeature features = HRMFeature_BPM; HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, update_interval_s, expire_s, featur...
// When we cleanup after an app process, its subscription, if any, should get an expriration time // placed on it void test_hrm_manager__app_cleanup(void) { stub_pebble_tasks_set_current(PebbleTask_App); AppInstallId app_id = 1; const uint32_t update_interval_s = 1; uint16_t expire_s = 0; HRMFeature featur...
(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_across_y_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_ro...
(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitma...
/* * 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 (PASSED(prv_open(&settings_file))) { settings_file_rewrite(&settings_file, prv_rewrite_cb, NULL); settings_file_close(&settings_file); }
}
/* * 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...
(0, 0, -20, 10)
)); } void test_gtypes__grect_shortest_side(void) { cl_assert_equal_i(0, grect_shortest_side(GRectZero)); cl_assert_equal_i(10, grect_shortest_side(GRect(0, 0, 10, 20))); cl_assert_equal_i(10, grect_shortest_side(GRect(0, 0, 20, 10))); cl_assert_equal_i(10, grect_shortest_side(GRect(0, 0, 10, -20))); cl_asse...
mand_btle_test_rx_start(char *rx_channel) { bt_driver_le_receiver_test(atoi(rx_channel)); } void command_btle_test_end(void) { bt_driver_le_test_end(); } //# if PLATFORM_ROBERT static const char *s_btle_pa_config_strings[3] = { "disable", "enable", "bypass" }; void command_btle_pa_set(char *command) { char buf...
(buf, sizeof(buf), "%s, %s, %"PRIu32", %"PRIu32, do_aa, width, us, total_time)
; } void command_perftest_line_all(void) { prompt_send_response("Antialiasing?, Width, Total time (us), Total cycles"); command_perftest_line("noaa", "8"); command_perftest_line("noaa", "6"); command_perftest_line("noaa", "5"); command_perftest_line("noaa", "4"); command_perftest_line("noaa", "3"); comma...
/* * 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_mask_record(ctx, mask)
); draw_func(ctx); cl_assert(graphics_context_mask_record(ctx, NULL)); cl_assert_equal_p(ctx->draw_state.draw_implementation, &g_default_draw_implementation); cl_assert(graphics_context_mask_use(ctx, mask)); cl_assert_equal_p(ctx->draw_state.draw_mask, mask); graphics_context_set_fill_color(ctx, GColorR...
fg_info.h" #include "rocky_api_util.h" #include "syscall/syscall.h" #include "system/passert.h" #include "system/version.h" // rocky.watchInfo = { // platform: "basalt", // model: "pebble_time_red", // language: "en_US", // firmware: { // major: 4, // minor: 0, // patch: 1, // ...
model_name = SNOWY_MODEL("pebble_time_steel_silver"); break; case WATCH_INFO_COLOR_TIME_STEEL_BLACK: model_name = SNOWY_MODEL("pebble_time_steel_black"); break; case WATCH_INFO_COLOR_TIME_STEEL_GOLD: model_name = SNOWY_MODEL("pebble_time_steel_gold"); break; ...
case WATCH_INFO_COLOR_PEBBLE_2_SE_BLACK: model_name = SILK_MODEL("pebble_2_se_black"); break; case WATCH_INFO_COLOR_PEBBLE_2_SE_WHITE: model_name = SILK_MODEL("pebble_2_se_white"); break; case WATCH_INFO_COLOR_PEBBLE_TIME_2_BLACK: model_name = ROBERT_MODEL("peb...
s\n", i, key, val); set_and_verify(&file, key, key_len, val, val_len); } uint8_t cur_val = 0; settings_file_each(&file, prv_each_cb_quit_early, (void *)&cur_val); cl_assert_equal_i(STOPPING_NUM, cur_val); } void test_settings_file__in_place(void) { printf("Testing that we can update a setting file in p...
cl_assert_equal_i(before_count, after_count)
; // Force us to move to the record `search_for_idx` + 1 settings_raw_iter_next(&file.iter); // We now are forced to start searching in the middle, wrap around, and continue searching // from the beginning. This will result in us calling `settings_raw_iter_next` NUM_RECORDS - 1 // times. before_count = se...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return prv_selection_config()->default_cell_height; }
tHandlerHistory s_started_handler_calls; static AnimTestHandlerHistory s_stopped_handler_calls; static AnimTestHandlerHistory s_setup_handler_calls; static AnimTestHandlerHistory s_teardown_handler_calls; static AnimTestHandlerHistory s_update_handler_calls; static uint32_t s_fire_order_index; // ---------------------...
{ // Flag should now get reset to false before entering stopped handler cl_assert(animation_private->is_completed == false); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ s_last_driver_addr_is_null = false; s_last_driver_addr = *pinned_address; }
/* * 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_must_pass_( shell_out(argv), "Failed to copy test fixtures to sandbox" )
; free(source); } static void fs_rm(const char *source) { char *argv[4]; argv[0] = "/bin/rm"; argv[1] = "-Rf"; argv[2] = (char *)source; argv[3] = NULL; cl_must_pass_( shell_out(argv), "Failed to cleanup the sandbox" ); } void cl_fs_cleanup(void) { clar_unsandbox(); clar_sandbox(); } #endif
/* * 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...
hrm_service_handle_measurement(&hrm_measurement, hc_hrm_measurement->devices, hc_hrm_measurement->num_devices)
/* * 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...
(&data->window.layer, &data->count_layer.layer)
; text_layer_init(&data->connected_layer, &GRect(0, 20, width, 20)); layer_add_child(&data->window.layer, &data->connected_layer.layer); text_layer_set_text(&data->count_layer, "No Presses"); text_layer_set_text(&data->connected_layer, "No connection event"); // subscribe to the accelerometer event stream ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(S_SUCCESS, app_cache_remove_entry(app1.id))
; PebbleEvent e = fake_event_get_last(); cl_assert_equal_i(e.type, PEBBLE_APP_CACHE_EVENT); cl_assert_equal_i(e.app_cache_event.cache_event_type, PebbleAppCacheEvent_Removed); cl_assert_equal_i(e.app_cache_event.install_id, app1.id); cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app3.id)); e = fake_ev...
es(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, spawn), 1); // Run to the completion of C, start of D prv_advance_to_ms_with_timers(start_ms + 1080 + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c),...
animation_set_handlers(a, handlers, context)
; animation_set_auto_destroy(a, auto_destroy); animation_schedule(a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_a); animation_set_delay(b, delay_a); animation_set_handlers(b, handlers, context); animation_set_auto_destroy(b, auto_destroy); animation_schedule(b); ...
he.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and *...
cl_assert(dirty_list == NULL)
; blob_db_util_free_dirty_list(dirty_list); char *keys[] = { "key1", "key2", "key3", "key4", "key5" }; int key_len = strlen(keys[0]); char *values[] = { "val1", "val2", "val3", "val4", "val5" }; int value_len = strlen(values[0]); // insert all keys for (int i = 0; i < ARRAY_LENGTH(keys); ++i) { blob...
/* * 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...
distance_interpolate(distance_normalized, property_animation->values.from.gpoint.x, property_animation->values.to.gpoint.x)
; result.y = distance_interpolate(distance_normalized, property_animation->values.from.gpoint.y, property_animation->values.to.gpoint.y); ((PropertyAnimationLegacy2Implementation*) property_animation->animation.implementation) ->accessors.se...
ens to get the same UID. should_perform_dismiss = true; } prv_handle_success_fail_response(data, &action_result->attr_list, true /* success */); // Perform the dismiss after showing the UI (to try and improve perceived responsiveness) if (should_perform_dismiss) { // Call this ...
(&pin->attr_list, AttributeIdSender)
; const int16_t num_attributes = (sender_attr) ? 2 : 1; Attribute attributes[num_attributes]; attributes[0] = data->response.attribute; if (sender_attr) { // Copy the sender attribute - note: this assumes the timeline item is not freed until // the message is sent attribu...
˜¯˘¿" "あいうえおかきくけこさしすせそたちつてとなに" "ぬねのはひふへほまみむめもやゆよらりるれろわ" "をんアイウエオサシスセソタチツテトナニヌネノ" "ハヒフヘホマミムメモヤユヨラリルレロワヲン", .lengths = { #if PLATFORM_ROBERT [TestStringFont_Gothic18] = 579, [TestStringFont_Gothic24B] = 291, [TestStringFont_Other] = STRING_LENG...
(s_perftest_text_arguments.y_offset)
; if (length == 0) { length = STRING_LENGTH_MAX; } #else size_t length = s_perftest_text_strings[text_index].lengths[font_index]; #endif length = MIN(length, sizeof(s_text_test_str)); strncpy(s_text_test_str, s_perftest_text_strings[text_index].string, length); s_text_test_str[length] = '\0';...
s[HRZone_Zone0], 0); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 0); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 0); prv_inc_time(10); prv_put_bpm_event(ZONE_2_HR, HRMQuality_Good); cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zo...
cl_assert_equal_i(avg_hr, 150)
nore(void) { int32_t median, total_weight; s_num_hr_events = 0; // Start activity tracking. This method assumes it can be called from any task, so we must // invoke system callbacks to handle its KernelBG callback. activity_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); ...
cl_assert_equal_i(activity_metrics_prv_get_distance_mm(), 66 * MM_PER_METER)
; activity_metrics_prv_set_metric(ActivityMetricActiveKCalories, Thursday, 22); activity_metrics_prv_set_metric(ActivityMetricActiveKCalories, Wednesday, 33); activity_get_metric(ActivityMetricActiveKCalories, 2, metric_values); cl_assert_equal_i(metric_values[0], 22); cl_assert_equal_i(metric_values[1], 33)...
}; ProtobufLogRef ref = prv_test_encode_measurements(&input, false /*use_data_logging*/); prv_test_decode_payload(&input, false /*use_data_logging*/, ref); } // A simple message with 1 type, 1 sample. Large sample values { ProtobufLogMeasurementType types[] = {ProtobufLogMeasurementType_BPM}; u...
(&input, msg)
gacyFwUpdateCompletionStatus { uint32_t recovery_percent_completion; uint32_t resource_percent_completion; uint32_t firmware_percent_completion; } LegacyFwUpdateCompletionStatus; typedef struct FwUpdateCompletionStatus { uint32_t bytes_transferred; uint32_t total_size; } FwUpdateCompletionStatus; typedef st...
if (result != FirmwareUpdateRunning) { prv_initialize_completion_status(event); services_set_runlevel(RunLevel_FirmwareUpdate); modal_manager_pop_all(); static const ProgressUIAppArgs s_update_args = { .progress_source = PROGRESS_UI_SOURCE_FW_UPDATE, }; app_manager_launch_new_app(&(AppLa...
xSemaphoreGive(s_firmware_update_semaphore); return result; } static void prv_handle_firmware_update_start_msg(PebbleSystemMessageEvent *event) { FirmwareUpdateStatus result = prv_firmware_update_start(event); s_update_status = result; PBL_ASSERTN((result == FirmwareUpdateRunning) || (result ...
{ -480, 352, -24}, { -520, 288, 80}, { -528, 248, 128}, { -488, 296, 64}, { -504, 328, 40}, // 26 seconds { -768, 344, 32}, { -984, 400, 16}, { -1216, 368, 40}, { -1416, 456, -24}, { -1136, 592, -280}, { -1208, 504, -328}, { -880, 416, -200}, { -480, 344, -224}, {...
{ -672, 632, -200}, { -880, 728, -344}, { -1120, 728, -192}, { -1392, 832, -320}, { -1144, 848, -288}, { -984, 608, -64}, { -1016, 712, -272}, { -920, 560, -144}, { -664, 432, -32}, { -536, 400, -48}, { -544, 336, 0}, { -512, 280, 64}, { -488, 248, 88}, { -472, 27...
0 /* no features */); prv_fake_send_new_data(); fake_system_task_callbacks_invoke_pending(); // Expect 4 events: 1 for BPM, 1 for LED, 2 for subscribing to all, none for no feature. cl_assert_equal_i(s_event_count, 4); sys_hrm_manager_unsubscribe(bpm_session); sys_hrm_manager_unsubscr...
(session_ref_2)
ate_Updated; recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_PositionUpdate }); cl_assert_equal_i(last_touch_event.type, TouchEvent_PositionUpdate); cl_assert_equal_b(updated, true); cl_assert_equal_i(rec_event, RecognizerEvent_Updated); updated = false; new_state = RecognizerState_Canc...
recognizer_should_evaluate_simultaneously(NULL, NULL)
); cl_assert(!recognizer_should_evaluate_simultaneously(r1, NULL)); cl_assert(!recognizer_should_evaluate_simultaneously(NULL, r2)); cl_assert(recognizer_should_evaluate_simultaneously(r1, r2)); } void test_recognizer__add_remove_list(void) { RecognizerList list = { NULL }; NEW_RECOGNIZER(r1) = test_recogniz...
read_size = prv_file_get(&ROOT_KEYS_KEY, sizeof(ROOT_KEYS_KEY), &keys, sizeof(keys)); if (!read_size) { return false; } SM128BitKey nil_key = {}; if (0 == memcmp(&nil_key, &keys[key_type], sizeof(nil_key))) { return false; } if (key_out) { memcpy(key_out, &keys[k...
{ // Skip pairing entries return; }
/* * 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 (!fontinfo->loaded) { if (!text_resources_init_font(SYSTEM_APP, resource, extension, &s_system_fonts_info_table[i])) { // Can't initialize the font for some reason return NULL; } resource_get_and_cache(SYSTEM_APP, resource); resource_get_and_cache(SYSTE...
return &s_system_fonts_info_table[i]; } } // Didn't find the given font, invalid key. return NULL; } GFont system_resource_get_font(const char *font_key) { GFont result = prv_load_system_font(font_key); return result; } DEFINE_SYSCALL(GFont, sys_font_get_system_font, const char *font_key) { if...
nute handler, which computes the minute stats and saves them to data logging // as well as the sleep PFS file. for (int i = 0; i < num_minutes; i++) { fake_rtc_increment_time(SECONDS_PER_MINUTE); s_alg_next_steps = minute_data[i].base.steps; AccelRawData samples[100] = { }; uint64_t timestamp = 0; ...
ambient_light_level_to_enum( expected->base.light * ALG_RAW_LIGHT_SENSOR_DIVIDE_BY)
); cl_assert_equal_i(actual->heart_rate_bpm, expected->heart_rate_bpm); } // --------------------------------------------------------------------------------------- // Test to make sure that when we re-boot we correctly get the saved minute data void test_activity_algorithm_kraepelin__minute_data_after_boot(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...
MHZ_TO_HZ(54)
, FLASH_SPI_CLOCK_PERIPH); // max read freq for the flash spi_cfg.SPI_FirstBit = SPI_FirstBit_MSB; spi_cfg.SPI_CRCPolynomial = 7; SPI_Init(FLASH_SPI, &spi_cfg); SPI_Cmd(FLASH_SPI, ENABLE); } void flash_start(void) { periph_config_acquire_lock(); gpio_use(FLASH_GPIO); // Init the hardware flash_hw_ini...
turn; } if (!prv_write_register(LIS3DH_FIFO_CTRL_REG, mode)) { return; } } } static void prv_reset(void) { lis3dh_lock(); if (i2c_bitbang_recovery(I2C_LIS3DH)) { prv_clear_fifo(); } lis3dh_unlock(); analytics_inc(ANALYTICS_DEVICE_METRIC_ACCEL_RESET_COUNT, AnalyticsClient_System); } ...
{ s_accel_mutex = mutex_create(); }
void lis3dh_lock(void) { mutex_lock(s_accel_mutex); } void lis3dh_unlock(void) { mutex_unlock(s_accel_mutex); } static void prv_handle_tap(void *data) { IMUCoordinateAxis axis; int direction; if (s_running) { uint8_t click_src; lis3dh_read(LIS3DH_CLICK_SRC, 1, &click_src); if (click_src & (...
required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #inc...
{ BTDeviceInternal identity_device = {}; const SMIdentityResolvingKey *irk = (const SMIdentityResolvingKey *) fake_GAPAPI_get_fake_irk(); BleBonding bonding = { .pairing_info = { .identity = identity_device, .irk = *irk, .is_remote_identity_info_valid = true, }, .is_gateway = true, ...
static void prv_assert_no_event(void) { PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_NULL_EVENT); } static void prv_fake_connect(const BTDeviceInternal *device, bool is_master) { // Simulate getting a Connection Complete event for the device from Bluetopia: fake_gap_put_con...
/* * 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 (BOARD_CONFIG_VIBE.options & ActuatorOptions_Pwm) { pwm_init(&BOARD_CONFIG_VIBE.pwm, PWM_TIMER_UPDATE_PERIOD, PWM_TIMER_FREQUENCY_HZ); s_initialized = true; }
if (BOARD_CONFIG_VIBE.options & ActuatorOptions_HBridge) { PBL_ASSERTN(BOARD_CONFIG_VIBE.options & ActuatorOptions_Pwm); } periph_config_release_lock(); } //! Enables / disables the PWM timer used for vibe control. //! Note: assumes the timer peripheral is enabled static void prv_vibe_pwm_enable(bool on) ...
ib/graphics/graphics.h" #include "applib/graphics/graphics_private.h" #include "console/prompt.h" #include "kernel/panic.h" #include "kernel/events.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "process_state/app_state/app_state.h" #include "services/common/compositor/compositor_transitions....
(filter_cb, ctx)
.size.h; const int16_t bottom_clipped_height = (content_size.h + content_offset.y) - frame_size.h; const int16_t shadow_bottom_y_offset = - CLIP(bottom_clipped_height, 0, shadow_bottom_bitmap_h); if (shadow_bottom_y_offset < 0) { graphics_draw_bitmap_in_rect(ctx, shadow_bottom, &GRect(0, layer_h + shadow_bott...
scroll_layer_update_content_indicator(scroll_layer)
; return; } layer_set_bounds(&scroll_layer->content_sublayer, &bounds); scroll_layer_update_content_indicator(scroll_layer); if (scroll_layer->callbacks.content_offset_changed_handler) { scroll_layer->callbacks.content_offset_changed_handler(scroll_layer, get_callback_context(scroll_layer)); } } v...
onnected() && prv_is_allowed_to_run()) { prv_handle_action(StationaryActionEnableStationary); } else { prv_handle_action(StationaryActionDisableStationary); } } void stationary_handle_battery_connection_change_event(void) { PBL_LOG_D(DEBUG_STATIONARY, LOG_LEVEL_DEBUG, "Stationary mode battery...
(LOG_LEVEL_INFO, "Entering stationary: Changing run level")
; if (s_current_state == StationaryStatePeeking) { analytics_event_stationary_state_change(rtc_get_time(), StationaryAnalyticsEnterFromPeek); } else if (s_current_state == StationaryStateAwake) { analytics_event_stationary_state_change(rtc_get_time(), StationaryAnalyticsEnterNormally); } services_set_ru...
time_t local_time; time_t utc_time = *tim_p; if (utc_mode) { res->tm_gmtoff = 0; res->tm_isdst = 0; strncpy(res->tm_zone, "UTC", TZ_LEN); res->tm_zone[TZ_LEN - 1] = '\0'; local_time = utc_time; } else { res->tm_gmtoff = time_get_gmtoffset(); res->tm_isdst = time_get_isdst(utc_time); ...
(utc_offset_min)
* SECONDS_PER_MINUTE; } else { return local_time - (time_t) utc_offset_min * SECONDS_PER_MINUTE; } } time_t time_util_utc_to_local_offset(void) { time_t now = rtc_get_time(); return (time_utc_to_local(now) - now); } // -------------------------------------------------------------------------------------...
sh_check_whoami(dev)) { ++failures; prompt_send_response("ERROR: Who am I failed"); } else { ++passes; } prompt_send_response("Exit low power mode"); flash_impl_exit_low_power_mode(); prompt_send_response("Start flash_read_verify test"); qspi_use(QSPI); const int final_size = atoi(len_str);...
(s_test_addr)
sion 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "A...
{ if (is_remote_connected(remote) != is_remote_connected(other)) { return is_remote_connected(remote) ? -1 : 1; } else { return strncmp(remote->name, other->name, sizeof(remote->name)); } }
ut_ms(uint32_t timeout_ms) { s_notif_window_timeout_ms = timeout_ms; SET_PREF(PREF_KEY_NOTIF_WINDOW_TIMEOUT, s_notif_window_timeout_ms); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Vibes bool alerts_preferences_get_vibrate(void) { return s_vibe_on_no...
(WeekdaySchedule)
<< 2); alerts_dnd_prefs_bitmask |= (alerts_preferences_dnd_is_schedule_enabled(WeekendSchedule) << 3); analytics_set(ANALYTICS_DEVICE_METRIC_ALERTS_DND_PREFS_BITMASK, alerts_dnd_prefs_bitmask, AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_ALERTS_MASK, (uint8_t) al...
_disturb_toggle_push(ActionTogglePrompt_NoPrompt, false /* set_exit_reason */); } static void prv_toggle_manual_dnd_from_settings_menu(void *e_dialog) { do_not_disturb_set_manually_enabled(!do_not_disturb_is_manually_enabled()); } static void prv_push_first_use_dialog(const char* msg, ...
(seconds_until_start, seconds_until_end)
; is_enable_next = (seconds_until_update == seconds_until_start); // Update at midnight if on the last day of the current schedule if ((curr_day == Sunday) || (curr_day == Friday)) { const time_t seconds_until_midnight = time_util_get_seconds_until_daily_time(&time, 0, 0); seconds_until_update =...
return; } iter = &((*iter)->next); } mutex_unlock_recursive(s_list_mutex); } void dls_list_remove_all(void) { mutex_lock_recursive(s_list_mutex); DataLoggingSession *cur = s_logging_sessions; DataLoggingSession *next; while (cur != NULL) { next = cur->next; if (cur->data) { mut...
{ mutex_lock_recursive(s_list_mutex); DataLoggingSession *logging_session = s_logging_sessions; while (logging_session != NULL) { // Read the next pointer first, just in case the callback ends up removing the session. DataLoggingSession *next_logging_session = logging_session->next; if (!callback(lo...
void dls_list_init(void) { s_list_mutex = mutex_create_recursive(); s_logging_sessions = NULL; } bool dls_list_is_session_valid(DataLoggingSession *logging_session) { mutex_lock_recursive(s_list_mutex); DataLoggingSession *iter = s_logging_sessions; while (iter != NULL) { if (iter == logging_session) ...
(nest_count == 1) { \ logged_lr = 0; \ } static PebbleMutexCommon *create_pebble_mutex(LightMutexHandle_t freertos_mutex) { PebbleMutexCommon *mutex = os_malloc_check(sizeof(PebbleMutex)); *mutex = (PebbleMutexCommon) { .freertos_mutex = freertos_mutex, .lr = 0 }...
{ LightMutexHandle_t mutex = handle->common.freertos_mutex; void* holder = xLightMutexGetHolder(mutex); void* current = xTaskGetCurrentTaskHandle(); return (holder == current); }
///////////// void prv_push_and_render_simple_dialog(Dialog *dialog) { gbitmap_destroy(s_dest_bitmap); const int16_t bitmap_width = DISP_COLS; const int16_t bitmap_height = DISP_ROWS; const GSize bitmap_size = GSize(bitmap_width, bitmap_height); s_dest_bitmap = gbitmap_create_blank(bitmap_size, CANVAS_GBITM...
dialog_set_text(dialog, "Calendar Unmuted")
; dialog_set_icon(dialog, RESOURCE_ID_RESULT_MUTE_LARGE); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT); prv_push_and_render_simple_dialog(dialog); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_simple_dialog__does_text_fit(void) { const bool use_status_bar = true; const GSize ic...
REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_CS_HIGH_MIN, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_WRAP_SIZE, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_WRAP_LEN, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_WRAP_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_INST_MD, 0x0); REG_SETF(QS...
(CACHE, CACHE_CTRL3_REG, CACHE_CONTROLLER_RESET, 0x0)
; REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_RAM_SIZE_RESET_VALUE, 0x2); REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_LINE_SIZE_RESET_VALUE, 0x0); REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_ASSOCIATIVITY_RESET_VALUE, 0x2); REG_SETF(CACHE, CACHE_MRM_HITS_REG, MRM_HITS, 0x0); REG_SETF(CACHE, CACHE_MRM_MISSES_REG, MRM_MISSE...
x.size.w; line.height_px = text_box_params.box.size.h; cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 1 * HORIZ_ADVANCE_PX); cl_assert(iter_next(&word_iter)); cl_assert(!line_add_word(&s_ctx, &line, &word_it...
(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 0)
; line_reset(&line, utf8_bounds.start); cl_assert(line_add_words(&line, &word_iter, NULL)); cl_assert(line.height_px == 10); cl_assert(line.width_px == HORIZ_ADVANCE_PX * 0); cl_assert(line.origin.x == 0); cl_assert(line.suffix_codepoint == 0); cl_assert(*line.start == '\n'); // ar cl_assert(*word_i...
cl_assert_equal_i(s_num_alarms_fired, 3); cl_assert_equal_i(s_num_alarm_events_put, 3); cl_assert_equal_i(s_num_timeline_adds, 11); cl_assert_equal_i(s_num_timeline_removes, 7); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. First one should be up...
cron_service_wakeup()
er)) { if (data->show_check_something_first_text) { // clicking "complete" when no days selected box.size = GSize(cell_layer->bounds.size.w, ALARM_DAY_LIST_CELL_HEIGHT); box.origin = GPoint(0, 4); graphics_draw_text(ctx, i18n_get("Check something first.", ...
{ data->show_check_something_first_text = false; }
} static void prv_setup_custom_day_picker_window(AlarmEditorData *data) { window_init(&data->custom_day_picker_window, WINDOW_NAME("Alarm Custom Day Picker")); window_set_user_data(&data->custom_day_picker_window, data); data->custom_day_picker_window.window_handlers.unload = prv_custom_day_picker_window_unload...
/contacts/attributes_address.h" #include "services/normal/contacts/contacts.h" #include "os/mutex.h" #include "system/passert.h" #include "system/status_codes.h" #include "util/units.h" #include "util/uuid.h" #define SETTINGS_FILE_NAME "contactsdb" #define SETTINGS_FILE_SIZE (KiBYTES(30)) static struct { SettingsFi...
mutex_lock(s_contacts_db.mutex)
; status_t rv = pfs_remove(SETTINGS_FILE_NAME); mutex_unlock(s_contacts_db.mutex); return rv; }
vitySession) {.start_utc = now + (5 * SECONDS_PER_MINUTE), .length_min = 5}, HealthIterationDirectionPast)); // a ends later cl_assert(0 > prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 10}, &(ActivitySession) {.start_utc = now + (2 * SECONDS_PER_MINUTE), .length_min = 5}, ...
ARRAY_LENGTH(data)
, &time_start, &time_end); cl_assert_equal_i(1, s_sys_activity_get_minute_history_values.in[0].num_records); // respects time_end == time_start => 0 records s_sys_activity_get_minute_history_values.stage = 0; time_start = time_on_boundary; time_end = time_start; health_service_get_minute_history(data, ARRA...
.id = {0xdd}, .parent_id = {0}, .timestamp = s_feb_5_midnight + 8 * 60 * 60 + 15 * 60, // 8:15-8:16 am .duration = 1, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, } } }; // Setup ///////////////////////// void test_timeline__initialize(void) { fake_rt...
(&iterator)
); cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id)); // check third again cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id)); // check fifth cl_assert(iter_next(&iterator)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pi...
/* * 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(prand_bytes, 0, sizeof(prand_bytes))
; // Copy the 24 LSBits of prand: memcpy(prand_bytes, &prand, PRAND_LEN_BYTES); // Assign the 2 MSBits of the prand, these are used to indicate the address is a PRA. prand_bytes[PRAND_LEN_BYTES - 1] &= 0b00111111; prand_bytes[PRAND_LEN_BYTES - 1] |= 0b01000000; uint8_t hash_bytes[AES_128_BLOCK_SIZE]; prv...
_bitmap, "fill_rect_inside_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_x_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_x_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_...
(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 0, GCornersAll)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r0_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_orig...
/* * 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...
(key, key_len)
; }
tatic const Uuid music_uuid = {0x1f, 0x03, 0x29, 0x3d, 0x47, 0xaf, 0x4f, 0x28, 0xb9, 0x60, 0xf2, 0xb0, 0x2a, 0x6d, 0xd7, 0x57}; static const Uuid sports_uuid = {0x4d, 0xab, 0x81, 0xa6, 0xd2, 0xfc, 0x45, 0x8a, 0x99, 0x2c, 0x7a, 0x1f, 0x3b, 0x96, 0xa9, 0x7...
app_install_get_entry_for_uuid(&sports_uuid, &uuid_entry)
); cl_assert_equal_b(true, app_install_entries_equal(&id_entry, &uuid_entry)); cl_assert_equal_b(true, app_install_get_entry_for_install_id(bg_counter_id, &id_entry)); cl_assert_equal_b(true, app_install_get_entry_for_uuid(&bg_counter.uuid, &uuid_entry)); cl_assert_equal_b(true, app_install_entries_equal(&id_e...
== PebbleTask_Worker) { worker_manager_close_current_worker(gracefully); } else { WTF; } } // ---------------------------------------------------------------------------------------------- bool process_manager_send_event_to_process(PebbleTask task, PebbleEvent* e) { ProcessContext *context = prv_get_c...
{ return (uint32_t) process_manager_get_current_process_args(); }
} // ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(AppExitReason, sys_process_get_exit_reason, void) { return prv_get_context()->exit_reason; } // ------------------------------------------------------------------------------------------- DEFINE_SYSCALL(...
fonts_get_font_height(graph_card->legend_font); const GRect *bounds = &graph_card->layer.bounds; GRect box = { .origin.x = (bounds->size.w - total_bar_widths) / 2, .origin.y = LABEL_OFFSET_Y }; // The first day to draw is Monday, and draw a week's worth of bars for (int i = Monday, draw_count = 0; draw_...
(graph_card->legend_font)
; const int avg_line_offset_y = -1; const GRect avg_line_box = { .origin.x = offset_x, // Position vertically centered with the text .origin.y = info_offset_y + (info_line_height + INFO_PADDING_BOTTOM) / 2 + avg_line_offset_y, .size = { AVG_LINE_LEGEND_WIDTH, AVG_LINE_HEIGHT }, }; graphics_conte...
the cell by two and subtract half of the text size. // However, that just puts the TOP of a line vertically aligned. // So we also have to subtract half of a single line's width. box.origin.y = (box.size.h - text_size.h - fonts_get_font_height(font)/2) / 2; graphics_draw_text(ctx, no_activities_string, font, ...
option_menu_set_content_type(&data->option_menu, OptionMenuContentType_SingleLine)