prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
/*
* 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... | (shape_width, shape_width) | ;
for (unsigned int i = 0; i < num_mask_levels; i++) {
// Calculate the angle of the mask shape using the current animation progress
// Offset the angle to space each of the mask shapes equally apart
const uint32_t starting_angle = (i * TRIG_MAX_ANGLE / num_mask_levels);
const int32_t progress_angle_... |
ll_day_items[2].header.id));
cl_assert(state.node->all_day);
// check that the item we see is timestamped at local midnight rather than utc midnight
// 1421136000 is midnight Jan 13, PST
cl_assert_equal_i(state.pin.header.timestamp, 1421136000);
// second all day event
cl_assert(iter_next(&iterator));
cl... | (!iter_next(&iterator)) | ;
}
static void prv_insert_extra_case_items(void) {
pin_db_flush();
for (int i = 0; i < ARRAY_LENGTH(s_extra_case_items); i++) {
cl_assert_equal_i(pin_db_insert_item(&s_extra_case_items[i]), 0);
}
}
// 5am, no events passed
void test_timeline__extra_case_forwards(void) {
prv_insert_extra_case_items();
... |
:
*size = GSize(width, style->fat_pin_height);
break;
case LayoutLayerModePinnedThin:
*size = GSize(width, style->thin_pin_height);
break;
}
}
static void prv_get_frame(TimelineLayer *layer, int index, GRect *frame) {
const TimelineLayerStyle *style = prv_get_style();
index = CLIP(ind... | (&layer->layouts_layer, (Layer *)&layout->icon_layer) | ;
layer->layouts[index] = layout;
layer->layouts_info[index] = info;
}
static void prv_destroy_layout(TimelineLayer *layer, int index) {
TimelineLayout *timeline_layout = layer->layouts[index];
timeline_layout->is_being_destroyed = true;
layer_remove_from_parent((Layer *)timeline_layout);
layout_destroy((L... |
extern TimerID bt_driver_gatt_get_watchdog_timer_id(void);
#define TEST_GATT_CONNECTION_ID (1234)
static BTDeviceInternal prv_dummy_device(uint8_t octet) {
BTDeviceAddress address = {
.octets = {
[0] = octet,
[1] = octet,
[2] = octet,
[3] = octet,
[4] = octet,
[5] = octet,
... | fake_gatt_is_service_discovery_running() | |
APP_GLANCE_RESULT_TEMPLATE_STRING_TOO_LONG);
// Check that adding a slice with a bad template string fails
const char *invalid_template_subtitle = "How much time? {time_until(500)|format('%uS',)}";
slice = (AppGlanceSlice) {
.expiration_time = APP_GLANCE_SLICE_NO_EXPIRATION,
.layout.icon = APP_GLANCE_SL... | cl_assert_equal_b(app_glance_service_get_current_slice(&APP_GLANCE_TEST_UUID, &slice_out), false) | |
/*
* 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_animation_infinite && !is_reel_infinite && is_animation_reversed) {
// If animation is infinite, reel is not infinite and animation is reversed
animation_get_elapsed(animation, &animation_elapsed_ms);
elapsed_ms = MAX(0, (int32_t)player->to_elapsed_ms - animation_elapsed_ms);
} else {
elapsed_... |
bool frame_changed = kino_reel_set_elapsed(player->reel, elapsed_ms);
prv_announce_frame_did_change(player, frame_changed);
}
static void prv_play_anim_stopped(Animation *anim, bool finished, void *context) {
KinoPlayer *player = context;
player->animation = NULL;
prv_announce_did_stop(player, finished);
}... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
prv_click_reset(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_click.ha... |
NTAGE = 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_remaining;
bool countdown_running;
bool fastcharge_enabled;
int pass_count;
} AppData;
static void prv... | (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_set_fast_charge(true);
battery_set_charge_enable(true);
Window *window = &data->wi... |
_version,
};
strncpy(entry->name, db_entry->name, APP_NAME_SIZE_BYTES);
return true;
}
static bool prv_app_install_entry_from_resource_registry_entry(const AppRegistryEntry *reg_entry,
AppInstallEntry *entry) {
PebbleProcessInfo *app_header = kernel_malloc_check(sizeof(PebbleProcessInfo));
bool rv = fal... | (app_id, &entry) | |
const char* fmt, va_list fmt_args) {
int message_length = vsniprintf(msg->message + msg->message_length,
max_message_len - msg->message_length, fmt, fmt_args);
msg->message_length += message_length;
if (msg->message_length > max_message_len) {
msg->message_length = max_message_len;
... | va_start(fmt_args, packed_loghash) | |
/*
* 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... | {
graphics_context_set_fill_color(ctx, color);
graphics_fill_rect(ctx, &layer->bounds);
} |
static void prv_fill_cols(GContext *ctx, uint8_t color, int16_t *row, int16_t column,
uint8_t num_pixels) {
const GRect rect = { { column, *row }, { 1, num_pixels } };
// Set alpha bits to make it opaque
graphics_context_set_fill_color(ctx, (GColor) { .argb = (0b11000000 | color) });
... |
el_zalloc(kalg_state_size());
const uint32_t k_max_tests = 1000;
uint32_t num_tests = 0;
// Results
ActivityTestResults test_results[k_max_tests];
memset(test_results, 0, sizeof(test_results));
// List of metrics we measure for each test
// IMPORTANT: This order must match the order in the SleepTestEnt... | ("| ---------------------- ") | ;
}
float weighted_sum = 0.0;
int pass_count = 0;
int fail_count = 0;
ActivityFileTestEntry *entry = &test_entry[0];
ActivityTestResults *results;
for (int i = 0; i < num_tests; i++, entry++, results++) {
results = &test_results[entry->test_idx];
// Generate the status string
const char *sta... |
the most recent system session capabilities
static const char SYSTEM_CAPABILITIES_KEY[] = "SYSTEM_CAPABILITIES";
//! This key is used to access the BLE address that can be used for address pinning.
static const char BLE_PINNED_ADDRESS_KEY[] = "BLE_PINNED_ADDRESS";
static uint8_t s_bt_persistent_storage_updates = 0;
... | settings_file_get_len(&fd, key, key_len) | |
attributes_per_actions_out);
}
size_t attributes_actions_get_required_buffer_size(uint8_t num_attributes,
uint8_t num_actions,
uint8_t *attributes_per_actions,
size_t... | (&source->actions[i].attr_list) | ;
if (buffer + offset + attr_size > buffer_end) {
return false;
}
attribute_list_copy(&dest->actions[i].attr_list, &source->actions[i].attr_list,
buffer + offset, buffer + offset + attr_size);
offset += attr_size;
}
return true;
}
bool attributes_actions_deep_copy(At... |
c void prv_gpath_draw_filled_cb(GContext *ctx, int16_t y,
Fixed_S16_3 x_range_begin, Fixed_S16_3 x_range_end,
Fixed_S16_3 delta_begin, Fixed_S16_3 delta_end,
void *user_data) {
const GRect fill_rect = GRect... | graphics_context_set_stroke_color(ctx, outer_ring_color) | ;
graphics_context_set_fill_color(ctx, outer_ring_color);
graphics_fill_radial_internal(ctx, center, interpolated_outer_radial_inner_radius,
outer_radial_outer_radius, 0, TRIG_MAX_ANGLE);
// The outer ring also has a small inner ring with a radial width equal to the dot radius
... |
container_bounds.size.w, container_bounds.size.h);
layer_set_hidden(&s_phone_ui_data->action_bar.layer, true /* hide */);
layer_set_bounds(&s_phone_ui_data->core_ui_container, &onscreen);
#endif
}
//! Action bar setup functions
static void prv_set_action_bar_icon(ButtonId button, ResourceI... | if (actions & PhoneCallActions_Reply) {
// Move to top if that place isn't taken
if (!s_phone_ui_data->up_action) {
s_phone_ui_data->up_action = prv_sms_reply_click_handler;
up_icon = RESOURCE_ID_ACTION_BAR_ICON_SMS;
} else {
s_phone_ui_data->select_action = prv_sms_reply_click... | |
/*
* 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... | hc_protocol_enqueue_with_payload_and_expect(
HcEndpointID_Analytics, HcMessageID_Analytics_GetHeartbeatData, NULL, 0) | ;
if (!msg) {
// Should be a basic log for timed out expect in hc_protocol layer
return;
}
HcAnalyticsHeartbeatData *data = (HcAnalyticsHeartbeatData *)&msg->payload[0];
for (uint32_t i = 0; i < data->count; i++) {
SerializedAnalytic analytic = data->analytics[i];
const AnalyticsMetric metric ... |
xt_worker(data->app_install_id);
// Pop the worker crash dialog
actionable_dialog_pop(data->actionable_dialog);
}
static void prv_worker_crash_click_config_provider(void *context) {
window_single_click_subscribe(BUTTON_ID_UP, prv_worker_crash_button_up_handler);
window_single_click_subscribe(BUTTON_ID_DOWN, p... | {
launcher_task_add_callback(prv_push_worker_crash_dialog, (void *) install_id);
} |
// ---------------------------------------------------------------------------
#if (defined(SHOW_BAD_BT_STATE_ALERT) || defined(SHOW_PEBBLE_JUST_RESET_ALERT))
#define YOUR_PEBBLE_RESET \
i18n_noop("Your Pebble just reset. " \
"Please report this using the 'Support' link in the Pebble phone app.")
#defin... |
ue;
}
static int32_t prv_get_buffer_size_for_serialized_attribute(const uint8_t **cursor,
const uint8_t *end) {
SerializedAttributeHeader *attribute = (SerializedAttributeHeader *)*cursor;
*cursor += sizeof(SerializedAttributeHeader);
if ((*cursor + attribute->length) > end) {
return -1;
}
int32_t st... | for (int i = 0; i < attr_list->num_attributes; i++) {
SerializedAttributeHeader *attribute = (SerializedAttributeHeader *)buffer;
buffer += sizeof(SerializedAttributeHeader);
PBL_ASSERTN(buffer <= buf_end);
attribute->id = attr_list->attributes[i].id;
switch (prv_attribute_type(attr_list->attributes... |
return buffer - buf_start;
}
bool attribute_deserialize_list(char **buffer, char *const buf_end,
const uint8_t **cursor, const uint8_t *payload_end, AttributeList attr_list) {
for (int i = 0; i < attr_list.num_attributes; i++) {
if (!prv_deserialize_attribute(buffer, buf_end, cursor, payload_end,
... |
/*
* 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... | {
heap_free(task_heap_get_for_current_task(), ptr, client_pc);
} |
#endif
void task_free(void* ptr) {
register uintptr_t lr __asm("lr");
uintptr_t saved_lr = lr;
heap_free(task_heap_get_for_current_task(), ptr, saved_lr);
}
void *task_realloc(void* ptr, size_t size) {
register uintptr_t lr __asm("lr");
uintptr_t saved_lr = lr;
return heap_realloc(task_heap_get_for_cur... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (buffer, src, src_size) | ;
return true;
}
GDrawCommandList *gdraw_command_list_clone(GDrawCommandList *list) {
if (!list) {
return NULL;
}
size_t size = gdraw_command_list_get_data_size(list);
GDrawCommandList *result = applib_malloc(size);
if (result) {
memcpy(result, list, size);
}
return result;
}
void gdraw_comm... |
(mutex, timeout_ticks) | == pdTRUE) {
LOG_LOCKED(handle->common.lr, myLR);
return (true);
}
return (false);
}
void mutex_lock_with_lr(PebbleMutex * handle, uint32_t myLR) {
OS_ASSERT(!mcu_state_is_isr());
xLightMutexLock(handle->common.freertos_mutex, portMAX_DELAY);
LOG_LOCKED(handle->common.lr, myLR);
}
void mutex_unlo... | |
r_bounds, bool is_chosen) {
const int32_t left_icon_spacing = PBL_IF_RECT_ELSE(0, 14);
const GSize not_chosen_icon_bounds = gbitmap_get_bounds(&option_menu->not_chosen_image).size;
const GSize chosen_icon_bounds = gbitmap_get_bounds(&option_menu->chosen_image).size;
PBL_ASSERTN(gsize_equal(¬_chosen_icon_boun... | (option_menu, option_menu->context) | ;
}
}
void option_menu_set_status_colors(OptionMenu *option_menu, GColor background, GColor foreground) {
option_menu->status_colors.background = background;
option_menu->status_colors.foreground = foreground;
status_bar_layer_set_colors(&option_menu->status_layer,
option_menu->st... |
nd only has two points
cl_assert_equal_i(1, s_gpath_draw_filled.call_count);
cl_assert_equal_i(3, lc->path.num_points);
cl_assert_equal_point(GPoint(0, 1), lc->path.points[0]);
cl_assert_equal_point(GPoint(2, 3), lc->path.points[1]);
cl_assert_equal_point(GPoint(4, 5), lc->path.points[2]);
s_gpath_draw_fil... | EXECUTE_SCRIPT(
"ctx.rect(7, 8, 9, 10);\n"
) | ;
cl_assert_equal_i(11, s_rocky_path_steps_num);
cl_assert_equal_i(RockyAPIPathStepType_MoveTo, s_rocky_path_steps[0].type);
cl_assert_equal_i(RockyAPIPathStepType_MoveTo, s_rocky_path_steps[1].type);
cl_assert_equal_i(RockyAPIPathStepType_LineTo, s_rocky_path_steps[5].type);
cl_assert_equal_i(RockyAPIPathSte... |
_error->next = error;
_clar.last_error = error;
error->test = _clar.active_test;
error->test_number = _clar.test_count;
error->suite = _clar.active_suite;
error->file = file;
error->line_number = line;
error->error_msg = error_msg;
if (description != NULL)
error->description = strdup(description)... | (" %s\n", buff) | ;
}
void clar__assert_equal_m(
uint8_t *m1,
uint8_t *m2,
int n,
const char *file,
int line,
const char *err,
int should_abort)
{
if (m1 == m2 || n == 0) {
return;
}
if (m1 == NULL || m2 == NULL) {
char buf[4096];
snprint_eq(buf, 4096, "'%p' != '%p'", m1, m2);
clar__assert(0, file, l... |
// Setup
////////////////////////////////////
void test_app_message__initialize(void) {
prv_set_app_uuid(simplicity_uuid);
prv_set_remote_app_uuid(simplicity_uuid);
fake_app_timer_init();
s_app_receiver_oom = false;
s_sys_psleep_last_millis = 0;
s_app_inbox_consume_call_count = 0;
app_message_init();
... | (prv_ack_sent_callback) | |
_argument_invalid("Value out of bounds");
}
TRY_ALLOCATE_STEPS_OR_RETURN_ERROR(1);
s_rocky_path_steps[s_rocky_path_steps_num++] = (RockyAPIPathStep) {
.type = step_type,
.pt.xy = GPointPrecise((int16_t)raw_x, (int16_t)raw_y),
};
return jerry_create_undefined();
}
JERRY_FUNCTION(prv_move_to) {
re... | ROCKY_ARG_ANGLE(angle_1) | ,
ROCKY_ARG_ANGLE(angle_2));
TRY_ALLOCATE_STEPS_OR_RETURN_ERROR(1);
const bool anti_clockwise = (argc >= 6) ? jerry_get_boolean_value(argv[5]) : false;
// adjust for coordinate system
center.x.raw_value -= FIXED_S16_3_HALF.raw_value;
center.y.raw_value -= FIXED_S16_3_HALF.raw_value;
s_rocky_path_ste... |
;
break;
}
}
static void prv_subscribe_to_action_results_and_timeouts(ActionResultData *data,
bool ignore_failures) {
data->event_service_info = (EventServiceInfo) {
.type = PEBBLE_SYS_NOTIFICATION_EVENT,
.handler = prv_action_handle_response,
... | // Copy the sender attribute - note: this assumes the timeline item is not freed until
// the message is sent
attributes[1] = *sender_attr;
}
AttributeList response_attributes = {
.num_attributes = num_attributes,
.attributes = attributes,
};
timeline_invo... |
return data;
}
// invoke actions that are immediately handled locally
static void prv_invoke_local_action(const TimelineItemAction *action, const TimelineItem *pin) {
timeline_invoke_action(pin, action, NULL);
}
static void prv_do_action_analytics(const TimelineItem *pin, const ActionMenuItem *item) {
const T... |
ics; i++) {
if (client->characteristics.meta == characteristics[i] ||
client->characteristics.data == characteristics[i]) {
client_removed = true;
prv_delete_client(client, true, DeleteReason_ServiceRemoved);
break;
}
}
client = next;
}
// P... | PBL_LOG(LOG_LEVEL_DEBUG, "Got notification/read for unknown client") | |
/*
* 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... | (out_buffer, (uint8_t*) "5678", 4) | |
cl_assert_equal_i(notif_prefs->attr_list.num_attributes, 0) | ;
cl_assert_equal_i(notif_prefs->action_group.num_actions, 0);
ios_notif_pref_db_free_prefs(notif_prefs);
}
void test_ios_notif_pref_db__is_dirty_insert_from_phone(void) {
char *keys[] = { "key1", "key2", "key3", "key4", "key5" };
int key_len = strlen(keys[0]);
char *values[] = { "val1", "val2", "val3", "va... | |
) {
return NULL;
} else {
return __APP_RAM__;
}
}
void quick_launch_handle_analytics(void) {
}
void reboot_set_slot_of_last_launched_app(uint32_t app_slot) {
}
void sys_exit(int status) {
}
RockyResourceValidation rocky_app_validate_resources(const PebbleProcessMd *md) {
return RockyResourceValidation... | (true /* gracefully */) | ;
// The second app should now be running.
cl_assert(app_manager_get_current_app_md() == (PebbleProcessMd*) &s_third_party_app);
app_manager_get_task_context()->safe_to_kill = false;
}
void test_app_manager__start_third_party_and_crash_back_to_root(void) {
test_app_manager__start_third_party();
// Simulate... |
/*
* 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... | {
char destbuf[9] = "hi";
char expectbuf[9] = "hilarity";
cl_assert_equal_p(strcat(destbuf, "larity"), destbuf);
} |
void test_strcat__n_basic(void) {
char destbuf[9] = "hi";
char expectbuf[9] = "hilarity";
strncat(destbuf, "larity", 6);
cl_assert_equal_m(expectbuf, destbuf, 9);
}
void test_strcat__n_overlarge(void) {
char destbuf[9] = "hi";
char expectbuf[9] = "hilariou";
strncat(destbuf, "lariousness", 6);
cl_ass... |
/*
* 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... | ble_root_keys_get_and_generate_if_needed(keys) | ;
prv_assert_key_is_equal_to_rng_key(&keys[SMRootKeyTypeEncryption], SMRootKeyTypeEncryption);
prv_assert_key_is_equal_to_rng_key(&keys[SMRootKeyTypeIdentity], SMRootKeyTypeIdentity);
prv_assert_key_is_equal_to_rng_key(&s_stored_keys[SMRootKeyTypeEncryption], SMRootKeyTypeEncryption);
prv_assert_key_is_equal_to... |
rsisted to flash a few lines later).
activity_algorithm_early_deinit();
// Update storage before we close down
s_activity_state.update_settings_counter = -1;
prv_update_storage(rtc_get_time());
PBL_LOG(LOG_LEVEL_DEBUG, "Updated and persisted sessions before stopping activity tracking");
}
// -------------... | if (enable) {
// We just got enabled, re-start activity tracking if it should be in the started state
if (s_activity_state.should_be_started) {
prv_start_tracking_cb(NULL);
}
} else {
// We just got disabled. Turn off activity tracking if necessary and set should_be_started
//... |
}
cleanup:
mutex_unlock_recursive(s_activity_state.mutex);
}
static void prv_handle_activity_enabled_change(void) {
if (activity_tracking_on() && !prv_activity_allowed_to_be_enabled()) {
prv_stop_tracking_early();
}
system_task_add_callback(prv_set_enable_cb, NULL);
}
static void prv_charger_event_cb(... |
/*
* 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("Invalid firmware description!");
return UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED;
} |
if (!check_valid_firmware_crc(
flash_address + sizeof(FirmwareDescription), &firmware_description)) {
dbgserial_putstr("Invalid firmware CRC in SPI flash!");
return UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED;
}
erase_old_firmware(firmware_description.firmware_length);
write_new_firmware(
fl... |
0x0d, 0x35, 0x35, 0x35, 0x2D, 0x35, 0x35, 0x35,
0x2D, 0x35, 0x35, 0x35, 0x35, 0x00, // "555-555-5555"
0x00};
phone_protocol_msg_callback(s_session, pp_msg, sizeof(pp_msg));
fake_system_task_callbacks_invoke_pending();
prv_assert_last_event(... | (s_session, pp_msg, sizeof(pp_msg)) | |
},
.num_attributes = 3,
};
static TimelineItem title_item1 = {
.header = {
.id = {0x9c, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c,
0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05},
.timestamp = 1,
.duration = 0,
.type = TimelineItemTypeReminder,
.layout = LayoutIdTest,
},
.att... | (&item4, &temp, sizeof(TimelineItem)) | == 0);
cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */));
cl_assert(reminder_db_get_len((uint8_t *)&item4.header.id, sizeof(Uuid)) == 0);
} else {
temp.attr_list.attributes = NULL;
cl_assert(memcmp(&item4, &temp, sizeof(TimelineItem)) == 0);
cl_assert(S_SUCCE... |
_characteristics;
remove_hdl->num_descriptors = service_node->service->num_descriptors;
gatt_client_service_get_all_characteristics_and_descriptors(
connection, service_node->service,
&remove_hdl->char_and_desc_handles[0],
&remove_hdl->char_and_desc_handles[service_node->service->num_characteristi... | prv_discovery_handle_timeout(connection, &errno) | ) {
// if a retry started, don't generate any events yet
finalize_discovery = false;
goto unlock;
}
// it's possible the discovery completed before we handled the timeout, in which case
// we get a BTErrnoOK which means we will get a completion event already
finalize_disc... |
length);
dbgserial_putstr(" bytes");
void *system_flash_base = (void*)FIRMWARE_OLDWORLD_BASE;
if (firmware_is_new_world(NULL)) {
dbgserial_putstr("New World firmware system_flash_base");
system_flash_base = (void*)FIRMWARE_NEWWORLD_BASE;
} else {
dbgserial_putstr("Old World firmware system_flash_b... | boot_bit_clear(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS) | ;
boot_bit_clear(BOOT_BIT_NEW_FW_AVAILABLE);
boot_bit_set(BOOT_BIT_NEW_FW_INSTALLED);
}
bool switch_to_recovery_fw() {
dbgserial_putstr("Loading recovery firmware");
UpdateFirmwareResult result = prv_update_fw(FLASH_REGION_SAFE_FIRMWARE_BEGIN);
bool recovery_fw_ok = true;
switch (result) {
case UPDATE_F... |
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "app_menu_data_source.h"
#include "applib/fonts/fonts.h"
#include "applib/ui/menu_layer.h"
#include "apps/system_app_ids.h"
#include "kernel/pbl_malloc.h"
#include "process_management/app_manager.h"
#i... | prv_comparator_ascending_zero_last(app_node->record_order, new_node->record_order) | ;
} else {
// AppInstallId (smallest first)
return new_node->install_id - app_node->install_id;
}
}
static void prv_set_storage_order(AppMenuDataSource *source, AppMenuNode *menu_node,
AppMenuOrderStorage *storage, bool update_and_take_ownership) {
if (!storage) {
re... |
.max_space_total = max_space_total,
};
settings_raw_iter_init(&file->iter, fd, file->name);
SettingsFileHeader file_hdr = file->iter.file_hdr;
if (file_hdr_is_uninitialized(&file_hdr)) {
// Newly created file, create & write out header.
memcpy(&file_hdr.magic, SETTINGS_FILE_MAGIC, sizeof(file_hdr.m... | (hdr, SETTINGS_FLAG_WRITE_COMPLETE) | ;
}
static bool partially_overwritten(SettingsRecordHeader *hdr) {
return flag_is_set(hdr, SETTINGS_FLAG_OVERWRITE_STARTED)
&& !flag_is_set(hdr, SETTINGS_FLAG_OVERWRITE_COMPLETE);
}
static bool overwritten(SettingsRecordHeader *hdr) {
return flag_is_set(hdr, SETTINGS_FLAG_OVERWRITE_STARTED)
&& flag_is_s... |
bytes) * 100) / (s_pb_state.total_size);
}
static void prv_send_response(ResponseCode code, uint32_t token) {
struct {
uint8_t response_code;
uint32_t token;
} PACKED msg = {
.response_code = code,
.token = htonl(token)
};
bool success = comm_session_send_data(comm_session_get_system_session()... | if (command == PutBytesInit ||
command == PutBytesInstall) {
return false;
} |
if (s_pb_state.token != request_token) {
PBL_LOG(LOG_LEVEL_ERROR, "%d: Token does not match; got 0x%" PRIx32 ", expected 0x%" PRIx32,
command, request_token, s_pb_state.token);
return true;
}
return false;
}
static size_t prv_expected_minimum_length_by_command(const PutBytesCommand command) ... |
GPoint(7, 24) | , 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_no_clip")));
// Even rows of different lengths
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_COLS);
graphi... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_b(false, scroll_layer_get_shadow_hidden(scroll_layer)) | |
8, "Saturdays");
bool schedule_9[7] = {true, false, false, false, false, false, false};
char alarm_day_text_9[32] = {0};
alarm_get_string_for_custom(schedule_9, alarm_day_text_9);
cl_assert_equal_s(alarm_day_text_9, "Sundays");
}
void test_alarm__alarm_set_get_enabled(void) {
AlarmId id1, id2;
id1 = alarm... | cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_CUSTOM, all_caps), "CUSTOM") | ;
}
void test_alarm__handle_clock_change(void) {
AlarmId id1, id2;
id1 = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_WEEKENDS });
id2 = alarm_create(&(AlarmInfo) { .hour = 13, .minute = 14, .kind = ALARM_KIND_WEEKDAYS });
s_current_hour = 12;
s_current_minute = 14;
alarm_handle... |
0) {
strncpy(buffer, EN_DASH, buffer_size);
return;
}
const int conversion_factor = health_util_get_distance_factor();
const char *units_string = health_util_get_distance_string(i18n_noop("MI"), i18n_noop("KM"));
char distance_buffer[HEALTH_WHOLE_AND_DECIMAL_LENGTH];
health_util_format_whole_and_dec... | (card_data) | ;
health_detail_card_destroy(card);
}
|
lt = app_inbox_create_and_register(BUFFER_SIZE, 1,
test_message_handler, test_dropped_handler);
cl_assert(result != NULL);
cl_assert_equal_b(true, app_inbox_service_has_inbox_for_tag(AppInboxServiceTagUnitTest));
}
void test_app_inbox__app_inbox_create_and_register... | {
prv_create_test_inbox();
cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest,
BUFFER_SIZE, s_writer));
cl_assert_equal_b(true, app_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest));
// Call ...begin() again:
cl_asser... |
void test_app_inbox__app_inbox_service_begin_not_enough_storage_space(void) {
prv_create_test_inbox();
cl_assert_equal_b(false, app_inbox_service_begin(AppInboxServiceTagUnitTest,
BUFFER_SIZE + 1, s_writer));
cl_assert_equal_b(false, app_inbox_service_is_being_... |
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 "unobstructed_area_service.h"
#include "unobstructed_area_service_private.h"
#i... | if (state->handlers.change) {
state->handlers.change(event->unobstructed_area.progress, state->context);
} |
}
static void prv_handle_did_change_event(PebbleEvent *event, void *context) {
UnobstructedAreaState *state = context;
prv_call_will_change(state, event);
state->is_changing = false;
if (state->handlers.did_change) {
state->handlers.did_change(state->context);
}
}
static void prv_handle_unobstructed_ar... |
/*
* 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, CANVAS_GBITMAP_FORMAT) | |
/*
* 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_LOG_LEVEL_INFO, "0x%02x", value[i]) | ;
}
}
static void write_handler(BLECharacteristic characteristic,
BLEGATTError error) {
char uuid_buffer[UUID_STRING_BUFFER_LENGTH];
Uuid characteristic_uuid = ble_characteristic_get_uuid(characteristic);
uuid_to_string(&characteristic_uuid, uuid_buffer);
APP_LOG(APP_LOG_LEVEL_INFO... |
ransaction_id = message->transaction_id,
};
if (endpoint_id == ENDPOINT_ID) {
app_message_app_protocol_msg_callback(session, (const uint8_t*)&ack, sizeof(AppMessage), NULL);
} else {
cl_fail("Unhandled endpoint");
}
}
static void prv_nack_sent_callback(uint16_t endpoint_id, const uint8_t* data, unsign... | {
return false;
} |
prv_send_data(endpoint_id, data, length);
return true;
}
static AppOutboxSentHandler s_app_outbox_sent_handler;
static void *s_app_outbox_ctx;
static void prv_call_outbox_sent(int status) {
cl_assert(s_app_outbox_sent_handler);
s_app_outbox_sent_handler(status, s_app_outbox_ctx);
}
void app_outbox_send(cons... |
/*
* 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... | (&(AlarmInfo) { .hour = 5, .minute = 14, .kind = ALARM_KIND_EVERYDAY }) | ;
prv_assert_alarm_config(id, 5, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
id = alarm_create(&(AlarmInfo) { .hour = 6, .minute = 14, .kind = ALARM_KIND_EVERYDAY });
prv_assert_alarm_config(id, 6, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
}
void test_alarm__alarm_create_recurring_weekend... |
ig->detail_text;
}
attribute_list_add_cstring(&pin_attr_list,
PBL_IF_RECT_ELSE(AttributeIdLocationName, AttributeIdTitle),
detail_text);
attribute_list_add_cstring(&pin_attr_list, AttributeIdBody,
i18n_get(percent_config->body... | (metric, ACTIVITY_HISTORY_DAYS, history) | ;
const StatsBasicOp op =
(StatsBasicOp_Average | StatsBasicOp_Count | StatsBasicOp_ConsecutiveFirst |
StatsBasicOp_Median);
struct {
int32_t mean;
int32_t count;
int32_t first_streak;
int32_t median;
} result;
// Note: we ignore history[0] since it's the current day
stats_calcu... |
peek_mode = false;
new_timer_stop(s_timer_id);
AccelSubscriberState *state = (AccelSubscriberState *)s_data_subscribers;
while (state) {
if (state->sampling_rate > highest_rate) {
highest_rate = state->sampling_rate;
}
if (state->samples_per_update > 0) {
num_fifo_subscribers++;
ms_... | (accel_data) | );
accel_data->timestamp = prv_get_timestamp();
} else if (s_accel_samples_per_update == 1) {
// Else, if the FIFO is 1 deep, we can ask the accel driver for the cached reading from the
// last FIFO read
if (s_temp_peek_mode) {
prv_set_restore_fifo_mode_timer(); // Give us anothe... |
/*
* 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... | {
const int STR_SIZE = 100;
char str[STR_SIZE];
// This is the message we should get back if we try and use floating point
const char* fp_msg = "floating point not supported in snprintf";
//----------------------------------------------------
pbl_snprintf(str, STR_SIZE, "%", 1); // Make sure we don't b... |
pbl_snprintf(str, STR_SIZE, "ab%%c % E zz", 1.0);
cl_assert_equal_s(str, fp_msg);
pbl_snprintf(str, STR_SIZE, "ab%%c % d zz", 42);
cl_assert_equal_s(str, "ab%c 42 zz");
//----------------------------------------------------
pbl_snprintf(str, STR_SIZE, "abc %-5e%s", "a", 1.0, "b");
cl_assert_equal_s(str... |
i++) {
GenericAttribute * attribute = (GenericAttribute *)((uint8_t *)score + total_size);
total_size += sizeof(GenericAttribute);
if (data_size < total_size) {
return false;
}
total_size += attribute->length;
if (data_size < total_size) {
return false;
}
}
if (data_size != ... | generic_attribute_find_attribute(&score->attr_list, VibeAttributeId_RepeatDelay,
score->attr_list_size) | ;
if (repeat_delay_attribute) {
uint16_t *repeat_delay = (uint16_t *) repeat_delay_attribute->data;
return *repeat_delay;
}
return 0;
}
void vibe_score_do_vibe(VibeScore *score) {
PBL_ASSERTN(score);
GenericAttribute *notes_attribute = generic_attribute_find_attribute(&score->attr_list,
... |
/*
* 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... | {
ListNode *node = list_find(s_manager_state.subscribers, prv_match_session_ref,
(void *)(uintptr_t)session);
return (HRMSubscriberState *)node;
} | |
// If neither animation nor reel is infinite
elapsed_ms = interpolate_uint32(normalized, player->from_elapsed_ms, player->to_elapsed_ms);
} else if ((is_animation_infinite || is_reel_infinite) && !is_animation_reversed) {
// If either animation or reel is infinite and animation is not reversed
animation... | {
if (player && player->reel) {
const uint32_t from_value = kino_reel_get_elapsed(player->reel);
const uint32_t to_value = kino_reel_get_duration(player->reel);
prv_create_play_animation(player, from_value, to_value);
return (ImmutableAnimation *)player->animation;
}
return NULL;
} | |
app_install_id_from_app_db(1000000));
}
void test_app_install_manager__get_md(void) {
const PebbleProcessMd *tictoc_md = app_install_get_md(tictoc_id, false);
cl_assert(tictoc_md != NULL);
cl_assert_equal_b(false, tictoc_md->has_worker);
cl_assert_equal_i(ProcessTypeWatchface, tictoc_md->process_type);
cl_as... | cl_assert_equal_b(true, app_install_is_prioritized(music_id)) | ;
// Clear recent time.
app_install_unmark_prioritized(music_id);
cl_assert_equal_b(false, app_install_is_prioritized(music_id));
// Update most recent time and let it expire
app_install_mark_prioritized(music_id, true /* can_expire */);
cl_assert_equal_b(true, app_install_is_prioritized(music_id));
//... |
ebbletechnology.atlassian.net/browse/PBL-5473
prv_reset_local_session_ptrs();
dls_clear();
prv_schedule_retry();
return NULL;
}
return dls_session;
}
static void prv_dls_log(AnalyticsHeartbeat *device_hb, AnalyticsHeartbeatList *app_hbs) {
dls_log(s_device_heartbeat_session, device_hb->data, 1);
... | if (!s_event_session) {
s_event_session = prv_create_dls(ANALYTICS_BLOB_KIND_EVENT, sizeof(AnalyticsEventBlob));
// If the above call fails, it will schedule our timer to try again in a few seconds
} |
}
static void prv_handle_log_event(AnalyticsEventBlob *event_blob) {
if (!s_event_session) {
PBL_LOG(LOG_LEVEL_INFO, "Event dropped because session not created yet");
return;
}
// Log it
dls_log(s_event_session, event_blob, 1);
}
static void prv_handle_async_event_logging(void *data) {
AnalyticsEv... |
prv_manual_scroll(&expandable_dialog->scroll_layer, 1);
}
static void prv_down_click_handler(ClickRecognizerRef recognizer, void *context) {
ExpandableDialog *expandable_dialog = context;
prv_manual_scroll(&expandable_dialog->scroll_layer, -1);
}
static void prv_config_provider(void *context) {
ExpandableDial... | (header_layer, 8) | ;
#endif
// We account for a header that may be larger than the available space
// by adjusting our height variable that is passed to the body layer
GSize header_size = text_layer_get_content_size(ctx, header_layer);
header_size.h += 4; // See PBL-1741
header_size.w = w;
header_content_height =... |
/*
* 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... | (0 /* offset */, 0x1000000 /* length */) | ;
pfs_init(false /* run filesystem check */);
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME,
false /* is_next */);
resource_init();
// Setup content indicator
ContentIndicatorsBuffer *buffer ... |
(
"ctx.lineWidth = -1;",
"TypeError: Argument at index 0 is invalid: Value out of bounds for native type"
) | ;
EXECUTE_SCRIPT_EXPECT_ERROR(
"ctx.lineWidth = 256;",
"TypeError: Argument at index 0 is invalid: Value out of bounds for native type"
);
}
void test_rocky_api_graphics__fill_and_stroke_styles(void) {
prv_global_init_and_set_ctx();
EXECUTE_SCRIPT(
"ctx.fillStyle = '#f00';\n"
"ctx.strokeS... | |
initialized, make sure there is no code
// that tries to use the BT stack in this path.
s_db_mutex = mutex_create();
prv_load_data_from_prf();
// Load cached capability bits from flash
prv_load_cached_system_capabilities(&s_cached_system_capabilities);
}
static void prv_delete_all_pairings_itr(SettingsFile... | (LOG_LEVEL_DEBUG, (uint8_t *)&data, sizeof(*data)) | ;
}
}
static bool prv_dump_bt_persistent_storage_contents(
SettingsFile *file, SettingsRecordInfo *info, void *context) {
if (info->key_len == 0 || info->val_len == 0) {
prompt_send_response("key or val of 0 length");
return true;
}
char *display_buf = kernel_malloc_check(DISPLAY_BUF_LEN);
// g... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return gmtime_r(timep, result);
} |
struct tm *sys_localtime_r(const time_t *timep, struct tm *result) {
return localtime_r(timep, result);
}
// i18n dummies
////////////////////////////////////
static bool s_i18n_translate = false;
static bool s_i18n_locale_other = false;
char *i18n_get_locale(void) {
if (s_i18n_locale_other) {
return "es_ES... |
, 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 "text_layout.h"
#include "applib/app.h"
#inc... | (window, WINDOW_NAME("Text Layout Demo")) | ;
window_set_user_data(window, data);
window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_window_load,
});
const bool animated = true;
app_window_stack_push(window, animated);
}
////////////////////
// App boilerplate
static void handle_init(void) {
s_fonts[0] = fonts_get_system_font(F... |
&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1);
graphics_context_set_text_color(&ctx, GColorBlack);
graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NEG_W,
GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL);
cl_check(framebuffer_is_empty("draw_text_neg_w", fb, GColorWhite));
... | (&ctx.dest_bitmap, "draw_text_color_assign.8bit.pbi") | );
setup_test_aa_sw(&ctx, fb, GRect(0, 0, 144, 168), GRect(0, 0, 144, 168), false, 1);
graphics_context_set_fill_color(&ctx, GColorRed);
graphics_fill_rect(&ctx, &GRect(0, 0, 144, 168));
graphics_context_set_compositing_mode(&ctx, GCompOpSet);
graphics_context_set_text_color(&ctx, GColorBlue);
graphics_dra... |
mplied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "comm/ble/gatt_service_changed.h"
#include "comm/ble/gap_le_connection.h"
#include "kernel/events.h"
#include "clar.h"
#include <btutil/bt_device.h>
// Fakes
///////////////////////////////... | GATT_Start_Service_Discovery_Handle_Range(TEST_BT_STACK_ID, TEST_GATT_CONNECTION_ID, NULL, 0, NULL,
prv_bluetopia_service_discovery_cb, 0) | ;
}
void test_gatt_service_changed_client__cleanup(void) {
}
// Discovery
///////////////////////////////////////////////////////////
void test_gatt_service_changed_client__handle_non_gatt_profile_service(void) {
fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_CONNECTION_ID);
cl_assert_equal_... |
ar *daypart_string = NULL;
const char morning[] = "this morning"; // anything before 12pm of the current day
const char afternoon[] = "this afternoon"; // 12pm today
const char evening[] = "this evening"; // 6pm today
const char tonight[] = "tonight"; // 9pm today
const char tomorrow_morning[] = "tomorrow... | (day_after_tomorrow, daypart_string) | ;
// (1am 3 days from now) Anything after 2 days from now becomes "the foreseeable future"
daypart_string = clock_get_relative_daypart_string(timestamp, 69 /* hours_in_the_future */);
cl_assert_equal_s(future, daypart_string);
// Our test event is at Oct 31 2015, 22:00:00
const int oct31_2015 = 1446328800;
... |
E(5)));
// Since loop only equals 1, make sure that huge elapsed time leaves us at final frame
gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap, 12345 * 1000);
cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5)));
#endif
}
// Tests APNG file with 8-bit color, 5 frames and loop infinite, size 64x64... | (check_frames) | ; ++i) {
// Advance to the next frame we're interested in.
for (; current_frame < check_frames[i]; ++current_frame) {
bool status = gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL);
cl_assert_equal_b(status, true);
}
printf("Checking %u\n", current_frame);
// Do... |
;
local_is_master = connection->local_is_master;
connected_device = &connection->device;
}
intent = prv_get_intent_by_bonding_id(request->bonding.id);
} else {
is_already_connected = gap_le_connection_is_connected(request->device);
intent = prv_get_intent_by_device(request->device);
}
... | if (is_connected_real) {
// Disconnect the device because no one is using it
const int result = bt_driver_gap_le_disconnect(device);
if (result != 0) {
PBL_LOG(LOG_LEVEL_ERROR, "Ble disconnect failed: %d", result);
}
} else {
if (prv_is_intent_using_whitelist(intent)) {
... | |
) {
#if PLATFORM_SPALDING
uint32_t resource_id = sys_resource_load_file_as_resource(TEST_IMAGES_PATH, GET_APNG_NAME);
cl_assert(resource_id != UINT32_MAX);
GBitmapSequence *bitmap_sequence = gbitmap_sequence_create_with_resource(resource_id);
cl_assert(bitmap_sequence);
GBitmap *bitmap = gbitmap_create_blan... | cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(1))) | ;
gbitmap_set_bounds(bitmap, shift_bounds);
gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL);
gbitmap_set_bounds(bitmap, orig_bounds);
cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(2)));
gbitmap_set_bounds(bitmap, shift_bounds);
gbitmap_sequence_update_bitmap_next_frame(bitmap_seq... |
////////////////////////////////////////////
extern void gap_le_connect_bluetopia_connection_callback(
unsigned int stack_id, GAP_LE_Event_Data_t* event_data, unsigned long CallbackParameter);
void test_gap_le_connect__initialize(void) {
fake_GAPAPI_init();
// Register slave connection event callback for tests... | gap_le_connect_connect(&device,
true /* auto_reconnect */,
false /* is_pairing_required */,
GAPLEClientApp) | ;
cl_assert_equal_i(e, BTErrnoOK);
registered = gap_le_connect_has_connection_intent(&device, GAPLEClientApp);
cl_assert_equal_b(registered, true);
// Try registering the device again as same client:
e = gap_le_connect_connect(&device,
true /* auto_reconnect */,
... |
out_length));
cl_assert_equal_i(out_length, 5);
cl_assert(memcmp(out_buffer, (uint8_t*) "56789", 5) == 0);
cl_assert(shared_circular_buffer_consume(&buffer, &client, 5));
// Get the rest of the wrapped read
cl_assert(shared_circular_buffer_read(&buffer, &client, 1, &out_buffer, &out_length));
cl_assert_equ... | cl_assert_equal_i(out_length, 3) | ;
cl_assert(memcmp(out_buffer, "def", 3) == 0);
cl_assert(shared_circular_buffer_consume(&buffer, &client1, 3));
cl_assert(shared_circular_buffer_read(&buffer, &client1, 2, &out_buffer, &out_length));
cl_assert_equal_i(out_length, 2);
cl_assert(memcmp(out_buffer, "gh", 2) == 0);
cl_assert(shared_circular_b... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
if (!animation) {
return false;
}
// For use in this stub, start time is 0, so anything past 0 is elapsed
*progress = ((AnimationPrivate*)animation)->duration_ms * ANIMATION_NORMALIZED_MAX /
((AnimationPrivate*)animation)->abs_start_time_ms;
return true;
} | |
uired by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#includ... | system_task_add_callback(prv_analytics_bt_chip_boot_cb, copy) | ;
}
break;
}
case HcMessageID_Analytics_LogBleMicErrorEvent: {
HcAnalyticsLogBleMicErrorEvent *info = (HcAnalyticsLogBleMicErrorEvent *)&msg->payload[0];
bluetooth_analytics_ble_mic_error(info->num_subsequent_mic_errors);
break;
}
default:
break;
}
}
|
client_id_payload =
(PPoGATTResetRequestClientIDPayload *) packet->payload;
*client_id_payload = (const PPoGATTResetRequestClientIDPayload) {
.ppogatt_version = client->version,
};
memcpy(client_id_payload->serial_number, mfg_get_serial_number(),
sizeof(client_id_payload->serial_n... | PBL_ASSERTN(read_space >= offset) | |
8_t FLASH_CMD_WRITE_DISABLE = 0x04;
static const uint8_t FLASH_CMD_READ_STATUS_REG = 0x05;
static const uint8_t FLASH_CMD_READ = 0x03;
static const uint8_t FLASH_CMD_READ_ID = 0x9F;
static const uint8_t FLASH_CMD_DEEP_SLEEP = 0xB9;
static const uint8_t FLASH_CMD_WAKE = 0xAB;
static const uint8_t FLASH_CMD_DUMMY = 0xA9;... | prv_flash_send_and_receive_byte(FLASH_CMD_DUMMY) | ;
return result;
}
static void prv_flash_wait_for_write_bounded(volatile int cycles_to_wait) {
prv_flash_start_cmd();
prv_flash_send_and_receive_byte(FLASH_CMD_READ_STATUS_REG);
uint8_t status_register = 0;
do {
if (cycles_to_wait-- < 1) {
break;
}
status_register = prv_flash_read_next_by... |
name_out, platform_bits_out)) {
return BT_BONDING_ID_INVALID;
}
return key;
}
bool bt_persistent_storage_has_active_bt_classic_gateway_bonding(void) {
return prv_has_active_gateway_by_type(BtPersistBondingTypeBTClassic);
}
typedef struct {
BtPersistBondingDBEachBTClassic... | if (key_out) {
memcpy(key_out, &keys[key_type], sizeof(keys[key_type]));
} |
return true;
}
void bt_persistent_storage_set_root_keys(SM128BitKey *keys_in) {
if (!keys_in) {
return;
}
shared_prf_storage_set_root_keys(keys_in);
prv_file_set(&ROOT_KEYS_KEY, sizeof(ROOT_KEYS_KEY),
keys_in, SMRootKeyTypeNum * sizeof(SM128BitKey));
}
bool bt_persistent_storage_get_lo... |
window_set_click_context(BUTTON_ID_SELECT, context) | ;
window_single_click_subscribe(BUTTON_ID_SELECT, &prv_mic_click_handler);
}
static void prv_back_click_config_provider(void *context) {
window_set_click_context(BUTTON_ID_BACK, context);
window_single_click_subscribe(BUTTON_ID_BACK, &prv_mic_click_handler);
}
static void prv_enable_select_click(VoiceUiData *da... | |
/*
* 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 ((prev_state == SmartstrapStateNotifyInProgress) &&
(new_state == SmartstrapStateReadComplete)) {
PBL_ASSERTN(mcu_state_is_isr() || (pebble_task_get_current() == PebbleTask_NewTimers));
} else if ((prev_state == SmartstrapStateReadDisabled) &&
(new_state == SmartstrapStateReadInProgre... |
}
bool smartstrap_fsm_state_test_and_set(SmartstrapState expected_state, SmartstrapState next_state) {
const bool did_set = __atomic_compare_exchange_n(&s_fsm_state, &expected_state, next_state, false,
__ATOMIC_RELAXED, __ATOMIC_RELAXED);
if (did_set) {
prv_a... |
tations under the License.
*/
#include <pebble_worker.h>
#include <inttypes.h>
#define BREAKPOINT __asm("bkpt")
#define ACCEL_BATCH_SIZE 10
#define PERSIST_WRITE_PERIOD_MS 1000
// -------------------------------------------------------------------------------------------------
static void prv_assert(bool co... | app_timer_register(PERSIST_WRITE_PERIOD_MS /*ms*/, update_persist_callback, NULL) | |
Last iteration: expect event with error status and 0 services:
prv_assert_event(device, BTErrnoServiceDiscoveryTimeout);
}
}
}
void test_gatt_client_discovery__watchdog_error_out_after_max_retries(void) {
BTDeviceInternal device = prv_connected_dummy_device(1);
// Start discovery:
cl_assert_equal_i(... | (&connection->gatt_remote_services->node) | , 0);
// Put one, expect one:
prv_simulate_and_assert_discovery_of_one_service(&device);
cl_assert_equal_i(list_count(&connection->gatt_remote_services->node), 1);
}
void test_gatt_client_discovery__rediscover_already_running(void) {
BTDeviceInternal device = prv_connected_dummy_device(1);
// Start discove... |
prv_handle_heart_rate_update(&event->data.heart_rate_update);
}
}
prv_unlock();
}
// ---------------------------------------------------------------------------------------
void workout_service_activity_event_handler(PebbleActivityEvent *event) {
if (!workout_service_is_workout_ongoing()) {
return;
... | workout_service_is_workout_type_supported(type) | ) {
rv = false;
goto unlock;
}
if (workout_service_is_workout_ongoing()) {
PBL_LOG(LOG_LEVEL_WARNING, "Only 1 workout at a time is supported");
rv = false;
goto unlock;
}
// Before starting this new session we need to deal with any in progress sessions
uint32_t num_se... |
v_safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text));
}
prv_display_alert(data->debug_card.dialog_text);
}
// -----------------------------------------------------------------------------------------
static void debug_window_load(Window *window) {
HealthAPITestAppData *data = ... | (data->results_window, GColorBlack) | ;
window_set_user_data(data->results_window, data);
window_set_click_config_provider_with_context(data->results_window, results_click_config_provider,
data);
window_set_window_handlers(data->results_window, (WindowHandlers) {
.load = results_window_load,
.un... |
/*
* 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... | (1000, prv_hide_thumbsup, data) | ;
}
static void prv_set_tap_text(AppData *data, uint32_t count, AccelAxisType axis) {
char axes[] = {'X', 'Y', 'Z'};
snprintf(data->text, sizeof(data->text), "Axis: %c\nDouble Taps: %6"PRIu32, axes[axis], count);
text_layer_set_text(&data->text_layer, data->text);
}
static void prv_window_load(Window *window) {... |
{
Window *window = &s_notification_window_data.window;
// Set the window on screen so its load/appear handlers will be called
window_set_on_screen(window, true, true);
// Trigger a reload of the NotificationWindow's SwapLayer so it will be updated with the content
// in s_test_data
swap_layer_reload_data(... |
//! @note This must be a multiple of 8 so that we are word-aligned when using a 1-bit bitmap.
#define GRID_CELL_PADDING 8
static void prv_prepare_canvas_and_render_notification_windows(unsigned int num_down_scrolls) {
// Initialize the notification window module before rendering anything
notification_window_init... | |
onse
struct PACKED VersionsPhoneResponseV1 {
uint32_t pebble_library_version;
uint32_t session_capabilities_bitfield;
uint32_t platform_bitfield;
};
// The 2.x mobile apps return a longer response than the 1.x apps do.
struct PACKED VersionsPhoneResponseV2 {
uint32_t pebble_library_version;
uint32_t session_... | ntohl(response->platform_bitfield) | ;
bt_driver_reconnect_notify_platform_bitfield(platform_bits);
const bool is_system = comm_session_is_system(session);
PBL_LOG(LOG_LEVEL_INFO,
"Phone app: is_system=%u, plf=0x%"PRIx32", capabilities=0x%"PRIx32,
is_system, platform_bits, (uint32_t)capability_flags);
// Only emit for the Peb... |
oing, we don't need GPIO. (connected to QEMU)
.periph = USART2,
.irq_channel = USART2_IRQn,
.irq_priority = 13,
.rcc_apb_periph = RCC_APB1Periph_USART2
};
UARTDevice * const QEMU_UART = &QEMU_UART_DEVICE;
IRQ_MAP(USART2, uart_irq_handler, QEMU_UART);
#endif
static UARTDeviceState s_dbg_uart_state;
static UARTD... | voltage_monitor_device_init(VOLTAGE_MONITOR_ALS) | ;
voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY);
}
|
/*
* 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_ASSERTN(flash_size == (uint32_t)1 << ceil_log_two(flash_size)) | ;
// Init QSPI peripheral
QSPI_InitTypeDef qspi_config;
QSPI_StructInit(&qspi_config);
qspi_config.QSPI_SShift = QSPI_SShift_HalfCycleShift;
// QSPI clock = AHB / (1 + QSPI_Prescaler)
qspi_config.QSPI_Prescaler = prescaler - 1;
qspi_config.QSPI_CKMode = QSPI_CKMode_Mode0;
qspi_config.QSPI_CSHTime = QSP... |
/*
* 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_debounce_timers[i].cb = prv_handle_disconnection_debounced;
s_debounce_timers[i].cb_data = (void *)(uintptr_t)i;
} |
// initial state of the connections
s_debounced_state_is_connected[MobileAppDebounce] = (comm_session_get_system_session() != NULL);
s_debounced_state_is_connected[PebbleKitDebounce] =
(comm_session_get_current_app_session() != NULL);
}
DEFINE_SYSCALL(bool, sys_mobile_app_is_connected_debounced, void) {
... |
S) {
PBL_LOG(LOG_LEVEL_WARNING, "W:Couldn't find next page for %d",
file->curr_page);
res = E_INTERNAL;
goto cleanup;
}
}
res = bytes_written;
cleanup:
mutex_unlock_recursive(s_pfs_mutex);
return (res);
}
uint32_t pfs_get_size(void) {
// one sector is needed for internal book... | prv_page_to_flash_offset(last_written_pg) | +
offsetof(PageHeader, last_written));
}
}
static bool prv_update_gc_reserved_region(void) {
if (!s_gc_block.block_valid || (s_gc_block.block_writes > 5)) {
int free_region_start = prv_find_free_erase_region(s_gc_block.block_valid);
if (free_region_start >= 0) {
s_gc_block = (GCBlock) {
... |
uint16_t value_length) {
if (connection->gatt_service_changed_att_handle != att_handle) {
return false;
}
if (value_length != sizeof(ATTHandleRange)) {
PBL_LOG(LOG_LEVEL_ERROR, "Service Changed Indication incorrect length: %u", value_length);
// Pretend we a... | (&event->dev_address) | |
E;
const bool align_in_frame = true;
peek_layer_set_scale_to_image(peek_layer, &data->peek_icon_info, TimelineResourceSizeTiny, frame,
align_in_frame);
// set peek_layer clips to true so I can resize the peek_layer's background
layer_set_clips(&peek_layer->layer, true);
peek... | layer_insert_below_sibling((Layer *)data->peek_layer, (Layer *)&data->status_layer) | ;
}
///////////////////////
// SwapLayer Callbacks
///////////////////////
static void prv_remove_notification(NotificationWindowData *data, Uuid *notif_id,
const bool should_close_am) {
// We have to check if the current presented notification is the one being
// viewed. If i... |
tributes_enable_screen_text_flow((GTextLayoutCacheRef) &layout,
TEXT_FLOW_INSET_PX);
return graphics_text_layout_get_max_used_size(ctx,
text,
TEXT_FONT,
... | dialog_load(dialog) | |
/*
* 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... | {
graphics_context_set_fill_color(ctx, SETTINGS_MENU_HIGHLIGHT_COLOR);
graphics_context_set_text_color(ctx, GColorWhite);
} | else {
graphics_context_set_fill_color(ctx, GColorWhite);
graphics_context_set_text_color(ctx, GColorBlack);
}
graphics_fill_rect(ctx, &cell_layer->bounds);
}
// Menu Layer Handling
//////////////////////
static void prv_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *context) {
Set... |
le click" after the multi-click timeout passed and this callback is called:
if (recognizer->number_of_clicks_counted >= 1 && recognizer->is_repeating == false) {
int clicks_over = recognizer->number_of_clicks_counted;
for(int i = 0; i < clicks_over; i++) {
prv_dispatch_event(recognizer, ClickHandlerOffs... | (recognizer, ClickHandlerOffsetLongRelease, needs_reset) | ;
return;
}
prv_cancel_timer(&recognizer->hold_timer);
if (local_is_multi_click_enabled && false == recognizer->is_repeating) {
const bool local_can_more_clicks_follow = prv_can_more_clicks_follow(recognizer);
bool should_fire_multi_click_handler = ((recognizer->config.multi_click.last_click_only &&... |
ernsData *data = (SettingsVibePatternsData *)context;
const char *title = NULL;
const char *subtitle = NULL;
VibeClient client = VibeClient_Notifications;
switch (row) {
case VibeSettingsRow_Notifications: {
title = i18n_noop("Notifications");
client = VibeClient_Notifications;
break;
... | vibe_client_get_score(client) | ;
if (!score) {
return;
}
vibe_score_do_vibe(score);
vibe_score_destroy(score);
}
static uint16_t prv_num_rows_cb(SettingsCallbacks *context) {
return VibeSettingsRow_Count;
}
static void prv_expand_cb(SettingsCallbacks *context) {
SettingsVibePatternsData *data = (SettingsVibePatternsData *)context;
... |
-960},
{ -120, 192, -1016},
{ -136, 288, -944},
{ -24, 208, -1208},
{ -72, 144, -984},
{ -24, 416, -1016},
{ -80, 440, -896},
{ -200, 544, -880},
{ -240, 672, -688},
{ -144, 784, -800},
{ -144, 576, -680},
{ -96, 688, -688},
{ -64, 632, -712},
{ -88, 728, -792},
{... | { -48, 800, -776},
{ -80, 784, -768},
{ -96, 736, -656},
{ -48, 736, -760},
{ -80, 856, -768},
{ -80, 696, -672},
{ -88, 816, -816},
{ -96, 800, -688},
{ -24, 736, -712},
{ -104, 816, -808},
{ -48, 800, -704},
{ -112, 816, -744},
// 13 seconds
{ -40, 680, -696},
... |
{ -64, 704, -744},
{ -96, 688, -704},
{ 24, 744, -688},
{ -112, 728, -672},
{ -16, 880, -768},
{ -96, 656, -592},
{ -88, 912, -728},
{ -8, 688, -688},
{ -128, 824, -736},
{ -72, 768, -640},
{ -56, 640, -696},
{ -72, 744, -704},
{ -72, 752, -672},
{ -24, 840, -824... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.