prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
ck_recognizer_get_button_id(recognizer);
if (button_id == BUTTON_ID_BACK) {
VOICE_LOG("Exit UI");
prv_cancel_dictation(data);
DictationSessionStatus status = DictationSessionStatusFailureTranscriptionRejected;
if ((data->error_count > 0) && !data->last_session_successful) {
status = DictationSes... | (current_state != next_state, "Trying to transition to the same state %d",
next_state) | ;
PBL_ASSERTN(next_state != StateStart); // Cannot transition to start state
VOICE_LOG("Transition: Current state: %d; new state: %d", current_state, next_state);
// Transition will be handled by the animation stopped handler if defer_transition is set to true
*defer_transition = false;
// These transitio... |
blePacket.i is wrong");
_Static_assert(sizeof((ReliablePacket){0}.s) == 2,
"sizeof ReliablePacket.s is wrong");
_Static_assert(sizeof((ReliablePacket){0}.i) == sizeof(ReliablePacket),
"Something is really wrong here");
static bool s_layer_up = false;
static ReliableInfoBuffer *s_tx_buffer... | (packet->i.protocol) | ) {
case PULSE_CONTROL_MESSAGE_PROTOCOL:
// TODO PBL-37695: PCMP sends packets synchronously, which will
// trip the not-KernelMain check on pulse_reliable_send_begin.
// pulse_control_message_protocol_on_packet(
// &s_reliable_pcmp, packet->i.informatio... |
about 112 bytes. Base64 encoded it becomes 112 * 4/3 = 150 bytes. That is too much
// to fit in a single log line, so we split it into 2.
uint32_t chunk_size = sizeof(data->record) / 2;
uint8_t *binary_data = (uint8_t *)&data->record;
int32_t num_chars = base64_encode(data->base64_buf, sizeof(da... | prv_accel_cb(context->data, context->num_samples, timestamp) | |
cribers++;
ms_per_update = state->samples_per_update * 1000 / state->sampling_rate;
if (ms_per_update < lowest_ms_per_update) {
lowest_ms_per_update = ms_per_update;
}
}
state = (AccelSubscriberState *)state->list_node.next;
}
// Setup the subsampling numerator and denominators
... | {
// Else, if the FIFO is 1 deep, we can ask the accel driver for the cached reading from the
// last FIFO read
if (s_temp_peek_mode) {
prv_set_restore_fifo_mode_timer(); // Give us another N seconds
}
accel_get_latest_reading((AccelRawData *)accel_data);
accel_data->times... | else {
uint64_t old_timestamp_ms = accel_get_latest_timestamp();
// Else, change the FIFO to 1 deep and wait for a reading
ACCEL_LOG_DEBUG("setting FIFO to 1 deep for peek");
accel_set_num_samples(1);
s_accel_samples_per_update = 1;
// Set a timer to restore settings after a whil... |
/*
* 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... | grect_clip(&rect, &ctx->dest_bitmap.bounds) | ; // clip to display bounds
for (int16_t y = rect.origin.y; y < rect.origin.y + rect.size.h; y++) {
int16_t row_offset = y * ctx->dest_bitmap.row_size_bytes;
for (int16_t x = rect.origin.x; x < rect.origin.x + rect.size.w; x++) {
uint8_t *pixel_addr = &(((uint8_t*)ctx->dest_bitmap.addr)[row_offset + x]... |
) {
app_manager_close_current_app(false);
} else if (i == PebbleTask_Worker &&
worker_manager_get_current_worker_md()->is_unprivileged) {
worker_manager_close_current_worker(false);
} else {
PBL_ASSERTN(0);
}
#endif
}
}... | syscall_assert_userspace_buffer(uuid, sizeof(*uuid)) | ;
}
if (uuid == NULL) {
uuid = &sys_process_manager_get_current_process_md()->uuid;
}
return prv_get_plugin_index(uuid);
}
DEFINE_SYSCALL(void, sys_event_service_cleanup, PebbleEvent *e) {
if (PRIVILEGE_WAS_ELEVATED) {
syscall_assert_userspace_buffer(e, sizeof(PebbleEvent));
}
EventServiceBuffer... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (s_dest_bitmap) | ;
s_dest_bitmap = NULL;
}
// Helpers
//////////////////////
static char s_emoji_string[] =
"๐๐๐๐โบ๐๐๐๐๐๐๐๐๐๐ณ๐๐๐๐๐๐ฃ๐ข๐๐ญ๐ฅ๐ช๐ฐ๐
๐๐ฉ๐ซ๐จ๐ฑ"
"๐ ๐ก๐ค๐๐๐๐ท๐๐ด๐ต๐ฒ๐๐ง๐๐ฟ๐ฎ๐ฌ๐๐๐ฏ๐ถ๐๐๐๐บ๐ธ๐ป๐ฝ๐ผ๐๐ฟ๐น๐พ๐ฉ"
"๐๐๐๐โโ๐โ๐๐๐๐๐๐๐โ๐๐๐๐๐โค๐๐๐๐๐๐๐๐๐ฅ๐๐ฉ๐ป๐บ"
"๐ช๐ฅ๐ต๐โ... |
mp(sensor_timestamp_before);
uint32_t end_time = prv_sensortime_to_timestamp(sensor_timestamp_after);
uint32_t sample_time_bit = prv_get_sample_collection_bit();
// see if the upper bits oveflowed
uint32_t upper_bits_mask = ~((0x1 << sample_time_bit) - 1);
start_time &= upper_bits_mask;
end_time &= upper_... | {
BMI160_DBG("Wahh, no motion/tap?: INT0: 0x%"PRIx8", INT2: 0x%"PRIx8, int0_status, int2_status);
prv_dump_int_stats();
} |
if (toggled_power_mode) {
bmi160_set_accel_power_mode(BMI160_Accel_Mode_Low);
}
}
// TODO: strictly for debug, remove when done
static void prv_dump_int_stats(void) {
for (uint8_t addr = 0x1b; addr <= 0x1f; addr++) {
BMI160_DBG("0x%"PRIx8" = 0x%"PRIx8, addr, bmi160_read_reg(addr));
}
BMI160_DBG("La... |
/*
* 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... | launcher_task_add_callback(command_sim_panic_cb, (void*) error_code) | ;
}
|
prv_get_row_height_depending_on_selection_state(struct MenuLayer *menu_layer,
MenuIndex *cell_index,
void *callback_context) {
MenuIndex selected_index = menu_layer_get_selected_index(menu_layer);
bool i... | MenuIndex(0, 2) | , MenuRowAlignNone, false);
// new center-focus behavior: adjust for changed row sizes depending on focused row
cl_assert(menu_layer_get_center_focused(&l) == true);
cl_assert_equal_i(2 * NORMAL, l.selection.y);
cl_assert_equal_i(NORMAL - FOCUSED, scroll_layer_get_content_offset(&l.scroll_layer).y);
cl_assert... |
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 "comm/bt_lock.h"
#include "services/common/comm_session/session_analytics.h"
#include "services/common/comm_session/session_internal.h"
#in... | job->impl->free(job) | ;
}
remaining_length -= consume_length;
job = next;
}
}
|
1));
const bool has_quiet_time_action = true; // Always true
const bool has_ancs_mute_action = prv_has_mute_action(item);
uint8_t num_local_actions = 0;
num_local_actions += (has_snooze_action) ? 1 : 0;
num_local_actions += (has_dismiss_all_action) ? 1 : 0;
num_local_actions += (has_quiet_time_action) ? 1 ... | (notif_prefs) | ;
}
if (has_dismiss_all_action) {
action_menu_level_add_action(root_level,
i18n_get("Dismiss All", root_level),
prv_dismiss_all_action_cb,
window_data);
}
if (has_quiet_time_action) {
action_menu_level_ad... |
-48},
{ 720, -72, -144},
{ 952, 56, -352},
{ 1064, -64, -256},
{ 936, 48, -200},
{ 696, 16, -328},
{ 672, 0, -160},
{ 928, 168, -336},
{ 1216, 248, -400},
{ 1416, 344, -440},
{ 1312, 432, -648},
{ 1024, 488, -488},
{ 1128, 616, -656},
{ 1024, 424, -576},
{ 1040, 4... | { -504, 744, 144},
// 116 seconds
{ -408, 800, 288},
{ -408, 896, 368},
{ -360, 912, 456},
{ -344, 864, 424},
{ -352, 888, 376},
{ -368, 872, 368},
{ -376, 840, 400},
{ -320, 800, 336},
{ -280, 784, 376},
{ -232, 672, 240},
{ -184, 800, 368},
{ -208, 824, 368},
... | |
cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest)) | ;
// One callback event scheduled:
assert_num_callback_events(1);
prv_process_callback_events();
assert_num_callback_events(0);
}
void test_app_inbox__consume_inbox_closed_in_mean_time(void) {
prv_create_test_inbox_and_begin_write();
cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitT... | |
en_val, int_en_mask);
BMI160_DBG("INT_MAP[1] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_MAP_1));
BMI160_DBG("INT_EN[1] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_EN_1));
int_enabled = enable_int;
s_fifo_in_use = use_fifo;
}
void accel_set_num_samples(uint32_t num_samples) {
uint8_t fifo_frame_size = prv_g... | (AccelOperatingModeShakeDetection) | ;
}
static void prv_enable_double_tap_detection(void) {
uint8_t tap_0_cfg =
(0x1 << BMI160_INT_TAP_QUIET_SHIFT) | // 0 = 20 ms, 1 = 30ms
(0x1 << BMI160_INT_TAP_SHOCK_SHIFT) | // 0 = 50 ms, 1 = 75ms
(0x4 << BMI160_INT_TAP_DUR_SHIFT); // 4 = 300 ms
prv_write_reg(BMI160_REG_INT_TAP_0, tap_0_cfg);... |
_generic_error_dialog(data);
}
} else {
if (!speech_detected) {
VOICE_LOG("No speech detected! Exiting...");
prv_exit_and_send_result_event(data, DictationSessionStatusFailureNoSpeechDetected);
} else {
prv_exit_and_send_result_event(data, DictationSessionStatusFailureRecognizerError);
... | app_timer_cancel(data->dictation_timeout) | |
ation_legacy2_private_init_scheduler(
AnimationLegacy2Scheduler *animation_legacy2_scheduler) {
*animation_legacy2_scheduler = (AnimationLegacy2Scheduler) {
.timer_handle = NULL,
.last_delay_ms = ANIMATION_TARGET_FRAME_INTERVAL_MS_LEGACY2,
.last_frame_time = animation_legacy2_get... | (animation_legacy2_scheduler, delay_ms) | ;
animation_legacy2_scheduler->last_delay_ms = delay_ms;
animation_legacy2_scheduler->last_frame_time = now;
}
void animation_legacy2_set_handlers(AnimationLegacy2 *animation, AnimationLegacy2Handlers handlers,
void *context) {
PBL_ASSERTN(animation->abs_start_time_ms == 0); /... |
s/normal/data_logging/data_logging_service.h"
#include "services/normal/data_logging/dls_private.h"
#include "services/normal/data_logging/dls_list.h"
#include "services/normal/data_logging/dls_storage.h"
#include "services/common/regular_timer.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util... | data_logging_log(logging_session, buf, chunk_size / item_size) | ;
fake_system_task_callbacks_invoke_pending();
buf += chunk_size;
num_bytes -= chunk_size;
}
}
// ----------------------------------------------------------------------------------------
static void prv_check_session_data(DataLoggingSessionRef logging_session, uint32_t crc,
... |
size_t buffer_size, int duration_s,
void *i18n_owner) {
int hours;
int minutes;
prv_convert_duration_to_hours_and_minutes(duration_s, &hours, &minutes);
int pos = 0;
if (hours != INT_MIN) {
pos += snprintf(buffer + pos, buffer_size - pos, i18n_get("%dH", i18n_owner... | ("%d", i18n_owner) | , minutes);
GTextNodeText *minutes_units_text_node = health_util_create_text_node_with_text(
i18n_get("M", i18n_owner), units_font, color, container);
minutes_units_text_node->node.offset.y = units_offset_y;
}
}
void health_util_convert_fraction_to_whole_and_decimal_part(int numerator, int denominat... |
20},
{ 832, 568, 96},
// 37 seconds
{ 472, 544, 72},
{ 448, 568, 8},
{ 624, 696, 56},
{ 576, 672, 72},
{ 384, 696, -104},
{ 272, 704, -72},
{ 160, 656, -200},
{ 400, 864, 176},
{ 160, 1200, -696},
{ 0, 680, -416},
{ 24, 792, -496},
{ 168, 688, -800},
{ 320, 75... | { 1008, -160, -272},
{ 920, -224, -224},
{ 880, -64, -136},
{ 912, -112, -72},
{ 800, -184, 48},
{ 856, -160, -96},
{ 1152, -352, 56},
{ 1408, -328, 32},
// 43 seconds
{ 1360, -208, -56},
{ 1200, -168, -80},
{ 1072, -208, -64},
{ 1064, -232, -72},
{ 1080, -248, -8... | |
, 10), SW_ODD));
#endif
setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, false);
graphics_draw_rect(&context, &GRect(10, 20, 40, 10));
#if PBL_COLOR
ASSERT_CALLED(prv_draw_rect_aa_stroked(&context, &GRect(10, 20, 40, 10), SW_ODD));
#else
ASSERT_CALLED(prv_draw_rect_stroked(&context, &GRect(10, 20, ... | graphics_draw_rect(&context, &GRect(10, 20, 40, 10)) | );
ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10));
ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4));
setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, true);
ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10)));
ASSERT_N... |
ezone_id(int16_t *new_value) {
s_clock_phone_timezone_id = *new_value;
return true;
}
static bool prv_set_s_units_distance(uint8_t *new_unit) {
if (*new_unit >= UnitsDistanceCount) {
s_units_distance = UnitsDistance_Miles;
return false;
}
s_units_distance = *new_unit;
return true;
};
static bool p... | {
s_activity_prefs_health_app_opened = *version;
return true;
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (emx_resources_get_size(1, id_2) == 4) | ;
buf = 0;
ASSERT(emx_resources_read(1, id_2, 0, (uint8_t *)&buf, 1) == 4);
ASSERT(buf == 2);
ASSERT(s_read_2_called == 1);
ASSERT(s_size_2_called == 1);
// 3rd res
uint32_t id_3 = emx_resources_register_custom(custom_res_read_3, custom_res_size_3);
ASSERT(emx_resources_get_size(1, id_3) == 4);
buf =... |
TypeDef rtc_date;
RTC_TimeTypeDef rtc_time;
// NOTE: There is a tricky rollover situation that can occur here if the date rolls over
// between when we read the date and time registers. For example:
// read date: 1/1/14 (actual time 11:59:59 PM)
// [date rolls over]
// read time: 12:00:00 AM (act... | (&seconds, &milliseconds) | |
if (isupper(c)) return c - 'A'; |
if (islower(c)) return c - 'a' + 26;
if (isdigit(c)) return c - '0' + 52;
if (c == '+') return 62;
if (c == '/') return 63;
if (c == '=') return 127;
return -1;
}
unsigned int base64_decode_inplace(char* buffer, unsigned int length) {
unsigned int read_index = 0;
unsigned int write_index = 0;
while... | |
{ 624, -48, 104},
{ 624, -48, 48},
{ 880, 136, -200},
{ 1488, -96, -24},
{ 1984, -160, 288},
{ 1728, 376, -64},
{ 1112, 408, -344},
{ 1008, -16, 48},
{ 1200, 776, 544},
{ 1152, 232, 320},
{ 1016, 280, 240},
{ 1008, 520, 176},
{ 840, 464, 224},
{ 736, 392, 96},
... | { 1832, -184, 344},
{ 1808, 464, 104},
{ 1344, 800, -416},
{ 992, 72, 120},
// 91 seconds
{ 1432, 336, 472},
{ 1208, 288, 392},
{ 1016, 344, 288},
{ 840, 384, 208},
{ 744, 352, 192},
{ 728, 304, 152},
{ 808, 312, 120},
{ 944, 400, 88},
{ 1152, 456, 32},
{ 1432... |
{ 1424, 520, 0},
{ 1624, 408, 32},
{ 1472, 256, 80},
{ 872, 192, 112},
{ 1056, 168, 136},
{ 1208, 96, 136},
{ 1192, 112, 168},
{ 1104, 72, 248},
{ 1008, 48, 216},
{ 976, -8, 240},
// 94 seconds
{ 912, 32, 160},
{ 864, 16, 104},
{ 864, 160, -48},
{ 920, 64, -4... |
Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is d... | strlen(s_utf8_ellipsis) | + 1;
// Sender and action message
int pos = snprintf((char *)buffer, max_msg_length, "%.*s %s",
sender->length, (char *)sender->value, action_msg);
if (pos < (int)max_msg_length && stripped_caption && !IS_EMPTY_STRING(stripped_caption)) {
// Quoted caption
pos += snprintf((char *)bu... |
{
// When unsubscribing or when Pebble was already subscribed,
// immediately send unsubscription confirmation event to client:
prv_send_subscription_event(characteristic_ref, ~gap_le_pebble_task_bit_for_client(client),
subscription_type, BLEGATTErrorSuccess);
} ... | {
prv_subscribe(node->characteristic, BLESubscriptionNone, c,
true);
} |
}
node = next;
}
}
bt_unlock();
}
void gatt_client_subscription_boot(void) {
s_gatt_client_subscriptions_mutex = mutex_create_recursive();
s_gatt_client_subscriptions_semphr = xSemaphoreCreateBinary();
PBL_ASSERTN(s_gatt_client_subscriptions_semphr);
}
//! Only for unit tests
T_STATIC bool ... |
prv_handle_notification_added_common(e->notification_id, NotificationMobile) | ;
break;
case NotificationActedUpon:
prv_handle_notification_acted_upon(e->notification_id);
break;
case NotificationRemoved:
prv_handle_notification_removed_common(e->notification_id, NotificationMobile);
break;
}
}
void notification_window_handle_dnd_event(PebbleDoNotDisturbEv... | |
ponse.ignore_failures && action_result->type != ActionResultTypeSuccess)) {
const bool success = false;
prv_cleanup_action_result(data, success);
return;
}
char uuid_string[UUID_STRING_BUFFER_LENGTH];
uuid_to_string(&action_result->id, uuid_string);
PBL_LOG(LOG_LEVEL_INFO, "Received action result: ... | action_menu_get_context(action_menu) | |
/*
* 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... | (GATT_SERVICE_DISCOVERY_STATUS_SUCCESS,
TEST_GATT_CONNECTION_ID) | ;
}
// Tests
///////////////////////////////////////////////////////////
void test_gatt_client_accessors__initialize(void) {
fake_gatt_init();
fake_event_init();
gap_le_connection_init();
}
void test_gatt_client_accessors__cleanup(void) {
gap_le_connection_deinit();
}
void test_gatt_client_accessors__copy_s... |
_change_state(BacklightState new_state);
static void light_timer_callback(void *data) {
mutex_lock(s_mutex);
prv_change_state(LIGHT_STATE_ON_FADING);
mutex_unlock(s_mutex);
}
static uint16_t prv_backlight_get_intensity(void) {
// low_power_mode backlight intensity (25% of max brightness)
const uint16_t back... | PBL_LOG(LOG_LEVEL_ERROR, "More buttons were pressed than have been released.") | ;
s_num_buttons_down = 0;
}
// set the state to be on; releasing buttons will start the timer counting down
if (prv_light_allowed()) {
prv_change_state(LIGHT_STATE_ON);
}
mutex_unlock(s_mutex);
}
void light_button_released(void) {
mutex_lock(s_mutex);
s_num_buttons_down--;
if (s_num_buttons_... |
ff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3024 - 3040 */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* bytes 3040 - 3056 */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* byt... | resource_storage_get_file_name(filename, sizeof(filename), resource_bank) | ;
load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, APP_RESOURCES_FIXTURE_NAME, filename);
size_t image_size = resource_size(resource_bank, no_litter_res_id);
cl_assert_equal_i(image_size, sizeof(no_litter));
uint8_t image_buf[image_size];
cl_assert_equal_i( resource_load_byte_range_system(resource_bank,... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_ASSERTN(y < f->size.h) | |
s:
// Calling removeEventListener() with arguments that do not identify
// any currently registered EventListener on the EventTarget has no effect.
EXECUTE_SCRIPT(
"_rocky.off('foo', f2);\n"
"_rocky.off('unknownevent', f1);\n"
);
cl_assert_equal_i(0, s_prv_api_remove__callcount);
cl_assert_equal_b(t... | ASSERT_JS_GLOBAL_EQUALS_B("is_called", false) | ;
s_process_manager_callback(s_process_manager_callback_data);
ASSERT_JS_GLOBAL_EQUALS_B("is_called", true);
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | animation_unschedule(property_animation_get_animation(data->info_text_in_animation)) | ;
animation_unschedule(property_animation_get_animation(data->info_text_out_animation));
layer_set_hidden(&data->info_text_layer2.layer, true);
}
typedef struct {
const char *string;
const char *font_key;
} Translation;
static void prv_update_text_layer_with_translation(TextLayer *text_layer,
... |
_icon_margin(void) {
const PlatformType platform = process_manager_current_platform();
return PBL_PLATFORM_SWITCH(platform,
/*aplite*/ 24,
/*basalt*/ 24,
/*chalk*/ 53,
/*diorite*/ 24,
... | (animation_offset, 0) | ,
GPoint(0, animation_offset),
};
return offset[action_bar->animation[button_index]];
}
static void prv_draw_background_rect(ActionBarLayer *action_bar, GContext *ctx, GColor bg_color) {
graphics_fill_rect(ctx, &action_bar->layer.bounds);
}
void prv_draw_background_round(ActionBarLayer *action_bar, GConte... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&BOARD_CONFIG.dbgserial_int_gpio) | ;
}
// set up the USART interrupt on RX
uart_set_rx_interrupt_handler(DBG_UART, prv_uart_irq_handler);
uart_set_rx_interrupt_enabled(DBG_UART, true);
s_stop_mode_timeout_timer = new_timer_create();
// Enable receive interrupts
dbgserial_enable_rx_exti();
}
void dbgserial_enable_rx_exti(void) {
exti_... |
bug_card.dialog_text),
"Out of memory");
prv_display_alert(data->debug_card.dialog_text);
goto exit;
}
time_t now = time(NULL);
char time_now_text[64];
struct tm *local_tm = localtime(&now);
strftime(time_now_text, sizeof(time_now_text), "%F %r", local_tm);
APP_LOG(APP_LOG_LEVEL_DEBUG... | snprintf(temp, sizeof(temp), "\nweekly: %d", (int)avg) | ;
prv_safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text));
// Daily avg
avg = health_service_sum_averaged(metric, day_start, day_start + SECONDS_PER_DAY,
HealthServiceTimeScopeDaily);
snprintf(temp, sizeof(temp), "\ndaily: %d", (int)avg);
... |
EPTH_NAME}__cleanup(void) {
free(fb);
}
/////////////////////////////////////
/// TESTS
/////////////////////////////////////
void test_graphics_context_${BIT_DEPTH_NAME}__set(void) {
GDrawState draw_state;
GColor color;
// Stroke Color
graphics_context_set_stroke_color(&context, GColorClear);
cl_assert_e... | graphics_context_set_stroke_width(&context, 0) | |
/////////////////
// Scrolling related functions
///////////////////////////////////////////////////////////
static int16_t prv_get_first_scroll_offset(TimelineItemLayer *item_layer) {
if (!item_layer->timeline_layout->has_page_break) {
return 0;
}
return MAX(prv_get_frame_size(item_layer).h, 0);
}
static i... | prv_update_scroll_offset(item_layer, max_scroll, false) | |
("TmplStringPlur", " sec")},
/// Singular suffix for seconds with full units
{ i18n_ctx_noop("TmplStringSing", " second"),
/// Plural suffix for seconds with full units
i18n_ctx_noop("TmplStringPlur", " seconds")},
};
static const char * const s_minute_strings[3][2] = {
/// Singular suffix for minutes with... | prv_append_number(state, zero_pad ? "%02d" : "%d", value) | ;
prv_append_string_i18n(state, suffix_strings[add_units][value != 1]);
}
// This is a recursive function, so watch out!
// The recursion happens on the %R and %T cases only, and will only recurse once.
// So when adding stack variables, realize the stack usage may be doubled!
T_STATIC const char *prv_template_forma... |
/*
* 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... | (str, fp_msg) | |
nstallId install_id) {
// Don't filter, just always try removing from the list:
const bool is_removed = remove_app_with_install_id(install_id, source);
if (is_removed) {
prv_alert_data_source_changed(source);
}
}
//! Called when an application is uninstalled
static void prv_app_removed_callback(const AppIn... | (source, node) | ;
list_remove((ListNode*)node, (ListNode**)&source->list, NULL);
app_free(node->name);
app_free(node);
}
static void add_app_with_install_id(const AppInstallEntry *entry, AppMenuDataSource *source) {
if (source->is_list_loaded == false) {
return;
}
AppMenuNode *node = app_malloc_check(sizeof(AppMenuNo... |
pstring_pstring16_to_string(pstring, loc) | ;
cl_assert_equal_s(loc, s_entry_names[index]);
pstring = pstring_get_pstring16_from_list(&pstring16_list, 1);
cl_assert_equal_i(pstring->str_length, strlen(s_entry_phrases[index]));
char phrase[WEATHER_SERVICE_MAX_SHORT_PHRASE_BUFFER_SIZE];
pstring_pstring16_to_string(pstring, phrase);
cl_assert_equal_s(p... | |
GBitmap *down_bitmap;
GBitmap *click_bitmap;
Layer *background;
TextLayer *text_layers[NumTextIdx];
TextLayer *disconnected_text;
uint8_t sync_buffer[60];
AppSync sync;
} AppData;
static AppData s_data;
static void bluetooth_status_callback(bool connected) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Golf bluetoo... | (
vertical_divider_y_offset + (vertical_divider_height / 2), vertical_divider_y_offset) | ;
graphics_context_set_stroke_color(ctx, GColorBlack);
draw_dotted_line(ctx, GPoint(horizontal_divider_x_offset, horizontal_divider_y_offset),
horizontal_divider_width, false /* is_vertical */);
draw_dotted_line(ctx, GPoint(vertical_divider_x_offset, vertical_divider_y_offset),
... |
int delta = (i % 50);
if (delta > 25) {
delta = 50 - delta;
}
s_temp_readings[i] = 1600 + delta;
}
#endif
// Draw the last bunch that fit in the window
int first_idx = (int)READ_HISTORY_ENTRIES - PLOT_WIDTH;
first_idx = MAX(first_idx, 0);
// Get the min and max
bool first_valid = tru... | window_set_window_handlers(data->window, &(WindowHandlers) {
.load = prv_window_load,
.unload = prv_window_unload,
}) | ;
app_window_stack_push(data->window, true /* Animated */);
}
// -------------------------------------------------------------------------------
static void s_main(void) {
init();
app_event_loop();
deinit();
}
// -------------------------------------------------------------------------------
const PebblePr... |
/*
* 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 1;
} | |
pear(Window *window) {
cl_check(window);
cl_assert_equal_i(window->on_screen, true);
s_appear_count++;
cl_check(s_appear_count >= 1);
}
static void prv_window_disappear(Window *window) {
cl_check(window);
cl_assert_equal_i(window->on_screen, false);
s_disappear_count++;
cl_check(s_appear_count >= 0);
}... | (window1->on_screen, false) | ;
cl_assert_equal_i(window2->on_screen, true);
app_window_stack_pop(true);
cl_assert_equal_i(window1->on_screen, true);
cl_assert_equal_i(window2->on_screen, false);
app_window_stack_pop(true);
cl_assert_equal_i(window1->on_screen, false);
window_destroy(window1);
window_destroy(window2);
}
void t... |
uint32_t size = dls_test_get_num_bytes(logging_sessions[i]);
PBL_LOG(LOG_LEVEL_INFO, "Size of session %d: %d", i, size);
total_bytes += size;
}
PBL_LOG(LOG_LEVEL_INFO, "total bytes: %d", total_bytes);
cl_assert(total_bytes < DLS_TOTAL_STORAGE_BYTES);
}
// ------------------------------------------... | cl_assert_equal_i(data_logging_log(0, data, ARRAY_LENGTH(data)), DATA_LOGGING_INVALID_PARAMS) | ;
cl_assert_equal_i(data_logging_log(&data, data, ARRAY_LENGTH(data)), DATA_LOGGING_INVALID_PARAMS);
// Make sure closing invalid sessions doesn't crash. It's defined to be a no-op
data_logging_finish(0);
data_logging_finish(&data);
}
// ------------------------------------------------------------------------... |
prv_receive_reset_request(s_characteristics[0][PPoGATTCharacteristicData]) | ;
prv_assert_sent_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]);
prv_receive_reset_request(s_characteristics[0][PPoGATTCharacteristicData]);
fake_gatt_client_op_assert_no_write();
}
void test_ppogatt__ignore_server_reset_request_while_resetting_due_to_own_reset_request(void) {
prv_notify_ser... | |
id) {
return window_manager_get_window_click_manager(window_manager_get_top_window());
}
static void prv_call_click_provider(Window *window) {
window->is_waiting_for_click_config = false;
app_click_config_setup_with_window(prv_get_current_click_manager(), window);
window->is_click_configured = true;
}
static ... | (window, true) | |
RT_ALARM_RANGE_S / SECONDS_PER_MINUTE,
.enabled = is_smart,
},
};
time_selection_window_configure(&data->time_picker_window, &config);
// Reset the selection layer to the first cell
data->time_picker_window.selection_layer.selected_cell_idx = 0;
}
static void prv_time_picker_complete(TimeSelectionWin... | prv_setup_day_picker_window(data) | ;
#if CAPABILITY_HAS_HEALTH_TRACKING
prv_setup_type_menu_window(data);
return &data->alarm_type_menu->window;
#else
return &data->time_picker_window.window;
#endif
}
void alarm_editor_update_alarm_time(AlarmId alarm_id, AlarmType alarm_type,
AlarmEditorCompleteCallback complet... |
/*
* 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... | (prop_val) | ;
char *result = rocky_string_alloc_and_copy(prop_str);
return result;
}
// from lit-magic-string.inc.h
const jerry_char_t ERROR_NAME_PROPERTY_NAME[] = "name";
const jerry_char_t ERROR_MSG_PROPERTY_NAME[] = "message";
void rocky_error_print(jerry_value_t error_val) {
char *name = NULL;
char *msg = NULL;
if ... |
{ 0, 800, 232},
{ 0, 816, 240},
{ 72, 656, 152},
{ 104, 480, -8},
{ 120, 352, 104},
// 75 seconds
{ -56, 504, 208},
{ -152, 1096, 152},
{ 0, 848, -384},
{ 320, 944, -832},
{ 376, 1064, -896},
{ 696, 832, -968},
{ 768, 560, -712},
{ 696, 392, -680},
{ 680, 248,... | {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_28386_3
//> TEST_EXPECTED 100
//> TEST_EXPECTED_MIN 80
//> TEST_EXPECTED_MAX 120
//> TEST_WEIGHT 1.0
static AccelRawData samples[] = {
// 0 seconds
// elapsed: 0 minutes
{ 288, -32, -856},
{ 30... |
{ 656, 728, 0},
{ 680, 712, -8},
{ 592, 688, -40},
{ 504, 968, -104},
{ 440, 448, -224},
{ 472, 1272, -184},
{ 384, 512, -88},
{ 472, 664, -232},
{ 656, 560, -360},
{ 776, 560, -408},
{ 856, 384, -456},
{ 1000, 200, -448},
{ 1152, 80, -552},
{ 1128, 144, -384},
... |
es_left, 0);
cl_assert_equal_p(data_out, NULL);
const uint16_t copy_out_size = 8;
uint8_t copy_out[copy_out_size];
cl_assert_equal_i(circular_buffer_copy(&buffer, copy_out, copy_out_size), 8);
cl_assert_equal_i(memcmp(copy_out, "01234567", 8), 0);
circular_buffer_consume(&buffer, 2);
cl_assert_equal_i(c... | cl_assert_equal_m(data_buf, &letterB, sizeof(letterB)) | ;
}
|
codepoint, data->resource_offset);
return NULL;
}
LineCacheData *final_data;
#if !CAPABILITY_HAS_GLYPH_BITMAP_CACHING
// Copy the info into the glyph_buffer.
// This must be done _before_ loading the bitmap, otherwise loading the bitmap may modify the
// metadata! We will use `glyph_buffer` as the fin... | codepoint_is_emoji(codepoint) | &&
!codepoint_is_special(codepoint) &&
font_info->extended) {
// Latin & emoji codepoints are in base, others are in extension
return (&font_info->extension);
} else if (codepoint_is_emoji(codepoint) &&
font_info->base.app_num == SYSTEM_APP) {
// Assuming we are using base
Fo... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (iter->data_index >= mbuf_get_length(iter->m)) {
// we're at the end of this MBuf so move to the next one
iter->m = mbuf_get_next(iter->m);
iter->data_index = 0;
// make sure this MBuf has data
if (!prv_iter_to_valid_mbuf(iter)) {
return true;
}
} |
return false;
}
bool mbuf_iterator_read_byte(MBufIterator *iter, uint8_t *data) {
if (mbuf_iterator_is_finished(iter)) {
return false;
}
uint8_t *buffer = mbuf_get_data(iter->m);
*data = buffer[iter->data_index++];
return true;
}
bool mbuf_iterator_write_byte(MBufIterator *iter, uint8_t data) {
if ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | list_append((ListNode *)s_read_head, &read->node) | ;
} else {
s_read_head = read;
}
return BTErrnoOK;
}
void gatt_client_consume_read_response(uintptr_t object_ref,
uint8_t value_out[],
uint16_t value_length,
GAPLEClient client) {
}
typedef s... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(horiz_advance,
text_resources_get_glyph_horiz_advance(&s_font_cache, 'a', &s_font_info)) | ;
cl_assert_equal_i(horiz_advance,
text_resources_get_glyph_horiz_advance(&s_font_cache, 'a', &s_font_info));
}
void test_text_resources__horiz_advance_multiple(void) {
uint32_t gothic_18_handle = RESOURCE_ID_GOTHIC_18;
cl_assert(text_resources_init_font(0, gothic_18_handle, 0, &s_font_info));
int8_t ho... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (s_send_data_count, 1) | ;
}
void test_registry_endpoint__fail_read_other(void) {
uint8_t message[] = { 0x0, 0x7, 'm', 'f', 'g', '_', 'x', 'x', 'x', };
uint8_t expected_response[] = { 0xff };
s_expected_response = expected_response;
s_expected_response_length = sizeof(expected_response);
factory_registry_protocol_msg_callback(NULL... |
o Start");
app_window_stack_push(&data->status_window, true);
if (data->current_test_step != BTLETestStep_BTStart) {
// A BTLE Test start failed, stop BT Test
const bool success = prv_run_test_step(BTLETestStep_BTEnd, data);
PBL_ASSERTN(success);
}
data->current_test_step = BTLETestSte... | window_get_root_layer(&data->payload_window) | );
simple_menu_layer_destroy(data->payload_menu_layer);
app_free(data->payload_menu_items);
}
static void prv_payload_type_window(AppData *data) {
window_set_window_handlers(&data->payload_window, &(WindowHandlers){
.load = prv_payload_window_load,
.unload = prv_payload_window_unload,
});
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (RCC_APB1PeriphClockCmd, RCC_APB1Periph_USART3) | ;
//USART_OverSampling8Cmd(USART3, ENABLE);
/* Connect PXx to USARTx_Tx*/
GPIO_PinAFConfig(GPIOC, GPIO_PinSource10, GPIO_AF_USART3);
/* Connect PXx to USARTx_Rx*/
GPIO_PinAFConfig(GPIOC, GPIO_PinSource11, GPIO_AF_USART3);
/* Configure USART Tx as alternate function */
GPIO_InitStructure.GPIO_OType = ... |
int32_t info_text_y_offset = 36;
#else
const int32_t info_text_y_offset = PBL_IF_RECT_ELSE(10, 12);
#endif
KinoLayer *kino_layer = &data->kino_layer;
kino_layer_init(kino_layer, &window->layer.bounds);
layer_add_child(&window->layer, &kino_layer->layer);
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
GRect pair_t... | (data->timer) | ;
if (data->ui_state == BTPairingUIStateAwaitingUserConfirmation) {
prv_send_response(false /* is_confirmed */);
}
prv_deinitialize_info_text(data);
property_animation_destroy(data->info_text_in_animation);
property_animation_destroy(data->info_text_out_animation);
kernel_free(data);
}
... |
MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RE... | (&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , 3, GCornersAll) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r3_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersAll);
cl_ch... |
6, "-7fffffff", },
{ 2147483646LL, 17, "53G7F547", },
{ 2147483646LL, 17, "53g7f547", },
{ -2147483647LL, 17, "-53G7F548", },
{ -2147483647LL, 17, "-53g7f548", },
{ 2147483646LL, 18, "3928G3H0", },
{ 2147483646LL, 18, "3928g3h0", },
{ -2147483647LL, 18, "-3928G3H1", },
{ -2147483647LL, 18, "-3928g3h1", ... | cl_assert_equal_i(strtol(" -+123", NULL, 10), 0) | ;
cl_assert_equal_i(strtol("+-123", NULL, 10), 0);
}
void test_strtol__end(void) {
char *end;
char *s;
s = "";
strtol(s, &end, 10);
cl_assert_equal_p(s, end);
cl_assert_equal_i('\0', *end);
s = "123";
strtol(s, &end, 10);
cl_assert_equal_p(s+3, end);
cl_assert_equal_i('\0', *end);
s = "123a"... |
/*
* 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... | {
const uint8_t op_flags = OP_FLAG_READ | OP_FLAG_SKIP_HDR_CRC_CHECK | OP_FLAG_USE_PAGE_CACHE;
return prv_file_common_get_length_and_close(prv_file_open(entry, op_flags));
} |
static uint32_t resource_storage_file_get_crc(ResourceStoreEntry *entry, uint32_t num_bytes,
uint32_t entry_offset) {
const uint8_t op_flags = OP_FLAG_READ;
return prv_file_common_get_crc(prv_file_open(entry, op_flags), num_bytes, entry_offset);
}
static uint32_t res... |
{
return rv;
} |
rv = prv_read_item_header(next_item_out, &id);
return rv;
}
static bool prv_timestamp_title_compare_func(SettingsFile *file, SettingsRecordInfo *info,
void *context) {
// Check entry is valid
if (info->key_len != UUID_SIZE || info->val_len == 0) {
return true; ... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
cl_assert(alerts_get_mask() == AlertMaskAllOn);
// Should not allow any notifications through while in low power
s_low_power_active = true;
cl_assert(!alerts_should_notify_for_type(AlertInvalid));
cl_assert(!alerts_should_notify_for_type(AlertMobile));
cl_assert(!alerts_should_notify_for_type(AlertRemin... |
void test_alerts__phone_calls_only(void) {
cl_assert(alerts_get_mask() == AlertMaskAllOn);
alerts_set_mask(AlertMaskPhoneCalls);
// Should allow a phone call notification
cl_assert(alerts_should_notify_for_type(AlertPhoneCall));
// Should not allow any other notifications through
cl_assert(!alerts_shou... |
/prefs.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/attributes.h"
#include "util/list.h"
#include "util/math.h"
#include "util/time/time.h"
#include "util/units.h"
//! @file app_cache.c
//! App Cache
//! The App Cache keeps track of the install date, last launch, launch count, and size of... | (LOG_LEVEL_DEBUG, "Cache OOS: Need to free %"PRIu32" bytes, PFS avail space: %"PRIu32"",
to_free, pfs_space) | ;
app_cache_free_up_space(to_free);
}
}
static void prv_delete_cache_callback(void *data) {
app_cache_flush();
}
static void prv_delete_cached_files(void) {
pfs_remove_files(is_app_file_name);
}
static bool prv_is_in_list(AppInstallId id, const AppInstallId list[], uint8_t len) {
for (unsigned int i = 0;... |
;
fake_comm_session_cleanup();
}
// ----------------------------------------------------------------------------------------
void test_data_logging__log_consume(void) {
DataLoggingSessionRef logging_sessions[10];
const int item_size = 1;
// Create sessions
for (int i = 0; i < 10; i++) {
logging_sessions... | PBL_LOG(LOG_LEVEL_INFO, "Size of session %d: %d", i, size) | ;
total_bytes += size;
}
PBL_LOG(LOG_LEVEL_INFO, "total bytes: %d", total_bytes);
cl_assert(total_bytes < DLS_TOTAL_STORAGE_BYTES);
// We should still be able to create more sessions up to the max
for (int i = num_sessions; i < DLS_MAX_NUM_SESSIONS; i++) {
logging_sessions[i] = data_logging_create(i... |
ributeIdScoreHome, "103");
if (has_broadcaster) {
attribute_list_add_cstring(&list, AttributeIdBroadcaster, "ABC");
}
attribute_list_add_cstring(&list, AttributeIdBody,
"01:45\nJames 3pt Shot: Missed\n"
"03:15 | 22-29\nLeonard Free Throw 2 of 2 (8PTS)"... | pin_db_insert_item_without_event(item) | ;
timeline_item_destroy(item);
attribute_list_destroy_list(&list);
}
static void prv_add_activity_session_pin(int32_t delta_time_s, int32_t duration_m) {
const time_t now = rtc_get_time();
AttributeList list = {};
attribute_list_add_uint32(&list, AttributeIdIconPin, TIMELINE_RESOURCE_RUN);
attribute_list_... |
{ 0, 0x52, 3698, 214, 0},
// 30: Local time: 2016-03-01 08:35:00 PM
{ 0, 0x41, 5469, 179, 0},
{ 0, 0x53, 1573, 182, 0},
{ 22, 0x42, 7516, 175, 0},
{ 0, 0x41, 676, 159, 0},
{ 48, 0x34, 3292, 150, 0},
{ 101, 0x24, 4735, 171, 0},
{ 0, 0x75, 6674, 145, 0},
{ 0, 0x67, 1833, 145, 0},
... | { 0, 0x69, 0, 147, 0},
{ 0, 0x69, 0, 144, 0},
// 135: Local time: 2016-03-01 10:20:00 PM
{ 0, 0x69, 0, 147, 0},
{ 0, 0x69, 0, 148, 0},
{ 0, 0x69, 0, 148, 0},
{ 0, 0x69, 0, 147, 0},
{ 0, 0x69, 0, 150, 0},
{ 0, 0x69, 0, 148, 0},
{ 0, 0x69, 0, 148, 0},
{ 0, 0x69, 0, 148, 0},
... |
{ 0, 0x18, 0, 148, 0},
{ 0, 0x18, 0, 149, 0},
{ 0, 0x18, 0, 148, 0},
{ 0, 0x18, 0, 149, 0},
{ 0, 0x18, 0, 148, 0},
{ 0, 0x18, 0, 145, 0},
{ 0, 0x18, 0, 148, 0},
{ 0, 0x18, 11, 148, 0},
{ 0, 0x18, 0, 149, 0},
{ 0, 0x18, 0, 149, 0},
{ 0, 0x18, 0, 146, 0},
// 195: Local tim... |
/*
* 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... | {
display_firmware_update_progress(progress, total * 2);
} |
//! Returns true if we're going to install a new world firmware
static bool prv_check_firmware_world(uint32_t flash_new_fw_addr) {
// Read the beginning of the firmware off flash to see if it's new world or old world
const unsigned world_length = FW_IDENTIFIER_OFFSET + sizeof(uint32_t); // NeWo read as uint32_t
... |
close_and_remove(fd);
} else {
pfs_close(fd);
}
}
}
#endif
#endif
static GAPLEConnection *prv_get_le_connection_and_print_info(void) {
GAPLEConnection *conn = gap_le_connection_any();
if (!conn) {
prompt_send_response("No device connected");
} else {
char buf[80];
prompt_send_response... | (atoi(rx_channel)) | |
LEAdData *ad_data) {
if (prv_ad_is_finalized(ad_data)) {
// Already finalized
return;
}
ad_data->scan_resp_data_length = BLE_AD_DATA_FINALIZED;
}
// -----------------------------------------------------------------------------
//! Helper to calculate whether a number of bytes will still fit when appended... | memcmp(&bt_uuid_base.byte4, &uuid->byte4,
sizeof(Uuid) - offsetof(Uuid, byte4)) | == 0);
if (!is_bt_uuid_based) {
// Not based on the Bluetooth base UUID, so use 128-bits:
return sizeof(Uuid);
}
if (uuid->byte0 || uuid->byte1) {
// If byte0 and byte1 not zero: 32-bit UUID, Bluetooth base UUID based:
return sizeof(uint32_t);
}
// If byte0 and byte1 are zero: 16-bit UUID, Bl... |
connected(void) {
// Android app connects:
prv_receive_app_info_event(true /* is_android */);
prv_receive_and_assert_all(true /* expect_is_handled*/);
}
void test_music_endpoint__ignore_unknown_message(void) {
// Android app connects:
prv_receive_app_info_event(true /* is_android */);
uint8_t unknown_msg[]... | prv_receive_app_info_event(true /* is_android */) | ;
fake_comm_session_process_send_next(); // send out any pending data
// Attempting to send an unsupported command should not result in any data getting sent out:
fake_transport_set_sent_cb(s_transport, prv_assert_no_data_sent_cb);
music_command_send(MusicCommandAdvanceRepeatMode);
fake_comm_session_process... |
clude "progress_ui_app.h"
#include "applib/app.h"
#include "applib/app_timer.h"
#include "applib/graphics/gpath_builder.h"
#include "applib/graphics/graphics.h"
#include "util/trig.h"
#include "applib/ui/dialogs/dialog.h"
#include "applib/ui/dialogs/simple_dialog.h"
#include "applib/ui/layer.h"
#include "applib/ui/pro... | {
switch (data->progress_source) {
case PROGRESS_UI_SOURCE_COREDUMP: {
break;
}
case PROGRESS_UI_SOURCE_LOGS: {
break;
}
case PROGRESS_UI_SOURCE_FW_UPDATE: {
if (firmware_update_current_status() == FirmwareUpdateFailed) {
prv_handle_finished(data, false /* success */);
... |
static void prv_refresh_progress(void *data_in) {
ProgressUIData *data = (ProgressUIData*) data_in;
if (!data) {
// Sanity check
return;
}
// Overwrite the old timer handle, it's no longer valid
data->timer = app_timer_register(UPDATE_FREQ_MS, prv_refresh_progress, data);
prv_update_progress(dat... |
rflow;
}
rect_to_clip->origin.y = rect_clipper->origin.y;
} else if (rect_to_clip->origin.y > rect_clipper->origin.y + rect_clipper->size.h) {
rect_to_clip->origin.y = rect_clipper->origin.y + rect_clipper->size.h;
rect_to_clip->size.h = 0;
}
overflow = rect_to_clip->origin.y + rect_to_clip->size.... | (cropped_height >= 0) | ;
return grect_inset_internal(rect, crop_size_px, crop_size_px);
}
GRect grect_inset_internal(GRect rect, int16_t dx, int16_t dy) {
return grect_inset(rect,
(GEdgeInsets) {.top = dy, .right = dx, .bottom = dy, .left = dx});
}
GRect grect_inset(GRect r, GEdgeInsets insets) {
grect_standardi... |
http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing per... | (app_data->out_iter, AppMessageKey_Status, AppStatus_Enabled_1HZ) | |
.
cl_assert_equal_m(&item2.header.id, stub_new_timer_callback_data(get_reminder_timer_id()), sizeof(TimelineItemId));
cl_assert(stub_new_timer_timeout(get_reminder_timer_id()) == 100 * 1000);
// ...until we insert item 1 back
cl_assert(S_SUCCESS == reminders_insert(&item1));
cl_assert_equal_m(&item1.header.id... | (reminders_insert(&s_all_day_reminder), S_SUCCESS) | ;
cl_assert_equal_i(reminders_insert(&s_reminder_before_all_day_reminder), S_SUCCESS);
// set time to 16:00 PST March 4
now = 1425513600;
reminders_init();
cl_assert_equal_i(stub_new_timer_timeout(get_reminder_timer_id()), 5 * 60 * 60 * 1000);
cl_assert(uuid_equal(&s_reminder_before_all_day_reminder.header... |
e_create(b, a, NULL);
cl_assert(seq == NULL);
seq = animation_sequence_create(a, b, NULL);
animation_set_delay(seq, delay_seq); // This delay not applicable since a was already scheduled
animation_set_handlers(seq, handlers, seq);
animation_schedule(seq);
// The duration of seq should include all of a and... | animation_schedule(seq) | ;
// The duration of seq should include all of a and b
uint32_t duration = animation_get_duration(seq, true, true);
cl_assert_equal_i(duration, duration_a + delay_a + duration_b + delay_b);
// The position of seq should be the amount we already played of a, including the 'a' delay
// since a is embedded wi... |
ense is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <pebble.h>
static Window *window;
static TextLayer *result_layer;
static struct tm... | if (r == 0 || strncmp(buf, "11:04:49 AM", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"r\": %s", buf);
} | |
/*
* 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... | fake_spi_flash_init(0, 0x1000000) | ;
pfs_init(false);
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */);
load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, CHINESE_FIXTURE_NAME, "lang");
//cl_assert(resource_has_valid_system_resources());
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(DICT_OK, dict_serialize_tuplets_to_buffer(&tuplet, 1,
(uint8_t *)&push_message->dictionary,
size)) | ;
// Including sizeof(AppMessagePush):
*size = sizeof(buffer);
return buffer;
}
static void prv_receive(uint32_t key, uint8_t value) {
uint32_t length = 0;
const uint8_t *msg= prv_build_push_message(key, value, &length);
launcher_app_message_protocol_msg_callback_deprecated(s_session, msg, length);
}
// ... |
(reset_handler)
);
__builtin_unreachable();
}
static bool check_and_increment_reset_loop_detection_bits(void) {
uint8_t counter =
(boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_THREE) << 2) |
(boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_TWO) << 1) |
boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_ONE);
if (count... | dbgserial_putstr(error_code_buffer) | ;
display_error_code(error_code);
static uint8_t prev_button_state = 0;
prev_button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK;
while (1) {
// See if we should restart
uint8_t button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK;
if (button_state != prev_button_state) {
sy... |
assert(uuid_equal(&state.pin.header.id, &s_all_day_items[1].header.id) ||
uuid_equal(&state.pin.header.id, &s_all_day_items[2].header.id));
cl_assert(state.node->all_day);
// check that the item we see is timestamped at local midnight rather than utc midnight
// 1421136000 is midnight Jan 13, PST
cl_assert_... | (iter_next(&iterator)) | ;
cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[0].header.id));
cl_assert(!iter_next(&iterator));
}
static void prv_insert_extra_case_items(void) {
pin_db_flush();
for (int i = 0; i < ARRAY_LENGTH(s_extra_case_items); i++) {
cl_assert_equal_i(pin_db_insert_item(&s_extra_case_items[i]), 0);
... |
rom LSB to MSB
// INSTRUCTION[7:0]: Instruction
// IMODE[1:0]: Instruction Mode
// ADMODE[1:0]: Address Mode
// ADSIZE[1:0]: Address Size
// ABMODE[1:0]: Alternate Bytes Mode
// ABSIZE[1:0]: Instruction Mode
// DCYC[4:0]: Dummy Cycles
// RESERVED
// DMODE[1:0]: Data Mode
// FMODE[1:0]: Functional Mode
// SIOO: Send Ins... | dcache_alignment_mask_minimum(QSPI_DMA_READ_WORD_SIZE) | ;
const uintptr_t buffer_address = (uintptr_t)buffer;
const uintptr_t last_address = buffer_address + length;
const uintptr_t last_address_aligned = last_address & (~word_mask);
const uintptr_t start_address_aligned = ((buffer_address + word_mask) & (~word_mask));
uint32_t leading_bytes = start_address_ali... |
0:59 (T+00:00:59)
rtc_set_time(event_time + (1 * SECONDS_PER_MINUTE) - 1);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("NOW", time_buf);
// June 9th 2015, 12:01:00 (T+00:01:00)
rtc_set_time(event_time + (1 * SECONDS_PER_MINUTE));
clock_get_u... | ("12:00 PM", time_buf) | ;
// June 9th 2015, 23:59:59 (T+11:59:59)
rtc_set_time(event_time + (11 * SECONDS_PER_HOUR) + (59 * SECONDS_PER_MINUTE) + 59);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("12:00 PM", time_buf);
// June 10th 2015, 00:00:00 (T+12:00:00)
rtc_s... |
04, 336, -144},
{ 1392, 480, -136},
{ 1384, 512, -128},
{ 1368, 544, -192},
{ 1144, 576, -232},
{ 952, 456, -200},
{ 824, 296, -216},
{ 1040, 312, -248},
{ 1144, 168, -144},
// 32 seconds
{ 1040, 72, -96},
{ 984, 104, -144},
{ 856, 152, -128},
{ 696, 112, -16},
{ ... | { 576, 192, -120},
{ 800, 256, -208},
{ 1128, 264, -232},
{ 1144, 280, -264},
{ 1088, 312, -296},
{ 1232, 320, -232},
{ 1168, 352, -208},
{ 984, 296, -112},
{ 1080, 312, -152},
{ 1192, 368, -160},
{ 1152, 272, -56},
{ 928, 224, -16},
{ 752, 216, -88},
{ 736, 184, ... | |
FIXED_S16_3_ONE.raw_value / 2)};
prv_calc_cap_prepared(right_point_tmp.x, right_point_tmp.y, radius,
progress_line, &top_margin, &bottom_margin);
// Finally draw line
if (top_margin.raw_value <= bottom_margin.raw_value) {
graphi... | (p0, ctx->draw_state.drawing_box.origin) | |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
.timestamp = 25*60,
.duration = 5,
.type = TimelineItemTypePin,
.all_day = false,
.layout = LayoutIdCalendar,
},
.attr_list = {
.num_attributes = 1,
.attributes = &title_attr,
},
};
static TimelineItem item4 = {
.header = {
.i... | (fake_event_get_count(), 1) | ;
cl_assert(!prv_get_calendar_ongoing());
TimerID timer_id = stub_new_timer_get_next();
cl_assert_equal_i(timer_id, TIMER_INVALID_ID);
cl_assert(!stub_new_timer_is_scheduled(timer_id));
cl_assert(timeline_add(&item1));
timeline_event_handle_blobdb_event();
cl_assert_equal_i(fake_event_get_count(), 2);
... |
/*
* 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_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)) | ;
}
void test_health_activity_detail_card__render_no_distance(void) {
HealthData health_data = {
.current_distance_meters = 0,
};
prv_create_card_and_render(&health_data);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_health_activity_detail_card__render_step_data(void) {
Heal... |
ext_${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_graphics_context_${BIT_DEPTH_NAME}__cleanup(void) {
free(fb);
}
/////////////////////////////////////
/// TESTS
/... | cl_assert_equal_i(context.draw_state.text_color.argb, GColorClear.argb);
color.a = 0;
graphics_context_set_text_color(&context, color);
cl_assert_equal_i(context.draw_state.text_color.argb, GColorClear.argb);
// Text Color - 2-bit
graphics_context_set_text_color_2bit(&context, GColor2White);
cl_assert(g... |
void test_graphics_context_${BIT_DEPTH_NAME}__draw_antialiased(void) {
// Stroke width = 1, antialiased
setup_test(&context, true, 1, GColorBlack, GColorBlack, false);
graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10));
#if PBL_COLOR
ASSERT_CALLED(graphics_line_draw_1px_aa(&context, GPoint(5, 5), GPoi... |
(CACHE, CACHE_ASSOCCFG_REG, CACHE_ASSOC, 0x2) | ;
REG_SETF(CACHE, CACHE_CTRL2_REG, ENABLE_ALSO_QSPIFLASH_CACHED, 0x0);
REG_SETF(CACHE, CACHE_CTRL2_REG, ENABLE_ALSO_OTP_CACHED, 0x0);
REG_SETF(CACHE, CACHE_CTRL2_REG, CACHE_CGEN, 0x0);
REG_SETF(CACHE, CACHE_CTRL2_REG, CACHE_WEN, 0x0);
REG_SETF(CACHE, CACHE_CTRL2_REG, CACHE_LEN, 0x0);
REG_SETF(CACHE, CACHE... | |
Scheduler* animation_legacy2_scheduler) {
PBL_ASSERTN(animation != NULL);
PBL_ASSERTN(animation->implementation->update != NULL);
if (animation_legacy2_is_scheduled(animation)) {
animation_legacy2_unschedule(animation);
}
const uint32_t now = animation_legacy2_get_ms_since_system_start();
animation->a... | animation_legacy2_get_ms_since_system_start() | ;
while (animation) {
const int32_t rel_ms_running = serial_distance32(animation->abs_start_time_ms, now);
if (rel_ms_running < 0) {
// AnimationLegacy2s are ordered by abs_start_time_ms.
// We've reached an animation that should not start yet, so
// everything after and including this ani... |
IN_RECT_NO_CLIP, true, 1);
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MAX_PRECOMPUTED);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r2_no_clip.${BIT_DEPTH_NAME}.pbi"));
// Radius of 0 - draw a single pixel
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CL... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_aa_r1_no_clip.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 1);
graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_SMALL);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_aa_r1_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_... |
struct tm jan_6 = {
.tm_sec = 0, // 0 seconds after the minute
.tm_min = 30, // 30 minutes after the hour
.tm_hour = 17, // 17 hours since midnight
.tm_mday = 6, // 6st day of the month
.tm_mon = 0, // January
.tm_year = 2014 - 1900,
.tm_isdst = 0,
};
// DST info for US/Canada 2014
... | {
char time_buf[64];
const int jun10th_noon_2015 = 1433937600;
prv_clock_reset(0);
rtc_set_time(jun10th_noon_2015);
// Our test event is at June 10th 2015, 14:00:00
// Now + two hours
const int event_time = jun10th_noon_2015 + (2 * SECONDS_PER_HOUR);
// if the event is in 1+ hours, then show the act... |
cl_assert_equal_s("Wed, 2:00 PM", time_buf);
// June 9th 2015, 23:59:58 (T-14:00:02)
rtc_set_time(event_time - (14 * SECONDS_PER_HOUR) - 2);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("Wed, 2:00 PM", time_buf);
// June 9th 2015, 23:59:5... |
ecordHome,
"Sports layout requires that all Home attributes are directly after Away");
_Static_assert(AttributeIdScoreAway + 1 == AttributeIdScoreHome,
"Sports layout requires that all Home attributes are directly after Away");
#if !TINTIN_FORCE_FIT
///////////////////////////////////////... | for (int i = 0; i < num_teams; i++) {
GTextNode *team_node = prv_create_team_node(layout_ref, i);
graphics_text_node_container_add_child(&game_node->container, team_node);
} |
return &game_node->container.node;
}
static GTextNode *prv_broadcaster_header_constructor(
const LayoutLayer *layout_ref, const LayoutNodeConstructorConfig *config) {
const char *broadcaster =
attribute_get_string(layout_ref->attributes, AttributeIdBroadcaster, "");
if (IS_EMPTY_STRING(broadcaster)) {... |
8},
{ -936, 72, 208},
{ -856, 152, 168},
{ -792, 280, 184},
// 56 seconds
{ -992, 464, 200},
{ -1200, 432, 472},
{ -1320, 704, 224},
{ -1248, 120, 216},
{ -1016, 248, 192},
{ -1240, 472, 248},
{ -1432, 352, 208},
{ -1648, 528, -192},
{ -1296, 288, 232},
{ -1112, 1... | {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_25478_6
//> TEST_EXPECTED 100
//> TEST_EXPECTED_MIN 75
//> TEST_EXPECTED_MAX 120
//> TEST_WEIGHT 1.0
static AccelRawData samples[] = {
// 0 seconds
// elapsed: 0 minutes
{ -488, 168, -944},
{ -... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.