prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
------------------------------------------------------------ // Count how many animations have been allocated static uint32_t prv_count_animations(void) { AnimationState *state = kernel_applib_get_animation_state(); return list_count(state->unscheduled_head) + list_count(state->scheduled_head); } // --------------...
memset(&layer, 0, sizeof(layer))
/* * 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...
(glance->service)
/* * 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...
passert_failed_no_message_with_lr(filename, line, lr)
; } void *os_malloc(size_t size) { return kernel_malloc(size); } void *os_malloc_check(size_t size) { return kernel_malloc_check(size); } void os_free(void *ptr) { kernel_free(ptr); }
oints_index = -1; } static void prv_enter_low_power(void *ignored) { #ifndef RECOVERY_FW watchface_start_low_power(); modal_manager_pop_all_below_priority(ModalPriorityAlarm); modal_manager_set_min_priority(ModalPriorityAlarm); // Override the vibe intensity to Medium in low-power mode vibes_set_default_vibe...
if (s_state != BatteryCharging) { enter_standby(RebootReasonCode_ShutdownMenuItem); } else { prv_transition(BatteryShutdownCharging, NULL); }
} void battery_ui_reset_fsm_for_tests(void) { s_state = BatteryGood; s_warning_points_index = -1; }
< prv_vibe_score_get_pattern_length(pattern_attribute); i++) { if (pattern_list[i] >= num_note_types) { return false; } } GenericAttribute *repeat_delay_attribute = generic_attribute_find_attribute(&score->attr_list, VibeAttributeId_RepeatDelay, score->att...
sys_vibe_pattern_enqueue_step_raw(note->vibe_duration_ms, note->strength)
; } if (note->brake_duration_ms > 0) { sys_vibe_pattern_enqueue_step_raw(note->brake_duration_ms, vibe_get_braking_strength()); } } sys_vibe_pattern_trigger_start(); } VibeScore *vibe_score_create_with_resource(uint32_t resource_id) { ResAppNum app_num = sys_get_current_resource_num(); return...
(s_app_data->timer[0], 100, stuck_timer_callback, cb_data, zero_flags); PBL_ASSERTN(success); } // ================================================================================= void invaid_timer_id_menu_cb(int index, void *ctx) { void *cb_data = 0; uint32_t zero_flags = 0; menu_callback_prefix(index, ctx)...
simple_menu_layer_get_layer(data->menu_layer)
); } // ================================================================================= // Deinitialize resources on window unload that were initialized on window load static void prv_window_unload(Window *window) { simple_menu_layer_destroy(s_app_data->menu_layer); } // ========================================...
ics/graphics_private_raw.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/window_private.h" #include "applib/ui/layer.h" #include "clar.h" #include "util.h" #include <stdio.h> // Helper Functions //////////////////////////////////// #include "test_graphics.h" #include "8bit/test_framebuffer.h" // ...
(ctx, bitmap_bounds)
; const GSize *bitmap_bounds_size = &bitmap_bounds->size; // Draw the left rectangle blue with 66% opacity // (will appear at the top because data rows are vertically flipped) const GRect left_rect = GRect(0, 0, bitmap_bounds_size->w * 2 / 5, bitmap_bounds_size->h); GColor left_rect_color = GColorBlue; l...
lude "applib/app_comm.h" #include "comm/ble/kernel_le_client/app_launch/app_launch.h" #include "comm/bt_lock.h" #include "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/comm_session/protocol.h" #include "services/common/comm_session/session_remote_version.h" #include "services/commo...
PBL_LOG(LOG_LEVEL_WARNING, "Already closed!")
; goto unlock; } session->transport_imp->reset(session->transport); } unlock: bt_unlock(); } // ------------------------------------------------------------------------------------------------- // Interfaces towards Transport (reading from the send buffer to actually transmit the data): // ----------...
w, WindowHandlerOffsetUnload); // Don't touch window after calling it's unload handler. We allow windows to free themselves on unload. } // TODO PBL-1769: deal with window unload. In app deinit? When low memory? void window_set_on_screen(Window *window, bool new_on_screen, bool call_window_appear_handlers) { PBL...
if (layer_is_status_bar_layer(layer)) { *((StatusBarLayer **)ctx) = (StatusBarLayer *)layer; return false; // prevent further iterating }
return true; } bool window_has_status_bar(Window *window) { if (!window) { return false; } if (!window->is_fullscreen) { return true; } StatusBarLayer *status_bar = NULL; layer_process_tree(&window->layer, &status_bar, prv_find_status_bar_layer); return status_bar && !layer_get_hidden(&statu...
jerry_size_t jerry_string_to_utf8_char_buffer(const jerry_value_t value, jerry_char_t *buffer_p, jerry_size_t buffer_size) { const jerry_size_t str_size = jerry_get_utf8_string_size(value); if (str_size == 0 || buffer_size ...
JERRY_CREATE_VALUE(NaN)
len, const Uuid *uuid) { // Firmware 2.x persist files are named "p%06d", the added "s" in the file // name prefix indicates that it is in SettingsFile format. int pid = persist_map_auto_id(uuid); if (FAILED(pid)) { // Attempting to debug persist map failure PBL_LOG(LOG_LEVEL_WARNING, "Failed to get pid...
{ prv_lock(); { PersistStore *store = prv_find_open_store(uuid); PBL_ASSERTN(store && list_contains(s_client_stores, &store->list_node) && store->usage_count >= 1); if (--store->usage_count == 0) { if (store->file_open) { settings_file_close(&store->file); ...
)(const jerry_value_t argv[], RockyArgTypeCheckError *type_error_out); uint8_t expected_num_args; } RockyArgAssignImp; static bool prv_check_value_number_within_bounds(RockyArgType type, const double *val, RockyArgValueCheckError *value_error_out) { const struct { ...
(argv[0], prv_malloc_and_assign_string_applier, binding)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gpio_use(GPIOB)
nds { 440, 480, -792}, { 416, 320, -712}, { 448, 376, -752}, { 512, 568, -984}, { 448, 352, -576}, { 400, 512, -768}, { 424, 216, -784}, { 520, 360, -720}, { 456, 280, -800}, { 424, 400, -768}, { 440, 432, -752}, { 480, 416, -800}, { 504, 376, -712}, { 472, 512, -...
{ 432, 520, -728}, { 440, 512, -664}, { 456, 496, -768}, { 448, 424, -792}, { 432, 320, -800}, { 424, 424, -824}, { 424, 360, -768}, { 424, 280, -712}, { 424, 280, -784}, { 448, 224, -808}, { 472, 312, -912}, // 180 seconds // elapsed: 3 minutes { 400, 336, -800},...
{ 440, 416, -776}, { 448, 392, -776}, { 424, 384, -784}, { 408, 408, -808}, { 408, 368, -768}, { 440, 440, -840}, { 472, 408, -672}, { 392, 448, -616}, { 416, 688, -736}, { 432, 616, -632}, { 480, 584, -584}, { 488, 552, -672}, { 416, 608, -760}, { 432, 528, -680...
(sizeof(key_irk_t))
; memcpy(&irk->key, info->irk.data, sizeof(irk->key)); dev->irk = irk; } } storage_release(); PBL_LOG(LOG_LEVEL_DEBUG, "Added pairing for "BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(info->identity.address)); } void bonding_sync_handle_hc_remove(const BleBonding *bonding) { cons...
/* * 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...
snprintf(dstbuf, 256, "Hello!\nI am error")
, 17); cl_assert_equal_s(dstbuf, "Hello!\nI am error"); snprintf(dstbuf, 256, "What is the %%d"); cl_assert_equal_s(dstbuf, "What is the %d"); snprintf(dstbuf, 256, "What is the %%d"); cl_assert_equal_s(dstbuf, "What is the %d"); } void test_sprintf__truncate(void) { char dstbuf[256]; memset(dstbuf, 0...
-136}, { 632, 112, -128}, { 560, 80, -72}, { 616, 72, -64}, { 720, 72, -112}, { 952, 80, -152}, { 856, 56, -152}, { 792, 16, -152}, { 1144, 88, -96}, { 1472, 168, 48}, { 1440, 224, 32}, { 1608, 320, -72}, { 1440, 328, -152}, { 888, 288, -192}, { 440, 160, -184}, ...
// 40 seconds { 704, 128, 32}, { 664, 32, 24}, { 688, 32, -32}, { 800, 120, -40}, { 928, 144, -48}, { 1056, 120, -136}, { 1128, 136, -104}, { 1208, 104, -104}, { 1232, 192, -80}, { 1104, 192, -112}, { 1168, 216, -136}, { 1288, 224, -96}, { 1088, 232, -144}, { ...
{ 1344, 224, -40}, { 1208, 240, -120}, { 864, 232, -232}, { 544, 176, -184}, { 448, 176, -168}, { 456, 192, -152}, { 608, 200, -168}, // 43 seconds { 880, 256, -192}, { 1160, 304, -280}, { 1112, 336, -288}, { 1144, 360, -248}, { 1288, 368, -216}, { 1128, 392, -18...
lues = ARRAY_LENGTH(values), .values = values, }, }; 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 { ProtobufLo...
prv_flush_get_record(&input, false /* use_data_logging */, session_ref)
; prv_assert_msg_equal(&input, msg); // ------------------ // Send another set of measurements uint32_t offset_sec_b[] = {2, 4, 6}; uint32_t values_b[] = {0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666}; input = (TestPLParsedMsg) { .type = ProtobufLogType_Measurements, .msrmt = { .time_utc ...
context, is_subsector, 0); if (remaining_ms) { // Start timer that will periodically check for the erase to complete new_timer_start(s_erase_poll_timer, remaining_ms, prv_flash_erase_timer_cb, NULL, 0); } } static void prv_blocking_erase_complete(void *context, status_t status) { PBL_ASSERT(PAS...
{ mutex_lock(s_flash_lock); flash_impl_erase_bulk_begin(); while (flash_impl_erase_is_in_progress()) { psleep(10); } mutex_unlock(s_flash_lock); }
#endif void flash_sleep_when_idle(bool enable) { // the S29VS flash automatically enters and exits standby } bool flash_get_sleep_when_idle(void) { return false; } bool flash_is_initialized(void) { return (s_flash_lock != NULL); } void flash_stop(void) { if (!flash_is_initialized()) { // Not yet initia...
/* * 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 true; }
bool bt_driver_stop_le_scan(void) { return true; }
/* * 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_source, cell_index->row)
; PBL_ASSERTN(node); launcher_menu_layer->app_to_launch_after_next_render = node->install_id; // Now kick off a render of the last frame of the menu layer; note that any menu layer scroll or // selection animation has already been advanced to completion by the menu layer before it called // this select click...
bi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw1_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 2 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFS...
(&ctx.dest_bitmap, "draw_rect_offset_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); #endif } #define BOX_SIZE 8 #define CLIP_RECT_DRAW_BOX GRect(10, 10, 140, 30) #define CLIP_RECT_CLIP_BOX GRect(10, 10, 120, 2*BOX_SIZE + 4) #define CLIP_RECT_RECT_BOX GRect(0, 0, BOX_SIZE, BOX_SIZE) #define CLIP_OFFSET 40 // yoffset if used to allow for multiple test cases to be drawn and tested on the same test ...
FILE("draw_horiz_dotted_line_even_offset_checkerboard_no_clip"))); // Clipping on even boundaries - no offset setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_EVEN, OFFSET_RECT_EVEN, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_CO...
(&ctx, fb, OFFSET_RECT_CLIP_EVEN, OFFSET_RECT_ODD, false, 1)
_100) }; GColor bg_color = (GColor){ .argb = (data->bg_color.argb | ALPHA_100) }; uint8_t alpha = data->alpha; if (alpha == ALPHA_100) { graphics_context_set_stroke_color(ctx, fg_color); graphics_draw_pixel(ctx, point); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y)); graphics_draw_pixel(c...
GRect(origin.x + 4*color_index_match - 1, origin.y - 1 + height_offset, COLOR_BAR_WIDTH + 2, COLOR_BAR_HEIGHT + 2)
lue); } else { bottom_margin.raw_value = bm_p0.y.raw_value; } } // Find edges for both caps prv_calc_cap_vert(&p0, radius, x, &top_margin, &bottom_margin); prv_calc_cap_vert(&p1, radius, x, &top_margin, &bottom_margin); // Finally draw line if (top_margin....
{ // Antialiased and Stroke Width > 1 graphics_line_draw_stroked_aa(ctx, p0, p1, ctx->draw_state.stroke_width); return; }
else { // Antialiased and Stroke Width == 1 (not suppported on 1-bit color) graphics_line_draw_1px_aa(ctx, p0, p1); return; } } #endif if (ctx->draw_state.stroke_width > 1) { // Non-Antialiased and Stroke Width > 1 graphics_line_draw_stroked_non_aa(ctx, p0, p1, ctx->draw_state.stroke_...
/* * 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_deallocate_headroom(ctx)
; prv_allocate_headroom_or_die(ctx); } } static void prv_collect_all_garbage(void) { ecma_free_unused_memory(JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH, 0, true); jmem_pools_collect_empty(); } static void prv_memorypressure_app_log(const char *level, const jmem_heap_stats_t *stats) { APP_LOG(LOG_LEVEL_WARNING,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_WARNING, "Discovery service_changed_handle but no device connected?")
; return; } bt_driver_cb_gatt_client_discovery_handle_service_changed(connection, payload->handle); } void hc_endpoint_discovery_handler(const HcProtocolMessage *msg) { bt_lock(); { switch (msg->command_id) { case HcMessageID_Discovery_Service_Found: prv_handle_new_service_found((HcProto...
d test_timeline__all_backwards(void) { Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // Note: 1421188000 == Tue Jan 13 14:26:40 PST 2015 // check first timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast, 1...
(&state.pin.header.id, &s_long_items[2].header.id)
); #endif cl_assert(!iter_prev(&iterator)); } void test_timeline__long_middle_future(void) { prv_insert_long_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; // initialize it to be 11 min after item cc has started timeline_init(&head); cl_assert_equal_i(time...
/* * 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...
FLASH_Lock()
; return false; } if (progress_callback) { progress_callback(sector - first_sector + 1, count, progress_context); } } FLASH_Lock(); return true; } bool system_flash_write(uint32_t address, const void *data, size_t length) { // enable programming of flash FLASH_Unlock(); // clear err...
ude "util/dict.h" #define LAUNCHER_MESSAGE_ENDPOINT_ID (0x31) typedef enum { //! Used as reply from the watch to the phone, to indicate the app is not running. //! Or, when pushed from phone to watch, this value will have the effect of killing the app. NOT_RUNNING_DEPRECATED = 0x00, //! Used as reply from th...
{ return; }
AppMessageHeader *message = (AppMessageHeader *) data; bool ack = false; switch (message->command) { case CMD_PUSH: { // Incoming message: ack = prv_receive_push_cmd(session, (AppMessagePush *) message, length); break; } case CMD_ACK: case CMD_NACK: // Ignore ACK / NACKs...
viceTimeScopeOnce); cl_assert_equal_i(123, result); // The function call is the equivalent to `peek_value` with HeartRateBPM except for the // time stamps, make sure it returns 0 because we haven't filled in that data) result = health_service_aggregate_averaged(HealthMetricHeartRateBPM, ...
// Store if this is yesterday if (i == 1) { yesterday_stats = (HealthServiceStats) { .max = value, .min = value, .avg = value, .sum = value, .count = 1, }; } // Update stats if (day_in_week == yesterday_day_in_week) { prv_update_stats(&weekl...
scope_str = "weekday/weekend"; break; case HealthServiceTimeScopeDaily: stats = &daily_stats; scope_str = "daily"; break; } HealthValue exp_value = 0; char *agg_str; switch (agg) { case HealthAggregationSum: exp_value ...
/* * 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_INVALID_OPERATION; }
status_t app_cache_add_entry(AppInstallId app_id, uint32_t total_size) { return E_INVALID_OPERATION; } status_t app_cache_remove_entry(AppInstallId id) { return E_INVALID_OPERATION; } status_t app_db_insert(const uint8_t *key, int key_len, const uint8_t *val, int val_len) { return E_INVALID_OPERATION; } stat...
_reset_and_flush(); } // ----------------------------------------------------------------------------- // Is Alive Logic #define ANCS_INVALID_PARAM 0xA2 #define ANCS_IS_ALIVE_NEXT_CHECK_TIME_MINUTES 60 // 1 hour (60 minutes) #define ANCS_IS_ALIVE_RESPONSE_WAIT_TIME_SECONDS 5 // 5 seconds static void prv_is_ancs_ali...
(&s_notification_connection_delay_timer)
) { regular_timer_remove_callback(&s_notification_connection_delay_timer); } s_just_connected = true; const int post_connection_notification_ignore_seconds = 10; s_notification_connection_delay_timer = (const RegularTimerInfo) { .cb = prv_set_no_longer_just_connected, }; regular_timer_add_multiseco...
e_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 minutes ago", time_buf); // June 9th 2015, 15:00:00 (T-01:00:00) rtc_set_time(event_time - (1 * SECONDS_PER_HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("In 1 hour", time_buf); // June ...
(event_time - (2 * SECONDS_PER_MINUTE))
; clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("In 2 minutes", time_buf); // June 10th 2015, 04:00:00 (T+12:00:00) rtc_set_time(event_time + (12 * SECONDS_PER_HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_asse...
0xff. 0xff is used as an invalid //! value (as the spi flash sets bytes to 0xff when they're erased) typedef struct PACKED { bool invalid:1; //!< Whether or not this chunk is formatted bool valid:1; //!< Set to 0 when the chunk is stale. //! The ID of the current chunk. Each chunk in the gets an auto-incrementin...
for (int i = 1; i < NUM_CHUNKS; ++i) { uint8_t zero = 0; flash_write_bytes(&zero, get_current_address(i, 0), sizeof(zero)); }
s_enabled = true; } // Dumping commands /////////////////////////////////////////////////////////////////////////////// static bool dump_chunk(int generation, int chunk_index, DumpLineCallback cb) { int offset = sizeof(LogChunkHeader); uint8_t* read_buffer = kernel_malloc(256); bool error = false; while ...
/* * 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...
("This app requires Pebble Health to work. Enable Health in the Pebble" " mobile app to continue.")
= prv_draw_noop, .draw = prv_draw_text_node_text, }; static const GTextNodeBaseImpl s_text_dynamic_impl = { .destructor = prv_destroy_text_node_base, .will_draw = prv_draw_noop, .did_draw = prv_draw_noop, .draw = prv_draw_text_node_text_dynamic, }; static const GTextNodeBaseImpl s_custom_impl = { .destru...
(&ctx->gcontext->draw_state.clip_box, &draw_box)
; } } static void prv_iter_did_draw(GTextNodeDrawContext *ctx, GTextNodeDrawContext *parent_ctx) { GTextNode *node = ctx->node; prv_base(node)->did_draw(ctx); if (!ctx->cached) { if (node->clip) { ctx->gcontext->draw_state.clip_box = ctx->cached_clip_box; } gsize_add_eq(ctx->size_out, node->...
ES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "mfg_btle_app.h" #include "applib/app.h" #include "applib/ui/ui.h" #include "applib/ui/option_menu_window.h" #include "bluetooth/bt_test.h" #in...
(LOG_LEVEL_DEBUG, "Step %d complete", data->current_test_step)
{ 664, 200, -16}, { 584, 320, -24}, { 648, 288, 64}, { 1016, 296, 128}, { 1312, 424, 176}, { 1376, 544, 320}, { 1288, 840, 496}, { 1224, 848, 608}, { 1104, 584, 272}, { 664, 672, 360}, { 784, 512, 384}, { 856, 408, 424}, { 816, 368, 280}, { 656, 376, 144}, { 6...
{ 1528, 1184, 376}, { 1704, 1008, 552}, { 2112, 1000, 240}, { 2656, 1320, 408}, { 2056, 1208, 784}, // 343 seconds { 1304, 784, 480}, { 1272, 392, 248}, { 1408, 608, 344}, { 1200, 896, 656}, { 832, 704, 624}, { 496, 1072, 624}, { 536, 936, 768}, { 824, 976, 576},...
prv_lock(); s_has_sent_byte = true; s_did_send_byte = true; PBL_ASSERTN(!s_input_enabled); while (!(uart_is_tx_ready(ACCESSORY_UART))) continue; // this section needs to be atomic since the UART IRQ also modifies these variables portENTER_CRITICAL(); if (s_send_history.has_data) { // The send buffer i...
prv_enable_dma()
; } else { prv_disable_dma(); } prv_unlock(); } bool accessory_bus_contention_detected(void) { return s_bus_contention_detected; } static uint32_t prv_get_baudrate(AccessoryBaud baud_select) { const uint32_t BAUDS[] = { 9600, 14400, 19200, 28800, 38400, 57600, 62500, 115200, 125000, 230400, ...
graphics/gdraw_command_private.h" #include "applib/ui/kino/kino_reel.h" #include "kernel/pbl_malloc.h" #include "process_management/app_install_manager.h" #include "resource/resource_ids.auto.h" #include "system/logging.h" #include "syscall/syscall.h" #include "syscall/syscall_internal.h" #include "system/passert.h" #i...
prv_get_app_resource_id(res_app_num, timeline_id, size)
; if (res_id != RESOURCE_ID_INVALID) { const AppResourceInfo res_info = (AppResourceInfo) { .res_app_num = res_app_num, .res_id = res_id, }; if (prv_is_app_published_resource_valid(&res_info)) { if (res_info_out) { *res_info_out = res_info; } retur...
lse { const size_t resource_size = kino_reel_get_data_size(reel); if (resource_size == 0) { APP_LOG(APP_LOG_LEVEL_ERROR, "Cannot determine size for published icon"); is_valid = false; } else if (resource_size > RESOURCE_MAX_SIZE) { APP_LOG(APP_LOG_LEVEL_ERROR, "Published icon size %zuB > ...
{ goto fail; }
// Only try to load icon if app was built with an SDK that supports it const Version first_pbw_icon_version = (Version) { .major = TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MAJOR, .minor = TIMELINE_RESOURCE_PBW_SUPPORT_FIRST_SDK_VERSION_MINOR, }; if (version_compare(entry.sdk_version...
value_length_in_out)); syscall_assert_userspace_buffer(value_out, *value_length_in_out); syscall_assert_userspace_buffer(has_more_out, sizeof(*has_more_out)); } return gatt_client_subscriptions_consume_notification(object_ref_out, value_out, value_len...
syscall_assert_userspace_buffer(uuid, sizeof(*uuid))
; } *uuid = gatt_client_characteristic_get_uuid(characteristic); } DEFINE_SYSCALL(BLEAttributeProperty, sys_ble_characteristic_get_properties, BLECharacteristic characteristic) { return gatt_client_characteristic_get_properties(characteristic); } DEFINE_SYSCALL(BLEService, s...
_task_cb(void *unused) { PutBytesPendingJobs *put_jobs = &s_pb_state.pb_pending_jobs; prv_lock_pb_job_state(); uint8_t num_put_jobs = put_jobs->num_ops_pending; uint8_t read_idx = put_jobs->read_idx; uint32_t initial_remaining_bytes = s_pb_state.remaining_bytes; prv_unlock_pb_job_state(); if (num_put_job...
{ PBL_LOG(LOG_LEVEL_ERROR, "Failed to acquire the put-bytes semaphore"); return; }
if (s_pb_state.current_command == PutBytesIdle) { PBL_LOG(LOG_LEVEL_DEBUG, "Attempted to cancel put_bytes while idle, %d", s_pb_state.current_command); } else if (s_pb_state.type == ObjectWatchApp || s_pb_state.type == ObjectAppResources || s_pb_state.type == ObjectWatchW...
/* * 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...
(f->dirty_lines, 0xff, DISP_ROWS / 8)
; f->is_dirty = true; f->is_cleared = false; } void framebuffer_clear_line(FrameBuffer* f, uint8_t y) { uint32_t* line = framebuffer_get_line(f, y); memset(line, 0xffffffff, FRAMEBUFFER_SIZE_BYTES); bitset8_set(f->dirty_lines, y); f->is_dirty = true; } void framebuffer_mark_dirty_rect(FrameBuffer* f, GRe...
the specific language governing permissions and * limitations under the License. */ // Need to use the real struct because the product code accesses the structure directly. It would // be nice to instead create a dummy with only the fields we need, but oh well. #include "applib/ui/animation_private.h" #include <st...
if (!animation) { return false; }
ine LABEL_HEIGHT 27 #define GRAPH_HEIGHT (LABEL_OFFSET_Y - GRAPH_OFFSET_Y) #define AVG_LINE_HEIGHT 4 #define AVG_LINE_LEGEND_WIDTH 10 #define AVG_LINE_COLOR GColorYellow #define INFO_PADDING_BOTTOM 6 //! Get the current day in the standard tm format. Sunday is 0 static uint8_t prv_get_weekday(time_t timestamp) { ...
graphics_context_set_fill_color(ctx, bar_color)
; graphics_fill_rect(ctx, &thin_box); } static int16_t prv_draw_day_bar(GContext *ctx, int weekday, const GRect *box, GColor bar_color, bool wide_bar) { const int bar_inset = 3; GRect box_inset = grect_inset(*box, GEdgeInsets(bar_inset, bar_inset, 0, bar_inset)); if (wide_bar) {...
/* * 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->text_layer_1, GColorYellow)
; text_layer_set_font(&data->text_layer_1, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_text_alignment(&data->text_layer_1, GTextAlignmentCenter); // Add first text layer to scroll layer (required to get correct content size based on location) const int inset = 8; const int padding = 4; ...
/ Get some new data but out stats shouldn't change (except HR) prv_inc_time(10); prv_inc_steps_and_put_event(10); prv_put_bpm_event(110, HRMQuality_Good); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); ...
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone))
; cl_assert_equal_i(bpm, 100); // Put an OffWrist reading. Verify we received it. prv_put_bpm_event(50, HRMQuality_OffWrist); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 0); ...
state(1) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(has_next); cl_assert_equal_i(new_idx, 4); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_mod...
timeline_model_get_iter_state(0)
->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(2)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_mo...
should_vibrate_for_type(AlertReminder)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertReminder)); cl_assert(alerts_should_notify_for_type(AlertOther)); cl_assert(!alerts_should_vibrate_...
(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS)
; cl_assert(alerts_should_enable_backlight_for_type(AlertReminder)); cl_assert(alerts_should_notify_for_type(AlertOther)); cl_assert(alerts_should_vibrate_for_type(AlertOther)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(alerts...
ng, 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. */ #include "test_alarm_common.h" // Fakes #include "f...
cl_assert_equal_i(s_num_timeline_adds, 3)
; cl_assert_equal_i(s_num_timeline_removes, 0); s_sleep_state = ActivitySleepStateLightSleep; s_last_vmc = 1; prv_set_time(s_current_day, 10, 0); cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_equal_i(s_last_timeline_item_added->...
imer_id); } void enter_standby(RebootReasonCode reason) { s_entered_standby = true; } void event_put(PebbleEvent* event) { s_last_event_put = *event; if (event->type == PEBBLE_BATTERY_STATE_CHANGE_EVENT) { battery_monitor_handle_state_change_event(event->battery_state.new_state); } else if (event->type =...
fake_battery_set_charging(true)
; fake_battery_set_millivolts(charge_mv); fake_battery_set_connected(true); cl_assert_equal_i(battery_get_charge_state().charge_percent, percent); fake_battery_set_charging(false); fake_battery_set_millivolts(discharge_mv); fake_battery_set_connected(false); cl_assert_equal_i(battery_get_charge_state().c...
RIVILEGE_WAS_ELEVATED) { // Check that data is in app space: syscall_assert_userspace_buffer(data, length); } const AppOutboxSenderDef *def = prv_find_def_and_tag_by_handler(sent_handler, NULL); if (!def) { PBL_LOG(LOG_LEVEL_ERROR, "AppOutbox sent_handler not allowed <%p>", sent_handler); syscall...
prv_unlock()
b; if (!prv_read_register(PmicRegisters_STATUSA, &status_a) || !prv_read_register(PmicRegisters_STATUSB, &status_b)) { PBL_LOG(LOG_LEVEL_WARNING, "Failed to read status registers"); return; } PBL_LOG(LOG_LEVEL_INFO, "%s: StatusA = 0x%"PRIx8"; StatusB = 0x%"PRIx8, preamble, status_a, status_b...
prv_update_rail_state(PmicRail_LDO3, enabled)
; i2c_release(I2C_MAX14690); } void set_4V5_power_state(bool enabled) { gpio_output_set(&BOARD_CONFIG_POWER.rail_4V5_ctrl, enabled); } void set_6V6_power_state(bool enabled) { PBL_ASSERTN(BOARD_CONFIG_POWER.rail_6V6_ctrl.gpio); gpio_output_set(&BOARD_CONFIG_POWER.rail_6V6_ctrl, enabled); }
, 16}, // 101 seconds { 1112, -32, 24}, { 1544, -144, 304}, { 1488, 208, 136}, { 1272, 384, -96}, { 968, 240, -16}, { 736, 56, 168}, { 768, 96, 160}, { 784, 176, 152}, { 824, 288, 120}, { 792, 312, 160}, { 832, 448, 40}, { 896, 336, 40}, { 1168, 400, -48}, { 1...
{ 832, -16, 152}, { 856, 8, 168}, { 840, -48, 184}, { 936, -104, 184}, { 960, -232, 136}, { 888, -208, -32}, { 1344, -152, -136}, { 1272, -120, 0}, { 1424, 32, 0}, { 1648, 296, -176}, { 1344, 464, 48}, { 936, 272, 256}, { 904, 360, 256}, { 904, 304, 304}, { 83...
// ---------------------------------------------------------------- // Sample captured: 2015-09-29 15:20:14 local AccelRawData *activity_sample_walk_200_pbl_25299_8(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_200_pbl_25299_8 //> TEST_EXPECTED 200 //> T...
/* * 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...
iter_next(&utf8_iter)
); cl_assert(!iter_next(&utf8_iter)); } void test_utf8_iterator__decode_valid_string(void) { // Mutable types Iterator utf8_iter; Utf8IterState utf8_iter_state; // Immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, s_valid_test_string); cl_assert(success); ...
32List, } AttributeType; static AttributeType prv_attribute_type(AttributeId id) { switch (id) { case AttributeIdTitle: case AttributeIdSubtitle: case AttributeIdBody: case AttributeIdShortTitle: case AttributeIdShortSubtitle: case AttributeIdLocationName: case AttributeIdSender: case...
(*buffer <= buf_end)
; memcpy(notif_attr->string_list->data, *cursor, data_length - 1); notif_attr->string_list->data[data_length - 1] = '\0'; break; } case AttributeTypeUint32List: { notif_attr->uint32_list = (Uint32List *)*buffer; *buffer += attribute->length; PBL_ASSERTN(*buffer <= buf_end); ...
EBBLE_PHONE_EVENT, .phone = { .type = PhoneEventType_Outgoing, .source = PhoneCallSource_ANCS_Legacy, .call_identifier = call_identifier, .caller = phone_call_util_create_caller(caller_id, NULL), } }; event_put(&event); } /////////////////////////////////////////////////// // Publi...
{ iter_init(iter, prv_iter_dummy, prv_iter_dummy, iter_state); return S_NO_MORE_ITEMS; }
status_t rv = pin_db_get(&node->id, &iter_state->pin); if (rv != S_SUCCESS) { iter_state->pin = (TimelineItem){}; iter_init(iter, prv_iter_dummy, prv_iter_dummy, iter_state); return rv; } iter_state->node = node; iter_state->current_day = time_util_get_midnight_of(node->timestamp); iter_state...
nsed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under t...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_x_origin_layer_non_aa.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 10); graphics_line_draw_precise_stroked_non_aa(&ctx, START_ON_ORIGIN_RECT_NXNY, END_ON_ORIGIN_RECT_NXNY, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_origin_layer_non_aa.${BIT_DEPTH_NAME}.pbi"));...
o); clock_init(); clock_set_time(jan1st_noon_2005); cl_assert_equal_i(rtc_get_time(), jan1st_noon_2005); time_t t = rtc_get_time(); struct tm now; localtime_r(&t, &now); time_t timestamp = clock_to_timestamp(TODAY, now.tm_hour, now.tm_min + 1); cl_assert_equal_i(timestamp, t + 60); }...
(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("Wed, 2:00 PM", time_buf); // June 10th 2015, 00:00:00 (T-14:00:00) rtc_set_time(event_time - (14 * SECONDS_PER_HOUR)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s(" 2:00 PM", time_buf); // June 10th 2015, 00:00:01 (T-1...
MenuIndexEnabledCount : TimelinePeekMenuIndexDisabledCount; } static void prv_draw_row_cb(SettingsCallbacks *context, GContext *ctx, const Layer *cell_layer, uint16_t row, bool selected) { SettingsTimelinePeekData *data = (SettingsTimelinePeekD...
prv_create_settings_window()
PI, RCC_AHB3Periph_QSPI); } static void prv_set_num_data_bytes(uint32_t length) { // From the docs: QSPI_DataLength: Number of data to be retrieved, value+1. // so 0 is 1 byte, so we substract 1 from the length. -1 is read the entire flash length. QSPI_SetDataLength(length - 1); } static void prv_wait_for_qspi_...
(&qspi_config)
; QSPI_Cmd(ENABLE); // Must call quad_enable first, all commands are QSPI prv_quad_enable(); // Reset the flash to stop any program's or erase in progress from before reboot prv_flash_reset(); prv_disable_qspi_clock(); } bool flash_sanity_check(void) { prv_enable_qspi_clock(); bool result = prv_fl...
on_bar_set_highlighted(action_bar, index, is_highlighted); } static void action_bar_raw_up_handler(ClickRecognizerRef recognizer, void *context) { ActionBarLayer *action_bar = (ActionBarLayer *)context; action_bar_raw_up_down_handler(recognizer, action_bar, false); } static void action_bar_raw_down_handler(ClickR...
{ if (gcolor_equal(background_color, action_bar->background_color)) { return; } action_bar->background_color = background_color; layer_mark_dirty(&(action_bar->layer)); }
/* * 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...
dict_calc_buffer_size(0)
; cl_assert(size == sizeof(Dictionary)); size = dict_calc_buffer_size(1, 1); cl_assert(size == sizeof(Dictionary) + sizeof(Tuple) + 1); size = dict_calc_buffer_size(3, 10, 100, 1000); cl_assert(size == sizeof(Dictionary) + (3 * sizeof(Tuple)) + 10 + 100 + 1000); } struct SerializeTestResult { bool okay; ...
d. * See the License for the specific language governing permissions and * limitations under the License. */ #include "gtypes.h" #include "gcontext.h" #include "process_management/process_manager.h" #include "process_state/app_state/app_state.h" #include "system/passert.h" #include "util/math.h" #include <stddef....
if (rect_to_clip->origin.y < rect_clipper->origin.y) { overflow = rect_clipper->origin.y - rect_to_clip->origin.y; if (overflow > rect_to_clip->size.h) { rect_to_clip->size.h = 0; } else { rect_to_clip->size.h -= overflow; } rect_to_clip->origin.y = rect_clipper->origin.y; } else if (r...
overflow = rect_to_clip->origin.y + rect_to_clip->size.h - (rect_clipper->origin.y + rect_clipper->size.h); if (overflow > 0) { rect_to_clip->size.h -= overflow; } } GRect grect_union(const GRect *r1, const GRect *r2) { GRect s_r1 = *r1; GRect s_r2 = *r2; grect_standardize(&s_r1); grect_standardize(...
/* * 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...
(!gsize_equal(&f->size, &GSizeZero))
; memset(f->buffer, 0xff, framebuffer_get_size_bytes(f)); framebuffer_dirty_all(f); } void framebuffer_mark_dirty_rect(FrameBuffer *f, GRect rect) { PBL_ASSERTN(!gsize_equal(&f->size, &GSizeZero)); if (!f->is_dirty) { f->dirty_rect = rect; } else { f->dirty_rect = grect_union(&f->dirty_rect, &rect); ...
328, 168}, { 904, -312, 144}, { 936, -344, 136}, { 952, -336, 96}, { 1008, -296, 72}, { 1040, -296, 72}, { 1056, -272, 32}, // 56 seconds { 1080, -216, -8}, { 1144, -200, -56}, { 1168, -176, -48}, { 1176, -144, -32}, { 1192, -144, 32}, { 1640, -128, -24}, { 1432, ...
{ 1432, -192, -240}, { 1336, -160, -408}, { 896, -160, -432}, { 696, -168, -320}, { 1072, -104, -240}, { 984, -144, -216}, { 960, -96, -184}, { 840, -96, -256}, { 792, -16, -336}, { 768, -80, -344}, { 784, -112, -336}, { 744, -120, -384}, { 760, -72, -432}, { 760,...
{ 976, -72, -280}, { 1016, -64, -264}, // 64 seconds { 1040, -48, -224}, { 1184, -16, -192}, { 1568, -16, -232}, { 1384, -40, -256}, { 904, -64, -280}, { 648, -32, -272}, { 944, -24, -280}, { 1112, -48, -216}, { 1104, -96, -160}, { 992, -112, -144}, { 920, -32, -...
ed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the...
{ if (uuid_equal(&uuid_list[i], find_me)) { return i; } }
return -1; } // if an entry appears in the UUID list, place it's install_id in the correct index of // storage->id_list bool prv_enumerate_apps(AppInstallEntry *entry, void *data) { UuidTranslateData *my_data = (UuidTranslateData *) data; int idx = prv_uuid_search(&entry->uuid, my_data->uuid_list, my_data->co...
/* * 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 (progress_callback) { progress_callback(sector - first_sector + 1, count, progress_context); }
} FLASH_Lock(); return true; } bool system_flash_write(uint32_t address, const void *data, size_t length) { // enable programming of flash FLASH_Unlock(); // clear errors FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLA...
} if (ble_service_handle_event(hdr)) { goto handled; } switch (hdr->evt_code) { // GAP Events: case BLE_EVT_GAP_CONNECTED: handle_evt_gap_connected((ble_evt_gap_connected_t *) hdr); break; case BLE_EVT_GAP_DISCONNECTED: prv_handle_e...
OS_GET_CURRENT_TASK()
cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */)); cl_assert(reminder_db_get_len((uint8_t *) &item4, sizeof(Uuid)) == 0); memset(&temp, 0, sizeof(TimelineItem)); cl_assert(S_SUCCESS == reminder_db_next_item_header(&temp)); temp.attr_list.attributes = NULL; cl...
((uint8_t *)&item1.header.id, sizeof(TimelineItemId), (uint8_t *)&item1, sizeof(TimelineItem))
; reminder_db_insert((uint8_t *)&item2.header.id, sizeof(TimelineItemId), (uint8_t *)&item2, sizeof(TimelineItem)); reminder_db_insert((uint8_t *)&item3.header.id, sizeof(TimelineItemId), (uint8_t *)&item3, sizeof(TimelineItem)); reminder_db_insert((uint8_t *)&item4.heade...
/* * 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 (!timer) { return TASK_TIMER_INVALID_ID; }
// Grab lock on timer structures, create a unique ID for this timer and put it into our idle // timers list mutex_lock(manager->mutex); *timer = (TaskTimer) { .id = manager->next_id++, }; // We don't expect to wrap around, this would take over 100 years if we allocated a timer every // second PBL...
/* * 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, GColorBlack)
; graphics_fill_rect(ctx, &GRect(0, time_max_y + line_top_margin, DISP_COLS, line_stroke_width)); #endif } static void prv_update_time(SdkAppData *data) { #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_buf...
ETRIC_NOTIFICATION_ANCS_PARSE_ERROR_COUNT, AnalyticsClient_System); prv_reset_and_next(); } static void prv_reset_due_to_bt_error(void) { prv_reset_and_flush(); } // ----------------------------------------------------------------------------- // Is Alive Logic #define ANCS_INVALID_PARAM 0xA2 #de...
regular_timer_remove_callback(&s_notification_connection_delay_timer)
; } static void prv_start_temp_notification_connection_delay_timer(void) { if (regular_timer_is_scheduled(&s_notification_connection_delay_timer)) { regular_timer_remove_callback(&s_notification_connection_delay_timer); } s_just_connected = true; const int post_connection_notification_ignore_seconds = 10;...
1675, 0x0}, { 0, 0x62, 1468, 0x0}, { 0, 0x62, 2148, 0x0}, { 0, 0x63, 1453, 0x0}, { 0, 0x63, 1408, 0x0}, { 0, 0x63, 670, 0x0}, { 0, 0x63, 538, 0x0}, // 1230: Local time: 09:06:00 AM { 0, 0x53, 1256, 0x0}, { 0, 0x44, 645, 0x0}, { 0, 0x64, 747, 0x0}, { 0, 0x63, 902, 0x0}, { ...
ARRAY_LENGTH(samples)
; return samples; }
prv_create_test_animation(); animation_set_duration(c, duration_c); Animation *d = prv_create_test_animation(); animation_set_duration(d, duration_d); Animation *seq = animation_sequence_create(inner_seq, c, d, NULL); animation_set_handlers(seq, handlers, seq); // Play it prv_clear_handler_histories(...
(start_ms + duration_a + duration_b + 5 * MIN_FRAME_INTERVAL_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_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0)...
GBitmap *src_bitmap, GRect dest_rect, GPoint src_origin_offset, GCompOp compositing_mode, GColor8 tint_color) { const ...
for (int16_t dest_y = dest_begin_y; dest_y < dest_end_y; ++dest_y, ++src_y) { // Wrap-around source bitmap vertically if (src_y >= src_end_y) { src_y = src_begin_y; } const GBitmapDataRowInfo dest_row_info = gbitmap_get_data_row_info(dest_bitmap, dest_y); uint8_t *dest...
grect_get_max_x(&src_bitmap->bounds) - 1)) { // keep correct bounds alignment for circular when tiling src_x = src_bitmap->bounds.origin.x + (((src_x - src_bitmap->bounds.origin.x)) % src_bitmap->bounds.size.w); } else { // I...
the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the speci...
cl_assert_passert(prv_register())
; } void test_app_outbox__send_not_user_space_buffer(void) { // TODO: really implement privilege escalation in unit tests. See PBL-9688 return; cl_assert_passert(app_outbox_send(NULL, s_test_data_length, test_app_outbox_sent_handler, s_expected_cb_ctx)); assert_syscall_faile...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_handle_query_region(command, length)
TN(task < NumPebbleTask); vTaskSuspend(g_task_handles[task]); } void analytics_external_collect_stack_free(void) { analytics_set(ANALYTICS_DEVICE_METRIC_STACK_FREE_KERNEL_MAIN, prv_task_get_stack_free(PebbleTask_KernelMain), AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_STACK_FREE_KERNEL_BAC...
{ *handle = new_handle; }
prv_task_register(pebble_task, new_handle); } void pebble_task_configure_idle_task(void) { // We don't have the opportunity to configure the IDLE task before FreeRTOS // creates it, so we have to configure the MPU regions properly after the // fact. This is only an issue on platforms with a cache, as altering...
larm->id < MAX_CONFIGURED_ALARMS, "Invalid id %d", alarm->id); AlarmStorageKey key = { .id = alarm->id, .type = ALARM_DATA_CONFIG }; AlarmConfig config = { .kind = alarm->config.kind, .is_disabled = alarm->config.is_disabled, .hour = alarm->config.hour, .minute = alarm->config.minute, .is_smart...
(minute < 60 && minute >= 0, "Invalid minute value, %d", minute)
; } // ---------------------------------------------------------------------------------------------- static void prv_enable_alarm_config(AlarmConfig *config, bool enable) { config->is_disabled = !enable; if (enable && config->kind == ALARM_KIND_JUST_ONCE) { // Update the day required for the alarm prv_set...
PersistBondingType type:8; union PACKED { BtPersistBondingBTClassicData bt_classic_data; BtPersistBondingBLEData ble_data; }; } BtPersistBondingData; /////////////////////////////////////////////////////////////////////////////////////////////////// //! Settings File #define BT_PERSISTENT_STORAGE_FILE_NA...
(&fd, key, key_len)
; // If a big enough buffer wasn't passed in, then the data can't be read. if (data_len > buf_len || settings_file_get(&fd, key, key_len, data_out, buf_len) != S_SUCCESS) { data_len = 0; } settings_file_close(&fd); } cleanup: prv_unlock(); return data_len; } //! @return the value t...
t.bytes_receivable_count); prv_unlock(); } static void prv_handle_receiving_footer_complete_isr(bool *should_context_switch) { // Check the received CRC uint32_t crc = crc32(CRC32_INIT, s_spi_transport.rx_write_ptr, s_spi_transport.bytes_receivable_count); if (crc != s_spi_transport.rx_f...
circular_buffer_read(&s_spi_transport.tx, s_spi_transport.tx.data_length, &s_spi_transport.tx_read_ptr, &s_spi_transport.status_local->bytes_sendable_count)
OUTBOX_RESET_COMPLETE_PENDING(); cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetCompleteRemoteInitiated); } void test_rocky_api_app_message__awaiting_reset_request__receive_chunk(void) { prv_init_api(false /* start_connected */); prv_simulate_transport_conn...
EXPECT_OUTBOX_NO_MESSAGE_PENDING()
ep_str[step_buf_size]; snprintf(step_str, step_buf_size, "%d", session->step_data.steps); string_list_add_string(headings, headings_buf_size, i18n_get("Steps", headings), headings_buf_size); string_list_add_string(values, values_buf_size, step_str, values_buf_size); } static void prv_ad...
(headings, headings_buf_size, values, values_buf_size, session)
; prv_add_avg_pace_metric_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_distance_metric_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_active_calories_metric_info(headings, headings_buf_size, values, values_...
s_graphics_draw_text.last_call.draw_text.box); EXECUTE_SCRIPT("ctx.fillText('some text', -0.2, 1.2, 10.5);"); cl_assert_equal_rect((GRect(0, 1, 11, large_int)), s_graphics_draw_text.last_call.draw_text.box); EXECUTE_SCRIPT("ctx.fillText('some text', -0.5, 1.2, -0.5);"); cl_assert_equ...
(FONT_KEY_GOTHIC_14_BOLD, s_fonts_get_system_font.last_call.font_key)
int32_t angle) { return gpoint_from_polar_precise(center, distance << GPOINT_PRECISE_PRECISION, angle); } static void prv_graphics_draw_centered_text(GContext *ctx, const GSize *max_size, const GPoint *center, const GFont font, ...
grect_align(&bob_center_rect, bounds, GAlignCenter, false /* clips */)
; graphics_context_set_fill_color(ctx, face->bob_color); graphics_fill_oval(ctx, bob_rect, GOvalScaleModeFitCircle); graphics_context_set_fill_color(ctx, face->bob_center_color); graphics_fill_oval(ctx, bob_center_rect, GOvalScaleModeFitCircle); } static void prv_draw_non_local_clock(GContext *ctx, NonLocalClo...
/* * 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...
{ normalized = CLIP(normalized - delay, 0, ANIMATION_NORMALIZED_MAX); normalized = animation_timing_curve(normalized, AnimationCurveEaseInOut); GPoint result; result.x = interpolate_int16(normalized, from.x, to.x); result.y = interpolate_int16(normalized, from.y, to.y); return result; }
//! Returns a new point halfway between two provided points static GPoint prv_gpoint_mid(const GPoint a, const GPoint b) { return GPoint((a.x + b.x) / 2, (a.y + b.y) / 2); } //! Draw the "collapse" portion of the animation. This function can either work by drawing //! an outer ring using the fill_cb, or by drawing...
_b.parent == &parent); cl_assert(child_b.next_sibling == &child_a); cl_assert(child_a.next_sibling == NULL); // Insert child_c above child_b (next_sibling code path): // // +-parent // | // '->child_b->child_c->child_a // layer_insert_above_sibling(&child_c, &child_b); cl_assert(parent.firs...
(!layer_is_descendant(&child_b, &parent))
; layer_add_child(&parent, &child_b); cl_assert(layer_is_descendant(&child_b, &parent)); cl_assert(!layer_is_descendant(&child_b, &child_a)); cl_assert(!layer_is_descendant(&child_c, &child_a)); layer_add_child(&child_a, &child_c); cl_assert(layer_is_descendant(&child_c, &child_a)); cl_assert(layer_is_d...
ommand_list, 0); *command = (GDrawCommand) { .type = GDrawCommandTypePath, .hidden = false, .stroke_color = GColorRed, .stroke_width = 1, .fill_color = GColorBlue, .path_open = false, .num_points = 2, }; GPoint points1[] = { { 3, 97 }, {5, 5} }; memcpy(command_list->commands[0].point...
(!gdraw_command_list_validate(command_list, size))
; command->type = GDrawCommandTypePrecisePath; cl_assert(gdraw_command_list_validate(command_list, size)); free(command_list); } void test_gdraw_command__validate_image(void) { size_t size = sizeof(GDrawCommandImage) + (3 * sizeof(GDrawCommand)) + (sizeof(GPoint) * 6); GDrawCommandImage *image = mall...
rror with \"c\": %s", buf); } r = strftime(buf, buf_size, "%d", &good_data); if (r == 0 || strncmp(buf, "05", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"d\": %s", buf); } r = strftime(buf, buf_size, "%D", &good_data); if (r == 0 || strncmp(buf, "05/05/15", buf_size) != 0) { APP_L...
if (r == 0 || strncmp(buf, "11:04:49", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"X\": %s", buf); }
r = strftime(buf, buf_size, "%y", &good_data); if (r == 0 || strncmp(buf, "15", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"y\": %s", buf); } r = strftime(buf, buf_size, "%Y", &good_data); if (r == 0 || strncmp(buf, "2015", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with...
b_id; // Read token and db_id iter = endpoint_private_read_token_db_id(iter, &token, &db_id); // read key length and key bytes ptr uint8_t key_size; const uint8_t *key_bytes = NULL; iter = prv_read_key_size(iter, data + length, &key_size); iter = prv_read_ptr(iter, data + length, &key_bytes, key_size); ...
analytics_inc(ANALYTICS_DEVICE_METRIC_BLOB_DB_EVENT_COUNT, AnalyticsClient_System)
; PBL_HEXDUMP_D(LOG_DOMAIN_BLOBDB, LOG_LEVEL_DEBUG, data, length); // Each BlobDB message is required to have at least a Command and a Token static const uint8_t MIN_RAW_DATA_LEN = sizeof(BlobDBCommand) + sizeof(BlobDBToken); if (length < MIN_RAW_DATA_LEN) { PBL_LOG(LOG_LEVEL_ERROR, "Got a blob_db message...
orizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20), 143); graphics_d...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20),...
(bool block) { if (block) { s_block_popup_count++; } else { PBL_ASSERTN(s_block_popup_count > 0); s_block_popup_count--; } } bool launcher_popups_are_blocked(void) { return s_block_popup_count > 0; } void launcher_cancel_force_quit(void) { new_timer_stop(s_back_hold_timer); } static void launch...
app_install_is_app_running(e->launch_app.id)
) { process_manager_launch_process(&(ProcessLaunchConfig) { .id = e->launch_app.id, .common = NULL_SAFE_FIELD_ACCESS(e->launch_app.data, common, (LaunchConfigCommon) {}), }); } return; case PEBBLE_WORKER_LAUNCH_EVENT: if (!app_install_is_worker_running(e->launc...
ax_period_secs, ResponsivenessGrantedHandler granted_handler) { } // Referenced from protocol_endppints_table.auto.h override header: /////////////////////////////////////////////////////////// typedef enum { TestEndpointPrivate, TestEndpointPublic, TestEndpointAny...
cl_assert_equal_i(s_prepare_count, 0)
; assert_meta_response_sent(MetaResponseCodeUnhandled); // Length: 1, Endpoint ID: OTHER_NON_EXISTENT_ENDPOINT_ID, Payload: 0x55 RECEIVE(0x00, 0x01, OTHER_NON_EXISTENT_ENDPOINT_ID >> 8, OTHER_NON_EXISTENT_ENDPOINT_ID & 0xff, 0x55); cl_assert_equal_i(s_prepare_count, 0); assert_meta_response_sent(Me...
(BATTERY_SILHOUETTE_ICON_WIDTH, BATTERY_SILHOUETTE_ICON_HEIGHT); if (render) { // This points array is static to help conserve stack usage static const GPoint s_battery_silhouette_path_points[] = { {0, 0}, {BATTERY_SILHOUETTE_ICON_WIDTH - 1, 0}, ...
(max_horizontal_nodes)
; horizontal_container_node->horizontal_alignment = GTextAlignmentLeft; if (!settings_glance->glance_state.battery_charge_state.is_plugged) { GTextNode *battery_percent_text_node = launcher_app_glance_structured_create_subtitle_text_node( structured_glance, prv_battery_percent_dynamic_text_...
/* * 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...
task_free(serialized_array)
; } // Assumes a list of 0s is an empty list, not a list full of empty pstrings uint16_t pstring_get_number_of_pstring16s_in_list(PascalString16List *pstring16_list) { size_t size = sizeof(uint16_t); uint16_t count = 0; uint16_t empty_count = 0; // Traverse list uint8_t *data_ptr = (pstring16_list->pstrings...
elay_spawn)); animation_get_elapsed(a, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_spawn + delay_a)); animation_get_elapsed(b, &elapsed_ms); cl_assert_equal_i(elapsed_ms, -1 * (delay_spawn + delay_b)); // Start prv_advance_to_ms_with_timers(start_ms + 1); cl_assert_equal_i(prv_count_handler...
prv_count_handler_entries(&s_stopped_handler_calls, b)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // Just before A completes prv_advance_to_ms_with_timers(start_ms + duration_a - 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_...
ellent" quality readings the first few seconds, even // though the BPM is 0. Let's fix the quality if the BPM is too low to be valid HRMQuality quality = data->hrm_quality; if ((data->hrm_bpm < HRM_SENSOR_MIN_VALID_BPM_READING) && (data->hrm_quality > HRMQuality_NoSignal)) { quality = HRMQuality_NoSigna...
( s_manager_state.accel_state, s_manager_state.accel_manager_buffer, HRM_MANAGER_ACCEL_MANAGER_SAMPLES_PER_UPDATE)
; hrm_enable(HRM); // Don't need the re-enable timer to fire new_timer_stop(s_manager_state.update_enable_timer_id); } else if (!turn_sensor_on && hrm_is_enabled(HRM)) { // Turn off the sensor now HRM_LOG("Turning off HR sensor"); hrm_disable(HRM); sys_accel_manager_dat...