prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
ruct {
Window *window;
WorkoutActiveWindow *active_window;
WorkoutController workout_controller;
AppSync sync;
uint8_t sync_buffer[148];
uint8_t current_bpm;
char duration_string[20];
char distance_string[20];
char pace_string[20];
char custom_label_string[20];
char custom_value_string[20];
bo... | if (strncmp(new_tuple->value->cstring,
data->custom_value_string,
sizeof(data->custom_value_string)) != 0) {
strncpy(data->custom_value_string,
new_tuple->value->cstring,
sizeof(data->custom_value_string));
prv_update_scrollable_metrics... |
break;
}
default:
// Unknown key
return;
}
}
static bool prv_is_paused(void) {
SportsAppData *data = app_state_get_user_data();
return data->is_paused;
}
static bool prv_pause(bool should_be_paused) {
SportsAppData *data = app_state_get_user_data();
AppSync *s = &data->sync;
con... |
tionIterState;
static const char *FILENAME = "notifstr"; //The filename should not be changed
static PebbleRecursiveMutex *s_notif_storage_mutex = NULL;
static uint32_t s_write_offset;
static bool prv_iter_next(NotificationIterState *iter_state);
static bool prv_get_notification(TimelineItem *notification,
... | if (pfs_seek(fd, iter_state.header.payload_length, FSeekCur) < 0) {
break;
} |
}
}
//! Check whether there exists @ref size_needed available space in storage after compression
static bool prv_is_storage_full(size_t size_needed, size_t *size_available, int fd) {
*size_available = 0;
NotificationIterState iter_state = {
.fd = fd,
};
Iterator iter;
iter_init(&iter, (IteratorCallb... |
uint16_t *value_length_in_out) {
if (PRIVILEGE_WAS_ELEVATED) {
syscall_assert_userspace_buffer(value_length_in_out, sizeof(*value_length_in_out));
syscall_assert_userspace_buffer(value_out, *value_length_in_out);
}
gatt_client_consume_read_response(object_ref,
... | gatt_client_service_get_device(service) | ;
}
DEFINE_SYSCALL(uint8_t, sys_ble_service_get_included_services, BLEService service_ref,
BLEService included_services_out[],
uint8_t num_services) {
if (PRIVILEGE_WAS_ELEVATED) {
syscall_assert_userspace_buffer(included... |
/*
* 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... | memcmp(blobdb_event->key, (uint8_t *)SEND_TEXT_NOTIF_PREF_KEY,
strlen(SEND_TEXT_NOTIF_PREF_KEY)) | ) {
return;
}
s_has_send_text_reply_action = prv_has_send_text_reply_action();
}
void send_text_service_init(void) {
// Save the initial state
s_has_send_text_reply_action = prv_has_send_text_reply_action();;
// Register for updates
static EventServiceInfo s_blobdb_event_info = {
.type = PEBBLE_B... |
rns 0 if A and B are equal, 1 if A has a higher section & row combination than B or else -1
int16_t menu_index_compare(const MenuIndex *a, const MenuIndex *b) {
const int16_t max_rows = MAX(a->row, b->row) + 1;
const int32_t a_abs = ((a->section * max_rows) + a->row);
const int32_t b_abs = ((b->section * max_rows... | (w, menu_layer->selection.h) | ;
menu_layer->inverter.layer.bounds = (GRect) {
.origin = { 0, 0 },
.size = size,
};
menu_layer->inverter.layer.frame = (GRect) {
.origin = {
.x = 0,
.y = menu_layer->selection.y,
},
.size = size,
};
layer_mark_dirty(&menu_layer->inverter.layer);
}
}
... |
plit_timestamp_dict_part_two);
s_num_ds_notifications_received += 2;
} else if (uid == message_dict_uid) {
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_message_dict), (uint8_t*) s_message_dict);
s_num_ds_notifications_received++;
} else if (uid == app_name_title_dict_uid) {
prv_fake_receiving_d... | fake_kernel_services_notifications_ancs_notifications_count() | , 4 + 4 + 4);
// Send a "corrupted" notification.
prv_send_notification((uint8_t *)&s_invalid_attribute_length);
cl_assert_equal_i(s_num_requested_notif_attributes, 12 + 1);
cl_assert_equal_i(s_num_ds_notifications_received, 18 + 1);
// No increment:
cl_assert_equal_i(fake_kernel_services_notifications_anc... |
/*
* 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... | (action_bar, BUTTON_ID_DOWN) | ;
}
}
static void prv_up_click_handler(ClickRecognizerRef recognizer, void *context) {
ExpandableDialog *expandable_dialog = context;
prv_manual_scroll(&expandable_dialog->scroll_layer, 1);
}
static void prv_down_click_handler(ClickRecognizerRef recognizer, void *context) {
ExpandableDialog *expandable_dialog... |
NULL,
false /* requires_address_pinning */,
false /* auto_accept_re_pairing */);
cl_assert(id_2 != BT_BONDING_ID_INVALID);
cl_assert_equal_i(s_ble_bonding_change_add_count, 2);
cl_assert_... | bonding_sync_contains_pairing_info(&pairing_1, true) | |
text;
window_stack_pop(true);
window_stack_push(data->steps_window, true /* Animated */);
}
// -------------------------------------------------------------------------------
static void prv_hr_down_click_handler(ClickRecognizerRef recognizer, void *context) {
HealthAPITestAppData *data = (HealthAPITestAppData ... | prv_display_seconds_history_alert(data, "Sleep total", HealthMetricSleepSeconds) | |
sys_activity_get_metric_values.out.history[0] = 123;
s_sys_activity_get_metric_values.out.history[1] = 456;
HealthValue result = health_service_peek_current_value(HealthMetricHeartRateBPM);
cl_assert_equal_i(123, result);
const ActivityMetric IN_METRIC = ActivityMetricHeartRateFilteredBPM;
cl_assert_equal_i(s... | positive_modulo(day_in_week, DAYS_PER_WEEK) | ;
HealthValue value = 1000 + (i * 50);
s_sys_activity_get_metric_values.out.history[i] = value;
PBL_LOG(LOG_LEVEL_DEBUG, "Day #%d, day_of_week: %d, value: %"PRIi32" ", i, day_in_week,
value);
// Day 0 is not included in the stats
if (i == 0) {
continue;
}
// Store if thi... |
ck(id, &config, context)) {
goto cleanup;
}
prv_enable_alarm_config(&config, true /* enabled */);
prv_alarm_set_config(&file, id, &config);
cleanup:
prv_file_close_and_unlock(&file);
}
// ----------------------------------------------------------------------------------------------
typedef struct SetAlar... | prv_alarm_get_config(&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... |
raction_handler(SwapLayer *swap_layer, void *context) {
NotificationWindowData *data = context;
prv_refresh_pop_timer(data);
}
static void prv_set_dnd_icon_visible(bool is_visible) {
NotificationWindowData *data = &s_notification_window_data;
if (is_visible == data->dnd_icon_visible) {
// nothing to do her... | (status_layer, PBL_IF_RECT_ELSE(GColorBlack, GColorClear),
PBL_IF_RECT_ELSE(GColorWhite, GColorBlack)) | ;
status_bar_layer_set_separator_mode(status_layer, StatusBarLayerSeparatorModeNone);
layer_add_child(root_layer, (Layer *)status_layer);
// bubble on right for action button
layer_init(&data->action_button_layer, &data->window.layer.bounds);
data->action_button_layer.update_proc = action_button_update_proc;... |
entifier, app_id);
TimelineItem *item = timeline_item_create_with_attributes(0, 0, TimelineItemTypeNotification,
LayoutIdUnknown,
&attributes,
... | text_layer_deinit(&s_phone_ui_data->call_status_text_layer) | |
, &animation->list_node));
list_remove(&animation->list_node, &state->unscheduled_head /* &head */, NULL /* &tail */);
ANIMATION_LOG_DEBUG("destroying %d (%p) ", (int)animation->handle, animation);
applib_free(animation);
}
// ------------------------------------------------------------------------------------... | (start_ms, now) | ;
}
// -------------------------------------------------------------------------------------------
// Adjust the abs_start_time of this animation and all of its children. This is called during
// a set_elapsed operation.
static void prv_backup_start_time(AnimationState *state, AnimationPrivate *parent,
... |
ar, ENABLE);
DFSDM_FilterCmd(this->filter, ENABLE);
DFSDM_RegularContinuousModeCmd(this->filter, ENABLE);
DFSDM_StartSoftwareRegularConversion(this->filter);
dma_request_start_circular(this->dma, this->state->in_buffer, (void *)&this->filter->RDATAR,
sizeof(this->state->in_buffer), ... | while (this->state->running) {
uint16_t size = circular_buffer_copy(
&this->state->circ_buffer,
(uint8_t *)&this->state->subscriber.buffer[this->state->subscriber.idx],
((this->state->subscriber.size - this->state->subscriber.idx) *
sizeof(int16_t)));
if (size == 0) {
bre... |
mutex_unlock_recursive(this->state->mic_mutex);
}
static void prv_dispatch_samples_main(void *context_ptr) {
MicDevice *this = context_ptr;
this->state->main_pending = false;
prv_dispatch_samples(context_ptr);
}
static void prv_dispatch_samples_bg(void *context_ptr) {
MicDevice *this = context_ptr;
this-... |
n writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "util/trig.h"
#include "util/math.h"... | {
int32_t dist = serial_distance(6, 1, 3);
cl_assert_equal_i(dist, 3);
} |
}
void test_math__is_signed_macro(void) {
cl_assert(IS_SIGNED((int)-1) == true);
cl_assert(IS_SIGNED((unsigned int)1) == false);
}
void test_math__test_within_macro(void) {
int16_t min;
int16_t max;
// Min and max are both positive
////////////////////////////////
min = 5;
max = 10;
// Min and ma... |
e 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
* distributed under the License is... | {
new_state = WordStateEnd;
} | else {
new_state = WordStateGrowing;
}
break;
case WordStateJoining:
if (codepoint == NEWLINE_CODEPOINT) {
new_state = WordStateEnd;
} else if (codepoint_is_ideograph(codepoint)) {
new_state = WordStateIdeograph;
} else if (codepoint == WORD_JOINER_CODEPOINT) {... |
/*
* 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... | (false /* run filesystem check */) | ;
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME,
false /* is_next */);
resource_init();
// Setup content indicator
ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer();
co... |
d prv_draw_hr_measuring_node_callback(GContext *ctx, const GRect *box,
const GTextNodeDrawConfig *config, bool render,
GSize *size_out, void *user_data) {
WorkoutActiveWindow *active_window = user_data;
GRect bounds = gb... | {
rect.origin.y = (&active_window->scrollable_metric_layer == layer) ?
PBL_IF_RECT_ELSE(-2, 0) : PBL_IF_RECT_ELSE(-4, -2);
} |
// set the rect height so we don't wrap text to the next line
rect.size.h = 40;
#if PBL_ROUND
if (draw_hr_zones) {
// padding between text and zones is less on round
rect.origin.y -= 10;
}
rect.origin.x -= 24;
#endif
prv_render_metric_label(ctx, &rect, metric_type, active_window, layer);
// u... |
((TimelineLayout *)layout, config, &s_timeline_layout_impl) | ;
return (LayoutLayer *)layout;
}
#else
LayoutLayer *alarm_layout_create(const LayoutLayerConfig *config) { return NULL; }
bool alarm_layout_verify(bool existing_attributes[]) { return false; }
#endif
| |
t_box_params
};
word_init(ctx, &word_iter_state->current, text_box_params, start);
iter_init(word_iter, (IteratorCallback) word_iter_next, NULL, (IteratorState) word_iter_state);
}
void line_iter_init(Iterator* line_iter, LineIterState* line_iter_state, GContext* ctx) {
*line_iter_state = (LineIterState) {
... | // or completely clipped.
next_line_y_extent = line_iter_state->current->origin.y;
}
return (next_line_y_extent > (text_box_params->box.origin.y + text_box_params->box.size.h));
} |
//! @return is_advanced
bool line_iter_next(IteratorState state) {
LineIterState* line_iter_state = (LineIterState*) state;
const TextBoxParams* const text_box_params = &line_iter_state->ctx->text_draw_state.text_box;
if (prv_line_iter_is_vertical_overflow(line_iter_state, text_box_params)) {
return 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... | (s_watchinfo_api) | ;
EXECUTE_SCRIPT("var model = _rocky.watchInfo.model");
ASSERT_JS_GLOBAL_EQUALS_S("model", "pebble_time_steel_gold");
}
void test_rocky_api_watchinfo__qemu_model(void) {
s_watch_info_color = -1;
rocky_global_init(s_watchinfo_api);
EXECUTE_SCRIPT("var model = _rocky.watchInfo.model");
ASSERT_JS_GLOBAL_EQU... |
void comm_session_send_buffer_end_write(SendBuffer *sb) {
cl_assert(sendbuffer_length > 0);
cl_assert_equal_m(sendbuffer, s_expected_msg, sendbuffer_length);
}
bool comm_session_send_data(CommSession *session, uint16_t endpoint_id,
const uint8_t *data, size_t length, uint32_t timeout_ms... | {
blob_db2_protocol_msg_callback(NULL, s_start_writeback_response_success,
sizeof(s_start_writeback_response_success));
cl_assert(did_sync_next);
blob_db2_protocol_msg_callback(NULL, s_start_writeback_response_error,
sizeof(s_start_writeback_respo... |
static const uint8_t s_sync_done_response[] = {
BLOB_DB_COMMAND_SYNC_DONE_RESPONSE, // cmd
0x56, 0x78, // token
BLOB_DB_SUCCESS, // response
};
void test_blob_db2_endpoint__handle_sync_done_response(void) {
blob_db2_protocol_msg_callback(NULL, s_sync_done_respons... |
PebbleEvent s_captured_sleep_event = { };
static int s_num_captured_sleep_events = 0;
static void prv_fake_sleep_event_cb(PebbleEvent *event) {
if ((event->type == PEBBLE_HEALTH_SERVICE_EVENT)
&& (event->health_event.type == HealthEventSleepUpdate)) {
s_captured_sleep_event = *event;
s_num_captured_slee... | (event.type, PEBBLE_HEALTH_SERVICE_EVENT) | |
ionally, iOS/Android and the watch are not in sync over what this should look like.
//
// The new UI allows the phone to give us more info up front about how much data will be
// transmitted and also cleanly drive a re-start of the UI to a non-0 percentage if the FW update
// is being resumed. Newer implementations sho... | battery_monitor_critical_lockout() | ) {
return FirmwareUpdateCancelled; // Disable firmware updates on low power
}
if (xSemaphoreTake(s_firmware_update_semaphore, 0) == pdFALSE) {
return FirmwareUpdateStopped;
}
FirmwareUpdateStatus result = s_update_status;
if (result != FirmwareUpdateRunning) {
prv_initialize_completion_status(... |
{
callback_node->callbacks[event_type](install_id, callback_node->data);
} |
callback_node = (struct AppInstallCallbackNode *) list_get_next(&callback_node->node);
}
}
typedef struct {
AppInstallEnumerateCb cb;
void *data;
AppInstallEntry *entry_buf;
} EnumerateData;
static void prv_app_install_enumerate_app_db(AppInstallId install_id, AppDBEntry *db_entry,
void *data) {
En... | |
ccount for the size of the icon when positioning vertically
line.origin.y = grect_get_max_y(&first_icon_frame) +
REL_BAR_VERT_MARGIN - curr_offset - prev_offset;
line.size.w = REL_BAR_LINE_WIDTH;
line.size.h = solid_line_length + curr_offset;
graphics_fill_rect(ctx, &line);
// Bottom Notch ... | line2_start.x = line1_start.x + REL_BAR_OVERLAP_LINE2_HORIZ_OFFSET;
line2_start.y = second_icon_frame.origin.y - REL_BAR_VERT_MARGIN - y_offset -
REL_BAR_LINE_WIDTH;
graphics_fill_rect(ctx, &GRect(line2_start.x, line2_start.y,
REL_BAR_OVERLAP_STROKE_WIDTH, -line_... | |
vents.h"
#include "services/normal/filesystem/pfs.h"
#include "clar.h"
// Fixture
////////////////////////////////////////////////////////////////
// Fakes
////////////////////////////////////////////////////////////////
#include "fake_new_timer.h"
#include "fake_pbl_malloc.h"
#include "fake_pebble_tasks.h"
#includ... | (&item2.header.id, stub_new_timer_callback_data(get_reminder_timer_id()), sizeof(TimelineItemId)) | ;
cl_assert(stub_new_timer_timeout(get_reminder_timer_id()) == 100 * 1000);
now = 100;
stub_pebble_tasks_set_current(PebbleTask_NewTimers);
cl_assert(stub_new_timer_fire(get_reminder_timer_id()));
stub_pebble_tasks_set_current(PebbleTask_KernelBackground);
fake_system_task_callbacks_invoke(1);
cl_assert_e... |
nAverage] = {
.avg_relation = PBL_IF_RECT_ELSE(i18n_noop("ON AVG"), i18n_noop("On avg")),
.bg_color = GColorVividCeruleanARGB8,
.card_icon = TIMELINE_RESOURCE_THUMBS_UP,
},
[PercentTier_AboveAverage] = {
.avg_relation = PBL_IF_RECT_ELSE(i18n_noop("ABOVE AVG"), i18n_noop("Above avg")),
... | (now_utc, notif_config) | ;
notif_config->state->last_triggered_utc = time_util_get_midnight_of(now_utc);
analytics_event_health_insight_created(now_utc, notif_config->insight_type, 0);
// Save out the trigger time
prv_save_state(notif_config->settings_key,
¬if_config->state->last_triggered_utc,
siz... |
(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), 0);
prv_clear_handler_histories();
uint64_t start_ms = prv_now_ms();
animation_schedule(spawn);
// Start
prv_advance_to_ms_with_timers(... | |
rce(
timeline_layout, icon_res_size, resource, fallback_resource, app_id);
if (!icon_reel) {
return;
}
GSize icon_size = kino_reel_get_size(icon_reel);
const GSize max_icon_size = timeline_resources_get_gsize(icon_res_size);
if ((icon_size.w > max_icon_size.w) || (icon_size.h > max_icon_size.h)) {
... | if (layout->layout_layer.mode == LayoutLayerModeCard && layout->impl->card_view_deinitializer) {
layout->impl->card_view_deinitializer(layout);
} | |
lBackground);
} else if ((prev_state == SmartstrapStateReadInProgress) &&
(new_state == SmartstrapStateReadComplete)) {
PBL_ASSERTN(mcu_state_is_isr() || (pebble_task_get_current() == PebbleTask_NewTimers));
} else if ((prev_state == SmartstrapStateReadComplete) &&
(new_state == Smarts... | prv_find_connected_service(service_id) | |
2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS"... | for (int i = 0; i < NUM_SUPPORTED_PARAM_COUNT; ++i) {
// Consume leading whitespace
while (buffer <= buffer_end && *buffer == ' ') {
++buffer;
}
if (buffer >= buffer_end) {
args.num_args = i;
return args;
}
// Yay, a param!
args.args[i] = buffer;
// Skip over the para... |
args.num_args = NUM_SUPPORTED_PARAM_COUNT;
return args;
}
static void prv_execute_given_command(const Command* cmd, char* param_str, char* param_str_end) {
CommandArgs args = prv_parse_arguments(param_str, param_str_end);
if (args.num_args != cmd->num_params) {
char buffer[128];
prompt_send_response... |
d_reset_request */);
}
}
////////////////////////////////////////////////////////////////////////////////
// App Message Handling
////////////////////////////////////////////////////////////////////////////////
static const struct {
AppMessageInboxReceived inbox_received;
} s_app_message_handlers[] = {
[PostMes... | (event, ROCKY_EVENT_MESSAGE_DATA, prv_postmessageerror_data_getter, NULL) | |
and
* limitations under the License.
*/
#include "launcher_app_glance_alarms.h"
#include "launcher_app_glance_structured.h"
#include "kernel/events.h"
#include "kernel/pbl_malloc.h"
#include "process_management/app_install_manager.h"
#include "resource/resource_ids.auto.h"
#include "services/common/clock.h"
#incl... | (time_buffer, sizeof(time_buffer), alarm_time_epoch) | ;
// Determine if the alarm is for today
const time_t current_time = rtc_get_time();
const time_t today_midnight = time_util_get_midnight_of(current_time);
const time_t alarm_midnight = time_util_get_midnight_of(alarm_time_epoch);
const bool is_alarm_for_today = (alarm_midnight == today_midnight);
... |
stop_mode_disable(InhibitorFlash) | ;
DMA_Cmd(FLASH_DMA_STREAM, ENABLE);
DMA_Cmd(FLASH_TX_DMA_STREAM, ENABLE);
xSemaphoreTake(s_flash_state.dma_semaphore, portMAX_DELAY);
stop_mode_enable(InhibitorFlash);
xSemaphoreGive(s_flash_state.dma_semaphore);
}
void DMA2_Stream0_IRQHandler(void) {
if (DMA_GetITStatus(FLASH_DMA_STREAM, DMA_IT_TCIF3)) {... | |
/*
* 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... | pwm_init(&BOARD_CONFIG_BACKLIGHT.pwm,
TIMER_PERIOD_RESOLUTION,
TIMER_PERIOD_RESOLUTION * PWM_OUTPUT_FREQUENCY_HZ) | ;
periph_config_release_lock();
s_initialized = true;
}
if (BOARD_CONFIG_BACKLIGHT.options & ActuatorOptions_IssiI2C) {
led_controller_init();
s_initialized = true;
}
}
// TODO: PBL-36077 Move to a generic 4v5 enable
void led_enable(LEDEnabler enabler) {
if (s_led_enable == 0) {
gpio_outpu... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | gpio_release(pin_config.gpio) | ;
}
void gpio_af_init(AfConfig af_config, GPIOOType_TypeDef otype,
GPIOSpeed_TypeDef speed, GPIOPuPd_TypeDef pupd) {
GPIO_InitTypeDef init = {
.GPIO_Pin = af_config.gpio_pin,
.GPIO_Mode = GPIO_Mode_AF,
.GPIO_Speed = speed,
.GPIO_OType = otype,
.GPIO_PuPd = pupd
};
gpio_use(... |
on't show the ongoing call UI because we must continue to poll so that we know when the
//! call ends, which consumes a lot of battery especially for longer calls. On iOS 9, we only
//! know when the phone stops ringing, we don't know what happens after the user accepts/rejects
static bool s_call_in_progress = fa... | (ANALYTICS_DEVICE_METRIC_PHONE_CALL_INCOMING_COUNT, AnalyticsClient_System) | ;
analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_PHONE_CALL_TIME, AnalyticsClient_System);
}
static void prv_handle_outgoing_call(PebblePhoneEvent *event) {
// Only 1 call at a time is supported
if (!s_call_in_progress && s_mobile_app_is_connected) {
phone_ui_handle_outgoing_call(event->caller);
analy... |
_equal_s(dstbuf, "There are 10 lights, the absolute value of 37777777774");
// Plus for positive signed
// No signed conversion occurs, so this is a no-op
snprintf(dstbuf, 256, "There are %+o lights, the absolute value of %+o", 8, -4);
cl_assert_equal_s(dstbuf, "There are 10 lights, the absolute value of 37777... | (dstbuf, "There are 10 lights") | |
/*
* 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... | (CONFIG_LOG_UART,
line_buffer, MIN((int)sizeof(line_buffer), (unsigned int)len)) | ;
va_end(args);
return 0;
}
static void prv_lock(void) {
OS_ENTER_CRITICAL_SECTION();
}
static void prv_unlock(void) {
OS_LEAVE_CRITICAL_SECTION();
}
static bool prv_pm_prepare_for_sleep(void) {
/* Do not sleep when there is transmission in progress */
return !hw_uart_tx_in_progress(CONFIG_LOG_UART);
}
... |
/*
* 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... | periph_config_enable(hal->i2c, hal->clock_ctrl) | ;
// Soft reset of the state machine and status bits by disabling the peripheral.
// Note: PE must be low for 3 APB cycles after this is done for the reset to be successful
hal->i2c->CR1 &= ~I2C_CR1_PE;
hal->i2c->CR1 &= ~CR1_CLEAR_MASK;
// Set the timing register
RCC_ClocksTypeDef rcc_clocks;
RCC_GetCl... |
>selection.index;
if (!provide_correct_selection_index) {
menu_layer->selection.index.section = MENU_INDEX_NOT_FOUND;
}
const int16_t result = menu_layer->callbacks.get_cell_height(menu_layer, cell_index,
menu_layer->callback_context);
... | (&cell_layer->frame, &menu_layer->inverter.layer.frame) | |
NDPOINT,
(uint8_t *)&action->msg, action->length, COMM_SESSION_DEFAULT_TIMEOUT);
kernel_free(action);
}
static ActionResultType prv_get_action_result_type(ResponseHeader *header) {
switch (header->response) {
case ResponseACK:
return ActionResultTypeSuccess;
case ResponseNACKContactAmbiguity:... | {
comm_session_send_data(comm_session_get_system_session(), TIMELINE_ACTION_ENDPOINT,
(uint8_t *)&invoke_action_data->msg, invoke_action_data->length,
COMM_SESSION_DEFAULT_TIMEOUT);
kernel_free(invoke_action_data);
} |
}
void timeline_action_endpoint_protocol_msg_callback(CommSession *session,
const uint8_t* data, size_t length) {
if (length < sizeof(ResponseHeader)) {
PBL_LOG(LOG_LEVEL_WARNING, "Invalid phone response message length %d", (int) length);
return;
}
ResponseHeader *header = (ResponseHeader *) data;
... |
APP_LOG_LEVEL_ERROR,
(upng_state == UPNG_ENOMEM) ? APNG_MEMORY_ERROR : APNG_DECODE_ERROR);
goto cleanup;
}
// Save metadata to bitmap_sequence
uint32_t play_count = 0;
// If png is APNG, get num plays, otherwise play count is 0
if (upng_is_apng(upng)) {
play_count = upng_apng_num_plays(upn... | if (!((bitmap_format == GBitmapFormat1Bit) ||
(bitmap_format == GBitmapFormat8Bit) ||
(bitmap_format == GBitmapFormat8BitCircular))) {
APP_LOG(APP_LOG_LEVEL_ERROR, "Invalid destination bitmap format for APNG");
goto cleanup;
} |
// Update current time elapsed using the previous frames current_frame_delay_ms
bitmap_sequence->elapsed_ms += bitmap_sequence->current_frame_delay_ms;
// Check if single animation loop is complete, and restart if there are more loops
if (bitmap_sequence->current_frame >= bitmap_sequence->total_frames) {
... |
nnected_t *evt) {
PBL_LOG(LOG_LEVEL_INFO, "Disconnected: idx=%"PRIu16", reason=0x%"PRIx8,
evt->conn_idx, evt->reason);
local_addr_handle_disconnection();
Connection *conn = connection_by_idx_check(evt->conn_idx);
BTDeviceInternal addr;
connection_get_address(conn, &addr);
BleDisconnectionComple... | (LOG_LEVEL_ERROR, "No connection for idx=%d", conn_idx) | ;
return;
}
if (prv_is_auto_accept_repairing_mode(conn, conn_idx)) {
// Don't sync the new pairing, we're dealing with an Android device that has to re-pair
// upon every reconnection. Don't sync to avoid re-writing the pairing info upon every
// reconnection. @see https://pebbletechnology.atlassia... |
-------------------------------------------------------------------------
// Builds the base attribute list for insight notifications
static void prv_build_notification_attr_list(AttributeList *attr_list, const char *body,
uint32_t icon, ActivityInsightType insight_type,
... | (¬if_attr_list) | ;
attribute_list_destroy_list(&positive_attr_list);
attribute_list_destroy_list(&neutral_attr_list);
attribute_list_destroy_list(&negative_attr_list);
return item;
}
// ------------------------------------------------------------------------------------------------
// Sets the common header parameters, pushes... |
tmap_in_rect__rect = *rect;
}
bool graphics_release_frame_buffer(GContext *ctx, GBitmap *buffer) {return false;}
void window_schedule_render(struct Window *window) {}
void window_set_click_config_provider_with_context(
struct Window *window, ClickConfigProvider click_config_provider, void *context) {}
void window_s... | scroll_layer_set_paging(scroll_layer, true) | ;
cl_assert_equal_i(page_height, prv_scroll_layer_get_paging_height(scroll_layer));
// paging should force < page_height offsets to ceil of modulo page height
scroll_layer_set_content_size(scroll_layer, GSize(180, 2000));
scroll_layer_scroll(scroll_layer, ScrollDirectionDown, false);
// scroll offset for s... |
_t *) &future_meta_non_compatible,
sizeof(future_meta_non_compatible),
BLEGATTErrorSuccess);
// No client created:
cl_assert_equal_i(ppogatt_client_count(), 0);
cl_assert_equal_b(ppogatt_has_client_for_uuid(&future_meta_non_compatible.app... | {
fake_gatt_client_subscriptions_set_subscribe_return_value(BTErrnoInvalidParameter);
prv_notify_services_discovered(1);
ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta],
(const uint8_t *) &s_meta_v0_system,
... |
void test_ppogatt__cleanup_client_when_data_subscription_error_response(void) {
prv_notify_services_discovered(1);
ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta],
(const uint8_t *) &s_meta_v0_system,
... |
void *cb_data) {
struct CopyServiceUUIDsCtx *ctx = (struct CopyServiceUUIDsCtx *)cb_data;
for (int i = 0; i < count; ++i) {
if (ctx->copied < ctx->max) {
// Still space left, so copy:
const Uuid *uuid = &uuids[i];
memcpy(&ctx->uuids_out[ctx->copied++], uuid, sizeof(Uuid))... | (ctx->size, length) | ;
memcpy(ctx->buffer, data, copied_size);
ctx->copied_size = copied_size;
ctx->company_id = company_id;
return false; // stop parsing
}
size_t ble_ad_copy_manufacturer_specific_data(const BLEAdData *ad,
uint16_t *company_id,
... |
/*
* 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... | syscall_failed() | ;
}
if (!memory_layout_is_cstring_in_region(memory_layout_get_app_region(), string, 100) &&
!memory_layout_is_cstring_in_region(memory_layout_get_microflash_region(), string, 100)) {
PBL_LOG(LOG_LEVEL_ERROR, "Pointer %p not in app or microflash region", string);
syscall_failed();
}
}
... |
to_valid = PredicateCondition_L;
wait_time = state->filter_state - predicate_value;
}
if (!previously_matched && match && ((predicate_cond == cond_to_expire) ||
(predicate_cond == cond_to_expire + 1))) {
// This predicate could expire over time.
// If the conditi... | if (*state->position == ',') {
state->position++;
if (*state->position == ')') {
state->error->status = TemplateStringErrorStatus_MissingArgument;
return;
}
} | |
88, -184, -1000},
{ -88, -224, -976},
{ -72, -192, -984},
{ -88, -176, -1000},
{ -120, -224, -1040},
{ -120, -272, -928},
{ -88, -176, -1024},
{ -112, -272, -1024},
{ -104, -296, -1000},
{ -112, -296, -952},
// 10 seconds
{ -80, -184, -928},
{ -96, -176, -920},
{ -160... | { -88, -168, -1000},
{ -88, -176, -992},
{ -88, -176, -992},
// 15 seconds
{ -80, -192, -984},
{ -88, -152, -1008},
{ -88, -152, -1008},
{ -88, -192, -976},
{ -80, -200, -1000},
{ -88, -200, -1008},
{ -72, -184, -984},
{ -80, -272, -960},
{ -64, -296, -952},
{ -56... |
{ -64, -192, -1008},
{ -56, -208, -1016},
{ -56, -248, -976},
{ -48, -168, -968},
{ -48, -200, -992},
{ -48, -184, -992},
{ -56, -200, -1008},
{ -40, -192, -984},
{ -56, -200, -984},
{ -48, -200, -984},
{ -56, -216, -968},
{ -56, -216, -976},
{ -56, -216, -992},
... |
cl_assert_equal_i(stored_session->step_data.active_kcalories, 200 + calculated_active_kcalories);
cl_assert_equal_i(stored_session->step_data.resting_kcalories,
ROUND(activity_private_compute_resting_calories(stored_session->length_min),
ACTIVITY_CALORIES_PER_KCAL));
... | (&steps, &duration_s, &distance_m,
&bpm, &hr_zone) | );
cl_assert_equal_i(bpm, 100);
// Time forward X seconds
prv_inc_time(30);
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m,
&bpm, &hr_zone));
cl_assert_equal_i(bpm, 100);
// Time forward X seconds
prv_inc_time(30)... |
/*
* 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... | (copied_points != NULL) | ;
for (int i = 0; i < num_points; i++) {
copied_points[i] = gpoint_add(points[i], offset);
}
return copied_points;
}
static bool prv_compare_points(GPoint *a, GPoint *b, uint16_t num_points) {
return (memcmp(a, b, sizeof(GPoint) * num_points) == 0);
}
// Stubs
void graphics_context_set_stroke_color(GConte... |
/*
* 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 (!system_resource_is_valid()) {
return false;
} |
// Do stuff that needs to happen when stack starts, i.e. bootstrap, load FW, ...
if (!dialog_bootrom_load_second_stage_bootloader()) {
// Failed to load BT bootloader. Shutdown if we haven't tried this already.
PBL_LOG(LOG_LEVEL_ERROR, "Failed to load BLE Second Stage Bootloader - shutting down");
if ... |
/*
* 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... | i18n_free(msg, dialog) | ;
return simple_dialog;
}
|
riphs, ENABLE);
RCC_AHB3PeriphResetCmd(ahb3_periphs, DISABLE);
RCC_APB1PeriphResetCmd(apb1_periphs, ENABLE);
RCC_APB1PeriphResetCmd(apb1_periphs, DISABLE);
RCC_APB2PeriphResetCmd(apb2_periphs, ENABLE);
RCC_APB2PeriphResetCmd(apb2_periphs, DISABLE);
}
static void __attribute__((noreturn)) prv_jump_to_fw(void)... | {
// Yikes, our firmware is screwed. Boot into recovery mode.
dbgserial_putstr("Failed to start firmware, strike three.");
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE);
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO);
return true;
} | |
/*
* 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... | pebble_task_get_current() | == PebbleTask_App) {
event_service_client_unsubscribe(&session->app_focus_sub);
}
}
#endif
DictationSession *dictation_session_create(uint32_t buffer_size,
DictationSessionStatusCallback callback, void *context) {
#if CAPABILITY_HAS_MICROPHONE
if (!callback) {
r... |
) / 8;
}
void test_text_resources__initialize(void) {
fake_spi_flash_init(0, 0x1000000);
pfs_init(false);
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */);
load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH... | (s_font_info.base.md.version) | , 3);
cl_assert_equal_i(s_font_info.base.md.wildcard_codepoint, WILDCARD_CODEPOINT);
}
void test_text_resources__test_backup_wildcard(void) {
const uint8_t wildcard_bytes[] = {0x3f, 0xc6, 0x18, 0x63, 0x8c, 0x31, 0xc6, 0x0f};
uint32_t font_fallback = RESOURCE_ID_FONT_FALLBACK_INTERNAL;
cl_assert(text_resources... |
/*
* 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 (layout && swap_layer->callbacks.layout_removed_handler) {
swap_layer->callbacks.layout_removed_handler(swap_layer, layout, swap_layer->context);
} |
}
//! Calls the fetch layout callback and gets the layout that is at an offset of rel_change from the
//! current index (which is stored and kept track of by the client)
static LayoutLayer *prv_fetch_next_layout(SwapLayer *swap_layer, int8_t rel_change) {
if (swap_layer->callbacks.get_layout_handler) {
LayoutLa... |
n/analytics/analytics.h"
#include "services/common/comm_session/protocol.h"
#include "services/common/comm_session/session_send_buffer.h"
#include "services/common/system_task.h"
#include "services/common/new_timer/new_timer.h"
#include "services/normal/data_logging/data_logging_service.h"
#include "kernel/pbl_malloc.h... | (s_endpoint_data.mutex) | ;
}
static bool find_soonest_ack_timeout_cb(DataLoggingSession *session, void *data) {
RtcTicks *soonest_ack_timeout = (RtcTicks*) data;
if (session->comm.ack_timeout != 0
&& (session->comm.ack_timeout < *soonest_ack_timeout || *soonest_ack_timeout == 0)) {
*soonest_ack_timeout = session->comm.ack_timeou... |
/*
* 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... | (floor( 1.5) == 1.0) | ;
cl_assert(floor(-1.5) == -2.0);
cl_assert(floor( 2.0) == 2.0);
cl_assert(floor(-2.0) == -2.0);
cl_assert(floor( 0.0001) == 0.0);
cl_assert(floor(-0.0001) == -1.0);
cl_assert(isnan(floor(NAN)));
cl_assert(isinf(floor(INFINITY)));
}
|
/*
* 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... | (region_name, TIMEZONE_NAME_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... | (0, bounds.size.h/2 - text_height/2,
text_width, text_height) | );
// Set the text, font, and text alignment
text_layer_set_text(text_layer, "No Accelerometer");
text_layer_set_text_alignment(text_layer, GTextAlignmentCenter);
// Add the text layer to the window
layer_add_child(window_get_root_layer(window), text_layer_get_layer(text_layer));
// Push the window
win... |
Uuid *id, const char *msg,
uint32_t timeline_res_id, ActionResultType type) {
// send action result event
PebbleSysNotificationActionResult *action_result =
kernel_malloc_check(sizeof(PebbleSysNotificationActionResult) + 2 * sizeof(Attribute));
AttributeList res... | if (action->type == TimelineItemActionTypeAncsDelete) {
msg_i18n = i18n_noop("Deleted");
res_id = TIMELINE_RESOURCE_RESULT_DELETED;
} |
prv_put_notification_action_result(&item->header.id, i18n_get(msg_i18n, &i18n_key), res_id,
ActionResultTypeSuccess);
}
}
static void prv_get_pin_and_push_pin_window(void *data) {
Uuid *parent_id = data;
TimelineItem *pin = task_malloc(sizeof(TimelineItem)); // cleaned... |
/*
* 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... | gcolor_is_transparent(path_layer->stroke_color) | ) {
graphics_context_set_stroke_color(ctx, path_layer->stroke_color);
gpath_draw_outline(ctx, &path_layer->path);
}
}
void path_layer_init(PathLayer *path_layer, const GPathInfo *path_info) {
gpath_init(&path_layer->path, path_info);
const GRect outer_rect = gpath_outer_rect(&path_layer->path);
layer_i... |
_message_register_inbox_dropped(AppMessageInboxDropped dropped_callback) {
AppMessageCtx *app_message_ctx = app_state_get_app_message_ctx();
AppMessageInboxDropped retval = app_message_ctx->inbox.dropped_callback;
app_message_ctx->inbox.dropped_callback = dropped_callback;
return retval;
}
AppMessageOutboxSent... | {
AppMessageCtx *app_message_ctx = app_state_get_app_message_ctx();
return app_message_ctx->inbox.is_open;
} |
bool app_message_is_accepting_outbound(void) {
AppMessageCtx *app_message_ctx = app_state_get_app_message_ctx();
return (app_message_ctx->outbox.phase == OUT_ACCEPTING);
}
bool app_message_is_closed_inbound(void) {
AppMessageCtx *app_message_ctx = app_state_get_app_message_ctx();
return (!app_message_ctx->in... |
last_handler_entry(&s_started_handler_calls, b3)->fire_order);
first_fire_b = MIN(first_fire_b,
prv_last_handler_entry(&s_started_handler_calls, spawn_b)->fire_order);
cl_assert(last_fire_a < first_fire_b);
cl_assert_equal_i(prv_count_animations(), 0);
}
// ---------------------------------... | (&s_stopped_handler_calls, b) | , 0);
cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX);
// Complete B
prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS + 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_... |
{ 128, -64, -912},
{ 216, -24, -968},
{ 312, -24, -1032},
{ 480, -64, -1128},
{ 608, 160, -1192},
{ 624, 168, -1128},
{ 552, 96, -1008},
{ 432, 32, -912},
{ 304, 0, -824},
{ 208, 0, -696},
{ 184, -24, -672},
{ 192, -80, -688},
// 21 seconds
{ 224, -128, -784},
{ ... | { 248, 672, -888},
{ 200, 520, -696},
{ 144, 376, -552},
{ 80, 312, -456},
{ 48, 176, -536},
{ 16, 152, -584},
{ 16, 352, -784},
{ 176, 496, -944},
{ 360, 192, -744},
{ 456, 352, -816},
{ 512, 392, -792},
{ 552, 616, -952},
{ 608, 520, -1016},
{ 640, 568, -1024},
... |
{ 328, 552, -896},
{ 632, 568, -896},
{ 736, 600, -872},
{ 592, 608, -824},
{ 376, 552, -736},
// 29 seconds
{ 160, 392, -640},
{ 96, 360, -600},
{ 128, 360, -616},
{ 112, 424, -688},
{ 96, 440, -720},
{ 48, 480, -800},
{ 0, 536, -824},
{ -8, 600, -888},
{ 48... |
/*
* 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... | gbitmap_destroy(s_pixels) | ;
}
s_pixels = gbitmap_create_blank(size, GBITMAP_NATIVE_FORMAT);
memset(s_pixels->addr, 0xff, size.h * s_pixels->row_size_bytes);
s_context.dest_bitmap = *s_pixels;
s_context.draw_state.clip_box = (GRect){.size = size};
s_context.draw_state.drawing_box = s_context.draw_state.clip_box;
s_app_state_get_gra... |
esult_sub);
voice_window_regain_focus(session->voice_window);
} else {
event_service_client_unsubscribe(&session->dictation_result_sub);
voice_window_lose_focus(session->voice_window);
}
}
static void prv_stop_session(DictationSession *session) {
session->in_progress = false;
event_service_client_u... | event_service_client_subscribe(&session->app_focus_sub) | ;
}
return result;
#else
return DictationSessionStatusFailureInternalError;
#endif
}
DictationSessionStatus dictation_session_stop(DictationSession *session) {
#if CAPABILITY_HAS_MICROPHONE
if (!session || !session->in_progress) {
return DictationSessionStatusFailureInternalError;
}
prv_stop_session(se... |
), 1);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 9), 2);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 11), 3);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 13), 4);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 15), 20);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 17... | graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 5), 0) | ;
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 7), 1);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 9), 2);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 11), 3);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 13), 4);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 15), 20);... |
_is_empty("outside_x_y_origin_layer", ctx.parent_framebuffer, GColorWhite));
}
void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__offset_layer(void) {
GContext ctx;
Layer layer;
test_graphics_context_init(&ctx, fb);
layer_init(&layer, &GRect(10, 10, 10, 10));
layer_set_update_proc(&layer, &inside_layer_update_... | graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y)) | ;
graphics_draw_pixel(ctx, GPoint(p.x + 0, p.y + 1));
graphics_draw_pixel(ctx, GPoint(p.x + 1, p.y + 1));
graphics_draw_pixel(ctx, GPoint(p.x + 2, p.y + 1));
graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y + 1));
graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y + 1));
graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y ... |
list_validate(command_list, size));
command->type = GDrawCommandTypePrecisePath;
cl_assert(gdraw_command_list_validate(command_list, size));
free(command_list);
}
void test_gdraw_command__validate_image(void) {
size_t size = sizeof(GDrawCommandImage) + (3 * sizeof(GDrawCommand)) +
(sizeof(GPoint) * 6);
... | (prv_compare_points(points, s_stroke_points, s_path_num_points)) | ;
cl_assert(prv_compare_points(points, s_fill_points, s_path_num_points));
prv_reset();
gdraw_command_frame_draw(ctx, NULL, frame, GPoint(-1, 1));
cl_assert_equal_i(s_path_num_points, 2);
points[0] = GPoint(0, 2);
points[1] = GPoint(1, -1);
cl_assert(prv_compare_points(points, s_stroke_points, s_path_num... |
h"
#include "resource/resource_ids.auto.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/math.h"
#include <inttypes.h>
#include <stdint.h>
// The dialog BLE chip has a baked in bootloader capable of talking serial
// protocols. The bootloader allows a contiguous memory region to be loaded
// ... | (BT_RX_BOOTROM_UART) | ;
return true;
}
} while (rtc_get_ticks() <= end_ticks);
PBL_LOG(LOG_LEVEL_ERROR, "Timed out waiting for char");
return false;
}
static bool prv_bootrom_wait_for_char(char *char_received) {
const uint32_t wait_time_ticks = (DIALOG_BOOTROM_DEFAULT_CHAR_TIMEOUT_MS * RTC_TICKS_HZ) / 1000;
return prv_... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return;
} |
if (boot_bit_test(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS)) {
dbgserial_putstr("Our previous firmware update failed, aborting update.");
// Pretend like the new firmware bit wasn't set afterall. We'll just run the
// previous code, whether that was normal firmware or the recovery firmware.
boot_bit_clea... |
/*
* 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(impl && impl->handler_scheduled && impl->session) | ;
impl->endpoint->handler(impl->session, impl->payload, impl->total_payload_size);
prv_wipe_receiver_data(impl);
kernel_free(impl);
}
static void prv_default_kernel_receiver_finish(Receiver *receiver) {
DefaultReceiverImpl *impl = (DefaultReceiverImpl *)receiver;
impl->handler_scheduled = true;
if ((int... |
alog_text;
char *reminder_str;
time_t timestamp;
ReminderAppUIState ui_state;
} ReminderAppData;
static void prv_create_reminder(ReminderAppData *data) {
AttributeList pin_attr_list = {0};
attribute_list_add_uint32(&pin_attr_list, AttributeIdIconTiny,
TIMELINE_RESOURCE_NOTIFICATIO... | {
app_free(data->dialog_text);
} |
const size_t sentence_len = strlen(data->reminder_str);
const size_t date_time_len = 32; // "September 19th 9:05pm", "Yesterday 12:33pm"
const size_t required_buf_size = sentence_len + date_time_len + 2 /* \n\n */ + 1 /* \0 */;
data->dialog_text = app_zalloc_check(required_buf_size);
// The string that is b... |
ection_state()`.
void prv_launcher_menu_layer_set_selection_index(LauncherMenuLayer *launcher_menu_layer,
uint16_t index, MenuRowAlign row_align,
bool animated);
void prv_render_launcher_menu_layer(uint16_t selected_index... | cl_assert_equal_i(app_glance_db_insert_glance(&s_fake_app_nodes[i].node.uuid, &glance),
S_SUCCESS) | ;
}
}
void test_launcher_menu_layer__app_selected_and_apps_above_and_below_with_glances(void) {
prv_insert_glances_for_app_selected_and_apps_above_and_below_with_glances_test();
prv_render_launcher_menu_layer(LauncherMenuLayerTestApp_InteriorApp);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
... |
nclude "drivers/pmic.h"
#include "mfg/mfg_info.h"
#include "mfg/mfg_serials.h"
#include "resource/resource.h"
#include "resource/system_resource.h"
#include "services/common/bluetooth/bluetooth_persistent_storage.h"
#include "services/common/bluetooth/local_id.h"
#include "services/common/comm_session/protocol.h"
#incl... | PBL_LOG(LOG_LEVEL_DEBUG, "Sending lang version: %d", versions_msg.lang_version) | ;
// Set the capabilities as zero, effectively saying that we don't support anything.
versions_msg.capabilities.flags = 0;
// Assign the individual bits for the capabilities that we support.
versions_msg.capabilities.run_state_support = 1;
versions_msg.capabilities.infinite_log_dumping_support = 1;
version... |
"task.h"
#include "queue.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define RETURN_CRASH_TIMEOUT_TICKS (60 * RTC_TICKS_HZ)
//! Behold! The file that manages applications!
//!
//! The code in this file applies to all apps, whether they're third party apps ... | (process_metadata_get_app_sdk_platform(app_md)) | ;
PBL_LOG(LOG_LEVEL_DEBUG, "Starting %s app <%s>", app_type, process_metadata_get_name(app_md));
// new logging only allows for 2 %s per format string...
PBL_LOG(LOG_LEVEL_DEBUG, "Starting app with sdk platform %s", sdk_platform);
}
#define APP_STACK_ROCKY_SIZE (8 * 1024)
#define APP_STACK_NORMAL_SIZE (2 * 1024... |
opping %d accel samples", (int)(state->num_samples - samples));
success = false;
}
state->event_posted = false;
state->num_samples = 0;
// Fill it again from circular buffer
prv_dispatch_data();
mutex_unlock_recursive(s_accel_manager_mutex);
return success;
}
/*
* TODO: APIs that still need to be... | (s_accel_manager_mutex) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return mapping;
} |
}
// App ID doesn't match any of the known IDs:
return &s_generic_app;
}
time_t ancs_notifications_util_parse_timestamp(const ANCSAttribute *timestamp_attr) {
PBL_ASSERTN(timestamp_attr);
struct PACKED {
char year[4];
char month[2];
char day[2];
char T[1];
char hour[2];
char minute[... |
uired by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#includ... | power_tracking_start(PowerSystemMcuCoreSleep) | |
//////////////
// Data structures
typedef struct {
Window window;
TextLayer percent_done_text_layer;
char percent_done_text_buffer[5]; //<! Text for progress percentage label, format %02d%%
SimpleDialog finished_dialog;
ProgressLayer progress_layer;
AppTimer *timer;
unsigned int percent_complete;
Progr... | i18n_free_all(data) | ;
app_timer_cancel(data->timer);
app_free(data);
}
}
static void prv_window_load_handler(Window* window) {
ProgressUIData *data = window_get_user_data(window);
const ProgressUIAppArgs* app_args = app_manager_get_task_context()->args;
data->progress_source = app_args->progress_source;
simple_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... | ((uint8_t*)&firmware_description, firmware_start_address,
sizeof(FirmwareDescription)) | ;
return firmware_description;
}
bool firmware_storage_check_valid_firmware_description(FirmwareDescription* desc) {
return desc->description_length == sizeof(FirmwareDescription);
}
|
debug_tag(job->tag), gap_le_connect_is_connected_as_slave());
// Set to next job (round-robin) that isn't silent (unless there is no non-silent one):
s_jobs = (GAPLEAdvertisingJob *) job->node.next;
while (prv_is_current_term_silent(s_jobs) &&
s_jobs != job /* looped around */) {
s_jobs = ... | prv_string_for_debug_tag(next->tag) | );
// Use average interval ms. BT controller does not report back what it uses.
const uint32_t interval_ms = (min_interval_ms + max_interval_ms) / 2;
// The ad data is fixed in size. See below.
// The scan response data size is omitted here, because we can't tell how
// often a... |
e the heart rate metrics
time_t now_utc = rtc_get_time();
activity_metrics_prv_add_median_hr_sample(hrm_event, now_utc, now_uptime_ts);
// Log it to the mobile
protobuf_log_hr_add_sample(s_activity_state.hr.log_session, now_utc,
hrm_event->bpm.bpm, hrm_event->bpm... | (LOG_LEVEL_WARNING, "Unexpected key len: %"PRIu32" ", (uint32_t)info->key_len) | ;
return;
}
// rewrite this entry
ActivitySettingsKey key;
info->get_key(old_file, &key, info->key_len);
void *data = kernel_malloc_check(info->val_len);
info->get_val(old_file, data, info->val_len);
settings_file_set(new_file, &key, info->key_len, data, info->val_len);
kernel_free(data);
}
//... |
/*
* 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... | (&success, s_malformed_test_string) | ;
cl_assert(!success);
utf8_t* malformed_test_string_utf8 = (utf8_t*)s_malformed_test_string;
for (int i = 0; i < (UTF8_TEST_MALFORMED_CODEPOINT_INDEX - 1); i++) {
uint32_t decoded_codepoint = utf8_peek_codepoint(malformed_test_string_utf8, NULL);
uint32_t actual_codepoint = s_valid_test_codepoints[i];
... |
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the Lice... | prv_wait_for_qspi_not_busy() | ;
const uint32_t expected_whoami = 0x3725c2;
if (read_whoami == expected_whoami) {
return true;
} else {
return false;
}
}
void flash_init(void) {
prv_enable_qspi_clock();
// init GPIOs
for (unsigned i = 0; i < QSpiPinCount; ++i) {
gpio_af_init(&BOARD_CONFIG_FLASH_PINS[i], GPIO_OType_PP, GPI... |
0; i < NUM_TEST_EVENTS; ++i) {
circular_buffer_write(&cb, (const uint8_t *)&event[i], sizeof(PebbleHRMEvent));
}
PebbleHRMEvent out_event[NUM_TEST_EVENTS];
for (int i = 0; i < NUM_TEST_EVENTS; ++i) {
prv_read_event_from_buffer_and_consume(&cb, &out_event[i]);
cl_assert_equal_b(memcmp(&even... | (num_updates <= HRM_CHECK_SENSOR_DISABLE_COUNT) | ;
prv_advance_time_ms(1000);
// Now, change the update interval to 10 seconds. That should re-enable the sensor immediately
update_interval_s = 10;
cl_assert(sys_hrm_manager_set_update_interval(session_ref, update_interval_s, expire_s));
fake_system_task_callbacks_invoke_pending();
cl_assert_equal_b(hrm_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... | (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 footer;
} StatusRegisterRequest;
typedef struct PACKED {
uint8_t pa... |
R_HOUR, 50, ActivitySleepStateAwake);
// switch into PST (which would be 3pm)
tz_info = (TimezoneInfo) {
.tm_zone = "PST",
.tm_gmtoff = -8 * SECONDS_PER_HOUR,
};
time_util_update_timezone(&tz_info);
// Walk some more until 11pm PST
prv_feed_cannned_accel_data(8 * SECONDS_PER_HOUR, 50, ActivitySlee... | (ActivityMetricStepCount,
((const uint32_t [ACTIVITY_HISTORY_DAYS]){2000, 1000, 0, 0, 0, 0, 0})) | ;
// If we ask for the sum of the latter half of yesterday, we should get 500
HealthValue steps = health_service_sum(
HealthMetricStepCount, time_start_of_today() - (12 * SECONDS_PER_HOUR),
time_start_of_today());
cl_assert_equal_i(steps, 500);
// If we ask for the sum from latter half of yesterd... |
ation we just fetched.
PBL_LOG(LOG_LEVEL_DEBUG, "App Fetch: Putting launch event");
// if this was launched by the phone, it's probably a new install
if ((data->next_app_args.common.reason == APP_LAUNCH_PHONE) &&
!battery_is_usb_connected()) {
vibes_short_pulse();
}
// Allocate and inialize the da... | app_window_stack_pop(true) | ;
}
data->result = error_code;
if ((watchface_get_default_install_id() == data->install_entry.install_id) &&
app_install_entry_is_watchface(&data->install_entry)) {
// We failed to fetch a watchface and it was our default.
// Invalidate it and it will be reassigned to one that exists next time arou... |
/*
* 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... | ("pebble_green") | ;
break;
case WATCH_INFO_COLOR_PINK:
model_name = TINTIN_MODEL("pebble_pink");
break;
case WATCH_INFO_COLOR_TIME_WHITE:
model_name = SNOWY_MODEL("pebble_time_white");
break;
case WATCH_INFO_COLOR_TIME_BLACK:
model_name = SNOWY_MODEL("pebble_time_black");... |
ize(&menu_layer->scroll_layer, GSize(frame_size.w, total_height));
// Set the selected cell again:
const bool animated = false;
menu_layer_set_selected_index(menu_layer, selected_index, MenuRowAlignNone, animated);
}
void menu_layer_set_callbacks(MenuLayer *menu_layer, void *callback_context,
... | animation_schedule(a) | |
timer_register(
1000, true /* repeating */, prv_update_call_time, NULL);
// Update call time immediately
prv_update_call_time(NULL);
}
static void prv_stop_call_duration_timer(void) {
evented_timer_cancel(s_phone_ui_data->call_duration_timer);
s_phone_ui_data->call_duration_timer = EVENTED_TIMER_INVALID... | phone_call_decline() | ;
prv_stop_call_duration_timer();
prv_set_icon_resource(TIMELINE_RESOURCE_DISMISSED_PHONE_CALL);
prv_set_window_color(DECLINE_COLOR, true);
// This must be called before prv_set_status_text, otherwise the text will not be centered
prv_action_bar_setup(PhoneCallActions_None);
prv_set_status_text(DECLINED);... |
WeatherLocationForecast *forecast_out) {
PascalString16List pstring16_list;
pstring_project_list_on_serialized_array(&pstring16_list, &entry->pstring16s);
PascalString16 *location_pstring =
pstring_get_pstring16_from_list(&pstring16_list, WeatherDbStringIndex_LocationName);
PascalString16 *phrase_pstrin... | {
SerializedWeatherAppPrefs *prefs = watch_app_prefs_get_weather();
if (!prefs) {
PBL_LOG(LOG_LEVEL_ERROR, "No SerializedWeatherAppPrefs available!");
return false;
}
// Can occur if the user removes all weather locations from their mobile app
if (prefs->num_locations == 0) {
watch_app_prefs_dest... | |
/*
* 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_i(0b1, BITS(0)) | ;
cl_assert_equal_i(0b00011111, BITS(4));
cl_assert_equal_i(0b00111111, BITS_BETWEEN(0, 5));
cl_assert_equal_i(0b00111000, BITS_BETWEEN(3, 5));
cl_assert_equal_i(0b00010000, BITS_BETWEEN(4, 4));
}
// Flash memory is organized into twelve sectors of unequal sizes.
// Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.