prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
malloc(PATH_STRING_LENGTH);
if (index) {
snprintf(filename, PATH_STRING_LENGTH, "%s_%u.%s", func_name, index, extension);
} else {
snprintf(filename, PATH_STRING_LENGTH, "%s.%s", func_name, extension);
}
return filename;
}
// Tests
////////////////////////////////////
// Reference PNGs reside in "test... | gbitmap_pbi_eq(bitmap, GET_PBI_NAME(88)) | );
#endif
}
// Tests APNG file with 8-bit color, 5 frames and loop = 1
// Tests gbitmap_sequence_update_bitmap_by_elapsed with 0 delay frames for 1, 4 and 5
// and 2 & 3 have delay 1000ms
// Result:
// - gbitmaps matches platform decoded APNG
void test_gbitmap_sequence__color_8bit_coin(void) {
#if PLATFORM_SPALDING... |
on_id);
}
session->storage.fd = DLS_INVALID_FILE;
}
// -----------------------------------------------------------------------------------------
// Open the session file, creating it if necessary. If space_needed is > 0, then make sure there is
// enough space in the file to add 'space_needed' more bytes, compact... | prv_realloc_storage(session, file_size) | ) {
goto exit;
}
// Re-open it now
success = prv_open_file(&session->storage, OP_FLAG_WRITE | OP_FLAG_READ, DLS_FILE_INIT_SIZE_BYTES,
session);
exit:
// If success, double-check that we have enough space.
if (success && space_needed > 0) {
file_size = prv_pfs_get_file_size(... |
SSED(read_result) || read_result == E_RANGE) {
return E_DOES_NOT_EXIST;
}
PBL_LOG(LOG_LEVEL_WARNING, "seek_map failed: %d", read_result);
return read_result;
} else if (field.id == EOF_PERSIST_ID_TAG) {
break;
} else if ((found = callback(&field, data))) {
pfs_seek(fd, -(i... | pfs_close(fd) | |
ct->size.w = inside_rect->size.w;
}
if (rect->size.h > inside_rect->size.h) {
rect->size.h = inside_rect->size.h;
}
}
switch (alignment) {
case GAlignCenter: {
rect->origin.x = ((inside_rect->size.w - rect->size.w) / 2) + inside_rect->origin.x;
rect->origin.y = ((inside_rect->size... | { // Bottom edge r1 not above r2's top edge
return true;
} |
return false;
}
void grect_precise_standardize(GRectPrecise *rect) {
if (rect->size.w.raw_value < 0) {
rect->origin.x.raw_value += rect->size.w.raw_value;
rect->size.w.raw_value = -rect->size.w.raw_value;
}
if (rect->size.h.raw_value < 0) {
rect->origin.y.raw_value += rect->size.h.raw_value;
r... |
ted from soonest to farthest.
static ListNode *s_scheduled_jobs;
// -------------------------------------------------------------------------------------------
static bool prv_is_scheduled(CronJob *job) {
// Assumes mutex lock is already taken
return list_contains(s_scheduled_jobs, &job->list_node);
}
static int ... | (LOG_LEVEL_DEBUG, "Cron job scheduled for %ld", job->cached_execute_time) | |
need to take care of this
// in any potential custom transition. The default transitions cannot handle this.
window_from = NULL;
}
// Remove the item from the window stack
list_remove(&pop_item->list_node, &window_stack->list_head, NULL);
WindowStackItem *stack_item = (WindowStackItem *)window_stack-... | (pop_item, transition) | ;
}
return window;
}
void window_stack_pop_all(WindowStack *window_stack, const bool animated) {
if (window_stack->list_head == NULL) {
return;
}
WindowStackItem *top_item = (WindowStackItem *)window_stack->list_head;
WindowStackItem *next_item;
do {
// We manually remove each item to ensure tha... |
ormat format,
GColor *palette, bool free_on_destroy) {
PBL_ASSERTN(!process_manager_compiled_with_legacy2_sdk());
if (!prv_platform_supports_format(size, format)) {
return NULL;
}
if (!prv_is_palettized_format(format)) {
return NULL;
}
GBitmap *bitmap = prv_gbitmap_create_blank(size, format);... | (LOG_LEVEL_WARNING, "format %u row_size_bytes %"PRIu16" width %"PRId16" height %"PRId16,
format, bitmap->row_size_bytes, bitmap->bounds.size.w, bitmap->bounds.size.h) | ;
return false;
}
// Move the actual pixel data up to the front of the buffer.
// This way bitmap->addr points to the start of the buffer and can be directly freed.
memmove(data, data + addr_offset, data_size - addr_offset);
bitmap->addr = data;
bitmap->info.is_bitmap_heap_allocated = true;
// Move... |
r_equal(test_value, start_value));
property_animation_get_to_gcolor8(prop_h, &test_value);
cl_assert(gcolor_equal(test_value, end_value));
GColor8 set_value;
set_value = (GColor8) {.a=0, .r=1, .g=2, .b=3};
property_animation_set_from_gcolor8(prop_h, &set_value);
property_animation_get_from_gcolor8(prop_h,... | animation_set_handlers(h, handlers, context) | ;
animation_set_duration(h, duration);
animation_set_auto_destroy(h, false);
prv_clear_handler_histories();
animation_schedule(h);
int max_loops = 20;
uint64_t start_ms = prv_now_ms();
uint64_t time_ms;
while (s_stopped_handler_calls.num_calls == 0) {
prv_fire_animation_timer();
time_ms = pr... |
(layout.box.size.w, box.size.w) | ;
cl_assert_equal_i(layout.max_used_size.w, 8 * HORIZ_ADVANCE_PX);
graphics_draw_text(&gcontext, "Twitter \n \n \n\n \n \n \n\n ", font, box,
GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, (void*)&layout);
cl_assert_equal_i(layout.box.size.w, box.size.w);
cl_assert_equal... | |
o break it up.
const uint8_t* read_iter = msg;
const char* player_package_ptr;
size_t player_package_length;
read_iter = prv_read_ptr_and_length_from_buffer(read_iter, msg + length,
&player_package_ptr, &player_package_length);
if (!read_iter) {
return;
... | {
comm_session_set_responsiveness(comm_session_get_system_session(),
BtConsumerMusicServiceMomentary,
ResponseTimeMin,
period_ms / MS_PER_SECOND);
} | |
("Core dump and reboot?"), RESOURCE_ID_GENERIC_QUESTION_LARGE);
confirmation_dialog_set_click_config_provider(confirmation_dialog,
prv_coredump_click_config);
app_confirmation_dialog_push(confirmation_dialog);
confirmation_dialog_pop((ConfirmationDialog *)context);
}
static void prv_information_click_confi... | mfg_info_get_hw_version(info->hw_version_string, MFG_HW_VERSION_SIZE + 1) | ;
prv_populate_uptime_string(info);
sniprintf(info->language_string, sizeof(info->language_string),
"%s, v%u", i18n_get_locale(), i18n_get_version());
info->subtitle_text[SystemInformationItemBtAddress] = info->bt_mac_addr;
info->subtitle_text[SystemInformationItemFirmware] = (char*)TINTIN_META... |
*peek_out = (Animation *)property_animation_create_layer_frame(
(Layer *)&data->peek_layer, start, &stop);
animation_set_duration(peek_out, duration);
animation_set_custom_interpolation(peek_out, interpolate_moook_in_only);
// resize the sidebar from fullscreen to become thin on the right
Animation *side... | prv_play_peek_in(data) | ;
#endif
if (data->state == TimelineAppStateNoEvents) {
window_set_click_config_provider_with_context(&data->timeline_window, prv_click_config_provider,
data);
} else if (data->state == TimelineAppStatePeek &&
data->intro_timer_id == EVENTED_TIMER_... |
136, 64},
{ -1144, 216, 24},
{ -1160, 176, 40},
{ -1224, 120, 72},
{ -984, -208, -176},
{ -1024, -168, -272},
{ -1240, -56, -464},
{ -1280, -40, -392},
{ -1544, -48, -312},
{ -1560, 72, -128},
{ -1208, 160, 32},
{ -1072, 304, 16},
{ -1192, 400, 48},
{ -1264, 408, 48},... | { -1088, -24, 32},
{ -1160, 56, -80},
{ -928, 224, -464},
{ -1016, 216, -344},
{ -1168, -184, -168},
{ -1184, -360, -136},
{ -1152, -112, -224},
{ -1112, 224, -144},
{ -1136, 304, -128},
// 31 seconds
{ -1264, 368, -160},
{ -1280, 528, -224},
{ -1152, 712, -352},
... |
{ -1136, 416, 128},
{ -1088, 640, 104},
{ -1352, 664, 168},
{ -928, 632, -120},
{ -1040, 616, -160},
{ -1280, 552, -48},
{ -1592, 424, 56},
{ -1528, 128, 96},
{ -1360, 72, 56},
{ -1368, 24, 24},
{ -1304, 56, 40},
{ -1328, 96, 72},
{ -1296, 80, 80},
{ -1328, 16, 1... |
"
#include "stubs_passert.h"
#include "stubs_pbl_malloc.h"
#include "stubs_rand_ptr.h"
#include "stubs_pfs.h"
#include "stubs_blob_db_sync.h"
#include "stubs_prompt.h"
extern const char *iOS_NOTIF_PREF_DB_FILE_NAME;
extern const int iOS_NOTIF_PREF_MAX_SIZE;
//! Data from iOS notif pref INSERT
//! 00 00 00 00 00 01 02... | cl_assert_equal_s(title->cstring, "Title") | ;
Attribute *mute = attribute_find(¬if_prefs->attr_list, AttributeIdMuteDayOfWeek);
cl_assert(mute);
cl_assert_equal_i(mute->uint8, 0x1F);
Attribute *name = attribute_find(¬if_prefs->attr_list, AttributeIdAppName);
cl_assert(name);
cl_assert_equal_s(name->cstring, "GMail");
// Update the current e... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | process_metadata_get_app_sdk_platform(&md.common) | ;
cl_assert_equal_i(type, PlatformTypeBasalt);
}
|
/*
* 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... | {
SerializedTimelineItemHeader hdr1 = {
.common = {
.ancs_uid = 1,
.layout = 0,
.flags = 0,
.timestamp = 0,
},
};
uuid_generate(&hdr1.common.id);
SerializedTimelineItemHeader hdr2 = {
.common = {
.ancs_uid = 1,
.layout = 0,
.flags = 0,
.timestamp = 0,
... | |
336},
{ -448, 728, 352},
{ -424, 720, 304},
{ -456, 712, 312},
{ -456, 720, 304},
{ -432, 712, 320},
{ -432, 728, 320},
{ -432, 728, 312},
{ -432, 720, 328},
{ -440, 728, 320},
{ -448, 728, 336},
{ -432, 688, 304},
{ -440, 728, 288},
{ -448, 712, 272},
{ -456, 72... | { -432, 728, 296},
{ -432, 728, 296},
{ -440, 728, 296},
{ -440, 728, 296},
{ -432, 728, 296},
{ -432, 728, 296},
{ -424, 736, 296},
{ -424, 736, 296},
{ -432, 736, 296},
// 80 seconds
{ -440, 728, 288},
{ -440, 728, 288},
{ -440, 728, 288},
{ -440, 736, 288},
... | |
eWindow *active_window = app_zalloc_check(sizeof(WorkoutActiveWindow));
active_window->layout = WorkoutLayout_TwoStaticAndScrollable;
active_window->top_metric = top_metric;
active_window->middle_metric = middle_metric;
prv_add_scrollable_metrics(active_window, num_scrollable_metrics, scrollable_metrics);
p... | (top_metric,
ARRAY_LENGTH(scrollable_metrics),
scrollable_metrics,
workout_data,
workout_controller) | ;
}
}
default:
return NULL;
}
}
void workout_active_window_push(WorkoutActiveWindow *active_window) {
app_window_stack_push(&active_window->window, true);
}
void workout_active_update_scrollable_metrics(WorkoutActiveWindow *active_window,
int num_s... |
/*
* 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... | {
// Nothing to call, but somehow this is valid ¯\_(ツ)_/¯, no-op
return jerry_create_number(0);
} |
jerry_acquire_value(callback);
uint32_t timeout = 0;
jerry_length_t cb_argc = 0;
if (argc >= 2) {
// both numbers (123) and strings ('123') are valid
// all others are 0
timeout = rocky_util_uint_from_value(argv[1]);
cb_argc = argc - 2;
}
RockyTimerCbData *cb_data = task_zalloc_check(size... |
yer* me, GContext* ctx) {
graphics_context_set_text_color(ctx, GColorBlack);
graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(80, 4, 72, 32),
GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL);
}
void canvas_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set... | (&ctx, fb) | |
ow away the recorded samples.
}
#endif
static bool prv_run_test_step(BTLETestStep step, AppData *data) {
data->current_test_step = step;
PBL_LOG(LOG_LEVEL_DEBUG, "Run test step: %d", step);
bool wait_for_result = false;
switch (step) {
case BTLETestStep_BTStart:
bt_test_start();
break;
case... | if (!prv_run_test_step(BTLETestStep_BTEnd, data)) {
failed = true;
goto cleanup;
} |
cleanup:
data->current_test_step = BTLETestStep_None;
bt_driver_register_response_callback(NULL);
prv_txrx_menu_update(data);
#if CAPABILITY_HAS_BUILTIN_HRM
sys_hrm_manager_unsubscribe(data->hrm_session);
#endif
#if CAPABILITY_HAS_MICROPHONE
prv_stop_mic_and_cleanup(data);
#endif
if (failed) {
snpri... |
LAG_WRITE | OP_FLAG_READ,
FILE_TYPE_STATIC, sizeof(buf));
for (int i = 0; i < sizeof(buf); i++) {
buf[i] = i;
}
rv = pfs_write(fd, NULL, sizeof(buf));
cl_assert(rv == E_INVALID_ARGUMENT);
rv = pfs_write(fd, buf, sizeof(buf) / 2);
int off = sizeof(buf) / 2;
rv = pfs_write(fd, &buf[off], sizeof(bu... | cl_assert(rv == S_SUCCESS) | ;
rv = pfs_close(fd); // should not be able to double close an fd
cl_assert(rv == E_INVALID_ARGUMENT);
}
void test_pfs__remove(void) {
cl_assert(pfs_remove(NULL) == E_INVALID_ARGUMENT);
char *fname = "abc";
int fd = pfs_open(fname, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10 * 1024);
cl_assert(fd >= 0);
cl_asse... |
(&test[i], &suite->initialize, &suite->cleanup) | ;
if (_clar.exit_on_error && _clar.total_errors)
return;
}
}
#if 0 /* temporarily disabled */
static void
clar_run_single(const struct clar_func *test,
const struct clar_suite *suite)
{
_clar.suite_errors = 0;
_clar.active_suite = suite->name;
_clar.active_test = test->name;
clar_run_test(test,... | |
on, prev_is_sharing);
}
static void prv_disconnect_to_kill_subscription(GAPLEConnection *connection) {
// Unfortunately, GATT does not offer a way to remove a subscription from the server side.
// Only clients (subscribers) themselves can change the subscription state (write the CCCD).
// When stopping sharing, ... | gap_le_connection_by_device(device) | ;
if (!connection) {
PBL_LOG(LOG_LEVEL_ERROR, "Subscription update but no connection?");
goto unlock;
}
prv_update_subscription(connection, is_subscribed);
unlock:
bt_unlock();
}
void ble_hrm_handle_disconnection(GAPLEConnection *connection) {
if (!s_ble_hrm_is_inited) {
return;
}
if (prv_is_... |
8, 712},
{ 160, 560, 576},
{ 224, 552, 584},
{ 264, 568, 648},
{ 256, 712, 608},
{ 264, 776, 528},
{ 288, 800, 480},
{ 264, 816, 400},
{ 384, 984, 320},
{ 168, 744, -8},
{ 80, 1224, -160},
{ 128, 912, -176},
// 59 seconds
{ 144, 904, -320},
{ 128, 800, -408},
... | { -1440, 264, -160},
{ -1208, 312, -352},
{ -1296, 376, -288},
{ -1264, 376, -552},
{ -1384, 448, -800},
{ -1512, 248, -664},
{ -1248, 168, -608},
{ -1472, -112, -328},
{ -1952, 200, -168},
{ -2296, 104, -136},
{ -2304, 96, -40},
{ -2040, -64, 24},
{ -1744, -24, 96},
... |
{ -1272, 368, -568},
{ -1600, 192, -464},
{ -1856, 112, -424},
{ -1768, 72, -360},
{ -1496, 40, -296},
{ -1400, 16, -280},
{ -1400, 112, -200},
{ -1224, 128, -168},
{ -1064, 88, -120},
// 5 seconds
{ -1064, -64, 48},
{ -872, -312, 56},
{ -912, -224, 64},
{ -1216,... |
_result->type != ActionResultTypeSuccessANCSDismiss) {
return;
}
// the notification has been acted on. Remove it.
NotificationWindowData *data = &s_notification_window_data;
notification_storage_set_status(&action_result->id, TimelineItemStatusActioned);
data->notifications_modified = true;
if (data-... | prv_handle_notification_added_common(e->reminder_id, NotificationReminder) | |
tchResult result) {
if (result != AppFetchResultSuccess) {
put_bytes_cancel();
app_cache_remove_entry(s_fetch_state.app_id);
prv_put_event_error(result);
}
s_fetch_state.in_progress = false;
PBL_LOG(LOG_LEVEL_INFO, "App fetch cleanup with result %d", result);
}
//! System task callback triggered ... | kernel_free(pb_event) | ;
}
//! Put Bytes handler. Used for keeping track of progress and cleanup events. This is called
//! from KernelMain's event handler when it receives a PEBBLE_PUT_BYTES_EVENT event. put_bytes
//! posts these events to inform clients of progress.
void app_fetch_put_bytes_event_handler(PebblePutBytesEvent *pb_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... | (&pin_attr_list, AttributeIdIconTiny,
TIMELINE_RESOURCE_NOTIFICATION_REMINDER) | |
ader + sb->consumed_length);
}
static size_t prv_send_job_impl_get_length(const SessionSendQueueJob *send_job) {
return prv_get_remaining_length((SendBuffer *)send_job);
}
static size_t prv_send_job_impl_copy(const SessionSendQueueJob *send_job, int start_offset,
size_t length, ... | PBL_LOG(LOG_LEVEL_WARNING,
"Failed to get send buffer (bytes=%"PRIu32", endpoint_id=%"PRIu16", to=%"PRIu32")",
(uint32_t)required_payload_length, endpoint_id, (uint32_t)is_timeout) | ;
return NULL;
}
} // while(true)
}
bool comm_session_send_buffer_write(SendBuffer *sb, const uint8_t *data, size_t length) {
if (UNLIKELY((sb->payload_buffer_length - sb->written_length) < length)) {
return false;
}
memcpy(sb->payload + sb->header.length + sb->written_length, data, length);
s... |
if (item_layer->animation) {
property_animation_init(item_layer->animation, &implementation, item_layer, NULL, &new_offset);
} else {
item_layer->animation = property_animation_create(&implementation,
item_layer, NULL, &new_offset);
PBL_ASSERTN(item_layer->animation);
animation_set_auto_dest... | {
timeline_animate_back_from_card();
} | |
/*
* 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... | ("language", TEST_LOCALE) | ;
}
void test_rocky_api_watchinfo__platform(void) {
rocky_global_init(s_watchinfo_api);
EXECUTE_SCRIPT("var platform = _rocky.watchInfo.platform");
ASSERT_JS_GLOBAL_EQUALS_S("platform", "basalt");
}
void test_rocky_api_watchinfo__platform_unknown(void) {
s_current_app_sdk_platform = -1; // Some unknown / inv... |
efs.get($1);
var to_set = __jerryRefs.get($2);
obj[name] = to_set;
return __jerryRefs.ref(true);
}, obj_val, prop_name_val, value_to_set);
}
jerry_value_t jerry_set_property_by_index(const jerry_value_t obj_val,
uint32_t index,
... | {
if (!jerry_value_is_function(func_obj_val)) {
return TYPE_ERROR_ARG;
}
return (jerry_value_t)EM_ASM_INT({
var func_obj = __jerryRefs.get($0);
var this_val = __jerryRefs.get($1);
var args = [];
for (var i = 0; i < $3; ++i) {
args.push(__jerryRefs.get(getValue($2 + i... |
jerry_value_t jerry_construct_object(const jerry_value_t func_obj_val,
const jerry_value_t args_p[],
jerry_size_t args_count) {
if (!jerry_value_is_constructor(func_obj_val)) {
return TYPE_ERROR_ARG;
}
return (jerry_value_t)EM_ASM_INT... |
/*
* 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... | (new_reel, icon_from) | ;
kino_reel_transform_set_transform_duration(new_reel, duration);
kino_reel_scale_segmented_set_deflate_effect(new_reel, CARD_TRANSITION_ICON_EXPAND);
kino_reel_scale_segmented_set_delay_by_distance(new_reel, GPoint(0, icon_to.size.h / 2));
prv_change_reel(card_timeline_layout, new_reel);
kino_layer_play_sec... |
e) and
//! sends an event to notify client tasks of any state change. Client tasks
//! that have already been notified, will not be notified again.
//! @note Upon disconnection, this function also removes and free's the intent
//! if there are no more clients that want to auto-reconnect. The caller of this
//! function... | {
bt_lock();
GAPLEConnection *connection = gap_le_connection_by_device(&e->peer_address);
if (connection) {
const BleRemoteVersionInfo *info = &e->remote_version_info;
connection->remote_version_info = *info;
PBL_LOG(LOG_LEVEL_DEBUG, "Remote Vers Info: VersNr: %d, CompId: 0x%x, SubVersNr: 0x%x",
... |
//! bt_lock is assumed to be taken before calling this function.
void bt_driver_handle_le_connection_complete_event(const BleConnectionCompleteEvent *event) {
bt_lock();
const BleConnectionParams *params = &event->conn_params;
PBL_LOG(LOG_LEVEL_INFO,
"LE Conn Compl: addr="BT_DEVICE_ADDRESS_FMT", is_ra... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert(child_b.next_sibling == &child_c) | ;
layer_add_child(&child_a, &grand_child_a);
cl_assert(grand_child_a.parent == &child_a);
// Remove non-first-child (child_b):
//
// +-parent
// |
// '->child_a->child_c
// |
// '->grand_child_a
//
// +-child_b
//
layer_remove_from_parent(&child_b);
cl_assert(chi... |
ernel:
e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionNone, GAPLEClientKernel);
cl_assert_equal_i(e, BTErrnoOK);
// Kernel should get event immediately:
prv_assert_subscription_event(characteristic, BLESubscriptionNone, BLEGATTErrorSuccess,
true /* kernel */, false /*... | (has_notification, false) | |
is is allocated here, but free'd in the wakup_ui.h module
missed_events->missed_app_ids =
kernel_malloc(NUM_APPS_ALERT_ON_BOOT * sizeof(AppInstallId));
}
if (missed_events->missed_apps_count > NUM_APPS_ALERT_ON_BOOT) {
// We have more than NUM_APPS_ALERT_ON_BOOT apps that had eve... | {
mutex_lock(s_mutex);
{
SettingsFile wakeup_settings;
if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) == S_SUCCESS) {
settings_file_delete(&wakeup_settings, (uint8_t*)&wakeup_id, sizeof(WakeupId));
settings_file_close(&wakeup_settings);
}
}
mutex_unlock(... |
static WakeupEntry prv_wakeup_settings_get_entry(WakeupId wakeup_id) {
WakeupEntry entry = {{0}};
mutex_lock(s_mutex);
{
SettingsFile wakeup_settings;
if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) == S_SUCCESS) {
settings_file_get(&wakeup_settings, (uint8_t*)&wa... |
_MASTER_BYTE_RECEIVED,
I2C_EVENT_MASTER_BYTE_TRANSMITTING,
I2C_EVENT_MASTER_BYTE_TRANSMITTED,
};
static bool s_initialized = false;
/*----------------SEMAPHORE/LOCKING FUNCTIONS--------------------------*/
static void bus_lock(I2cBus *bus) {
}
static void bus_unlock(I2cBus *bus) {
}
static bool semaphore_take(... | (BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_scl) | ;
bus_pin_cfg_input(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_sda);
BOARD_CONFIG.i2c_bus_configs[bus_idx].rail_ctl_fn(true);
}
//! Initialize the I2C peripheral
//! Lock the bus and peripheral config access before initialization
static void bus_init(uint8_t bus_idx) {
// Initialize peripheral
I2C_InitTypeDef ... |
def struct RecognizerHandled {
ListNode node;
int idx;
} RecognizerHandled;
static ListNode *s_recognizers_handled;
static ListNode *s_recognizers_reset;
static bool prv_simultaneous_with_cb(const Recognizer *recognizer,
const Recognizer *simultaneous_with) {
return true;
}
... | (&window.layer, &GRectZero) | ;
manager.window = &window;
Layer layer_a, layer_b, layer_c;
layer_init(&layer_a, &GRectZero);
layer_init(&layer_b, &GRectZero);
layer_init(&layer_c, &GRectZero);
layer_add_child(&window.layer, &layer_a);
layer_add_child(&layer_a, &layer_b);
layer_add_child(&window.layer, &layer_c);
manager.active_la... |
or(
5000, false, scaling_factor);
int32_t delta_percent = end_percent - start_percent;
cl_assert(delta_percent > (INT32_MAX - 100));
delta_percent = start_percent - end_percent;
cl_assert(delta_percent < (INT32_MIN + 100));
}
// Check that the percentage reported is somewhat protected from transient v... | battery_curve_lookup_voltage_by_percent(100, false) | ;
int low_mv = battery_curve_lookup_voltage_by_percent(3, false);
int critical_mv = battery_curve_lookup_voltage_by_percent(0, false);
fake_battery_init(good_mv, false, false);
battery_monitor_init();
periodic_timer_trigger(1);
cl_assert(!s_in_low_power && !battery_monitor_critical_lockout());
cl_assert... |
-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 permissions and
* limitations under the ... | sys_get_time() | |
itmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_line_across_y_origin_layer")));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_ny_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_l... | graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 6), 1) | ;
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 8), 2);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 10), 3);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21... |
i(fake_event_get_count(), 1);
cl_assert(!prv_get_calendar_ongoing());
TimerID timer_id = stub_new_timer_get_next();
cl_assert_equal_i(timer_id, TIMER_INVALID_ID);
cl_assert(!stub_new_timer_is_scheduled(timer_id));
cl_assert(timeline_add(&item1));
timeline_event_handle_blobdb_event();
cl_assert_equal_i(fa... | fake_event_get_count() | , 2);
cl_assert(prv_get_calendar_ongoing());
cl_assert(stub_new_timer_is_scheduled(timer_id));
cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000);
rtc_set_time(20 * 60);
cl_assert(stub_new_timer_fire(timer_id));
cl_assert_equal_i(fake_event_get_count(), 3);
cl_assert(prv_get_calendar_ongoi... |
b9, 0x26, 0xd6, 0x44, 0x2c,
0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05},
.app_version = {
.major = 1,
.minor = 1,
},
.sdk_version = {
.major = 1,
.minor = 1,
},
.info_flags = 0,
.icon_resource_id = 0,
};
// Setup
//////////////////////////////////////////////////////////////... | cl_assert_equal_b(true, uuid_equal(&app1.uuid, &temp.uuid)) | ;
// check app_db_get_install_id_for_uuid for app 2
memset(&temp, 0, sizeof(AppDBEntry));
cl_assert_equal_i(S_SUCCESS, app_db_get_app_entry_for_uuid(&app2.uuid, &temp));
cl_assert_equal_b(true, uuid_equal(&app2.uuid, &temp.uuid));
// check app_db_get_install_id_for_uuid for app 3
memset(&temp, 0, sizeof(A... |
lors__green(void) {
cl_assert(GColorGreen.r == 0b00);
cl_assert(GColorGreen.g == 0b11);
cl_assert(GColorGreen.b == 0b00);
cl_assert(GColorGreen.a == 0b11);
}
void test_graphics_colors__blue(void) {
cl_assert(GColorBlue.r == 0b00);
cl_assert(GColorBlue.g == 0b00);
cl_assert(GColorBlue.b == 0b11);
cl_ass... | (GColorWhite) | .argb);
cl_assert_equal_i(GColorBlackARGB8, gcolor_get_bw(GColorBlack).argb);
cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_bw(GColorLightGray).argb);
cl_assert_equal_i(GColorBlackARGB8, gcolor_get_bw(GColorDarkGray).argb);
cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_bw(GColorYellow).argb);
cl_assert_equa... |
entesque auctor, turpis at cras "
"amet.";
_Static_assert(sizeof(lipsum) > PERSIST_STRING_MAX_LENGTH,
"lipsum string is not long enough for persist tests");
void test_persist__initialize(void) {
fake_spi_flash_init(0, 0x1000000);
pfs_init(false);
persist_service_init();
persist_service_clien... | cl_assert(PASSED(persist_write_int(0, 0))) | ;
cl_assert_equal_i(persist_delete(0), S_TRUE);
cl_assert_equal_i(persist_delete(0), E_DOES_NOT_EXIST);
}
/*
* Confirm that fields can be reassigned values.
*/
void test_persist__overwrite(void) {
const uint32_t key = 0;
cl_assert_equal_i(persist_write_int(key, 1), sizeof(int));
cl_assert_equal_i(persist_r... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (new_tail == &a) | ;
cl_assert(list_get_prev(&b) == NULL);
cl_assert(list_get_tail(&b) == &b);
}
void test_list__append(void) {
ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL;
ListNode *tail;
tail = list_append(&a, &b);
cl_assert(tail == &b);
tail = list_append(&a, &c);
cl_assert(tail == &c);
cl_as... |
tmbuf);
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%g", &wrk);
cl_assert_equal_s(tmbuf, s_iso8601_data[i].str_g);
printf("%s\n", tmbuf);
}
}
#endif
#if EXTENSION_SU
void test_strftime__full_percent_z(void) {
char tmbuf[512];
struct tm jan_2_2015__13_00_00 = {
.tm_hour = 13, .tm_min = ... | cl_assert_equal_s(tmbuf, "00") | ;
}
// Test the zero flag
void test_strftime__zeroflag(void) {
char tmbuf[512];
struct tm jan_2_10015__13_00_00 = {
.tm_hour = 13, .tm_min = 0, .tm_sec = 0, // 13:00:00
.tm_year = 10015 - 1900, .tm_mon = 0, .tm_mday = 2, // 10015/01/02
.tm_wday = 5, .tm_yday = 1, // Friday, 2nd day of the year
.tm... |
/*
* 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... | ((ListNode*)vibe) | |
k(sizeof(SharedPRFData));
prv_fetch_struct(data);
return data;
}
static void prv_dealloc_struct(SharedPRFData *data) {
kernel_free(data);
}
static void prv_persist_field(uint8_t *field, size_t offset, size_t field_size, bool calc_crc) {
SharedPRFData *data = prv_alloc_and_fetch_struct();
const size_t field... | {
flash_read_bytes((uint8_t *) &data, SPRF_PAGE_FLASH_ADDR(i), sizeof(data));
if (prv_valid_struct(&data)) {
s_valid_page_idx = i;
break;
}
} |
}
// Keep a write offset, this won't work when we try to roll over to the other 25% of the sectors
if (s_valid_page_idx == SPRF_PAGE_IDX_INVALID) {
prv_erase_region_and_save(NULL);
} else if (s_valid_page_idx > (SPRF_MAX_NUM_PAGES_MULT(SPRF_NUM_PAGES))) {
prv_erase_region_and_save(&data);
... |
EvictListNode *)list_pop_head((ListNode *)node);
kernel_free(temp);
} else {
break;
}
}
*list_node = node;
}
//! Check if we need to free up some space in the cache. If so, do it.
static void prv_cleanup_app_cache_if_needed(void *data) {
uint32_t pfs_space = get_available_pfs_space();
if (... | mutex_lock_recursive(s_app_cache_mutex) | ;
{
SettingsFile file;
rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE);
if (rv != S_SUCCESS) {
goto unlock;
}
// we don't want to remove any default apps or quick launch apps, so keep them in a list.
EachEvictData evict_data = (EachEvictData) {
.bytes_neede... |
system/bootbits.h"
#include "system/logging.h"
#include "system/passert.h"
#include "system/reset.h"
#include "syscall/syscall_internal.h"
#include "debug/debug.h"
#include "debug/setup.h"
#define STM32F2_COMPATIBLE
#define STM32F4_COMPATIBLE
#define STM32F7_COMPATIBLE
#include <mcu.h>
#include "FreeRTOS.h"
#includ... | boot_bit_clear(BOOT_BIT_BOOTLOADER_TEST_A | BOOT_BIT_BOOTLOADER_TEST_B);
psleep(10000);
system_hard_reset();
for (;;) {}
// won't get here, rest gets optimized out
#endif
#ifdef RECOVERY_FW
boot_bit_clear(BOOT_BIT_RECOVERY_START_IN_PROGRESS);
#endif
extern uint32_t __kernel_main_stack_start__[];
exter... |
static void watchdog_timer_callback(void* data) {
task_watchdog_bit_set(PebbleTask_NewTimers);
}
static void vcom_timer_callback(void* data) {
display_pulse_vcom();
}
static void register_system_timers(void) {
static RegularTimerInfo watchdog_timer = { .list_node = { 0, 0 }, .cb = watchdog_timer_callback };
... |
while (length >= 1) {
if (even) {
graphics_draw_pixel(ctx, p0);
}
even = !even;
p0.x += delta.x;
p0.y += delta.y;
--length;
}
}
static void background_update_proc(Layer *layer, GContext *ctx) {
GRect bounds = layer_get_bounds(layer);
// Draw lines to contain 'hole' and 'par' sect... | (0, 0, background_width, STATUS_BAR_LAYER_HEIGHT) | ;
layer_set_frame(status_bar_layer_get_layer(data->status_layer), status_frame);
status_bar_layer_set_colors(data->status_layer, GColorClear, GColorBlack);
#if PBL_RECT
status_bar_layer_set_separator_mode(data->status_layer, StatusBarLayerSeparatorModeDotted);
#endif
layer_add_child(background, status_bar_layer... |
-136},
{ 1656, 272, 32},
{ 1456, 240, -40},
{ 1288, 216, -88},
{ 1152, 72, -32},
{ 976, 40, -96},
{ 1032, 24, -96},
{ 984, 8, -72},
{ 928, 48, -256},
{ 968, 24, -344},
// 52 seconds
{ 1160, -40, -64},
{ 1512, 136, -264},
{ 1488, 160, -312},
{ 1488, 104, -376},
... | { -584, 1432, -72},
{ -248, 1424, 96},
{ -72, 1512, -104},
// 58 seconds
{ -8, 1328, -56},
{ 344, 1536, -344},
{ -264, 1112, -208},
{ -448, 912, -168},
{ -312, 560, -272},
{ -152, 392, -384},
{ -408, 168, 48},
{ -744, -232, 856},
{ -664, -80, 488},
{ -560, -32, 54... |
// ----------------------------------------------------------------
// Sample captured: 2015-10-01 09:31:54 local
AccelRawData *activity_sample_walk_100_pbl_25471_6(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_25471_6
//> TEST_EXPECTED 100
//> T... |
ssert_equal_i(kino_reel_get_elapsed(test_reel), 300 - 20);
}
void test_kino_player__create_infinite_animation_finite_reel_reverse(void) {
// Choose duration and elapsed to have clean division for
// ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number
test_reel_data->duration_ms = 300;
Animation *anima... | (animation_is_scheduled(animation), false) | ;
animation_schedule(animation);
// Play plays a new animation
cl_assert_equal_i(animation_is_scheduled(animation), true);
kino_player_play(test_player);
cl_assert_equal_i(animation_is_scheduled(animation), false);
// Create play animation unschedules previous animation
animation = (Animation *)kino_pla... |
-Enable Register
NVIC->ICER[i] = 0xFFFFFFFF;
// Interrupt Clear-Pending Register
NVIC->ICPR[i] = 0xFFFFFFFF;
}
// Set the peripheral clock enable registers to their reset values as
// specified in the datasheet.
RCC->AHB1ENR = 0x00100000; // Core-coupled memory is enabled at reset
RCC->AHB2ENR =... | {
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE);
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO);
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_THREE);
return true;
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | settings_file_set(&file, key, strnlen(key, SETTINGS_KEY_MAX_LEN) + 1, val, val_len) | ;
settings_file_close(&file);
cleanup:
return (rv == S_SUCCESS);
}
bool shell_prefs_get_clock_24h_style(void) {
return s_is_24h_style;
}
void shell_prefs_set_clock_24h_style(bool is_24h_style) {
mutex_lock(s_mutex);
if (prv_pref_set(PREF_KEY_CLOCK_24H, &s_is_24h_style, sizeof(s_is_24h_style))) {
s_is_24... |
S;
#if STM32F412xG
// STM32F412xG suports a new "low-power regulator low voltage in deep sleep" mode.
temp |= PWR_CR_LPLVDS;
#endif
PWR->CR = temp;
#endif
// Configure the processor core to enter deepsleep mode when we
// execute a WFI or WFE instruction.
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
// Go stop no... | prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_COMM_TIME, InhibitorCommMode, now_ticks) | |
add_units, zero_pad, modulus);
#else
prv_do_conversion(state, value, SECONDS_PER_DAY, 0, s_day_strings,
add_units, zero_pad, modulus);
#endif
break;
case 'H': // hour
prv_do_conversion(state, value, SECONDS_PER_HOUR, HOURS_PER_DAY, s_hour_strings,
... | {
if (wait_time < state->eval_cond->eval_time) {
state->eval_cond->eval_time = wait_time;
}
} |
// Only characters possible here are :,)
if (*state->position == ':') {
state->position++;
}
return match;
}
static void prv_format_process_format_string(TemplateStringState *state, char delimiter) {
// Predicate matched (or is default case), so let's parse the string.
while ((*state->position != del... |
/*
* 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... | CTYPE_THEIRS(ispunct) |
CTYPE_THEIRS(isalnum)
CTYPE_THEIRS(isprint)
CTYPE_THEIRS(isgraph)
CTYPE_THEIRS(iscntrl)
CTYPE_THEIRS(isascii)
CTYPE_THEIRS(toascii)
// We have to do this because glibc throws specification to the wind.
// Quoting from the C99 spec:
// If the argument is a character for which isupper is true and there are one or mo... |
{ -576, -240, -792},
{ -624, -64, -776},
{ -576, -256, -704},
{ -712, -128, -792},
{ -568, -200, -688},
{ -672, -144, -736},
{ -560, -184, -688},
{ -536, -232, -744},
{ -496, -88, -688},
{ -584, -232, -808},
{ -592, 32, -728},
{ -592, -232, -784},
{ -736, -64, -776},
... | { -544, -168, -752},
{ -536, -216, -744},
{ -544, -80, -800},
{ -560, -184, -720},
{ -496, -160, -840},
{ -528, -104, -672},
{ -520, -232, -808},
{ -552, -112, -768},
{ -520, -304, -792},
{ -648, -160, -824},
{ -536, -216, -696},
{ -640, -136, -744},
{ -664, 8, -768},... | |
/*
* 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... | (GRect(0, 0, 10, -20)) | );
cl_assert_equal_i(10, grect_shortest_side(GRect(0, 0, -20, 10)));
}
void test_gtypes__grect_inset(void) {
GRect rect = GRect(10, 20, 30, 40);
cl_assert_equal_grect(GRect(12, 23, 26, 34), grect_inset_internal(rect, 2, 3));
cl_assert_equal_grect(GRect(7, 18, 36, 44), grect_inset_internal(rect, -3, -2));
}
v... |
/*
* 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 (address < s_sector_addresses[0]) {
dbgserial_print("address ");
dbgserial_print_hex(address);
dbgserial_putstr(" is outside system flash");
return -1;
} |
for (size_t i=0; i < ARRAY_LENGTH(s_sector_addresses)-1; ++i) {
if (s_sector_addresses[i] <= address
&& address < s_sector_addresses[i+1]) {
return i;
}
}
return ARRAY_LENGTH(s_sector_addresses)-1;
}
bool system_flash_erase(uint32_t address, size_t length, SystemFlashProgressCb progress_ca... |
the watchface upon exit
app_exit_reason_set(APP_EXIT_ACTION_PERFORMED_SUCCESSFULLY);
// Pop all windows so we'll soon exit the app
app_window_stack_pop_all(true /* animated */);
// Immediately push this result dialog so it's the last thing we see before exiting
app_simple_dialog_push(confirmation_dialog);
}... | MAX(icon_size.w, ATTRIBUTE_ICON_TINY_SIZE_PX) | ;
mutable_cell_layer->bounds = grect_inset(cell_layer_bounds,
GEdgeInsets(0, 5, 0, text_left_margin));
const GFont title_font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle);
const GFont subtitle_font = system_theme_get_font_for_default_size(TextSt... |
_did_focus(bool in_focus) {
LauncherAppWindowData *data = app_state_get_user_data();
if (in_focus) {
launcher_menu_layer_set_selection_animations_enabled(&data->launcher_menu_layer, true);
}
}
static void prv_will_focus(bool in_focus) {
LauncherAppWindowData *data = app_state_get_user_data();
if (!in_foc... | window_set_user_data(window, data) | ;
window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_window_load,
.unload = prv_window_unload,
});
const bool animated = false;
app_window_stack_push(window, animated);
}
static void prv_main(void) {
const LauncherMenuArgs *args = (const LauncherMenuArgs *)app_manager_get_task_contex... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert(floor( 1.5) == 1.0) | ;
cl_assert(floor(-1.5) == -2.0);
cl_assert(floor( 2.0) == 2.0);
cl_assert(floor(-2.0) == -2.0);
cl_assert(floor( 0.0001) == 0.0);
cl_assert(floor(-0.0001) == -1.0);
cl_assert(isnan(floor(NAN)));
cl_assert(isinf(floor(INFINITY)));
}
|
, 200, -216},
{ 1296, 24, -104},
{ 1184, 88, -128},
{ 1280, 104, -208},
{ 984, 48, -232},
{ 1288, 128, -128},
{ 496, -152, -208},
{ 632, 216, -440},
{ 912, 88, -368},
{ 808, 80, -312},
{ 680, 184, -320},
{ 712, 216, -216},
{ 904, 320, -240},
{ 1176, 400, -224},
{ ... | { 1120, 632, -304},
{ 1032, 464, -304},
{ 848, 592, -368},
{ 984, 600, -320},
{ 1264, 640, -240},
{ 1360, 472, -136},
{ 1048, 480, -256},
{ 880, 264, -224},
{ 720, 272, -192},
{ 752, 152, -112},
{ 992, 200, -176},
// 37 seconds
{ 1184, 64, -64},
{ 1184, 56, -88},
... |
{ 472, 32, -424},
{ 1064, 48, -400},
{ 968, 48, -296},
{ 736, 48, -360},
{ 688, 128, -336},
{ 784, 208, -336},
{ 960, 384, -384},
{ 1176, 480, -320},
{ 1232, 576, -384},
{ 1088, 616, -384},
{ 960, 552, -304},
{ 1136, 608, -392},
{ 944, 536, -256},
{ 1048, 440, -1... |
= alignment;
}
return jerry_create_undefined();
}
JERRY_FUNCTION(prv_get_text_align) {
char *align_str = NULL;
switch (s_rocky_text_state.alignment) {
case GTextAlignmentLeft:
align_str = "left";
break;
case GTextAlignmentRight:
align_str = "right";
break;
case GTextAlignme... | (str_buffer) | ;
// return a TextMetrics object
JS_VAR result = jerry_create_object();
JS_VAR result_width = jerry_create_number(size.w);
JS_VAR result_height = jerry_create_number(size.h);
JS_VAR result_abbl = jerry_create_number(-1);
JS_VAR result_abbr = jerry_create_number(-2);
jerry_set_object_field(result, "width"... |
/*
* 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... | {
// clz stands for Count Leading Zeroes. We use it to find the MSB
int msb = 31 - __builtin_clz(n);
// popcount counts the number of set bits in a word (1's)
bool power_of_two = __builtin_popcount(n) == 1;
// if not exact power of two, use the next power of two
// we want to err on the side of ... | |
}
++s_circular_buffer_retain_count[client];
}
unlock:
prv_unlock();
return rv;
}
// -------------------------------------------------------------------------------------------------
static bool prv_find_subscription_cb(ListNode *node, void *data) {
const GATTClientSubscriptionNode *subscription = (const G... | {
BLESubscription previous_prevailing_type = BLESubscriptionNone;
GAPLEConnection *connection;
uint8_t supported_properties;
uint16_t att_handle;
BLEDescriptor cccd_ref =
gatt_client_accessors_find_cccd_with_characteristic(characteristic_ref, &supported_properties,
... |
subscription = (GATTClientSubscriptionNode *) kernel_malloc(sizeof(GATTClientSubscriptionNode));
if (!subscription) {
// OOM
return BTErrnoNotEnoughResources;
}
// Initialize it:
*subscription = (const GATTClientSubscriptionNode) {
.characteristic = characteristic_ref,
.att_... |
rt_pos) : GPointZero;
int64_t diff_time = time_ms - ctx->start_time_ms;
TouchPressure diff_pressure = pressure - ctx->start_pressure;
uint32_t queue_idx;
if (!prv_queue_is_full(ctx)) {
queue_idx = (ctx->touch_queue.read_idx + ctx->touch_queue.count) %
ARRAY_LENGTH(ctx->touch_queue.events);
ctx->... | event_handler(&event, context) | |
d(data->progress_window, true);
progress_window_push(data->progress_window, prv_get_window_stack(data));
const unsigned action_result_timeout_ms = 5 * MS_PER_SECOND;
data->response.timer = evented_timer_register(action_result_timeout_ms,
false,
... | (
item, TimelineItemActionTypeAncsResponse) | ;
// Update the type of the action to be of type TimelineItemActionTypeResponse. This will cause
// us to send a slightly different message to the phone so it can tell the difference between
// the start reply action and the send reply action.
// This is okay because we are just modifying a copy of the original... |
ap, on Spalding the "padding" we had left
// isn't enough to fit Rocky + Jerry's .bss:
app_segment_size -= 1400;
}
#endif
memset((char *)app_ram.start + stack_guard_size, 0,
memory_segment_get_size(&app_ram) - stack_guard_size);
MemorySegment app_segment;
PBL_ASSERTN(memory_segment_split(&app... | {
watchface_set_default_install_id(entry.install_id);
} |
}
app_manager_set_minimum_run_level(process_metadata_get_run_level(app_md));
// Use the static app event queue:
s_app_task_context.to_process_event_queue = s_to_app_event_queue;
// Init services required for this process before it starts to execute
process_manager_process_setup(PebbleTask_App);
char ... |
/*
* 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 SECONDS_PER_DAY + rtc_get_time();
} |
static uint32_t s_total_step_count;
bool activity_get_metric(ActivityMetric metric, uint32_t history_len, int32_t *history) {
if (metric != ActivityMetricStepCount) {
return false;
}
*history = s_total_step_count;
return true;
}
static bool s_abandoned_workout_notification_sent;
void workout_utils_send_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... | {
return reel->impl->get_data_size(reel);
} | |
/*
* 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... | ARRAY_LENGTH(s_vibe_score_resources) | |
/*
* 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 prv_get_dimensions_for_runtime_platform_default_size()->title_subtitle_left_margin;
} |
static ALWAYS_INLINE GFont prv_get_cell_title_font(const MenuCellLayerConfig *config) {
return config->title_font ?: system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle);
}
static ALWAYS_INLINE GFont prv_get_cell_subtitle_font(const MenuCellLayerConfig *config) {
return config->subtitle_font ?:
... |
state, &head, TimelineIterDirectionFuture,
1421178000), 0);
cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id));
// check second
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check third
cl_assert(iter_next(&iterator));
cl_assert(... | (&iterator) | );
// check second
cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id));
// check third
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id));
// check fourth
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[... |
License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli... | portEXIT_CRITICAL() | ;
return result;
}
static void prv_event_cb(void *data) {
while (true) {
// No need to worry about reading a partial message here, we write messages to the circular
// buffer while disabling interrupts the whole time.
uint32_t log_length;
if (!prv_isr_buffer_read_and_consume(&log_length, sizeof(... |
t8_t *) &incomplete_put_msg,
sizeof(incomplete_put_msg));
assert_ack_count(0);
assert_nack_count(1);
}
void test_put_bytes__put_message_length_field_too_long(void) {
prv_receive_init_fw_object();
prv_process_and_reset_test_counters();
const size_t payload_size = 2;
const ... | if (max_batched_ops < 2) { // This race condition is not possible if we aren't pre-Acking
return;
} | |
FlashReadTestValues {
int size;
int offset;
};
const struct FlashReadTestValues FLASH_READ_TEST_TABLE[] = {
{ .size = 1024, .offset = 0 },
{ .size = 1025, .offset = 0 },
{ .size = 1026, .offset = 0 },
{ .size = 1027, .offset = 0 },
{ .size = 1024, .offset = 1 },
{ .size = 1025, .offset = 2 },
{ .siz... | profiler_get_total_duration(true) | ;
prompt_send_response_fmt(buf, buf_size, "Subsector blank check via read took: %"PRIu32,
blank);
if (is_blank != S_TRUE) {
++failures;
prompt_send_response("FAILURE: sector not blank!?!");
} else {
++passes;
}
if (failures == 0) {
prompt_send_response_fmt(buf, buf_... |
hese occasionally
// and don't want them to mess up our state.
if (data->hrm_quality == HRMQuality_NoAccel) {
return s_manager_state.sensor_stable;
}
// If we were stable before, just make sure we are still stable
if (s_manager_state.sensor_stable) {
// If we just went on-wrist or off-wrist, reset th... | (remaining_ticks, subscriber_remaining_ticks) | ;
}
// How many milliseconds till we need to send the next sensor reading
remaining_ms = ticks_to_milliseconds(remaining_ticks);
HRM_LOG("Need sensor on again in %"PRIu32" sec", remaining_ms / MS_PER_SECOND);
turn_sensor_on = (remaining_ms <= 0);
}
if (turn_sensor_on && !hrm_is_e... |
fonts_get_system_font(config->music_time_font_key));
layer_add_child(&data->window.layer, &data->position_text_layer.layer);
prv_configure_music_text_layer(&data->length_text_layer, data->length_buffer, &time_rect,
TIME_BOUNDS_OFFSET, GTextAlignmentRight,
... | prv_update_ui_state(data, true) | |
tc,
s_parsed_msg.msrmt.utc_to_local);
LOG(" %"PRIu32" types: ", s_parsed_msg.msrmt.num_types);
for (unsigned i = 0; i < s_parsed_msg.msrmt.num_types; i++) {
LOG(" %d", (int)s_parsed_msg.msrmt.types[i]);
}
LOG(" %"PRIu32" measurements: ", s_parsed_msg.msrmt.num_samples);
for (unsig... | cl_assert_equal_i(a->payload_sender_v_major, b->payload_sender_v_major) | ;
cl_assert_equal_i(a->payload_sender_v_minor, b->payload_sender_v_minor);
cl_assert_equal_s(a->payload_sender_version_patch, b->payload_sender_version_patch);
// Ensure they are the same type
cl_assert_equal_i(a->type, b->type);
// MeasurementSet Specific
if (a->type == ProtobufLogType_Measurements) {
... |
}
gatt_client_consume_read_response(event->object_ref,
buffer, value_length, GAPLEClientKernel);
}
if (client->handle_read_or_notification) {
client->handle_read_or_notification(event->object_ref, buffer,
value_length, event-... | (LOG_LEVEL_ERROR,
"Unhandled GATT event:%u ref:%"PRIu32" err:%"PRIu16" len:%"PRIu16" cl:%p",
event->subtype,
(uint32_t)event->object_ref,
(uint16_t)event->gatt_error,
(uint16_t)event->value_length,
client) | ;
}
static void prv_handle_connection_event(const PebbleBLEConnectionEvent *event) {
PBL_LOG(LOG_LEVEL_DEBUG, "PEBBLE_BLE_CONNECTION_EVENT: reason=0x%x, conn=%u, bond=%u",
event->hci_reason, event->connected, event->bonding_id);
const bool connected = event->connected;
// FIXME: When PPoGATT is suppor... |
/*
* 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_cb_data, sizeof(*out_cb_data)) | ;
}
mutex_lock(s_mutex);
EventedTimer *timer = prv_find_timer(timer_id);
// It's possible that the client made a call to delete the timer just
// after the timer executed (from the timer task) and posted the PEBBLE_CALLBACK_EVENT
// to the client's event queue. In this case, the timer will no
// longe... |
ct_precise(GContext* ctx, const GRectPrecise *rect) {
const Fixed_S16_3 right = grect_precise_get_max_x(rect);
const Fixed_S16_3 bottom = grect_precise_get_max_y(rect);
const GPointPrecise top_left = rect->origin;
const GPointPrecise top_right = {right, rect->origin.y};
const GPointPrecise bottom_right = {ri... | {
bitset8_clear(line, x);
} |
}
}
void graphics_draw_round_rect(GContext* ctx, const GRect *rect, uint16_t radius) {
PBL_ASSERTN(ctx);
if (!rect || ctx->lock) {
return;
}
// only draw if there is enough to cover the rounded edges - otherwise round down to largest
// radius that can be drawn
radius = prv_clamp_corner_radius(rect... |
ck_push(window, true);
cl_assert_equal_i(app_window_stack_count(), 1);
app_window_stack_pop(true);
cl_assert_equal_i(app_window_stack_count(), 0);
window_destroy(window);
}
void test_window_stack__basic_modal_push(void) {
Window *window = window_create();
WindowStack *window_stack =
modal_manager... | app_state_get_window_stack() | ->list_head);
app_window_stack_push(window1, true);
cl_assert_equal_i(app_window_stack_count(), 1);
cl_assert_equal_i(window1->on_screen, true);
app_window_stack_insert_next(window2);
cl_assert_equal_i(app_window_stack_count(), 2);
cl_assert_equal_i(window1->on_screen, true);
cl_assert_equal_i(window2... |
animation
void test_animation__sequence_get_duration(void) {
#ifdef TEST_INCLUDE_COMPLEX
const int duration_a = 300;
const int delay_a = 100;
const int play_count_a = 1;
const int total_duration_a = play_count_a * (delay_a + duration_a);
const int duration_b = 500;
const int delay_b = 200;
const int play... | animation_get_duration(b, true, false) | , delay_b + duration_b);
cl_assert_equal_i(animation_get_duration(b, true, true), total_duration_b);
cl_assert_equal_i(animation_get_duration(spawn, false, false),
MAX(total_duration_a, total_duration_b));
cl_assert_equal_i(animation_get_duration(spawn, false, true),
play_... |
"AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "graphics_private_raw_mask.h"
#include "bitblt_private.h"
#include "gcontext.h"
#include "system/passert.h"
... | {
prv_update_mask(ctx, y, x1.integer, x2.integer, color);
// increment the last_pixel since we had some middle pixels
last_pixel_x++;
// x1 doesn't need to be increased as it's not used anymore in this function
} |
// last pixel with blending (don't render first *and* last pixel if line length is 1)
if (x2.fraction != 0) {
prv_blend_color_and_update_mask(ctx, y, last_pixel_x, last_pixel_x, color,
(uint8_t)x2.fraction);
}
}
T_STATIC void prv_mask_recording_assign_vertical_line(GCont... |
h"
#include "misc.h"
#include <string.h>
static void prv_spi_init(void) {
// Configure the GPIO (SCLK, MOSI - no MISO since the SPI is TX-only)
gpio_af_init(&ICE40LP->spi.clk, GPIO_OType_PP, GPIO_Speed_25MHz, GPIO_PuPd_NOPULL);
gpio_af_init(&ICE40LP->spi.mosi, GPIO_OType_PP, GPIO_Speed_25MHz, GPIO_PuPd_NOPULL... | dbgserial_putstr("Enabling 6v6 (Display VDDC)") | |
ctivityMetricStepCount, &val_out));
cl_assert_equal_i(val_out, average_steps_val);
const char *average_sleep_key = "average_sleepDuration";
int32_t average_sleep_val = 654321;
cl_assert_equal_i(health_db_insert((uint8_t *)average_sleep_key, strlen(average_sleep_key),
(uint8... | health_db_insert((uint8_t *)key, strlen(key),
(uint8_t *)s_future_movement_data, sizeof(s_movement_data)) | ,
S_SUCCESS);
cl_assert_equal_i(s_metric_updated_count, 0);
}
|
stub_new_timer_timeout(get_dnd_timer_id()) | , 1800 * MS_PER_SECOND);
rtc_set_time(s_monday_10_30);
do_not_disturb_handle_clock_change();
active = do_not_disturb_is_active();
cl_assert(active == false);
// Timer will go off at 01:00 on Sunday. (12 hours)
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 43200 * MS_PER_SECOND);
}
void tes... | |
bject_field(options, "hour12");
if (!jerry_value_is_undefined(hour12)) {
*is_24h_style = !jerry_get_boolean_value(hour12);
}
struct {
const jerry_value_t field;
const char *value;
ToStringFormat format;
} option_values[] = {
{.field = second, .value = ROCKY_DATE_FORMAT_NUMERIC, .format = T... | {
case ToStringFormatLocaleTime:
// %I adds leading zeros, for single digit hours. We don't want that for 12h
return !is_24h_style;
case ToStringFormatSecondNumeric:
case ToStringFormatMinuteNumeric:
case ToStringFormatHourNumeric:
case ToStringFormatDayNumeric:
case ToStringFormatMo... | |
0, 0x1000000); //from test_settings_file.c
pfs_init(false);
stub_pebble_tasks_set_current(PebbleTask_KernelBackground);
// Reset variable due to previous callbacks
s_popup_occurred = false;
wakeup_init();
wakeup_enable(true);
}
void test_wakeup__cleanup(void) {}
void test_wakeup__basic_checks(void) {
... | wakeup_enable(false) | |
//////////////////////////////
void test_session_receive_router__initialize(void) {
s_session = comm_session_open(s_transport, &s_transport_implementation,
TransportDestinationSystem);
memset(s_protocol_callback_counts, 0, sizeof(s_protocol_callback_counts));
s_prepare_count = 0;... | {
// Expect "Disallowed" meta message to be replied to a message for an endpoint that is disallowed
// by use over a app session.
// The message should get eaten and not interfere with whatever comes next.
comm_session_close(s_session, CommSessionCloseReason_UnderlyingDisconnection);
s_session = comm_session... |
void test_session_receive_router__ignore_message_if_no_receiver_could_be_prepared(void) {
// Expect an inbound message to be skipped/ignored if no Receiver could be prepared.
// The message should get eaten and not interfere with whatever comes next.
s_prepare_return_null = true;
// Length: 1, Endpoint ID: P... |
/*
* 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 (ctx->draw_state.compositing_mode == GCompOpAssign) {
graphics_context_set_compositing_mode(ctx, GCompOpSet);
} |
}
graphics_draw_bitmap_in_rect(ctx, icon, icon_frame);
}
static void prv_menu_cell_basic_draw_custom_rect(
GContext *ctx, const Layer *cell_layer, const MenuCellLayerConfig *config) {
const GRect *bounds = &cell_layer->bounds;
const bool is_legacy2 = process_manager_compiled_with_legacy2_sdk();
const ... |
{ 160, 1168, 32},
{ 232, 1496, 152},
{ 16, 1328, 264},
{ -112, 1392, 352},
{ 56, 1264, 352},
{ 32, 888, 312},
{ 56, 792, 248},
{ 136, 720, 208},
{ 104, 616, 128},
{ 120, 536, 128},
// 50 seconds
{ 176, 608, 128},
{ 208, 760, 112},
{ 216, 880, 112},
{ 208, 1000... | { 176, 1176, 144},
{ 120, 1488, 328},
{ -48, 1424, 456},
{ -24, 1200, 448},
{ 72, 1032, 256},
{ 112, 864, 256},
{ 152, 544, 296},
{ 176, 576, 96},
{ 184, 552, 128},
{ 216, 664, 136},
{ 248, 800, -40},
{ 312, 920, 80},
{ 352, 960, 56},
// 56 seconds
{ 248, 1080... |
{ 192, 1304, 136},
{ 48, 1264, -16},
{ 112, 1520, 240},
{ -40, 1240, 240},
{ -32, 992, 40},
{ 24, 856, 40},
{ 120, 664, 96},
{ 192, 600, 64},
{ 200, 568, -8},
{ 216, 664, 40},
{ 240, 872, 24},
{ 232, 888, 24},
{ 280, 872, 72},
{ 304, 1136, -40},
{ 248, 1184, ... |
Priority = (tskIDLE_PRIORITY + 1) | portPRIVILEGE_BIT,
.puxStackBuffer = stack,
};
PBL_LOG(LOG_LEVEL_DEBUG, "Starting %s", task_name);
pebble_task_create(PebbleTask_Worker, &task_params, &s_worker_task_context.task_handle);
// If no default yet, set as the default so that it can be relaunched upon system... | {
// Reset the data tracking the last worker that crashed since we are going to show crash UI
prv_reset_last_worker_crashed_data();
// Show the crash UI, which will ask the user if they want to launch the worker's app
crashed_ui_show_worker_crash(closing_worker_install_id);
} | else {
// Record that this worker crashed and what time it crashed
s_last_worker_crashed_install_id = closing_worker_install_id;
s_last_worker_crash_timestamp = current_time;
// Silently restart the worker if we are allowing relaunches of crashed workers
if (!s_worker_crash_relaunches_dis... |
y2.integer > max_valid_y) {
y2 = (Fixed_S16_3){.integer = max_valid_y};
}
if (y1.integer > y2.integer) {
return;
}
// last pixel with blending (don't render the pixel if it overflows the framebuffer/clip box)
if (y2.integer >= max_valid_y) {
y2.fraction = 0;
}
ctx->draw_state.draw_implement... | {
bool black = (gcolor_equal(color, GColorBlack));
uint8_t *line = ((uint8_t *)framebuffer->addr) + (framebuffer->row_size_bytes * y);
bitset8_update(line, x, !black);
} |
#endif // PBL_COLOR
}
void graphics_private_plot_horizontal_line_prepared(GContext *ctx, GBitmap *framebuffer,
GRect *clip_box, int y, int x0, int x1,
uint16_t opacity, GColor color) {
// Plots pixel directly to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.