prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
0 minutes. By this time, as soon as we leave the app, we should turn off the HR device. prv_inc_time(20 * SECONDS_PER_MINUTE); workout_service_frontend_closed(); cl_assert_equal_b(s_hrm_subscribed, false); cl_assert_equal_i(s_hrm_expiration, 0); } // -----------------------------------------------------------...
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 10); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 10); // Unpause workout cl_assert(workout_service_pause_workout(false)); prv_inc_time(10); prv_put_bpm_event(ZONE_3_HR, HRMQuality_Good); cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone...
// --------------------------------------------------------------------------------------- void test_workout_service__avg_hr(void) { int32_t avg_hr; cl_assert(!workout_service_get_avg_hr(&avg_hr)); cl_assert(workout_service_start_workout(ActivitySessionType_Run)); prv_put_bpm_event(140, HRMQuality_Good); ...
n.type == NotificationActionResult) { return (void **)&event->sys_notification.action_result; } else if ((event->sys_notification.type == NotificationAdded) || (event->sys_notification.type == NotificationRemoved) || (event->sys_notification.type == NotificationActedUpon)...
PBL_ASSERTN(xQueueReceive(queue, &event, 0) != pdFAIL)
; // event service does some book-keeping about events, notify it that we're dropping these. sys_event_service_cleanup(&event); #if !RECOVERY_FW // app outbox service messages need to be cleaned up: app_outbox_service_cleanup_event(&event); #endif // cleanup the event, free associated memory if appl...
{ .size = 4, .offset = 0 }, { .size = 20, .offset = 0 }, { .size = 60, .offset = 0 }, { .size = 127, .offset = 0 }, { .size = 128, .offset = 0 }, }; void command_flash_apicheck(const char *len_str) { QSPIFlash *dev = QSPI_FLASH; const int buf_size = 64; char buf[buf_size]; int failures = 0; ...
prompt_send_response_fmt(buf, buf_size, "SUCCESS: run %d tests and all passeed", passes)
; } else { prompt_send_response_fmt(buf, buf_size, "FAILED: run %d tests and %d failed", passes + failures, failures); } } #endif #if RECOVERY_FW #include "console/prompt.h" #include "drivers/flash.h" #define SIGNAL_TEST_MAGIC_PATTERN (0xA5) #define...
/* * 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->selection = 0; }
layer_mark_dirty(data->canvas_layer); } static void click_config_provider(void *context) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, up_handler); window_single_repeating_click_subscribe(BUTTON_ID_SELECT, 100, select_handler); window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, down_...
notification_storage_set_status(id, TimelineItemStatusDeleted); } bool notification_storage_find_ancs_notification_id(uint32_t ancs_uid, Uuid *uuid_out) { PBL_ASSERTN(s_notif_storage_mutex != NULL); int fd = prv_file_open(OP_FLAG_READ); if (fd < 0) { return false; } SerializedTimelineItemHeader header...
{ uint8_t status = iter_state.header.common.status; if (!(status & TimelineItemStatusDeleted)) { iter_callback(&iter_state.notification, &iter_state.header, data); } prv_write_notification(&iter_state.notification, &iter_state.header, new_fd); }
// Close the old file prv_file_close(fd); // We have to close and reopend the new file pointed to by the file descriptor, so // that it's temp flag is cleared. pfs_close(new_fd); new_fd = prv_file_open(OP_FLAG_READ | OP_FLAG_WRITE); // Finally, close that new file as this fd is only known here prv_fi...
fff >> (32 - right_edge_bits_count); *(block + (width / 32)) = (*(block + (width / 32)) & ~mask) | (pattern & mask); width -= right_edge_bits_count; } if (width > 0) { memset(block, pattern, (width / 8)); } } } // ## Line blending functions: // This function draws horizontal line with ...
if (WITHIN(x, data_row_info.min_x, data_row_info.max_x)) { prv_set_color(ctx, output, data_row_offset, x, 1, color); }
y1.integer++; data_row_info = gbitmap_get_data_row_info(framebuffer, y1.integer); output = (GColor8 *)(data_row_info.data + x); } // last pixel with blending (don't render first *and* last pixel if line length is 1) if (y2.fraction != 0) { // Only draw the pixel if its within the bitmap data row...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Launching timeline in future mode."); s_timeline_args.direction = TimelineIterDirectionFuture; analytics_inc(ANALYTICS_DEVICE_METRIC_TIMELINE_FUTURE_LAUNCH_COUNT, AnalyticsClient_System); }
s_timeline_args.launch_into_pin = true; s_timeline_args.stay_in_list_view = true; timeline_peek_get_item_id(&s_timeline_args.pin_id); const CompositorTransition *animation = NULL; const bool is_future = (s_timeline_args.direction == TimelineIterDirectionFuture); const bool timeline_is_destination = true; ...
O"); PebbleEvent event = { .type = PEBBLE_BATTERY_CONNECTION_EVENT, .battery_connection = { .is_connected = battery_is_usb_connected(), }, }; event_put(&event); } // Read the interrupt status registers to clear pending bits. static void prv_clear_pending_interrupts(void) { uint8_t throwaway_...
if (found) { PBL_LOG(LOG_LEVEL_DEBUG, "Found the as3701b"); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Error: read as3701b whoami byte 0x%x, expecting 0x11", chip_id); }
return found; } static void prv_set_sd1_voltage(void) { // STM32F4 running at 1.76V may trigger a Power Down Reset (PDR). The power supply has a // tolerance of 3%. Set the voltage rail to 1.825V so our theoretical minimum should be 1.77V uint8_t sd1_vsel; if (prv_read_register(PmicRegisters_SD1_VOLTAGE, &s...
s_pairing_info_equal_identity(&PAIRING_INFO, &pairing_info_out), true); cl_assert_equal_s(device_name_out, DEVICE_NAME); // Check getting started cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), GETTING_STARTED_COMPLETE); // Check local_name cl_assert_equal_b(shared_prf_storage_get_local...
((uint8_t *)&new_crc, SPRF_PAGE_FLASH_OFFSET(shared_prf_storage_get_valid_page_number()) + offsetof(SharedPRFData, getting_started) + offsetof(SprfGettingStarted, crc), sizeof(new_crc))
; // Should be corrupt, so it should return false cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), false); // Should have moved to the next page, which is ZERO since we had to wrap around. cl_assert_equal_b(shared_prf_storage_get_valid_page_number(), 0); } // Sets the getting started field,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App)
; s_app_state_get_graphics_context = &s_ctx; // Setup resources fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */); pfs_init(false /* run filesystem check */); pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, ...
MS = 800; T_STATIC NotificationWindowData s_notification_window_data; static bool s_in_use = false; PebbleMutex *s_notification_window_mutex; static bool prv_should_provide_action_menu_for_item(NotificationWindowData *data, const TimelineItem *item); static void p...
if (type_b == NotificationReminder) { return 1; } else if (type_b != NotificationReminder && type_a != NotificationReminder) { return 1; } else { return -1; }
(status_bar_layer->config.info_text_buffer, text, INFO_TEXT_BUFFER_SIZE)
; layer_mark_dirty(&(status_bar_layer->layer)); } // Sets info text either ot X/Y or percentage if total is larger than MAX_INFO_TOTAL void status_bar_layer_set_info_progress(StatusBarLayer *status_bar_layer, uint16_t current, uint16_t t...
uint32_t write_size = 32 * 1024; const uint32_t subsector_size = 4 * 1024; for (uint32_t i = region.begin; i < region.end; i += block_size) { struct Region write_region; write_region.begin = i; write_region.end = i + write_size; if (!check_region_write(write_region, false, true)) { success ...
(&stress_data.window, &(WindowHandlers) { .load = stress_window_load, .unload = stress_window_unload })
; app_window_stack_push(&stress_data.window, true); } static void populate_menu(SimpleMenuSection *menu_section, SimpleMenuItem *menu_items) { for (unsigned int i = 0; i < NUM_REGIONS; ++i) { menu_items[i] = (SimpleMenuItem) { .title = s_flash_regions[i].name, .callback = menu_select_callback, ...
/* * 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...
BITS_BETWEEN(0, 0)
, erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_some_sectors_from_beginning(void) { cl_assert(system_flash_erase(FLASH_BASE, 128 KiB, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_full_flash(void) { cl_...
[i].z); } #endif if (state->raw_data_handler_deprecated) { state->raw_data_handler_deprecated(state->raw_data, num_samples); } else if (state->raw_data_handler) { state->raw_data_handler(state->raw_data, num_samples, timestamp_ms); } else { AccelData data[num_samples]; for (uint32_t i = 0; i ...
(PebbleTask_Unknown)
; AccelServiceState *state = (AccelServiceState *)session; state->raw_data_handler_deprecated = handler; state->raw_data_handler = NULL; state->data_handler = NULL; prv_shared_subscribe(state, ACCEL_SAMPLING_25HZ, samples_per_update, pebble_task_get_current()); } // ---------------------------------------...
G_TO_TRIGANGLE(45), GPoint(20, 20)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_bw_center_45.Xbit.pbi")); } void test_graphics_draw_rotated_bitmap__origin_color_assign(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // No Clip, Angle 0 setup_test_rotate_bitmap(&ctx, fb...
(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_color_0.Xbit.pbi")
); // Top-left corner rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_draw_rotated_bitmap(&ctx, test_image_color, GPointZero, DEG_TO_TRIGANGLE(45), GPoint(20, 20)); cl_check(gbitmap_pbi_eq(&ctx.dest_b...
ert_no_write(); // Resources come available again: fake_gatt_client_op_set_write_return_value(BTErrnoOK); // Simulate processing the callback to retry: cl_assert(s_launcher_task_callback != NULL); s_launcher_task_callback(s_launcher_task_callback_data); // Expect to have written the command to register f...
(NumMusicCommand)
; fake_gatt_client_op_assert_no_write(); } void test_ams__send_remote_command_non_kernel_main_task(void) { prv_connect_ams(); // Simulate Music app calling music_command_send(): stub_pebble_tasks_set_current(PebbleTask_App); music_command_send(MusicCommandPlay); // Process the KernelMain callback: cl_a...
184, -880}, { 112, 24, -976}, { 120, 136, -1032}, { 104, -128, -1080}, { 88, -168, -1040}, { 32, -192, -1032}, { 16, -240, -992}, { 16, -264, -984}, { -16, -232, -1008}, { -8, -248, -1008}, { -16, -144, -1024}, { -32, -248, -1024}, { -24, -192, -1032}, { -32, -200, -1...
{ 184, 816, 296}, { 208, 888, 328}, { 208, 856, 320}, { 200, 832, 288}, { 240, 832, 288}, { 216, 808, 360}, { 208, 880, 336}, { 240, 840, 248}, // 388 seconds { 248, 808, 224}, { 208, 848, 376}, { 200, 864, 336}, { 152, 872, 360}, { 144, 912, 328}, { 232, 848,...
{ 72, 120, -760}, { 128, 184, -408}, { 192, 504, 32}, { 248, 1072, 520}, { 152, 1456, 784}, { 112, 1232, 624}, { 120, 912, 448}, { 104, 1008, 232}, { 88, 992, 352}, { 64, 872, 536}, { 72, 800, 464}, { 136, 816, 384}, { 160, 888, 336}, { 136, 880, 328}, // 391...
_get_array_location(heartbeat, metric, index); return prv_location_get_value(location, analytics_metric_element_type(metric)); } const Uuid *analytics_heartbeat_get_uuid(AnalyticsHeartbeat *heartbeat) { return (const Uuid*)prv_heartbeat_get_array_location(heartbeat, ANALYTICS_APP_METRIC_UUID, 0); } //////////////...
PBL_LOG(LOG_LEVEL_DEBUG, "Device heartbeat:")
; prv_print_heartbeat(heartbeat, ANALYTICS_DEVICE_METRIC_START, ANALYTICS_DEVICE_METRIC_END); break; case ANALYTICS_HEARTBEAT_KIND_APP: { const Uuid *uuid = analytics_heartbeat_get_uuid(heartbeat); char uuid_buf[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(uuid, uuid_buf); PBL_LOG(LOG_LEVEL_DEBU...
extAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_clip_outside_y(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, 40, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } v...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_nx.${BIT_DEPTH_NAME}.pbi"))
; test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_outside_x); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_x.${BIT_DEPTH_NAME}.pbi")); // Word Wrap tests test_graphics_cont...
h" typedef struct SendBuffer { //! Save some memory by making this a union. //! @note This is the first field, so that we can just cast between //! (SendBuffer *) and (SessionSendQueueJob *) union { //! The targeted session, this field is valid until ..._write_end has been called. CommSession *session;...
(true /* assert_is_held */)
; const size_t num_bytes_allocated_after = (s_default_kernel_sender_bytes_allocated + sizeof(PebbleProtocolHeader) + payload_buffer_length); if (num_bytes_allocated_after > DEFAULT_KERNEL_SENDER_MAX_BYTES_ALLOCATED) { return NULL; } const size_t allocation_size = ...
ayer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi")); } #define OFFSET_RECT_NO_CLIP GRect(10, 10, 40, 50) #define OFFSET_RECT_CLIP_XY GRect(10, 10, 30, 40) #define OFFSET_RECT_CLIP_NXNY GRect(0, 0, 30, 40) #define CE...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quad_bottom_left.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_circle_quadrant_draw_1px_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, GCornerBottomRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quad_bottom_right.${BIT_DEPTH_NAME}.pbi")); setup_test_a...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (!buffer_allocated) { msg_copy = (HcProtocolMessage *)kernel_malloc_check(message->message_length); memcpy(msg_copy, message, message->message_length); } else { msg_copy = message; }
*should_free = false; HcProtocolMessageHandlerEvent event = { .cb = handler, .msg = msg_copy, }; xQueueSendToBack(s_dispatcher.job_queue, &event, portMAX_DELAY); } void hc_protocol_cb_dispatcher_init(void) { static const int HC_PROTOCOL_CB_DISPATCHER_MAX_JOBS_QUEUED = 15; s_dispatcher = (HcProt...
right 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing,...
cl_assert(gbitmap_pbi_eq(&s_dest_bitmap, "test_bitblt_palette_1bit__2bit_palette_to_1bit-expect.pbi"))
; gbitmap_destroy(src_bitmap); } // Tests assign, from same size to same size. // Setup: // - Source is 50x50, alternating lines between orange and blue for the top half. // The bottom half is a diagonal orange line over blue. // The left half is semi-transparent and the right half is completely opaque //...
/* * 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...
{ get_subsector_base_calls++; return addr & 0xffffff00; }
int get_sector_base_calls = 0; FlashAddress flash_impl_get_sector_base_address(FlashAddress addr) { get_sector_base_calls++; return addr & 0xfffff000; } int erase_subsector_begin_calls = 0; status_t erase_subsector_begin_return = S_SUCCESS; status_t flash_impl_erase_subsector_begin(FlashAddress addr) { erase_s...
tate *state, AnimationPrivate *animation, bool include_delay, bool include_play_count) { uint32_t child_duration; uint32_t duration = 0; int child_idx; if (include_delay) { duration += animation->delay_ms; } if (animation->type == AnimationTypeSequence) { // ...
(state, animation, parent)
ig.h" #include "vendor/jerryscript/jerry-libm/include/math.h" // easiest way to get M_PI #include <stdlib.h> #include <string.h> #define ROCKY_SINGLETON "_rocky" // [MT] including <math.h> causes the jerry-libm header to get included again :( extern double round(double d); uintptr_t rocky_util_uint_from_value(const...
if (was_created) { *was_created = true; }
return jerry_acquire_value(result); } static jerry_value_t prv_create_function(void *c_function_ptr) { return jerry_create_external_function(c_function_ptr); } bool rocky_add_function(jerry_value_t parent, char *name, jerry_external_handler_t handler) { bool result = false; JS_UNUSED_VAL = rocky_get_or_creat...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ Layer *window_layer = window_get_root_layer(window); GRect bounds = window_layer->bounds; // Parameters outer_size = 49; inner_size = 0; angle_start = TRIG_MAX_ANGLE / 4; angle_end = TRIG_MAX_ANGLE; prv_setup_data(bounds); }
static void prv_test_radial(Layer *layer, GContext* ctx) { GColor color = { .argb = (uint8_t) rand() }; graphics_context_set_fill_color(ctx, color); graphics_fill_radial(ctx, rect, GOvalScaleModeFillCircle, inset, angle_start, angle_end); } static void prv_test_circle(Layer *layer, GContext* ctx) { GColor co...
tx_power_level_out)); } void test_ble_ad_parse__128_bit_uuid(void) { // AD Element, Length: 2, AD Type: Flags // AD Element, Length: 17, AD Type: More 128-bit UUIDs available, // Value: 0x68753a444d6f12269c600050e4c00067 uint8_t data[GAP_LE_AD_REPORT_DATA_MAX_LENGTH] = "\x02\x01\x1a\x11\x06\x67\x00\xc0\xe...
(ad, uuid, 8)
NE_RESOURCE_CALORIES; icons->values[3] = TIMELINE_RESOURCE_DISTANCE; static StringList names = StringListLiteral("Pace\0Run duration\0Calories burned\0Distance"); static StringList values = StringListLiteral("7:45\0" "30M\0" "8384\0" "3.3 miles"); attribute_list_add_string_list(&list, AttributeIdMetricNames, &n...
prv_add_notification(-60 * 30)
; prv_add_notification(-60 * 5); prv_add_notification(-60); prv_add_notification(-1); goto notifications; default: // do nothing break; } return; timeline: timeline_event_refresh(); prv_launch_timeline(); return; notifications: prv_launch_notifications(); return; ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ while (tries_left) { const bool success = rng_rand((uint32_t *) &rand_buffer[i * sizeof(uint32_t)]); if (success) { break; } --tries_left; } }
if (tries_left == 0) { PBL_LOG(LOG_LEVEL_WARNING, "rng_rand() failed too many times, falling back to rand()"); // Fall back to rand(): for (uint32_t i = 0; i < (sizeof(SM128BitKey) * SMRootKeyTypeNum); ++i) { rand_buffer[i] = rand(); } } } void ble_root_keys_get_and_generate_if_needed(SM128B...
/* * 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...
for (unsigned int j = i+1; j < length; j++) { if (values[i].x.raw_value > values[j].x.raw_value) { swapIntersections(&values[i], &values[j]); } }
} } static inline bool prv_is_in_range(int16_t min_a, int16_t max_a, int16_t min_b, int16_t max_b) { return (max_a >= min_b) && (min_a <= max_b); } static void prv_gpath_draw_filled_cb(GContext *ctx, int16_t y, Fixed_S16_3 x_range_begin, Fixed_S16_3 x_range_end, ...
p_le_advert_schedule(const BLEAdData *payload, const GAPLEAdvertisingJobTerm *terms, uint8_t num_terms, GAPLEAdvertisingJobUnscheduleCallback callback, void *callback_data, GAPLEAd...
kernel_free(job->terms)
; kernel_free(job); } } void gap_le_advert_unschedule_job_types( GAPLEAdvertisingJobTag *tag_types, size_t num_types) { bt_lock(); ListNode *first_node = bt_driver_advert_client_has_cycled() ? &s_current->node : &s_jobs->node; // get the last job in the list ListNode *curr_node = list_get_prev(firs...
{0x99, 0xcb, 0x7c, 0x75, 0x8a, 0x35, 0x44, 0x87, 0x90, 0xa4, 0x91, 0x3f, 0x1f, 0xa6, 0x76, 0x01}, .timestamp = 0, .duration = 0, .type = TimelineItemTypeNotification } }; cl_assert(E_INVALID_ARGUMENT == reminder_db_insert_item(&not_a_reminder)); } void test_reminder_db__delete...
cl_assert(dirty_list)
; cl_assert(list_count((ListNode *)dirty_list) == num_reminders); // Mark some items as synced reminder_db_mark_synced((uint8_t *)&item1.header.id, sizeof(TimelineItemId)); reminder_db_mark_synced((uint8_t *)&item3.header.id, sizeof(TimelineItemId)); // We should now only have 2 dirty items cl_assert_equa...
/* * 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 const PebbleProcessMdSystem s_workout_app_info = { .common = { .uuid = {0xfe, 0xf8, 0x2c, 0x82, 0x71, 0x76, 0x4e, 0x22, 0x88, 0xde, 0x35, 0xa3, 0xfc, 0x18, 0xd4, 0x3f}, }, .name = "Workout", }; return (const PebbleProcessMd*) &s_workout_app_info; }
const PebbleProcessMd *sports_app_get_info(void) { static const PebbleProcessMdSystem s_sports_app_info = { .common = { .uuid = {0x4d, 0xab, 0x81, 0xa6, 0xd2, 0xfc, 0x45, 0x8a, 0x99, 0x2c, 0x7a, 0x1f, 0x3b, 0x96, 0xa9, 0x70}, .visibility = ProcessVisibilityShownOnCommunication }, ...
buf_size = 64; char buf[buf_size]; prompt_send_response_fmt(buf, buf_size, "Size: %d DMA: %"PRIu32 " POL: %"PRIu32 " MMP: %"PRIu32, size, dma_time, pol_time, mmap_time); kernel_free(buffer_dma_ptr); kernel_free(buffer_pol); kernel_free(buffer_mmap); return success; } struct F...
(buf, buf_size, "Sector blank check via read took: %"PRIu32, blank)
ock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Jun 9, 4:00 PM", time_buf); } void test_clock__time_24h_lower_style(void) { char time_buf[64]; const int jun10th_noon_2015 = 1433937600; prv_clock_reset(0); rtc_set_time(jun10th_noon_2015); // Our test eve...
clock_get_month_named_date(time_buf, sizeof(time_buf), format_time)
pps/system_apps/settings/settings_quick_launch.h" #include "apps/system_apps/timeline/timeline.h" #include "kernel/low_power.h" #include "kernel/pbl_malloc.h" #include "popups/alarm_popup.h" #include "popups/bluetooth_pairing_ui.h" #include "popups/notifications/notification_window.h" #include "popups/timeline/peek.h" ...
{ prefs_private_handle_blob_db_event(blobdb_event); }
return; } case PEBBLE_DO_NOT_DISTURB_EVENT: notification_window_handle_dnd_event(&e->do_not_disturb); return; case PEBBLE_REMINDER_EVENT: // This handles incoming Reminders notification_window_handle_reminder(&e->reminder); return; case PEBBLE_BATTERY_STATE_CHANGE...
/* * 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...
{ launcher_app_glance_structured_draw_icon(structured_glance, ctx, charging_indicator_icon, rect->origin); }
if (size_out) { *size_out = GSize(kino_reel_get_size(charging_indicator_icon).w, settings_glance->subtitle_font_height); } } static void prv_battery_icon_node_draw_cb(GContext *ctx, const GRect *rect, UNUSED const GTextNodeDrawConfig *config, bo...
if (bus->user_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "Attempted reset of disabled bus %d by device %d", bus_idx, device_id); bus_unlock(bus); return; }
PBL_LOG(LOG_LEVEL_WARNING, "Resetting I2C bus %" PRId8, bus_idx); // decrement user count for reset so that if this user is the only user, the // bus will be powered down during the reset bus->user_count--; // Reset and reconfigure bus and pins bus_reset(bus_idx); //Restore user count bus->user_cou...
nection_for_cccd( BLEDescriptor cccd_ref, GAPLEConnection **connection_out) { BLECharacteristic characteristic_ref = gatt_client_descriptor_get_characteristic_and_conne...
if (!prv_check_buffer(client)) { goto unlock; }
has_notification = prv_get_next_notification_header(client, header_out); const uint16_t read_space = circular_buffer_get_read_space_remaining(s_circular_buffer[client]); if (has_notification && header_out) { // When tackling https://pebbletechnology.atlassian.net/browse/PBL-14151 this should probably // ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return false; }
// // Fakes & helpers // #define TEST_EVENT_BLOB_VERSION (0) #define TEST_EVENT_TIMESTAMP (0) static AnalyticsEventBlob s_last_blob; void analytics_logging_log_event(AnalyticsEventBlob *event_blob) { s_last_blob = *event_blob; s_last_blob.version = TEST_EVENT_BLOB_VERSION; s_last_blob.timestamp = TEST_EVENT_T...
_assert_equal_s("1 MIN AGO", time_buf); // June 9th 2015, 16:02:00 (T+00:02:00) rtc_set_time(event_time + (2 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("2 MIN AGO", time_buf); // June 9th 2015, 15:00:00 (T-01:00:00) ...
("IN 2 H", time_buf)
; // June 9th 2015, 15:59:00 (T-00:01:00) rtc_set_time(event_time - (1 * SECONDS_PER_MINUTE)); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 1 MIN", time_buf); // June 9th 2015, 15:58:00 (T-00:02:00) rtc_set_time(event_time - (2 * SECONDS...
command); cl_assert_equal_i(1, s_path_stroke_precise_count); cl_assert_equal_b(true, s_path_open); cl_assert(prv_compare_points((GPoint*)points, s_stroke_points, s_path_num_points)); free(command); } void test_gdraw_command__draw_circle(void) { GDrawCommand *command = malloc(sizeof(GDrawCommand) + sizeof(GP...
(NULL, command)
; cl_assert_equal_i(s_stroke_color.argb, GColorPurpleARGB8); cl_assert_equal_i(s_fill_color.argb, GColorClearARGB8); cl_assert_equal_i(s_stroke_width, 2); cl_assert_equal_i(s_path_num_points, 1); cl_assert_equal_b(s_radius, 0); cl_assert_equal_i(s_circle_fill_count, 0); cl_assert_equal_i(s_circle_stroke_c...
" #include "hrm_manager_private.h" #include "console/prompt.h" #include "drivers/hrm.h" #include "kernel/pbl_malloc.h" #include "mfg/mfg_info.h" #include "os/tick.h" #include "process_management/app_manager.h" #include "process_management/worker_manager.h" #include "services/common/analytics/analytics.h" #include "ser...
( s_manager_state.accel_state, &timestamp_ms)
; mutex_lock(s_manager_state.accel_data_lock); // Only read as many as we have space to store const size_t MAX_BUFFERED_SAMPLES = ARRAY_LENGTH(s_manager_state.accel_data.data); if ((s_manager_state.accel_data.num_samples + num_new_samples) > MAX_BUFFERED_SAMPLES) { analytics_inc(ANALYTICS_DEVICE_METRIC_HR...
while recognizers are active. A different layer is touched, so // the active recognizers on non-touched layers in the tree are cancelled s_active_layer = &layer_b; e.type = TouchEvent_Touchdown; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed((int[]) {4, 0, 2}, 3, &s_re...
cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown)
; cl_assert_equal_p(manager.triggered, NULL); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible); // A touchdown occurs where no layers are touched s_activ...
{ return gap_le_connection_get_gatt_mtu(&device); } DEFINE_SYSCALL(BTErrno, sys_ble_client_read, BLECharacteristic characteristic) { return gatt_client_op_read(characteristic, GAPLEClientApp); } DEFINE_SYSCALL(bool, sys_ble_client_get_notification_value_length, BLECharacteristic *characterist...
(BTErrno, sys_ble_client_read_descriptor, BLEDescriptor descriptor)
{ return gatt_client_op_read_descriptor(descriptor, GAPLEClientApp); } // ----------------------------------------------------------------------------- // ble_service.h DEFINE_SYSCALL(uint8_t, sys_ble_service_get_characteristics, BLEService service_ref, BLECharacteristic...
e->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->w = max_size->w; } } static void prv_clip_height(GSize *size, const GSize *max_size) { if (max_size->h && size->h > max_size->h) { size->h = max_size->h; } } ...
prv_clip_width(&ctx->box.size, &child_node->cached_size)
; } else if (parent_node->type == GTextNodeType_Vertical && child_node->type == GTextNodeType_Horizontal) { prv_clip_height(&ctx->box.size, &child_node->cached_size); } return true; } static bool prv_did_draw_container_child(GTextNodeDrawContext *ctx, GTextNode *child_node) { const GValue *siz...
act settings file. Error %"PRIi32".", status); return status; } settings_raw_iter_begin(&new_file.iter); for (settings_raw_iter_begin(&file->iter); !settings_raw_iter_end(&file->iter); settings_raw_iter_next(&file->iter)) { SettingsRecordHeader *hdr = &file->iter.hdr; if (partially...
(&file->iter)
; !settings_raw_iter_end(&file->iter); settings_raw_iter_next(&file->iter)) { if (partially_written(&file->iter.hdr)) { // Compact will remove partially written records. We could be smarter, // but this is something of an edge case. return settings_file_compact(file); } if (!partia...
/* * 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_text_layer_get_cache_handle(text_layer)
); } } static const char * const s_text_layer_default_fonts[NumPreferredContentSizes] = { //! @note this is the same as Medium until Small is designed [PreferredContentSizeSmall] = FONT_KEY_GOTHIC_14_BOLD, [PreferredContentSizeMedium] = FONT_KEY_GOTHIC_14_BOLD, [PreferredContentSizeLarge] = FONT_KEY_GOTHIC_1...
se return; } size_t payload_length = length - sizeof(cmd->opcode) - sizeof(cmd->write); int ret = pulse_fd->impl->write_proc(cmd->write.data, cmd->write.address, payload_length, pulse_fd->domain_state); if (FAILED(ret)) { prv_respond_internal_error(cmd, length, r...
{ BulkIOPacketCallbackData *callback_data = data; Command *cmd = (Command*)&callback_data->packet; size_t length = callback_data->length; if (length) { switch (cmd->opcode) { case BULKIO_CMD_DOMAIN_OPEN: prv_handle_open(cmd, length); break; case BULKIO_CMD_DOMAIN_CLOSE: p...
void pulse2_bulkio_packet_handler(void *packet, size_t length) { BulkIOPacketCallbackData *data = kernel_malloc_check(length + sizeof(length)); data->length = length; memcpy(&data->packet, packet, length); system_task_add_callback(prv_handle_packet, data); } void pulse2_bulkio_link_open_handler(void) { } vo...
liceHeader *)glance_buffer_cursor; *serialized_slice_header = (SerializedAppGlanceSliceHeader) { .type = current_slice->type, .total_size = serialized_slice_total_size, .num_attributes = attr_list->num_attributes, }; // Serialize the slice's attribute list attribute_list_serialize(att...
kernel_free(serialized_glance)
; return rv; } status_t app_glance_db_read_glance(const Uuid *uuid, AppGlance *glance_out) { if (!uuid || !glance_out) { return E_INVALID_ARGUMENT; } const uint8_t *key = (uint8_t *)uuid; const int key_size = UUID_SIZE; const int serialized_glance_size = app_glance_db_get_len(key, key_size); if (!...
/* * 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_pfs_stress_callback, NULL)
tup_swap_up(SwapLayer *swap_layer) { LayoutLayer *new_previous = prv_fetch_next_layout(swap_layer, -1); // if there is no layout to swap up to, abort if (!new_previous) { return false; } swap_layer->previous = new_previous; GRect prev_frame = swap_layer->previous->layer.frame; const GRect *current_...
{ int16_t offset = prv_get_current_notification_offset(swap_layer); prv_scroll(swap_layer, offset, AnimationCurveEaseOut); }
HOUT 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 "bma255.h" #include "bma255_regs.h" #include "bma255_private.h" #include "console/prompt.h" #include "drivers/accel.h" #include "d...
(BOARD_CONFIG_ACCEL.accel_ints[1], ExtiTrigger_Rising, prv_bma255_IRQ2_handler)
; } bool bma255_query_whoami(void) { const uint8_t chip_id = bma255_read_register(BMA255Register_BGW_CHIP_ID); PBL_LOG(LOG_LEVEL_DEBUG, "Read BMA255 whoami byte 0x%"PRIx8", expecting 0x%"PRIx8, chip_id, BMA255_CHIP_ID); return (chip_id == BMA255_CHIP_ID); } static uint64_t prv_get_curr_system_time_ms(...
/* * 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, fb, ctx.dest_bitmap.bounds, ctx.dest_bitmap.bounds, false, 1)
1, -1}, .in_sleep = {-1, -1, -1}, .in_deep_sleep = {-1, -1, -1}, .weight = 1.0, .force_shut_down_at = -1, }; char line_buf[256]; while (true) { char *line = fgets(line_buf, sizeof(line_buf), state->common.file); if (!line) { // EOF break; } //printf("\nGot line: %s", l...
(token, "TEST_IN_DEEP_SLEEP_MIN")
g enough delta in response to the self test mode. // NOTE! For some reason, applying a "positive" force makes the number go lower and applying // a "negative" force makes the number go higher. And then, for some reason, we abs() it when // calculating a delta to hide the fact that it's backwards. This is all docu...
{ acc_odr = BMI160AccODR_800_HZ; }
else { // any interval < min supported must saturate to 1600Hz acc_odr = BMI160AccODR_1600_HZ; } return acc_odr; } static BMI160SampleRate prv_get_supported_sample_rate(uint32_t interval_us) { BMI160SampleRate sample_rate; if (BMI160SampleRate_12p5_HZ <= interval_us) { sample_rate = BMI160SampleRate_...
value_length, event->gatt_error); } kernel_free(buffer); } static void prv_consume_notifications(const PebbleBLEGATTClientEvent *event) { GATTBufferedNotificationHeader header = {}; bool has_more = gatt_client_subscriptions_get_notification_header(GAPLEClientKernel, &header); const RtcTicks start_ticks =...
PBL_LOG(LOG_LEVEL_DEBUG, "PEBBLE_BLE_CONNECTION_EVENT: reason=0x%x, conn=%u, bond=%u", event->hci_reason, event->connected, event->bonding_id)
; const bool connected = event->connected; // FIXME: When PPoGATT is supported add a check for active gateway // https://pebbletechnology.atlassian.net/browse/PBL-15277 // // For now, we just assume that the Kernel LE client is _always_ bonded for // ANCS. Note that we cannot use bt_persistent_storage call...
/* * 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...
(ARROW_PATH_POINTS)
, .points = ARROW_PATH_POINTS }; #define ARROW_SIZE {26, 24} static const GRect ARROW_RECTS[] = { {{ 5, 55}, ARROW_SIZE}, // BACK {{112, 30}, ARROW_SIZE}, // UP {{112, 90}, ARROW_SIZE}, // SELECT {{112, 140}, ARROW_SIZE}, // DOWN }; PathLayer *arrow = &data->arrows[id]; path_layer_in...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(TIMELINE_PEEK_HIDE_AFTER_TIME_S, duration_s)
; // As soon as an event begins, it should peek, hence the show-before time being inclusive return timeline_event_starts_within( &header->common, now, -show_duration_after_start_s, s_peek_event_data.show_before_time_s + 1 /* inclusive */); } static bool prv_should_set_first_event(PeekUpdateContext *upd...
h_card, GContext *ctx) { const GRect *bounds = &graph_card->layer.bounds; const int weekday_width = PBL_IF_RECT_ELSE(103, 119); prv_draw_avg_line(graph_card, ctx, graph_card->stats.weekday.avg, 0, weekday_width); const int weekend_width = PBL_IF_RECT_ELSE(38, 58); prv_draw_avg_line(graph_card, ctx, graph_card...
clock_get_month_named_abbrev_date(buffer, buffer_size, selection_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...
cl_assert(!memory_layout_is_cstring_in_region(&region, invalid_str, 100))
; // Invalid string, no null. cl_assert(!memory_layout_is_cstring_in_region(&region, invalid_str, 3)); }
/* * 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...
(&md->uuid, &app_process->uuid)
) { return APP_WORKER_RESULT_ALREADY_RUNNING; } // We have to get confirmation first that it is OK to launch the new worker launcher_task_add_callback(prv_switch_worker, (void *) install_id); return APP_WORKER_RESULT_ASKING_CONFIRMATION; } worker_manager_put_launch_worker_event(install_id); ...
ingFormatSecondNumeric: case ToStringFormatMinuteNumeric: case ToStringFormatHourNumeric: case ToStringFormatDayNumeric: case ToStringFormatMonthNumeric: return true; case ToStringFormatUnsupported: case ToStringFormatEmpty: case ToStringFormatSecond2Digit: case ToStringFormatMinu...
(result_buffer, date_buffer, sizeof(result_buffer))
raw_vertical_line_dotted(&ctx, GPoint(9, 0), 2); graphics_draw_vertical_line_dotted(&ctx, GPoint(11, 0), 3); graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20); graphics_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21); graphics_draw_verti...
graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 71), 10)
1}, { -376, -80, -946}, { -427, -116, -869}, { -465, -86, -910}, { -513, -74, -817}, { -480, 25, -908}, { -499, -1, -844}, { -388, -5, -825}, { -483, -1, -942}, { -531, -37, -905}, { -492, 85, -1020}, { -451, 1, -986}, { -190, 143, -1064}, { -33, 356, -1133}, { 23...
{ 335, 341, -1180}, { 343, 312, -1185}, { 398, 313, -1179}, { 468, 332, -1050}, { 543, 209, -906}, { 510, 205, -921}, { 442, 198, -954}, { 344, 250, -983}, { 360, 289, -1072}, { 395, 355, -1182}, { 280, 380, -1114}, { 328, 342, -1186}, { 198, 377, -1246}, { 114, 3...
{ 388, 218, -1087}, { 394, 274, -1127}, { 340, 245, -1077}, { 299, 367, -1244}, { 279, 323, -1217}, { 242, 324, -1143}, { 279, 239, -1094}, { 197, 140, -1022}, { 34, 75, -894}, { -352, 178, -923}, { -645, 83, -843}, { -778, 133, -754}, { -654, 195, -815}, { -596,...
ime as another transport may cause // undesirable behaviour however. if (!prv_is_transport_type(existing_system_session->transport, existing_system_session->transport_imp, CommSessionTransportType_PULSE) && !prv_is_...
if (session) { bt_lock(); if (comm_session_is_valid(session)) { session->transport_imp->set_connection_responsiveness(session->transport, consumer, state, max_period_secs, granted_handle...
TH_NAME}__clipping_letters(void) { GContext ctx; prv_setup_resources(); uint32_t gothic_18_handle = RESOURCE_ID_GOTHIC_18_BOLD; cl_assert(text_resources_init_font(0, gothic_18_handle, 0, &s_font_info)); test_graphics_context_init(&ctx, fb); // Test when clipping/drawing and text bounds are all at (0, 0)...
setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
((uint8_t []) { 0, 1, 255, 255 }, &index, &id)
; cl_assert_equal_i(index, 2); cl_assert_equal_i(id, 2); debug_db_determine_current_index((uint8_t []) { 0, 1, 2, 255 }, &index, &id); cl_assert_equal_i(index, 3); cl_assert_equal_i(id, 3); } void test_debug_db__basic(void) { int index; uint8_t id; debug_db_determine_current_index((uint8_t []) { 0, 1...
obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Lice...
(&data->window.layer, &arrow->layer)
; } static void prv_handle_init(void) { AppData *data = app_malloc_check(sizeof(AppData)); *data = (AppData) { .seconds_remaining = 10, .buttons_pressed = 0, .test_complete = false, }; app_state_set_user_data(data); Window *window = &data->window; window_init(window, ""); window_set_fullscr...
REG = 0x0; CACHE->SWD_RESET_REG = 0x0; #if DEFAULT_REGISTER_DEBUG // DCDC REG_SETF(DCDC, DCDC_CTRL_0_REG, DCDC_FAST_STARTUP, 0x0); REG_SETF(DCDC, DCDC_CTRL_0_REG, DCDC_BROWNOUT_LV_MODE, 0x1); REG_SETF(DCDC, DCDC_CTRL_0_REG, DCDC_IDLE_CLK_DIV, 0x1); REG_SETF(DCDC, DCDC_CTRL_0_REG, DCDC_PRIORITY, 0xE4); RE...
(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_IDLE, 0x0)
; REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V18P, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_VDD, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V18, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V14, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_FW, 0x0); REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC...
); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")); layer_set_update_proc(&layer, &clear_layer_update_callback); layer_render_tree(&layer, &ctx); #if PBL_COLOR c...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 4)
; graphics_draw_arc_internal(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG, angle_start, angle_end); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_arc_origin_aa_letter_c.${BIT_DEPTH_NAME}.pbi")); // Stroke width bigger than radius setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, RADIUS_BI...
us_inner.raw_value); cl_assert_equal_i(0, lc->fill_radial_precise.radius_outer.raw_value); } void test_rocky_api_graphics__line_styles(void) { prv_global_init_and_set_ctx(); EXECUTE_SCRIPT( "ctx.lineWidth = 8;\n" "var w = ctx.lineWidth;\n" ); cl_assert_equal_i(1, s_graphics_context_set_stroke_width...
(-11, 5000, 60, large_int)
insight_type, PercentTier pct_tier) { // Format the event specifc info in the blob. The analytics_logging_log_event() method will fill // in the common fields AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_HealthInsightCreated, .health_insight_create...
(conn_interval, UINT8_MAX)
, .crc_good = crc_good, .type = type, .bytes_transferred = bytes_transferred, .elapsed_time_ms = elapsed_time_ms, .conn_events = MIN(conn_events, UINT32_MAX), .sync_errors = MIN(sync_errors, UINT16_MAX), .skip_errors = MIN(skip_errors, UINT16_MAX), .other_errors = MIN(oth...
chunk_size; if (minute_idx != samples_remaining / (60 * SAMPLES_PER_SECOND)) { activity_test_run_minute_callback(); minute_idx = samples_remaining / (60 * SAMPLES_PER_SECOND); prv_clear_event_queue(); } } } // ------------------------------------------------------------------------------- ...
activity_get_metric(ActivityMetricSleepRestfulSeconds, 1, &before_deep)
; PBL_LOG(LOG_LEVEL_DEBUG, "start total: %d, start deep: %d", (int)before_total, (int)before_deep); // Capture steps before sleep int32_t steps_before; activity_get_metric(ActivityMetricStepCount, 1, &steps_before); // Do some light and deep sleep prv_feed_deep_sleep_min(60); prv_feed_light_sleep_min(18...
} const uint32_t field_crc = *(uint32_t*)field; const bool valid_crc = (field_crc == crc32(CRC32_INIT, SPRF_FIELD_DATA(field), SPRF_FIELD_DATA_SIZE(field_size))); return valid_crc; } //! Return whether the entire SharedPRFData given as an argument is valid. //! It checks: //! 1. That the struct header i...
prv_invalidate_current_page()
; memset(data_out, 0xFF, sizeof(*data_out)); } } static SharedPRFData *prv_alloc_and_fetch_struct(void) { SharedPRFData *data = kernel_zalloc_check(sizeof(SharedPRFData)); prv_fetch_struct(data); return data; } static void prv_dealloc_struct(SharedPRFData *data) { kernel_free(data); } static void prv_p...
eta_read(client, value, value_length, error); } } unlock: bt_unlock(); } // ------------------------------------------------------------------------------------------------- static PPoGATTPacket * prv_lazily_allocate_packet_if_needed(const PPoGATTClient *client, ...
{ if (new_timer_scheduled(client->rx_ack_timer, NULL)) { new_timer_stop(client->rx_ack_timer); } // Ack packet (zero payload size): *payload_size_out = 0; return &client->out.ack_packet_to_send; }
te_Receiving_Footer: case SPITransportState_Sending_Footer: { // Got INT while DMA TC interrupt hasn't happened yet. // This might happen if the Dialog side would be *extremely* fast and assert the INT line // faster than the DMA transfer complete interrupt happens. Probably very unlikely, but ...
hc_protocol_buffer_gained_space()
; analytics_add(ANALYTICS_DEVICE_METRIC_BT_UART_BYTES_IN, length, AnalyticsClient_System); } bool host_transport_is_current_task_host_transport_task(void) { return (s_spi_transport.task == xTaskGetCurrentTaskHandle()); } bool host_transport_init(void) { s_spi_transport.tx_storage = s_spi_tx_storage_buffer; s_...
ude "stubs_window_stack.h" // Setup and Teardown //////////////////////////////////// void test_selection_windows__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); test_graphics_context_init(&s_ctx, fb); framebuffer_clear(fb); load_system_resources...
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
; } void test_selection_windows__time_range_selection_window(void) { prv_prepare_canvas_and_render_for_each_size(prv_render_time_range_selection_window); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); }
ction = 3 }, .y = { .integer = bounds->size.h / 2 - 1, .fraction = 3 } }; } return GPointPreciseFromGPoint(imprecise_center_point); } static void prv_draw_clock_face(GContext *ctx, ClockFace *face) { MultiWatchData *data = app_state_get_user_data(); const GRect *bounds = &window_get_root_layer(&d...
(&data->window)
ray_len); } Animation *WEAK animation_spawn_create(Animation *animation_a, Animation *animation_b, Animation *animation_c, ...) { va_list args; va_start(args, animation_c); Animation *animation = prv_create_from_vararg(animation_a, animation_b, animation_c, args); va_end(...
{ if (animation->implementation && animation->implementation->update) { animation->implementation->update((Animation *)animation, progress); } }
16_t bezel_height = (DISP_ROWS - app_height) / 2; const int16_t app_peek_offset_y = timeline_peek_get_origin_y() - app_height; const int16_t app_offset_y = CLIP(app_peek_offset_y, 0, bezel_height); PBL_ASSERTN((bezel_width > 0) && (bezel_height > 0)); uint8_t *dst = (uint8_t *)s_framebuffer.buffer; ...
{ PebbleEvent event = { .type = PEBBLE_APP_DID_CHANGE_FOCUS_EVENT, .app_focus = { .in_focus = in_focus, }, }; event_put(&event); }
static bool prv_should_render(void) { return !(compositor_display_update_in_progress() || s_framebuffer_frozen); } static void prv_release_app_framebuffer(void) { // Inform the app that the render is complete and it is safe to write into its framebuffer again. PebbleEvent event = { .type = PEBBLE_RENDER_FI...
x72, .vmc = 1787, }, }; prv_test_minute_data(samples, num_samples, exp_minutes, ARRAY_LENGTH(exp_minutes)); } // Run the not moving sample // The expected results were obtained empirically on a known good commit { int num_samples; AccelRawData *samples = activity_sample_not_moving...
memset(minute_raw_data, 0, k_minute_data_bytes)
; s_num_captured_activity_sessions = 0; time_t now = rtc_get_time(); int len = 30; KAlgTestActivitySession exp_session = { .activity = KAlgActivityType_Run, .start_utc = now + 10 * SECONDS_PER_MINUTE, .steps = len * 150, // 150 steps/min .len_minutes = len, .resting_calori...
enable_scan_resp); if (result) { s_is_advertising = true; PBL_LOG(GAP_LE_ADVERT_LOG_LEVEL, "Airing advertising job: %s ", prv_string_for_debug_tag(next->tag)); // Use average interval ms. BT controller does not report back what it uses. ...
prv_perform_next_job(false)
; } } else { kernel_free(job->terms); kernel_free(job); job = NULL; } } bt_unlock(); return job; } // ----------------------------------------------------------------------------- void gap_le_advert_unschedule(GAPLEAdvertisingJobRef job) { if (!job) { return; } bool is...
le; session->db_id = db_id; session->dirty_list = dirty_list; session->session_type = session_type; session->timeout_timer = (const RegularTimerInfo) { .cb = prv_timeout_timer_callback, .cb_data = session, }; s_sync_sessions = (BlobDBSyncSession *)list_prepend((ListNode *)s_sync_sessions, ...
{ regular_timer_remove_callback(&session->timeout_timer); }
if (session->session_type == BlobDBSyncSessionTypeDB) { // Only send the sync done when syncing an entire db blob_db_endpoint_send_sync_done(session->db_id); } list_remove((ListNode *)session, (ListNode **)&s_sync_sessions, NULL); kernel_free(session); } } }
LIGHT_STATE_ON_FADING: new_brightness = s_current_brightness - (prv_backlight_get_intensity() / LIGHT_FADE_STEPS); if (new_brightness <= BACKLIGHT_BRIGHTNESS_OFF) { // Done fading! new_brightness = BACKLIGHT_BRIGHTNESS_OFF; s_light_state = LIGHT_STATE_OFF; // Don't need to ...
{ s_user_controlled_state = false; if (s_num_buttons_down == 0) { prv_change_state(LIGHT_STATE_OFF); } }
mutex_unlock(s_mutex); } static void prv_light_reset_to_timed_mode(void) { mutex_lock(s_mutex); if (s_user_controlled_state) { s_user_controlled_state = false; if (prv_light_allowed()) { prv_change_state(LIGHT_STATE_ON_TIMED); } } mutex_unlock(s_mutex); } void light_toggle_enabled(void...
NULL, 0 /*flags*/); PBL_ASSERTN(success); } // ------------------------------------------------------------------------------------------- void regular_timer_add_multisecond_callback(RegularTimerInfo* cb, uint16_t seconds) { PBL_ASSERTN(s_callback_list_semaphore); mutex_lock(s_callback_list_semaphore); cb->p...
{ mutex_destroy((PebbleMutex *) s_callback_list_semaphore); s_callback_list_semaphore = NULL; new_timer_delete(s_timer_id); s_timer_id = TIMER_INVALID_ID; }
static void prv_fire_callbacks(ListNode *list, uint16_t mod) { mutex_lock(s_callback_list_semaphore); ListNode* iter = list_get_next(list); while (iter) { RegularTimerInfo* reg_timer = (RegularTimerInfo*) iter; if (reg_timer->private_reset_count % mod == 0) { // Last one. Will trigger callback whe...
< SPRF_NUM_PAGES; i++) { page_magic = prv_get_magic_for_page(i); // Check the magic to see if we need to investigate further and read the entire contents. if (page_magic == SprfMagic_ValidEntry || page_magic == SprfMagic_UnpopulatedEntry) { flash_read_bytes((uint8_t *) &data, SPRF_PAGE_FLASH_...
(data.fields, SprfValidFields_RemoteSigningInfoValid)
, }; } if (requires_address_pinning_out) { *requires_address_pinning_out = data.requires_address_pinning; } if (flags) { *flags = data.flags; } if (name_out) { SprfBlePairingName name_data = {}; const bool name_rv = SPRF_FETCH_FIELD(name_data, ble_pairing_name); ...
plementation *impl = (PropertyAnimationImplementation *)animation->animation.implementation; impl->accessors.setter.grect(animation->subject, animation->values.from.grect); } if (to_frame) { animation->values.to.grect = *to_frame; } return (PropertyAnimation *)animation; } // Helper Functions ///...
{ // Initialize the notification window module before rendering anything notification_window_init(false /* is_modal */); const unsigned int num_columns = SettingsContentSizeCount; const unsigned int num_rows = num_down_scrolls + 1; const int16_t bitmap_width = (DISP_COLS * num_columns) + (GRID_CELL_PADDING ...
system_theme_set_content_size(content_size); const int16_t x_offset = (int16_t)(GRID_CELL_PADDING + (settings_content_size * (GRID_CELL_PADDING + DISP_COLS))); for (int down_scrolls = 0; down_scrolls <= num_down_scrolls; down_scrolls++) { const int16_t y_offset = (int16_t)((num_ro...
License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distribu...
{ total_value = -total_value; }
return total_value; } T_STATIC bool prv_template_predicate_match(TemplateStringState *state, PredicateCondition *cond, intmax_t *value) { *cond = PredicateCondition_Invalid; if (*state->position == '<') { *cond = PredicateCondition_L; } else if (*state->positio...
unt_handler_entries(&s_setup_handler_calls, h), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, h), 1); // Make sure the frame reached the "to" state cl_assert_equal_i(prv_last_update_distance(h), ANIMATION_NORMALIZED_MAX); // This should return NULL now if the animation got destroy...
prv_advance_to_ms_with_timers(start_ms + test_duration)
; // Should still be running cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, 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_stopped_handler_calls, a), 0); cl_assert(prv_count_handler_entries(&s_update_ha...
l come from overrides and will include a smaller boot fpga image #include "mfg/spalding/spalding_boot.fpga.auto.h" // Stubs for fake_crc.c #include "services/normal/filesystem/pfs.h" int pfs_read(int fd, void *buf, size_t size) { return 0; } int pfs_seek(int fd, int offset, FSeekType seek_type) { return 0; } // Test ...
mfg_info_set_disp_offsets((GPoint) {-2, 1})
; cl_assert_equal_i(mfg_info_get_disp_offsets().x, -2); cl_assert_equal_i(mfg_info_get_disp_offsets().y, 1); cl_assert_equal_i(mfg_info_get_watch_color(), 3); cl_assert_equal_i(mfg_info_get_rtc_freq(), 4); mfg_info_get_model(buffer); cl_assert_equal_s(buffer, ""); // Make sure we have space for ...
this at // https://pebbletechnology.atlassian.net/browse/PBL-5473 prv_reset_local_session_ptrs(); dls_clear(); prv_schedule_retry(); return NULL; } return dls_session; } static void prv_dls_log(AnalyticsHeartbeat *device_hb, AnalyticsHeartbeatList *app_hbs) { dls_log(s_device_heartbeat_sessio...
prv_create_dls(ANALYTICS_BLOB_KIND_EVENT, sizeof(AnalyticsEventBlob))
; // If the above call fails, it will schedule our timer to try again in a few seconds } } static void prv_handle_log_event(AnalyticsEventBlob *event_blob) { if (!s_event_session) { PBL_LOG(LOG_LEVEL_INFO, "Event dropped because session not created yet"); return; } // Log it dls_log(s_event_sess...
s_received_callback(&it, NULL); \ } \ } while(0); #define RCV_RESET_REQUEST() \ RCV_APP_MESSAGE(TupletBytes(PostMessageKeyResetRequest, NULL, 0)); #define RCV_RESET_COMPLETE() \ RCV_APP_MESSAGE(TupletBytes(PostMessageKeyResetComplete, \ (const uint8_t *)&VALID_RESET_COMPLETE, sizeof(VALI...
EXPECT_OUTBOX_MESSAGE_PENDING(TupletBytes(PostMessageKeyResetRequest, NULL, 0))
; // TODO: check fields cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetCompleteLocalInitiated); } void test_rocky_api_app_message__awaiting_reset_request__disconnect(void) { prv_init_api(false /* start_connected */); prv_simulate_transport_connection_even...
, { 1184, 32, -80}, { 1544, -104, -64}, { 1560, -32, 120}, { 1128, 336, -120}, { 1032, 384, -216}, { 864, 280, 32}, { 680, 128, 80}, { 752, 152, 112}, { 832, 216, 128}, // 25 seconds { 816, 352, 24}, { 784, 352, -24}, { 824, 400, -96}, { 968, 408, -176}, { 115...
{ 840, 352, -112}, { 936, 336, -128}, { 1208, 328, -128}, { 1240, 288, -64}, { 1760, 352, 0}, { 1432, 480, -16}, { 840, 400, 0}, { 960, 272, 80}, { 1064, 176, 144}, { 944, 168, 128}, { 832, 112, 128}, { 760, 96, 72}, // 31 seconds { 752, 96, 24}, { 752, 24, 48...
{ 880, 24, 32}, { 1032, -32, -64}, { 1056, -64, -136}, { 1744, -232, 32}, { 1440, 64, 8}, { 1200, 368, -184}, { 976, 408, -152}, { 728, 256, 64}, { 720, 184, 80}, { 824, 136, 176}, { 824, 216, 136}, { 784, 192, 216}, { 712, 464, 80}, { 792, 856, 464}, { 784, ...
consumed_bytes = -1; // error goto exit; } if (!prv_pfs_read(logging_session->storage.fd, &chunk_hdr, sizeof(chunk_hdr))) { consumed_bytes = -1; // error goto exit; } if (chunk_hdr.valid && chunk_hdr.num_bytes == DLS_CHUNK_HDR_NUM_BYTES_UNINITIALIZED) { // End of va...
(head->name)
; goto bad_session; } // We need to figure out how many bytes of data are unread and the offset of the // last byte of data (which becomes the write offset). We pass NULL into the buffer argument // of dls_storage_read() to tell it to compute these for us. uint32_t write_offset; int32_t n...
s_data.metric_history[ActivityMetricSleepStateSeconds][0] = 30 * SECONDS_PER_MINUTE; s_data.metric_history[ActivityMetricSleepExitAtSeconds][0] = midnight_local; s_data.metric_history[ActivityMetricSleepEnterAtSeconds][0] = midnight_local; s_data.metric_history[ActivityMetricSleepTotalSeconds][0] = 0; activi...
prv_set_activation_time(now)
; activity_insights_process_minute_data(now); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); now += SECONDS_PER_DAY; // Jan 2 @ 10:00am rtc_set_time(now); activity_insights_process_minute_data(now); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notificatio...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(mask)
; cl_assert(graphics_context_mask_record(ctx, mask)); draw_func(ctx); cl_assert(graphics_context_mask_record(ctx, NULL)); cl_assert_equal_p(ctx->draw_state.draw_implementation, &g_default_draw_implementation); cl_assert(graphics_context_mask_use(ctx, mask)); cl_assert_equal_p(ctx->draw_state.draw_mask, ...
_status(&iter_state.header, TimelineItemStatusDeleted, fd); size_available += sizeof(SerializedTimelineItemHeader) + iter_state.header.payload_length; if (size_needed <= size_available) { return; } } if (pfs_seek(fd, iter_state.header.payload_length, FSeekCur) < 0) { break; }...
(notification, &header, fd)
; if (result < 0) { // [AS] TODO: Write failure: reset storage, compression or reset watch? goto reset_storage; } s_write_offset += result; prv_file_close(fd); return; reset_storage: mutex_unlock_recursive(s_notif_storage_mutex); notification_storage_reset_and_init(); } // Finds the next match...