prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
ter_state->node = (TimelineNode *)timeline_iter_state->node->node.prev;
if (timeline_iter_state->node == NULL) {
timeline_iter_state->node = orig;
return false;
}
} while (!prv_show_event(timeline_iter_state->node, timeline_iter_state->start_time,
timeline_iter_state->midnight, timeline_iter... | {
case TimelineItemTypeReminder:
// Follow the parent id to get to the owner pin
if (pin_db_get(&item->header.parent_id, &pin) != S_SUCCESS) {
*uuid = UUID_INVALID;
return false;
}
pin_p = &pin;
break;
case TimelineItemTypePin:
case TimelineItemTypeNotification:... |
*uuid = pin_p->header.parent_id;
if (pin_p == &pin) {
timeline_item_free_allocated_buffer(&pin);
}
return true;
}
//
// Iter functions
//
// return true if removed a node, false if non left
void timeline_iter_remove_node(TimelineNode **head, TimelineNode *node) {
PBL_ASSERTN(node);
prv_remove_node(... |
cstring(&list, AttributeIdSubtitle, "Q4 • 1:25");
attribute_list_add_uint32(&list, AttributeIdSportsGameState, is_ingame ? 1 : 0);
attribute_list_add_cstring(&list, AttributeIdNameAway, "GSW");
attribute_list_add_cstring(&list, AttributeIdRecordAway, "114-152");
attribute_list_add_cstring(&list, AttributeIdScor... | (&list, AttributeIdHeadings, &headings) | ;
attribute_list_add_string_list(&list, AttributeIdParagraphs, ¶graphs);
attribute_list_add_cstring(&list, AttributeIdBody, "Body message");
attribute_list_add_uint32(&list, AttributeIdLastUpdated, now);
TimelineItem *item = timeline_item_create_with_attributes(now + delta_time_s, 0,
... |
static bool prv_fetch_field(uint8_t *field_out, size_t offset, size_t field_size) {
flash_read_bytes(field_out, prv_current_page_flash_addr() + offset, field_size);
if (!prv_field_valid(field_out, field_size)) {
// If corrupted field, delete entire page
PBL_LOG(LOG_LEVEL_WARNING, "Shared PRF Storage sector... | {
prv_lock();
{
SprfRootKeys data = {};
if (keys_in) {
memcpy(&data.keys, keys_in, sizeof(data.keys));
}
SPRF_PERSIST_FIELD(data, root_keys);
}
prv_unlock();
} | |
tate;
}
CompassServiceConfig **app_state_get_compass_config(void) {
return &s_app_state_ptr->compass_config;
}
PluginServiceState *app_state_get_plugin_service(void) {
return &s_app_state_ptr->plugin_service_state;
}
LogState *app_state_get_log_state(void) {
return &s_app_state_ptr->log_state;
}
BatteryStateS... | {
s_app_state_ptr->current_timeline_item_action_source = current_source;
} | |
/*
* 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... | (argc - 3, &argv[3],
&(RockyArgBinding){.ptr = &box_width, .type = RockyArgTypeInt16}, 1) | ;
if (jerry_value_has_error_flag(result)) {
return jerry_acquire_value(result);
}
} else {
box_width = large_int;
}
GContext *const ctx = rocky_api_graphics_get_gcontext();
GRect box = {
.origin.x = x,
.origin.y = y,
.size.w = box_width,
.size.h = large_int,
};
// adjust ... |
0, 320},
{ -440, 728, 320},
{ -432, 728, 328},
{ -432, 720, 320},
{ -432, 728, 320},
{ -432, 728, 320},
{ -440, 720, 320},
{ -440, 720, 320},
{ -432, 728, 312},
{ -432, 728, 312},
{ -432, 728, 320},
{ -440, 728, 304},
{ -424, 688, 280},
{ -440, 752, 368},
{ -416, ... | { -416, 728, 304},
{ -408, 752, 296},
// 77 seconds
{ -432, 736, 304},
{ -424, 744, 296},
{ -416, 736, 304},
{ -424, 744, 304},
{ -408, 752, 288},
{ -408, 752, 304},
{ -416, 752, 296},
{ -416, 744, 296},
{ -424, 744, 296},
{ -424, 744, 288},
{ -424, 736, 288},
... |
{ -432, 728, 296},
{ -432, 728, 296},
{ -440, 728, 296},
{ -440, 728, 296},
{ -432, 728, 296},
{ -432, 728, 296},
{ -424, 736, 296},
{ -424, 736, 296},
{ -432, 736, 296},
// 80 seconds
{ -440, 728, 288},
{ -440, 728, 288},
{ -440, 728, 288},
{ -440, 736, 288},
... |
for_custom(schedule_4, alarm_day_text_4);
cl_assert_equal_s(alarm_day_text_4, "Tuesdays");
bool schedule_5[7] = {false, false, false, true, false, false, false};
char alarm_day_text_5[32] = {0};
alarm_get_string_for_custom(schedule_5, alarm_day_text_5);
cl_assert_equal_s(alarm_day_text_5, "Wednesdays");
b... | (s_num_alarm_events_put, 1) | ;
}
void test_alarm__get_string_for_kind(void) {
bool all_caps = false;
cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_EVERYDAY, all_caps), "Every Day");
cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_WEEKDAYS, all_caps), "Weekdays");
cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_WEEKE... |
send_enable setting
void dls_set_send_enable_pp(bool setting) {
s_sends_enabled_pp = setting;
}
// ----------------------------------------------------------------------------------------
// Set the send_enable setting
void dls_set_send_enable_run_level(bool setting) {
s_sends_enabled_run_level = setting;
}
// ... | (tag, item_type, item_size, uuid, rtc_get_time(),
DataLoggingStatusActive) | ;
if (logging_session == NULL) {
// No need to log again here, dls_list_create_session will log on our behalf
return NULL;
}
// Add to the linked list of logging_sessions. This assigns a new unique session_id to this
// session.
dls_list_add_new_session(logging_session);
if (buffer... |
auncherAppGlance *glance) {
// Ignore slices that aren't of the IconAndSubtitle type beyond this point for now
if (glance->current_slice.type != AppGlanceSliceType_IconAndSubtitle) {
return;
}
LauncherAppGlanceStructured *structured_glance = (LauncherAppGlanceStructured *)glance;
LauncherAppGlanceGeneric... | template_string_evaluate(subtitle_template_string, buffer, buffer_size,
&template_string_reeval_conditions, &template_string_vars,
&template_string_error) | |
"attm_db.h"
#include "ble_common.h"
#include "ble_gap.h"
#include "ble_mgr.h"
#include "gapm_task.h"
#include <os/mutex.h>
#include <bluetooth/init.h>
// We'd like to avoid changing the ATT table between FW updates if we can. The implementation of
// the "Service Changed" GATT feature has been buggy on iOS in the p... | (LOG_LEVEL_DEBUG, "Service flush detected, re-registering ...") | ;
prv_gatt_local_services_register();
}
mutex_unlock(s_svc_register_mutex);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// The functions below are wrappers for API calls that are known to clear out the ROM stack's
// ATT table. All the wrappers do is ... |
t32_t));
info->get_val(file, (uint8_t *)&value, sizeof(uint32_t));
cl_assert(value == desired_value);
return true;
}
static void prv_test_settings_file_compaction(const bool manual) {
// If manual is enabled, then the test will force a compaction every so often
// If manual is disabled, then the test will on... | cl_assert_equal_i(settings_file_set(&file, key, key_len, val, val_len), E_OUT_OF_STORAGE) | |
RANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "services/normal/notifications/alerts.h"
#include "services/normal/notifications/alerts_private.h"
#include "clar.h"
#include "stdbool.h"... | alerts_should_notify_for_type(AlertMobile) | );
cl_assert(!alerts_should_vibrate_for_type(AlertMobile));
alerts_set_notification_vibe_timestamp();
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS);
cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile));
cl_assert(alerts_should_notify_for_type(AlertReminder));
cl_assert(!... |
/*
* 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... | bt_unlock() | ;
}
static void prv_update_conn_event_timer(uint32_t interval_1_25ms, bool stop) {
bt_lock();
static bool s_analytic_conn_timer_running = false;
if (stop || s_analytic_conn_timer_running) {
analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BLE_CONN_EVENT_COUNT);
s_analytic_conn_timer_running = false;
}
... |
mutex_unlock(s_state_mutex) | ;
return false;
}
s_input_state = state;
switch (s_input_state) {
case AccessoryInputStateMfg:
accessory_enable_input();
accessory_set_baudrate(AccessoryBaud115200);
accessory_set_power(false);
accessory_mfg_mode_start();
break;
case AccessoryInputStateIdle:
// restore accessory t... | |
/*
* 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... | resource_init() | |
_plot_pixel(framebuffer, &ctx->draw_state.clip_box, x1, y1, MAX_PLOT_OPACITY,
stroke_color);
}
} else {
// Line is not horizontal, diagonal, or vertical
// Error accumulator
error_acc = 0;
// # of bits by which to shift error_acc to get intensity level
inten... | {
int16_t circle_min;
int16_t circle_max;
const int16_t p_offset = cap_center_offset.raw_value;
const int16_t r8 = cap_radius.raw_value;
if (progress.raw_value <= cap_center.raw_value) {
// Top part of the circle
Fixed_S16_3 lookup_val = prv_get_circle_border_precise(cap_center.raw_val... |
}
static void prv_calc_cap_horiz(GPointPrecise *line_end_point, Fixed_S16_3 cap_radius,
int16_t y, Fixed_S16_3 *left_margin, Fixed_S16_3 *right_margin) {
// This function will calculate edges of the cap for stroked line using horizontal lines
Fixed_S16_3 progress = (Fixed_S16_3){.integer =... |
PER_DAY, now);
cl_assert_equal_i(accessible, HealthServiceAccessibilityMaskAvailable);
}
void test_health__metric_hr_accessible(void) {
const time_t now = rtc_get_time();
HealthServiceAccessibilityMask accessible;
// all value in the future
accessible = health_service_metric_accessible(HealthMetricHeartRate... | (LOG_LEVEL_DEBUG, "%s\nMetric: %d, start: %d, end: %d, Scope: %d",
test->desc, (int)test->in.metric, (int)test->in.time_start,
(int)test->in.time_end, (int)test->in.scope) | ;
cl_assert_equal_i(accessible, tests[i].out.accessible);
}
}
void test_health__metric_hr_aggregate_averaged_accessible(void) {
const time_t now = rtc_get_time();
typedef struct {
const char *desc;
struct {
HealthMetric metric;
time_t time_start;
time_t time_end;
HealthAggreg... |
one));
cl_assert_equal_i(bpm, 100);
// Time forward X seconds
prv_inc_time(30);
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m,
&bpm, &hr_zone));
// HR Reading has expired. Should return 0
cl_assert_equal_i(bpm, 0);
... | (s_hrm_expiration, 0) | ;
cl_assert(workout_service_start_workout(ActivitySessionType_Run));
workout_service_frontend_closed();
cl_assert_equal_b(s_hrm_subscribed, true);
cl_assert_equal_i(s_hrm_expiration, SECONDS_PER_HOUR);
}
// ---------------------------------------------------------------------------------------
// Open the ap... |
AVERAGE_SLEEP,
AVERAGE_SLEEP,
AVERAGE_SLEEP
};
memcpy(&s_data.metric_history[ActivityMetricSleepTotalSeconds], sleep_history,
sizeof(sleep_history));
activity_insights_init(rtc_get_time());
// Make sure we don't trigger while still asleep
s_data.metric_history[ActivityMetricSleepState]... | rtc_get_time() | );
}
}
// ---------------------------------------------------------------------------------------
void prv_set_step_history_avg() {
// History with low median
static const int32_t step_history[ACTIVITY_HISTORY_DAYS] = {
AVERAGE_STEPS, // This is 'today'
AVERAGE_STEPS,
AVERAGE_STEPS,
AVERAGE_STEPS... |
dalPriorityGeneric);
cl_check(window_stack);
cl_check(!window_stack->list_head);
window_stack_push(window_stack, window, true);
cl_assert_equal_i(window_stack_count(window_stack), 1);
window_stack_pop(window_stack, true);
cl_assert_equal_i(window_stack_count(window_stack), 0);
window_destroy(window)... | (window2->on_screen, false) | ;
app_window_stack_pop(true);
cl_assert_equal_i(app_window_stack_count(), 1);
cl_assert_equal_i(window1->on_screen, false);
cl_assert_equal_i(window2->on_screen, true);
app_window_stack_pop(true);
cl_assert_equal_i(app_window_stack_count(), 0);
cl_assert_equal_i(window2->on_screen, false);
window_d... |
ore, milliseconds_to_ticks(SEND_BYTE_TIMEOUT_MS)) != pdPASS) {
if (!s_has_sent_byte) {
// we haven't sent a byte in the last timeout period, so time out the whole send
s_stream_cb = NULL;
s_stream_context = NULL;
success = false;
PBL_LOG(LOG_LEVEL_ERROR, "Timed-out while sending");
... | if (s_input_enabled) {
// we are receiving data from the accessory
if (!err_flags->framing_error) {
should_context_switch = accessory_manager_handle_character_from_isr((char)data);
} else if (data == 0x00) {
should_context_switch = accessory_manager_handle_break_from_isr();
}
} else {
... |
if (s_stream_cb) {
// enable the TXE interrupt for sending the next byte
uart_set_tx_interrupt_enabled(dev, true);
}
return should_context_switch;
}
static bool prv_tx_irq_handler(UARTDevice *dev) {
bool should_context_switch = false;
if (s_stream_cb && !s_send_history.has_data) {
s_did_send_byt... |
) {
entry_idx = i;
break;
}
}
cl_assert(entry_idx < MAX_CAPTURED_SESSIONS);
// Deleting?
if (delete) {
if (entry_idx < s_num_captured_sleep_sessions) {
int num_to_move = s_num_captured_sleep_sessions - entry_idx - 1;
cl_assert(num_to_move >= 0);
memmove(&s_captured_sleep_s... | {
if (exit_utc != 0) {
results->cur_state_elapsed.value = (test_end_utc - exit_utc) / SECONDS_PER_MINUTE;
} else {
results->cur_state_elapsed.value = (test_end_utc - test_start_utc) / SECONDS_PER_MINUTE;
}
} |
}
// --------------------------------------------------------------------------------------
// Run a set of samples through and verify that we got the right minute data
static void prv_test_minute_data(AccelRawData *samples, int num_samples,
TestMinuteData *exp_minutes, int exp_num_m... |
DMA_Init(FLASH_TX_DMA_STREAM, &dma_config);
/* Setup DMA interrupts */
NVIC_InitTypeDef nvic_config;
nvic_config.NVIC_IRQChannel = FLASH_DMA_IRQn;
nvic_config.NVIC_IRQChannelPreemptionPriority = 0x0f;
nvic_config.NVIC_IRQChannelSubPriority = 0x00;
nvic_config.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&nvic... | (buffer_size) | ;
mutex_assert_held_by_curr_task(s_flash_state.mutex, true /* is_held */);
// Writing a zero-length buffer is a no-op.
if (buffer_size < 1) {
return;
}
flash_write_enable();
flash_start_cmd();
flash_send_and_receive_byte(FLASH_CMD_PAGE_PROGRAM);
flash_send_24b_address(start_addr);
while (buff... |
e "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,... | (start.month, 2) | ;
cl_assert_equal_i(start.mday, 8);
cl_assert_equal_i(start.hour, 2);
cl_assert_equal_i(end.ds_label, 'S');
cl_assert_equal_i(end.month, 10);
cl_assert_equal_i(end.mday, 1);
cl_assert_equal_i(end.hour, 2);
}
void test_timezone_database__kazakhstan(void) {
{
const int almaty_region = FIND_REGION("Asi... |
/*
* 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... | (job, start_offset, remaining_length, data_out) | ;
remaining_length -= copied_length;
data_out += copied_length;
start_offset = 0;
}
job = (SessionSendQueueJob *)job->node.next;
}
return (length - remaining_length);
}
size_t comm_session_send_queue_get_read_pointer(const CommSession *session,
... |
onst jerry_value_t value) {
return JERRY_VALUE_HAS_TYPE(value, 'undefined');
}
////////////////////////////////////////////////////////////////////////////////
// Jerry Value Getter Functions
////////////////////////////////////////////////////////////////////////////////
bool jerry_get_boolean_value(const jerry_va... | (ReferenceError, message_p, message_size) | |
1480, 232, -136},
{ 1624, 256, -136},
{ 1504, 336, -224},
{ 1296, 328, -136},
{ 1104, 360, -80},
{ 1176, 352, 48},
{ 1248, 384, 16},
{ 1080, 384, -72},
{ 848, 408, -192},
{ 1240, 512, 48},
{ 1056, 704, 272},
{ 960, 816, -24},
{ 1328, 608, 0},
{ 816, 536, -104},
{ ... | ARRAY_LENGTH(samples) | ;
return samples;
}
// ----------------------------------------------------------------
// Sample captured: 2015-09-29 18:03:45 local
AccelRawData *activity_sample_taking_vitamins(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME taking_vitamins
//> TEST_EXPECTED 0
... |
gn, Variable length character output
snprintf(dstbuf, 256, "There are %*i lights", -3, 4);
cl_assert_equal_s(dstbuf, "There are 4 lights");
// Variable length digits output
snprintf(dstbuf, 256, "There are %.*i lights", 3, 4);
cl_assert_equal_s(dstbuf, "There are 004 lights");
// Variable length digits ... | snprintf(dstbuf, 256, "There are %03o lights, %03o", 8, -4) | ;
cl_assert_equal_s(dstbuf, "There are 010 lights, 37777777774");
// Space padded minimum character output
snprintf(dstbuf, 256, "There are %3o lights, %3o", 8, -4);
cl_assert_equal_s(dstbuf, "There are 10 lights, 37777777774");
// Space for positive signed
// No signed conversion occurs, so this is a no... |
{
return true;
} |
#include "system/bootbits.h"
bool boot_bit_test(BootBitValue bit) {
return false;
}
// Use this macro to define a PebbleProcessMd* getter function and an associated constant
// that it will return.
#define DEFINE_STUB_APP(FUNC_NAME, RESULT_VAL) \
static const PebbleProcessMd* FUNC_NAM... | |
raphics_api);
cl_assert_equal_i(0, s_layer_mark_dirty.call_count);
EXECUTE_SCRIPT("_rocky.requestDraw();");
cl_assert_equal_i(1, s_layer_mark_dirty.call_count);
cl_assert_equal_p(&s_app_window_stack_get_top_window.layer, s_layer_mark_dirty.last_call.layer);
}
void test_rocky_api_graphics__provides_draw_event(... | EXECUTE_SCRIPT(
"ctx.rockyFillRadial(30, 40, 10, 20, 0, Math.PI);\n"
) | |
/*
* 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... | FAILED(read_result) | |
L_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length);
return;
}
const FlashCRCRequest *request = payload;
const uint32_t num_entries = length / sizeof(FlashCRCRequest);
// this is just static cause it's potentially too big to put on the stack
static FlashCRCResponse response[MAX_DATA_LENGTH / si... | if (hdlc_err) {
s_curr_buf->is_valid = false;
} else if (is_complete) {
if (s_curr_buf->is_valid && s_curr_buf->checksum == CRC32_RESIDUE && s_curr_buf->index) {
// queue up processing of this frame and clear s_curr_buf so we'll switch to a new one
system_task_add_callback_from_isr(prv_process_fra... |
return should_context_switch;
}
bool accessory_imaging_handle_char(char c) {
static bool has_no_buffer = false;
if (!s_curr_buf) {
// find a buffer to write into
for (int i = 0; i < NUM_RX_BUFFERS; ++i) {
if (s_buffers[i].is_free) {
s_buffers[i].is_free = false;
s_curr_buf = &s_buf... |
= previous->length_min +
(current->start_utc - end_time) / SECONDS_PER_MINUTE;
current->start_utc = previous->start_utc;
previous->length_min = 0;
previous->type = ActivitySessionType_None;
}
}
static void prv_mitsuta_mean_loop_itr(int64_t new_value, int64_t *sum, int64_t *D) {... | health_data_update_hr_zone_minutes(health_data) | ;
}
void health_data_update_step_derived_metrics(HealthData *health_data) {
// get distance in meters
health_data->current_distance_meters = health_service_sum_today(HealthMetricWalkedDistanceMeters);
// get calories
health_data->current_calories = health_service_sum_today(HealthMetricActiveKCalories)
... |
Rect outer_bounds = grect_inset(frame, GEdgeInsets(-1));
#if PBL_RECT
GPoint start_outer_point = prv_steps_to_point(0, total, outer_bounds);
GPoint start_inner_point = prv_inset_point(&frame, start_outer_point, fill_thickness);
GPoint end_outer_point = prv_steps_to_point(current, total, outer_bounds);
GPoint e... | GEdgeInsets(line_length) | );
const GPoint line_inner_point = prv_steps_to_point(current_progress,
total_progress, inner_bounds);
#endif
graphics_context_set_stroke_color(ctx, color);
graphics_context_set_stroke_width(ctx, line_width);
graphics_draw_line(ctx, line_inner_point, line_ou... |
pins_cfg_i2c(I2CBus *bus) {
gpio_af_init(&bus->scl_gpio, GPIO_OType_OD, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL);
gpio_af_init(&bus->sda_gpio, GPIO_OType_OD, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL);
}
static void prv_bus_pins_cfg_input(I2CBus *bus) {
InputConfig in_scl = {
.gpio = bus->scl_gpio.gpio,
.gpio_pin = ... | (slave->bus->state->bus_mutex) | ;
return;
}
PBL_LOG(LOG_LEVEL_WARNING, "Resetting I2C bus %s", slave->bus->name);
// decrement user count for reset so that if this user is the only user, the
// bus will be powered down during the reset
slave->bus->state->user_count--;
// Reset and reconfigure bus and pins
prv_bus_reset(slave->bus... |
E = "Blah123";
static const BTDeviceAddress DEVICE_ADDR = {.octets = {0x88, 0x99, 0xaa, 0xbb, 0x00, 0x11}};
static const SMPairingInfo PAIRING_INFO = (const SMPairingInfo) {
.local_encryption_info = {
.ediv = 123,
.ltk = (const SMLongTermKey) {
.data = {
0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x22... | (shared_prf_storage_get_valid_page_number(), 0) | ;
}
void test_shared_prf_storage_v3__wipe_all(void) {
SMPairingInfo sm_pairing_info;
memset(&sm_pairing_info, 0xaa, sizeof(sm_pairing_info));
sm_pairing_info.is_local_encryption_info_valid = true;
sm_pairing_info.is_remote_signing_info_valid = true;
sm_pairing_info.is_remote_identity_info_valid = true;
sha... |
d *id) {
TimelineItem notification;
if (!notification_storage_get(id, ¬ification)) {
return;
}
prv_add_notification(s_data, id);
// NOTE: To avoid having two flash reads, we only read and validate the notification once.
// We do it here, instead of in the function call below. If the above
/... | WINDOW_NAME("Notifications") | );
window_set_user_data(window, data);
window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_window_load,
.appear = prv_window_appear,
.disappear = prv_window_disappear,
});
const bool animated = true;
app_window_stack_push(window, animated);
}
////////////////////
// App boilerplat... |
++i) {
s_receive_buffers[i] = kernel_malloc_check(sizeof(IncomingPulseFrame));
prv_return_receive_buffer(s_receive_buffers[i]);
}
s_current_receive_buffer = prv_take_receive_buffer();
s_drop_rest_of_frame = false;
s_keepalive_timer = new_timer_create();
PBL_ASSERTN(s_keepalive_timer != TIMER_INVALID_... | {
if (!cobs_streaming_decode(&s_frame_decode_ctx, c)) {
s_drop_rest_of_frame = true;
}
} | |
al_b(false, app_cache_entry_exists(app3.id));
}
static const uint32_t SIZE_SUM = 7210515;
static const AppData t_data[] = { // higher rank = should keep around
{ .id = 1, .priority = 40, .size = 131798 }, // priority rank 28
{ .id = 2, .priority = 60, .size = 194327 }, // priority rank 48
{ .id =... | cl_assert_equal_b(true, app_cache_entry_exists(t_data[i].id)) | ;
}
cl_assert_equal_i(SIZE_SUM, app_cache_get_size());
}
void prv_cleanup(void) {
app_cache_flush();
prv_load_lotta_apps();
}
void test_app_cache__free_up_space_lots_apps(void) {
uint32_t to_free;
uint32_t before_size;
uint32_t after_size;
// test random number
prv_cleanup();
to_free = 150000;
... |
CREATED_LAYOUT (GTextLayoutCacheRef)123456
void graphics_text_layout_cache_init(GTextLayoutCacheRef *layout_cache) {
*layout_cache = MOCKED_CREATED_LAYOUT;
}
void graphics_text_layout_cache_deinit(GTextLayoutCacheRef *layout_cache) {}
void graphics_text_layout_set_line_spacing_delta(GTextLayoutCacheRef layout, int16... | text_layer_enable_screen_text_flow_and_paging(&text_layer, 8) | ;
// nothing called
cl_assert_mocks_called((MockValues){});
cl_assert(text_layer.layout_cache == NULL);
}
void test_text_layer__enable_text_flow(void) {
text_layer.layer.window = &window;
text_layer_enable_screen_text_flow_and_paging(&text_layer, 8);
cl_assert_mocks_called(((MockValues){
.enable_text_... |
/*
* 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... | {
uint32_t address;
uint32_t length;
} | ExternalFlashEraseOptions;
typedef struct ExternalFlashEraseState {
uint32_t address;
uint32_t length;
unsigned int next_sector;
uint8_t cookie;
} ExternalFlashEraseState;
static int external_flash_domain_read(uint8_t *buf, uint32_t address, uint32_t length,
void *contex... |
PBL_LOG(LOG_LEVEL_DEBUG, "GATT notification stalled for %d ms...",
(int)(timeout_ms - ticks_to_milliseconds(timeout_end_ticks - rtc_get_ticks())));
analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_GATT_STALLED_NOTIFICATIONS_COUNT,
AnalyticsClient_System);
}
retur... | prv_unlock() | ;
}
if (UNLIKELY(task_mask != task_mask_none)) {
prv_send_notification_event(task_mask);
}
unlock:
bt_unlock();
}
// -------------------------------------------------------------------------------------------------
static GATTClientSubscriptionNode * prv_find_subscription_and_connection_for_cccd(
... |
est,
.sn = 0,
};
PPoGATTResetRequestClientIDPayload *client_id_payload =
(PPoGATTResetRequestClientIDPayload *) packet->payload;
*client_id_payload = (const PPoGATTResetRequestClientIDPayload) {
.ppogatt_version = client->version,
};
memcpy(client_id_payload->serial_number, mfg... | (client, client->out.next_data_sn) | ;
if (payload_size == 0) {
PBL_ASSERTN(read_space >= offset);
payload_size = read_space - offset;
if (payload_size == 0) {
// No data to send
return NULL;
}
// Cap to the size that the GATT MTU allows:
payload_size = MIN(payload_size, max_payload_size);
}
PPoGATTPacket *pack... |
eate_string_utf8(const jerry_char_t *str_p) {
if (!str_p) {
return jerry_create_undefined();
}
return jerry_create_string_utf8_sz(str_p, strlen((const char *)str_p));
}
jerry_value_t jerry_create_string_utf8_sz(const jerry_char_t *str_p, jerry_size_t str_size) {
if (!str_p) {
return jerry_create_undefi... | {
*prop_desc_p = (jerry_property_descriptor_t) {
.value = jerry_create_undefined(),
.getter = jerry_create_undefined(),
.setter = jerry_create_undefined(),
};
} |
jerry_value_t jerry_define_own_property(const jerry_value_t obj_val,
const jerry_value_t prop_name_val,
const jerry_property_descriptor_t *pdp) {
if (!jerry_value_is_object(obj_val) && !jerry_value_is_string(obj_val)) {
return TYPE_... |
irectionFuture,
time_21_00_march_1_pst), S_SUCCESS);
const time_t midnight_march_2_pst = 1425283200;
// day 1
cl_assert(uuid_equal(&state.pin.header.id, &all_day_item.header.id));
cl_assert(uuid_equal(&state.node->id, &all_day_item.header.id));
cl_assert(!state.node->al... | cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY) | ;
cl_assert_equal_i(state.current_day, midnight_march_2_pst);
// day 2
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &multiday_item.header.id));
cl_assert(uuid_equal(&state.node->id, &multiday_item.header.id));
cl_assert(state.node->all_day);
cl_assert_equal_i(state.node->ti... |
rly_deinit(void) {
}
bool activity_algorithm_deinit(void) {
return true;
}
void activity_algorithm_handle_accel(AccelRawData *data, uint32_t num_samples, uint64_t timestamp) {
// For testing purposes, we'll use the x movment as the steps and y as the sleep state
ActivitySleepState prior_state = s_test_alg_state... | {
cl_assert(s_test_alg_state.minute_data.num_sessions_created < TEST_ACTIVITY_MAX_SESSIONS);
s_test_alg_state.minute_data.sleep_current_container_idx =
s_test_alg_state.minute_data.num_sessions_created;
s_test_alg_state.minute_data.sessions[s_test_alg_state.minute_data.num_se... |
// Start a restful sleep session
cl_assert(s_test_alg_state.minute_data.num_sessions_created < TEST_ACTIVITY_MAX_SESSIONS);
s_test_alg_state.minute_data.sessions[s_test_alg_state.minute_data.num_sessions_created++]
= (ActivitySession) {
.type = ActivitySessionType_RestfulSl... |
true);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Custom Day Picker
static void prv_custom_day_picker_window_unload(Window *window) {
AlarmEditorData *data = (AlarmEditorData*) window_get_user_data(window);
if (!data->custom_day_picker_was_comple... | (&data->day_picker_menu_layer,
(MenuIndex) { 0, prv_alarm_kind_to_index(data->alarm_kind) },
MenuRowAlignCenter, false) | ;
}
static uint16_t prv_custom_day_picker_get_num_sections(struct MenuLayer *menu_layer,
void *callback_context) {
return 1;
}
static uint16_t prv_custom_day_picker_get_num_rows(struct MenuLayer *menu_layer,
ui... |
/*
* 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... | DEFINE_SYSCALL(status_t, persist_write_int, const uint32_t key, const int32_t value) | |
/*
* 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... | {
uint32_t *raw = (uint32_t *)reason;
raw[0] = RTC_ReadBackupRegister(REBOOT_REASON_REGISTER_1);
raw[1] = RTC_ReadBackupRegister(REBOOT_REASON_REGISTER_2);
raw[2] = RTC_ReadBackupRegister(REBOOT_REASON_STUCK_TASK_PC);
raw[3] = RTC_ReadBackupRegister(REBOOT_REASON_STUCK_TASK_LR);
raw[4] = RTC_ReadBackupRegis... |
void reboot_reason_clear(void) {
RTC_WriteBackupRegister(REBOOT_REASON_REGISTER_1, 0);
RTC_WriteBackupRegister(REBOOT_REASON_REGISTER_2, 0);
RTC_WriteBackupRegister(REBOOT_REASON_STUCK_TASK_PC, 0);
RTC_WriteBackupRegister(REBOOT_REASON_STUCK_TASK_LR, 0);
RTC_WriteBackupRegister(REBOOT_REASON_STUCK_TASK_CALL... |
/*
* 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... | (is_ble_pairable_and_discoverable) | ;
}
if (bt_driver_supports_bt_classic()) {
bt_driver_classic_pairability_set_enabled((s_allow_bt_pairing_refcount > 0));
bt_driver_classic_update_connectability();
}
}
static void prv_schedule_evaluation(void) {
// We used to sparingly schedule the evaluation and had a bug because of this:
// https:... |
+ 20, HealthServiceTimeScopeOnce },
.out = { HealthServiceAccessibilityMaskNotAvailable }
},
{
.desc = "Time range that goes further back into history than BPM supports",
.in = { HealthMetricHeartRateBPM, now - 3 * SECONDS_PER_HOUR, now, HealthServiceTimeScopeOnce },
.out = { HealthServ... | .in = { HealthMetricHeartRateBPM, now - 10, now, HealthAggregationMax,
HealthServiceTimeScopeDaily },
.out = { HealthServiceAccessibilityMaskNotSupported }
},
{
.desc = "Invalid time range with ScopeOnce and Max. NotSupported",
.in = { HealthMetricHeartRateBPM, now - 3 *... |
test->in.aggregation,
test->in.scope);
PBL_LOG(LOG_LEVEL_DEBUG, "%s\nMetric: %d, start: %d, end: %d, Aggregation: %d, Scope: %d",
test->desc, (int)test->in.metric, (... |
et_gbitmap_from_pbi("test_bitblt_palette_1bit__1bit_palette_to_1bit.pbi");
bitblt_bitmap_into_bitmap(&s_dest_bitmap, src_bitmap, GPointZero, GCompOpSet, GColorWhite);
cl_assert(gbitmap_pbi_eq(&s_dest_bitmap,
"test_bitblt_palette_1bit__1bit_palette_to_1bit_set-expect.pbi"));
gbitmap_destroy(src... | bitblt_bitmap_into_bitmap(&s_dest_bitmap, src_bitmap, GPoint(20,20), GCompOpAssign, GColorWhite) | ;
cl_assert(gbitmap_pbi_eq(&s_dest_bitmap,
"test_bitblt_palette_1bit__2bit_palette_to_1bit_offest-expect.pbi"));
gbitmap_destroy(src_bitmap);
}
void test_bitblt_palette_1bit__get_1bit_graphics_grayscale_pattern(void) {
cl_assert_equal_i(graphics_private_get_1bit_grayscale_pattern(GColorWhite, ... |
cond again
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check fourth
cl_assert(iter_next(&iterator));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id));
// check fifth
cl_assert(iter_next(&iterat... | (&iterator) | );
cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id));
// check done
cl_assert(iter_next(&iterator));
cl_assert(iter_next(&iterator) == false);
}
void test_timeline__middle_backwards(void) {
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
// check firs... |
/*
* 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... | (&buffer, data_out, data_out_size) | , 0);
// Write + consume, so read index is at 2:
circular_buffer_write(&buffer, (uint8_t *)"0123", 4);
circular_buffer_consume(&buffer, 2);
// Write data that will be wrapped:
circular_buffer_write(&buffer, (uint8_t *)"456789", 6);
// Test copying the whole thing (providing buffer of 8 bytes):
memset(d... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (bounds.origin.x, bounds.size.h / 2) | ;
end = GPoint(bounds.size.w, bounds.size.h / 2);
break;
case LineDirection_Vertical:
APP_LOG(APP_LOG_LEVEL_INFO, "Vertical lines");
start = GPoint(bounds.size.w / 2, bounds.origin.y);
end = GPoint(bounds.size.w / 2, bounds.size.h);
break;
case LineDirection_Diagonal:
A... |
8] = 256,
[TestStringFont_Gothic24B] = 113,
[TestStringFont_Other] = STRING_LENGTH_MAX,
#endif
},
},
[TestString_Typical] = {
.string = "Brian Gomberg\n"
"Re: Robert stand-up 06/06 • "
"y: - DDAD (enabling system apps to take advantage of memory mapped "
... | (0, 0, DISP_COLS, DISP_ROWS) | ;
int y_offset = atoi(s_perftest_text_arguments.y_offset);
bounds.origin.y -= y_offset;
if (y_offset > 0) {
bounds.size.h = DISP_ROWS + y_offset;
}
uint32_t avg = 0;
for (int i = 0; i < PERFTEST_TEXT_ITERATIONS; i++) {
// Sometimes this loop takes long enough that we end up watchdogging
watch... |
, 0},
{ 160, 800, 24},
{ 216, 864, 24},
{ 168, 984, 64},
{ 0, 1040, 0},
{ 16, 1232, 272},
{ -64, 1696, 184},
{ -112, 1288, 344},
{ -88, 1200, 240},
{ -32, 920, 200},
{ 16, 632, 160},
{ 112, 528, 136},
{ 184, 592, 144},
{ 168, 704, 200},
{ 168, 816, 208},
{ 80,... | { 56, 1072, 136},
{ 80, 1200, 64},
{ -112, 1240, 264},
// 72 seconds
{ -88, 1176, 96},
{ -32, 1064, 32},
{ -72, 1008, 128},
{ 16, 968, 80},
{ 120, 736, 24},
{ 160, 616, -32},
{ 208, 664, 16},
{ 248, 728, 48},
{ 208, 760, 24},
{ 288, 1008, 40},
{ 224, 1208, 208... |
{ -16, 1072, 216},
{ 32, 944, 312},
{ 40, 712, 248},
{ 128, 632, 168},
{ 224, 576, 200},
{ 216, 680, 232},
{ 224, 824, 232},
{ 240, 928, 256},
// 75 seconds
{ 200, 1024, 320},
{ 64, 984, 224},
{ 64, 1208, 144},
{ -96, 1248, 320},
{ -216, 1216, 232},
{ -80, 11... |
, just rely on the fact that
// this is the only consumer of DMA2.
periph_config_enable(DMA2, RCC_AHB1Periph_DMA2);
}
static void disable_flash_dma_clock(void) {
// TINTINHACK: Rather than update this file to use the new DMA driver, just rely on the fact that
// this is the only consumer of DMA2.
periph_conf... | flash_deep_sleep_enter() | ;
disable_flash_spi_clock();
}
}
}
void flash_power_up_after_stop_mode(void) {
// no need here as this platform doesn't support memory-mappable flash
}
uint32_t flash_get_sector_base_address(uint32_t addr) {
return addr & ~(SECTOR_SIZE_BYTES - 1);
}
// This simply issues a command to read a specific ... |
/*
* 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... | {
gdraw_command_list_iterate_private(command_list, handle_command, callback_context);
} |
GDrawCommand *gdraw_command_list_get_command(GDrawCommandList *command_list, uint16_t command_idx) {
if (!command_list || (command_idx >= command_list->num_commands)) {
return NULL;
}
GDrawCommand *command = command_list->commands;
for (uint32_t i = 0; i < command_idx; i++) {
command = prv_next_comma... |
// Layer C recognizer starts recognizing a gesture, failing other recognizers
e.type = TouchEvent_Touchdown;
s_next_state = RecognizerState_Started;
s_idx_to_change = 1;
recognizer_manager_handle_touch_event(&e, &manager);
prv_compare_recognizers_processed((int[]) {4, 0, 3, 1}, 4, &s_recognizers_handled);
p... | (manager.state, RecognizerManagerState_RecognizersTriggered) | ;
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Started);
cl_assert_equal_i(recognizers[1]->state, RecognizerState_Cancelled);
cl_assert_equal_i(recognizers[3]->state, RecognizerState_Failed);
cl_assert_equal_i(recognizers[4]->state, RecognizerState_Failed);
// Touchdown occurs, Window recognizer ... |
icense, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distribut... | job->impl->get_length(job) | ;
const size_t consume_length = MIN(remaining_length, job_length);
job->impl->consume(job, consume_length);
SessionSendQueueJob *next = (SessionSendQueueJob *)job->node.next;
if (job_length == consume_length) {
// job's done
list_remove((ListNode *)job, (ListNode **)&session->send_queue_head... |
son.h"
#include "stubs_resources.h"
#include "stubs_syscalls.h"
#include "stubs_compiled_with_legacy2_sdk.h"
///////////////////////////////////////////////////////////
// Fakes
static GContext s_ctx;
static FrameBuffer s_fb;
size_t framebuffer_get_size_bytes(FrameBuffer *f) {
return FRAMEBUFFER_SIZE_BYTES;
}
///... | (*word_iter_state.current.end == '\n') | |
radius);
}
T_STATIC void prv_draw_round_rect_aa_stroked(GContext* ctx, const GRect *rect,
uint16_t radius, uint8_t stroke_width) {
// Assumes AA and stroke_width is set appropriately in ctx
prv_draw_round_rect(ctx, rect, radius);
}
#endif // SCREEN_COLOR_DEPTH_BITS
T_... | process_manager_compiled_with_legacy2_sdk() | ,
#endif
.stroke_width = 1,
.draw_implementation = &g_default_draw_implementation,
.avoid_text_orphans = (init_mode == GContextInitializationMode_System),
};
}
GDrawState graphics_context_get_drawing_state(GContext* ctx) {
PBL_ASSERTN(ctx);
return ctx->draw_state;
}
void graphics_context_set_drawing... |
ere we could mess it up
if (memcmp(&curr_val, data_in, data_len) == 0) {
do_perform_update = false;
}
}
if (do_perform_update) {
s_bt_persistent_storage_updates++;
PBL_LOG_D(LOG_DOMAIN_BT_PAIRING_INFO, LOG_LEVEL_DEBUG,
"Updating GAP Bonding DB Val... | shared_prf_storage_get_root_key(SMRootKeyTypeIdentity, &keys[SMRootKeyTypeIdentity]) | ) {
#if !defined(RELEASE) && !defined(PLATFORM_TINTIN)
PBL_LOG(LOG_LEVEL_INFO, "Loading Root Keys from PRF storage:");
PBL_HEXDUMP(LOG_LEVEL_INFO, (const uint8_t *) keys, sizeof(keys));
#endif
bt_persistent_storage_set_root_keys(keys);
return;
}
// if we get here there are no root keys in prf stora... |
#include "process_state/app_state/app_state.h"
#include "resource/resource_ids.auto.h"
#include "services/common/i18n/i18n.h"
#include "system/passert.h"
typedef struct ActionToggleDialogConfig {
const char *window_name;
const char *message;
ResourceId icon;
GColor text_color;
GColor background_color;
unsi... | {
ActionToggleContext *ctx = context;
if (!ctx) {
return;
}
if (ctx->defer_destroy) {
ctx->defer_destroy = false;
return;
}
applib_free(ctx);
} |
static void prv_prompt_click_config_provider(void *context) {
window_single_click_subscribe(BUTTON_ID_SELECT, prv_handle_prompt_confirm);
}
static void prv_push_prompt_dialog(ActionToggleContext *ctx) {
ActionToggleDialogConfig config = {
.message = ctx->config.impl->prompt_messages[prv_get_toggled_state_ind... |
tLszgMocgGSEsqmoipqqWdk7dq",
}, {
.key = "friday_steps",
.val = "uxFhoWTzJxDOmyBX2g3n7wdoPKxeleBR7iwKGn7utn8qTEj0tB7aw65EEFZ5QldgAkg6lctSmamf2p95l2CpHXNgVL22hQFx" \
"uxFhoWTzJxDOmyBX2g3n7wdoPKxeleBR7iwKGn7utn8qTEj0tB7aw65EEFZ5QldgAkg6lctSmamf2p95l2CpHXNgVL22hQFx",
}, {
.key = "sat... | cl_assert_equal_i(s_metric_updated_count, NUM_CURRENT_MOVEMENT_METRICS) | ;
s_metric_updated_count = 0;
key = "monday_movementData";
cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key),
(uint8_t *)s_movement_data, sizeof(s_movement_data)),
S_SUCCESS);
cl_assert_equal_i(s_metric_updated_count, NUM_CURRENT_MOVEMENT_M... |
_context_switch);
} else {
BMI160_DBG("%s", "We fell behind on motion interrupt handling!");
}
}
static uint8_t prv_get_fifo_frame_size(void) {
return 6; // we are just storing {x, y, z} accel data in the fifo today
}
static uint16_t prv_get_current_fifo_length_and_timestamp(uint64_t *timestamp_us) {
int ... | bmi160_read_reg(BMI160_REG_INT_STATUS_1) | , status);
}
}
static void bmi160_IRQ2_handler(bool *should_context_switch) {
if (!s_accel_outstanding_data_work) {
s_accel_outstanding_data_work = true;
accel_offload_work_from_isr(prv_handle_data, should_context_switch);
} else {
BMI160_DBG("%s", "We fell behind on data handling");
}
}
// in ord... |
LOG_LEVEL_DEBUG,
"Trying to set local address to auto-cycling private resolvable address!");
desired_address_out->addr_type = PRIVATE_RANDOM_RESOLVABLE_ADDRESS;
return;
}
PBL_LOG(LOG_LEVEL_DEBUG,
"Trying to set local address: allow_cycling=%d, pinned_address="BT_DEVICE_ADDRESS_FMT,
... | BT_DEVICE_ADDRESS_XPLODE_PTR(updated_address) | );
}
}
void local_addr_handle_adverts_stopped(void) {
prv_assert_is_executing_on_ble_task();
if (s_local_addr_state == LocalAddressState_AwaitingAdvertisementsPaused) {
PBL_LOG(LOG_LEVEL_DEBUG, "Adverts paused, trying to update own address");
prv_try_updating_own_address();
}
}
void local_addr_handle... |
PhoneEventType_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_invok... | phone_protocol_msg_callback(s_session, pp_msg, sizeof(pp_msg)) | ;
PebbleEvent e = fake_event_get_last();
cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT);
}
// PBL-34640 Make sure we don't put an incoming call event to a state response - the incoming call
// state is only used for iOS 8 devices now and just causes trouble
void test_phone_pp__get_phone_call_state_response_incoming(... |
60},
{ 312, 1176, -136},
{ 400, 1392, -136},
{ 264, 1336, -104},
{ 184, 1008, -96},
{ 224, 1016, -48},
{ 176, 1032, -72},
{ 80, 792, -120},
{ 48, 560, -152},
{ 56, 456, -192},
{ 80, 336, -176},
// 13 seconds
{ 72, 240, -184},
{ 24, 208, -184},
{ -104, 256, -208},
... | { -312, 600, 720},
{ -184, 576, 624},
{ -168, 320, 528},
{ -136, 296, 416},
{ -128, 352, 376},
{ -136, 72, 392},
{ -224, 96, 264},
{ -344, 248, 376},
{ -592, 136, 392},
{ -880, 480, 384},
{ -1232, 440, 280},
{ -1880, 544, 96},
{ -1944, 800, -168},
{ -1232, 520, -7... |
{ -784, -88, -48},
{ -1064, 16, -152},
{ -1176, 72, -288},
{ -1024, 48, -384},
// 21 seconds
{ -1240, -16, -368},
{ -1376, -24, -336},
{ -1240, -16, -216},
{ -1040, 112, -152},
{ -968, 264, -136},
{ -1072, 304, -168},
{ -1184, 376, -200},
{ -1032, 352, -216},
{ -... |
ration(new_reel, duration);
kino_reel_scale_segmented_set_deflate_effect(new_reel, CARD_TRANSITION_ICON_EXPAND);
kino_reel_scale_segmented_set_delay_by_distance(new_reel, GPoint(0, icon_to.size.h / 2));
prv_change_reel(card_timeline_layout, new_reel);
kino_layer_play_section(&card_timeline_layout->icon_layer, ... | (new_reel, duration / 2) | ;
kino_reel_scale_segmented_set_delay_by_distance(
new_reel, GPoint(icon_from.size.w, icon_from.size.h / 2));
prv_change_reel(card_timeline_layout, new_reel);
kino_layer_set_callbacks(&card_timeline_layout->icon_layer, (KinoLayerCallbacks) {
.did_stop = prv_card_to_pin_stopped,
}, pin_timeline_layout... |
de "services/common/compositor/compositor.h"
#include "services/common/system_task.h"
#include "services/normal/filesystem/pfs.h"
#include "syscall/syscall.h"
#include "system/bootbits.h"
#include "system/hexdump.h"
#include "system/logging.h"
#include "system/passert.h"
#include "system/reboot_reason.h"
#include "syst... | MIN(MAX_READ_FLASH_SIZE,length) | );
if (buffer == 0) {
prompt_send_response("Unable to allocate read buffer");
return;
}
while (length > 0) {
uint32_t read_length = MAX_READ_FLASH_SIZE;
if (length < MAX_READ_FLASH_SIZE){
read_length = length;
}
flash_read_bytes(buffer, address, read_length);
// Output to seri... |
e;
size_t response_len = sizeof(*resp);
size_t command_len = MIN(length, PULSE_MAX_SEND_SIZE - response_len);
response_len += command_len;
memcpy(resp->bad_command, cmd, command_len);
pulse_reliable_send(resp, response_len);
}
static int prv_get_fresh_fd(PulseBulkIODomainHandler *domain_handler, PulseTrans... | pulse_reliable_send(resp, sizeof(*resp)) | ;
prv_free_fd(cmd->close.fd);
}
static void prv_handle_read(Command *cmd, size_t length) {
if (cmd->read.length == 0) {
prv_respond_internal_error(cmd, length, E_INVALID_ARGUMENT);
return;
}
PulseTransferFD *pulse_fd = prv_get_fd(cmd, length);
if (!pulse_fd) {
// prv_get_fd has already sent an ... |
sturbSchedule schedule = {
.from_hour = 1,
.from_minute = 0,
.to_hour = 12,
.to_minute = 30,
};
do_not_disturb_set_schedule(WeekdaySchedule, &schedule);
cl_assert(do_not_disturb_is_manually_enabled() == false);
cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == false);
active = d... | cl_assert(active == false) | |
{
return 0;
}
}
// ------------------------------------------------------------------------------------
// Find timer by id
static bool prv_id_list_filter(ListNode* node, void* data) {
TaskTimer* timer = (TaskTimer*)node;
return timer->id == (uint32_t) data;
}
static TaskTimer* prv_find_timer(TaskTimerMana... | (manager, timer_id) | ;
PBL_ASSERTN(!timer->defer_delete);
// If expire timer is not 0, it means we are scheduled
bool retval = (timer->expire_time != 0);
// Figure out expire timer?
if (expire_ms_p != NULL && retval) {
RtcTicks current_ticks = rtc_get_ticks();
if (timer->expire_time > current_ticks) {
*expire_ms_p... |
l_color(ctx, fill_color);
ctx->lock = lock;
reset_last_args_for_mock();
}
// Setup
void test_graphics_context_${BIT_DEPTH_NAME}__initialize(void) {
fb = malloc(sizeof(FrameBuffer));
framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS});
test_graphics_context_init(&context, fb);
}
// Teardown
void test_graph... | graphics_context_set_antialiased(&context, true) | ;
cl_assert(context.draw_state.antialiased == true);
#endif
// Stroke Width
graphics_context_set_stroke_width(&context, 11);
cl_assert(context.draw_state.stroke_width == 11);
// Make sure setting to zero is ignored
draw_state = graphics_context_get_drawing_state(&context);
graphics_context_set_stroke_... |
_layer_init(inverter, &GRectZero);
scroll_layer_add_child(scroll_layer, &inverter->layer);
// Hide inverter layer by default for 3.0 apps
layer_set_hidden(inverter_layer_get_layer(&menu_layer->inverter), true);
#if PBL_ROUND
prv_set_center_focused(menu_layer, true);
#endif
}
MenuLayer* menu_layer_create(GRec... | {
menu_layer->callbacks = *callbacks;
PBL_ASSERTN(menu_layer->callbacks.draw_row);
PBL_ASSERTN(menu_layer->callbacks.get_num_rows);
} |
menu_layer->callback_context = callback_context;
menu_layer_reload_data(menu_layer);
}
void menu_layer_set_callbacks_by_value(MenuLayer *menu_layer, void *callback_context,
MenuLayerCallbacks callbacks) {
menu_layer_set_callbacks(menu_layer, callback_context, &callbacks)... |
{ -16, -264, -856},
{ -88, -256, -912},
{ -168, -336, -896},
{ -80, -272, -1008},
{ -24, -312, -824},
{ 16, -88, -1064},
{ -72, -152, -888},
{ -48, -240, -912},
{ -88, -216, -960},
{ -32, -224, -992},
{ 8, -232, -1024},
{ -24, -304, -872},
{ 32, -168, -952},
{ -1... | { -32, -128, -960},
{ -40, -144, -960},
{ -40, -112, -960},
{ -56, -104, -968},
{ -56, -112, -944},
// 18 seconds
{ -48, -112, -944},
{ -56, -104, -944},
{ -56, -112, -944},
{ -48, -112, -976},
{ -32, -160, -984},
{ -8, -120, -952},
{ -40, -160, -960},
{ -56, -152... | |
/*
* 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... | (cb[i], state_x[i]) | |
uct {
const char *const script;
size_t expected_utf_size;
const char *const expected_utf_data;
} cases[] = {
[0] = {
.script = "var str = '\\uDCA9';", // low surrogate only
.expected_utf_size = 0,
},
[1] = {
.script = "var str = '\\uD83D';", // high surrogate only
.expe... | (copied_bytes, strlen(cases[i].cesu8_output)) | ;
if (copied_bytes) {
cl_assert_equal_m(output, cases[i].cesu8_output, copied_bytes);
}
// TODO: test equality/hash
jerry_release_value(s);
}
}
|
n_window.h"
#include "process_state/app_state/app_state.h"
#include "resource/resource_ids.auto.h"
#include "services/common/i18n/i18n.h"
#include "services/normal/blob_db/pin_db.h"
#include "services/normal/notifications/notification_storage.h"
#include "services/normal/timeline/notification_layout.h"
#include "shell/... | (loaded_notif->icon) | ;
app_free(loaded_notif);
}
static NOINLINE LoadedNotificationNode *prv_loaded_notification_list_load_item(
LoadedNotificationNode **loaded_list, NotificationNode *node) {
if (node == NULL) {
return NULL;
}
LoadedNotificationNode *loaded_node = prv_find_loaded_notification(*loaded_list, &node->id);
... |
r_set_hidden(&data->action_button_layer, !prv_should_provide_action_menu_for_item(data, n));
}
// update status bar to the current info
prv_update_status_layer(data);
kino_layer_play(&((NotificationLayout *)layout)->icon_layer);
}
static void prv_update_colors_handler(SwapLayer *swap_layer, GColor bg_color,
... | swap_layer_init(swap_layer, &swap_frame) | ;
swap_layer_set_callbacks(swap_layer, data, (SwapLayerCallbacks) {
.get_layout_handler = prv_get_layout_handler,
.layout_removed_handler = prv_layout_removed_handler,
.layout_did_appear_handler = prv_layout_did_appear_handler,
#if PBL_COLOR
.update_colors_handler = prv_update_colors_handler,
#endif
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_LOG(LOG_LEVEL_WARNING, "%s: From app queue is full! Dropped %p! Killing App",
(task == PebbleTask_App ? "App" : "Worker"), event) | |
const int typical_end =
(typical_sleep_end_12h * HEALTH_PROGRESS_BAR_MAX_VALUE / TWELVE_HOURS);
#if PBL_COLOR
const bool fell_asleep_late = (typical_sleep_start_24h < sleep_start_24h);
if (fell_asleep_late) {
health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR,
... | (ctx, base_layer, sleep_text) | ;
}
static void prv_render_no_sleep_data_text(GContext *ctx, Layer *base_layer) {
HealthSleepSummaryCardData *data = layer_get_data(base_layer);
const int y = PBL_IF_RECT_ELSE(91, 100);
const GRect rect = GRect(0, y, base_layer->bounds.size.w, 60);
const char *text = i18n_get("No sleep data,\nwear your watch... |
erialized_byte_length = 4;
list->data[0] = '\0';
list->data[1] = 'b';
list->data[2] = '\0';
list->data[3] = '\0'; // end of data
list->data[4] = '\0';
cl_assert_equal_i(4, string_list_count(list));
cl_assert_equal_s("", string_list_get_at(list, 0));
cl_assert_equal_s("b", string_list_get_at(list, 1));
... | cl_assert_equal_p(timeline_item_find_dismiss_action(&item), NULL) | ;
// Make sure we find both dismiss and ancs negative actions
action_list[1].type = TimelineItemActionTypeDismiss;
cl_assert_equal_p(timeline_item_find_dismiss_action(&item), &action_list[1]);
action_list[1].type = TimelineItemActionTypeAncsNegative;
cl_assert_equal_p(timeline_item_find_dismiss_action(&item... |
store(item);
timeline_item_destroy(item);
attribute_list_destroy_list(&list);
}
static void prv_add_weather_pin_with_params(int32_t delta_time_s, bool has_timestamp,
bool has_short_title, bool has_short_subtitle) {
const time_t now = rtc_get_time();
AttributeList li... | (&list, icon ?: TIMELINE_RESOURCE_TIMELINE_CALENDAR, card_icon) | |
mples_system_cb, context);
data += chunk_size;
num_samples -= chunk_size;
}
return true;
}
// ------------------------------------------------------------------------------------------------
bool activity_test_run_minute_callback(void) {
return system_task_add_callback(prv_minute_system_task_cb, NULL);... | activity_algorithm_test_fill_minute_file() | ;
} else {
context->success = false;
}
// Unblock the caller
context->completed = true;
xSemaphoreGive(s_activity_state.bg_wait_semaphore);
}
bool activity_test_fill_minute_file(void) {
// Fill in the context
ActivitySleepFileInfoContext context = (ActivitySleepFileInfoContext) { };
// Enqueue it... |
e;
settings_file_set(file, &m_info.settings_key, sizeof(m_info.settings_key),
&history, sizeof(history));
}
activity_private_settings_close(file);
}
if (current_value_updated) {
if (metric == ActivityMetricStepCount) {
PebbleEvent e = {
.type = PEBBLE_HEALTH... | (state->mutex) | |
ics_draw_horizontal_line_dotted(&ctx, GPoint(36, 16), 10);
// T facing up
graphics_draw_vertical_line_dotted(&ctx, GPoint(70, 15), 5);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(65, 15), 10);
// T facing down
graphics_draw_vertical_line_dotted(&ctx, GPoint(101, 11), 5);
graphics_draw_horizontal_lin... | graphics_context_set_antialiased(ctx, false) | ;
graphics_context_set_stroke_width(ctx, 5);
graphics_draw_line(ctx, GPoint(90,90), GPoint(90,90));
graphics_context_set_antialiased(ctx, true);
graphics_context_set_stroke_width(ctx, 5);
graphics_draw_line(ctx, GPoint(100,100), GPoint(100,100));
}
void test_graphics_draw_line__same_point(void) {
GContext... |
/*
* 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... | {
uint16_t token = (uint16_t)(uintptr_t)data;
BlobDBSyncSession *session = (BlobDBSyncSession *)node;
return session->current_token == token;
} | |
b/preferred_content_size.h"
#include "process_state/app_state/app_state.h"
#include "shell/system_theme.h"
#include "system/logging.h"
#include "system/passert.h"
#include <string.h>
#include <stddef.h>
static GTextLayoutCacheRef prv_text_layer_get_cache_handle(TextLayer *text_layer) {
PBL_ASSERTN(text_layer);
re... | {
PBL_ASSERTN(text_layer);
return text_layer->text;
} | |
/*
* 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... | (test_player, 0, sizeof(KinoPlayer)) | ;
kino_player_set_reel(test_player, test_reel, true);
}
// Teardown
void test_kino_player__cleanup(void) {
kino_reel_destroy(test_reel);
}
// Tests
////////////////////////////////////
extern void prv_play_animation_update(Animation *animation, const AnimationProgress normalized);
void test_kino_player__finite... |
g ID cause it doesn't matter)
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_... | bt_persistent_storage_store_bt_classic_pairing(&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,
... |
/*
* 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... | analytics_external_collect_chip_specific_parameters() | ;
analytics_external_collect_bt_pairing_info();
analytics_external_collect_ble_parameters();
analytics_external_collect_ble_pairing_info();
analytics_external_collect_system_flash_statistics();
analytics_external_collect_backlight_settings();
analytics_external_collect_notification_settings();
analytics_e... |
unt);
}
}
iteration_count++;
}
PBL_LOG(LOG_LEVEL_DEBUG, "Ran %d iterations", iteration_count);
PBL_LOG(LOG_LEVEL_DEBUG, ">PASS - STRESS TEST 1");
return FLASH_TEST_SUCCESS;
}
/***********************************************************/
/******************* Perf Data Test Functions ***********... | PBL_LOG(LOG_LEVEL_DEBUG, ">>>>>PASS FLASH TEST CASE %d<<<<<", test_case_num) | ;
}
else {
PBL_LOG(LOG_LEVEL_DEBUG, ">>>>>FAIL FLASH TEST CASE %d, Status: %d<<<<<", test_case_num, status);
}
// Re-enable watchdog state if previously enabled
if (previous_task_watchdog_state) {
task_watchdog_bit_set(pebble_task_get_current());
task_watchdog_mask_set(pebble_task_get_current()... |
/*
* 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... | { 56, -136, -1024},
{ 72, -144, -1016},
{ 80, -168, -1016},
{ 72, -184, -1008},
{ 64, -200, -1008},
{ 56, -192, -1016},
{ 72, -208, -1008},
{ 80, -200, -1024},
{ 80, -192, -1024},
{ 72, -200, -1008},
{ 72, -208, -1000},
{ 80, -224, -1000},
{ 72, -216, -992},
{ 72,... |
{ -1176, 2712, -320},
{ -712, 4000, -1608},
{ 624, 4000, -936},
{ 1544, 2496, 912},
{ 1224, 784, 632},
{ 1408, -16, 296},
// 5 seconds
{ 1424, -472, 112},
{ 1536, -408, -192},
{ 1360, -176, -8},
{ 1328, 16, 88},
{ 2208, 2176, -584},
{ 2200, 4000, -2072},
{ 152, 3... |
/*
* 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_single_click_subscribe(BUTTON_ID_UP, (ClickHandler) confirm_click_handler);
window_long_click_subscribe(BUTTON_ID_UP, 1200, (ClickHandler) confirm_long_click_handler, NULL);
window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler) decline_click_handler);
(void)window;
} |
static void prv_window_load(Window *window) {
ConfirmUIData *data = window_get_user_data(window);
const GRect *root_layer_bounds = &window_get_root_layer(window)->bounds;
const int16_t width = root_layer_bounds->size.w - ACTION_BAR_WIDTH;
const uint16_t x_margin_px = PBL_IF_ROUND_ELSE(6, 3);
const uint16_t... |
);
}
void accessory_set_power(bool on) {
if (on == s_power_enabled) {
return;
}
PBL_LOG(LOG_LEVEL_DEBUG, "Setting accessory power %s", on?"on":"off");
s_power_enabled = on;
gpio_output_set(&BOARD_CONFIG_ACCESSORY.power_en, on);
}
bool accessory_is_present(void) {
accessory_set_power(true);
gpio_inpu... | accessory_set_baudrate(DEFAULT_BAUD) | ;
accessory_use_dma(false);
char buffer[50];
if (!success) {
prompt_send_response_fmt(buffer, sizeof(buffer), "FAILED: send timed-out");
} else if (s_num_test_bytes == 0) {
prompt_send_response_fmt(buffer, sizeof(buffer), "PASS!");
} else {
prompt_send_response_fmt(buffer, sizeof(buffer), "FAILED... |
static const uint32_t FLASH_DMA_IRQn = DMA2_Stream0_IRQn;
static const uint32_t FLASH_DATA_REGISTER_ADDR = (uint32_t)&(SPI1->DR);
/* TX DMA */
static DMA_Stream_TypeDef* FLASH_TX_DMA_STREAM = DMA2_Stream3;
static const uint32_t FLASH_TX_DMA_CHANNEL = DMA_Channel_3;
static uint32_t analytics_read_count;
static uint32_... | (FLASH_DMA_STREAM, DMA_IT_TC, ENABLE) | ;
// enable the DMA stream to start the transfer
SPI_I2S_DMACmd(FLASH_SPI, SPI_I2S_DMAReq_Tx | SPI_I2S_DMAReq_Rx, ENABLE);
}
static void do_dma_transfer(void) {
xSemaphoreTake(s_flash_state.dma_semaphore, portMAX_DELAY);
stop_mode_disable(InhibitorFlash);
DMA_Cmd(FLASH_DMA_STREAM, ENABLE);
DMA_Cmd(FLASH_T... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (!memcmp(testbuf1, testbuf2, 8), true) | ;
}
void test_memcmp__different_content(void) {
uint8_t testbuf1[8] = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, };
uint8_t testbuf2[8] = { 0x12, 0x34, 0x56, 0x78, 0x00, 0xBC, 0xDE, 0xF0, };
cl_assert_equal_b(!memcmp(testbuf1, testbuf2, 8), false);
}
void test_memcmp__partial(void) {
uint8_t testbuf1[9... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.