prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
prv_assert_simple_test_object_pending();
prv_rcv_app_message_ack(APP_MSG_OK);
EXPECT_OUTBOX_NO_MESSAGE_PENDING();
}
static void prv_init_and_goto_session_open_with_tiny_buffers(void) {
prv_init_and_goto_awaiting_reset_complete_remote_initiated();
RCV_APP_MESSAGE(TupletBytes(PostMessageKeyResetComplete, \
... | EXPECT_OUTBOX_NO_MESSAGE_PENDING() | ;
task_free(buffer);
}
void test_rocky_api_app_message__postmessage_not_jsonable(void) {
prv_init_and_goto_session_open();
const char *not_jsonable_error =
"TypeError: Argument at index 0 is not a JSON.stringify()-able object";
EXECUTE_SCRIPT_EXPECT_ERROR("_rocky.postMessage(undefined);", not_jsonable_err... |
(data->debug_card.dialog_text, name, sizeof(data->debug_card.dialog_text)) | ;
time_t day_start = time_start_of_today();
time_t now = time(NULL);
HealthServiceAccessibilityMask accessible;
accessible = health_service_metric_averaged_accessible(
metric, day_start, now, HealthServiceTimeScopeDailyWeekdayOrWeekend);
if (!(accessible & HealthServiceAccessibilityMaskAvailable)) {
... | |
/*
* 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_DEBUG, "starting tick timer") | ;
regular_timer_add_seconds_callback(&s_tick_timer_info);
}
}
void tick_timer_remove_subscriber(PebbleTask task) {
PBL_ASSERTN(s_num_subscribers > 0);
--s_num_subscribers;
if (s_num_subscribers == 0) {
PBL_LOG(LOG_LEVEL_DEBUG, "stopping tick timer");
regular_timer_remove_callback(&s_tick_timer_info... |
We're priviledged, it's not safe to just kill the app task.
vTaskResume((TaskHandle_t) context->task_handle);
return false;
}
context->safe_to_kill = true;
return true;
}
// --------------------------------------------------------------------------------------------------
static void prv_force_close_t... | expandable_dialog_get_dialog(expandable_dialog) | ;
const char *error_text = i18n_noop("This app requires a newer version of the Pebble firmware.");
dialog_set_text(dialog, i18n_get(error_text, expandable_dialog));
dialog_set_icon(dialog, RESOURCE_ID_GENERIC_WARNING_SMALL);
i18n_free(error_text, expandable_dialog);
if (pebble_task_get_current() == PebbleTas... |
/*
* 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_prefs->action_group) | != NULL);
ios_notif_pref_db_free_prefs(notif_prefs);
return has_reply_action;
}
static void prv_blobdb_event_handler(PebbleEvent *event, void *context) {
const PebbleBlobDBEvent *blobdb_event = &event->blob_db;
if (blobdb_event->db_id != BlobDBIdiOSNotifPref) {
return;
}
if (blobdb_event->type != Bl... |
e additional v1 metadata fields:
PPoGATTSessionType session_type = PPoGATTSessionType_InferredFromUuid;
if (/*meta->ppogatt_max_version >= 0x01 &&*/ value_length >= sizeof(PPoGATTMetaV1)) {
const PPoGATTMetaV1 *meta_v1 = (const PPoGATTMetaV1 *)value;
if (meta_v1->pp_session_type >= PPoGATTSessionTypeCount) ... | bt_unlock() | ;
}
void ppogatt_invalidate_all_references(void) {
bt_lock();
{
PPoGATTClient *client = s_ppogatt_head;
while (client) {
PPoGATTClient *next = (PPoGATTClient *) client->node.next;
prv_delete_client(client, true /* is_disconnected */, DeleteReason_InvalidateAllReferences);
client = next;
... |
pfs_close(fds[j]) | == S_SUCCESS);
}
fd = pfs_open("newfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
pfs_close(fd);
int fd2 = pfs_open("newfile", OP_FLAG_READ, 0, 0);
cl_assert((fd2 >= 0) && (fd == fd2)); // should have a cache hit
pfs_close(fd2);
fd = pfs_open("toobig", OP_FLAG_WRITE, FILE_TYPE_STAT... | |
E_FORMAT);
ctx.dest_bitmap = *s_dest_bitmap;
ctx.draw_state.clip_box = (GRect){.size = size};
ctx.draw_state.drawing_box = ctx.draw_state.clip_box;
graphics_context_set_text_color(&ctx, GColorBlack);
graphics_context_set_fill_color(&ctx, GColorLightGray);
memset(s_dest_bitmap->addr, 0xff, s_dest_bitmap->row... | (gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)) | ;
}
void test_graphics_draw_text_flow__flow_no_paging_draw_box(void) {
TextLayoutExtended layout = {
.flow_data = {
.perimeter.impl = &(GPerimeter){.callback=perimeter_for_display_round},
.perimeter.inset = 8,
},
};
render_steps(&layout, RenderMoveDrawBox, DELTA, DISP_ROWS, NULL);
// should... |
/*
* 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... | kino_reel_get_duration(player->reel) | ;
bool is_reel_infinite = (kino_reel_duration == PLAY_DURATION_INFINITE);
bool is_animation_reversed = animation_get_reverse(animation);
bool is_animation_infinite =
(animation_get_duration(animation, false, false) == PLAY_DURATION_INFINITE);
if (!is_animation_infinite && !is_reel_infinite) {
// If nei... |
/*
* 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... | {
sports_app_data->current_bpm = health_service_peek_current_value(HealthMetricHeartRateBPM);;
} | |
"text codepoint %"PRIx32" is %zu bytes, overflowing %zu max size", codepoint,
glyph_size_bytes, CACHE_GLYPH_SIZE);
if (glyph_size_bytes) {
uint8_t *target;
PBL_LOG_D(LOG_DOMAIN_TEXT, LOG_LEVEL_DEBUG,
"GD read: cp: %"PRIx32", res_bank: %"PRIu32", res_id: %"PRIu32", "
... | keyed_circular_cache_push(&font_cache->line_cache, cache_key, data) | ;
return NULL;
}
size_t num_bytes_loaded;
if (FONT_VERSION(font_res->md.version) == FONT_VERSION_1) {
GlyphHeaderDataV1 header;
PBL_LOG_D(LOG_DOMAIN_TEXT, LOG_LEVEL_DEBUG, "LGMD READ: offset: %"PRIx32", bytes: %zu",
data->resource_offset, sizeof(header));
SYS_PROFILER_NODE_START(tex... |
= 1);
// Callback should not get invoked if we close with read access
s_watch_file_callback_called_count = 0;
fd = pfs_open(file_name, OP_FLAG_READ, 0, 0);
cl_assert(fd >= 0);
pfs_close(fd);
cl_assert(s_watch_file_callback_called_count == 0);
// Callback should get invoked if we remove the file
s_watc... | ("b_test_0", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10) | |
) {
GRect bounds = scroll_layer->content_sublayer.bounds;
bounds.size = size;
layer_set_bounds(&scroll_layer->content_sublayer, &bounds);
// Ensure our content offset is clipped to the new size.
// We call prv_scroll_layer_set_content_offset_internal() directly and
// keep potential animations running – sin... | (&scroll_layer->shadow_sublayer) | ;
}
// paging and shadow_sublayer are mutually exclusive
scroll_layer->paging.shadow_hidden = true;
scroll_layer->paging.paging_disabled = false;
} else {
if (prv_scroll_layer_is_paging_enabled(scroll_layer)) {
prv_setup_shadow_layer(scroll_layer);
// still require explicit un-hiding ... |
bool schedule_3[7] = {false, true, false, false, false, false, false};
char alarm_day_text_3[32] = {0};
alarm_get_string_for_custom(schedule_3, alarm_day_text_3);
cl_assert_equal_s(alarm_day_text_3, "Mondays");
bool schedule_4[7] = {false, false, true, false, false, false, false};
char alarm_day_text_4[3... | cl_assert_equal_i(delay, 10) | ;
alarm_set_snooze_delay(15);
delay = alarm_get_snooze_delay();
cl_assert_equal_i(delay, 15);
}
void test_alarm__set_snooze_alarm() {
alarm_set_snooze_alarm();
cl_assert_equal_i(s_snooze_timer_timeout_ms, 10 * 1000);
cl_assert_equal_i(s_num_alarm_events_put, 0);
s_current_minute = 10;
cl_assert_equal_... |
/*
* 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... | fs_rm(fixture_path(_clar_path, "*")) | |
_set_time(event_time - (1 * SECONDS_PER_HOUR));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("IN 1 H", time_buf);
// June 9th 2015, 14:00:00 (T-02:00:00)
rtc_set_time(event_time - (2 * SECONDS_PER_HOUR));
clock_get_until_time_capitalized(time_b... | (event_time - (2 * SECONDS_PER_MINUTE)) | |
ist_append(list_append(&a, &b), &c);
cl_assert(list_count(tail) == 3);
cl_assert(list_count(&a) == 3);
cl_assert(list_count(&b) == 3);
cl_assert(list_count(&c) == 3);
cl_assert(list_count_to_tail_from(&a) == 3);
cl_assert(list_count_to_tail_from(&b) == 2);
cl_assert(list_count_to_tail_from(&c) == 1);
cl... | cl_assert(list_find_next(NULL, filter_odd, false, NULL) == NULL) | ;
cl_assert(list_find_prev(NULL, filter_odd, false, NULL) == NULL);
}
void test_list__concatenate(void) {
ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL;
ListNode d = LIST_NODE_NULL, e = LIST_NODE_NULL, f = LIST_NODE_NULL;
cl_assert_equal_p(list_concatenate(&a, &b), &a);
cl_assert_equal... |
CALE_GRANULARITY - 1)
/ BACKLIGHT_SCALE_GRANULARITY);
}
static int prv_intensity_get_selection_index() {
const uint8_t intensity = prv_get_scaled_brightness();
// FIXME: PBL-22272 ... We will return idx 0 if someone has an old value for
// one of the intensity options
for (int i = 0; i < (int)ARRA... | settings_display_calibration_push(app_state_get_window_stack()) | ;
break;
#endif
default:
WTF;
}
settings_menu_reload_data(SettingsMenuItemDisplay);
settings_menu_mark_dirty(SettingsMenuItemDisplay);
}
static void prv_draw_row_cb(SettingsCallbacks *context, GContext *ctx,
const Layer *cell_layer, uint16_t row, bool selected) {
Set... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | FLASH_Lock() | ;
return true;
}
uint32_t system_flash_read(uint32_t address) {
uint32_t data = *(volatile uint32_t*) address;
return data;
}
|
368, -936},
{ -208, 360, -936},
{ -208, 368, -936},
{ -200, 360, -928},
{ -200, 376, -928},
{ -200, 368, -936},
{ -208, 360, -944},
{ -216, 368, -936},
{ -208, 360, -928},
{ -208, 368, -928},
{ -208, 368, -928},
{ -200, 368, -944},
{ -208, 368, -920},
{ -208, 360, -9... | { -232, 432, -896},
{ -224, 440, -888},
{ -232, 440, -888},
{ -232, 424, -896},
{ -224, 416, -888},
// 289 seconds
{ -224, 432, -896},
{ -232, 448, -896},
{ -232, 432, -896},
{ -232, 424, -888},
{ -232, 432, -896},
{ -232, 432, -896},
{ -232, 432, -896},
{ -232, 4... |
{ -200, 424, -896},
{ -200, 448, -888},
{ -208, 432, -896},
{ -184, 424, -912},
{ -168, 424, -912},
{ -160, 424, -888},
{ -152, 456, -888},
{ -144, 464, -896},
{ -64, 416, -968},
{ -128, 328, -952},
{ -104, 384, -944},
{ -96, 440, -912},
{ -88, 424, -888},
{ -64,... |
AnalyticsClient_System);
analytics_set(ANALYTICS_DEVICE_METRIC_FLASH_WRITE_BYTES_COUNT,
s_system_analytics_write_bytes_count, AnalyticsClient_System);
analytics_set(ANALYTICS_DEVICE_METRIC_FLASH_ERASE_COUNT,
s_system_analytics_erase_count, AnalyticsClient_System);
s_system_analyti... | (s_flash_lock) | |
ctivityScalarStore average, int *percentage) {
// Determine percentage of target
*percentage = (average > 0) ? (((cur_val * 100) / (average)) - 100) : 0;
if (*percentage < config->insight_settings->summary.fail_threshold) {
return PercentTier_Fail;
} else if (*percentage < config->insight_settings->summary... | (percentage_buf, SUBTITLE_BUFFER_LENGTH, "%+d%%", percentage) | ;
}
attribute_list_add_cstring(&pin_attr_list, AttributeIdSubtitle, percentage_buf);
TimelineItem *item = prv_create_pin(pin_time_utc, now_utc, 0, LayoutIdWeather, &pin_attr_list,
config->health_card_type);
kernel_free(percentage_buf);
i18n_free_all(&pin_attr_list);
a... |
/*
* 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, "") | ;
// Make sure we have space for the model.
mfg_info_set_model("test_model");
cl_assert_equal_i(mfg_info_get_watch_color(), 5);
cl_assert_equal_i(mfg_info_get_rtc_freq(), 4);
mfg_info_get_model(buffer);
cl_assert_equal_s(buffer, "test_model");
}
|
schedule
do_not_disturb_handle_clock_change();
active = do_not_disturb_is_active();
cl_assert(active == true);
// Timer will go off at 00:00 on Saturday. (0.5 hours)
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_SECOND);
rtc_set_time(s_saturday_00_30);
do_not_disturb_handle... | (s_saturday_00_00) | |
under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "health.h"
#include "health_card_view.h"
#include "health_data.h"
#inc... | (health_app_data) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | action_button_draw(ctx, action_button_layer, GColorBlack) | ;
}
|
E(45), GPointZero);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
"draw_rotated_bitmap_origin_color_set_center_45_transparent.Xbit.pbi"));
}
void test_graphics_draw_rotated_bitmap__offset_color(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// No Clip, Angle 0
setup_test_... | (&ctx->dest_bitmap, "draw_rotated_bitmap_stamp_0deg.Xbit.pbi") | |
/*
* 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_delta_moook_in) | * ANIMATION_TARGET_FRAME_INTERVAL_MS;
}
uint32_t interpolate_moook_out_duration() {
return ARRAY_LENGTH(s_delta_moook_out) * ANIMATION_TARGET_FRAME_INTERVAL_MS;
}
uint32_t interpolate_moook_duration() {
return interpolate_moook_in_duration() + interpolate_moook_out_duration();
}
uint32_t interpolate_moook_soft_... |
ext_out_animation =
property_animation_create_layer_frame(&data->info_text_layer.layer,
&pair_text_area, &below_pair_text);
PBL_ASSERTN(data->info_text_out_animation);
animation = property_animation_get_animation(data->info_text_out_animation);
animation_set_a... | prv_has_device_name(data) | ) {
layer_remove_from_parent(&data->device_name_text_layer.layer);
}
if (prv_has_confirmation_token(data)) {
layer_remove_from_parent(&data->code_text_layer.layer);
}
// Disable all buttons in this screen:
action_bar_layer_remove_from_window(&data->action_bar_layer);
action_bar_layer_set_click_conf... |
/*
* 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... | mutex_unlock(mutex_2) | |
on_resource_id = 0,
};
static const AppDBEntry app2 = {
.name = "Application 2",
.uuid = {0x55, 0xcb, 0x7c, 0x75, 0x8a, 0x35, 0x44, 0x87,
0x90, 0xa4, 0x91, 0x3f, 0x1f, 0xa6, 0x76, 0x01},
.app_version = {
.major = 1,
.minor = 1,
},
.sdk_version = {
.major = 1,
.minor = 1,
},
.in... | cl_assert(app_one_id > 0) | ;
cl_assert_equal_i(S_SUCCESS, app_db_get_app_entry_for_install_id(app_three_id, &temp));
cl_assert_equal_b(true, uuid_equal(&app3.uuid, &temp.uuid));
}
void test_app_db__retrieve_app_db_entries_by_uuid(void) {
AppDBEntry temp;
// check app_db_get_install_id_for_uuid for app 1
memset(&temp, 0, sizeof(AppDBE... |
indowTransitioningContext *context) {
window_transition_context_disappear(context);
window_transition_context_appear(context);
return animation_create();
}
const WindowTransitionImplementation g_window_transition_none_implementation = {
.create_animation = window_transition_none_create_animation,
};
void comp... | cl_assert_equal_i(app_window_stack_count(), 0) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (solution, expected_final_solution) | ;
}
}
}
|
!boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED)) {
// We're good, we're just starting normally.
PBL_LOG_VERBOSE("We're good, we're just starting normally.");
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE);
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO);
return false;
}
// We failed to... | (" /\\___/") | ;
dbgserial_putstr(" \\/__/");
// PMIC requires I2C
i2c_init();
// Enable the 3.2V rail for the benefit of the FPGA and display
pmic_init();
boot_bit_init();
boot_version_write();
// Write the bootloader version to serial-out
{
char bootloader_version_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... | (reply, ntoh16(packet->length)) | ;
}
}
static void prv_on_echo_reply(PPPControlProtocol *this,
struct LCPPacket *packet) {
// TODO
}
static bool prv_handle_extended_lcp_codes(PPPControlProtocol *this,
LCPPacket *packet) {
switch (packet->code) {
case ControlCode_Protoc... |
XNY, true, 1);
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw1_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// AA = true, SW = 2
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 2);
graphics_draw_rect(&ctx, &ORIGIN_DRA... | (gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")) | ;
#endif
}
void test_graphics_draw_rect_${BIT_DEPTH_NAME}__origin_sw(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// SW = 1
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP);
cl_check(gbitmap_pbi_eq(&ctx.des... |
(notifications_glance->title, node->name, title_size) | ;
notifications_glance->title[title_size - 1] = '\0';
// Create the icon for the Notifications app
notifications_glance->icon = kino_reel_create_with_resource_system(node->app_num,
node->icon_resource_id);
PBL_ASSERTN(notifications_glance->ic... | |
36, 968},
{ -32, 624, 896},
{ 8, 528, 816},
{ 104, 400, 648},
{ 160, 304, 536},
{ 240, 296, 504},
{ 256, 256, 512},
{ 256, 304, 552},
{ 240, 352, 512},
{ 168, 440, 616},
{ 240, 504, 560},
{ 224, 240, 1040},
{ 184, 920, 1152},
{ 168, 936, 1224},
{ 104, 776, 1184},
... | { 368, 552, -496},
{ 320, 504, -352},
{ 304, 696, -376},
{ 232, 720, -328},
{ 232, 704, -320},
{ 208, 720, -344},
{ 232, 736, -296},
{ 264, 736, -272},
{ 280, 848, -168},
{ 344, 808, -136},
{ 232, 880, -120},
{ 208, 1224, -176},
{ 160, 1416, -128},
{ -32, 1608, -2... |
{ 64, 528, 72},
// 5 seconds
{ 64, 568, 216},
{ 64, 840, 512},
{ 240, 1408, 648},
{ 256, 1424, 752},
{ 152, 1808, 872},
{ 80, 1456, 664},
{ -64, 1040, 440},
{ 8, 784, 312},
{ -32, 552, 328},
{ 144, 696, 112},
{ 112, 632, 168},
{ 56, 864, 80},
{ 96, 544, 16},
... |
e "stubs_app_state.h"
#include "stubs_comm_session.h"
#include "stubs_logging.h"
#include "stubs_passert.h"
#include "stubs_serial.h"
#include "stubs_sys_exit.h"
extern PostMessageState rocky_api_app_message_get_state(void);
extern AppTimer *rocky_api_app_message_get_app_msg_retry_timer(void);
extern AppTimer *rocky_a... | {
s_comm_session_connected = start_connected;
rocky_global_init(s_app_message_api);
} | |
er_get_bounds(window_layer);
static SimpleMenuItem menu_items[] = {
{
.title = "Step History",
.callback = prv_debug_cmd_step_history,
}, {
.title = "Active Minutes History",
.callback = prv_debug_cmd_active_time_history,
}, {
.title = "Distance(m) History",
.callback ... | window_create() | |
/*
* 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 (app_type == UNKNOWN_APP_TYPE) {
return;
}
AppInstallId app_id = (app_type == SPORTS) ? APP_ID_SPORTS : APP_ID_GOLF;
app_install_do_callbacks(APP_ICON_NAME_UPDATED, app_id, NULL, NULL, NULL);
} |
#if ALLOW_SET_ICON
static void set_icon(const CustomizableAppType app_type, const uint16_t row_size_bytes,
const uint16_t info_flags, const GRect bounds,
const uint8_t image_data[], const uint16_t image_data_length) {
AppCustomizeInfo *info = &s_info[app_type];
const uint16_t desired_size = row_size_byte... |
/*
* 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_GetClocksFreq(&clocks) | ;
uint32_t prescaler = clocks.PCLK2_Frequency / this->pdm_frequency;
// Disable the device before changing the config
DFSDM_Cmd(DISABLE);
DFSDM_ChannelCmd(this->channel, DISABLE);
DFSDM_FilterCmd(this->filter, DISABLE);
DFSDM_TransceiverInitTypeDef DFSDM_InitStruct;
DFSDM_TransceiverStructInit(&DFSDM_I... |
prv_create_window_and_render(active_window, 0) | ;
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_workout_active__sports_speed(void) {
s_sports_data = (SportsData) {
.current_bpm = 71,
.duration_string = "20:00",
.distance_string = "18.9",
.pace_string = "35.3",
};
WorkoutMetricType top_metric = WorkoutMetricType_Du... | |
sage_queue_pop_head();
} else {
if (s_state.out.failure_count >= CONTROL_MESSAGE_MAX_FAILURES) {
MessageNode *node = s_state.out.control_msg_queue;
PBL_LOG(LOG_LEVEL_ERROR, "Failed to send msg with key %"PRIu32, node ? node->key : 0);
prv_control_message_queue_pop_head();
... | (rc->max_supported_version, POSTMESSAGE_PROTOCOL_MAX_VERSION) | |
te
bmp = gbitmap_create_blank(s10, GBitmapFormat2BitPalette);
cl_assert(NULL != bmp);
cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette
bmp = gbitmap_create_blank(s10, GBitmapFormat4BitPalette);
cl_assert(NULL != bmp);
cl_assert(g_gbitmap_spalding_data_row_infos !... | cl_assert_equal_i(130, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat8Bit)) | ;
cl_assert_equal_i( 20, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat1BitPalette));
cl_assert_equal_i( 40, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat2BitPalette));
cl_assert_equal_i( 70, prv_gbitmap_size_for_data(GSize(13, 10), GBitmapFormat4BitPalette));
cl_assert_equal_i( 0, prv_gbitmap... |
ret = bt_persistent_storage_get_ble_pairing_by_id(id_2, &irk_out, &device_out, NULL /* name */);
cl_assert(ret);
cl_assert_equal_m(&irk_out, &pairing_2.irk, sizeof(irk_out));
cl_assert_equal_m(&device_out, &pairing_2.identity, sizeof(device_out));
ret = bt_persistent_storage_get_ble_pairing_by_id(id_3, &irk_ou... | (id != BT_BONDING_ID_INVALID) | ;
cl_assert_equal_i(s_ble_bonding_change_add_count, 2);
cl_assert_equal_i(fake_shared_prf_storage_get_ble_store_count(), 2);
// Delete a pairing that doesn't exist. Delete count should stay at 1
bt_persistent_storage_delete_ble_pairing_by_id(9);
cl_assert_equal_i(s_ble_bonding_change_delete_count, 1);
cl_a... |
rty_animation) {
return;
}
GPoint result;
result.x = interpolate_int16(distance_normalized,
property_animation->values.from.gpoint.x,
property_animation->values.to.gpoint.x);
result.y = interpolate_int16(distance_normalized,
... | setter(property_animation->subject, result) | ;
}
#endif
// -----------------------------------------------------------------------------------------
void property_animation_update_gcolor8(PropertyAnimation *property_animation_h,
const uint32_t distance_normalized) {
PBL_ASSERTN(!animation_private_using_legacy_2(NULL));
... |
ition);
cl_assert_equal_i(position, duration_a + delay_a - leftover_a);
// Now, advance sequence to almost the end of seq. Positions don't include the delay, so
// pass false for 'include_delay'
animation_set_elapsed(seq, animation_get_duration(seq, false /*delay*/, true /*play_count*/)
... | (seq, animation_get_duration(seq, false /*delay*/, true /*play_count*/)
- leftover_seq) | |
!att_handle) {
ret_val = BTErrnoInvalidParameter;
goto unlock;
}
GattClientEventContext *data = prv_create_event_context(client);
if (!data) {
ret_val = BTErrnoNotEnoughResources;
goto unlock;
}
// Zero'd out and added to list in `prv_create_event_context`
data->client ... | (descriptor, value, value_length, client,
gatt_client_descriptor_get_handle_and_connection,
PebbleBLEGATTClientEventTypeDescriptorWrite) | ;
}
BTErrno gatt_client_op_read_descriptor(BLEDescriptor descriptor,
GAPLEClient client) {
return prv_read(descriptor, client,
gatt_client_descriptor_get_handle_and_connection,
PebbleBLEGATTClientEventTypeDescriptorRead);
}
BTErrno gatt_clie... |
&layout->layout_layer, &s_primary_config.extent.node);
primary_node->text =
attribute_get_string(attributes, AttributeIdShortTitle, NULL) ?:
attribute_get_string(attributes, layout->impl->attributes.primary_id, "");
primary_node->line_spacing_delta = style->primary_line_spacing_delta;
i... | gpoint_add_eq(&icon_node->node.offset,
GPoint(PBL_IF_RECT_ELSE(1, 2),
PBL_IF_RECT_ELSE(0, -1) - (concurrent_height / 2))) | ;
graphics_text_node_container_add_child(&vertical_icon_node->container, &icon_node->node);
graphics_text_node_container_add_child(&horizontal_node->container,
&horizontal_icon_node->container.node);
return &horizontal_node->container.node;
}
return &vertical_... |
r *layer) {
return !layer_get_hidden((Layer *)&layer->day_separator);
}
void timeline_layer_move_data(TimelineLayer *layer, int delta) {
PBL_ASSERTN(delta == 1 || delta == -1);
if (delta == 1) {
if (layer->layouts[s_nonvisible_items[0]]) {
prv_destroy_layout(layer, s_nonvisible_items[0]);
}
for... | {
static const AnimationImplementation s_speed_lines_impl = {
.update = prv_speed_lines_update,
};
Animation *animation = animation_create();
animation_set_implementation(animation, &s_speed_lines_impl);
const unsigned int num_jump_frames = 3;
animation_set_duration(animation, num_jump_frames * ANIMATI... |
static Animation *prv_create_bounce_back_animation(Layer *layer, const GRect *to_orig,
GPoint direction) {
GRect from = *to_orig;
GRect to = *to_orig;
gpoint_add_eq(&from.origin, GPoint(direction.x * INTERPOLATE_MOOOK_BOUNCE_BACK,
... |
t_lock.h"
#include "stubs_gap_le_advert.h"
#include "stubs_bluetooth_analytics.h"
#include "stubs_gatt_client_discovery.h"
#include "stubs_gatt_client_subscriptions.h"
#include "stubs_logging.h"
#include "stubs_mutex.h"
#include "stubs_passert.h"
#include "stubs_pebble_pairing_service.h"
#include "stubs_print.h"
#inclu... | (&address_out) | |
nel/pbl_malloc.h"
#include "syscall/syscall.h"
#include "util/size.h"
#include "util/trig.h"
typedef struct {
Window window;
} GDrawMaskDemoData;
static void prv_draw_text(GContext *ctx, const GRect *layer_bounds) {
graphics_context_set_text_color(ctx, GColorBlack);
const char *text = PBL_IF_RECT_ELSE("Masks ar... | app_timer_register(ANIMATION_TARGET_FRAME_INTERVAL_MS, prv_refresh_timer_callback, data) | ;
}
static void prv_window_load(Window *window) {
GDrawMaskDemoData *data = window_get_user_data(window);
Layer *window_root_layer = window_get_root_layer(window);
layer_set_update_proc(window_root_layer, prv_layer_update_proc);
app_timer_register(ANIMATION_TARGET_FRAME_INTERVAL_MS, prv_refresh_timer_callback... |
ler. Asserts in the code will help to ensure that the
//! API is used correctly.
//
void spi_ll_slave_acquire(const SPISlavePort *slave) {
PBL_ASSERTN(slave->slave_state->initialized);
PBL_ASSERTN(slave->slave_state->acquired == false);
prv_spi_enable_peripheral_clock(slave->spi_bus);
prv_spi_clear_flags(slav... | {
PBL_ASSERTN(slave->slave_state->initialized);
PBL_ASSERTN(slave->slave_state->acquired);
for (size_t elem = 0; elem < num_sg; ++elem) {
const SPIScatterGather *sg = &sc_info[elem];
spi_ll_slave_burst_read_write(slave, sg->sg_out, sg->sg_in, sg->sg_len);
}
} |
static bool prv_dma_irq_handler(DMARequest *request, void *context) {
const SPISlavePort *slave = context;
PBL_ASSERTN(slave);
bool is_done = false;
switch (slave->slave_state->dma_state) {
case SPISlavePortDMAState_Read:
case SPISlavePortDMAState_Write:
case SPISlavePortDMAState_ReadWriteOneInter... |
arm_config(id1, 10, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
cl_assert_equal_i(s_num_timeline_adds, 3);
alarm_get_next_enabled_alarm(&next_alarm_time);
cl_assert_equal_i(next_alarm_time,
s_current_day + 10 * SECONDS_PER_HOUR + 30 * SECONDS_PER_MINUTE);
id2 = alarm_create(&(Al... | cron_service_wakeup() | ;
cl_assert_equal_i(s_num_alarms_fired, 0);
// Only 1 pin should be added (for Saturday)
cl_assert_equal_i(s_num_timeline_adds, 1);
s_current_minute = 30;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 1);
cl_assert_equal_i(s_num_timeline_adds, 3);
}
void test_alarm__recurring_weekends_ala... |
#include "services/normal/settings/settings_file.h"
#include "process_management/app_install_manager.h"
#include "util/attributes.h"
#include "clar.h"
// Fakes
//////////////////////////////////////////////////////////
#include "fake_app_manager.h"
#include "fake_new_timer.h"
#include "fake_pbl_malloc.h"
#include "fa... | (&file, (uint8_t*)&wakeup_id, sizeof(wakeup_id)) | |
n.h"
// rocky.watchInfo = {
// platform: "basalt",
// model: "pebble_time_red",
// language: "en_US",
// firmware: {
// major: 4,
// minor: 0,
// patch: 1,
// suffix: "beta3"
// }
// }
#define ROCKY_WATCHINFO "watchInfo"
#define ROCKY_WATCHINFO_PLATFORM "platform"
#... | model_name = SNOWY_MODEL("pebble_time_steel_black");
break;
case WATCH_INFO_COLOR_TIME_STEEL_GOLD:
model_name = SNOWY_MODEL("pebble_time_steel_gold");
break;
case WATCH_INFO_COLOR_TIME_ROUND_SILVER_14:
model_name = SPALDING_MODEL("pebble_time_round_silver_14mm");
... | |
ernal(&origin_center, radius, (TRIG_MAX_ANGLE * 3 / 4));
cl_assert_equal_gpoint(result, GPoint(-5, 0));
const GPoint offset_center = GPoint(1, 1);
// 90 degrees should be (6, 1)
result = gpoint_from_polar_internal(&offset_center, radius, (TRIG_MAX_ANGLE / 4));
cl_assert_equal_gpoint(result, GPoint(6, 1));
... | (GRect(5, 4, 2, 2), grect_centered_internal(&p2, GSize(2, 2))) | ;
// Repeat for a positive offset center point with 0.5 fractions
GPointPrecise p3 = GPointPreciseFromGPoint(GPoint(5, 5));
p3.x.raw_value += FIXED_S16_3_HALF.raw_value;
p3.y.raw_value += FIXED_S16_3_HALF.raw_value;
// GRectZero + standardize
cl_assert_equal_grect(GRect(6, 6, 0, 0), grect_centered_interna... |
/*
* 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... | strcpy(dup, s) | ;
}
return dup;
}
// task_* functions that map to other heaps depending on the current task
///////////////////////////////////////////////////////////
#if defined(MALLOC_INSTRUMENTATION)
void *task_malloc_with_pc(size_t bytes, uintptr_t client_pc) {
return heap_malloc(task_heap_get_for_current_task(), bytes, cl... |
uuid_to_string(&desc_dest->uuid, uuid_str);
PBL_LOG(LOG_LEVEL_DEBUG,
" Found Descriptor %s Handle 0x%x", uuid_str, item->handle);
} else if (item->type == GATTC_ITEM_TYPE_INCLUDE) {
att_handles_included_services[att_idx] = item->i.start_h;
att_idx++;
PBL_LOG(LOG_LEVEL_D... | connection_by_idx_check(service->conn_idx) | ;
connection_get_address(connection, &payload->address);
hc_endpoint_discovery_send_service_found(payload, payload_size);
const Uuid ppogatt_uuid =
(const Uuid){PEBBLE_BT_UUID_EXPAND(PEBBLE_BT_PPOGATT_SERVICE_UUID_32BIT)};
if (uuid_equal(&payload->service.uuid, &ppogatt_uuid)) {
PBL_LOG(LOG_LEVEL_DEB... |
eed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "util/trig.h"
#include "util... | serial_distance(6, 1, 3) | |
}
prev = result;
result = result->next;
}
}
//! Finds ScanResult based on BTDevice. If found, unlink and return ScanResult.
static ScanResult *list_unlink(const BTDevice *device) {
ScanResult *prev = NULL;
ScanResult *result = s_head;
while (result) {
if (bt_device_equal(&result->device, device)... | list_link_sorted_by_rssi(result) | |
sed on the FS, this routine will return
//! very quickly. If we need to do erases, it will take longer becauses this
//! operation can take seconds to complete on certain flash parts
//!
//! @param file_size - The amount of file space to erase
//! @param max_elapsed_ticks - The max amount of time to spend attempting ... | {
status_t rv;
uint16_t start_page = INVALID_PAGE;
PageHeader pg_hdr;
memset(&pg_hdr, 0xff, sizeof(pg_hdr));
bool use_gc_allocator = (strcmp(f->name, GC_FILE_NAME) == 0);
if ((rv = find_free_page(&start_page, use_gc_allocator, true)) != S_SUCCESS) {
return (rv);
}
pg_hdr.version = PFS_CUR_VERSIO... |
write_pg_header(&pg_hdr, curr_page);
break; // we are done
}
}
// we have succesfully allocated space for the file, so add file specific info
f->start_page = f->curr_page = start_page;
FileHeader file_hdr;
memset(&file_hdr, 0xff, sizeof(file_hdr));
file_hdr.file_namelen = strlen(f->name);... |
sert_equal_p(s_last_click_configured_window, window2);
// Switch to modal happens via the compositor
compositor_transition(NULL);
// Call the upkeep function so the change in state is handled
modal_manager_event_loop_upkeep();
// The app is now obstructed by a transparent modal, it should remain active
cl... | fake_event_get_last() | ;
cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT);
cl_assert_equal_i(event.app_focus.in_focus, true);
cl_assert_equal_i(window1->on_screen, true);
window_stack_remove(window1, true);
cl_assert_equal_i(window1->on_screen, false);
cl_assert_equal_i(window_stack_count(app_stack), 0);
w... |
prv_assert_sent_reset_request(s_characteristics[0][PPoGATTCharacteristicData]);
// Session should still no have opened yet:
cl_assert_equal_i(fake_comm_session_open_call_count(), 0);
}
void test_ppogatt__open_session_when_found_pebble_app(void) {
prv_discover_and_read_meta_and_reset();
// Simulate getting "R... | (PPOGATT_TIMEOUT_TICK_INTERVAL_SECS) | ;
}
// Expect "Reset Request" sent by FW:
prv_assert_sent_reset_request(s_characteristics[0][PPoGATTCharacteristicData]);
}
void test_ppogatt__timeout_waiting_for_reset_complete_self_initiated(void) {
prv_discover_and_read_meta_and_reset();
// Timeout waiting for "Reset Complete":
for (int i = 0; i < PPO... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | dialog_set_icon(dialog, data->resource_id_80) | ;
dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT);
app_simple_dialog_push(simple_dialog);
}
///////////////////////////////
// Simple Dialog with vibration
static void prv_show_simple_dialog_vibe(DialogsData *data) {
SimpleDialog *simple_dialog = simple_dialog_create("Simple Vibe Dialog");
Dialog *dialog ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (data->thumbsup_timer) | ;
text_layer_set_text(&data->thumbsup_layer, "👍");
data->thumbsup_timer = app_timer_register(1000, prv_hide_thumbsup, data);
}
static void prv_set_tap_text(AppData *data, uint32_t count, AccelAxisType axis) {
char axes[] = {'X', 'Y', 'Z'};
snprintf(data->text, sizeof(data->text), "Axis: %c\nDouble Taps: %6"PR... |
(layer, ctx, GColorBlack);
break;
case TestPattern_Gray:
prv_draw_solid(layer, ctx, GColorDarkGray);
break;
case TestPattern_White:
prv_draw_solid(layer, ctx, GColorWhite);
break;
case TestPattern_Crosshair:
prv_draw_crosshair_screen(layer, ctx, 0);
break;
#if PBL_COLOR
case TestPatt... | strcmp(color, ARGS[i]) | ) {
// Do this first because it launches the mfg menu using a callback, as if we did this in the
// callback we send below to launch the display app it would end up launching the menu on
// top of the display app.
if (!mfg_is_mfg_mode()) {
mfg_enter_mfg_mode_and_launch_app();
}
... |
;
} else if (uid == split_timestamp_uid) {
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_split_timestamp_dict_part_one), (uint8_t*) s_split_timestamp_dict_part_one);
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_split_timestamp_dict_part_two), (uint8_t*) s_split_timestamp_dict_part_two);
s_num_ds_... | prv_send_notification((uint8_t *)&s_complete_dict) | |
AY, NULL);
cl_assert_equal_b(result, false);
// start after end
result = prv_calculate_time_range(now - 100, now - 200, NULL);
cl_assert_equal_b(result, false);
}
void test_health__range_to_day_id_clamps_values(void) {
const time_t now = rtc_get_time();
bool result;
HealthServiceTimeRange range;
// ... | (values[0], 1000) | ;
cl_assert_equal_i(values[1], 1000);
cl_assert_equal_i(values[2], 1000);
// ensure we can handle empty sets
values[0] = 1000;
prv_adjust_value_boundaries(values, 0, &range);
cl_assert_equal_i(values[0], 1000);
cl_assert_equal_i(values[1], 1000);
cl_assert_equal_i(values[2], 1000);
// ensure we can ... |
KinoReel *reel, GPointIndexLookupCreator creator, void *userdata, bool take_ownership) {
ScaleSegmentedData *data = kino_reel_transform_get_context(reel);
if (!data) {
return;
}
if (data->lookup.owns_userdata) {
applib_free(data->lookup.userdata);
}
data->lookup.creator = creator;
data->lookup.use... | (reel, prv_ease_in_out_last_half) | ;
}
|
/*active_cals*/, 0 /*distance*/, shutting_down,
prv_activity_session_callback, NULL);
if (shutting_down) {
break;
}
now += SECONDS_PER_MINUTE;
rtc_set_time(now);
}
// Get summary of the activity
ActivityTestResults result = { };
KAlgTestAct... | ("\n\ntest FAILED: %d failures, Avg weighted error: %.2f", fail_count,
weighted_sum / num_tests) | ;
} else {
printf("\n\ntest PASSED! Avg weighted error: %.2f", weighted_sum / num_tests);
}
cl_assert_equal_i(fail_count, 0);
kernel_free(s_kalg_state);
s_kalg_state = NULL;
}
// ---------------------------------------------------------------------------------------
// Test that we generate the right m... |
/*
* 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... | (dstbuf, 256, "There are %*d lights", 3, 4) | |
Layer *base_layer = context;
HealthHrSummaryCardData *data = layer_get_data(base_layer);
const uint32_t duration = gdraw_command_sequence_get_total_duration(data->pulsing_heart);
const uint32_t num_frames = gdraw_command_sequence_get_num_frames(data->pulsing_heart);
const uint32_t timer_duration = duration / n... | (ctx, TEXT_COLOR) | ;
graphics_draw_text(ctx, text, data->timestamp_font,
rect, GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL);
}
static void prv_base_layer_update_proc(Layer *base_layer, GContext *ctx) {
HealthHrSummaryCardData *data = layer_get_data(base_layer);
data->now_bpm = health_data_hr_get_cur... |
/*
* 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(hr_util_get_hr_zone(200), HRZone_Zone3) | ;
cl_assert_equal_i(hr_util_get_hr_zone(220), HRZone_Zone3);
cl_assert_equal_i(hr_util_get_hr_zone(240), HRZone_Zone3);
}
void test_hr_util__is_elevated(void) {
cl_assert_equal_b(hr_util_is_elevated(60), false);
cl_assert_equal_b(hr_util_is_elevated(80), false);
cl_assert_equal_b(hr_util_is_elevated(99), fal... |
ol (*PrefSetHandler)(const void *value, size_t val_len);
typedef struct {
const char *key;
void *value;
uint16_t value_len;
PrefSetHandler handler;
} PrefsTableEntry;
// The PREFS_DECLARE_HANDLER creates a springboard function with a generic signature
// (of type PrefSetHandler) which simply calls into the spe... | for (uint32_t i = 0; i < num_entries; i++, entry++) {
if (!strncmp((const char *)key, entry->key, key_len)) {
return entry;
}
} |
PBL_LOG(LOG_LEVEL_WARNING, "Unrecognized key: %s", (const char *)key);
return NULL;
}
// ------------------------------------------------------------------------------------
// Set the backing store for a pref
static bool prv_set_pref_backing(const PrefsTableEntry *entry, const void *value, int value_len) {
if... |
ert(uuid_equal(&s_items[s_correct_order[5]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id));
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(4));
cl_assert(timeline_model_iter_prev(&new_idx, NULL));
cl_assert_equal_i(new_idx, 3);
cl_assert_equal... | (&s_items[s_correct_order[2]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id) | );
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(0));
cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(2));
}
void test_timeline_model__graceful_delete_first(void) {
TimelineModel model = {0};
model.direction = Timelin... |
],
}
};
Uuid i3;
uuid_generate(&i3);
TimelineItem e3 = {
.header = {
.id = i3,
.type = TimelineItemTypeNotification,
.status = 0,
.ancs_uid = 0,
.layout = LayoutIdGeneric,
.timestamp = 0x53f0dda7,
},
.attr_list = {
.num_attributes = 1,
.attributes... | cl_assert(notification_storage_get(&uuids[j], &r)) | |
window below a transparent
// window that just disappeared, it was already on screen and may need its click configured.
const bool is_focused = (iter->current_idx == iter->first_focus_idx);
if (!window->is_click_configured && is_focused) {
// Input is now exposed by a higher priority modal window stack emptyi... | {
WindowStack *stack = prv_find_window_stack(prv_has_visible_focusable_window, NULL);
return window_stack_get_top_window(stack);
} |
void modal_manager_handle_button_event(PebbleEvent *event) {
ClickManager *click_manager = modal_manager_get_click_manager();
switch (event->type) {
case PEBBLE_BUTTON_DOWN_EVENT: {
// If we get a button event, it must also be for the top modal window.
Window *window = prv_get_visible_focused_wind... |
he timeout occurs.
prv_reset_read_info();
mbuf_iterator_init(&s_read_consumer.mbuf_iter, &s_header_mbuf);
}
}
bool smartstrap_handle_data_from_isr(uint8_t data) {
// NOTE: THIS IS RUN WITHIN AN ISR
if ((smartstrap_fsm_state_get() != SmartstrapStateReadInProgress) &&
(smartstrap_fsm_state_get() != S... | (&s_header_mbuf, context) | |
tems[0].header.id));
cl_assert(!iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id));
cl_assert(state.node);
}
void test_timeline__none_forwards(void) {
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_asse... | (&iterator) | );
#endif
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[1].header.id));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[0].header.id));
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[1].header.id));
#if !CAPABIL... |
ng.h"
#include "util/attributes.h"
#include "util/build_id.h"
#include "util/crc32.h"
#include "util/math.h"
#include <os/tick.h>
#if PLATFORM_ROBERT
#define CORE_DUMP_RX_BUFFER_SIZE (16 * 1024)
// Place in DTCM on Robert
static unsigned char DMA_BSS DMA_READ_BSS s_rx_buffer[CORE_DUMP_RX_BUFFER_SIZE];
#else
#define C... | {
PBL_LOG(LOG_LEVEL_ERROR, "Unable to get Text CRC");
goto spi_failed;
} |
memcpy(&text_crc_matches, s_rx_buffer, sizeof(text_crc_matches));
// Get the Build ID
cmd = (CoreDumpSPICmd) { .cmd = CoreDumpCmd_GetBuildID };
if (!prv_spi_transaction(&cmd, s_rx_buffer, sizeof(build_id))) {
PBL_LOG(LOG_LEVEL_ERROR, "Unable to get Build ID");
goto spi_failed;
}
memcpy(build_id, s... |
#include "kernel/pbl_malloc.h"
#include "services/common/system_task.h"
#include "system/passert.h"
#include <util/attributes.h>
#include <util/net.h>
#include "FreeRTOS.h"
#include "semphr.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
//! Modulus for sequence numbers
#define M... | (
&s_reliable_pcmp, bad_port) | ;
}
void pulse2_reliable_transport_on_command_packet(
void *raw_packet, size_t length) {
if (!s_layer_up) {
return;
}
if (length < sizeof((ReliablePacket){0}.s)) {
PBL_LOG(LOG_LEVEL_DEBUG, "Received malformed command packet");
prv_bounce_ncp_state();
return;
}
ReliablePacket *packet = ra... |
memmove(&buffer[0], &buffer[1], rx_index);
}
}
} else { // Tx Mode
if (hw_spi_is_tx_fifo_full(s_spi->bus_id)) {
// Don't spin for too long, just in case the host doesn't clock out our response
if (!prv_timer_check_delta(tx_start_ticks, TIMER0_10_MS)) {
b... | ((uint8_t *)&s_thread_info.ti, sizeof(s_thread_info.ti)) | ;
break;
case CoreDumpCmd_ReadExtraThreadInfo:
printf("read ExtraTB\n");
prv_send_response((uint8_t *)&s_extra_info, sizeof(s_extra_info));
break;
case CoreDumpCmd_LowPowerMode:
printf("low power mode\n");
prv_low_power_mode();
break;
default:... |
compiled to use the 3.0 animation API to work with 2.0 apps.
return ((AnimationLegacy2 *)animation_h)->curve;
}
AnimationPrivate *animation = prv_find_animation_by_handle(NULL, animation_h, false /*quiet*/);
if (!animation) {
return AnimationCurveDefault;
}
return animation->curve;
}
// ----------... | {
return false;
} | |
{
// https://pebbletechnology.atlassian.net/browse/PBL-28582
.day_lag = 10,
.hour = 20,
.minute = 30,
.trigger = prv_create_day_10_insight,
.insight_type = ActivityInsightType_Day10,
},
};
// ------------------------------------------------------------------------------------------------
stat... | {
// Stop here if not enough time has passed to trigger this reward
INSIGHTS_LOG_DEBUG("Not triggering activity reward - too soon to trigger");
return false;
} |
// Make sure we're not still sleeping
if (prv_get_sleep_state() != ActivitySleepStateAwake) {
INSIGHTS_LOG_DEBUG("Not triggering reward - asleep");
return false;
}
// Finally, make sure the current metric value is over the target
ActivityScalarStore target = ((uint32_t)(metric_stats->median *
... |
, -160},
{ -1360, 520, 56},
{ -1584, 392, 96},
{ -1328, 32, 0},
{ -1232, 64, -40},
{ -1304, 208, 48},
{ -1264, 128, 64},
{ -1128, 104, 24},
{ -1056, 88, 40},
{ -1064, 32, 160},
{ -824, -160, 176},
// 94 seconds
{ -984, -32, 80},
{ -1120, 24, -120},
{ -1112, 0, -23... | { -1064, 488, -8},
{ -1008, 592, -40},
{ -1008, 416, -112},
{ -808, 248, -72},
{ -712, 104, -48},
{ -776, 120, -40},
{ -928, 160, 0},
{ -984, 88, 56},
{ -1200, 232, 56},
{ -1496, 240, 88},
{ -1432, 176, 96},
{ -1656, 152, 112},
{ -1368, 136, -8},
{ -984, 128, -184... |
{ -288, 1104, 656},
{ -128, 1040, 424},
{ -240, 1008, 448},
{ -408, 616, 448},
{ -352, 416, 344},
{ -304, 336, 264},
{ -256, 256, 216},
// 102 seconds
{ -280, 176, 184},
{ -392, 184, 248},
{ -568, 280, 784},
{ -864, 608, 960},
{ -1016, 832, 408},
{ -1200, 720, 36... |
eation_time_than_existing_not_inserted(void) {
// Insert the first glance blob
SerializedAppGlanceHeader app_glance_1 = (SerializedAppGlanceHeader) {
.version = APP_GLANCE_DB_CURRENT_VERSION,
.creation_time = 1464734484, // Tue, 31 May 2016 22:41:24 GMT
};
const size_t glance_1_size = sizeof(app_glance_... | {
cl_assert_equal_i(prv_insert_dummy_glance_blob_with_size(APP_GLANCE_DB_SLICE_MAX_SIZE + 1),
E_INVALID_ARGUMENT);
} |
void test_app_glance_db__check_invalid_slice_total_sizes_blob_not_inserted(void) {
cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE,
(uint8_t *)&s_app_glance_with_invalid_slice_total_sizes,
sizeof(s_a... |
d));
Uuid missing_uuid = bt_uuid_expand_16bit(0xabcd);
cl_assert(!ble_ad_includes_service(s_ad_data, &missing_uuid));
}
// -----------------------------------------------------------------------------
// Creating BLEAdData:
// -----------------------------------------------------------------------------
void test... | (expected_ad_data, ad->data,
sizeof(expected_ad_data)) | , 0);
cl_assert_equal_i(ad->ad_data_length, sizeof(expected_ad_data));
cl_assert_equal_i(ad->scan_resp_data_length, 0);
ble_ad_destroy(ad);
// 14x 16-bit UUIDs should fit, expect true:
ad = ble_ad_create();
cl_assert_equal_b(ble_ad_set_service_uuids(ad, uuid, 14), true);
ble_ad_destroy(ad);
// 15x 16-... |
/*
* 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... | (HOST_SPI->spi.peripheral,
byte_buffer, num_bytes, prv_expect_byte_spi_int_cb, NULL) | ;
} else {
hw_spi_read_buf(HOST_SPI->spi.peripheral,
byte_buffer, num_bytes, prv_expect_byte_spi_int_cb, NULL);
}
hw_gpio_set_active(HOST_SPI->mcu_int.port, HOST_SPI->mcu_int.pin);
// Probably not necessary but add a little delay so its easier to catch INT
// on logic an... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
uint8_t c_len = utf8_copy_character(w_cursor, r_cursor, len);
w_cursor += c_len;
} |
r_cursor = next;
}
*w_cursor = '\0';
}
void ancs_phone_call_handle_incoming(uint32_t uid, ANCSProperty properties,
ANCSAttribute **notif_attributes) {
// This field holds the caller's name if the phone number belongs to a contact,
// or the actual phone number if it d... |
the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "drivers/dbgserial.h"
#include "drivers/periph_config.h"
#include "system/pa... | memcpy(app, s_message_header, sizeof(s_message_header)) | ;
memcpy(&app[sizeof(s_message_header)], s_message_buffer,
s_message_length);
crc = crc32(CRC32_INIT, raw_packet, raw_length - sizeof(crc));
memcpy(&raw_packet[raw_length - sizeof(crc)], &crc, sizeof(crc));
unsigned char cooked_packet[MAX_SIZE_AFTER_COBS_ENCODING(raw_length)];
size_t cooked_length ... |
terator));
#endif
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[1].header.id));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[0].header.id));
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[1].header.id));
#if ... | (!uuid_equal(&first_all_day_event, &state.pin.header.id)) | ;
cl_assert(state.node->all_day);
cl_assert_equal_i(state.pin.header.timestamp, 1421136000);
// back to the first
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&first_all_day_event, &state.pin.header.id));
cl_assert(state.node->all_day);
// correct end of line behaviour
cl_assert(!iter_prev(&i... |
uint32_t *num_bytes_out) { return NULL; }
// Helper Functions
////////////////////////////////////
#include "../graphics/test_graphics.h"
#include "../graphics/8bit/test_framebuffer.h"
static FrameBuffer *fb = NULL;
// Setup
void test_kino_reel__initialize(void) {
fb = malloc(sizeof(FrameBuffer)... | kino_reel_get_gdraw_command_sequence(kino_reel) | , 0));
cl_assert(list1 != NULL);
cl_assert(list1 == list1_direct);
// Test that after elapsed, frame has changed and new list is correct
kino_reel_set_elapsed(kino_reel, 100);
GDrawCommandList *list2 = kino_reel_get_gdraw_command_list(kino_reel);
GDrawCommandList *list2_direct = gdraw_command_frame_get_com... |
.type = ActivitySessionType_Sleep,
.start_utc = now_secs,
.length_min = 0,
.ongoing = true,
};
} else {
// We were in restful sleep before, we should already have a container
cl_assert(s_test_alg_state.minute_data.sleep_current_container_i... | activity_sessions_prv_add_activity_session(&s_test_alg_state.minute_data.sessions[i]) | ;
}
return true;
}
void activity_algorithm_post_process_sleep_sessions(uint16_t num_input_sessions,
ActivitySession *sessions) {
}
void activity_algorithm_minute_handler(time_t utc_sec, AlgMinuteRecord *record_out) {
s_test_alg_state.last_sleep_utc = utc_sec;
... |
th a circle
return (Fixed_S16_3){.raw_value = integer_sqrt((offset_radius_sq << FIXED_S16_3_PRECISION) -
offset.raw_value * offset.raw_value)};
}
return (Fixed_S16_3){
.raw_value = (integer_sqrt((opposite_radius_sq - opposite_radius_sq *
... | while (x < y) {
if (f >= 0) {
y--;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x;
if (quadrant & GCornerBottomRight) {
graphics_private_set_pixel(ctx, GPoint(p.x + x, p.y + y));
graphics_private_set_pixel(ctx, GPoint(p.x + y, p.y + x));
}
if (quad... |
}
static void prv_plot4(GBitmap *fb, GRect *clip_box, GPoint center, GPoint offset, int8_t brightness,
GColor stroke_color, GCornerMask quadrant) {
/*
* This will mirror given offset point over x and y coordinates of given center point
* |
* x1 | x
* |
* ... |
/*
* 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_driver_set_local_address(allow_cycling, allow_cycling ? NULL : &s_pinned_addr) | ;
}
void bt_local_addr_pause_cycling(void) {
bt_lock();
{
if (s_pra_cycling_pause_count == 0) {
PBL_LOG(LOG_LEVEL_INFO, "Pausing address cycling (pinned_addr="BT_DEVICE_ADDRESS_FMT")",
BT_DEVICE_ADDRESS_XPLODE(s_pinned_addr));
prv_allow_cycling(false);
}
++s_pra_cycling_pause_... |
MAGE(s_ctx);
};
/////////////////
// BASIC TESTS //
/////////////////
// These tests test the basic functionality of the clipping mask API.
static void prv_verify_mask_pixel_values(const GContext *ctx, const GDrawMask *mask,
uint8_t expected_value) {
// Assumes rectangular ... | graphics_context_mask_use(ctx, mask2) | );
// Should still be on default draw implementation
cl_assert_equal_p(ctx->draw_state.draw_implementation, &g_default_draw_implementation);
// Should now have mask2 attached to GContext
cl_assert_equal_p(ctx->draw_state.draw_mask, mask2);
// Calling use with NULL should reset draw impl to default and mask i... |
IT_DEPTH_NAME}.pbi"));
// Should draw same as rmax1
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_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_orig... | MIN(RECT_WIDTH, RECT_HEIGHT) | ) / 2) - 1, GCornersLeft);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_left.${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, RECT_HEIGHT)) / 2) - 1, GCorners... |
e_idx(4));
cl_assert(timeline_model_iter_prev(&new_idx, NULL));
cl_assert_equal_i(new_idx, 3);
cl_assert_equal_i(timeline_model_get_num_items(), 2);
cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_o... | cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(2)) | ;
}
void test_timeline_model__graceful_delete_first(void) {
TimelineModel model = {0};
model.direction = TimelineIterDirectionFuture;
time_t first_time = 1421178000;
// Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015
timeline_model_init(first_time, &model);
timeline_model_remove(&s_items[s_correct_order[0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.