prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
TimelineItemId)));
}
void test_reminder_db__wrong_type_test(void) {
TimelineItem not_a_reminder = {
.header = {
.id = {0x99, 0xcb, 0x7c, 0x75, 0x8a, 0x35, 0x44, 0x87,
0x90, 0xa4, 0x91, 0x3f, 0x1f, 0xa6, 0x76, 0x01},
.timestamp = 0,
.duration = 0,
.type = TimelineItemTypeNot... | cl_assert_equal_i(reminder_db_is_dirty(&is_dirty), S_SUCCESS) | ;
cl_assert(is_dirty);
BlobDBDirtyItem *dirty_list = reminder_db_get_dirty_list();
cl_assert(dirty_list);
cl_assert(list_count((ListNode *)dirty_list) == num_reminders);
// Mark some items as synced
reminder_db_mark_synced((uint8_t *)&item1.header.id, sizeof(TimelineItemId));
reminder_db_mark_synced((ui... |
// -------------------------------------------------------------------------------
// Feed in N minutes of light sleep
static void prv_feed_light_sleep_min(uint32_t minutes) {
// Light sleep produces minute statistics with step:0, variance:17-22, with
// one minute of high variance (511) every 3-10 minutes.
for ... | (ActivityMetricStepCount, 1, &steps_before) | ;
// Do some light and deep sleep
prv_feed_deep_sleep_min(60);
prv_feed_light_sleep_min(180);
prv_feed_deep_sleep_min(20);
// Capture steps before sleep
activity_get_metric(ActivityMetricSleepState, 1, &value);
PBL_LOG(LOG_LEVEL_DEBUG, "sleep state: %d", (int)value);
// See how many steps we took dur... |
61598,
61734,
61867,
61998,
62126,
62253,
62377,
62498,
62618,
62735,
62850,
62962,
63072,
63179,
63285,
63388,
63488,
63586,
63682,
63775,
63866,
63955,
64041,
64125,
64206,
64286,
64362,
64436,
64508,
64578,
64645,
64709,
64771,
64831,
64889,
64943,
64996,
65046,
65094,
65139,
65182,
65222,
65260,
65295,
65328,
65359... | ABS(angle) | % TRIG_MAX_ANGLE;
if (angle < 0) {
normalized_angle = TRIG_MAX_ANGLE - normalized_angle;
}
return normalized_angle;
}
|
/*
* 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, dest_row) | , GCompOpAssign,
GColorWhite);
}
}
static void prv_shift_framebuffer_rows(GBitmap *dest_bitmap, int16_t start_row, int16_t end_row,
int16_t shift_amount) {
GBitmap src_bitmap = *dest_bitmap;
prv_copy_framebuffer_rows(dest_bitmap, &src_bitmap, s... |
f,sz,_TRUNCATE,fmt,a,b)
# else
# define snprint_eq snprintf
# endif
typedef struct _stat STAT_T;
#else
# ifdef UNITTEST_DEBUG
# include <signal.h>
# endif
# include <sys/wait.h> /* waitpid(2) */
# include <unistd.h>
# define _MAIN_CC
# define snprint_eq snprintf
typedef struct stat STAT_T;
#endif
#include "cla... | clar_print_ontest(
test->name,
_clar.test_count,
(_clar.suite_errors > error_st)
) | ;
}
static void
clar_run_suite(const struct clar_suite *suite)
{
const struct clar_func *test = suite->tests;
size_t i;
if (!clar_category_is_suite_enabled(suite))
return;
if (_clar.exit_on_error && _clar.total_errors)
return;
if (!_clar.report_errors_only)
clar_print_onsuite(suite->name, suit... |
(dst_color, mask, data_offset, x, 1, blended_color) | ;
#else
*dst_color = blended_color;
#endif // CAPABILITY_HAS_MASKING
#endif // (SCREEN_COLOR_DEPTH_BITS == 8)
}
static ALWAYS_INLINE void prv_set_color(const GContext *ctx, GColor *dst_color,
unsigned int data_row_offset, int x, int width,
... | |
ponse = test_client_handle_write_response,
.handle_subscribe = test_client_handle_subscribe,
.handle_read_or_notification = test_client_handle_read_or_notification,
},
#else
[KernelLEClientPPoGATT] = {
.debug_name = "PPoG",
.service_uuid = &s_ppogatt_service_uuid,
.characteristic_uuids = s_ppoga... | bt_driver_classic_disconnect(NULL) | ;
bt_unlock();
}
static void prv_handle_services_removed(PebbleBLEGATTClientServicesRemoved *services_removed) {
PebbleBLEGATTClientServiceHandles *service_remove_info = &services_removed->handles[0];
for (int s = 0; s < services_removed->num_services_removed; s++) {
bool removed = false;
for (int c = 0;... |
app_state_set_user_data(data) | ;
Window *window = &data->window;
window_init(window, WINDOW_NAME("Morph Square Demo"));
window_set_user_data(window, data);
window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_window_load,
.appear = prv_window_appear,
.unload = prv_window_unload,
});
window_set_click_config_pro... | |
/*
* 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... | {
case CMD_PUSH:
// Incoming message:
app_message_inbox_receive(session, (AppMessagePush *) message, length, consumer_info);
return;
case CMD_REQUEST:
// Incoming request for an update push:
// TODO PBL-1636: decide to implement CMD_REQUEST, or remove it
return;
case C... |
}
//! Executes on KernelBG, sends back NACK on behalf of the app if it is not able to do so.
//! Note that app_message_receiver_dropped_handler will also get called on the App task,
//! to report the number of missed messages.
void app_message_app_protocol_system_nack_callback(CommSession *session,
... |
s_prv_reset_hr_stats();
activity_metrics_prv_get_median_hr_bpm(&median, &total_weight);
cl_assert_equal_i(median, 0);
// But the last stable BPM shouldn't get wiped
activity_get_metric(ActivityMetricHeartRateFilteredBPM, 1, &last_median);
activity_get_metric(ActivityMetricHeartRateFilteredUpdatedTimeUTC, 1, ... | cl_assert_equal_i(metric_values[0], 4444) | ;
// Set the current value to something smaller (will be ignored)
activity_metrics_prv_set_metric(ActivityMetricStepCount, Thursday, 1);
activity_get_metric(ActivityMetricStepCount, 1, metric_values);
cl_assert_equal_i(metric_values[0], 4444);
// Verify some other metrics work
activity_metrics_prv_set_met... |
// solve for d
plane_eq[3] = -(plane_eq[0] * s_samples[0][0] +
plane_eq[1] * s_samples[0][1] + plane_eq[2] * s_samples[0][2]);
// Distance^2 = (a * xo + b * yo + c * zo + d) / (a^2 + b^2 + c^2)
int64_t distance = ABS((plane_eq[0] * s_samples[idx_pt][0] +
plane_eq[1] * s_samples[idx_pt][1] + plane_e... | {
return (MagCalStatusNoSolution);
} |
}
// the sample has passed its distance threshold check so add it
PBL_LOG(LOG_LEVEL_DEBUG, "---> [%d] Adding %d %d %d \n",
s_sample_idx, (int)sample[0], (int)sample[1], (int)sample[2]);
s_sample_idx++;
if (s_sample_idx != 4) {
return (MagCalStatusNoSolution); // we need 4 pts before we can do a f... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(prv_convert_content_size_between_platforms(PreferredContentSizeLarge,
PlatformTypeEmery,
PlatformTypeBasalt),
PreferredContentSizeMedium) | ;
// Converting from Aplite to Emery should return one size larger
cl_assert_equal_i(prv_convert_content_size_between_platforms(PreferredContentSizeLarge,
PlatformTypeAplite,
PlatformTypeEm... |
PebbleEvent event = {
.type = PEBBLE_ACTIVITY_EVENT,
.activity_event = {
.type = PebbleActivityEvent_TrackingStopped,
},
};
event_put(&event);
}
// ------------------------------------------------------------------------------------------------
// Enable/disable activity service KernelBG callb... | if (!file) {
return false;
} |
// Write the new version
ActivitySettingsKey key = ActivitySettingsKeyVersion;
const uint16_t version = ACTIVITY_SETTINGS_CURRENT_VERSION;
if (version != written_version) {
settings_file_set(file, &key, sizeof(key), &version, sizeof(version));
}
// Init the current day index
time_t utc_now = rtc_ge... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ("No file specified. Pass a path to a QEMU SPI image. "
"(e.g. qemu_spi_cooker <spi_flash_img>)\n") | ;
return 1;
}
return prv_prebake_pfs(argv[1]);
}
|
"∂ƒ©˙∆˚¬…Ω≈√∫˜µ≤≥÷¡™£¢∞§¶•ªº–≠`“‘"
"«ÈÉÊËĒĖĘŸÛÜÙÚŪÎÏÍĪĮÌÔÖÒÓŒØŌÕÀÁÂÄÆÃÅĀŚ"
"ŠŁŽŹŻÇĆČÑŃ∑ˇ∏”’»˝¸˛◊ı˜¯˘¿"
"あいうえおかきくけこさしすせそたちつてとなに"
"ぬねのはひふへほまみむめもやゆよらりるれろわ"
"をんアイウエオサシスセソタチツテトナニヌネノ"
"ハヒフヘホマミムメモヤユヨラリルレロワヲン",
.lengths = {
#if... | strcmp(s_perftest_text_arguments.font_key, "RESOURCE_ID_GOTHIC_24_BOLD") | |
f
if (force_destroy || animation->defer_delete
|| ((allow_auto_destroy && animation->auto_destroy)
&& !prv_animation_is_scheduled(state, animation))) {
// It's possible the stopped handler rescheduled, so check before we destroy it
prv_unlink_and_free(state, animation);
}
}
// ----------... | 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;
}
uint32_t duration = prv_get_total_duration(state, child, true /*delay*/, true /*play_count*/);
... |
} else if (animation->type == AnimationTypeSpawn) {
// For a spawn animation, schedule each of the components in parallel
// If any of the children have already been scheduled, then we need to back up our start time
// of the spawn accordingly and adjust the delay_ms field of every child such that
... |
T_EVENTS; ++i) {
prv_read_event_from_buffer_and_consume(&cb, &out_event[i]);
cl_assert_equal_b(memcmp(&event[i], &out_event[i], sizeof(PebbleHRMEvent)), false);
}
}
}
#undef NUM_TEST_EVENTS
// Test the enable and disable functionality across subscriptions
void test_hrm_manager__enable_disable(void) {... | prv_advance_time_ms(1000) | ;
// Now add a 10 minute subscription back in.
AppInstallId app_id_2 = 2;
sys_hrm_manager_app_subscribe(app_id_2, 600, expire_s, features);
fake_system_task_callbacks_invoke_pending();
// We should stay enabled after each update because we still have the 10 second subscription
// too
prv_fake_send_new_... |
e this
// entry from the resource_list (since we don't want to delete it)
// note: resource_list may be updated if we happen to remove the first entry in the list
list_remove(&(iter->list_node), (ListNode**)resource_list, NULL);
kernel_free(iter); // free up the memory for the node we just remo... | (s_app_cache_mutex) | ;
{
SettingsFile file;
status_t rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE);
if (rv != S_SUCCESS) {
goto unlock;
}
exists = settings_file_exists(&file, (uint8_t *)&app_id, sizeof(AppInstallId));
if (exists && !app_storage_app_exists(app_id)) {
settings... |
/*
* 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... | task_zalloc_check(sizeof(RockyTimerCbData) +
cb_argc * sizeof(jerry_value_t)) | ;
*cb_data = (RockyTimerCbData){
.is_repeating = is_repeating,
.callback = callback,
.argc = cb_argc
};
// copy arguments over to cb_data
for (unsigned i = 0; i < cb_argc; i++) {
cb_data->argv[i] = argv[i + 2];
jerry_acquire_value(cb_data->argv[i]);
}
cb_data->timer = app_timer_register_... |
), 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), 21);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, ... | graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 7), 1) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | attribute_list_init_list(num_existing_attributes, &new_attr_list) | ;
// Copy over all the existing attributes to our new list
if (existing_notif_prefs) {
for (int i = 0; i < num_existing_attributes; i++) {
new_attr_list.attributes[i] = existing_notif_prefs->attr_list.attributes[i];
}
}
char msg_buffer[message->length + 1];
memcpy(msg_buffer, message->value, m... |
nnelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
// Setup timer 3 for periodic interrupts at TIMER_INTERRUPT_HZ
TIM_TimeBaseInitTypeDef tim_config;
TIM_TimeBaseStructInit(&tim_config);
tim_config.TIM_Prescaler = timer_find_prescaler(&BOARD_BT_WATCHDOG_TIMER.timer,
... | {
prv_lock();
circular_buffer_write_finish(&s_spi_transport.rx, s_spi_transport.bytes_receivable_count);
prv_unlock();
} | |
0, .tm_mon = 11, .tm_mday = 30, // 2014/12/30
.tm_wday = 2, .tm_yday = 363, // Tuesday, 364th day of the year
.tm_gmtoff = 0, .tm_isdst = 0, .tm_zone = "UTC", // No DST, UTC+0
};
struct tm jan_2_2015__13_00_00 = {
.tm_hour = 13, .tm_min = 0, .tm_sec = 0, // 13:00:00
.tm_year = 2015 - 1900, .tm_mon ... | strftime(tmbuf, sizeof(tmbuf), "%6Y %3y", &jan_2_10015__13_00_00) | ;
cl_assert_equal_s(tmbuf, "010015 015");
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%Z %%", &jan_2_10015__13_00_00);
cl_assert_equal_s(tmbuf, "UTC %");
}
extern size_t localized_strftime(char* s,
size_t maxsize, const char* format, const struct tm* tim_p, const char *locale);
void test_strftime_... |
eep);
activity_get_metric(ActivityMetricSleepRestfulSeconds, 1, &health_data->deep_sleep);
activity_get_metric(ActivityMetricSleepEnterAtSeconds, 1, &health_data->sleep_start);
activity_get_metric(ActivityMetricSleepExitAtSeconds, 1, &health_data->sleep_end);
activity_get_metric_typical(ActivityMetricSleepEnte... | {
total_steps_avg += health_data->step_averages.average[i];
} |
}
return total_steps_avg;
}
int32_t health_data_steps_get_current_average(HealthData *health_data) {
// get the current minutes into today
time_t utc_sec = rtc_get_time();
struct tm local_tm;
localtime_r(&utc_sec, &local_tm);
int32_t today_min = local_tm.tm_hour * MINUTES_PER_HOUR + local_tm.tm_min;
c... |
52, 96},
{ -1360, 136, 160},
{ -1296, 80, 160},
{ -1152, -120, 176},
{ -1208, -400, 128},
{ -976, -368, -256},
{ -1264, -224, -256},
{ -1640, -48, -208},
{ -1616, -8, -88},
{ -1592, -24, -40},
{ -1592, 16, 112},
{ -1568, 408, 208},
{ -1432, 416, 136},
{ -1416, 328, -1... | { -1280, -96, -176},
{ -1480, 32, -160},
{ -1448, 56, -144},
{ -1504, -48, 24},
{ -1624, 120, 72},
{ -1656, 288, 192},
{ -1600, 440, 224},
{ -1400, 704, 40},
{ -1272, 472, -8},
{ -1400, 784, 0},
{ -1168, 624, 176},
{ -1152, 824, 200},
// 59 seconds
{ -1080, 840, 3... | |
ring sleep:: %d", (int)(steps_after - steps_before));
if (steps_after - steps_before > 16) {
PBL_LOG(LOG_LEVEL_ERROR, "too many steps during sleep: test FAILED");
passed = false;
}
// Walk long enough to overlap with a periodic sleep recomputation
prv_feed_steps_min(2 * ACTIVITY_SESSION_UPDATE_MIN);
... | {
ActivitySession *session = &sessions[i];
PBL_LOG(LOG_LEVEL_DEBUG, " Found session type: %d, start_min: %d, length_min: %"PRIu16" ",
(int)session->type, time_util_get_minute_of_day(session->start_utc),
session->length_min);
if (session->start_utc < after_time) {
PBL_LOG(LOG_L... |
PBL_LOG(LOG_LEVEL_DEBUG, "Done looking for sessions");
}
// -------------------------------------------------------------------------------
static void prv_test_nap(void *context) {
bool passed = true;
activity_prefs_sleep_insights_set_enabled(true);
const time_t now_utc = rtc_get_time();
PBL_LOG(LOG_LEV... |
/*
* 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... | i2c_bus_rail_ctl_config((OutputConfig){ GPIOH, GPIO_Pin_0, true}) | |
0x0},
{ 0, 0x58, 0, 0x0},
{ 0, 0x68, 1425, 0x0},
{ 0, 0x63, 3776, 0x0},
{ 0, 0x73, 0, 0x0},
{ 0, 0x73, 0, 0x0},
{ 0, 0x73, 0, 0x0},
{ 0, 0x73, 0, 0x0},
{ 0, 0x73, 0, 0x0},
{ 0, 0x73, 0, 0x0},
{ 0, 0x73, 0, 0x0},
{ 0, 0x73, 0, 0x0},
{ 0, 0x73, 0, 0x0},
{ 0, 0x73, 0, 0... | { 0, 0x5b, 235, 0x0},
{ 0, 0x6b, 90, 0x0},
{ 0, 0x5b, 355, 0x0},
{ 0, 0x5b, 211, 0x0},
{ 0, 0x5b, 520, 0x0},
{ 0, 0x5b, 760, 0x0},
{ 0, 0x5b, 0, 0x0},
{ 0, 0x5b, 278, 0x0},
{ 0, 0x4b, 0, 0x0},
{ 0, 0x4b, 0, 0x0},
// 270: Local time: 03:35:00 AM
{ 0, 0x5b, 192, 0x0},
{... |
{ 0, 0x68, 0, 0x0},
{ 0, 0x68, 0, 0x0},
{ 7, 0x7f, 870, 0x0},
{ 0, 0x7f, 0, 0x0},
{ 0, 0x7f, 0, 0x0},
{ 0, 0x7f, 0, 0x0},
{ 0, 0x7f, 0, 0x0},
{ 0, 0x7f, 0, 0x0},
{ 0, 0x7f, 0, 0x0},
{ 0, 0x7f, 0, 0x0},
{ 0, 0x7f, 0, 0x0},
{ 0, 0x7f, 0, 0x0},
// 330: Local time: 04:35... |
_ny_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_ny_origin_layer.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_fill_rect_${BIT_DEPTH_NAME}__offset_layer(void) {
GContext ctx;
Layer layer;
test_graphics_context_init(&ctx, fb);
layer_in... | GRect(20, 80, 70, 20) | );
ctx.draw_state.fill_color.a = 3;
graphics_fill_rect(&ctx, &GRect(20, 110, 70, 20));
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_transparent.8bit.pbi"));
}
void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_radius(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// AA = true, SW ... |
SET_RECT_ODD, OFFSET_RECT_ODD, false, 1);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_COLS);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 2), MAX_NUM_COLS + 4);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 4), 0);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 6), 1);
... | {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// Test odd and even cols draw appropriately
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(12, 6), 10);
graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 6), 10);
grap... |
// Odd cols of different lengths
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(1, 0), MAX_NUM_ROWS);
graphics_draw_vertical_line_dotted(&ctx, GPoint(3, 0), MAX_NUM_ROWS + 4);
graphics_draw_vertical_line_dotted(&ctx, GPoint(5, 0... |
return status;
}
void voice_init(void) {
s_lock = mutex_create();
}
// This will kick off a dictation session. After the setup session message is sent via the
// voice control endpoint, we wait for a session ready response via the
// voice_handle_session_setup_result call or a session setup timeout occurs (timer c... | if (s_state != SessionState_StartSession &&
s_state != SessionState_AudioEndpointSetupReceived) {
PBL_LOG(LOG_LEVEL_WARNING, "Session setup result received when not expected, state=%d",
(int)s_state);
prv_cancel_session();
VoiceEventType event_type = (s_state <= SessionState_StartSession) ... | |
WAIT_TIME (100000)
// These are a bit dangerous on long erase commands, but they can also be very useful to find out
// why the QSPI driver is locking up when doing development
static void prv_wait_for_transfer_complete(void) {
int i = 0;
while (QSPI_GetFlagStatus(QSPI_FLAG_TC) == RESET) {
if (++i > QSPI_WAIT... | (dev, instruction, addr, dummy_cycles, is_ddr) | ;
prv_read_bytes(buffer, length);
QSPI_ClearFlag(QSPI_FLAG_TC);
prv_wait_for_not_busy();
}
void qspi_indirect_read_no_addr(QSPIPort *dev, uint8_t instruction, uint8_t dummy_cycles,
void *buffer, uint32_t length, bool is_ddr) {
prv_indirect_read(dev, instruction, QSPI_ADDR_NO_A... |
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
cl_assert(!iter_prev(&iterator));
timeline_iter_deinit(&iterator, &state, &head);
}
void test_timeline__skip_deleted_item(void) {
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head ... | (state.node->timestamp, 1425369600) | ;
cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY);
cl_assert_equal_i(state.current_day, midnight_march_2_pst + SECONDS_PER_DAY);
// no more
cl_assert(!iter_next(&iterator));
// 4 deletes
cl_assert(timeline_iter_remove_node_with_id(&head, &multiday_item.header.id));
cl_assert(timeline_iter_remov... |
{ 664, 24, -248},
{ 1480, 216, 64},
// 2 seconds
{ 2384, 432, -16},
{ 2632, 544, -168},
{ 2200, 528, 96},
{ 1928, 368, 40},
{ 1728, 376, 8},
{ 1416, 480, -176},
{ 1424, 408, -120},
{ 1512, 352, -48},
{ 1456, 448, -56},
{ 1400, 456, -112},
{ 1376, 496, -224},
{ 984... | { 1208, 136, -344},
{ 1384, 152, -264},
{ 1408, 120, -240},
{ 1336, 192, -192},
{ 1256, 336, -176},
{ 1120, 360, -144},
{ 1136, 360, -112},
{ 1168, 408, -152},
{ 1112, 448, -232},
{ 1008, 496, -280},
{ 736, 480, -160},
{ 512, 480, -88},
{ 784, 656, -112},
// 8 sec... |
{ 552, 600, -104},
{ 872, 728, -280},
{ 896, 568, -152},
{ 1160, 464, -208},
{ 1584, 640, -168},
{ 1928, 648, -136},
{ 1968, 336, -40},
{ 1776, 104, 0},
{ 1488, 104, -112},
{ 1240, 128, -144},
{ 1000, 120, -72},
{ 904, 64, -112},
{ 1040, 80, -136},
{ 944, 128, -1... |
de "applib/ui/ui.h"
#include "kernel/pbl_malloc.h"
#include "system/passert.h"
#include <string.h>
#include <stdio.h>
typedef struct AnimatedDemoData {
Window window;
TextLayer text_layer;
PropertyAnimation *prop_animation;
bool toggle;
} AnimatedDemoData;
static void animation_started(Animation *animation, ... | (window, data) | |
= 0,
.bitstream_version = 0,
};
s_session_id = audio_endpoint_setup_transfer(prv_audio_transfer_setup_complete_handler,
prv_audio_transfer_stopped_handler);
PBL_ASSERTN(s_session_id != AUDIO_ENDPOINT_SESSION_INVALID_ID);
PBL_LOG(LOG_LEVEL_INFO, "Send session... | (SessionState_VoiceEndpointSetupReceived) | ;
}
unlock:
mutex_unlock(s_lock);
}
static bool prv_get_string_size_cb(const TranscriptionWord *word, void *data) {
size_t *size = data;
*size += word->length + sizeof(char); // add 1 for space or null terminator
return true;
}
static bool prv_build_string_cb(const TranscriptionWord *word, void *data) {
c... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
ListNode *head = &dirty_list->node;
ListNode *cur;
while (head) {
cur = head;
list_remove(cur, &head, NULL);
kernel_free(cur);
}
} | |
9, 0xfa, 0xfa, 0xf8, 0xf9, 0xfa, 0xfa, 0xfc, 0xfd, 0xfe, 0xfe,
0xd5, 0xd5, 0xd6, 0xd7, 0xd9, 0xd9, 0xda, 0xdb, 0xd9, 0xd9, 0xda, 0xdb, 0xdd, 0xdd, 0xde, 0xdf,
0xe5, 0xe5, 0xe6, 0xe7, 0xe9, 0xe9, 0xea, 0xeb, 0xe9, 0xe9, 0xea, 0xeb, 0xed, 0xed, 0xee, 0xef,
0xe5, 0xe5, 0xe6, 0xe7, 0xe9, 0xe9, 0xea, 0xeb, 0xe9, 0xe9,... | {
int16_t start = range_to_clip->origin;
int16_t end = range_to_clip->origin + range_to_clip->size;
start = CLIP(start, range_clipper->origin, range_clipper->origin + range_clipper->size);
end = CLIP(end, range_clipper->origin, range_clipper->origin + range_clipper->size);
range_to_clip->origin = start;
ran... | |
,
.exp_steps_min = -1,
.exp_steps_max = -1,
.weight = 1.0,
};
char line_buf[256];
while (true) {
char *line = fgets(line_buf, sizeof(line_buf), state->common.file);
if (!line) {
// EOF
break;
}
//printf("\nGot line: %s", line);
// Find first token
char *token = st... | strncpy(state->test_entry.name, token + 1, sizeof(state->test_entry.name)) | ;
printf("\nParsing function samples: %s", state->test_entry.name);
continue;
}
// Look for and parse the expected values
if (strcmp(token, "//>") == 0) {
token = strtok(NULL, " \t\n");
if (strcmp(token, "TEST_VERSION") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state-... |
st_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 1);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RE... | (&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 11);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "dr... |
yer __attribute__((always_inline)) *prv_layer_tree_traverse_next(Layer *stack[],
int const stack_size, uint8_t *current_depth,
const bool descend) {
const Layer *top_of_stack = stack[*current_depth];
// goto first child
if (descend && top_of_stack->first_child) {
if (*current_depth < stack_size-1) {
... | {
layer_process_tree(node, NULL, layer_property_changed_tree_node);
} |
void layer_set_update_proc(Layer *layer, LayerUpdateProc update_proc) {
PBL_ASSERTN(layer != NULL);
layer->update_proc = update_proc;
}
void layer_set_frame(Layer *layer, const GRect *frame) {
if (grect_equal(frame, &layer->frame)) {
return;
}
const bool bounds_in_sync = gpoint_equal(&layer->bounds.ori... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | app_event_loop() | ;
deinit();
}
const PebbleProcessMd* menu_overflow_app_get_info() {
static const PebbleProcessMdSystem s_app_info = {
.common.main_func = &s_main,
.name = "Menu Overflow"
};
return (const PebbleProcessMd*) &s_app_info;
}
|
OT_INDICES[] = {OTP_HWVER1};
#endif
static const char DUMMY_SERIAL[MFG_SERIAL_NUMBER_SIZE + 1] = "XXXXXXXXXXXX";
// FIXME: shouldn't the dummy HWVER be 9 X's?
static const char DUMMY_HWVER[MFG_HW_VERSION_SIZE + 1] = "XXXXXXXX";
static const char DUMMY_PCBA_SERIAL[MFG_PCBA_SERIAL_NUMBER_SIZE + 1] = "XXXXXXXXXXXX";
sta... | mfg_print_feedback(result, index, serial, "Serial") | ;
}
void command_hwver_write(const char *hwver) {
MfgSerialsResult result;
uint8_t index = 0;
size_t hwver_len = strlen(hwver);
if (hwver_len > 0) {
result = prv_mfg_write_hw_version(hwver, hwver_len, &index);
} else {
result = MfgSerialsResultFailIncorrectLength;
}
mfg_print_feedback(result, 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... | (CMD_DISPLAY_OFF) | ;
prv_end_command();
}
void prv_draw_scene(uint8_t scene) {
prv_start_command(CMD_DRAW_SCENE);
prv_send_command_arg(scene);
prv_end_command();
}
void prv_set_parameter(uint32_t param) {
prv_start_command(CMD_SET_PARAMETER);
// Send in little-endian byte order
prv_send_command_arg(param & 0xff);
prv_sen... |
_Incoming, true /* check_cookie */, true /* check_name_number */,
"Bobby", "555-555-5555");
}
void test_phone_pp__start(void) {
uint8_t pp_msg[] = {0x08, 0x1a, 0xd4, 0x77, 0x08};
phone_protocol_msg_callback(s_session, pp_msg, sizeof(pp_msg));
fake_system_task_callbacks_invoke_pending();
... | (s_session, pp_msg, sizeof(pp_msg)) | |
ict_serialize_tuplets_to_buffer_with_iter(&it, tuplets, ARRAY_LENGTH(tuplets), \
buffer, &buffer_size); \
cl_assert_equal_i(DICT_OK, result); \
if (s_received_callback) { \
s_received_callback(&it, NULL); \
} \
} while(0);
#define RCV_RESET_REQUES... | RCV_DUMMY_CHUNK() | ;
// https://pebbletechnology.atlassian.net/browse/PBL-42466
// TODO: assert that app message was NACK'd
// Expect responding with a ResetRequest:
EXPECT_OUTBOX_RESET_REQUEST();
EXPECT_OUTBOX_MESSAGE_PENDING(TupletBytes(PostMessageKeyResetRequest, NULL, 0));
// TODO: check fields
cl_assert_equal_i(rocky... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | get_gbitmap_from_pbi("test_bitblt_palette_1bit__1bit_palette_to_1bit.pbi") | ;
bitblt_bitmap_into_bitmap(&s_dest_bitmap, src_bitmap, GPointZero, GCompOpAssign, GColorWhite);
cl_assert(gbitmap_pbi_eq(&s_dest_bitmap,
"test_bitblt_palette_1bit__1bit_palette_to_1bit_assign-expect.pbi"));
gbitmap_destroy(src_bitmap);
}
// Test images reside in "tests/fw/graphics/test_image... |
ansitions are always valid
if ((next_state == StateFinished) ||
(next_state == StateExiting) ||
(next_state == StateError)) {
return next_state;
}
// This determines whether a transition is valid and whether the transition should be deferred
// until an animation completes. If a transition skip... | prv_show_mic_text(data, i18n_noop("Listening")) | |
case FLASH_TEST_CASE_RUN_DATA_TEST:
text_layer_set_text(msg_text_layer, "Data Bus Test");
break;
case FLASH_TEST_CASE_RUN_ADDR_TEST:
text_layer_set_text(msg_text_layer, "Addr Bus Test");
break;
case FLASH_TEST_CASE_RUN_STRESS_ADDR_TEST:
text_layer_set_text(msg_text_layer, "Stress A... | {
struct FlashTestData *data = app_state_get_user_data();
FlashTestErrorType status = FLASH_TEST_SUCCESS;
// Execute test - pass in 0 by default for iterations
status = run_flash_test_case(data->test_case, 0);
if (status == FLASH_TEST_SUCCESS) {
data->test_case_status = FLASH_TEST_STATUS_PASSED;
}
e... |
static void select_click_handler(ClickRecognizerRef recognizer, void *unusued) {
struct FlashTestData *data = app_state_get_user_data();
if ((data->test_case == FLASH_TEST_CASE_RUN_STRESS_ADDR_TEST) && (data->test_case_status == FLASH_TEST_STATUS_RUNNING)) {
data->test_case_status = FLASH_TEST_STATUS_STOPPED... |
0, -1000},
{ 88, -288, -944},
// 2 seconds
{ 80, -304, -1016},
{ 24, -312, -952},
{ 40, -312, -960},
{ 48, -312, -968},
{ 64, -320, -928},
{ 48, -296, -952},
{ 40, -296, -960},
{ 40, -304, -936},
{ 64, -312, -928},
{ 56, -312, -920},
{ 96, -296, -952},
{ 104, -208... | { -968, 224, 128},
{ -1168, 424, 48},
{ -1160, 520, -120},
{ -1184, 624, -152},
{ -1120, 1112, -88},
{ -1200, 368, -440},
{ -1520, 672, -208},
{ -952, 536, -280},
{ -1328, 488, -192},
{ -1576, 360, 40},
{ -1336, 288, -24},
{ -1024, 192, -112},
{ -1000, 192, -56},
... |
// 10 seconds
{ -1376, 280, 72},
{ -1368, 96, 64},
{ -1280, 120, 96},
{ -1216, 176, 64},
{ -1304, 296, -32},
{ -1040, 296, -128},
{ -1104, 456, -120},
{ -800, 688, -376},
{ -432, 968, -576},
{ -432, 952, -584},
{ -288, 752, -456},
{ -72, 632, -320},
{ 128, 520, -... |
/*
* 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... | {
WTF;
} | |
iceTagUnitTest,
prv_message_handler,
PebbleTask_KernelMain,
s_consumer_data_length);
}
void test_app_outbox__register_twice_asserts(void) {
prv_register();
cl_assert_passert(prv_register());
}
void test_app_outbox__send_not_... | prv_register() | |
= 10},
&(ActivitySession) {.start_utc = now - (2 * SECONDS_PER_MINUTE), .length_min = 5},
HealthIterationDirectionFuture));
// both end at the same time
cl_assert(0 == prv_session_compare(
&(ActivitySession) {.start_utc = now, .length_min = 10},
&(ActivitySession) {.start_utc = now + (5 * SECONDS_P... | cl_assert_equal_i(3, s_sys_activity_get_minute_history_values.in[0].num_records) | ;
// respects time_end, 1 minute => 1 records
s_sys_activity_get_minute_history_values.stage = 0;
time_start = time_on_boundary;
time_end = time_start + SECONDS_PER_MINUTE;
health_service_get_minute_history(data, ARRAY_LENGTH(data), &time_start, &time_end);
cl_assert_equal_i(1, s_sys_activity_get_minute_hi... |
common/compositor/compositor.h"
#include "services/common/cron.h"
#include "services/common/debounced_connection_service.h"
#include "services/common/ecompass.h"
#include "services/common/event_service.h"
#include "services/common/evented_timer.h"
#include "services/common/firmware_update.h"
#include "services/common/i... | compositor_is_animating() | ) {
// mask the app task if we're already animating
e->task_mask |= 1 << PebbleTask_App;
return;
}
const bool is_modal_focused = (modal_manager_get_enabled() &&
!(modal_manager_get_properties() & ModalProperty_Unfocused));
if (is_modal_focused) {
// mask the app t... |
{ 560, 208, -736},
{ 568, 216, -728},
{ 560, 224, -744},
{ 560, 200, -736},
{ 560, 216, -736},
{ 560, 208, -736},
{ 560, 208, -736},
// 5 seconds
{ 568, 224, -728},
{ 560, 224, -744},
{ 560, 208, -736},
{ 568, 200, -736},
{ 560, 200, -736},
{ 560, 224, -736},
{ 56... | { 560, 168, -752},
{ 552, 160, -744},
{ 560, 192, -736},
{ 552, 192, -760},
{ 536, 224, -752},
{ 536, 176, -760},
{ 552, 152, -784},
{ 552, 184, -752},
{ 552, 192, -736},
{ 552, 176, -736},
{ 552, 184, -744},
{ 560, 184, -744},
{ 552, 168, -744},
{ 560, 184, -744}... |
// 13 seconds
{ 560, 248, -736},
{ 560, 216, -728},
{ 560, 216, -736},
{ 568, 232, -728},
{ 568, 224, -728},
{ 560, 216, -720},
{ 560, 232, -728},
{ 560, 216, -728},
{ 560, 232, -728},
{ 560, 208, -728},
{ 568, 224, -728},
{ 560, 232, -728},
{ 552, 216, -776},
... |
_duration_a);
cl_assert_equal_i(animation_get_duration(b, false, false), duration_b);
cl_assert_equal_i(animation_get_duration(b, false, true), play_count_b * duration_b);
cl_assert_equal_i(animation_get_duration(b, true, false), delay_b + duration_b);
cl_assert_equal_i(animation_get_duration(b, true, true), t... | animation_schedule(spawn) | ;
animation_schedule(e);
// Verify count
cl_assert_equal_i(prv_count_scheduled_animations(), 7);
// Unschedule all
animation_unschedule_all();
cl_assert_equal_i(prv_count_scheduled_animations(), 0);
// Make sure just the setup and teardown handlers were called
cl_assert_equal_i(prv_count_handler_ent... |
, false);
cl_assert_equal_i(s_hrm_expiration, 0);
}
// ---------------------------------------------------------------------------------------
// Open the app, start a workout, 120s, stop the workout, 120s, close app.
// Make sure the HR stays on for WORKOUT_ENDED_HR_SUBSCRIPTION_TS_EXPIRE - 120s
void test_workout_s... | cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s)) | ;
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 10);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 10);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 10);
prv_inc_time(10);
prv_put_bpm_event(ZONE_1_HR, HRMQuality_Good);
workout_service_get_curren... |
ivity_session(ActivitySession *session) {
}
// =============================================================================================
// Data logging stubs
DataLoggingResult dls_log(DataLoggingSession *logging_session, const void *data,
uint32_t num_items) {
if (!s_capture_dls_recor... | rtc_get_time() | ;
if (s_kalg_sleep_start_utc == 0 || now < s_kalg_sleep_start_utc + SECONDS_PER_HOUR) {
// We are before the requested sleep time
*stats = (KAlgOngoingSleepStats) { };
} else {
// We are somewhere after the start of sleep
time_t sleep_end = s_kalg_sleep_start_utc + s_kalg_sleep_m * SECONDS_PER_MINUT... |
, 464, -1032},
{ -24, 488, -1152},
{ 96, 584, -1160},
{ 56, 552, -1144},
{ 32, 664, -1184},
{ 176, 712, -1112},
{ 168, 624, -984},
{ 96, 560, -904},
{ 56, 312, -632},
{ -48, 192, -568},
{ -120, 192, -640},
// 34 seconds
{ -136, 144, -752},
{ -200, 280, -888},
{ -3... | { -120, 208, -704},
{ -136, 344, -824},
{ -240, 592, -1016},
{ -312, 608, -1096},
{ -216, 464, -1096},
{ -264, 632, -1216},
{ 104, 840, -1440},
{ 296, 568, -1128},
{ 160, 496, -1040},
{ 72, 464, -880},
{ 128, 336, -736},
{ 88, 280, -632},
{ 16, 288, -656},
{ -48, ... |
{ 32, 264, -920},
{ 72, 352, -1088},
{ 32, 312, -1208},
{ -40, 320, -1152},
{ -88, 384, -1192},
{ 0, 592, -1176},
{ 136, 584, -1088},
{ 168, 560, -1056},
// 42 seconds
{ 168, 480, -984},
{ 152, 312, -760},
{ 24, 248, -656},
{ -64, 184, -640},
{ -88, 128, -688},
... |
ic uint32_t s_last_response_cookie;
static CommSession *s_session;
// Helpers
///////////////////////////////////////////////////////////
#define VALID_OBJECT_SIZE (4)
#define PUT_BYTES_TIMEOUT_MS (30000)
#define EXPECTED_CRC (0x12345678)
#define EXPECTED_COOKIE (0xabcd1234)
#define EXPECT_INIT_TIMEOUT_MS (1000)
s... | fake_comm_session_process_send_next() | ;
fake_system_task_callbacks_invoke_pending();
s_acks_received = 0;
s_nacks_received = 0;
}
static void prv_receive_init_and_put_fw_object(void) {
prv_receive_init(VALID_OBJECT_SIZE, ObjectFirmware);
fake_comm_session_process_send_next();
fake_system_task_callbacks_invoke_pending();
const uint8_t chunk[... |
tion_system_task_callback(void *data) {
InvokeActionMsgCbData *action = data;
comm_session_send_data(comm_session_get_system_session(), TIMELINE_ACTION_ENDPOINT,
(uint8_t *)&action->msg, action->length, COMM_SESSION_DEFAULT_TIMEOUT);
kernel_free(action);
}
static ActionResultType prv_get_action_result_t... | (prv_action_system_task_callback, invoke_action_data) | ;
} else {
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... |
d_animations(), 7);
// Unschedule all
animation_unschedule_all();
cl_assert_equal_i(prv_count_scheduled_animations(), 0);
// Make sure just the setup and teardown handlers were called
cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&... | animation_get_implementation(h) | != &implementation.base);
cl_assert(animation_get_implementation(h) == &implementation2.base);
// Custom Curve
cl_assert(animation_get_custom_curve(h) != prv_custom_curve);
animation_set_custom_curve(h, prv_custom_curve);
cl_assert(animation_get_custom_curve(h) == prv_custom_curve);
// Reverse
cl_ass... |
1].strength, -100);
cl_assert_equal_i(s_vibe_queue[2].duration_ms, 100);
cl_assert_equal_i(s_vibe_queue[2].strength, 0);
cl_assert_equal_i(s_vibe_queue[3].duration_ms, 15);
cl_assert_equal_i(s_vibe_queue[3].strength, 100);
cl_assert_equal_i(s_vibe_queue[4].duration_ms, 9);
cl_assert_equal_i(s_vibe_queue[4].... | cl_assert_equal_i(vibe_score_get_repeat_delay_ms(score), 0) | ;
vibe_score_destroy(score);
}
void test_vibe_score__test_bad_attr_size(void) {
uint8_t buffer[] = {
'V', 'I', 'B', 'E', // FourCC
1, 0, // version
0, 0, 0, 0, // reserved bytes
11, 0, // attr_list_size (right value is 12)
2, // GenericAttributeList.num_attributes
VibeAttributeI... |
* limitations under the License.
*/
#include <string.h>
#include <stdlib.h>
#include "drivers/flash.h"
#include "flash_region/flash_region.h"
#include "services/normal/filesystem/pfs.h"
#include "services/normal/filesystem/flash_translation.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/... | (memcmp(buf, bufcmp, sizeof(buf)) == 0) | ;
cl_assert_equal_i(pfs_close(fd), S_SUCCESS);
}
}
void test_pfs__garbage_collection_when_full(void) {
char file_name[10];
int num = 0;
int fd;
while (1) {
snprintf(file_name, sizeof(file_name), "file%d", num++);
fd = pfs_open(file_name, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(file_name));
cl... |
// Test if there are any notifications in the list.
if (first_row) {
// Draw "Clear all" box and exit
#if PBL_ROUND
draw_cell(ctx, cell_layer, i18n_get("Clear All", data), NULL, NULL);
#else
const GFont font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle);
GRect box = cell_layer-... | {
if (e->type == PEBBLE_SYS_NOTIFICATION_EVENT) {
Uuid *id = e->sys_notification.notification_id;
switch(e->sys_notification.type) {
case NotificationAdded:
prv_handle_notification_added(id);
break;
case NotificationRemoved:
prv_handle_notification_removed(id);
brea... |
///////////////////
// Window callbacks
static void prv_window_appear(Window *window) {
NotificationsData *data = window_get_user_data(window);
prv_update_text_layer_visibility(data);
}
static void prv_window_disappear(Window *window) {
NotificationsData *data = window_get_user_data(window);
prv_loaded_not... |
/*
* 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 worker_state_get_tick_timer_service_state();
} | else if (task == PebbleTask_KernelMain) {
return kernel_applib_get_tick_timer_service_state();
} else {
WTF;
}
}
static void do_handle(PebbleEvent *e, void *context) {
TickTimerServiceState *state = prv_get_state(PebbleTask_Unknown);
PBL_ASSERTN(state->handler != NULL);
TimeUnits units_changed = 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... | (item_layer) | ;
return MAX(first_scroll, max_scroll);
} else {
return MAX(max_scroll, 0);
}
}
static void prv_scroll_offset_setter(TimelineItemLayer *item_layer, int16_t value) {
item_layer->scroll_offset_pixels = value;
layer_mark_dirty(&item_layer->layer);
}
static int16_t prv_scroll_offset_getter(TimelineItemLay... |
/ Did we get samples?
if (state->test_entry.num_samples > 0) {
return true;
} else {
return false;
}
}
// ---------------------------------------------------------------------------------------
// Init the sample discovery iterator
static bool prv_sample_discovery_init(SampleDiscoveryState *state, Sample... | prv_parse_activity_samples_file(state) | ;
if (success) {
*entry = state->test_entry;
return true;
} else {
// No more in this file
fclose(state->common.file);
state->common.file = NULL;
}
}
}
// --------------------------------------------------------------------------------------
// Callback provided to the qsor... |
static void prv_add_avg_pace_metric_info(StringList *headings, int headings_buf_size,
StringList *values, int values_buf_size,
ActivitySession *session) {
const int pace_buf_size = 16;
char pace_str[pace_buf_size];
const int pace_s... | (hr_zone_time_s[HRZone_Zone2], SECONDS_PER_MINUTE) | |
ght_dag;
uint16_t height_mm;
} HumanPrefs;
#define ACTIVITY_DEFAULT_HEIGHT_MM 1620 // 5'3.8"
// dag - decagram (10 g)
#define ACTIVITY_DEFAULT_WEIGHT_DAG 7539 // 166.2 lbs
#define ACTIVITY_DEFAULT_GENDER ActivityGenderFemale
#define ACTIVITY_DEFAULT_AGE_YEARS ... | cl_assert_gt(long_run_distance_m, short_guy_distance) | ;
// And finally throw in a specific value so that anyone who touches the function will have to
// check up on the unit tests
cl_assert_equal_i(short_guy_distance, 36845);
}
// ---------------------------------------------------------------------------------------
void test_activity_calculators__active_calories... |
ce/resource.h"
#include "resource/resource_ids.auto.h"
#include "resource/system_resource.h"
#include "util/size.h"
// Fakes
#include "fake_app_manager.h"
// Stubs
#include "stubs_analytics.h"
#include "stubs_bootbits.h"
#include "stubs_logging.h"
#include "stubs_mutex.h"
#include "stubs_pbl_malloc.h"
#include "stubs... | cl_assert(text_resources_init_font(0, gothic_18_handle, 0, &s_font_info)) | ;
uint8_t glyph_size_bytes;
const GlyphData *glyph;
glyph = text_resources_get_glyph(&s_font_cache, 'a', &s_font_info);
glyph_size_bytes = glyph_get_size_bytes(glyph);
cl_assert_equal_m(a_glyph_data_bytes, glyph->data, glyph_size_bytes);
glyph = text_resources_get_glyph(&s_font_cache, 'b', &s_font_info);... |
time_buf);
// June 10th 2015, 04:00:00 (T+12:00:00)
rtc_set_time(event_time + (12 * SECONDS_PER_HOUR));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("Yesterday, 4:00 PM", time_buf);
// June 9th 2015, 02:00:00 (T-14:00:00)
rtc_set_time(even... | ("Tue, 16:00", time_buf) | ;
// June 16th 2015, 17:00:00 (T+7DAY+01:00:00)
rtc_set_time(event_time + (7 * SECONDS_PER_DAY) + (1 * SECONDS_PER_HOUR));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("Jun 9, 16:00", time_buf);
}
void test_clock__time_12h_lower_style(void) {
... |
text_layer_set_text(status, data->status_string) | ;
layer_add_child(&window->layer, &status->layer);
if (has_hrm) {
data->hrm_event_info = (EventServiceInfo){
.type = PEBBLE_HRM_EVENT,
.handler = prv_handle_hrm_data,
};
event_service_client_subscribe(&data->hrm_event_info);
// Use app data as session ref
AppInstallId app_id = 1;... | |
on(&s_conn_a);
prv_assert_event_service_subscribed(false);
cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 0);
ble_hrm_init(); // reinit, __cleanup() will deinit again
}
static void prv_put_and_assert_hrm_event(HRMEventType subtype, uint8_t bpm, HRMQuality quality,
... | bt_driver_cb_hrm_service_update_subscription(s_device_a, true) | ;
cl_assert_equal_b(true, regular_timer_is_scheduled(timer));
cl_assert_equal_i(0, s_ble_hrm_push_reminder_popup_call_count);
fake_regular_timer_trigger(timer);
cl_assert_equal_i(1, s_ble_hrm_push_reminder_popup_call_count);
// Except timer to be rescheduled again:
cl_assert_equal_b(true, regular_timer_is... |
lse {
// non buffered sessions can only be created/used from KernelBG
PBL_ASSERT_TASK(PebbleTask_KernelBackground);
}
}
// send an open message
dls_endpoint_open_session(logging_session);
return (logging_session);
}
// -------------------------------------------------------------------------... | {
return (DATA_LOGGING_CLOSED);
} | |
default:
WTF;
}
}
static const KernelLEClient * prv_client_for_characteristic(BLECharacteristic characteristic) {
for (int c = 0; c < KernelLEClientNum; ++c) {
const KernelLEClient * const client = &s_clients[c];
if (client->can_handle_characteristic && client->can_handle_characteristic(characteris... | (event->object_ref) | ;
if (!client) {
// Read responses still need to be consumed, even if the client has disappeared:
if (event->subtype == PebbleBLEGATTClientEventTypeCharacteristicRead && event->value_length) {
gatt_client_consume_read_response(event->object_ref,
NULL, event->value... |
salt",
// model: "pebble_time_red",
// language: "en_US",
// firmware: {
// major: 4,
// minor: 0,
// patch: 1,
// suffix: "beta3"
// }
// }
#define ROCKY_WATCHINFO "watchInfo"
#define ROCKY_WATCHINFO_PLATFORM "platform"
#define ROCKY_WATCHINFO_MODEL "model"
#define ROCK... | SPALDING_MODEL("pebble_time_round_rose_gold_14mm") | ;
break;
case WATCH_INFO_COLOR_PEBBLE_2_HR_BLACK:
model_name = SILK_MODEL("pebble_2_hr_black");
break;
case WATCH_INFO_COLOR_PEBBLE_2_HR_LIME:
model_name = SILK_MODEL("pebble_2_hr_lime");
break;
case WATCH_INFO_COLOR_PEBBLE_2_HR_FLAME:
model_name = SILK_... |
eps));
// Check new step count
int32_t steps;
steps = health_service_sum_today(HealthMetricStepCount);
steps -= before;
PBL_LOG(LOG_LEVEL_DEBUG, "steps: %"PRId32, steps);
if (steps >= 27 && steps <= 33) {
passed = true;
}
prv_test_end(context, passed);
}
// -------------------------------------... | {
passed = false;
} |
// Check other sleep metrics
activity_get_metric(ActivityMetricSleepEnterAtSeconds, 1, &value);
PBL_LOG(LOG_LEVEL_DEBUG, "entry minute: %d", (int)(value / SECONDS_PER_MINUTE));
activity_get_metric(ActivityMetricSleepExitAtSeconds, 1, &value);
PBL_LOG(LOG_LEVEL_DEBUG, "exit minute: %d", (int)(value / SECOND... |
draw_circle(&ctx, CENTER_OF_OFFSET_RECT_NXNY, RADIUS_BIG);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r16_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// Medium circles
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, STROKE_SMALL);
graphics_draw_circle(&ctx, CENTER_OF_... | (&ctx.dest_bitmap, "stroke_circle_offset_r8_quads_bottom.${BIT_DEPTH_NAME}.pbi") | );
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL);
graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornersRight);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quads_right.${BIT_DEPTH_NAME}.pbi"... |
include "stubs/stubs_passert.h"
InterpolateInt64Function s_animation_private_current_interpolate_override;
InterpolateInt64Function animation_private_current_interpolate_override(void) {
return s_animation_private_current_interpolate_override;
}
void test_animation_interpolate__initialize(void) {
s_animation_pri... | interpolate_moook_custom(0, -20000, 20000, &s_custom_moook) | );
// mid frame is closer to end due to more end frames
cl_assert_equal_i(6683, interpolate_moook_custom(ANIMATION_NORMALIZED_MAX / 2, -20000, 20000,
&s_custom_moook));
cl_assert_equal_i(20000, interpolate_moook_custom(ANIMATION_NORMALIZED_MAX, -20000, 20000,
... |
>hdl.end
};
BTErrno rv = bt_driver_gatt_start_discovery_range(connection, &hdl);
if (rv == BTErrnoOK) {
// if we are back here because a timeout occurred, let the
// driver handle resetting the watchdog timer (cc2564x issue)
connection->gatt_is_service_discovery_in_progress = true;
}
return rv;... | prv_send_event(info) | |
b/app_timer.h"
#include "applib/fonts/fonts.h"
#include "applib/ui/action_bar_layer.h"
#include "applib/ui/app_window_stack.h"
#include "applib/ui/window_stack_private.h"
#include "applib/ui/ui.h"
#include "apps/system_apps/timeline/peek_layer.h"
#include "kernel/pbl_malloc.h"
#include "kernel/ui/kernel_ui.h"
#include ... | text_layer_init_with_parameters(msg_text_layer, &msg_text_frame,
i18n_get("Perform factory reset?", data),
fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD), text_color,
GColorClear, alignment, overflow_mode) | ;
layer_add_child(&window->layer, &msg_text_layer->layer);
#if PBL_ROUND
const uint8_t text_flow_inset = 8;
text_layer_enable_screen_text_flow_and_paging(msg_text_layer, text_flow_inset);
#endif
// handle different title heights gracefully
GContext *ctx = graphics_context_get_current_context();
const uint1... |
_app_task_context.app_md->uuid))) {
PBL_LOG(LOG_LEVEL_WARNING, "Ignoring launch for app <%s>, app is already running",
process_metadata_get_name(app_md));
app_install_release_md(app_md);
return false;
}
if (process_metadata_get_run_level(app_md) < s_minimum_run_level) {
PBL_LOG(LOG_LEV... | {
s_minimum_run_level = run_level;
} |
// -----------------------------------------------------------------------------------------
void app_manager_force_quit_to_launcher(void) {
const PebbleProcessMd *default_process = system_app_state_machine_get_default_app();
const AppInstallId current_app_id = s_app_task_context.install_id;
const AppInstallId ... |
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" BASIS,
*... | if (++i > QSPI_WAIT_TIME) {
break;
} |
}
PBL_ASSERT(i < QSPI_WAIT_TIME, "Waited too long for the QSPI to become not busy");
}
#else
static void prv_wait_for_transfer_complete(void) {
while (QSPI_GetFlagStatus(QSPI_FLAG_TC) == RESET) { }
}
static void prv_wait_for_not_busy(void) {
while (QSPI_GetFlagStatus(QSPI_FLAG_BUSY) != RESET) { }
}
#endif
... |
mand(const uint8_t *command, uint32_t length) {
s_sending_endpoint_id = 0;
s_sending_data_length = 0;
blob_db_protocol_msg_callback(s_session, command, length);
fake_system_task_callbacks_invoke_pending();
fake_comm_session_process_send_next();
cl_assert(BLOB_DB_ENDPOINT_ID == s_sending_endpoint_id);
ret... | cl_assert(TEST_VALUE_SIZE == *(uint16_t*)cmd_ptr) | ;
cmd_ptr += sizeof(uint16_t);
// go past value_bytes
cmd_ptr += TEST_VALUE_SIZE;
cl_assert((cmd_ptr - s_insert_cmd_success) == sizeof(s_insert_cmd_success));
// Process Command
uint8_t *resp_ptr = process_blob_db_command(s_insert_cmd_success, sizeof(s_insert_cmd_success));
// Check Response
cl_asse... |
(animation, finished, animation->context) | ;
}
if (animation->implementation->teardown != NULL) {
animation->implementation->teardown(animation);
}
}
void animation_legacy2_private_unschedule_all(AppTaskCtxIdx idx) {
AnimationLegacy2Scheduler *animation_legacy2_scheduler =
animation_legacy2_scheduler_data_for_app_c... | |
ursor = 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 {
event... | ("Dictation is not available.") | ,
RESOURCE_ID_GENERIC_WARNING_LARGE, GColorRed);
}
static void prv_show_error_dialog(VoiceUiData *data, const char *msg) {
if (data->show_error_dialog) {
if (data->error_count == MAX_ERROR_COUNT) {
data->error_exit_status = DictationSessionStatusFailureSystemAborted;
prv_push_... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | for (uint32_t i = region.begin; i < region.end; i += sizeof(uint32_t)) {
uint32_t read = 0;
flash_read_bytes((uint8_t *)&read, i, sizeof(read));
if (read != 0xffffffff) {
PBL_LOG_SYNC(LOG_LEVEL_INFO, ">>>> Address 0x%lx failed to erase: 0x%lx", i, read);
success = false;
}
} | |
Animation *a = prv_create_test_animation();
animation_set_duration(a, duration_a);
Animation *b = prv_create_test_animation();
animation_set_duration(b, duration_b);
animation_set_play_count(b, 0);
// Create a sequence
Animation *seq = animation_sequence_create(a, b, NULL);
cl_assert(seq != NULL);
ani... | prv_count_handler_entries(&s_started_handler_calls, b) | , 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0);
// Just before A completes
prv_advance_to_ms_with_timers(start_ms + duration_a - 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_... |
sion_process_send_next();
fake_system_task_callbacks_invoke_pending();
// Assert the FW description got written at the beginning of the storage:
const FirmwareDescription fw_descr = {
.description_length = sizeof(FirmwareDescription),
.firmware_length = VALID_OBJECT_SIZE,
.checksum = EXPECTED_CRC,
... | prv_receive_init_fw_object() | ;
// Stop the timer, so we can easily detect it gets restarted again:
TimerID timer_id = put_bytes_get_timer_id();
new_timer_stop(timer_id);
const uint8_t chunk[] = { 0xaa, 0xbb, 0xcc };
prv_receive_put(s_last_response_cookie, chunk, sizeof(chunk));
fake_system_task_callbacks_invoke_pending();
cl_asser... |
riable depending on the number of IRQn interrupt handlers implemented
// by the platform. For the dialog part 32 IRQs are provided. There is also a
// patch area used by the dialog BT ROM which must be loaded and comes directly
// after the vector table, it's 128 bytes
#define IVT_TABLE_SIZE (0x40 + 32 * 4 + 0x80)
stat... | prv_handle_load_data_command() | ;
} else if (cmd[0] == 'V' && cmd[1] == 'T') {
prv_handle_vector_table_update_command();
} else if (cmd[0] == 'R' && cmd[1] == 'T') {
prv_handle_reboot_command();
} else {
debug_print_str("Unknown CMD:");
debug_print_str_and_int(" Byte 0:", cmd[0]);
debug_print_str_and_int(" By... |
, 616, 8},
{ 1104, 696, 40},
{ 992, 568, 8},
{ 1152, 616, -8},
{ 1024, 504, -64},
{ 1200, 456, -96},
{ 1448, 424, -64},
{ 1648, 376, -24},
{ 1536, 128, 72},
{ 1464, 80, 48},
{ 1384, 48, -40},
{ 1312, 88, -80},
{ 1112, 24, -56},
{ 888, -32, -112},
{ 1024, -104, -17... | ARRAY_LENGTH(samples) | ;
return samples;
}
// ----------------------------------------------------------------
// Sample captured: 2015-10-02 15:19:17 local
AccelRawData *activity_sample_walk_100_pbl_25477_18(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_25477_18
//> TE... |
qual_i(((timingr >> 8) & 0xFF) + 1, expected_scl_high);
cl_assert_equal_i(((timingr >> 20) & 0xF) + 1, expected_scl_delay);
}
void test_i2c_timingr__valid_no_prescaler_no_rise_fall_time(void) {
// We'll use a base clock speed of 36Mhz and try to get to 400kHz I2C. We should be able to do
// this with a prescaler... | (MHZ_TO_HZ(1600), I2CBusMode_Standard,
KHZ_TO_HZ(100), 0, 0) | ,
I2C_TIMINGR_INVALID_VALUE);
}
void test_i2c_timingr__invalid_speed_too_high_for_mode(void) {
// Try calculating timing for 400kHz in Standard mode, which is out of spec for that mode.
cl_assert_equal_i(i2c_timingr_calculate(MHZ_TO_HZ(36), I2CBusMode_Standard,
... |
apper;
static CoreDumpThreadInfo_Wrapper ALIGN(4) s_thread_info;
_Static_assert(((uint32_t)&s_thread_info.ti.registers[0] % 4) == 0,
"Structure not correctly aligned");
static CoreDumpExtraRegInfo ALIGN(4) s_extra_info;
extern void debug_uart_init(void);
// Linker symbols
extern const uint8_t __heap_s... | hw_cpm_ldo_io_ret_off() | ;
hw_watchdog_freeze();
while (true) {
__WFI();
}
__builtin_unreachable();
}
// Timer0 is very limited -- there is no way to reset the count until it's triggered, so it's
// not useful as a generic one-shot. We'll let it run free and calculate deltas.
static void prv_timer_enable(void) {
timer0_config... |
/*
* 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... | {
AppMenuNode *node = app_menu_data_source_get_node_at_index(&data->data_source, cell_index->row);
GBitmap *bitmap = app_menu_data_source_get_node_icon(&data->data_source, node);
const char *subtitle = (data->active_watchface_id == node->install_id) ?
i18n_get("Active", data) : NULL;
const GCompOp op = (... |
///////////////////
// Window callbacks
static void prv_window_appear(Window *window) {
SettingsWatchfacesData* data = (SettingsWatchfacesData*)window_get_user_data(window);
// Select the currently active watchface:
data->active_watchface_id = watchface_get_default_install_id();
const uint16_t row =
a... |
_periphs = RCC_AHB3Periph_FMC | RCC_AHB3Periph_QSPI;
const uint32_t apb1_periphs =
RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM4| RCC_APB1Periph_TIM5
| RCC_APB1Periph_TIM6 | RCC_APB1Periph_TIM7 | RCC_APB1Periph_TIM12 | RCC_APB1Periph_TIM13
| RCC_APB1Periph_TIM14 | RCC_APB1Periph_LPTIM1 |... | (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 bits overrun");
break;
}
return false;
}
static bool prv_check_for_recovery_start_failure() {
return boot_bit_test(BOOT_BIT_RECOVERY_... |
timestamp + j;
cl_assert(notification_storage_get(&uuids[j], &r));
compare_notifications(&e, &r);
free(r.allocated_buffer);
// Fill up storage again
for (++i; i < count + erase_count; i++) {
e.header.id = uuids[i % count];
e.header.timestamp = timestamp + i;
notification_storage_store(&e);
c... | (notification_storage_find_ancs_notification_id(84, &u)) | ;
cl_assert(uuid_equal(&u, &e4.header.id));
}
void test_notification_storage__find_by_timestamp(void) {
Uuid i1;
uuid_generate(&i1);
TimelineItem e1 = {
.header = {
.id = i1,
.type = TimelineItemTypeNotification,
.status = 0,
.ancs_uid = 0,
.layout = LayoutIdGeneric,
.ti... |
ly.
// (verified in iOS 8.3 and iOS 9 beta 1)
// AMSPlayerAttributeIDName,
AMSPlayerAttributeIDPlaybackInfo,
AMSPlayerAttributeIDVolume,
};
static const uint8_t register_for_queue_entity_updates_cmd[] = {
AMSEntityIDQueue,
AMSQueueAttributeIDIndex,
AMSQueueAttributeIDCount,
AMSQueueA... | {
case AMSPlaybackStatePaused: return MusicPlayStatePaused;
case AMSPlaybackStatePlaying: return MusicPlayStatePlaying;
case AMSPlaybackStateRewinding: return MusicPlayStateRewinding;
case AMSPlaybackStateForwarding: return MusicPlayStateForwarding;
default: return MusicPlayStateUnknown;
} | |
/*
* 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) {
const char c = value_begin[idx];
const bool is_terminated = (c == '\0' || idx == end_idx);
if (c == ',' || is_terminated) {
should_continue = callback(value_begin, idx, values_parsed_count, context);
value_begin += idx + 1;
++values_parsed_count;
if (is_t... |
}
finally:
return values_parsed_count;
}
|
// Fakes
///////////////////////////////////////////////////////////
typedef enum EraseCommandType {
SectorEraseCommand,
SubsectorEraseCommand
} EraseCommandType;
typedef struct EraseCommand {
uint32_t addr;
EraseCommandType type;
} EraseCommand;
static EraseCommand s_command_list[32];
static int s_command_... | (s_command_list[0].type, SectorEraseCommand) | ;
s_command_list_index = 0;
// App that's in an aligned bank but larger than than 64k
flash_region_erase_optimal_range(0, 0, 69 * 1024, 96 * 1024);
cl_assert_equal_i(s_command_list_index, 3);
cl_assert_equal_i(s_command_list[0].addr, 0);
cl_assert_equal_i(s_command_list[0].type, SectorEraseCommand);
c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.