prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
ck_pop_all(true);
}
static const char *prv_get_dialog_text(ProgressUIData *data, bool success) {
if (data->progress_source == PROGRESS_UI_SOURCE_FW_UPDATE) {
return success ? i18n_get("Update Complete", data) : i18n_get("Update Failed", data);
} else {
return "";
}
}
static void prv_handle_finished(Prog... | dialog_set_destroy_on_pop(&data->finished_dialog.dialog, false) | ;
const int16_t load_bar_length = 108;
const int16_t x_offset = (window->layer.bounds.size.w - load_bar_length) / 2;
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
const int16_t y_offset_progress = 123;
const int16_t y_offset_text = 85;
#else
const int16_t y_offset_progress = PBL_IF_RECT_ELSE(93, 99);
const int1... |
// For the second half of the animation where the app is the destination, draw the "expand to
// app" frame and fill its inner ring with the app's frame buffer
// Switch to the "expand to app" animation if necessary
if (!s_data.expanding) {
prv_modal_transition_animation_init_sequence(MODAL_EXPAND_TO_... | {
if (s_data.animation_sequence) {
gdraw_command_sequence_destroy(s_data.animation_sequence);
s_data.animation_sequence = NULL;
}
} |
const CompositorTransition *prv_modal_transition_get_rect(bool modal_is_destination) {
// NOTE: This initialization will set .expanding to false so we default to contracting to a dot
s_data = (CompositorModalTransitionData) {
.modal_is_destination = modal_is_destination,
// TODO: PBL-19849
// Decide o... |
fo *icon_info;
KinoLayer *icon_layer;
int index;
} MetricContext;
static GTextNode *prv_metric_constructor(
const LayoutLayer *layout, const LayoutNodeConstructorConfig *config) {
MetricContext *context = config->context;
const int icon_offset_x = PBL_IF_RECT_ELSE(-2, 0);
const int icon_offset_y = PBL_IF... | ((const TimelineLayout *)layout) | ->node;
graphics_text_node_container_add_child(&vertical_node->container, page_break);
}
#endif
}
GTextNodeVertical *layout_create_metrics_node(const LayoutLayer *layout_ref) {
// TODO: Remove TimelineLayout requirement
TimelineLayout *layout = (TimelineLayout *)layout_ref;
if (layout->metric_icon_layers) ... |
64, -16},
{ 1192, 728, -120},
{ 1576, 664, -24},
{ 1656, 472, -72},
{ 1496, 360, -160},
{ 1520, 392, -224},
{ 1672, 376, -104},
{ 1656, 240, -152},
{ 1496, 200, -224},
{ 1360, 104, -216},
{ 768, -768, 16},
{ 1048, -312, 0},
{ 848, -152, -392},
{ 1104, 48, -256},
{... | { 1296, 288, -328},
{ 1112, 112, -288},
{ 1112, 264, -192},
{ 1320, 416, -88},
{ 1616, 744, -128},
{ 1448, 872, -24},
{ 1200, 960, -104},
{ 952, 936, -40},
{ 712, 992, -32},
{ 968, 1000, -16},
{ 968, 736, -16},
{ 1120, 800, -32},
{ 1440, 720, -88},
// 63 seconds
... |
{ 1448, 296, -120},
{ 1384, 264, -80},
{ 1368, 208, -80},
{ 1328, 168, -16},
{ 1128, 200, -48},
{ 744, -144, 56},
{ 792, -304, 96},
{ 752, -312, -152},
{ 1128, 144, -360},
{ 1528, 56, -264},
{ 1360, 368, -312},
{ 1224, 96, -280},
{ 1296, 344, -312},
{ 1528, 400, ... |
t width is the starting width plus any change
int current_cell_width = cur_cell_width + current_cell_width_change;
const GRect rect =
GRect(current_x_offset, 0, current_cell_width, selection_layer->layer.frame.size.h);
graphics_context_set_fill_color(ctx, selection_layer->active_background_color);
const ... | (current_x_offset, y_offset, selection_layer->cell_widths[i], height) | ;
graphics_draw_text(ctx, text, selection_layer->font,
rect, GTextOverflowModeFill, GTextAlignmentCenter, NULL);
}
}
// Update the x-offset so we are ready for the next cell
current_x_offset += selection_layer->cell_widths[i] + selection_layer->cell_padding;
}
}
static void prv_... |
[index]) == 0) {
break;
}
}
if (index >= BtlePaConfigCount) {
prompt_send_response_fmt(buffer, sizeof(buffer), "BTLE PA options are: %s, %s, %s",
s_btle_pa_config_strings[BtlePaConfig_Disable],
s_btle_pa_config_strings[BtlePaConfig_Enable],
... | ("noaa", "1") | |
the specific language governing permissions and
* limitations under the License.
*/
#include "applib/graphics/gtypes.h"
#include "applib/graphics/bitblt.h"
#include "clar.h"
#include "util.h"
#include <string.h>
#include <stdio.h>
// Stubs
////////////////////////////////////
#include "graphics_common_stubs.h"
#i... | cl_assert(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE)) | |
i18n_noop("Wake up interval"));
const TimeSelectionWindowConfig config = {
.label = i18n_get(label, data),
.range = {
.update = true,
.text = is_smart ? i18n_get(range_text, data) : NULL,
.duration_m = SMART_ALARM_RANGE_S / SECONDS_PER_MINUTE,
... | (sizeof(AlarmEditorData)) | ;
*data = (AlarmEditorData) {
.alarm_id = ALARM_INVALID_ID,
.complete_callback = complete_callback,
.callback_context = callback_context,
.creating_alarm = true,
};
// Setup the windows
prv_setup_time_picker_window(data);
prv_setup_day_picker_window(data);
#if CAPABILITY_HAS_HEALTH_TRACKING
... |
nd_text(void) {
return (SerializedSendTextPrefs *)prv_get_prefs(PREF_KEY_SEND_TEXT_APP);
}
SerializedWeatherAppPrefs *watch_app_prefs_get_weather(void) {
return (SerializedWeatherAppPrefs *)prv_get_prefs(PREF_KEY_WEATHER_APP);
}
SerializedReminderAppPrefs *watch_app_prefs_get_reminder(void) {
SerializedReminder... | prv_close_file_and_unlock_mutex() | ;
}
return rv;
}
int watch_app_prefs_db_get_len(const uint8_t *key, int key_len) {
int len = 0;
if (prv_lock_mutex_and_open_file() == S_SUCCESS) {
len = settings_file_get_len(&s_watch_app_prefs_db.settings_file, key, key_len);
prv_close_file_and_unlock_mutex();
}
return len;
}
status_t watch_app... |
Make sure we don't push a pin when we have no history to compare against
void test_activity_insights__sleep_summary_no_history(void) {
// Tests init with zero history
activity_insights_init(rtc_get_time());
// Make sure we don't trigger as soon as we're awake
s_data.metric_history[ActivityMetricSleepState][0... | prv_add_nap_session(0.5, 1.5) | |
/*
* 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... | {
dbgserial_putstr("Specify valid Layer address!");
return;
} |
s_nudge_layer = (Layer *)address;
dbgserial_putstr("Layer nudging mode, CTRL-C to stop");
dbgserial_putstr("Keys:\nWASD: Move frame.origin\n[]: Change frame.size.w & bounds.size.w\n{}: Change frame.size.h & bounds.size.h");
serial_console_set_state(SERIAL_CONSOLE_STATE_LAYER_NUDGING);
}
#endif /* UI_DEBUG */
|
m->id, alarm->config.hour, alarm->config.minute, s_next_alarm_time,
alarm->config.is_smart);
}
// ----------------------------------------------------------------------------------------------
//! Checks to see if this alarm is the new next alarm. If it is, adjust the timer so it's scheduled.
static void prv... | {
s_most_recent_alarm_recorded = true;
// Read from flash since the in-memory cache can be modified
prv_alarm_operation(s_most_recent_alarm_id, prv_record_alarm_op, NULL);
} |
}
}
// ----------------------------------------------------------------------------------------------
static void prv_snooze_kernel_bg_callback(void *unused) {
prv_process_most_recent_alarm();
}
// ----------------------------------------------------------------------------------------------
static void prv_snoo... |
continue;
}
// If this is a comment skip it
if (strcmp(token, "//") == 0) {
continue;
}
// If this is an AlgDlsMinuteData line, get the name
if (strcmp(token, "AlgDlsMinuteData") == 0) {
PBL_ASSERT(state->test_entry.name[0] == 0, "Unexpected start of new samples");
token... | sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight) | ;
} else if (strcmp(token, "TEST_NAME") == 0) {
sscanf(token + strlen(token) + 1, "%s", state->test_entry.name);
}
}
// If this is a "static AlgDlsMinuteData samples[] = {" line, skip it
if (strcmp(token, "static") == 0) {
continue;
}
// Grab a sample
if (strcmp(token... |
/*
* 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... | (ctx, color) | |
t_equal_i(pfs_read(fd, (uint8_t *)rbuf, len), len);
cl_assert(memcmp(rbuf, buf, len) == 0);
cl_assert(fd >= 0);
cl_assert(pfs_close(fd) == S_SUCCESS);
}
}
static uint32_t s_watch_file_callback_called_count = 0;
static void prv_file_changed_callback(void *data) {
s_watch_file_callback_called_count++;
}
... | pfs_open(file_small, OP_FLAG_READ, FILE_TYPE_STATIC, 0) | |
activity_insights_recalculate_stats();
// activity_insights_process_sleep_data(rtc_get_time());
// cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 2);
//
// // Make sure we don't trigger if we didn't get enough sleep
// rtc_set_time(rtc_get_time() + 7 * SECONDS_PER_DAY);
// activit... | {
prv_set_step_history_avg();
activity_insights_init(rtc_get_time());
// Make sure that when we are active, we don't trigger without being above average
s_data.steps_per_minute = 80;
s_data.metric_history[ActivityMetricStepCount][0] = AVERAGE_STEPS;
prv_minute_update(ACTIVE_MINUTES);
cl_assert_equal_i(fa... |
void test_activity_insights__activity_reward_no_trigger_not_active(void) {
prv_set_step_history_avg();
activity_insights_init(rtc_get_time());
// Make sure that being above average but not active doesn't trigger
s_data.steps_per_minute = 0;
s_data.metric_history[ActivityMetricStepCount][0] = HIGH_STEPS;
... |
max_length /* required_free_length */,
TIMEOUT_MS);
uint8_t fake_data[max_length];
memset(fake_data, 0, max_length);
cl_assert_equal_b(comm_session_send_buffer_write(write_sb, fake_data, max_length), true);
// Try writing another byte (expect ... | (header->length, htons(max_payload_length)) | |
ineResourceSizeLarge);
const bool use_status_bar = true;
const bool use_simple_dialog = simple_dialog_does_text_fit(msg, DISP_FRAME.size,
simple_dialog_icon_size,
use_status_bar);
SimpleDialo... | if (!data->progress_window) {
const bool success = false;
prv_cleanup_action_result(data, success);
return;
} | |
/*
* 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... | time_get_isdst(utc_now) | |
_layer, up, prev_selection, was_animating);
} else {
prv_menu_layer_update_selection_highlight(menu_layer, up, animated, true);
prv_menu_layer_update_selection_scroll_position(menu_layer, scroll_align, animated);
// only call this here, on animated center focus, the announcement will happen in-between
... | {
MenuSelectNextIterator *it = (MenuSelectNextIterator*)iterator;
MenuLayer *menu_layer = it->it.menu_layer;
if (it->count == 1) {
MenuLayerSelectionWillChangeCallback cb = menu_layer->callbacks.selection_will_change;
it->it.should_continue = false;
it->did_change_selection = true;
if (cb) {
... |
void menu_layer_set_selected_next(MenuLayer *menu_layer, bool up,
MenuRowAlign scroll_align, bool animated) {
const MenuLayerBeforeSelectionChangeState before_state =
prv_capture_state_and_cancel_center_focus_animation(menu_layer);
MenuSelectNextIterator it = {
.it = {... |
/*
* 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 pin_db_delete(key, key_len);
} |
void ancs_notifications_enable_bulk_action_mode(bool enable) {
return;
}
bool ancs_notifications_is_bulk_action_mode_enabled(void) {
return false;
}
status_t reminder_db_delete_with_parent(const TimelineItemId *id) {
return S_SUCCESS;
}
void timeline_action_endpoint_invoke_action(const Uuid *id,
uint8_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... | (text_layer, translation->string) | ;
text_layer_set_font(text_layer, fonts_get_system_font(translation->font_key));
}
static void prv_update_prf_info_text_layers_text(BTPairingUIData *data) {
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
const char *font_key_default = FONT_KEY_GOTHIC_28_BOLD;
const char *font_key_japanese = FONT_KEY_MINCHO_24_PAIR;
#e... |
lities s_cached_system_capabilities;
static void prv_lock(void) {
mutex_lock(s_db_mutex);
}
static void prv_unlock(void) {
mutex_unlock(s_db_mutex);
}
static bool prv_bt_persistent_storage_get_ble_smpairinginfo_by_id(
BTBondingID bonding, SMPairingInfo *info_out, char *name_out, bool *requires_address_pinnin... | (LOG_DOMAIN_BT_PAIRING_INFO, LOG_LEVEL_DEBUG,
"Updating GAP Bonding DB Value <key, val>!") | ;
PBL_HEXDUMP_D(LOG_DOMAIN_BT_PAIRING_INFO, LOG_LEVEL_DEBUG, (uint8_t *)key, key_len);
PBL_HEXDUMP_D(LOG_DOMAIN_BT_PAIRING_INFO, LOG_LEVEL_DEBUG, (uint8_t *)data_in, data_len);
rv = settings_file_set(&fd, key, key_len, (uint8_t*) data_in, data_len);
}
} else {
rv = settings_file_... |
{ 1144, 104, 56},
{ 1160, 112, -32},
{ 1136, 128, -32},
{ 1072, 104, -64},
{ 1216, 128, -40},
{ 1336, 208, -96},
{ 1176, 240, -120},
{ 872, 240, -160},
{ 600, 224, -192},
// 16 seconds
{ 448, 192, -176},
{ 440, 184, -192},
{ 584, 176, -176},
{ 832, 224, -256},
... |
{ 496, 184, -88},
{ 504, 192, -80},
{ 616, 248, -104},
{ 792, 328, -168},
{ 1048, 368, -216},
{ 1128, 352, -296},
{ 1128, 272, -240},
{ 1288, 336, -224},
{ 1144, 368, -248},
{ 1128, 344, -144},
{ 1264, 320, -80},
{ 1224, 304, -40},
{ 1016, 280, -24},
{ 784, 224, ... | |
77774");
// Space for positive signed
// No signed conversion occurs, so this is a no-op
snprintf(dstbuf, 256, "There are % o lights, the absolute value of % o", 8, -4);
cl_assert_equal_s(dstbuf, "There are 10 lights, the absolute value of 37777777774");
// Plus for positive signed
// No signed conversion... | (dstbuf, 256, "%.1xzero%.1x", 0, 1) | ;
cl_assert_equal_s(dstbuf, "0zero1");
// Variable length character output
snprintf(dstbuf, 256, "There are %*x lights", 3, 16);
cl_assert_equal_s(dstbuf, "There are 10 lights");
// Variable length digits output
snprintf(dstbuf, 256, "There are %.*x lights", 3, 16);
cl_assert_equal_s(dstbuf, "There are... |
/*
* 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... | app_glance_service_init() | ;
}
void app_glance_db_deinit(void);
void test_app_glance_service__cleanup(void) {
app_glance_db_deinit();
}
static void prv_check_expected_slice_data(const AppGlanceSliceInternal *expected_slice_data,
time_t time) {
// Set the current time to the provided time
rtc_set... |
{ 1096, -264, -48},
{ 1064, -184, -144},
{ 1152, -48, -168},
{ 1232, -32, -288},
{ 1160, -8, -272},
{ 952, 16, -280},
{ 928, 72, -272},
{ 1072, 136, -248},
{ 1224, 280, -264},
{ 1192, 368, -296},
{ 1248, 384, -296},
{ 1368, 488, -312},
{ 1040, 536, -312},
{ 1248, 664... | { 848, 208, -152},
{ 992, 216, -120},
{ 1080, 272, -144},
{ 1144, 304, -160},
{ 1264, 392, -184},
{ 1328, 560, -216},
// 42 seconds
{ 1056, 552, -248},
{ 1088, 568, -264},
{ 944, 440, -288},
{ 1064, 368, -272},
{ 1208, 312, -184},
{ 1280, 248, -160},
{ 1128, 136, ... |
{ 1232, 80, -88},
{ 1384, 72, -72},
{ 1328, 88, -136},
{ 1104, 64, -152},
{ 1000, -48, -184},
{ 1048, -144, -248},
{ 736, -288, -256},
{ 1144, -296, -64},
{ 960, -184, -160},
{ 1096, -16, -144},
{ 1240, 24, -256},
{ 1184, 24, -272},
{ 960, 88, -224},
{ 944, 152, ... |
// This subscription has expired
expired_state = state;
}
state = (HRMSubscriberState *)state->list_node.next;
// If the prior subscription expired, remove it now
if (expired_state) {
PBL_LOG(LOG_LEVEL_DEBUG, "Subscription %"PRIu32" expired", expired_state->session_ref);
prv_remove... | DEFINE_SYSCALL(HRMSessionRef, sys_hrm_manager_app_subscribe,
AppInstallId app_id, uint32_t update_interval_s, uint16_t expire_sec, HRMFeature features) | {
return hrm_manager_subscribe_with_callback(app_id, update_interval_s, expire_sec, features, NULL,
NULL);
}
DEFINE_SYSCALL(bool, sys_hrm_manager_unsubscribe, HRMSessionRef session) {
HRM_LOG("Unsubscribing");
bool success = false;
mutex_lock_recursive(s_manager_s... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
case S_SUCCESS:
return BLOB_DB_SUCCESS;
case E_DOES_NOT_EXIST:
return BLOB_DB_KEY_DOES_NOT_EXIST;
case E_RANGE:
return BLOB_DB_INVALID_DATABASE_ID;
case E_INVALID_ARGUMENT:
return BLOB_DB_INVALID_DATA;
case E_OUT_OF_STORAGE:
return BLOB_DB_DATABASE_FULL;
case E_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... | task_malloc_check(sizeof(uint16_t) + sizeof(char) * 1) | ;
pstring->str_length = length;
pstring->str_value[0] = '\0';
} else {
pstring = task_malloc_check(sizeof(uint16_t) + sizeof(char) * length);
pstring->str_length = length;
strncpy(pstring->str_value, string, length);
}
return pstring;
}
void pstring_destroy_pstring16(PascalString16 *pstring) ... |
// Manual internal function to refresh title text clock and mark dirty
static void prv_status_bar_layer_update_clock(StatusBarLayer *status_bar_layer) {
clock_copy_time_string(status_bar_layer->config.title_text_buffer,
sizeof(status_bar_layer->config.title_text_buffer));
layer_mark_dirty(... | prv_get_text_format() | .font;
// find width of info text
GSize max_used_size = graphics_text_layout_get_max_used_size(ctx, config->info_text_buffer,
info_font,
GRect(0, 0, 100, prv_height()),
GTextOverflowModeTrailin... |
, 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), 4);
ASSERT_CA... | (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)... |
t_animation();
animation_set_duration(a, duration_a);
animation_schedule(a);
// -------------------------------------------------------------------------------------
// Start A and play to the end
prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS);
cl_assert_equal_i(prv_count... | cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1) | ;
prv_advance_to_ms_with_timers(start_ms + 310);
// Schedule B now and run for a little
animation_schedule(b);
prv_advance_to_ms_with_timers(start_ms + 330);
// Schedule C now and run for a while
prv_advance_to_ms_with_timers(start_ms + 500);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handle... |
/*
* 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 SETTLE_HEIGHT_DIFF - ((SETTLE_HEIGHT_DIFF * anim_percent_complete) / 100);
} | else {
return 0;
}
}
static int prv_get_font_top_padding(GFont font) {
if (font == fonts_get_system_font(FONT_KEY_GOTHIC_36_BOLD)) {
return 14;
} else if (font == fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)) {
return 10;
} else if (font == fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)) {
r... |
,
test_data->test_name);
GBitmap *bitmap = test_data->bitmap_create_func(test_image_filename);
cl_assert(bitmap);
cl_assert(gbitmap_get_format(bitmap) == test_data->expected_test_image_bitmap_format);
// Draw the two variations of the test image at GPointZero
prv_composite_test_draw_b... | (GPoint(0, -40)) | ;
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_graphics_draw_bitmap__offset_bitmap_layer_inside(void) {
prv_offset_bitmap_layer_test(GPointZero);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_graphics_draw_bitmap__offset_bitmap_layer_across_x(void) {
prv_... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | window_transition_context_appear(ctx) | ;
}
const WindowTransitionImplementation *window_transition_get_default_push_implementation(void) {
#if PBL_RECT
return &g_window_transition_default_push_implementation_rect;
#else
return &g_window_transition_default_push_implementation_round.implementation;
#endif
}
const WindowTransitionImplementation *window_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... | write_register(RegShutdown, 0x01) | |
r (int i = 0; i < num_pages(); i++) {
snprintf(file_small, sizeof(file_small), "file%d", i);
snprintf(buf_small, sizeof(buf_small), "This is small buf_small %d!", i);
int len = strlen(buf_small);
int fd = pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, len);
cl_assert(fd >= 0);
cl_assert(p... | (overwrite_string, new_buf, strlen(overwrite_string)) | == 0);
pfs_close(fd);
}
void test_pfs__seek(void) {
int len = 10;
int fd = pfs_open("newfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, len);
cl_assert(fd >= 0);
int rv = pfs_seek(fd, len, FSeekSet);
cl_assert(rv == len);
rv = pfs_seek(fd, 0, FSeekCur);
cl_assert(rv == len);
rv = pfs_seek(fd, -5, FSeekCur... |
240},
{ -1552, 704, 328},
{ -1568, 688, 376},
{ -1624, 632, 360},
{ -1392, 576, 448},
{ -1248, 552, 520},
{ -1056, 680, 776},
{ -792, 672, 800},
{ -672, 488, 544},
{ -920, 632, 584},
{ -1096, 864, 216},
{ -1216, 664, 0},
{ -1632, 664, 160},
{ -1776, 496, 336},
{ -... | { -712, 688, -296},
{ -1504, 344, -96},
{ -1488, 616, 24},
{ -1248, 760, -128},
{ -1368, 768, -208},
{ -872, 616, -72},
// 18 seconds
{ -1144, 584, -160},
{ -1232, 552, -160},
{ -1328, 760, -344},
{ -1280, 432, -456},
{ -688, -208, 208},
{ -984, 112, -32},
{ -952,... |
{ -984, 216, 56},
{ -944, 200, 88},
{ -1144, 176, 24},
{ -1264, -128, 64},
{ -1024, -328, -48},
{ -1456, 88, -152},
{ -1632, 328, -160},
{ -1408, 480, -312},
{ -1312, 144, -112},
{ -1192, 40, -152},
{ -1096, 232, -112},
{ -976, 336, -24},
{ -992, 280, 48},
{ -104... |
ion_get_num_rows_callback,
.get_cell_height = prv_certification_get_cell_height_callback,
.draw_row = prv_certification_draw_row_callback,
.select_click = prv_certification_select_callback,
});
menu_layer_set_highlight_colors(menu_layer, SETTINGS_MENU_HIGHLIGHT_COLOR, GColorWhite);
menu_layer_set_clic... | (&data->info_text, &info_text_frame,
prv_get_korea_kcc_id(), info_text_font,
GColorBlack, GColorClear, GTextAlignmentCenter,
GTextOverflowModeTrailingEllipsis) | |
/*
* 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 (font == NULL) {
const PreferredContentSize runtime_platform_default_size =
system_theme_get_default_content_size_for_runtime_platform();
font = fonts_get_system_font(s_text_layer_default_fonts[runtime_platform_default_size]);
} |
text_layer->font = font;
text_layer->text = text;
layer_mark_dirty(&(text_layer->layer));
}
void text_layer_init(TextLayer *text_layer, const GRect *frame) {
text_layer_init_with_parameters(text_layer, frame, NULL, NULL, GColorBlack, GColorWhite,
GTextAlignmentLeft, GTextOve... |
72, 400, -760},
{ 472, 400, -760},
{ 472, 400, -760},
{ 472, 392, -760},
{ 472, 416, -760},
{ 472, 400, -760},
{ 480, 392, -760},
{ 472, 400, -752},
// 118 seconds
{ 472, 392, -760},
{ 480, 400, -760},
{ 464, 400, -760},
{ 480, 400, -760},
{ 472, 400, -760},
{ 480... | { 464, 400, -760},
{ 472, 416, -760},
{ 472, 392, -760},
{ 472, 392, -752},
{ 480, 400, -752},
{ 488, 408, -760},
{ 464, 400, -768},
{ 472, 400, -760},
{ 480, 408, -760},
{ 472, 400, -752},
{ 480, 400, -752},
{ 464, 400, -760},
{ 480, 400, -760},
{ 472, 416, -752}... | |
----------------------------
// Callback used to free a storage buffer from unprivileged mode.
static void prv_free_storage_buffer_cb(void *p) {
PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Freeing buffer storage ptr: %p", p);
task_free(p);
}
// ------------------------------------------------------------... | {
if (*iter == logging_session) {
*iter = (*iter)->next;
mutex_unlock_recursive(s_list_mutex);
if (logging_session->data) {
mutex_destroy(logging_session->data->mutex);
kernel_free(logging_session->data);
}
kernel_free(logging_session);
return;
}
iter = &(... |
mutex_unlock_recursive(s_list_mutex);
}
void dls_list_remove_all(void) {
mutex_lock_recursive(s_list_mutex);
DataLoggingSession *cur = s_logging_sessions;
DataLoggingSession *next;
while (cur != NULL) {
next = cur->next;
if (cur->data) {
mutex_destroy(cur->data->mutex);
kernel_free(cur-... |
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
void test_health_activity_summary_card__render_current_above_typical2(void) {
HealthData health_data = {
.step_data = 400,
.step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,... | |
.res_app_num,
peek_layer->res_info.res_id);
if (!from_reel) {
return;
}
KinoReel *to_reel = NULL;
if (timeline_res) {
AppResourceInfo res_info;
timeline_resources_get_id(timeline_res, res_size, &res_info);
to_reel = kino_reel_create_... | kino_layer_get_reel(&peek_layer->kino_layer) | |
/*
* 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... | strncpy(timezone_abbr, sys_tz, TZ_LEN) | |
#endif
}
void test_graphics_draw_rotated_bitmap__origin_bw_assign(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// No Clip, Angle 0
setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign);
graphics_draw_rotated_bitmap(&ctx, test_image_bw,
... | DEG_TO_TRIGANGLE(0) | , GPointZero);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_assign_0.Xbit.pbi"));
// Top-left corner rotation point, Angle 45
setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign);
graphics_draw_rotated_bitmap(&ctx, test_image_color,
... |
}
}
static void prv_start_ringing(void) {
alerts_incoming_alert_analytics();
s_phone_ui_data->ring_timer = (const RegularTimerInfo) {
.cb = prv_ring,
};
unsigned int vibe_repeat_interval_sec;
#if CAPABILITY_HAS_VIBE_SCORES
s_phone_ui_data->vibe_score = vibe_client_get_score(VibeClient_PhoneCalls);
if ... | {
i18n_get_with_buffer("Call Accepted", s_phone_ui_data->call_status_text_buf,
CALL_STATUS_BUFFER_LENGTH);
} | else if (status == DISCONNECTED) {
i18n_get_with_buffer("Disconnected", s_phone_ui_data->call_status_text_buf,
CALL_STATUS_BUFFER_LENGTH);
} else {
if (s_phone_ui_data->call_start_time) {
i18n_get_with_buffer("Call Ended", s_phone_ui_data->call_status_text_buf,
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&BMA255_SCLK_CONFIG, GPIO_OType_PP, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL) | |
prv_draw_text_node(GTextNode *node, GContext *ctx, const GRect *box,
const GTextNodeDrawConfig *config, bool render, GSize *size_out);
static bool prv_container_each(GTextNodeContainer *container_node, ContainerIterCallback callback,
void *context) {
con... | {
prev_child->sibling = child;
} |
return true;
}
static void prv_set_size(GSize *size, const GSize *exact_size) {
if (exact_size->w) {
size->w = exact_size->w;
}
if (exact_size->h) {
size->h = exact_size->h;
}
}
static void prv_clip_width(GSize *size, const GSize *max_size) {
if (max_size->w && size->w > max_size->w) {
size->... |
0, HW_GPIO_MODE_OUTPUT,
HW_GPIO_FUNC_UART_RX);
hw_gpio_set_pin_function(HW_GPIO_PORT_1, HW_GPIO_PIN_1, HW_GPIO_MODE_OUTPUT,
HW_GPIO_FUNC_UART_TX);
}
void pbl_log_init(void) {
debug_uart_init();
// Let's use all available RAM for the log buffer!
// That is,... | {
str1_len = len;
} | else {
str2_len = len;
}
}
}
va_end(args);
// Make sure the strings don't blow our max message setting
if ((str1_len + str2_len) >= MAX_MSG_STR_LEN) {
str1_len = MIN(str1_len, MAX_MSG_STR_LEN_HALF);
str2_len = MIN(str2_len, MAX_MSG_STR_LEN_HALF);
}
if (str1... |
ut are still
// sitting in the send buffer, until they are Ack'd in case we need to retransmit them.
uint16_t offset = prv_total_num_bytes_awaiting_ack(client);
// If retransmitting, we need to use the same fragmentation as the previous transmission.
// The payload_sizes field will still contain the previously... | prv_send_next_packets(client) | ;
client = (PPoGATTClient *) client->node.next;
}
}
bt_unlock();
}
// -------------------------------------------------------------------------------------------------
// To be called by comm_session after enqueuing new data into the SendBuffer
// bt_lock() must be held before calling
void ppogatt_send_... |
ons and
* limitations under the License.
*/
#include "comm/ble/kernel_le_client/ancs/ancs.h"
#include "comm/ble/kernel_le_client/ancs/ancs_types.h"
#include "comm/ble/kernel_le_client/ancs/ancs_util.h"
#include "util/buffer.h"
#include "clar.h"
#include <string.h>
// Stubs
//////////////////////////////////////... | (b, s_chunked_dict_part_two, sizeof(s_chunked_dict_part_two)) | |
> Max -> Min. The Dialog chip would disconnect with reasons 0x1f. Also, it doesn't really
// make sense to transition for just 2 seconds anyways. However, during an App/File install
// PutBytes, we will stay at Min for an extra 10 seconds after the entire transaction is
// completed. Marginal power hit, but shoul... | {
FirmwareDescription fw_descr = {
.description_length = sizeof(FirmwareDescription),
.firmware_length = s_pb_state.total_size + s_pb_state.append_offset,
.checksum = crc
};
#if !CAPABILITY_HAS_DEFECTIVE_FW_CRC
// Note: We are trying to move away from using the STM32 legacy defective
... |
struct InstallableObject* o = s_ready_to_install + (s_pb_state.type - 1);
o->token = s_pb_state.token;
o->type = s_pb_state.type;
o->index = s_pb_state.index;
}
static void prv_finish_fw_update_if_completed(void) {
if (s_ready_to_install[ObjectFirmware - 1].type != ObjectFirmware ||
s_ready_to_instal... |
arStore sleep_average_seconds, Uuid *uuid) {
prv_generate_sleep_pin_strings(sleep_enter_seconds, sleep_exit_seconds, sleep_total_seconds);
// Insert or update the pin
return prv_push_summary_pin(pin_time_utc, now_utc, uuid, sleep_total_seconds,
sleep_average_seconds, &SLEEP_SUMMARY... | (&pin_attr_list) | |
last_save_time_ticks = RTC_ReadBackupRegister(CURRENT_INTERVAL_TICKS_REGISTER);
time_t last_save_time = RTC_ReadBackupRegister(CURRENT_TIME_REGISTER);
RtcIntervalTicks current_ticks = get_rtc_interval_ticks();
const int32_t ticks_since_last_save = elapsed_ticks(last_save_time_ticks, current_ticks);
s_time_base... | if (elapsed_ticks(get_last_save_time_ticks(), rtc_ticks) > SAVE_TIME_FREQUENCY) {
// If we didn't do this, we would have an edge case where if the watch reset
// immediately before rollover and then rolled over before we booted again,
// we wouldn't be able to detect the rollover and we'd think the saved st... |
if (save_needed) {
save_rtc_time_state(rtc_ticks);
}
}
static RtcTicks get_ticks(void) {
// Prevent this from being interrupted
bool ints_enabled = mcu_state_are_interrupts_enabled();
if (ints_enabled) {
__disable_irq();
}
RtcTicks rtc_interval_ticks = get_rtc_interval_ticks();
check_and_h... |
recursive(s_list_mutex);
}
void dls_list_remove_all(void) {
mutex_lock_recursive(s_list_mutex);
DataLoggingSession *cur = s_logging_sessions;
DataLoggingSession *next;
while (cur != NULL) {
next = cur->next;
if (cur->data) {
mutex_destroy(cur->data->mutex);
kernel_free(cur->data);
}
... | (logging_session, data) | ) {
mutex_unlock_recursive(s_list_mutex);
return false;
}
logging_session = next_logging_session;
}
mutex_unlock_recursive(s_list_mutex);
return true;
}
void dls_list_init(void) {
s_list_mutex = mutex_create_recursive();
s_logging_sessions = NULL;
}
bool dls_list_is_session_valid(DataLo... |
;
SimpleMenuLayer *menu_layer;
} DebugCard;
typedef struct {
TextLayer *cur_step_layer;
TextLayer *time_layer;
TextLayer *delta_step_layer;
TextLayer *msg_layer;
char cur_step_text[32];
char time_text[32];
char delta_step_text[32];
char msg_text[256];
} StepsCard;
typedef struct {
TextLayer *text_... | snprintf(temp, sizeof(temp), "\n%d: %s", i, elapsed) | ;
prv_safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text));
day_start -= SECONDS_PER_DAY;
}
prv_display_alert(data->debug_card.dialog_text);
}
// -------------------------------------------------------------------------------
static void sleep_select_click_handler(ClickRe... |
/*
* 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 (find_tmp_path(_clar_path, sizeof(_clar_path)) < 0)
return -1; |
len = strlen(_clar_path);
#ifdef _WIN32
{ /* normalize path to POSIX forward slashes */
size_t i;
for (i = 0; i < len; ++i) {
if (_clar_path[i] == '\\')
_clar_path[i] = '/';
}
}
#endif
if (_clar_path[len - 1] != '/') {
_clar_path[len++] = '/';
}
strncpy(_clar_path + len, path_tail, sizeof(_cla... |
8},
{ -299, 207, -212},
{ -314, 433, -243},
{ -583, 744, -395},
{ -968, 1158, -411},
{ -1097, 1054, -344},
{ -892, 1005, -231},
{ -1118, 490, 150},
{ -636, 459, -22},
{ -511, 267, 197},
{ -688, 613, 124},
{ -717, 699, -11},
{ -689, 798, 92},
{ -576, 739, 47},
{ -5... | { -170, -277, -822},
{ -185, -270, -831},
{ -201, -275, -867},
{ -194, -282, -886},
{ -203, -285, -887},
{ -197, -281, -885},
{ -201, -257, -896},
{ -202, -269, -875},
{ -202, -239, -890},
{ -209, -237, -866},
{ -196, -238, -866},
{ -186, -238, -841},
{ -187, -249, -8... |
{ -304, -259, -860},
{ -303, -249, -871},
{ -293, -251, -849},
{ -294, -248, -866},
{ -290, -245, -868},
{ -292, -260, -853},
{ -288, -260, -846},
{ -269, -272, -811},
{ -229, -308, -732},
{ -216, -355, -578},
{ -144, -281, -546},
{ -116, -52, -541},
{ -79, 299, -527... |
v_assert_alarm_config(id, 10, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
cl_assert_equal_i(s_num_timeline_adds, 3);
cl_assert_equal_i(s_num_timeline_removes, 0);
s_sleep_state = ActivitySleepStateLightSleep;
s_last_vmc = 1;
prv_set_time(s_current_day, 10, 0);
cron_service_wakeup();
cl_assert_... | if (i < num_checks - 1) {
// Smart alarm non-trigger checks
cl_assert_equal_i(s_num_alarms_fired, 1);
cl_assert_equal_i(s_num_alarm_events_put, 0);
} |
}
// Smart alarm trigger checks
cl_assert_equal_i(s_num_alarms_fired, 1);
cl_assert_equal_i(s_num_alarm_events_put, 1);
cl_assert_equal_i(s_num_timeline_adds, 6);
cl_assert_equal_i(s_num_timeline_removes, 3);
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time());
}
void test_a... |
t(I2cBus *bus) {
bus->busy = true;
volatile uint32_t timeout_attempts = I2C_TIMEOUT_ATTEMPTS_MAX;
while ((timeout_attempts-- > 0) && (bus->busy));
bus->busy = false;
return (timeout_attempts != 0);
}
static void semaphore_give(I2cBus *bus) {
}
/*-------------------BUS/PIN CONFIG FUNCTIONS-------------------... | I2C_StructInit(&i2c_init_struct) | |
/*
* 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... | (af_config->gpio) | ;
}
void gpio_af_configure_fixed_output(const AfConfig *af_config, bool asserted) {
GPIO_InitTypeDef init = {
.GPIO_Pin = af_config->gpio_pin,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_NOPULL
};
gpio_use(af_config->gpio);
... |
esourceInfo *b) {
PBL_ASSERTN(a && b);
return ((a == b) || ((a->res_id == b->res_id) && (a->res_app_num == b->res_app_num)));
}
static void prv_generic_glance_set_icon(LauncherAppGlanceGeneric *generic_glance,
const AppResourceInfo *res_info) {
if (!generic_glance || !res_... | launcher_app_glance_structured_notify_service_glance_changed(structured_glance) | ;
}
static void prv_update_subtitle_template_string_reeval_timer_if_necessary(
LauncherAppGlanceStructured *structured_glance, time_t new_reeval_time) {
LauncherAppGlanceGeneric *generic_glance =
launcher_app_glance_structured_get_data(structured_glance);
const time_t existing_reeval_time =
generi... |
/*
* 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... | (testbuf, 'B') | , testbuf+6);
}
void test_strchr__r_unfound(void) {
char testbuf[10] = "Hello!B\0Z";
cl_assert_equal_p(strrchr(testbuf, 'Z'), NULL);
}
void test_strchr__r_big_value(void) {
char testbuf[8] = "Hello!B";
cl_assert_equal_p(strrchr(testbuf, 0xF00 + 'B'), testbuf+6);
}
void test_strchr__r_end_of_string(void) {
... |
animation(health_card_view, next_card_index, slide_up);
}
}
// Select click handler
static void prv_select_click_handler(ClickRecognizerRef recognizer, void *context) {
HealthCardView *health_card_view = context;
Layer *layer = health_card_view->card_layers[health_card_view->current_card_index];
s_card_view_se... | (health_card_view->card_layers[health_card_view->current_card_index]) | ;
}
|
_ERR_ERASE:
PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Did not successfully erase the sector");
break;
case FLASH_TEST_ERR_DATA_WRITE:
PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Did not successfully write the data");
break;
default:
break;
}
return err_code;
}
return FLASH_T... | for (data_buffer = 1; data_buffer != 0; data_buffer <<= 1) {
read_buffer = 0;
flash_read_bytes((uint8_t*) &read_buffer, addr_region, sizeof(read_buffer));
PBL_LOG(LOG_LEVEL_DEBUG, ">> Reading Addr 0x%"PRIx32" value is 0x%"PRIx16,
addr_region, read_buffer);
if (read_buffer != 0xFFFF) {
... |
PBL_LOG(LOG_LEVEL_DEBUG, ">PASS - DATA TEST 1: Data bus test");
return status;
}
/***********************************************************/
/******************* Addr Test Functions *******************/
/***********************************************************/
// Write the test byte 0xAA at each power-of-t... |
e_Legacy);
bool commit_succeeded = (calculated_crc == crc);
if (elapsed_time_ms > 0) {
int bytes_per_sec = (int)((s_pb_state.total_size * 1000) / elapsed_time_ms);
PBL_LOG(LOG_LEVEL_DEBUG, "PutBytes pushed %d bytes/sec", bytes_per_sec);
}
bluetooth_analytics_handle_put_bytes_stats(
commit_succee... | if (!prv_do_put((PutRequest *)job->buffer, job->request_length, token)) {
// consume the jobs, they are all going to fail
prv_mark_pb_jobs_complete(num_put_jobs);
return;
} |
}
xSemaphoreTake(s_pb_semaphore, portMAX_DELAY);
{
s_pb_state.current_command = PutBytesPut;
uint32_t bytes_transferred = initial_remaining_bytes - s_pb_state.remaining_bytes;
PebbleEvent event = {
.type = PEBBLE_PUT_BYTES_EVENT,
.put_bytes = {
.type = PebblePutBytesEventTypePro... |
= alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_EVERYDAY });
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
alarm_set_kind(id, ALARM_KIND_WEEKENDS);
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule);
bool custom_s... | (alarm_day_text_3, "Mondays") | ;
bool schedule_4[7] = {false, false, true, false, false, false, false};
char alarm_day_text_4[32] = {0};
alarm_get_string_for_custom(schedule_4, alarm_day_text_4);
cl_assert_equal_s(alarm_day_text_4, "Tuesdays");
bool schedule_5[7] = {false, false, false, true, false, false, false};
char alarm_day_text_5... |
/*
* 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_circular_buffer_write(&buffer, (uint8_t*) "789", 3, false) | );
cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 3);
cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "abc", 3, false));
cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 0);
cl_assert(!shared_circular_buffer_write(&buffer, (uint8_t*) "d", 1, f... |
ne_Event_Type_ActivitySessionEvent) {
cl_assert_equal_i(a_event->activity_session.type.type.internal_type,
b_event->activity_session.type.type.internal_type);
cl_assert_equal_i(a_event->activity_session.start_reason,
b_event->activity_session.start_rea... | time_util_update_timezone(&tz_info) | ;
s_dls_session_created = false;
s_saved_encoded_msg = NULL;
protobuf_log_init();
}
// ---------------------------------------------------------------------------------------------
void test_protobuf_log__cleanup(void) {
}
// ----------------------------------------------------------------------------------... |
ritten_flag;
void *source_buffer;
uint32_t flash_data_start, flash_data_length;
bool callback_called;
void test_system_flash__initialize(void) {
erased_sector = 0;
flash_locked = true;
flash_flags_set = false;
return_status = FLASH_COMPLETE;
flash_written_data = NULL;
flash_written_flag = NULL;
flash_dat... | cl_assert(flash_locked) | |
_INACTIVITY_TIMEOUT_SECS);
state = conn_mgr_get_latency_for_le_connection(&s_hdl, &secs_to_wait);
cl_assert_equal_i(state, ResponseTimeMiddle);
cl_assert_equal_i(secs_to_wait, 30 - BT_CONN_MGR_INACTIVITY_TIMEOUT_SECS);
cl_assert_equal_i(fake_gap_le_connect_params_get_last_requested(), ResponseTimeMiddle);
/... | conn_mgr_get_latency_for_le_connection(&s_hdl, &secs_to_wait) | ;
cl_assert_equal_i(state, ResponseTimeMax);
// Requesting ResponseTimeMax should have no effect:
conn_mgr_set_ble_conn_response_time(&s_hdl, BtConsumerLeServiceDiscovery, ResponseTimeMax, 1);
state = conn_mgr_get_latency_for_le_connection(&s_hdl, &secs_to_wait);
cl_assert_equal_i(state, ResponseTimeMax);
... |
llback event on the subscriber's queue when
//! the requested number of samples have been batched
static void prv_dispatch_data(void) {
mutex_lock_recursive(s_accel_manager_mutex);
AccelManagerState * state = (AccelManagerState *)s_data_subscribers;
while (state) {
if (!state->raw_buffer) {
state = (Ac... | {
mutex_lock_recursive(s_accel_manager_mutex);
uint32_t samps_collected = s_accel_samples_collected_count;
s_accel_samples_collected_count = 0;
mutex_unlock_recursive(s_accel_manager_mutex);
analytics_set(ANALYTICS_DEVICE_METRIC_ACCEL_SAMPLE_COUNT, samps_collected,
AnalyticsClient_System);
} |
void accel_manager_init(void) {
s_accel_manager_mutex = mutex_create_recursive();
shared_circular_buffer_init(&s_buffer, s_buffer_storage,
sizeof(s_buffer_storage));
event_service_init(PEBBLE_ACCEL_SHAKE_EVENT, &prv_shake_add_subscriber_cb,
&prv_shake_remove_subscriber_cb);
event_service_init(P... |
);
stub_pebble_tasks_set_current(TEST_TARGET_TASK);
s_num_messages_to_consume_from_handler = 0;
s_can_send_event = true;
s_dropped_idx = 0;
memset(s_dropped_messages, 0, sizeof(s_dropped_messages));
s_message_idx = 0;
memset(s_messages, 0, sizeof(s_messages));
}
void test_app_inbox__cleanup(void) {
app... | (false, app_inbox_service_has_inbox_for_tag(AppInboxServiceTagUnitTestAlt)) | |
that a negative value isn't passed in which gets cast to something positive
buf_space_remaining = MAX(buf_space_remaining - sentence_len, 0);
strncat(data->dialog_text, "\n\n", buf_space_remaining);
buf_space_remaining = MAX(buf_space_remaining - 2, 0);
char tmp[date_time_len];
clock_get_friendly_date(tmp,... | (window, false) | ;
}
static void prv_deinit(void) {
ReminderAppData *data = app_state_get_user_data();
voice_window_destroy(data->voice_window);
event_service_client_unsubscribe(&data->event_service_info);
app_free(data->dialog_text);
app_free(data);
}
static void prv_main(void) {
prv_init();
app_event_loop();
prv_dei... |
/*
* 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... | (recognizer) | ;
}
return true;
} else {
return false;
}
}
inline static bool prv_is_hold_to_repeat_enabled(ClickRecognizer *recognizer) {
return (recognizer->config.click.repeat_interval_ms >= 30);
}
inline static bool prv_is_multi_click_enabled(ClickRecognizer *recognizer) {
return (recognizer->config.multi_c... |
, 1);
cl_assert_equal_i(s_num_alarm_events_put, 1);
cl_assert_equal_i(s_num_timeline_adds, 8);
cl_assert_equal_i(s_num_timeline_removes, 4);
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time());
// Second alarm goes off. First one should be up again
s_current_hour = 11;
s_curre... | (s_last_timeline_item_added->header.timestamp, rtc_get_time()) | ;
}
void test_alarm__custom_alarm_everyday(void) {
AlarmId id1;
bool schedule_1[7] = {true, true, true, true, true, true, true};
id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 });
prv_assert_alarm_config(id1, 10, 30, false, ALARM_KIND_CUSTO... |
840, -432},
{ 1440, 816, -680},
{ 1016, 1648, -728},
{ 832, 1448, -768},
{ 1120, 1168, -440},
{ 960, 744, -296},
{ 1328, 704, -176},
{ 1736, 824, -184},
{ 1824, 584, -64},
{ 1696, 376, -40},
{ 1632, 320, 16},
{ 1720, 384, 0},
{ 1728, 312, 48},
{ 1528, 224, -48},
{... | { 1184, 88, 24},
{ 536, -1072, 64},
// 377 seconds
{ 616, -240, -304},
{ 632, -512, 32},
{ 1120, 120, -232},
{ 1352, 216, -128},
{ 1600, 280, 40},
{ 1784, 352, 0},
{ 1864, 568, -112},
{ 1848, 1112, -248},
{ 1784, 640, -232},
{ 1552, 696, -432},
{ 1128, 1312, -544}... |
{ -8, -776, -872},
{ -88, -736, -920},
{ -120, -712, -864},
{ 48, -632, -904},
{ 104, -592, -880},
{ 136, -592, -808},
{ 96, -600, -752},
{ 128, -576, -752},
{ 168, -664, -744},
{ 152, -832, -720},
{ 160, -808, -704},
// 380 seconds
{ 136, -760, -720},
{ 280, -79... |
rt_set_baud_rate(BT_TX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE);
} else {
uart_init(BT_RX_BOOTROM_UART);
uart_set_baud_rate(BT_RX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE);
}
periph_config_release_lock();
}
static void prv_deinit_dialog_bootrom_interface(void) {
periph_config_acquire_lock();
if... | {
// Send the header
prv_send_char(0x01); // Start of Header: 0x01
prv_send_char(bootloader_size & 0xff); // LEN_LSB
prv_send_char((bootloader_size >> 8) & 0xff); // LEN_MSB
char c;
if (!prv_bootrom_wait_for_char(&c)) {
PBL_LOG(LOG_LEVEL_ERROR, "Error waiting for header response");
return false;
... | |
layer_offset;
#else
const uint16_t icon_top_default_margin_px = 18 + status_layer_offset;
#endif
const uint16_t frame_height_claimed = icon_height + TEXT_MAX_HEIGHT_PX + status_layer_offset;
const uint16_t icon_top_adjusted_margin_px = MAX(window_height - frame_height_claimed, 0);
// Try and use the default val... | (BUTTON_ID_SELECT, prv_click_handler) | ;
window_single_click_subscribe(BUTTON_ID_UP, prv_click_handler);
window_single_click_subscribe(BUTTON_ID_DOWN, prv_click_handler);
}
Dialog *simple_dialog_get_dialog(SimpleDialog *simple_dialog) {
return &simple_dialog->dialog;
}
void simple_dialog_push(SimpleDialog *simple_dialog, WindowStack *window_stack) {... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (animation) | ;
int32_t animation_elapsed_ms = 0;
uint32_t elapsed_ms = 0;
uint32_t kino_reel_duration = kino_reel_get_duration(player->reel);
bool is_reel_infinite = (kino_reel_duration == PLAY_DURATION_INFINITE);
bool is_animation_reversed = animation_get_reverse(animation);
bool is_animation_infinite =
(animation_... |
status = E_INTERNAL;
}
}
mutex_unlock(s_mutex);
return status;
}
static void prv_delete_events_by_uuid_callback(SettingsFile *old_file, SettingsFile *new_file,
SettingsRecordInfo *info, void *context) {
// Check if valid entry
if (info->key_len != sizeof(WakeupId) || info->val_len != sizeof(Wakeup... | (&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) | |
{ 192, -416, -944},
{ 192, -400, -936},
{ 192, -400, -936},
{ 184, -400, -944},
// 479 seconds
{ 184, -400, -936},
{ 216, -400, -944},
{ 192, -400, -936},
{ 184, -400, -936},
{ 184, -392, -944},
{ 184, -408, -936},
{ 240, -416, -944},
{ 224, -480, -952},
{ 272, -720,... | { 312, -440, -888},
{ 312, -456, -888},
{ 272, -448, -872},
{ 328, -416, -872},
{ 144, -536, -888},
{ 288, -456, -904},
{ 264, -448, -904},
{ 248, -464, -888},
{ 288, -448, -888},
{ 296, -472, -872},
{ 248, -432, -880},
{ 288, -488, -896},
{ 320, -448, -872},
{ 30... |
{ 304, -448, -880},
// 487 seconds
{ 304, -424, -888},
{ 296, -440, -888},
{ 296, -432, -888},
{ 296, -440, -880},
{ 296, -424, -880},
{ 296, -448, -888},
{ 304, -464, -896},
{ 344, -584, -904},
{ 432, -808, -960},
{ 416, -952, -904},
{ -376, 656, -1024},
{ 248, ... |
ect(ctx, &layer->bounds);
#endif
}
//! Ring functionality
static void prv_ring(void *unused) {
PBL_LOG(LOG_LEVEL_DEBUG, "RING");
if (alerts_should_vibrate_for_type(AlertPhoneCall)) {
#if CAPABILITY_HAS_VIBE_SCORES
if (!s_phone_ui_data || !s_phone_ui_data->vibe_score) {
// There is a mutex-related issue t... | text_layer_set_text(&s_phone_ui_data->call_status_text_layer,
s_phone_ui_data->call_status_text_buf) | ;
}
static void prv_start_call_duration_timer(void) {
if (s_phone_ui_data->call_start_time == 0) {
s_phone_ui_data->call_start_time = rtc_get_time();
}
s_phone_ui_data->call_duration_timer = evented_timer_register(
1000, true /* repeating */, prv_update_call_time, NULL);
// Update call time immedia... |
/*
* 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... | PBL_LOG(LOG_LEVEL_DEBUG, "RTC frequency invalid - Skipping calibration") | ;
return (RTCCalibConfig) {
.sign = RTC_CalibSign_Positive,
.units = 0
};
}
// Difference in frequency in mHz (ex. 224 = .224 Hz off from target frequency)
const int32_t rtc_freq_diff = target - frequency;
// RTC_CoarseCalibConfig uses units of +4.069ppm or -2.035ppm.
// Formula:
// pp... |
/*
* 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_ad_data, local_name, 64) | ;
cl_assert_equal_s(local_name, "LightBlue");
cl_assert_equal_i(size, strlen("LightBlue") + 1);
// Test ble_ad_copy_local_name, destination buffer too small:
size = ble_ad_copy_local_name(s_ad_data, local_name, 6);
cl_assert_equal_s(local_name, "Light");
cl_assert_equal_i(size, strlen("Light") + 1);
// ... |
#include "stubs_process_manager.h"
/////////////////////////////
const void * const g_gbitmap_spalding_data_row_infos = &g_gbitmap_spalding_data_row_infos;
void test_gbitmap_formats__create_blank(void) {
const GSize s10 = GSize(10, 10);
const GSize s180 = GSize(180, 180);
GBitmap *bmp = NULL;
cl_assert((voi... | gbitmap_get_palette(bmp) | );
bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat2BitPalette, p, true);
cl_assert(NULL != bmp);
cl_assert(p == gbitmap_get_palette(bmp));
bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat4BitPalette, p, true);
cl_assert(NULL == bmp);
cl_assert(NULL == gbitmap_create_blank_with_palett... |
the exception of the child ActionBarLayer
void prv_update_proc(Layer *layer, GContext* ctx) {
graphics_context_set_fill_color(ctx, GColorWhite);
graphics_fill_rect(ctx, &layer->bounds);
// This is safe becase Layer is the first member in Window and Window is the first member in
// NumberWindow.
_Static_asse... | {
return;
} |
number_window_deinit(number_window);
applib_free(number_window);
}
Window *number_window_get_window(NumberWindow *numberwindow) {
return (&numberwindow->window);
}
|
tatic const int SLOW_THRESHOLD_PERCENTAGE = 0; // Always go "slow" on snowy
static const int PASS_BATTERY_PERCENTAGE = 60; // ~4190mv
#endif
typedef struct {
Window window;
TextLayer status;
char status_string[20];
TextLayer details;
char details_string[45];
RuninTestState test_state;
uint32_t seconds... | window_single_click_subscribe(BUTTON_ID_BACK, prv_back_click_handler) | ;
}
static void app_init(void) {
AppData *data = app_malloc_check(sizeof(AppData));
app_state_set_user_data(data);
*data = (AppData) {
.test_state = RuninStateStart,
.countdown_running = false,
.seconds_remaining = 5400, //1.5h
.fastcharge_enabled = true,
.pass_count = 0,
};
battery_se... |
pplicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "get_byt... | (data->core_dump_base) | ;
}
kernel_free(storage->impl_data);
}
bool is_unread_coredump_available(void) {
uint32_t flash_base = prv_coredump_flash_base(true);
return core_dump_is_unread_available(flash_base);
}
|
unc_b
};
void launcher_task_add_callback(void (*callback)(void *data), void *data) {
}
// Tests
///////////////////////////////////////////////////////////
void test_compositor__initialize(void) {
s_animation_implementation = NULL;
s_last_event = (PebbleEvent) { .type = 0 };
s_modal_window_present = false;
... | (s_render_pending, false) | ;
cl_assert_equal_i(s_count_animation_create, 0);
// Start the animation
s_display_update_in_progress = false;
prv_handle_display_update_complete();
cl_assert_equal_i(s_count_animation_create, 1);
cl_assert_equal_i(s_count_animation_schedule, 1);
}
void test_compositor__app_no_animation(void) {
// Start... |
eTransitionToText) {
return StateStopWaitForResponse;
}
break;
case StateStopWaitForResponse:
if (next_state == StateTransitionToText) {
return next_state;
}
break;
case StateTransitionToText:
if (next_state == StateFinished) {
return next_state;
... | grect_align(&dot_frame, root_frame, GAlignCenter, false) | ;
layer_init(mic_dot_layer, &dot_frame);
layer_set_clips(mic_dot_layer, false); //
layer_set_update_proc(mic_dot_layer, prv_dot_layer_update_proc);
layer_add_child(root_layer, mic_dot_layer);
layer_set_hidden(mic_dot_layer, true);
GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD);
int16_t fon... |
ITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "app_order_storage.h"
#include "kernel/pbl_malloc.h"
#include "process_management/app_install_manager.h"
#include "services/norm... | {
UuidTranslateData *my_data = (UuidTranslateData *) data;
int idx = prv_uuid_search(&entry->uuid, my_data->uuid_list, my_data->count);
if (idx < 0) {
return true; // continue iterating
}
my_data->storage->id_list[idx] = entry->install_id;
return true; // continue iterating
} |
//! Should be called on system task.
void write_uuid_list_to_file(const Uuid *uuid_list, uint8_t count) {
PBL_ASSERT_TASK(PebbleTask_KernelBackground);
int storage_size = sizeof(AppMenuOrderStorage) + (count * sizeof(AppInstallId));
AppMenuOrderStorage *storage = kernel_malloc(storage_size);
memset(storage,... |
/*
* 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... | (PebbleTask_KernelMain) | |
/*
* 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 s_mfg_mode;
} |
void command_enter_mfg(void) {
mfg_enter_mfg_mode_and_launch_app();
}
|
/*
* 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(DISPLAY_FRAMEBUFFER_BYTES == 25944) | ;
bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite);
cl_assert(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE));
}
// Tests 8-bit bitblt to circular display buffer
// Result:
// - gbitmap matches platform loaded PBI
void test_bitblt_circular__color_8_bit(void) {
GB... |
t Running");
break;
case FLASH_TEST_STATUS_STOPPED:
snprintf(data->status_text, STATUS_TEXT_SIZE, "Test Stopped");
break;
case FLASH_TEST_STATUS_PASSED:
snprintf(data->status_text, STATUS_TEXT_SIZE, "Test Passed");
break;
case FLASH_TEST_STATUS_FAILED:
snprintf(data->stat... | (&data->test_window, animated) | |
/*
* 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... | handle_init() | |
se, 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 is distributed o... | (&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.