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... | app_glance_add_slice(session, slice) | , APP_GLANCE_RESULT_SUCCESS);
}
void test_app_glance__basic_reload(void) {
// Reload the glance with two slices
app_glance_reload(prv_basic_reload_cb, s_test_state.context);
cl_assert_equal_b(s_test_state.reload_callback_was_called, true);
// Read the glance back
AppGlance glance = {};
cl_assert_equal_i(a... |
Info) {
.type = PEBBLE_APP_DID_CHANGE_FOCUS_EVENT,
.handler = focus_handler,
.context = s_app_data,
};
event_service_client_subscribe(&s_app_data->focus_event_info);
}
static GColor prv_get_sidebar_color(TimelineAppData *data) {
if (s_app_data->timeline_model.direction == TimelineIterDirectionPast) {... | timeline_layer_get_current_layout(&data->timeline_layer) | ;
if (pin_timeline_layout) {
// animation the pin icon
TimelineItemLayer *item_layer = &data->pin_window.item_detail_layer;
timeline_layout_transition_card_to_pin(item_layer->timeline_layout, pin_timeline_layout);
}
#endif
// animate the timeline layer from the left
Layer *layer = &data->timeline_l... |
].buffer);
put_jobs->job[i].buffer = NULL;
}
}
static bool prv_init_put_job_queue_if_necessary(void) {
PutBytesPendingJobs *put_jobs = &s_pb_state.pb_pending_jobs;
// Things are already initialized if at least the first job buffer is non-NULL
if (put_jobs->job[0].buffer != NULL) {
return true;
}
#i... | firmware_update_is_in_progress() | ) {
bool is_fw_update_object = (type == ObjectFirmware ||
type == ObjectRecovery ||
type == ObjectSysResources);
if (is_fw_update_object) {
PBL_LOG(LOG_LEVEL_ERROR, "Cannot handle object type=<0x%x> when not in FW update mode", type);
r... |
mand(MusicCommand command) {
switch (command) {
case MusicCommandPlay:
return MusicEndpointCmdIDPlay;
case MusicCommandPause:
return MusicEndpointCmdIDPause;
case MusicCommandTogglePlayPause:
return MusicEndpointCmdIDTogglePlayPause;
case MusicCommandNextTrack:
return MusicEndp... | {
if (!app_event->is_open && app_event->is_system) {
// Pebble mobile app went away, communicate the disconnection to the upper layers:
prv_set_connected(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... | prv_get_fw_reset_vector(&reset_handler, &initial_stack_pointer) | ;
dbgserial_print("Booting firmware @ ");
dbgserial_print_hex((uintptr_t)reset_handler);
dbgserial_print("...\r\n\r\n");
// Disable all interrupts, just in case.
for (int i = 0; i < 8; ++i) {
// Interrupt Clear-Enable Register
NVIC->ICER[i] = 0xFFFFFFFF;
// Interrupt Clear-Pending Register
N... |
= idx;
}
if (prv_has_transition_window(context) && (iter.first_transition_idx == ModalPriorityInvalid)) {
iter.first_transition_idx = idx;
}
if (prv_has_focusable_window(context) && (iter.first_focus_idx == ModalPriorityInvalid)) {
iter.first_focus_idx = idx;
}
if (prv_has_opaque_wi... | (prv_update_modal_stack_callback, context) | ;
}
ModalProperty modal_manager_get_properties(void) {
return modal_manager_get_enabled() ? s_current_modal_properties : ModalPropertyDefault;
}
void modal_manager_render(GContext *ctx) {
PBL_ASSERTN(ctx);
prv_each_modal_stack(prv_render_modal_stack_callback, ctx);
}
typedef struct VisibleContext {
Window *... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
PBL_LOG(LOG_LEVEL_ERROR,
"settings_raw_iter logic error. "
"Attempting to read affected file into RAM for easier debugging...");
uint8_t *contents = read_file_into_ram(iter);
PBL_LOG(LOG_LEVEL_INFO, "Removing affected file %s...", iter->file_name);
// Remove the file that caused us to get ... | |
/*
* 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... | hr_util_get_hr_zone(240) | , HRZone_Zone3);
}
void test_hr_util__is_elevated(void) {
cl_assert_equal_b(hr_util_is_elevated(60), false);
cl_assert_equal_b(hr_util_is_elevated(80), false);
cl_assert_equal_b(hr_util_is_elevated(99), false);
cl_assert_equal_b(hr_util_is_elevated(100), true);
cl_assert_equal_b(hr_util_is_elevated(120), tr... |
/*
* 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... | smartstrap_comms_init() | ;
smartstrap_state_init();
smartstrap_connection_init();
smartstrap_profiles_init();
}
bool accessory_manager_handle_character_from_isr(char c) {
// NOTE: THIS IS RUN WITHIN AN ISR
switch (s_input_state) {
case AccessoryInputStateSmartstrap:
return smartstrap_handle_data_from_isr((uint8_t)c);
case Ac... |
ert(!iter_next(&iterator));
// 2 deletes
cl_assert(timeline_iter_remove_node_with_id(&head, &all_day_item.header.id));
cl_assert(timeline_iter_remove_node_with_id(&head, &all_day_item.header.id));
cl_assert(!timeline_iter_remove_node_with_id(&head, &all_day_item.header.id));
}
void test_timeline__24h_non_all_... | (!timeline_iter_remove_node_with_id(&head, &multiday_item.header.id)) | ;
}
void test_timeline__all_day_ios_bug(void) {
TimelineItem item = {
.header = {
.id = {0x29, 0xac, 0xd8, 0xb5, 0x9, 0xc7, 0x4c, 0x31, 0xbf,
0x6f, 0x3, 0x64, 0xd0, 0x5b, 0x9b, 0xc2},
.parent_id = {0},
.timestamp = 1430236800, // 9am Apr 28, 2015 PDT
.duration = MINUTES... |
for (j = 0; j < ALGORITHM_SAMPLING_RATE && i < num_samples; j++, i++) {
accel_data[j] = (AccelData) {
.x = samples[i].x,
.y = samples[i].y,
.z = samples[i].z,
.did_vibrate = false,
.timestamp = start_ms
};
}
fake_accel_service_invoke_callbacks(accel_data, ... | strftime(time_start_text, sizeof(time_start_text), "%F %r", local_tm) | |
different place, we need
// to clean up this state or else we'll just hit an INVSTATE UsageFault immediately. The only bit we leave
// set is the bit that says we're in thumb state, which must always be set on Cortex-M3, since the micro doesn't
// even support non-thumb instructions.
// See: https://pebbletech.... | if (stack_overflow) {
// Zero out the saved registers. We won't have new values in them, and we want to make sure
// that they don't contain bogus values from a fault we previously handled without crashing.
s_fault_saved_lr = 0;
s_fault_saved_pc = 0;
s_fault_saved_sp = 0;
// We can't call fault... |
}
void MemManage_Handler(void) {
// Grab the stack pointer, shove it into a register and call
// the c function above.
__asm("tst lr, #4\n"
"ite eq\n"
"mrseq r0, msp\n"
"mrsne r0, psp\n"
"mov r1, lr\n"
"b %0\n" :: "i" (mem_manage_handler_c));
}
static void busfault_handl... |
/*
* 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(y < f->size.h) | ;
#if PLATFORM_SPALDING
const GBitmapDataRowInfoInternal *row_infos = g_gbitmap_spalding_data_row_infos;
const size_t offset = row_infos[y].offset;
#else
const size_t offset = y * f->size.w;
#endif
return f->buffer + offset;
}
inline size_t framebuffer_get_size_bytes(FrameBuffer *f) {
PBL_ASSERTN(!gsize_equ... |
/*
* 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... | (&payload->address) | ;
if (connection == NULL) {
PBL_LOG(LOG_LEVEL_WARNING, "Service found but no device connected?");
return;
}
uint32_t gatt_service_size = payload->service.size_bytes;
GATTService *service_copy = kernel_malloc(gatt_service_size);
BTErrno e = BTErrnoNotEnoughResources;
if (service_copy) {
e = BTEr... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | window_render(&s_data.option_menu.window, fake_graphics_context_get_context()) | ;
}
// Tests
//////////////////////
// These tests test all permutations on all platforms even if the combination on the particular
// platform was not designed and thus does not appear pleasant. Make sure you are looking at the
// combination relevant to your use case when examining the unit test output of Option Me... |
/*
* 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... | snprintf(typical_text, sizeof(typical_text), i18n_get("TYPICAL %s", layer), weekday) | ;
const int y = PBL_IF_RECT_ELSE(PBL_IF_BW_ELSE(122, 120), 125);
GRect rect = GRect(0, y, layer->bounds.size.w, PBL_IF_RECT_ELSE(35, 36));
#if PBL_RECT
rect = grect_inset(rect, GEdgeInsets(0, 18));
#endif
const GColor bg_color = PBL_IF_COLOR_ELSE(GColorYellow, GColorBlack);
const GColor text_color = PBL_IF_... |
ition_state(r, RecognizerState_Completed));
r->state = RecognizerState_Started;
event_type = -1;
recognizer_transition_state(r, RecognizerState_Cancelled);
cl_assert_equal_i(event_type, RecognizerEvent_Cancelled);
cl_assert_equal_i(r->state, RecognizerState_Cancelled);
cl_assert(!s_manager_state_change);
... | (cancelled, false) | ;
cl_assert_equal_i(rec_event, -1);
r->state = RecognizerState_Cancelled;
recognizer_cancel(r);
cl_assert_equal_i(r->state, RecognizerState_Cancelled);
cl_assert_equal_b(cancelled, false);
cl_assert_equal_i(rec_event, -1);
r->state = RecognizerState_Completed;
recognizer_cancel(r);
cl_assert_equal_i... |
///////////////////////////
void watch_app_prefs_db_init(void) {
s_watch_app_prefs_db.mutex = mutex_create_recursive();
}
// All entries in this db currently follow a structure of base data + arbitrary list of records.
// All records in the list are the same size
static bool prv_validate_received_pref(const size_t ... | pfs_remove(SETTINGS_FILE_NAME) | ;
mutex_unlock_recursive(s_watch_app_prefs_db.mutex);
return rv;
}
|
Job *) job->node.next;
if (job != s_current && prv_is_current_term_silent(job)) {
prv_increment_elapsed_time_for_job(&job, NULL);
}
job = next;
} while (job != s_jobs);
}
// -----------------------------------------------------------------------------
//! Cycle timer callback.
//! It increments the... | if (!s_current) {
// No current job, start timer:
prv_timer_start();
} |
if (!prv_is_current_term_silent(next)) {
const bool enable_scan_resp = (next->payload.scan_resp_data_length > 0);
if (s_current_ad_data != &next->payload) {
// Give the advertisement data to the BT controller:
bt_driver_advert_set_advertising_data(&next->payload);
s_current_ad... |
entCallback cb, void *data) {
cb(data);
return true;
}
bool sm_is_pairing_info_empty(const SMPairingInfo *p) {
return false;
}
extern RegularTimerInfo *shared_prf_storage_get_writeback_timer(void);
static void prv_fire_writeback_timer(void) {
fake_regular_timer_trigger(shared_prf_storage_get_writeback_timer()... | cl_assert_equal_i(pairing_info->local_encryption_info.div,
pairing_info_out.local_encryption_info.div) | ;
cl_assert_equal_i(pairing_info->identity.opaque.opaque_64,
pairing_info_out.identity.opaque.opaque_64);
cl_assert_equal_i(pairing_info->remote_encryption_info.rand,
pairing_info_out.remote_encryption_info.rand);
cl_assert_equal_i(pairing_info->remote_encryption_info.ediv,... |
LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* dist... | TIM_ClearITPendingBit(TIM7, TIM_IT_Update) | |
TROKE_SMALL,GCornerBottomRight);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_bottom_right.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL);
graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADI... | (&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL) | ;
graphics_circle_quadrant_draw_stroked_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornersLeft);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_quads_left.${BIT_DEPTH_NAME}.pbi"));
#endif // SCREEN_COLOR_DEPTH_BITS == 8
}
|
TSTRAP
// Event handler
////////////////////////////////////////////////////////////////////////////////
static void prv_app_smartstrap_event(PebbleEvent *e, void *context) {
SmartstrapConnectionState *state = app_state_get_smartstrap_state();
PebbleSmartstrapEvent event = e->smartstrap;
if (event.type == Smarts... | if (!sys_smartstrap_attribute_register(service_id, attribute_id, buffer, buffer_length)) {
applib_free(buffer);
return NULL;
} |
SmartstrapConnectionState *state = app_state_get_smartstrap_state();
state->num_attributes++;
prv_state_init();
return (SmartstrapAttribute *)buffer;
#else
return NULL;
#endif
}
void app_smartstrap_attribute_destroy(SmartstrapAttribute *attr) {
#if USE_SMARTSTRAP
SmartstrapConnectionState *state = app_sta... |
lt(bool connected, void *context) {
VoiceUiData *data = context;
if (connected) {
if (data->state == StateError) {
// We got here after a dictation result timeout, so restart the dictation
prv_start_dictation(data);
} else {
prv_voice_window_push(data);
}
} else {
VOICE_LOG("Blue... | VOICE_LOG("Empty sentence received") | ;
return false;
}
VOICE_LOG("New sentence: %s", data->message);
return true;
}
static void prv_handle_dictation_error(VoiceUiData *data, VoiceStatus error_status) {
uint64_t elapsed = prv_get_time_ms() - data->start_ms;
const bool speech_detected = (data->speech_detected) || (elapsed < MIN_ELAPSED_DURAT... |
pp_message_outbox_begin(&iter), APP_MSG_BUSY);
cl_assert_equal_i(MIN(i, 100), s_sys_psleep_last_millis);
}
}
// Test INBOUND (phone->watch):
////////////////////////////////////
static void check_in_accepting_again(void) {
cl_assert(app_message_is_accepting_inbound() == true);
}
void test_app_message__receive... | cl_assert_equal_b(app_message_is_closed_outbound(), true) | ;
}
void test_app_message__kernel_nack_handler(void) {
prv_set_remote_receive_handler(prv_receive_ack_nack_callback);
const AppMessagePush push = {
.header = {
.command = CMD_PUSH,
.transaction_id = TEST_TRANSACTION_ID_2,
},
};
app_message_app_protocol_system_nack_callback(s_fake_app_comm_... |
2_t distance;
uint32_t active_seconds;
} MovementData;
_Static_assert(offsetof(MovementData, version) == 0, "Version not at the start of MovementData");
_Static_assert(sizeof(MovementData) % sizeof(uint32_t) == 0, "MovementData size is invalid");
typedef struct PACKED SleepData {
uint32_t version;
uint32_t last_... | (data->last_processed_timestamp) | ) {
return;
}
PBL_LOG(LOG_LEVEL_INFO, "Got SleepData for wday: %d, cur_wday: %d, sleep: %"PRIu32"",
wday, cur_wday, data->sleep_duration);
activity_metrics_prv_set_metric(ActivityMetricSleepTotalSeconds, wday, data->sleep_duration);
activity_metrics_prv_set_metric(ActivityMetricSleepRe... |
event_time_ts) * MS_PER_SECOND;
const int32_t delta_distance_mm = activity_private_compute_distance_mm(delta_steps, delta_ms);
wrkt_data->distance_m += (delta_distance_mm / MM_PER_METER);
// Calculate active calories
const int32_t active_calories = activity_private_compute_active_calories(delta_distanc... | {
workout_service_pause_workout(true);
} |
}
// ---------------------------------------------------------------------------------------
void workout_service_workout_event_handler(PebbleWorkoutEvent *event) {
if (!workout_service_is_workout_ongoing()) {
return;
}
// Handling this with an event because the timer needs to be called from KernelMain
i... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ARRAY_LENGTH(s_emoji_table) | ; i++) {
const EmojiEntry *emoji = &s_emoji_table[i];
const Codepoint codepoint = utf8_peek_codepoint((utf8_t *)emoji->string, NULL);
if (emoji->codepoint != codepoint) {
printf(" ENTRY(\"%s\", 0x%05x, %s)\n", emoji->string, (unsigned int)codepoint,
emoji->resource_name);
}
cl_ch... |
ult
static uint32_t s_spi_clock_hz;
// DMA constants
static DMA_Stream_TypeDef* DISPLAY_DMA_STREAM = DMA1_Stream4;
static const uint32_t DISPLAY_DMA_CLOCK = RCC_AHB1Periph_DMA1;
static bool s_initialized = false;
// DMA state
static DisplayContext s_display_context;
static uint32_t s_dma_line_buffer[DISP_DMA_BUFFER_... | dma_request_init(SHARP_SPI_TX_DMA) | ;
prv_enable_display_spi_clock();
prv_display_start();
prv_disable_display_spi_clock();
s_initialized = true;
}
static void prv_display_context_init(DisplayContext* context) {
context->state = DISPLAY_STATE_IDLE;
context->get_next_row = NULL;
context->complete = NULL;
}
// Clear-all mode is entered b... |
ing at desk sample
// The expected results were obtained empirically on a known good commit
{
int num_samples;
AccelRawData *samples = activity_sample_working_at_desk(&num_samples);
TestMinuteData exp_minutes[] = {
{
.steps = 0,
.orientation = 0x72,
.vmc = 1787,
},
... | (s_captured_activity_sessions, s_num_captured_activity_sessions, &exp_session) | |
alse; // stop iteration
}
bool reminder_db_find_by_timestamp_title(time_t timestamp, const char *title,
TimelineItemStorageFilterCallback filter_cb,
TimelineItem *reminder_out) {
PBL_ASSERTN(reminder_out);
ReminderInfo reminder_info... | {
return timeline_item_storage_read(&s_storage, key, key_len, val_out, val_out_len);
} |
status_t reminder_db_delete(const uint8_t *key, int key_len) {
status_t rv = prv_reminder_db_delete_common(key, key_len);
reminders_handle_reminder_removed((Uuid *) key);
return rv;
}
status_t reminder_db_flush(void) {
return timeline_item_storage_flush(&s_storage);
}
status_t reminder_db_is_dirty(bool *is... |
impleMenuItem menu_items[] = {
{
.title = "Step History",
.callback = prv_debug_cmd_step_history,
}, {
.title = "Active Minutes History",
.callback = prv_debug_cmd_active_time_history,
}, {
.title = "Distance(m) History",
.callback = prv_debug_cmd_distance_history,
},... | window_set_background_color(data->hr_window, GColorBlack) | ;
window_set_user_data(data->hr_window, data);
window_set_click_config_provider_with_context(data->hr_window, prv_hr_click_config_provider,
data);
window_set_window_handlers(data->hr_window, (WindowHandlers) {
.load = prv_hr_window_load,
.unload = prv_hr_win... |
----------------------------
// Globals
static ListNode *s_data_subscribers = 0;
static uint8_t s_tap_subscribers_count = 0;
AccelSamplingRate s_accel_sampling_rate;
static uint8_t s_accel_samples_per_update;
static TimerID s_timer_id = TIMER_INVALID_ID;
static bool s_temp_peek_mode = false;
static bool s_enabled = fal... | {
// Min FIFO setting is 1 deep
num_samples = 1;
} | else if (num_samples > ACCEL_MAX_SAMPLES_PER_UPDATE) {
num_samples = ACCEL_MAX_SAMPLES_PER_UPDATE;
}
accel_set_num_samples(num_samples);
s_accel_samples_per_update = num_samples;
PBL_LOG(LOG_LEVEL_DEBUG, "setting accel rate:%d, num_samples:%"PRIu32, highest_rate, num_samples);
}
// Switch accelerometer i... |
GCornerTopLeft | GCornerBottomLeft);
GRect rect = action_bar->layer.bounds;
rect.origin.x += margin;
rect.origin.y += margin;
rect.size.w -= margin;
rect.size.h -= 2 * margin;
rect.size.h /= NUM_ACTION_BAR_LEGACY2_ITEMS;
const bool is_white = gcolor_equal(bg_color, GColorWhite);
con... | (action_bar) | ;
// For UP, SELECT and DOWN, setup the raw handler and assign the user specified context:
for (ButtonId button_id = BUTTON_ID_UP; button_id < NUM_BUTTONS; ++button_id) {
window_raw_click_subscribe(button_id, action_bar_legacy2_raw_down_handler,
action_bar_legacy2_raw_up_handler, ... |
alling accessory_disable_input before will give you a nice speed boost as we don't have
// to wait for it to be safe to turn the input back on after each byte.
const bool temporarily_disabled = s_input_enabled;
if (UNLIKELY(temporarily_disabled)) {
accessory_disable_input();
}
for (size_t i = 0; i < len... | psleep(10) | ;
bool result = (gpio_input_read(&BOARD_CONFIG_ACCESSORY.int_gpio) == SET);
gpio_input_init(&BOARD_CONFIG_ACCESSORY.int_gpio);
return result;
}
// ISRs
////////////////////////////////////////////////////////////////////
static bool prv_rx_irq_handler(UARTDevice *dev, uint8_t data, const UARTRXErrorFlags *err_f... |
e, animation_h, false /*quiet*/);
if (!animation) {
return false;
}
return animation->reverse;
}
// -------------------------------------------------------------------------------------------
bool animation_set_play_count(Animation *animation_h, uint32_t play_count) {
AnimationState *state = prv_animation... | prv_complex_create(animation_array, array_len, AnimationTypeSequence) | ;
return seq;
}
// -------------------------------------------------------------------------------------------
Animation *animation_sequence_init_from_array(Animation *parent, Animation **animation_array,
uint32_t array_len) {
PBL_ASSERTN(!animation_private_using_lega... |
y_value_t jerry_create_error_sz(jerry_error_t error_type,
const jerry_char_t *message_p,
jerry_size_t message_size) {
jerry_value_t error_ref = 0;
switch (error_type) {
case JERRY_ERROR_COMMON:
error_ref = JERRY_ERROR(Error, message_p... | __jerryRefs.get($1) | ;
try {
return delete obj[name];
} catch (e) {
// In strict mode, delete throws SyntaxError if the property is an
// own non-configurable property.
return false;
}
return true;
}, obj_val, prop_name_val);
}
jerry_value_t jerry_get_property(const jerry_value_t... |
, -296},
// 28 seconds
{ 1352, 696, -256},
{ 1208, 712, -288},
{ 944, 752, -376},
{ 872, 880, -320},
{ 984, 848, -288},
{ 1008, 824, -240},
{ 1032, 752, -256},
{ 1184, 656, -224},
{ 1344, 456, -240},
{ 1056, 320, -208},
{ 952, 280, -224},
{ 1088, 256, -192},
{ 124... | { 1280, 384, -296},
{ 1096, 328, -224},
{ 1048, 192, -232},
{ 1072, 240, -184},
{ 1152, 216, -184},
{ 1264, 200, -176},
{ 1192, 112, -128},
{ 1192, 144, -160},
{ 896, 48, -216},
{ 712, -184, -96},
{ 504, -192, -336},
{ 704, -104, -312},
{ 1088, 56, -352},
{ 1120, ... |
{ 976, 280, -320},
{ 1040, 352, -360},
{ 1144, 368, -376},
{ 1152, 464, -504},
{ 1072, 600, -608},
{ 1040, 696, -616},
{ 1096, 752, -544},
{ 1144, 752, -504},
{ 1056, 632, -376},
{ 1152, 528, -352},
{ 1288, 432, -312},
{ 1144, 240, -192},
{ 1064, 216, -160},
{ 87... |
/*
* 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... | {
MfgData data = prv_fetch_struct();
data.disp_offset_x = p.x;
data.disp_offset_y = p.y;
prv_update_struct(&data);
} |
uint32_t mfg_info_get_rtc_freq(void) {
return prv_fetch_struct().rtc_freq;
}
void mfg_info_set_rtc_freq(uint32_t rtc_freq) {
MfgData data = prv_fetch_struct();
data.rtc_freq = rtc_freq;
prv_update_struct(&data);
}
void mfg_info_get_model(char* buffer) {
MfgData data = prv_fetch_struct();
strncpy(buffer,... |
328, -928},
{ -264, 304, -944},
{ -256, 288, -936},
{ -280, 328, -928},
{ -264, 328, -944},
{ -272, 336, -952},
{ -272, 328, -928},
{ -256, 296, -928},
{ -256, 312, -944},
{ -248, 320, -944},
{ -304, 360, -928},
// 142 seconds
{ -272, 344, -952},
{ -280, 368, -912},
... | { -264, 448, -968},
{ -272, 368, -920},
// 147 seconds
{ -288, 328, -896},
{ -336, 336, -888},
{ -328, 328, -888},
{ -320, 376, -904},
{ -320, 368, -936},
{ -336, 296, -880},
{ -288, 312, -888},
{ -288, 400, -936},
{ -272, 376, -928},
{ -272, 384, -912},
{ -280, 3... |
{ -296, 384, -896},
{ -288, 400, -904},
{ -288, 384, -904},
{ -288, 376, -904},
{ -288, 384, -888},
{ -288, 368, -904},
{ -296, 384, -904},
{ -296, 400, -896},
{ -296, 392, -904},
{ -296, 376, -904},
{ -288, 368, -896},
{ -304, 384, -896},
{ -296, 392, -896},
// ... |
existing_uuid,
ActivityScalarStore cur_val, ActivityScalarStore average,
const SummaryPinConfig *config) {
TimelineItem *item = prv_create_summary_pin(pin_time_utc, now_utc, cur_val, average, config);
return prv_push_pin(item, existing_uuid);
}
// -... | (stats->metric, history_len, history) | ;
// Make sure enough days have been above the target
// (start at 1 since we don't care about today's metric)
for (uint32_t i = 1; i < history_len; ++i) {
if (history[i] < target) {
INSIGHTS_LOG_DEBUG("History validation failed - not above target on day %"PRIu32
": %"PRIi32, i... |
app_manager_get_current_app_id() | ) {
app_manager_force_quit_to_launcher();
} else {
const time_t current_time = rtc_get_time();
const time_t WORKER_CRASH_RESET_TIMEOUT_SECONDS = 60;
if ((closing_worker_install_id == s_last_worker_crashed_install_id) &&
((current_time - s_last_worker_crash_timestamp) <= WORKER_CRASH_RESET_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... | pfs_close(fd) | |
__connect_to_music_service_upon_subscribing_entity_update_characteristic(void) {
prv_discover_ams(1 /* num_instances */);
// Not connected yet (still need to subscribe):
cl_assert_equal_s(music_get_connected_server_debug_name(), NULL);
// Simulate successful subscription:
BLECharacteristic entity_update = s_... | prv_discover_ams(1 /* num_instances */) | ;
cl_assert_equal_b(ams_is_registered_for_all_entity_updates(), false);
}
void test_ams__register_for_entity_updates_retry_if_out_of_resources(void) {
prv_discover_ams(1 /* num_instances */);
// Simulate not having enough resources to process the request:
fake_gatt_client_op_set_write_return_value(BTErrnoNotE... |
t
return;
}
// Destroy the currently displayed icon
prv_generic_glance_destroy_displayed_icon(generic_glance);
AppResourceInfo res_info_to_load = *res_info;
// Set the resource info to the real default icon resource info if the default icon was requested
if (is_requested_resource_the_default_icon) {
... | {
// Next reeval time is so far in the future that its offset in milliseconds from the
// current time would overflow the argument to AppTimer, so just ignore this reeval because it's
// not worth setting a timer for it
return;
} |
prv_cancel_subtitle_reeval_timer(generic_glance);
generic_glance->slice_subtitle_template_string_reeval_timer =
app_timer_register((uint32_t)time_until_next_reeval_ms, prv_subtitle_reeval_timer_cb,
structured_glance);
generic_glance->next_slice_subtitle_template_string_reeval_time = ... |
e->spi_first_bit);
// Write result back to CR1
bus->spi->CR1 = tmpreg;
#if MICRO_FAMILY_STM32F7
// On STM32F7 we need to set FRXTH in order to do 8-bit transfers.
// If we don't, the MCU always tries to read 16-bits even though we
// specified that the data is 8-bits.
// Why clear isn't 8-bit is beyond me,... | prv_spi_acquire_helper(slave) | ;
spi_ll_slave_burst_read_write_scatter(slave, sc_info, num_sg);
prv_spi_release_helper(slave);
}
void spi_slave_set_frequency(const 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(cons... |
MAL_MODE_CLOCK_SPEED_MAX) { //Fast mode
i2c_init_struct.I2C_DutyCycle = BOARD_CONFIG.i2c_bus_configs[bus_idx].duty_cycle;
}
i2c_init_struct.I2C_ClockSpeed = BOARD_CONFIG.i2c_bus_configs[bus_idx].clock_speed;
i2c_init_struct.I2C_Ack = I2C_Ack_Enable;
I2C_Init(i2c_buses[bus_idx].i2c, &i2c_init_struct);
I2... | {
PBL_LOG(LOG_LEVEL_ERROR, "Attempted release of disabled bus %d by device %d", bus_idx, device_id);
bus_unlock(bus);
return;
} |
bus->user_count--;
if (bus->user_count == 0) {
bus_disable(bus_idx);
}
bus_unlock(bus);
}
void i2c_reset(I2cDevice device_id) {
PBL_ASSERTN(s_initialized);
PBL_ASSERTN(device_id < BOARD_CONFIG.i2c_device_count);
uint8_t bus_idx = BOARD_CONFIG.i2c_device_map[device_id];
I2cBus *bus = &i2c_buses[... |
{ 640, 904, 368},
{ 560, 1048, 168},
{ 360, 600, 0},
{ 200, 560, 64},
{ 152, 640, 136},
{ 232, 688, 216},
// 5 seconds
{ 336, 968, 312},
{ 448, 808, 376},
{ 512, 1008, 320},
{ 560, 1136, 368},
{ 704, 1176, 528},
{ 584, 1104, 528},
{ 616, 1120, 344},
{ 584, 784, 5... | { 928, 456, 16},
{ 976, 488, 80},
{ 1160, 496, 64},
{ 1392, 544, 88},
{ 1568, 392, 272},
{ 1584, 560, 216},
{ 1160, 464, 272},
{ 1384, 328, 240},
{ 1392, 352, 312},
{ 1144, 360, 296},
{ 840, 280, 224},
{ 760, 216, 200},
// 11 seconds
{ 800, 168, 224},
{ 760, 1... |
{ 816, 152, 224},
{ 776, 104, 208},
{ 880, 120, 224},
{ 960, 168, 280},
{ 1168, 128, 328},
{ 1448, 288, 424},
{ 1104, 584, 256},
{ 1256, 648, -24},
{ 1376, 488, 136},
{ 1176, 264, 320},
{ 944, 264, 232},
{ 864, 432, 88},
{ 808, 448, 104},
{ 952, 560, 104},
{ ... |
graphics_context_set_drawing_state(ctx, prev_state);
}
static inline void prv_menu_layer_draw_section_header(MenuLayer *menu_layer, Layer *cell_layer,
MenuCellSpan *cursor, GContext* ctx) {
cell_layer->bounds.size.h = cursor->h;
cell_layer->frame.size.h = cursor->h;
cell_layer->frame.origin.y = cursor->y;
... | {
it->row_callback_before_geometry(it);
} |
it->cursor.h = prv_menu_layer_get_cell_height(it->menu_layer, &it->cursor.index, true);
it->cell_bottom_y = it->cursor.y + it->cursor.h;
// ROW
if (it->row_callback_after_geometry) {
it->row_callback_after_geometry(it);
}
if (it->should_continue == false) {
return;... |
l());
}
}
mutex_unlock_recursive(s_accel_manager_mutex);
}
static void prv_shake_remove_subscriber_cb(PebbleTask task) {
mutex_lock_recursive(s_accel_manager_mutex);
{
PBL_ASSERTN(s_shake_subscribers_count > 0);
if (--s_shake_subscribers_count == 0) {
PBL_LOG(LOG_LEVEL_DEBUG, "Stopping accel ... | PBL_LOG(LOG_LEVEL_DEBUG,
"set subsampling for session %p to %" PRIu16 "/%" PRIu16,
state, numerator, denominator) | |
nsumed without consuming any more.
// This special mode is only used by dls_storage_rebuild() when we are resurrecting old
// sessions from the file system.
int32_t dls_storage_consume(DataLoggingSession *logging_session, int32_t num_bytes) {
prv_assert_valid_task();
int32_t consumed_bytes = 0;
bool got_session_... | PBL_LOG(LOG_LEVEL_ERROR, "Error %d opening file %s", fd, head->name) | ;
pfs_remove(head->name);
goto bad_session;
}
// Get the session info
DLSFileHeader hdr;
if (!prv_pfs_read(fd, &hdr, sizeof(hdr))) {
pfs_close(fd);
goto bad_session;
}
pfs_close(fd);
// Create a new session based on the file info
session = dls_list_create_sessio... |
ibutes_response(const uint8_t *data, size_t length);
static void prv_handle_app_attributes_response(const uint8_t *data, size_t length);
static void prv_get_notification_attributes(uint32_t uid);
static bool prv_write_control_point_request(const CPDSMessage *cmd, size_t size);
static void prv_reset_reassembly_conte... | prv_get_notification_attributes(s_ancs_client->queue->uid) | ;
} else if (s_ancs_client->queue->op == NotificationQueueOpPerformAction) {
prv_perform_action(s_ancs_client->queue->uid, s_ancs_client->queue->action_id);
}
}
static bool prv_notif_queue_comparator(ListNode *found_node, void *data) {
NotificationQueueNode *queue_node = (NotificationQueueNode *)found_node;
... |
_WIDTH == 144 && PBL_DISPLAY_HEIGHT == 168)
#define SPALDING_SCREEN_RES (PBL_DISPLAY_WIDTH == 180 && PBL_DISPLAY_HEIGHT == 180)
////////////////////////////////////////////////////////////////////////////////////////////////////
// UI Utils
#if UNITTEST
static int16_t s_unobstructed_area_height = 0;
T_STATIC void pr... | (sizeof(GPoint) * max_points) | ,
.num_points = 0,
};
const int32_t top_right = frame.size.w / 2;
const int32_t bot_right = frame.size.h + top_right;
const int32_t bot_left = frame.size.w + bot_right;
const int32_t top_left = frame.size.h + bot_left;
const int32_t rect_perimeter = top_left + top_right;
const int32_t corners[] = {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... | for (ListNode* iter = list_get_next(list); iter != 0; ) {
RegularTimerInfo* reg_timer = (RegularTimerInfo*) iter;
if (--reg_timer->private_count == 0) {
reg_timer->private_count = reg_timer->private_reset_count;
// Release the mutex while we execute the callback
reg_timer->is_executing = tru... |
mutex_unlock(s_callback_list_semaphore);
}
// -------------------------------------------------------------------------------------------
static void timer_callback(void* data) {
(void) data;
do_callbacks(&s_seconds_callbacks);
time_t t = rtc_get_time();
struct tm time;
localtime_r(&t, &time);
if (ti... |
/*
* 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... | (fmt_args) | ;
trigger_fault(RebootReasonCode_Assert, lr);
}
NORETURN passert_failed_hashed_no_message_with_lr(uint32_t lr) {
PBL_LOG(LOG_LEVEL_ALWAYS, "ASSERTION at LR 0x%"PRIx32, lr);
trigger_fault(RebootReasonCode_Assert, lr);
}
NORETURN passert_failed_hashed_no_message(void) {
passert_failed_hashed_no_message_with_l... |
ect__color = GColorClear;
s_graphics_draw_rect_precise = (MockCallRecordings){0};
s_graphics_fill_radial_precise_internal = (MockCallRecordings){0};
s_layer_mark_dirty = (MockCallRecordings){0};
s_fonts_get_system_font = (MockCallRecordings){0};
s_graphics_draw_text = (MockCallRecordings){0};
s_graphics_tex... | rocky_global_init(s_graphics_api) | |
nfig, context)) {
goto cleanup;
}
prv_enable_alarm_config(&config, true /* enabled */);
prv_alarm_set_config(&file, id, &config);
cleanup:
prv_file_close_and_unlock(&file);
}
// ----------------------------------------------------------------------------------------------
typedef struct SetAlarmTimeConte... | (&file, id, &config) | ;
if (!rv) {
goto cleanup;
}
if (id == s_most_recent_alarm_id && !enable) {
PBL_LOG(LOG_LEVEL_DEBUG, "Canceling snooze timer because alarm was disabled");
// Harmless if the alarm is not currently snoozing - the snooze timer still exists to be stopped
prv_clear_snooze_timer();
}
prv_enable_a... |
// UART DEVICES
#if TARGET_QEMU
static UARTDeviceState s_qemu_uart_state;
static UARTDevice QEMU_UART_DEVICE = {
.state = &s_qemu_uart_state,
// GPIO? Where we're going, we don't need GPIO. (connected to QEMU)
.periph = USART2,
.irq_channel = USART2_IRQn,
.irq_priority = 13,
.rcc_apb_periph = RCC_APB1Perip... | (&I2C_2V5_BUS) | ;
voltage_monitor_device_init(VOLTAGE_MONITOR_ALS);
voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY);
}
|
TIMELINE_RESOURCE_ALARM_CLOCK);
const char *pin_title = attribute_get_string(pin_attr_list, AttributeIdTitle, NULL);
cl_assert_equal_s(pin_title, "Alarm");
const char *pin_subtitle = attribute_get_string(pin_attr_list, AttributeIdSubtitle, NULL);
cl_assert_equal_s(pin_subtitle, alarm_get_string_for_kind(alar... | (s_num_alarm_events_put, 2) | ;
cl_assert_equal_i(s_num_timeline_adds, 20);
cl_assert_equal_i(s_num_timeline_removes, 12);
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time());
// First alarm goes off. Second one should be up
s_current_hour = 10;
s_current_minute = 30;
s_current_day = s_friday;
cron_servi... |
/*
* 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 OtpWriteFailAlreadyWritten;
} |
char * const field = otp_get_slot(index);
uint8_t * const lock = otp_get_lock(index);
FLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |
FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR|FLASH_FLAG_PGSERR);
bool failed = false; // Because it's OTP we need to keep t... |
t_subscription_info(session_ref, NULL, NULL, &ret_expire_s, NULL);
cl_assert_equal_i(ret_expire_s, 0);
// Now, call the process cleanup. This should place an expiration time on the subscription
hrm_manager_process_cleanup(PebbleTask_App, app_id);
cl_assert(sys_hrm_manager_get_app_subscription(app_id) == sessio... | sys_hrm_manager_app_subscribe(app_id, 1, expire_s, HRMFeature_BPM) | ;
app_ids[i] = app_id;
}
// Ensure sure all can be found
for (int i = 0; i < num_refs; ++i) {
cl_assert(prv_get_subscriber_state_from_ref(session_refs[i]));
cl_assert(prv_get_subscriber_state_from_app_id(PebbleTask_App, app_ids[i]));
}
cl_assert(prv_get_subscriber_state_from_ref(HRM_INVALID_SESS... |
nclude "services/common/new_timer/new_timer.h"
#include "services/common/system_task.h"
#include "services/common/analytics/analytics_event.h"
#include "services/common/analytics/analytics_external.h"
#include "services/common/analytics/analytics_heartbeat.h"
#include "services/common/analytics/analytics_logging.h"
#i... | {
AnalyticsHeartbeat *app_hb = app_hb_node->heartbeat;
#ifdef ANALYTICS_DEBUG
analytics_heartbeat_print(app_hb);
#endif
dls_log(s_app_heartbeat_session, app_hb->data, 1);
AnalyticsHeartbeatList *next = (AnalyticsHeartbeatList*)app_hb_node->node.next;
kernel_free(app_hb);
kernel_free(app_hb_node... | |
52},
{ -504, 1192, 584},
{ -296, 880, 584},
{ -232, 856, 480},
{ -96, 632, 288},
{ 40, 496, 256},
{ 24, 552, 280},
{ -32, 720, 360},
{ -128, 840, 408},
{ -256, 1016, 504},
{ -520, 1120, 568},
{ -440, 976, 544},
{ -584, 1256, 560},
{ -408, 976, 192},
{ -320, 848, 1... | { 312, 528, 40},
{ 272, 696, 72},
{ 168, 648, 56},
{ 288, 1248, 184},
{ 160, 1336, 248},
{ 48, 936, 112},
{ 16, 1744, 72},
{ -432, 1472, 608},
{ -216, 1448, 392},
{ -224, 840, 368},
{ -8, 544, 256},
{ 96, 440, 128},
{ 128, 440, 176},
{ 144, 664, 56},
{ -48, 10... | |
lls, b), 0);
// Complete sequence
prv_advance_to_ms_with_timers(start_ms + duration_a + duration_b + 5 * MIN_FRAME_INTERVAL_MS + 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0);
cl_assert_equal_i(pr... | (prv_count_handler_entries(&s_stopped_handler_calls, c), 1) | ;
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, c), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, c), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, d), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, d), 1)... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ("flags: "PRIb8", ", TO_BINARY(hdr.flags)) | ;
printf("key_hash: %"PRIu8", key_len: %d, val_len: %d }\n", hdr.key_hash, hdr.key_len, hdr.val_len);
}
}
static void verify(SettingsFile *file, uint8_t *key, int key_len,
uint8_t *val, int val_len) {
int val_len_out = settings_file_get_len(file, key, key_len);
cl_must_pass(val_len_out);
... |
d, %d", &x, &y, &z);
fflush(stdout);
PBL_ASSERTN(state->test_entry.num_samples < ACCEL_SAMPLES_DISCOVERY_MAX_SAMPLES);
state->samples[state->test_entry.num_samples++] = (AccelRawData) {
.x = x,
.y = y,
.z = z,
};
continue;
}
// End of a sample
if (strc... | (token + strlen(token) + 1, "%d", &state->test_entry.cur_state_elapsed.value) | ;
} else if (strcmp(token, "TEST_CUR_STATE_ELAPSED_MIN") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.cur_state_elapsed.min);
} else if (strcmp(token, "TEST_CUR_STATE_ELAPSED_MAX") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.cur_state_elapsed.max)... |
buted 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/app.h"
#include "applib/app_logging.h"
#include "applib/fonts/fonts.h"
#include "applib/ui... | MAX(first_idx, 0) | ;
// Get the min and max
bool first_valid = true;
int first_non_zero_idx = -1;
for (int i = first_idx; i < (int)READ_HISTORY_ENTRIES; i++) {
if (s_temp_readings[i] == 0) {
continue;
}
if (first_non_zero_idx < 0) {
first_non_zero_idx = i;
}
if (first_valid) {
data->min_temp... |
app_notification_window_remove_notification_by_id(id);
}
static void prv_handle_notification_acted_upon(Uuid *id) {
app_notification_window_handle_notification_acted_upon_by_id(id);
}
static void prv_handle_notification_added(Uuid *id) {
TimelineItem notification;
if (!notification_storage_get(id, ¬ification... | MenuIndex(0, 1) | ,
PBL_IF_RECT_ELSE(MenuRowAlignNone, MenuRowAlignCenter), false);
}
static void prv_push_window(NotificationsData *data) {
Window *window = &data->window;
window_init(window, WINDOW_NAME("Notifications"));
window_set_user_data(window, data);
window_set_window_handlers(window, &(... |
/*
* 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... | (ALARM_PRIORITY) | |
s workaround, we do need to publish a new service but I think this should be
// harmless to watches which do not need the workaround
// Not foolproof but chose a high service handle that is unlikely to be occupied by a different
// service on the phone.
#define EMULATED_PPOGATT_SERVICE_HANDLE_MSB 0xE0
#define EMULATED... | (connection_get_idx(conn)) | ) {
PPoGATTWorkAroundState *state = prv_get_state(conn);
state->ppogatt_server_found_on_phone = true;
}
}
bool ppogatt_emulated_server_wa_enabled(uint16_t conn_idx) {
if (!prv_is_emulated_server_wa_requested(conn_idx)) {
return false;
}
// Disable the workaround if a PPoGATT Server was found on th... |
d,
negative_action)) {
PBL_LOG(LOG_LEVEL_DEBUG, "Ignoring ANCS reminders notification because existing "
"time-based reminder was found in db");
return true;
}
// filter out super-old notifications
if (prv_should_ignore_because_stale(timestamp)) {... | (notification, &existing_header) | |
r fill_color;
} CompositorSlideTransitionData;
static CompositorSlideTransitionData s_data;
static void prv_copy_framebuffer_rows(GBitmap *dest_bitmap, GBitmap *src_bitmap, int16_t start_row,
int16_t end_row, int16_t dupe_row, int16_t shift_amount) {
const int16_t delta = start... | graphics_fill_rect(ctx, &GRect(0, fill_offset_y, DISP_COLS, fill_height)) | ;
}
} else {
GBitmap app_bitmap = compositor_get_app_framebuffer_as_bitmap();
bitblt_bitmap_into_bitmap(&dest_bitmap, &app_bitmap, GPoint(0, app_offset_y),
GCompOpAssign, GColorWhite);
if (app_should_dupe) {
prv_duplicate_framebuffer_row(&dest_bitmap, app_dupe_row, ... |
_notification(LoadedNotificationNode *list,
Uuid *id) {
return (LoadedNotificationNode *)list_find((ListNode *)list,
prv_loaded_notification_list_filter_cb,
id);
}
sta... | gdraw_command_image_create_with_resource_system(icon_res_info.res_app_num,
icon_res_info.res_id) | ;
loaded_node->icon_is_default = (timeline_res_id == NOTIF_FALLBACK_ICON) ||
(timeline_res_id == TIMELINE_RESOURCE_NOTIFICATION_GENERIC);
*loaded_list = (LoadedNotificationNode*) list_prepend((ListNode*) *loaded_list,
(ListNode*)loaded_node);
return loaded_node;
}
static ... |
(callbacks) {
menu_layer->callbacks = *callbacks;
PBL_ASSERTN(menu_layer->callbacks.draw_row);
PBL_ASSERTN(menu_layer->callbacks.get_num_rows);
}
menu_layer->callback_context = callback_context;
menu_layer_reload_data(menu_layer);
}
void menu_layer_set_callbacks_by_value(MenuLayer *menu_layer, void... | if (menu_layer->center_focused || menu_layer->selection_animation_disabled) {
// animation on center_focused will not happen by moving the selection
// see prv_schedule_center_focus_animation()
animated = false;
} |
Animation *scroll_animation = (Animation *) menu_layer->scroll_layer.animation;
if (change_ongoing_animation && animation_is_scheduled(scroll_animation)) {
animation_unschedule(scroll_animation);
}
if (change_ongoing_animation && animated && !process_manager_compiled_with_legacy2_sdk()) {
prv_setup_se... |
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r0_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 1);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r1_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RE... | |
return false;
}
delay_ms(1);
}
return true;
}
void *reset_vector, *initial_sp;
prv_get_fw_reset_vector(&reset_vector, &initial_sp);
if ((uintptr_t)reset_vector == 0xffffffff ||
(uintptr_t)initial_sp == 0xffffffff) {
dbgserial_putstr("Firmware is erased");
return true;
}... | {
sad_watch(ERROR_BAD_SPI_FLASH);
} | |
// Switch to app state to push windows to the Application window stack
stub_pebble_tasks_set_current(PebbleTask_App);
cl_check(app_state_get_window_stack());
cl_check(!app_state_get_window_stack()->list_head);
app_window_stack_push(window1, true);
cl_assert_equal_i(app_window_stack_count(), 1);
cl_as... | cl_check(((WindowStackItem *)stack->list_head)->window != window) | |
des_service_parse_cb(const Uuid uuids[], uint8_t count,
void *cb_data) {
struct IncludesServiceCtx *ctx = (struct IncludesServiceCtx *) cb_data;
for (int i = 0; i < count; ++i) {
if (uuid_equal(ctx->service_uuid, &uuids[i])) {
// Found!
ctx->included = true;
... | {
return ad->ad_data_length + ad->scan_resp_data_length;
} |
// -----------------------------------------------------------------------------
//! ble_ad_copy_raw_data() wrapper and helper function:
size_t ble_ad_copy_raw_data(const BLEAdData *ad, uint8_t *buffer, size_t size) {
const size_t size_to_copy = ble_ad_get_raw_data_size(ad);
if (size < size_to_copy) {
return... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
erased_sector = 0;
flash_locked = true;
flash_flags_set = false;
return_status = FLASH_COMPLETE;
flash_written_data = NULL;
flash_written_flag = NULL;
flash_data_start = 0;
flash_data_length = 0;
callback_called = false;
} |
void test_system_flash__cleanup(void) {
free(flash_written_data);
free(flash_written_flag);
}
void test_system_flash__erase_zero_bytes(void) {
cl_assert(system_flash_erase(FLASH_BASE, 0, NULL, NULL));
cl_assert_equal_i(0, erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_one_byte(vo... |
ER_OFFSET (sizeof(PageHeader))
#define METADATA_OFFSET (FILEHEADER_OFFSET + sizeof(FileHeader))
#define FILEDATA_LEN (sizeof(FileHeader) + sizeof(FileMetaData))
#define FILE_NAME_OFFSET (FILEHEADER_OFFSET + FILEDATA_LEN)
// defines & struct for data that needs to be tracked once a file ... | {
if ((offset + size) <= s_pfs_size) {
ftl_read(buffer, size, offset);
} else {
PBL_LOG(LOG_LEVEL_ERROR, "FS read out of bounds 0x%x", (int)offset);
}
} |
// Invalidates s_pfs_page_flags_cache for a given range of bytes. This should be called after the
// contents of the backing-flash are changed so that we re-read the page flags into our cache.
static void prv_invalidate_page_flags_cache(uint32_t offset, uint32_t size) {
if (!s_pfs_page_flags_cache) {
return;
... |
end_idx = MIN(src_line_start_end_idx, src_line_start_idx + row_bits_left);
if (src_start_idx > src_end_idx) {
continue;
}
const uint32_t *src_block_end = src_block_begin + src_row_length_words;
int16_t dest_x = dest_begin_x;
while (dest_x < dest_end_x) {
const uint8_t number_of_bits = ... | {
if (bitblt_compositing_mode_is_noop(compositing_mode, tint_color)) {
return;
}
GBitmapFormat src_fmt = gbitmap_get_format(src_bitmap);
// Don't use gbitmap_get_format on dest_bitmap since it's always of known origin.
// In the case of a Legacy2 app, we have a 1-bit src going into an 8-bit dest and do n... |
case GBitmapFormat2BitPalette:
case GBitmapFormat4BitPalette:
bitblt_bitmap_into_bitmap_tiled_palette_to_8bit(dest_bitmap, src_bitmap, dest_rect,
src_origin_offset, compositing_mode,
... |
ion.allocated_buffer);
}
s_write_offset = write_offset;
pfs_close(*fd);
pfs_close(new_fd);
*fd = pfs_open(FILENAME, OP_FLAG_READ | OP_FLAG_WRITE, FILE_TYPE_STATIC,
NOTIFICATION_STORAGE_FILE_SIZE);
if (*fd < 0) {
PBL_LOG(LOG_LEVEL_ERROR, "Error re-opening after compression %d", new_fd);
retu... | (read_buffer) | |
/*
* 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_private_set_pixel(ctx, GPoint(p0.x, p0.y));
} |
err -= dy;
if (err < 0) {
p0.y += ystep;
err += dx;
}
}
}
#if PBL_COLOR
MOCKABLE void graphics_line_draw_1px_aa(GContext* ctx, GPoint p0, GPoint p1) {
// Implementation of Wu-Xiang fast anti-aliased line drawing algorithm
// Points over which we're going to iterate adjusted to drawing_b... |
(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_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(!line... | |
quote for filter was missing.",
"Invalid argument separator.",
};
////////////////////////////////////////////////////////////////////////////////////////////////////
// Fakes & Stubs
#include "stubs_passert.h"
#include "stubs_i18n.h"
////////////////////////////////////////////////////////////////////////////////... | (s_output, "hurf") | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
prv_init();
APP_LOG(APP_LOG_LEVEL_DEBUG, "Done initializing, pushed window: %p", s_window);
app_event_loop();
prv_deinit();
} | |
icense at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific la... | if (type != AnalyticsEvent_BtLeDisconnect) {
analytics_event_bt_connection_or_disconnection(type, reason);
} else {
if (!vers_info) { // We expect version info
PBL_LOG(LOG_LEVEL_WARNING, "Le Disconnect but no version info?");
} else {
analytics_event_bt_le_disconnection(reason, vers_info->vers... |
num_events_logged++;
}
void bluetooth_analytics_handle_connect(
const BTDeviceInternal *peer_addr, const BleConnectionParams *conn_params) {
analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_COUNT, AnalyticsClient_System);
analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_TIME, AnalyticsClient... |
const BTDeviceInternal *device, BLEService services_out[],
uint8_t num_services, uint8_t discovery_gen) {
return 0;
}
void gatt_client_service_get_all_characteristics_and_descriptors(
GAPLEConnection *connection, GATTService *... | prv_cccd_write(true /* is_subscribing */) | ;
// Grab the timer ID:
TimerID t = s_connection->gatt_service_changed_indication_timer;
s_connection->gatt_service_changed_indication_timer = TIMER_INVALID_ID;
// Simulate disconnection:
gap_le_connection_remove(&s_device);
s_connection = NULL;
// Timer fires:
stub_new_timer_fire(t);
prv_expect_s... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return config->title_font ?: system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle);
} |
static ALWAYS_INLINE GFont prv_get_cell_subtitle_font(const MenuCellLayerConfig *config) {
return config->subtitle_font ?:
system_theme_get_font_for_default_size(TextStyleFont_MenuCellSubtitle);
}
static ALWAYS_INLINE GFont prv_get_cell_value_font(const MenuCellLayerConfig *config) {
return config->value_f... |
/*
* 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(!gbitmap_init_with_resource_system(&bitmap, 0, 0)) | ;
// Fix it up again
s_fake_bitmap_data.row_size_bytes = 8;
cl_assert(gbitmap_init_with_resource_system(&bitmap, 0, 0));
// But now change the palette format to something that requires more space and watch it fail
s_fake_bitmap_data.info.format = GBitmapFormat4BitPalette;
cl_assert(!gbitmap_init_with_reso... |
sizeof(EventMessage) == 8, "eWD1000 event messages should be 8 bytes.");
#if 0
// TODO: used by prv_status_register_read()
typedef enum {
StatusReadType_8bit,
StatusReadType_12bit,
StatusReadType_16bit
} StatusReadType;
typedef struct PACKED {
uint8_t packet_id;
uint8_t address;
uint8_t padding;
uint8_t... | {
address = htons(address);
MemoryPacket packet = {
.packet_id = PACKET_ID_RAM_READ,
.address = address,
.value = 0x00,
.footer = RAM_FLASH_FOOTER
};
prv_write_data((uint8_t *)&packet, sizeof(packet));
prv_wait_for_interrupt();
prv_read_data((uint8_t *)&packet, sizeof(packet));
PBL_ASSERTN... | |
c, (int) session->len_minutes,
start_idx);
// Only compare the first activity found
if (!found_activity) {
result.activity_type.value = (int)session->activity;
result.len.value = (int)session->len_minutes;
result.start_at.value = start_idx;
found_activity = true... | activity_sample_working_at_desk(&num_samples) | ;
TestMinuteData exp_minutes[] = {
{
.steps = 0,
.orientation = 0x72,
.vmc = 1787,
},
};
prv_test_minute_data(samples, num_samples, exp_minutes, ARRAY_LENGTH(exp_minutes));
}
// Run the not moving sample
// The expected results were obtained empirically on a known ... |
THURSDAY, 1447372800},
// now, -Th-Fr
// 2015 Nov 14, 00:00:00
{ -1,-1,-1,-1, WDAY_ANY & ~(WDAY_THURSDAY|WDAY_FRIDAY), 1447459200},
// now, -Th-Fr-Sa
// 2015 Nov 15, 00:00:00
{ -1,-1,-1,-1, WDAY_ANY & ~(WDAY_THURSDAY|WDAY_FRIDAY|WDAY_SATURDAY), 1447545600},
// now, -Th-Fr-Sa-Su
// 2015 Nov 16, 00:00:00
... | (&s_timezone_gmt, &test_cron, s_2015_dec19_123456_gmt, advance, advance, 1) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | graphics_context_set_stroke_color(ctx, GColorClear) | ;
graphics_draw_rect(ctx, &GRect(4, 2, 16, 8));
}
static void across_x_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_draw_rect(ctx, &GRect(10, 2, 18, 4));
}
static void across_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics_contex... |
n = -10,
.body_line_delta = -2,
.timestamp_upper_padding = 6,
},
};
static bool prv_is_reminder(const NotificationLayout *layout) {
return (layout->info.item->header.type == TimelineItemTypeReminder);
}
static void prv_reminder_timestamp_update(const LayoutLayer *layout_ref,
... | (TextStyleFont_Footer, TextStyleFont_Caption) | |
silence. B's third (silent) is 2 secs, so one more to go and A's third term is silent.
regular_timer_fire_seconds(1);
cl_assert_equal_b(gap_le_is_advertising_enabled(), false);
// Expect B's fourth term now.
regular_timer_fire_seconds(1);
cl_assert_equal_b(gap_le_is_advertising_enabled(), true);
assert_ad... | (s_unscheduled_job, job) | ;
cl_assert_equal_b(s_unscheduled_completed, true);
free(ad);
}
void test_gap_le_advert__invalid_params(void) {
GAPLEAdvertisingJobRef job;
BLEAdData *ad = create_ad(NULL, NULL);
GAPLEAdvertisingJobTerm advert_term = {
.min_interval_slots = 31,
.max_interval_slots = 31,
.duration_secs = 1,
};... |
= comm_session_send_buffer_begin_write(&s_session, ENDPOINT_ID,
max_length + 1,
TIMEOUT_MS);
cl_assert_equal_p(write_sb, NULL);
}
TickType_t prv_session_closed_yield_cb(QueueHandle_t handle) {... | memset(fake_data, 0, max_length) | ;
comm_session_send_buffer_write(write_sb, fake_data, max_length);
comm_session_send_buffer_end_write(write_sb);
// Pretend the current task is the same task that processes "send_next".
// Pretend to execute a callback that was scheduled already before the previous write caused
// a "send_next" callback to b... |
_manager.h"
const GDrawRawImplementation g_default_draw_implementation;
// Statics
///////////////////////
static GContext s_ctx;
static FrameBuffer s_fb;
typedef struct MockBitbltBitmapIntoBitmapTiledCallRecording {
GBitmap *dest_bitmap;
const GBitmap *src_bitmap;
GRect dest_rect;
GPoint src_origin_offset;... | (ctx->draw_state.compositing_mode ==
EXPECTED_COMPOSITING_MODE_BEFORE_AND_AFTER_PRE_FUNCTION) | ;
processor_with_data->previous_compositing_mode = ctx->draw_state.compositing_mode;
cl_assert(gcolor_equal(ctx->draw_state.tint_color,
EXPECTED_TINT_COLOR_BEFORE_AND_AFTER_PRE_FUNCTION));
processor_with_data->previous_tint_color = ctx->draw_state.tint_color;
// Set the compositing mod... |
/*
* 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... | (RCC_FLAG_IWDGRST) | |
cords);
for (int j = 0; j < num_records; j++) {
printf("\nRecord:%d, steps: %d", j, (int)received_records[j].steps);
}
// Verify the contents of the records
for (int j = 0; j < num_records; j++) {
prv_assert_minute_data(&received_records[j], &minute_data[next_read_minute_idx + j]);
}
... | { // Create two 2 hour sessions, they should both be considered as separate naps
ActivitySession sessions[] = {
{
.start_utc = start_of_today + (13 * SECONDS_PER_HOUR), // 1pm
.length_min = 2 * MINUTES_PER_HOUR,
.type = ActivitySessionType_Sleep,
},
{
.start_utc ... |
uint16_t session_entries = ARRAY_LENGTH(sessions);
activity_algorithm_post_process_sleep_sessions(session_entries, sessions);
cl_assert_equal_i(sessions[0].type, ActivitySessionType_Sleep);
}
{ // Create a 2 hour session that is still on-going - should register as normal sleep
time_t sleep_start_u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.