prefix string | middle string | suffix string |
|---|---|---|
DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V18P, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_VDD, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V18, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V14, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_FW, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_NSW, 0... | REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_DMY_NUM, 0x0) | ;
REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_EXT_HF_DS, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_EXT_BYTE_EN, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_DAT_RX_MD, 0x0);
REG_SETF(QSPIC, QSPIC_WRITEDATA_REG, QSPIC_WRITEDATA, 0x0);
REG_SETF(QSPIC, QSPIC_DUMMYDATA_REG, QSPIC_DUMMYDATA, 0x0);
R... |
ate state = {};
TimelineNode *head = NULL;
cl_assert_equal_i(timeline_init(&head), S_SUCCESS);
const time_t time_21_00_march_1_pst = 1425272400;
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture,
time_21_00_march_1_pst), S_SUCCESS)... | uuid_equal(&state.pin.header.id, &multiday_item.header.id) | );
cl_assert(uuid_equal(&state.node->id, &multiday_item.header.id));
cl_assert(state.node->all_day);
cl_assert_equal_i(state.node->timestamp, midnight_march_2_pst);
cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY);
cl_assert_equal_i(state.current_day, midnight_march_2_pst);
// day 2
cl_assert(ite... |
}
static bool prv_get_and_log_device_info(HRMDevice *dev, AS7000InfoRecord *info,
bool log_version) {
// get the device info
if (!prv_read_register_block(dev, ADDR_INFO_START, info, sizeof(AS7000InfoRecord))) {
return false;
}
if (log_version) {
// print out th... | led_enable(LEDEnablerHRM) | |
n_menu = context;
const TimelineItem *pin = timeline_action_menu->item;
const TimelineItemAction *action = action_menu_item->action_data;
time_t new_time = rtc_get_time() + (15 * SECONDS_PER_MINUTE);
prv_invoke_remote_action(action_menu, action, pin, (void *)(uintptr_t)new_time);
}
static void prv_postpone_la... | {
ActionMenuLevel *responses_level = prv_create_postpone_level(action, root_level);
action_menu_level_add_child(root_level, responses_level, label);
} | else {
action_menu_level_add_action(root_level, label, prv_action_menu_cb, action);
}
}
ActionMenuLevel *timeline_actions_create_action_menu_root_level(uint8_t num_items,
uint8_t separator_index,
... |
pdate_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_inside_origin_layer.${BIT_DEPTH_NAME}.pbi"));
layer_set_update_proc(&layer, &white_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(framebuffer_is_empty("... | 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 = TRIG_MAX_ANGLE + (TRIG_MAX_ANGLE / 8);
uint32_t ang... |
ds[0].points, points, sizeof(points));
GContext *ctx = (GContext *)123; // just a fake internal guard != NULL
gdraw_command_image_draw(ctx, image, GPoint(0, 0));
cl_assert_equal_i(s_path_num_points, 2);
cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points));
cl_assert(prv_compare_points(p... | {
GDrawCommandList *command_list = prv_create_command_list_3();
// The third command in the list is the largest so it's size should be returned by
// prv_get_list_max_command_size
cl_assert_equal_i(gdraw_command_get_data_size(gdraw_command_list_get_command(command_list, 2)),
prv_get_list_ma... | |
/*
* 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_pbi_eq_with_bounds(img_palettized, TEST_PALETTIZED_FILE, &test_bounds) | ;
gbitmap_destroy(img_palettized);
gbitmap_destroy(img_1bit);
}
|
/*
* 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 0;
} | |
/logging.h"
#include "os/mutex.h"
#include "system/passert.h"
#include "FreeRTOS.h"
#include "semphr.h"
#include <stdlib.h>
typedef enum {
LIGHT_STATE_ON = 1, // backlight on, no timeouts
LIGHT_STATE_ON_TIMED = 2, // backlight on, will start fading after a period
LIGHT_STATE_ON_FADING = 3, // ... | (ANALYTICS_APP_METRIC_BACKLIGHT_ON_TIME) | |
nclude "clar.h"
#include "services/normal/notifications/alerts_preferences.h"
#include "services/normal/notifications/ancs/ancs_notifications.h"
#include "services/normal/blob_db/ios_notif_pref_db.h"
// Stubs
////////////////////////////////////////////////////////////////
#include "stubs_analytics.h"
#include "stub... | ancs_notifications_handle_notification_removed(uid, ANCSProperty_IncomingCall) | ;
cl_assert_equal_i(fake_event_get_count(), 0);
// Make sure that we trigger an event when this is iOS9
ancs_notifications_handle_notification_removed(uid,
ANCSProperty_IncomingCall | ANCSProperty_iOS9);
PebbleEvent event = fake_event_get_last();
cl_assert_equ... |
draw_precise_stroked_aa(ctx, p0, p1, data->stroke_width);
} else {
graphics_draw_line(ctx, GPoint(p0.x.integer, p0.y.integer),
GPoint(p1.x.integer, p1.y.integer));
}
return;
}
if (data->operation == OP_ROTATE3) {
int line_length = 60;
time_t now;
uint16_t now... | window_destroy(s_window) | ;
}
static void s_main(void) {
init();
app_event_loop();
deinit();
}
const PebbleProcessMd* stroke_width_get_app_info(void) {
static const PebbleProcessMdSystem s_app_info = {
.common.main_func = s_main,
.name = "Stroke Width"
};
return (const PebbleProcessMd*) &s_app_info;
}
|
stem_task_callbacks_invoke_pending();
HRMSessionRef session_ref_2 = hrm_manager_subscribe_with_callback(INSTALL_ID_INVALID, 1,
expire_s, HRMFeature_BPM,
prv_fake_hrm_2_cb, NULL);
fake_... | (&event[i], &out_event[i], sizeof(PebbleHRMEvent)) | , false);
}
}
{ // Test reading back unaligned
for (int i = 0; i < NUM_TEST_EVENTS; ++i) {
circular_buffer_write(&cb, (const uint8_t *)&event[i], sizeof(PebbleHRMEvent));
}
PebbleHRMEvent out_event[NUM_TEST_EVENTS];
for (int i = 0; i < NUM_TEST_EVENTS; ++i) {
prv_read_event_from_buff... |
me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_round_rect(ctx, &GRect(2, -10, 28, 20), 4);
}
void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_layer(void) {
GContext ctx;
Layer layer;
test_graphics_context_ini... | cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)) | ;
#endif
}
#define RADIUS_DEFAULT 4
#define RECT_WIDTH 30
#define RECT_HEIGHT 40
#define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168)
#define ORIGIN_RECT_CLIP_XY GRect(0, 0, 20, 20)
#define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 144, 168)
#define ORIGIN_DRAW_RECT_N... |
polateInt64Function interpolate, GPointIndexLookup *lookup, Fixed_S32_16 duration_fraction,
bool is_offset) {
GPoint offset = GPointZero;
if (is_offset) {
offset = from.origin;
to.origin = gpoint_sub(to.origin, from.origin);
from.origin = GPointZero;
}
ScaleToCBContext ctx = {
.values = {
... | {
command->fill_color = to;
} |
if (gcolor_equal(from, command->stroke_color)) {
command->stroke_color = to;
}
}
bool prv_replace_color(GDrawCommand *command, uint32_t index, void *context) {
ReplaceColorCBContext *cb_context = context;
gdraw_command_replace_color(command, cb_context->from, cb_context->to);
return true;
}
void gdraw_... |
kdaySchedule, &schedule);
do_not_disturb_set_schedule_enabled(WeekdaySchedule, true);
active = do_not_disturb_is_active();
cl_assert(active == false); // not in Scheduled mode
rtc_set_time(s_thursday_01_00);
do_not_disturb_handle_clock_change(); // In scheduled period
do_not_disturb_set_manually_enabled(t... | do_not_disturb_toggle_smart_dnd() | ; // Only smart DND is on
cl_assert(do_not_disturb_is_smart_dnd_enabled() == true);
active = do_not_disturb_is_active();
cl_assert(active == false);
s_event_ongoing = true;
active = do_not_disturb_is_active();
cl_assert(active == true);
s_event_ongoing = false;
active = do_not_disturb_is_active();
c... |
ode == NULL) {
return NULL;
}
return node->prev;
}
ListNode* list_get_tail(ListNode* node) {
if (node == NULL) {
return NULL;
}
while (node->next != NULL) {
node = node->next;
}
return node;
}
ListNode* list_get_head(ListNode* node) {
if (node == NULL) {
return NULL;
}
while (node-... | {
ListNode *head_a = list_get_head(list_a);
if (list_b == NULL) {
return head_a;
}
ListNode *head_b = list_get_head(list_b);
if (list_a == NULL) {
return head_b;
}
if (head_a == head_b) {
// list b is already in list a!
return head_a;
}
ListNode *tail_a = list_get_tail(list_a);
h... |
void list_foreach(ListNode *head, ListForEachCallback each_cb, void *context) {
if (!each_cb) {
return;
}
ListNode *iter = head;
while (iter) {
// Save off a pointer so the client to this function can destroy the node (useful for deinits)
ListNode *next = iter->next;
if (!each_cb(iter, contex... |
l_assert_equal_i(sign_extend(7, 3), -1);
}
void test_math__serial_distance32(void) {
{
int32_t dist = serial_distance32(0x0, 0x1);
cl_assert_equal_i(dist, 1);
}
{
int32_t dist = serial_distance32(0x1, 0x0);
cl_assert_equal_i(dist, -1);
}
{
int32_t dist = serial_distance32(0x0, 0xfffffff... | cl_assert_equal_i(9, gcd(18, 9)) | |
direction);
const GRect *fin_from = &layer->end_of_timeline.layer.frame;
animations[num_animations++] = prv_create_bounce_back_animation(
&layer->end_of_timeline.layer, fin_from, direction);
Animation *animation = animation_spawn_create_from_array(animations, num_animations);
return animation;
}
void t... | timeline_relbar_layer_init(layer) | ;
#endif
}
void timeline_layer_deinit(TimelineLayer *layer) {
animation_unschedule_all();
for (int i = 0; i < TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER; i++) {
if (layer->layouts[i]) {
prv_destroy_layout(layer, i);
}
}
peek_layer_deinit(&layer->day_separator);
kino_layer_deinit(&layer->end_of_timeli... |
OpAssign, GColorWhite);
}
}
void graphics_patch_trace_of_moving_rect(GContext *ctx, int16_t *prev_x, GRect current) {
const int16_t new_x = current.origin.x;
int16_t src_x = 0; // just so that GCC accepts that src_x is always initialized
int16_t dst_x1 = INT16_MAX;
int16_t dst_x2 = INT16_MIN;
if (*prev_x =... | {
// Leave shifted-out areas alone
buf[0] = (buf[0] << lshift) | (buf[0] & (0xFF >> rshift));
} |
}
}
break;
}
case 8: {
uint8_t *const left_pixel = row_info.data + min_x;
uint8_t *const right_pixel = left_pixel + abs_delta;
if (pixels_to_move <= 0) {
// on this row, the delta is wider than the available pixels
if (patch_garbage) {
... |
prv_display_enter_static() | ;
s_display_context.complete();
signed portBASE_TYPE was_higher_priority_task_woken = pdFALSE;
xSemaphoreGiveFromISR(s_dma_update_in_progress_semaphore, &was_higher_priority_task_woken);
return was_higher_priority_task_woken != pdFALSE;
}
#if DISPLAY_ORIENTATION_ROTATED_180
prv_memcp... | |
}
};
Uuid i2;
uuid_generate(&i2);
TimelineItem e2 = {
.header = {
.id = i2,
.type = TimelineItemTypeNotification,
.status = 0,
.ancs_uid = 0,
.layout = LayoutIdGeneric,
.timestamp = 0x53f0dda6,
},
.attr_list = {
.num_attributes = 2,
.attributes =... | (&uuids[0], &r) | );
e.header.id = uuids[0];
e.header.timestamp = timestamp;
compare_notifications(&e, &r);
free(r.allocated_buffer);
cl_assert(notification_storage_get(&uuids[i - 1], &r));
e.header.id = uuids[i - 1];
e.header.timestamp = timestamp + i - 1;
compare_notifications(&e, &r);
free(r.allocated_buffer);
/... |
_test(TEST_PNG_FILE_FMT(1bitpalette));
cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(1bitpalette)));
cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat1BitPalette);
}
// Tests 1-bit red&white palettized PNG loading into gbitmap
// Result:
// - gbitmap matches platform loaded PNG
void test_png__colo... | TEST_PBI_FILE_FMT(2bitpalette) | ));
cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat2BitPalette);
}
// Tests 1-bit transparent greyscale PNG loading into gbitmap
// Result:
// - gbitmap matches platform loaded PNG
void test_png__greyscale_1_bit_transparent(void) {
GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(1bitpalette));
c... |
736},
{ 464, 320, -576},
{ 424, 424, -608},
{ 456, 400, -552},
{ 520, 424, -576},
{ 560, 344, -576},
{ 584, 280, -560},
{ 616, 216, -568},
// 5 seconds
{ 608, 336, -664},
{ 496, 272, -800},
{ 496, 408, -880},
{ 440, 616, -952},
{ 408, 560, -1096},
{ 360, 192, -816... | { 336, 808, 192},
{ 296, 864, 120},
{ 384, 816, 72},
{ 424, 880, -24},
{ 328, 928, 16},
{ 216, 1144, -96},
{ 256, 1336, -152},
{ 104, 984, 224},
{ 160, 1144, -48},
{ 272, 1024, -128},
{ 288, 616, -8},
{ 296, 856, -176},
{ 240, 600, 24},
{ 440, 704, -144},
{ 40... |
{ 320, 688, -152},
{ 344, 776, -96},
{ 352, 848, -24},
{ 152, 1152, -120},
{ 184, 824, 80},
{ 144, 1656, 120},
{ 72, 1232, 264},
{ 200, 1216, 192},
{ 168, 896, 192},
{ 224, 816, 64},
{ 184, 688, 104},
{ 232, 752, 112},
{ 216, 856, 136},
{ 200, 912, 112},
{ 27... |
i18n_get(message, dialog) | );
dialog_set_text(dialog, buffer);
}
dialog_set_icon(dialog, data->warning_icon);
}
static void prv_dialog_on_unload(void *context) {
Dialog *dialog = context;
i18n_free_all(dialog);
if (dialog == s_dialog) {
s_dialog = NULL;
}
}
static void prv_display_modal(WindowStack *stack, DialogUpdateFn u... | |
/*
* 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... | (HcEndpointID_GapService, HcMessageId_GapService_MtuChanged,
(const uint8_t *)&mtu_resp, sizeof(mtu_resp)) | |
itch (simple_state) {
case StateWaitForReady:
if (event->type == VoiceEventTypeSessionSetup) {
prv_handle_ready_event(data, event);
}
break;
case StateWaitForResponse:
if (event->type == VoiceEventTypeSessionResult) {
prv_handle_dictation_result(data, event);
}
... | ((Animation *) anim, duration) | ;
animation_set_curve((Animation *) anim, AnimationCurveEaseInOut);
return anim;
}
static const PropertyAnimationImplementation s_animated_dot_impl = {
.base = {
.update = (AnimationUpdateImplementation) property_animation_update_int16,
},
.accessors = {
.setter = { .int16 = prv_set_d... |
{
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_25296_5
//> TEST_EXPECTED 100
//> TEST_EXPECTED_MIN 80
//> TEST_EXPECTED_MAX 120
//> TEST_WEIGHT 1.0
static AccelRawData samples[] = {
// 0 seconds
// elapsed: 0 minutes
{ -120, -288, -1008},
{... |
{ 112, 776, -360},
{ 144, 840, -512},
{ 208, 848, -576},
{ 320, 928, -552},
{ 256, 832, -568},
{ 384, 864, -608},
{ 280, 696, -528},
{ 416, 864, -552},
{ 448, 696, -480},
{ 456, 496, -400},
{ 632, 416, -360},
{ 872, 408, -208},
{ 1360, 352, -128},
{ 1512, 224, 8}... | |
8, 1016, 0},
{ 488, 784, -32},
{ 552, 688, -104},
{ 680, 496, -40},
{ 896, 528, -184},
{ 1104, 496, -384},
{ 1496, 576, -576},
{ 1720, 672, -408},
{ 1392, 152, -72},
{ 1376, 176, -384},
// 61 seconds
{ 1392, 360, -528},
{ 992, 192, -584},
{ 840, 128, -648},
{ 832,... | { 1352, 848, 488},
{ 968, 1208, 328},
{ 904, 1552, -8},
{ 976, 1112, 56},
{ 912, 1032, 16},
{ 1096, 712, 48},
{ 1136, 344, 232},
{ 1008, 392, 352},
{ 808, 432, 368},
{ 848, 368, 344},
{ 776, 480, 104},
{ 728, 528, -16},
{ 488, 400, -104},
{ 232, 208, -208},
{ ... |
{ 848, 432, -688},
// 69 seconds
{ 808, 336, -488},
{ 776, 328, -336},
{ 952, 336, -744},
{ 784, 496, -592},
{ 696, 432, -576},
{ 920, 424, -704},
{ 488, 144, -544},
{ 400, -16, -560},
{ 336, -8, -624},
{ 504, 224, -648},
{ 1136, 480, -624},
{ 952, 296, -688},
... |
/*
* 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_vibe_history_clear(vibe->time_start - MAX_HISTORY_MS) | ;
mutex_unlock(s_vibe_history_mutex);
}
// Ends the last vibration event
static void prv_vibe_history_end_event(void) {
if (!s_vibe_history_enabled) {
return;
}
if (!s_vibe_history) {
// Possible that it was enabled while the watch was vibrating
return;
}
time_t s;
uint16_t ms;
rtc_get_tim... |
/*
* 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... | {
GDrawState prev_state = graphics_context_get_drawing_state(ctx);
graphics_context_set_fill_color(ctx, bg_color);
graphics_fill_rect(ctx, &layer->bounds);
graphics_context_set_drawing_state(ctx, prev_state);
} |
}
//! helper struct to move displacement logic out of window_render()
typedef struct {
GPoint drawing_box_origin;
GRect clip_box;
} DrawingStateOrigins;
static void prv_adjust_drawing_state_for_legacy2_apps(DrawingStateOrigins *saved_state,
GContext *ctx, Win... |
24, -1000},
{ 48, 24, -992},
{ 56, 24, -1000},
{ 48, 24, -1000},
{ 56, 24, -1000},
{ 48, 24, -1000},
{ 48, 16, -1008},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 16, -1000},
{ 48, 16, -1000},
{ 48, 24, -1000},
... | { 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 16, -992},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 56, 24, -1000},
{ 48, 32, -1000},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 40,... |
{ 48, 24, -1000},
{ 48, 24, -992},
{ 48, 32, -1000},
{ 48, 24, -1000},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 16, -1000},
{ 48, 32, -992},
{ 48, 24, -1000},
{ 56, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -992},
{ 48, 24, ... |
ssert(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__8bit_wrap_x-expect.8bit.pbi"));
gbitmap_destroy(src_bitmap);
}
// Test vertical wrapping when dest_rect taller than src_bitmap.
// Setup:
// - Source is 25 x 10
// - 4 rows red, 2 rows blue, 4 rows black.
// - Dest is Green, 50 x 50
// - Dest Rect is 10 x 24 ... | cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_and-expect.8bit.pbi")) | ;
memset(dest_data, GColorBlue.argb, sizeof(dest_data));
bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpClear, GColorWhite);
cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_clear-expect.8bit.pbi"));
memset(dest_data, GColorBlue.argb, sizeof(dest_data));
bitblt_bitmap... |
SettingsRecordInfo *info,
void *context) {
if (info->key_len != sizeof(BTBondingID)) {
return true;
}
if (info->val_len == 0) {
return true;
}
BtPersistBondingData data;
info->get_val(file, &data, sizeof(data));
... | shared_prf_storage_get_bt_classic_pairing_data(&bd_addr, name, &link_key, &platform_bits) | ) {
// No pairing available, check to see if we have a pairing in the gapDB
prv_push_bt_persist_to_shared_prf(BtPersistBondingTypeBTClassic);
return;
}
bt_persistent_storage_store_bt_classic_pairing(&bd_addr, &link_key, name, &platform_bits);
}
static void prv_load_ble_pairing_from_prf(void) {
SMPai... |
136, -984},
{ -152, -136, -992},
{ -160, -128, -1008},
{ -160, -152, -1000},
{ -144, -128, -1008},
{ -160, -136, -960},
{ -160, -112, -1000},
{ -144, -112, -1024},
{ -152, -144, -984},
{ -152, -128, -992},
{ -160, -128, -992},
{ -160, -144, -992},
{ -152, -120, -1000},
... | { -152, -144, -1000},
{ -160, -144, -976},
{ -160, -144, -992},
{ -152, -152, -1000},
{ -152, -144, -984},
{ -152, -136, -1000},
{ -152, -136, -992},
{ -160, -136, -992},
{ -160, -136, -992},
{ -160, -144, -992},
{ -152, -144, -984},
{ -152, -160, -992},
{ -160, -144,... | |
-160, -952},
{ 0, -184, -928},
// 2 seconds
{ -16, -152, -952},
{ -48, -184, -992},
{ -224, -248, -1024},
{ -168, -96, -1080},
{ -8, 280, -1096},
{ 336, 336, -1016},
{ 312, 400, -848},
{ 440, 456, -632},
{ 400, 528, -712},
{ 440, 432, -616},
{ 392, 280, -696},
{ 3... | { 256, 904, -280},
{ 256, 840, -240},
{ 280, 888, -232},
{ 336, 920, -200},
{ 288, 928, -216},
{ 288, 920, -224},
{ 248, 920, -216},
{ 288, 912, -248},
{ 280, 928, -256},
// 8 seconds
{ 264, 864, -264},
{ 240, 880, -272},
{ 176, 776, -336},
{ 176, 768, -416},
... | |
/*
* 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 GBitmapFormat1Bit:
case GBitmapFormat1BitPalette:
return 1;
case GBitmapFormat2BitPalette:
return 2;
case GBitmapFormat4BitPalette:
return 4;
case GBitmapFormat8Bit:
case GBitmapFormat8BitCircular:
return 8;
} |
return 0;
}
//! @return the size in bytes of the palette for a given format
uint8_t gbitmap_get_palette_size(GBitmapFormat format) {
switch (format) {
case GBitmapFormat1Bit:
case GBitmapFormat8Bit:
case GBitmapFormat8BitCircular:
return 0;
default:
return (1 << gbitmap_get_bits_per_pi... |
/*
* 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... | fake_event_get_last() | ;
cl_assert_equal_i(event.type, PEBBLE_BLE_GATT_CLIENT_EVENT);
cl_assert_equal_i(event.bluetooth.le.gatt_client_service.subtype,
PebbleBLEGATTClientEventTypeServiceChange);
cl_assert_equal_i(event.bluetooth.le.gatt_client_service.info->status,
status);
const BTDeviceInter... |
ify that UUID remains
// unchanged.
// struct AppHeartbeat {
// [...]
// uint32 TIME_INTERVAL
// Uuid UUID
// uint8 SDK_MAJOR_VERSION
// [...]
// }
void test_analytics_heartbeat__test_read_write_sanity(void) {
// Set Metrics
AnalyticsHeartbeat *heartbeat = analytics_heartbeat_app_create(&... | analytics_heartbeat_set(heartbeat, metric, pattern(i, 8)) | |
t(shared_circular_buffer_read(&buffer, &client, 4, &out_buffer, &out_length));
cl_assert_equal_i(out_length, 4);
cl_assert(memcmp(out_buffer, "1234", 4) == 0);
cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 2);
cl_assert(shared_circular_buffer_consume(&buffer, &client, 4));
cl_a... | (out_length, 2) | ;
cl_assert(memcmp(out_buffer, "bc", 2) == 0);
cl_assert(shared_circular_buffer_consume(&buffer, &client1, 2));
cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 0);
// Should fail, not enough room because client 2 is full
cl_assert(!shared_circular_buffer_write(&buffer, (uint8_t... |
reate();
animation_set_implementation(mode_change, &s_mode_change_impl);
animation_set_handlers(mode_change, (AnimationHandlers){ 0 }, layer);
return animation_spawn_create(animation, mode_change, NULL);
}
static void prv_draw_round_flip(GContext *ctx, const GRect *layer_bounds, const int sidebar_x) {
// Use ... | (0, (style->thin_pin_height +
style->past_thin_pin_margin)) | |
_is_enabled, true);
cl_will_return(dcache_is_enabled, true);
cl_will_return(icache_line_size, 8);
cl_will_return(dcache_line_size, 16);
cl_will_return(syscall_internal_check_return_address, true);
s_user_start = 0x00;
s_user_size = 0x20;
memory_cache_flush((void*)0x0F, 0x2);
cl_assert_equal_i(s_flus... | ((void*)0x20, 0x1) | ;
cl_assert_equal_i(s_flush_addr, 0xAA55);
cl_assert_equal_i(s_flush_size, 0x55AA);
cl_assert_equal_i(s_invalidate_addr, 0x20);
cl_assert_equal_i(s_invalidate_size, 0x01);
cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Invalid);
}
void test_cpu_cache__without_cache(void) {
cl_will_return(icache_is_enab... |
/*
* 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_state, &rcv_bytes, &rcv_protocol) | ;
cl_assert(rcv_msg);
cl_assert_equal_i(rcv_protocol, QemuProtocol_SPP);
cl_assert_equal_i(rcv_bytes, sizeof(msg_data));
cl_assert_equal_m(msg_data, rcv_msg, sizeof(msg_data));
// -----------------------------------------------------------------------------
// Send 2 messages before checking
for (int i=0... |
Animation *a = prv_create_test_animation();
animation_set_duration(a, duration_a);
animation_set_delay(a, delay_a);
animation_set_play_count(a, play_count_a);
Animation *b = prv_create_test_animation();
animation_set_duration(b, duration_b);
animation_set_delay(b, delay_b);
animation_set_play_count(b,... | (spawn, true, true) | , duration_total);
animation_destroy(spawn);
#endif
}
// --------------------------------------------------------------------------------------
// Test unschedule all when we have multiple animations, some complex
void test_animation__unschedule_all(void) {
#ifdef TEST_INCLUDE_COMPLEX
// Create animations
/... |
/*
* 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... | animation_set_duration((Animation*)a, DURATION) | ;
animation_set_handlers((Animation*) a, (AnimationHandlers) {
.started = (AnimationStartedHandler) animation_started,
.stopped = (AnimationStoppedHandler) animation_stopped,
}, NULL /* callback data */);
PropertyAnimation *a_rev = property_animation_clone(a);
animation_set_handlers((Animation*) a_rev,... |
/*
* 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... | (event->callback.data) | ;
return true;
default:
PBL_LOG_VERBOSE("Received an unhandled event (%u)", event->type);
return false;
}
}
// -------------------------------------------------------------------------------------------------
void worker_event_loop(void) {
// Event loop:
while (1) {
PebbleEvent event;... |
/*
* 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_assert_data_matches_expected(data, length) | ;
}
static void prv_endpoint_handler_b(
CommSession *session, const uint8_t *data, size_t length) {
s_handler_call_count[HandlerB]++;
prv_assert_data_matches_expected(data, length);
}
static void prv_endpoint_handler_c(
CommSession *session, const uint8_t *data, size_t length) {
s_handler_call_count[Han... |
T_DEVICE_NAME_BUFFER_SIZE];
bool requires_address_pinning;
uint8_t flags;
if (!shared_prf_storage_get_ble_pairing_data(&prf_pairing_info, device_name,
&requires_address_pinning,
&flags)) {
// No pairing available, ch... | bt_local_addr_handle_bonding_change(bonding, op) | |
*att_value,
uint16_t att_length);
extern void gatt_client_subscriptions_handle_write_cccd_response(BLEDescriptor cccd,
BLEGATTError error);
extern uint16_t gatt_client_characteristic_get_... | {
uint16_t value_length = assert_value_length;
gatt_client_subscriptions_consume_notification(&characteristic_out, buffer, &value_length,
GAPLEClientKernel, NULL);
cl_assert_equal_i(memcmp(buffer, value, value_length), 0);
cl_assert_equal_i(ch... | |
ponse for Characteristic %s (error=%u)",
uuid_buffer, error);
}
static void subscribe_handler(BLECharacteristic characteristic,
BLESubscription subscription_type,
BLEGATTError error) {
char uuid_buffer[UUID_STRING_BUFFER_LENGTH];
Uuid characteri... | bt_device_get_address(device) | ;
const bool connected = (connection_status == BTErrnoConnected);
APP_LOG(APP_LOG_LEVEL_INFO, "%s " BT_DEVICE_ADDRESS_FMT " (status=%d)",
connected ? "Connected" : "Disconnected",
BT_DEVICE_ADDRESS_XPLODE(address), connection_status);
ble_client_discover_services_and_characteristics(device)... |
// aiming for width / 2 - 0.5 to get the true center
return (GPointPrecise) {
.x = { .integer = bounds->size.w / 2 - 1, .fraction = 3 },
.y = { .integer = bounds->size.h / 2 - 1, .fraction = 3 }
};
}
return GPointPreciseFromGPoint(imprecise_center_point);
}
static void prv_draw_clo... | ((AppFocusHandlers) {
.did_focus = prv_app_did_focus,
}) | ;
}
static void prv_deinit(void) {
MultiWatchData *data = app_state_get_user_data();
window_destroy(&data->window);
watch_model_cleanup();
}
void tictoc_main(void) {
prv_init();
app_event_loop();
prv_deinit();
}
|
015, 13:30:00 (T+01:30:00)
rtc_set_time(event_time + SECONDS_PER_HOUR + (30 * SECONDS_PER_MINUTE));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("2 H AGO", time_buf);
// June 9th 2015, 13:59:59 (T+01:59:59)
rtc_set_time(event_time + SECONDS_PER... | cl_assert_equal_s("Yesterday, 12:00 PM", time_buf);
// June 10th 2015, 11:00:00 (T+23:00:00)
rtc_set_time(event_time + (23 * SECONDS_PER_HOUR));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("Yesterday, 12:00 PM", time_buf);
} | |
ess Logic
static void prv_quit(void *data) {
i18n_free_all(data);
app_window_stack_pop_all(true);
}
static const char *prv_get_dialog_text(ProgressUIData *data, bool success) {
if (data->progress_source == PROGRESS_UI_SOURCE_FW_UPDATE) {
return success ? i18n_get("Update Complete", data) : i18n_get("Update ... | (&data->finished_dialog.dialog, &(DialogCallbacks) {
.unload = prv_dialog_unloaded,
}, data) | ;
dialog_set_destroy_on_pop(&data->finished_dialog.dialog, false);
const int16_t load_bar_length = 108;
const int16_t x_offset = (window->layer.bounds.size.w - load_bar_length) / 2;
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
const int16_t y_offset_progress = 123;
const int16_t y_offset_text = 85;
#else
const... |
some more until 11pm PST
prv_feed_cannned_accel_data(8 * SECONDS_PER_HOUR, 50, ActivitySleepStateAwake);
// Starting at 11pm: 2 Cycles of 3 hrs each light (165 min), awake (15 min)
for (int i = 0; i < 2; i++) {
prv_feed_cannned_accel_data(165 * SECONDS_PER_MINUTE, 0, ActivitySleepStateLightSleep);
prv_f... | (
HealthMetricStepCount, time_start_of_today() - (12 * SECONDS_PER_HOUR),
time_start_of_today()) | |
/*
* 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... | uuid_equal(uuid, &launcher_menu_app_get_app_info()->uuid) | ) {
return false;
}
#endif
return true;
}
// ------------------------------------------------------------------------------------------
// Log an out-of-memory situation for an app.
void analytics_event_app_oom(AnalyticsEvent type,
uint32_t requested_size, uint32_t total_size, ui... |
_size packets in flight:
for (sn = 0; sn < s_tx_window_size; ++sn) {
cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport,
s_short_data_fragment,
sizeof(s_short_data_fragme... | regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS) | |
9ea0)}, inconsistent with Pebble color
{"chartreuse", GColorARGB8FromHEX(0x7fff00)},
{"chocolate", GColorARGB8FromHEX(0xd2691e)},
{"coral", GColorARGB8FromHEX(0xff7f50)},
{"cornflowerblue", GColorARGB8FromHEX(0x6495ed)},
{"cornsilk", GColorARGB8FromHEX(0xfff8dc)},
{"crimson", GColorARGB8FromHEX(0xdc143c)},
... | (0xffe4b5) | },
{"navajowhite", GColorARGB8FromHEX(0xffdead)},
{"oldlace", GColorARGB8FromHEX(0xfdf5e6)},
{"olivedrab", GColorARGB8FromHEX(0x6b8e23)},
{"orangered", GColorARGB8FromHEX(0xff4500)},
{"orchid", GColorARGB8FromHEX(0xda70d6)},
{"palegoldenrod", GColorARGB8FromHEX(0xeee8aa)},
{"palegreen", GColorARGB8FromHEX... |
/*
* 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... | (bytes_remaining, temp_buffer_size) | ;
comm_session_send_queue_copy(session, 0 /* start_offset */, bytes_to_copy, temp_buffer);
qemu_serial_send(QemuProtocol_SPP, temp_buffer, bytes_to_copy);
comm_session_send_queue_consume(session, bytes_to_copy);
bytes_remaining -= bytes_to_copy;
}
kernel_free(temp_buffer);
}
// --------------------... |
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 this check as this function
// is in a hot code-path and needs to execute as quickly as possible.
// All syscall functions are lumped tog... | 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_analytics_device_stop_ticks = 0;
}
void analytics_external_collect_app_cpu_stats(void) {
static uint32_t s_last_ticks = 0;
... |
->attributes[i].uint32_list, attribute->length);
break;
default:
attribute->length = 0;
break;
}
buffer += attribute->length;
PBL_ASSERTN(buffer <= buf_end);
}
return buffer - buf_start;
}
bool attribute_deserialize_list(char **buffer, char *const buf_end,
cons... | (LOG_LEVEL_WARNING, "Adding attribute with type cstring for non-cstring attribute") | ;
}
prv_add_attribute(list, id)->cstring = (char*) cstring;
}
void attribute_list_add_uint32(AttributeList *list, AttributeId id, uint32_t uint32) {
if (prv_attribute_type(id) != AttributeTypeUint32) {
PBL_LOG(LOG_LEVEL_WARNING, "Adding attribute with type uint32 for non-uint32_t attribute");
}
prv_add_a... |
way
ret = bt_persistent_storage_get_active_gateway(&id_out, &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);
// Manually set the active gateway
bt_persistent_... | bt_persistent_storage_is_unfaithful() | ;
cl_assert(ret);
// We should be unfaithful
ret = bt_persistent_storage_is_unfaithful();
cl_assert(ret);
// A "sync" happened. We are now faithful
bt_persistent_storage_set_unfaithful(false);
ret = bt_persistent_storage_is_unfaithful();
cl_assert(!ret);
// Another "sync" happened. We should still ... |
enable_display_spi_clock() {
periph_config_enable(RCC_APB1PeriphClockCmd, DISPLAY_SPI_CLOCK);
}
static void prv_disable_display_spi_clock() {
periph_config_disable(RCC_APB1PeriphClockCmd, DISPLAY_SPI_CLOCK);
}
static void prv_enable_chip_select(void) {
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET);
// requi... | prv_display_write_byte(DISP_MODE_WRITE) | ;
}
static void prv_display_write_line(uint8_t line_addr, const uint8_t *line) {
// 1-indexed (ugh) 8bit line address (1-168)
prv_display_write_byte(prv_reverse_bits(line_addr + 1));
for (int i = 0; i < DISP_LINE_BYTES; ++i) {
prv_display_write_byte(prv_reverse_bits(line[i]));
}
prv_display_write_byte(... |
account for the dest_shift when loading up the new glyph block
rotl32(src, glyph_block_bits_left + dest_shift);
src_rotated = glyph_block_bits_left + dest_shift;
}
dest_block += clipped_blocks;
}
while (dest_block != dest_block_end && glyph_line_bits_left) {
PBL_ASSERT(dest_... | (ctx, clipped_glyph_target) | ;
}
void text_render_set_special_codepoint_cb(SpecialCodepointHandlerCb handler, void *context) {
TextRenderState *state = app_state_get_text_render_state();
state->special_codepoint_handler_cb = handler;
state->special_codepoint_handler_context = context;
}
|
stack_push(&data->status_window, true);
}
}
static bool prv_test_is_running(AppData *data) {
return (data->current_test_step != BTLETestStep_None);
}
//--------------------------------------------------------------------------------
// Number Windows
//-------------------------------------------------------------... | (FONT_KEY_GOTHIC_24_BOLD) | |
/*
* 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... | (out_buffer, "1234", 4) | |
rt_equal_b(fake_gatt_is_service_discovery_running(), false);
}
// -------------------------------------------------------------------------------------------------
// Watchdog timeout tests
static void prv_fire_watchdog_timeouts(const BTDeviceInternal *device, int retries) {
for (int i = 0; i <= retries; ++i) {
... | (&device, BTErrnoWithBluetopiaError(BTGATT_ERROR_INVALID_PARAMETER)) | ;
}
// -------------------------------------------------------------------------------------------------
// Re-discovery
extern BTErrno gatt_client_discovery_rediscover_all(const BTDeviceInternal *device);
void test_gatt_client_discovery__rediscover_not_already_running(void) {
BTDeviceInternal device = prv_connect... |
------------------------------
static void prv_test_fill_sleep(void *context) {
// Fill the sleep file
bool success = activity_test_fill_minute_file();
prv_test_end(context, success);
}
// -------------------------------------------------------------------------------
static void select_click_handler(ClickRecog... | for (uint32_t i = 0; i < num_tests; i++) {
menu_items[i] = (SimpleMenuItem) {
.title = s_test_entries[i].title,
.callback = prv_test_begin
};
} |
static SimpleMenuSection sections;
sections.items = menu_items;
sections.num_items = num_tests;
data->menu_items = menu_items;
data->menu_layer = simple_menu_layer_create(bounds, window, §ions, 1, data /*context*/);
layer_add_child(window_layer, simple_menu_layer_get_layer(data->menu_layer));
// St... |
LED(graphics_line_draw_stroked_non_aa(&context, GPoint(5, 5), GPoint(45, 10), SW_EVEN));
setup_test(&context, false, SW_EVEN, GColorBlack, GColorBlack, false);
graphics_draw_rect(&context, &GRect(10, 20, 40, 10));
ASSERT_CALLED(prv_draw_rect_stroked(&context, &GRect(10, 20, 40, 10), SW_EVEN));
setup_test(&con... | GPoint(50, 50) | , 10, SW_EVEN));
#else
ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_EVEN));
#endif
setup_test(&context, true, SW_EVEN, GColorBlack, GColorBlack, false);
graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4);
#if PBL_COLOR
ASSERT_CALLED(prv_draw_round_rect_aa_stroke... |
our backing store
int prefs_private_get_backing_len(const uint8_t *key, size_t key_len) {
const PrefsTableEntry *entry = prv_prefs_entry(key, key_len);
if (!entry) {
return 0;
}
return entry->value_len;
}
// ------------------------------------------------------------------------------------
// Exported ... | {
if (s_backlight_enabled) {
if (s_backlight_ambient_sensor_enabled) {
return BacklightBehaviour_Auto;
} else {
return BacklightBehaviour_On;
}
} else {
return BacklightBehaviour_Off;
}
} |
bool backlight_is_enabled(void) {
return s_backlight_enabled;
}
void backlight_set_enabled(bool enabled) {
prv_pref_set(PREF_KEY_BACKLIGHT_ENABLED, &enabled, sizeof(enabled));
}
bool backlight_is_ambient_sensor_enabled(void) {
#if INFINITE_BACKLIGHT
return false;
#endif
return s_backlight_ambient_sensor_ena... |
, dummy);
cl_assert_equal_p(r->subscriber.data, &sub_data);
cl_assert_equal_i(r->state, RecognizerState_Possible);
cl_assert_equal_i(r->flags, 0);
cl_assert_equal_p(r->simultaneous_with_cb, NULL);
cl_assert_equal_p(r->fail_after, NULL);
cl_assert_passert(recognizer_create_with_data(NULL, &s_test_impl_data,... | (recognizer_transition_state(r, RecognizerState_Failed)) | ;
cl_assert_passert(recognizer_transition_state(r, RecognizerState_Possible));
cl_assert_passert(recognizer_transition_state(r, RecognizerState_Started));
event_type = -1;
recognizer_transition_state(r, RecognizerState_Updated);
cl_assert_equal_i(event_type, RecognizerEvent_Updated);
cl_assert_equal_i(r->s... |
dress *addr, SM128BitKey *link_key,
const char *name, uint8_t *platform_bits, void *context) {
SettingsBluetoothData *data = (SettingsBluetoothData*) context;
if (!data) {
return;
}
// Determine the address of our active remote, if we have one.
BTDeviceAddress active... | prv_clear_remote_list(data) | ;
prv_add_bt_classic_remotes(data);
prv_add_and_merge_ble_remotes(data);
}
static void settings_bluetooth_update_remotes_private(SettingsBluetoothData* data) {
prv_reload_remote_list(data);
if (!data->remote_list_head) {
strncpy(data->header_buffer, i18n_get("Pairing Instructions", data), HEADER_BUFFER_SI... |
/*
* 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 kino_reel_gbitmap_create_with_resource_system(app_num, resource_id);
} |
}
default:
// We don't have any good way to validate that something
// is indeed a gbitmap. We use it as our fallback.
return kino_reel_gbitmap_create_with_resource_system(app_num, resource_id);
}
return NULL;
}
void kino_reel_destroy(KinoReel *reel) {
if (reel) {
reel->impl->de... |
_num_points, 0);
cl_assert_equal_b(s_path_open, false);
cl_assert_equal_i(s_path_fill_count, 0);
cl_assert_equal_i(s_path_stroke_count, 0);
cl_assert_equal_p(s_stroke_points, NULL);
cl_assert_equal_p(s_fill_points, NULL);
free(command);
}
void test_gdraw_command__draw_precise_path(void) {
GDrawCommand *... | cl_assert_equal_i(s_stroke_width, 2) | ;
cl_assert_equal_i(s_path_num_points, 1);
cl_assert_equal_b(s_radius, 300);
cl_assert_equal_i(s_circle_fill_count, 0);
cl_assert_equal_i(s_circle_stroke_count, 1);
cl_assert(prv_compare_points(¢er, s_stroke_points, s_path_num_points));
cl_assert_equal_p(s_fill_points, NULL);
prv_reset();
// set st... |
// correctly.
void test_animation__sequence_of_already_completed(void) {
#ifdef TEST_INCLUDE_COMPLEX
const int duration_a = 300;
const int duration_b = 500;
const int delay_b = 20;
const int delay_seq = 30;
const AnimationHandlers handlers = {
.started = prv_started_handler,
.stopped = prv_stoppe... | animation_set_delay(b, delay_b) | |
.end = MAX_ATT_HANDLE
};
}
if (!connection->discovery_jobs) {
list_init(&node->node);
connection->discovery_jobs = node;
} else {
list_append((ListNode *)connection->discovery_jobs, (ListNode *)node);
}
}
void gatt_client_discovery_discover_range(GAPLEConnection *connection, ATTHandleRange ... | {
PBL_LOG(LOG_LEVEL_ERROR, "Remote has %u services, more than we can handle.",
num_services_changed);
num_services_changed = BLE_GATT_MAX_SERVICES_CHANGED;
} | |
age*)buffer;
message->command = CMD_PUSH;
message->transaction_id = transaction_id;
message->payload->push.uuid = s_remote_app_uuid;
memcpy(&message->payload->push.dictionary, s_expected_buffer, dict_length);
PBL_LOG(LOG_LEVEL_DEBUG, "message->transaction_id = %"PRIu32, message->transaction_id);
CommSessi... | if (!s_is_app_message_receiver_open) {
return;
} | |
ckRecognizerRef recognizer, void *context) {
prv_set_action_bar_state(context, ActionBarStateSkip);
}
static void prv_skipping_click_config_provider(void *context) {
window_single_click_subscribe(BUTTON_ID_UP, prv_skip_click_handler);
window_single_click_subscribe(BUTTON_ID_DOWN, prv_skip_click_handler);
if (m... | (&window->window.layer, &window->bitmap_layer.layer) | ;
layer_add_child(&window->window.layer, &window->text_layer.layer);
window_set_click_config_provider(&window->window, prv_no_music_window_click_config);
return window;
}
static void prv_push_no_music_window(MusicAppData *data) {
if (data->no_music_window) {
return;
}
data->no_music_window = prv_create... |
/*
* 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... | {
int32_t gibberish[] = { 0, 0, 0, 0 };
int8_t* gibberish_ptr = (int8_t*) gibberish;
((void (*)(void))gibberish_ptr + 1)();
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&utf8_iter, &utf8_iter_state, &utf8_bounds, utf8_bounds.start) | ;
// Tests
cl_assert(!iter_next(&utf8_iter));
cl_assert(!iter_next(&utf8_iter));
cl_assert(!iter_next(&utf8_iter));
}
//! Decode multi-byte char
void test_utf8_iterator__decode_test_single_codepoint_string_multi_byte(void) {
// Mutable types
Iterator utf8_iter;
Utf8IterState utf8_iter_state;
// Immut... |
/*
* 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... | pfs_init(false /* run filesystem check */) | ;
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME,
false /* is_next */);
resource_init();
// Setup content indicator
ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer();
co... |
(&s_stopped_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0);
// Complete A and start B
prv_advan... | animation_sequence_create(a, b, NULL) | ;
const AnimationHandlers handlers = {
.started = prv_started_handler,
.stopped = prv_stopped_handler
};
animation_set_handlers(seq, handlers, seq);
s_parent_for_sequence_unschedule_from_child = seq;
prv_clear_handler_histories();
uint64_t start_ms = prv_now_ms();
animation_schedule(seq);
//... |
{
return VibeSettingsRow_Count;
} |
static void prv_expand_cb(SettingsCallbacks *context) {
SettingsVibePatternsData *data = (SettingsVibePatternsData *)context;
// window is visible again, remind user which vibe pattern they're on
int16_t current_row = settings_menu_get_selected_row(SettingsMenuItemVibrations);
prv_selection_changed_cb(&data-... | |
/*
* 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_t seconds;
uint16_t millis;
time_ms(&seconds, &millis);
return ((double)seconds * 1000.0) + millis;
} | /* jerry_port_get_current_time */
DEFINE_SYSCALL(bool, jerry_port_get_time_zone, jerry_time_zone_t *tz_p) {
if (PRIVILEGE_WAS_ELEVATED) {
syscall_assert_userspace_buffer(tz_p, sizeof(*tz_p));
}
time_t utc_now;
time_ms(&utc_now, NULL);
int32_t dstoffset = time_get_isdst(utc_now) ? time_get_dstoffset() :... |
n *permission = (BLEHRMSharingPermission *)found_node;
return bt_device_internal_equal(device, &permission->device);
}
static BLEHRMSharingPermission *prv_find_permission_by_device(const BTDeviceInternal *device) {
return (BLEHRMSharingPermission *)list_find((ListNode *)s_permissions_head,
... | (INSTALL_ID_INVALID, 1 /*update_interval_s*/,
0 /*expire_s*/, HRMFeature_BPM, NULL, NULL) | ;
analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_BLE_HRM_SHARING_TIME, AnalyticsClient_System);
}
static void prv_stop_hrm_kernel_main(void *unused) {
PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing stopped");
sys_hrm_manager_unsubscribe(s_ble_hrm_session.manager_session);
event_service_client_unsubscribe(&s_ble_... |
stub_pebble_tasks_set_current(PebbleTask_KernelBackground);
s_num_cb_events_1 = 0;
const uint16_t expire_s = SECONDS_PER_MINUTE;
HRMSessionRef session_ref = hrm_manager_subscribe_with_callback(INSTALL_ID_INVALID, 1,
expire_s, HRMFeature_BPM,
... | sys_hrm_manager_app_subscribe(app_id, update_interval_a_s,
expire_a_s, HRMFeature_BPM) | ;
HRMSubscriberState *state = prv_get_subscriber_state_from_ref(session_ref);
cl_assert(state->update_interval_s == update_interval_a_s);
cl_assert(state->expire_utc == rtc_get_time() + expire_a_s);
// Change update interval and expiration
const uint16_t expire_b_s = 2 * SECONDS_PER_MINUTE;
// TODO: PBL-37... |
t8_t *read_pointer = NULL;
size_t length_available = comm_session_send_queue_get_read_pointer(s_app_session_ptr,
&read_pointer);
cl_assert(read_pointer);
cl_assert_equal_i(TEST_EXPECTED_PP_MSG[i], *read_pointer);
// Expect that the h... | (num_bytes, sizeof(PebbleProtocolHeader)) | ;
cl_assert_equal_m(bytes_out, TEST_EXPECTED_PP_MSG, intact_size);
// Expect the remainder to be filled with zeroes:
for (int i = 0; i < (length - intact_size); ++i) {
cl_assert_equal_i(bytes_out[intact_size + i], 0x00);
}
app_free(outbox_data);
}
void test_app_message_sender__cancelled_message_in_flig... |
ggered) {
if (!new_active_layer_is_ancestor) {
prv_cancel_layer_tree_recognizers(manager, NULL, new_active_layer);
}
} else {
// We cancelled all the triggered recognizers, time to reset everything
manager->active_layer = new_active_layer;
prv_reset_... | prv_cleanup_state_change(manager, triggered) | ;
recognizer_reset(recognizer);
recognizer_set_manager(recognizer, NULL);
}
void recognizer_manager_handle_state_change(RecognizerManager *manager, Recognizer *changed) {
PBL_ASSERTN(manager);
PBL_ASSERTN(changed);
PBL_ASSERTN(recognizer_get_manager(changed) == manager);
Recognizer *triggered = recognize... |
/*
* 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... | trigger_stack_overflow(index, (void*) counter) | |
tate.log_file_id;
hdr.log_chunk_id = s_curr_state.log_chunk_id;
hdr.log_flags = ~(LOG_FLAGS_VALID);
s_curr_state.log_chunk_id++;
size_t len;
const uint8_t *build_id = version_get_build_id(&len);
memcpy(hdr.build_id, build_id, sizeof(hdr.build_id));
flash_write_bytes((uint8_t *)&hdr, s_curr_state.page_st... | (prv_get_unit_base_address(new_flash_addr)) | ;
}
s_curr_state.page_start_addr = new_flash_addr;
prv_allocate_page_for_use();
done:
s_curr_state.log_start_addr = s_curr_state.offset_in_log_page +
s_curr_state.page_start_addr;
s_curr_state.bytes_remaining = msg_length;
prv_write_flash_log_record_header(msg_length);
return (s_curr_state.log_st... |
ed_prf_storage_get_valid_page_number()),
sizeof(data));
cl_assert_equal_i(data.getting_started.crc, new_crc);
// Should be corrupt, so it should return false
cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), false);
// Should have moved to the next page
cl_assert_equal_b... | shared_prf_storage_erase_ble_pairing_data() | ;
cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 2);
char device_name_out[BT_DEVICE_NAME_BUFFER_SIZE];
SMPairingInfo pairing_info_out;
const bool rv = shared_prf_storage_get_ble_pairing_data(&pairing_info_out, device_name_out, NULL,
NULL)... |
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.
*/
//! This file displays the main Quick Launc... | app_launch_button() | |
544, -280},
{ 848, 560, -416},
{ 920, 600, -512},
{ 888, 664, -496},
{ 872, 696, -408},
{ 984, 656, -304},
{ 1384, 696, -256},
{ 1448, 840, -360},
{ 1616, 664, -176},
{ 1648, 536, -24},
{ 1408, 416, -144},
{ 1072, 392, -152},
// 29 seconds
{ 936, 360, -72},
{ 864,... | { 1280, 776, -304},
{ 1424, 720, -360},
{ 1696, 616, -160},
{ 1768, 480, -104},
{ 1520, 416, -176},
{ 1184, 352, -144},
{ 936, 280, -88},
{ 872, 216, -96},
{ 784, 176, -96},
{ 768, 128, -80},
{ 760, 88, -32},
{ 744, 64, -48},
{ 944, 88, -72},
{ 1224, 128, 40},
... |
{ 1792, 160, -264},
{ 1664, 176, -272},
{ 1256, 368, -496},
{ 872, 424, -432},
{ 688, 352, -320},
// 37 seconds
{ 704, 448, -384},
{ 704, 480, -472},
{ 848, 544, -536},
{ 976, 544, -488},
{ 1000, 760, -568},
{ 960, 680, -472},
{ 1384, 544, -352},
{ 1352, 576, -39... |
onst time_t midnight_before_start = prv_get_midnight_of_local_time(time_start);
const time_t midnight_before_end = prv_get_midnight_of_local_time(time_end);
// we treat time_end as exclusive, if one passes exactly midnight, we don't count that day
const time_t midnight_after_end = (midnight_before_end == ti... | (((int64_t)values[oldest_day_idx] * range->seconds_first_day) / SECONDS_PER_DAY) | ;
}
}
// ----------------------------------------------------------------------------------------------
static HealthValue prv_compute_aggregate_using_daily_totals(
HealthServiceState *state, HealthMetric metric, time_t time_start, time_t time_end,
HealthAggregation aggregation) {
#if !CAPABILITY_HAS_HEALTH_TRA... |
0, -80, -120},
{ 984, -72, -176},
{ 1048, -56, -288},
{ 1128, -80, -312},
{ 1152, -144, -304},
{ 1128, -192, -240},
{ 1472, -176, -256},
{ 1576, -80, -280},
{ 1080, -16, -200},
{ 712, -24, -176},
{ 920, 48, -176},
{ 1312, 72, -128},
{ 1368, -48, 8},
{ 1144, -72, 24},
... | // 77 seconds
{ 1048, -64, -240},
{ 1080, -48, -304},
{ 1144, -24, -360},
{ 1160, -40, -336},
{ 1320, -88, -272},
{ 1648, -56, -312},
{ 1256, -72, -152},
{ 1016, -56, -104},
{ 1040, -48, -72},
{ 1312, -16, -96},
{ 1320, 0, -48},
{ 1176, 0, 0},
{ 1080, -32, 32},
... |
{ 872, 8, -80},
{ 864, 16, -224},
{ 904, -16, -152},
{ 944, -48, -192},
{ 1032, -88, -152},
{ 992, -120, -152},
{ 1040, -136, -144},
{ 1032, -152, -128},
// 80 seconds
{ 1080, -160, -88},
{ 1128, -192, -16},
{ 1536, -192, -16},
{ 1320, -184, -8},
{ 1208, -176, 0}... |
(&averages, time_start, time_end) | ;
num_sums++;
}
}
} else {
APP_LOG(APP_LOG_LEVEL_ERROR, "Unsupported scope: %d", (int) scope);
result = 0;
}
if (num_sums > 0) {
result = ROUND(result, num_sums);
}
return result;
}
// --------
// Default handling is to use daily totals
if (scope =... | |
_heap.h"
#include "stubs_logging.h"
#include "stubs_memory_layout.h"
#include "stubs_passert.h"
#include "stubs_pbl_malloc.h"
#include "stubs_pebble_tasks.h"
#include "stubs_resources.h"
#include "stubs_ui_window.h"
#include "stubs_unobstructed_area.h"
void framebuffer_clear(FrameBuffer* f) {}
void graphics_context_mo... | (
TEST_IMAGES_PATH, "test_kino_reel__resource_pdcs.pdc") | ;
cl_assert(resource_id != UINT32_MAX);
KinoReel *kino_reel = kino_reel_create_with_resource(resource_id);
cl_assert(kino_reel);
cl_assert(kino_reel_get_type(kino_reel) == KinoReelTypePDCS);
kino_reel_set_elapsed(kino_reel, 0);
GDrawCommandList *list1 = kino_reel_get_gdraw_command_list(kino_reel);
GDraw... |
BondingID
//! This function re-uses bonding ids as they are freed. This could be a problem with 3rd party
//! apps. https://pebbletechnology.atlassian.net/browse/PBL-8391
static BTBondingID prv_get_free_key() {
BTBondingID free_key = BT_BONDING_ID_INVALID;
prv_lock();
{
SettingsFile fd;
status_t rv = setting... | {
BTBondingID bonding_id = BT_BONDING_ID_INVALID;
BtPersistBondingType found_type;
// At the moment, the "active gateway" concept is a bit broken. We're in a transition period
// with an amphibious iAP + LE mode, where the iOS app decides what connection to use for
// PP transport. To keep iAP reconnection g... |
static void prv_load_bt_classic_data_from_prf(void) {
BTDeviceAddress bd_addr;
char name[BT_DEVICE_NAME_BUFFER_SIZE];
SM128BitKey link_key;
uint8_t platform_bits;
if (!shared_prf_storage_get_bt_classic_pairing_data(&bd_addr, name, &link_key, &platform_bits)) {
// No pairing available, check to see if we... |
/*
* 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... | {
const GRect *bitmap_bounds = &ctx->dest_bitmap.bounds;
// Fill the screen with red
graphics_context_set_fill_color(ctx, GColorRed);
graphics_fill_rect(ctx, bitmap_bounds);
const GSize *bitmap_bounds_size = &bitmap_bounds->size;
// Draw the bottom rectangle blue with 66% opacity
// (will appear at the ... | |
dow(window_stack_from, window)) {
// If the item is on the list of window items, then we remove it as we're going to
// re-insert it.
item = prv_find_window_stack_item_for_window(window_stack_from, window);
list_remove(&item->list_node, &window_stack_from->list_head, NULL);
} else {
// If the item... | {
const WindowTransitionImplementation *transition_insert =
animated ? window_transition_get_default_push_implementation() :
&g_window_transition_none_implementation;
const WindowTransitionImplementation *transition_pop =
animated ? window_transition_get_default_pop_implementation() :
... |
void window_stack_push_with_transition(WindowStack *window_stack, Window *window,
const WindowTransitionImplementation *push_transition,
const WindowTransitionImplementation *pop_transition) {
if (window_stack->lock_push) {
return;
... |
98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05},
.timestamp = 3,
.duration = 0,
.type = TimelineItemTypeReminder,
.layout = LayoutIdTest,
},
.num_attributes = 3,
};
static TimelineItem title_item1 = {
.header = {
.id = {0x9c, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c,
0x98, 0x68, 0x... | {
temp.attr_list.attributes = NULL;
timeline_item_free_allocated_buffer(&temp);
cl_assert(memcmp(&item3, &temp, sizeof(TimelineItem)) == 0);
cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */));
cl_assert(reminder_db_get_len((uint8_t *) &item3, sizeof(Uuid)) == 0);... | else {
temp.attr_list.attributes = NULL;
cl_assert(memcmp(&item4, &temp, sizeof(TimelineItem)) == 0);
cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */));
cl_assert(reminder_db_get_len((uint8_t *) &item4, sizeof(Uuid)) == 0);
memset(&temp, 0, sizeof(TimelineItem... |
de <string.h>
static GattRespDest prv_dest_from_source(GattReqSource source) {
return (source == GattReqSourceHost) ? GattRespDestHost : GattRespDestController;
}
static bool prv_enqueue(
uint16_t conn_idx, uintptr_t context_ref, GattRespDest resp_dest, GattOpType op_type) {
Connection *conn = connection_by_i... | {
// This used to be `connection_by_idx_check`, but due to PBL-36813, needed to change it.
// The error that comes back in the `evt` is `GAP_ERR_COMMAND_DISALLOWED: 0x43`, but to make
// sure we don't assert on any other future errors, we check for the connection.
Connection *conn = connection_by_idx(conn_idx);... |
void gatt_wrapper_handle_read_completed(const ble_evt_gattc_read_completed_t *evt) {
BTDeviceInternal addr;
uintptr_t context_ref;
GATT_LOG_DEBUG("gatt_wrapper_handle_read_completed: handle: %d, status: %d",
evt->handle, evt->status);
const BLEGATTError status = (BLEGATTError)evt->status;
G... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.