prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
{ case 1: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 2: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 3: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; case 4: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETE...
return false; } static bool prv_check_for_recovery_start_failure() { return boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS); } static bool prv_check_for_fw_start_failure() { // Add more failure conditions here. if (!watchdog_check_reset_flag() && !boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) { /...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ s_popup_occurred = true; }
bounds->size.w, bounds->size.h), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } static void prv_display_saving_message(Layer *layer, GContext *ctx) { AppData *data = app_state_get_user_data(); const GRect *bounds = &data->window.layer.bounds; graphics_context_set_text_color(ct...
(&app_data->window.layer)
; } static void prv_save_offsets_callback(void *data) { AppData *app_data = app_state_get_user_data(); mfg_info_set_disp_offsets((GPoint) { .x = app_data->axis_offsets[X_AdjustState], .y = app_data->axis_offsets[Y_AdjustState] }); app_window_stack_pop_all(false); } static void prv_back_click_handler...
s_origin) { prv_bitmap_layer_test(GPointZero, bounds_origin); } static void prv_offset_bitmap_layer_test(GPoint bounds_origin) { prv_bitmap_layer_test(TEST_LAYER_OFFSET_ORIGIN, bounds_origin); } // Composite Test Support //////////////////////////////////// static GBitmap *prv_create_bitmap_from_png_file(const c...
{ GRect destination = bitmap->bounds; destination.origin = gpoint_add(destination.origin, offset); graphics_context_set_compositing_mode(ctx, GCompOpAssign); graphics_draw_bitmap_in_rect(ctx, bitmap, &destination); destination.origin = gpoint_add(destination.origin, GPoint(COMPOSITE_TEST_OFFSET_X, ...
static void prv_composite_test(const char *unit_test_name, GCompOp compositing_mode) { for (size_t i = 0; i < ARRAY_LENGTH(s_composite_tests); i++) { const CompositeTest *test_data = &s_composite_tests[i]; // Skip invalid GBitmapFormat and GCompOp combinations if (!prv_gbitmap_format_and_compositing_mo...
(StringList *)*buffer; notif_attr->string_list->serialized_byte_length = MIN((uint16_t)MAX_LENGTH_CANNED_RESPONSES, attribute->length); uint16_t data_length = notif_attr->string_list->serialized_byte_length + (uint16_t)sizeof(char); // terminator after last string *buffer += sizeo...
PBL_ASSERTN(attr_list != NULL)
quested_resource_the_default_icon && !prv_app_resource_info_equal(&generic_glance->displayed_icon_resource_info, &generic_glance->default_icon_resource_info)); const bool is_icon_stale = (!prv_app_resource_info_equal(&generic_glance->displayed_icon_resource_info, res_i...
rtc_get_time()
; // On the off chance that we missed the reeval, immediately call the timer callback if (time_until_next_reeval <= 0) { prv_subtitle_reeval_timer_cb(structured_glance); return; } const uint64_t time_until_next_reeval_ms = (uint64_t)time_until_next_reeval * MS_PER_SECOND; if (time_until_next_reeval_m...
{ -432, 152, -152}, { -400, 232, -136}, { -448, 328, -112}, { -584, 520, 0}, // 34 seconds { -648, 336, -32}, { -792, 488, -80}, { -1032, 656, -192}, { -1088, 432, -88}, { -1440, 872, -280}, { -1376, 240, -32}, { -1256, 592, -168}, { -1168, 496, -152}, { -1136, 39...
{ -880, 520, -224}, { -1096, 440, -24}, { -1296, 592, -376}, { -1264, 512, -136}, { -1144, 624, -232}, { -1176, 520, -200}, { -1008, 392, -176}, { -712, 296, -104}, { -544, 264, -96}, { -456, 248, 0}, { -432, 232, -32}, { -472, 240, 8}, { -568, 320, 0}, // 37 sec...
nMenuLevel *emoji_level = 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...
if (!prv_is_reply_option_supported(reply, action)) { continue; }
responses_level->items[item] = reply_options[reply]; // fill with the non-leaves with next level if (!reply_options[reply].is_leaf) { responses_level->items[item].next_level = level_getters[reply](responses_level, action, root_level); } item++; } return responses_level; } stat...
c_get_ticks(); return; } // ================================================================================= static void stuck_timer_callback(void* data) { PBL_LOG(LOG_LEVEL_DEBUG, "STT entering infinite loop in callback"); while (true) { psleep(100); } } // ============================================...
psleep(300)
; PBL_ASSERTN(s_app_data->fired_time[timer_idx_0] != 0); scheduled = new_timer_scheduled(s_app_data->timer[timer_idx_0], &expire_ms); PBL_ASSERTN(!scheduled); } // ================================================================================= void repeating_timer_menu_cb(int index, void *ctx) { uint32_t ex...
s_sys_activity_get_sessions_values.out.num_sessions = 7; health_service_activities_iterate(HealthActivityRun | HealthActivityWalk | HealthActivityOpenWorkout, now - (100 * SECONDS_PER_MINUTE), now, HealthIterat...
prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 10}, &(ActivitySession) {.start_utc = now - (2 * SECONDS_PER_MINUTE), .length_min = 5}, HealthIterationDirectionFuture)
); // both end at the same time cl_assert(0 == prv_session_compare( &(ActivitySession) {.start_utc = now, .length_min = 10}, &(ActivitySession) {.start_utc = now + (5 * SECONDS_PER_MINUTE), .length_min = 5}, HealthIterationDirectionPast)); // a ends later cl_assert(0 > prv_session_compare( &(A...
_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr_zone)); cl_assert_equal_i(bpm, 100); // Put an OffWrist reading. Verify we received it. prv_put_bpm_event(50, HRMQuality_OffWrist); cl_assert(workout_service_get_current_workout_info(&steps, &...
(s_hrm_expiration, 0)
CAPABILITY_HAS_CORE_NAVIGATION4 cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[2].header.id)); cl_assert(iter_next(&iterator)); #endif cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[3].header.id)); cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[...
(uuid_equal(&state.pin.header.id, &s_all_day_items[1].header.id) || 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.p...
cl_assert_equal_i(4 * basic_cell_height, l.selection.y); menu_layer_set_selected_next(&l, false, MenuRowAlignNone, false); cl_assert_equal_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); me...
{ l = l->next_sibling; result++; }
/* * 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...
(fmt_args, packed_loghash)
; pbl_log_hashed_vargs(false, CORE_NUMBER, packed_loghash, fmt_args); va_end(fmt_args); trigger_fault(RebootReasonCode_Assert, saved_lr); } NORETURN passert_failed_hashed_with_lr(uint32_t lr, uint32_t packed_loghash, ...) { PBL_LOG(LOG_LEVEL_ALWAYS, "ASSERTION at LR 0x%"PRIx32, lr); va_list fmt_args; v...
s[i]; break; } } if (test == NULL) { clar_print_onabort("No test named '%s'.\n", argument); exit(-1); } _clar.active_suite = suite->name; _clar.suite_errors = 0; _clar.active_test = test->name; clar_run_test(test, &suite->initialize, &suite->...
(buf, 128, "%f != %f", d1, d2)
; clar__assert(0, file, line, err, buf, should_abort); } } void clar__assert_within( int n, int min, int max, const char *file, int line, const char *err, int should_abort) { if (!CL_WITHIN(n, min, max)) { char buf[256]; snprint_eq(buf, 256, "%d not within [%d, %d]", n, min, max); cla...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (!BOARD_CONFIG_BUTTON.button_com.gpio) { // This board doesn't use a button common pin. return; }
// Configure BUTTON_COM to drive low. When the button // is pressed this pin will be connected to the pin for the // button. gpio_use(BOARD_CONFIG_BUTTON.button_com.gpio); GPIO_InitTypeDef GPIO_InitStructure; GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = BOARD_CONFIG_BUTTON.butto...
_format == GBitmapFormat8BitCircular)) { GColor8 *const destination_pixel = (GColor8 *)(row_data + x); *destination_pixel = color; } else { WTF; // Unsupported destination type } } bool gbitmap_sequence_update_bitmap_next_frame(GBitmapSequence *bitmap_sequence, ...
{ memset(row_info.data + min_x, 0, num_bytes); }
} } apng_fctl fctl = {0}; // Defaults work for IDAT frame without fctl data // If this frame doesn't have fctl, use the full width & height if (!upng_get_apng_fctl(upng, &fctl)) { fctl.width = width; fctl.height = height; // As a PNG image is only a single frame, display it forever bitmap...
case GBitmapFormat1BitPalette: case GBitmapFormat2BitPalette: case GBitmapFormat4BitPalette: return ((width * gbitmap_get_bits_per_pixel(format) + 7) / 8); // byte aligned case GBitmapFormat8BitCircular: return 0; // variable width } return 0; } static GBitmap* prv_allocate_gbitmap(void) {...
if (bitmap) { gbitmap_init_with_data(bitmap, data); }
return bitmap; } void gbitmap_init_as_sub_bitmap(GBitmap *sub_bitmap, const GBitmap *base_bitmap, GRect sub_rect) { if (gbitmap_get_version(base_bitmap) == GBITMAP_VERSION_0) { GBitmapLegacy2 *legacy_bitmap = (GBitmapLegacy2 *) sub_bitmap; *legacy_bitmap = *(GBitmapLegacy2 *) base_bitmap; // it's the ...
/* * 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...
{ mutex_unlock_recursive(s_resource_mutex); *entry = ((CachedResource *)node)->stored_resource; return; }
te_stats(&weekday_stats, value); } prv_update_stats(&daily_stats, value); } // ---------------------------------------- // Compute each combination of agg/stat and compare to expected for (HealthAggregation agg = HealthAggregationSum; agg <= HealthAggregationMax; agg++) { for (HealthServiceTimeSco...
MAX(max_value, value)
; sum += value; count++; s_sys_activity_get_minute_history_values.out[0].records[i].heart_rate_bpm = value; value++; if (value > 200) { value = 50; } } for (unsigned i = 0; i < num_minutes_per_call; i++) { min_value = MIN(min_value, value); max_value = MAX(max_value, value); ...
red activities not found or incompatible"); return; } // Read in the stored activities status_t result = settings_file_get(file, &key, sizeof(key), state->activity_sessions, sizeof(state->activity_sessions)); if (result != S_SUCCESS) { return; } // Scan to see...
(bool, sys_activity_sessions_is_session_type_ongoing, ActivitySessionType type)
{ return activity_sessions_is_session_type_ongoing(type); }
bool with_fulltime) { time_t difference = rtc_get_time() - timestamp; time_t today_midnight = time_util_get_midnight_of(rtc_get_time()); time_t timestamp_midnight = time_util_get_midnight_of(timestamp); if (today_midnight != timestamp_midnight) { prv_clock_get_fu...
prv_clock_get_month_named_date(buffer, buffer_size, timestamp, abbrev)
; } void clock_get_since_time(char *buffer, int buf_size, time_t timestamp) { const time_t now = rtc_get_time(); const time_t clamped_timestamp = MIN(now, timestamp); prv_clock_get_relative_time_string(buffer, buf_size, clamped_timestamp, false, HOURS_PER_DAY, true); } void ...
ogging.h" #include "system/passert.h" #include "util/circular_cache.h" #include "util/size.h" #include <os/mutex.h> #include <util/attributes.h> typedef struct PACKED RecentApp { AppInstallId id; time_t last_activity; bool can_expire; } RecentApp; // The number of applications to store in the circular cache. /...
circular_cache_get(&s_recent_apps.cache, &install_id)
; if (app) { app->last_activity = cur_time; app->can_expire = can_expire; } else { RecentApp app = { .id = install_id, .last_activity = cur_time, .can_expire = can_expire, }; circular_cache_push(&s_recent_apps.cache, &app); } } mutex_unlock_recursive...
/* * 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...
(bmp_width / 2, bmp_height / 2)
; image->dest_ic = GPoint(layer_size / 2, layer_size / 2); image->rotation = 0; image->corner_clip_color = GColorClear; image->compositing_mode = GCompOpAssign; layer_mark_dirty(&(image->layer)); } RotBitmapLayer* rot_bitmap_layer_create(GBitmap *bitmap) { RotBitmapLayer* layer = applib_type_malloc(RotBi...
/* * 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...
{ actl_chunk_found = true; }
if (seek_framedata) { if (marker.chunk_type == CHUNK_FDAT || marker.chunk_type == CHUNK_IDAT) { if (found_actl) { *found_actl = actl_chunk_found; } // current distance + data_length + chunk_parts return (current_offset - offset + marker.length + CHUNK_META_SIZE); ...
dst = src * (alpha_normalized) + dst * (1 - alpha_normalized) static ALWAYS_INLINE void prv_gbitmap_sequence_blend_over(GColor8 src_color, GColor8 *dst) { if (src_color.a == 3) { // Fast path: 100% opacity *dst = src_color; } else if (src_color.a == 0) { // Fast path: 0% opacity, no-op! } else { const GCo...
{ if (bitmap_sequence) { upng_destroy(bitmap_sequence->png_decoder_data.upng, true); applib_free(bitmap_sequence->png_decoder_data.palette); applib_free(bitmap_sequence); } }
static ALWAYS_INLINE GColor8 *prv_target_pixel_addr(GBitmap *bitmap, apng_fctl *fctl, uint32_t x, uint32_t y) { uint32_t offset = (fctl->y_offset + y + bitmap->bounds.origin.y) * bitmap->row_size_bytes + (fctl->x_offset + x + bitmap->bounds.origin.x); GCol...
dler_entries(&s_started_handler_calls, b), 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 1); // --------------------------...
(&s_stopped_handler_calls, b)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 0); // Execute to the end of B & C prv_advance_to_ms_with_timers(start_ms + duration_total + 1 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_...
Need to convert offsets to bytes for the horizontal dimensions x_offset = prv_round_to_byte(x_offset); width = prv_round_to_byte(width); for (unsigned i = 0; i < height; i++) { memcpy(buffer[i + y_offset] + x_offset, bitmap + i * width, width); } } static void prv_display_buffer(uint8_t buffer[DISP_ROWS][...
{ prv_enable_display_spi_clock(); prv_display_start(); prv_disable_display_spi_clock(); }
wing_box_x; } void status_bar_layer_init(StatusBarLayer *status_bar_layer) { PBL_ASSERTN(status_bar_layer); *status_bar_layer = (StatusBarLayer){ .previous_min_of_day = -1, }; // The status bar needs to be as wide as the framebuffer we will render it into, which may be less // wide than the display e.g....
(status_bar_layer)
; return status_bar_layer->config.title_text_buffer; } void status_bar_layer_reset_title(void *cb_data) { StatusBarLayer *status_bar_layer = (StatusBarLayer *)cb_data; // set title text mode to 'clock', update text, and setup timer to allow clock text to update status_bar_layer->config.mode = StatusBarLayerMod...
// The bottom half is a diagonal orange line over blue. // The left half is semi-transparent and the right half is completely opaque // - Dest is 100x100, white. // Result: // - The top right half will be alternating between dithered gray and black lines // The bottom right half consists of a diagonal ...
cl_assert_equal_i(color.argb, tinted_color.argb)
; tinted_color.a = 2; color.a = 2; prv_apply_tint_color(&color, GColorRed); cl_assert_equal_i(color.argb, tinted_color.argb); tinted_color.a = 1; color.a = 1; prv_apply_tint_color(&color, GColorRed); cl_assert_equal_i(color.argb, tinted_color.argb); }
_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_string(number_buffer, number_buffer_size, word_buffer, word_buffer_size, end_time, end_time); } else { ...
("Yesterday", buffer, buf_size)
; } else if (midnight == (today_midnight + SECONDS_PER_DAY)) { i18n_get_with_buffer("Tomorrow", buffer, buf_size); } else if (midnight <= (today_midnight + (5 * SECONDS_PER_DAY))) { // Use weekday name up to 5 days in the future, aka "Sunday" prv_format_time(buffer, buf_size, i18n_noop("%A"), timestamp)...
-280, -496, -808}, { -408, -472, -896}, { -480, -520, -1048}, { -392, -480, -1232}, { -448, -528, -1256}, { -272, -448, -1360}, { -304, -248, -1168}, { -288, -96, -1160}, { -40, -240, -928}, { -24, -216, -728}, { -48, -360, -528}, { -16, -232, -448}, { 80, -40, -432}, ...
{ 936, -600, 64}, { 648, -288, -192}, { 1048, -16, -352}, { 1592, -136, -24}, { 1496, 440, -240}, { 1288, 184, -320}, { 1360, 328, -192}, { 1568, 536, -128}, { 1528, 856, -216}, { 1304, 744, -224}, { 1144, 912, -328}, { 864, 1120, -376}, { 736, 920, -280}, // 21 s...
{ 1584, 544, -56}, { 1440, 384, -88}, { 1480, 368, -120}, { 1656, 344, -88}, { 1688, 240, -48}, { 1576, 264, -80}, { 1576, 224, -112}, { 880, -768, 8}, { 944, -424, -40}, { 664, -496, -104}, { 1056, 88, -256}, { 1480, 8, -72}, { 1384, 448, -328}, { 1336, 192, -25...
/* * 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_passert(recognizer_create_with_data(&s_test_impl, NULL, sizeof(s_test_impl_data), dummy, NULL))
; cl_assert_passert(recognizer_create_with_data(&s_test_impl, &s_test_impl_data, 0, dummy, NULL)); cl_assert_equal_p(NULL, recognizer_create_with_data(&s_test_impl, &s_test_impl_data, sizeof(s_test_impl_data), NULL...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
accessory_send_stream_stop()
; // release the accessory port PBL_ASSERTN(accessory_manager_set_state(AccessoryInputStateIdle)); } static void prv_monitor_timer_cb(void *context); static void prv_monitor_system_task_cb(void *context) { static uint32_t s_monitor_interval = 0; PBL_ASSERT_TASK(PebbleTask_KernelBackground); smartstrap_state...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_LOG(LOG_LEVEL_WARNING, "Test only works on 64k aligned regions")
; return (false); } const uint32_t block_size = 64 * 1024; const 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_siz...
use_button(WorkoutActiveWindow *active_window) { bool can_stop = active_window->workout_controller->stop != NULL; if (can_stop || active_window->num_scrollable_metrics > 1) { active_window->pause_button = BUTTON_ID_UP; } else { active_window->pause_button = BUTTON_ID_SELECT; } } T_STATIC void prv_cycle...
(&active_window->base_layer, &active_window->top_metric_layer)
; GRect scrollable_metric_bounds = top_metric_bounds; scrollable_metric_bounds.origin.y = scrollable_metric_bounds.size.h; scrollable_metric_bounds.size.h = window->layer.bounds.size.h - scrollable_metric_bounds.origin.y; layer_init(&active_window->scrollable_metri...
y_picker_window); return; } menu_layer_deinit(&data->custom_day_picker_menu_layer); prv_remove_windows(data); i18n_free_all(&data->custom_day_picker_window); } static void prv_handle_custom_day_selection(int index, void *callback_context) { AlarmEditorData *data = (AlarmEditorData *)callback_context; ...
{ return DAYS_PER_WEEK + 1; }
static int16_t prv_custom_day_picker_get_cell_height(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) { return ALARM_DAY_LIST_CELL_HEIGHT; } static void prv_custom_day_picker_draw_r...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&data->window, "Event Service Demo")
; app_window_stack_push(&data->window, true /* Animated */); // Init text layer Layer *windowlayer = &data->window.layer; const int16_t width = windowlayer->bounds.size.w - ACTION_BAR_WIDTH - 6; text_layer_init(&data->count_layer, &GRect(0, 0, width, 20)); layer_add_child(&data->window.layer, &data->count_...
, { 1008, 392, -72}, { 1232, 456, -136}, { 1376, 472, -120}, { 1792, 448, -40}, { 1456, 520, -48}, { 1040, 464, -64}, { 1216, 360, -32}, { 1328, 336, 32}, { 1160, 280, 88}, { 928, 240, 88}, { 816, 272, 48}, { 792, 232, 80}, { 824, 232, 104}, { 824, 160, 128}, ...
{ 1104, 336, -88}, { 1408, 424, -120}, { 1600, 352, 40}, { 1768, 488, -16}, { 1304, 488, -56}, // 68 seconds { 1200, 336, 8}, { 1280, 280, 32}, { 1288, 264, 80}, { 1048, 176, 128}, { 896, 200, 120}, { 832, 224, 104}, { 776, 136, 136}, { 760, 152, 128}, { 712, ...
{ 832, 136, 96}, { 840, 112, 96}, { 904, 96, 80}, { 1032, 104, 56}, { 1400, 64, 72}, { 1488, 304, -160}, { 1200, 392, -328}, { 1352, 344, -296}, { 1376, 344, -128}, { 1168, 184, 24}, { 864, 232, -32}, // 71 seconds { 728, 288, -88}, { 688, 272, -40}, { 768, 3...
HRMSubscriberCallback callback, void *context) { if (!s_hrm_present) { return HRM_INVALID_SESSION_REF; } const PebbleTask current_task = pebble_task_get_current(); bool is_app_subscription = false; if (current_task == PebbleTask_KernelBackground) { // KernelBG must provide a callback PBL...
mutex_unlock_recursive(s_manager_state.lock)
; return (state != NULL); } DEFINE_SYSCALL(bool, sys_hrm_manager_set_features, HRMSessionRef session, HRMFeature features) { bool success = false; mutex_lock_recursive(s_manager_state.lock); HRMSubscriberState *state = prv_get_subscriber_state_from_ref(session); if (state) { state->features = features; ...
{ 0, 0x47, 846, 232}, { 0, 0x47, 2292, 227}, { 0, 0x66, 1016, 235}, { 0, 0x36, 2111, 207}, { 0, 0x46, 2631, 237}, { 0, 0x64, 576, 239}, { 0, 0x56, 1254, 238}, { 0, 0x47, 2596, 235}, { 12, 0x47, 1787, 237}, { 37, 0x47, 3333, 238}, { 12, 0x57, 3288, 234}, { 0, 0x58, 999, 232}, ...
{ 0, 0x27, 1421, 183}, { 0, 0x16, 227, 180}, { 0, 0x36, 4429, 197}, { 0, 0x45, 5098, 181}, { 0, 0x35, 1354, 197}, { 0, 0x44, 2421, 167}, // 255: Local time: 11:44:00 AM { 0, 0x44, 3054, 196}, { 8, 0x42, 1734, 184}, { 0, 0x43, 1044, 174}, { 0, 0x41, 0, 177}, { 0, 0x44, 204...
{ 0, 0x48, 511, 192}, { 0, 0x47, 992, 207}, { 0, 0x46, 1805, 197}, { 8, 0x57, 5212, 198}, { 0, 0x57, 1827, 200}, { 0, 0x48, 1152, 202}, { 38, 0x54, 2971, 199}, { 0, 0x6c, 2274, 202}, { 8, 0x57, 1837, 202}, { 0, 0x59, 1713, 201}, { 0, 0x5a, 495, 190}, { 0, 0x5a, 1610, 199...
/* * 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 (reschedule) { reschedule_ack_timeout(); }
} static void send_timeout_msg(void *session_id_param) { uint8_t session_id = (uint8_t)(uintptr_t)session_id_param; CommSession *session = comm_session_get_system_session(); if (!session) { // timed out because of lost connection return; } DataLoggingSession *logging_session = dls_list_find_by_sess...
eLarge); const bool use_status_bar = true; const bool use_simple_dialog = simple_dialog_does_text_fit(msg, DISP_FRAME.size, simple_dialog_icon_size, use_status_bar); SimpleDialog *simple_dial...
{ const bool success = false; prv_cleanup_action_result(data, success); return; }
progress_window_init(data->progress_window); const int16_t max_fake_percent = 80; progress_window_set_max_fake_progress(data->progress_window, max_fake_percent); progress_window_set_callbacks(data->progress_window, (ProgressWindowCallbacks) { .finished = prv_progress_window_finished, }, data); progress...
caller_id_font = NULL; int lines = 1; if (is_phone_number) { phone_format_phone_number(caller_text, s_phone_ui_data->caller_id_text_buf, NAME_BUFFER_LENGTH); text_layer_set_overflow_mode(&s_phone_ui_data->caller_id_text_layer, GTextOverflowModeWordWrap); } else { phone_format_caller_name(caller_text, ...
GPoint(0, DURATION_ANIMATION_START_OFFSET)
, &GPoint(0, -BOUNCEBACK_DISTANCE))); animation_set_curve(upward, AnimationCurveEaseIn); animation_set_duration(upward, DURATION_APPEAR_ANIMATION_FRAMES * ANIMATION_FRAME_MS); Animation *bounceback = property_animation_get_animation( property_animation_create_b...
itle_buffer, artist_buffer, NULL); if (music_needs_user_to_start_playback_on_phone()) { prv_push_no_music_window(data); } else { prv_pop_no_music_window(data); } bool title_changed = strncmp(data->title_buffer, title_buffer, MUSIC_BUFFER_LENGTH) != 0; bool artist_changed = strncmp(data->artist_buffe...
{ MusicAppData *data = window_get_user_data(window); window_set_background_color(window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite)); const GSize WINDOW_SIZE = window->layer.bounds.size; const GTextAlignment ARTIST_TITLE_TEXT_ALIGNMENT = PBL_IF_RECT_ELSE(GTextAlignmentLeft, ...
dius, y0), radius + 1); } prv_fill_horizontal_line(ctx, GPoint(x0 - x, y0 + y), x + 1); prv_fill_horizontal_line(ctx, GPoint(x0 - y, y0 + x), y + 1); } if (quadrant & GCornerBottomRight) { if (x == 1) { prv_fill_horizontal_line(ctx, GPoint(x0, y0), radius + 1); } prv...
graphics_private_draw_horizontal_line(ctx, y, (Fixed_S16_3){.raw_value = starting_edge}, (Fixed_S16_3){.raw_value = right - FIXED_S16_3_ONE.raw_value})
; } } else { starting_edge = (MAX(left, starting_edge)); ending_edge = (MIN(right, ending_edge)); if (starting_edge <= ending_edge) { graphics_private_draw_horizontal_line(ctx, y, (Fixed_S16_3){.raw_value = starting_edge}, ...
f (expandable_dialog->action_bar_background_color.a != 0) { action_bar_layer_set_background_color(action_bar, expandable_dialog->action_bar_background_color); } if (expandable_dialog->select_icon) { action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_...
fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)
, }; dialog_init(&expandable_dialog->dialog, dialog_name); Window *window = &expandable_dialog->dialog.window; window_set_window_handlers(window, &(WindowHandlers) { .load = prv_expandable_dialog_load, .unload = prv_expandable_dialog_unload, .appear = prv_expandable_dialog_appear, }); expandabl...
&health_data->typical_sleep); activity_get_metric(ActivityMetricSleepRestfulSeconds, 1, &health_data->deep_sleep); activity_get_metric(ActivityMetricSleepEnterAtSeconds, 1, &health_data->sleep_start); activity_get_metric(ActivityMetricSleepExitAtSeconds, 1, &health_data->sleep_end); activity_g...
{ if (health_data->step_averages.average[i] != ACTIVITY_METRIC_AVERAGES_UNKNOWN) { total_steps_avg += health_data->step_averages.average[i]; } }
return total_steps_avg; } int32_t health_data_steps_get_current_average(HealthData *health_data) { // get the current minutes into today time_t utc_sec = rtc_get_time(); struct tm local_tm; localtime_r(&utc_sec, &local_tm); int32_t today_min = local_tm.tm_hour * MINUTES_PER_HOUR + local_tm.tm_min; const...
ame_size.h; } else if (render_icon && (icon_align == GAlignLeft)) { // Let the icon extend the container height if it's taller than the title/subtitle combo container_height = MAX(icon_frame_size.h, container_height); } GRect container_rect = (GRect) { .size = GSize(cell_layer_bounds_size.w, container_hei...
(ctx, config->title, title_font, rect, config->overflow_mode, text_alignment, NULL)
; // Add back the cap offset so functions that use the returned title text frame can position // themselves using the actual frame rect.origin.y += cap_offsets_to_apply; return rect; } static ALWAYS_INLINE void prv_menu_cell_basic_draw_custom_two_columns_round( GContext *ctx, const GRect *cell_layer_bounds...
eed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "graphics_private_raw_mask.h...
prv_update_mask(ctx, y, x1.integer, x2.integer, color)
; // increment the last_pixel since we had some middle pixels last_pixel_x++; // x1 doesn't need to be increased as it's not used anymore in this function } // last pixel with blending (don't render first *and* last pixel if line length is 1) if (x2.fraction != 0) { prv_blend_color_and_update_mas...
some client fallout though, so tackle this later. .is_subsector = is_subsector, .address = is_subsector? flash_impl_get_subsector_base_address(addr) : flash_impl_get_sector_base_address(addr), .on_complete_cb = on_complete_cb, .cb_context = context, .expected_duration = is...
(sector_addr, on_complete_cb, context, is_subsector, 0)
; if (remaining_ms) { // Start timer that will periodically check for the erase to complete new_timer_start(s_erase_poll_timer, remaining_ms, prv_flash_erase_timer_cb, NULL, 0); } } static void prv_blocking_erase_complete(void *context, status_t status) { PBL_ASSERT(PASSED(status), "Flash erase failure: ...
or(void *a, void *b) { return ((TestCacheItem *)a)->id - ((TestCacheItem *)b)->id; } // setup and teardown void test_circular_cache__initialize(void) { memset(s_cache_buffer, 0, sizeof(s_cache_buffer)); circular_cache_init(&s_test_cache, (uint8_t *)s_cache_buffer, sizeof(TestCacheItem), NUM...
circular_cache_flush(&s_test_cache)
; cl_assert(*s_test_item[0].freed); cl_assert(!(*s_test_item[1].freed)); cl_assert(!(*s_test_item[2].freed)); memset(s_cache_buffer, 0, sizeof(s_cache_buffer)); *s_test_item[0].freed = false; circular_cache_push(&s_test_cache, &s_test_item[0]); circular_cache_push(&s_test_cache, &s_test_item[1]); circ...
); return accel_get_sampling_interval(); } static void prv_configure_operating_mode(void) { BMA255SampleInterval interval_us = accel_get_sampling_interval(); const uint8_t odr = (uint8_t)prv_get_odr(interval_us); const uint8_t bw = s_odr_settings[odr].bw; const uint8_t tsleep = s_odr_settings[odr].tsleep; ...
("Setting num samples to: %"PRIu32, num_samples)
; // Note that with the bma255, we do not want to use Bypass mode when // collecting a single sample as this will result in uneven sampling. // The accelerometer will wake up, provide several samples in quick // succession, and then go back to sleep for a period. Looking at the INT2 // line shows similar to ...
p(true); window_stack_push(data->sleep_window, true /* Animated */); } // ------------------------------------------------------------------------------- static void steps_down_click_handler(ClickRecognizerRef recognizer, void *context) { HealthAPITestAppData *data = (HealthAPITestAppData *)context; window_stac...
graphics_fill_rect(ctx, bounds, 0, GCornerNone)
; // Show the battery level in the outer circle BatteryChargeState charge_state = battery_state_service_peek(); const int percent = charge_state.charge_percent; graphics_context_set_fill_color(ctx, GColorDarkCandyAppleRed); graphics_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, 15, 0, TRIG_MAX_ANGLE); ...
die.h" #include "system/reboot_reason.h" #include "system/reset.h" #include "util/attributes.h" #include "util/bitset.h" #include "util/size.h" #include "util/string.h" #define CMSIS_COMPATIBLE #include <mcu.h> #include <inttypes.h> #include <stdarg.h> #include <stdio.h> #include "kernel/pebble_tasks.h" void fault_...
(buffer, 80, " MMFARVALID = yes 0x%"PRIx32, SCB->MMFAR)
; } print_set_indexes(buffer, &mmfsr, mmfsr_mappings, ARRAY_LENGTH(mmfsr_mappings)); } } void fault_handler_dump(char buffer[80], unsigned int *stacked_args) { fault_handler_dump_stacked_args(buffer, stacked_args); fault_handler_dump_cfsr(buffer); PBL_LOG_FROM_FAULT_HANDLER_FMT( buffer, 80, "Tas...
/* * 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...
(fd, RESOURCE_STORE_METADATA_BYTES + entry_offset, num_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...
{ // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_28394_1 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 60 //> TEST_EXPECTED_MAX 120 //> TEST_WEIGHT 1.0 static AccelRawData samples[] = { // 0 seconds // elapsed: 0 minutes { -96, -24, -1008}, { -...
{ 152, 616, -504}, { 72, 720, -504}, { 24, 800, -408}, { 80, 640, -296}, { -72, 720, -80}, { -80, 912, 32}, { -136, 936, 296}, { -144, 960, 432}, { -72, 864, 544}, { -88, 840, 520}, { -16, 744, 520}, { -24, 744, 528}, { 16, 760, 456}, { 24, 816, 560}, { 16, 9...
* 1024 * 1024); cl_assert(fd == E_OUT_OF_STORAGE); fd = pfs_open("toobig", OP_FLAG_READ, 0, 0); cl_assert(fd == E_DOES_NOT_EXIST); fd = pfs_open(NULL, OP_FLAG_READ, 0, 0); cl_assert(fd == E_INVALID_ARGUMENT); fd = pfs_open("newfile2", OP_FLAG_WRITE, FILE_TYPE_STATIC, 8000); cl_assert(fd >= 0); cl_ass...
strlen(overwrite_string)
); cl_assert(tmp_fd >= 0); rv = pfs_write(tmp_fd, (uint8_t *)overwrite_string, strlen(overwrite_string)); cl_assert_equal_i(rv, strlen(overwrite_string)); cl_assert_equal_i(pfs_close(tmp_fd), S_SUCCESS); uint8_t new_buf[strlen(overwrite_string)]; fd = pfs_open(file, OP_FLAG_READ, 0, 0); cl_assert(fd >= 0...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_wait_for_qspi_transfer_complete(QSPIFlag_ClearTC)
; delay_us(50000); // 50ms reset if busy with an erase! // Return the flash to Quad SPI mode, all our commands are quad-spi and it'll just cause // problems/bugs for someone if it comes back in single spi mode prv_quad_enable(); } #include "system/passert.h" static bool prv_flash_check_whoami(void) { const...
prv_init_icon_and_subtitle_slice_from_attr_list(const AttributeList *attr_list, AppGlanceSliceInternal *slice_out) { slice_out->icon_and_subtitle.icon_resource_id = attribute_get_uint32(attr_list, ...
if (!prv_is_slice_type_valid(type)) { return false; }
// Check if the AttributeList has the attributes required for this specific slice type return s_slice_type_impls[type].is_attr_list_valid(attr_list); } ////////////////////////////////// // Slice Deserialization ////////////////////////////////// //! Returns true if a non-empty AttributeList was successfully de...
/* * 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...
notification_storage_store(&notification)
; PBL_LOG(LOG_LEVEL_INFO, "Notification added: %s", uuid_string); notifications_handle_notification_added(id); } timeline_item_free_allocated_buffer(&notification); return S_SUCCESS; } int notif_db_get_len(const uint8_t *key, int key_len) { if (key_len < UUID_SIZE) { return 0; } return notifi...
x *)pattern_attribute->data; } static unsigned int prv_vibe_score_get_num_note_types(GenericAttribute *notes_attribute) { return notes_attribute->length / sizeof(VibeNote); } static unsigned int prv_vibe_score_get_pattern_length(GenericAttribute *pattern_attribute) { return pattern_attribute->length / sizeof(Vibe...
(app_num, resource_id, VIBE_DATA_OFFSET, (uint8_t*)vibe_score, data_size)
!= data_size) { applib_free(vibe_score); return NULL; } // Validate the loaded command sequence if (!vibe_score_validate(vibe_score, data_size)) { applib_free(vibe_score); return NULL; } return vibe_score; } unsigned int vibe_score_get_duration_ms(VibeScore *score) { if (!score) { re...
); AnimationProgress progress; if (timeline_layer->animating_intro_or_exit && animation_get_progress(timeline_layer->animation, &progress)) { const GPoint offset = { PEEK_ANIMATIONS_SPEED_LINES_OFFSET_X, interpolate_int64_linear(progress, 0, -DISP_ROWS) }; graphics_context...
((Layer *)&layer->day_separator)
; } void timeline_layer_move_data(TimelineLayer *layer, int delta) { PBL_ASSERTN(delta == 1 || delta == -1); if (delta == 1) { if (layer->layouts[s_nonvisible_items[0]]) { prv_destroy_layout(layer, s_nonvisible_items[0]); } for (int i = 0; i < TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER - 1; i++) { ...
handle_dummy_touch_event, NULL)); prv_compare_recognizers_processed((int[]) {0, 1}, 2, &s_recognizers_handled); // Recognizers attached to children of active layer will not be evaluated manager.active_layer = &layer_a; cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)); prv_...
(!ctx.recognizers_active)
; // Make sure that we don't try to fail a recognizer twice (causing an assert) cl_assert(prv_fail_recognizer(r1, &ctx)); cl_assert_equal_i(r1->state, RecognizerState_Failed); r1->state = RecognizerState_Possible; recognizer_set_simultaneous_with(r1, prv_simultaneous_with_cb); cl_assert(prv_fail_recognize...
SPLAY_FRAMEBUFFER_BYTES == 25944); bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite); cl_assert(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE)); } // Tests 4-bit bitblt palettized to circular display buffer // Result: // - gbitmap matches platform loaded PBI void te...
(bitmap->info.format == GBitmapFormat8BitCircular)
; GBitmap *native_framebuffer = graphics_context_get_bitmap(ctx); GRect framebuffer_bounds = gbitmap_get_bounds(native_framebuffer); cl_assert(native_framebuffer->info.format == GBitmapFormat8BitCircular); cl_assert(DISPLAY_FRAMEBUFFER_BYTES == 25944); // Set screen to black to match empty region with test ...
ic void prv_transform_list(KinoReelTransformData *data) { KinoReel *reel = prv_get_current_reel(data); GDrawCommandList *source_list = kino_reel_get_gdraw_command_list(reel); GDrawCommandList *list = prv_get_or_create_list_copy(data, source_list); if (!list) { return; } if (!gdraw_command_list_copy(list...
prv_draw_processed_in_local(data, ctx, offset, processor)
; } } static GDrawCommandList *prv_get_gdraw_command_list(KinoReel *reel) { KinoReelTransformData *data = kino_reel_custom_get_data(reel); if (data) { KinoReel *reel = prv_get_current_reel(data); return kino_reel_get_gdraw_command_list(reel); } return NULL; } static const KinoReelImpl s_kino_reel_im...
der part bool result = shared_circular_buffer_read(&s_buffer, &s_buffer_client, sizeof(uint8_t), &data_read, &read_length); PBL_ASSERTN(result); PBL_ASSERT(read_length == sizeof(uint8_t), "read_length %u sizeof(uint8_t) %u", read_length, sizeof(uint8_t)); uint8_t msg_length = *data_read; if (shared_circular_...
(s_buffer_mutex)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ s_usb_connected = qemu_setting_get(QemuSetting_DefaultPluggedIn); }
&nap_count); PBL_LOG(LOG_LEVEL_DEBUG, "Found %d sleep sessions and %d nap sessions", sleep_count, nap_count); if (nap_count > 0 || sleep_count == 0) { PBL_LOG(LOG_LEVEL_ERROR, "FAILED: expected only sleep but got %d naps and %d sleep", nap_count, sleep_count); prv_test_end(context, false); r...
rtc_get_time()
) + 1 * SECONDS_PER_DAY); ActivityInsightSettings original_settings; activity_insights_settings_read(ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD, &original_settings); ActivityInsightSettings disabled_settings = original_settings; disabled_settings.enabled = false; activity_insights_settings_write(ACTIVITY_IN...
------------------------------------- // Structure holding the samples and expected values for a step sample discovered on the file // system typedef struct { char name[256]; AccelRawData *samples; int num_samples; int exp_steps; int exp_steps_min; int exp_steps_max; float weight; // Weight ...
clar__assert(false, file, line, "Missing activity record", "", true)
; } #define ASSERT_ACTIVITY_SESSION_PRESENT(sessions, num_sessions, session) \ prv_assert_activity_present((sessions), (num_sessions), (session), __FILE__, __LINE__) // ================================================================================== // Functions used for collecting stats and writing them ...
, 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, ...
(&APP_GLANCE_TEST_UUID, &read_back_glance)
, S_SUCCESS); cl_assert_equal_m(&glance, &read_back_glance, sizeof(AppGlance)); } void test_app_glance_db__reading_nonexistent_glance_returns_does_not_exist(void) { AppGlance glance = {}; cl_assert_equal_i(app_glance_db_read_glance(&UUID_INVALID, &glance), E_DOES_NOT_EXIST); } void test_app_...
uint8_t value_out[], uint16_t *value_length_in_out) { if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(value_length_in_out, sizeof(*value_length_in_out)); syscall_assert_userspace_buffer(value_out, *value_length_in_out); } gatt_client_con...
syscall_assert_userspace_buffer(device, sizeof(*device))
; } *device = gatt_client_service_get_device(service); } DEFINE_SYSCALL(uint8_t, sys_ble_service_get_included_services, BLEService service_ref, BLEService included_services_out[], uint8_t num_services) { if (PRIVILEGE_WAS...
/* * 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_music_ctx.implementation == implementation) { // Previously registered server got disconnected change_type = Disconnected; s_music_ctx.implementation = NULL; PBL_LOG(LOG_LEVEL_INFO, "Music server disconnected: %s", implementation->debug_name); } else { PBL_LOG(LOG_LEVEL_ERR...
if (change_type != None) { // Upon connect and disconnect, reset the cached data: music_update_player_volume_percent(0); // Taking short-cut here, music_update_now_playing already puts NowPlayingChanged event, no // need to put it again by calling music_update_player_name: s_music_ctx.player_na...
cl_assert_equal_i(fail_count, 0)
; kernel_free(s_kalg_state); s_kalg_state = NULL; } // --------------------------------------------------------------------------------------- void test_kraepelin_algorithm__activity_tests(void) { bool success = prv_sample_discovery_init(&s_activity_sample_discovery_state.common, ...
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "settings_vibe_patterns.h" #include "settings_window.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "se...
{ // Vibe a short pulse so the user can feel the current system default vibe intensity vibes_short_pulse(); // Just return because the remainder of this function only applies to vibe scores return; }
default: WTF; } if (!score) { PBL_LOG(LOG_LEVEL_ERROR, "Null VibeScore!"); return; } vibe_score_do_vibe(score); vibe_score_destroy(score); } static void prv_select_click_cb(SettingsCallbacks *context, uint16_t row) { vibes_cancel(); SettingsVibePatternsData *data = (SettingsVibePatter...
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, .timestamp = 25*60, .duration = 5, .type = TimelineItemTypePin, .all_day = false, .layout = LayoutIdCalendar, }, .attr_list = { .num_attributes = 1, .attributes = &title_attr, }, }; static TimelineItem item4 = { .header =...
cl_assert_equal_i(fake_event_get_count(), 1)
; cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert_equal_i(timer_id, TIMER_INVALID_ID); cl_assert(!stub_new_timer_is_scheduled(timer_id)); cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(fake_event_get_count(), 2); ...
bar; if (actionable_dialog->action_bar_type == DialogActionBarConfirm) { #if !defined(RECOVERY_FW) actionable_dialog->select_icon = gbitmap_create_with_resource( RESOURCE_ID_ACTION_BAR_ICON_CHECK); #endif action_bar_layer_set_context(action_bar, window); action_bar_layer_set_icon(action_bar, BUTTO...
(window, actionable_dialog)
box *outbox) { // Verify outbox phase. if (outbox->phase == OUT_CLOSED) { return; } // Cancel any outstanding timer. prv_stop_timer(outbox); outbox->transmission_size_limit = 0; applib_free(outbox->app_outbox_message); outbox->app_outbox_message = NULL; // Finish by moving to the next phase. ...
prv_is_message_pending(outbox->phase)
) { PBL_LOG(LOG_LEVEL_ERROR, "Can't call app_message_outbox_send() now, wait for sent_callback!"); return APP_MSG_BUSY; } if (outbox->phase != OUT_WRITING) { return APP_MSG_INVALID_STATE; } const size_t transmission_size = dict_write_end(&outbox->iterator) + APP_MSG_HDR_OVRHD_SIZE; if (transmissi...
animation_set_curve(h, AnimationCurveEaseOut); cl_assert(animation_get_curve(h) == AnimationCurveEaseOut); static const PropertyAnimationImplementation implementation2 = { .base = { .setup = prv_setup_handler, .update = (AnimationUpdateImplementation) property_animation_update_gpoint, .tear...
(prv_count_handler_entries(&s_started_handler_calls, a), 1)
--------- //! Main Window typedef struct { ActionableDialog *alarm_popup; GBitmap *bitmap; GBitmap *action_bar_dismiss; GBitmap *action_bar_snooze; ActionBarLayer action_bar; TimerID vibe_timer; int max_vibes; int vibe_count; #if CAPABILITY_HAS_VIBE_SCORES VibeScore *vibe_score; #endif } AlarmPopupD...
(BUTTON_ID_BACK, prv_snooze_click_handler)
; } // ---------------------------------------------------------------------------------------------- //! Main Window Setup static void prv_setup_action_bar(void) { ActionBarLayer *action_bar = &s_alarm_popup_data->action_bar; action_bar_layer_init(action_bar); action_bar_layer_set_background_color(action_bar, G...
uint8_t left_aa_offset, uint8_t right_aa_offset, int16_t clip_box_min_x, int16_t clip_box_max_x, GColor color); static void prv_hline_pattern_apply_assign_horizontal_line_delta_raw(GContext *ctx, int16_t y, ...
{ cl_assert_equal_i(test_graphics_context_mask_get_value_for_coordinate(ctx, mask, GPoint(x, y)), expected_value); }
} } void test_graphics_context_mask__basic_create(void) { GContext *ctx = s_ctx; // Should be safe to call create with NULL values cl_assert_equal_p(graphics_context_mask_create(NULL, NULL), NULL); GDrawMask *transparent_mask = graphics_context_mask_create(ctx, true /* transparent */); cl_assert(transpa...
e(text_layer); } void text_layer_deinit(TextLayer *text_layer) { PBL_ASSERTN(text_layer); layer_deinit(&text_layer->layer); graphics_text_layout_cache_deinit(&text_layer->layout_cache); text_layer->layout_cache = NULL; } Layer* text_layer_get_layer(TextLayer *text_layer) { PBL_ASSERTN(text_layer); return ...
(text_layer)
return true; } AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/); if (!prv_is_mutable(state, animation)) { return false; } animation->custom_function = function; if (function) { animation->curve = curve; } else { animation->curve = AnimationC...
(state, animation_h, false /*quiet*/)
; if (!prv_is_mutable(state, animation)) { return false; } // NOTE: We still need to implement reverse for sequence and spawn animations. // tracked in this JIRA: https://pebbletechnology.atlassian.net/browse/PBL-14838 animation->reverse = reverse; return true; } // ----------------------------------...
x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7...
getSBoxValue(tempa[2])
; tempa[3] = getSBoxValue(tempa[3]); } } RoundKey[i * 4 + 0] = RoundKey[(i - Nk) * 4 + 0] ^ tempa[0]; RoundKey[i * 4 + 1] = RoundKey[(i - Nk) * 4 + 1] ^ tempa[1]; RoundKey[i * 4 + 2] = RoundKey[(i - Nk) * 4 + 2] ^ tempa[2]; RoundKey[i * 4 + 3] = RoundKey[(i - Nk) * 4 + 3] ^ tempa[3]; ...
GTextOverflowModeTrailingEllipsis); layer_set_hidden(&s_phone_ui_data->call_status_text_layer.layer, true); layer_set_clips(&s_phone_ui_data->call_status_text_layer.layer, false); layer_add_child(&s_phone_ui_data->core_ui_container, &s_phone_ui_data->call_status_text_layer.layer); // Shrink th...
if (call_accepted) { prv_set_icon_resource(TIMELINE_RESOURCE_DURING_PHONE_CALL); prv_set_window_color(ACCEPT_COLOR, true); prv_set_status_text(ACCEPTED); } else { prv_set_icon_resource(TIMELINE_RESOURCE_DISMISSED_PHONE_CALL); prv_set_window_color(DECLINE_COLOR, true); if (disconnected) { ...
prv_window_pop_with_delay(CALL_END_DELAY_MS); } void phone_ui_handle_call_hide(void) { // Just pop the window - it'll handle all the cleanup prv_window_pop(); } void phone_ui_handle_caller_id(PebblePhoneCaller *caller) { if (!s_phone_ui_data) { PBL_LOG(LOG_LEVEL_ERROR, "Can't update caller id, UI isn't ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_ERROR, "Unknown cmd ID: 0x%"PRIx8, msg->command_id)
; break; } }
ild_c; Layer *layers[] = {&parent, &child_a, &child_b, &child_c}; for (int i = 0; i < ARRAY_LENGTH(layers); ++i) { layer_init(layers[i], &GRectZero); } // Create this hierarchy: // // +-parent // | // '->child_b // layer_add_child(&parent, &child_b); // Insert child_a above child_b (f...
(ab, stack[1])
"AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stdarg.h> #include <stdint.h> #include <string.h> #include <time.h> #include "drivers/qemu/qemu_serial.h" ...
(&s_state, &rcv_bytes, &rcv_protocol)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ ++s_method_func_imp_call_count; return jerry_create_undefined(); }
void test_rocky_api_util__rocky_add_constructor(void) { static const RockyGlobalAPI *s_api[] = { NULL, }; rocky_global_init(s_api); JS_VAR prototype = rocky_add_constructor("test", test_func_imp); cl_assert_equal_b(jerry_value_is_object(prototype), true); EXECUTE_SCRIPT("_rocky.test();"); cl_assert...
isabled) { prv_timeline_remove_alarm(fd, alarm->id); return; } CronJob cron; time_t execute_time = prv_build_cron(&alarm->config, &cron); prv_timeline_add_alarm(fd, alarm, &cron, rtc_get_time()); if (s_next_alarm_time == 0 || execute_time < s_next_alarm_time) { // This alarm is sooner than the p...
PBL_LOG(LOG_LEVEL_INFO, "Snooze timeout")
; system_task_add_callback(prv_snooze_kernel_bg_callback, NULL); } // ---------------------------------------------------------------------------------------------- T_STATIC void prv_timer_kernel_bg_callback(void *data) { AlarmId id = (intptr_t) data; if (id == ALARM_INVALID_ID) { return; } // We alloca...
tic // static bool prv_is_bidrectional(const SPISlavePort *slave) { bool is_bidirectional = (slave->spi_direction == SpiDirection_2LinesFullDuplex) || (slave->spi_direction == SpiDirection_2LinesRxOnly); return (is_bidirectional); } void spi_slave_port_deinit(const SPISlavePort *slave) { // don't d...
(slave->spi_bus)
; spi_ll_slave_spi_disable(slave); slave->slave_state->acquired = false; prv_spi_disable_peripheral_clock(slave->spi_bus); } void spi_ll_slave_spi_enable(const SPISlavePort *slave) { PBL_ASSERTN(slave->slave_state->initialized); PBL_ASSERTN(slave->slave_state->acquired); prv_spi_cmd(slave->spi_bus, SpiEnab...
, 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, t...
(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 2)
; graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 2); graphics_draw_round_rect(&ctx, &OFFSET_DRAW...
on us. state->hr.last_sample_ts = now_uptime; // Save the BPM, quality, and update time (UTC) of the last reading for activity_get_metric() state->hr.metrics.current_bpm = hrm_event->bpm.bpm; state->hr.metrics.current_quality = hrm_event->bpm.quality; state->hr.metrics.current_update_time_utc = now...
{ health_tracking_ui_app_show_disabled(); }
// Update derived metrics prv_update_real_time_derived_metrics(); ActivityMetricInfo m_info; activity_metrics_prv_get_metric_info(metric, &m_info); if (history_len == 0) { goto unlock; } // Clip history length history_len = MIN(history_len, ACTIVITY_HISTORY_DAYS); if (!m_i...
we had the last resource, we're done return; } memmove(&s_custom_res_list.custom_resources[index], &s_custom_res_list.custom_resources[index + 1], (s_custom_res_list.next_index - index) * sizeof(EmxCustomResource)); } ////////////////////////////////////// // System Resources // // In this...
prv_custom_resource_remove(resource_id)
M_LOG(fmt, ...) \ do { \ PBL_LOG(LOG_LEVEL_DEBUG, fmt, ## __VA_ARGS__); \ } while (0) #define HRM_HEXDUMP(data, length) \ do { \ PBL_HEXDUMP(LOG_LEVEL_DEBUG, (uint8_t *)data, length); \ } while (0) #else #define HRM_LOG(fmt, ...) #define HRM_HEXDUMP(data, length) #endif static struct HRMManagerState s_...
memcpy(write_ptr, s_manager_state.accel_manager_buffer, num_new_samples * sizeof(AccelRawData))
; s_manager_state.accel_data.num_samples += num_new_samples; mutex_unlock(s_manager_state.accel_data_lock); sys_accel_manager_consume_samples(s_manager_state.accel_state, num_new_samples); } // Return true if this is a stable BPM reading. This is called each time we power the sensor off // or receive a new HR...
&type_out); cl_assert(!ret); ret = bt_persistent_storage_has_active_bt_classic_gateway_bonding(); cl_assert(!ret); ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(!ret); // Store a new BT Classic pairing BTDeviceAddress addr_1 = {{0x11, 0x12, 0x13, 0x14, 0x15, 0x16}}; SM128BitK...
cl_assert(ret)
; ret = bt_persistent_storage_has_active_ble_gateway_bonding(); cl_assert(!ret); // Manually set the active gateway again (to the ble pairing) bt_persistent_storage_set_active_gateway(id_3); ret = bt_persistent_storage_get_active_gateway(&id_out, &type_out); cl_assert(ret); cl_assert_equal_i(id_out, id_3...
uint8_t left_aa_offset, uint8_t right_aa_offset, int16_t clip_box_min_x, int16_t clip_box_max_x, GColor color); static void prv_hline_pattern_assign_horizontal_line_delta_raw(GContext *ctx, int16...
test_graphics_context_init(&ctx, fb)
*swap_layer = &data->swap_layer; swap_layer_init(swap_layer, &swap_frame); swap_layer_set_callbacks(swap_layer, data, (SwapLayerCallbacks) { .get_layout_handler = prv_get_layout_handler, .layout_removed_handler = prv_layout_removed_handler, .layout_did_appear_handler = prv_layout_did_appear_handler, #if...
prv_reload_swap_layer(data)
; } void notification_window_service_init(void) { s_notification_window_mutex = mutex_create(); s_notification_window_data.pop_timer_id = EVENTED_TIMER_INVALID_ID; } ////////////////// // Event Handers ////////////////// static void prv_handle_action_result(PebbleSysNotificationActionResult *action_result) { ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
app_light_enable(true)
_health__range_to_day_id_clamps_values(void) { const time_t now = rtc_get_time(); bool result; HealthServiceTimeRange range; // clamps value that goes into the future result = prv_calculate_time_range(now - 10, now + 11, &range); cl_assert_equal_b(result, true); cl_assert_equal_range(range, ((HealthServi...
(values, 0, &range)
; cl_assert_equal_i(values[0], 1000); cl_assert_equal_i(values[1], 1000); cl_assert_equal_i(values[2], 1000); // ensure we can handle empty ranges range.num_days = 0; prv_adjust_value_boundaries(values, ARRAY_LENGTH(values), &range); cl_assert_equal_i(values[0], 1000); cl_assert_equal_i(values[1], 1000...