prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
ionWindowData *data) {
if (data->window_frozen || !s_in_use) {
return;
}
// This calls through to our window_unload() callback, which cancels our timer and clears s_in_use
window_stack_remove(&data->window, true /* animated */);
}
static int prv_reminders_on_top_comparator(void *a, void *b) {
NotifList ... | property_animation_get_animation(prop_anim) | ;
animation_set_duration(animation, interpolate_moook_soft_duration(NUM_MOOOK_SOFT_MID_FRAMES));
animation_set_custom_interpolation(animation, prv_interpolate_moook_peek_animation);
return animation;
}
/////////////////////
// Peek Layer
/////////////////////
static void prv_peek_anim_stopped(Animation *animatio... |
_stroke_color(ctx, GColorClear);
graphics_draw_pixel(ctx, GPoint(5, 5));
}
void outside_x_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_draw_pixel(ctx, GPoint(15, 5));
}
void outside_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics... | (framebuffer_is_empty("outside_x_y_offset_layer", ctx.parent_framebuffer, GColorWhite)) | ;
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &outside_nx_y_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(framebuffer_is_empty("outside_nx_y_offset_layer", ctx.parent_framebuffer, GColorWhite));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&laye... |
*/
#include "apps/watch/kickstart/kickstart.h"
#include "popups/timeline/peek.h"
#include "applib/ui/window_private.h"
#include "fw/graphics/util.h"
#include "util/size.h"
#include "clar.h"
extern void prv_window_load_handler(Window *window);
extern void prv_window_unload_handler(Window *window);
extern void prv_... | (&s_data.window, &s_ctx) | |
/*
* 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... | {
free(flash_written_data);
free(flash_written_flag);
} |
void test_system_flash__erase_zero_bytes(void) {
cl_assert(system_flash_erase(FLASH_BASE, 0, NULL, NULL));
cl_assert_equal_i(0, erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_one_byte(void) {
cl_assert(system_flash_erase(FLASH_BASE, 1, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(... |
/*
* 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... | {
CronJob *job_a = (CronJob*)a;
CronJob *job_b = (CronJob*)b;
return job_b->cached_execute_time - job_a->cached_execute_time;
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (!session->data->buffer_storage) {
// Skip if no buffer to free.
return;
} | |
end_pebble_event_to_kernel(PebbleEvent* event) {
cl_assert_equal_i(event->type, PEBBLE_APP_OUTBOX_MSG_EVENT);
event->callback.callback(event->callback.data);
}
static int s_num_app_outbox_events_sent;
bool process_manager_send_event_to_process(PebbleTask task, PebbleEvent* e) {
cl_assert_equal_i(e->type, PEBBLE_... | assert_sent_cb_last_status(AppOutboxStatusConsumerDoesNotExist) | ;
}
void test_app_outbox__send_but_max_pending_messages_reached(void) {
prv_register();
uint32_t max_pending_messages =
app_outbox_service_max_pending_messages(AppOutboxServiceTagUnitTest);
for (uint32_t i = 0; i < max_pending_messages; ++i) {
app_outbox_send(s_test_data, s_test_data_length,
... |
// create several files
for (int i = 0; i < NUM_ENTRIES; i++) {
fd[i] = pfs_open(fname[i], OP_FLAG_WRITE, FILE_TYPE_STATIC, 3 * 4096);
cl_assert(fd[i] >= 0);
}
// test close and remove
for (int i = (NUM_ENTRIES - 1); i >= 0; i--) {
cl_assert_equal_i(pfs_close_and_remove(fd[i]), S_SUCCESS);
}
... | pfs_format(true) | |
const jerry_value_t func = JS_GLOBAL_GET_VALUE(FUNC_NAME);
rocky_util_call_user_function_and_log_uncaught_error(func, jerry_create_undefined(), NULL, 0);
jerry_release_value(func);
}
static void prv_do_eval(const char *eval_str) {
rocky_util_eval_and_log_uncaught_error((const jerry_char_t *)eval_str, strlen(ev... | (now, "getSeconds") | ;
jerry_value_t getMinutes = jerry_get_object_field(now, "getMinutes");
jerry_value_t getHours = jerry_get_object_field(now, "getHours");
jerry_value_t getDate = jerry_get_object_field(now, "getDate");
jerry_value_t result_seconds = jerry_call_function(getSeconds, now, NULL, 0);
jerry_value_t result_minutes ... |
/*
* 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... | {
child->sibling = (AnimationPrivate *)animation_array[i + 1];
} |
}
return (Animation *)parent;
}
static Animation *prv_create_from_vararg(Animation *animation_a, Animation *animation_b,
Animation *animation_c, va_list args) {
Animation *animation_array[ANIMATION_MAX_CREATE_VARGS];
size_t array_len = 0;
animation_array[array_len++]... |
ateIndexCBContext ctx = {
.values = {
.points = points,
.num_points = num_points,
},
.iter = {
.lookup = lookup,
},
};
gdraw_command_list_iterate(list, prv_gdraw_command_create_point_index_lookup, &ctx);
applib_free(points);
return lookup;
}
typedef struct {
const GPoint or... | (point.x, size.w, from.size.w, to.size.w,
from.origin.x, to.origin.x, normalized, interpolate) | ,
prv_int_scale_and_translate_to(point.y, size.h, from.size.h, to.size.h,
from.origin.y, to.origin.y, normalized, interpolate));
}
typedef struct {
GRect from;
GRect to;
GSize size;
GPoint offset;
} ScaleToGValues;
typedef struct {
const struct {
ScaleToGValues integer;
... |
GPointPrecise p1;
p0.x.raw_value = (data->canvas_layer->bounds.size.w / 2) * FIXED_S16_3_ONE.raw_value;
p0.y.raw_value = (data->canvas_layer->bounds.size.h / 2) * FIXED_S16_3_ONE.raw_value;
p1.x.raw_value = (sin_lookup(rotation) * (line_length * FIXED_S16_3_ONE.raw_value)
/ TRIG_MA... | window_create() | ;
window_set_user_data(s_window, data);
window_set_fullscreen(s_window, true);
window_set_window_handlers(s_window, &(WindowHandlers) {
.load = main_window_load,
.unload = main_window_unload,
});
data->p1.x = 10;
data->p1.y = 30;
data->p2.x = 100;
data->p2.y = 120;
data->size = 40;
data->op... |
ffer;
uint16_t endpoint_id;
uint16_t bytes_written;
uint16_t max_out_payload_length;
CircularBuffer send_buffer;
uint8_t storage[1024];
} CommSession;
static CommSession *s_session_head;
static int s_session_close_call_count;
static int s_session_open_call_count;
bool comm_session_is_valid(const CommSessio... | circular_buffer_get_read_space_remaining(&session->send_buffer) | ;
}
size_t comm_session_send_queue_copy(CommSession *session, uint32_t start_off, size_t length,
uint8_t *data_out) {
cl_assert(data_out);
cl_assert(list_contains((const ListNode *) s_session_head, &session->node));
return circular_buffer_copy_offset(&session->send_buffer, sta... |
r == local_time.tm_hour && minute <= local_time.tm_min)) {
// The time is before or equal to the current time. Sechedule the alarm for tomorrow
return (local_time.tm_wday + 1) % DAYS_PER_WEEK;
} else {
// The time hasn't happend yet today. Schedule it for today
return local_time.tm_wday;
}
}
static... | (id, prv_set_alarm_smart_op, (void *)(uintptr_t)smart) | |
(
SMRootKeyTypeEncryption, &sprf_root_keys[SMRootKeyTypeEncryption]) | &&
shared_prf_storage_get_root_key(
SMRootKeyTypeIdentity, &sprf_root_keys[SMRootKeyTypeIdentity])) {
bool root_keys_match =
memcmp(&root_keys, &sprf_root_keys, sizeof(SM128BitKey) * SMRootKeyTypeNum) == 0;
prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN,
... | |
ge governing permissions and
* limitations under the License.
*/
#include "shell/system_app_state_machine.h"
#include "apps/core_apps/panic_window_app.h"
#include "apps/system_apps/battery_critical_app.h"
#include "apps/system_app_ids.h"
#include "apps/system_apps/launcher/launcher_app.h"
#include "apps/watch/low_p... | {
// If we're rooted in the watchface but we're not the watchface itself, or the launcher
// is closing, we should launch the watchface.
if ((s_rooted_in_watchface && !prv_current_app_is_watchface())
|| (app_manager_get_current_app_md() == launcher_menu_app_get_app_info())) {
return watchface_get_defaul... |
const PebbleProcessMd* system_app_state_machine_get_default_app(void) {
return launcher_menu_app_get_app_info();
}
void system_app_state_machine_register_app_launch(AppInstallId app_id) {
if (app_id == APP_ID_LAUNCHER_MENU) {
s_rooted_in_watchface = false;
} else if (app_install_is_watchface(app_id)) {
... |
/*
* 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 the selection animation is running, complete it. Note that 2.x apps don't have a selection
// animation.
if (menu_layer->animation.animation) {
animation_set_elapsed(menu_layer->animation.animation,
animation_get_duration(menu_layer->animation.animation, true, true));
}
... |
static void prv_menu_select_long_click_handler(ClickRecognizerRef recognizer,
MenuLayer *menu_layer) {
if (menu_layer->callbacks.select_long_click) {
menu_layer->callbacks.select_long_click(menu_layer, &menu_layer->selection.index,
menu_layer->callback_context);
}
}
void menu_up_click_handler(Cli... |
selection_window->time_data.hour;
const int minute_end = time_selection_window->time_data.minute;
int hour_start = hour_end;
int minute_start = minute_end;
clock_hour_and_minute_add(&hour_start, &minute_start,
-time_selection_window->range_duration_m);
char start_buf[TIME_STRING_T... | (time_selection_window) | |
f(timeout_ms));
}
uint16_t backlight_get_intensity(void) {
return s_backlight_intensity;
}
uint8_t backlight_get_intensity_percent(void) {
return (backlight_get_intensity() * 100) / BACKLIGHT_BRIGHTNESS_MAX;
}
void backlight_set_intensity_percent(uint8_t percent_intensity) {
PBL_ASSERTN(percent_intensity > 0 &... | app_install_get_uuid_for_install_id(app_id, &uuid) | ;
prv_pref_set(PREF_KEY_DEFAULT_WATCHFACE, &uuid, sizeof(uuid));
}
void welcome_set_welcome_version(uint8_t version) {
if (s_welcome_version != version) {
s_welcome_version = version;
prv_pref_set(PREF_KEY_WELCOME_VERSION, &version, sizeof(version));
}
}
uint8_t welcome_get_welcome_version(void) {
ret... |
eive_reset_request(s_characteristics[0][PPoGATTCharacteristicData]);
prv_assert_sent_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]);
prv_receive_reset_request(s_characteristics[0][PPoGATTCharacteristicData]);
fake_gatt_client_op_assert_no_write();
}
void test_ppogatt__ignore_server_reset_reques... | prv_receive_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]) | ;
// 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__ignore_data_during_reset(void) {
prv_notify_services_discover... |
hour, int minute) {
PBL_ASSERT(hour < 24 && hour >= 0, "Invalid hour value, %d", hour);
PBL_ASSERT(minute < 60 && minute >= 0, "Invalid minute value, %d", minute);
}
// ----------------------------------------------------------------------------------------------
static void prv_enable_alarm_config(AlarmConfig *c... | {
case ALARM_KIND_EVERYDAY:
config->kind = ALARM_KIND_EVERYDAY;
const bool everyday[DAYS_PER_WEEK] = { true, true, true, true, true, true, true };
memcpy(&config->scheduled_days, everyday, sizeof(everyday));
break;
case ALARM_KIND_WEEKENDS:
config->kind = ALARM_KIND_WEEKENDS;
... |
return true;
}
void alarm_set_kind(AlarmId id, AlarmKind kind) {
prv_alarm_operation(id, prv_set_alarm_kind_op, (void *)(uintptr_t)kind);
}
// ----------------------------------------------------------------------------------------------
static bool prv_set_alarm_custom_op(AlarmId id, AlarmConfig *config, void *... |
{ 120, -216, -968},
{ 128, -200, -976},
{ 112, -208, -968},
{ 128, -200, -976},
{ 112, -200, -968},
{ 120, -208, -968},
{ 120, -192, -976},
{ 120, -200, -968},
{ 120, -184, -968},
{ 128, -168, -984},
{ 120, -200, -968},
// 107 seconds
{ 120, -184, -976},
{ 120, -192, ... | { 120, -208, -976},
{ 120, -216, -968},
{ 120, -216, -968},
{ 120, -216, -968},
{ 120, -224, -976},
{ 128, -208, -968},
{ 120, -216, -968},
{ 120, -224, -968},
{ 120, -216, -976},
{ 120, -216, -968},
{ 120, -216, -968},
{ 128, -216, -968},
{ 120, -216, -976},
{ 12... |
{ 128, -200, -960},
{ 128, -184, -968},
{ 120, -184, -984},
{ 112, -208, -984},
{ 96, -200, -936},
{ 152, -256, -984},
{ 88, -240, -968},
{ 112, -208, -984},
{ 104, -200, -1000},
{ 120, -208, -976},
{ 120, -192, -968},
{ 56, -96, -928},
// 115 seconds
{ 128, -160... |
0x45, 0},
{ 0, 0x45, 0},
{ 0, 0x45, 0},
{ 0, 0x45, 0},
{ 0, 0x45, 0},
{ 0, 0x45, 0},
// 345: Local time: 03:00:00 AM
{ 0, 0x45, 0}, // start DEEP
{ 0, 0x46, 21},
{ 0, 0x45, 0},
{ 0, 0x45, 0},
{ 0, 0x45, 0},
{ 0, 0x45, 0},
{ 0, 0x45, 0},
{ 0, 0x45, 0},
{ ... | ARRAY_LENGTH(samples) | ;
return samples;
}
// ----------------------------------------------------------------
// Sample captured at: 2015-08-22 19:57:00 local, 2015-08-23 02:57:00 GMT
// Accroding to misfit:
// total sleep: 374 min
// deep: 200 min
// light: 174 min
// 7:57pm awake (220 min)
// 11:36pm light (5 min)
// ...
// 5... |
t away (don't wait for the Connection Complete event
// with HCI_ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER status):
s_has_pending_create_connection = false;
}
#endif
}
static void prv_mutate_whitelist(const BTDeviceInternal *device, bool is_adding) {
#if !BLE_MASTER_CONNECT_SUPPORT // PBL-32761
PBL_LOG(LOG_... | (&intent->device) | |
LTIN_HRM
#if BLE_HRM_SERVICE
ble_hrm_handle_activity_prefs_heart_rate_is_enabled(new_settings->enabled);
#endif // BLE_HRM_SERVICE
return true;
}
#endif /* CAPABILITY_HAS_HEALTH_TRACKING */
#if PLATFORM_SPALDING
static bool prv_set_s_display_user_offset(GPoint *offset) {
s_display_user_offset = *offset;
retur... | mutex_create() | ;
SettingsFile file = {{0}};
if (settings_file_open(&file, SHELL_PREFS_FILE_NAME, SHELL_PREFS_FILE_LEN) != S_SUCCESS) {
return;
}
prv_convert_deprecated_backlight_behaviour_key(&file);
// Init state for each pref from our backing store
uint32_t num_entries = ARRAY_LENGTH(s_prefs_table);
const Prefs... |
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb6},
.parent_id = {0},
.timestamp = 1421183462, // Tue Jan 13 13:11:02 PST 2015
.duration = 4,
.type = TimelineItemTypePin,
.flags = 0,
.layout = LayoutIdTest,
},
.attr_list = {
.num_attributes = 0,
... | timeline_model_get_iter_state_with_timeline_idx(4) | );
cl_assert(timeline_model_iter_next(&new_idx, &has_next));
cl_assert(has_next);
cl_assert_equal_i(new_idx, 5);
cl_assert_equal_i(timeline_model_get_num_items(), 2);
cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id,
&timeline_model_get_iter_state(-1)->pin.header.id));
cl_assert(uuid_equal... |
me_layer, data->steps_card.time_text);
}
if (data->lap_steps > data->cur_steps) {
// We probably encountered a midnight rollover, reset the persistent storage too
data->lap_steps = data->cur_steps;
persist_write_int(AppPersistKeyLapSteps, data->lap_steps);
}
if (data->steps_card.delta_step_layer) ... | text_layer_get_layer(data->steps_card.cur_step_layer) | );
// Time
data->steps_card.time_layer = text_layer_create(TIME_RECT);
text_layer_set_text_alignment(data->steps_card.time_layer, GTextAlignmentCenter);
text_layer_set_font(data->steps_card.time_layer,
fonts_get_system_font(FONT_KEY_LECO_38_BOLD_NUMBERS));
text_layer_set_background_colo... |
urn offset_16 ? sizeof(OffsetTableEntry_2_2) : sizeof(OffsetTableEntry_2_4);
} else {
return offset_16 ? sizeof(OffsetTableEntry_4_2) : sizeof(OffsetTableEntry_4_4);
}
}
static int prv_offset_table_get_id(const FontMetaData *md, Codepoint codepoint) {
if (FONT_VERSION(md->version) == FONT_VERSION_1) {
... | (codepoint, font_cache, font_res) | ;
uint32_t offset = 0;
while (max_idx >= min_idx) {
int mid_idx = (max_idx + min_idx) / 2;
Codepoint codepoint_at_mid_idx = prv_offset_table_get_codepoint(font_cache, &font_res->md,
mid_idx);
if (codepoint_at_mid_idx < codepoint) {
... |
ypedef struct {
const char *name;
const char *value;
AppResourceInfo *icon_info;
KinoLayer *icon_layer;
int index;
} MetricContext;
static GTextNode *prv_metric_constructor(
const LayoutLayer *layout, const LayoutNodeConstructorConfig *config) {
MetricContext *context = config->context;
const int ico... | if (index == METRICS_PER_PAGE - 1 && !layout->has_page_break) {
// after filling a page with metric nodes, add a page break
layout->has_page_break = true;
GTextNode *page_break =
&timeline_layout_create_page_break_node((const TimelineLayout *)layout)->node;
graphics_text_node_container_add_child... | |
/*
* 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... | GColorARGB8FromHEX(0xff7f50) | },
{"cornflowerblue", GColorARGB8FromHEX(0x6495ed)},
{"cornsilk", GColorARGB8FromHEX(0xfff8dc)},
{"crimson", GColorARGB8FromHEX(0xdc143c)},
{"darkblue", GColorARGB8FromHEX(0x00008b)},
{"darkcyan", GColorARGB8FromHEX(0x008b8b)},
{"darkgoldenrod", GColorARGB8FromHEX(0xb8860b)},
// {"darkgray", GColorARGBFrom... |
/*
* 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_launch_mfg_app, NULL) | ;
}
}
bool mfg_is_mfg_mode(void) {
return s_mfg_mode;
}
void command_enter_mfg(void) {
mfg_enter_mfg_mode_and_launch_app();
}
|
nectionStateRequest *consumer_request =
(ConnectionStateRequest *)list_find((ListNode *)conn_mgr_info->requests,
prv_find_source, (void *)consumer);
bool is_already_granted = (gap_le_connect_params_get_actual_state(hdl) >= state);
if (consumer_request == NULL) {
... | (LOG_LEVEL_DEBUG, "Mode chaos monkey: next change=%"PRIu32"ms", delay_ms) | |
//www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissi... | (offsetof(Window, layer) == 0, "") | |
visibility == two->visibility);
bool process_type = (one->process_type == two->process_type);
bool uuid = !memcmp(&one->uuid, &two->uuid, sizeof(Uuid));
bool name = !strcmp(one->name,two->name);
bool icon = (one->icon_resource_id == two->icon_resource_id);
return (id && type && visibility && process_type && ... | (APP2_APP_FIXTURE_NAME, filename_buf) | ;
resource_storage_get_file_name(filename_buf, sizeof(filename_buf), 2);
load_fixture_on_pfs(APP2_RESOURCES_FIXTURE_NAME, filename_buf);
}
void test_app_install_manager__cleanup(void) {
}
/*************************************
*************************************/
void test_app_install_manager__get_id_inval... |
law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "session_receive_r... | if ((int)impl->total_payload_size != impl->curr_pos) {
PBL_LOG(LOG_LEVEL_WARNING, "Got fewer bytes than expected for handler %p",
impl->endpoint->handler);
} |
// Note: At the moment we unconditionally spawn a new callback upon
// completion of each individual payload. If we are getting a flood of
// events, this may generate too many CBs and overflow the queue. We could keep a list
// of pending receiver events and only schedule the CB if there isn't one
// alrea... |
h_state(0, TouchState_FingerDown, GPointZero, 3686380, 0);
touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400);
TouchEvent *touch_event = touch_event_queue_get_event(0, 0);
prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0,
&GPoin... | touch_dispatch_touch_events(0, prv_touch_event_dispatch_cb, &ctx) | ;
cl_assert_equal_i(ctx.idx, 2);
prv_test_touch_event(&ctx.touch_events[0], 0, TouchEvent_Touchdown, &GPoint(13, 13), 3686420, 6,
NULL, 0, 0, false);
prv_test_touch_event(&ctx.touch_events[1], 0, TouchEvent_PositionUpdate, &GPoint(13, 13), 3686420,
6, &GPoint(2, 2), 2... |
e this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDI... | TEST_RESULT_TO_STR(MfgTest_Vibe) | );
prompt_send_response_fmt(buf, 32, "LCM: %s", TEST_RESULT_TO_STR(MfgTest_Display));
prompt_send_response_fmt(buf, 32, "ALS: %s", TEST_RESULT_TO_STR(MfgTest_ALS));
prompt_send_response_fmt(buf, 32, "Buttons: %s", TEST_RESULT_TO_STR(MfgTest_Buttons));
prompt_send_response_fmt(buf, 32, "ALS Reading: %"PRIu32, d... |
/*
* 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... | (&char_iter) | |
ion(b, duration_b);
animation_set_delay(b, delay_b);
// Create a sequence
Animation *seq = animation_sequence_create(a, b, NULL);
cl_assert(seq != NULL);
animation_set_delay(seq, delay_seq);
prv_clear_handler_histories();
uint64_t start_ms = prv_now_ms();
animation_schedule(seq);
// Test the ela... | prv_clear_handler_histories() | ;
uint64_t start_ms = prv_now_ms();
animation_schedule(spawn);
// Test the elapsed
int32_t elapsed_ms;
animation_get_elapsed(spawn, &elapsed_ms);
cl_assert_equal_i(elapsed_ms, -1 * (delay_spawn));
animation_get_elapsed(a, &elapsed_ms);
cl_assert_equal_i(elapsed_ms, -1 * (delay_spawn + delay_a));
... |
operly.
void test_window_stack__window_flow(void) {
Window *window = window_create();
window_set_window_handlers(window, &(WindowHandlers){
.load = prv_window_load,
.unload = prv_window_unload,
.appear = prv_window_appear,
.disappear = prv_window_disappear
});
window_set_click_config_provider(... | window_stack_count(stack) | , 0);
// We popped the window off the screen, but the unload handler
// should not have been called for it, as it hasn't finished
// unloading.
cl_assert_equal_i(prv_get_load_unload_count(), 1);
}
// Description:
// In this test, we push a window during the unload handler of a window.
void test_window_stack__... |
tate = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0);
cl_assert_equal_i(pin_db_delete((uint8_t *)&s_items[4].header.id, sizeof(Uuid)), 0);
// next item should be items[5], going back should s... | (&head, &multiday_item.header.id) | |
et_time(event_time + (2 * SECONDS_PER_MINUTE));
clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("2 minutes ago", time_buf);
// June 9th 2015, 15:00:00 (T-01:00:00)
rtc_set_time(event_time - (1 * SECONDS_PER_HOUR));
clock_get_until_time(time_buf, sizeof(time_b... | ("In 1 minute", time_buf) | |
/*
* 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 (!pstring_equal_cstring(&app_name_attr->pstr, existing_name)) {
// If the existing name doesn't match our new name, update the name
app_name_buff = kernel_zalloc_check(app_name_attr->length + 1);
pstring_pstring16_to_string(&app_name_attr->pstr, app_name_buff);
attribute_list_add_cstring(&new... |
}
// Add the mute attribute if we don't have one already
// Default the app to not muted
const bool already_has_mute =
app_notif_prefs && attribute_find(&app_notif_prefs->attr_list, AttributeIdMuteDayOfWeek);
if (!already_has_mute) {
attribute_list_add_uint8(&new_attr_list, AttributeIdMuteDayOfWee... |
/*
* 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... | (window, NULL) | ;
}
static void confirm_click_handler(ClickRecognizerRef recognizer, Window *window) {
ConfirmUIData *data = window_get_user_data(window);
// Need to lock-out inputs after starting the factory reset.
prv_lockout_back_button(window);
PeekLayer *peek_layer = &data->resetting_layer;
peek_layer_init(peek_layer... |
// Write the I2C bus address to select it in write mode.
i2c->DR = transfer->device_address & ~I2C_READ_WRITE_BIT;
transfer->state = I2CTransferState_WriteRegAddress;
} else {
if (transfer->direction == I2CTransferDirection_Read) {
// Write the I2C bus address to select ... | if ((i2c->SR1 & I2C_SR1_BERR) != 0) {
i2c->SR1 &= ~I2C_SR1_BERR;
// Bus error: invalid start or stop condition detected
I2C_DEBUG("Bus error detected during I2C transaction; Bus: %s", bus->name);
} |
if ((i2c->SR1 & I2C_SR1_AF) != 0) {
i2c->SR1 &= ~I2C_SR1_AF;
// NACK received.
//
// The MFI chip will cause NACK errors during read operations after writing a start bit (first
// start or repeat start indicating that it is busy. The transfer must be paused and the start
// condition sent ag... |
_on_pop */);
bt_conn_dialog_push(bt_dialog, prv_handle_bt_conn_result, data);
}
static uint64_t prv_get_time_ms(void) {
time_t now_s;
uint16_t now_ms;
sys_get_time_ms(&now_s, &now_ms);
uint64_t ms = (now_s * 1000) + now_ms;
return ms;
}
static void prv_update_analytics_metrics(VoiceUiData *data) {
data... | prv_exit_and_send_result_event(data, DictationSessionStatusFailureNoSpeechDetected) | ;
} else {
prv_exit_and_send_result_event(data, DictationSessionStatusFailureRecognizerError);
}
}
}
static void prv_handle_dictation_result(VoiceUiData *data, PebbleVoiceServiceEvent *event) {
VOICE_LOG("Handling result event");
data->session_id = VOICE_SESSION_ID_INVALID;
bool success = false;
... |
D_FOCUSED_SHORT_CELL_HEIGHT :
MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT));
}
static void prv_draw_mark_with_inversion(GContext *ctx, GBitmap *mark, const GRect *box,
bool inverted) {
graphics_context_set_compositing_mode(ctx, GCompOpTint);
graphi... | {
const GFont fcc_title_font = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD);
const int16_t fcc_title_font_cap_padding = 10;
const GFont fcc_number_subtitle_font = fonts_get_system_font(FONT_KEY_GOTHIC_18);
const uint8_t fcc_title_height = fonts_get_font_height(fcc_title_font);
const uint8_t fcc_number_subti... |
// If the cell is selected, draw the FCC # subtitle centered at the bottom of the container
if (cell_is_selected) {
const int16_t fcc_number_subtitle_width = 60;
box.size = GSize(fcc_number_subtitle_width, fcc_number_subtitle_height);
// Note that we don't clip when we align the subtitle frame because... |
/*
* 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 time_t_to_string(buffer, rtc_get_time());
} |
const char* time_t_to_string(char* buffer, time_t t) {
struct tm time;
localtime_r(&t, &time);
strftime(buffer, TIME_STRING_BUFFER_SIZE, "%c", &time);
return buffer;
}
//! We attempt to save registers by placing both the timezone abbreviation
//! timezone index and the daylight_savingtime into the same re... |
items[4].header.id));
// check sixth
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id));
}
void test_timeline__none_backwards(void) {
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_assert_equal... | (&state.pin.header.id, &s_long_items[2].header.id) | );
#endif
cl_assert(!iter_prev(&iterator));
}
static int prv_num_items(Iterator iterator) {
int n = 1;
while (iter_next(&iterator)) {
n++;
}
return n;
}
void test_timeline__gc_past(void) {
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
// Tue Jan 13 11:40:00... |
/*
* 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 resource_load_byte_range_system(SYSTEM_APP, RESOURCE_ID_TIMEZONE_DATABASE,
offset, data, num_bytes) == num_bytes;
} | |
(LOG_LEVEL_DEBUG, "Sending history update event") | ;
PebbleEvent e = {
.type = PEBBLE_HEALTH_SERVICE_EVENT,
.health_event = {
.type = HealthEventSignificantUpdate,
.data.significant_update = {
.day_id = cur_day_index,
},
},
};
event_put(&e);
}
}
// ------------------------------------------------------... | |
truct tm time_tm = s_init_time_tm;
time_t utc_sec = mktime(&time_tm);
fake_rtc_init(100 /*initial_ticks*/, utc_sec);
TimezoneInfo tz_info = {
.tm_zone = "???",
.tm_gmtoff = SECONDS_PER_HOUR,
};
time_util_update_timezone(&tz_info);
s_dls_session_created = false;
s_saved_encoded_msg = NULL;
pro... | time_util_utc_to_local_offset() | ,
.num_types = ARRAY_LENGTH(types),
.types = types,
.num_samples = ARRAY_LENGTH(offset_sec),
.offset_sec = offset_sec,
.num_values = ARRAY_LENGTH(values),
.values = values,
},
};
prv_common_payload_initialize(&input);
// Create a session
ProtobufLogConfig log_config = {
... |
);
cl_assert(logging_session == NULL);
// Reset regular timer. dls_init() will add the same timer info again
regular_timer_deinit();
regular_timer_init();
// Rebuild the list from flash
dls_init();
fake_system_task_callbacks_invoke_pending();
// Check the sessions
for (int i = 0; i < num_sessions; ... | fake_system_task_callbacks_invoke_pending() | |
RAME_INTERVAL_MS);
timeline_layer->animation = animation;
return animation;
}
static Animation *prv_create_bounce_back_animation(Layer *layer, const GRect *to_orig,
GPoint direction) {
GRect from = *to_orig;
GRect to = *to_orig;
gpoint_add_eq(&from.origin, G... | (&layer->layouts_layer, false) | ;
layer_add_child((Layer *)layer, (Layer *)&layer->layouts_layer);
// day separator
GRect frame;
prv_get_day_sep_show_frame(layer, &frame);
peek_layer_init(&layer->day_separator, &frame);
const GFont title_font =
system_theme_get_font_for_size(PreferredContentSizeDefault, TextStyleFont_Title);
peek... |
PBL_LOG(LOG_LEVEL_ERROR, "Error fetching metric data");
return false;
}
// Store in cache if we have space for it.
if (state->cache && (metric == HealthMetricStepCount)) {
memcpy(&state->cache->steps_daily, daily, sizeof(*daily));
state->cache->step_daily_valid = true;
}
return true;
}
// ------... | (averages, &state->cache->step_averages, sizeof(*averages)) | ;
return true;
}
// Fetch the intraday averages, if available
if (state->cache && (metric == HealthMetricStepCount)) {
// Fill the cache if this is step count
sys_activity_get_step_averages(day_in_week, &state->cache->step_averages);
state->cache->step_averages_day = day_in_week;
state->cache... |
nt file_index) {
return FLASH_REGION_DEBUG_DB_BEGIN + (file_index * FILE_SIZE_BYTES);
}
static uint32_t get_current_file_address(void) {
return get_file_address(generation_to_index(0));
}
//! Get next FILE_ID_BIT_WIDTH bit value
static uint8_t get_next_file_id(uint8_t file_id) {
return (file_id + 1) % (1 << (FI... | {
flash_erase_subsector_blocking(get_current_file_address());
FirmwareMetadata md;
bool result = version_copy_running_fw_metadata(&md);
PBL_ASSERTN(result);
FileHeader file_header = {
.basic = {
.magic = VALID_FILE_HEADER_MAGIC,
.file_id = s_current_file_id,
.version_id = CURRENT_VERSI... | |
cosine = cos_lookup(angle);
GTransformNumber num = GTransformNumberFromNumber((float)cosine / TRIG_MAX_RATIO);
GTransformNumber num2 =
(GTransformNumber) { .raw_value = (int32_t)(((int64_t)cosine *
GTransformNumberOne.raw_value) / TRIG_MAX_RATIO) };
cl_asser... | cl_assert(gtransform_is_equal(&t_new, &t_c)) | ;
// Test pointer re-use
gtransform_concat(&t2, &t1, &t2);
cl_assert(gtransform_is_equal(&t2, &t_c));
// Test non-identity concatenation with identity
t1 = GTransformIdentity();
t2 = GTransformFromNumbers(1, 2, 3, 4, 5, 6);
t_c = GTransformFromNumbers(1, 2, 3, 4, 5, 6);
gtransform_concat(&t_new, &t1, ... |
this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDIT... | graphics_draw_rotated_bitmap(&ctx, test_image_bw,
GPointZero, DEG_TO_TRIGANGLE(0), GPointZero) | |
%d, steps:%d, seconds:%.1f, exp_distance:%d, exp_distance_2min:%d, "
"act_distance_2min:%"PRIu32", pct_err: %.2f%% \n", i, params->height_in, params->steps,
params->seconds, params->exp_distance_m, exp_distance_m, value, pct_err);
// Check the percent error
cl_assert(pct_err < 25);
cl... | rtc_get_time() | );
// Should still be sampling every 1 second
cl_assert_equal_i(s_hrm_manager_update_interval, 1);
// Tick one more second, should trigger slow sampling
prv_advance_time_hr(1, 100 /*bpm*/, HRMQuality_Good, false /*force_continuous*/);
// Should be back to no sampling by now (very large sampling period)
cl... |
/*
* 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 (sector_start < (int32_t) min_start) {
sector_start += SECTOR_SIZE_BYTES;
} |
// We want to erase ending after min_end but before max_end. If that ends running past the end of max_end,
// we need to erase starting with the sector before and fill in with subsector erases.
int32_t sector_end = ((min_end - 1) & SECTOR_ADDR_MASK) + SECTOR_SIZE_BYTES;
int32_t subsector_end = ((min_end - 1) ... |
he end of the header.
PBL_ASSERTN((image_length - cursor) > sizeof(AS7000FWSegmentHeader));
// Read the header.
AS7000FWSegmentHeader segment_header;
if (resource_load_byte_range_system(
SYSTEM_APP, RESOURCE_ID_AS7000_FW_IMAGE, cursor,
(uint8_t *)&segment_header, sizeof(segment_heade... | {
PBL_LOG(LOG_LEVEL_ERROR,
"Unexpected application running: 0x%" PRIx8, info.application_id);
goto failed;
} |
// the INT line should be low
if (gpio_input_read(&dev->int_gpio)) {
PBL_LOG(LOG_LEVEL_ERROR, "INT line is not low!");
goto failed;
}
// Set the accelerometer sample frequency
PBL_LOG(LOG_LEVEL_DEBUG, "Setting accel frequency");
PBL_ASSERTN(HRM_MANAGER_ACCEL_RATE_MILLIHZ >= 10000 && HRM_MANAGER_A... |
, 0x17, 0x17, 0x17,
0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17};
cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&made_up));
cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&UUID_INVALID));
cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_i... | (true, app_install_is_hidden(sports_id)) | ;
cl_assert_equal_b(false, app_install_is_hidden(bg_counter_id));
cl_assert_equal_b(false, app_install_is_hidden(menu_layer_id));
cl_assert_equal_b(false, app_install_is_hidden(CRAZY_ID));
}
void test_app_install_manager__is_from_system(void) {
cl_assert_equal_b(true, app_install_id_from_system(-1000000));
... |
/*
* 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... | GPointPreciseFromGPoint(point) | ;
// Hack to make it draw 2px lines on b/w
// Note that this shifts it down and to the right, but it works for us.
pointP.x.fraction += FIXED_S16_3_HALF.raw_value;
pointP.y.fraction += FIXED_S16_3_HALF.raw_value;
return pointP;
}
static GPoint prv_get_point_between_points(GPoint p1, GPoint p2, HealthProgress... |
{
pfs_format(false /* write erase headers */); // start with an empty flash
pfs_init(false);
int num_iters = 30;
for (int i = 0; i < num_iters; i++) {
int files_written = run_full_flash_region_test();
if ((i % 2) == 0) {
pfs_init(true); // simulate a reboot
}
// delete all files
for ... | 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) == 0) || i > ((num_pages() * 2) /... |
Window window;
WeatherAppLayout layout;
WeatherDataListNode *forecasts_list_head;
size_t forecasts_count;
unsigned int current_forecast_index;
EventServiceInfo weather_event_info;
WeatherAppWarningDialog *warning_dialog;
} WeatherAppData;
static bool prv_is_weather_forecast_recent(WeatherLocationForecast... | (data->current_forecast_index + delta,
data->forecasts_count) | ;
WeatherDataListNode *node =
weather_service_locations_list_get_location_at_index(data->forecasts_list_head,
data->current_forecast_index);
weather_app_layout_animate(&data->layout, &node->forecast, is_down_pressed);
}
static void prv_main_window_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... | {
launcher_menu_layer_set_selection_state(launcher_menu_layer,
&s_launcher_app_persisted_data.selection_state);
} |
app_focus_service_subscribe_handlers((AppFocusHandlers) {
.did_focus = prv_did_focus,
.will_focus = prv_will_focus,
});
}
static void prv_window_unload(Window *window) {
LauncherAppWindowData *data = window_get_user_data(window);
// Capture the vertical range of the selection rectangle for composito... |
(DISP_COLS, DISP_ROWS) | ;
return;
}
WTF;
}
bool app_manager_is_app_supported(const PebbleProcessMd *md) {
// Get the app ram size depending on the SDK type.
// Unsupported SDK types will have a size of 0.
return prv_get_app_segment_size(md) > 0;
}
// Commands
///////////////////////////////////////////////////////////
void... | |
er_calls, b), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_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);
// The stopped handler for A should fire before the st... | (prv_count_handler_entries(&s_started_handler_calls, seq), 1) | ;
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 1);
// Everything should have been freed
cl_assert_equal_i(prv_count_animations(), 0);
#endif
}
// --------------------------------------------------------------------------------------
// Test a seeking in a basic sequence animati... |
// Get the rest of the wrapped read
cl_assert(shared_circular_buffer_read(&buffer, &client, 1, &out_buffer, &out_length));
cl_assert_equal_i(out_length, 1);
cl_assert(memcmp(out_buffer, (uint8_t*) "a", 1) == 0);
cl_assert(shared_circular_buffer_consume(&buffer, &client, 1));
// Consume one without reading i... | cl_assert(shared_circular_buffer_read(&buffer, &client1, 2, &out_buffer, &out_length)) | ;
cl_assert_equal_i(out_length, 2);
cl_assert(memcmp(out_buffer, "gh", 2) == 0);
cl_assert(shared_circular_buffer_consume(&buffer, &client1, 2));
cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client1), 3);
cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer... |
/*
* 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 (e != BLE_STATUS_OK) {
PBL_LOG(LOG_LEVEL_DEBUG, "ble_gattc_discover_cancel: %u", e);
} | |
c_mark();
// Try to subscribe to the non-subscribe-able characteristic:
BTErrno e = gatt_client_subscriptions_subscribe(characteristic,
BLESubscriptionAny, GAPLEClientKernel);
cl_assert_equal_i(e, BTErrnoInvalidParameter);
fake_kernel_malloc_mark_assert_equal()... | cl_assert_equal_i(e, -1) | ;
fake_kernel_malloc_mark_assert_equal();
prv_assert_no_event();
}
void test_gatt_client_subscriptions__unsubscribe_no_clients_subscribed(void) {
fake_kernel_malloc_mark();
BTErrno e;
BLECharacteristic characteristic = prv_get_indicatable_characteristic();
e = gatt_client_subscriptions_subscribe(characteri... |
ead);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000), 0);
// s_items[0] is the earliest pin, followed by s_items[4]
cl_assert_equal_i(pin_db_delete((uint8_t *)&s_items[0].header.id, sizeof(Uuid)), 0);
// next item should be items 4, going back should ski... | (state.node->duration, 16 * 60) | ;
cl_assert_equal_i(state.current_day, midnight_march_2_pst);
// day 2
cl_assert(iter_next(&iterator));
cl_assert(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->ti... |
ontext;
static bool prv_read_minute_file_info_cb(SettingsFile *file, SettingsRecordInfo *info,
void *context_arg) {
AlgMinuteFileInfoContext *context = (AlgMinuteFileInfoContext *)context_arg;
context->num_records++;
return true;
}
bool activity_algorithm_minute_file_inf... | hr_util_get_hr_zone(60 + i) | |
rmware it will get mad at us and try to update us out of this mode. We
// want to stay in this mode to collect logs and core dumps at the factory.
// FIXME: Long term the phone should probably just be able to collect logs and core dumps
// regardless of the state of the watch, but for now just lie.
fw_metadata-... | comm_session_send_data(session, s_endpoint_id, (uint8_t*) &versions_msg, sizeof(versions_msg),
COMM_SESSION_DEFAULT_TIMEOUT) | ;
}
void system_version_protocol_msg_callback(CommSession *session, const uint8_t* data, size_t length) {
switch (data[0]) {
case VERSION_REQUEST: {
prv_send_watch_versions(session);
break;
}
default:
PBL_LOG(LOG_LEVEL_ERROR, "Invalid message received. First byte is %u", data[0]);
break;
}
}
... |
}
uint8_t register_value;
bool success = prv_read_register(rail_control_reg, ®ister_value);
if (!success) {
// Failed to read the current register value
return false;
}
if (enable) {
if (*ref_count) {
(*ref_count)++;
return true;
} else {
// Set the register byte to X... | if (val == 0x01) {
PBL_LOG(LOG_LEVEL_DEBUG, "Found the max14690");
return true;
} else {
PBL_LOG(LOG_LEVEL_DEBUG,
"Error: read max14690 whomai byte 0x%x, expecting 0x%x", val, 0x01);
return false;
} |
}
static bool prv_set_pin_config(void) {
periph_config_acquire_lock();
gpio_use(GPIOB);
GPIO_InitTypeDef gpio_init_struct;
gpio_init_struct.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_9;
gpio_init_struct.GPIO_Mode = GPIO_Mode_AF;
gpio_init_struct.GPIO_Speed = GPIO_Speed_50MHz;
gpio_init_struct.GPIO_OType = GPIO_O... |
/*
* 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;
} | |
allocate some larger variables on the heap to reduce stack usage
struct tm *local_alarm_time = kernel_malloc_check(sizeof(struct tm));
uint8_t *settings_file_buffer = kernel_malloc_check(ALARM_ENTRY_SIZE);
AppInstallEntry *entry = kernel_malloc_check(sizeof(AppInstallEntry));
if (!app_install_get_entry_for_inst... | {
bool alarm_found = false;
s_next_alarm_time = 0;
cron_job_unschedule(&s_next_alarm_cron);
for (int i = 0; i < MAX_CONFIGURED_ALARMS; ++i) {
AlarmConfig config;
if (prv_alarm_get_config(file, i, &config)) {
Alarm alarm = { .id = i, .config = config };
prv_check_and_schedule_alarm(file, &a... |
// ----------------------------------------------------------------------------------------------
static void prv_put_alarm_event(void) {
if (!s_alarms_enabled) {
return;
}
AlarmConfig *config = s_most_recent_alarm_id != ALARM_INVALID_ID ? &s_most_recent_alarm_config :
... |
---------------------------------------------
// Called by accel driver after it has put more data into the circular buffer
void accel_manager_dispatch_data(void) {
ACCEL_LOG_DEBUG("entering accel_manager_dispatch_data");
mutex_lock_recursive(s_mutex);
{
AccelSubscriberState* state;
// Tell the accel dri... | mutex_unlock_recursive(s_mutex) | ;
return success;
}
// -------------------------------------------------------------------------------------------
DEFINE_SYSCALL(int, sys_accel_manager_set_sampling_rate, AccelSessionRef session,
AccelSamplingRate rate) {
if (rate != ACCEL_SAMPLING_10HZ && rate != ACCEL_SAMPLING_25HZ && rate != AC... |
656, -40, -688},
{ 656, -24, -696},
{ 656, -40, -696},
{ 640, -48, -696},
{ 656, -24, -704},
{ 648, -32, -712},
{ 648, -32, -696},
{ 648, -40, -688},
{ 656, -32, -688},
{ 648, -40, -696},
// 64 seconds
{ 648, -32, -688},
{ 664, -40, -712},
{ 672, -16, -840},
{ 624... | { 680, -48, -672},
{ 680, -48, -672},
{ 672, -40, -688},
{ 672, -80, -696},
{ 664, -56, -672},
{ 672, -48, -672},
{ 672, -64, -672},
{ 672, -64, -664},
{ 672, -32, -680},
{ 664, -40, -688},
{ 672, -56, -688},
{ 664, -56, -696},
{ 656, -64, -688},
{ 656, -64, -680}... |
{ 664, -40, -688},
{ 664, -48, -688},
{ 656, -48, -696},
// 72 seconds
{ 664, -40, -696},
{ 664, -48, -688},
{ 656, -24, -704},
{ 664, -32, -704},
{ 672, -40, -672},
{ 672, -56, -680},
{ 672, -80, -672},
{ 680, -72, -648},
{ 680, -88, -640},
{ 672, -64, -664},
... |
on_layout_frame->size.h),
TEXT_VISIBLE_UPPER_THRESHOLD));
#else
const bool text_visible = render;
#endif
static const GRect box = {
.origin = { CARD_MARGIN, LAYOUT_TOP_BANNER_HEIGHT },
.size = { DISP_COLS - 2 * CARD_MARGIN, LAYOUT_MAX_HEIGHT },
};
static const GRect page_frame_on... | if (layout->view_size.h == 0) {
prv_card_render(layout, graphics_context_get_current_context(), false);
} |
return layout->view_size;
}
static void prv_layout_destroy(LayoutLayer *layout) {
NotificationLayout *notification_layout = (NotificationLayout *)layout;
prv_destroy_view(notification_layout);
kino_layer_deinit(¬ification_layout->icon_layer);
task_free(notification_layout);
}
static void prv_layout_init... |
ction *= (invert ? -1 : 1);
return axis;
}
static void prv_dump_int_stats(void);
static void prv_handle_motion_interrupts(void) {
s_accel_outstanding_motion_work = false;
// Interestingly, the status registers for tap interrupts are updated _after_
// the EXTI fires. Low power mode toggles between suspend and... | (ts_before) | ;
uint16_t num_samples = bmi160_read_16bit_reg(BMI160_REG_FIFO_LENGTH_LSB);
prv_burst_read(BMI160_REG_SENSORTIME_0, &ts_after[0], sizeof(ts_after));
// check to see if we rolled
if (!prv_new_sample_collected(ts_before, ts_after)) {
*timestamp_us = sample_time_before;
return (num_samples);
... |
;
const TimelineLayerStyle *style = prv_get_style();
gpoint_add_eq(&frame->origin,
GPoint(style->fin_offset_x,
is_future ? style->future_fin_offset_y : style->past_fin_offset_y));
frame->size.w -= PBL_IF_RECT_ELSE(style->sidebar_width, 0);
}
static void prv_get_day_sep_fram... | {
if (layer->layouts[s_visible_items[i]]) {
prv_destroy_layout(layer, s_visible_items[i]);
}
TimelineIterState *state = timeline_model_get_iter_state(i);
if (!state) {
continue;
}
TimelineNode *node = state->node;
if (i < num_items && node) {
prv_create_layout(layer, state,... | |
(S_SUCCESS, app_db_get_app_entry_for_install_id(app_three_id, &temp)) | ;
cl_assert_equal_b(true, uuid_equal(&app3.uuid, &temp.uuid));
}
void test_app_db__retrieve_app_db_entries_by_uuid(void) {
AppDBEntry temp;
// check app_db_get_install_id_for_uuid for app 1
memset(&temp, 0, sizeof(AppDBEntry));
cl_assert_equal_i(S_SUCCESS, app_db_get_app_entry_for_uuid(&app1.uuid, &temp));
... | |
0);
check_atan2(-153, 217);
check_atan2(-28, -133);
check_atan2(323, -229);
check_atan2(245, 196);
check_atan2(65, -3);
check_atan2(331, -320);
check_atan2(-151, 284);
check_atan2(111, -98);
check_atan2(-44, -17);
check_atan2(269, -356);
check_atan2(-78, 268);
check_atan2(-247, 37);
check_atan... | (-11, min, max) | , false);
cl_assert_equal_i(WITHIN(11, min, max), false);
// Min and max are both negative
////////////////////////////////
min = -20;
max = -10;
// Min and max themselves should satisfy WITHIN
cl_assert_equal_b(WITHIN(min, min, max), true);
cl_assert_equal_b(WITHIN(max, min, max), true);
// In the... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | regular_timer_add_multisecond_callback(
&s_debounce_timers[conn_id], DISCONNECT_HIDE_DURATION_SECS) | ;
return;
}
if (regular_timer_is_scheduled(&s_debounce_timers[conn_id])) {
// we reconnected quickly so no need to notify the app about it
timer_stopped = regular_timer_remove_callback(&s_debounce_timers[conn_id]);
}
if (!timer_stopped) {
// We've been disconnected long enough that we've alrea... |
{
if (!command) {
return;
}
command->stroke_width = stroke_width;
} |
uint8_t gdraw_command_get_stroke_width(GDrawCommand *command) {
if (!command) {
return 0;
}
return command->stroke_width;
}
uint16_t gdraw_command_get_num_points(GDrawCommand *command) {
if (!command) {
return 0;
}
return command->num_points;
}
void gdraw_command_set_point(GDrawCommand *command,... | |
cl_assert_equal_i(ll, s_messages[idx].length); \
cl_assert_equal_m(dd, s_messages[idx].data, ll); \
}
#define assert_num_message_callbacks(num_cbs) \
{ \
cl_assert_equal_i(num_cbs, s_message_idx); \
}
static int s_dropped_idx;
static uint32_t s_dropped_messages[TEST_ARRAY_SIZE];
void test_dropped_handler(uint... | (BUFFER_SIZE, 1,
test_message_handler,
test_dropped_handler) | ;
cl_assert_equal_p(result, NULL);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// app_inbox_service_register
void test_app_inbox__app_inbox_create_and_register_storage_already_associated(void) {
bool success;
uint8_t storage[BUFFER_SIZE];
success = a... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
// Since modal windows don't have a framebuffer that we can use in the compositor animation,
// draw the modal now (if one exists) so the modal compositor animations can draw on top of it,
// revealing the relevant parts of the modal window throughout the animation
if (s_data.modal_is_destination) {
compo... | |
_pc(void *ptr, uintptr_t client_pc) {
heap_free(task_heap_get_for_current_task(), ptr, client_pc);
}
#endif
void task_free(void* ptr) {
register uintptr_t lr __asm("lr");
uintptr_t saved_lr = lr;
heap_free(task_heap_get_for_current_task(), ptr, saved_lr);
}
void *task_realloc(void* ptr, size_t size) {
regi... | heap_malloc(heap, bytes, saved_lr) | ;
if (!mem && bytes != 0) {
PBL_CROAK_OOM(bytes, saved_lr, heap);
}
return mem;
}
void *kernel_calloc(size_t count, size_t size) {
register uintptr_t lr __asm("lr");
uintptr_t saved_lr = lr;
return (heap_calloc(kernel_heap_get(), count, size, saved_lr));
}
void *kernel_calloc_check(size_t count, size... |
r_type(AlertInvalid));
}
void test_alerts__disabled(void) {
cl_assert(alerts_get_mask() == AlertMaskAllOn);
// Should not allow any notifications through
alerts_set_mask(AlertMaskAllOff);
cl_assert(!alerts_should_notify_for_type(AlertInvalid));
cl_assert(!alerts_should_notify_for_type(AlertMobile));
cl_a... | alerts_should_notify_for_type(AlertReminder) | );
cl_assert(!alerts_should_vibrate_for_type(AlertReminder));
alerts_set_notification_vibe_timestamp();
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS);
cl_assert(!alerts_should_enable_backlight_for_type(AlertReminder));
cl_assert(alerts_should_notify_for_type(AlertOther));
cl_assert(... |
le_items[0]]) {
prv_destroy_layout(layer, s_nonvisible_items[0]);
}
prv_create_layout(layer, iter_state, s_nonvisible_items[0]);
if (iter_state->current_day != layer->current_day) {
// we moved back to an item from the previous day, display the day separator
// by first hiding the pin of the "last" d... | {
static const PropertyAnimationImplementation s_implementation = {
.base.update = (AnimationUpdateImplementation) property_animation_update_int16,
.accessors.setter.int16 = prv_sidebar_setter,
.accessors.getter.int16 = prv_sidebar_getter,
};
Animation *animation = (Animation *)property_animation_crea... |
static void prv_speed_lines_update(Animation *animation, AnimationProgress progress) {}
Animation *timeline_layer_create_speed_lines_animation(TimelineLayer *timeline_layer) {
static const AnimationImplementation s_speed_lines_impl = {
.update = prv_speed_lines_update,
};
Animation *animation = animation_... |
1848, 536, -160},
{ 1952, 656, -520},
{ 1240, 264, -200},
{ 1600, 528, -88},
{ 1456, 624, 72},
{ 1360, 1152, 56},
{ 1056, 1344, 24},
{ 920, 856, 24},
{ 1000, 920, -32},
{ 1016, 816, -24},
{ 1040, 728, -40},
{ 1424, 768, 24},
{ 2024, 752, 160},
{ -1944, 552, 216},
... | { 728, 824, 128},
{ 816, 1184, 288},
{ 1024, 1152, 152},
{ 1320, 960, 32},
{ 1776, 984, 72},
{ -1616, 880, 184},
{ -1440, 800, 152},
{ -1416, 648, 448},
{ -1208, 656, 240},
{ -1376, 1112, 56},
{ -1664, 1096, 192},
{ 1696, 1000, 128},
{ 1208, 976, -136},
{ 752, 480... |
{ 256, -464, -112},
{ 400, -424, -304},
{ 1016, -296, -48},
{ 1688, 80, -208},
{ 1952, 152, -64},
{ -1648, 160, -40},
{ -1672, 328, -152},
{ -1776, 504, 40},
{ -1920, 728, 136},
{ 2000, 760, -120},
{ 1752, 648, 104},
{ 1616, 1264, -80},
{ 1040, 1824, -248},
{ 888... |
ndow) {
VoiceUiData *data = window_get_user_data(window);
if (data->state != StateError) {
// Do not indicate that an error occurred when a session is interrupted by a window transition
if (data->state != StateFinished) {
data->last_session_successful = false;
}
prv_cancel_dictation(data);
}... | {
voice_window->message[0] = '\0';
} |
}
voice_window->message_len = 0;
voice_window->last_session_successful = false;
voice_window->num_sessions = 0;
voice_window->error_count = 0;
voice_window->speech_detected = false;
voice_window->state = StateStart;
voice_window->session_id = VOICE_SESSION_ID_INVALID;
voice_window->start_ms = 0;
vo... |
dialog->buffer,
dialog_text_font,
probe_rect,
... | dialog_appear(dialog) | ;
}
static void prv_actionable_dialog_unload(Window *window) {
ActionableDialog *actionable_dialog = window_get_user_data(window);
dialog_unload(&actionable_dialog->dialog);
// Destroy action bar if it was a predefined type. If the action bar is custom, it is the user's
// responsibility to free it.
if (act... |
void test_shared_prf_storage_v3__wipe_all(void) {
SMPairingInfo sm_pairing_info;
memset(&sm_pairing_info, 0xaa, sizeof(sm_pairing_info));
sm_pairing_info.is_local_encryption_info_valid = true;
sm_pairing_info.is_remote_signing_info_valid = true;
sm_pairing_info.is_remote_identity_info_valid = true;
shared_... | (SMRootKeyTypeIdentity, NULL) | , false);
cl_assert_equal_b(shared_prf_storage_get_root_key(SMRootKeyTypeEncryption, NULL), false);
SM128BitKey keys[2];
for (int i = 0; i < sizeof(keys); ++i) {
((uint8_t *) keys)[i] = i;
}
shared_prf_storage_set_root_keys(keys);
SM128BitKey keys_out[2];
for (SMRootKeyType key_type = 0; key_type <... |
GColorBlack,
PBL_IF_COLOR_ELSE(GColorClear, GColorWhite),
PBL_IF_RECT_ELSE(GTextAlignmentCenter, GTextAlignmentRight),
GTextOverflowModeTrailingEllipsis);
layer_set_hidden(&s_phone_ui_data->call_status_t... | prv_action_bar_setup(PhoneCallActions_None) | ;
if (call_accepted) {
prv_set_icon_resource(TIMELINE_RESOURCE_DURING_PHONE_CALL);
prv_set_window_color(ACCEPT_COLOR, true);
prv_set_status_text(ACCEPTED);
} else {
prv_set_icon_resource(TIMELINE_RESOURCE_DISMISSED_PHONE_CALL);
prv_set_window_color(DECLINE_COLOR, true);
if (disconnected) {
... |
_create_text_attribute_node_from_config(
const LayoutLayer *layout, const LayoutNodeTextAttributeConfig *config) {
GTextNodeText *text_node = prv_create_text_node_attribute(layout, config->attr_id);
if (text_node) {
prv_set_text_node_text_parameters_from_config(text_node, layout, &config->text);
}
retur... | (config->horizontal_alignment) | ;
}
prv_setup_container_node_from_config(&horizontal_node->container, layout, &config->container);
}
return horizontal_node;
}
static GTextNodeVertical *prv_create_vertical_container_node_from_config(
const LayoutLayer *layout, const LayoutNodeVerticalConfig *config) {
const int capacity = config->co... |
get_cell_offset }
}
};
static void prv_unschedule_item_animation(ActionMenuLayer *aml) {
animation_unschedule(aml->item_animation.animation);
aml->item_animation.animation = NULL;
}
static void prv_animate_cell(ActionMenuLayer *aml, GRect *label_text_frame, bool *draw_top_shading,
b... | animation_set_delay(item_animation->animation, DELAY_PER_LINE /* ms */) | ;
animation_schedule(item_animation->animation);
}
*draw_top_shading = (item_animation->current_offset_y != item_animation->bottom_offset_y);
*draw_bottom_shading = (item_animation->current_offset_y != item_animation->top_offset_y);
// update the rect height and offset based on the current animat... |
_timer, NULL)) {
prompt_send_response("BUSY");
return;
}
// Construct our new_timer context, will be freed in command_button_press_callback()
ButtonPressNewTimerContext *new_timer_context = kernel_malloc(sizeof(ButtonPressNewTimerContext));
if (!new_timer_context) {
goto error;
}
*new_timer_con... | prompt_command_continues_after_returning() | ;
}
void command_log_dump_generation(const char* generation_str) {
int generation = atoi(generation_str);
flash_dump_log_file(generation, prv_serial_dump_chunk_callback,
prv_serial_dump_completed_callback);
prompt_command_continues_after_returning();
}
static void spam_callback(void *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... | {
list_append((ListNode*)s_vibe_history, (ListNode*)vibe);
} |
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 vibrati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.