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... | (PebbleTask_Unknown) | ;
PBL_ASSERTN(state->handler != NULL);
state->handler(sys_battery_get_charge_state());
}
void battery_state_service_init(void) {
event_service_init(PEBBLE_BATTERY_STATE_CHANGE_EVENT, NULL, NULL);
}
void battery_state_service_subscribe(BatteryStateHandler handler) {
BatteryStateServiceState *state = prv_get_st... |
nitiated);
s_state.state = PostMessageStateAwaitingResetRequest;
}
static void prv_awaiting_reset_request__inbox_received(DictionaryIterator *it, void *context) {
if (dict_find(it, PostMessageKeyResetRequest)) {
prv_awaiting_reset_complete_remote_initiated_enter();
} else {
// This is not a request mess... | ("postmessageerror event") | ;
OutgoingObject *old_head = s_state.out.object_queue;
char *const json_data_buffer = old_head->data_buffer;
// Don't free the JSON data buffer, ownership is about to be passed to the error event.
prv_object_queue_pop_head(false /* should_free_data_buffer */);
JS_VAR event = rocky_global_create_event(ROCKY_... |
/*
* 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... | ("Checksumming firmware update") | ;
uint32_t crc = crc_calculate_flash(flash_address, desc->firmware_length);
return crc == desc->checksum;
}
static void prv_display_erase_progress(
uint32_t progress, uint32_t total, void *ctx) {
display_firmware_update_progress(progress, total * 2);
}
static bool erase_old_firmware(uint32_t firmware_length... |
/*
* 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[conn_id]) | ;
}
void debounced_connection_service_init(void) {
for (int i = 0; i < NumConnectionsToDebounce; 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[MobileAppDebou... |
static void prv_start_tx(void) {
const uint8_t *data;
uint16_t length;
// Don't start another TX if we're already writing
if (s_log_buffer.transmitting) {
return;
}
// How much is available to transmit?
length = circular_buffer_get_read_space_remaining(&s_log_buffer.circular_buffer);
if (length ... | task_get_dialogtask() | ;
uint32_t *param = msg->body.payload;
va_list args;
va_start(args, packed_loghash);
for (unsigned index = 0; index < num_fmt_conversions; ++index) {
if ((index + 1 == str_index_1) || (index + 1 == str_index_2)) {
BinLogMessage_StringParam *str_param = (BinLogMessage_StringParam *)param;
const... |
st = {};
attribute_list_add_uint32(&list, AttributeIdIconPin, TIMELINE_RESOURCE_RUN);
attribute_list_add_uint32(&list, AttributeIdIconTiny, TIMELINE_RESOURCE_PACE);
attribute_list_add_uint8(&list, AttributeIdHealthInsightType,
ActivityInsightType_ActivitySessionRun);
attribute_list_ad... | prv_add_weather_pin(3 * 24 * 60 * 60) | ;
// Fallthrough
}
case TimelinePinsDemo_OneDayAway:
prv_add_weather_pin(-2 * 24 * 60 * 60);
prv_add_weather_pin(2 * 24 * 60 * 60);
goto timeline;
case TimelinePinsDemo_OngoingEvent: {
prv_add_calendar_pin(-(3 * SECONDS_PER_DAY) / 2, 3 * MINUTES_PER_DAY, is_all_day,
... |
/*
* 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_delete(&storage->entries, entry) | ;
return S_SUCCESS;
}
return E_DOES_NOT_EXIST;
}
status_t ram_storage_flush(RamStorage *storage) {
while (storage->entries) {
prv_delete(&storage->entries, storage->entries);
}
return S_SUCCESS;
}
RamStorage ram_storage_create(void) {
RamStorage storage;
storage.entries = NULL;
return storag... |
dNotification, ¬if_attr_list,
&action_group);
i18n_free_all(¬if_attr_list);
attribute_list_destroy_list(¬if_attr_list);
attribute_list_destroy_list(&positive_attr_list);
attribute_list_destroy_list(&neutral_attr_list);
attribute_list_destro... | (&response_item->attr_list) | ;
}
kernel_free(action_group.actions);
attribute_list_destroy_list(&open_attr_list);
attribute_list_destroy_list(&remove_attr_list);
return item;
}
// ------------------------------------------------------------------------------------------------
static TimelineItem *prv_create_pin(time_t pin_time_utc, tim... |
/*
* 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... | event_put(&event) | ;
}
void reminders_handle_reminder_updated(const Uuid *reminder_id) {
prv_put_reminder_event((ReminderId *)reminder_id, ReminderUpdated);
}
void reminders_handle_reminder_removed(const Uuid *reminder_id) {
prv_put_reminder_event((ReminderId *)reminder_id, ReminderRemoved);
}
static void prv_trigger_reminder_syst... |
1, 0x83, 0xd0, 0xb4, 0xd1,
};
void test_timeline_item__get_serialized_attributes_length(void) {
const uint8_t *cursor = s_serialized_attribute_list;
int32_t result = attribute_get_buffer_size_for_serialized_attributes(2,
&cursor, s_serialized_attribute_list + sizeof(s_serialized_attribute_list));
cl_assert... | (list, 0, 20) | ;
// no data
list->serialized_byte_length = 0;
cl_assert_equal_i(0, string_list_count(list));
list->serialized_byte_length = 3;
// 4 empty strings
cl_assert_equal_i(4, string_list_count(list));
cl_assert_equal_s("", string_list_get_at(list, 0));
cl_assert_equal_s("", string_list_get_at(list, 1));
cl_... |
);
GPIO_InitStructure.GPIO_Pin = BOARD_CONFIG_POWER.chg_fast.gpio_pin;
GPIO_Init(BOARD_CONFIG_POWER.chg_fast.gpio, &GPIO_InitStructure);
prv_battery_set_fast_charge(false);
gpio_release(BOARD_CONFIG_POWER.chg_fast.gpio);
}
if (board_has_chg_en()) {
gpio_use(BOARD_CONFIG_POWER.chg_... | prv_battery_set_fast_charge(fast_charge_enabled) | ;
periph_config_release_lock();
}
|
oLocaleTimeString(undefined, {hour: '2-digit'});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "20");
EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "20:04:05");
EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, "
"{hour: undefined, minute: undefined, second:... | ("s = d.toLocaleDateString(undefined, {day: 'numeric'});") | ;
ASSERT_JS_GLOBAL_EQUALS_S("s", "25");
EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: '2-digit'});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "25");
EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'short'});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "Mon");
EXECUTE_SCRIPT("s = d.toLocaleDateString(unde... |
(uint8_t *)value,
strlen(value)));
blob_db_get_dirty_dbs(ids, &num_ids);
cl_assert_equal_i(num_ids, 1);
cl_assert(blob_db_get_dirty_list(BlobDBIdTest) != NULL);
// mark it synced
cl_assert_equal_i(S_SUCCESS, blob_db_mark_synced(BlobDBIdTest, (uint8_t *)key, strle... | (values[0]) | ;
// insert all keys, mark some as synced
for (int i = 0; i < ARRAY_LENGTH(keys); ++i) {
blob_db_insert(BlobDBIdTest, (uint8_t *)keys[i], key_len, (uint8_t *)values[i], value_len);
// choose two that are not consecutive, that leaves 3 still to be synced
if (i == 1 || i == 3) {
blob_db_mark_synced... |
handler) {
window_single_click_subscribe(BUTTON_ID_SELECT, expandable_dialog->select_click_handler);
}
}
static void prv_expandable_dialog_load(Window *window) {
ExpandableDialog *expandable_dialog = window_get_user_data(window);
Dialog *dialog = &expandable_dialog->dialog;
GRect frame = window->layer.bou... | // layer must be added immediately to scroll layer for perimeter and paging
scroll_layer_add_child(scroll_layer, &header_layer->layer);
#if PBL_ROUND
text_layer_enable_screen_text_flow_and_paging(header_layer, 8);
#endif
// We account for a header that may be larger than the available space
// by ... |
int32_t text_content_height = text_layer_get_content_size(ctx, text_layer).h;
text_content_height += 4; // See PBL-1741
text_layer_set_size(text_layer, GSize(w, text_content_height));
uint16_t scroll_height = icon_offset + icon_size.h +
header_content_height + text_content_height + (icon ? BOTTOM_MARGIN... |
NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture,
s_feb_5_midnight + 8 * SECONDS_PER_HOUR + 16 * SECONDS_PER_MINUTE), 0);
#if CAPABILITY_HAS_CORE_NAVIGATION4
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[1].header.id));
... | cl_assert(!iter_prev(&iterator)) | ;
timeline_iter_deinit(&iterator, &state, &head);
}
void test_timeline__skip_deleted_item(void) {
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1421178000)... |
GContext *ctx, const char *text,
GFont const font, const GRect box,
const GTextOverflowMode overflow_mode,
const GTextAlignment alignment,
G... | cl_assert_equal_i(1, s_graphics_fill_rect.call_count) | ;
cl_assert_equal_i(4, s_graphics_line_draw_precise_stroked.call_count);
cl_assert_equal_i(0, s_graphics_draw_line.call_count);
cl_assert_equal_i(1, s_graphics_context_set_fill_color.call_count);
cl_assert_equal_i(4, s_graphics_context_set_stroke_color.call_count);
cl_assert_equal_i(4, s_graphics_co... |
rstUseSourceActionMenu) {
prv_push_first_use_dialog(msg, prv_toggle_manual_dnd_from_action_menu);
} else {
prv_push_first_use_dialog(msg, prv_toggle_manual_dnd_from_settings_menu);
}
}
static void prv_try_update_schedule_mode(void *data) {
const bool clear_override = (bool) (uintptr_t) data;
if (clear_... | {
return (prv_is_current_schedule_enabled() && s_data.is_in_schedule_period &&
!s_data.manually_override_dnd);
} |
static bool prv_is_smart_dnd_active(void) {
return (calendar_event_is_ongoing() &&
do_not_disturb_is_smart_dnd_enabled() &&
!s_data.manually_override_dnd);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Public Functions
////////////////... |
/*
* 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... | mutex_create() | ;
device_information_service_init(&config->dis_info);
pebble_pairing_service_init();
hrm_service_init(config->is_hrm_supported_and_enabled);
ppogatt_service_init();
}
static void prv_gatt_local_services_register(void) {
device_information_service_register(DEVICE_INFORMATION_SERVICE_EXPECTED_ATT_STARTING_HAND... |
= prv_get_elapsed(child, now) + child->delay_ms;
uint32_t child_start_time = now - child_position_inc_delay;
if (serial_distance32(child_start_time, earliest_start_time) > 0) {
// computes (earliest_start_time - child->abs_start_time_ms)
earliest_start_time = child_start_time;
... | {
state = prv_animation_state_get(PebbleTask_Current);
} | |
ProtobufLogMeasurementType_BPM};
const int num_samples = 50;
const int num_values_per_sample = ARRAY_LENGTH(types);
uint32_t offset_sec[num_samples];
uint32_t values[num_samples * num_values_per_sample];
for (unsigned i = 0; i < num_samples; i++) {
offset_sec[i] = i * 2;
}
for (unsigned i = 0;... | (offset_sec) | ,
.offset_sec = offset_sec,
.num_values = ARRAY_LENGTH(values),
.values = values,
}
};
prv_common_payload_initialize(&input);
// Create a session
ProtobufLogTransportCB transport_cb = prv_protobuf_log_transport;
ProtobufLogRef session_ref = protobuf_log_hr_create(transport_cb);
cl_as... |
GBitmapFormat8BitCircular
GBitmap* graphics_capture_frame_buffer(GContext *ctx) {
PBL_ASSERTN(ctx);
return graphics_capture_frame_buffer_format(ctx, CANVAS_GBITMAP_FORMAT);
}
// Overrides same function in graphics.c; we need to do this so we can release the framebuffer we're
// using even though its format doesn't... | (simple_dialog) | ;
const char *snooze_text = "Snooze delay set to %d minutes";
char snooze_buf[64];
snprintf(snooze_buf, sizeof(snooze_buf), snooze_text, 10);
dialog_set_text(dialog, snooze_buf);
dialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE);
dialog_set_background_color(dialog, GColorJaegerGreen);
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... | if (before_time_m <= 30) {
return PeekBeforeTimingMenuIndex_30Min;
} |
return PeekBeforeTimingMenuIndexDefault;
}
static void prv_before_time_menu_select(OptionMenu *option_menu, int selection, void *context) {
timeline_peek_prefs_set_before_time(s_before_time_values[selection]);
app_window_stack_remove(&option_menu->window, true /* animated */);
}
static void prv_push_before_tim... |
_context_init(&ctx, fb);
// No Clip, Angle 0
setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet);
graphics_draw_rotated_bitmap(&ctx, test_image_color,
GPointZero, DEG_TO_TRIGANGLE(0), GPointZero);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "dr... | (gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_leftedge_2.Xbit.pbi")) | ;
// right edge center rotation point, Angle 2
setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign);
graphics_draw_rotated_bitmap(&ctx, test_image_color,
GPoint(59, 30), DEG_TO_TRIGANGLE(2), GPoint(72, 84));
cl_check(gbitmap_pbi_eq(&ctx.dest... |
onst SPISlavePort *slave, uint32_t frequency_hz) {
slave->spi_bus->state->spi_clock_speed_hz = frequency_hz;
prv_spi_slave_init(slave);
}
void spi_slave_wait_until_idle_blocking(const SPISlavePort *slave) {
while (prv_spi_get_flag_status(slave->spi_bus, SpiI2sFlag_BSY)) continue;
}
uint32_t spi_get_dma_base_add... | PBL_ASSERTN(slave->slave_state->acquired) | ;
const uint8_t *outp = out;
uint8_t *inp = in;
for (size_t n = 0; n < len; ++n) {
uint8_t byte_out = outp ? *(outp++) : 0;
uint8_t byte_in = spi_ll_slave_read_write(slave, byte_out);
if (inp) {
*(inp++) = byte_in;
}
}
}
void spi_ll_slave_burst_read_write_scatter(const SPISlavePort *slave... |
/*
* 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... | {
va_list fmt_args;
va_start(fmt_args, message);
prv_handle_passert_failed_vargs(filename, line_number,
(uintptr_t)__builtin_return_address(0), "ASSERT", message, fmt_args);
va_end(fmt_args);
} | |
ke_system_task_count_callbacks(), 1);
cl_assert_equal_i(s_send_next_count, 1);
fake_system_task_callbacks_invoke_pending();
cl_assert_equal_i(s_send_next_count, 2);
comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection);
}
void test_session__send_next_not_called_when_session_closed_in_me... | comm_session_send_next_is_scheduled(session) | , true);
fake_system_task_callbacks_invoke_pending();
cl_assert_equal_b(comm_session_send_next_is_scheduled(session), false);
comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection);
}
void test_session__capabilities(void) {
Transport *transport = (Transport *) TransportID1;
CommSession... |
rawConfig){TO_TRIG(270),GCornerTopLeft},
.full_quadrants = GCornerTopLeft,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerTopRight}
}));
// Tests for pairs of quadrants
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(0), TO_TRIG(180)), ((EllipsisDrawConfig){
.start_quadrant = (E... | TO_TRIG(30) | ,GCornerTopRight},
.full_quadrants = GCornerNone,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(60),GCornerTopRight}
}));
// Starting quadrant filling up and ending quadrant finishing
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(360 + 45), TO_TRIG(360 + 270 + 45)), ((EllipsisDrawConfig){
... |
/*
* 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, cell_layer, title) | ;
break;
}
(void)data;
}
static void draw_header_callback(GContext* ctx, Layer *cell_layer, uint16_t section_index, AppData *data) {
char title[BUFFER_SIZE];
sniprintf(title, BUFFER_SIZE, "Section Header (%i)", section_index);
menu_cell_basic_header_draw(ctx, cell_layer, title);
(void)data;
}
static... |
t 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,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND... | ("Donut " E_ACUTE "clair", dest, buffer_length) | ;
cl_assert_equal_s(dest, "Donut");
cl_assert_equal_m(dest + buffer_length, GUARD_REFERENCE, NAME_LENGTH - buffer_length);
}
void test_phone_formatting__phone_number_intl_std(void) {
char test_number[] = "+55 408-555-1212";
int dest_len = sizeof(test_number) + 1;
char *dest = malloc(dest_len); // malloc'd ... |
NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_16KB_sectors(void) {
cl_assert(system_flash_erase(FLASH_BASE, 48 KiB, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 2), erased_sector);
cl_assert(flash_locked);
}
void callback_is_called_... | {
fprintf(stderr, "0x%.08x", num);
} |
extern void dbgserial_putstr(char *str) {
fprintf(stderr, "%s\n", str);
}
|
/*
* 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_dest_bitmap->addr, 0xff, s_dest_bitmap->row_size_bytes * s_dest_bitmap->bounds.size.h) | ;
}
void prv_prepare_fb_steps(GSize size) {
prv_prepare_fb_steps_xy(size, NUM_STEPS, NUM_STEPS);
}
void test_graphics_draw_text_flow__initialize(void) {
fb = malloc(sizeof(FrameBuffer));
framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS});
ctx = (GContext){};
// Setup resources
fake_spi_flash_init(0, 0... |
_position, &track_duration);
cl_assert_equal_i(track_position, 0xAA);
cl_assert_equal_i(music_get_playback_rate_percent(), 0xAA);
} else {
cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT);
}
}
static void prv_receive_and_assert_volume_info(bool expect_is_handled) {
uint8_t msg[] = { 0x12, 0x33 };
prv_... | fake_comm_session_cleanup() | ;
}
void test_music_endpoint__ignore_now_playing_while_not_connected(void) {
// Don't connect app, but receive Now Playing info. Should be ignored:
prv_receive_and_assert_all(false /* expect_is_handled */);
}
void test_music_endpoint__ignore_now_playing_while_other_server_connected(void) {
// Another music serv... |
Layer parent, child_a, child_b, child_c;
Layer *layers[] = {&parent, &child_a, &child_b, &child_c};
for (int i = 0; i < ARRAY_LENGTH(layers); ++i) {
layer_init(layers[i], &GRectZero);
}
// Create this hierarchy:
//
// +-parent
// |
// '->child_b
//
layer_add_child(&parent, &child_b);
... | (a, stack[0]) | ;
cl_assert_equal_p(ab, stack[1]);
// not necessary to free memory on unit tests
}
void test_layer__is_ancestor(void) {
Layer parent, child_a, child_b, child_c;
Layer *layers[] = {&parent, &child_a, &child_b, &child_c};
for (int i = 0; i < ARRAY_LENGTH(layers); ++i) {
layer_init(layers[i], &GRectZero);
... |
:00 AM
{ 0, 0x8b, 0, 141, 0},
{ 0, 0x8b, 0, 141, 0},
{ 0, 0x8b, 0, 141, 0},
{ 0, 0x8b, 0, 141, 0},
{ 0, 0x76, 1772, 141, 0},
{ 0, 0x76, 0, 140, 0},
{ 0, 0x76, 0, 140, 0},
{ 0, 0x76, 0, 140, 0},
{ 0, 0x76, 0, 140, 0},
{ 0, 0x76, 0, 140, 0},
{ 0, 0x76, 0, 140, 0},
{ 0, 0x76... | { 0, 0x14, 0, 141, 0},
{ 0, 0x14, 165, 142, 0},
{ 0, 0x6e, 1677, 141, 0},
{ 0, 0x5e, 0, 141, 0},
{ 0, 0x5e, 0, 141, 0},
{ 0, 0x5e, 0, 141, 0},
{ 0, 0x5e, 0, 141, 0},
{ 0, 0x5e, 0, 141, 0},
{ 0, 0x5e, 0, 141, 0},
{ 0, 0x5e, 0, 141, 0},
{ 0, 0x5e, 0, 140, 0},
// 550: Local ... |
{ 0, 0x35, 0, 140, 0},
{ 0, 0x35, 0, 141, 0},
{ 0, 0x35, 0, 141, 0},
// 595: Local time: 2016-05-16 07:12:00 AM
{ 0, 0x35, 0, 141, 0},
{ 0, 0x35, 0, 141, 0},
{ 0, 0x35, 0, 141, 0},
{ 0, 0x35, 0, 141, 0},
{ 0, 0x35, 0, 141, 0},
{ 0, 0x35, 0, 141, 0},
{ 0, 0x35, 0, 141, 0},
... |
be more than enough.
uint32_t num_sessions = 32;
ActivitySession *sessions = app_malloc(num_sessions * sizeof(ActivitySession));
if (!sessions) {
snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text),
"Not enough memory");
return;
}
// Get sessions
bool success = ... | (temp, sizeof(temp), " %dm\n", (int)(session->length_min)) | ;
safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text));
// Write steps, calories, distance
snprintf(temp, sizeof(temp), " %"PRIu16", %"PRIu16"C, %"PRIu16"m\n", session->step_data.steps,
session->step_data.active_kcalories + session->step_data.resting_kcalories,... |
and_list_3();
memcpy(&image->command_list, command_list, sizeof(GDrawCommandList) + (3 * sizeof(GDrawCommand)) +
(sizeof(GPoint) * 6));
free(command_list);
image->version = 1;
image->size = GSize(20, 20);
cl_assert(gdraw_command_image_validate(image, size));
cl_assert(!gdraw_command_image_validate(im... | (points, s_fill_points, s_path_num_points) | |
/*
* 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... | args.join(' ') | );
return 0;
} catch (e) {
console.error(e);
return -1;
}
}, argv);
}
#else // #ifdef EMSCRIPTEN
static int
shell_out(char * const argv[])
{
int status;
pid_t pid;
pid = fork();
if (pid < 0) {
fprintf(stderr,
"System error: `fork()` call failed.\n");
exit(-1);
}
if (pid == 0... |
tTypeDelete) {
if (uuid_equal(id, &s_activity_pin_state.uuid)) {
s_activity_pin_state.removed = true;
} else if (uuid_equal(id, &s_sleep_pin_state.uuid)) {
s_sleep_pin_state.removed = true;
}
}
}
// ----------------------------------------------------------------------------------------------... | (now_utc, 1234, 1234, i) | ;
prv_push_activity_summary_notification(now_utc, 1234, 800, i);
// Way below average, but more than 10,000 steps were taken so these should be neutral
prv_push_activity_summary_notification(now_utc, 12345, 100000, i);
}
}
time_t midnight = time_util_get_midnight_of(now_utc);
int32_t enter... |
/*
* 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... | milliseconds_to_ticks(6000) | ;
bool success = false;
if (xSemaphoreTake(s_spi_int_semph, tick_timeout) == pdTRUE) {
dialog_spi_send_and_receive_dma(tx_buffer, rx_buffer, length, prv_dma_cb);
success = (xSemaphoreTake(s_spi_dma_semph, tick_timeout) == pdTRUE);
}
return success;
}
static bool prv_spi_transaction(CoreDumpSPICmd *cm... |
onnected and PreExisting");
} else {
BLE_LOG_DEBUG("Added ANCS notification!");
prv_notif_queue_push_attr_request(nsnotification->uid, properties);
}
// See analytics_external_collect_ancs_info()
s_ns_flags_used_bitset |= nsnotification->event_flags;
break;
case Event... | BLE_LOG_DEBUG("Taking action <%u> upon UID: %"PRIu32, action_id,
notification_uid) | |
selection_config_large = {
.subtitle_font_key = FONT_KEY_GOTHIC_18_BOLD,
.cell_width = 56,
.ampm_cell_width = 56,
.cell_padding = 6,
.top_offset_with_label = 87,
.top_offset_without_label = 67, // NOTE: this hasn't been designed, because we don't use it
.label_origin_y = 33,
.range_origin_y = 158,
};
... | (start_buf, sizeof(start_buf), hour_start, minute_start, true) | ;
clock_format_time(end_buf, sizeof(end_buf), hour_end, minute_end, true);
char *buffer = time_selection_window->range_buf;
snprintf(buffer, sizeof(time_selection_window->range_buf), "%s - %s", start_buf, end_buf);
text_layer_set_text(range_text_layer, buffer);
// update range_subtitle_text_layer
buffer ... |
1624, 88, 264},
{ 1320, 0, 304},
{ 1088, -24, 224},
{ 944, -32, 192},
{ 824, -40, 168},
{ 768, -40, 128},
{ 688, -96, 128},
{ 680, -112, 40},
{ 816, -8, -144},
{ 1360, -184, -32},
{ 1752, -160, 312},
{ 1472, 336, 0},
{ 1456, 384, -216},
{ 1440, 176, 72},
// 83 sec... | { 616, -16, -64},
{ 480, 8, -104},
{ 392, -8, -40},
{ 320, 24, 0},
{ 432, 88, 32},
{ 760, 216, 72},
{ 1216, 512, 96},
{ 1992, 224, 264},
{ 2136, -152, 600},
{ 1696, 472, -344},
{ 1128, 208, -136},
{ 944, 232, 56},
{ 784, 152, 208},
{ 808, 128, 296},
{ 832, 168... |
{ 808, 88, 296},
{ 864, 96, 320},
{ 792, 240, 248},
{ 720, 328, 120},
{ 728, 352, 8},
{ 784, 184, 56},
{ 944, 312, 40},
{ 1304, 312, 112},
{ 1328, 288, 32},
{ 1640, 288, 40},
{ 1368, 496, 16},
{ 1072, 352, 80},
{ 1264, 240, 96},
{ 1280, 80, 216},
{ 1184, 96, ... |
be moved to send_text.c
#if !PLATFORM_TINTIN && defined(APP_ID_SEND_TEXT)
static void prv_capabilities_changed_event_handler(PebbleEvent *event, void *context) {
// We only care if send text support changed right now
if (!event->capabilities.flags_diff.send_text_support) {
return;
}
const PebbleProcessMd *... | (SYSTEM_APP, reg_entry->bin_resource_id, 0,
(uint8_t *)app_header, sizeof(*app_header)) | != sizeof(*app_header)) {
PBL_LOG(LOG_LEVEL_WARNING, "Stored app with resource id %d not found in resources",
reg_entry->bin_resource_id);
goto done;
}
*entry = (AppInstallEntry) {
.install_id = reg_entry->id,
.type = AppInstallStorageResources,
.visibility = process_metadata_flags_... |
);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1);
cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MAX);
#endif
}
// --------------------------------------------------------------------------------------
// Test a sequence animation with a component that has a pl... | animation_spawn_create(a, b, NULL) | ;
cl_assert(spawn != NULL);
animation_set_play_count(spawn, play_count_spawn);
// Check the duration
cl_assert_equal_i(animation_get_duration(spawn, true, true), play_count_spawn * duration_a);
prv_clear_handler_histories();
uint64_t start_ms = prv_now_ms();
animation_schedule(spawn);
// Start A
... |
_iter_init(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start);
// Tests
cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params));
cl_assert(line.height_px == 10);
cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX);
cl_assert(iter_next(&word_iter));
cl_asse... | word_iter_init(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start) | ;
// Tests
cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params));
cl_assert(line.height_px == 10);
cl_assert(line.width_px == 2 * HORIZ_ADVANCE_PX);
cl_assert(iter_next(&word_iter));
cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params));
cl_as... |
4},
{ -296, -96, -1008},
{ -240, -160, -1096},
{ -184, -136, -1152},
{ -200, -136, -1072},
{ -224, -200, -992},
{ -184, -160, -904},
{ -192, -184, -888},
{ -208, -176, -960},
{ -240, -144, -968},
{ -288, -104, -984},
{ -296, -72, -1040},
{ -296, -80, -1128},
{ -176, 4... | { 920, 896, -152},
{ 1312, 720, -104},
{ 1920, 760, -32},
{ -1992, 728, -32},
{ 2000, 616, -24},
{ 2016, 328, 56},
{ 1904, 328, 32},
{ 1760, 488, -152},
{ 1496, 376, -288},
{ 1304, 32, -296},
{ 736, -616, -32},
{ 432, -416, -568},
{ 1008, -360, -256},
{ 1136, 48, ... |
{ -1984, 464, -232},
{ 1904, 608, -184},
{ 1776, 768, -96},
{ 1664, 728, -56},
{ 1584, 504, -24},
{ 1440, 776, 128},
{ 1480, -1960, 32},
{ 624, 1480, 96},
{ 1112, 1400, -136},
{ 1024, 816, -344},
{ 1312, 544, -232},
{ 1944, 712, 40},
{ -1880, 704, 16},
{ -1880, 5... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
size_t len = s_rocky_path_steps_array_len ?: MINIMUM_ARRAY_LEN;
while (required_array_len > len) {
len *= 2;
}
return len;
} | |
OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "flash_logging.h"
#include "console/dbgserial.h"
#include "drivers/flash.h"
#include "os/mutex.h"
#include "system/passert.h"
#include "util/shar... | if (shared_circular_buffer_get_write_space_remaining(&s_buffer) >= length + 1) {
// Ideally we could figure out a way to skip out on this copy but then you'd potentially need to sniprintf
// into a non-contiguous buffer... whatever, we have CPU to burn.
uint8_t msg_length = length;
// Do not ad... |
mutex_unlock(s_buffer_mutex);
// If we failed to buffer this message, flush the buffer to cache to make room.
// Otherwise, if this is a sync message, flush this message to flash.
if (!success || !async) {
handle_buffer_sync((void *)(uintptr_t) false /* !is_async */);
}
} while (!success);... |
ase WATCH_INFO_COLOR_PEBBLE_2_HR_FLAME:
pres_detect_thrsh = PRES_DETECT_THRSH_BLACK;
break;
case WATCH_INFO_COLOR_PEBBLE_2_HR_WHITE:
case WATCH_INFO_COLOR_PEBBLE_2_HR_LIME:
case WATCH_INFO_COLOR_PEBBLE_2_HR_AQUA:
pres_detect_thrsh = PRES_DETECT_THRSH_WHITE;
break;
default:
... | gpio_output_set(&dev->en_gpio, false) | ;
psleep(50);
gpio_output_set(&dev->en_gpio, true);
psleep(20);
gpio_output_set(&dev->en_gpio, false);
psleep(20);
#else
gpio_output_set(&dev->en_gpio, true);
psleep(NORMAL_BOOT_DELAY_MS);
#endif
AS7000InfoRecord hrm_info;
if (!prv_get_and_log_device_info(dev, &hrm_info, true /* log_version */)) {
... |
/*
* 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... | {
// Translate points to fixedpoint realms
int32_t x1 = p1.x * fixedpoint_base;
int32_t x2 = p2.x * fixedpoint_base;
int32_t x3 = p3.x * fixedpoint_base;
int32_t x4 = p4.x * fixedpoint_base;
int32_t y1 = p1.y * fixedpoint_base;
int32_t y2 = p2.y * fixedpoint_base;
int32_t y3 = p3.y * fixedpoint_base;
... | |
r);
cl_assert(read_pointer);
cl_assert_equal_i(TEST_EXPECTED_PP_MSG[i], *read_pointer);
// Expect that the header and payload will be non-contiguous:
if (i < sizeof(PebbleProtocolHeader)) {
cl_assert_equal_i(sizeof(PebbleProtocolHeader) - i, length_available);
} else {
cl_assert_equal_i(... | for (int i = 0; i < (length - intact_size); ++i) {
cl_assert_equal_i(bytes_out[intact_size + i], 0x00);
} |
app_free(outbox_data);
}
void test_app_message_sender__cancelled_message_in_flight_header_and_payload_not_finished(void) {
// Expect header to get sent out normally, then a payload with all zeroes
prv_quit_app_after_pp_msg_byte(sizeof(PebbleProtocolHeader) - 1);
}
void test_app_message_sender__cancelled_messa... |
0, sizeof(s_vars));
memset(&s_error, 0, sizeof(s_error));
memset(&s_cond, 0, sizeof(s_cond));
s_cond.eval_time = INT_MAX;
}
void test_template_string__initialize(void) {
}
void test_template_string__cleanup(void) {
}
//////////////////////////////////////////////////////////////////////////////////////////////... | template_string_evaluate("test string {time_until(5)|format('%uS')}", s_output,
sizeof(s_output), NULL, &vars, &err) | ;
cl_assert_equal_b(ret, true);
cl_assert_equal_s(s_output, "test string 5 seconds");
}
{
TemplateStringVars vars = {};
TemplateStringError err = {};
vars.current_time = 0;
bool ret = template_string_evaluate("test string {time_until(5)|format('%uS',)}", NULL, 0,
... |
/*
* 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(fake_mutex_all_unlocked(), true) | ;
}
void test_fake_mutex__recursive_mismatched_counts(void) {
PebbleRecursiveMutex *mutex = mutex_create_recursive();
mutex_lock_recursive(mutex);
mutex_lock_recursive(mutex);
mutex_unlock_recursive(mutex);
cl_assert_equal_b(fake_mutex_all_unlocked(), false);
mutex_unlock_recursive(mutex);
cl_assert_equa... |
y;
}
PropertyAnimation *prop_anim = property_animation_create_layer_frame(layer, start, &stop);
Animation *animation = property_animation_get_animation(prop_anim);
animation_set_duration(animation, interpolate_moook_soft_duration(NUM_MOOOK_SOFT_MID_FRAMES));
animation_set_custom_interpolation(animation, prv_... | {
return;
} | |
_peeking_time_window(SerializedTimelineItemHeader *header, time_t now) {
const unsigned int duration_s = header->common.duration * SECONDS_PER_MINUTE;
const unsigned int show_duration_after_start_s =
header->common.persistent ? duration_s :
MIN(TIMELINE_PEEK_HIDE_AFTER_TIME_S, duration_s);
// As soon ... | {
const time_t into = start + TIMELINE_PEEK_HIDE_AFTER_TIME_S;
const bool short_event = (end < into);
const bool started_moments_ago = (now < into);
timeout_s = ((started_moments_ago && !short_event) ? into : end) - now;
// If it's persistent, it should be shown for the entire duration
time_type... | else {
const time_t before = start - s_peek_event_data.show_before_time_s;
const bool some_time_next = (now < before);
timeout_s = (some_time_next ? before : start) - now;
time_type = some_time_next ? TimelinePeekTimeType_SomeTimeNext :
TimelinePeekTimeType_ShowWillStar... |
edule and expect not to be advertising any more:
gap_le_advert_unschedule(job);
cl_assert(!gap_le_is_advertising_enabled());
// Unschedule callback should have been called once:
cl_assert_equal_i(s_unscheduled_cb_count, 1);
cl_assert_equal_p(s_unscheduled_job, job);
cl_assert_equal_b(s_unscheduled_complete... | cl_assert_equal_i(s_unscheduled_cb_count, 0) | ;
// Make sure the all the terms in the job are run:
for (int term = 0; term < ARRAY_LENGTH(advert_terms); ++term) {
for (int second_tick = 0; second_tick < 4; ++second_tick) {
cl_assert_equal_i(s_unscheduled_cb_count, 0);
assert_ad_data("ad data");
gap_le_assert_advertising_interval(advert_... |
ON_TOP_MARGIN_PX - status_layer_offset : 0);
x = 0;
y = status_layer_offset;
w = frame.size.w;
h = frame.size.h - y;
ScrollLayer *scroll_layer = &expandable_dialog->scroll_layer;
scroll_layer_init(scroll_layer, &GRect(x, y, w, h));
layer_add_child(&window->layer, &scroll_layer->layer);
#if PBL_ROUND
... | (SYSTEM_APP,
RESOURCE_ID_ACTION_BAR_ICON_DOWN) | ;
PBL_ASSERTN(expandable_dialog->down_icon && expandable_dialog->up_icon);
#endif
// Set up the Action bar.
ActionBarLayer *action_bar = &expandable_dialog->action_bar;
action_bar_layer_init(action_bar);
if (expandable_dialog->action_bar_background_color.a != 0) {
action_bar_layer_set_backgro... |
art_pg + pg;
uint8_t page_flags = prv_get_page_flags(curr_page);
if (page_is_erased(page_flags)) {
next_page = curr_page;
break;
}
}
start_pg += remaining_pgs_in_block;
}
// we should now be processing on a sector aligned boundary
PBL_ASSERTN((start_pg % PFS_PAGES_PER_... | {
if (*next_page < s_pfs_page_count) {
return (S_SUCCESS);
}
} |
return (E_INTERNAL); // the next page pointer is corrupt
}
static status_t unlink_flash_file(uint16_t page) {
uint16_t first_page = page;
if (page > s_pfs_page_count) { // should never happen
return (E_INTERNAL);
}
// Mark the files to indicate that they are ready to be erased
PageHeader hdr;
hdr.... |
/*
* 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... | weather_app_resource_create_sun() | |
void *user_data) {
LauncherAppGlanceStructured *structured_glance = user_data;
const char *title = NULL;
if (structured_glance && structured_glance->impl && structured_glance->impl->get_title) {
title = structured_glance->impl->get_title(structured_glance);
}
if (title) {
strncpy(buffer, title, buffer... | interpolate_int16(elapsed_normalized, 0, total_px_to_scroll) | ;
return true;
}
//! Currently the subtitle scrolling drives the duration of the overall glance selection animation
//! because we only scroll once, and since we don't know what we're scrolling until this function
//! is called, we need to record the duration of the scrolling animation in this function so the
//! g... |
data->timeline_layer, new_idx);
}
timeline_layer_move_data(&data->timeline_layer, -1);
}
// If we interrupted a previous scroll, hasten this scroll
const bool is_hasted = !was_stationary;
const uint32_t duration = TIMELINE_UP_DOWN_ANIMATION_DURATION_MS;
const InterpolateInt64Function interpolate = is... | GPoint(1, 0) | ;
#endif
Animation *layer_bounce = timeline_layer_create_bounce_back_animation(&data->timeline_layer,
direction);
data->current_animation = layer_bounce;
animation_schedule(layer_bounce);
}
}
static Animation *prv_create_intro_anim... |
G(LOG_LEVEL_ERROR, "ble_gap_address_set: %u", e);
}
#endif
e = ble_gap_mtu_size_set(ATT_MAX_SUPPORTED_MTU);
if (e != BLE_STATUS_OK) {
PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_mtu_size_set: %u", e);
}
e = ble_gap_role_set(GAP_PERIPHERAL_ROLE);
if (e != BLE_STATUS_OK) {
PBL_LOG(LOG_LEVEL_ERROR, "ble_gap_ro... | handle_evt_gap_connected((ble_evt_gap_connected_t *) hdr) | ;
break;
case BLE_EVT_GAP_DISCONNECTED:
prv_handle_evt_gap_disconnected((ble_evt_gap_disconnected_t *) hdr);
break;
case BLE_EVT_GAP_ADV_COMPLETED:
advert_handle_completed((ble_evt_gap_adv_completed_t *) hdr);
break;
case BLE_EVT_GAP_CONN_PARAM_U... |
GColorLightGray));
timeline_layer_set_layouts_hidden(timeline_layer, true); // hide until the peek is over
layer_set_hidden((Layer *)&timeline_layer->day_separator, true);
layer_add_child(&window->layer, (Layer *)timeline_layer);
// peek layer
prv_init_peek_layer(s_app_data);
prv_setup_peek... | uuid_equal(&app_uuid, &(Uuid)TIMELINE_PAST_UUID_INIT) | ) {
data->timeline_model.direction = TimelineIterDirectionPast;
} else if (args == NULL) {
data->timeline_model.direction = TimelineIterDirectionFuture;
} else {
data->timeline_model.direction = args->direction;
}
// check if we were asked to launch into a specific item
time_t now = rtc_get_time(... |
/*
* 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 unsigned int num_words = data_length / 4;
prv_calculate_incremental_words((uint32_t*) data, num_words);
data += num_words * 4;
data_length -= num_words * 4;
} |
if (data_length) {
uint32_t last_word = 0;
for (unsigned int i = 0; i < data_length; ++i) {
last_word = (last_word << 8) | data[i];
}
crc_value = CRC_CalcCRC(last_word);
} else {
crc_value = CRC_GetCRC();
}
return crc_value;
}
static void prv_calculate_incremental_stop(void) {
pr... |
i_graphics__cleanup(void) {
fake_app_timer_deinit();
// some tests deinitialize the engine, avoid double de-init
if (app_state_get_rocky_runtime_context() != NULL) {
jerry_cleanup();
rocky_runtime_context_deinit();
}
}
static const RockyGlobalAPI *s_graphics_api[] = {
&GRAPHIC_APIS,
NULL,
};
exte... | (
"ctx.clearRect(1, 2, 3, 4);\n"
) | ;
cl_assert_equal_i(1, s_graphics_fill_rect.call_count);
cl_assert_equal_rect(GRect(1, 2, 3, 4), s_graphics_fill_rect.last_call.rect);
cl_assert_equal_i(GColorBlackARGB8, s_graphics_fill_rect__color.argb);
cl_assert_equal_i(GColorJaegerGreenARGB8, s_context.draw_state.fill_color.argb);
s_graphics_fill_rect ... |
/*
* 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, 64 * 1024, 2 * 64 * 1024, 3 * 64 * 1024) | |
--------------------------------------------------------------------
bool gatt_client_subscriptions_get_notification_header(GAPLEClient client,
GATTBufferedNotificationHeader *header_out) {
bool has_notification = false;
prv_lock();
if (!prv_check_buffer(cli... | {
prv_lock();
const PebbleTaskBitset task_mask = ~gap_le_pebble_task_bit_for_client(c);
prv_send_notification_event(task_mask);
s_is_notification_event_pending[c] = true;
prv_unlock();
} |
// -------------------------------------------------------------------------------------------------
// Decrements ownership count
static void prv_release_buffer(GAPLEClient client) {
prv_lock();
{
PBL_ASSERTN(s_circular_buffer_retain_count[client]);
--s_circular_buffer_retain_count[client];
if (s_ci... |
/*
* 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... | TIM_ClearITPendingBit(TIM4, TIM_IT_Update) | ;
NVIC_InitStructure.NVIC_IRQChannel = TIM4_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0b;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
TIM_TimeBaseInitTypeDef tim_config;
TIM_TimeBaseStructInit(&tim... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&kino_layer->layer, prv_update_proc) | ;
// init kino layer
kino_layer->background_color = GColorClear;
// init kino player
kino_player_set_callbacks(&kino_layer->player, (KinoPlayerCallbacks){
.frame_did_change = prv_player_frame_did_change,
.did_stop = prv_player_did_stop,
}, kino_layer);
}
void kino_layer_deinit(KinoLayer *kino_layer) ... |
SettingsFile *file, SettingsRecordInfo *info, void *context) {
// check entry is valid
if ((info->val_len == 0) || (info->key_len != sizeof(AppInstallId))) {
return true; // continue iteration
}
EnumerateData *cb_data = (EnumerateData *)context;
AppInstallId id;
info->get_key(file, (uint8_t *)&id, inf... | (&s_app_db.settings_file, (uint8_t *)&app_id,
sizeof(AppInstallId), val_out, val_len) | |
entry;
if (!app_install_get_entry_for_install_id(id, &entry)) {
// can't retrieve app install entry for id
PBL_LOG(LOG_LEVEL_ERROR, "Failed to get entry for id %"PRId32, id);
} else if (app_install_entry_is_watchface(&entry)) {
// If the watchface is for an unsupported SDK version, ... | prv_handle_app_stop_analytics(context, task, gracefully) | ;
return true;
}
PBL_LOG(LOG_LEVEL_DEBUG, "make %s process safe to kill: state %u", pebble_task_get_name(task),
context->closing_state);
if (gracefully) {
if (context->closing_state == ProcessRunState_Running) {
context->closing_state = ProcessRunState_GracefullyClosi... |
evented_timer_register_or_reschedule(
s_app_data->inactive_timer_id, INACTIVITY_TIMEOUT_MS, prv_inactive_timer_callack, data);
}
/////////////////////////////////////
// Pin View
/////////////////////////////////////
static void prv_move_timeline_layer_stopped(Animation *animation, bool finished, void *context)... | prv_set_state(data, TimelineAppStateNoEvents) | ) {
// Hide layouts and animate to "No events"
timeline_layer_set_layouts_hidden(&data->timeline_layer, true);
prv_init_peek_layer(data);
prv_setup_no_events_peek(data);
peek_layer_play(&data->peek_layer);
Animation *sidebar_slide = prv_create_sidebar_animation(data, false /* open */);
dat... |
stributed 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 "graphics.h"
#include "bitblt.h"
#include "bitblt_private.h"... | MAX((int32_t)(corner_insets_right & 0xf) - right_cropped_columns_count, 0) | ;
int32_t corner_insets = left_side + right_side;
int32_t width = corner_insets < clipped_rect.size.w ? (clipped_rect.size.w - corner_insets) : 0;
uint32_t x = clipped_rect.origin.x + left_side;
corner_insets_left >>= 4;
corner_insets_right >>= 4;
PBL_ASSERTN(clipped_rect.origin.y < bitmap->bo... |
ed 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 "applib/graphics/framebuffer.h"
#include "applib/graphics/graphics.h"
#include "applib/ui/app_window_... | window_set_on_screen(&dialog->window, true, true) | ;
for (uint32_t i = 0; i < num_times_to_scroll_down; i++) {
scroll_layer_scroll(&expandable_dialog->scroll_layer, ScrollDirectionDown,
false /* animated */);
}
window_render(&dialog->window, &s_ctx);
}
// Tests
//////////////////////
void test_expandable_dialog__dismiss_tutorial_po... |
al(&p4, GSize(0, 0)));
cl_assert_equal_grect(GRect(-6, -6, 1, 2), grect_centered_internal(&p4, GSize(-1, -2)));
// handles fixed point
cl_assert_equal_grect(GRect(-6, -6, 2, 2), grect_centered_internal(&p4, GSize(2, 2)));
p4.x.raw_value += FIXED_S16_3_HALF.raw_value;
cl_assert_equal_grect(GRect(-6, -6, 2, 2)... | (radius, 168 / 2 - 0.5) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
uintptr_t rv = 0;
if (jerry_value_is_number(value)) {
rv = jerry_get_number_value(value);
} else if (jerry_value_is_string(value)) {
uint32_t sz = jerry_get_utf8_string_size(value);
char buf[sz + 1];
memset(buf, 0, sz + 1);
jerry_string_to_utf8_char_buffer(value, (jerry_char_t *)buf, sz);
... |
int32_t jerry_get_int32_value(jerry_value_t value) {
return (int32_t)(round(jerry_get_number_value(value)));
}
int32_t jerry_get_angle_value(jerry_value_t value) {
return (int32_t)
(jerry_get_number_value(value) * TRIG_MAX_ANGLE / (2 * M_PI)) + TRIG_MAX_ANGLE / 4;
}
char *rocky_string_alloc_and_copy(const... |
// Get useful UTC times
time_t start_of_today_utc = time_util_get_midnight_of(now_utc);
int minute_of_day = time_util_get_minute_of_day(now_utc);
int last_sleep_second_of_day = ACTIVITY_LAST_SLEEP_MINUTE_OF_DAY * SECONDS_PER_MINUTE;
int first_sleep_utc;
if (minute_of_day < ACTIVITY_LAST_SLEEP_MINUTE_OF_DAY)... | activity_sessions_prv_send_activity_session_to_data_logging(session) | ;
*params->exit_utc = session_exit_utc;
params->modified = true;
logged_event = true;
}
// Update settings file if any events were logged
if (logged_event) {
mutex_lock_recursive(state->mutex);
SettingsFile *file = activity_private_settings_open();
if (file) {
for (int i = 0; i < Ac... |
_length);
dbgserial_print("Calculated checksum: ");
dbgserial_print_hex(crc);
dbgserial_newline();
return crc == desc->checksum;
}
static void prv_display_erase_progress(
uint32_t progress, uint32_t total, void *ctx) {
display_firmware_update_progress(progress, total * 2);
}
static bool erase_old_firmwa... | boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE) | ;
boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO);
UpdateFirmwareResult result = update_fw(FLASH_REGION_FIRMWARE_SCRATCH_BEGIN);
switch (result) {
case UPDATE_FW_SUCCESS:
break;
case UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED:
// Our firmware update failed in a way that didn't break our previous
... |
at_current_chunk(void) {
uint32_t addr = get_current_address(s_current_chunk, 0);
PBL_ASSERT((addr & (SUBSECTOR_SIZE_BYTES - 1)) == 0,
"Sections must be subsector aligned! addr is 0x%" PRIx32, addr);
PBL_ASSERT((CHUNK_SIZE_BYTES & (SUBSECTOR_SIZE_BYTES - 1)) == 0,
"Sections divide into subsectors even... | get_generation_address(generation, i, 0) | , sizeof(chunk_header));
if (chunk_header.invalid || !chunk_header.valid) {
// No more valid chunks
break;
}
if (i == 0 || serial_distance(lowest_chunk_id, chunk_header.chunk_id, CHUNK_ID_BIT_WIDTH) < 0) {
lowest_chunk_index = i;
lowest_chunk_id = chunk_header.chunk_id;
}
... |
{ -1600, 88, -176},
{ -1632, -64, -72},
{ -1808, 8, 48},
{ -1800, 240, 72},
{ -1744, 432, 192},
{ -1600, 560, 208},
{ -1504, 656, 200},
{ -1384, 288, 144},
{ -1152, 352, 88},
{ -1136, 520, 152},
{ -992, 704, 208},
{ -1064, 728, 184},
{ -848, 624, 16},
{ -944, 464, 40}... | { -1152, 0, -136},
{ -1216, 184, -240},
{ -1344, 192, -216},
{ -1488, -16, -40},
{ -1584, 152, -176},
{ -1440, 224, -136},
{ -1288, 280, -24},
{ -1240, 304, -32},
{ -1256, 312, 0},
{ -1240, 392, 16},
{ -1040, 376, 24},
{ -1160, 528, 24},
{ -1088, 672, 88},
{ -1272... | |
{ .id = AttributeIdBody, .cstring = "Body" },
{ .id = AttributeIdMuteDayOfWeek, .uint8 = MuteBitfield_Always },
},
},
};
iOSNotifPrefs *existing_prefs = &prefs;
AttributeList expected_attributes = {
.num_attributes = 5,
.attributes = (Attribute[]) {
{ .id = AttributeIdTitle, .cs... | (ancs_filtering_is_muted(&mute_always)) | ;
cl_assert(!ancs_filtering_is_muted(&mute_weekends));
cl_assert(ancs_filtering_is_muted(&mute_weekdays));
s_now += SECONDS_PER_DAY; // Saturday Jan 2, 2016
cl_assert(ancs_filtering_is_muted(&mute_always));
cl_assert(ancs_filtering_is_muted(&mute_weekends));
cl_assert(!ancs_filtering_is_muted(&mute_weekday... |
/*
* 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_buffer[cache_idx], &s_test_data[data_idx].item,
sizeof(TestCacheItem)) | ;
}
static void prv_test_backing_data_empty(int cache_idx) {
cl_assert_equal_i(s_cache_keys[cache_idx], 0);
cl_assert_equal_m(&s_cache_buffer[cache_idx], &ZERO_ITEM, sizeof(TestCacheItem));
}
static void prv_test_get_miss(int data_idx) {
cl_assert(!prv_get(s_test_data[data_idx].key));
}
static void prv_test_ge... |
/*
* 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(s_last_driver_addr_is_null, false) | ;
cl_assert_equal_m(&s_last_driver_addr, &TEST_PINNED_ADDR_1, sizeof(s_last_driver_addr));
}
static void prv_assert_driver_addr_is_addr2(void) {
cl_assert_equal_b(s_last_driver_addr_is_null, false);
cl_assert_equal_m(&s_last_driver_addr, &TEST_PINNED_ADDR_2, sizeof(s_last_driver_addr));
}
void test_local_addr__... |
/*
* 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... | (NULL == bmp->data_row_infos) | ;
bmp = gbitmap_create_blank(s10, GBitmapFormat8Bit);
cl_assert(NULL != bmp);
cl_assert(NULL == bmp->data_row_infos);
bmp = gbitmap_create_blank(s10, GBitmapFormat1BitPalette);
cl_assert(NULL != bmp);
cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette
bmp = gbit... |
"->OUT");
PBL_HEXDUMP(LOG_LEVEL_DEBUG, (uint8_t *)&local_status_out, sizeof(local_status_out));
PBL_LOG(LOG_LEVEL_DEBUG, "->IN");
PBL_HEXDUMP(LOG_LEVEL_DEBUG, (uint8_t *)&remote_status_in, sizeof(remote_status_in));
prv_core_dump();
}
HOST_TRANSPORT_DEBUG_LOG("Local Status: %u bytes se... | (0, ~0, NULL, portMAX_DELAY) | ;
sys_watchdog_resume(s_ble_host_transport_wdog_id);
HOST_TRANSPORT_DEBUG_LOG("prv_host_transport_main loop unblocked, about to read..");
spi_device dev = ad_spi_open(PEBBLE_HOST);
ad_spi_device_acquire(dev);
host_transport_configure_spi_scs_pin(SCSPinFunction_SPI_CS);
while (prv_transact(d... |
/*
* 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... | kernel_zalloc(sizeof(PebbleSysNotificationActionResult) + alloc_size) | ;
if (!action_result) {
PBL_LOG(LOG_LEVEL_WARNING, "Failed to allocate memory for action result");
return NULL;
}
uint8_t *buffer = (uint8_t *)action_result + sizeof(PebbleSysNotificationActionResult);
uint8_t *const buf_end = buffer + alloc_size;
action_result->id = header->item_id;
action_result... |
/*
* 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... | (memory_layout_get_microflash_region(), font_key, 100) | ) {
PBL_LOG(LOG_LEVEL_ERROR, "Pointer %p not in app or microflash region", font_key);
syscall_failed();
}
}
return system_resource_get_font(font_key);
}
DEFINE_SYSCALL(void, sys_font_reload_font, FontInfo *fontinfo) {
if (PRIVILEGE_WAS_ELEVATED) {
if (!memory_layout_is_pointer_in_region(memo... |
_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 3);
s_current_day = s_monday;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 4);
s_current_day = s_tuesday;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 5);
s_current_day = s_wednesday;
cron_service_wakeup();
c... | cl_assert_equal_i(s_num_timeline_adds, 11) | ;
cl_assert_equal_i(s_num_timeline_removes, 7);
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time());
// Second alarm goes off. First one should be up again, but not until Saturday
s_current_hour = 11;
s_current_minute = 30;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms... |
{ -40, 912, 256},
{ -40, 920, 256},
{ -32, 912, 248},
// 133 seconds
{ -32, 912, 256},
{ -40, 912, 256},
{ -40, 912, 256},
{ -40, 920, 256},
{ -32, 912, 248},
{ -32, 912, 256},
{ -32, 912, 256},
{ -40, 912, 256},
{ -32, 920, 248},
{ -32, 920, 256},
{ -40, 912, ... | { -40, 920, 240},
{ -40, 920, 248},
{ -48, 920, 240},
{ -40, 920, 240},
{ -40, 920, 240},
{ -40, 928, 240},
{ -40, 920, 240},
{ -40, 920, 240},
{ -40, 920, 232},
{ -40, 920, 240},
{ -40, 920, 232},
{ -48, 920, 232},
{ -40, 920, 232},
{ -40, 928, 232},
{ -32, 9... |
{ -40, 920, 256},
{ -40, 920, 264},
{ -48, 920, 248},
{ -40, 912, 256},
{ -40, 912, 248},
{ -48, 912, 256},
{ -40, 920, 248},
{ -40, 920, 248},
{ -40, 920, 256},
{ -48, 912, 248},
{ -40, 912, 256},
// 142 seconds
{ -48, 912, 248},
{ -40, 912, 264},
{ -40, 912... |
/*
* 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_node->install_id,
new_node->install_id) | ;
if (is_app_quick_launch != is_new_quick_launch) {
// Quick Launch only apps are first
return (is_app_quick_launch ? 1 : 0) - (is_new_quick_launch ? 1 : 0);
} else if (override_cmp_rv) {
// Apps that override storage, record, and install order
return (override_cmp_rv);
} else if (app_node->storag... |
tedHandler granted_handler = ctx;
granted_handler();
}
static void prv_set_connection_responsiveness(
Transport *transport, BtConsumer consumer, ResponseTimeState state, uint16_t max_period_secs,
ResponsivenessGrantedHandler granted_handler) {
if (granted_handler) {
launcher_task_add_callback(prv_grant... | (packet_length) | ;
cb_data->packet_length = sizeof(PulsePPPacket) + data_length;
cb_data->packet.opcode = opcode;
if (data) {
memcpy(&cb_data->packet.data[0], data, data_length);
}
launcher_task_add_callback(prv_pulse_pp_send_cb, cb_data);
}
void pulse_pp_transport_open_handler(void) {
return;
}
void pulse_pp_transp... |
(length, data) | ;
}
}
void ancs_handle_read_or_notification(BLECharacteristic characteristic, const uint8_t *value,
size_t value_length, BLEGATTError error) {
if (error != BLEGATTErrorSuccess) {
PBL_LOG(LOG_LEVEL_ERROR, "Read or notification error: %d", error);
prv_reset_due_to_bt_err... | |
/*
* 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... | menu_layer_set_click_config_onto_window(menu_layer, &data->window) | ;
layer_add_child(&data->window.layer, menu_layer_get_layer(menu_layer));
}
static void prv_window_unload(Window *window) {
SettingsAppData *data = window_get_user_data(window);
menu_layer_deinit(&data->menu_layer);
app_free(data);
}
static void handle_init(void) {
SettingsAppData *data = app_zalloc_check(... |
/*
* 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_data.info[0].logging_session == NULL) {
// Sessions closed.
return;
} |
struct DataLoggingInfo*info = ck;
log_moar_data(info);
const int num_chunks = 30;
snprintf(info->text, sizeof(info->text), "%lu (%i) %i/%i", info->crc, info->counter * s_chunk_size, info->counter, num_chunks);
text_layer_set_text(&info->text_layer, info->text);
if (info->counter < num_chunks) {
app... |
}; // reset
return;
}
}
// We've received an expected byte, so store it
s_hci_cmd_info.data_buf[s_hci_cmd_info.write_offset] = c;
s_hci_cmd_info.write_offset++;
if (s_hci_cmd_info.write_offset == (HCI_CMD_HEADER_LEN + s_hci_cmd_info.param_len)) {
// We have found an HCI command, forward to the... | {
if (!prv_in_test_mode()) {
return;
}
uint8_t rx_test_cmd[] = {
HCI_CMD_START,
HCI_LE_RX_TEST_OCF,
OPCODE_TEST_CMDS_MSB,
0x1, // param length
rx_channel
};
hc_endpoint_enqueue_hci_cmd(rx_test_cmd, sizeof(rx_test_cmd));
} |
void bt_driver_le_test_end(void) {
if (!prv_in_test_mode()) {
return;
}
uint8_t test_end_cmd[] = {
HCI_CMD_START,
HCI_LE_TEST_STOP_OCF,
OPCODE_TEST_CMDS_MSB,
0x0 // param length
};
hc_endpoint_enqueue_hci_cmd(test_end_cmd, sizeof(test_end_cmd));
}
void bt_driver_register_response_callb... |
rt_dnd_enabled()) {
do_not_disturb_toggle_smart_dnd();
}
alerts_preferences_check_and_set_first_use_complete(FirstUseSourceSmartDND);
s_event_ongoing = false;
s_num_dnd_events_put = 0;
}
void test_do_not_disturb__cleanup(void) {
// Make sure we start in a common state: everything off
do_not_disturb_s... | do_not_disturb_is_smart_dnd_enabled() | == true);
active = do_not_disturb_is_active();
cl_assert(active == false);
s_event_ongoing = true;
// Manual && !Scheduled && Smart
do_not_disturb_set_manually_enabled(true);
do_not_disturb_set_schedule_enabled(WeekdaySchedule, false);
active = do_not_disturb_is_active();
cl_assert(active == true);
... |
angerously";
}
// Keep hourly logging to keep track of hours without crashes.
analytics_set(ANALYTICS_DEVICE_METRIC_SYSTEM_CRASH_CODE,
0xDEAD0000 | reason.code, AnalyticsClient_System);
uint32_t lr = reason.extra;
// Leave this NULL to do your own printing.
const char *reason_string = NULL... | {
DEBUG_LOG(LOG_LEVEL_INFO, reason_string, restarted_safely_string, rebooted_due_to,
reason.extra);
} |
analytics_set(ANALYTICS_DEVICE_METRIC_SYSTEM_CRASH_LR, lr, AnalyticsClient_System);
// We need to wait for the logging service to initialize.
AnalyticsEventCrash *crash_report = kernel_malloc_check(sizeof(AnalyticsEventCrash));
*crash_report = (AnalyticsEventCrash) {
.crash_code = reason.code,
.link_... |
ay(connection, true);
if (!is_subscribed) {
// The CoreBluetooth central that the iOS app uses to subscribe to the Connection Status
// characteristic does not use state restoration. Therefore, when the app crashes / is
// jetsam'd, iOS will unsubscribe from the characteristic. Use this as a trig... | {
if (length < sizeof(PebblePairingServicePacketLengthExtension)) {
return ATT_ERROR_INVALID_VALUE_LENGTH;
}
#if !SUPPORTS_PACKET_LENGTH_EXTENSION
return ((att_error_t)PebblePairingServiceGATTError_DeviceDoesNotSupportPLE);
#else
if (ple_req->trigger_ll_length_req) {
extern void hci_initiate_length_cha... |
extern void power_inhibit_sleep(void);
static att_error_t prv_handle_conn_params_write(const ble_evt_gatts_write_req_t *evt) {
Connection *connection = connection_by_idx(evt->conn_idx);
if (!connection) {
return ATT_ERROR_UNLIKELY;
}
att_error_t rv;
if (evt->length == 0) {
rv = ATT_ERROR_INVALID_... |
ulate_priority(AppCacheEntry *entry) {
return (uint32_t) MAX(entry->last_launch, entry->install_date);
}
//! Comparator for EvictListNode
static int evict_node_comparator(void *a, void *b) {
EvictListNode *a_node = (EvictListNode *)a;
EvictListNode *b_node = (EvictListNode *)b;
if (b_node->priority > a_node->... | mutex_lock_recursive(s_app_cache_mutex) | ;
{
SettingsFile file;
rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE);
if (rv != S_SUCCESS) {
goto unlock;
}
AppCacheEntry entry = { 0 };
rv = settings_file_get(&file, (uint8_t *)&app_id, sizeof(AppInstallId),
(uint8_t *)&entry, sizeof(AppCacheEntry));
... |
vent.put_bytes.failed, true); \
static void prv_receive_init_fw_object(void) {
prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware);
fake_comm_session_process_send_next();
fake_system_task_callbacks_invoke_pending();
}
static void prv_process_and_reset_test_counters(void) {
fake_comm_session_process_send_next(... | {
// Take and hold for a long time:
xSemaphoreTake(put_bytes_get_semaphore(), portMAX_DELAY);
fake_queue_set_yield_callback(put_bytes_get_semaphore(), prv_taking_too_long_yield_cb);
} |
void test_put_bytes__lock_contention_upon_write_message(void) {
// When the PutBytes lock is taken for a long time when a PutBytes message is written,
// expect to receive a Nack:
s_do_before_write = prv_hold_lock_before_write;
prv_receive_init(4, ObjectFirmware);
// Release it:
xSemaphoreGive(put_byte... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.