prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
timeline_init(&head)
; cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0); // delete item 2, iterate to the end, check that everything still works cl_assert_equal_i(pin_db_delete((uint8_t *)&s_items[2].header.id, sizeof(Uuid)), 0); cl_assert(uuid_equal(&state.pin.header.id,...
ation_time_than_existing_not_inserted(void) { // Insert the first glance blob SerializedAppGlanceHeader app_glance_1 = (SerializedAppGlanceHeader) { .version = APP_GLANCE_DB_CURRENT_VERSION, .creation_time = 1464734484, // Tue, 31 May 2016 22:41:24 GMT }; const size_t glance_1_size = sizeof(app_glance_1...
cl_assert_equal_i(prv_insert_dummy_glance_blob_with_size(APP_GLANCE_DB_SLICE_MAX_SIZE + 1), E_INVALID_ARGUMENT)
; } void test_app_glance_db__check_invalid_slice_total_sizes_blob_not_inserted(void) { cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, (uint8_t *)&s_app_glance_with_invalid_slice_total_sizes, sizeof(...
-456}, // 24 seconds { 1656, 592, -280}, { 1920, 528, -112}, { 1816, 408, -176}, { 1360, 368, -128}, { 1008, 288, -72}, { 816, 224, -40}, { 704, 160, -40}, { 656, 144, -40}, { 632, 120, 16}, { 736, 112, 8}, { 760, 88, 48}, { 784, 56, -128}, { 1032, -456, -8}, ...
{ 1040, 1664, -112}, { 1248, 2584, -360}, { 528, 2088, -600}, { 232, 1640, -272}, { 208, 1112, 8}, { -144, 720, 128}, { -496, 600, 24}, { -424, 336, -160}, { -432, 296, -120}, { -456, 368, -96}, // 30 seconds { -560, 552, 56}, { -616, 1584, 88}, { -264, 2568, 296}...
/* * 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...
_Static_assert(sizeof(struct VersionsMessage) >= 126 /* pre-v1.5 version info */ + 24 /* v1.5 version info or later, added system_resources_version */, "")
; version_copy_running_fw_metadata(&versions_msg.running_fw_metadata); prv_fixup_running_firmware_metadata(&versions_msg.running_fw_metadata); version_copy_recovery_fw_metadata(&versions_msg.recovery_fw_metadata); prv_fixup_firmware_metadata(&versions_msg.recovery_fw_metadata); // Note: Don't worry about t...
end_notification((uint8_t *)&s_message_dict); cl_assert_equal_i(s_num_requested_notif_attributes, 2); // should have gotten cached the second time around cl_assert_equal_i(s_num_requested_app_attributes, 1); cl_assert_equal_i(s_num_ds_notifications_received, 2); } void test_ancs__ancs_invalid_param(void) { ...
{ prv_send_notification((uint8_t *)&s_app_name_title_dict); prv_cmp_last_received_notification(&s_app_name_title_parsed_item); }
// Test an unrecognized app with a duplicated title prv_send_notification((uint8_t *)&s_unknown_app_dict); prv_cmp_last_received_notification(&s_unknown_app_parsed_item); // Make sure both apps attributes were requested (Messages and FakeApp) cl_assert_equal_i(s_num_requested_app_attributes, 2); // Test...
&p->framebuffer_offset); } } else { // Original SVGs use Red for the stroke, replace it here const GColor8 key_stroke_color = GColorRed; gdraw_command_replace_color(processed_command, key_stroke_color, p->stroke_color); // replace surrounding color gdraw_command_replace_color(pr...
for (int x = x1.integer; x < x1.integer + width; x++) { graphics_private_raw_mask_apply(output, mask, data_row_offset, x1.integer, 1, *input); input++; output++; }
#else memcpy((uint8_t *)output, (uint8_t *)input, width); input += width; output += width; #endif } // Last pixel with blending (don't render first AND last pixel if line length is 1) if (x2.fraction != 0) { graphics_private_raw_blend_color_factor(ctx, output, data_row_offset, *input, x2.integer...
latform); } static int prv_vertical_icon_margin(void) { const PlatformType platform = process_manager_current_platform(); return PBL_PLATFORM_SWITCH(platform, /*aplite*/ 24, /*basalt*/ 24, /*chalk*/ 53, ...
(0, -animation_offset)
{ window_schedule_render(window); // The click provider was set but not updated if (window->is_waiting_for_click_config && !window->is_unfocusable) { prv_call_click_provider(window); } }
else { window->is_render_scheduled = false; window->is_waiting_for_click_config = false; window->is_click_configured = false; } if (call_window_appear_handlers) { if (window->on_screen) { prv_window_load(window); // In our load handler, we may unload ourselves; this is perfectly fine! ...
TouchEvent_PositionUpdate, &GPointZero, 3686380, 0, &GPoint(10, 10), 20, 5, true); // No touch event generated when finger remains stationary touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686420); touch_event = touch_event_queue_get_event(0, 1); cl_assert_equal_p(tou...
GPoint(13, 13)
, 6, 3686420); touch_handle_update(0, TouchState_FingerUp, &GPoint(15, 100), 0, 3686400); TouchEvent *touch_event = touch_event_queue_get_event(0, 1); prv_test_touch_event(touch_event, 0, TouchEvent_Liftoff, &GPointZero, 3686380, 0, &GPoint(15, 100), 20, 0, true); // touchdown event shou...
estroy(SendBuffer *sb); // ------------------------------------------------------------------------------------------------- // Defined in session_receive_router.c extern void comm_session_receive_router_cleanup(CommSession *session); // --------------------------------------------------------------------------------...
prv_string_for_destination(session->destination)
, uuid_string); } static bool prv_is_transport_type(Transport *transport, const TransportImplementation *implementation, CommSessionTransportType expected_transport_type) { CommSessionTransportType transport_type = implementation->get_type(transport...
ypted(void) { BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk(); BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_device(); prv_fake_connect(&device, false /* is_master*/); fake_GAPAPI_set_encrypted_for_device(&device); fake_GAPAPI_put_encryption_change_event(true /* encry...
fake_HCIAPI_whitelist_contains(&device)
/* * 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...
(ctx, text_test_str, s_font, layer->bounds, GTextOverflowModeWordWrap, GTextAlignmentLeft, NULL)
; }
is opaque, dest is blended blue void test_bitblt__8bit_to_8bit_comptint(void) { GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__8bit_assign.8bit.pbi"); GRect bounds = gbitmap_get_bounds(src_bitmap); uint8_t dest_data[bounds.size.w * bounds.size.h]; GBitmap dest_bitmap = { .addr = dest_data, ....
(&dest_bitmap, &src_bmp, upper_rect, GPointZero, GCompOpAssign, GColorWhite)
; bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, &src_bmp, upper_left_legend_rect, GPointZero, GCompOpAssign, GColorWhite); bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, &src_bmp, upper_right_legend_rect, GPointZero, GCompOpAssign, GColorWhi...
n also be very useful to find out // why the QSPI driver is locking up when doing development static void prv_wait_for_transfer_complete(void) { int i = 0; while (QSPI_GetFlagStatus(QSPI_FLAG_TC) == RESET) { if (++i > QSPI_WAIT_TIME) { break; } } PBL_ASSERT(i < QSPI_WAIT_TIME, "Waited too long fo...
(QSPI_FLAG_TC)
-------------------- // Advance to the end animation_set_elapsed(complex, duration_total); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handle...
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 1); // If we keep going, we should repeat the whole sequence prv_advance_to_ms_with_timers(start_ms + 2 * (duration_total + 4 * MIN_FRAME_INTERVAL_MS)); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 3); c...
reate_object(parent, name, prv_create_function, handler, &result); return result; } bool rocky_add_global_function(char *name, jerry_external_handler_t handler) { return rocky_add_function(jerry_create_undefined(), name, handler); } jerry_value_t rocky_add_constructor(char *name, jerry_external_handler_t handler)...
{ JS_VAR date_constructor = jerry_get_global_builtin((const jerry_char_t *)"Date"); if (!jerry_value_is_constructor(date_constructor)) { return jerry_create_undefined(); } jerry_value_t date_obj; if (tick_time) { jerry_value_t args[] = { jerry_create_number(1900 + tick_time->tm_year), jerry_c...
void rocky_cleanup_js_var(const jerry_value_t *var) { jerry_release_value(*var); }
_get_until_time(const LayoutLayer *layout, char *buffer, int buffer_size, time_t timestamp) { const int max_relative_hrs = 24; const time_t now = rtc_get_time(); const time_t difference = timestamp - now; size_t starts_len = 0; if (difference <= SECONDS_PER_HOUR * max_relative_h...
i18n_noop("Broadcaster")
, .use_i18n = true, .text.font_key = FONT_KEY_GOTHIC_14, .text.line_spacing_delta = CARD_LINE_DELTA, }; return layout_create_text_node_from_config( layout_ref, &s_broadcaster_header_config.text.extent.node); } static GTextNode *prv_card_view_constructor(TimelineLayout *timeline_layout) { Sports...
{ 1144, 592, -216}, { 1248, 488, -200}, { 1056, 320, -168}, { 896, 272, -168}, { 920, 288, -192}, { 1120, 232, -192}, { 1160, 176, -144}, { 1040, 128, -144}, { 1032, 176, -208}, { 896, 88, -184}, { 544, -96, -168}, { 864, -80, -104}, { 872, 16, -352}, { 1368, 200, ...
{ 1064, 184, -184}, { 680, -112, -256}, { 568, -40, -128}, { 664, 8, -464}, { 904, 168, -408}, { 1352, 240, -504}, { 1160, 224, -344}, { 968, 344, -272}, { 928, 352, -208}, { 1024, 520, -168}, { 1200, 536, -144}, { 1168, 704, -160}, // 28 seconds { 1024, 808, -256...
static bool prv_destroy_container_iter(GTextNode *node, void *context) { graphics_text_node_destroy(node); return true; } static void prv_destroy_text_node_container(GTextNode *node) { if (!node) { return; } GTextNodeContainer *container_node = (GTextNodeContainer *)node; prv_container_each(container_...
{ GSize max_used_size; const GAxis axis = prv_container(ctx->node)->axis; const GAxisAlign align = prv_container(ctx->node)->get_axis_align(ctx->node); graphics_text_node_get_size(ctx->node, ctx->gcontext, ctx->draw_box, ctx->config, &max_used_size); const int16_t excess_length = ToGValue(&ctx->box.size)[axis...
static void prv_will_draw_container(GTextNodeDrawContext *ctx) { GTextNodeContainer *container = (GTextNodeContainer *)ctx->node; prv_set_size(&ctx->box.size, &container->size); if (ctx->render) { prv_align_axis(ctx); } } static void prv_did_draw_container(GTextNodeDrawContext *ctx) { GTextNodeContaine...
se_subsector_begin(FlashAddress subsector_addr) { return flash_impl_erase_sector_begin(subsector_addr); } status_t flash_impl_erase_sector_begin(FlashAddress sector_addr) { status_t result = E_UNKNOWN; // FIXME: We should just assert that the address is already aligned. If // someone is depending on this beha...
{ status_t status = E_INTERNAL; sector_addr = flash_impl_get_sector_base_address(sector_addr); flash_impl_use(); uint8_t sr = prv_read_status_register(sector_addr); if ((sr & S29VSStatusBit_DeviceReady) != 0 && (sr & S29VSStatusBit_EraseSuspended) != 0) { prv_issue_command(sector_addr, S29VSCommand_...
// It is dangerous to leave this built in by default. #if 0 status_t flash_impl_erase_bulk_begin(void) { flash_s29vs_use(); prv_issue_command(0, S29VSCommand_EraseSetup); prv_issue_command_argument(0, S29VSCommandEraseAguments_ChipErase); flash_s29vs_release(); } #endif static void prv_read_words_pio(uint...
; const size_t num_vertical_icon_nodes = 1; GTextNodeHorizontal *horizontal_icon_node = graphics_text_node_create_horizontal(num_horizontal_icon_nodes); GTextNodeVertical *vertical_icon_node = graphics_text_node_create_vertical(num_vertical_icon_nodes); graphics_text_node_container_add_c...
{ return layout_node_create_kino_layer_wrapper((void *)&layout->icon_layer); }
static void prv_last_updated_update(const LayoutLayer *layout, const LayoutNodeTextDynamicConfig *config, char *buffer, bool render) { AttributeList *attributes = layout->attributes; const time_t last_updated_time = attribute_get_uint32(attri...
/* * 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...
{ /* normalize path to POSIX forward slashes */ size_t i; for (i = 0; i < len; ++i) { if (_clar_path[i] == '\\') _clar_path[i] = '/'; } }
#endif if (_clar_path[len - 1] != '/') { _clar_path[len++] = '/'; } strncpy(_clar_path + len, path_tail, sizeof(_clar_path) - len); #if defined(__MINGW32__) if (_mktemp(_clar_path) == NULL) return -1; if (mkdir(_clar_path, 0700) != 0) return -1; #elif defined(_WIN32) if (_mktemp_s(_clar_path, sizeof(_c...
GSize *size_out, void *user_data) { LauncherAppGlanceStructured *structured_glance = user_data; LauncherAppGlanceSettings *settings_glance = launcher_app_glance_structured_get_data(structured_glance); const GSize battery_silhouette_icon_size = GSize(BATTERY_SILHOUETTE_ICON_WIDTH, ...
(structured_glance)
d_data.num_services_removed = 1; PebbleBLEGATTClientServiceHandles *remove_hdl = &info->services_removed_data.handles[0]; remove_hdl->service = service; remove_hdl->uuid = service_node->service->uuid; remove_hdl->num_characteristics = service_node->service->num_characteristics; remove_hdl->num_descriptors =...
{ *head = &node->node; }
prv_spi_transmit_flush_blocking(slave->spi_bus); } } void spi_ll_slave_burst_read_write(const SPISlavePort *slave, const void *out, void *in, size_t len) { PBL_ASSERTN(slave->slave_state->initialized); PBL_...
(slave->slave_state->acquired)
; prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqTx, false); slave->slave_state->dma_complete_handler = NULL; slave->slave_state->dma_complete_context = NULL; } void spi_ll_slave_read_write_dma_start(const SPISlavePort *slave, const void *out, void *in, size_t len, SPIDMAComp...
/* * 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...
(SimpleMenuLayer)
; if (layer) { simple_menu_layer_init(layer, &frame, window, sections, num_sections, callback_context); } return layer; } void simple_menu_layer_deinit(SimpleMenuLayer *menu_layer) { menu_layer_deinit(&menu_layer->menu); } void simple_menu_layer_destroy(SimpleMenuLayer* menu_layer) { if (menu_layer == N...
04}, { 928, 232, -160}, { 904, 272, -240}, { 848, 264, -296}, { 1024, 376, -472}, { 872, 368, -592}, { 696, 296, -648}, { 640, 344, -744}, { 760, 408, -792}, { 800, 344, -688}, { 856, 320, -632}, { 808, 320, -600}, { 800, 416, -624}, // 80 seconds { 696, 456, -552...
{ -120, -240, -952}, { -112, -232, -936}, { -112, -232, -928}, { -120, -248, -904}, { -128, -240, -920}, { -96, -256, -904}, { -80, -240, -928}, { -72, -272, -936}, { -40, -272, -936}, { -8, -272, -928}, { 56, -248, -1040}, { 80, -240, -1040}, { 168, -192, -1104}, ...
{ 936, -24, -480}, { 928, -48, -440}, { 1048, -16, -392}, { 1160, -48, -272}, { 1400, 16, -240}, { 1480, 120, -264}, { 1360, 48, -192}, { 1208, -72, -192}, // 5 seconds { 1032, 80, -176}, { 1504, -360, -192}, { 1568, -200, -136}, { 1352, -32, -128}, { 1120, -104,...
OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <bluetooth/gatt.h> #include "comm/ble/gatt_client_accessors.h" #include "comm/ble/gatt_client_discovery.h" #include "comm/ble/gatt_service_changed...
(uuid_equal(&uuid, &expected_service->uuid))
S_PER_MINUTE, 0, 0, 0, 0, 0})); activity_get_metric(ActivityMetricRestingKCalories, ACTIVITY_HISTORY_DAYS, actual_resting_kcalories); for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) { if (i == 0) { cl_assert_equal_i(actual_resting_kcalories[i], s_exp_5pm_resting_kcalories); } el...
if (i == 0) { // All tests start at 5pm, we we just entered 3 minutes of data. uint32_t minutes_today = 17 * MINUTES_PER_HOUR + 3 + ACTIVITY_SESSION_UPDATE_MIN; exp_resting_kcalories[i] = ROUND(s_exp_full_day_resting_kcalories * minutes_today, MINUTES_PER_DAY); ...
} ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricRestingKCalories, exp_resting_kcalories); // Put in 2 activities, one of which should drop off on a new day because it's old and the // other which drop off because it is in the future (invalid) time_t day_start = time_util_get_midnight_of(rtc_get_time()); Activ...
cess, read_profile); } else { smartstrap_profiles_handle_read(context.success, read_profile, read_length); } } static void prv_read_timeout(void *context) { if (smartstrap_fsm_state_test_and_set(SmartstrapStateReadInProgress, SmartstrapStateReadComplete)) { // we n...
(&should_context_switch)
; } else if (should_store && !s_read_info.should_drop) { prv_store_byte(data); } return should_context_switch; } void prv_notify_timeout(void *context) { if (smartstrap_fsm_state_test_and_set(SmartstrapStateNotifyInProgress, SmartstrapStateReadComplete)) { // we...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const char *fmt = leading_zero ? "%02d:%02d" : "%d:%02d"; return snprintf(buffer, buffer_size, i18n_get(fmt, i18n_owner), minutes, seconds); }
zontal_line_dotted(&ctx, GPoint(0, 15), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 17), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 19), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 21), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 23), MAX_NU...
// Odd cols of different lengths setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(1, 0), MAX_NUM_ROWS); graphics_draw_vertical_line_dotted(&ctx, GPoint(3, 0), MAX_NUM_ROWS + 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(5, 0)...
for (int16_t col = 0; col < MAX_NUM_COLS; col++) { graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_even_clip"))); // Clipping on odd boundaries - no offset setup_test_aa_sw(&ctx,...
ite(written_hw_version2_long); hw_version = mfg_get_hw_version(); cl_assert_equal_s(written_hw_version1, hw_version); // Write second time const char* written_hw_version2 = "HIJKLMN"; command_hwver_write(written_hw_version2); hw_version = mfg_get_hw_version(); cl_assert_equal_s(written_hw_version2, hw_ve...
cl_assert_equal_s(sn, first_sn)
; // Second time: const char *second_sn = "012345678901"; r = mfg_write_serial_number(second_sn, strlen(second_sn), &index); sn = mfg_get_serial_number(); cl_assert_equal_i(index, 3); // SERIAL2 lives at index 3 cl_assert_equal_i(r, MfgSerialsResultSuccess); cl_assert_equal_s(sn, second_sn); // Third ...
ToGValue(&ctx->box.size)[axis] - ToGValue(&max_used_size)[axis]; if (align == GAxisAlign_Center) { ToGValue(&ctx->box.origin)[axis] += excess_length / 2; } else if (align == GAxisAlign_Max) { ToGValue(&ctx->box.origin)[axis] += excess_length; } } static void prv_will_draw_container(GTextNodeDrawContext ...
{ return s_impl_table[node->type]; }
static const GTextNodeContainerImpl *prv_container(GTextNode *node) { return (const GTextNodeContainerImpl *)s_impl_table[node->type]; } void graphics_text_node_destroy(GTextNode *node) { if (node) { prv_base(node)->destructor(node); } } bool graphics_text_node_container_add_child(GTextNodeContainer *pare...
RIPT_EXPECT_ERROR( "ctx.rockyFillRadial(30, 40, 10, 20, 0, false);\n", "TypeError: Argument at index 5 is not a Number" ); } void test_rocky_api_graphics__fill_radial_range_check(void) { prv_global_init_and_set_ctx(); EXECUTE_SCRIPT_EXPECT_ERROR( "ctx.rockyFillRadial(4096, 40, 10, 20, 0, false...
(1, s_context.draw_state.fill_color.argb)
; EXECUTE_SCRIPT("ctx.save()\n"); // 1 s_context.draw_state.fill_color.argb = 2; EXECUTE_SCRIPT("ctx.save()\n"); // 2 s_context.draw_state.fill_color.argb = 3; EXECUTE_SCRIPT("ctx.restore()\n"); // -> 2 (one element left) cl_assert_equal_i(2, s_context.draw_state.fill_color.argb); EXECUTE_SCRIPT("ctx.r...
t_node) { TextDynamicContext *context = (TextDynamicContext *)text_node->buffer; *context = (TextDynamicContext) { .layout = layout, .config = *config, }; text_node->user_data = context; // graphics_text_node_create_text_dynamic() sets text_node->text.text to text_node->buffer, // bu...
attribute_get_string_list(attributes, AttributeIdHeadings)
; StringList *paragraphs = attribute_get_string_list(attributes, AttributeIdParagraphs); const size_t num_headings = string_list_count(headings); if (num_headings == 0) { return NULL; } const LayoutNodeTextConfig s_heading_config = { .extent.node.type = LayoutNodeType_Text, .font_key = prv_get_fo...
{ -900, 510, -141}, { -970, 376, -113}, { -891, 346, -100}, { -797, 395, -38}, { -774, 526, -58}, { -837, 453, -35}, { -840, 405, 9}, { -844, 380, 31}, { -854, 443, 22}, { -892, 420, 43}, { -889, 378, 65}, { -872, 362, 99}, { -841, 375, 101}, { -1106, 546, 141}, ...
for (uint32_t minute = 0; minute < minutes; minute++) { if ((minute % 30) == 0) { activity_test_feed_samples(s_walk_30_steps, 2 * SAMPLES_PER_SECOND); prv_feed_idle_movement_sec(58); } else { prv_feed_idle_movement_sec(60); } activity_test_run_minute_callback(); rtc_set_time(rtc_ge...
} // ------------------------------------------------------------------------------- static void prv_test_steps(void *context) { bool passed = false; // Reset all stored data activity_test_reset(true /*reset_settings*/, true /*tracking_on*/, NULL, NULL); // Fill the steps pipleine then capture step count b...
tic void prv_draw_text_node(GTextNode *node, GContext *ctx, const GRect *box, const GTextNodeDrawConfig *config, bool render, GSize *size_out); static bool prv_container_each(GTextNodeContainer *container_node, ContainerIterCallback callback, void *context)...
if (prev_child) { prev_child->sibling = child; }
return true; } static void prv_set_size(GSize *size, const GSize *exact_size) { if (exact_size->w) { size->w = exact_size->w; } if (exact_size->h) { size->h = exact_size->h; } } static void prv_clip_width(GSize *size, const GSize *max_size) { if (max_size->w && size->w > max_size->w) { size->...
cation of maximum size based //! on the platform. The only time when this isn't true is the time between "add_entry" and the //! callback to clean up the cache. #define APP_CACHE_FILE_NAME "appcache" //! each cache entry is ~16 bytes, 4000 / 16 = 250 apps #define APP_CACHE_MAX_SIZE 4000 //! Keep enough room for the ...
system_task_add_callback(prv_delete_cache_callback, NULL)
; return false; // stop iterating, delete the file and binaries } EachEvictData *data = (EachEvictData *)context; AppInstallId id; AppCacheEntry entry; info->get_key(file, (uint8_t *)&id, info->key_len); info->get_val(file, (uint8_t *)&entry, info->val_len); // create node EvictListNode *node = ...
/* * 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...
applib_free(state->cache)
/* * 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...
milliseconds_to_ticks_double(time_ms)
); } void test_freertos_utils__should_convert_max_to_ticks(void) { const uint32_t uint32_max = ~0; // The maximum input time possible until overflow uint32_t max_time_ms = ((double)uint32_max * 1000.0) / s_tick_rate_hz; cl_assert(milliseconds_to_ticks(max_time_ms) == (uint32_max - 1)); cl_assert(millisecon...
nclude "8bit/test_framebuffer.h" // Stubs //////////////////////////////////// #include "graphics_common_stubs.h" #include "stubs_applib_resource.h" void window_transition_context_appearance_call_all(WindowTransitioningContext *ctx) {} void window_render(Window *window, GContext *ctx) {} bool compositor_transition_...
{ prv_test_clipping_mask(prv_left_flip_first_quarter_frame_clipping, "left_flip_first_quarter_frame_clipping"); }
; // This test records a clipping mask of the half progress frame of the left "round flip" compositor // transition animation and then clips a full-screen red rectangle to the resulting mask static void prv_left_flip_half_frame_clipping(GContext *ctx) { compositor_round_flip_transitions_flip_animation_update(ctx, A...
0, 240}, { -48, 920, 240}, { -40, 920, 240}, { -40, 912, 240}, { -40, 920, 240}, { -48, 920, 248}, { -40, 920, 240}, { -32, 920, 240}, { -40, 920, 256}, { -40, 920, 248}, { -40, 912, 248}, { -40, 920, 248}, { -40, 920, 248}, { -40, 912, 248}, { -32, 920, 248}, ...
{ -32, 920, 248}, { -40, 920, 248}, { -40, 920, 248}, { -40, 912, 248}, // 122 seconds { -40, 920, 248}, { -40, 920, 240}, { -40, 920, 232}, { -32, 912, 240}, { -40, 920, 248}, { -40, 920, 248}, { -40, 920, 248}, { -32, 912, 248}, { -40, 920, 248}, { -40, 920,...
{ -40, 928, 216}, { -40, 928, 208}, { -40, 928, 216}, { -48, 928, 208}, { -48, 936, 216}, { -40, 920, 208}, { -40, 928, 208}, { -48, 928, 200}, { -40, 928, 208}, // 125 seconds { -32, 920, 200}, { -40, 928, 216}, { -40, 928, 216}, { -40, 928, 208}, { -40, 936...
pebble_app_connected) { return RESOURCE_ID_CONNECTIVITY_BLUETOOTH_CONNECTED; } else { WTF; } } static void prv_refresh_glance_content(LauncherAppGlanceSettings *settings_glance) { // Update the battery percent text in the glance const size_t battery_percent_text_size = sizeof(settings_glance->battery_p...
(&node->uuid, &s_settings_structured_glance_impl, should_consider_slices, settings_glance)
; PBL_ASSERTN(structured_glance); // Disable selection animations for the settings glance structured_glance->selection_animation_disabled = true; // Set the first state of the glance settings_glance->glance_state = (LauncherAppGlanceSettingsState) { .battery_charge_state = battery_state_service_peek(), ...
{ return (dev->state->enabled_state == HRMEnabledState_Enabled || dev->state->enabled_state == HRMEnabledState_PoweringOn); }
void as7000_get_version_info(HRMDevice *dev, AS7000InfoRecord *info_out) { if (!dev->state->lock) { PBL_LOG(LOG_LEVEL_DEBUG, "Not an HRM Device."); return; } mutex_lock(dev->state->lock); if (!prv_get_and_log_device_info(dev, info_out, true /* log_version */)) { PBL_LOG(LOG_LEVEL_WARNING, "Failed...
/* * 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 (alignment == image->alignment) { return; } image->alignment = alignment; layer_mark_dirty(&(image->layer)); }
void bitmap_layer_set_background_color(BitmapLayer *image, GColor color) { const GColor image_color = image->background_color; if (gcolor_equal(color, image_color)) { return; } image->background_color = color; layer_mark_dirty(&(image->layer)); } void bitmap_layer_set_background_color_2bit(BitmapLayer ...
in the future to protect against that I suppose uint16_t connection_get_idx(Connection *connection) { uint16_t idx; prv_lock(); { idx = connection->conn_idx; } prv_unlock(); return idx; } void connection_get_address(const Connection *connection, BTDeviceInternal *addr_buf) { prv_lock(); { if ...
prv_unlock()
; } void connection_set_subscribed_to_connection_status_notifications( Connection *connection, bool is_subscribed) { prv_set_flag(connection, is_subscribed, ConnectionFlag_IsSubscribedToConnectionStatusNotifications); } void connection_set_subscribed_to_gatt_mtu_notifications( Connection *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...
(&s_header_mbuf, s_header_data, sizeof(s_header_data))
always an option) content_indicator_set_content_available(&health_card_view->down_indicator, ContentIndicatorDirectionDown, true); } static void prv_hide_content_indicators(HealthCardView *health_card_view) { content_indicator_set...
(NUM_MID_FRAMES)
cl_assert_equal_i(state.node->timestamp, midnight_march_2_pst + SECONDS_PER_DAY)
; cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY); cl_assert_equal_i(state.current_day, midnight_march_2_pst + SECONDS_PER_DAY); // no more cl_assert(!iter_next(&iterator)); // 4 deletes cl_assert(timeline_iter_remove_node_with_id(&head, &multiday_item.header.id)); cl_assert(timeline_iter_remov...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_timer_register(PERSIST_WRITE_PERIOD_MS /*ms*/, update_persist_callback, NULL)
; } // ----------------------------------------------------------------------------------------------- static void battery_state_handler(BatteryChargeState charge) { APP_LOG(APP_LOG_LEVEL_INFO, "got battery state service update"); APP_LOG(APP_LOG_LEVEL_INFO, "percent: %d, is_charging: %d, is_plugged: %d", charge....
ox_out = GRect(TIMELINE_CARD_MARGIN, 0, frame->size.w - 2 * TIMELINE_CARD_MARGIN, TIMELINE_MAX_BOX_HEIGHT); } static void prv_render_view(TimelineLayout *layout, GContext *ctx, bool render, GSize *size_out) { const bool is_card = (layout->layout_layer.mode == LayoutLayerModeCard); const bool is_...
layout_create_text_node_from_config(&layout->layout_layer, &s_header_config.text.extent.node)
(s_test_buffer, s_test_addr, sizeof(s_test_buffer))
; QSPIFlash *dev = QSPI_FLASH; // Ensure DDR is disabled for write check prv_set_fast_read_ddr_enabled(dev, false); uint8_t instruction; uint8_t dummy_cycles; bool is_ddr; prv_get_fast_read_params(dev, &instruction, &dummy_cycles, &is_ddr); PBL_ASSERTN(!is_ddr); qspi_use(QSPI); qspi_indirect_read(...
#include "stubs_sleep.h" #include "stubs_serial.h" #include "stubs_syscalls.h" #include "stubs_sys_exit.h" size_t heap_bytes_free(void) { return 123456; } void tick_timer_service_handle_time_change(void) {} MockCallRecordings s_tick_timer_service_subscribe; void tick_timer_service_subscribe(TimeUnits tick_units, ...
(5, s_tick_timer_service_subscribe.call_count)
; cl_assert_equal_i(SECOND_UNIT | MINUTE_UNIT | HOUR_UNIT | DAY_UNIT | MONTH_UNIT | YEAR_UNIT, s_tick_timer_service_subscribe.last_call.tick_units); } void prv_tick_handler(struct tm *tick_time, TimeUnits units_changed); void test_rocky_api_tickservice__calls_handlers(void) { rocky_global_ini...
nceStructured *structured_glance) { LauncherAppGlanceMusic *music_glance = launcher_app_glance_structured_get_data(structured_glance); if (music_glance) { event_service_client_unsubscribe(&music_glance->music_event_info); kino_reel_destroy(music_glance->icon); } app_free(music_glance); } static v...
{ case PebbleMediaEventTypeNowPlayingChanged: case PebbleMediaEventTypePlaybackStateChanged: case PebbleMediaEventTypeServerConnected: case PebbleMediaEventTypeServerDisconnected: prv_update_glance_for_music_state(context); return; case PebbleMediaEventTypeVolumeChanged: case PebbleM...
WTF; } static const LauncherAppGlanceStructuredImpl s_music_structured_glance_impl = { .get_icon = prv_get_icon, .get_title = prv_get_title, .create_subtitle_node = prv_create_subtitle_node, .destructor = prv_destructor, }; LauncherAppGlance *launcher_app_glance_music_create(const AppMenuNode *node) { PB...
/* * 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...
{ FSResourceAppData *data = window_get_user_data(window); Layer *root_layer = window_get_root_layer(window); gbitmap_init_with_resource(&data->bitmap, RESOURCE_ID_PUG); bitmap_layer_init(&data->bitmap_layer, &root_layer->bounds); bitmap_layer_set_bitmap(&data->bitmap_layer, &data->bitmap); layer_add_child(r...
ltime_r(&timestamp, &time_tm); const size_t ret_val = strftime(buffer, buf_size, i18n_get(format, buffer), &time_tm); i18n_free(format, buffer); return ret_val; } size_t clock_get_time_number(char *number_buffer, size_t number_buffer_size, time_t timestamp) { const size_t written = prv_format_time(number...
(number_buffer, "", number_buffer_size)
; } } DEFINE_SYSCALL(bool, clock_is_24h_style, void) { return shell_prefs_get_clock_24h_style(); } void clock_set_24h_style(bool is_24h_style) { shell_prefs_set_clock_24h_style(is_24h_style); } DEFINE_SYSCALL(bool, clock_is_timezone_set, void) { return rtc_is_timezone_set(); // If timezone abbr isn't set } ...
e.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 * ...
(AccessoryInputStateImaging)
; accessory_use_dma(true); s_timeout_timer = new_timer_create(); new_timer_start(s_timeout_timer, TIMEOUT_MS, prv_timeout_timer_cb, NULL, 0 /* flags */); PBL_LOG(LOG_LEVEL_DEBUG, "Starting accessory imaging"); } static void prv_stop(void *context) { if (s_no_buffer_count > 0) { PBL_LOG(LOG_LEVEL_ERROR, "...
oiceUiData *data, VoiceUiState state); static PropertyAnimation *prv_create_int16_prop_anim(int16_t from, int16_t to, uint32_t duration, const PropertyAnimationImplementation *impl, ...
dialog_set_text(dialog, data->error_text_buffer)
; dialog_set_icon(dialog, resource_id); dialog_set_background_color(dialog, color); dialog_set_timeout(dialog, has_timeout ? ERROR_DIALOG_TIMEOUT : DIALOG_TIMEOUT_INFINITE); dialog_set_destroy_on_pop(dialog, false /* free_on_pop */); } static void prv_push_error_dialog(VoiceUiData *data, const char *text, uint...
d PQRS // being the value. PBL_ASSERTN((response.data[0] & 0xF0) == (address & 0xF0)); PBL_ASSERTN((response.data[2] & 0x0F) == PACKET_FOOTER); *(uint16_t *)result = (response.data[0] << 4) | (response.data[1] >> 4); *(uint16_t *)result <<= 8; *(uint16_t *)result |= (response.data[1] << 4) | (re...
{ // TODO: PBL-29944 handle this gracefully by re-initializing - should "never" happen PBL_CROAK("Touch controller reset!"); }
ed = (attribute_get_uint32(layout->layout_layer.attributes, AttributeIdLastUpdated, 0) != 0); // One node for paragraphs and headings, and conditionally two more for the last updated time. const int num_default_nodes = has_last_updated ? 3 : 1; vertical_config.container.extra_capacity = num_default_nodes; ...
(buffer, config->buffer_size, layout->info->timestamp)
; }
the License. */ #include "pebble.h" #include <stdlib.h> static Window *window; static TextLayer *s_text_layer_a; static TextLayer *s_text_layer_b; static Animation *s_animation; static int toggle; #define DURATION 1000 static void animation_started(Animation *animation, void *data) { text_layer_set_text(s_tex...
animation_set_curve((Animation*) a, AnimationCurveEaseIn)
; animation_set_curve((Animation*) a_rev, AnimationCurveEaseIn); break; default: case BUTTON_ID_SELECT: animation_set_curve((Animation*) a, AnimationCurveEaseInOut); animation_set_curve((Animation*) a_rev, AnimationCurveEaseInOut); break; } /* // Exmple animation parameter...
{ -424, 760, 184}, { -432, 760, 176}, { -440, 752, 192}, { -440, 760, 184}, { -432, 760, 192}, { -432, 768, 160}, { -360, 696, 256}, { -520, 792, 184}, { -408, 728, 160}, // 198 seconds { -440, 752, 176}, { -456, 760, 176}, { -424, 752, 184}, { -424, 760, 168}, ...
{ -432, 752, 184}, { -440, 744, 184}, { -448, 752, 192}, { -424, 752, 176}, { -424, 768, 176}, { -432, 752, 184}, { -448, 752, 192}, { -440, 760, 176}, { -432, 760, 168}, { -432, 760, 184}, { -432, 760, 192}, { -440, 760, 184}, { -440, 752, 176}, { -440, 752, 176...
/* * 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 CAPABILITY_HAS_SDK_SHELL4 clock_copy_time_string(data->time_buffer, sizeof(data->time_buffer)); text_layer_set_text(&data->time_text_layer, data->time_buffer); #endif }
static void prv_update_info(SdkAppData *data) { const AppInstallId app_id = shell_sdk_get_last_installed_app(); const char *text; #if CAPABILITY_HAS_SDK_SHELL4 const unsigned int tip_delay_s = 5; if ((app_id == INSTALL_ID_INVALID) || shell_sdk_last_installed_app_is_watchface()) { text = "Install an app to...
(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 })
; prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_CUSTOM, schedule_1); cl_assert_equal_i(s_num_timeline_adds, 2); // First alarm goes off. Second one should be up s_current_hour = 10; s_current_minute = 30; s_current_day = s_saturday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, ...
nnectionStateDischargingUnplugged; } } static void prv_update_state(void *force_update) { const uint8_t MAX_SAMPLE_SKIPS = 5; bool forced = (bool)force_update; // Large current draws will cause the voltage supplied by the battery to // droop. We try to only sample the battery when there is minimal // activ...
prv_schedule_update(0, true)
; } void battery_state_init(void) { s_periodic_timer_id = new_timer_create(); s_last_battery_state = (BatteryState) { .connection = ConnectionStateDischargingUnplugged }; battery_state_reset_filter(); battery_state_force_update(); s_analytics_previous_mv = s_last_battery_state.voltage; } void battery_stat...
p.${BIT_DEPTH_NAME}.pbi")); // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax2_aa_...
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 3)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r3_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1); cl_check(gbitm...
/* * 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...
xQueueReceive(queue, &event, 0)
(prv_count_handler_entries(&s_started_handler_calls, a), 1); prv_advance_to_ms_with_timers(start_ms + 310); // Schedule B now and run for a little animation_schedule(b); prv_advance_to_ms_with_timers(start_ms + 330); // Schedule C now and run for a while prv_advance_to_ms_with_timers(start_ms + 500); cl...
prv_unschedule_all_in_update_handler(true)
; } // -------------------------------------------------------------------------------------- // Test unscheduling animations arbitrarily in an update handler without auto destroy. void test_animation__unschedule_all_in_update_handler_without_auto_destroy(void) { prv_unschedule_all_in_update_handler(false); } stati...
rgb); cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0xaaaaaa)).argb); // // expectation as derived from Appfaces_generic_colors.psd cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0x0000aa)).argb); cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0x005500)).argb); cl_assert_equal_i(GColorWh...
(gcolor_equal(lookup_table_out[3], GColorYellow))
; // lookup_table_out's entries should all preserve the alpha of tint_color tint_color = GColorBlack; tint_color.a = 1; gcolor_tint_luminance_lookup_table_init(tint_color, lookup_table_out); for (GColor8Component i = 0; i < GCOLOR8_COMPONENT_NUM_VALUES; i++) { cl_assert_equal_i(lookup_table_out[i].a, tin...
/* * 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; }
unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert_equal_p(job, NULL); advert_term.min_interval_slots = 160; advert_term.max_interval_slots = 160; job = gap_le_advert_schedule(ad_scannable, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), ...
gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ len++; }
return len; } size_t strnlen(const char *s, size_t maxlen) { size_t len = 0; while (*s++ && maxlen--) { len++; } return len; }
%3V", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "00005 001"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%9z", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "+0000"); #endif tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%12d", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "0000...
(tmbuf, "Fri Jan 2 13:00:00 2015")
TODO: test various min/max version combos // TODO: test RX/TX buffer size combos //////////////////////////////////////////////////////////////////////////////// // Generic Tests //////////////////////////////////////////////////////////////////////////////// void test_rocky_api_app_message__json_stringify(void) { ...
prv_assert_simple_test_object_pending()
; prv_rcv_app_message_ack(APP_MSG_OK); EXPECT_OUTBOX_NO_MESSAGE_PENDING(); } static void prv_init_and_goto_session_open_with_tiny_buffers(void) { prv_init_and_goto_awaiting_reset_complete_remote_initiated(); RCV_APP_MESSAGE(TupletBytes(PostMessageKeyResetComplete, \ (const uint8...
orBlack); } else { text_layer_set_background_color(text, GColorBlack); text_layer_set_text_color(text, GColorWhite); } } static void raw_click_handler(ClickRecognizerRef recognizer, Window *window, const bool up) { ClickAppData *data = window_get_user_data(window); sniprintf(data->text_buffer, TEXT_BUF...
(text, &window->layer.bounds)
; text_layer_set_text(text, "Use select button and try different clicks: single, hold-to-repeat, multiple, long press, etc.\n\nNOTE: a long click config will override hold-to-repeat config. Comment out the long_click section of the config to enable hold-to-repeat."); layer_add_child(&window->layer, &text->layer); }...
RIC_FLASH_READ_BYTES_COUNT, s_analytics_read_bytes_count, AnalyticsClient_App); analytics_set(ANALYTICS_APP_METRIC_FLASH_WRITE_BYTES_COUNT, s_analytics_write_bytes_count, AnalyticsClient_App); // The overhead cost of tracking whether each flash read was due to the foreground // or...
{ // 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.address); PBL_A...
} //! Assumes that s_flash_lock is held. static void prv_erase_resume(void) { if (s_erase.suspended) { status_t status = flash_impl_erase_resume(s_erase.address); PBL_ASSERT(PASSED(status), "Erase resume failure: %" PRId32, status); s_erase.suspended = false; } } static void prv_erase_suspend_timer_c...
it->cursor.y += it->cursor.sep; } ++(it->cursor.index.row); } // for() rows // Next section: ++(it->cursor.index.section); if (it->cursor.index.section >= num_sections) { break; // Reached last section } it->cursor.index.row = 0; it->cursor.h = prv_menu_layer_get_he...
{ ctx->draw_state.fill_color = menu_layer->normal_colors[MenuLayerColorBackground]; graphics_fill_rect(ctx, bounds); }
/* * 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...
(LOG_LEVEL_INFO, (const uint8_t *)&bonding->pairing_info.local_encryption_info.rand, sizeof(bonding->pairing_info.local_encryption_info.rand))
; PBL_HEXDUMP(LOG_LEVEL_INFO, (const uint8_t *)&bonding->pairing_info.local_encryption_info.ediv, sizeof(bonding->pairing_info.local_encryption_info.ediv)); PBL_HEXDUMP(LOG_LEVEL_INFO, (const uint8_t *)&bonding->pairing_info.irk, sizeof(bonding->pairing_info.irk)); #endif } void bt_driv...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
while (layer && (layer != root)) { if (!recognizer_list_iterate(layer_get_recognizer_list(layer), iter_cb, context)) { return false; } layer = layer->parent; }
return true; } typedef struct ProcessTouchCtx { Recognizer *triggered; const TouchEvent *touch_event; } ProcessTouchCtx; T_STATIC bool prv_dispatch_touch_event(Recognizer *recognizer, void *context) { ProcessTouchCtx *ctx = context; // Skip recognizer if it has already failed, been cancelled or completed ...
/* * 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 (metric_group->num_items >= metric_group->max_num_items) { return false; } const size_t max_list_size = StringListSize(metric_group->max_num_items, metric_group->max_item_string_size); string_list_add_string(metric_group->names, max_list_size, i18n_get(name...
.data = data, .entry_buf = db_entry, }; settings_file_each(&s_app_db.settings_file, prv_enumerate_entries, &cb_data); prv_close_file_and_unlock_mutex(); kernel_free(db_entry); return; } ///////////////////////// // Blob DB API ///////////////////////// void app_db_init(void) { memset(&s_app_db, 0, s...
if (rv == S_SUCCESS) { rv = settings_file_delete(&s_app_db.settings_file, (uint8_t *)&app_id, sizeof(AppInstallId)); }
prv_close_file_and_unlock_mutex(); if (rv == S_SUCCESS) { // uuid will be free'd by app_install_manager Uuid *uuid_copy = kernel_malloc_check(sizeof(Uuid)); memcpy(uuid_copy, key, sizeof(Uuid)); app_install_do_callbacks(APP_REMOVED, app_id, uuid_copy, NULL, NULL); } return rv; } status_t a...
tm_mon = 11, .tm_mday = 30, // 2014/12/30 .tm_wday = 2, .tm_yday = 363, // Tuesday, 364th day of the year .tm_gmtoff = 0, .tm_isdst = 0, .tm_zone = "UTC", // No DST, UTC+0 }; struct tm jan_2_2015__13_00_00 = { .tm_hour = 13, .tm_min = 0, .tm_sec = 0, // 13:00:00 .tm_year = 2015 - 1900, .tm_mon = 0,...
(tmbuf, sizeof(tmbuf), "%6Y %3y", &jan_2_10015__13_00_00)
; cl_assert_equal_s(tmbuf, "010015 015"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%Z %%", &jan_2_10015__13_00_00); cl_assert_equal_s(tmbuf, "UTC %"); } extern size_t localized_strftime(char* s, size_t maxsize, const char* format, const struct tm* tim_p, const char *locale); void test_strftime_...
rt_rate_zone = minute_data[i].heart_rate_zone; AlgMinuteRecord minute_record = {}; activity_algorithm_minute_handler(rtc_get_time(), &minute_record); if (simulate_bg_delays) { rtc_set_time(rtc_get_time() - delay); } } } // =======================================================================...
(start, start_utc)
; for (int i = 0; i < num_minutes; i++) { prv_assert_minute_data(&retrieve[i], &minute_data[i]); } } // --------------------------------------------------------------------------------------- // Test to make sure that the minute data file gets compacted correctly. If we write more than // ALG_MINUTE_DATA_FILE...
t, rect, GTextOverflowModeFill, GTextAlignmentCenter, NULL); } } static void prv_render_typical_sleep_text(GContext *ctx, Layer *base_layer) { HealthSleepSummaryCardData *data = layer_get_data(base_layer); const int typical_sleep = health_data_sleep_get_cur_wday_average(data->health_data); char sleep_text[32...
(health_sleep_summary_card_data->health_data)
; }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return &s_worker_state_ptr->rand_seed; }
AccelServiceState *worker_state_get_accel_state(void) { return &s_worker_state_ptr->accel_state; } CompassServiceConfig **worker_state_get_compass_config(void) { return &s_worker_state_ptr->compass_config; } EventServiceInfo *worker_state_get_event_service_state(void) { return &s_worker_state_ptr->event_servi...
sizes[sn]; } static bool prv_is_packet_with_sn_awaiting_ack(const PPoGATTClient *client, uint32_t sn) { return (prv_get_payload_size_for_sn(client, sn) != 0); } static uint16_t prv_total_num_bytes_awaiting_ack_up_to(const PPoGATTClient *client, uint32_t sn_end_...
prv_roll_back(client, sn)
; // Return, because all packets after the timed-out one have been "rolled back" now, // no point in continuing. return; } // No timeouts s_ppogatt_timeout_count = 0; } static void prv_timer_callback(void *unused) { bt_lock(); { PPoGATTClient *client = s_ppogatt_head; while (client) { ...
cache_line_size, 16); cl_will_return(syscall_internal_check_return_address, true); s_user_start = 0x00; s_user_size = 0x20; memory_cache_flush((void*)0x0F, 0x2); cl_assert_equal_i(s_flush_addr, 0x00); cl_assert_equal_i(s_flush_size, 0x20); cl_assert_equal_i(s_invalidate_addr, 0x00); cl_assert_equal_i...
cl_assert_equal_i(s_invalidate_addr, 0x20)
; cl_assert_equal_i(s_invalidate_size, 0x01); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Invalid); } void test_cpu_cache__without_cache(void) { cl_will_return(icache_is_enabled, false); cl_will_return(dcache_is_enabled, false); cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_size, 1...
t_queue_set = NULL; static const int MAX_KERNEL_EVENTS = 32; static const int MAX_FROM_APP_EVENTS = 10; static const int MAX_FROM_WORKER_EVENTS = 5; static const int MAX_FROM_KERNEL_MAIN_EVENTS = 14; uint32_t s_current_event; #define EVENT_DEBUG 0 #if EVENT_DEBUG static void prv_queue_dump(QueueHandle_t queue) { ...
xQueueSendToBack(queue, event, milliseconds_to_ticks(3000))
) { // We waited a reasonable amount of time here before failing. We don't want to wait too long because // if the queue really is stuck we'll just get a watchdog reset, which will be harder to debug than // just dieing here. However, we want to wait a non-zero amount of time to provide for a little bit ...
sessions(time_t after_time, int *num_sleep, int *num_nap) { *num_sleep = 0; *num_nap = 0; ActivitySession sessions[ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT]; uint32_t session_entries = ARRAY_LENGTH(sessions); bool success = activity_get_sessions(&session_entries, sessions); if (!success) { return; } P...
(time_util_get_midnight_of(rtc_get_time()))
; bool prev_insights_enabled = activity_prefs_sleep_insights_are_enabled(); activity_prefs_sleep_insights_set_enabled(true); // History with low median but good sleep over the past few days ActivitySettingsValueHistory sleep_history = { .utc_sec = rtc_get_time(), .values = { 0, // This ends up o...
equal_i(prv_count_handler_entries(&s_started_handler_calls, a3), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a3), 1); // None of the b's should finish yet cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b0), 0); cl_assert_equal_i(prv_count_handler_entries(&s_...
cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a))
; animation_get_elapsed(b, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a + duration_a + delay_b)); // Start prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_star...
/* * 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...
{ ProcessTouchCtx ctx = { .touch_event = touch_event, }; prv_process_all_recognizers(manager, prv_dispatch_touch_event, &ctx); return ctx.triggered; }
typedef struct FailRecognizerCtx { Recognizer *triggered; bool recognizers_active; } FailRecognizerCtx; T_STATIC bool prv_fail_recognizer(Recognizer *recognizer, void *context) { FailRecognizerCtx *ctx = context; if ((recognizer == ctx->triggered) || !recognizer_is_active(recognizer)) { return true...
#define READ_HISTORY_ENTRIES (4 * MINUTES_PER_HOUR) static int32_t s_temp_readings[READ_HISTORY_ENTRIES]; // Demo temperature typedef struct { Window *window; TextLayer *cur_temp_layer; TextLayer *temp_range_layer; char cur_temp_text[32]; char temp_range_text[128]; int min_temp; int max_temp; } Temperatu...
{ int reading = s_temp_readings[i]; int line_height = (reading - data->min_temp) * PLOT_HEIGHT / temp_range; int y_pos = PLOT_BOTTOM - line_height; graphics_context_set_stroke_color(ctx, GColorRed); graphics_draw_line(ctx, GPoint(x_pos, PLOT_BOTTOM), GPoint(x_pos, y_pos)); GRect dot = GRect(x_...
BToken token; BlobDBResponse result; uint8_t num_ids; BlobDBId db_ids[NumBlobDBs]; } response = { .cmd = BLOB_DB_COMMAND_DIRTY_DBS_RESPONSE, .token = *(BlobDBToken *)data, .result = BLOB_DB_SUCCESS, }; blob_db_get_dirty_dbs(response.db_ids, &response.num_ids); // we don't want to send ...
(session, (uint8_t *)&response, sizeof(response))
; } static void prv_blob_db_msg_decode_and_handle( CommSession *session, BlobDBCommand cmd, const uint8_t *data, size_t data_length) { switch (cmd) { case BLOB_DB_COMMAND_DIRTY_DBS: PBL_LOG(LOG_LEVEL_DEBUG, "Got DIRTY DBs"); prv_handle_get_dirty_databases(session, data, data_length); break;...
176, 120}, { -1296, 152, 112}, { -1120, 96, 104}, { -1056, -32, 104}, { -752, -400, 32}, { -952, -184, 0}, { -1152, 0, -136}, { -1216, 184, -240}, { -1344, 192, -216}, { -1488, -16, -40}, { -1584, 152, -176}, { -1440, 224, -136}, { -1288, 280, -24}, { -1240, 304, -32...
{ -2128, 200, 144}, { -1888, 96, 160}, { -1824, 184, 96}, { -1624, 120, 104}, { -1312, 136, 120}, { -1064, 120, 104}, { -904, -96, 80}, { -560, -216, -40}, { -856, 96, 144}, // 31 seconds { -736, 928, -104}, { -408, 1560, -216}, { -152, 1536, -200}, { 88, 1544, -1...
{ -1536, 88, -128}, { -1464, 104, -264}, { -1368, 392, -416}, { -1104, 440, 72}, { -904, 376, -144}, { -944, 384, -128}, { -968, 248, -16}, { -872, 304, 16}, { -992, 312, 0}, { -1192, 376, 72}, { -1240, 656, 120}, { -1240, 424, -136}, { -1024, 512, -104}, { -1408...
_should_notify_for_type(AlertPhoneCall)); // Should not allow invalid Notifications though cl_assert(!alerts_should_notify_for_type(AlertInvalid)); } void test_alerts__disabled(void) { cl_assert(alerts_get_mask() == AlertMaskAllOn); // Should not allow any notifications through alerts_set_mask(AlertMaskAll...
(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS)
CONDS_PER_MINUTE), now, HealthIterationDirectionPast, prv_activity_cb, NULL); cl_assert_equal_i(num_run_sessions + num_walk_sessions + num_open_sessions, s_prv_activity_cb__call_count); cl_assert_equal_b(s_prv_activity_cb__args[0].activity, HealthActivityRun);...
cl_assert(0 == prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 10}, &(ActivitySession) {.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}, HealthIterationDirectionPast)); // b ends later cl_assert(0 < prv_session_compare( &(ActivitySession)...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_push(0)
; prv_test_backing_data(0, 3); prv_test_backing_data(1, 0); prv_test_backing_data(2, 2); prv_push(1); prv_test_backing_data(0, 3); prv_test_backing_data(1, 0); prv_test_backing_data(2, 1); } void test_circular_cache__get(void) { prv_test_get_miss(0); prv_test_get_miss(1); prv_test_get_miss(2); p...
/* * 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...
(ctx, GCompOpTint)
; } else if (ctx->draw_state.compositing_mode == GCompOpAssign) { graphics_context_set_compositing_mode(ctx, GCompOpSet); } } graphics_draw_bitmap_in_rect(ctx, icon, icon_frame); } static void prv_menu_cell_basic_draw_custom_rect( GContext *ctx, const Layer *cell_layer, const MenuCellLayerConfig...
.type = PEBBLE_ACTIVITY_EVENT, .activity_event = { .type = PebbleActivityEvent_TrackingStarted, }, }; event_put(&event); } } // ------------------------------------------------------------------------------------------------ // Stop activity tracking system callback static void prv_stop...
{ return false; // Timed out }
const TickType_t k_timeout = configTICK_RATE_HZ; xSemaphoreTake(s_activity_state.bg_wait_semaphore, k_timeout); } return *cb_success; } // ------------------------------------------------------------------------------------------------ bool activity_init(void) { ACTIVITY_LOG_DEBUG("init"); s_activit...