prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
) = g(x) with f(x)=y and a line g(x) that goes through two given points a,b
static int16_t prv_intersection_between_horizontal_and_line(Fixed_S16_3 progress, GPointPrecise top,
GPointPrecise bottom) {
if (bottom.y.raw_value - top.y.raw_value == 0) {
retu... | PBL_ASSERTN(angle_start <= angle_end) | ;
EllipsisDrawConfig config = (EllipsisDrawConfig){(EllipsisPartDrawConfig){0, GCornerNone},
GCornerNone,
(EllipsisPartDrawConfig){0, GCornerNone}};
// Nothing to draw case:
if (angle_end == angle_start) {
return config;
}
// Full circle case:
if (angle_end - angle_start >= TRIG_MAX_ANGLE) {
... |
MIN(MAX_ATTRIBUTE_LENGTHS[attribute->id - 1], attribute->length) + 1;
} else if (attribute->id == AttributeIdSubtitleTemplateString) {
string_alloc_size += MIN(ATTRIBUTE_APP_GLANCE_SUBTITLE_MAX_LEN, attribute->length) + 1;
} else {
string_alloc_size += attribute->length + 1;
... | Uint32ListSize(attr_list->attributes[i].uint32_list->num_values) | ;
memcpy(buffer, attr_list->attributes[i].uint32_list, attribute->length);
break;
default:
attribute->length = 0;
break;
}
buffer += attribute->length;
PBL_ASSERTN(buffer <= buf_end);
}
return buffer - buf_start;
}
bool attribute_deserialize_list(char **b... |
a_len, uint8_t *data) {
return i2c_read_register_block(I2C_MAG3110, reg_addr, data_len, data);
}
static bool mag3110_write(uint8_t reg_addr, uint8_t data) {
return i2c_write_register_block(I2C_MAG3110, reg_addr, 1, &data);
}
static void mag3110_interrupt_handler(bool *should_context_switch) {
if (s_use_refcount... | (DR_STATUS_REG, sizeof(raw_data), raw_data) | |
void graphics_draw_text(GContext *ctx, const char *text, GFont const font, const GRect box,
const GTextOverflowMode overflow_mode, const GTextAlignment alignment,
GTextAttributes *text_attributes) {
record_mock_call(s_graphics_draw_text){
.draw_text.box = box,
... | (1, s_layer_mark_dirty.call_count) | ;
cl_assert_equal_p(&s_app_window_stack_get_top_window.layer, s_layer_mark_dirty.last_call.layer);
}
void test_rocky_api_graphics__provides_draw_event(void) {
rocky_global_init(s_graphics_api);
cl_assert_equal_b(false, rocky_global_has_event_handlers("draw"));
EXECUTE_SCRIPT("_rocky.on('draw', function() {});... |
/*
* 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... | (RTC_TIMEZONE_ABBR_START, 0) | |
ache_buffer));
circular_cache_init(&s_test_cache, (uint8_t *)s_cache_buffer, sizeof(TestCacheItem),
NUM_TEST_ITEMS, prv_comparator);
for (int i = 0; i < ARRAY_LENGTH(s_test_item); i++) {
s_free_flags[i] = false;
}
}
void test_circular_cache__cleanup(void) {
}
// tests
void test_circula... | {
circular_cache_set_item_destructor(&s_test_cache, prv_destructor);
circular_cache_push(&s_test_cache, &s_test_item[0]);
circular_cache_flush(&s_test_cache);
cl_assert(*s_test_item[0].freed);
cl_assert(!(*s_test_item[1].freed));
cl_assert(!(*s_test_item[2].freed));
memset(s_cache_buffer, 0, sizeof(s_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... | applib_free(builder) | ;
}
GPath *gpath_builder_create_path(GPathBuilder *builder) {
if (builder->num_points <= 1) {
return NULL;
}
uint32_t num_points = builder->num_points;
// handle case where last point == first point => remove last point
while (num_points > 1
&& gpoint_equal(&builder->points[0], &builder->poin... |
IC_MAG_BUS = {
.state = &I2C_PMIC_MAG_BUS_STATE,
.hal = &I2C_PMIC_MAG_BUS_HAL,
.scl_gpio = {
.gpio = GPIOF,
.gpio_pin = GPIO_Pin_14,
.gpio_pin_source = GPIO_PinSource14,
.gpio_af = GPIO_AF4_I2C4
},
.sda_gpio = {
.gpio = GPIOF,
.gpio_pin = GPIO_Pin_15,
.gpio_pin_source = GPIO_PinSou... | MHZ_TO_HZ(4) |
};
static SPIBusState BMI160_SPI_BUS_STATE = {};
static const SPIBus BMI160_SPI_BUS = {
.state = &BMI160_SPI_BUS_STATE,
.spi = SPI2,
.spi_sclk = {
.gpio = GPIOI,
.gpio_pin = GPIO_Pin_1,
.gpio_pin_source = GPIO_PinSource1,
.gpio_af = GPIO_AF5_SPI2
},
.spi_miso = {
.gpio = GPIOI,
.gpio... |
cl_assert(layer->frame.origin.y >= DISP_ROWS) | ;
// Peek service shows the peek UI using the animated code path.
TimelineItem *item = prv_set_timeline_item(&(TimelinePeekItemConfig) {
.title = "CoreUX Design x Eng",
.subtitle = "ConfRM-Missile Command",
.icon = TIMELINE_RESOURCE_TIMELINE_CALENDAR,
.num_concurrent = 0,
}, true /* animated */);... | |
ibrating, uint64_t time_search) {
bool rc = false;
PBL_ASSERTN(s_vibe_history_mutex);
mutex_lock(s_vibe_history_mutex);
VibeHistory *node = s_vibe_history;
while (node) {
if (node->time_end == END_NOT_SET && time_search >= node->time_start) {
rc = true;
break;
}
if (time_search >= nod... | if (s_vibe_strength == VIBE_STRENGTH_OFF) {
prv_vibe_history_start_event();
} |
} else {
vibe_ctl(false /* on */);
if (s_vibe_strength != VIBE_STRENGTH_OFF) {
prv_vibe_history_end_event();
}
}
s_vibe_strength = new_strength;
}
void vibe_service_set_enabled(bool enable) {
mutex_lock(s_vibe_pattern_mutex);
if (enable != s_vibe_service_enabled) {
// ensure that the v... |
system_theme_get_default_content_size_for_runtime_platform() | ;
return s_selection_configs[runtime_platform_default_size];
}
int selection_layer_default_cell_height(void) {
return prv_selection_config()->default_cell_height;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Drawing helpers
static int prv_get_pixels_fo... | |
ayer_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(... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_y_second_line.${BIT_DEPTH_NAME}.pbi")) | ;
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_nx);
layer_render_tree(&canvas, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_nx.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
... |
rv_last_handler_entry(AnimTestHandlerHistory *history,
Animation *animation) {
int last_entry=-1;
for (int i = 0; i < history->num_calls; i++) {
if (!animation || history->entries[i].animation == animation) {
last_entry = i;
}
}
if (last_entry == -1) {
return NULL;
} else {
ret... | (&s_update_handler_calls, animation, false,
(void *)(uintptr_t)distance /*context*/) | ;
DPRINTF("%"PRIu64" ms: Executing update handler for %d, distance: %d\n", prv_now_ms(),
(int)animation, (int)distance);
}
// --------------------------------------------------------------------------------------
static int s_custom_curve_call_count;
static AnimationProgress prv_custom_curve(AnimationProg... |
/*
* 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... | (EXIT_FAILURE) | ;
}
WEAK uint32_t rand32(void) {
return ((uint32_t)rand() << 1) + (uint32_t)rand;
}
|
skip_errors, uint32_t other_errors) {
bool is_ppogatt = false;
uint16_t conn_interval = 0;
if (!prv_get_connection_details(session, &is_ppogatt, &conn_interval)) {
return;
}
AnalyticsEventBlob event_blob = {
.event = AnalyticsEvent_PutByteTime,
.pb_time = {
.ppogatt = is_ppogatt,
.c... | (sync_errors, UINT16_MAX) | ,
.skip_errors = MIN(skip_errors, UINT16_MAX),
.other_errors = MIN(other_errors, UINT16_MAX),
},
};
ANALYTICS_LOG_DEBUG("GetBytesStats event: type: 0x%x, num_bytes: %"PRIu32", elapsed_ms: %"PRIu32,
type, bytes_transferred, elapsed_time_ms);
analytics_logging_log_event(&even... |
/*
* 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... | strftime(buf, buf_size, "%A", &good_data) | ;
if (r == 0 || strncmp(buf, "Tuesday", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"A\": %s", buf);
}
r = strftime(buf, buf_size, "%b", &good_data);
if (r == 0 || strncmp(buf, "May", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"b\": %s", buf);
}
r = strftime(buf, b... |
7f548", },
{ 2147483646LL, 18, "3928G3H0", },
{ 2147483646LL, 18, "3928g3h0", },
{ -2147483647LL, 18, "-3928G3H1", },
{ -2147483647LL, 18, "-3928g3h1", },
{ 2147483646LL, 19, "27C57H31", },
{ 2147483646LL, 19, "27c57h31", },
{ -2147483647LL, 19, "-27C57H32", },
{ -2147483647LL, 19, "-27c57h32", },
{ 2... | (s, &end, 10) | ;
cl_assert_equal_p(s, end);
cl_assert_equal_i('\0', *end);
s = "123";
strtol(s, &end, 10);
cl_assert_equal_p(s+3, end);
cl_assert_equal_i('\0', *end);
s = "123a";
strtol(s, &end, 10);
cl_assert_equal_p(s+3, end);
cl_assert_equal_i('a', *end);
s = "a123";
strtol(s, &end, 10);
cl_assert_equa... |
/*
* 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_analytics_max(ANALYTICS_APP_METRIC_MEM_NATIVE_HEAP_SIZE, heap_size(heap),
AnalyticsClient_CurrentTask) | ;
sys_analytics_max(ANALYTICS_APP_METRIC_MEM_NATIVE_HEAP_PEAK, heap->high_water_mark,
AnalyticsClient_CurrentTask);
#if CAPABILITY_HAS_JAVASCRIPT && !RECOVERY_FW
if (is_rocky_app) {
jmem_heap_stats_t jerry_mem_stats = {};
jmem_heap_get_stats(&jerry_mem_stats);
sys_analytics_max(ANAL... |
/*
* 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... | floor( 1.5) | |
_long_click_start_handler,
prv_volume_long_click_end_handler);
window_long_click_subscribe(BUTTON_ID_DOWN, 0, prv_volume_long_click_start_handler,
prv_volume_long_click_end_handler);
window_long_click_subscribe(BUTTON_ID_SELECT, 0, prv_play_pause_long_clic... | app_free(data->no_music_window) | ;
data->no_music_window = NULL;
}
}
static void prv_update_now_playing(MusicAppData *data) {
layer_set_hidden((Layer *)&data->track_pos_bar, !music_is_progress_reporting_supported());
char artist_buffer[MUSIC_BUFFER_LENGTH];
char title_buffer[MUSIC_BUFFER_LENGTH];
music_get_now_playing(title_buffer, art... |
daypart_string = clock_get_relative_daypart_string(timestamp, 5 /* hours_in_the_future */);
cl_assert_equal_s(morning, daypart_string);
// (4pm today) time between 12pm and 6pm is this afternoon
daypart_string = clock_get_relative_daypart_string(timestamp, 12 /* hours_in_the_future */);
cl_assert_equal_s(afte... | cl_assert_equal_i(hour, 0) | ;
cl_assert_equal_i(minute, 20);
hour = 0;
minute = 15;
clock_hour_and_minute_add(&hour, &minute, -30);
cl_assert_equal_i(hour, 23);
cl_assert_equal_i(minute, 45);
}
|
ot_version_string[(sizeof(uint32_t) * 2) + 3];
char recovery_version_string[sizeof(TINTIN_METADATA.version_tag)];
// Ensure that OTP values are null-terminated
char serial_string[MFG_SERIAL_NUMBER_SIZE + 1];
char hw_version_string[MFG_HW_VERSION_SIZE + 1];
char uptime_string[16]; // "xxd xxh xxm xxs"
char c... | (cell_index->section == 0) | ;
PBL_ASSERTN(cell_index->row < SystemInformationItem_Count);
SettingsSystemData *data = (SettingsSystemData *) context;
SystemInformationData *info = &data->information_data;
const char *title = i18n_get(s_information_titles[cell_index->row], data);
menu_cell_basic_draw(ctx, cell_layer, title, info->subtit... |
== SmartstrapStateReadReady)) {
PBL_ASSERT_TASK(PebbleTask_KernelBackground);
} else {
// all other transitions are invalid
WTF;
}
}
bool smartstrap_fsm_state_test_and_set(SmartstrapState expected_state, SmartstrapState next_state) {
const bool did_set = __atomic_compare_exchange_n(&s_fsm_state, &exp... | mutex_unlock(s_state_lock) | |
{
PeekLayer *peek_layer = &data->peek_layer;
#if ANIMATION_DOT
peek_layer_set_icon(peek_layer, timeline_res);
#elif ANIMATION_SLIDE
GRect icon_from;
GRect icon_to;
const bool shift_offscreen_from = true;
const bool shift_offscreen_to = false;
prv_get_icon_animation_frame(data, &icon_from, use_pin, shift_o... |
T_STATIC void prv_setup_no_events_peek(TimelineAppData *data) {
PeekLayer *peek_layer = &data->peek_layer;
// set the text
peek_layer_set_fields(peek_layer, "", i18n_get("No events", peek_layer), "");
// set the icon resource
TimelineResourceInfo timeline_res = {
.res_id = TIMELINE_RESOURCE_NO_EVENTS,
... | |
/*
* 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_equal_i(0b00111111, BITS_BETWEEN(0, 5)) | ;
cl_assert_equal_i(0b00111000, BITS_BETWEEN(3, 5));
cl_assert_equal_i(0b00010000, BITS_BETWEEN(4, 4));
}
// Flash memory is organized into twelve sectors of unequal sizes.
// Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB.
// The remaining sectors are 128 KiB.
// Bitset of sectors that have been "erased"
static uint... |
e, ActivitySettingsKeyInsightSleepSummaryState,
&s_sleep_pin_state, sizeof(s_sleep_pin_state));
prv_restore_state(file, ActivitySettingsKeyInsightNapSessionTime,
&s_nap_pin_state.last_triggered_utc,
sizeof(s_nap_pin_state.last_triggered_utc));
pr... | prv_push_sleep_summary_notification(now_utc, total_seconds, total_seconds, i) | ;
prv_push_sleep_summary_notification(now_utc, total_seconds - deviate_seconds,
total_seconds, i);
prv_push_sleep_summary_notification(now_utc, deviate_seconds,
total_seconds, i);
}
}
}
static void prv_test_push_rewar... |
is_connected = s_debounced_is_usb_connected,
}
};
event_put(&event);
}
static bool board_has_chg_fast() {
return BOARD_CONFIG_POWER.chg_fast.gpio != 0;
}
static bool board_has_chg_en() {
return BOARD_CONFIG_POWER.chg_en.gpio != 0;
}
// These are the guts of battery_set_charge_enable(), called when we al... | gpio_use(BOARD_CONFIG_POWER.vusb_stat.gpio) | ;
bool state = !GPIO_ReadInputDataBit(BOARD_CONFIG_POWER.vusb_stat.gpio, BOARD_CONFIG_POWER.vusb_stat.gpio_pin);
gpio_release(BOARD_CONFIG_POWER.vusb_stat.gpio);
periph_config_release_lock();
return state;
}
bool battery_is_usb_connected_impl(void) {
if (BOARD_CONFIG_POWER.has_vusb_interrupt) {
return s_... |
ct(void) {
const MusicAppSizeConfig *config = prv_config();
const int16_t cassette_x = config->horizontal_margin +
PBL_IF_RECT_ELSE(0, prv_content_width() - config->cassette_rect.size.w);
return GRect(cassette_x, config->cassette_rect.origin.y,
config->cassette_rect.size.w, config->cassette_r... | GPoint(0, -layer->bounds.size.h - offset) | |
assert_equal_s(dump[1].name, "Window2");
cl_assert_equal_p(dump[2].addr, window1);
cl_assert_equal_s(dump[2].name, "Window1");
kernel_free(dump);
}
void test_window_stack__pop_all_modals(void) {
Window *windows[NumModalPriorities];
WindowStack *window_stacks[NumModalPriorities];
for (ModalPriority idx = M... | (window_stack_count(stack), 0) | |
n, &s_workout_data, &s_workout_controller);
prv_create_window_and_render(active_window, 0);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_workout_active__workout_render_open_workout(void) {
s_workout_data = (WorkoutData) {
.steps = 0,
.duration_s = 84,
.distance_m = 0,
... | (gbitmap_pbi_eq(&s_ctx.dest_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... | (ModalPriorityAlert) | ;
}
static void prv_worker_crash_button_up_handler(ClickRecognizerRef recognizer, void *context) {
WorkerCrashDialogData *data = context;
// Push an event to launch the app for the worker that crashed
app_manager_put_launch_app_event(&(AppLaunchEventConfig) {
.id = data->app_install_id,
});
// Pop the ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | vTaskSuspend(g_task_handles[task]) | ;
}
void analytics_external_collect_stack_free(void) {
analytics_set(ANALYTICS_DEVICE_METRIC_STACK_FREE_KERNEL_MAIN,
prv_task_get_stack_free(PebbleTask_KernelMain), AnalyticsClient_System);
analytics_set(ANALYTICS_DEVICE_METRIC_STACK_FREE_KERNEL_BACKGROUND,
prv_task_get_stack_free(PebbleTask_KernelBackgrou... |
einit();
rocky_global_deinit();
}
void test_rocky_api_global__global(void) {
char test_object[] = "var t = typeof _rocky";
// global doesn't exist in plain Jerry context
EXECUTE_SCRIPT(test_object);
ASSERT_JS_GLOBAL_EQUALS_S("t", "undefined");
// rocky_global_init() injects global...
static const Rocky... | rocky_global_has_event_handlers("b") | );
prv_add_event_listener_to_list("b", jerry_create_external_function(prv_listener_b));
cl_assert_equal_b(true, rocky_global_has_event_handlers("a"));
cl_assert_equal_b(true, rocky_global_has_event_handlers("b"));
prv_add_event_listener_to_list("a", jerry_create_external_function(prv_listener_a2));
cl_asse... |
ize;
uint8_t *buffer = task_malloc(sizeof(PostMessageChunkPayload) + TINY_CHUNK_SIZE);
// Chunk 1:
{
const size_t json_bytes_size = MIN(TINY_CHUNK_SIZE, json_bytes_remaining);
const size_t expected_size = sizeof(PostMessageChunkPayload) + json_bytes_size;
PostMessageChunkPayload *chunk = (PostMessa... | prv_init_api(false /* start_connected */) | ;
fake_malloc_set_largest_free_block(0);
EXECUTE_SCRIPT_EXPECT_ERROR("_rocky.postMessage('x');",
"RangeError: Out of memory: can't postMessage() -- object too large");
}
////////////////////////////////////////////////////////////////////////////////
// Receive Tests
///////////////... |
f(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("1 MIN AGO", time_buf);
// June 9th 2015, 12:05:00 (T+00:05:00)
rtc_set_time(event_time + (5 * SECONDS_PER_MINUTE));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("5 MIN AGO", time_bu... | (event_time + (12 * SECONDS_PER_HOUR)) | ;
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("Yesterday, 12:00 PM", time_buf);
// June 10th 2015, 11:00:00 (T+23:00:00)
rtc_set_time(event_time + (23 * SECONDS_PER_HOUR));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_tim... |
1) {
wait_time++;
}
} else if (!match && ((predicate_cond == cond_to_valid) ||
(predicate_cond == cond_to_valid + 1))) {
// This predicate could become valid over time.
// If the conditional is not equal, add 1 to the wait time, because only the equals case
// becomes va... | (state->position, &endptr, 10) | ;
if (*endptr != ')') {
state->error->status = TemplateStringErrorStatus_MissingClosingParen;
return;
}
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... |
}
void test_health_detail_card__render_one_heading(void) {
HealthDetailCardConfig config = {
.num_headings = 1,
.headings = &(HealthDetailHeading) {
.primary_label = "LABEL1",
.primary_value = "value1",
.fill_color = GColorWhite,
#if PBL_BW
.outline_color = GColorBlack,
#endif
},... | window_render(&card->window, &s_ctx) | ;
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_health_detail_card__render_crown(void) {
HealthDetailZone zones[] = DEFAULT_ZONES;
zones[1].show_crown = true;
HealthDetailCardConfig config = {
.num_headings = 1,
.headings = &(HealthDetailHeading) {
.primary_label = "L... |
animation_destroy(seq) | ;
prv_clear_handler_histories();
uint64_t start_ms = prv_now_ms();
animation_schedule(clone);
// Start A
prv_advance_to_ms_with_timers(start_ms + 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NU... | |
/*
* 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... | (dialog, &GRect(x, y, w, h)) | ;
}
x = left_margin_px;
w = bounds->size.w - left_margin_px - right_margin_px;
GTextAttributes *text_attributes = NULL;
#if PBL_ROUND
// Create a GTextAttributes for the TextLayer. Note that the matching
// graphics_text_attributes_destroy() will not need to be called here, as the ownership
// of text_a... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(PEBBLE_CALLBACK_EVENT, e->type) | ;
// Use fake_system_task as mock implementation:
system_task_add_callback(e->callback.callback, e->callback.data);
return true;
}
static void prv_process_events(void) {
fake_system_task_callbacks_invoke_pending();
}
static AppInbox *s_app_message_inbox;
AppInbox **app_state_get_app_message_inbox(void) {
r... |
// We are disabling DMA reads when running under QEMU for now because they are not reliable.
const uint32_t num_reads_dma_cutoff = buffer_size + 1;
#endif
if (buffer_size < num_reads_dma_cutoff) {
while (buffer_size--) {
*buffer = flash_read_next_byte();
buffer++;
}
} else {
enable_flash... | flash_wait_for_write() | ;
flash_prf_set_protection(true);
disable_flash_spi_clock();
power_tracking_stop(PowerSystemFlashErase);
flash_unlock();
}
#endif
void flash_sleep_when_idle(bool enable) {
if (enable == s_flash_state.sleep_when_idle) {
return;
}
flash_lock();
if (!s_flash_state.enabled) {
flash_unlock();
... |
, "entry minute: %d", (int)(value / SECONDS_PER_MINUTE));
activity_get_metric(ActivityMetricSleepExitAtSeconds, 1, &value);
PBL_LOG(LOG_LEVEL_DEBUG, "exit minute: %d", (int)(value / SECONDS_PER_MINUTE));
activity_get_metric(ActivityMetricSleepState, 1, &value);
PBL_LOG(LOG_LEVEL_DEBUG, "sleep state: %d", (int... | rtc_set_time(next_nap_time) | ;
}
time_t test_start_utc = rtc_get_time();
PBL_LOG(LOG_LEVEL_DEBUG, "test start time changed to: %d", (int)test_start_utc);
// Reset all stored data
activity_test_reset(false /* reset_settings */, true /*tracking_on*/, NULL, NULL);
// Walk a little first
prv_feed_steps_min(15);
// Sleep for 100 min... |
FIXME:
break;
case BtPersistBondingOpDidChange:
*intent->bonding = updated_bonding;
break;
case BtPersistBondingOpWillDelete:
for (GAPLEClient c = GAPLEClientKernel; c < GAPLEClientNum; ++c) {
if (!intent->client[c].is_used) {
continue;
}
prv_unregister_... | while (intent) {
GAPLEConnectionIntent *next = (GAPLEConnectionIntent *) intent->node.next;
prv_unregister_intent(intent, client, false /* should_send_disconnection_event */,
GAPLEConnectHCIReasonExtensionCancelConnect);
intent = next;
} | |
/*
* 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... | (processed_command, fill_color, tinted_fill_color) | ;
gdraw_command_set_fill_color(processed_command, tinted_fill_color);
// Luminance tint the stroke color
const GColor stroke_color = gdraw_command_get_stroke_color(processed_command);
const GColor tinted_stroke_color =
gcolor_perform_lookup_using_color_luminance_and_multiply_alpha(stroke_color,
... |
-176, -968},
{ 120, -160, -968},
{ 128, -160, -984},
{ 136, -152, -960},
{ 128, -160, -976},
{ 128, -168, -968},
{ 136, -152, -984},
{ 128, -168, -968},
{ 136, -168, -976},
{ 128, -136, -992},
{ 136, -184, -960},
{ 144, -216, -960},
{ 112, -216, -968},
{ 128, -216, -9... | { 120, -208, -968},
{ 136, -216, -960},
{ 120, -200, -968},
{ 136, -208, -960},
{ 144, -216, -976},
{ 112, -216, -960},
{ 144, -224, -968},
{ 120, -232, -968},
{ 152, -208, -960},
{ 128, -200, -960},
{ 120, -240, -968},
{ 144, -240, -960},
{ 128, -216, -968},
{ 14... |
{ 120, -248, -960},
{ 128, -256, -960},
{ 120, -240, -968},
{ 128, -256, -960},
{ 120, -248, -968},
{ 128, -248, -960},
{ 128, -240, -968},
{ 112, -264, -960},
{ 128, -248, -968},
{ 136, -232, -968},
{ 120, -256, -960},
{ 120, -256, -960},
{ 120, -248, -968},
{ 1... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (entry->val, val, val_len) | ;
entry->key_len = key_len;
entry->val_len = val_len;
entry->flags |= RamStorageFlagDirty;
// Add to list
storage->entries = (RamStorageEntry *)list_prepend((ListNode *)storage->entries, &entry->node);
return 0;
}
int ram_storage_get_len(RamStorage *storage, const uint8_t *key, int key_len) {
RamStorage... |
icense.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implie... | (attr2->data, &data1[offset]) | ;
attr1 = generic_attribute_find_attribute(attr_list2, VEAttributeIdAppUuid, sizeof(data2));
cl_assert(attr1);
cl_assert_equal_i(attr1->id, VEAttributeIdAppUuid);
cl_assert_equal_i(attr1->length, 16);
offset = sizeof(GenericAttributeList) + sizeof(GenericAttribute);
cl_assert_equal_p(attr1->data, &data2[of... |
nse for the specific language governing permissions and
* limitations under the License.
*/
#include "recognizer.h"
#include "recognizer_impl.h"
#include "recognizer_list.h"
#include "recognizer_manager.h"
#include "recognizer_private.h"
#include "applib/applib_malloc.auto.h"
#include "applib/ui/layer.h"
#include "... | {
return NULL;
} |
return recognizer->impl_data;
}
void recognizer_transition_state(Recognizer *recognizer, RecognizerState new_state) {
PBL_ASSERTN(recognizer);
PBL_ASSERTN(new_state < RecognizerStateCount);
PBL_ASSERTN(new_state != RecognizerState_Possible);
prv_set_state(recognizer, new_state);
if (new_state != Recogniz... |
/*
* 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(dev, true /* is_open_drain */, UARTCR1Flags_Duplex);
} |
void uart_init_tx_only(UARTDevice *dev) {
prv_init(dev, false /* !is_open_drain */, UARTCR1Flags_TE);
}
void uart_init_rx_only(UARTDevice *dev) {
prv_init(dev, false /* !is_open_drain */, UARTCR1Flags_RE);
}
void uart_deinit(UARTDevice *dev) {
dev->periph->CR1 &= ~USART_CR1_UE;
periph_config_disable(dev->pe... |
ak;
}
}
if (button_state == 0) {
// We made it through with all the buttons released. We're good.
return;
}
// Alright, so either the button is held down or we hit a bounce. Wait
// for all the buttons to release again.
// 100000 is about a second in practice
for (int i =... | {
// stop waiting if not held down any longer and go back to sleep
return false;
} |
}
return true;
}
void leave_standby_mode(void) {
// Speed up the RTC so the firmware doesn't need to deal with it
rtc_speed_up();
}
|
8g range, as required for the self test mode
prv_set_accel_scale(BMI160_SCALE_8G);
// Set ODR to 1600Hz
accel_set_sampling_interval(BMI160SampleRate_1600_HZ);
prv_accel_enable_undersampling(false);
PBL_LOG(LOG_LEVEL_DEBUG, "Self Test: Negative offset");
// Enable self test with high amplitude in the neg... | bmi160_read_reg(BMI160_REG_ACC_CONF) | );
}
void bmi160_set_gyro_power_mode(BMI160GyroPowerMode mode) {
int retries = 20;
prv_run_command(BMI160_CMD_GYR_SET_PMU_MODE | mode);
while (retries--) {
uint8_t status = 0;
// can take up to 80ms to power up
status = bmi160_read_reg(BMI160_REG_PMU_STATUS) >> 2;
if (status == mode) {
brea... |
EVEN, GColorBlack, GColorBlack, false);
graphics_draw_circle(&context, GPoint(50, 50), 10);
ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_EVEN));
setup_test(&context, false, SW_EVEN, GColorBlack, GColorBlack, false);
graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10)... | prv_draw_round_rect_aa_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_EVEN) | );
#else
ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_EVEN));
#endif
}
void test_graphics_context_${BIT_DEPTH_NAME}__draw_antialiased_stroke_width_odd(void) {
// Stroke width odd > 1, antialiased
setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, false);
graphics_... |
ther the value is incrementing or
// decrementing over time.
PredicateCondition cond_to_expire;
PredicateCondition cond_to_valid;
if (!state->time_was_until) {
// Value increments over time, so a < will expire and a > will become valid.
cond_to_expire = PredicateCondition_L;
cond_to_valid = Predicat... | {
bool match;
bool previously_matched = false;
bool did_output = false;
// We need to iterate all the way through for finding the proper 'next' time.
while (*state->position != ')') {
match = prv_format_predicate(state, previously_matched);
if (state->error->status != TemplateStringErrorStatus_Succes... |
// format() must be the last filter, and ends the sequence.
state->filters_complete = true;
}
static void prv_filter_time_until(TemplateStringState *state) {
char *endptr;
time_t target_time = strtol(state->position, &endptr, 10);
if (*endptr != ')') {
state->error->status = TemplateStringErrorStatus_Mi... |
{
s_hrm_subscribed = true;
s_hrm_expiration = expire_s;
return 1;
}
bool sys_hrm_manager_unsubscribe(HRMSessionRef ref) {
s_hrm_subscribed = false;
s_hrm_expiration = 0;
return true;
}
uint32_t time_get_uptime_seconds(void) {
return SECONDS_PER_DAY + rtc_get_time();
}
static uint32_t s_total_step_coun... | (&steps, &duration_s, &distance_m,
&bpm, &hr_zone) | );
cl_assert_equal_i(steps, 1800);
cl_assert_equal_i(6800, s_total_step_count);
cl_assert_equal_i(distance_m, 2402 /* 2.4km in 10 mins is reasonable */);
cl_assert_equal_i(duration_s, 10 * SECONDS_PER_MINUTE);
// Get some more HR info
prv_inc_time(10);
prv_put_bpm_event(180, HRMQuality_Good);
cl_assert... |
reenable this: - PBL-16509
#if SCREEN_COLOR_DEPTH_BITS == 8
// SW = 4
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 4);
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw4_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_... | (&ctx, 1, 0, 0) | ;
prv_draw_rects(&ctx, 2, CLIP_OFFSET, 0);
prv_draw_rects(&ctx, 3, 2 * CLIP_OFFSET, 0);
prv_draw_rects(&ctx, 4, 3 * CLIP_OFFSET, 0);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_clip_rect.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1);
prv_dra... |
/*
* 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... | (&PWR->CR1, PWR_CR1_FPDS, __ATOMIC_RELAXED) | |
include "launcher_app_message.h"
#include "kernel/event_loop.h"
#include "kernel/pbl_malloc.h"
#include "process_management/app_install_manager.h"
#include "process_management/app_manager.h"
#include "process_management/process_manager.h"
#include "services/common/system_task.h"
#include "system/logging.h"
#include "u... | (&msg->uuid) | ? NULL : &msg->uuid);
}
void app_run_state_send_update(const Uuid *uuid, AppState app_state) {
#ifdef RECOVERY_FW
// FIXME: Need to actually factor out this so it's totally removed from PRF, but for now just
// pull it all. We can't use this here because we don't initialize app message at all.
return;
#endif
... |
prv_lock() | ) {
return 0;
}
time_t rv = kalg_activity_last_processed_time(s_alg_state->k_state, KAlgActivityType_Sleep);
prv_unlock();
return rv;
}
// ------------------------------------------------------------------------------------
// Post-process the passed in sleep sessions. This function identifies which sleep... | |
s->transfer.result;
if (!result) {
PBL_LOG(LOG_LEVEL_ERROR, "I2C Error on bus %" PRId8, bus_idx);
}
} else if (bus->transfer.nack_count < I2C_NACK_COUNT_MAX) {
// NACK received after start condition sent: the MFI chip NACKs start conditions whilst it is busy
// Retry sta... | {
// Disable interrupts if spurious interrupt received
bus->i2c->CR2 &= ~(I2C_CR2_ITEVTEN | I2C_CR2_ITBUFEN);
return pdFALSE;
} |
// Check that the expected event occurred
if (I2C_CheckEvent(bus->i2c, s_guard_events[bus->transfer.state]) == ERROR) {
// Ignore interrupt - A spurious byte transmitted event as well as an interrupt with no
// discernible event associated with it occur after repeat start events are generated
return p... |
urce_end_offset) {
// overflow
PBL_LOG(LOG_LEVEL_ERROR, "Overflow while validating resource");
return 0;
}
// Make sure the store's calculated length is not past the end of the store.
if (prv_get_length(entry) < store_length) {
return 0;
}
// Return the length of the store's resource data
... | if (!prv_get_manifest_by_id(app_num, resource_id, &manifest)) {
return 0;
} |
return manifest.num_resources;
}
// if resource_id == 0 then check all of resource storage, else just validate
// that the resource requested is valid
bool resource_storage_check(ResAppNum app_num, uint32_t resource_id,
const ResourceVersion *expected_version) {
ResourceStoreEntry entr... |
(uint8_t*)&id, sizeof(id));
return (bytes_read == sizeof(id)) ? id : (uint32_t)RESOURCE_ID_INVALID;
}
static uint32_t prv_get_sys_resource_id(TimelineResourceId timeline_id, TimelineResourceSize size) {
timeline_id &= ~SYSTEM_RESOURCE_FLAG;
if (timeline_id >= NUM_TIMELINE_RESOURCES) {
... | syscall_assert_userspace_buffer(timeline_res, sizeof(*timeline_res)) | ;
syscall_assert_userspace_buffer(res_info, sizeof(*res_info));
}
if (!timeline_res || !res_info || (size >= TimelineResourceSizeCount)) {
if (res_info) {
*res_info = (AppResourceInfo) {0};
}
return;
}
timeline_resources_get_id(timeline_res, size, res_info);
}
|
;
}
if (!prv_item_init(item, num_attributes, num_actions, attributes_per_action,
*string_alloc_size, string_buffer)) {
return false;
}
return true;
}
TimelineItem *timeline_item_create_with_attributes(time_t timestamp, uint16_t duration,
TimelineIt... | PBL_ASSERTN(item != NULL) | ;
PBL_ASSERTN(header != NULL);
item->header = header->common;
item->attr_list.num_attributes = header->num_attributes;
item->action_group.num_actions = header->num_actions;
item->header.timestamp = timeline_item_get_tz_timestamp(&item->header);
}
time_t timeline_item_get_tz_timestamp(CommonTimelineItemHead... |
f (!response) {
event_blob.canned_response.response_size_bytes = 0;
} else {
event_blob.canned_response.response_size_bytes = strlen(response);
}
if (successfully_sent) {
ANALYTICS_LOG_DEBUG("canned response sent event: response_size_bytes:%d",
event_blob.canned_response.respo... | ANALYTICS_LOG_DEBUG("Event %d - BT disconnection: Reason: %"PRIu8, event_blob.event,
event_blob.bt_connection_disconnection.reason) | ;
analytics_logging_log_event(&event_blob);
}
// ------------------------------------------------------------------------------------------
// Log a bluetooth error
void analytics_event_bt_error(AnalyticsEvent type, uint32_t error) {
AnalyticsEventBlob event_blob = {};
event_blob.event = type,
event_blob.bt_... |
||
mode == BMA255PowerMode_Standby);
// Workaround for entering Normal Mode
// LPM1 => Normal requires us to go through Suspend mode
// LPM2 => Normal requires us to go through Standby mode
if (mode == BMA255PowerMode_Normal) {
if (s_accel_power_mode == BMA255PowerMode_LowPower1) {
prv_... | bma255_read_modify_write(BMA255Register_PMU_LPW,
tsleep << BMA255_LPW_SLEEP_DUR_SHIFT,
BMA255_LPW_SLEEP_DUR_MASK) | |
ries(&s_setup_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, inner_seq), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0);
cl_assert_equal_i(prv_count_han... | (prv_count_handler_entries(&s_stopped_handler_calls, b), 0) | |
onnection_update_address(connection, &e.new_device);
hc_endpoint_gap_le_connect_send_address_and_irk_changed(&e);
}
static void prv_handle_pairing_completed(const ble_evt_gap_pair_completed_t *evt) {
PBL_LOG(LOG_LEVEL_INFO, "Pairing completed. Bond=%u, MITM=%u, status=0x%"PRIx8,
evt->bond, evt->mitm, ev... | (&dev_params->irk, &config->root_keys[SMRootKeyTypeIdentity], sizeof(dev_params->irk)) | ;
ble_mgr_dev_params_release();
}
static void prv_handle_get_peer_version_complete(const ble_evt_gap_get_peer_version_t *evt) {
Connection *conn = connection_by_idx_check(evt->conn_idx);
BTDeviceInternal addr;
connection_get_address(conn, &addr);
BleRemoteVersionInfoReceivedEvent event = {
.peer_addres... |
_data, sizeof(*out_cb_data));
}
mutex_lock(s_mutex);
EventedTimer *timer = prv_find_timer(timer_id);
// It's possible that the client made a call to delete the timer just
// after the timer executed (from the timer task) and posted the PEBBLE_CALLBACK_EVENT
// to the client's event queue. In this case, ... | (timeout_ms, false, callback, data) | ;
}
EventedTimerID evented_timer_register(uint32_t timeout_ms,
bool repeating,
EventedTimerCallback callback,
void* data) {
PebbleTask current_task = pebble_task_get_current();
PBL_ASSERT(current_task ... |
/*
* 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... | delay_us(100) | ;
display_write_byte(cmd);
}
static void prv_send_command_arg(uint8_t arg) {
display_write_byte(arg);
}
static void prv_end_command(void) {
while (SPI_I2S_GetFlagStatus(DISP_SPI, SPI_I2S_FLAG_BSY)) continue;
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET);
}
static bool prv_wait_busy(void) {
// The display... |
t positive_attr_list = {0};
attribute_list_add_cstring(&positive_attr_list, AttributeIdTitle,
i18n_get(notif_config->text_positive_action, ¬if_attr_list));
attribute_list_add_cstring(&positive_attr_list, AttributeIdBody,
i18n_get(notif_config->text_positi... | ("Open App", i18n_owner) | |
/*
* 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... | decode_start(6) | ;
assert_decode_succeeds(vector, sizeof(vector));
assert_decode_completed(6);
assert_output_equal("\0A\0\0B\0", 6);
}
void test_cobs_decode__max_length_block(void) {
decode_start(254);
assert_decode_char_succeeds(0xff);
for (int c = 0x01; c <= 0xfe; ++c) {
assert_decode_char_succeeds(c);
}
assert_d... |
tate();
return;
}
ReliablePacket *packet = raw_packet;
if (packet->is_supervisory) {
if (packet->s.kind != SupervisoryKind_ReceiveReady &&
packet->s.kind != SupervisoryKind_Reject) {
PBL_LOG(LOG_LEVEL_DEBUG, "Received a command packet of type %" PRIu8
" which is not supported ... | prv_send_info_packet(retransmit_sequence_number,
s_tx_buffer->app_protocol,
&s_tx_buffer->information[0],
s_tx_buffer->length) | ;
prv_start_retransmit_timer(retransmit_sequence_number);
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Reached maximum number of retransmit attempts.");
prv_bounce_ncp_state();
}
}
static void prv_start_retransmit_timer(uint8_t sequence_number) {
pulse2_reliable_retransmit_timer_start(
RETRANSMIT_TIMEOUT... |
{ 872, 264, -64},
{ 928, 288, -176},
{ 1184, 280, -160},
{ 1272, 160, -96},
{ 1848, 80, 48},
{ 1376, 312, 16},
{ 992, 248, 32},
{ 1096, 152, 56},
{ 1160, 24, 168},
{ 944, 56, 152},
{ 808, 56, 104},
{ 768, 24, 72},
{ 760, -8, 80},
{ 792, -8, 96},
{ 832, -48, 48}... | { 712, -64, 88},
{ 768, -80, 96},
{ 936, -120, 96},
{ 1152, -64, 48},
{ 1312, -144, 48},
{ 1472, -160, 144},
{ 1168, 136, -40},
{ 1056, 152, -184},
{ 976, 120, -64},
{ 720, 48, 40},
{ 704, 64, 80},
{ 800, 152, 88},
{ 912, 200, 96},
{ 928, 264, 40},
{ 936, 304,... |
// 50 seconds
{ 1696, 136, 168},
{ 1640, 424, 200},
{ 1256, 224, 152},
{ 1120, 80, 168},
{ 1208, 0, 208},
{ 984, -32, 264},
{ 816, 0, 200},
{ 792, -24, 184},
{ 776, -40, 168},
{ 808, -80, 152},
{ 944, -56, 64},
{ 976, -224, 192},
{ 1048, -112, 56},
{ 1088, -2... |
unless we're stable and discharging but the % went up.
if (!charging && likely_stable &&
new_charge_percent > s_last_battery_state.percent) {
// It's okay to return early since any connection/plugged changes will reset the filter,
// so we won't catch those.
return;
}
#endif
s_last_battery_sta... | {
return s_periodic_timer_id;
} | |
// Total size
0x00, // AppGlanceSliceType - AppGlanceSliceType_IconAndSubtitle
0x01, // Number of attributes
// Slice Attributes
0x25, // Attribute ID - AttributeIdTimestamp
0x04, 0x00, // Attribute Length
// Slice expirat... | {
const size_t glance_size = sizeof(s_app_glance_basic);
cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE,
(uint8_t *)&s_app_glance_basic, glance_size),
S_SUCCESS);
cl_assert_equal_i(app_glance_db_get_len((uint8_t *)&A... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | pwm->timer.init(pwm->timer.peripheral, &tim_oc_init) | |
/*
* 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_equal_i(metric, ANALYTICS_APP_METRIC_MEM_ROCKY_RECURSIVE_MEMORYPRESSURE_EVENT_COUNT);
++s_sys_analytics_inc_call_count;
} |
static const RockyGlobalAPI *s_api[] = {
&MEMORY_APIS,
NULL,
};
static bool s_skip_pbl_malloc_check;
#define assert_oom_app_fault() \
cl_assert_equal_i(s_app_heap_analytics_log_rocky_heap_oom_fault_call_count, 1)
#define assert_no_oom_app_fault() \
cl_assert_equal_i(s_app_heap_analytics_log_rocky_heap_oom_... |
in_from, direction);
Animation *animation = animation_spawn_create_from_array(animations, num_animations);
return animation;
}
void timeline_layer_set_layouts_hidden(TimelineLayer *layer, bool hidden) {
for (int i = 0; i < TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER; i++) {
TimelineLayout *layout = layer->layouts[... | for (int i = 0; i < TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER; i++) {
if (layer->layouts[i]) {
prv_destroy_layout(layer, i);
}
} |
peek_layer_deinit(&layer->day_separator);
kino_layer_deinit(&layer->end_of_timeline);
// TODO: PBL-21982: Only support rectangular screen for now
#if PBL_RECT
timeline_relbar_layer_deinit(layer);
#endif
}
|
/*
* 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_resource_storage_get_num_entries__result = 15;
cl_assert_equal_b(false, rocky_app_has_compatible_bytecode_res(123));
} |
void test_rocky_res__valid_snapshot(void) {
s_resource_storage_get_num_entries__result = 25;
cl_assert_equal_b(true, rocky_app_has_compatible_bytecode_res(123));
}
|
gle 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 writing, software
* d... | {
prv_check_whoami(dev);
} |
qspi_release(dev->qspi);
}
status_t qspi_flash_is_erase_complete(QSPIFlash *dev) {
qspi_use(dev->qspi);
uint8_t status_reg;
uint8_t flag_status_reg;
prv_read_register(dev, dev->state->part->instructions.read_status, &status_reg, 1);
prv_read_register(dev, dev->state->part->instructions.read_flag_status,... |
ices/normal/activity/health_util.h"
#include "services/normal/activity/workout_service.h"
#include "system/logging.h"
#include <stdio.h>
// Workout app versions
// 0: Invalid (app was never opened)
// 1: Initial version
#define CURRENT_WORKOUT_APP_VERSION 1
typedef struct WorkoutAppData {
WorkoutSummaryWindow *sum... | workout_dialog_set_click_config_provider(workout_dialog,
prv_detected_workout_click_config_provider) | ;
workout_dialog_set_click_config_context(workout_dialog, data);
i18n_free_all(workout_dialog);
app_workout_dialog_push(workout_dialog);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//! Workout Ended
static void prv_show_workout_ended_dialog(WorkoutApp... |
e "applib/app.h"
#include "applib/event_service_client.h"
#include "applib/graphics/gtypes.h"
#include "applib/ui/app_window_stack.h"
#include "applib/ui/bitmap_layer.h"
#include "applib/ui/kino/kino_layer.h"
#include "applib/ui/kino/kino_reel.h"
#include "applib/ui/layer.h"
#include "applib/ui/text_layer.h"
#include "... | window_raw_click_subscribe(BUTTON_ID_SELECT, prv_raw_down_handler, prv_raw_up_handler, NULL) | ;
window_raw_click_subscribe(BUTTON_ID_DOWN, prv_raw_down_handler, prv_raw_up_handler, NULL);
}
////////////////////////////////////////////////////////////
// Windows
static void prv_update_background_image_and_url_text(RecoveryFUAppData *data) {
uint32_t icon_res_id;
const char *url_string;
GColor backgroun... |
ge context
app_message_close();
// Make fake remote send the ack if something has been sent (not expected)
prv_process_sent_data();
// Test that timer has been invalidated
cl_assert_equal_b(!fake_app_timer_is_scheduled(app_message_ack_timer_id()), true);
cl_assert_equal_b(s_ack_sent_is_called, false);
... | app_message_open(0, MAX_SIZE_OUTBOUND) | , APP_MSG_OK);
cl_assert_equal_b(app_message_is_closed_inbound(), true);
cl_assert_equal_b(app_message_is_closed_outbound(), false);
}
void test_app_message__zero_outbox(void) {
app_message_close();
cl_assert_equal_i(app_message_open(MAX_SIZE_INBOUND, 0), APP_MSG_OK);
cl_assert_equal_b(app_message_is_closed_... |
&s_items[0].header.id));
cl_assert(!iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id));
cl_assert(state.node);
}
void test_timeline__none_forwards(void) {
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl... | iter_next(&iterator) | );
#endif
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[1].header.id));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[0].header.id));
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[1].header.id));
#if !CAPABIL... |
rect_origin_r4_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 4);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw4_clip_nxny.${BIT_DEPTH_NAME... | gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax2_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi") | |
== 8
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"));
#endif
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 11);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
// TODO: Fix offset calculation ... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 4);
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_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
#endif
// SW = 5
setup_test_aa_sw(&c... |
s_stopped_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0);
// Just before A completes
prv_advance_to_m... | prv_count_handler_entries(&s_teardown_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 a sequence within a sequence where the imbedded one... |
t char *message;
switch (data->result) {
case AppFetchResultNoBluetooth:
icon = TIMELINE_RESOURCE_WATCH_DISCONNECTED;
message = i18n_get("Not connected", data);
// Subscribe to the BT remote app connect event
data->connect_event_info = (EventServiceInfo) {
.type = PEBBLE_COMM_SESSI... | if (af_event->type == AppFetchEventTypeStart) {
PBL_LOG(LOG_LEVEL_DEBUG, "App Fetch: Got the start event");
// We have received a new progress event
} else if (af_event->type == AppFetchEventTypeProgress) {
progress_window_set_progress(&data->window, af_event->progress_percent);
// We have finished the ... |
}
// TODO: Use appropriate transitions to and from watchfaces or apps
static void prv_click_handler(ClickRecognizerRef recognizer, Window *window) {
AppFetchUIData *data = app_state_get_user_data();
if (data->failed) {
app_window_stack_pop(true);
} else {
app_fetch_cancel(data->install_entry.install_id)... |
rocessor, ctx, &bitmap_to_draw, &rect);
}
// Bail out early if the bitmap to draw is NULL
if (!bitmap_to_draw) {
// Set rect to GRectZero so the processor's .post function knows that nothing was drawn
rect = GRectZero;
goto call_processor_post_function_and_return;
}
// TODO PBL-35694: what if sr... | {
graphics_draw_bitmap_in_rect(
ctx, src, &(GRect){ .origin = { dest_ic.x - src_ic.x, dest_ic.y - src_ic.y },
.size = src->bounds.size });
return;
} | |
l_assert_equal_i(ProcessTypeWatchface, tictoc_md->process_type);
cl_assert_equal_i(ProcessStorageBuiltin, tictoc_md->process_storage);
app_install_release_md(tictoc_md);
const PebbleProcessMd *music_md = app_install_get_md(music_id, false);
cl_assert(music_md != NULL);
cl_assert_equal_b(false, music_md->has_... | app_install_mark_prioritized(music_id, true /* can_expire */) | ;
cl_assert_equal_b(true, app_install_is_prioritized(music_id));
// Wait 10 minutes. Should return false
fake_rtc_increment_time(10 * SECONDS_PER_MINUTE);
cl_assert_equal_b(false, app_install_is_prioritized(music_id));
// Update with most recent time but don't let it expire
app_install_mark_prioritized(mu... |
ursday_00_00);
do_not_disturb_handle_clock_change();
active = do_not_disturb_is_active();
cl_assert(active == true);
// Timer will go off at 07:00 on Thursday. (7.0 hours)
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 25200 * MS_PER_SECOND);
// Check that there is a timer scheduled
cl_ass... | do_not_disturb_is_active() | |
--------------------------------------------
void *animation_get_context(Animation *animation_h) {
if (animation_private_using_legacy_2(NULL)) {
// We need to enable other applib modules like scroll_layer, menu_layer, etc. which are
// compiled to use the 3.0 animation API to work with 2.0 apps.
return ((... | prv_get_total_duration(state, animation, include_delay, include_play_count) | ;
}
// -------------------------------------------------------------------------------------------
bool animation_set_curve(Animation *animation_h, AnimationCurve curve) {
AnimationState *state = prv_animation_state_get(PebbleTask_Current);
if (animation_private_using_legacy_2(state)) {
// We need to enable o... |
don't trigger as soon as we're awake
s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateAwake;
s_data.metric_history[ActivityMetricSleepStateSeconds][0] = 1 * SECONDS_PER_HOUR;
activity_insights_process_sleep_data(rtc_get_time());
cl_assert_equal_i(fake_kernel_services_notifications_ancs_no... | (&s_data.metric_history[ActivityMetricStepCount], &step_history, sizeof(step_history)) | ;
}
void prv_set_sleep_history_avg() {
const ActivityScalarStore AVERAGE_SLEEP = 5 * MINUTES_PER_HOUR;
static const int32_t sleep_history[ACTIVITY_HISTORY_DAYS] = {
AVERAGE_SLEEP, // This is 'today'
AVERAGE_SLEEP, // Average sleep to make sure our median is fairly low
AVERAGE_SLEEP,
AVERAGE_SLEE... |
Variants;
// -----------------------------------------------------------------------------------------
// Globals
typedef struct InsightStateCommon {
bool history_valid; // True if history requirements were met for the associated reward
time_t last_triggered_utc; // Last time reward was triggered, saved to ... | ("Congratulations - you're having a super active day! Activity "
"makes you more focused and creative. How do you feel?") | |
o this is a no-op
snprintf(dstbuf, 256, "You know Bagu? % s", "Then I can let you cross");
cl_assert_equal_s(dstbuf, "You know Bagu? Then I can let you cross");
// Plus for positive signed
// No signed conversion occurs, so this is a no-op
snprintf(dstbuf, 256, "You know Bagu? %+s", "Then I can let you cross... | cl_assert_equal_i(hhntest[3], 0);
hntest[0] = hntest[1] = 0;
snprintf(dstbuf, 512, "aaaa aaaa aaaa aaaa " // 0- 20
"aaaa aaaa aaaa aaaa " // 20- 40
"aaaa aaaa aaaa aaaa " // 40- 60
"aaaa aaaa aaaa aaaa " // 60- 80
"a... |
"aaaa aaaa aaaa aaaa " //160-180
"aaaa aaaa aaaa aaaa " //180-200
"aaaa aaaa aaaa aaaa " //200-220
"aaaa aaaa aaaa aaaa " //220-240
"aaaa aaaa aaaa aaaa " //240-260
"aaaa aaaa... |
/*
* 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... | RTC_ReadBackupRegister(REBOOT_REASON_STUCK_TASK_PC) | ;
raw[3] = RTC_ReadBackupRegister(REBOOT_REASON_STUCK_TASK_LR);
raw[4] = RTC_ReadBackupRegister(REBOOT_REASON_STUCK_TASK_CALLBACK);
raw[5] = RTC_ReadBackupRegister(REBOOT_REASON_DROPPED_EVENT);
}
void reboot_reason_clear(void) {
RTC_WriteBackupRegister(REBOOT_REASON_REGISTER_1, 0);
RTC_WriteBackupRegister(RE... |
property_animation->values.from.gpoint.y,
property_animation->values.to.gpoint.y);
((PropertyAnimationImplementation*)
property_animation->animation.implementation)
->accessors.setter.gpoint(property_animation->subject, result);
}
// ----------------------------... | (!animation_private_using_legacy_2(NULL)) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return (GColor) {.argb = s_weather_type_text_colors[prv_get_array_index_of_type(weather_type)]};
} | ;
TimelineResourceId weather_type_get_timeline_resource_id(WeatherType weather_type) {
return s_weather_type_timeline_resource_ids[prv_get_array_index_of_type(weather_type)];
};
|
/*
* 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... | (result, 3) | ;
}
void test_stats__median(void) {
const int32_t data[] = { 10, 40, 6, 32, 73, 80, 34, 25, 62 };
const size_t num_data = ARRAY_LENGTH(data);
const StatsBasicOp op = StatsBasicOp_Median;
int32_t result;
stats_calculate_basic(op, data, num_data, NULL, NULL, &result);
cl_assert_equal_i(result, 34);
}
void t... |
/*
* 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_information_service_register(DEVICE_INFORMATION_SERVICE_EXPECTED_ATT_STARTING_HANDLE) | ;
pebble_pairing_service_register(PEBBLE_PAIRING_SERVICE_EXPECTED_ATT_STARTING_HANDLE);
hrm_service_register(HRM_SERVICE_EXPECTED_ATT_STARTING_HANDLE);
ppogatt_service_register(PEBBLE_PPOGATT_SERVICE_EXPECTED_ATT_STARTING_HANDLE);
s_has_registered = true;
}
//! @note this will be called multiple times!
void g... |
/*
* 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... | (".rocky_bss") | T_STATIC size_t s_rocky_path_steps_num;
void rocky_api_graphics_path2d_reset_state(void) {
s_rocky_path_steps_num = 0;
task_free(s_rocky_path_steps);
s_rocky_path_steps = NULL;
s_rocky_path_steps_array_len = 0;
}
JERRY_FUNCTION(prv_begin_path) {
rocky_api_graphics_path2d_reset_state();
return jerry_crea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.