prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
item(&item, &bad_item.common.id)); } void test_reminder_db__find_by_timestamp_title(void) { prv_insert_default_reminders(); // Add items with title attributes for searching (out of order for worst-case scenario) cl_assert(S_SUCCESS == reminder_db_insert_item(&title_item2)); cl_assert(S_SUCCESS == reminder_db_...
cl_must_pass(reminder_db_read((uint8_t *)&item1.header.id, sizeof(Uuid), (uint8_t *)&item, sizeof(SerializedTimelineItemHeader)))
; cl_assert_equal_i(item.common.status & 0xFF, TimelineItemStatusReminded); }
//! Convert a exti number (value 0 to 22) to one of the EXTI_LineX defines static uint32_t prv_exti_line_to_bit(int exti_line) { return 0x1 << exti_line; } static void prv_lock(void) { if (mcu_state_are_interrupts_enabled()) { __disable_irq(); s_exti_locked = true; } } static void prv_unlock(void) { i...
{ // Clear IT Pending bit EXTI->PR = prv_exti_line_to_bit(exti_line); const ExtiHandlerCallback cb = s_exti_handlers[exti_line]; if (cb) { bool should_context_switch = false; cb(&should_context_switch); portEND_SWITCHING_ISR(should_context_switch); } }
static void prv_check_handle_exti(int exti_line) { if (EXTI->PR & prv_exti_line_to_bit(exti_line)) { prv_handle_exti(exti_line); } } // Actual ISR functions /////////////////////////////////////////////////////////////////////////////// void EXTI0_IRQHandler(void) { NVIC_ClearPendingIRQ(EXTI0_IRQn); pr...
pes } GenericServiceType; typedef enum { ReservedServiceManagement = 0x0101, ReservedServiceControl = 0x0102, ReservedServiceMax = 0x0fff } ReservedService; typedef enum { ManagementServiceAttributeServiceDiscovery = 0x0001, ManagementServiceAttributeNotificationInfo = 0x0002 } ManagementServiceAttribute; ...
{ s_has_done_service_discovery = true; }
else { return false; } } else if (attr == ManagementServiceAttributeNotificationInfo) { if (length != sizeof(NotificationInfoData)) { PBL_LOG(LOG_LEVEL_WARNING, "Notification info response is invalid length: %"PRIu32, length); return false; } const NotificationInfoData *notification...
nit(&iterator, &state, &head, TimelineIterDirectionPast, s_feb_5_midnight + 11 * 60 * 60), 0); cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[2].header.id)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[1].header.id)); cl_assert(iter_next(...
cl_assert(iter_next(&iterator))
; cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id)); // check second again cl_assert(iter_prev(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id)); // check fourth cl_assert(iter_next(&iterator)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.p...
{ return jerry_create_undefined(); }
layer_mark_dirty(&top_window->layer); return jerry_create_undefined(); } GContext *rocky_api_graphics_get_gcontext(void) { return app_state_get_graphics_context(); } static jerry_value_t prv_rect_precise_call(const jerry_length_t argc, const jerry_value_t argv[], void (*func...
one_item(void) { static const char* thin_values[] = { "Y" }; ActionMenuLevel *root_level = action_menu_level_create(ARRAY_LENGTH(thin_values)); action_menu_level_set_display_mode(root_level, ActionMenuLevelDisplayModeThin); for (size_t i = 0; i < ARRAY_LENGTH(thin_values); i++) { action_menu_level_add_actio...
(root_level, template_level, "Reply to HUBERT BLAINE WOLFESCHLEGELSTEINHAUSENBERGERDORFF")
; ActionMenuLevel *emoji_level = action_menu_level_create(1); action_menu_level_add_action(emoji_level, "This won't be seen", prv_noop_action_callback, NULL); action_menu_level_add_child(root_level, emoji_level, "Open on...
rect(&context, &GRect(20, 80, 40, 10), 4, GCornersAll)); setup_test(&context, true, 1, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&co...
{ // Test for locking of requested framebuffer format GContext ctx = {.dest_bitmap.info.format = GBitmapFormat8BitCircular}; GBitmap *bmp = graphics_capture_frame_buffer_format(&ctx, GBitmapFormat8BitCircular); cl_assert_equal_p(bmp, &ctx.dest_bitmap); cl_assert(ctx.lock == true); }
; void test_graphics_context_${BIT_DEPTH_NAME}__lock_framebuffer_fails_from_8BitCircular(void) { // Test for locking of 8Bit Circular framebuffer when framebuffer is regular 8Bit GContext ctx = {.dest_bitmap.info.format = GBitmapFormat8BitCircular}; GBitmap *bmp = graphics_capture_frame_buffer_format(&ctx, GBitm...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_check_serial_log_enabled(log_message->log_level)
) { return; } #if PULSE_EVERYWHERE if (async) { pulse_logging_log(log_message->log_level, log_message->filename, htons(log_message->line_number), log_message->message); } else { pulse_logging_log_sync( log_message->log_level, log_message->filename, htons(log_mess...
/* * 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...
{ *buffer++ = '-'; }
buffer += snprintf(buffer, 3, "%02"PRIx8, ((uint8_t *)uuid)[i]); } *buffer++ = '}'; *buffer = '\0'; }
skipping r12 " str lr, [r0, #4]! \n" // lr " mrs r1, xpsr \n" " mrs r2, msp \n" " mrs r3, psp \n" " adds r0, #8 \n" // skip pc " stmia r0!, {r1-r3} \n" // xpsr, msp, psp " b core_...
(true /*new*/)
include <util/math.h> // from lit-magic-string.inc.h static const char ECMA_STRING_TYPE_NUMBER[] = "Number"; static const char COLOR_TYPES[] = "String ('color name' or '#hex') or Number"; static const char COLOR_ERROR_MSG[] = "Expecting String ('color name' or '#hex') or Number"; typedef struct { const char *expect...
{ str_val = val; }
else { str_val = jerry_value_to_string(val); should_release = true; } apply(str_val, binding); if (should_release) { jerry_release_value(str_val); } } static void prv_malloc_and_assign_string_applier(const jerry_value_t str, const RockyArgBinding ...
ice_window.h" #include "applib/applib_malloc.auto.h" #include "process_management/app_install_manager.h" #include "syscall/syscall.h" #include "system/logging.h" #include "system/passert.h" #include <string.h> #if CAPABILITY_HAS_MICROPHONE static void prv_handle_transcription_result(PebbleEvent *e, void *context) { ...
if (!session || session->in_progress) { return; }
voice_window_set_confirmation_enabled(session->voice_window, is_enabled); #endif } void dictation_session_enable_error_dialogs(DictationSession *session, bool is_enabled) { #if CAPABILITY_HAS_MICROPHONE if (!session || session->in_progress) { return; } voice_window_set_error_enabled(session->voice_window,...
const GTextOverflowMode overflow_mode, const GTextAlignment alignment) { const int16_t LAYOUT_HEIGHT_IGNORE = SHRT_MAX; GRect box = { .origin = (GPoint) { .x = 0, .y = 0 }, .size = (GSize) { .w = bounds_width, .h = LAYOUT_HEIGHT_IGNORE ...
{ TextLayoutExtended *extended = prv_get_writable_extended_layout(layout); if (extended) { extended->line_spacing_delta = delta; } }
int16_t graphics_text_layout_get_line_spacing_delta(const GTextLayoutCacheRef layout) { return prv_layout_get_line_spacing_delta(layout); } void graphics_text_attributes_restore_default_text_flow(GTextLayoutCacheRef layout) { TextLayoutExtended *extended = prv_get_writable_extended_layout(layout); if (!extende...
ze); PBL_ASSERTN(num_chars + 1 < (int)sizeof(data->base64_buf)); pbl_log(LOG_LEVEL_INFO, __FILE_NAME__, __LINE__, "RAW: %s", data->base64_buf); // Reset the stored record. 0 in num_samples causes it to be re-initialized // at the top of this loop. data->record.num_samples = 0; } ...
(rtc_get_time())
; PBL_LOG(LOG_LEVEL_DEBUG, "Updated and persisted sessions before stopping activity tracking"); } // ------------------------------------------------------------------------------------------------ // Start activity tracking system callback static void prv_start_tracking_cb(void *context) { PBL_ASSERT_TASK(Pebbl...
te_blank(s10, GBitmapFormat8Bit); cl_assert(NULL != bmp); cl_assert(NULL == bmp->data_row_infos); bmp = gbitmap_create_blank(s10, GBitmapFormat1BitPalette); cl_assert(NULL != bmp); cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette bmp = gbitmap_create_blank(s10, G...
cl_assert_equal_i(expected, DISPLAY_FRAMEBUFFER_BYTES)
; } size_t prv_gbitmap_size_for_data(GSize size, GBitmapFormat format); void test_gbitmap_formats__size_for_data(void) { cl_assert_equal_i( 40, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat1Bit)); cl_assert_equal_i(130, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat8Bit)); cl_assert_equal_i( 20...
{ 0, 0x6f, 0, 182}, { 0, 0x6f, 0, 182}, { 0, 0x6f, 0, 182}, // 870: Local time: 04:03:00 PM { 0, 0x6f, 0, 182}, { 0, 0x6f, 0, 182}, { 0, 0x6f, 0, 182}, { 0, 0x6f, 0, 181}, { 0, 0x6f, 0, 181}, { 0, 0x6f, 0, 181}, { 0, 0x6f, 0, 181}, { 0, 0x6f, 0, 180}, { 0, 0x6f, 0, 180...
{ 0, 0x59, 0, 186}, { 0, 0x59, 0, 185}, { 0, 0x59, 0, 186}, { 0, 0x59, 0, 182}, { 0, 0x59, 0, 186}, { 0, 0x59, 0, 186}, { 0, 0x59, 0, 186}, { 0, 0x59, 0, 186}, { 0, 0x59, 0, 183}, { 0, 0x59, 0, 186}, { 0, 0x59, 0, 186}, { 0, 0x59, 0, 186}, { 0, 0x59, 0, 185}, { 0,...
{ 0, 0x59, 0, 188}, { 0, 0x59, 0, 188}, { 0, 0x59, 0, 188}, { 0, 0x59, 0, 185}, { 0, 0x59, 0, 188}, { 0, 0x59, 0, 188}, { 0, 0x59, 0, 187}, { 0, 0x59, 0, 187}, { 0, 0x59, 0, 185}, { 0, 0x59, 0, 187}, { 0, 0x59, 0, 187}, { 0, 0x59, 0, 187}, { 0, 0x59, 0, 188}, { 0...
header, context)) { timeline_item_free_allocated_buffer(reminder); return true; // continue iteration } reminder_info->match = true; return false; // stop iteration } bool reminder_db_find_by_timestamp_title(time_t timestamp, const char *title, TimelineItemStorag...
(&s_storage, key, key_len)
; } status_t reminder_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len) { return timeline_item_storage_read(&s_storage, key, key_len, val_out, val_out_len); } status_t reminder_db_delete(const uint8_t *key, int key_len) { status_t rv = prv_reminder_db_delete_common(key, key_len); remin...
break; case BUTTON_ID_DOWN: key = PREF_KEY_QUICK_LAUNCH_DOWN; break; case BUTTON_ID_SELECT: key = PREF_KEY_QUICK_LAUNCH_SELECT; break; case BUTTON_ID_BACK: key = PREF_KEY_QUICK_LAUNCH_BACK; break; case NUM_BUTTONS: break; } PBL_ASSERTN(key); prv_pref_set...
{ if (s_activity_activation_timestamp == 0) { s_activity_activation_timestamp = rtc_get_time(); prv_pref_set(PREF_KEY_ACTIVITY_ACTIVATED_TIMESTAMP, &s_activity_activation_timestamp, sizeof(s_activity_activation_timestamp)); } }
Impl is_dirty; BlobDBGetDirtyListImpl get_dirty_list; BlobDBMarkSyncedImpl mark_synced; bool disabled; } BlobDB; static const BlobDB s_blob_dbs[NumBlobDBs] = { [BlobDBIdPins] = { .init = pin_db_init, .insert = pin_db_insert, .get_len = pin_db_get_len, .read = pin_db_read, .del = pin_db_dele...
{ db->init(); }
} } void blob_db_get_dirty_dbs(uint8_t *ids, uint8_t *num_ids) { const BlobDB *db = s_blob_dbs; *num_ids = 0; for (uint8_t i = 0; i < NumBlobDBs; ++i, ++db) { bool is_dirty = false; if (db->is_dirty && (db->is_dirty(&is_dirty) == S_SUCCESS) && is_dirty) { ids[*num_ids] = i; *num_ids += 1; ...
*)hdr)->att_handle, .value_length = sizeof(emulated_result), .context_ref = ((HcGattReadData *)hdr)->context_ref }; memcpy(data->value, &emulated_result, sizeof(emulated_result)); hc_protocol_enqueue_with_payload(HcEndpointID_Gatt, HcMessageID_Gatt_ReadCompleted, (uint...
ble_gatts_get_num_attr(num_included_services, num_characteristics, num_descriptors)
28, 96, -8}, { 1280, 112, 0}, { 1208, 200, -56}, { 992, 264, -96}, { 696, 208, -144}, { 584, 192, -104}, { 560, 224, -112}, { 656, 256, -152}, { 832, 288, -240}, { 1064, 312, -312}, { 1232, 344, -408}, { 1096, 312, -336}, { 1344, 288, -256}, // 102 seconds { 1136,...
{ 728, 128, -40}, { 752, 152, -16}, { 824, 112, 0}, { 872, 88, 16}, { 1056, 96, -24}, { 1064, 104, -24}, { 1072, 88, -96}, { 1224, 88, -168}, { 1192, 16, -16}, { 1064, 56, 48}, { 1256, 200, -112}, { 1304, 264, -176}, { 1080, 288, -176}, { 752, 224, -208}, { 55...
{ 1264, 168, -96}, { 1224, 208, -120}, { 968, 224, -200}, { 688, 192, -192}, // 110 seconds { 544, 136, -176}, { 528, 152, -112}, { 648, 176, -72}, { 800, 224, -112}, { 984, 304, -216}, { 1040, 336, -280}, { 1024, 328, -272}, { 1096, 304, -216}, { 1336, 312, -200...
T_Y, frame->size.w, 40); // number layer text_layer_init_with_parameters(&peek_layer->number.text_layer, &text_rect, NULL, fonts_get_system_font(FONT_KEY_LECO_26_BOLD_NUMBERS_AM_PM), GColorBlack, GColorClear, text_...
(kino_reel, expand)
; layer_set_hidden((Layer *)&peek_layer->kino_layer, true); peek_layer->show_dot = prv_is_dot_size(icon_from.size); if (peek_layer->show_dot) { kino_reel_unfold_set_start_as_dot(kino_reel, peek_layer->dot_diameter / 2); } kino_layer_set_reel(&peek_layer->kino_layer, kino_reel, true); } void peek_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...
(&firmware_description)
pitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("IN 12 H", time_buf); // June 12th 2015, 00:29:59 (T-11:30:01) rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) + (29 * SECONDS_PER_MINUTE) + 59); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX...
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS)
; cl_assert_equal_s("10 MIN AGO", time_buf); // June 9th 2015, 12:59:29 (T+00:59:29) rtc_set_time(event_time + (59 * SECONDS_PER_MINUTE) + 29); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("59 MIN AGO", time_buf); // June 9th 2015, 12:59:30 ...
v_window_unload, .appear = prv_window_appear, .disappear = prv_window_disappear }); window_set_click_config_provider(window, prv_click_config_provider); cl_check(window->is_waiting_for_click_config); WindowStack *stack = app_state_get_window_stack(); cl_check(stack); cl_check(!stack->list_head);...
cl_assert_equal_i(prv_get_load_unload_count(), 1)
; } // Description: // In this test, we push a window during the unload handler of a window. void test_window_stack__push_during_window_unload(void) { Window *window = window_create(); window_set_window_handlers(window, &(WindowHandlers){ .load = prv_window_load, .unload = prv_push_window_unload }); ...
tems[i]), 0); } } void test_timeline__long_middle_past(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(timeline_iter_init(&iterator, &stat...
uuid_equal(&state.pin.header.id, &s_all_day_items[2].header.id)
); cl_assert(state.node->all_day); // check that the item we see is timestamped at local midnight rather than utc midnight // 1421136000 is midnight Jan 13, PST cl_assert_equal_i(state.pin.header.timestamp, 1421136000); // second all day event cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state....
se_lines = realloc(s_precise_lines, (s_num_precise_lines + 1) * sizeof(*s_precise_lines)); s_precise_lines[s_num_precise_lines].p0 = p0; s_precise_lines[s_num_precise_lines].p1 = p1; s_num_precise_lines++; } void prv_reset(void) { s_fill_color = GColorClear; s_stroke_color = GColorClear; s_stroke_w...
prv_compare_points(points, s_stroke_points, s_path_num_points)
); cl_assert_equal_p(s_fill_points, NULL); prv_reset(); // set stroke color to be transparent and restore fill - fill should be drawn, but no outline // should be drawn gdraw_command_set_fill_color(command, GColorGreen); color = gdraw_command_get_stroke_color(command); color.a = 0; gdraw_command_set_st...
344, 352}, { 1016, 376, 304}, { 872, 384, 160}, { 768, 424, 32}, { 880, 456, -72}, { 992, 400, -48}, { 1272, 408, 32}, { 1760, 256, 296}, { 1920, 288, 416}, { 1008, -40, 344}, { 1152, 152, 224}, { 1384, 272, -120}, { 352, -2184, -768}, { 1024, 376, -176}, { 1016, ...
{ 1216, 544, -144}, { 1576, 528, -88}, { 1672, 552, -72}, { 1144, 248, 112}, { 1336, 136, 96}, { 1464, 72, 136}, { 1264, -264, 200}, { 1080, 112, 144}, { 1000, 24, 208}, { 920, 24, 160}, { 912, 0, 144}, { 840, 16, 80}, { 768, 24, 40}, { 832, 0, -48}, { 896, 64...
{ 768, -8, -112}, // 44 seconds { 1064, -16, -248}, { 1336, -248, 48}, { 1384, -48, 64}, { 1392, 272, -176}, { 1448, 216, -80}, { 1384, 184, 256}, { 1280, 344, 280}, { 1184, 416, 352}, { 992, 232, 240}, { 896, 264, 80}, { 904, 360, 72}, { 928, 464, -16}, { 10...
", 0, true, }, { "\\\\\\", 1000000000, "\\", EVAL_DEFAULT, false, TemplateStringErrorStatus_InvalidEscapeCharacter, 3, }, { "\\e", 1000000000, "e", 0, true, }, { "\\\\\\{}", 1000000000, "\\{}", 0, true, }, { "\\\\{end()}", 1000000000, "\\", 0, ...
(cond.eval_time, s_full_tests[i].expect_time)
; if (cond.eval_time != 0) { cl_assert_equal_b(cond.force_eval_on_time, true); } else { cl_assert_equal_b(cond.force_eval_on_time, false); } if (!rv) { cl_assert_equal_i(err.status, s_full_tests[i].expect_status); cl_assert_equal_i(err.index_in_string, s_full_tests[i].expect_inde...
MIN(*session_entries, s_activity_state.activity_sessions_count); memcpy(sessions, s_activity_state.activity_sessions, num_sessions_to_return * sizeof(ActivitySession)); *session_entries = num_sessions_to_return; } mutex_unlock_recursive(s_activity_state...
health_db_get_typical_value(metric, day, value_out)
; } // ------------------------------------------------------------------------------------------------ bool activity_get_metric_monthly_avg(ActivityMetric metric, int32_t *value_out) { *value_out = 0; return health_db_get_monthly_average_value(metric, value_out); } // --------------------------------------------...
tmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r0_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r1_aa_no_cl...
(&ctx.dest_bitmap, "fill_rect_origin_r0_aa_clip_xy.${BIT_DEPTH_NAME}.pbi")
); // TODO: Remove these #ifdefs in PBL-15916 when support for non-antialiased rounded rect #if SCREEN_COLOR_DEPTH_BITS == 8 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, 1, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_...
ffer) { task_free(obj->data_buffer); } task_free(obj); } static void prv_calc_current_chunk_size(size_t *out_bytes_remaining, size_t *out_chunk_payload_size) { OutgoingObject *obj = s_state.out.object_queue; const size_t bytes_remaining = strlen(obj->data_buffer + o...
{ PBL_LOG(LOG_LEVEL_ERROR, "Chunk reassembly out of sync! is_first=%u, is_expecting_first=%u", chunk->is_first, is_expecting_first); return false; }
if (chunk->is_first) { // If this is the first message, allocate buffer: uint8_t *const buffer = task_malloc(chunk->total_size_bytes); if (!buffer) { APP_LOG(APP_LOG_LEVEL_ERROR, "Not enough mem to recv postMessage() of %"PRIu32" bytes", (uint32_t) chunk->total_size_bytes); // ...
the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ...
for (int i = 0; i < (int)READ_HISTORY_ENTRIES; i++) { int delta = (i % 50); if (delta > 25) { delta = 50 - delta; } s_temp_readings[i] = 1600 + delta; }
#endif // Draw the last bunch that fit in the window int first_idx = (int)READ_HISTORY_ENTRIES - PLOT_WIDTH; first_idx = MAX(first_idx, 0); // Get the min and max bool first_valid = true; int first_non_zero_idx = -1; for (int i = first_idx; i < (int)READ_HISTORY_ENTRIES; i++) { if (s_temp_readings[...
prv_configure_operating_mode(); } uint32_t accel_set_sampling_interval(uint32_t interval_us) { BMI160SampleRate sample_rate = prv_get_supported_sample_rate(interval_us); prv_enable_operating_mode(AccelOperatingModeData, sample_rate); return prv_get_min_sampling_interval_us(); } uint32_t accel_get_sampling_inte...
prv_read_modify_write(BMI160_REG_INT_MAP_0, en_val, en_val)
; // Actually enable the anymotion interrupt uint8_t int_en = (BMI160_INT_EN_0_ANYMOTION_Z_EN | BMI160_INT_EN_0_ANYMOTION_Y_EN | BMI160_INT_EN_0_ANYMOTION_X_EN); prv_read_modify_write(BMI160_REG_INT_EN_0, int_en, int_en); // configure the anymotion interrupt to fire after 4 successcive // samples are ...
/* * 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...
FAILED(sc)
) { return sc; } block_addr += block_size; } return S_SUCCESS; } status_t flash_impl_unprotect(void) { // No way to unprotect all of flash. This requires a full reset of the mt25q qspi_flash_init(QSPI_FLASH, &QSPI_FLASH_PART, qspi_flash_is_in_coredump_mode(QSPI_FLASH)); return S_SUCCESS; } st...
ally a reboot reason would be set before initiating a core dump. In // case this isn't true, set a default reason so that we know the reboot was // because of a core dump. RebootReason reason; reboot_reason_get(&reason); if (reason.code == RebootReasonCode_Unknown) { reason = (RebootReason) { RebootReason...
(&chunk_hdr, s_flash_addr, sizeof(chunk_hdr))
; s_flash_addr += prv_flash_write_bytes(&s_saved_registers.extra_reg, s_flash_addr, chunk_hdr.size); // Write out each of the thread chunks ---------------------------------- // Note that we leave the threads for last just in case we encounter corrupted FreeRTOS structures...
qual_i(0, menu_layer_get_selected_index(&l).section); cl_assert_equal_i(5, menu_layer_get_selected_index(&l).row); cl_assert_equal_i(5 * basic_cell_height, l.selection.y); menu_layer_set_selected_next(&l, true, MenuRowAlignNone, false); cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section); cl_asse...
menu_layer_init(&s_menu_layer_hierarchy, &GRect(10, 10, 100, 180))
; Layer *layer = &s_menu_layer_hierarchy.scroll_layer.content_sublayer; // two layers (inverter + shadow) cl_assert_equal_i(2, prv_num_sublayers(layer)); menu_layer_set_callbacks(&s_menu_layer_hierarchy, NULL, &(MenuLayerCallbacks){ .draw_row = prv_menu_cell_is_part_of_hierarchy_draw_row, .get_num_rows ...
/* * 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...
confirmation_dialog_pop(confirmation_dialog)
; bool selection_confirmed = (click_recognizer_get_button_id(recognizer) == BUTTON_ID_UP); if (selection_confirmed) { if (!app_cache_entry_exists(args->new_worker_id)) { // If an app cache entry does not exist for the new worker, then we will have to // fetch the application. Since this will promp...
{ ActionMenuData *data = context; if (animation_is_scheduled(data->level_change_anim)) { animation_set_elapsed(data->level_change_anim, animation_get_duration(data->level_change_anim, true, true)); } ActionMenuLevel *parent_level = data->view_model.cur_level->parent_level; if (...
if (result_window) { prv_action_window_insert_below(action_menu, result_window); }
data->result_window = result_window; } void action_menu_set_align(ActionMenuConfig *config, ActionMenuAlign align) { if (!config) { return; } config->align = align; } ActionMenu *action_menu_open(WindowStack *window_stack, ActionMenuConfig *config) { ActionMenuData *data = applib_type_zalloc(ActionMe...
// Feed in 100 steps/min over 1 min, 1 minute of deep and 1 minute of light sleep prv_feed_cannned_accel_data(60, 100, ActivitySleepStateAwake); prv_feed_cannned_accel_data(60, 0, ActivitySleepStateRestfulSleep); prv_feed_cannned_accel_data(60, 0, ActivitySleepStateLightSleep); // Wait long enough for our re...
{ // Uncomment this call to prv_save_known_settings_file() in order to save the current version // of settings to the fixture directory. After doing this, you will need to git add it and modify // this migration test to read it in and verify its contents after migration. // prv_save_known_settings_file("activi...
/* * 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...
(crc, buffer, CRC_CHUNK_SIZE)
; num_bytes -= CRC_CHUNK_SIZE; flash_addr += CRC_CHUNK_SIZE; } flash_read_bytes(buffer, flash_addr, num_bytes); return crc32(crc, buffer, num_bytes); }
rt((*state)[j][i]); } } } static void InvShiftRows(void) { uint8_t temp; // Rotate first row 1 columns to right temp=(*state)[3][1]; (*state)[3][1]=(*state)[2][1]; (*state)[2][1]=(*state)[1][1]; (*state)[1][1]=(*state)[0][1]; (*state)[0][1]=temp; // Rotate second row 2 columns to right temp=(...
(output, input)
; state = (state_t*)output; // Skip the key expansion if key is passed as 0 if(0 != key) { Key = key; KeyExpansion(); } // If iv is passed as 0, we continue to encrypt without re-setting the Iv if(iv != 0) { Iv = (uint8_t*)iv; } for(i = 0; i < length; i += KEYLEN) { BlockCopy(ou...
MIN_FRAME_INTERVAL_MS); animation_destroy(a); animation_destroy(b); animation_destroy(c); } // -------------------------------------------------------------------------------------- // Test unscheduling animations arbitrarily in an update handler with auto destroy. void test_animation__unschedule_all_in_update...
(animation_get_custom_curve(a), NULL)
; cl_assert_equal_p(animation_get_custom_interpolation(a), NULL); cl_assert_equal_i(animation_get_curve(a), AnimationCurveDefault); animation_destroy(a); } void test_animation__current_interpolate_override(void) { // just some pointer to compare against AnimationCurveFunction curve = (void*)1; Interpolate...
LOG(LOG_LEVEL_INFO, "Phone call watchdog timer started"); pp_get_phone_state_set_enabled(true); } } else { PBL_LOG(LOG_LEVEL_INFO, "Not starting phone call watchdog, this isn't iOS 8: %d", s_call_source); } } static void prv_cancel_call_watchdog(void) { new_timer_stop(s_call_watchdog); ...
analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_END_COUNT, AnalyticsClient_System)
; } static void prv_handle_call_end(bool disconnected) { if (!disconnected) { analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_END_COUNT, AnalyticsClient_System); } if (s_call_in_progress) { prv_call_end_common(); phone_ui_handle_call_end(false /*call accepted*/, disconnected); } else if (!disconn...
TERVAL 1 typedef struct { uint16_t service_id; uint16_t attribute_id; } ReadInfo; typedef struct PACKED { uint8_t version; uint16_t service_id; uint16_t attribute_id; uint8_t type; uint8_t error; uint16_t length; } FrameInfo; typedef struct PACKED { uint16_t service_id; uint16_t attribute_id; } ...
{ PBL_LOG(LOG_LEVEL_WARNING, "Service discovery response is invalid length: %"PRIu32, length); return false; }
// validate and mark the services as connected uint32_t i; uint16_t *services = data; bool has_valid_service = false; for (i = 0; i < length / sizeof(uint16_t); i++) { if ((services[i] > ReservedServiceMax) || (services[i] == ReservedServiceControl)) { has_valid_service = true; ...
mm_session_cleanup(); } // --------------------------------------------------------------------------------------- // Basic test for incoming calls over PP void test_phone_call__pp_incoming(void) { // We should only allow incoming calls when connected to the mobile app (this should never really // happen for PP) ...
(ANCS_UNUSED_UID)
; ASSERT_LAST_EVENT(PhoneEventType_Invalid); prv_call_hide(ANCS_CALL_UID); ASSERT_LAST_EVENT(PhoneEventType_Hide); }
---------------------------------------------------------------------- static void prv_start_connecting_if_needed(void) { if (s_current_role == GAPLERoleSlave) { return; } if (prv_has_intents_for_disconnected_devices()) { prv_start_connecting(); } } // --------------------------------------------------...
(request->device, true /* add */)
; } } } intent->client[c].is_used = true; intent->client[c].auto_reconnect = auto_reconnect; intent->client[c].is_pairing_required = is_pairing_required; intent->client[c].connected = false; // starting state if (!is_already_connected) { return BTErrnoOK; } if (is_pairing_required && !...
/gatt_service_changed.h" #include "comm/bt_lock.h" #include "kernel/events.h" #include <bluetooth/pebble_pairing_service.h> //! @see comment in gatt_client_subscriptions.c extern void gatt_client_subscriptions_handle_server_notification(GAPLEConnection *connection, ...
{ goto unlock; }
PebbleTaskBitset task_mask = gap_le_connect_task_mask_for_connection(connection); PebbleEvent e = { .type = PEBBLE_BLE_GATT_CLIENT_EVENT, .task_mask = task_mask, .bluetooth = { .le = { .gatt_client = { .subtype = PebbleBLEGATTClientEventTypeBufferEmpty, ...
dow->top_metric_layer); layer_deinit(&active_window->scrollable_metric_layer); layer_deinit(&active_window->base_layer); window_deinit(&active_window->window); i18n_free_all(active_window); app_free(active_window); } } //////////////////////////////////////////////////////////////////////////////...
layer_set_update_proc(&active_window->scrollable_metric_layer, prv_scrollable_layer_update_proc)
; layer_add_child(&active_window->base_layer, &active_window->scrollable_metric_layer); } StatusBarLayer *status_layer = &active_window->status_layer; status_bar_layer_init(status_layer); status_bar_layer_set_colors(status_layer, GColorClear, GColorBlack); layer_add_child(&window->layer, status_bar_layer...
cessory power %s", on?"on":"off"); s_power_enabled = on; gpio_output_set(&BOARD_CONFIG_ACCESSORY.power_en, on); } bool accessory_is_present(void) { accessory_set_power(true); gpio_input_init_pull_up_down(&BOARD_CONFIG_ACCESSORY.int_gpio, GPIO_PuPd_DOWN); // budget for a capacitance up to ~1uF and a resistanc...
prompt_send_response_fmt(buffer, sizeof(buffer), "FAILED: send timed-out")
; } else if (s_num_test_bytes == 0) { prompt_send_response_fmt(buffer, sizeof(buffer), "PASS!"); } else { prompt_send_response_fmt(buffer, sizeof(buffer), "FAILED: %"PRId32" bytes left!", s_num_test_bytes); } }
/* * 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 ((i >= 4) && (i <= 10) && ((i % 2) == 0)) { *buffer++ = '-'; } buffer += snprintf(buffer, 3, "%02"PRIx8, ((uint8_t *)uuid)[i]); }
*buffer++ = '}'; *buffer = '\0'; }
ith our test bit. If shorted, then we would // read 0 from the address bit which is shorted with the test one. // We only have to check shorts with higher address bits, since we've already checked for // shorts from the lower address bits to this one. uint8_t bitpos2 = bitpos+1; for (bit_offset = te...
if (status != FLASH_TEST_SUCCESS) { return status; }
// Keep going until DOWN button is pushed or iterations reached while(((iterations == 0) && enable_flash_test) || ((iterations > 0) && (iteration_count < iterations))) { // Confirm write took place - data should now be set to stress_data1 status = prv_read_verify_halfword(stress_addr1, stress_dat...
, { 952, 232, -96}, { 1152, 120, -144}, { 1280, 16, -96}, { 1256, 40, -488}, { 1320, 8, -312}, { 1440, 160, -216}, { 1208, 352, -304}, { 912, 360, -256}, { 760, 440, -280}, { 672, 480, -176}, { 728, 464, -208}, { 824, 416, -160}, { 832, 416, -208}, { 856, 488, -26...
{ 1360, 608, -384}, { 1232, 680, -392}, // 104 seconds { 1472, 584, -272}, { 1616, 440, -104}, { 1440, 328, -40}, { 1200, 296, 0}, { 1048, 296, 24}, { 944, 264, 56}, { 800, 168, 40}, { 704, 176, 96}, { 632, 208, 40}, { 696, 224, -24}, { 752, 224, -136}, { 776,...
{ 1064, 312, -96}, { 960, 280, -96}, { 840, 208, -104}, { 728, 136, -24}, { 560, 80, 8}, { 576, 136, -16}, { 808, 224, -184}, { 800, 144, -136}, { 952, 176, -232}, { 1184, 224, -192}, { 1352, 296, -208}, // 107 seconds { 1376, 368, -432}, { 1544, 408, -368}, ...
_writeback_timer(); cl_assert(id != BT_BONDING_ID_INVALID); // Delete the Pairing bt_persistent_storage_delete_ble_pairing_by_id(id); // Try to read it back ret = bt_persistent_storage_get_ble_pairing_by_id(id, &irk_out, &device_out, NULL); cl_assert(!ret); // Add the pairing again id = bt_persistent...
cl_assert_equal_m(&addr_3, &addr_out, sizeof(addr_out))
; cl_assert_equal_m(&link_key_3, &link_key_out, sizeof(link_key_out)); cl_assert_equal_s(name_3, name_out); cl_assert_equal_i(platform_bits_3, platform_bits_out); } void test_bluetooth_persistent_storage_prf__get_bt_classic_pairing_by_addr(void) { // Output variables SM128BitKey link_key_out; char name_out...
/* * 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_set_stroke_color(ctx, GColorBlack)
; graphics_context_set_antialiased(ctx, false); graphics_draw_circle(ctx, GPoint(14, -14), 12); } void test_graphics_draw_circle_${BIT_DEPTH_NAME}__origin_layer(void) { GContext ctx; Layer layer; test_graphics_context_init(&ctx, fb); layer_init(&layer, &GRect(0, 0, 28, 28)); layer_set_update_proc(&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...
(pref_key)
); void *prefs = task_zalloc(len); if (prefs) { rv = settings_file_get(&s_watch_app_prefs_db.settings_file, pref_key, strlen(pref_key), prefs, len); if (rv != S_SUCCESS) { task_free(prefs); prefs = NULL; } } prv_close_file_and_unlock_mutex(); return prefs; ...
}, { .filename_part = "quads_right", .mask = GCornersRight, }, { .filename_part = "quads_left", .mask = GCornersLeft, }, }; // note: not the prettiest, fast a quick way to render all the scenarios Nitin was interested in for (int i = 0; i < ARRAY_...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_swX_color.8bit.pbi"))
; } void test_graphics_draw_circle_8bit__zero_aa_swX_color(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // Draw red circles with different alpha values in the stroke color with antialiasing enabled setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 0); graphics_contex...
{ TimelineItem pin; if (S_SUCCESS != pin_db_get(&reminder->header.parent_id, &pin)) { return reminder->header.timestamp; } timeline_item_free_allocated_buffer(&pin); return pin.header.timestamp; } ////////////////////////////////////////// // Card Mode ////////////////////////////////////////// static ...
if (codepoint_is_emoji(codepoint)) { if (*emoji_codepoint) { // This has more than one emoji goto fail; } // Found an emoji *emoji_codepoint = codepoint; return true; }
// This is not an emoji-only string fail: *emoji_codepoint = NULL_CODEPOINT; return false; } T_STATIC ResourceId prv_get_emoji_icon_by_string(const EmojiEntry *table, const char *str) { if (!str) { return INVALID_RESOURCE; } Codepoint emoji_codepoint = NULL_CODEPOINT; utf8_each_codepoint(str, prv_ea...
12:00 PM", time_buf); // June 10th 2015, 23:59:59 (T-2DAY+11:59:59) rtc_set_time(jun10th_noon_2015 + (12 * SECONDS_PER_HOUR) - 1); clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("Fri, 12:00 PM", time_buf); // June 11th 2015, 00:00:00 (T-1DAY-12...
(event_time - (11 * SECONDS_PER_HOUR) + 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...
(inverter, &GRect(15, 15, 30, 30))
; scroll_layer_add_child(scroll_layer, &inverter->layer); layer_add_child(&window->layer, &scroll_layer->layer); } static void push_window(ScrollAppData *data) { Window *window = &data->window; window_init(window, WINDOW_NAME("Scroll Demo")); window_set_user_data(window, data); window_set_window_handlers(...
for (int i = 2; i <= CACHE_BUFFER_SIZE / (sizeof(CacheEntry) + sizeof(uint32_t)); ++i) { output = lru_cache_get(&s_cache, i); // check that the others are still around cl_assert(output); cl_assert(*output == i); }
}
Animation *e = prv_create_test_animation(); // Schedule them all animation_schedule(seq); animation_schedule(spawn); animation_schedule(e); // Verify count cl_assert_equal_i(prv_count_scheduled_animations(), 7); // Unschedule all animation_unschedule_all(); cl_assert_equal_i(prv_count_scheduled_...
// Play count cl_assert_equal_i(animation_get_play_count(h), 1); animation_set_play_count(h, 2); cl_assert_equal_i(animation_get_play_count(h), 2); cl_assert(animation_get_duration(h, true, true) == 2*(duration + delay)); // Curve cl_assert(animation_get_curve(h) == AnimationCurveDefault); animation_se...
cl_must_pass(animation_get_elapsed(h, &elapsed_ms)); cl_assert_equal_i(elapsed_ms, -delay); cl_assert_passert(animation_get_progress(h, &progress)); animation_set_elapsed(h, 0); cl_must_pass(animation_get_elapsed(h, &elapsed_ms)); cl_assert_equal_i(elapsed_ms, 0); cl_must_pass(animation_get_progress(h, &...
t: prv_handle_track_artist_update(update, value_length); return; case AMSTrackAttributeIDAlbum: prv_handle_track_album_update(update, value_length); return; case AMSTrackAttributeIDTitle: prv_handle_track_title_update(update, value_length); // ...
{ const AMSAnalyticsEvent event = is_entity_update_characteristic ? AMSAnalyticsEventErrorRegisterEntityWriteResponse : AMSAnalyticsEventErrorOtherWriteResponse; prv_analytics_log_event_with_info(event, error); }
if (!is_entity_update_characteristic) { // We only need to act upon getting a write response of the Entity Update characteristic. // Just ignore write responses for the Remote Command characteristic. return; } const AMSEntityID entity_id = s_ams_client->next_entity_to_register; if (has_error) { ...
emove_attr_list, AttributeIdTitle, i18n_get("Remove", &pin_attr_list)); const int num_actions = 3; TimelineItemActionGroup action_group = { .num_actions = num_actions, .actions = (TimelineItemAction[]) { { .id = 0, .type = TimelineItemActionTypeComplete, ...
MAX(buf_space_remaining - 2, 0)
; char tmp[date_time_len]; clock_get_friendly_date(tmp, date_time_len, data->timestamp); strncat(data->dialog_text, tmp, buf_space_remaining); buf_space_remaining = MAX(buf_space_remaining - strlen(tmp), 0); strncat(data->dialog_text, " ", buf_space_remaining); buf_space_remaining = MAX(buf_space_remainin...
parent_window_stack; WindowTransitioningContext *context = &window_stack->transition_context; if (context->animation) { // If we currently have an animation, run it to completion immediately before starting // another transition. // For 2.x apps, just unschedule the animation because there is no equiva...
(window_stack_from->removed_list_head, prv_filter_window_item_for_window, window)
; if (node != NULL) { list_remove(node, &window_stack_from->removed_list_head, NULL); } } WindowStackItem *item = NULL; if (window_stack_contains_window(window_stack_from, window)) { // If the item is on the list of window items, then we remove it as we're going to // re-insert it. item...
; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT ...
(LOG_LEVEL_INFO, "Recording")
; } static void prv_send_event(VoiceEventType event_type, VoiceStatus status, PebbleVoiceServiceEventData *data) { PebbleEvent event = { .type = PEBBLE_VOICE_SERVICE_EVENT, .voice_service = { .type = event_type, .status = status, .data = data, } }; event_p...
f TEST_INCLUDE_COMPLEX const int duration_a = 300; // This one will complete const int delay_a = 10; const int duration_b = 400; // This one will have 50 ms left on it const int delay_b = 20; const int duration_c = 350; const int delay_c = 230; const int duration_d = 220; // This one won't be ...
prv_clear_handler_histories()
, { 1008, 752, -328}, { 1472, 728, -312}, { 1424, 720, -296}, { 1528, 688, -232}, { 1768, 632, -128}, { 1536, 496, -160}, { 1160, 368, -128}, { 960, 312, -88}, { 832, 152, -56}, { 792, 136, -64}, { 800, 112, -40}, { 816, 104, -48}, { 928, -128, 48}, // 21 seconds ...
{ 800, 176, -48}, { 920, 136, -96}, { 872, 16, -8}, { 1040, 40, -80}, { 1296, 160, -72}, { 1424, 256, -240}, { 1504, 256, -232}, { 1392, 280, -224}, { 1080, 352, -336}, { 888, 464, -336}, { 800, 504, -152}, { 896, 640, -256}, { 1024, 760, -344}, { 1008, 792, -344}...
_MRM_MISSES_REG = 0x0; CACHE->CACHE_MRM_CTRL_REG = 0x0; CACHE->CACHE_MRM_TINT_REG = 0x0; CACHE->CACHE_MRM_THRES_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_TEST_0_REG, DCDC_OUTPUT_MONITOR, 0x0)
; REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_ANA_TEST, 0x0); REG_SETF(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, DCD...
touch_down_pos, uint64_t touch_down_time_ms, TouchPressure touch_down_pressure); // setup and teardown void test_touch__initialize(void) { fake_event_init(); touch_reset(); } void test_touch__cleanup(void) { } void prv_test_touch_event(TouchEvent *touch_event, TouchIdx idx, Tou...
(0, TouchState_FingerDown, GPointZero, 3686380, 0)
; touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400); PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT); cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable); TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv...
l5" }; int value_len = strlen(values[0]); // insert all keys for (int i = 0; i < ARRAY_LENGTH(keys); ++i) { blob_db_insert(BlobDBIdTest, (uint8_t *)keys[i], key_len, (uint8_t *)values[i], value_len); } // check the dirty list blob_db_get_dirty_dbs(ids, &num_ids); cl_assert_equal_i(num_ids, 1); dir...
(s_num_writebacks, s_num_until_timeout)
m_values = 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); } } // --------------------------------------------------------------------------...
{ offset_sec[i] = i * 2; }
for (unsigned i = 0; i < num_samples * num_values_per_sample; i++) { values[i] = i * 3; } // Create a session with an artifically small buffer size which will cause it to flush // automatically time_t start_time = rtc_get_time(); ProtobufLogConfig log_config = { .type = ProtobufLogType_Measurement...
/ 62 seconds { 904, 1672, -24}, { 392, 1192, -24}, { 120, 944, -16}, { -8, 744, 8}, { -64, 704, 24}, { -104, 720, 56}, { -88, 816, 96}, { -64, 800, 64}, { -40, 784, 16}, { 128, 920, 64}, { 456, 1520, 232}, { 976, 1976, 32}, { 1136, 1704, 64}, { 1032, 1344, -24}, ...
{ 400, 376, -152}, { 424, 248, -80}, { 536, 256, -264}, { 624, 336, -264}, { 864, 312, -288}, { 568, 1376, -416}, { 600, 2104, -768}, { 120, 2096, -864}, { -200, 1488, -472}, // 68 seconds { -176, 1088, -408}, { -232, 752, -256}, { -288, 536, -160}, { -336, 408, -...
{ 328, 1304, 16}, { 336, 920, -24}, { 232, 512, 40}, { 176, 376, 0}, { 256, 320, -80}, { 416, 368, -152}, { 552, 504, -176}, { 616, 528, -176}, { 648, 584, -296}, { 688, 1064, -192}, { 824, 1752, -368}, { 912, 1992, -648}, { 656, 1624, -424}, { 240, 1144, -248}, ...
; } } void test_ppogatt__retransmit_timed_out_data_packets_race_everything_acked_at_once(void) { test_ppogatt__open_session_when_found_pebble_app(); Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); // Get s_tx_window_size packets in flight: uint8_t sn = 0; for (; sn < s_tx_windo...
regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS)
ime_than_existing_not_inserted(void) { // Insert the first glance blob SerializedAppGlanceHeader app_glance_1 = (SerializedAppGlanceHeader) { .version = APP_GLANCE_DB_CURRENT_VERSION, .creation_time = 1464734484, // Tue, 31 May 2016 22:41:24 GMT }; const size_t glance_1_size = sizeof(app_glance_1); cl...
(APP_GLANCE_DB_SLICE_MAX_SIZE + 1)
, E_INVALID_ARGUMENT); } void test_app_glance_db__check_invalid_slice_total_sizes_blob_not_inserted(void) { cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, (uint8_t *)&s_app_glance_with_invalid_slice_total_sizes, ...
/* * 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...
shared_circular_buffer_read(&buffer, &client, 6, &out_buffer, &out_length)
cted_area.h" // Tests //////////////////////////////////// ///////////////////////////////// /// Generic matrix tests ///////////////////////////////// void test_graphics_gtransform_${BIT_DEPTH_NAME}__types_gtransformnumber(void) { GTransform t_c; // matrix to compare against GTransformNumber tn; int32_t test_...
(gtransform_is_only_translation(&t))
#include "fake_new_timer.h" // NOTE: This must match the definition of EventedTimer in kernel/services/evented_timer.c typedef struct EventedTimer { ListNode list_node; //! The TimerID type used for sys_timers is a non-repeating integer that we also use as our key for finding //! EventedTimers by id. Timer...
(sys_timer_id)
; // However, the timer should have been canceled in the evented_timer system, and we shouldn't see an event // be generated. cl_assert_equal_i(s_last_event.type, PEBBLE_NULL_EVENT); cl_assert(!s_times_callback_executed); } void test_evented_timer__cancel_during_app_event(void) { EventedTimerID timer = even...
amp_midnight == today_midnight) { switch (style) { case FullStyleLower12h: case FullStyleCapital12h: time_fmt = i18n_noop("%l:%M %p"); break; case FullStyleLower24h: case FullStyleCapital24h: time_fmt = i18n_noop("%R"); break; } } else if (timestamp_midn...
("In %lu minute")
; } else { str_fmt = i18n_noop("In %lu minutes"); } snprintf(buffer, buf_size, i18n_get(str_fmt, buffer), num_minutes); } else if (difference >= -(SECONDS_PER_HOUR * max_relative_hrs)) { const int num_hrs = prv_round(-difference, SECONDS_PER_HOUR, RoundTypeHalfDown) / SECONDS_PER_HOUR; ...
(1 << 8) = 43.2 = 43 (drop fraction) ==> 5.375 // -16 + 43 = 27 = 3.375 * (1 << 8) num1 = (Fixed_S16_3){ .raw_value = (int16_t)((float)-2.1 * (1 << FIXED_S16_3_PRECISION)) }; num2 = (Fixed_S16_3){ .raw_value = (int16_t)((float)5.4 * (1 << FIXED_S16_3_PRECISION)) }; sum = Fixed_S16_3_add(num1, num2); sum_c = ...
Fixed_S32_16_add(num1, num2)
; sum_c = (Fixed_S32_16){ .raw_value = (int32_t)((float)3 * (1 << FIXED_S32_16_PRECISION)) }; cl_assert(sum.raw_value == sum_c.raw_value); // sum = -2.1 + 5.4 = 3.3 // math is as follows: // -2.1 * (1 << 16) = -137625.6 = -137625 (drop fraction) // 5.4 * (1 << 16) = 353894.4 = 353894 (drop fraction) // -...
#include "util/size.h" #include "util/time/time.h" struct TimelineNode { ListNode node; int index; Uuid id; time_t timestamp; uint16_t duration; bool all_day; }; static uint32_t i18n_key; #define TIMELINE_FUTURE_WINDOW (3 * SECONDS_PER_DAY) #define TIMELINE_PAST_WINDOW (2 * SECONDS_PER_DAY) static bool...
{ break; }
current = (TimelineNode *)current->node.prev; } return current; } static TimelineNode *prv_find_first_future(TimelineNode *head, time_t timestamp, time_t today_midnight, bool show_all_day_events) { TimelineNode *current = head; while (current) { if (prv_show_event(current, timestamp, today_midnight,...
TODO: Use different tag ids for device_hb and app_hb sessions. // https://pebbletechnology.atlassian.net/browse/PBL-5463 const bool resume = false; DataLoggingSessionRef dls_session = dls_create( tag, DATA_LOGGING_BYTE_ARRAY, item_length, buffered, resume, &system_uuid); PBL_LOG(LOG_LEVEL_DEBUG, "%s HB ...
extern void analytics_stopwatches_update(uint64_t current_ticks); analytics_stopwatches_update(current_ticks); // Hijack the device_hb and app_hb heartbeats from analytics_storage. // After this point, we own the memory, so analytics_storage will not // modify it anymore. Thus, we do not need to ho...
// Launcher task callback used to create our event logging session. static void prv_create_event_session_cb(void *ignored) { if (!s_event_session) { s_event_session = prv_create_dls(ANALYTICS_BLOB_KIND_EVENT, sizeof(AnalyticsEventBlob)); // If the above call fails, it will schedule our timer to try again i...
/* * 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_equal_b(fake_mutex_all_unlocked(), false)
; mutex_unlock(mutex_2); cl_assert_equal_b(fake_mutex_all_unlocked(), false); mutex_unlock(mutex_1); cl_assert_equal_b(fake_mutex_all_unlocked(), 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...
if (s_custom_res_list.array_size <= s_custom_res_list.next_index) { // grow the list int new_size = (s_custom_res_list.array_size + 1) * 2; s_custom_res_list.custom_resources = realloc(s_custom_res_list.custom_resources, new_size); s_custom_res_list.array_size = new_size; }
get_info(PEBBLE_UNOBSTRUCTED_AREA_EVENT)->handler); cl_assert_equal_p(app_state_get_unobstructed_area_state()->handlers.did_change, prv_did_change); const GRect from_area = GRect(0, 0, DISP_COLS, 400); const GRect to_area = GRect(0, 0, DISP_COLS, 200); unobstructed_area_service_will_change(from_area.size.h, to...
cl_assert_equal_grect(unobstructed_bounds, GRect(110, 130, 140, 150))
; } void test_unobstructed_area_service__nested_layer_clip_nx_ny(void) { app_state_get_unobstructed_area_state()->area = GRect(0, 0, 400, 400); Layer root_layer = { .bounds = GRect(-150, -120, 10, 10), // The size of the parent layer has no affect }; Layer layer = { .bounds = GRect(-110, -130, 300, 290...
(void *) connection_id); } static bool prv_list_filter_for_addr(ListNode *found_node, void *data) { const BTDeviceAddress *addr = (const BTDeviceAddress *) data; const GAPLEConnection *connection = (const GAPLEConnection *) found_node; return bt_device_address_equal(&connection->device.address, addr);...
(connection->pairing_state)
; kernel_free(connection->device_name); kernel_free(connection->irk); kernel_free(connection); } void gap_le_connection_remove(const BTDeviceInternal *device) { bt_lock(); { GAPLEConnection *connection = prv_find_connection(device); // Verify that: // the reason we can't find a connection is be...
error_ref = JERRY_ERROR(ReferenceError, message_p, message_size); break; case JERRY_ERROR_SYNTAX: error_ref = JERRY_ERROR(SyntaxError, message_p, message_size); break; case JERRY_ERROR_TYPE: error_ref = JERRY_ERROR(TypeError, message_p, message_size); break; case JERRY_ER...
({ var obj = __jerryRefs.get($0); var name = __jerryRefs.get($1); return __jerryRefs.ref(obj[name]); }, obj_val, prop_name_val)
; } jerry_value_t jerry_get_property_by_index(const jerry_value_t obj_val, uint32_t index) { if (!jerry_value_is_object(obj_val)) { return TYPE_ERROR; } return (jerry_value_t)EM_ASM_INT({ var obj = __jerryRefs.get($0); return __jerryRefs.ref(obj[$1]); }, obj_val, index); } jerry_value_t jerr...
; } } iteration_count++; } PBL_LOG(LOG_LEVEL_DEBUG, "Ran %d iterations", iteration_count); PBL_LOG(LOG_LEVEL_DEBUG, ">PASS - STRESS TEST 1"); return FLASH_TEST_SUCCESS; } /***********************************************************/ /******************* Perf Data Test Functions **************/...
(LOG_LEVEL_DEBUG, ">>>>>PASS FLASH TEST CASE %d<<<<<", test_case_num)
; } else { PBL_LOG(LOG_LEVEL_DEBUG, ">>>>>FAIL FLASH TEST CASE %d, Status: %d<<<<<", test_case_num, status); } // Re-enable watchdog state if previously enabled if (previous_task_watchdog_state) { task_watchdog_bit_set(pebble_task_get_current()); task_watchdog_mask_set(pebble_task_get_current()...
S OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "pebble_pairing_service_impl.h" #include "connection.h" #include "hc_protocol/hc_endpoint_pebble_pairing_service.h" #include "system/logging.h" #include "syste...
if (e != BLE_STATUS_OK) { PBL_LOG(LOG_LEVEL_ERROR, "ble_gattc_get_mtu: %u", e); }
memcpy(response_buffer, &mtu, sizeof(mtu)); return sizeof(mtu); } static uint8_t prv_handle_conn_params_read(uint16_t conn_idx, uint8_t response_buffer[READ_RESPONSE_BUFFER_SIZE]) { Connection *connection = connection_by_idx_check(conn_idx); BleConnectionParams param...
timeline_action_menu->item; const TimelineItemAction *action = item->action_data; // Quickly make sure our TimelineItem is still (mostly) valid. It is shared with the notification // window's UI, and can be easily trampled if we aren't careful switch (pin->header.type) { case TimelineItemTypeNotification:...
prv_create_level(num_items, parent_level)
; emoji_level->display_mode = ActionMenuLevelDisplayModeThin; for (size_t i = 0; i < num_items; i++) { action_menu_level_add_action(emoji_level, short_strings[i], prv_action_menu_cb, action); } return emoji_level; } static void prv_handle_voice_transcription_result(Pebble...
" #include "applib/graphics/graphics_line.h" #include "applib/graphics/text.h" #include "applib/ui/window_stack.h" #include "kernel/ui/kernel_ui.h" #include "process_state/app_state/app_state.h" #include "services/common/clock.h" #include "syscall/syscall.h" #include "syscall/syscall_internal.h" #include "system/passer...
status_bar_layer_init(layer)
; } return layer; } void status_bar_layer_destroy(StatusBarLayer *status_bar_layer) { if (!status_bar_layer) { return; } status_bar_layer_deinit(status_bar_layer); applib_free(status_bar_layer); } void status_bar_layer_deinit(StatusBarLayer *status_bar_layer) { layer_deinit(&status_bar_layer->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...
(AlertMaskAllOn)
; } void test_alerts__cleanup(void) { } // Tests ///////////////////////////////// void test_alerts__enabled(void) { alerts_set_mask(AlertMaskAllOn); cl_assert(alerts_get_mask() == AlertMaskAllOn); // Should allow all notifications to go through cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_as...
X(total_duration_a, total_duration_b)); cl_assert_equal_i(animation_get_duration(spawn, true, true), duration_total); animation_destroy(spawn); #endif } // -------------------------------------------------------------------------------------- // Test unschedule all when we have multiple animations, some complex...
animation_get_duration(h, true, true)
== (duration + delay)); // Play count cl_assert_equal_i(animation_get_play_count(h), 1); animation_set_play_count(h, 2); cl_assert_equal_i(animation_get_play_count(h), 2); cl_assert(animation_get_duration(h, true, true) == 2*(duration + delay)); // Curve cl_assert(animation_get_curve(h) == AnimationCur...
/* * 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 (font == fonts_get_system_font(FONT_KEY_GOTHIC_36_BOLD)) { font_height = 22; } else if (font == fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)) { font_height = 18; } else if (font == fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)) { font_height = 14; }
ENED, &s_activity_prefs_health_app_opened, sizeof(s_activity_prefs_health_app_opened)); } } uint8_t activity_prefs_get_workout_app_opened_version(void) { return s_activity_prefs_workout_app_opened; } void activity_prefs_set_workout_app_opened_version(uint8_t version) { if (s_activity_prefs_work...
{ s_should_prompt_display_calibration = should_prompt; prv_pref_set(PREF_KEY_SHOULD_PROMPT_DISPLAY_CALIBRATION, &s_should_prompt_display_calibration, sizeof(s_should_prompt_display_calibration)); }
#endif #if CAPABILITY_HAS_TIMELINE_PEEK void timeline_prefs_set_settings_opened(uint8_t version) { prv_pref_set(PREF_KEY_TIMELINE_SETTINGS_OPENED, &version, sizeof(version)); } uint8_t timeline_prefs_get_settings_opened(void) { return s_timeline_settings_opened; } void timeline_peek_prefs_set_enabled(bool enabl...
, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2)); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_N...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 4)
; graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 4); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_R...
= 0x5, // TUPLE_UINT(8) SPORTS_HRM_KEY = 0x6, // TUPLE_UINT(8) SPORTS_CUSTOM_LABEL_KEY = 0x7, // TUPLE_CSTRING SPORTS_CUSTOM_VALUE_KEY = 0x8, // TUPLE_CSTRING }; enum { STATE_INIT_VALUE = 0x00, STATE_RUNNING_VALUE = 0x01, STATE_PAUSED_VALUE = 0x02, STATE_END_VALUE = 0x03, }; ...
{ strncpy(data->custom_label_string, new_tuple->value->cstring, sizeof(data->custom_label_string)); prv_update_scrollable_metrics(data); }
break; } case SPORTS_CUSTOM_VALUE_KEY: { if (strncmp(new_tuple->value->cstring, data->custom_value_string, sizeof(data->custom_value_string)) != 0) { strncpy(data->custom_value_string, new_tuple->value->cstring, sizeof(...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return s_should_prompt_display_calibration; }
void shell_prefs_set_should_prompt_display_calibration(bool should_prompt) { s_should_prompt_display_calibration = should_prompt; } bool gpoint_equal(const GPoint * const point_a, const GPoint * const point_b) { return (point_a->x == point_b->x && point_a->y == point_b->y); } void launcher_task_add_callback(Callba...
/* * 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...
(r->subscriber.event, dummy)
; cl_assert_equal_p(r->subscriber.data, &sub_data); cl_assert_equal_i(r->state, RecognizerState_Possible); cl_assert_equal_i(r->flags, 0); cl_assert_equal_p(r->simultaneous_with_cb, NULL); cl_assert_equal_p(r->fail_after, NULL); cl_assert_passert(recognizer_create_with_data(NULL, &s_test_impl_data, ...
current_day) { // first day of multiday event or only day prv_copy_relative_time_string(number_buffer, number_buffer_size, word_buffer, word_buffer_size, timestamp, end_time); } else if (time_util_get_midnight_of(end_time) == current_day) { // last day of multiday event prv_copy_relative_time...
("Today", buffer, buf_size)