prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
et, .size = structured_glance->glance.size };
#if PLATFORM_ROBERT
const int16_t horizontal_inset = 10;
#else
const int16_t horizontal_inset = PBL_IF_RECT_ELSE(6, 23);
#endif
glance_frame = grect_inset_internal(glance_frame, horizontal_inset, 0);
GTextNode *structured_glance_node = prv_create_structured_glance_... | launcher_app_glance_notify_service_glance_changed(&structured_glance->glance) | ;
}
void launcher_app_glance_structured_set_icon_max_size(
LauncherAppGlanceStructured *structured_glance, GSize new_size) {
if (!structured_glance) {
return;
}
structured_glance->icon_max_size = new_size;
const int width_diff = structured_glance->icon_max_size.w -
LAUNCHER_A... |
nds
{ 440, 480, -792},
{ 416, 320, -712},
{ 448, 376, -752},
{ 512, 568, -984},
{ 448, 352, -576},
{ 400, 512, -768},
{ 424, 216, -784},
{ 520, 360, -720},
{ 456, 280, -800},
{ 424, 400, -768},
{ 440, 432, -752},
{ 480, 416, -800},
{ 504, 376, -712},
{ 472, 512, -... | { 432, 520, -728},
{ 440, 512, -664},
{ 456, 496, -768},
{ 448, 424, -792},
{ 432, 320, -800},
{ 424, 424, -824},
{ 424, 360, -768},
{ 424, 280, -712},
{ 424, 280, -784},
{ 448, 224, -808},
{ 472, 312, -912},
// 180 seconds
// elapsed: 3 minutes
{ 400, 336, -800},... | |
_persistent_storage_set_root_keys(keys);
return;
}
// if we get here there are no root keys in prf storage, let's load the root
// keys normal fw has been using. This shouldn't ever really happen unless we
// reboot while saving new information to shared PRF
if (bt_persistent_storage_get_root_key(SMRootK... | (&bonding, sizeof(bonding), NULL, 0) | == GapBondingFileSetFail) {
return false;
}
return true;
}
bool prv_has_active_gateway_by_type(BtPersistBondingType desired_type) {
BTBondingID bonding;
BtPersistBondingType type;
if (!bt_persistent_storage_get_active_gateway(&bonding, &type)) {
return false;
}
if (bonding == BT_BONDING_ID_IN... |
nt = 0;
EXECUTE_SCRIPT(
"ctx.moveTo(7, 8);\n"
"ctx.lineTo(9, 10);\n"
"ctx.fill();\n"
);
// still only the first part (before the .moveTo()) as the second only has two points
cl_assert_equal_i(1, s_gpath_draw_filled.call_count);
cl_assert_equal_i(3, lc->path.num_points);
cl_assert_equal_point(GP... | (0, s_rocky_path_steps_num) | ;
EXECUTE_SCRIPT(
"ctx.moveTo(1, 2);\n"
"ctx.rect(3, 4, 5, 6);\n"
);
cl_assert_equal_i(6, s_rocky_path_steps_num);
EXECUTE_SCRIPT(
"ctx.rect(7, 8, 9, 10);\n"
);
cl_assert_equal_i(11, s_rocky_path_steps_num);
cl_assert_equal_i(RockyAPIPathStepType_MoveTo, s_rocky_path_steps[0].type);
cl_asse... |
ctx->draw_state.clip_box;
grect_clip(&ctx->draw_state.clip_box, &window->layer.frame);
StatusBarLayerConfig config = {
.foreground_color = GColorWhite,
.background_color = GColorBlack,
.mode = StatusBarLayerModeClock,
};
GRect frame = window->layer.frame;
// window.frame.ori... | (&window->layer) | ;
window_unload(window);
}
void window_set_overrides_back_button(Window *window, bool overrides_back_button) {
if (overrides_back_button == window->overrides_back_button) {
return;
}
window->overrides_back_button = overrides_back_button;
}
static ClickManager* prv_get_current_click_manager(void) {
retu... |
/*
* 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_put_reminder_event(item_id, ReminderTriggered) | ;
reminders_update_timer();
}
static void prv_new_timer_callback(void *data) {
system_task_add_callback(prv_trigger_reminder_system_task_callback, data);
}
static status_t prv_set_timer(Reminder *item) {
time_t now = rtc_get_time();
uint32_t timeout_ms;
if (item->header.timestamp <= now) {
timeout_ms = ... |
d.
#include "settings_menu.h"
#include "settings_quick_launch.h"
#include "settings_quick_launch_app_menu.h"
#include "settings_quick_launch_setup_menu.h"
#include "settings_window.h"
#include "applib/app.h"
#include "applib/app_launch_button.h"
#include "applib/app_launch_reason.h"
#include "applib/ui/window_stack.h... | {
QuickLaunchData *data = app_malloc_check(sizeof(*data));
*data = (QuickLaunchData){};
data->callbacks = (SettingsCallbacks) {
.deinit = prv_deinit_cb,
.draw_row = prv_draw_row_cb,
.get_initial_selection = prv_get_initial_selection_cb,
.select_click = prv_select_click_cb,
.num_rows = prv_num... | |
SIS,
* 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 "gpath_builder.h"
#include "gpath.h"
#include "applib/applib_malloc.auto.h"
#include "util/trig.h"
#include <string.h>
... | if (!result) {
return NULL;
} |
memset(result, 0, sizeof(GPath));
result->num_points = num_points;
// Set the points pointer within the GPath structure to point just after the GPath structure
// since that is where memory has been allocated for the array.
result->points = (GPoint*)(result + 1);
memcpy(result->points, builder->points, si... |
write is 1/8 to 1/4 of the initial file size.
int num_bytes = DLS_FILE_INIT_SIZE_BYTES/8 + (rand() % DLS_FILE_INIT_SIZE_BYTES/8);
// By doing 16 loops, we are sure to cycle through the allocated file size at least twice.
for (int j=0; j<16; j++) {
prv_log_consume_random(logging_sessions[i], item_size... | {
unsigned int nb = rand() % 300;
nb = MIN(nb, bytes_left[i]);
if (!nb) {
continue;
}
did_some = true;
prv_data_log_chain(logging_sessions[i], buf[i], item_size, nb);
bytes_left[i] -= nb;
buf[i] += nb;
} | |
/*
* 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... | (memcmp(key, s_settings_file.keys[key_crc8], key_len) == 0) | ;
}
free(s_settings_file.values[key_crc8]);
free(s_settings_file.keys[key_crc8]);
s_settings_file.values[key_crc8] = val_copy;
s_settings_file.keys[key_crc8] = key_copy;
s_settings_file.val_lens[key_crc8] = val_len;
s_settings_file.key_lens[key_crc8] = key_len;
s_settings_file.dirty[key_crc8] = true;
... |
8, -144, -8},
{ 1512, -136, 0},
{ 1136, -72, -56},
{ 752, -32, -200},
{ 816, -64, -240},
{ 1072, -40, -200},
{ 1088, -112, -120},
{ 976, -104, -112},
{ 936, -64, -136},
{ 912, -64, -120},
{ 920, -56, -144},
{ 960, -80, -144},
{ 984, -72, -184},
// 136 seconds
{ 10... | { 1056, -144, -152},
{ 1432, -200, -88},
{ 1520, -144, -96},
{ 1248, -88, -112},
{ 912, -72, -192},
{ 832, -80, -104},
{ 1056, -48, -48},
{ 1088, -64, 24},
{ 1024, -56, 24},
{ 936, -32, 48},
{ 896, 0, -8},
{ 888, 24, -104},
{ 936, -8, -168},
{ 976, -48, -224},
... | |
new_status_frame.origin.x += is_visible ? status_offset : -status_offset;
const int16_t new_icon_layer_x_offset = ((window_bounds_width - title_width) / 2) - status_offset;
layer_set_frame(&data->status_layer.layer, &new_status_frame);
#endif
const uint16_t icon_layer_x_offset = PBL_IF_ROUND_ELSE(new_icon_layer_... | (&data->dnd_icon_layer, &GRectZero) | ;
layer_set_update_proc(&data->dnd_icon_layer, prv_draw_dnd_icon);
layer_add_child(root_layer, &data->dnd_icon_layer);
prv_dnd_status_changed(do_not_disturb_is_active());
// set up the notification presented list service
notifications_presented_list_init();
fail:
mutex_unlock(s_notification_window_mutex);... |
atchApp,
.attr_list = open_attr_list,
};
for (int i = 0; i < num_responses; i++) {
ResponseItem *response_item = &response_items[i];
attribute_list_add_cstring(&response_item->attr_list, AttributeIdTitle,
i18n_get(response_item->text, pin_attr_list));
action_group.acti... | ("On avg") | |
rvice(s_ad_data, &missing_uuid));
}
// -----------------------------------------------------------------------------
// Creating BLEAdData:
// -----------------------------------------------------------------------------
void test_ble_ad_parse__ad_and_scan_resp_boundaries(void) {
}
void test_ble_ad_parse__start_scan... | (ad->ad_data_length, sizeof(expected_ad_data)) | ;
cl_assert_equal_i(ad->scan_resp_data_length, 0);
ble_ad_destroy(ad);
// 14x 16-bit UUIDs should fit, expect true:
ad = ble_ad_create();
cl_assert_equal_b(ble_ad_set_service_uuids(ad, uuid, 14), true);
ble_ad_destroy(ad);
// 15x 16-bit UUIDs does not fit, expect false:
ad = ble_ad_create();
cl_asse... |
"drivers/rtc.h"
#include "kernel/events.h"
#include "kernel/pbl_malloc.h"
#include "services/common/comm_session/session.h"
#include "services/common/i18n/i18n.h"
#include "services/common/regular_timer.h"
#include "services/normal/alarms/alarm.h"
#include "services/normal/timezone_database.h"
#include "services/norma... | (&time_tm) | ;
gmtime_r(&uxtime, &time_tm);
}
if (rule->flag & TIMEZONE_FLAG_STANDARD_TIME) { // Standard time (not wall time)
time_tm.tm_gmtoff = tz_info->tm_gmtoff;
time_tm.tm_isdst = 0;
} else if (rule->flag & TIMEZONE_FLAG_UTC_TIME) { // UTC
time_tm.tm_gmtoff = 0;
time_tm.tm_isdst = 0;
} else { // W... |
"
#include "system/logging.h"
#include "system/passert.h"
#include "util/attributes.h"
#include "util/math.h"
#include "util/uuid.h"
//! Used for keeping track of binaries that are loaded through put_bytes
typedef struct {
AppInstallId app_id;
uint32_t total_size;
AppFetchResult prev_error;
bool cancelling;
... | prv_cleanup(error) | ;
goto finally;
}
if (pb_event->type == PebblePutBytesEventTypeInitTimeout) {
PBL_LOG(LOG_LEVEL_WARNING, "Timed out waiting for putbytes request from phone");
prv_cleanup(AppFetchResultTimeoutError);
}
// If this is an object that doesn't have a cookie, then we won't care about it.
if (pb_event-... |
&& s_stopped_handler_calls.num_calls == 1
&& layer.frame.origin.x < to_r.origin.x) {
detected_reset_of_elapsed = true;
}
cl_assert(max_loops > 0);
max_loops--;
}
// Make sure we detected a reset of the elapsed after rescheduling
cl_assert(s_stopped_handler_calls.num_calls == 2);
cl_a... | prv_create_test_animation() | |
i"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_y_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_y_offset_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&l... | (&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY) | |
IN_RECT_NO_CLIP, false, 1);
graphics_circle_quadrant_draw_1px_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, GCornersTop);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quads_top.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
gra... | layer_set_update_proc(&layer, &clear_layer_update_callback) | |
zeof(SerializedTimelineItemHeader) + iter_state.header.payload_length;
if (size_needed <= size_available) {
return;
}
}
if (pfs_seek(fd, iter_state.header.payload_length, FSeekCur) < 0) {
break;
}
}
}
//! Check whether there exists @ref size_needed available space in storage aft... | {
// [AS] TODO: Write failure: reset storage, compression or reset watch?
goto reset_storage;
} |
s_write_offset += result;
prv_file_close(fd);
return;
reset_storage:
mutex_unlock_recursive(s_notif_storage_mutex);
notification_storage_reset_and_init();
}
// Finds the next match in the notification storage file from the current position
// Position in file will be at the start of notification payload ... |
r_close_current_app(gracefully);
} else if (task == PebbleTask_Worker) {
worker_manager_close_current_worker(gracefully);
} else {
WTF;
}
}
// ----------------------------------------------------------------------------------------------
bool process_manager_send_event_to_process(PebbleTask task, Pebb... | {
return 0;
} | else {
return (uint32_t) process_manager_get_current_process_args();
}
}
// -------------------------------------------------------------------------------------------
DEFINE_SYSCALL(AppExitReason, sys_process_get_exit_reason, void) {
return prv_get_context()->exit_reason;
}
// ------------------------------... |
/*
* 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... | text_layer_calc_text_flow_paging_values(&text_layer, &origin, &page) | );
cl_assert_equal_i(page.origin.y, text_layer.layer.frame.origin.y);
// must not overflow
cl_assert(grect_get_max_y(&page) > 0);
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | __builtin_unreachable() | ;
}
|
--------------------------------------
// Sample captured: 2015-09-30 07:09:23 local
AccelRawData *activity_sample_reading_paper(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME reading_paper
//> TEST_EXPECTED 0
//> TEST_EXPECTED_MIN 0
//> TEST_EXPECTED_MAX 60
//... | { -144, 880, -256},
{ -136, 912, -248},
{ -128, 904, -248},
{ -120, 920, -232},
{ -120, 904, -232},
{ -120, 904, -232},
{ -120, 912, -232},
// 5 seconds
{ -120, 904, -248},
{ -120, 904, -248},
{ -120, 912, -240},
{ -120, 904, -240},
{ -112, 880, -256},
{ -112, 896... |
{ -112, 896, -256},
{ -112, 896, -256},
{ -112, 896, -256},
{ -120, 896, -256},
{ -112, 904, -256},
{ -120, 904, -256},
{ -120, 904, -256},
{ -120, 904, -256},
{ -112, 896, -256},
{ -112, 896, -256},
{ -112, 904, -256},
{ -120, 904, -256},
{ -120, 896, -248},
{ -... |
.duration = 30,
.type = TimelineItemTypePin,
.flags = 0,
.layout = LayoutIdTest,
},
.attr_list = {
.num_attributes = 0,
.attributes = NULL,
},
.action_group = {
.num_actions = 0,
.actions = NULL,
},
.allocated_buffer = NULL,
}, {
.... | uuid_equal(&s_items[s_correct_order[3]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id) | |
f_storage_v3__initialize(void) {
fake_spi_flash_init(FLASH_REGION_SHARED_PRF_STORAGE_BEGIN,
SPRF_REGION_SIZE);
shared_prf_storage_init();
}
void test_shared_prf_storage_v3__cleanup(void) {
fake_spi_flash_cleanup();
prv_assert_mutexes_unlocked();
}
void test_shared_prf_storage_v3__init_al... | shared_prf_storage_get_ble_pairing_data(&pairing_info_out, name_out,
&requires_address_pinning_out,
&flags) | |
;
cl_assert_equal_i(test_value, start_value);
property_animation_get_to_int16(prop_h, &test_value);
cl_assert_equal_i(test_value, end_value);
int16_t set_value;
set_value = 42;
property_animation_set_from_int16(prop_h, &set_value);
property_animation_get_from_int16(prop_h, &test_value);
cl_assert_equ... | {
#ifdef TEST_INCLUDE_BASIC
PropertyAnimation *prop_h;
GTransform value;
GTransform start_value, end_value, mid_value;
const int duration = 1000;
const AnimationHandlers handlers = {
.started = prv_started_handler,
.stopped = prv_stopped_handler
};
// NOTE: We are not exposing the GTransform in ... |
GTransform set_value;
set_value = GTransformIdentity();
property_animation_set_from_gtransform(prop_h, &set_value);
property_animation_get_from_gtransform(prop_h, &test_value);
cl_assert_equal_gtransform(test_value, GTransformIdentity());
property_animation_set_from_gtransform(prop_h, &start_value);
//... |
6, 744, -128},
{ 1152, 560, -128},
{ 992, 392, -152},
{ 872, 272, -184},
{ 936, 256, -168},
{ 1200, 200, -152},
{ 1384, 160, -200},
{ 1392, 128, -136},
{ 1216, 128, -256},
{ 856, -104, -248},
{ 464, -200, -72},
{ 632, 0, -568},
{ 920, -72, -528},
{ 1360, 104, -512},
... | { 296, -176, -368},
{ 792, -96, -624},
{ 1200, 96, -528},
{ 1272, 120, -616},
{ 1136, -8, -648},
{ 1040, 40, -608},
{ 1112, 272, -968},
{ 888, 280, -1208},
{ 712, 120, -1256},
{ 696, -88, -984},
{ 832, -24, -800},
// 34 seconds
{ 1080, 256, -680},
{ 1752, 672, -74... | |
, " ");
}
strncat(sentence, (char *) word->data, word->length);
}
return true;
}
static bool prv_handle_dictation_nlp_result_common(VoiceEndpointResult result,
AudioEndpointSessionId session_id,
bool app_... | (VoiceEventTypeSessionResult, VoiceStatusSuccess, event_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... | (buffer + pos, buffer_size - pos, " %"PRId32, daily_avg) | |
le_ancs_bulk_action_mode(bool enable) {
s_bulk_action_mode = enable;
}
bool timeline_is_bulk_ancs_action_mode_enabled(void) {
return s_bulk_action_mode;
}
typedef struct OpenAppContext {
EventServiceInfo event_info;
AppInstallId install_id;
} OpenAppContext;
static void prv_app_render_ready(PebbleEvent *e, v... | prv_dismiss_local_notification_action(item) | ;
return;
}
// FALLTHROUGH
case TimelineItemActionTypeGeneric:
case TimelineItemActionTypeResponse:
case TimelineItemActionTypeAncsResponse:
case TimelineItemActionTypeAncsGeneric:
case TimelineItemActionTypeHttp:
case TimelineItemActionTypeComplete:
case TimelineItemAct... |
tif_time,
.insight_type = type,
.icon_id = icon,
.body = body,
.headings = headings,
.values = values,
.open_app = {
.enabled = true,
.health_card_type = HealthCardType_Activity,
},
};
analytics_event_health_insight_created(notif_time, type, 0);
prv_create_and_push_notific... | activity_prefs_activity_insights_are_enabled() | ) {
prv_do_activity_reward(now_utc);
}
prv_do_activity_summary(now_utc);
prv_do_activation_delay_insights(now_utc);
prv_process_activity_sessions(now_utc);
}
// ------------------------------------------------------------------------------------------------
static void prv_settings_file_changed_cb(void *d... |
ner_session->start_utc);
cl_assert(session->start_utc < container_session->start_utc
+ container_session->len_m * SECONDS_PER_MINUTE);
last_deep_session_len_m = session->len_m;
// Accumulate restful sleep stats
results->deep.value += session->len_m;
if ... | (s_kalg_state, prv_stats_cb) | ;
s_num_captured_sleep_sessions = 0;
// Run samples through the activity detector
time_t now = rtc_get_time();
time_t test_start_utc = now;
for (int i = 0; i < entry->num_samples; i++) {
uint16_t vmc = entry->samples[i].v5_fields.vmc;
if (entry->version == 1) {
// Convert from t... |
_RECT_ODD GRect(15, 15, MAX_NUM_COLS, MAX_NUM_ROWS)
#define OFFSET_RECT_CLIP_EVEN GRect(10, 10, 60, 60)
#define OFFSET_RECT_CLIP_ODD GRect(11, 11, 61, 61)
void test_graphics_draw_line___even_offset_horizontal_dotted(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// Test odd and... | ("draw_horiz_dotted_line_even_offset_odd_clip") | ));
}
void test_graphics_draw_line___odd_offset_horizontal_dotted(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// Test odd and even rows draw appropriately
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(6, 12), 10);
... |
uint32_t active_calories, uint32_t distance_mm) {
// Translate to one of the activity.h activity types
ActivitySessionType activity = ActivitySessionTypeCount;
switch (kalg_activity) {
case KAlgActivityType_Walk:
activity = ActivitySessionType_Walk;
break;
... | base64_encode(base64_buf, sizeof(base64_buf), binary_data + chunk_size,
sizeof(AlgMinuteFileRecord) - chunk_size) | ;
PBL_ASSERTN(num_chars + 1 < (int)sizeof(base64_buf));
pbl_log_sync(LOG_LEVEL_INFO, __FILE_NAME__, __LINE__, "SLP: %s", base64_buf);
return true;
}
// ----------------------------------------------------------------------------------------------
// Log minute data to PBL_LOG
// @param earliest_wake_time ignore... |
G, "Attempted to cancel put_bytes with a non desired type, %d",
s_pb_state.type);
}
xSemaphoreGive(s_pb_semaphore);
}
// Only used by unit test
void put_bytes_deinit(void) {
vSemaphoreDelete(s_pb_semaphore);
if (s_pb_state.timer_id != TIMER_INVALID_ID) {
new_timer_delete(s_pb_state.timer_id);... | {
success = prv_prepare(total_payload_length);
xSemaphoreGive(s_pb_semaphore);
} |
if (!success) {
prv_add_nack_no_token_system_callback();
return NULL;
}
// This is just symbolic, It just has to be non-NULL, really.
// Since there is just once instance, we statically refer to it everywhere.
return (Receiver *)&s_pb_state.receiver;
}
static void prv_validate_and_preack_request_i... |
status_t s = settings_file_get(&file, key, key_len, value_out, sizeof(uint32_t));
prv_file_close_and_unlock(&file);
return (s == S_SUCCESS);
}
bool health_db_get_typical_step_averages(DayInWeek day, ActivityMetricAverages *averages) {
if (!averages) {
return false;
}
// Default results
_Static_asser... | prv_file_close_and_unlock(&file) | |
**********************************/
/******************* Window Related Functions **************/
/***********************************************************/
static void handle_timer(struct tm *tick_time, TimeUnits units_changed) {
struct FlashTestData *data = app_state_get_user_data();
// simply marking the wind... | (msg_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)) | |
KAlgActivityType activity;
time_t start_utc;
uint16_t len_minutes;
bool ongoing;
uint16_t steps;
uint32_t resting_calories;
uint32_t active_calories;
uint32_t distance_mm;
} KAlgTestActivitySession;
// ---------------------------------------------------------------------------------------------
// Gl... | (stats, 0, sizeof(*stats)) | ;
// Collect the stats and also print them out
for (int i = 0; i < num_stats; i++) {
printf("%s: %d, ", names[i], values[i]);
stats->values[i] = values[i];
}
printf("\n");
// Append to the list
if (s_stat_rows) {
list_append(&s_stat_rows->node, &stats->node);
} else {
s_stat_rows = stats... |
imeline item for contact lookup
AttributeList attributes = {};
attribute_list_add_cstring(&attributes, AttributeIdSender, number);
attribute_list_add_cstring(&attributes, AttributeIdiOSAppIdentifier, app_id);
TimelineItem *item = timeline_item_create_with_attributes(0, 0, TimelineItemTypeNotification,
... | (&s_phone_ui_data->status_bar) | ;
gbitmap_deinit(&s_phone_ui_data->up_bitmap);
gbitmap_deinit(&s_phone_ui_data->select_bitmap);
gbitmap_deinit(&s_phone_ui_data->down_bitmap);
text_layer_deinit(&s_phone_ui_data->call_status_text_layer);
text_layer_deinit(&s_phone_ui_data->caller_id_text_layer);
evented_timer_cancel(s_phone_ui_data->call_... |
sizeof(key), &new_data, sizeof(new_data));
if (status == GapBondingFileSetFail) {
return BT_BONDING_ID_INVALID;
}
if (is_gateway && status == GapBondingFileSetUpdated) {
prv_update_bondings(key, BtPersistBondingTypeBLE);
}
prv_call_ble_bonding_change_handlers(key, op);
return key;
}
bool bt_pers... | PBL_LOG(LOG_LEVEL_ERROR, "Not getting BLE id %d. Type mismatch", bonding) | |
s/gtypes.h"
#include "applib/graphics/text.h"
#include "applib/ui/ui.h"
#include "drivers/rtc.h"
#include "font_resource_keys.auto.h"
#include "kernel/pbl_malloc.h"
#include "process_state/app_state/app_state.h"
#include "services/common/clock.h"
#include "services/common/i18n/i18n.h"
#include "system/logging.h"
#inclu... | graphics_context_set_stroke_color(ctx, GColorBlack) | ;
graphics_draw_line(ctx, GPoint(offset_x, min_y), GPoint(offset_x, max_y));
*size_out = GSizeZero;
}
static GTextNode *prv_game_constructor(
const LayoutLayer *layout_ref, const LayoutNodeConstructorConfig *config) {
const SportsLayout *layout = (SportsLayout *)layout_ref;
const int num_teams = 2;
const... |
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... | {
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);
}
} | |
ons_handle_server_notification(s_connection, s_handle,
value, fill_entirely_size);
prv_assert_notification_event_ext(characteristic, value, fill_entirely_size,
false /* kernel */, true /* app */, false /* should_consume */);
... | (next_length, 0) | ;
cl_assert_equal_b(has_more, false);
}
void test_gatt_client_subscriptions__notification_consume_without_notification(void) {
BLECharacteristic characteristic = prv_get_indicatable_characteristic();
uint16_t value_length;
GATTBufferedNotificationHeader header = {
.characteristic = BLE_CHARACTERISTIC_INVA... |
/app.h"
#include "process_state/app_state/app_state.h"
#include "applib/fonts/fonts.h"
#include "applib/ui/app_window_stack.h"
#include "applib/ui/ui.h"
#include "kernel/pbl_malloc.h"
#include "system/passert.h"
#include <string.h>
#include <stdio.h>
typedef struct AnimatedDemoData {
Window window;
TextLayer text... | app_state_set_user_data(data) | ;
Window *window = &data->window;
window_init(window, WINDOW_NAME("Animated Demo"));
window_set_user_data(window, data);
window_set_click_config_provider(window, (ClickConfigProvider) config_provider);
window_set_window_handlers(window, &(WindowHandlers){
.load = animated_demo_window_load,
});
const ... |
/*
* 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... | i2c_use(EWD1000->i2c) | |
>flag & TIMEZONE_FLAG_STANDARD_TIME) { // Standard time (not wall time)
time_tm.tm_gmtoff = tz_info->tm_gmtoff;
time_tm.tm_isdst = 0;
} else if (rule->flag & TIMEZONE_FLAG_UTC_TIME) { // UTC
time_tm.tm_gmtoff = 0;
time_tm.tm_isdst = 0;
} else { // Wall time
time_tm.tm_gmtoff = tz_info->tm_gmtoff... | clock_is_timezone_set() | ) { // We'll need to update timezone stamps.
time_t tz_adjust_time;
// Get the time that we need to adjust for.
if (t) {
tz_adjust_time = *t;
} else {
tz_adjust_time = orig_utc_time;
}
if (tz_info) { // Adjust the DST rule timestamps of the provided tz_info
prv_update_dstrule_t... |
/ to task_timer_manager_execute_expired_timers service loop will take care of this for us.
if (timer->executing) {
timer->defer_delete = true;
mutex_unlock(manager->mutex);
} else {
PBL_ASSERTN(list_contains(manager->idle_timers, &timer->list_node));
list_remove(&timer->list_node, &manager->idle_tim... | mutex_unlock(manager->mutex) | ;
kernel_free(next_timer);
} else {
mutex_unlock(manager->mutex);
}
}
}
void* task_timer_manager_get_current_cb(const TaskTimerManager *manager) {
return manager->current_cb;
}
|
mation* prv_create_slide_animation(Layer *layer, GRect *from_frame, GRect *to_frame) {
Animation *anim = (Animation *)property_animation_create_layer_frame(layer, from_frame, to_frame);
animation_set_duration(anim, interpolate_moook_soft_duration(NUM_MID_FRAMES));
animation_set_custom_interpolation(anim, prv_inte... | (&health_card_view->window,
prv_click_config_provider, health_card_view) | ;
Layer *window_root = window_get_root_layer(&health_card_view->window);
// create and add all card layers to window root layer
for (int i = 0; i < CardCount; i++) {
health_card_view->card_layers[i] = s_card_view_create[i](health_data);
layer_add_child(window_root, health_card_view->card_layers[i]);
}
... |
#include "drivers/rtc.h"
#include "kernel/pbl_malloc.h"
#include "pulse_protocol_impl.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/likely.h"
#include "services/common/system_task.h"
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#define PROMPT_RESP_ACK (1... | {
char buffer[128];
prompt_send_response_fmt(buffer, sizeof(buffer),
"Incorrect number of arguments: Wanted %u Got %u",
cmd->num_params, args.num_args);
goto done;
} | |
rv_set_mon_config_register(uint8_t value) {
return prv_write_register(PmicRegisters_MON_CFG, value);
}
static bool prv_set_mon_config(const PmicMonConfig *config) {
const uint8_t ratio_config = 4 - config->ratio; // 4:1 is 0b00, 1:1 is 0b11.
const uint8_t register_value = (ratio_config << 4) | config->source_co... | gpio_use(GPIOF) | ;
GPIO_WriteBit(GPIOF, GPIO_Pin_2, enabled?Bit_SET:Bit_RESET);
gpio_release(GPIOF);
}
void set_6V6_power_state(bool enabled) {
gpio_use(GPIOF);
GPIO_WriteBit(GPIOF, GPIO_Pin_3, enabled?Bit_SET:Bit_RESET);
gpio_release(GPIOF);
}
void set_accessory_power_state(bool enabled) {
gpio_use(GPIOF);
GPIO_WriteBi... |
/*
* 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... | circular_buffer_consume(&buffer, 1) | );
}
void test_circular_buffer__copy(void) {
CircularBuffer buffer;
uint8_t storage[8];
circular_buffer_init(&buffer, storage, sizeof(storage));
const uint16_t data_out_size = 8;
uint8_t data_out[data_out_size];
// Test copy when there is nothing in the buffer:
cl_assert_equal_i(circular_buffer_copy(&b... |
static bool prv_protobuf_log_transport(uint8_t *buffer, size_t buf_size) {
if (s_saved_encoded_msg != NULL) {
free(s_saved_encoded_msg);
s_saved_encoded_msg = NULL;
}
s_saved_encoded_msg = malloc(buf_size);
cl_assert(s_saved_encoded_msg != NULL);
memcpy(s_saved_encoded_msg, buffer, buf_size);
retur... | {
LOG(" %d", (int)s_parsed_msg.msrmt.types[i]);
} |
LOG(" %"PRIu32" measurements: ", s_parsed_msg.msrmt.num_samples);
for (unsigned i = 0; i < s_parsed_msg.msrmt.num_samples; i++) {
LOG(" offset_sec: %"PRIu32"", s_parsed_msg.msrmt.offset_sec[i]);
for (unsigned j = 0; j < s_parsed_msg.msrmt.num_types; j++) {
LOG(" 0x%"PRIx32"",
... |
t_utc;
} SessionPinState;
static SessionPinState s_session_pin_state;
typedef struct NapPinState {
time_t last_triggered_utc;
} NapPinState;
static NapPinState s_nap_pin_state;
// Sleep and activity metric stats
static ActivityInsightMetricHistoryStats s_sleep_stats;
static ActivityInsightMetricHistoryStats s_activ... | i18n_noop("Do you feel more energetic, sharper or optimistic? Being active helps!") | |
ad_item.common.id));
}
void test_reminder_db__find_by_timestamp_title(void) {
prv_insert_default_reminders();
// Add items with title attributes for searching (out of order for worst-case scenario)
cl_assert(S_SUCCESS == reminder_db_insert_item(&title_item2));
cl_assert(S_SUCCESS == reminder_db_insert_item(&t... | ((uint8_t *)&item1.header.id, sizeof(Uuid), (uint8_t *)&item,
sizeof(SerializedTimelineItemHeader)) | );
cl_assert_equal_i(item.common.status & 0xFF, TimelineItemStatusReminded);
}
|
/*
* 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... | prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN, " Name: %s",
device_name) | ;
prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN, " Platform Bits: 0x%x",
(int)platform_bits);
}
void bluetooth_persistent_storage_debug_dump_root_keys(SM128BitKey *irk, SM128BitKey *erk) {
prompt_send_response("Root Key hexdumps:");
prompt_send_response(" IRK:");
if (irk) {
... |
e(&wakeup_settings);
}
}
mutex_unlock(s_mutex);
}
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) ... | {
new_timer_stop(s_current_timer_id);
} |
// Deletes the entry automatically if not written
} else { // Keep the entry
// Using settings_file_rewrite, need to write to keep key/value
settings_file_set(new_file, (uint8_t*)&wakeup_id, sizeof(WakeupId),
(uint8_t*)&entry, sizeof(WakeupEntry));
}
}
DEFINE_SYSCALL(void, sys_wakeup_cancel_a... |
_layer_update_selection_scroll_position(state.menu_layer, MenuRowAlignCenter, false);
prv_menu_layer_update_selection_highlight(state.menu_layer, state.up, false, false);
state.menu_layer->inverter.layer.frame.size.h += abs_content_offset;
state.menu_layer->inverter.layer.bounds.size = state.menu_layer->inv... | &s_center_focus_selection_animation_out_only_impl :
&s_center_focus_selection_animation_in_out_impl;
PropertyAnimation *const prop_anim = property_animation_create(impl, menu_layer, NULL, NULL);
// we're (ab)using the .t... |
static void prv_apply_selection_change(MenuLayer *menu_layer, MenuRowAlign scroll_align, bool up,
bool did_change, const MenuCellSpan *prev_selection,
bool was_animating, bool animated) {
if (menu_layer->center_focused && animated) {
... |
exact_size->h;
}
}
static void prv_clip_width(GSize *size, const GSize *max_size) {
if (max_size->w && size->w > max_size->w) {
size->w = max_size->w;
}
}
static void prv_clip_height(GSize *size, const GSize *max_size) {
if (max_size->h && size->h > max_size->h) {
size->h = max_size->h;
}
}
static ... | (&ctx->box.size, &child_node->cached_size) | |
teList pin_attr_list = {0};
attribute_list_add_cstring(&pin_attr_list, AttributeIdShortTitle,
i18n_get(config->short_title, &pin_attr_list));
attribute_list_add_cstring(&pin_attr_list, AttributeIdShortSubtitle, config->short_subtitle);
static struct {
const char *avg_relation;
... | timeline_add(item) | ;
timeline_item_destroy(item);
}
return rv;
}
// ------------------------------------------------------------------------------------------------
static bool prv_push_summary_pin(time_t pin_time_utc, time_t now_utc, Uuid *existing_uuid,
ActivityScalarStore cur_val, ActivitySca... |
stack, window1, true);
cl_assert_equal_i(window_stack_count(app_stack), 1);
cl_assert_equal_i(window1->on_screen, true);
cl_assert_equal_p(s_last_click_configured_window, window1);
// Switch to the kernel to push a modal window
stub_pebble_tasks_set_current(PebbleTask_KernelMain);
window_stack_push(modal... | window_stack_count(app_stack) | , 1);
// Pop the modal window off the stack
window_stack_remove(window2, true);
cl_assert_equal_i(window_stack_count(modal_stack), 0);
cl_assert_equal_i(window2->on_screen, false);
// Switch to app happens via the compositor
compositor_transition(NULL);
// Call the upkeep function so the change in stat... |
/*
* 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... | (sys_frame_buffer, fetch_row) | ;
uint32_t *dest_line = framebuffer_get_line(sys_frame_buffer, dest_row);
memcpy(dest_line, src_line, FRAMEBUFFER_BYTES_PER_ROW);
}
// update the current offset of the modal after all lines have been copied.
s_data.cur_modal_offset_y = new_modal_offset_y;
// As we move the modal down, we need to show ... |
.pairing_info = *pairing_info,
.key_out = BT_BONDING_ID_INVALID,
};
prv_file_each(prv_get_key_for_sm_pairing_info_itr, &itr_data);
return itr_data.key_out;
}
//! For unit testing
int bt_persistent_storage_get_raw_data(const void *key, size_t key_len,
void *data_out, s... | {
prv_update_bondings(bonding, BtPersistBondingTypeBLE);
} |
return (status != GapBondingFileSetFail);
}
static void prv_init_and_assign_ble_bonding(BleBonding *bonding,
const BtPersistBondingData *stored_data) {
*bonding = (BleBonding){};
bt_persistent_storage_assign_sm_pairing_info(&bonding->pairing_info,
... |
s(event);
rocky_api_graphics_path2d_reset_state();
}
JERRY_FUNCTION(prv_request_draw) {
Window *const top_window = app_window_stack_get_top_window();
if (!top_window) {
return jerry_create_undefined();
}
layer_mark_dirty(&top_window->layer);
return jerry_create_undefined();
}
GContext *rocky_api_grap... | prv_graphics_get_color_string(rocky_api_graphics_get_gcontext()->draw_state.stroke_color) | ;
}
JERRY_FUNCTION(prv_set_fill_style) {
return prv_graphics_set_color(argc, argv, graphics_context_set_fill_color);
}
JERRY_FUNCTION(prv_get_fill_style) {
return prv_graphics_get_color_string(rocky_api_graphics_get_gcontext()->draw_state.fill_color);
}
JERRY_FUNCTION(prv_fill_radial) {
// pblFillRadial(cx, cy... |
nt32_t size = dict_calc_buffer_size_from_tuplets(tuplets, 3);
cl_assert(size == sizeof(Dictionary) + (3 * sizeof(Tuple)) + sizeof(SOME_DATA) + strlen(SOME_STRING) + 1 + sizeof(uint32_t));
struct SerializeTestResult context = { .okay = false, .expected_size = size };
DictionaryResult result = dict_serialize_tuple... | (tuple->length == sizeof(uint32_t)) | ;
cl_assert(tuple->value->uint32 == 32);
uint32_found = true;
break;
case SOME_INT8_KEY:
cl_assert(tuple->length == sizeof(int8_t));
cl_assert(tuple->value->int8 == -8);
int8_found = true;
break;
case SOME_INT16_KEY:
cl_assert(tuple->length == ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (animation, 400) | ;
switch (click_recognizer_get_button_id(recognizer)) {
case BUTTON_ID_UP:
animation_set_curve(animation, AnimationCurveEaseOut);
break;
case BUTTON_ID_DOWN:
// animation_set_curve(animation, AnimationCurveEaseIn);
// animation_set_duration(animation, 2000);
animation_set_custom... |
arted_handler_calls, seq), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0);
// Just before A completes
prv_advance_to_ms_with_timers(start_ms + duration_a - 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handle... | prv_create_test_animation() | ;
animation_set_duration(a, duration_a);
// Setup stopped handler for the first child that unschedules the parent
const AnimationHandlers special_handlers = {
.started = NULL,
.stopped = prv_unschedule_parent
};
animation_set_handlers(a, special_handlers, NULL);
Animation *b = prv_create_test_anim... |
1544, 744, -264},
{ 1440, 960, -432},
// 109 seconds
{ 968, 1080, -480},
{ 528, 1280, -560},
{ 1016, 1496, -304},
{ 1304, 1096, -176},
{ 1416, 1216, -256},
{ 1616, 1040, -96},
{ 1720, 992, -64},
{ 1872, 984, 0},
{ 1856, 1064, 136},
{ 1696, 776, -64},
{ 1304, 792, 0},
... | { -384, 808, -512},
{ -104, 608, -520},
{ -64, 648, -584},
{ 184, 312, -640},
{ 416, 272, -880},
{ 448, 168, -920},
{ 464, 72, -1008},
{ 384, 176, -1112},
{ 320, 224, -1152},
{ 256, 96, -1160},
{ 176, 96, -1032},
{ 128, 104, -984},
{ 72, 104, -1024},
{ 72, 56, -10... |
{ 112, 440, -848},
{ 104, 448, -856},
{ 104, 464, -880},
{ 96, 464, -880},
{ 104, 456, -880},
{ 104, 440, -856},
{ 104, 440, -864},
{ 112, 448, -856},
{ 112, 456, -864},
{ 112, 448, -864},
{ 112, 448, -880},
{ 104, 456, -888},
{ 104, 456, -864},
{ 112, 432, -856}... |
analytics_logging.h"
#include "services/common/analytics/analytics_external.h"
// Stopwatches
typedef struct {
ListNode node;
AnalyticsMetric metric;
RtcTicks starting_ticks;
uint32_t count_per_sec;
AnalyticsClient client;
} AnalyticsStopwatchNode;
static ListNode *s_stopwatch_list = NULL;
static bool prv_i... | {
analytics_stopwatch_start_at_rate(metric, MS_PER_SECOND, client);
} | |
}
// Make sure that if this is an app initiated session, we're expecting a response for an app
// initiated session and that if this is an app initiated session, the app UUID matches the
// expected UUID
if ((app_initiated != s_from_app) || (s_from_app && !uuid_equal(&s_app_uuid, app_uuid))) {
if (app_init... | mutex_unlock(s_lock) | ;
}
|
andle_player_playback_info_update(update, value_length);
return;
case AMSPlayerAttributeIDVolume:
prv_handle_player_volume_update(update, value_length);
return;
default:
break;
}
break;
case AMSEntityIDQueue:
switch (update->attribute_id) {... | if (characteristic_id != AMSCharacteristicEntityUpdate) {
// Only Entity Update characteristic is expected to be subscribed to
WTF;
} |
if (error != BLEGATTErrorSuccess) {
prv_analytics_log_event_with_info(AMSAnalyticsEventErrorSubscribe, error);
PBL_LOG(LOG_LEVEL_ERROR, "Failed to subscribe AMS");
return;
}
PBL_LOG(LOG_LEVEL_INFO, "Hurray! AMS subscribed");
if (!prv_set_connected(true)) {
PBL_LOG(LOG_LEVEL_ERROR, "Another mus... |
KHZ_TO_HZ(400), 0, 0),
1, 54, 30, 4);
}
void test_i2c_timingr__valid_prescaler_no_rise_fall_time(void) {
// We'll use a base clock speed of 360Mhz and try to get to 100kHz I2C. This requires a prescaler
// of 8 which gets us down to a base clock speed of 45MHz.
//
// 45MHz / 100kHz = 450 cy... | (MHZ_TO_HZ(100), I2CBusMode_Standard,
KHZ_TO_HZ(100), 5000, 5000) | ,
I2C_TIMINGR_INVALID_VALUE);
}
|
/*
* 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... | (NULL, TLS_SYSCALL_LR_IDX, (void *)new_lr) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
static const uint16_t s_heights[] = { 0, DISP_ROWS, DISP_ROWS, 0, 0, 0, DISP_ROWS };
prv_draw_vertical_lines(ctx, ARRAY_LENGTH(s_heights), NULL /* offsets_y */, s_heights,
LINE_WIDTH, LINE_SPACING, offset);
} |
void peek_animations_draw_timeline_speed_lines(GContext *ctx, GPoint offset) {
static const uint16_t s_upper_offsets_y[] = { 12, 0, 0, 12, 12, 12, 12, 12 };
static const uint16_t s_upper_heights[] = { 53, 65, 65, 53, 53, 53, 53, 53 };
prv_draw_vertical_lines(ctx, ARRAY_LENGTH(s_upper_heights), s_upper_offsets_y... |
amp);
}
}
static GTextNode *prv_card_view_constructor(TimelineLayout *timeline_layout) {
static const LayoutNodeTextDynamicConfig s_title_config = {
.text.extent.node.type = LayoutNodeType_TextDynamic,
.update = prv_title_update,
.buffer_size = WEATHER_CARD_TITLE_LENGTH,
.text.style = LayoutContent... | (&s_subtitle_config.text.extent.node, &s_icon_config.node) | ,
&s_glance_location_config.text.extent.node,
&s_page_break_config,
&s_location_config.text.extent.node,
&s_body_header_config.text.extent.node,
&s_body_config.text.extent.node,
};
static const LayoutNodeVerticalConfig s_vertical_config = {
.container.extent.node.type = LayoutNodeType_Vertic... |
enEntry **head_ptr = (DataLoggingReopenEntry **)data;
DataLoggingReopenEntry *entry = kernel_malloc_check(sizeof(DataLoggingReopenEntry));
*entry = (DataLoggingReopenEntry) {
.session = session,
.app_uuid = session->app_uuid,
.timestamp = session->session_created_timestamp,
.tag = session->tag,
};... | {
mutex_lock(s_endpoint_data.mutex);
dls_list_for_each_session(prv_handle_disconnect_cb, 0);
mutex_unlock(s_endpoint_data.mutex);
} | |
t_down_at);
} else if (strcmp(token, "TEST_WEIGHT") == 0) {
sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight);
} else if (strcmp(token, "TEST_NAME") == 0) {
sscanf(token + strlen(token) + 1, "%s", state->test_entry.name);
}
}
// If this is a "static AlgDlsMin... | if (!state->common.file) {
if (!prv_sample_discovery_next_file(&state->common)) {
return false;
}
} |
// Parse next set of samples in the current file
bool success = prv_parse_accel_samples_file(state);
if (success) {
*entry = state->test_entry;
return true;
} else {
// No more in this file
fclose(state->common.file);
state->common.file = NULL;
}
}
}
// ----------... |
rt(success);
const TextBoxParams text_box_params = (TextBoxParams) {
.utf8_bounds = &utf8_bounds,
.box = (GRect) { GPointZero, (GSize) { 4 * HORIZ_ADVANCE_PX, 90 } }
};
line.max_width_px = text_box_params.box.size.w;
line.height_px = text_box_params.box.size.h;
// Init mutable types
word_iter_init... | cl_assert(line.width_px == HORIZ_ADVANCE_PX * 4) | ;
cl_assert(line.origin.x == 0);
cl_assert(line.suffix_codepoint == '-');
cl_assert(*line.start == 's');
// le
cl_assert(*word_iter_state.current.start == 'l');
cl_assert(*word_iter_state.current.end == '\0');
cl_assert(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 2);
line_reset(&line, utf8_... |
mebuffer_init(fb, &(GSize) { DISP_COLS, DISP_ROWS });
GFont font = (GFont) { 0 };
GRect box = (GRect) { (GPoint) { 0, 0 }, (GSize) {40, 250 * FONT_HEIGHT} };
graphics_context_init(&gcontext, fb, GContextInitializationMode_App);
framebuffer_clear(fb);
graphics_draw_text(&gcontext, "\n", font, box,
... | {
TextLayoutExtended l = {};
graphics_text_attributes_enable_screen_text_flow((GTextLayoutCacheRef) &l, 123);
cl_assert_equal_p(l.flow_data.perimeter.impl, g_perimeter_for_display);
cl_assert_equal_i(l.flow_data.perimeter.inset, 123);
} | |
(&data->action_bar_layer, NULL) | ;
}
static void prv_confirm_click_handler(ClickRecognizerRef recognizer, void *ctx) {
Window *window = (Window *) ctx;
BTPairingUIData *data = window_get_user_data(window);
PBL_ASSERTN(data->ui_state == BTPairingUIStateAwaitingUserConfirmation);
prv_exit_awaiting_user_confirmation(data);
data->ui_state = BTP... | |
/*
* 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... | {
device_t *dev = find_device_by_conn_idx(conn_idx);
if (!dev) {
success = false;
goto release;
}
bool is_resolved = false;
if (dev && dev->irk) {
is_resolved = true;
if (irk_out) {
memcpy(irk_out, dev->irk->key, sizeof(*irk_out));
}
} else {
PBL_LOG(L... | |
/*
* 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... | periph_config_disable(RCC_APB2PeriphClockCmd, RCC_APB2Periph_SYSCFG) | ;
periph_config_release_lock();
}
bool button_selftest(void) {
return button_get_state_bits() == 0;
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (VibeIntensityLow) | == VibeIntensityMedium);
// Medium -> High
cl_assert(vibe_intensity_cycle_next(VibeIntensityMedium) == VibeIntensityHigh);
// High -> Low
cl_assert(vibe_intensity_cycle_next(VibeIntensityHigh) == VibeIntensityLow);
}
|
else 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 *confi... | graphics_draw_text(ctx, config->title, title_font, box,
config->overflow_mode, GTextAlignmentLeft, NULL) | ;
}
if (config->subtitle) {
box.origin.y += title_height;
box.size.h = subtitle_height + 4;
graphics_draw_text(ctx, config->subtitle, subtitle_font, box,
config->overflow_mode, GTextAlignmentLeft, NULL);
}
}
// This function duplicates `grect_inset()` but helps us save some st... |
/*
* 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... | (key, key_len) | |
eader.id));
// check fifth
cl_assert(iter_next(&iterator));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_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_b... | (&state.pin.header.id, &s_long_items[3].header.id) | );
#if CAPABILITY_HAS_CORE_NAVIGATION4
cl_assert(iter_prev(&iterator));
cl_assert(uuid_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;
}
voi... |
Expect Reset to be initiated ("Reset Request" sent by FW):
prv_assert_sent_reset_request(s_characteristics[0][PPoGATTCharacteristicData]);
}
void test_ppogatt__ignore_retransmitted_ack(void) {
test_ppogatt__open_session_when_found_pebble_app();
Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.ap... | prv_receive_short_data_fragment(s_characteristics[0][PPoGATTCharacteristicData], sn) | |
on();
animation_set_duration(c, duration_c);
// Create a spawn out of b and c
Animation *spawn = animation_spawn_create(b, c, NULL);
cl_assert(spawn != NULL);
// Create a sequence by putting a in front and repeat it 5 times
// We now have a -> (b | c)
Animation *seq = animation_sequence_create(a, spawn,... | (prv_count_handler_entries(&s_started_handler_calls, a0), 1) | |
rYellow, GColorBlack),
},
.bg_color = BG_COLOR,
};
prv_create_card_and_render(&config);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_health_detail_card__render_no_subtitle(void) {
HealthDetailCardConfig config = {
.num_headings = 1,
.headings = &(HealthDetailHeading... | ARRAY_LENGTH(s_zones) | ,
.zones = s_zones,
};
HealthDetailCard *card = (HealthDetailCard *)prv_create_card_and_render(&config);
#if PBL_ROUND
menu_layer_set_selected_index(&card->menu_layer, MenuIndex(0, 1), MenuRowAlignCenter, false);
#endif
window_render(&card->window, &s_ctx);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, ... |
/*
* 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, true, true) | ;
window_render(window, fake_graphics_context_get_context());
}
// Tests
//////////////////////
void test_timeline_no_events__future(void) {
prv_create_no_events_and_render(false /* past */);
FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE();
}
void test_timeline_no_events__past(void) {
prv_create_no_events_and... |
o info = {
.hour = data->alarm_hour,
.minute = data->alarm_minute,
.kind = data->alarm_kind,
.is_smart = (data->alarm_type == AlarmType_Smart),
};
data->alarm_id = alarm_create(&info);
data->complete_callback(CREATED, data->alarm_id, data->callback_context);
app_window_stack_remo... | (&data->day_picker_menu_layer,
ALARMS_APP_HIGHLIGHT_COLOR,
GColorWhite) | ;
menu_layer_set_click_config_onto_window(&data->day_picker_menu_layer, &data->day_picker_window);
layer_add_child(&data->day_picker_window.layer,
menu_layer_get_layer(&data->day_picker_menu_layer));
if (!alarm_get_kind(data->alarm_id, &data->alarm_kind)) {
data->alarm_kind = ALARM_KIND_JUST... |
ARROW_SIZE_PX \
PREFERRED_CONTENT_SIZE_SWITCH(PreferredContentSizeDefault, \
/* This is the same as Medium until Small is designed */ \
/* small */ PBL_IF_RECT_ELSE(8, 6), \
/* medium */ PBL_IF_RECT_ELSE(8, 6), \
/* large */ 6, ... | {
AttributeId card_attr_id;
switch (card_icon_size) {
default:
case TimelineResourceSizeTiny:
card_attr_id = AttributeIdIconTiny;
break;
case TimelineResourceSizeSmall:
card_attr_id = AttributeIdIconSmall;
break;
case TimelineResourceSizeLarge:
card_attr_id = AttributeI... |
void timeline_layout_init_with_icon_id(TimelineLayout *layout, const LayoutLayerConfig *config,
const TimelineLayoutImpl *timeline_layout_impl,
TimelineResourceId icon_resource) {
TimelineLayoutInfo *info = config->context;
static cons... |
onse = { };
prv_read_data((uint8_t *)&response, sizeof(response));
PBL_ASSERTN(response.packet_id == PACKET_ID_STATUS_RESPONSE);
// TODO: remove this assert and footer ones below once we're sure the controller FW is stable
PBL_ASSERTN(response.padding == MESSAGE_PADDING);
// What follows is some rather hacky... | gpio_input_read(&EWD1000->int_gpio) | ) {
EventMessage message = { };
prv_read_data((uint8_t *)&message, sizeof(message));
// Packet format: https://pebbletechnology.atlassian.net/wiki/display/PRODUCT/Elan+Protocol
if (message.packet_id == PACKET_ID_TOUCH_STATUS) {
for (uint32_t i = 0; i < ARRAY_LENGTH(message.touch.finger_data); i++... |
pTestResults;
StepTestResults test_results[k_max_tests];
StepFileTestEntry test_entry[k_max_tests];
while (prv_accel_sample_discovery_next(&test_entry[num_tests])) {
StepFileTestEntry *entry = &test_entry[num_tests];
#ifdef STEP_TEST_ONLY
if (strcmp(entry->name, STEP_TEST_ONLY)) {
continue;
}
... | {
return "FAIL";
} | else {
return "pass";
}
}
// ---------------------------------------------------------------------------------------
// Returns the weighted error of this test
static float prv_compute_test_error(const char *name, ExpectedValue *exp, ActualValue *act,
float weight, bool ... |
u);
}
static void prv_configure_local_device_properties(const BTDriverConfig *config) {
ble_error_t e;
e = ble_gap_appearance_set(BLE_GAP_APPEARANCE_GENERIC_WATCH, ATT_PERM_READ);
if (e != BLE_STATUS_OK) {
PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_appearance_set: %u", e);
}
#if 0 // FIXME: PBL-36556 -- How to c... | sys_watchdog_resume(s_ble_perip_wdog_id) | ;
hc_protocol_process_receive_buffer();
extern bool should_log_about_mic_error(uint32_t *max_subsequent_failures);
uint32_t num_subsequent_failures = 0;
if (should_log_about_mic_error(&num_subsequent_failures)) {
hc_endpoint_analytics_log_mic_error_detected(num_subsequent_failures);
}
/... |
unobstructed_area_service__did_change_after_subscribe(void) {
const GRect from_area = GRect(0, 0, DISP_COLS, 400);
const GRect to_area = GRect(0, 0, DISP_COLS, 200);
unobstructed_area_service_will_change(from_area.size.h, to_area.size.h);
UnobstructedAreaHandlers handlers = {
.will_change = prv_will_change... | cl_assert_equal_grect(unobstructed_bounds, GRect(150, 120, 40, 40)) | ;
}
|
/*
* 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... | (font_key) | ;
cl_assert_(font_helper, font_key);
FontInfo *result = &font_helper->font_info;
if (!result->loaded) {
bool init_result = text_resources_init_font(0, font_helper->handle, 0, result);
cl_assert_(init_result, font_key);
}
return (GFont)result;
}
static const struct {
const char *key_name;
uint8_t... |
ssory/smartstrap_comms.h"
#include "services/normal/accessory/smartstrap_connection.h"
#include "services/normal/accessory/smartstrap_link_control.h"
#include "services/normal/accessory/smartstrap_state.h"
#include "syscall/syscall.h"
#include "syscall/syscall_internal.h"
#include "system/logging.h"
#include "system/pa... | {
did_send = true;
} |
if (did_send && smartstrap_fsm_state_get() == SmartstrapStateReadReady) {
if (accessory_bus_contention_detected()) {
// There was bus contention during the send which caused it to fail. Set a short interval
// before trying to send to allow the bus contention to clear.
s_monitor_inter... |
// 161 seconds
{ -416, 280, -904},
{ -424, 288, -904},
{ -424, 272, -896},
{ -424, 280, -896},
{ -424, 288, -896},
{ -424, 272, -896},
{ -424, 288, -896},
{ -424, 288, -896},
{ -424, 280, -904},
{ -424, 280, -896},
{ -424, 280, -896},
{ -424, 280, -896},
{ -416, ... | { -424, 288, -904},
{ -424, 280, -896},
{ -424, 280, -896},
{ -424, 288, -896},
{ -424, 280, -904},
{ -424, 280, -896},
{ -424, 288, -904},
{ -424, 288, -896},
{ -424, 288, -896},
{ -424, 272, -896},
{ -424, 288, -896},
{ -424, 280, -904},
{ -424, 280, -896},
{ -4... |
{ -416, 176, -944},
{ -416, 168, -944},
// 169 seconds
{ -408, 176, -944},
{ -416, 168, -944},
{ -408, 176, -936},
{ -416, 176, -936},
{ -416, 168, -936},
{ -416, 176, -936},
{ -416, 168, -936},
{ -440, 160, -920},
{ -352, 224, -1000},
{ -272, 336, -1096},
{ -424... |
-144},
{ 176, 968, -192},
{ 176, 960, -152},
{ 248, 1064, -184},
{ 224, 1160, -144},
{ 336, 1152, -176},
{ 288, 1048, -152},
{ 248, 1032, -160},
{ 256, 1000, -184},
{ 296, 912, -200},
{ 272, 864, -192},
{ 288, 928, -200},
{ 288, 920, -200},
{ 264, 864, -240},
{ 2... | { 1688, 552, 160},
{ 1704, 592, 112},
{ 1040, 392, 56},
{ 1120, 344, 40},
{ 968, 376, 400},
// 8 seconds
{ 1216, 176, 208},
{ 1000, 56, 224},
{ 864, 72, 104},
{ 752, -8, 144},
{ 624, -24, 128},
{ 608, 0, 80},
{ 656, -48, 104},
{ 872, 32, 24},
{ 1120, 120, -24}... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.