prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
t) {}
typedef uint16_t ResourceId;
const uint8_t *resource_get_builtin_bytes(ResAppNum app_num, uint32_t resource_id,
uint32_t *num_bytes_out) { return NULL; }
typedef struct TestReelData {
uint32_t elapsed_ms;
uint32_t duration_ms;
} TestReelData;
static int s_num_destru... | animation_schedule(animation) | ;
animation_set_reverse(animation, true);
animation_set_elapsed(animation, 1234); // intentionally bad value
prv_play_animation_update(animation,
ANIMATION_NORMALIZED_MAX - ANIMATION_NORMALIZED_MAX * 20 / 300);
cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 300 - 20);
}
void ... |
prv_get_cmd((uint8_t *)&cmd, sizeof(cmd)) | ;
if (crc32(CRC32_INIT, &cmd, sizeof(cmd)) != CRC32_RESIDUE) {
printf("cmd CRC failed");
prv_low_power_mode();
}
// Feed the watchdog
hw_watchdog_set_pos_val(0xFF);
switch (cmd.cmd) {
case CoreDumpCmd_GetTextCRC: {
uint16_t response = text_crc_matches; // This can't be a ... | |
IN(samples_remaining, SAMPLES_PER_SECOND);
AccelRawData data[SAMPLES_PER_SECOND];
for (uint32_t i = 0; i < chunk_size; i++) {
data[i] = step_samples[step_sample_idx++];
step_sample_idx = step_sample_idx % num_step_samples;
}
activity_test_feed_samples(data, chunk_size);
rtc_set_time(rtc... | (true /*reset_settings*/, true /*tracking_on*/, NULL, NULL) | ;
// Change into awake state and capture the sleep before
// Walk long enough to overlap with a periodic sleep recomputation
prv_feed_steps_min(ACTIVITY_SESSION_UPDATE_MIN + 1);
int32_t before_total, before_deep;
activity_get_metric(ActivityMetricSleepTotalSeconds, 1, &before_total);
activity_get_metric(Ac... |
ensed 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
* distributed under ... | cl_assert(!s_mfg_mode_entered) | |
_uuids[10];
static ActivitySession event_sessions[10];
s_parsed_msg = (TestPLParsedMsg) {
.events = {
.num_events = ARRAY_LENGTH(events),
.events = events,
.uuids = event_uuids,
.num_sessions = ARRAY_LENGTH(event_sessions),
.sessions = event_sessions,
},
};
// Get the mes... | (a->events.num_events, b->events.num_events) | ;
cl_assert_equal_i(a->events.num_sessions, b->events.num_sessions);
for (int i = 0; i < a->events.num_events; i++) {
const pebble_pipeline_Event *a_event = &a->events.events[i];
const pebble_pipeline_Event *b_event = &b->events.events[i];
cl_assert_equal_i(a_event->type, b_event->type);
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
PBL_ASSERTN(ctx);
ctx->lock = false;
framebuffer_dirty_all(ctx->parent_framebuffer);
return true;
} |
GContext *graphics_context_get_current_context(void) {
return &s_ctx;
}
// Stubs
/////////////////////
#include "stubs_analytics.h"
#include "stubs_animation_timing.h"
#include "stubs_app_install_manager.h"
#include "stubs_app_state.h"
#include "stubs_app_timer.h"
#include "stubs_bootbits.h"
#include "stubs_buffe... |
ar(const GPointPrecise *center, uint32_t distance,
int32_t angle) {
return gpoint_from_polar_precise(center, distance << GPOINT_PRECISE_PRECISION, angle);
}
static void prv_graphics_draw_centered_text(GContext *ctx, const GSize *max_size,
... | (&bob_rect, bounds, GAlignCenter, false /* clips */) | ;
grect_align(&bob_center_rect, bounds, GAlignCenter, false /* clips */);
graphics_context_set_fill_color(ctx, face->bob_color);
graphics_fill_oval(ctx, bob_rect, GOvalScaleModeFitCircle);
graphics_context_set_fill_color(ctx, face->bob_center_color);
graphics_fill_oval(ctx, bob_center_rect, GOvalScaleModeFitC... |
_init();
// Setup content indicator
ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer();
content_indicator_init_buffer(buffer);
}
void test_workout_active__cleanup(void) {
}
// Helpers
//////////////////////
static void prv_create_window_and_render(WorkoutActiveWindow *active_window,
... | (active_window, 0) | ;
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_workout_active__workout_render_hr_zone_1(void) {
s_workout_data = (WorkoutData) {
.steps = 567,
.duration_s = 789,
.distance_m = 234,
.avg_pace = health_util_get_pace(789, 234),
.bpm = 148,
.hr_zone = 1,
};
Work... |
_put_bpm_event(50, HRMQuality_OffWrist);
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m,
&bpm, &hr_zone));
cl_assert_equal_i(bpm, 0);
cl_assert_equal_i(hr_zone, HRZone_Zone0);
// Put a good quality reading. Verify it was ... | prv_inc_time(30) | ;
cl_assert(workout_service_stop_workout());
workout_service_frontend_closed();
cl_assert_equal_b(s_hrm_subscribed, false);
cl_assert_equal_i(s_hrm_expiration, 0);
}
// ---------------------------------------------------------------------------------------
// Open the app, start a workout, 120s, stop the work... |
onse(cmd->cmd_str);
}
}
}
typedef struct CommandArgs {
unsigned int num_args;
const char* args[NUM_SUPPORTED_PARAM_COUNT];
} CommandArgs;
static CommandArgs prv_parse_arguments(char* buffer, char* buffer_end) {
CommandArgs args;
for (int i = 0; i < NUM_SUPPORTED_PARAM_COUNT; ++i) {
// Consume leadi... | prompt_context_append_char(&s_dbgserial_prompt_context, c) | ) {
dbgserial_putchar(0x07); // bell
return;
}
// Echo
dbgserial_putchar_lazy(c);
return;
}
// Handle unprintable control characters.
if (UNLIKELY(c == 0x3)) { // CTRL-C
dbgserial_putstr("");
start_prompt(); // Start over
return;
}
if (UNLIKELY(c == 0x4)) { // CTRL... |
rite two more additional logs which should cause the first erase
// region to get erased
logs = realloc(logs, sizeof(char *) * (num_logs + 2));
logs[num_logs] = task_strdup("Let's test if wrap around is working!");
logs[num_logs + 1] = task_strdup("This should be on an early page");
int start_log = num_logs ... | cl_assert(start_addr != FLASH_LOG_INVALID_ADDR) | ;
bool rv = flash_logging_write((uint8_t *)msg, start_addr, strlen(msg));
cl_assert(rv);
rv = flash_logging_write((uint8_t *)msg, start_addr, strlen(msg));
cl_assert(!rv);
setup_and_test_expected_msg(&msg, 0, 1, 1);
}
//! Make sure that when we chunk up our writes for a log message, the lines
//! are saved... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | dbgserial_print("ASSERT: ") | ;
dbgserial_print(expr);
dbgserial_print(" ");
dbgserial_print(filename);
dbgserial_print(":");
dbgserial_print_hex(line_number);
if (fmt) {
dbgserial_print(" ");
dbgserial_print(fmt);
}
dbgserial_putstr("");
reset_due_to_software_failure();
}
static __attribute__((noreturn)) void handle_pa... |
st jerry_value_t argv[],
RockyArgValueCheckError *value_error_out) {
double val = jerry_get_number_value(argv[0]);
if (!prv_check_value_number_within_bounds(binding->type, &val, value_error_out)) {
return false;
}
if (binding->type != RockyArgTypeDouble && binding->type != Ro... | prv_fixed_s3_from_double(d) | ;
}
*((GRectPrecise *)binding->ptr) = (GRectPrecise) {
.origin.x = v[0],
.origin.y = v[1],
.size.w = v[2],
.size.h = v[3],
};
return true;
}
static bool prv_convert_and_assign_gcolor(const RockyArgBinding *binding,
const jerry_value_t argv[],
... |
bar_layer_render(GContext *ctx, const GRect *bounds, void *config) {
return;
}
GDrawState graphics_context_get_drawing_state(GContext* ctx) {
GDrawState state;
memset(&state, 0, sizeof(GDrawState));
return state;
}
void graphics_context_set_drawing_state(GContext* ctx, GDrawState draw_state) {
return;
}
bo... | cl_assert_equal_i(window->is_loaded, false) | ;
window_stack_push(window->parent_window_stack, new_window, true);
}
static void prv_pop_window_load(Window *window) {
prv_window_load(window);
cl_check(window->parent_window_stack);
cl_assert_equal_i(window->on_screen, true);
cl_assert_equal_i(window->is_loaded, false);
window_stack_pop(window->parent... |
-688},
{ -288, 640, -680},
{ -272, 640, -688},
{ -264, 632, -696},
{ -264, 616, -696},
{ -264, 632, -688},
{ -256, 640, -696},
{ -240, 624, -688},
{ -240, 624, -696},
{ -240, 624, -688},
{ -232, 624, -664},
{ -224, 632, -672},
{ -224, 600, -656},
{ -248, 608, -632},
... | { -736, 712, 48},
{ -784, 792, -8},
{ -616, 832, -16},
{ -600, 840, -128},
{ -496, 768, -216},
{ -440, 832, -272},
{ -392, 864, -384},
{ -312, 920, -440},
{ -288, 928, -528},
{ -248, 920, -584},
{ -216, 824, -632},
// 115 seconds
{ -208, 784, -640},
{ -184, 752, -... |
{ 560, 216, -720},
{ 408, 648, -680},
{ 256, 624, -592},
{ 216, 576, -560},
{ 280, 400, -736},
{ 288, 296, -792},
{ 288, 304, -904},
{ 264, 296, -904},
{ 216, 192, -904},
{ 336, 232, -952},
{ 368, 88, -920},
{ 448, 120, -872},
{ 448, 48, -928},
{ 424, -8, -952},
... |
attery_state.voltage,
battery_get_millivolts());
bool charging = (s_last_battery_state.connection == ConnectionStateChargingPlugged);
// Update Percent & Filtering
const uint32_t ALWAYS_UPDATE_THRESHOLD = ratio32_from_percent(10);
bool likely_stable = prv_is... | ratio32_to_percent(s_last_battery_state.percent) | ;
// subtract low power reserve, so developer will see 0% when we're approaching low power mode
int32_t percent_normalized = MAX((percent - BOARD_CONFIG_POWER.low_power_threshold
+ percent / (100 / BOARD_CONFIG_POWER.low_power_threshold)), 0);
// massage rounding factor so that between 100% to... |
SPI6;
bus->state->spi_clock_periph_speed = clocks.PCLK2_Frequency;
bus->state->spi_apb = SpiAPB_2;
#endif
}
}
static uint16_t prv_spi_find_prescaler(const SPIBus *bus) {
int lg;
if (bus->state->spi_clock_speed_hz > (bus->state->spi_clock_periph_speed / 2)) {
lg = 1; // Underclock to the highest possi... | {
// Enable SPIx reset state
RCC_APB2PeriphResetCmd(bus->state->spi_clock_periph, ENABLE);
// Release SPIx from reset state
RCC_APB2PeriphResetCmd(bus->state->spi_clock_periph, DISABLE);
} |
spi_ll_slave_release(slave);
}
//
//! High level slave port interface
//! This part of the API can be used for fairly straightforward SPI interactions
//! The assertion and deassertion of the SCS line is automatic
//
static bool prv_is_bidrectional(const SPISlavePort *slave) {
bool is_bidirectional = (slave->s... |
data) {
if (s_pulse_task_idle && uxQueueMessagesWaiting(s_pulse_task_queue) == 0) {
prv_pulse_task_feed_watchdog();
}
}
static void prv_pulse_task_main(void *unused) {
task_watchdog_mask_set(PebbleTask_PULSE);
static RegularTimerInfo idle_watchdog_timer = {
.cb = prv_pulse_task_idle_timer_callback
}... | (PULSE2_LCP) | |
/*
* 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... | {
// Erase flash
flash_erase_sector_blocking(start_address); // Set everything high
// Set up the firmware description
FirmwareDescription desc;
desc.description_length = sizeof(FirmwareDescription);
desc.firmware_length = (64 * 1024) - sizeof(FirmwareDescription);
desc.checksum = 0xdeadbeef;
// Write... |
enum {
ERASE_NORMAL_FW = 1 << 0,
ERASE_RECOVERY_FW = 1 << 1,
ERASE_ALL = ERASE_NORMAL_FW | ERASE_RECOVERY_FW,
};
static void erase_callback(void *data) {
uintptr_t arg = (uintptr_t)data;
if (arg & ERASE_RECOVERY_FW) {
erase_fw(FLASH_REGION_SAFE_FIRMWARE_BEGIN);
}
if (arg & ERASE_NORMAL_FW) {
... |
e except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF A... | (false, scroll_layer->paging.paging_disabled) | ;
cl_assert_equal_b(false, scroll_layer->paging.shadow_hidden);
}
void test_scroll_layer__scrolling(void) {
GRect scroll_bounds = GRect(0,0,180,180);
ScrollLayer *scroll_layer = scroll_layer_create(scroll_bounds);
GSize content_size = GSize(180, 2000);
scroll_layer_set_content_size(scroll_layer, content_si... |
RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerBottomLeft);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_bottomleft.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_C... | prv_fill_rects(&ctx, 3 * CLIP_OFFSET, 1, 4) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_clip_rect.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_fill_rect_${BIT_DEPTH_NAME}__clipping_rect_aa(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, true, 1);
graphics_conte... |
int max_message_length) {
// We want to avoid vnsiprintf if we don't have sufficient stack space, so fill in
// a default log message
uint32_t stack_space = sys_stack_free_bytes();
if (stack_space < LOGGING_MIN_STACK_FOR_SPRINTF) {
strncpy(msg->message, LOGGING_STACK_FULL_MSG, max_message_length);
msg... | if (!state) {
return;
} | |
ested
SharedCircularBufferClient *slacker;
uint32_t max_data = prv_get_max_data_length(buffer, &slacker);
uint32_t avail_space = buffer->buffer_size - 1 - max_data;
while (length > avail_space) {
if (!advance_slackers) {
return false;
}
// Delete data from the biggest slacker
slacker->rea... | (buffer,
&client->buffer_client) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (s_list_mutex) | ;
const time_t now = rtc_get_time();
// Always update the execution time.
job->cached_execute_time = cron_job_get_execute_time_from_epoch(job, now);
// If not scheduled yet, schedule it.
if (!prv_is_scheduled(job)) {
s_scheduled_jobs = list_sorted_add(s_scheduled_jobs, &job->list_node, prv_sort, 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... | (text_layer) | ;
applib_free(text_layer);
}
void text_layer_deinit(TextLayer *text_layer) {
PBL_ASSERTN(text_layer);
layer_deinit(&text_layer->layer);
graphics_text_layout_cache_deinit(&text_layer->layout_cache);
text_layer->layout_cache = NULL;
}
Layer* text_layer_get_layer(TextLayer *text_layer) {
PBL_ASSERTN(text_lay... |
e, get the name
if (strcmp(token, "AccelRawData") == 0) {
PBL_ASSERT(state->test_entry.name[0] == 0, "Unexpected start of new samples");
token = strtok(NULL, "(");
// Copy starting from token + 1 to skip the '*' at the front
strncpy(state->test_entry.name, token + 1, sizeof(state->test_entr... | (token + strlen(token) + 1, "%d", &state->test_entry.total.min) | ;
} else if (strcmp(token, "TEST_TOTAL_MAX") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.total.max);
} else if (strcmp(token, "TEST_DEEP") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.deep.value);
} else if (strcmp(token, "TEST_DEEP_MIN")... |
le except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ... | worker_manager_get_task_context() | |
ssert(info->type == PEBBLE_SMARTSTRAP_EVENT);
s_event_handler = info->handler;
}
void event_service_client_unsubscribe(EventServiceInfo *info) {
cl_assert(info->type == PEBBLE_SMARTSTRAP_EVENT);
s_event_handler = NULL;
}
bool process_manager_send_event_to_process(PebbleTask task, PebbleEvent *e) {
cl_assert(t... | (app_smartstrap_attribute_end_write(attr, 0, true)) | ;
assert_result_invalid(app_smartstrap_attribute_end_write(attr, 100, false));
assert_result_invalid(app_smartstrap_attribute_end_write(attr, 100, true));
// smartstrap_attribute_read()
assert_result_invalid(app_smartstrap_attribute_read(NULL));
// destroy test attribute
app_smartstrap_attribute_destroy(a... |
torage, sizeof(storage));
const uint8_t* out_buffer;
uint16_t out_length;
// We should start out empty
cl_assert(!circular_buffer_read(&buffer, 1, &out_buffer, &out_length));
cl_assert(circular_buffer_write(&buffer, (uint8_t*) "123", 3));
cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffe... | (circular_buffer_copy_offset(&buffer, sizeof(storage) + 1 /* start_offset */,
data_out, data_out_size), 0) | ;
// Valid offset, non-wrapping copy:
circular_buffer_write(&buffer, (uint8_t *)"0123", 4);
cl_assert_equal_i(circular_buffer_copy_offset(&buffer, 3 /* start_offset */,
data_out, data_out_size), 1);
cl_assert(memcmp("3", data_out, 1) == 0);
// Offset as long a... |
-----------------------------------------------------
static void prv_snooze_kernel_bg_callback(void *unused) {
prv_process_most_recent_alarm();
}
// ----------------------------------------------------------------------------------------------
static void prv_snooze_timer_callback(void *unused) {
PBL_LOG(LOG_LEVE... | (id >= 0 && id < MAX_CONFIGURED_ALARMS) | ;
Alarm alarm = { .id = id, .config = *config };
prv_persist_alarm(file, &alarm);
prv_reload_alarms(file);
}
// ----------------------------------------------------------------------------------------------
static AlarmId prv_get_next_free_alarm_id(SettingsFile *file) {
AlarmId id_out = ALARM_INVALID_ID;
... |
t + icon_size.h +
header_content_height + text_content_height + (icon ? BOTTOM_MARGIN_PX : 0);
scroll_layer_set_content_size(scroll_layer, GSize(frame.size.w, scroll_height));
scroll_layer_set_shadow_hidden(scroll_layer, true);
scroll_layer_set_callbacks(scroll_layer, (ScrollLayerCallbacks) {
.cont... | expandable_dialog_get_dialog(expandable_dialog) | |
ly catch
// errors (https://pebbletechnology.atlassian.net/browse/PBL-31359)
Recognizer *recognizer_create_with_data(const RecognizerImpl *impl, const void *data,
size_t data_size, RecognizerEventCb event_cb,
void *user_data) {
// These... | {
// Avoid circular dependency
return;
} |
recognizer->fail_after = fail_after;
}
Recognizer *recognizer_get_fail_after(const Recognizer *recognizer) {
if (!recognizer) {
return NULL;
}
return recognizer->fail_after;
}
void recognizer_set_simultaneous_with(Recognizer *recognizer,
RecognizerSimultaneousWithCb ... |
:
return 4;
case GBitmapFormat8Bit:
case GBitmapFormat8BitCircular:
return 8;
}
return 0;
}
//! @return the size in bytes of the palette for a given format
uint8_t gbitmap_get_palette_size(GBitmapFormat format) {
switch (format) {
case GBitmapFormat1Bit:
case GBitmapFormat8Bit:
ca... | (gbitmap_get_format(bitmap)) | > 0) {
PBL_ASSERTN(!process_manager_compiled_with_legacy2_sdk());
// Palette is positioned right after the pixel data
bitmap->palette = (GColor*)(bitmap_data->data +
(bitmap->row_size_bytes * bitmap->bounds.size.h));
// Don't flag this as heap allocated, as it gets freed along with pixel data
... |
e ((cursor = utf8_get_next(cursor))) {
response_len_chars++;
}
}
AnalyticsEvent event_type;
if (!data->show_confirmation_dialog) {
event_type = AnalyticsEvent_VoiceTranscriptionAutomaticallyAccepted;
} else if (success) {
event_type = AnalyticsEvent_VoiceTranscriptionAccepted;
} else {
... | i18n_noop("Dictation is not available.") | |
48, 912},
{ -152, 576, 816},
{ -160, 488, 728},
{ -112, 400, 584},
{ -80, 376, 392},
{ -152, 408, 400},
{ -216, 488, 512},
{ -224, 640, 720},
{ -248, 784, 896},
{ -120, 808, 912},
// 24 seconds
{ -304, 904, 912},
{ -312, 896, 1376},
{ -88, 880, 968},
{ 80, 688, 68... | { -376, 496, 472},
{ -400, 640, 568},
{ -544, 784, 736},
{ -488, 952, 984},
{ -592, 1040, 912},
{ -432, 1224, 1464},
{ -56, 880, 768},
{ -224, 688, 848},
{ -224, 584, 704},
{ -64, 384, 464},
{ -120, 440, 336},
{ -144, 472, 360},
{ -216, 552, 496},
{ -160, 688, 608... |
{ -88, 1072, 664},
{ 0, 968, 464},
// 32 seconds
{ -120, 688, 336},
{ -88, 480, 168},
{ -184, 432, 248},
{ -256, 456, 360},
{ -344, 600, 544},
{ -400, 688, 656},
{ -480, 808, 784},
{ -480, 1000, 992},
{ -552, 1096, 784},
{ -536, 1392, 1368},
{ 80, 984, 616},
... |
if (!s_current_completion_status.use_legacy_mode) {
return false;
}
LegacyFwUpdateCompletionStatus *status = &s_current_completion_status.legacy_status;
if (s_is_recovery_fw) {
*progress = MIN(100, status->recovery_percent_completion);
} else {
*progress =
MIN(100, (status->resource_perc... | (s_firmware_update_semaphore, 0) | == pdFALSE) {
return;
}
if (failed) {
// If we failed, we can set it back to normal. If we succeeded, we'll reboot shortly.
// We don't know the runlevel that was set before, so we assume it was Normal.
services_set_runlevel(RunLevel_Normal);
}
s_update_status = failed ? FirmwareUpdateFailed ... |
tyAnimation *shrink = NULL;
PropertyAnimation *revert = NULL;
// Do the overshoot animation first
expand = prv_create_int16_prop_anim(max, overshoot + max, stage_duration, &s_animated_dot_impl,
data);
if (!expand) {
goto cleanup;
}
animation_set_delay((Animation *) expand, delay_duration);
// ... | layer_set_hidden(&data->mic_window.mic_dot_layer, 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... | {
return 0;
} |
int accel_session_set_samples_per_update(AccelServiceState *session, uint32_t samples_per_update) {
PBL_ASSERTN(session == ACCEL_SESSION_REF);
s_samples_per_update = samples_per_update;
return 0;
}
|
d) {
if (md->process_storage == ProcessStorageFlash) {
return ((const PebbleProcessMdFlash*) md)->res_version;
}
return (ResourceVersion) { 0, 0 } ;
}
const uint8_t *process_metadata_get_build_id(const PebbleProcessMd *md) {
if (md->process_storage == ProcessStorageFlash) {
return ((const PebbleProcess... | {
return ((flags & PROCESS_INFO_ALLOW_JS) != 0);
} |
bool process_metadata_flags_has_worker(PebbleProcessInfoFlags flags) {
return ((flags & PROCESS_INFO_HAS_WORKER) != 0);
}
bool process_metadata_flags_rocky_app(PebbleProcessInfoFlags flags) {
return ((flags & PROCESS_INFO_ROCKY_APP) != 0);
}
uint16_t process_metadata_flags_stored_sdk_platform(PebbleProcessInfoF... |
/*
* 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... | {
intermediate = *from;
second_normalized = normalized;
} |
gdraw_command_list_scale_segmented_to(
list, size, intermediate, *to, second_normalized, data->interpolate, index_lookup,
data->point_duration, two_stage);
const AnimationProgress stroke_width_progress = data->stroke_width.curve ?
data->stroke_width.curve(normalized) :
animation_timing_cu... |
/*
* 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... | {
inbox->dropped_callback(APP_MSG_BUSY, inbox->user_context);
} |
}
}
static bool prv_is_app_with_uuid_running(const Uuid *uuid) {
Uuid app_uuid = {};
sys_get_app_uuid(&app_uuid);
return uuid_equal(&app_uuid, uuid);
}
void app_message_inbox_receive(CommSession *session, AppMessagePush *push_message, size_t length,
AppInboxConsumerInfo *consum... |
-672},
{ 400, 688, -656},
// 232 seconds
{ 408, 544, -672},
{ 432, 576, -648},
{ 368, 688, -672},
{ 408, 592, -664},
{ 416, 528, -640},
{ 384, 672, -648},
{ 416, 696, -616},
{ 408, 632, -640},
{ 408, 496, -656},
{ 416, 584, -640},
{ 400, 656, -632},
{ 400, 592, -... | { 400, 496, -736},
{ 400, 496, -744},
{ 400, 496, -728},
{ 400, 504, -736},
{ 408, 504, -736},
{ 400, 480, -736},
{ 392, 504, -728},
{ 400, 496, -736},
{ 400, 496, -728},
{ 400, 504, -728},
{ 408, 512, -728},
{ 400, 488, -736},
{ 400, 504, -728},
// 238 seconds
... | |
/*
* 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 (ctx->block_is_terminated) {
ctx->output[ctx->decoded_length++] = '\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... | graphics_context_set_fill_color(ctx, kino_layer->background_color) | ;
graphics_fill_rect(ctx, &kino_layer->layer.bounds);
}
// Draw Reel
KinoReel *reel = kino_player_get_reel(&kino_layer->player);
if (reel == NULL) {
return;
}
const GRect reel_bounds = kino_layer_get_reel_bounds(kino_layer);
kino_player_draw(&kino_layer->player, ctx, reel_bounds.origin);
}
////... |
/*
* 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(result, 3) | ;
}
void test_stats__median(void) {
const int32_t data[] = { 10, 40, 6, 32, 73, 80, 34, 25, 62 };
const size_t num_data = ARRAY_LENGTH(data);
const StatsBasicOp op = StatsBasicOp_Median;
int32_t result;
stats_calculate_basic(op, data, num_data, NULL, NULL, &result);
cl_assert_equal_i(result, 34);
}
void t... |
dma_config.DMA_MemoryBurst = DMA_MemoryBurst_Single;
dma_config.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
dma_config.DMA_Memory0BaseAddr = (uint32_t)buffer;
dma_config.DMA_BufferSize = size;
DMA_Init(FLASH_DMA_STREAM, &dma_config);
/* TX DMA config */
dma_config.DMA_Channel = FLASH_TX_DMA_CHANNE... | flash_send_and_receive_byte(FLASH_CMD_CLEAR_FLAG_STATUS_REG) | ;
flash_end_cmd();
}
/**
* Write up to 1 page (256B) of data to flash. start_addr DOES NOT
* need to be paged aligned. When writing into the middle of a page
* (addr & 0xFFF > 0), overrunning the length of the page will cause
* the write to "wrap around" and will modify (i.e. corrupt) data
* stored before the 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... | GPIO_Init(af_config->gpio, &init) | ;
gpio_release(af_config->gpio);
}
void gpio_af_configure_low_power(const AfConfig *af_config) {
GPIO_InitTypeDef init = {
.GPIO_Pin = af_config->gpio_pin,
.GPIO_Mode = GPIO_Mode_AN,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_PuPd = GPIO_PuPd_NOPULL
};
gpio_use(af_config->gpio);
GPIO_Init(af_conf... |
tions under the License.
*/
#include "debug.h"
#include "advanced_logging.h"
#include "flash_logging.h"
#include "debug_reboot_reason.h"
#include "drivers/watchdog.h"
#include "flash_region/flash_region.h"
#include "kernel/events.h"
#include "kernel/logging_private.h"
#include "kernel/pbl_malloc.h"
#include "kernel... | prv_put_status_event(DebugInfoStateStarted) | ;
// Temporarily disable logging so we don't log forever.
flash_logging_set_enabled(false);
s_bt_dump_chunk_callback_data.in_progress = true;
s_bt_dump_chunk_callback_data.generation = generation;
s_bt_dump_chunk_callback_data.comm_session = session;
s_bt_dump_chunk_callback_data.cookie = cookie;
flash... |
fs_write(fd, (uint8_t *)string, strlen(string));
cl_assert_equal_i(rv, strlen(string));
int tmp_fd = pfs_open(file, OP_FLAG_OVERWRITE, FILE_TYPE_STATIC, strlen(overwrite_string));
cl_assert(fd >= 0);
pfs_init(false); // simulate a reboot
uint8_t read_buf[strlen(string)];
fd = pfs_open(file, OP_FLAG_READ, ... | pfs_close_and_remove(fd[i]) | , S_SUCCESS);
}
// now make sure none of the files exist
for (int i = 0; i < NUM_ENTRIES; i++) {
int temp_fd = pfs_open(fname[i], OP_FLAG_READ, 0, 0);
cl_assert(temp_fd == E_DOES_NOT_EXIST);
}
}
void test_pfs__discontiguous_page_test(void) {
pfs_format(false /* write erase headers */); // start wit... |
/*
* 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... | {
diff_pos = ctx->touch_queue.events[queue_idx].diff_pos;
} |
}
TouchEvent *event = &ctx->touch_queue.events[queue_idx];
*event = (TouchEvent) {
.index = touch_idx,
.type = type,
.start_pos = ctx->start_pos,
.start_time_ms = ctx->start_time_ms,
.start_pressure = ctx->start_pressure,
.diff_pos = (type == TouchEvent_Touchdown) ? GPointZero : diff_pos,... |
184, -168},
{ 1344, 280, -240},
{ 1040, 320, -216},
{ 1032, 320, -240},
{ 1088, 280, -16},
{ 1144, 352, 32},
{ 1016, 392, 0},
{ 1104, 472, 0},
{ 1304, 616, 72},
{ 912, 848, 40},
{ 1304, 928, -256},
{ 1208, 496, -128},
// 16 seconds
{ 960, 456, -120},
{ 1384, 592, ... | { 1024, 208, -24},
{ 1000, 328, 48},
{ 912, 392, 96},
{ 752, 416, -24},
{ 632, 296, -40},
{ 640, 336, 0},
{ 880, 384, 48},
{ 1096, 496, 16},
{ 1040, 744, -184},
{ 1000, 616, -64},
{ 960, 424, -136},
{ 816, 376, -136},
{ 1312, 640, 8},
{ 2112, 176, 328},
{ 1680... |
{ 880, 1016, -216},
{ 1016, 584, -56},
// 24 seconds
{ 1168, 552, 168},
{ 1296, 352, 96},
{ 1216, 216, -32},
{ 1120, 136, -88},
{ 1088, 344, -120},
{ 1168, 520, -64},
{ 1264, 600, -32},
{ 1248, 424, 8},
{ 1376, 328, -96},
{ 1144, 144, -208},
{ 960, -312, -48},
... |
", time_buf);
// June 9th 2015, 14:00:00 (T-02:00:00)
rtc_set_time(event_time - (2 * SECONDS_PER_HOUR));
clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("In 2 hours", time_buf);
// June 9th 2015, 15:59:00 (T-00:01:00)
rtc_set_time(event_time - (1 * SECONDS... | clock_get_month_named_abbrev_date(time_buf, sizeof(time_buf), format_time) | |
playback rate (Apple's Podcast app can vary the playback rate)
//! -100 = backwards at normal rate
int32_t playback_rate_percent;
//! The current playback state
MusicPlayState playback_state;
} s_music_ctx;
void music_init(void) {
s_music_ctx.mutex = mutex_create_recursive();
}
static void copy_and_trunca... | {
// TODO: actually do something with this
off_t o = offsetof(__typeof__(s_music_ctx), player_name);
prv_update_string_and_put_event(player_name, player_name_length, o);
} | |
session_when_found_pebble_app();
// Simulate getting "Reset Complete" from remote:
prv_receive_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]);
// No crash etc, client still alive:
cl_assert_equal_i(ppogatt_client_count(), 1);
cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app... | (&s_meta_v0_system.app_uuid) | ;
// Get s_rx_window_size packets in flight:
for (sn = 0; sn < s_tx_window_size; ++sn) {
const bool success = fake_comm_session_send_buffer_write_raw_by_transport(transport,
s_short_data_fragment,
... |
/*
* 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... | dialog_set_text(dialog, i18n_get("Your screen may need calibration. Calibrate it now?",
confirmation_dialog)) | ;
dialog_set_background_color(dialog, GColorMediumAquamarine);
dialog_set_icon(dialog, RESOURCE_ID_GENERIC_PIN_TINY);
confirmation_dialog_set_click_config_provider(confirmation_dialog,
prv_calibrate_click_config);
confirmation_dialog_push(confirmation_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... | (window_root_layer, launcher_menu_layer_get_layer(launcher_menu_layer)) | |
lue
// 38 - CCCD
// 39 - Characteristic (R): Sensor Location (UUID: 0x2A38)
// 40 - Value
// 41 - Characteristic (W): Heart Rate Control Point (UUID: 0x2A39)
// 42 - Value
//
// 57344 (0xE000) - Service: PPoGATT Work-around Service (UUID: TBD)
static bool s_has_registered = false;
static PebbleMutex *s... | {
ble_error_t rv = __real_ble_gap_per_pref_conn_params_set(conn_params);
gatt_local_services_re_register_if_needed();
return rv;
} |
extern ble_error_t __real_ble_gap_role_set(const gap_role_t role);
ble_error_t __wrap_ble_gap_role_set(const gap_role_t role) {
ble_error_t rv = __real_ble_gap_role_set(role);
gatt_local_services_re_register_if_needed();
return rv;
}
extern ble_error_t __real_ble_gap_mtu_size_set(uint16_t mtu_size);
ble_error_... |
/*
* 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... | layer_set_update_proc(&layer, &across_y_layer_update_callback) | ;
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_across_y_origin_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_y_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.... |
pdate event");
} else if (event == HealthEventHeartRateUpdate) {
prv_hr_update_text(data);
} else if (event == HealthEventMetricAlert) {
HealthValue now_bpm = health_service_peek_current_value(HealthMetricHeartRateBPM);
APP_LOG(APP_LOG_LEVEL_INFO, "Crossed HR threshold of %d. HR: %"PRIi32" ",
... | text_layer_set_background_color(data->steps_card.msg_layer, GColorClear) | ;
text_layer_set_text_color(data->steps_card.msg_layer, GColorWhite);
layer_add_child(window_layer, text_layer_get_layer(data->steps_card.msg_layer));
snprintf(data->steps_card.msg_text, sizeof(data->steps_card.msg_text),
"Tracking disabled\n\nHold down button for settings menu");
text_layer_set_text... |
s file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS... | {
set_text_element(data->alpha_text, data->alpha_text_buffer, true);
} | else {
set_text_element(data->alpha_text, data->alpha_text_buffer, false);
}
// Set FG Text
strncpy(data->fg_text_buffer, "FG =", sizeof(data->fg_text_buffer));
if (data->property == PROPERTY_FG_COLOR) {
set_text_element(data->fg_text, data->fg_text_buffer, true);
} else {
set_text_element(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... | flash_crc32(start_address, firmware_description->firmware_length) | ;
#endif
PBL_LOG(LOG_LEVEL_DEBUG, "CRCing recovery... done");
return calculated_crc == firmware_description->checksum;
}
|
/*
* 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 data_byte = ((uint8_t *)data)[i];
checksum += data_byte;
prv_hexlify(&record->data[i*2], data_byte, sizeof(data_byte));
} |
prv_hexlify(&record->data[data_len*2], ~checksum + 1, sizeof(checksum));
}
|
i < num_pages(); i++) {
snprintf(file_small, sizeof(file_small), "file%d", i);
snprintf(buf_small, sizeof(buf_small), "This is small buf_small %d!", i);
int len = strlen(buf_small);
int fd = pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, len);
cl_assert(fd >= 0);
cl_assert(pfs_write(fd, ... | strlen(overwrite_string) | ) == 0);
pfs_close(fd);
}
void test_pfs__seek(void) {
int len = 10;
int fd = pfs_open("newfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, len);
cl_assert(fd >= 0);
int rv = pfs_seek(fd, len, FSeekSet);
cl_assert(rv == len);
rv = pfs_seek(fd, 0, FSeekCur);
cl_assert(rv == len);
rv = pfs_seek(fd, -5, FSeekCu... |
ssionCloseReason_UnderlyingDisconnection);
fake_system_task_callbacks_invoke_pending(); // get dls called
cl_assert_equal_b(s_dls_private_handle_disconnect_called, true);
cl_assert_equal_b(s_comm_session_event_put, true);
}
void test_session__get_type_app(void) {
Transport *transport = (Transport *) TransportI... | cl_assert_equal_b(comm_session_is_valid(session), true) | ;
// Expect assert when Transport didn't clean up after itself:
cl_assert_passert(comm_session_deinit());
comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection);
}
void test_session__send_next_deduping(void) {
Transport *transport = (Transport *) TransportID1;
CommSession *session = comm... |
==============================
static void stuck_timer_callback(void* data)
{
PBL_LOG(LOG_LEVEL_DEBUG, "STT: Entering infinite loop in timer callback");
while (true) {
psleep(100);
}
}
static void stuck_system_task_callback(void *data) {
PBL_LOG(LOG_LEVEL_DEBUG, "Entering infinite loop in system task callb... | PBL_LOG(LOG_LEVEL_INFO, "Calling core_dump FreeRTOS ISR") | ;
s_call_core_dump_from_isr = true;
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_WKUP_IRQn;
// Lower values are higher priority - make this same or lower priority than a FreeRTOS ISR
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = (configMAX_SYSCALL_INTERR... |
r(ListNode* node, void* data) {
AnimationPrivate* animation = (AnimationPrivate *)node;
ParentChildInfo *info = (ParentChildInfo *)data;
return animation->parent == info->parent && animation->child_idx == info->child_idx;
}
static AnimationPrivate* prv_find_animation_by_parent_child_idx(AnimationState *state,
... | {
// For a spawn animation, get the max of each component
uint32_t max_child_duration = 0;
for (child_idx = 0; child_idx < ANIMATION_MAX_CHILDREN; child_idx++) {
AnimationPrivate *child = prv_find_animation_by_parent_child_idx(state, animation, child_idx);
if (!child) {
break;
}
... | else {
PBL_ASSERTN(animation->type == AnimationTypePrimitive);
duration += animation->duration_ms;
}
if (include_play_count) {
// Factor in the play count of this animation now
if (animation->play_count == ANIMATION_PLAY_COUNT_INFINITE_STORED) {
duration = PLAY_DURATION_INFINITE;
} else ... |
0,
HealthAggregationAvg, HealthServiceTimeScopeOnce);
cl_assert_equal_i(123, result);
// The function call is the equivalent to `peek_value` with HeartRateBPM except for the
// time stamps, make sure it returns 0 because we haven't filled in that data)
result = heal... | prv_update_stats(&daily_stats, value) | ;
}
// ----------------------------------------
// Compute each combination of agg/stat and compare to expected
for (HealthAggregation agg = HealthAggregationSum; agg <= HealthAggregationMax; agg++) {
for (HealthServiceTimeScope scope = HealthServiceTimeScopeOnce;
scope <= HealthServiceTimeScopeD... |
sk_watchdog.h"
#include "stubs_app_state.h"
#include "stubs_worker_state.h"
// Overrides
//////////////////////////////////////////////////////////
void sys_get_time_ms(time_t *t, uint16_t *out_ms) {}
time_t sys_time_utc_to_local(time_t t) {
return t;
}
const char *get_timezone_abbr(void) {
static const char s_t... | (tmbuf, "+0000") | |
ar_buffer_get_write_space_remaining(&buffer), 6);
// Make client2 fall behind
cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "abcdef", 6, false));
cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 0);
cl_assert(shared_circular_buffer_read(&buffer, &client1, 3, &out_buff... | (shared_circular_buffer_write(
&buffer, (uint8_t*)"0a1b2c3d4e5f6g7h8i", 9*item_size, false)) | ;
items_read = shared_circular_buffer_read_subsampled(
&buffer, &client, item_size, out_buffer, 100);
cl_assert_equal_i(items_read, 4);
cl_assert_equal_m(out_buffer, "0a3d5f8i", 8);
cl_assert(shared_circular_buffer_write(
&buffer, (uint8_t*)"9j0k1m2n3o4p5q", 7*item_size, false));
items_read = sha... |
atter)
ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_1, &addr_out, &link_key_out,
name_out, &platform_bits_out);
cl_assert(ret);
cl_assert_equal_m(&addr_2, &addr_out, sizeof(addr_out));
cl_assert_equal_m(&link_key_2, &link_key_out, sizeof(link_ke... | (&addr_in, &link_key_in,
name_in, &platform_bits_in) | ;
prv_fire_writeback_timer();
cl_assert(id != BT_BONDING_ID_INVALID);
// And delete is again
bt_persistent_storage_delete_bt_classic_pairing_by_id(id);
// Try to read it back
ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out,
... |
e state that the
// bootloader leaves behind. This includes disabling the PLL.
// GPIOs are not reset here: resetting them would change their output values,
// which could unintentionally turn of e.g. PMIC power rails.
// The backup domain is not reset; that would be foolish.
const uint32_t ahb1_periphs =
... | boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_THREE) | ;
break;
case 5:
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE);
break;
case 6:
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE);
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO);
break;
case 7:
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE);
break;
default:
PBL_CROAK("reset loop boot ... |
fake_system_task_callbacks_invoke_pending();
HRMSessionRef session_ref_2 = hrm_manager_subscribe_with_callback(INSTALL_ID_INVALID, 1,
expire_s, HRMFeature_BPM,
prv_fake_hrm_2_cb, NULL);... | cl_assert_equal_b(memcmp(&event[i], &out_event[i], sizeof(PebbleHRMEvent)), false) | ;
}
}
{ // Test reading back unaligned
for (int i = 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_c... |
buffer,
buf_end);
}
// -----------------------------------------------------------------------------
static int prv_get_serialized_action_group_size(TimelineItemActionGroup *action_group) {
int size = action_group->num_actions * sizeof(SerializedAction... | {
buffer = prv_serialize_group_element(type, group_ptr, buffer, buf_end);
} |
return buffer - buf_start;
}
|
/*
* 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 false;
} | |
AppId_Loader) {
// This shouldn't happen. The application firmware should have been
// flashed during boot.
PBL_LOG(LOG_LEVEL_ERROR,
"AS7000 booted into loader! Something is very wrong.");
goto failed;
}
// check that we can communicate with this chip
if (info.protocol_version_major !... | resource_size(
SYSTEM_APP, RESOURCE_ID_AS7000_FW_IMAGE) | ;
if (update_length == 0) {
// We don't have a firmware to write so there's no point in booting
// the HRM.
PBL_LOG(LOG_LEVEL_DEBUG, "No HRM FW update available");
return;
}
AS7000FWUpdateHeader image_header;
if (resource_load_byte_range_system(
SYSTEM_APP, RESOURCE_ID_AS7000_FW_IMAGE, ... |
ase AttributeTypeUint32List:
return Uint32ListSize(attr->uint32_list->num_values);
default:
// The rest of the types fit within the Attribute struct
return 0;
}
}
static bool prv_deep_copy_attribute(Attribute *dest, const Attribute *src, uint8_t **buffer,
uin... | (list, id) | ->uint8 = uint8;
}
void attribute_list_add_string_list(AttributeList *list, AttributeId id, StringList *string_list) {
PBL_ASSERTN(prv_attribute_type(id) == AttributeTypeStringList);
prv_add_attribute(list, id)->string_list = string_list;
}
void attribute_list_add_uint32_list(AttributeList *list, AttributeId id, ... |
al/accessory/smartstrap_connection.h"
#include "services/normal/accessory/smartstrap_link_control.h"
#include "services/normal/accessory/smartstrap_state.h"
#include "syscall/syscall.h"
#include "syscall/syscall_internal.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/math.h"
#include <stddef... | smartstrap_fsm_state_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... | while (true) {
psleep(100);
} | |
{ 0, 0x74, 0, 148, 0},
{ 0, 0x74, 0, 148, 0},
{ 0, 0x74, 0, 144, 0},
{ 0, 0x74, 0, 148, 0},
{ 0, 0x74, 0, 148, 0},
{ 0, 0x74, 0, 148, 0},
{ 0, 0x74, 0, 148, 0},
{ 0, 0x74, 0, 144, 0},
// 345: Local time: 2016-03-02 01:50:00 AM
{ 0, 0x74, 0, 148, 0},
{ 0, 0x74, 0, 148, 0},
... | { 0, 0x78, 258, 148, 0},
{ 0, 0x69, 0, 144, 0},
// 450: Local time: 2016-03-02 03:35:00 AM
{ 0, 0x6a, 0, 148, 0},
{ 0, 0x78, 302, 148, 0},
{ 0, 0x78, 73, 148, 0},
{ 0, 0x78, 0, 148, 0},
{ 0, 0x78, 1155, 149, 0},
{ 0, 0x77, 0, 148, 0},
{ 0, 0x68, 1171, 148, 0},
{ 0, 0x69, 0, 1... |
{ 0, 0x55, 402, 146, 0},
{ 0, 0x55, 28, 146, 0},
{ 16, 0x53, 5328, 160, 0},
{ 13, 0x53, 5607, 146, 0},
{ 15, 0x54, 1394, 146, 0},
{ 0, 0x34, 0, 146, 0},
{ 0, 0x34, 0, 147, 0},
{ 0, 0x34, 200, 143, 0},
{ 0, 0x34, 0, 147, 0},
{ 0, 0x34, 1, 147, 0},
{ 0, 0x34, 0, 147, 0},
{... |
, true);
fake_kernel_malloc_mark();
uint8_t storage_alt[BUFFER_SIZE];
success = app_inbox_service_register(storage_alt, sizeof(storage_alt),
test_alt_message_handler, test_alt_dropped_handler,
AppInboxServiceTagUnitTest /* same tag! */... | (AppInboxServiceTagUnitTest,
s_test_data, BUFFER_SIZE) | );
}
void test_app_inbox__app_inbox_service_write_not_enough_space(void) {
prv_create_test_inbox_and_begin_write();
cl_assert_equal_b(false, app_inbox_service_write(AppInboxServiceTagUnitTest,
s_test_data, BUFFER_SIZE + 1));
// A continuation should also fail, ... |
}
bool ppogatt_emulated_server_handle_msg(uint16_t conn_idx, Connection *conn,
const HcProtocolMessage *msg) {
if (!ppogatt_emulated_server_wa_enabled(conn_idx)) {
return false;
}
HcGattHdr *hdr = (HcGattHdr *)&msg->payload[0];
uint16_t att_hdl = (msg->command_id =... | prv_convert_uuid_to_little_endian((const uint8_t[]){PEBBLE_BT_UUID_EXPAND(
PEBBLE_BT_PPOGATT_WATCH_SERVER_META_CHARACTERISTIC_UUID_32BIT)}, &uuid) | ;
PBL_ASSERTN(ble_gatts_add_characteristic(&uuid, GATT_PROP_READ, ATT_PERM_READ,
sizeof(PPoGATTMetaV1),
enable_read_cb_flag, NULL,
&ctx->att_hdl.meta) == BLE_STATUS_OK);
prv_convert_uuid... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | while (node) {
if (!iterator_func(node, ctx)) {
return false;
};
if (!layer_process_tree_level(node->first_child, ctx, iterator_func)) {
return false;
};
node = node->next_sibling;
} |
return true;
}
void layer_process_tree(Layer *node, void *ctx, LayerIteratorFunc iterator_func) {
layer_process_tree_level(node, ctx, iterator_func);
}
inline static Layer __attribute__((always_inline)) *prv_layer_tree_traverse_next(Layer *stack[],
int const stack_size, uint8_t *current_depth,
const bool... |
return app_menu_data_source_get_count(data->data_source);
} else {
return 0;
}
}
static void prv_reload_menu_data(void *context) {
SettingsActivityTrackerData *data = context;
const uint16_t count = prv_num_rows(data);
const bool use_icons = (count != 0);
option_menu_set_icons_enabled(&data->option_m... | PBL_IF_RECT_ELSE(prv_draw_no_activities_cell_rect,
prv_draw_no_activities_cell_round) |
(ctx, cell_layer, no_background_apps_string);
return;
}
const char *title = NULL;
if (row == 0) {
title = i18n_get("None", data);
} else {
AppMenuNode *node = app_menu_data_source_get_node_at_index(data->data_source, row - 1);
title = node->name;
}
option_menu_system_... |
data->peek_animation = NULL;
data->peek_layer = NULL;
data->peek_icon_info = (TimelineResourceInfo) {
.res_id = TIMELINE_RESOURCE_INVALID,
.app_id = NULL,
.fallback_id = TIMELINE_RESOURCE_INVALID
};
data->action_menu = NULL;
data->dnd_icon_visible = false;
Window *window = &data->window;
w... | notifications_presented_list_first() | |
/*
* 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... | (FONT_KEY_GOTHIC_24_BOLD) | |
/*
* 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_assert_key_is_equal_to_rng_key(&keys[SMRootKeyTypeEncryption], SMRootKeyTypeEncryption) | ;
prv_assert_key_is_equal_to_rng_key(&keys[SMRootKeyTypeIdentity], SMRootKeyTypeIdentity);
prv_assert_key_is_equal_to_rng_key(&s_stored_keys[SMRootKeyTypeEncryption], SMRootKeyTypeEncryption);
prv_assert_key_is_equal_to_rng_key(&s_stored_keys[SMRootKeyTypeIdentity], SMRootKeyTypeIdentity);
}
void test_ble_root_k... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | TIM_ARRPreloadConfig(pwm->timer.peripheral, ENABLE) | ;
}
periph_config_disable(pwm->timer.peripheral, pwm->timer.config_clock);
}
void pwm_set_duty_cycle(const PwmConfig *pwm, uint32_t duty_cycle) {
if (IS_LPTIM(pwm->timer.peripheral)) {
LPTIM_SetCompareValue(pwm->timer.lp_peripheral, duty_cycle);
LPTIM_SelectOperatingMode(pwm->timer.lp_peripheral, LPTIM_... |
(start_connected /* is_connected */) | ;
}
static void prv_postmessageconnected_postmessagedisconnected_negotiate_to_open_session(void) {
// Negotiate:
RCV_RESET_REQUEST();
EXPECT_OUTBOX_RESET_COMPLETE_PENDING();
prv_rcv_app_message_ack(APP_MSG_OK);
cl_assert_equal_i(rocky_api_app_message_get_state(),
PostMessageStateAwaitin... | |
/*
* 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 WATCH_INFO_MODEL_PEBBLE_2_SE;
case WATCH_INFO_COLOR_PEBBLE_TIME_2_BLACK:
case WATCH_INFO_COLOR_PEBBLE_TIME_2_SILVER:
case WATCH_INFO_COLOR_PEBBLE_TIME_2_GOLD:
return WATCH_INFO_MODEL_PEBBLE_TIME_2;
case WATCH_INFO_COLOR_UNKNOWN:
case WATCH_INFO_COLOR__MAX:
return WATCH_INFO_... |
// Should never be reached
return WATCH_INFO_MODEL_UNKNOWN;
}
WatchInfoVersion watch_info_get_firmware_version(void) {
return (WatchInfoVersion) {
.major = GIT_MAJOR_VERSION,
.minor = GIT_MINOR_VERSION,
.patch = GIT_PATCH_VERSION
};
}
|
Node **service_node_out) {
return 0;
}
uint8_t gatt_client_copy_service_refs_by_discovery_generation(
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 *co... | {
fake_gatt_put_discovery_indication_gatt_profile_service(TEST_GATT_CONNECTION_ID,
true /* has_service_changed_characteristic */);
const uint8_t value;
const bool handled = gatt_service_changed_client_handle_indication(&s_connection, 0xfffe,
... |
void test_gatt_service_changed_client__handle_indication_service_changed(void) {
fake_gatt_put_discovery_indication_gatt_profile_service(TEST_GATT_CONNECTION_ID,
true /* has_service_changed_characteristic */);
const uint16_t att_handle = fake_gatt_gatt_profile_... |
CommSession *system_session = comm_session_get_system_session();
comm_session_send_data(system_session, ENDPOINT_ID, buffer, sizeof(buffer), COMM_SESSION_DEFAULT_TIMEOUT);
PBL_LOG(LOG_LEVEL_DEBUG, "Sending sysmsg: %u", type);
}
static void prv_reset_kernel_bg_cb(void *unused) {
PBL_LOG(LOG_LEVEL_ALWAYS, "Reboo... | prv_handle_firmware_status_request(session) | ;
break;
case SysMsgFirmwareComplete: {
PBL_LOG_VERBOSE("Firmware transfer succeeded, okay to restart!");
PebbleEvent e = {
.type = PEBBLE_SYSTEM_MESSAGE_EVENT,
.firmware_update.type = PebbleSystemMessageFirmwareUpdateComplete,
};
event_put(&e);
prv_handle_firmware_complete_msg();... |
bscribe(BUTTON_ID_DOWN, prv_end_workout_down_click_handler);
}
static void prv_end_workout(void *context) {
WorkoutActiveWindow *active_window = context;
WorkoutDialog *workout_dialog = &active_window->end_workout_dialog;
workout_dialog_init(workout_dialog, "Workout End");
Dialog *dialog = workout_dialog_get... | {
WorkoutActiveWindow *active_window = window_get_user_data(window);
if (active_window) {
app_timer_cancel(active_window->update_timer);
app_timer_cancel(active_window->hr_measuring_timer);
gbitmap_destroy(active_window->action_bar_start);
gbitmap_destroy(active_window->action_bar_pause);
gbitma... |
////////////////////////////////////////////////////////////////////////////////////////////////////
//! Common Setup
static void prv_create_window_common(WorkoutActiveWindow *active_window,
void *workout_data,
WorkoutController *workout_contro... |
and don't support anything other than 12.5hz for jitter-free sampling. We chose
// this rate because it divides evenly into all the native rates we support right now.
// Supporting a wider range of jitter-free rates is harder due to dealing with all the potential
// combinations of different subscribers asking f... | (s_accel_manager_mutex) | ;
return empty;
}
void accel_cb_new_sample(AccelDriverSample const *data) {
prv_update_last_accel_data(data);
s_accel_samples_collected_count++;
if (!s_buffer.clients) {
return; // no clients so don't buffer any data
}
AccelManagerBufferData accel_buffer_data;
accel_buffer_data.rawdata.x = data->x... |
ar_layer,
StatusBarLayerSeparatorMode mode) {
PBL_ASSERTN(status_bar_layer);
status_bar_layer->config.separator.mode = mode;
layer_mark_dirty(&(status_bar_layer->layer));
}
void status_bar_layer_set_separator_load_percentage(StatusBarLayer *status_bar_layer,
... | (ctx, config->background_color) | ;
graphics_fill_rect(ctx, bounds);
}
// Set context text color and compositing mode
graphics_context_set_text_color(ctx, config->foreground_color);
graphics_context_set_compositing_mode(ctx, GCompOpSet);
// update title buffer with time if in StatusBarLayerModeClock
if (config->mode == StatusBarLayerM... |
--------
bool shared_circular_buffer_consume(SharedCircularBuffer* buffer, SharedCircularBufferClient *client, uint16_t length) {
PBL_ASSERTN(list_contains(buffer->clients, &client->list_node));
uint32_t data_length = prv_get_data_length(buffer, client);
if (data_length < length) {
return false;
}
client... | {
num_items = MIN(num_items, bytes_available / item_size);
uint16_t bytes_out;
shared_circular_buffer_read_consume(
buffer, &client->buffer_client, num_items * item_size,
(uint8_t *)data, &bytes_out);
PBL_ASSERTN(bytes_out == num_items * item_size);
return num_items;
} | |
f we successfully loaded a glance, set its service field
if (glance) {
glance->service = service;
}
return glance;
}
static LauncherAppGlanceCacheEntry *prv_find_glance_entry_in_cache(
LauncherAppGlanceService *service, Uuid *uuid) {
return (LauncherAppGlanceCacheEntry *)list_find(service->glance_cache,... | {
if (!service) {
return;
}
kino_player_rewind(&service->glance_reel_player);
} |
void launcher_app_glance_service_pause_current_glance(LauncherAppGlanceService *service) {
if (!service) {
return;
}
kino_player_pause(&service->glance_reel_player);
}
void launcher_app_glance_service_play_current_glance(LauncherAppGlanceService *service) {
if (!service) {
return;
}
kino_player_p... |
ntry) * font_res->md.hash_table_size) +
(prv_offset_table_entry_size(&font_res->md) * font_res->md.number_of_glyphs) +
offset;
}
return address;
}
//! Decode RLE4 decoded glyph data in place.
//! @return g or NULL on error.
#define RLE4_SYMBOL_MASK 0x08
#define RLE4_LENGTH_MASK 0x07
st... | {
GlyphData *g = &data->glyph_data;
const size_t bitmap_offset = (FONT_VERSION(font_res->md.version) == FONT_VERSION_1) ?
sizeof(GlyphHeaderDataV1) : sizeof(GlyphHeaderData);
const uint32_t bitmap_addr = data->resource_offset + bitmap_offset;
size_t glyph_size_bytes;
// Handl... |
// Load the glyph data at the end of the buffer
target = &((uint8_t *)g->data)[CACHE_GLYPH_SIZE - glyph_size_bytes];
} else {
target = (uint8_t *)g->data;
}
SYS_PROFILER_NODE_START(text_render_flash);
size_t num_bytes_loaded = sys_resource_load_range(font_res->app_num, font_res->resou... |
RRAY_LENGTH(scrollable_metrics), scrollable_metrics,
&s_sports_data, &s_sports_controller);
prv_create_window_and_render(active_window, 0);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_workout_active__sports_pace_long_values(void) {
s_sports_data = (SportsData) {
.current_bp... | (&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
void test_workout_active__sports_hr_z2(void) {
s_sports_data = (SportsData) {
.current_bpm = 165,
.duration_string = "30:00",
.distance_string = "5.0",
.pace_string = "6:00",
};
WorkoutMetricType top_metric = WorkoutMetricType_Duration;
WorkoutMetricType middle_metric = WorkoutMetricType_... |
/*
* 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 ((end <= (uint8_t *) command) ||
!gdraw_command_validate(command, end - (uint8_t *) command)) {
return false;
}
command = prv_next_command(command);
} |
return ((uint8_t *) command <= end);
}
void *gdraw_command_list_iterate_private(GDrawCommandList *command_list,
GDrawCommandListIteratorCb handle_command,
void *callback_context) {
if (!command_list) {
return NULL;
}
GDrawCommand *command... |
4BitPalette,
.bitmap_create_func = prv_create_bitmap_from_png_file,
.need_to_destroy_bitmap = true,
},
{
.test_name = "8bitTrns",
.expected_test_image_bitmap_format = GBitmapFormat8Bit,
.bitmap_create_func = prv_create_bitmap_from_png_file,
.need_to_destroy_bitmap = true,
},
#endif
};
#de... | gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.