prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
ineAppData *data = context;
if (!finished || !prv_set_state(data, TimelineAppStateDaySeparator)) {
return;
}
// Pins will reappear after the day separator completes hiding in `prv_hide_day_sep_stopped`
timeline_layer_set_layouts_hidden(&data->timeline_layer, true);
prv_set_day_sep_timer(data);
}
static... | {
if (prv_pin_in_card(data, id)) {
// remove the pin window if we just removed the pin
app_window_stack_remove((Window *)&data->pin_window, false);
prv_set_state(data, TimelineAppStateStationary);
}
timeline_model_remove(id);
prv_update_timeline_layer(data);
} | |
(dstbuf, "You know Bagu? Then I can let you ") | ;
}
void test_sprintf__percent_p(void) {
// %p is almost entirely implementation defined.
// Because of this, we are testing against newlib's output.
// Newlib just treats it as %#x
char dstbuf[256];
snprintf(dstbuf, 256, "What's a cool number? %p", (void*)(uintptr_t)0x02468ACE);
cl_assert_equal_s(dstbuf,... | |
ditional_crumbs;
data->crumbs_layer.level += additional_crumbs;
prv_set_selected_index(&data->action_menu_layer, selected_index, false /* animated */);
// Render the window so that we set the state of the cells again now that we've scrolled
window_render(&action_menu_window->window, &s_ctx);
// Update the a... | (
prv_render_action_menus_static, root_level, selected_index, 1 /* num_rows */,
additional_crumbs) | ;
}
void prv_prepare_canvas_and_render_action_menus_animated(const ActionMenuLevel *root_level,
unsigned int selected_index) {
prv_prepare_canvas_and_render_for_each_size(
prv_render_action_menus_animated, root_level, selected_index,
ActionMenuLaye... |
r interrupts and will trigger logic to reset the sensor if necessary.
static RegularTimerInfo s_as7000_watchdog_timer;
// Incremented by s_as7000_watchdog_timer. Reset to 0 by our interrupt handler.
static uint8_t s_missing_interrupt_count;
//! Interval timer to track how frequently the as7000 is handshaking with us
... | hton16(data->y * 2) | |
.subtype = PebbleBLEGATTClientEventTypeServiceChange,
},
},
},
};
// TODO: send only to tasks that are connected virtually
event_put(&e);
}
static void prv_send_services_added_event(
const GAPLEConnection *connection, BTErrno status) {
uint8_t num_services_changed = (status ==... | kernel_free(node) | ;
node = next;
}
connection->gatt_remote_services = NULL;
}
static void prv_remove_current_discovery_job(GAPLEConnection *connection) {
DiscoveryJobQueue *node = connection->discovery_jobs;
if (!node) {
return;
}
list_remove((ListNode *)connection->discovery_jobs,
(ListNode **)&connec... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | fake_gatt_get_blood_pressure_service() | ;
const Service *thermo_service = fake_gatt_get_health_thermometer_service();
const Service *random_128bit_service = fake_gatt_get_random_128bit_uuid_service();
const Service *services[] = {
bp_service,
thermo_service,
random_128bit_service,
};
const uint8_t num_services = 3;
// Test gatt_clien... |
N_RECT_NO_CLIP, false, 4);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw4_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 4);
graphics_draw_round_re... | (&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2)) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"));
// Should not draw anything
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT))... |
PROGRESS_TYPICAL_COLOR, typical_end);
}
#else
health_progress_bar_mark(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_start);
health_progress_bar_mark(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_end);
#endif
}
}
static void prv_render_progress_bar(GContext *ctx, Layer *base_laye... | health_data_sleep_get_monthly_average(health_data) | > 0;
}
static void prv_base_layer_update_proc(Layer *base_layer, GContext *ctx) {
HealthSleepSummaryCardData *data = layer_get_data(base_layer);
prv_render_icon(ctx, base_layer);
prv_render_progress_bar(ctx, base_layer);
if (!prv_has_sleep_data(data->health_data)) {
prv_render_no_sleep_data_text(ctx, b... |
/*
* 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(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE)) | |
/*
* 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_release_accessory() | ;
smartstrap_state_unlock();
return;
}
if (smartstrap_fsm_state_get() == SmartstrapStateUnsubscribed) {
if (prv_acquire_accessory()) {
// we will now start to attempt to connect to the smartstrap
smartstrap_fsm_state_set(SmartstrapStateReadReady);
s_monitor_interval = 0;
} else {
... |
CNTL2 = 0x26,
PmicRegisters_SD_CNTL1 = 0x30,
PmicRegisters_BATT_VOLTAGE_MON = 0x32,
PmicRegisters_STARTUP_CNTL = 0x33,
PmicRegisters_REFERENCE_CNTL = 0x35,
PmicRegisters_RESET_CNTL = 0x36,
PmicRegisters_OVERTEMP_CNTL = 0x37,
PmicRegisters_REG_STANDBY_MOD1 = 0x39,
PmicRegisters_PWM_CNTL_L = 0x41,
Pmi... | (register_address, val) | ;
}
static bool prv_register_clear_bit(uint8_t register_address, uint8_t bit) {
uint8_t val;
if (!prv_read_register(register_address, &val)) {
return false;
}
val &= ~(1 << bit);
return prv_write_register(register_address, val);
}
// Read the interrupt status registers to clear pending bits.
static voi... |
aphics_draw_horizontal_line_dotted(&ctx, GPoint(66, 36), 10);
// T facing down - lined up
graphics_draw_vertical_line_dotted(&ctx, GPoint(101, 33), 5);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(97, 37), 10);
// T facing left - lined up
graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 70), 10);
... | TEST_NAMED_PBI_FILE("draw_line_same_point_color") | ));
#endif
}
#define CLIP_RECT_DRAW_BOX GRect(10, 10, 40, 40)
#define CLIP_RECT_CLIP_BOX GRect(10, 10, 20, 20)
#define CLIP_OFFSET 100
static void prv_draw_lines(GContext *ctx, uint8_t sw, uint16_t xoffset, uint16_t yoffset) {
// Adjust drawing box and clipping box
ctx->draw_state.drawing_box = CLIP_RECT_DRAW_BOX;... |
AVERAGE_SLEEP,
AVERAGE_SLEEP,
AVERAGE_SLEEP
};
memcpy(&s_data.metric_history[ActivityMetricSleepTotalSeconds], sleep_history,
sizeof(sleep_history));
activity_insights_init(rtc_get_time());
// Make sure we don't trigger while still asleep
s_data.metric_history[ActivityMetricSleepState]... | (rtc_get_time()) | ;
}
}
// ---------------------------------------------------------------------------------------
void prv_set_step_history_avg() {
// History with low median
static const int32_t step_history[ACTIVITY_HISTORY_DAYS] = {
AVERAGE_STEPS, // This is 'today'
AVERAGE_STEPS,
AVERAGE_STEPS,
AVERAGE_STEPS,... |
timer);
app_timer_cancel(active_window->hr_measuring_timer);
gbitmap_destroy(active_window->action_bar_start);
gbitmap_destroy(active_window->action_bar_pause);
gbitmap_destroy(active_window->action_bar_stop);
gbitmap_destroy(active_window->action_bar_more);
gbitmap_destroy(active_window->action... | layer_init(&active_window->middle_metric_layer, &middle_metric_bounds) | ;
layer_set_update_proc(&active_window->middle_metric_layer, prv_static_layer_update_proc);
layer_add_child(&active_window->base_layer, &active_window->middle_metric_layer);
GRect scrollable_metric_bounds = middle_metric_bounds;
scrollable_metric_bounds.origin.y = top_metric_bounds.size.h + middle_metr... |
cl_assert_equal_i(gatt_client_discovery_discover_all(&device),
BTErrnoInvalidParameter) | ;
cl_assert_equal_b(fake_gatt_is_service_discovery_running(), false);
}
void test_gatt_client_discovery__already_in_progress(void) {
BTDeviceInternal device = prv_connected_dummy_device(1);
// Start discovery for device:
cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK);
cl_assert_eq... | |
sleep metrics
sleep_data->total_minutes = stats.total_minutes;
sleep_data->restful_minutes = stats.restful_minutes;
// Fill in the enter and exit minute
uint16_t enter_minute = time_util_get_minute_of_day(stats.enter_utc);
uint16_t exit_minute = time_util_get_minute_of_day(stats.today_exit_utc);
... | activity_private_state() | ;
// Activity classes. All of the activities in a class share the same "_exit_at_utc" state in
// the globals and the same settings key to persist it.
enum {
// for ActivitySessionType_Sleep, ActivitySessionType_Nap
ActivityClass_Sleep = 0,
// for ActivitySessionType_RestfulSleep, ActivitySessionType_... |
55, 0x66, 0x77,
},
},
.identity = (const BTDeviceInternal) {
.opaque.opaque_64 = 0x1122334455667788,
},
.csrk = {
.data = {
0xcc, 0xdd, 0xee, 0xff, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x22, 0x33,
},
},
.is_local_encryption_info_va... | shared_prf_storage_wipe_all() | ;
cl_assert_equal_b(shared_prf_storage_get_bt_classic_pairing_data(NULL, NULL, NULL, NULL), false);
// Store a classic pairing
BTDeviceAddress addr = {
.octets = { 0x11, 0x22, 0x33, 0x44, 0x55,},
};
char device_name_classic[BT_DEVICE_NAME_BUFFER_SIZE] = "CLASSIC";
SM128BitKey link_key = {
.data = {... |
draw_text_single_line_ellipsis_clip_outside_nx(Layer* 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),
GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL);
}
void draw_text_single_line... | layer_set_update_proc(&canvas, &canvas_layer_update_callback) | ;
layer_init(&layer, &GRect(40, 40, 80, 40));
layer_add_child(&canvas, &layer);
// Corner cases
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_nx_zero_y_offset);
layer_render_tree(&canvas, &ctx);
cl_check(gbitmap_pbi_eq(&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... | {
prv_init();
app_event_loop();
prv_deinit();
} |
const PebbleProcessMd *kino_layer_demo_get_info(void) {
static const PebbleProcessMdSystem s_app_info = {
.common = {
.main_func = s_main,
// UUID: 67a32d95-ef69-46d4-a0b9-854cc62f97fa
.uuid = {0x12, 0xa3, 0x2d, 0x95, 0xef, 0x69, 0x46, 0xd4,
0xa0, 0xb9, 0x85, 0x4c, 0xc6, 0x2f, 0... |
assert_equal_m(raw_bytes_v1, buffer, expected_size);
prv_rcv_app_message_ack(APP_MSG_OK);
json_bytes_remaining -= json_bytes_size;
}
// Chunk 3:
{
const size_t json_bytes_size = MIN(TINY_CHUNK_SIZE, json_bytes_remaining);
const size_t expected_size = sizeof(PostMessageChunkPayload) + json_bytes_... | (true, jerry_value_is_object(data_prop)) | ;
// Make sure the re-serialized object matches:
ASSERT_JS_GLOBAL_EQUALS_S("json_str", "{\"x\":123}");
EXECUTE_SCRIPT("json_str = null;\n"
"event = null");
}
}
////////////////////////////////////////////////////////////////////////////////
// "postmessageerror" event
///////////////... |
"HR❤️\nNow: %"PRIu32"\nRest: %"PRIu32"\n Alerts: %"PRIu32" ",
data->cur_hr_bpm, data->resting_hr_bpm, data->num_hr_alerts);
text_layer_set_text(data->hr_card.text_layer, data->hr_card.text);
layer_mark_dirty(text_layer_get_layer(data->hr_card.text_layer));
}
// --------------------------------------... | (APP_LOG_LEVEL_DEBUG, "Got activity: %s %s to %s (%d min)", activity_name, time_start_text,
time_end_text, (int)((time_end - time_start) / SECONDS_PER_MINUTE)) | ;
return true;
}
static void prv_debug_cmd_sleep_sessions(int index, void *context) {
HealthAPITestAppData *data = context;
// These will be filled in by the activity callback
data->bed_time_utc = 0;
data->awake_time_utc = 0;
time_t now = time(NULL);
uint32_t num_activities_found = 0;
char time_now_... |
rage_get_ble_pinned_address(NULL), false);
}
void test_bluetooth_persistent_storage__ble_store_and_get(void) {
bool ret;
// Output variables
SMIdentityResolvingKey irk_out;
BTDeviceInternal device_out;
// Store a new pairing
SMPairingInfo pairing_1;
memset(&pairing_1, 0x00, sizeof(pairing_1));
pairin... | (id_1, &irk_out, &device_out, NULL /* name */) | ;
cl_assert(ret);
cl_assert_equal_m(&irk_out, &pairing_1.irk, sizeof(irk_out));
cl_assert_equal_m(&device_out, &pairing_1.identity, sizeof(device_out));
ret = bt_persistent_storage_get_ble_pairing_by_id(id_2, &irk_out, &device_out, NULL /* name */);
cl_assert(ret);
cl_assert_equal_m(&irk_out, &pairing_2.ir... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
s_preferred_content_size = PreferredContentSizeSmall;
rocky_global_init(s_preferences_api);
EXECUTE_SCRIPT("var size = _rocky.userPreferences.contentSize");
ASSERT_JS_GLOBAL_EQUALS_S("size", "small");
} | |
SP = VECTOR_TABLE[0] (main stack pointer)
// PSP = Unknown (process stack pointer)
// LR = 0xFFFFFFFF
// PC = VECTOR_TABLE[1]
// PRIMASK = 0x0
// FAULTMASK = 0x0
// BASEPRI = 0x0
// CONTROL = 0x0
//
// Attempt to put the processor into as close to the reset state as pos... | (BUTTON_ID_BACK) | )) {
// stop waiting if not held down any longer
return false;
}
delay_ms(1);
}
return true;
}
void *reset_vector, *initial_sp;
prv_get_fw_reset_vector(&reset_vector, &initial_sp);
if ((uintptr_t)reset_vector == 0xffffffff ||
(uintptr_t)initial_sp == 0xffffffff) {
... |
s + num_open_sessions;
// result from mocked sys_activity_get_sessions_values is still false
health_service_activities_iterate(HealthActivityMaskAll, now - (100 * SECONDS_PER_MINUTE), now,
HealthIterationDirectionPast, prv_activity_cb, NULL);
cl_assert_equal_i(0, s_prv_activit... | {
HealthActivityMask activities;
activities = health_service_peek_current_activities();
cl_assert_equal_i(activities, HealthActivityNone);
cl_assert_equal_i(s_sys_activity_get_metric_values.in.history_len, 1);
cl_assert_equal_i(s_sys_activity_get_metric_values.in.metric, ActivityMetricSleepState);
s_sys_ac... |
void test_health__session_compare(void) {
const time_t now = rtc_get_time();
// both start at the same time
cl_assert(0 == prv_session_compare(
&(ActivitySession) {.start_utc = now, .length_min = 10},
&(ActivitySession) {.start_utc = now, .length_min = 5},
HealthIterationDirectionFuture));
// a ... |
"rocky_api_errors.h"
#include "rocky_api_util.h"
#include "services/common/clock.h"
#include "system/passert.h"
#include "util/size.h"
#include <string.h>
#define ROCKY_DATE_TOLOCALETIMESTRING "toLocaleTimeString"
#define ROCKY_DATE_TOLOCALEDATESTRING "toLocaleDateString"
#define ROCKY_DATE_TOLOCALESTRING "toLocaleS... | (options, "day") | ;
JS_VAR month = jerry_get_object_field(options, "month");
JS_VAR year = jerry_get_object_field(options, "year");
JS_VAR hour12 = jerry_get_object_field(options, "hour12");
if (!jerry_value_is_undefined(hour12)) {
*is_24h_style = !jerry_get_boolean_value(hour12);
}
struct {
const jerry_value_t fie... |
_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, void *co... | {
prv_dismiss_local_notification_action(item);
return;
} |
// FALLTHROUGH
case TimelineItemActionTypeGeneric:
case TimelineItemActionTypeResponse:
case TimelineItemActionTypeAncsResponse:
case TimelineItemActionTypeAncsGeneric:
case TimelineItemActionTypeHttp:
case TimelineItemActionTypeComplete:
case TimelineItemActionTypePostpone:
case... |
ubscribers > 0);
--service->num_subscribers;
service->subscribers[subscription->task] = NULL;
if (service->remove_subscriber_callback != NULL) {
service->remove_subscriber_callback(subscription->task);
}
}
static void prv_event_service_subscribe(PebbleSubscriptionEvent *subscription) {
EventServiceEntry... | {
stolen = prv_steal_buffer(*buf_ptr, service, e); // FIXME arguments?
} |
PebbleTask cur_task = pebble_task_get_current();
for (unsigned i = 0; i < NumPebbleTask; i++) {
if (!prv_task_is_masked_out(e, i) && service->subscribers[i]) {
if (i == cur_task) {
// We will handle this inline, but that has to happen after we copy it into the queues
// because handling ... |
ID
static const uint16_t APP_FETCH_ENDPOINT_ID = 6001;
////////////////////////////
// Internal Helper Functions
////////////////////////////
//! Puts an error event with the given error code
static void prv_put_event_error(uint8_t error_code) {
s_fetch_state.prev_error = error_code;
PebbleEvent event = {
.ty... | (LOG_LEVEL_ERROR, "Got a PutBytes Object that we shouldn't have gotten") | |
/*
* 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... | {
uint32_t *raw = (uint32_t*)tzinfo;
_Static_assert(sizeof(TimezoneInfo) <= 5 * sizeof(uint32_t),
"RTC Set Timezone invalid data size");
RTC_WriteBackupRegister(RTC_TIMEZONE_ABBR_START, raw[0]);
RTC_WriteBackupRegister(RTC_TIMEZONE_ABBR_END_TZID_DSTID, raw[1]);
RTC_WriteBackupRegister(RTC_TIMEZONE_GMTO... |
void rtc_get_timezone(TimezoneInfo *tzinfo) {
uint32_t *raw = (uint32_t*)tzinfo;
raw[0] = RTC_ReadBackupRegister(RTC_TIMEZONE_ABBR_START);
raw[1] = RTC_ReadBackupRegister(RTC_TIMEZONE_ABBR_END_TZID_DSTID);
raw[2] = RTC_ReadBackupRegister(RTC_TIMEZONE_GMTOFFSET);
raw[3] = RTC_ReadBackupRegister(RTC_TIMEZON... |
ndow *window1 = window_create();
Window *window2 = window_create();
cl_assert_equal_b(window_is_focusable(window2), true);
window_set_focusable(window2, false);
cl_assert_equal_b(window_is_focusable(window2), false);
WindowStack *app_stack = app_state_get_window_stack();
WindowStack *modal_stack = modal_ma... | cl_assert_equal_i(prv_get_appear_disappear_count(), 0) | ;
// Ensure the unload handler was called
cl_assert_equal_i(prv_get_load_unload_count(), 0);
}
void test_window_stack__dump(void) {
WindowStack *stack = app_state_get_window_stack();
Window *window1 = window_create();
Window *window2 = window_create();
Window *window3 = window_create();
window1->debug_n... |
der the License.
*/
#include "board/board.h"
#include "console/prompt.h"
#include "drivers/ambient_light.h"
#include "drivers/gpio.h"
#include "drivers/voltage_monitor.h"
#include "drivers/periph_config.h"
#include "kernel/util/sleep.h"
#include "mfg/mfg_info.h"
#include "system/logging.h"
#include "system/passert.h"... | {
return AmbientLightLevelDark;
} | else if (light_level < (s_sensor_light_dark_threshold + k_delta_threshold)) {
return AmbientLightLevelLight;
} else {
return AmbientLightLevelVeryLight;
}
}
|
kcalories;
uint32_t distance;
uint32_t active_seconds;
} MovementData;
_Static_assert(offsetof(MovementData, version) == 0, "Version not at the start of MovementData");
_Static_assert(sizeof(MovementData) % sizeof(uint32_t) == 0, "MovementData size is invalid");
typedef struct PACKED SleepData {
uint32_t version... | prv_is_last_processed_timestamp_valid(data->last_processed_timestamp) | ) {
return;
}
PBL_LOG(LOG_LEVEL_INFO, "Got SleepData for wday: %d, cur_wday: %d, sleep: %"PRIu32"",
wday, cur_wday, data->sleep_duration);
activity_metrics_prv_set_metric(ActivityMetricSleepTotalSeconds, wday, data->sleep_duration);
activity_metrics_prv_set_metric(ActivityMetricSleepRe... |
/*
* 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... | GPoint(icon_x, icon_y) | );
const int name_x = drawing_rect.origin.x + PBL_IF_RECT_ELSE(0, (rl_margin / 2));
const int name_y = PBL_IF_RECT_ELSE(107, 109);
GRect name_rect = GRect(name_x, name_y, drawing_rect.size.w, 32);
graphics_context_set_text_color(ctx, TEXT_COLOR);
graphics_draw_text(ctx, name, font, name_rect, overflow_mode,... |
et = (DISP_ROWS - basic_cell_height) / 2;
cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section);
cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row);
cl_assert_equal_i(0, l.selection.y);
cl_assert_equal_i(initial_scroll_offset, l.scroll_layer.content_sublayer.bounds.origin.y);
menu_layer_se... | (&l, NULL, &(MenuLayerCallbacks) {
.draw_row = prv_draw_row,
.get_num_rows = prv_get_num_rows,
.get_cell_height = prv_get_row_height_depending_on_selection_state,
}) | ;
menu_layer_set_center_focused(&l, true);
menu_layer_reload_data(&l);
const int focused_height = MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT;
// focus last row
menu_layer_set_selected_index(&l, MenuIndex(0, s_num_rows - 1), MenuRowAlignNone, false);
cl_assert_equal_i(focused_height, l.selection.h);
s_num_... |
/*
* 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... | (BOARD_CONFIG.fpc_pinstrap_2) | |
_time = 3 * MINUTES_PER_HOUR + 30;
steps = running_cadence_spm * long_run_time;
time_ms = long_run_time * SECONDS_PER_MINUTE * MS_PER_SECOND;
int long_run_distance_m = activity_private_compute_distance_mm(steps, time_ms) / MM_PER_METER;
cl_assert_within(long_run_distance_m, 40000, 44000);
// Now make a short... | activity_private_compute_resting_calories(long_time_m) | / ACTIVITY_CALORIES_PER_KCAL);
cl_assert_equal_i(4, activity_private_compute_resting_calories(short_time_m) / ACTIVITY_CALORIES_PER_KCAL);
prv_set_user(Human_TallFemale);
cl_assert_equal_i(1630, activity_private_compute_resting_calories(long_time_m) / ACTIVITY_CALORIES_PER_KCAL);
cl_assert_equal_i(5, activit... |
have_hit_old_value = true;
break;
case RecordResultNew:
have_hit_new_value = true;
break;
case RecordResultEnd:
have_hit_end = true;
break;
}
}
cl_assert(have_hit_old_value);
cl_assert(have_hit_new_value);
cl_assert(have_hit_end);
}
void test_settings_f... | cl_assert_equal_i(STOPPING_NUM, cur_val) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | fake_mutex_set_should_assert(false) | ;
PebbleMutex *mutex = mutex_create();
mutex_lock(mutex);
mutex_lock(mutex);
cl_assert_equal_b(true, fake_mutex_get_assert_triggered());
}
void test_fake_mutex__double_unlock(void) {
fake_mutex_set_should_assert(false);
PebbleMutex *mutex = mutex_create();
mutex_lock(mutex);
mutex_unlock(mutex);
mu... |
e "apps/system_app_ids.h"
#include "board/board.h"
#include "os/mutex.h"
#include "process_management/app_install_manager.h"
#include "process_management/process_manager.h"
#include "services/normal/activity/activity.h"
#include "services/normal/activity/activity_insights.h"
#include "services/normal/activity/insights_... | app_install_entry_is_hidden(entry) | ) {
return true; // continue search
}
watchface_set_default_install_id(entry->install_id);
return false;
}
AppInstallId watchface_get_default_install_id(void) {
AppInstallId app_id = app_install_get_id_for_uuid(&s_default_watchface);
AppInstallEntry entry;
if ((app_id == INSTALL_ID_INVALID) ||
!... |
et_sec_b),
.offset_sec = offset_sec_b,
.num_values = ARRAY_LENGTH(values_b),
.values = values_b,
}
};
prv_common_payload_initialize(&input);
for (unsigned i = 0; i < input.msrmt.num_samples; i++) {
rtc_set_time(input.msrmt.time_utc + input.msrmt.offset_sec[i]);
success = protobuf_lo... | rtc_get_time() | ,
.utc_to_local = time_util_utc_to_local_offset(),
.num_types = ARRAY_LENGTH(types),
.types = types,
.num_samples = ARRAY_LENGTH(offset_sec),
.offset_sec = offset_sec,
.num_values = ARRAY_LENGTH(values),
.values = values,
}
};
ProtobufLogRef ref = prv_test_encode_measur... |
ionType_Sleep, ActivitySessionType_Nap
ActivityClass_Sleep = 0,
// for ActivitySessionType_RestfulSleep, ActivitySessionType_RestfulNap
ActivityClass_RestfulSleep = 1,
// for ActivitySessionType_Walk, ActivitySessionType_Run, ActivitySessionType_Open
ActivityClass_Step = 2,
// Leave at end
... | settings_file_get_len(file, &key, sizeof(key)) | ;
if (stored_len != sizeof(state->activity_sessions)) {
PBL_LOG(LOG_LEVEL_WARNING, "Stored activities not found or incompatible");
return;
}
// Read in the stored activities
status_t result = settings_file_get(file, &key, sizeof(key), state->activity_sessions,
size... |
case PEBBLE_BLE_CONNECTION_EVENT:
case PEBBLE_BLE_GATT_CLIENT_EVENT:
kernel_le_client_handle_event(e);
return;
case PEBBLE_COMM_SESSION_EVENT: {
PebbleCommSessionEvent *comm_session_event = &e->bluetooth.comm_session_event;
debounced_connection_service_handle_event(comm_session_eve... | event_service_handle_event(&e) | |
"stubs_window_stack.h"
// Setup and Teardown
////////////////////////////////////
void test_selection_windows__initialize(void) {
fb = malloc(sizeof(FrameBuffer));
framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS});
test_graphics_context_init(&s_ctx, fb);
framebuffer_clear(fb);
load_system_resources_fix... | (gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)) | ;
}
void test_selection_windows__time_range_selection_window(void) {
prv_prepare_canvas_and_render_for_each_size(prv_render_time_range_selection_window);
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
}
|
&ctx->draw_state.clip_box, x,
y1.integer, y2.integer, opacity,
ctx->draw_state.stroke_color);
graphics_release_frame_buffer(ctx, framebuffer);
return;
}
#endif // PBL_COLOR
if (opacity <= (MAX_PLOT_BRIGHTNES... | (src_x, framebuffer->bounds.origin.y) | ,
.size = GSize(1, framebuffer->bounds.size.h),
};
GBitmap column_to_replicate_sub_bitmap;
gbitmap_init_as_sub_bitmap(&column_to_replicate_sub_bitmap, framebuffer, column_to_replicate);
for (int16_t x = dst_x1; x <= dst_x2; x++) {
bitblt_bitmap_into_bitmap(framebuffer, &column_to_replicate_sub_bitmap, G... |
ssage__receive_message_multi_chunk(void) {
prv_init_and_goto_session_open_with_tiny_buffers();
EXECUTE_SCRIPT("var event = null;\n"
"var json_str = null;\n"
"_rocky.on('message', function(e) {\n"
" json_str = JSON.stringify(e.data);\n" // stringify again to make ... | ("didError", true) | |
owse/PBL-20406
#define DICTATION_TIMEOUT (15 * 1000) // 15s timeout for each dictation
#define SPEECH_DETECTION_TIMEOUT (3 * 1000)
// Session must last at least 600ms before reporting an error to the user
#define MIN_ELAPSED_DURATION (600)
#define TEXT_PADDING (4)
#define MIC_DOT_MAX_RADIUS (9)
#define MIC_DOT... | (data, (result == DictationSessionStatusSuccess)) | ;
}
sys_light_reset_to_timed_mode();
prv_teardown(data);
}
static void prv_handle_error_retries(VoiceUiData *data) {
if (data->error_count < MAX_ERROR_COUNT) {
VOICE_LOG("Restarting dictation after error");
prv_start_dictation(data);
} else {
VOICE_LOG("Too many errors! Exiting...");
prv_ex... |
nsfer_setup_complete_handler(AudioEndpointSessionId session_id) {
if (s_session_id != session_id) {
PBL_LOG(LOG_LEVEL_WARNING, "Received audio transfer message when no session was in progress ("
"%d)", session_id);
return;
}
mutex_lock(s_lock);
prv_handle_subsystem_started(SessionState_Audi... | mutex_lock(s_lock) | ;
if ((s_state == SessionState_Idle) ||
(session_id != s_session_id) ||
(session_id == VOICE_SESSION_ID_INVALID)) {
goto unlock;
}
if (s_state != SessionState_Recording) {
mutex_unlock(s_lock);
voice_cancel_dictation(session_id);
return;
}
s_state = SessionState_WaitForSessionRes... |
heck(sizeof(AnalyticsNode));
*node = (AnalyticsNode) {
.metric = metric,
};
s_analytics_list = list_prepend(s_analytics_list, (ListNode *)node);
}
// Stopwatch Node Functions
static bool prv_compare_stopwatch(ListNode *found_node, void *data) {
AnalyticsStopwatchNode *stopwatch = (AnalyticsStopwatchNode *... | cb(node->metric, node->value, context) | |
.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions a... | {
prv_each((AnimationPrivate *)animation, prv_free, (uintptr_t)NULL);
return true;
} | |
ile (QSPI_GetFlagStatus(QSPI_FLAG_BUSY) != RESET) { }
}
static void prv_quad_enable() {
QSPI_ComConfig_InitTypeDef qspi_com_config;
QSPI_ComConfig_StructInit(&qspi_com_config);
qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Write;
qspi_com_config.QSPI_ComConfig_IMode = QSPI_ComConfig_IMod... | (buffer_size) | |
XY, RADIUS_DEFAULT);
// TODO: Fix offset calculation and reenable this: - PBL-16509
#if SCREEN_COLOR_DEPTH_BITS == 8
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi"));
#endif
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, ... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 1);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw1_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// SW = 2
setup_test_aa_sw(&ctx, fb,... |
// 0000 00 01 00 31 2c 32 2e 30 ...1,2.0
uint8_t incomplete_playback_info_update[] = {
0x00, 0x01, 0x00, 0x31, 0x2c, 0x32, 0x2e, 0x30,
};
prv_receive_entity_update(incomplete_playback_info_update,
sizeof(incomplete_playback_info_update));
prv_assert_initial_playback_state()... | {
prv_discover_ams(1 /* num_instances */);
// Simulate successful subscription:
BLECharacteristic entity_update = s_characteristics[0][AMSCharacteristicEntityUpdate];
ams_handle_subscribe(entity_update, BLESubscriptionNotifications, BLEGATTErrorSuccess);
ams_destroy();
cl_assert_equal_s(music_get_connecte... |
// Test setup
///////////////////////////////////////////////////////////
void test_ams__initialize(void) {
s_launcher_task_callback = NULL;
memset(s_conn_mgr_states, 0, sizeof(s_conn_mgr_states));
fake_rtc_init(1234, 5678);
fake_event_init();
fake_gatt_client_subscriptions_init();
fake_gatt_client_op_in... |
/*
* 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 (s_reminder_timer) {
new_timer_delete(s_reminder_timer);
} |
s_reminder_timer = new_timer_create();
if (s_reminder_timer == TIMER_INVALID_ID) {
return E_ERROR;
} else {
return reminders_update_timer();
}
}
status_t reminders_delete(ReminderId *reminder_id) {
return reminder_db_delete_item(reminder_id, true /* send_event */);
}
T_STATIC uint32_t prv_calculate... |
ext and battery icon
battery_percent_text_node->margin.w = 4;
GTextNode *vertically_centered_battery_percent_text_node =
prv_wrap_text_node_in_vertically_centered_container(battery_percent_text_node);
graphics_text_node_container_add_child(&horizontal_container_node->container,
... | {
return RESOURCE_ID_CONNECTIVITY_BLUETOOTH_CALLS_ONLY;
} | |
information tracked using the handle returned to callers
#define FD_STATUS_IN_USE 0x0 // A caller is using this fd
#define FD_STATUS_UNREFERENCED 0x1 // Valid data, no one using
#define FD_STATUS_FREE 0x2 // No data in the fd
// max number of files (cache size) that can be opened at any given time
#d... | PBL_LOG(LOG_LEVEL_ERROR, "FS write out of bounds 0x%x", (int)offset) | ;
}
}
// Erases all pages for the sector which begins at 'start_page'
static void prv_flash_erase_sector(uint16_t start_page) {
uint32_t offset = PFS_PAGE_SIZE * start_page;
if (offset < s_pfs_size) {
ftl_erase_sector(PFS_PAGE_SIZE * PFS_PAGES_PER_ERASE_SECTOR, offset);
prv_invalidate_page_flags_cache(of... |
uffer_size = strlen(message) + 1;
data->dialog.message = applib_malloc(message_buffer_size);
if (!data->dialog.message) {
return false;
}
strncpy(data->dialog.message, message, message_buffer_size);
data->dialog.icon = timeline_res_id;
data->dialog.success = success;
return true;
}
static bool prv_sh... | applib_zalloc(sizeof(ActionResultData)) | ;
if (!data) {
return;
}
data->chaining_data.action_chaining_window = chaining_window;
data->chaining_data.notif = timeline_item_copy(cb_data->item);
data->standalone_action = cb_data->standalone_action;
const bool ignore_failures = false;
prv_subscribe_to_action_results_and_timeouts(data, ignore_fa... |
// model: "pebble_time_red",
// language: "en_US",
// firmware: {
// major: 4,
// minor: 0,
// patch: 1,
// suffix: "beta3"
// }
// }
#define ROCKY_WATCHINFO "watchInfo"
#define ROCKY_WATCHINFO_PLATFORM "platform"
#define ROCKY_WATCHINFO_MODEL "model"
#define ROCKY_WATCH... | ("pebble_time_round_rose_gold_14mm") | ;
break;
case WATCH_INFO_COLOR_PEBBLE_2_HR_BLACK:
model_name = SILK_MODEL("pebble_2_hr_black");
break;
case WATCH_INFO_COLOR_PEBBLE_2_HR_LIME:
model_name = SILK_MODEL("pebble_2_hr_lime");
break;
case WATCH_INFO_COLOR_PEBBLE_2_HR_FLAME:
model_name = SILK_... |
ms[s_correct_order[4]].header.id,
&timeline_model_get_iter_state(2)->pin.header.id));
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(2));
cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3));
cl_assert(timeline_model... | (&s_items[i].header.id) | ;
}
cl_assert_equal_i(timeline_model_get_num_items(), 0);
cl_assert(!timeline_model_iter_next(NULL, NULL));
cl_assert(!timeline_model_iter_prev(NULL, NULL));
}
void test_timeline_model__is_empty(void) {
TimelineModel model = {0};
model.direction = TimelineIterDirectionFuture;
time_t first_time = 14211780... |
/*
* 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... | applib_malloc(sizeof(BtConnDialog)) | ;
bt_conn_dialog_init(bt_dialog, NULL, 0);
return bt_dialog;
}
void bt_conn_dialog_init(BtConnDialog *bt_dialog, char *text_buffer, size_t buffer_size) {
memset(bt_dialog, 0, sizeof(BtConnDialog));
simple_dialog_init(&bt_dialog->dialog, "Bluetooth Disconnected");
Dialog *dialog = &bt_dialog->dialog.dialog;
... |
aunch_get_app(BUTTON_ID_DOWN),
quick_launch_get_app(BUTTON_ID_BACK),
#endif
watchface_get_default_install_id(),
worker_preferences_get_default_worker(),
},
};
settings_file_each(&file, prv_each_free_up_space, &evict_data);
settings_file_close(&file);
// remove all nodes f... | {
// create a list of all app resource files in the filesystem
PFSFileListEntry *resource_files = pfs_create_file_list(is_app_resource_file_name);
// delete app resource files that don't correspond to entries in the app cache
prv_app_cache_find_and_delete_orphans(&resource_files);
pfs_delete_file_list(resourc... |
//////////////////////////
// AppCache Settings API's
//////////////////////////
//! Set up the app cache
void app_cache_init(void) {
s_app_cache_mutex = mutex_create_recursive();
mutex_lock_recursive(s_app_cache_mutex);
{
// if no cache file exists, then we should go ahead and clean up any files that are... |
utes_restore_default_text_flow((GTextLayoutCacheRef) &l);
cl_assert_equal_p(l.flow_data.perimeter.impl, NULL);
}
// just a fake value to have something to compare against
const GPerimeter * const g_perimeter_for_display = (const GPerimeter *) &g_perimeter_for_display;
void test_text_layout__enable_text_flow(void) {... | cl_assert(layout.hash != 0) | |
y_item = session->dirty_list;
int item_size = blob_db_get_len(session->db_id, dirty_item->key, dirty_item->key_len);
if (item_size == 0) {
// item got removed during the sync. Go to the next one
blob_db_sync_next(session);
return;
}
if (!comm_session_get_system_session()) {
PBL_LOG(LOG_LEVEL_IN... | (db_id, dirty_list, BlobDBSyncSessionTypeDB) | |
eros. Fusce ipsum metus, vehicula eu tortor "
"sed, congue tempus mauris. Maecenas mollis lacus non cursus bibendum. "
"Etiam id dolor lorem. Aenean scelerisque nulla sed tristique posuere. "
"Proin dui magna, gravida faucibus ultricies non, tincidunt id metus. "
"Integer a laoreet dolor, eu vulputate enim. Ut... | {
char string_buffer[PERSIST_STRING_MAX_LENGTH];
memset(string_buffer, '~', sizeof(string_buffer));
cl_assert_equal_i(
persist_read_string(0, string_buffer, sizeof(string_buffer)),
E_DOES_NOT_EXIST);
for (size_t i = 0; i < sizeof(string_buffer); ++i) {
if (string_buffer[i] != '~') {
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... | strcmp(testbuf, testbuf) | , true);
}
void test_strcmp__same_content(void) {
char testbuf1[8] = "Hello!\0\0";
char testbuf2[8] = "Hello\0\0\0";
testbuf2[5] = '!';
cl_assert_equal_b(!strcmp(testbuf1, testbuf2), true);
}
void test_strcmp__different_content(void) {
char testbuf1[8] = "Hello!\0\0";
char testbuf2[8] = "Hello\0\0\0";
c... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
*((int32_t*)location) = (int32_t)CLIP(val, INT32_MIN, INT32_MAX);
return;
} |
}
WTF; // Should not get here!
}
static int64_t prv_location_get_value(uint8_t *location, AnalyticsMetricElementType type) {
switch (type) {
case ANALYTICS_METRIC_ELEMENT_TYPE_NIL:
WTF;
case ANALYTICS_METRIC_ELEMENT_TYPE_UINT8:
return *(uint8_t*)location;
case ANALYTICS_METRIC_ELEMENT_TYPE_UINT16:
... |
ystem_theme_get_font_for_default_size(TextStyleFont_TimeHeaderNumbers);
vertical_node->container.node.offset.y =
((is_future ? -1 : 1) * fonts_get_font_height(numbers_font)) + single_offset;
}
if (is_peek) {
vertical_node->container.size.w = DISP_COLS - TIMELINE_PEEK_ICON_BOX_WIDTH;
const size_... | (paging, false) | ,
};
(render ? graphics_text_node_draw :
graphics_text_node_get_size)(layout->view_node, ctx, &box, &config, size_out);
}
void timeline_layout_render_view(TimelineLayout *layout, GContext *ctx) {
const bool render = true;
prv_render_view(layout, ctx, render, NULL);
}
void timeline_layout_get_size(... |
{
session_refs[i] = TO_SESSION_REF(i+1);
const uint16_t expire_s = SECONDS_PER_MINUTE;
sys_hrm_manager_app_subscribe(app_id, 1, expire_s, HRMFeature_BPM|HRMFeature_LEDCurrent);
} |
prv_fake_send_new_data();
// Two events for each app subscriber
cl_assert_equal_i(s_event_count, num_refs * 2);
for (int i = 0; i < num_refs; ++i) {
sys_hrm_manager_unsubscribe(session_refs[i]);
}
}
void test_hrm_manager__system_task_data_callback(void) {
stub_pebble_tasks_set_current(PebbleTask_Ke... | |
tmapProcessor *processor_with_data =
(GenericGlanceIconBitmapProcessor *)processor;
// Restore the saved compositing mode and tint color
ctx->draw_state.compositing_mode = processor_with_data->saved_compositing_mode;
ctx->draw_state.tint_color = processor_with_data->saved_tint_color;
}
GColor launcher_app_gl... | (structured_glance) | ;
underlying_text_node_text->overflow = GTextOverflowModeTrailingEllipsis;
underlying_text_node_text->node.offset = GPoint(0, -fonts_get_font_cap_offset(font));
underlying_text_node_text->max_size.h = fonts_get_font_height(font);
return &underlying_text_node_text->node;
}
static void prv_structured_glance_titl... |
e(Uuid *parent_id) {
return NULL;
}
static TimelineItem item1 = {
.header = {
.id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e,
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4},
.parent_id = {0xff, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e,
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0... | (pin_db_is_dirty(&is_dirty), S_SUCCESS) | ;
cl_assert(!is_dirty);
dirty_list = pin_db_get_dirty_list();
cl_assert(!dirty_list);
}
void test_pin_db__set_status_bits(void) {
pin_db_insert_item(&item1);
TimelineItem item;
cl_must_pass(pin_db_read_item_header(&item, &item1.header.id));
cl_assert_equal_i(item.header.status, 0);
cl_must_pass(pin_d... |
allocated_buffer(&dst_state->pin);
*dst_state = *src_state;
dst_state->pin = (TimelineItem){};
*dst_iter = *src_iter;
dst_iter->state = dst_state;
}
void timeline_iter_deinit(Iterator *iter, TimelineIterState *iter_state, TimelineNode **head) {
TimelineNode *node = *head;
while (node) {
TimelineNode ... | {
const bool do_async = true;
prv_do_remote_action(&item->header.id, action->type,
action->id, attributes, do_async);
} |
}
static void prv_dismiss_local_notification_action(const TimelineItem *item) {
// TODO: PBL-23915
// We leak this i18n'd string because not leaking it is really hard.
// We make sure we only ever allocate it once though, so it's not the end of the world.
prv_put_notification_action_result(&item->header.id, i... |
with the non-leaves with next level
if (!reply_options[reply].is_leaf) {
responses_level->items[item].next_level =
level_getters[reply](responses_level, action, root_level);
}
item++;
}
return responses_level;
}
static void prv_postpone_15_minutes(ActionMenu *action_menu,
... | (&action->attr_list, AttributeIdTitle, "[Action]") | ;
if (action->type == TimelineItemActionTypeResponse) {
ActionMenuLevel *responses_level = prv_create_responses_level(action, root_level,
false /* reply_prefix */);
action_menu_level_add_child(root_level, responses_level, label);
} else if (a... |
cess_minute_data(utc_sec);
}
mutex_unlock_recursive(s_activity_state.mutex);
}
// ------------------------------------------------------------------------------------------------
// Runs on the timer task. Simply register a callback for the KernelBG task from here.
static void prv_minute_cb(CronJob *job, void *da... | dls_log(data->dls_session, &data->record, 1) | ;
if (result != DATA_LOGGING_SUCCESS) {
PBL_LOG(LOG_LEVEL_WARNING, "Error %"PRIi32" while logging raw sample data",
(int32_t)result);
}
// Generate a log message as well. This is temporary until we have better support to
// send the DLS data to a server and retrieve it f... |
NE_1_HR, HRMQuality_Good);
prv_inc_time(10);
prv_put_bpm_event(ZONE_1_HR, HRMQuality_Good);
cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s));
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 0);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10);
cl_assert_equal_i(hr_zone_time_s[H... | workout_service_get_avg_hr(&avg_hr) | );
cl_assert_equal_i(avg_hr, 140);
prv_put_bpm_event(160, HRMQuality_Good);
prv_put_bpm_event(160, HRMQuality_Good);
cl_assert(workout_service_get_avg_hr(&avg_hr));
cl_assert_equal_i(avg_hr, 150);
cl_assert(workout_service_pause_workout(true));
prv_put_bpm_event(200, HRMQuality_Good);
prv_put_bpm_eve... |
d_handler_calls, b), 0);
cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MIN);
cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MIN);
#endif
}
// --------------------------------------------------------------------------------------
// Test the get_duration call on a seque... | animation_get_duration(a, true, false) | , delay_a + duration_a);
cl_assert_equal_i(animation_get_duration(a, true, true), total_duration_a);
cl_assert_equal_i(animation_get_duration(b, false, false), duration_b);
cl_assert_equal_i(animation_get_duration(b, false, true), play_count_b * duration_b);
cl_assert_equal_i(animation_get_duration(b, true, fa... |
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 in writ... | (list_a->serialized_byte_length, list_b->serialized_byte_length) | ;
cl_assert_equal_i(
string_list_count(list_a),
string_list_count(list_b)
);
uint32_t count = string_list_count(list_a);
for (uint32_t idx = 0; i<count; i++) {
cl_assert_equal_s(
string_list_get_at(list_a, idx),
string_list_ge... |
page_number(), 0);
}
void test_shared_prf_storage_v3__wipe_all(void) {
SMPairingInfo sm_pairing_info;
memset(&sm_pairing_info, 0xaa, sizeof(sm_pairing_info));
sm_pairing_info.is_local_encryption_info_valid = true;
sm_pairing_info.is_remote_signing_info_valid = true;
sm_pairing_info.is_remote_identity_info_va... | cl_assert_equal_b(shared_prf_storage_get_root_key(SMRootKeyTypeIdentity, NULL), false) | ;
cl_assert_equal_b(shared_prf_storage_get_root_key(SMRootKeyTypeEncryption, NULL), false);
SM128BitKey keys[2];
for (int i = 0; i < sizeof(keys); ++i) {
((uint8_t *) keys)[i] = i;
}
shared_prf_storage_set_root_keys(keys);
SM128BitKey keys_out[2];
for (SMRootKeyType key_type = 0; key_type < SMRootK... |
if (BMA255SampleInterval_250HZ <= interval_us) {
sample_interval = BMA255SampleInterval_250HZ;
} else {
sample_interval = BMA255SampleInterval_250HZ;
}
return sample_interval;
}
static void prv_enable_operating_mode(AccelOperatingMode mode,
BMA255SampleInterval samp... | prv_program_fifo_register(BMA255Register_FIFO_CONFIG_1, out) | ;
// If the fifo had overflowed, the write above will have cleared the flag
s_fifo_overrun_detected = false;
}
static void prv_configure_fifo_interrupts(bool enable_int, bool use_fifo) {
BMA255_DBG("Enabling FIFO Interrupts: %d %d", (int)enable_int, (int)use_fifo);
uint8_t map_value;
uint8_t en_value;
if (... |
Clear the ICI bits in the Program Status Register. These bits refer to microprocessor state if we
// get interrupted during a certain set of instructions. Since we're returning to a different place, we need
// to clean up this state or else we'll just hit an INVSTATE UsageFault immediately. The only bit we leave
... | fault_handler_dump_cfsr(buffer) | ;
stacked_args += 256; // Should be enough to get above the guard region and execute hardware_fault_landing_zone
if (lr & 0x04) {
__set_PSP((uint32_t)stacked_args);
} else {
__set_MSP((uint32_t)stacked_args);
}
attempt_handle_stack_overflow(stacked_args);
} else {
prv_save_de... |
ble_double_tap_detection(true);
prv_setup_subsampling(accel_get_sampling_interval());
}
mutex_unlock_recursive(s_accel_manager_mutex);
}
static void prv_double_tap_remove_subscriber_cb(PebbleTask task) {
mutex_lock_recursive(s_accel_manager_mutex);
PBL_ASSERTN(s_double_tap_subscribers_count > 0);
if (-... | prv_get_sample_interval_info(&lowest_interval_us, &max_n_samples) | ;
// Configure the driver sampling interval and get the actual interval that the driver is going
// to use.
uint32_t interval_us = accel_set_sampling_interval(lowest_interval_us);
prv_setup_subsampling(interval_us);
PBL_LOG(LOG_LEVEL_DEBUG, "setting accel rate:%"PRIu32", num_samples:%"PRIu32,
US_... |
.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 Li... | cl_assert(score) | ;
vibe_score_destroy(score);
}
void test_vibe_score__test_get_duration_ms(void) {
uint8_t buffer[] = {
'V', 'I', 'B', 'E', // FourCC
1, 0, // version
0, 0, 0, 0, // reserved bytes
18, 0, // attr_list_size
2, // GenericAttributeList.num_attributes
VibeAttributeId_Notes,
8, ... |
/*
* 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... | shared_prf_storage_get_ble_pinned_address(address_out) | ;
}
BTBondingID bt_persistent_storage_store_ble_pairing(const SMPairingInfo *new_pairing_info,
bool is_gateway, const char *device_name,
bool requires_address_pinning,
... |
GColor src_color) {
#if CAPABILITY_HAS_MASKING
const GDrawMask *mask = ctx->draw_state.draw_mask;
graphics_private_raw_mask_apply(dst_color, mask, data_row_offset, x, width, src_color);
#else
memset(dst_color, src_color.argb, (size_t)width);
#endif // CAPABILITY_HAS_MASKING
}
// Plots row at given starting... | prv_assign_row_with_pattern_1bit(framebuffer, y, x1_rounded, x2_rounded - x1_rounded + 1, color) | ;
#endif
}
// This function draws vertical line with AA edges, given values have to be adjusted for
// screen coordinates and clipped according to the clip box, does not respect transparency
// on the drawn line (beside edges)
T_STATIC void prv_assign_vertical_line_raw(GContext *ctx, int16_t x, Fixed_S16_3 y1,
... |
if (!is_animation_infinite && !is_reel_infinite) {
// If neither animation nor reel is infinite
elapsed_ms = interpolate_uint32(normalized, player->from_elapsed_ms, player->to_elapsed_ms);
} else if ((is_animation_infinite || is_reel_infinite) && !is_animation_reversed) {
// If either animation or re... | (player->reel) | ;
const uint32_t to_value = kino_reel_get_duration(player->reel);
prv_create_play_animation(player, from_value, to_value);
return (ImmutableAnimation *)player->animation;
}
return NULL;
}
ImmutableAnimation *kino_player_create_play_section_animation(
KinoPlayer *player, uint32_t from_elapsed_ms, ui... |
/*
* 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... | (get_pref, set_value + 1) | ;
// Issue the blob_db update event
PebbleBlobDBEvent event = (PebbleBlobDBEvent) {
.db_id = BlobDBIdPrefs,
.type = BlobDBEventTypeInsert,
.key = (uint8_t *)key,
.key_len = key_len,
};
prefs_private_handle_blob_db_event(&event);
get_pref = backlight_get_timeout_ms();
cl_assert(get_pref == g... |
rtc_alarm_init();
power_tracking_init();
}
static void clear_reset_loop_detection_bits(void) {
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);
}
static void uptime_callback(void* data) {
PBL_LOG_VERBOSE("Uptim... | compositor_init() | ;
kernel_ui_init();
bt_driver_init();
services_init();
// The RTC needs be calibrated after the mfg registry service has been initialized so we can
// load the measured frequency.
rtc_calibrate_frequency(mfg_info_get_rtc_freq());
clear_reset_loop_detection_bits();
task_watchdog_mask_set(PebbleTask_... |
}
state->position = endptr;
state->filter_state = target_time - state->vars->current_time;
state->time_was_until = true;
}
static void prv_filter_time_since(TemplateStringState *state) {
prv_filter_time_until(state);
if (state->error->status != TemplateStringErrorStatus_Success) {
return;
}
state-... | {
prv_handle_escape_character(&state);
if (state.error->status != TemplateStringErrorStatus_Success) {
break;
}
prv_append_char(&state, *state.position);
state.position++;
} | else { // Template
state.position++;
prv_template_eval(&state);
if (state.error->status != TemplateStringErrorStatus_Success) {
break;
}
state.time_was_until = false;
state.filter_state = 0;
state.filters_complete = false;
}
}
if (state.error->status != Templa... |
/*
* 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 (!s_is_scanning) {
s_dropped_reports = 0;
success = bt_driver_start_le_scan(
true /* active_scan */, false /* use_white_list_filter */,
true /* filter_dups */, 10240, 10240);
if (success) {
// Allocate report buffers if advertising started successfully
co... |
bt_unlock();
return success;
}
// -----------------------------------------------------------------------------
bool gap_le_stop_scan(void) {
bool success = false;
bt_lock();
{
if (s_is_scanning) {
success = bt_driver_stop_le_scan();
kernel_free(s_reports_buffer);
s_reports_buffer = N... |
yscall/syscall.h"
#include "syscall/syscall_internal.h"
#include "system/passert.h"
#include "util/size.h"
#include <pebbleos/cron.h>
#include "activity.h"
#include "activity_algorithm.h"
#include "activity_insights.h"
#include "activity_private.h"
// ----------------------------------------------------------------... | (LOG_LEVEL_WARNING, "Invalid activity type: %d", (int)session->type) | ;
return false;
}
// The length must be reasonable
if (session->length_min > ACTIVITY_SESSION_MAX_LENGTH_MIN) {
PBL_LOG(LOG_LEVEL_WARNING, "Invalid duration: %"PRIu16" ", session->length_min);
return false;
}
// The flags must be valid
if (session->reserved != 0) {
PBL_LOG(LOG_LEVEL_WARN... |
/*
* 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... | blob_db_get_dirty_list(BlobDBIdTest) | == NULL);
// insert one
char *key = "key";
char *value = "value";
cl_assert_equal_i(S_SUCCESS, blob_db_insert(BlobDBIdTest,
(uint8_t *)key,
strlen(key),
(uint8_t *)value,
... |
ions will check for a null pointer
TimelineItem *item = timeline_item_create_with_attributes(notif_time, 0,
TimelineItemTypeNotification,
LayoutIdNotification, ¬if_attr_list,
... | (item, NULL) | |
algorithm happy
prv_swap_precise_points(&start_top, &start_bottom);
}
if (end_top.y.raw_value > end_bottom.y.raw_value) {
prv_swap_precise_points(&end_top, &end_bottom);
} else if (end_top.y.raw_value == end_bottom.y.raw_value &&
(config.end_quadrant.quadrant & GCornersBottom)) {
// Spec... | prv_get_angles_mask_edge(y_middle, center, config.start_quadrant.quadrant,
&starting_edge, &ending_edge, start_top, start_bottom) | ;
prv_get_angles_mask_edge(y_middle, center, config.end_quadrant.quadrant,
&ending_edge, &starting_edge, end_top, end_bottom);
// Now we use only one with valuable data - same starting/ending is rejected
if (starting_edge == ending_edge) {
y_middle.integer++;
... |
the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License ... | (&confirmation_dialog->action_bar) | |
/*
* 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... | kino_player_set_reel(test_player, test_reel, true) | ;
}
// Teardown
void test_kino_player__cleanup(void) {
kino_reel_destroy(test_reel);
}
// Tests
////////////////////////////////////
extern void prv_play_animation_update(Animation *animation, const AnimationProgress normalized);
void test_kino_player__finite_animation_finite_reel_foward(void) {
// Choose durat... |
ActiveKCalories:
case ActivityMetricDistanceMeters:
case ActivityMetricSleepStateSeconds:
case ActivityMetricLastVMC:
case ActivityMetricHeartRateRawBPM:
case ActivityMetricHeartRateRawQuality:
case ActivityMetricHeartRateRawUpdatedTimeUTC:
case ActivityMetricHeartRateFilteredBPM:
case A... | prv_file_open_and_lock(&file) | |
size_t *out_length) {
if (!out_str || !out_length) {
return NULL;
}
*out_length = *iter;
*out_str = (const char*) iter + 1;
iter += 1 + *out_length;
if (iter > iter_end) {
PBL_LOG(LOG_LEVEL_WARNING, "Invalid music message");
return NULL;
... | (read_iter, msg + length,
&player_package_ptr, &player_package_length) | ;
if (!read_iter) {
return;
}
const char* player_name_ptr;
size_t player_name_length;
read_iter = prv_read_ptr_and_length_from_buffer(read_iter, msg + length,
&player_name_ptr, &player_name_length);
if (!read_iter) {
return;
}
// Not doing anyth... |
(uint8_t *)&entry, sizeof(AppCacheEntry));
settings_file_close(&file);
// cleanup the cache if we need to
system_task_add_callback(prv_cleanup_app_cache_if_needed, NULL);
}
unlock:
mutex_unlock_recursive(s_app_cache_mutex);
return rv;
}
//! Tests if an entry with the given AppInstallId is in the... | mutex_lock_recursive(s_app_cache_mutex) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | utf8_get_next(cursor) | ;
}
char *next = (char *)cursor;
if (next == dialog->buffer + transcription_dialog->buffer_len) {
return;
}
// Move the zero terminator.
transcription_dialog->missing = *next;
*next = '\0';
transcription_dialog->zero = next;
}
static void prv_set_char_index(void *subject, int16_t index) {
Trans... |
bool prv_handle_chunk_received(Tuple *tuple) {
if (tuple->type != TUPLE_BYTE_ARRAY) {
PBL_LOG(LOG_LEVEL_ERROR, "Chunk tuple not a byte array!");
return false;
}
const PostMessageChunkPayload *const chunk = (const PostMessageChunkPayload *) tuple->value;
if (tuple->length <= sizeof(PostMessageChunkPaylo... | {
MessageNode *old_head = s_state.out.control_msg_queue;
list_remove(&old_head->node, (ListNode **)&s_state.out.control_msg_queue, NULL);
task_free(old_head);
} |
static void prv_control_message_queue_send_head(void) {
MessageNode *node = s_state.out.control_msg_queue;
DictionaryIterator *it = NULL;
app_message_outbox_begin(&it);
if (!it) {
// FIXME: Handle not being able to open inbox ??
WTF;
}
dict_write_data(it, node->key, node->data, node->length);
di... |
392},
{ 1008, 1456, -632},
{ 976, 856, -304},
{ 1312, 728, -168},
{ 1688, 808, -120},
{ 1712, 592, -72},
{ 1616, 384, 32},
{ 1520, 376, -56},
{ 1568, 376, 48},
{ 1720, 400, 96},
{ 1600, 280, 168},
{ 1328, 272, 104},
{ 1136, -768, 192},
{ 328, -352, 128},
{ 488, -6... | { 1360, 320, 72},
{ 1360, 240, -96},
{ 1176, -936, 240},
{ 720, -472, 384},
{ 896, -296, -488},
{ 1160, -16, -344},
// 13 seconds
{ 1544, 104, -16},
{ 1592, 216, 104},
{ 1640, 408, -120},
{ 1752, 704, -96},
{ 1760, 1056, -264},
{ 1704, 880, -344},
{ 1400, 904, -21... |
{ 1352, 912, -376},
{ 1744, 880, -312},
{ 1608, 552, -224},
{ 1568, 368, -88},
{ 1592, 352, -152},
{ 1696, 392, -192},
{ 1664, 280, 24},
{ 1512, 240, 32},
{ 1200, 232, -80},
{ 944, -552, 288},
{ 608, -424, 296},
{ 624, -256, -440},
{ 880, -96, -320},
{ 1136, 120,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.