prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
Y_BLUETOOTH_AIRPLANE_MODE;
} else if (do_not_disturb_is_active()) {
new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_DND;
} else if (!prv_is_pebble_app_connected()) {
new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_DISCONNECTED;
} else if (alert_mask != AlertMaskAllOn) {
if ... | GRect(DISP_COLS - kino_width - kino_padding, 0,
kino_width, STATUS_BAR_LAYER_HEIGHT) | );
kino_layer_set_alignment(&data->battery_icon, GAlignRight);
layer_add_child(&window->layer, kino_layer_get_layer(&data->battery_icon));
prv_reload_status_bar_icons(data);
bounds = grect_inset(bounds, GEdgeInsets(STATUS_BAR_LAYER_HEIGHT, 0, 0, 0));
MenuLayer *menu_layer = &data->menu_layer;
menu_layer_... |
ate.drawing_box.size = levels_layer->bounds.size;
}
if (!grect_is_empty(&ctx->draw_state.clip_box)) {
// call the current node's render procedure
if (node->update_proc) {
node->update_proc(node, ctx);
}
// if client has forgotten to release frame buffer
if (ctx->lock) {
... | (child->parent->window) | ;
}
Layer *node = child->parent->first_child;
if (node == child) {
child->parent->first_child = node->next_sibling;
} else {
while (node->next_sibling != child) {
node = node->next_sibling;
}
node->next_sibling = child->next_sibling;
}
child->parent = NULL;
layer_set_window(child, NU... |
< PebbleTask_App),
HCI_ERROR_CODE_SUCCESS);
}
void __disabled_test_gap_le_connect__disconnection_event_upon_airplane_mode(void) {
BTDeviceInternal device = prv_dummy_device(1);
// Register connection intent:
BTErrno e = gap_le_connect_connect(&device,
... | fake_gap_le_put_cancel_create_event(&device, true /* is_master */) | |
.attributes = action1_attributes
}
},
{
.id = 1, .type = TimelineItemActionTypeResponse,
.attr_list = {
.num_attributes = ARRAY_LENGTH(action2_attributes),
.attributes = action2_attributes
}
},
{
.id = 2,
.type = TimelineItemActionTypeResponse,
.attr_list = {
.num_a... | (&invalid_uuid) | ;
cl_assert_equal_b(notification_storage_get(&invalid_uuid, &r), false);
}
void test_notification_storage__multiple(void) {
Uuid i1 ;
uuid_generate(&i1);
TimelineItem e1 = {
.header = {
.id = i1,
.type = TimelineItemTypeNotification,
.status = 0,
.ancs_uid = 0,
.layout = Layou... |
/*
* 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... | {
while (QSPI_GetFlagStatus(QSPI_FLAG_TC) == RESET) { }
if (actions == QSPIFlag_ClearTC) {
QSPI_ClearFlag(QSPI_FLAG_TC);
}
} |
static void prv_wait_for_qspi_not_busy(void) {
while (QSPI_GetFlagStatus(QSPI_FLAG_BUSY) != RESET) { }
}
static void prv_quad_enable() {
QSPI_ComConfig_InitTypeDef qspi_com_config;
QSPI_ComConfig_StructInit(&qspi_com_config);
qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Write;
qspi_... |
_t mid_value_y_offset = back_value_y_offset + PBL_IF_ROUND_ELSE(30, 26);
const int16_t front_value_y_offset = mid_value_y_offset + PBL_IF_ROUND_ELSE(30, 40);
const int16_t disconnected_text_y_offset = mid_value_y_offset + PBL_IF_ROUND_ELSE(-5, 8);
const int16_t stroke_box_width = PBL_IF_ROUND_ELSE(54, background... | TupletCString(GOLF_HOLE_KEY, "0") | ,
TupletCString(GOLF_BACK_KEY, "000"),
TupletCString(GOLF_MID_KEY, "000"),
TupletCString(GOLF_FRONT_KEY, "000"),
};
app_sync_init(&data->sync, data->sync_buffer, sizeof(data->sync_buffer), initial_values,
ARRAY_LENGTH(initial_values), sync_tuple_changed_callback, sync_error_callback,
... |
t.last_call.draw_text.color.argb);
cl_assert_equal_rect((GRect(10, 10, large_int, large_int)),
s_graphics_draw_text.last_call.draw_text.box);
rocky_api_graphics_get_gcontext()->draw_state.fill_color = GColorBlue;
EXECUTE_SCRIPT(
"ctx.fillText('more text', -10.5, 5000, 60);\n"
);
c... | rocky_global_init(s_graphics_api) | ;
cl_assert_equal_i(1, s_fonts_get_system_font.call_count);
cl_assert_equal_p((GFont)123, s_rocky_text_state.font);
// make this easily testable by putting it int JS context as global
Layer l = {.bounds = GRect(0, 0, 144, 168)};
const jerry_value_t ctx = prv_create_canvas_context_2d_for_layer(&l);
jerry_se... |
ror);
}
// In the error case, clean up the subscription data structure, if no longer used:
if (has_error && prv_prevailing_subscription_type(subscription) == BLESubscriptionNone) {
prv_remove_subscription(connection, subscription);
}
}
// -------------------------------------------------------------------... | circular_buffer_consume(s_circular_buffer[client],
sizeof(header) + header.value_length) | ;
} else {
PBL_LOG(LOG_LEVEL_WARNING, "Consume called while no notifications in buffer");
*characteristic_ref_out = BLE_CHARACTERISTIC_INVALID;
*value_length_in_out = 0;
}
has_more = has_notification &&
prv_get_next_notification_header(client, &next_header);
}
... |
//////////////////////////////////////////
static void prv_program_fifo_register(uint8_t address, uint8_t data) {
// To prevent lockups of the fifo, the fifo config registers should only be programmed
// while in standby mode
PBL_ASSERTN(s_accel_power_mode == BMA255PowerMode_Standby);
const int retries = 2;
... | (enable_int, use_fifo) | ;
s_fifo_is_enabled = use_fifo;
}
////////////////////////////////////////////////////////////////////////////////
// Shake Detection
////////////////////////////////////////////////////////////////////////////////
static void prv_enable_shake_detection(void) {
bma255_write_register(BMA255Register_INT_EN_0, BMA2... |
/*
* 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_cache, 1, &input) | ;
uint32_t *output = lru_cache_get(&s_cache, 1);
cl_assert(output);
cl_assert(*output == input);
}
void test_lru_cache__one_put_two_get(void) {
uint32_t input = 0xdeadbeef;
lru_cache_put(&s_cache, 1, &input);
uint32_t *output;
for (int i = 0; i < 2; i++) {
output = lru_cache_get(&s_cache, 1);
cl... |
neItem *pin) {
timeline_invoke_action(pin, action, NULL);
}
static void prv_do_action_analytics(const TimelineItem *pin, const ActionMenuItem *item) {
const TimelineItemAction *action = item->action_data;
// Record action in the analytics
if (action->type == TimelineItemActionTypeOpenWatchApp) {
analytics... | (false /* success */, cb_data) | ;
}
}
static void prv_push_dismiss_first_use_dialog(ActionMenu *action_menu) {
if (alerts_preferences_check_and_set_first_use_complete(FirstUseSourceDismiss)) {
return;
}
const char* tutorial_msg = i18n_get("Quickly dismiss all notifications by holding the " \
"Select... |
{
dialog_spi_send_and_receive_byte(send[i]);
} |
dialog_spi_end_cmd();
}
// NB: this function is used only by the bootloader.
void dialog_spi_transmit_data(uint8_t *send, size_t buf_len) {
// Don't tx until dialog says its ready!
dialog_spi_wait_for_int();
dialog_spi_transmit_data_no_wait(send, buf_len);
}
void dialog_spi_receive_data_no_wait(uint8_t *rec... | |
_graphics_gpath_${BIT_DEPTH_NAME}__initialize(void) {
fb = malloc(sizeof(FrameBuffer));
framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS});
s_house_path = gpath_create(&s_house_path_info);
s_bolt_path = gpath_create(&s_bolt_path_info);
s_duplicates_path = gpath_create(&s_duplicates_path_info);
s_crossing... | (&ctx, fb) | ;
s_current_path = s_house_path;
gpath_move_to(s_house_path, GPoint(SCREEN_WIDTH, SCREEN_HEIGHT / 2));
ctx.draw_state.drawing_box = GRect(-SCREEN_WIDTH / 2, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
prv_filled_update_proc(NULL, &ctx);
cl_check(gbitm... |
/*
* 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... | gpio_af_init(&BMA255_MOSI_CONFIG, GPIO_OType_PP, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL) | ;
gpio_output_init(&BMA255_SCS_CONFIG, GPIO_OType_PP, GPIO_Speed_50MHz);
SPI_InitTypeDef spi_cfg;
SPI_I2S_DeInit(BMA255_SPI);
spi_cfg.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
spi_cfg.SPI_Mode = SPI_Mode_Master;
spi_cfg.SPI_DataSize = SPI_DataSize_8b;
spi_cfg.SPI_CPOL = SPI_CPOL_Low;
spi_cfg.SPI... |
text) {
uint32_t *num_activities_found = (uint32_t *)context;
*num_activities_found += 1;
char *activity_name = "unknown";
switch (activity) {
case HealthActivityNone:
activity_name = "none";
break;
case HealthActivitySleep:
activity_name = "sleep";
break;
case HealthActivit... | if (num_minutes == 0) {
break;
} |
}
// Print summary
APP_LOG(APP_LOG_LEVEL_DEBUG, "Retrieved %d minute data records", (int)num_records);
// Print detail on the last few minutes
const int k_print_batch_size = 30;
APP_LOG(APP_LOG_LEVEL_DEBUG, "Fetching last %d minutes", k_print_batch_size);
utc_start = time(NULL) - (k_print_batch_size *... |
/*
* 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_event_loop() | ;
}
const PebbleProcessMd* deadlock_get_app_info(void) {
static const PebbleProcessMdSystem s_app_info = {
.common.main_func = &s_main,
.name = "Deadlock"
};
return (const PebbleProcessMd*) &s_app_info;
}
|
0d, 0x0e, 0x0f, 0x10, 0x11,
0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19
};
static void prv_create_test_inbox_and_begin_write(void) {
prv_create_test_inbox();
cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest,
BUFFER_SIZE, s_writer));
}... | (AppInboxServiceTagUnitTest,
BUFFER_SIZE + 1, s_writer) | );
// Shouldn't call ..._end() here because ..._begin() failed.
// Message 3:
cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, 1, s_writer));
cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1));
// ... still writing when event gets processed... |
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 implied.
* See the License for the specific language governin... | {
#if __DCACHE_PRESENT
prv_dcache_operation_all(&SCB->DCCSW);
#endif
} |
MOCKABLE void dcache_invalidate_all(void) {
#if __DCACHE_PRESENT
prv_dcache_operation_all(&SCB->DCISW);
#endif
}
MOCKABLE void dcache_flush_invalidate_all(void) {
#if __DCACHE_PRESENT
prv_dcache_operation_all(&SCB->DCCISW);
#endif
}
MOCKABLE void dcache_flush(const void *addr, size_t size) {
#if __DCACHE_PRESEN... |
500;
const int play_count_spawn = 2;
int duration_total = play_count_spawn * duration_a;
// Create 2 animations
Animation *a = prv_create_test_animation();
animation_set_duration(a, duration_a);
Animation *b = prv_create_test_animation();
animation_set_duration(b, duration_b);
animation_set_play_coun... | (&s_stopped_handler_calls, a) | |
er_calls, a), 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);
// Complete sequence
prv_advance_to_ms_with_timers(start_ms + duration_a + duration_b + 5 * MIN_FRAME_INTERVAL_MS + 1);
cl_assert_equal_... | prv_count_handler_entries(&s_stopped_handler_calls, seq) | , 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, c), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, 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... | if (digit < 0x10) {
c = 'a' + (digit - 0xa);
} else {
c = ' ';
} |
*buffer++ = c;
}
*buffer = '\0';
}
|
ingSession *)DataLoggingSession_AccelSamples) {
s_dls_accel_samples_created = false;
} else if (logging_session == (DataLoggingSession *) DataLoggingSession_ActivitySessions) {
s_dls_activity_sessions_created = false;
} else {
cl_assert(false);
}
}
// ================================================... | {
return;
} |
}
printf("\nFound activities:");
for (int i = 0; i < num_sessions; i++) {
printf("\nFound: type: %d, start_utc: %d, len: %"PRIu16", steps: %"PRIu16", "
"rest_cal: %"PRIu32", active_cal: %"PRIu32", dist: %"PRIu32" ",
(int)sessions[i].type, (int)sessions[i].start_utc, sessions[i].... |
#include "applib/ui/app_window_stack.h"
#include "applib/ui/option_menu_window.h"
#include "applib/ui/time_selection_window.h"
#include "applib/ui/ui.h"
#include "kernel/pbl_malloc.h"
#include "process_management/app_manager.h"
#include "util/date.h"
#include "util/time/time.h"
#include "util/string.h"
#include "serv... | (region_id) | ;
const bool continent_animated = false;
app_window_stack_remove(data->continent_window, continent_animated);
const bool region_animated = true;
app_window_stack_remove(&option_menu->window, region_animated);
}
static void prv_region_menu_push(SettingsTimeData *data) {
const char *title = prv_get_timezone_t... |
ll_is_hidden(music_id));
cl_assert_equal_b(true, app_install_is_hidden(sports_id));
cl_assert_equal_b(false, app_install_is_hidden(bg_counter_id));
cl_assert_equal_b(false, app_install_is_hidden(menu_layer_id));
cl_assert_equal_b(false, app_install_is_hidden(CRAZY_ID));
}
void test_app_install_manager__is_fr... | app_install_mark_prioritized(sports_id, true /* can_expire */) | ;
cl_assert(false == app_install_entry_is_hidden(&entry));
}
// clear and ensure hidden
app_install_unmark_prioritized(sports_id);
cl_assert(true == app_install_entry_is_hidden(&entry));
// simulates multiple messages from app
for (int i = 0; i < 10; i++) {
// visible after communication
app_i... |
/*
* 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... | (LOG_LEVEL_WARNING, "Length of record key exceeds maximum length.") | ;
return -1;
}
Record* r = registry_private_get(key, key_length, uuid, registry);
if (r) {
if (r->value_length == value_length &&
r->description == description &&
memcmp(r->value, value, value_length) == 0) {
PBL_LOG(LOG_LEVEL_DEBUG, "Key & value already exist.");
return 0;
... |
if (!prv_wait_int_low(dev)) {
PBL_LOG(LOG_LEVEL_ERROR, "Timed-out waiting for the HRM app to be ready");
goto failed;
}
// get the running apps (also triggers the app to start)
prv_log_running_apps(dev);
// HRM app is ready, enable handshake interrupts
prv_interrupts_enable(dev, true);
// We ar... | psleep(LOADER_REBOOT_DELAY_MS) | ;
if (!prv_get_and_log_device_info(dev, &hrm_info, true /* log_version */)) {
PBL_LOG(LOG_LEVEL_ERROR,
"Failed to read AS7000 version info after flashing!");
goto cleanup;
}
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "AS7000 firmware is up to date.");
}
cleanup:
// At this point the ... |
t16_t profile;
} FrameHeader;
typedef struct {
//! HDLC context
HdlcStreamingContext hdlc_ctx;
//! The total number of bytes we've read for this frame
uint32_t length;
//! A temporary buffer for storing the footer (checksum byte)
uint8_t footer_byte;
//! The checksum byte (comes after the payload in the ... | smartstrap_fsm_state_test_and_set(SmartstrapStateReadInProgress,
SmartstrapStateReadComplete) | ) {
// we need to handle the timeout from KernelBG
ReadCompleteContext context = {
.success = false,
.is_notify = false
};
system_task_add_callback(prv_read_complete_system_task_cb, context.context_ptr);
}
}
static void prv_store_byte(const uint8_t data) {
// NOTE: THIS IS RUN WITHIN AN... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prompt_send_response(" SMConnectionSignatureResolvingKey: ") | ;
PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG,
(uint8_t *)&info->csrk,
sizeof(SMConnectionSignatureResolvingKey));
prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN,
" local encryption valid: %s\n"
" remote encryption valid: ... |
eHeader *serialized_glance = NULL;
size_t serialized_glance_size = 0;
status_t rv = prv_serialize_glance(glance, &serialized_glance, &serialized_glance_size);
if (rv == S_SUCCESS) {
rv = app_glance_db_insert((uint8_t *)uuid, UUID_SIZE, (uint8_t *)serialized_glance,
serialized_gla... | PBL_LOG(LOG_LEVEL_WARNING,
"Tried to insert AppGlanceDB entry with older creation_time (%"PRIu32")"
" than existing entry (%"PRIu32")", serialized_glance->creation_time,
existing_glance.creation_time) | ;
return E_INVALID_ARGUMENT;
}
// Validate the slices (which also records a `validated_size` we'll use to trim excess slices)
SliceValidationIteratorContext validation_context = {
// Start by taking into account the header of the serialized glance
.validated_size = sizeof(SerializedAppGlanceHeader),
... |
to the buffer) before we receive
//! the byte we previously sent. So, when we receive a byte, we will have sent 2 more bytes by then.
#define SEND_HISTORY_LENGTH (1)
//! Within accessory_send_stream(), how long we wait for a byte to be sent before timing-out.
#define SEND_BYTE_TIMEOUT_MS (100)
//! We DMA into this buf... | if (s_stop_mode_monitor.intervals_without_data >=
s_stop_mode_monitor.max_intervals_without_data) {
// Enough intervals have passed and we should now turn stop mode back on.
stop_mode_enable(InhibitorAccessory);
s_stop_mode_monitor.active = false;
s_stop_mode_monitor.intervals_without_d... |
} else {
// Data was seen, reset the interval counter
s_stop_mode_monitor.intervals_without_data = 0;
}
// Regardless of what happened, this interval is over and should be reset
s_stop_mode_monitor.data_seen_this_interval = false;
}
static void prv_start_timer_cb(void *context) {
new_timer_start(s_... |
itmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(2bitpalette)));
cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat2BitPalette);
}
// Tests 4-bit palettized PNG loading into gbitmap
// Result:
// - gbitmap matches platform loaded PNG
void test_png__color_4_bit(void) {
GBitmap *bitmap = setup_png_test(TEST_PNG_FIL... | (2bitpalette) | |
.draw_row = prv_custom_day_picker_draw_row,
.select_click = prv_custom_day_picker_handle_selection,
.selection_changed = prv_custom_day_picker_selection_changed
});
menu_layer_set_highlight_colors(&data->custom_day_picker_menu_layer,
ALARMS_APP_HIGHLIGHT_COLOR,
... | (&data->time_picker_window) | ;
} else {
int hour, minute;
alarm_get_hours_minutes(data->alarm_id, &hour, &minute);
data->time_picker_window.time_data.hour = hour;
data->time_picker_window.time_data.minute = minute;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! 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... | {
if (s_test_mode_enabled) {
prompt_send_response("Invalid operation: Run 'bt test stop' first");
return;
}
s_test_mode_enabled = true;
bt_ctl_set_override_mode(BtCtlModeOverrideStop);
stop_mode_disable(InhibitorBluetooth);
bt_driver_test_start();
} |
bool bt_test_bt_sig_rf_test_mode(void) {
return bt_driver_test_enter_rf_test_mode();
}
void bt_test_enter_hci_passthrough(void) {
// redirect all communications to the BT module
serial_console_set_state(SERIAL_CONSOLE_STATE_HCI_PASSTHROUGH);
bt_driver_test_enter_hci_passthrough();
}
void bt_test_stop(void)... |
, -864},
{ 360, -96, -832},
{ 384, -80, -984},
{ 344, -72, -1024},
{ 296, -112, -1024},
{ 336, -112, -984},
{ 320, -224, -992},
{ 256, -296, -928},
{ 328, -296, -912},
{ 304, -272, -944},
{ 312, -352, -904},
{ 192, -376, -824},
{ 200, -400, -800},
{ 168, -400, -808},
... | ARRAY_LENGTH(samples) | ;
return samples;
}
// ----------------------------------------------------------------
// Sample captured: 2015-10-05 20:21:22 local
AccelRawData *activity_sample_walk_200_pbl_25662_9(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_200_pbl_25662_9
//> TEST... |
/*
* 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... | (BUTTON_ID_UP, (ClickHandler) up_click_handler) | ;
window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler) select_click_handler);
window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler) down_click_handler);
window_single_click_subscribe(BUTTON_ID_BACK, (ClickHandler) back_click_handler);
}
static void prv_window_load(Window *window) {
AppData *da... |
me.tm_wday;
if (!curr_schedule_enabled) { // Only next schedule is enabled
is_enable_next = true;
// Depending on the current schedule, determine the first day index of the next schedule
int next_schedule_day = (curr_schedule_type == WeekdaySchedule) ? Saturday : Monday;
// Count the number of full da... | prv_toggle_manual_dnd_from_settings_menu(NULL) | |
ngs_file_open(&file, SHELL_PREFS_FILE_NAME, SHELL_PREFS_FILE_LEN) != S_SUCCESS) {
return;
}
prv_convert_deprecated_backlight_behaviour_key(&file);
// Init state for each pref from our backing store
uint32_t num_entries = ARRAY_LENGTH(s_prefs_table);
const PrefsTableEntry *entry = s_prefs_table;
for (u... | if (!entry) {
return 0;
} |
return entry->value_len;
}
// ------------------------------------------------------------------------------------
// Exported function used by blob_db API to read our backing store
bool prefs_private_read_backing(const uint8_t *key, size_t key_len, void *value, int value_len) {
const PrefsTableEntry *entry = pr... |
xt = &stack->transition_context;
transition_context->implementation->render(transition_context, ctx);
} else {
PROFILER_NODE_START(render_modal);
window_render(window, ctx);
PROFILER_NODE_STOP(render_modal);
}
return true;
}
static void prv_update_modal_stacks(UpdateContext *context) {
context... | window_stack_dump(window_stack,
&info->dumps[priority]) | ;
}
} else {
info->disabled = true;
}
xSemaphoreGive(info->interlock);
}
void command_modal_stack_info(void) {
WindowStackInfoContext info = {
.interlock = xSemaphoreCreateBinary(),
};
if (!info.interlock) {
prompt_send_response("Couldn't allocate semaphore for modal stack");
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... | {
if (is_subscribed) {
event_service_client_unsubscribe(&ble_app_state->connection_service_info);
}
} |
return BTErrnoOK;
}
|
/*
* 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 (milliseconds * s_tick_rate_hz) / 1000.0;
} |
void test_freertos_utils__should_convert_48h_to_ticks(void) {
uint32_t time_ms = 24 * 7 * 60 * 60 * 1000;
cl_assert_equal_i(milliseconds_to_ticks(time_ms), (uint32_t)milliseconds_to_ticks_double(time_ms));
}
void test_freertos_utils__should_convert_max_to_ticks(void) {
const uint32_t uint32_max = ~0;
// The... |
ise_count = 0;
s_path_fill_count = 0;
s_path_fill_precise_count = 0;
s_circle_stroke_count = 0;
s_circle_fill_count = 0;
s_offset = (GPoint){ 0 };
if (s_precise_lines) {
free(s_precise_lines);
s_precise_lines = NULL;
}
s_num_precise_lines = 0;
}
// setup and teardown
void test_gdraw_command__i... | (s_path_num_points, 2) | ;
cl_assert_equal_b(s_path_open, false);
cl_assert_equal_i(s_path_fill_count, 1);
cl_assert_equal_i(s_path_stroke_count, 0);
cl_assert_equal_p(s_stroke_points, NULL);
cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points));
prv_reset();
// restore stroke color and change both points
gdr... |
, 840, -152},
{ 1232, 728, -160},
{ 1280, 584, -136},
{ 1232, 488, -136},
{ 1376, 64, -96},
{ 1240, 240, -88},
{ 1432, 176, -136},
{ 1576, 192, -72},
{ 1336, 264, -80},
{ 1288, 56, -80},
{ 704, -368, -88},
{ 936, -136, -88},
{ 736, -80, -400},
// 87 seconds
{ 1072... | // 92 seconds
{ 984, 32, -288},
{ 1272, 96, -408},
{ 1496, 304, -336},
{ 1320, 344, -176},
{ 1288, 320, -280},
{ 1392, 512, -176},
{ 1584, 592, -136},
{ 1592, 816, -104},
{ 1408, 792, -200},
{ 944, 928, -248},
{ 752, 1176, -144},
{ 960, 1024, -72},
{ 984, 944, -64... | |
g_change_sample_rate(MagSampleRate20Hz);
regular_timer_add_multiminute_callback(&s_cb_info, 2);
s_calib_run = true;
s_high_freq_calib_active = true;
samples_collected = 0;
return; // if we are switching to high freq mode, don't use 1st sample
}
if (samples_collected < 5) {
r... | {
int32_t prev_heading = s_last_heading;
launcher_task_add_callback(prv_ecompass_start_callback, NULL);
// wait for last heading to be updated
int retries = 50; // 5 seconds should be ample time
while ((prev_heading == s_last_heading) && retries-- > 0) {
psleep(100);
}
launcher_task_add_callback(pr... |
#endif // RECOVERY_FW
|
se");
* 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 on an "AS IS" BASIS,
* WITH... | app_free(data) | ;
}
static void handle_init(void) {
SettingsAppData *data = app_zalloc_check(sizeof(SettingsAppData));
Window *window = &data->window;
window_init(window, WINDOW_NAME("Settings"));
window_set_user_data(window, data);
window_set_window_handlers(window, &(WindowHandlers){
.load = prv_window_load,
.unl... |
{
// EOF
break;
}
//printf("\nGot line: %s", line);
// Find first token
char *token = strtok(line, " \t\n");
if (!token) {
continue;
}
// If this is a pre-processor directive, skip it
if (token[0] == '#') {
continue;
}
// If this is a comment skip it
... | if (strcmp(token, "TEST_IN_DEEP_SLEEP") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_deep_sleep.value);
} else if (strcmp(token, "TEST_IN_DEEP_SLEEP_MIN") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_deep_sleep.min);
} else if (strcmp(token, ... |
}
// If this is a "static AlgDlsMinuteData samples[] = {" line, skip it
if (strcmp(token, "static") == 0) {
continue;
}
// Grab a sample
if (strcmp(token, "{") == 0) {
PBL_ASSERTN(state->test_entry.name[0] != 0);
int steps = 0;
int orientation = 0;
int vmc = 0;
... |
NCS] = {
.debug_name = "ANCS",
.service_uuid = &s_ancs_service_uuid,
.characteristic_uuids = s_ancs_characteristic_uuids,
.num_characteristics = NumANCSCharacteristic,
.handle_service_discovered = ancs_handle_service_discovered,
.handle_service_removed = ancs_handle_service_removed,
.invalid... | (&service_remove_info->uuid, uuid_string) | |
/*
* 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... | USART_SendData(USART3, c) | |
if (i2c_hal_is_busy(bus)) {
PBL_LOG(LOG_LEVEL_ERROR, "Timed out waiting for bus %s to become non-busy", bus->name);
return false;
} |
}
return true;
}
//! Set up and start a transfer to a bus, wait for it to finish and clean up after the transfer
//! has completed
static bool prv_do_transfer(I2CBus *bus, TransferDirection direction, uint16_t device_address,
uint8_t register_address, uint32_t size, uint8_t *data,
... | |
, -416},
{ 976, 440, -400},
{ 1128, 328, -392},
{ 1256, 312, -256},
{ 1104, 392, -208},
{ 1152, 352, -88},
{ 1448, 312, -56},
{ 1272, 208, 8},
{ 1080, 64, 64},
{ 1048, 0, 0},
{ 1080, -8, -24},
{ 1008, 8, -64},
{ 816, 8, -72},
{ 992, -8, -8},
{ 1008, 16, -16},
... | { 960, 272, -8},
{ 1112, 352, 32},
{ 960, 440, 104},
{ 752, 464, -24},
{ 936, 344, 16},
{ 1152, 368, 120},
{ 1088, 344, 160},
{ 1056, 208, 160},
{ 1192, 72, 104},
{ 1280, 16, -8},
{ 1288, 16, -80},
{ 1240, 0, -48},
{ 1200, -32, -56},
{ 1416, 0, -120},
{ 1072, ... | |
/*
* 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_set_font(gmtime_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)) | ;
layer_add_child(window_layer, text_layer_get_layer(gmtime_layer));
char gmtime_strftime_buf[32];
strftime(gmtime_strftime_buf, 32, "%z %Z", gm_time);
APP_LOG(APP_LOG_LEVEL_DEBUG, "gmtime: %s", gmtime_strftime_buf);
// Time layer
struct tm *lt_time = localtime(&the_time);
static char localtime_buf[32];... |
tr, $1, $2 + 1);
}, value, buffer_p, buffer_size);
return strlen((const char *)buffer_p);
}
////////////////////////////////////////////////////////////////////////////////
// Functions for array object values
////////////////////////////////////////////////////////////////////////////////
uint32_t jerry_get_arr... | if (!str_p) {
return jerry_create_undefined();
} |
return (jerry_value_t)EM_ASM_INT({
return __jerryRefs.ref(Module.Pointer_stringify($0, $1));
}, str_p, str_size);
}
jerry_value_t jerry_create_undefined(void) {
return JERRY_CREATE_VALUE(undefined);
}
////////////////////////////////////////////////////////////////////////////////
// General API Functi... |
tributed 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 "util/misc.h"
#include "drivers/i2c.h"
#include "drivers/periph_config.h"
#include "drivers/gpi... | {
// Configure pin as high impedance input
GPIO_InitTypeDef gpio_init_struct;
gpio_init_struct.GPIO_Pin = pin_config.gpio_pin;
gpio_init_struct.GPIO_Mode = GPIO_Mode_IN;
gpio_init_struct.GPIO_Speed = GPIO_Speed_2MHz;
gpio_init_struct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(pin_config.gpio, &gpio_init_stru... | |
/*
* 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 (!number_str || number_str_length == 0 || number_str[0] == 0 || multiplier == 0) {
return false;
} |
const int32_t base = 10;
bool has_more = true;
bool is_negative = false;
bool number_started = false;
uint32_t decimal_divisor = 0;
int64_t result = 0;
const char * const number_str_end = number_str + number_str_length;
do {
const char c = *number_str;
switch (c) {
case '\0':
has_... |
(LOG_LEVEL_INFO, "Received %d accel samples for KernelMain.", num_samples) | ;
}
// -----------------------------------------------------------------------------------------------
static void prv_kernel_tap_subscription_handler(AccelAxisType axis, int32_t direction) {
PBL_LOG(LOG_LEVEL_INFO, "Received tap event for KernelMain, axis: %d, direction: %d", axis,
direction);
}
#endif
... | |
(now != earliest_start_time) {
// This is a complex animation that has a child that was already scheduled. We must pretend that
// the top-level animation started at earliest_start_time. add_delay_ms may end up being
// negative here if the child already started.
animation->delay_ms = 0;
add_delay_m... | if (!animation || !prv_animation_is_scheduled(state, animation) || !progress_out) {
return false;
} |
*progress_out = animation_private_get_animation_progress(animation);
return true;
}
// -------------------------------------------------------------------------------------------
// Execute the callbacks (update (optional), started, stopped) for a given animation at the given
// timestamp. Returns true if this i... |
t_layer, data->artist_buffer,
&artist_rect, ARTIST_BOUNDS_OFFSET,
ARTIST_TITLE_TEXT_ALIGNMENT,
system_theme_get_font_for_default_size(TextStyleFont_Header));
layer_add_child(&data->window.layer, &data->artist_text_layer... | window_set_status_bar_icon(window, (GBitmap*)&s_status_icon_music_bitmap) | ;
const bool animated = true;
app_window_stack_push(window, animated);
prv_init_ui(window);
}
static void prv_music_event_handler(PebbleEvent *event, void *context) {
MusicAppData *data = app_state_get_user_data();
switch (event->media.type) {
case PebbleMediaEventTypeNowPlayingChanged:
prv_update... |
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 "apps/watch/kickstart/kickstart.h"
#include "popups/timeline/peek.h"
#include "applib/ui... | cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)) | |
e "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 on an "AS IS" BASIS,... | (start.month, 2) | |
esired_size, GBitmapFormat8Bit);
ctx->dest_bitmap = *s_dest_bitmap;
ctx->draw_state.clip_box.size = desired_size;
ctx->draw_state.drawing_box.size = desired_size;
}
///////////////////////////////////////
// RECORDING HORIZONTAL LINE HELPERS //
///////////////////////////////////////
static void prv_prepare_ca... | {
int16_t y1 = (int16_t)(mask_value_index * num_pixels_per_mask_value);
int16_t y2 = (int16_t)(y1 + num_pixels_per_mask_value - 1);
record_func(ctx, x, y1, y2, src_color);
} |
}
cl_assert(graphics_context_mask_record(ctx, NULL));
test_graphics_context_mask_debug(ctx, mask);
graphics_context_mask_destroy(ctx, mask);
}
///////////////////////////////////////
// APPLYING HORIZONTAL LINE HELPERS //
///////////////////////////////////////
static const int16_t hline_applying_test_co... |
Connection *conn = connection_by_idx(conn_idx);
if (conn == NULL) {
PBL_LOG(LOG_LEVEL_ERROR, "No connection for idx=%d", conn_idx);
return;
}
BTDeviceInternal addr;
connection_get_address(conn, &addr);
BleConnectionParams params = {
.conn_interval_1_25ms = event->conn_params.interval_min,
... | (&evt->address, &e.device) | ;
dialog_utils_bd_address_to_bt_device(&evt->resolved_address, &e.new_device);
// Also update the new address in the local connection list:
Connection *connection = connection_by_idx_check(evt->conn_idx);
connection_update_address(connection, &e.new_device);
hc_endpoint_gap_le_connect_send_address_and_irk_c... |
n 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 on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, e... | (&ctx->draw_state.clip_box) | - 1;
const int x_min = ctx->draw_state.clip_box.origin.x;
const int x_max = grect_get_max_x(&ctx->draw_state.clip_box) - 1;
y1 = MAX(y1, y_min);
y2 = MIN(y2, y_max + 1); // Thats because we added one to end of the line
if (!WITHIN(x, x_min, x_max) || y1 > y2) {
// Outside of drawing bounds..
return;... |
ada. Maecenas vehicula felis eu posuere euismod. "
"Fusce at velit ultrices, sagittis enim ac, ultrices lorem. Quisque "
"tincidunt fringilla suscipit. Curabitur tempus lorem metus, sed venenatis "
"augue maximus a. Duis venenatis tortor sit amet justo sodales suscipit. "
"Morbi tincidunt rutrum nisl, eget plac... | cl_assert(strncmp(lipsum, string_buffer, PERSIST_STRING_MAX_LENGTH - 1) == 0) | |
n_bar,
prv_click_config_provider);
}
//! Put the correct data in the 3 text fields
static void prv_display_caller_info(PebblePhoneCaller *caller) {
prv_set_caller_id_text(caller);
}
static void prv_phone_ui_deinit(void) {
if (s_phone_ui_data == NULL) {
return;
}
... | (&s_phone_ui_data->window, &(WindowHandlers) {
.unload = prv_handle_window_unload,
}) | ;
window_set_overrides_back_button(window, true);
#if !PLATFORM_TINTIN
s_phone_ui_data->bg_color.left = DEFAULT_COLOR;
s_phone_ui_data->bg_color.right = DEFAULT_COLOR;
s_phone_ui_data->bg_color.boundary = 0;
#endif
const int16_t width = window->layer.bounds.size.w - (TEXT_MARGIN_WIDTH * 2);
// Container l... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_check(prv_get_emoji_icon_by_string(s_emoji_table, "😀 ") ==
RESOURCE_ID_EMOJI_BIG_OPEN_SMILE_LARGE) | |
ttingsFile format.
int pid = persist_map_auto_id(uuid);
if (FAILED(pid)) {
// Attempting to debug persist map failure
PBL_LOG(LOG_LEVEL_WARNING, "Failed to get pid! %d", pid);
persist_map_dump();
return pid;
}
return snprintf(name, buf_len, "ps%06d", pid);
}
status_t persist_service_delete_file... | (&store->list_node,
&s_client_stores /* &head */, NULL /* &tail */) | ;
kernel_free(store);
}
}
prv_unlock();
}
|
/*
* 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... | ((uint8_t *)&received_crc, sizeof(received_crc)) | ;
if (received_crc != expected_crc) {
PBL_LOG(LOG_LEVEL_ERROR, "Load Data Crc. Expected: 0x%x Received CRC: 0x%x",
(int)expected_crc, (int)received_crc);
}
return (received_crc == expected_crc);
}
static bool prv_send_vt(const uint8_t *vt, uint32_t vt_size_bytes) {
uint8_t vt_write[] = {'V', '... |
CKs start conditions whilst it is busy
// Retry start condition after a short delay.
// A NACK count is incremented for each NACK received, so that legitimate NACK
// errors cause the transfer to be aborted (after the NACK count max has been reached).
bus->transfer.nack_count++;
... | 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 pdFALSE;
} |
portBASE_TYPE should_context_switch = pdFALSE;
switch (bus->transfer.state) {
case TRANSFER_STATE_WRITE_ADDRESS_TX:
// Write the i2c device address to the bus to select it in write mode.
bus->i2c->DR = bus->transfer.device_address & ~I2C_READ_WRITE_BIT;
bus->transfer.state = TRANSFER_STATE_W... |
nutes, minute_data);
// Call the minute handler, which computes the minute stats and saves them to data logging
// as well as to the sleep PFS file.
prv_feed_minute_data(num_minutes, minute_data, false /*simulate_bg_delays*/);
// Retrieve all of the minute data at once
HealthMinuteData retrieve[num_minutes ... | for (int j = 0; j < num_records; j++) {
printf("\nRecord:%d, steps: %d", j, (int)received_records[j].steps);
} | |
uled(state, child)
|| prv_animation_children_scheduled(state, child)) {
return true;
}
}
}
return false;
}
// -------------------------------------------------------------------------------------------
// Unschedule of an animation and optional destroy, recurses into children of ... | (list_contains(state->unscheduled_head, &animation->list_node)
|| list_contains(state->scheduled_head, &animation->list_node)) | ;
#endif
if (force_destroy || animation->defer_delete
|| ((allow_auto_destroy && animation->auto_destroy)
&& !prv_animation_is_scheduled(state, animation))) {
// It's possible the stopped handler rescheduled, so check before we destroy it
prv_unlink_and_free(state, animation);
}
}
// ---... |
mutex_unlock(s_lock);
}
static void prv_session_result_timeout(void * data) {
mutex_lock(s_lock);
PBL_ASSERTN(s_state == SessionState_WaitForSessionResult);
prv_reset();
PBL_LOG(LOG_LEVEL_WARNING, "Timeout waiting for session result");
prv_send_event(VoiceEventTypeSessionResult, VoiceStatusTimeout, NULL)... | prv_stop_recording() | ;
prv_start_result_timeout();
unlock:
mutex_unlock(s_lock);
}
void voice_cancel_dictation(VoiceSessionId session_id) {
mutex_lock(s_lock);
if ((session_id != s_session_id) ||
(session_id == VOICE_SESSION_ID_INVALID)) {
goto unlock;
}
if (s_state != SessionState_Idle) {
new_timer_stop(s_time... |
if (icon) {
void (*draw_func)(GContext *, GDrawCommandImage *, GPoint) = gdraw_command_image_draw;
#if PBL_BW
if (menu_cell_layer_is_highlighted(cell_layer)) {
draw_func = prv_draw_pdc_bw_inverted;
}
#endif
// Inset the draw box from the left to leave some margin on the icon's left side
GRec... | {
// as measured from the design specs
const int inset = 8;
GRect frame = cell_layer->bounds;
// manually inset the frame to save stack space, instead of using grect_inset
frame.origin.x += inset;
frame.origin.y += inset;
frame.size.h -= inset * 2;
frame.size.w -= inset * 2;
const GFont title_font = s... |
static void prv_draw_notification_cell_round_unselected(GContext *ctx, const Layer *cell_layer,
const char *title, const char *subtitle,
GDrawCommandImage *icon) {
// as measured from the design specs
c... |
->origin.y + 1, 1, rect->size.h - 2)); // left
graphics_fill_rect(ctx, &GRect(rect->origin.x + rect->size.w - 1,
rect->origin.y + 1, 1, rect->size.h - 2)); // right
ctx->draw_state.fill_color = fill_color;
}
#if PBL_COLOR
T_STATIC void prv_draw_rect_aa_stroked(GContext *ctx, const ... | GPoint(origin.x, origin.y + radius + height_actual - 1) | ;
const GPoint right_t = GPoint(origin.x + width - 1, origin.y + radius);
const GPoint right_b = GPoint(origin.x + width - 1, origin.y + radius + height_actual - 1);
// Draw lines between each transformed corner point
graphics_draw_line(ctx, top_l, top_r); // top
graphics_draw_line(ctx, bottom_l, bott... |
CompositorState_Modal) {
compositor_render_modal();
prv_compositor_flush();
}
prv_release_app_framebuffer();
}
static void prv_send_app_render_request(void) {
PebbleEvent event = {
.type = PEBBLE_RENDER_REQUEST_EVENT,
};
process_manager_send_event_to_process(PebbleTask_App, &event);
}
void com... | if (!prv_should_render()) {
s_deferred_render.transition_complete.pending = true;
return;
} |
prv_finish_transition();
}
void compositor_transition(const CompositorTransition *compositor_animation) {
if (s_animation_state.animation != NULL) {
PBL_LOG(LOG_LEVEL_DEBUG, "Animation <%u> in progress, cancelling",
(int) s_animation_state.animation);
animation_destroy(s_animation_state.anim... |
? MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT : menu_cell_basic_cell_height();
}
void test_menu_layer__default_ignores_row_height_for_selection(void) {
MenuLayer l;
const int height = 180;
menu_layer_init(&l, &GRect(10, 10, height, 180));
menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){
.draw_row =... | (true, s_content_available[ContentIndicatorDirectionUp]) | ;
cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]);
menu_layer_set_selected_next(&l, false, MenuRowAlignNone, false);
cl_assert_equal_i(3 * NORMAL, l.selection.y);
cl_assert_equal_i(-FOCUSED, scroll_layer_get_content_offset(&l.scroll_layer).y);
cl_assert_equal_i(FOCUSED, l.selectio... |
{ 1264, 1064, -368},
{ 1288, 920, -424},
{ 1032, 984, -544},
{ 840, 848, -696},
{ 560, 888, -848},
{ 240, 1104, -872},
{ 72, 1048, -936},
{ -200, 1064, -776},
{ -168, 920, -632},
{ -144, 904, -528},
{ -216, 504, -424},
// 125 seconds
{ -328, 520, -552},
{ -440, 20... | ARRAY_LENGTH(samples) | ;
return samples;
}
// ----------------------------------------------------------------
// Sample captured: 2015-10-19 10:55:56 local
AccelRawData *activity_sample_walk_200_pbl_28385_9(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_200_pbl_28385_9
//> TEST... |
/*
* 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 (len == 0) {
return E_INVALID_ARGUMENT;
} |
return len;
}
status_t prefs_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len) {
bool success = prefs_private_read_backing(key, key_len, val_out, val_out_len);
if (success) {
return S_SUCCESS;
} else {
return E_INVALID_ARGUMENT;
}
}
status_t prefs_db_delete(const 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... | if (data->select_index == SelectIndexOverflow) {
data->word_wrap = !(data->word_wrap);
} | |
/*
* 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_heap_analytics_log_stats_to_app_heartbeat(true /* is_rocky_app */) | ;
rocky_api_deinit();
jerry_cleanup();
rocky_runtime_context_deinit();
}
bool rocky_event_loop_with_string_or_snapshot(const void *buffer, size_t buffer_size) {
#if CAPABILITY_HAS_JAVASCRIPT
prv_rocky_init();
const bool result = prv_rocky_eval_buffer(buffer, buffer_size);
if (result) {
app_event_loop_c... |
ld_install_id);
}
// Clear for next time.
s_next_app = (NextApp) {};
return true;
}
// ---------------------------------------------------------------------------------------------
void app_manager_start_first_app(void) {
const PebbleProcessMd* app_md = system_app_state_machine_system_start();
PBL_ASSER... | {
switch (s_app_task_context.exit_reason) {
case APP_EXIT_NOT_SPECIFIED:
return INSTALL_ID_INVALID;
case APP_EXIT_ACTION_PERFORMED_SUCCESSFULLY:
PBL_LOG(LOG_LEVEL_INFO,
"Next app overridden with watchface because action was performed successfully");
return watchface_get_default... | |
and_send_data(payload, length);
// send the checksum
uint32_t checksum = CRC32_INIT;
checksum = crc32(checksum, &header, sizeof(header));
if (payload && length) {
checksum = crc32(checksum, payload, length);
}
prv_encode_and_send_data(&checksum, sizeof(checksum));
accessory_send_byte(HDLC_FLAG);
a... | prv_coredump_flash_base(&response.address, &response.length) | ) {
response.address = 0;
response.length = 0;
}
} else {
PBL_LOG(LOG_LEVEL_ERROR, "Invalid region (%"PRIu8")", request->region);
}
prv_send_frame(OPCODE_FLASH_GEOMETRY, &response, sizeof(response));
}
static void prv_handle_flash_erase_request(const void *payload, uint32_t length) {
if (le... |
nfig.scheduled_days, sizeof(config.scheduled_days));
return true;
}
return false;
}
// ----------------------------------------------------------------------------------------------
static void prv_alarm_set_config(SettingsFile *file, AlarmId id, const AlarmConfig* config) {
PBL_ASSERTN(id >= 0 && id < MAX_... | (id, &config, context) | ) {
goto cleanup;
}
prv_enable_alarm_config(&config, true /* enabled */);
prv_alarm_set_config(&file, id, &config);
cleanup:
prv_file_close_and_unlock(&file);
}
// ----------------------------------------------------------------------------------------------
typedef struct SetAlarmTimeContext {
int hou... |
ngth,
&parse_error);
if (parse_error) {
PBL_HEXDUMP(LOG_LEVEL_INFO, response_data, response_length);
prv_reset_due_to_parse_error();
return;
}
if (!is_complete) {
// Keep waiting
BLE_LOG_DEBUG("Incomplete response. Waiting for another DS notification.");
return;
}
// Got all t... | memcpy(request_data_ptr, app_id->value, app_id->length) | ;
request_data_ptr += app_id->length;
// NULL terminator
*request_data_ptr = '\0';
request_data_ptr += 1;
// Requested attribute id(s)
for (unsigned i = 0; i < ARRAY_LENGTH(s_fetched_app_attributes); ++i) {
*request_data_ptr = s_fetched_app_attributes[i].id;
request_data_ptr++;
}
prv_set_state(... |
isteners, num_entries, listener);
}
static bool prv_remove_listener(jerry_value_t event_listeners, uint32_t idx,
jerry_value_t listener, void *data) {
ListenerQueryData *query_data = data;
if (query_data->listener == listener) {
// calling `event_listeners.splice(idx, 1)` to rem... | {
API_REFS_FOREACH(api_ref) {
if ((*api_ref)->remove_handler) {
(*api_ref)->remove_handler(event_name, func);
}
}
} | |
all stored data
activity_test_reset(true /*reset_settings*/, true /*tracking_on*/, NULL, NULL);
int32_t before;
activity_get_metric(ActivityMetricStepCount, 1, &before);
// Walk for about 30 minutes
const int k_num_minutes = 30;
// The sample we feed in feeds about 90 steps/min
const int k_steps_per_mi... | activity_get_metric(ActivityMetricSleepStateSeconds, 1, &value) | ;
PBL_LOG(LOG_LEVEL_DEBUG, "sleep state minutes: %d", (int)(value / SECONDS_PER_MINUTE));
prv_test_end(context, passed);
}
// -------------------------------------------------------------------------------
// Test that we don't crash or get a weird sleep session if the UTC time changes while
// sleeping
static v... |
rogressSegmentType_Vertical) {
p1 = prv_get_point_between_points(segment->points[0], segment->points[3], start);
p2 = prv_get_point_between_points(segment->points[1], segment->points[2], start);
p3 = prv_get_point_between_points(segment->points[1], segment->points[2], end);
p4 = prv_get_point_between_po... | graphics_context_set_stroke_width(ctx, 2) | ;
for (int i = 0; i < progress_bar->num_segments; i++) {
HealthProgressSegment *segment = &progress_bar->segments[i];
GPointPrecise p0 = prv_get_adjusted_gpoint_precise_from_gpoint(segment->points[0]);
GPointPrecise p1 = prv_get_adjusted_gpoint_precise_from_gpoint(segment->points[1]);
GPointPrecise ... |
tate.node->timestamp, midnight_apr_28_pst);
}
void test_timeline__all_day_ios_bug_2(void) {
TimelineItem item = {
.header = {
.id = {0x29, 0xac, 0xd8, 0xb5, 0x9, 0xc7, 0x4c, 0x31, 0xbf,
0x6f, 0x3, 0x64, 0xd0, 0x5b, 0x9b, 0xc2},
.parent_id = {0},
.timestamp = 1430200800, // 9am ... | timeline_iter_remove_node_with_id(&head, &all_day_item.header.id) | );
cl_assert(!timeline_iter_remove_node_with_id(&head, &all_day_item.header.id));
}
|
strncpy(data.name, local_device_name, sizeof(data.name)) | ;
SPRF_PERSIST_FIELD(data, local_name);
} else {
SPRF_ERASE_FIELD(local_name);
}
}
prv_unlock();
}
//!
//! BLE Root Key APIs
//!
bool shared_prf_storage_get_root_key(SMRootKeyType key_type, SM128BitKey *key_out) {
bool rv;
prv_lock();
{
SprfRootKeys data;
rv = SPRF_FETCH_FIELD(da... | |
_REG_INDEX_R0] = g_stacked_regs[Stacked_Register_R0];
s_thread_info.ti.registers[portCANONICAL_REG_INDEX_R1] = g_stacked_regs[Stacked_Register_R1];
s_thread_info.ti.registers[portCANONICAL_REG_INDEX_R2] = g_stacked_regs[Stacked_Register_R2];
s_thread_info.ti.registers[portCANONICAL_REG_INDEX_R3] = g_stacked... | hw_spi_reset(s_spi->bus_id) | ;
hw_spi_init(s_spi->bus_id, &s_spi->hw_init);
// Configure the hardware/GPIO interface. Use the host_transport code for now.
host_transport_init_periph();
host_transport_configure_spi_scs_pin(SCSPinFunction_SPI_CS);
host_transport_set_mcu_int(false);
prv_timer_enable();
// Loop until we get a connecti... |
_neg(box->origin), box->size };
s_dest_bitmap = gbitmap_create_blank(box->size, PBL_IF_COLOR_ELSE(GBitmapFormat8Bit, GBitmapFormat1Bit));
bitblt_bitmap_into_bitmap(s_dest_bitmap, screen_bitmap, GPointZero, GCompOpAssign,
GColorClear);
gbitmap_destroy(screen_bitmap);
}
}
type... | (gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)) | ;
}
void test_timeline_peek__peek_title_only(void) {
prv_render_timeline_peek(&(TimelinePeekItemConfig) {
.title = "Trash up the Place 🔥",
.icon = TIMELINE_RESOURCE_TIDE_IS_HIGH,
.num_concurrent = 0,
});
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
}
void test_timeline_peek__peek_title_o... |
orientation, &vmc);
PBL_LOG(LOG_LEVEL_DEBUG, "processed %d samples (%d seconds) of data: %d steps",
num_samples, num_samples / KALG_SAMPLE_HZ, steps);
return steps;
}
// ----------------------------------------------------------------------------------
// The file discovery state definitions
typedef en... | } else if (strcmp(token, "TEST_EXPECTED_MAX") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.exp_steps_max);
} else if (strcmp(token, "TEST_WEIGHT") == 0) {
sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight);
} else if (strcmp(token, "TEST_NAME") == ... |
// ---------------------------------------------------------------------------------------
static bool prv_parse_sleep_samples_file(SleepSampleDiscoveryState *state) {
// Init for next set of samples
state->test_entry = (SleepFileTestEntry) {
.samples = state->samples,
.version = 1,
.total = {-1, -1,... |
oid) {
}
void session_remote_version_start_requests(CommSession *session) {
}
static int s_send_next_count;
static void prv_send_next(Transport *transport) {
++s_send_next_count;
}
static int s_close_count;
Transport *s_last_closed_transport;
static void prv_close(Transport *transport) {
++s_close_count;
s_l... | cl_assert_equal_p(comm_session_get_by_type(CommSessionTypeSystem), session) | ;
comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection);
fake_system_task_callbacks_invoke_pending(); // get dls called
cl_assert_equal_b(s_dls_private_handle_disconnect_called, true);
cl_assert_equal_b(s_comm_session_event_put, true);
}
void test_session__get_type_app(void) {
Transport... |
_t samples_per_step = 0;
if (num_steps > 0) {
samples_per_step = num_samples / num_steps;
}
int need_step_ctr = samples_per_step;
time_t utc_secs;
uint16_t ms;
rtc_get_time_ms(&utc_secs, &ms);
uint64_t start_ms = utc_secs * 1000 + ms;
uint64_t ms_per_sample = 1000 / ALGORITHM_SAMPLING_RATE;
for ... | {
uint32_t encoded = record->entries[j];
uint32_t run_size = ACTIVITY_RAW_SAMPLE_GET_RUN_SIZE(encoded);
AccelRawData sample = (AccelRawData) {
.x = ACTIVITY_RAW_SAMPLE_GET_X(encoded),
.y = ACTIVITY_RAW_SAMPLE_GET_Y(encoded),
.z = ACTIVITY_RAW_SAMPLE_GET_Z(encoded),
};
... |
cl_assert_equal_i(num_samples_seen, record->num_samples);
}
cl_assert_equal_i(num_samples, 0);
}
// ---------------------------------------------------------------------------------------
// Init and enable the activity service
static void prv_activity_init_and_set_enabled(bool enable) {
activity_init();
... |
prv_lock();
s_has_sent_byte = true;
s_did_send_byte = true;
PBL_ASSERTN(!s_input_enabled);
while (!(uart_is_tx_ready(ACCESSORY_UART))) continue;
// this section needs to be atomic since the UART IRQ also modifies these variables
portENTER_CRITICAL();
if (s_send_history.has_data) {
// The send buffer i... | {
prv_enable_dma();
} | else {
prv_disable_dma();
}
prv_unlock();
}
bool accessory_bus_contention_detected(void) {
return s_bus_contention_detected;
}
static uint32_t prv_get_baudrate(AccessoryBaud baud_select) {
const uint32_t BAUDS[] = { 9600, 14400, 19200, 28800, 38400, 57600, 62500, 115200, 125000, 230400,
... |
0.042; // 6 on snowy
const int32_t s_large_movement_size = DISP_COLS * 0.14; // 20 on snowy
const int32_t s_upwards_movement_size = DISP_ROWS * 0.18; // 30 on snowy
static void prv_transition_animation_update(GContext *ctx, Animation *animation,
uint32_t progress) {
const ... | animation_set_duration(animation, duration) | ;
animation_set_curve(animation, AnimationCurveLinear);
s_data.animation_offset_px = 0;
}
static void prv_transition_animation_update_stub(GContext *ctx,
Animation *animation,
uint32_t progress) {
}
const Compositor... |
ges/viewpage.action?pageId=491698#PebbleProtocol(BluetoothSerial)-0xb(11)-Time/Clock(bigendian)
time_t utc_time; // UTC timestamp
int16_t utc_offset_min; // local timestamp - UTC timestamp in mins
int8_t region_name_len; // timezone name length
cha... | if (dst_start_stamps[start_idx] > dst_end_stamps[end_idx]) {
start_idx--;
} |
if (dst_start_stamps[start_idx] < utc_time && dst_end_stamps[end_idx] < utc_time) {
start_idx++;
end_idx++;
}
tz_info->dst_start = dst_start_stamps[start_idx];
tz_info->dst_end = dst_end_stamps[end_idx];
#endif // RECOVERY_FW
}
static void prv_clock_get_timezone_info_from_region_id(
int16_t reg... |
oded_codepoint = utf8_peek_codepoint(malformed_test_string_utf8, NULL);
uint32_t actual_codepoint = s_valid_test_codepoints[i];
cl_assert_equal_i(decoded_codepoint, actual_codepoint);
malformed_test_string_utf8 = utf8_get_next(malformed_test_string_utf8);
}
// When we decode the invalid codepoint, it s... | cl_assert_equal_s(output_buffer, "WW\xe2\x80\xa6") | ;
cl_assert_equal_i(trunc_size, 6);
// test where max_length < ellipsis_length
output_buffer = realloc(output_buffer, 3);
trunc_size = utf8_truncate_with_ellipsis("Hey", output_buffer, 3);
cl_assert_equal_i(trunc_size, 0);
// test where max_length == ellipsis_length
output_buffer = realloc(output_buffer... |
_start(config);
kernel_free(config);
if (s_comm_is_running) {
bt_local_addr_init();
bt_persistent_storage_register_existing_ble_bondings();
gap_le_init();
bt_local_id_configure_driver();
#if CAPABILITY_HAS_BUILTIN_HRM
ble_hrm_init();
#endif
bt_pairability_init();
analytics_stopwatch_sto... | (s_comm_state_change_mutex) | ;
if (should_schedule_eval) {
system_task_add_callback(prv_comm_state_change, NULL);
}
}
void bt_ctl_init(void) {
s_comm_state_change_mutex = mutex_create();
s_comm_airplane_mode_on = bt_persistent_storage_get_airplane_mode_enabled();
s_comm_initialized = true;
analytics_stopwatch_start(ANALYTICS_DEVI... |
ry);
}
activity_init();
activity_set_enabled(true);
// Restart tracking
if (tracking) {
activity_start_tracking(test_mode);
while (!s_activity_state.started) {
sys_psleep(1);
}
}
return true;
}
// ----------------------------------------------------------------------------------------... | (s_activity_state.mutex) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
get_sector_base_calls++;
return addr & 0xfffff000;
} |
int erase_subsector_begin_calls = 0;
status_t erase_subsector_begin_return = S_SUCCESS;
status_t flash_impl_erase_subsector_begin(FlashAddress addr) {
erase_subsector_begin_calls++;
return erase_subsector_begin_return;
}
int erase_sector_begin_calls = 0;
status_t erase_sector_begin_return = S_SUCCESS;
status_t f... |
#include "clar.h"
// Stubs
///////////////////////////////////////////////////////////////////////////////
#include "stubs_logging.h"
#include "stubs_passert.h"
#include "fake_new_timer.h"
static bool s_mfg_mode_entered;
void mfg_enter_mfg_mode(void) {
s_mfg_mode_entered = true;
}
void mfg_enter_mfg_mode_and_la... | (BUTTON_ID_UP) | ;
// Now we're just holding down, which is a different combo
StubTimer *timer = prv_find_combo_timer();
cl_assert(timer);
cl_assert_equal_i(stub_new_timer_timeout(timer->id), 5000);
stub_new_timer_fire(timer->id);
cl_assert(!s_mfg_mode_entered);
cl_assert(s_select_cb_called);
}
void test_getting_star... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.