prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
f(*hdr),
hdr->msg_size,
s_parsed_msg.payload_sender_type,
s_parsed_msg.payload_sender_id,
s_parsed_msg.payload_sender_version_patch,
&s_parsed_msg.payload_send_time,
&s_parsed_msg.payload_sender_v_major,
&s_parsed_msg.payload_sender_v_minor,
&s_parsed_msg.events.num_events,
s_parsed_... | cl_assert_equal_i(a_event->time_utc, b_event->time_utc) | |
/*
* 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... | {
case PreferredContentSizeSmall:
case PreferredContentSizeMedium:
case PreferredContentSizeLarge:
case PreferredContentSizeExtraLarge:
break;
default:
size = PreferredContentSizeDefault;
} |
switch (size) {
case PreferredContentSizeSmall:
return "small";
case PreferredContentSizeMedium:
return "medium";
case PreferredContentSizeLarge:
return "large";
case PreferredContentSizeExtraLarge:
return "x-large";
case NumPreferredContentSizes: {}
}
// unreachable
... |
ders to allocate the needed space.
// They will be set to the proper values during the animation.
{0, 0}, {0, 0}, {0, 0},
},
};
static GPathInfo s_path_quad = {
.num_points = PATH_QUAD_POINTS,
.points = (GPoint[PATH_QUAD_POINTS]) {
// These are just placeholders to allocate the needed space.
// T... | gpath_draw_filled(ctx, &s_data.path) | ;
for (int i = 0; i < PATH_QUAD_POINTS; i++) {
prv_gpoint_interpolate(&s_path_quad.points[i], distance,
&s_path_defs[s_data.direction].quad_verts[i]);
}
gpath_init(&s_data.path, &s_path_quad);
gpath_draw_outline(ctx, &s_data.path);
gpath_draw_filled(ctx, &s_data.path);
}
// Moves the current frame... |
fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 10);
graphics_context_set_stroke_color(&ctx, GColorClear);
graphics_line_draw_precise_stroked_non_aa(&ctx, COLOR_START_POINT, COLOR_END_POINT, 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_inside_origin_layer.${BIT_DEPTH_NAME}.pbi"));
*/
}... | {
GContext ctx;
test_graphics_context_init(&ctx, fb);
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 10);
int radius = 5;
int x_offset = 10 * FIXED_S16_3_ONE.raw_value;
for (int i = 0; i < 8; i++) {
radius += 1;
x_offset += radius * FIXED_S16_3_ONE.raw_value + 4 * FIXED... | |
GRect(0, 0, s_phone_ui_data->bg_color.boundary, layer->bounds.size.h) | );
graphics_context_set_fill_color(ctx, s_phone_ui_data->bg_color.right);
graphics_fill_rect(ctx, &GRect(s_phone_ui_data->bg_color.boundary, 0, layer->bounds.size.w,
layer->bounds.size.h));
#else
graphics_context_set_fill_color(ctx, DEFAULT_COLOR);
graphics_fill_rect(ctx, &layer... | |
= num_group_type_elements;
((AddressList *) group_ptr)->addresses = (Address *)*buffer;
*buffer += num_group_type_elements * sizeof(Address);
}
for (int i = 0; i < num_group_type_elements; i++) {
AttributeList *attr_list;
if (type == AttributeGroupType_Action) {
attr_list = &((... | {
return false;
} |
}
return true;
}
bool attribute_group_deserialize(AttributeGroupType type,
AttributeList *attr_list,
void *group_ptr,
uint8_t *buffer,
uint8_t *buf_end,
... |
}
layer_mark_dirty(s_canvas_layer);
}
static void click_config_provider(void *context) {
window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, up_handler);
window_single_repeating_click_subscribe(BUTTON_ID_SELECT, 100, select_handler);
window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, down_hand... | (s_window) | |
const ANCSAttribute *title) {
}
bool ancs_filtering_is_muted(const iOSNotifPrefs *app_notif_prefs) {
return false;
}
// Fakes
////////////////////////////////////////////////////////////////
#include "fake_events.h"
#include "fake_notification_storage.h"
static time_t s_now;
time_t rtc_get_ti... | cl_assert_equal_i(fake_event_get_count(), 2) | ;
cl_assert_equal_i(event.type, PEBBLE_PHONE_EVENT);
cl_assert_equal_i(event.phone.type, PhoneEventType_Hide);
cl_assert_equal_i(event.phone.source, PhoneCallSource_ANCS);
cl_assert_equal_i(event.phone.call_identifier, uid);
}
|
));
setup_test(&context, false, 2, 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(&context, GPoint(50, 50), 10));
ASSERT_NO_CHANGE(grap... | (memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 0) | ;
// Antialiased
draw_state = graphics_context_get_drawing_state(&context);
graphics_context_set_antialiased(&context, true);
cl_assert(memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 0);
// Stroke Width
draw_state = graphics_context_get_drawing_state(&context);
graphics_context_set_stro... |
up.",
s_pb_state.token, PUT_TIMEOUT_MS);
prv_cleanup_async();
}
static bool prv_has_valid_fw_update_state_for_object_type(PutBytesObjectType type) {
#ifndef RECOVERY_FW
if (!firmware_update_is_in_progress()) {
bool is_fw_update_object = (type == ObjectFirmware ||
type == ... | PBL_LOG(LOG_LEVEL_ERROR, "Token does not exist; got 0x%" PRIx32, token) | |
assert(test_scan_for_last_written() < 0);
// set up an environment that forces some garbage collection
for (int i = 0; i < num_pages(); i++) {
char name[10];
snprintf(name, sizeof(name), "test%d", i);
int fd = pfs_open(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
if (((i % 2... | (list_find(&dir_list->list_node, prv_find_name, "a_test_0")) | ;
cl_assert(list_find(&dir_list->list_node, prv_find_name, "a_test_1"));
pfs_delete_file_list(dir_list);
}
static bool prv_file_exists(char *name) {
int fd = pfs_open(name, OP_FLAG_READ, FILE_TYPE_STATIC, 0);
if (fd < 0) {
return false;
}
pfs_close(fd);
return true;
}
extern void test_override_last_... |
ListNode *new_head = head->next;
list_remove(head, NULL, NULL);
return new_head;
}
ListNode* list_pop_tail(ListNode *node) {
if (node == NULL) {
return NULL;
}
ListNode* tail = list_get_tail(node);
ListNode* new_tail = tail->prev;
list_remove(tail, NULL, NULL);
return new_tail;
}
void list_remo... | while (cursor) {
if (filter_callback(cursor, data)) {
return cursor;
}
// We're back at where we started and even <node> itself doesn't match the filter
if (cursor == node) {
return NULL;
}
cursor = cursor->next;
} |
UTIL_ASSERT(0);
return NULL;
}
ListNode* list_find_prev(ListNode *node, ListFilterCallback filter_callback, bool wrap_around, void *data) {
if (node == NULL) {
return NULL;
}
ListNode *cursor = node;
while ((cursor = cursor->prev)) {
if (filter_callback(cursor, data)) {
return cursor;
}
... |
es to the timeline item for contact lookup
AttributeList attributes = {};
attribute_list_add_cstring(&attributes, AttributeIdSender, number);
attribute_list_add_cstring(&attributes, AttributeIdiOSAppIdentifier, app_id);
TimelineItem *item = timeline_item_create_with_attributes(0, 0, TimelineItemTypeNotificati... | status_bar_layer_deinit(&s_phone_ui_data->status_bar) | |
state.current_day, midnight_march_2_pst + SECONDS_PER_DAY);
// no more
cl_assert(!iter_next(&iterator));
// 2 deletes
cl_assert(timeline_iter_remove_node_with_id(&head, &all_day_item.header.id));
cl_assert(timeline_iter_remove_node_with_id(&head, &all_day_item.header.id));
cl_assert(!timeline_iter_remove_... | (timeline_iter_remove_node_with_id(&head, &multiday_item.header.id)) | |
QUADSPI_CCR_DHHC | \
QUADSPI_CCR_DDRM))
static void prv_set_comm_config(uint32_t modes_bitset, uint32_t dummy_cycles) {
uint32_t ccr = QUADSPI->CCR;
ccr &= QSPI_CCR_CLEAR_MASK;
ccr |= modes_bitset;
ccr |= (dummy_cycles << 18);
QUADSPI->CCR = ccr;
}
static bool prv_dma... | {
// Do 4 bytes at a time for DMA
QSPI_SetFIFOThreshold(QSPI_DMA_READ_WORD_SIZE);
QSPI_DMACmd(ENABLE);
stop_mode_disable(InhibitorFlash);
dma_request_start_direct(dev->dma, (void *)start_address_aligned, (void *)&QUADSPI->DR,
dma_size, prv_dma_irq_handler, (void *)dev);... | |
tType current_test;
uint8_t channel;
uint8_t payload_length;
BTLEPayloadType payload_type;
bool is_unmodulated_cw_enabled;
#if CAPABILITY_HAS_BUILTIN_HRM
bool is_hrm_enabled;
#endif
#if CAPABILITY_HAS_MICROPHONE
bool is_mic_enabled;
int16_t *mic_buffer;
#endif
BTLETestStep current_test_step;
bool l... | bt_driver_register_response_callback(prv_response_cb) | ;
#if CAPABILITY_HAS_BUILTIN_HRM
if (data->is_hrm_enabled) {
AppInstallId app_id = 1;
uint16_t expire_s = SECONDS_PER_HOUR;
data->hrm_session = sys_hrm_manager_app_subscribe(app_id, 1, expire_s, HRMFeature_LEDCurrent);
}
#endif
#if CAPABILITY_HAS_MICROPHONE
if (data->is_mic_enabled) {
const size... |
/*
* 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 (entry->length < resource_offset) {
PBL_LOG(LOG_LEVEL_ERROR, "Resource offset past its own ending.");
return 0;
} else if ((resource_offset + num_bytes) > entry->length) {
PBL_LOG(LOG_LEVEL_ERROR, "offset + length > resource size, truncated.");
return entry->length - resource_offset;
} else {
... |
}
static uint32_t prv_read(ResourceStoreEntry *entry, uint32_t offset, void *data, size_t num_bytes) {
num_bytes = prv_check_resource_bounds(entry, offset, num_bytes);
if (!num_bytes) {
return 0;
}
return entry->impl->read(entry, offset, data, num_bytes);
}
static void prv_get_manifest(ResourceStoreEntry... |
get_midnight_of(timestamp);
time_t yesterday_midnight = time_util_get_midnight_of(rtc_get_time() - SECONDS_PER_DAY);
time_t last_week_midnight = time_util_get_midnight_of(rtc_get_time() - SECONDS_PER_WEEK);
time_t next_week_midnight = time_util_get_midnight_of(rtc_get_time() + SECONDS_PER_WEEK);
const char *ti... | if (difference >= SECONDS_PER_HOUR) {
const int num_hrs =
prv_round(difference, SECONDS_PER_HOUR, RoundTypeHalfUp) / SECONDS_PER_HOUR;
const char *str_fmt;
if (capitalized) {
str_fmt = i18n_noop("%lu H AGO");
} else if (num_hrs == 1) {
str_fmt = i18n_noop("An hour ago");
} else ... |
} else if (difference >= -(SECONDS_PER_HOUR * max_relative_hrs)) {
const int num_hrs =
prv_round(-difference, SECONDS_PER_HOUR, RoundTypeHalfDown) / SECONDS_PER_HOUR;
const char *str_fmt;
if (capitalized) {
str_fmt = i18n_noop("IN %lu H");
} else if (num_hrs == 1) {
str_fmt = i18... |
cted accessibility result: %d", (int)mask);
}
health_service_activities_iterate(HealthActivityMaskAll, now - (2 * SECONDS_PER_DAY), now,
HealthIterationDirectionFuture, prv_activity_iterate_cb,
&num_activities_found);
APP_LOG(APP_LOG_LEVEL_D... | health_service_metric_averaged_accessible(
metric, day_start, day_start + SECONDS_PER_DAY, HealthServiceTimeScopeDailyWeekdayOrWeekend) | ;
if (!(accessible & HealthServiceAccessibilityMaskAvailable)) {
prv_display_alert("NOT ACCESSIBLE");
return;
}
// Weekday/weekend avg
HealthValue avg;
char temp[64];
avg = health_service_sum_averaged(metric, day_start, day_start + SECONDS_PER_DAY,
HealthServiceT... |
/*
* 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... | {
year += delta;
return CLIP(year, MIN_SELECTABLE_YEAR - STDTIME_YEAR_OFFSET,
MAX_SELECTABLE_YEAR - STDTIME_YEAR_OFFSET);
} |
char *date_time_selection_get_text(TimeData *data, TimeInputIndex index, char *buf) {
switch (index) {
case TimeInputIndexHour: {
unsigned hour = data->hour;
if (!clock_is_24h_style()) {
hour = hour % 12;
if (hour == 0) {
hour = 12;
}
}
snprintf(buf, 3, ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
if (item == NULL || !item->is_leaf) {
return NULL;
}
return (void *)item->action_data;
} |
// Level
/////////////////////////////////
ActionMenuLevel *action_menu_level_create(uint16_t max_items) {
// TODO add applib-malloc padding
ActionMenuLevel *level = applib_malloc(applib_type_size(ActionMenuLevel) +
max_items * applib_type_size(ActionMenuItem));
if (!le... |
_play_section(&card_timeline_layout->icon_layer, duration / 2, duration);
kino_layer_set_callbacks(&card_timeline_layout->icon_layer, (KinoLayerCallbacks) {
.did_stop = prv_pin_to_card_second_half_stopped,
}, card_timeline_layout);
}
static void prv_pin_to_card_first_half_stopped(KinoLayer *layer, bool finish... | (&card_timeline_layout->icon_layer, (KinoLayerCallbacks) {
.did_stop = prv_card_to_pin_stopped,
}, pin_timeline_layout) | ;
kino_layer_play(&card_timeline_layout->icon_layer);
// for now, use the card icon for the entire animation, so hide the tiny icon
layer_set_hidden((Layer *)&pin_timeline_layout->icon_layer, true);
}
static void prv_up_down_stopped(Animation *animation, bool finished, void *context) {
TimelineLayout *layout ... |
/*
* 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... | {
LauncherAppGlanceWatchfaces *watchfaces_glance =
launcher_app_glance_structured_get_data(structured_glance);
return NULL_SAFE_FIELD_ACCESS(watchfaces_glance, title, NULL);
} |
static void prv_watchfaces_glance_subtitle_dynamic_text_node_update(
UNUSED GContext *ctx, UNUSED GTextNode *node, UNUSED const GRect *box,
UNUSED const GTextNodeDrawConfig *config, UNUSED bool render, char *buffer, size_t buffer_size,
void *user_data) {
LauncherAppGlanceStructured *structured_glance = ... |
/*
* 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 (!shell_prefs_should_prompt_display_calibration()) {
return;
} |
launcher_task_add_callback(prv_push_calibration_dialog, NULL);
}
T_STATIC bool prv_is_known_misaligned_serial_number(const char *serial) {
// Filter watches known to be misaligned based on the serial number. This is possible because
// Serial numbers are represented as strings as described in:
// https://peb... |
ne_wordwrap_clip_outside_nx.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_outside_x);
layer_render_tree(&canvas, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_x.${BIT_DEPTH_NAME... | ("draw_text_null_w", fb, GColorWhite) | |
ize;
GSize avg_text_size = GSizeZero;
int total_width = custom_text_size.w;
const int info_padding_top = PBL_IF_RECT_ELSE(-1, 1);
const int info_offset_y = LABEL_OFFSET_Y + LABEL_HEIGHT + info_padding_top;
const int info_line_height = fonts_get_font_height(graph_card->legend_font);
const int info_height = ... | if (config->info_update) {
graph_card->info_update = config->info_update;
} |
if (config->info_buffer_size) {
graph_card->info_buffer_size = config->info_buffer_size;
}
if (!gcolor_equal(config->inactive_color, GColorClear)) {
graph_card->inactive_color = config->inactive_color;
}
}
void health_graph_card_cycle_selected(HealthGraphCard *graph_card) {
if (graph_card->selection... |
file %s...", iter->file_name);
// Remove the file that caused us to get into this state before we reboot,
// that way we should be able to avoid getting into a reboot loop.
pfs_close_and_remove(iter->fd);
PBL_LOG(LOG_LEVEL_INFO, "Data at address %p. Rebooting...", contents);
PBL_CROAK("Internal logic error.")... | (iter, iter->hdr_pos
+ sizeof(SettingsRecordHeader) + iter->hdr.key_len, FSeekSet) | |
/*
* 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_enable_input() | ;
accessory_set_baudrate(AccessoryBaud921600);
accessory_set_power(false);
break;
case AccessoryInputStateMic:
// fallthrough
default:
break;
}
mutex_unlock(s_state_mutex);
PBL_LOG(LOG_LEVEL_DEBUG, "Setting accessory state to %u", state);
return true;
}
|
208, 512, -96},
{ -1224, 552, -176},
{ -1104, 392, -32},
{ -824, 336, 0},
{ -536, 304, 56},
{ -504, 304, 104},
{ -520, 208, 144},
{ -512, 160, 176},
{ -520, 176, 184},
{ -624, 240, 120},
{ -928, 312, 48},
{ -1136, 240, 0},
{ -1176, 80, 40},
{ -1560, 120, 32},
// 1... | { -1088, 632, -104},
{ -1144, 464, 32},
// 110 seconds
{ -1576, 560, -104},
{ -1384, 512, -64},
{ -1024, 480, -96},
{ -1064, 512, -176},
{ -1024, 392, 0},
{ -832, 296, 96},
{ -576, 288, 88},
{ -536, 264, 120},
{ -560, 248, 128},
{ -632, 224, 128},
{ -664, 192, 136... |
{ -736, 320, 64},
{ -576, 336, 56},
{ -568, 264, 104},
{ -552, 208, 144},
{ -528, 152, 152},
{ -576, 120, 144},
{ -736, 184, 104},
{ -976, 192, 136},
{ -1056, 232, 96},
{ -1472, 264, 96},
{ -1144, 368, -32},
{ -1192, 424, -224},
// 113 seconds
{ -1216, 440, -200}... |
! 50 : No rotation strength
//! [51, 100] : Zero-strength forward rotation to full-strength forward rotation.
//!
//! For a 1-direction vibe:
//! 0 : No vibration strength.
//! [1, 100] : Zero strength vibration to full-strength vibration.
//!
//! This must be an even value so that a half-way point exists as an... | analytics_stopwatch_stop(ANALYTICS_APP_METRIC_VIBRATOR_ON_TIME) | ;
analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_VIBRATOR_ON_TIME);
}
s_on = on;
PBL_LOG(LOG_LEVEL_DEBUG, "Vibe status <%s>", on ? "on" : "off");
prv_vibe_raw_ctl(on);
}
void vibe_force_off(void) {
if (!s_initialized) {
return;
}
prv_vibe_raw_ctl(false);
}
int8_t vibe_get_braking_strength(v... |
2;
prv_draw_hlines_in_rect(ctx, draw_func, &bottom_rect, bottom_rect_color);
// Draw the top rectangles green with 66% opacity
// (will appear at the bottom because data rows are vertically flipped)
const GSize top_rects_size = GSize(bitmap_bounds_size->w / 4, bitmap_bounds_size->h * 2 / 5);
const int16_t t... | prv_assign_horizontal_line_raw(&ctx->dest_bitmap, y, x1_fixed, x2_fixed, color) | ;
}
void test_graphics_draw_core__assign_horizontal_line_raw(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1);
prv_draw_hline_test_pattern(&ctx, prv_hline_pattern_assign_horizontal_line_raw);
cl_check(gbitmap_pbi_eq(&ct... |
d = command_id;
if (request_payload_length) {
memcpy(message->payload, request_payload, request_payload_length);
}
return message;
}
bool hc_protocol_enqueue_with_payload(HcEndpointID endpoint_id, HcCommandID command_id,
const uint8_t *request_payload,
... | (expectation) | |
include "comm/ble/gatt_service_changed.h"
#include "drivers/pmic.h"
#include "kernel/core_dump.h"
#include "kernel/event_loop.h"
#include "kernel/pbl_malloc.h"
#include "popups/crashed_ui.h"
#include "services/common/analytics/analytics.h"
#include "system/logging.h"
#include "system/reboot_reason.h"
static void log_r... | DEBUG_LOG(LOG_LEVEL_INFO, "Stuck task PC: 0x%" PRIx32 ", LR: 0x%" PRIx32,
reason.watchdog.stuck_task_pc, reason.watchdog.stuck_task_lr) | |
/*
* 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... | {
result |= APP_GLANCE_RESULT_EXPIRES_IN_THE_PAST;
} |
// If we haven't failed at this point, we're ready to add the slice to the glance!
if (result == APP_GLANCE_RESULT_SUCCESS) {
AppGlanceSliceInternal *slice_dest = &glance->slices[glance->num_slices];
*slice_dest = (AppGlanceSliceInternal) {
.expiration_time = slice.expiration_time,
.type = App... |
i);
printf("Iteration %d val %s\n", i, val);
set_and_verify(&file, key, key_len, val, val_len);
}
settings_file_close(&file);
cl_must_pass(settings_file_open(&file, "test_file_set_get_one_many_times", 4096));
printf("Making sure we still get the right value after closing & reopening the file...\n");... | (settings_file_open(&file, "test_file_max_storage", 4096)) | ;
uint8_t key[5];
int key_len = 4;
uint8_t val[5];
int val_len = 4;
// 255 * (8 + 4 + 4) = 4080 + 8 + 8 = 4096
for (int i = 0; i < 255; i++) {
snprintf((char *)key, sizeof(key), "k%03d", i);
snprintf((char *)val, sizeof(val), "v%03d", i);
printf("Iteration %d key %s val %s\n", i, key, val);
... |
2, -720},
{ 432, 480, -720},
{ 432, 448, -760},
{ 424, 472, -736},
{ 440, 536, -688},
{ 448, 512, -696},
{ 464, 520, -712},
{ 448, 480, -720},
{ 440, 480, -720},
{ 424, 464, -752},
{ 440, 448, -736},
{ 440, 488, -728},
{ 440, 448, -744},
{ 440, 448, -720},
{ 432, ... | { 416, 152, -792},
{ 528, 536, -952},
{ 496, 216, -768},
{ 488, 352, -792},
// 32 seconds
{ 496, 408, -696},
{ 472, 384, -704},
{ 344, 1056, -952},
{ 392, 256, -632},
{ 448, 504, -816},
{ 568, 368, -696},
{ 544, 344, -776},
{ 344, 440, -760},
{ 136, 408, -816},
... | |
his here, on animated center focus, the announcement will happen in-between
// as we change the selection index for real
if (did_change) {
prv_announce_selection_changed(menu_layer, prev_selection->index);
}
}
}
typedef struct {
bool was_animating;
MenuCellSpan prev_selection;
} MenuLayerBefore... | if (menu_index_compare(&new_index, &it->it.cursor.index) == 0) {
// new index is the index we wanted to select
menu_layer->selection = it->it.cursor;
} else {
// when center focused, animation will be scheduled at the very end
// see prv_apply_selection_change()
const bool ... |
} else {
menu_layer->selection = it->it.cursor;
}
} else {
++it->count;
}
}
void menu_layer_set_selected_next(MenuLayer *menu_layer, bool up,
MenuRowAlign scroll_align, bool animated) {
const MenuLayerBeforeSelectionChangeState before_state =
prv_capture... |
/*
* 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... | gbitmap_destroy(img_1bit) | |
merateData;
static bool prv_enumerate_entries(SettingsFile *file, SettingsRecordInfo *info, void *context) {
// check entry is valid
if ((info->val_len == 0) || (info->key_len != sizeof(AppInstallId))) {
return true; // continue iteration
}
EnumerateData *cb_data = (EnumerateData *)context;
AppInstallI... | if (app_id == INSTALL_ID_INVALID) {
rv = E_DOES_NOT_EXIST;
} else {
rv = settings_file_get(&s_app_db.settings_file, (uint8_t *)&app_id,
sizeof(AppInstallId), val_out, val_len);
} |
prv_close_file_and_unlock_mutex();
return rv;
}
status_t app_db_delete(const uint8_t *key, int key_len) {
if (key_len != UUID_SIZE) {
return E_INVALID_ARGUMENT;
}
status_t rv = prv_lock_mutex_and_open_file();
if (rv != S_SUCCESS) {
return rv;
}
PBL_ASSERTN(key_len == 16);
AppInstallId ap... |
e_color(&ctx, GColorClear);
prv_draw_circles(&ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_aa_swX_clear.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_draw_circle_${BIT_DEPTH_NAME}__arc_stroked(void){
GContext ctx;
test_graphics_context_init(&ctx, fb);
// Letter C
uint32_t angle_end = T... | graphics_draw_arc_internal(&ctx, pt, radius, test_angles[i].angle, TRIG_MAX_ANGLE) | ;
stroke_width += 1;
radius += 3;
pt.x += (radius + stroke_width) * 2;
if (pt.x > 120) {
pt.x = CENTER_OF_ORIGIN_RECT.x;
pt.y += (radius + stroke_width) * 2;
}
}
char filename[100];
snprintf(filename, sizeof(filename),
"draw_arc_offset_aa_start_an... |
offsetof(PebblePairingServiceConnParamsWrite,
remote_desired_state));
switch (conn_params->cmd) {
case PebblePairingServiceConnParamsWriteCmd_SetRemoteParamMgmtSettings:
rv = prv_validate_set_remote_param_mgmt_settings_cmd(&conn_params->remote_param_mgmt_sett... | (&uuid, GATT_SERVICE_PRIMARY, num_attr, start_hdl) | == 0);
// RivieraWaves caches values internally and only calls back once if we don't set this:
const uint8_t enable_read_cb_flag = GATTS_FLAG_CHAR_READ_REQ;
// Connectivity Status characteristic + CCCD:
prv_convert_uuid_to_little_endian(
(const uint8_t[]){PEBBLE_BT_PAIRING_SERVICE_CONNECTION_STATUS_UUI... |
/*
* 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 (app_initiated && !uuid_attr) {
PBL_LOG(LOG_LEVEL_WARNING, "No app UUID found for dictation response from app-initiated "
"session");
voice_handle_dictation_result(VoiceEndpointResultFailInvalidMessage, session_id, NULL,
app_initiated, NULL);
return false;
} | |
prv_do_transfer(slave->bus, Read, slave->address, register_address_start, read_size,
result_buffer, SendRegisterAddress) | ;
if (!result) {
PBL_LOG(LOG_LEVEL_ERROR, "Read failed on bus %s", slave->bus->name);
}
return result;
}
bool i2c_read_block(I2CSlavePort *slave, uint32_t read_size, uint8_t* result_buffer) {
PBL_ASSERTN(slave);
PBL_ASSERTN(result_buffer);
bool result = prv_do_transfer(slave->bus, Read, slave->addre... | |
/*
* 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_malloc_check(sizeof(AppData)) | ;
app_state_set_user_data(data);
number_window_init(&data->num, "Some Number",
(NumberWindowCallbacks) { .selected = selected },
data);
number_window_set_min(&data->num, 10);
number_window_set_max(&data->num, 100);
number_window_set_step_size(&data->num, 5);
const... |
name_buf[32];
app_storage_get_file_name(filename_buf, sizeof(filename_buf), 1,
PebbleTask_App);
load_fixture_on_pfs(APP1_APP_FIXTURE_NAME, filename_buf);
app_storage_get_file_name(filename_buf, sizeof(filename_buf), 1,
PebbleTask_Worker);
load_fixture_on_p... | (false, prv_app_install_is_watchface(CRAZY_ID)) | ;
}
void test_app_install_manager__get_uuid_for_install_id(void) {
Uuid uuid = {};
cl_assert_equal_b(false, app_install_get_uuid_for_install_id(INSTALL_ID_INVALID, &uuid));
cl_assert_equal_uuid(uuid, UUID_INVALID);
cl_assert_equal_b(true, app_install_get_uuid_for_install_id(tictoc_id, &uuid));
cl_assert_equ... |
h character output
snprintf(dstbuf, 256, "There are %*o lights", 3, 8);
cl_assert_equal_s(dstbuf, "There are 10 lights");
// Variable length digits output
snprintf(dstbuf, 256, "There are %.*o lights", 3, 8);
cl_assert_equal_s(dstbuf, "There are 010 lights");
// Variable length digits output (negative di... | (dstbuf, "There are 0X10 lights, 0XFFFFFFFC") | ;
// Zero padded minimum character output
snprintf(dstbuf, 256, "There are %03X lights, %03X", 16, -4);
cl_assert_equal_s(dstbuf, "There are 010 lights, FFFFFFFC");
// Space padded minimum character output
snprintf(dstbuf, 256, "There are %3X lights, %3X", 16, -4);
cl_assert_equal_s(dstbuf, "There are 10... |
) {
HealthDetailCardConfig config = {
.num_headings = 1,
.headings = &(HealthDetailHeading) {
.primary_label = "LABEL1",
.primary_value = "value1",
.fill_color = GColorWhite,
#if PBL_BW
.outline_color = GColorBlack,
#endif
},
.bg_color = BG_COLOR,
};
prv_create_card_and_re... | gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE) | |
reate_boolean(bool value) {
return (jerry_value_t)EM_ASM_INT({
return __jerryRefs.ref(Boolean($0));
}, value);
}
jerry_value_t jerry_create_error(jerry_error_t error_type, const jerry_char_t *message_p) {
return jerry_create_error_sz(error_type, message_p, strlen((const char *)message_p));
}
#define JER... | {
return false;
} |
return (bool)EM_ASM_INT({
var obj = __jerryRefs.get($0);
var name = __jerryRefs.get($1);
return obj.hasOwnProperty(name);
}, obj_val, prop_name_val);
}
bool jerry_delete_property(const jerry_value_t obj_val, const jerry_value_t prop_name_val) {
if (!jerry_value_is_object(obj_val) || !jerry_v... |
24 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, softwar... | if (num_samples < state->samples_per_update) {
return 0;
} |
#if LOG_DOMAIN_ACCEL
uint32_t time_since_last_sample =
(state->prev_timestamp_ms != 0) ? timestamp_ms - state->prev_timestamp_ms : 0;
state->prev_timestamp_ms = timestamp_ms;
ACCEL_LOG_DEBUG("got %d samples for task %d at %ld (%lu ms delta)",
(int)num_samples, (int)pebble_task_get_curre... |
indow_stack_pop(true);
window_stack_push(data->hr_window, true /* Animated */);
}
// -------------------------------------------------------------------------------
static void steps_down_long_click_handler(ClickRecognizerRef recognizer, void *context) {
HealthAPITestAppData *data = (HealthAPITestAppData *)contex... | (ctx, bounds, GOvalScaleModeFitCircle, 15, 0, TRIG_MAX_ANGLE) | |
/*
* 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... | (BOOTLOADER_VERSION_REGISTER) | ;
}
|
);
cl_assert_equal_i(s_circle_stroke_count, 1);
cl_assert_equal_i(s_circle_fill_count, 1);
prv_reset();
gdraw_command_list_get_command(command_list, 1)->hidden = true;
gdraw_command_list_draw(ctx, command_list);
cl_assert_equal_i(s_path_stroke_count, 0);
cl_assert_equal_i(s_path_fill_count, 0);
cl_asse... | (points, s_fill_points, s_path_num_points) | );
prv_reset();
gdraw_command_image_draw(ctx, image, GPoint(-1, 1));
cl_assert_equal_i(s_path_num_points, 2);
points[0] = GPoint(5, 2);
points[1] = GPoint(4, -4);
cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points));
cl_assert(prv_compare_points(points, s_fill_points, s_path_num_poin... |
e state for the status bar handler.
events_info->minute_of_last_legacy2_statusbar_change = -1;
events_info->legacy2_status_bar_change_event = (EventServiceInfo) {
.type = PEBBLE_TICK_EVENT,
.handler = prv_legacy2_status_bar_handler,
};
event_service_client_subscribe(
&events_info->le... | event_cleanup(&event) | |
(ctx, GPoint(20,20), GPoint(20,20));
graphics_context_set_antialiased(ctx, false);
graphics_context_set_stroke_width(ctx, 2);
graphics_draw_line(ctx, GPoint(30,30), GPoint(30,30));
graphics_context_set_antialiased(ctx, true);
graphics_context_set_stroke_width(ctx, 2);
graphics_draw_line(ctx, GPoint(40,40)... | prv_draw_lines(&ctx, 1, 0, 0) | ;
// Draw lines around boundaries of clipping box - AA true, SW 2
prv_draw_lines(&ctx, 2, CLIP_OFFSET, 0);
// Draw lines around boundaries of clipping box - AA true, SW 3
prv_draw_lines(&ctx, 3, 0, CLIP_OFFSET);
// Draw lines around boundaries of clipping box - AA true, SW 4
prv_draw_lines(&ctx, 4, CLIP_... |
)->handlers;
return *handlers;
}
AnimationPrivate *animation = prv_find_animation_by_handle(NULL, animation_h, false /*quiet*/);
if (!animation) {
return (AnimationHandlers) {0};
}
return animation->handlers;
}
// -------------------------------------------------------------------------------------... | {
// We need to enable other applib modules like scroll_layer, menu_layer, etc. which are
// compiled to use the 3.0 animation API to work with 2.0 apps.
return ((AnimationLegacy2 *)animation_h)->abs_start_time_ms;
} |
AnimationPrivate *animation = prv_find_animation_by_handle(NULL, animation_h, false /*quiet*/);
if (!animation) {
return 0;
}
return animation->abs_start_time_ms;
}
// -------------------------------------------------------------------------------------------
bool animation_set_duration(Animation *anima... |
indow_long_click_subscribe(BUTTON_ID_SELECT, 1000, prv_select_long_click_handler, NULL);
window_set_click_context(BUTTON_ID_SELECT, data);
window_single_click_subscribe(BUTTON_ID_BACK, prv_back_button_single_click_handler);
window_set_click_context(BUTTON_ID_BACK, data);
if (s_notification_window_data.is_moda... | if (is_visible == data->dnd_icon_visible) {
// nothing to do here
return;
} |
const GRect icon_rect = gbitmap_get_bounds(&data->dnd_icon);
#if PBL_ROUND
GRect new_status_frame = data->status_layer.layer.frame;
const int16_t icon_text_horizontal_spacing = 4;
const int16_t window_bounds_width = window_get_root_layer(&data->window)->bounds.size.w;
const int16_t title_width = status_lay... |
KS_HZ = 1024;
static const unsigned int TICKS_IN_INTERVAL = 60 * 60 * 24;
static uint32_t prv_get_asynchronous_prescaler(void) {
return (RTC->PRER >> 16) & 0x7f;
}
static uint32_t prv_get_synchronous_prescaler(void) {
return RTC->PRER & 0x1fff;
}
//! Are we in slow mode?
static bool prv_slow_mode() {
return pr... | (CURRENT_TIME_REGISTER) | ;
// Correct the saved time with the number of seconds we've been in standby mode
saved_time += elapsed_since_standby;
// Save time in the backup register so the firmware can read it once it boots
RTC_WriteBackupRegister(CURRENT_TIME_REGISTER, saved_time);
RTC_WriteBackupRegister(CURRENT_INTERVAL_TICKS_REGIS... |
// Test a basic gpoint property animation
void test_animation__property_gpoint(void) {
#ifdef TEST_INCLUDE_BASIC
PropertyAnimation *prop_h;
GPoint value;
GPoint start_value, end_value;
const int duration = 200;
const int delay = 25;
const AnimationHandlers handlers = {
.started = prv_started_handler,
... | (test_value, start_value) | ;
property_animation_get_to_gtransform(prop_h, &test_value);
cl_assert_equal_gtransform(test_value, end_value);
GTransform set_value;
set_value = GTransformIdentity();
property_animation_set_from_gtransform(prop_h, &set_value);
property_animation_get_from_gtransform(prop_h, &test_value);
cl_assert_equal... |
888, 232, -120},
{ 784, 160, -64},
{ 800, 48, 16},
{ 856, 8, 64},
{ 880, 64, 80},
{ 848, 128, 40},
{ 848, 152, -8},
{ 872, 184, -40},
{ 880, 176, -56},
{ 888, 192, -64},
{ 864, 160, -72},
{ 896, 144, -48},
{ 968, 168, -16},
{ 1008, 200, 8},
{ 1104, 152, 112},
... | { 960, 192, 32},
{ 936, 208, 56},
{ 848, 176, 88},
{ 792, 128, 96},
{ 784, 64, 120},
{ 776, 64, 112},
{ 784, 88, 72},
{ 880, 104, 80},
{ 960, 128, 80},
{ 1016, 184, 16},
{ 1128, 160, -8},
{ 1240, 216, 72},
{ 1064, 248, -40},
{ 952, 240, -128},
{ 792, 176, -112... |
{ 888, 88, 144},
{ 976, 104, 128},
{ 968, 120, 16},
{ 1168, 128, 16},
{ 1232, 184, 56},
{ 1008, 200, -96},
{ 904, 208, -208},
{ 808, 192, -136},
{ 840, 88, -8},
{ 896, 8, 88},
{ 888, 32, 96},
{ 856, 72, 40},
{ 808, 120, 0},
{ 808, 152, -48},
{ 872, 184, -80},... |
ineItemTypeReminder,
.layout_id = LayoutIdReminder,
.icon_id = TIMELINE_RESOURCE_NOTIFICATION_REMINDER,
.title = "Implementation Design Review",
.location = "High (Room 12)\nPebble PA Office",
.body = "with Liron Damir and 10 other people",
.time_offset = MINUTES(10),
}
};
#define NUM_NOTIFS ... | layer_add_child(root, (Layer *)status_layer) | |
unsigned int record_order = 0;
const AppRegistryEntry *reg_entry = prv_get_registry_list_entry(install_id, &record_order);
if (reg_entry) {
bool rv = false;
// switch on registry type
switch (reg_entry->type) {
case AppInstallStorageFw:
rv = prv_app_install_entry_from_fw_registry_entry(... | app_db_exists_install_id(id) | |
.h"
#include "stubs_passert.h"
#include "stubs_pbl_malloc.h"
#include "stubs_pebble_process_info.h"
#include "stubs_pebble_tasks.h"
#include "stubs_process_manager.h"
#include "stubs_prompt.h"
#include "stubs_serial.h"
#include "stubs_shell_prefs.h"
#include "stubs_sleep.h"
#include "stubs_syscalls.h"
#include "stubs_t... | {
s_clock_is_24h_style = true;
prv_set_data(&s_data, 10323, 7500, 8000, 0);
window_set_on_screen(&s_data.window, true, true);
window_render(&s_data.window, &s_ctx);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
} |
void test_kickstart__render_hr_bpm_24h(void) {
#if (PLATFORM_SILK || PLATFORM_ROBERT)
s_clock_is_24h_style = true;
prv_set_data(&s_data, 10323, 7500, 13000, 82);
window_set_on_screen(&s_data.window, true, true);
window_render(&s_data.window, &s_ctx);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FIL... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, STROKE_BIG) | |
/*
* 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_gpoint(result, GPoint(0, -5)) | ;
}
void test_graphics_circle__gpoint_from_polar_correct_scale(void) {
// edge cases are covered above, this test only verifies that
// the internal implementation correctly scales
GPoint result = gpoint_from_polar(GRect(0, 0, 10, 10), GOvalScaleModeFillCircle, 0);
cl_assert_equal_gpoint(result, GPoint(4, 0));... |
_stack =
modal_manager_get_window_stack(ModalPriorityGeneric);
cl_check(window_stack);
cl_check(!window_stack->list_head);
window_stack_push(window_stack, window, true);
cl_assert_equal_i(window_stack_count(window_stack), 1);
window_stack_pop(window_stack, true);
cl_assert_equal_i(window_stack_co... | (window1->on_screen, 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... | (&option_menu->window, animated) | ;
}
return option_menu;
}
void *settings_option_menu_get_context(SettingsOptionMenuData *data) {
return data->context;
}
|
(void) {
AppInstallEntry id_entry;
AppInstallEntry uuid_entry;
cl_assert_equal_b(true, app_install_get_entry_for_install_id(tictoc_id, &id_entry));
cl_assert_equal_b(true, app_install_get_entry_for_uuid(&tictoc_uuid, &uuid_entry));
cl_assert_equal_b(true, app_install_entries_equal(&id_entry, &uuid_entry));
... | cl_assert_equal_b(false, app_install_id_from_system(0)) | ;
cl_assert_equal_b(false, app_install_id_from_system(1));
cl_assert_equal_b(false, app_install_id_from_system(1000000));
}
void test_app_install_manager__is_from_app_db(void) {
cl_assert_equal_b(false, app_install_id_from_app_db(-1000000));
cl_assert_equal_b(false, app_install_id_from_app_db(-1));
cl_assert... |
, 56},
{ 1736, 632, 152},
{ 1440, 480, 136},
{ 864, 320, 88},
{ 1240, 264, 264},
{ 1624, 160, 312},
{ 1408, 16, 384},
{ 1128, 8, 304},
{ 1008, 72, 120},
{ 880, 72, 96},
{ 752, 40, 120},
{ 648, 0, 112},
{ 568, -56, 40},
{ 656, -64, -48},
{ 944, 16, -80},
{ 1656... | { 928, 440, 48},
{ 1120, 304, 80},
{ 1400, 200, 224},
{ 1360, 256, 216},
{ 1144, 80, 288},
{ 904, 8, 192},
{ 784, 32, 144},
{ 680, 8, 144},
{ 592, 0, 88},
{ 536, -16, 32},
{ 664, -40, -8},
{ 968, 88, -24},
{ 1576, 40, 200},
{ 1776, 72, 440},
{ 1352, 528, -40},... |
{ 1168, 640, -264},
// 19 seconds
{ 912, 408, -184},
{ 1112, 168, 192},
{ 1016, 288, 200},
{ 936, 88, 248},
{ 888, 272, 144},
{ 800, 320, 88},
{ 832, 352, -8},
{ 888, 304, 56},
{ 936, 432, -88},
{ 1104, 360, -56},
{ 1272, 280, -24},
{ 1728, 216, 144},
{ 1576,... |
rSuccess);
// No crash etc, client still alive:
cl_assert_equal_i(ppogatt_client_count(), 1);
cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), true);
cl_assert_equal_i(fake_comm_session_close_call_count(), 0);
}
void test_ppogatt__ack_received_data(void) {
test_ppogatt__open_session... | fake_comm_session_send_buffer_write_raw_by_transport(transport,
s_short_data_fragment,
sizeof(s_short_data_fragment)) | |
BD_ADDR_t BD_ADDR,
GAP_LE_Pairing_Capabilities_t *Capabilities,
GAP_LE_Event_Callback_t GAP_LE_Event_Callback,
unsigned long CallbackParameter) {
return 0;
}
// ---------------------------------------------... | (s_resolving_bd_addr) | ,
.is_random_address = true,
};
return &s_resolving_device;
}
Boolean_t GAP_LE_Resolve_Address(unsigned int BluetoothStackID, Encryption_Key_t *IRK,
BD_ADDR_t ResolvableAddress) {
return COMPARE_BD_ADDR(ResolvableAddress, s_resolving_bd_addr) &&
COMPARE_ENCRYPTION_KE... |
/*
* 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 (should_free_request) {
kernel_free(request);
} | |
info, tz_adjust_time);
} else if (clock_get_timezone_region_id() != UNKNOWN_TIMEZONE_ID) {
// If we have a timezone _actually_ set, update our own.
int region_id = clock_get_timezone_region_id();
prv_clock_get_timezone_info_from_region_id(region_id, tz_adjust_time, &tz_adjust_info);
tz_info ... | (rtc_get_time()) | ;
if (is_dst != was_dst) {
PebbleEvent e = {
.type = PEBBLE_SET_TIME_EVENT,
.set_time_info = {
.utc_time_delta = 0,
.gmt_offset_delta = 0,
.dst_changed = true,
}
};
event_put(&e);
s_dst_checker.cb_data = (void*)is_dst;
}
}
void clock_init(void) {
if (cloc... |
mation* prv_create_slide_animation(Layer *layer, GRect *from_frame, GRect *to_frame) {
Animation *anim = (Animation *)property_animation_create_layer_frame(layer, from_frame, to_frame);
animation_set_duration(anim, interpolate_moook_soft_duration(NUM_MID_FRAMES));
animation_set_custom_interpolation(anim, prv_inte... | (&health_card_view->window,
prv_click_config_provider, health_card_view) | |
/*
* 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_flash_read_next_byte() | ;
uint32_t type = prv_flash_read_next_byte();
uint32_t capacity = prv_flash_read_next_byte();
prv_flash_end_cmd();
// If we can't ready the flash info correctly, bail
CD_ASSERTN(manufacturer == 0x20 && type == 0xbb && (capacity >= 0x16));
}
static void prv_flash_write_enable(void) {
prv_flash_start_cmd();... |
/*
* 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_ASSERTN(!s_subscriber_count) | ;
smartstrap_fsm_state_set(SmartstrapStateUnsubscribed);
PBL_LOG(LOG_LEVEL_DEBUG, "Disconnecting from smartstrap");
smartstrap_link_control_disconnect();
smartstrap_comms_set_enabled(false);
new_timer_stop(s_monitor_timer);
// stop any in-progress write
accessory_send_stream_stop();
// release the acce... |
(&time, 0, 0) | ;
seconds_until_update = MIN(seconds_until_update, seconds_until_midnight);
}
}
if (s_data.is_in_schedule_period == is_enable_next) {
// Coming out of scheduled DND with manual DND on, turning it off
if (is_enable_next && do_not_disturb_is_manually_enabled()) {
do_not_disturb_set_manually_e... | |
/*
* 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... | bt_driver_test_set_spoof_address(&bd_addr) | ;
prompt_send_response_fmt(buffer, 32, BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(bd_addr));
} else {
prompt_send_response("?");
}
}
//! @param bt_name A custom Bluetooth device name.
void command_bt_set_name(const char *bt_name) {
bt_local_id_set_device_name(bt_name);
}
// BT FCC tests
void comman... |
dow){};
#ifndef RELEASE
window->debug_name = debug_name;
#else
(void)debug_name;
#endif
bool fullscreen = !process_manager_compiled_with_legacy2_sdk();
const GRect frame = window_calc_frame(fullscreen);
layer_init(&window->layer, &frame);
window->is_fullscreen = fullscreen;
window->layer.window = window;... | window_manager_get_top_window() | ;
prv_check_is_in_click_config_provider(window, "subscribe");
ClickManager *mgr = prv_get_current_click_manager();
ClickConfig *cfg = &mgr->recognizers[button_id].config;
cfg->multi_click.min = (min_clicks == 0) ? 2 : min_clicks;
cfg->multi_click.max = (max_clicks == 0) ? min_clicks : max_clicks;
cfg->mult... |
/*
* 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... | OS_TASK_NOTIFY(DialogTaskList[DialogTask_HostTrans], 0, eNoAction) | |
n_by_address_check(const BTDeviceInternal *addr) {
Connection *connection;
prv_lock();
{
connection = connection_by_address(addr);
PBL_ASSERTN(connection);
}
prv_unlock();
return connection;
}
static bool prv_connection_for_each_cb(ListNode *found_node, void *data) {
ForEachCbData *cb_data = (For... | {
if (connection_is_valid(connection)) {
connection->is_gateway = is_gateway;
}
} |
prv_unlock();
}
static char prv_debug_char_for_flag(ConnectionFlag flag) {
static const char s_debug_chars[] = {
[ConnectionFlag_IsSubscribedToConnectionStatusNotifications] = 'S',
[ConnectionFlag_IsSubscribedToGattMtuNotifications] = 'M',
[ConnectionFlag_IsSubscribedToConnParamNotifications] = 'C',
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return false;
} |
ResAppNum sys_get_current_resource_num(void) {
return 1; // 0 is system
}
size_t sys_resource_load_range(ResAppNum app_num, uint32_t id, uint32_t start_bytes,
uint8_t *buffer, size_t num_bytes) {
return emx_resources_read(app_num, id, start_bytes, buffer, num_bytes);
}
size_t sys_... |
el_malloc_check(SPRF_REGION_SIZE);
fake_spi_flash_erase();
memset(buf, 0x17, SPRF_REGION_SIZE);
flash_write_bytes(buf, FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, SPRF_REGION_SIZE);
kernel_free(buf);
}
static void prv_assert_mutexes_unlocked(void) {
cl_assert_equal_b(s_mutex_locked, false);
}
// Tests
//////////... | (&PAIRING_INFO, DEVICE_NAME,
false /* requires_address_pinning */, 0 /* flags */) | |
se {
window->is_waiting_for_click_config = true;
}
}
void window_set_click_config_provider(Window *window, ClickConfigProvider click_config_provider) {
window_set_click_config_provider_with_context(window, click_config_provider, NULL);
}
void window_set_click_context(ButtonId button_id, void *context) {
prv... | {
return window->click_config_context;
} |
void window_set_window_handlers(Window *window, const WindowHandlers *handlers) {
if (handlers) {
window->window_handlers = *handlers;
}
}
void window_set_window_handlers_by_value(Window *window, WindowHandlers handlers) {
window_set_window_handlers(window, &handlers);
}
void window_set_user_data(Window *... |
dler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MIN);
cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORM... | (animation_get_duration(a, false, false), duration_a) | ;
cl_assert_equal_i(animation_get_duration(a, false, true), play_count_a * duration_a);
cl_assert_equal_i(animation_get_duration(a, true, false), delay_a + duration_a);
cl_assert_equal_i(animation_get_duration(a, true, true), total_duration_a);
cl_assert_equal_i(animation_get_duration(b, false, false), duratio... |
/*
* 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... | (GColorRedARGB8, ctx.draw_state.stroke_color.argb) | ;
graphics_context_set_stroke_color(&ctx, (GColor8){.a= 2, .r = 3});
cl_assert_equal_i(GColorRedARGB8, ctx.draw_state.stroke_color.argb);
graphics_context_set_stroke_color(&ctx, (GColor8){.a= 1, .r = 3});
cl_assert_equal_i(GColorClearARGB8, ctx.draw_state.stroke_color.argb);
graphics_context_set_stroke_color(... |
izeof(Uuid)) == 0);
}
cl_assert(S_NO_MORE_ITEMS == reminder_db_next_item_header(&temp));
}
void test_reminder_db__size_test(void) {
prv_insert_default_reminders();
cl_assert(sizeof(SerializedTimelineItemHeader) == reminder_db_get_len((uint8_t*) &item1.header.id, sizeof(TimelineItemId)));
cl_assert(sizeof(... | (reminder_db_is_dirty(&is_dirty), S_SUCCESS) | |
lue_updated = true;
}
} else if (m_info.has_history) {
// This update is for a day in the past. Modify the copy stored in the settings file
SettingsFile *file = activity_private_settings_open();
if (!file) {
goto unlock;
}
ActivitySettingsValueHistory history;
settings_file_get(file,... | ACTIVITY_LOG_DEBUG("new active kcal: %"PRIu16"", state->step_data.active_kcalories) | ;
}
mutex_unlock_recursive(state->mutex);
}
// --------------------------------------------------------------------------------------------
// Called periodically from the minute handler to update step derived metrics that do not have to
// be updated in real time.
// We use NOINLINE to reduce the stack requireme... |
/*
* 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... | mfg_info_get_rtc_freq() | , 0);
mfg_info_set_rtc_freq(0xfefefefe);
cl_assert_equal_i(mfg_info_get_rtc_freq(), 0xfefefefe);
mfg_info_set_rtc_freq(1337);
cl_assert_equal_i(mfg_info_get_rtc_freq(), 1337);
}
void test_snowy_mfg_info__model(void) {
// Intentionally make the buffer too long so we can check for truncation.
char buffer[M... |
eason);
reset_due_to_software_failure();
}
}
bool xApplicationIsAllowedToRaisePrivilege(uint32_t caller_pc) {
// This function is called by portSVCHandler with the PC value of the
// function which initiated the SVC call requesting privilege elevation.
// The memory_region.c functions are not used for th... | analytics_set(ANALYTICS_DEVICE_METRIC_CPU_SLEEP_TIME, sleep_ms, AnalyticsClient_System) | ;
uint32_t now_ticks = rtc_get_ticks();
uint32_t ms_running =
ticks_to_milliseconds(now_ticks - s_last_ticks) - stop_ms - sleep_ms;
analytics_set(ANALYTICS_DEVICE_METRIC_CPU_RUNNING_TIME, ms_running, AnalyticsClient_System);
s_last_ticks = now_ticks;
s_analytics_device_sleep_cpu_cycles = 0;
s_analyt... |
prv_single_click_handler);
window_multi_click_subscribe(BUTTON_ID_DOWN, 2, 2, 100, false, prv_down_multi_click_handler);
SwapLayer *swap_layer = context;
if (swap_layer->callbacks.click_config_provider) {
swap_layer->callbacks.click_config_provider(swap_layer->context);
}
}
///////////////... | swap_layer_init(layer, &frame) | ;
}
return layer;
}
void swap_layer_destroy(SwapLayer *swap_layer) {
if (swap_layer == NULL) {
return;
}
swap_layer_deinit(swap_layer);
applib_free(swap_layer);
}
|
we land on to be killed when it shouldn't be.
launcher_cancel_force_quit();
// Make sure the process is safe to kill. If this method returns false, it will have set a timer to post
// another KILL event in a few seconds, thus giving the process a chance to clean up.
if (!process_manager_make_process_safe_to_k... | {
// Note that config has a dynamically allocated member that needs to be free'd with
// app_install_release_md if we don't actually proceed with launching the app.
const PebbleProcessMd *app_md = config->md;
const AppInstallId new_app_id = app_install_get_id_for_uuid(&app_md->uuid);
if (!config->restart &&... |
// ---------------------------------------------------------------------------------------------
void app_manager_handle_app_fetch_request_event(const PebbleAppFetchRequestEvent *const evt) {
PBL_ASSERTN(evt);
if (!evt->with_ui) {
return;
}
const AppFetchUIArgs *const fetch_args = evt->fetch_args;
app_m... |
/*
* 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 (reel) {
reel->impl->draw_processed(reel, ctx, offset, processor);
}
} |
void kino_reel_draw(KinoReel *reel, GContext *ctx, GPoint offset) {
kino_reel_draw_processed(reel, ctx, offset, NULL);
}
GSize kino_reel_get_size(KinoReel *reel) {
if (reel && reel->impl->get_size) {
return reel->impl->get_size(reel);
}
return GSize(0, 0);
}
size_t kino_reel_get_data_size(const KinoRee... |
/*
* 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 (sleep_duration <= 0) {
strncpy(buffer, EN_DASH, buffer_size);
return;
} |
health_util_format_hours_and_minutes(buffer, buffer_size, sleep_duration, i18n_owner);
}
static void prv_set_avg(char *buffer, size_t buffer_size, int32_t daily_avg, void *i18n_owner) {
#if PBL_ROUND
int avg_len = snprintf(buffer, buffer_size, "%s\n", i18n_get("30 DAY AVG", i18n_owner));
#else
int avg_len = sn... |
/*
* 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... | (2, b->bytes_written) | ;
cl_assert_equal_i(b->data[0], b1);
cl_assert_equal_i(b->data[1], b4);
free(b);
}
void test_buffer__can_remove_interior_data(void) {
uint8_t b1 = 1;
uint8_t b2 = 2;
uint8_t b3 = 3;
uint8_t b4 = 4;
Buffer *b = buffer_create(4);
buffer_add(b, &b1, sizeof(uint8_t));
buffer_add(b, &b2, sizeof(uint8_... |
/*
* 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... | time_get_gmtoffset() | ;
time_get_timezone_abbr(time_tm.tm_zone, sys_time);
time_tm.tm_isdst = time_get_isdst(sys_time);
return mktime(&time_tm);
}
bool ancs_notifications_util_is_phone(const ANCSAttribute *app_id) {
return (app_id && pstring_equal_cstring(&app_id->pstr, IOS_PHONE_APP_ID));
}
bool ancs_notifications_util_is_sms(co... |
e()\n");
cl_assert_equal_i(1, s_context.draw_state.fill_color.argb);
EXECUTE_SCRIPT("ctx.save()\n"); // 1
s_context.draw_state.fill_color.argb = 2;
EXECUTE_SCRIPT("ctx.save()\n"); // 2
s_context.draw_state.fill_color.argb = 3;
EXECUTE_SCRIPT("ctx.restore()\n"); // -> 2 (one element left)
cl_assert_equal... | EXECUTE_SCRIPT("ctx.textAlign = 'unknown';\n") | ;
cl_assert_equal_i(-1, s_rocky_text_state.alignment);
EXECUTE_SCRIPT("ctx.textAlign = 'left';\nvar a = ctx.textAlign;\n");
cl_assert_equal_i(GTextAlignmentLeft, s_rocky_text_state.alignment);
ASSERT_JS_GLOBAL_EQUALS_S("a", "left");
EXECUTE_SCRIPT("ctx.textAlign = 'right';\nvar a = ctx.textAlign;\n");
cl... |
-------------------------------------------
// Handling Bonding Changes
void test_gap_le_connect__removed_bonding_while_connected(void) {
BTDeviceInternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk();
BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_device();
// Register connection inten... | cl_assert_equal_b(fake_HCIAPI_whitelist_contains(&device), true) | ;
cl_assert_equal_i(fake_HCIAPI_whitelist_count(), 1);
}
|
*/
#include "accel_manager.h"
#include "console/prompt.h"
#include "drivers/accel.h"
#include "drivers/vibe.h"
#include "kernel/events.h"
#include "kernel/pbl_malloc.h"
#include "mcu/interrupts.h"
#include "os/mutex.h"
#include "services/common/analytics/analytics.h"
#include "services/common/event_service.h"
#incl... | accel_enable_shake_detection(false) | ;
prv_setup_subsampling(accel_get_sampling_interval());
}
}
mutex_unlock_recursive(s_accel_manager_mutex);
}
static void prv_double_tap_add_subscriber_cb(PebbleTask task) {
mutex_lock_recursive(s_accel_manager_mutex);
if (++s_double_tap_subscribers_count == 1) {
PBL_LOG(LOG_LEVEL_DEBUG, "Startin... |
ssage_handler = inbox->message_handler,
.dropped_handler = inbox->dropped_handler,
.num_failed = inbox->num_failed,
.num_success = inbox->num_success,
.it = inbox->buffer.storage,
.end = inbox->buffer.storage + inbox->buffer.write_index,
};
// Also mark that there is no event pend... | prv_lock() | ;
{
AppInboxNode *node = prv_find_inbox_by_storage(storage);
if (node) {
list_remove((ListNode *)node, (ListNode **)&s_app_inbox_head, NULL);
num_messages_lost = node->num_failed + node->num_success + (node->writer ? 1 : 0);
kernel_free(node);
}
}
prv_unlock();
return num_messages_... |
cl_assert_fixedS16_3(radius, 3.5);
}
void test_graphics_circle__grect_polar_calc_values_mode(void) {
GPointPrecise center = {};
Fixed_S16_3 radius = {};
GRect r = GRect(0, 0, 144, 168);
grect_polar_calc_values(&r, GOvalScaleModeFitCircle, ¢er, &radius);
cl_assert_gpoint_precise(center, 144 / 2 - 0.5, ... | {
cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_MAX_ANGLE * 2), 720);
cl_assert_equal_i(TRIGANGLE_TO_DEG(-TRIG_MAX_ANGLE * 2), -720);
cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_MAX_ANGLE), 360);
cl_assert_equal_i(TRIGANGLE_TO_DEG(-TRIG_MAX_ANGLE), -360);
cl_assert_equal_i(TRIGANGLE_TO_DEG(TRIG_PI / 2), 90);
cl_ass... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.