prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
st bool old_is_persistent = old_header->common.persistent;
if (new_is_peeking != old_is_peeking) {
// Peeking items always take priority
return (old_is_peeking ? 1 : 0) - (new_is_peeking ? 1 : 0);
} else if (old_is_peeking && (new_is_persistent != old_is_persistent)) {
// When both items are peeking, it... | timeline_event_refresh() | ;
}
|
{ -144, 576, -824},
{ -120, 576, -824},
{ -112, 584, -824},
{ -104, 560, -816},
{ -96, 560, -808},
{ -128, 560, -808},
{ -128, 560, -816},
{ -112, 584, -808},
{ -136, 600, -800},
{ -152, 600, -808},
{ -136, 600, -824},
{ -112, 576, -816},
{ -120, 584, -808},
{ -13... |
{ -128, 584, -808},
{ -136, 576, -800},
{ -136, 584, -792},
{ -128, 600, -808},
{ -128, 592, -824},
{ -136, 592, -808},
{ -144, 592, -800},
{ -136, 584, -800},
// 328 seconds
{ -136, 584, -808},
{ -136, 584, -800},
{ -136, 592, -800},
{ -136, 592, -800},
{ -136, ... | |
===========");
printf("\nRunning activity sample set: \"%s\"\n", entry->name);
memset(s_kalg_state, 0, kalg_state_size());
kalg_init(s_kalg_state, prv_stats_cb);
s_num_captured_activity_sessions = 0;
// Run samples through the activity detector
time_t now = rtc_get_time();
time_t test_star... | if (actual->passed) {
indicator = " ";
} else {
indicator = "**";
} |
if (expected->value != -1) {
int delta = actual->value - expected->value;
printf(" (%3d,%3d) %s%3d (%+4d) ", expected->min, expected->max, indicator, actual->value,
delta);
} else {
printf(" (NA, NA ) %s%3d ", indicator, actual->value);
}
}
pri... |
t_size), 0);
// Write + consume, so read index is at 2:
circular_buffer_write(&buffer, (uint8_t *)"0123", 4);
circular_buffer_consume(&buffer, 2);
// Write data that will be wrapped:
circular_buffer_write(&buffer, (uint8_t *)"456789", 6);
// Test copying the whole thing (providing buffer of 8 bytes):
m... | cl_assert_equal_i(memcmp(copy_out, "234567AB", 8), 0) | ;
contiguous_num_bytes_left = circular_buffer_write_prepare(&buffer, &data_out);
cl_assert_equal_i(contiguous_num_bytes_left, 0);
cl_assert_equal_p(data_out, NULL);
}
void test_circular_buffer__read_or_copy_returns_false_when_length_is_too_long(void) {
CircularBuffer buffer;
uint8_t storage[1];
circular_b... |
/*
* 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 scroll_layer_is_instance(layer);
} | |
f(time_range, max_attr_length, time_range_fmt, start_time, end_time);
attribute_list_add_cstring(&pin_attr_list,
PBL_IF_RECT_ELSE(AttributeIdLocationName, AttributeIdTitle),
time_range);
// Don't display the time in the title
attribute_list_add_uint8(&pin... | INSIGHTS_LOG_DEBUG("Not notifying sleep pin - already notified") | ;
return;
}
// Notify about the pin after a certain amount of time
const time_t since_exited = now_utc - sleep_exit_utc;
if (since_exited < s_sleep_summary_settings.summary.sleep.trigger_notif_seconds) {
INSIGHTS_LOG_DEBUG("Not notifying sleep pin - not trigger time yet (%ld)", since_exited);
retur... |
selected(menu_layer, cell_index);
OptionMenu *option_menu = context;
if (option_menu->callbacks.get_cell_height) {
return option_menu->callbacks.get_cell_height(option_menu, cell_index->row, is_selected,
option_menu->context);
} else {
return option_menu_d... | (&option_menu->menu_layer, window) | ;
if (option_menu->choice != OPTION_MENU_CHOICE_NONE) {
menu_layer_set_selected_index(&option_menu->menu_layer, MenuIndex(0, option_menu->choice),
MenuRowAlignCenter, false);
}
layer_add_child(window_get_root_layer(window), menu_layer_get_layer(&option_menu->menu_layer));
}
... |
IN(TINY_CHUNK_SIZE, json_bytes_remaining);
const size_t expected_size = sizeof(PostMessageChunkPayload) + json_bytes_size;
PostMessageChunkPayload *chunk = (PostMessageChunkPayload *)buffer;
*chunk = (PostMessageChunkPayload) {
.total_size_bytes = expected_json_size,
.is_first = true,
};
... | EXECUTE_SCRIPT_EXPECT_ERROR("_rocky.postMessage('x');",
"RangeError: Out of memory: can't postMessage() -- object too large") | ;
}
////////////////////////////////////////////////////////////////////////////////
// Receive Tests
////////////////////////////////////////////////////////////////////////////////
void test_rocky_api_app_message__receive_message_multi_chunk(void) {
prv_init_and_goto_session_open_with_tiny_buffers();
EXECUTE_SC... |
, 1096, -528},
{ -584, 1208, -392},
// 10 seconds
{ -112, 1448, -224},
{ -112, 1032, -160},
{ -248, 1016, -192},
{ -168, 752, -224},
{ -104, 528, -208},
{ -144, 552, -192},
{ -216, 672, -264},
{ -248, 920, -288},
{ -248, 1184, -376},
{ -344, 1312, -440},
{ -304, 1184,... | { -64, 904, -224},
{ -208, 1040, -360},
{ -312, 1184, -496},
{ -392, 1376, -480},
{ -328, 1336, -432},
{ -216, 1504, -368},
{ 288, 1152, -320},
{ 160, 848, -344},
{ 112, 744, -320},
{ 8, 616, -336},
{ -120, 528, -304},
{ -232, 600, -320},
{ -280, 728, -368},
{ -31... | |
uint16_t att_handle,
const uint8_t *att_value,
uint16_t att_length);
extern void gatt_client_subscriptions_handle_write_cccd_response(BLEDescr... | if (kernel) {
GATTBufferedNotificationHeader header = {};
gatt_client_subscriptions_get_notification_header(GAPLEClientKernel, &header);
cl_assert_equal_i(header.value_length, assert_value_length);
cl_assert_equal_i(header.characteristic, characteristic);
if (should_consume) {
uint16_t value_... |
memset(buffer, 0, assert_value_length);
if (app) {
GATTBufferedNotificationHeader header = {};
gatt_client_subscriptions_get_notification_header(GAPLEClientApp, &header);
cl_assert_equal_i(header.value_length, assert_value_length);
cl_assert_equal_i(header.characteristic, characteristic);
if (... |
ticMeta],
(const uint8_t *) metas[i].meta,
sizeof(PPoGATTMetaV1),
BLEGATTErrorSuccess);
// Client created:
cl_assert_equal_i(ppogatt_client_count(), 1);
Transport *client = ppogatt_client... | fake_gatt_client_op_set_read_return_value(BTErrnoInvalidParameter) | ;
prv_notify_services_discovered(1);
cl_assert_equal_i(ppogatt_client_count(), 0);
}
void test_ppogatt__cleanup_client_when_meta_read_gets_error_response(void) {
fake_gatt_client_op_set_read_return_value(BTErrnoOK);
prv_notify_services_discovered(1);
ppogatt_handle_read_or_notification(s_characteristics[0][P... |
/*
* 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_window, "Window Name") | ;
window_stack_push(&s_window);
static Layer s_watch_layer;
layer_init(&s_watch_layer, s_window.layer.frame);
layer_add_child(&s_window.layer, &s_watch_layer);
PBL_GEN_INIT(&s_watch_layer);
}
static void handle_render(AppContextRef ctx, PebbleRenderEvent *e) {
(void)ctx;
window_render(e->window, e->ct... |
/*
* 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... | {
free(fb);
free(ctx);
} |
// Tests
////////////////////////////////////
// Reference PNGs reside in "tests/test_images/"
// and are created at build time, with the test PBI file generated
// by bitmapgen.py from the reference PNG copied to TEST_IMAGES_PATH
// covers 1-bit b&w image
// covers 1,2,4,8 bit palettized
// Tests 1-bit black&whit... |
]! \n" // lr
" mrs r1, xpsr \n"
" mrs r2, msp \n"
" mrs r3, psp \n"
" adds r0, #8 \n" // skip pc
" stmia r0!, {r1-r3} \n" // xpsr, msp, psp
" b core_dump_handler_c \n"
:
: [... | prv_debug_str_int("CD: Saving to: ", flash_base) | ;
// ---------------------------------------------------------------------------------------
// Dump RAM and thread info into flash. We store data in flash using the following format:
//
// CoreDumpImageHeader image_header // includes magic signature, version, time stamp, serial number
// ... |
/*
* 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, buffer_size, "%"PRId32, current_calories) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prv_play_animation_update(test_player->animation, ANIMATION_NORMALIZED_MAX * 20 / 300) | ;
cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 20);
}
void test_kino_player__create_finite_animation_finite_reel_foward(void) {
// Choose duration and elapsed to have clean division for
// ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number
test_reel_data->duration_ms = 300;
Animation *anima... |
if (s_alarms_app_opened != version) {
s_alarms_app_opened = version;
prv_pref_set(PREF_KEY_ALARMS_APP_OPENED, &s_alarms_app_opened, sizeof(s_alarms_app_opened));
} |
}
uint8_t alarm_prefs_get_alarms_app_opened(void) {
return s_alarms_app_opened;
}
#endif /* CAPABILITY_HAS_HEALTH_TRACKING */
#if PLATFORM_SPALDING
void shell_prefs_set_display_offset(GPoint offset) {
const GPoint user_offset = gpoint_sub(offset, mfg_info_get_disp_offsets());
prv_pref_set(PREF_KEY_DISPLAY_USER... | |
/*
* 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 MICRO_FAMILY_STM32F7
// STM32F7 needs to access as 8 bits in order to actually do 8 bits.
// This _does_ work on F4, but QEMU doesn't agree, so let's just do it safely.
*(volatile uint8_t*)&bus->spi->DR = Data;
#else
bus->spi->DR = Data;
#endif
} |
uint16_t prv_spi_receive_data(const SPIBus *bus) {
#if MICRO_FAMILY_STM32F7
// STM32F7 needs to access as 8 bits in order to actually do 8 bits.
// This _does_ work on F4, but QEMU doesn't agree, so let's just do it safely.
return *(volatile uint8_t*)&bus->spi->DR;
#else
return bus->spi->DR;
#endif
}
void pr... |
/*
* 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... | {
// Match to the precision we need here
y *= FIXED_S16_3_ONE.raw_value;
radius *= FIXED_S16_3_ONE.raw_value;
return (Fixed_S16_3){.raw_value = radius - integer_sqrt(radius * radius - y * y)};
} |
static Fixed_S16_3 prv_get_ellipsis_border(Fixed_S16_3 offset, uint32_t offset_radius_sq,
uint32_t opposite_radius_sq) {
if (offset_radius_sq == opposite_radius_sq) {
// We're dealing with a circle
return (Fixed_S16_3){.raw_value = integer_sqrt((offset_radius_sq <<... |
/*
* 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... | (GTextAlignmentLeft, GTextAlignmentCenter) | ;
const GFont title_font = PBL_IF_RECT_ELSE(fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD),
cell_layer->is_highlighted ? fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)
: fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
const int title_height = fonts_get_font_height(title_font)... |
ue);
}
static GAPLEConnection * prv_find_connection(const BTDeviceInternal *device) {
return (GAPLEConnection *) list_find(&s_connections->node,
prv_list_filter_for_device,
(void *) device);
}
// ------------------------------------------... | bt_unlock() | ;
return connected;
}
// -------------------------------------------------------------------------------------------------
uint16_t gap_le_connection_get_gatt_mtu(const BTDeviceInternal *device) {
bt_lock();
const GAPLEConnection *connection = prv_find_connection(device);
const uint16_t mtu = connection ? con... |
/*
* 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_b(bt_device_internal_equal(peer_address, &s_last_disconnected), true);
} |
static int s_ble_hrm_push_reminder_popup_call_count;
void ble_hrm_push_reminder_popup(void) {
s_ble_hrm_push_reminder_popup_call_count++;
}
static int s_hrm_manager_subscribe_with_callback_call_count;
static HRMSessionRef s_last_session_ref;
static HRMSessionRef s_next_session_ref;
HRMSessionRef hrm_manager_subscr... |
/*
* 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_settings_file.values[key_crc8]) | ;
free(s_settings_file.keys[key_crc8]);
s_settings_file.values[key_crc8] = val_copy;
s_settings_file.keys[key_crc8] = key_copy;
s_settings_file.val_lens[key_crc8] = val_len;
s_settings_file.key_lens[key_crc8] = key_len;
s_settings_file.dirty[key_crc8] = true;
return S_SUCCESS;
}
int settings_file_get_len... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (0, 0, -20, 10) | |
* 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 permissions and
* limitations under the License... | (window, animated) | ;
}
static void deinit(void) {
}
int main(void) {
init();
app_event_loop();
deinit();
}
|
= prv_file_get(&ACTIVE_GATEWAY_KEY, sizeof(ACTIVE_GATEWAY_KEY),
&active_gateway, sizeof(active_gateway));
if (!read_size || active_gateway == BT_BONDING_ID_INVALID) {
return false;
}
if (bonding_out) {
*bonding_out = active_gateway;
}
if (type_out) {
*type_out = pr... | prv_file_set(&SYSTEM_CAPABILITIES_KEY, sizeof(SYSTEM_CAPABILITIES_KEY),
capabilities, sizeof(PebbleProtocolCapabilities)) | ;
PebbleEvent event = {
.type = PEBBLE_CAPABILITIES_CHANGED_EVENT,
.capabilities.flags_diff = diff,
};
event_put(&event);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Common
void bt_persistent_storage_init(void) {
// Note: thi... |
PROFILER_NODE_START(render_modal);
window_render(window, ctx);
PROFILER_NODE_STOP(render_modal);
}
return true;
}
static void prv_update_modal_stacks(UpdateContext *context) {
context->highest_idx = ModalPriorityInvalid;
context->properties = ModalPropertyDefault;
prv_each_modal_stack(prv_update_mo... | xSemaphoreGive(info->interlock) | ;
}
void command_modal_stack_info(void) {
WindowStackInfoContext info = {
.interlock = xSemaphoreCreateBinary(),
};
if (!info.interlock) {
prompt_send_response("Couldn't allocate semaphore for modal stack");
return;
}
launcher_task_add_callback(prv_modal_window_stack_info_cb, &info);
xSemaphor... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | window_set_click_context(BUTTON_ID_SELECT, context) | |
AlarmsAppData *data = (AlarmsAppData *)callback_context;
prv_update_alarm_list(data);
}
static void prv_create_new_alarm(AlarmsAppData* data) {
Window *editor = alarm_editor_create_new_alarm(prv_handle_alarm_editor_complete, data);
app_window_stack_push(editor, true);
}
////////////////////////////////////////... | (alarm_time_text, sizeof(alarm_time_text),
node->info.hour, node->info.minute, true) | ;
const char *enabled = node->info.enabled ? i18n_get("ON", data) : i18n_get("OFF", data);
graphics_context_set_compositing_mode(ctx, GCompOpTint);
// If the alarm is not smart, use the icon as spacing but don't render it.
// Otherwise if the alarm is smart draw according to the menu highlight.
graphics_cont... |
);
cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable);
touch_event = touch_event_queue_get_event(1, 0);
prv_test_touch_event(touch_event, 1, TouchEvent_Touchdown, &GPoint(1, 13), 3686401, 5,
&GPointZero, 0, 0, true);
}
void test_touch__handle_update_liftoff(void) {
//... | (touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0,
&GPoint(10, 10), 20, 5, true) | |
w - (15 * SECONDS_PER_MINUTE), now,
HealthIterationDirectionPast, prv_activity_cb, NULL);
cl_assert_equal_i(1, s_prv_activity_cb__call_count);
cl_assert_equal_b(s_prv_activity_cb__args[0].activity, HealthActivitySleep);
// order direction past
s_prv_activity_cb__call_count =... | (
&(ActivitySession) {.start_utc = now, .length_min = 5},
&(ActivitySession) {.start_utc = now + (2 * SECONDS_PER_MINUTE), .length_min = 5},
HealthIterationDirectionPast) | );
}
void test_health__get_minute_history_edge_case_args(void) {
const time_t now = rtc_get_time();
HealthMinuteData data[5] = {};
uint32_t written;
// null pointer
time_t time_start = now - 10 * 60 - 30;
time_t time_end = now - 20;
written = health_service_get_minute_history(NULL, ARRAY_LENGTH(data), ... |
://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 permiss... | (CURRENT_HEALTH_APP_VERSION) | ;
HealthAppData *health_app_data = app_zalloc_check(sizeof(HealthAppData));
app_state_set_user_data(health_app_data);
health_app_data->health_data = health_data_create();
health_data_update_quick(health_app_data->health_data);
health_app_data->health_card_view = health_card_view_create(health_app_data->he... |
(&context, &GRect(20, 80, 40, 10), 4, GCornersAll, GColorBlack));
#else
ASSERT_CALLED(prv_fill_rect_aa(&context, &GRect(20, 80, 40, 10), 4, GCornersAll, GColorBlack));
#endif
}
void test_graphics_context_${BIT_DEPTH_NAME}__lock(void) {
// Test all the setup test combinations as above
setup_test(&context, false, ... | cl_assert(memcmp(&draw_state, &context.draw_state, sizeof(GDrawState)) == 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... | (&send_mbuf, &header, sizeof(header)) | ;
PBL_ASSERTN(!s_read_mbuf);
s_read_mbuf = mbuf_get(s_read_data, MAX_FRAME_LENGTH, MBufPoolSmartstrap);
SmartstrapResult result = smartstrap_send(SmartstrapProfileLinkControl, &send_mbuf, s_read_mbuf,
TIMEOUT_MS);
if (result != SmartstrapResultOk) {
mbuf_free(s_re... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ((ListNode *)s_resource_list,
prv_resource_filter, (void *)(uintptr_t)resource_id) | |
// ================================================================================
// We install this ISR which does an infinite loop to test that the core dump captures the right
// task information if we get it while stuck in an ISR
void OTG_FS_WKUP_IRQHandler(void) {
if (s_call_core_dump_from_isr) {
core_d... | if (index == 7) {
PBL_LOG(LOG_LEVEL_INFO, "Forcing inf loop during core dump");
core_dump_test_force_inf_loop();
core_dump_reset(false /* don't force overwrite */);
} else if (index == 8) {
PBL_LOG(LOG_LEVEL_INFO, "Forcing assert loop during core dump");
core_dump_test_force_assert();
core_... |
SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
// Write to protected memory
extern uint32_t __isr_stack_start__[];
__isr_stack_start__[0] = 0x55;
}
}
// =================================================================================
static void prv_window_load(Window *window) {
TestTimersAppDa... |
st, AttributeIdTitle, config->title);
if (config->subtitle) {
attribute_list_add_cstring(&list, AttributeIdSubtitle, config->subtitle);
}
attribute_list_add_uint32(&list, AttributeIdIconPin, config->icon);
item = timeline_item_create_with_attributes(timestamp, MINUTES_PER_HOUR,
... | gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE) | );
}
void test_timeline_peek__peek_in_5_minutes(void) {
prv_render_timeline_peek(&(TimelinePeekItemConfig) {
.timestamp = rtc_get_time() + (5 * SECONDS_PER_MINUTE),
.title = "Stock for party 🍺",
.subtitle = "Pebble Pad on Park",
.icon = TIMELINE_RESOURCE_NOTIFICATION_REMINDER,
.num_concurrent = ... |
s_items[2].header.id));
// check fourth
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id));
// check third again
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id));
// check fifth
cl_assert(iter_next(&itera... | (uuid_equal(&state.pin.header.id, &s_long_items[3].header.id)) | ;
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[4].header.id));
cl_assert(!iter_next(&iterator));
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[3].header.id));
#if CAPABILITY_HAS_CORE_NAVIGATION4
cl_assert(iter_prev(&... |
tic ReadResponseData *s_read_responses[GAPLEClientNum];
//! Keeps track of the current outstanding GattClientOperations (reads/writes). Useful for freeing
//! the outstanding op's memory when a connection dies in the middle.
static GattClientEventContext *s_client_event_ctxs[GAPLEClientNum];
static void prv_send_even... | prv_handle_response(resp, data, &gatt_value_length) | ;
break;
}
case GattClientOpResponseWrite: {
PBL_ASSERTN(data->subtype == PebbleBLEGATTClientEventTypeCharacteristicWrite ||
data->subtype == PebbleBLEGATTClientEventTypeDescriptorWrite);
break;
}
default:
WTF;
}
}
... |
ColorRed,
.stroke_width = 1,
.fill_color = GColorBlue,
.path_open = false,
.num_points = 2,
};
GPoint points1[] = { { 3, 97 }, {5, 5} };
memcpy(command_list->commands[0].points, points1, sizeof(points1));
command = gdraw_command_list_get_command(command_list, 1);
*command = (GDrawCommand) {
... | (command_list, size) | |
T')", 1, true,
"",
INT_MAX,
TemplateStringErrorStatus_InvalidTimeUnit,
3,
},
{ "'%T',)", 1, true,
"1",
1,
TemplateStringErrorStatus_MissingArgument,
5,
},
{ "'%T'fj)", 1, true,
"1",
1,
TemplateStringErrorStatus_InvalidArgumentSeparator,
4,
},
// Basic %T test... | printf("filter_state: %jd %s\n", test->filter_state,
test->time_was_until ? "until" : "since") | ;
printf("expect: \"%s\" err %d @ %zu eval@%jd\n", test->expect_str,
test->expect_status, test->expect_index,
test->expect_eval_time);
printf("got : \"%s\" err %d @ %zu eval@%jd\n", s_output,
s_error.status, err_index, s_cond.eval_time);
#endif
if (s_error.status) {
#if D... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ASSERT(emx_resources_get_size(1, id_4) == 0) | ;
ASSERT(s_size_4_called == 1);
// add 4 again
id_4 = emx_resources_register_custom(custom_res_read_4, custom_res_size_4);
ASSERT(emx_resources_get_size(1, id_4) == 4);
buf = 0;
ASSERT(emx_resources_read(1, id_4, 0, (uint8_t *)&buf, 1) == 4);
ASSERT(buf == 4);
ASSERT(s_read_4_called == 3);
ASSERT(s_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... | strlen(s1) | ;
strcpy(s1, s2);
return rc;
}
char *strncat(char * restrict s1, const char * restrict s2, size_t n) {
char * rc = s1;
s1 += strlen(s1);
size_t strn = strlen(s2);
if (strn > n) {
strn = n;
}
memcpy(s1, s2, strn);
s1[strn] = '\0';
return rc;
}
|
with_legacy2_sdk.h"
///////////////////////////////////////////////////////////
// Fakes
static GContext s_ctx;
static FrameBuffer s_fb;
size_t framebuffer_get_size_bytes(FrameBuffer *f) {
return FRAMEBUFFER_SIZE_BYTES;
}
///////////////////////////////////////////////////////////
// Tests
void test_word_iterato... | (*word_iter_state.current.start == '\n') | ;
cl_assert(*word_iter_state.current.end == 'o');
cl_assert(iter_next(&word_iter));
cl_assert(*word_iter_state.current.start == 'o');
cl_assert(*word_iter_state.current.end == '\0');
cl_assert(!iter_next(&word_iter));
}
void test_word_iterator__test_string_terminating_newlines(void) {
// Allocate mutable... |
mcpy(buffer, (void*)(FMC_BANK_1_BASE_ADDRESS + start_addr), buffer_size);
}
static void flash_s29vs_software_reset(void) {
flash_s29vs_issue_command(0, S29VSCommand_SoftwareReset);
}
void flash_init(void) {
gpio_use(GPIOB);
gpio_use(GPIOD);
gpio_use(GPIOE);
// Configure the reset pin (D2)
GPIO_InitTypeD... | FMC_NORSRAMCmd(FMC_Bank1_NORSRAM1, ENABLE) | ;
}
bool flash_sanity_check(void) {
// Check that the first words of the CFI table are 'Q' 'R' 'Y'.
// This will work on any flash memory, regardless of the manufacturer.
flash_s29vs_issue_command(0, S29VSCommand_CFIEntry);
bool ok = (flash_s29vs_read_short(0x20) & 0xff) == 'Q';
ok = ok && (flash_s29vs_read_... |
cl_assert_equal_i(state.pin.header.timestamp, 1421136000) | ;
// second all day event
cl_assert(iter_next(&iterator));
cl_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(!uuid_equal(&first_all_day_event, &state.pin.header.id));
cl_assert(state.node->all_day);
c... | |
d_buffer, write_addr, sizeof(read_buffer));
if (disp_logs) {
PBL_LOG(LOG_LEVEL_DEBUG, ">> Reading Addr 0x%"PRIx32" value is 0x%"PRIx16,
write_addr, read_buffer);
}
if (read_buffer != expected_val) {
PBL_LOG(LOG_LEVEL_DEBUG, "ERROR: Did not successfully write the data");
return FLASH_TEST... | {
FlashTestErrorType status = FLASH_TEST_SUCCESS;
uint32_t base_addr = FLASH_TEST_ADDR_START;
uint32_t test_addr = base_addr;
uint32_t addr_mask = FLASH_TEST_ADDR_MSK;
uint8_t read_buffer = 0;
uint32_t bit_offset;
if (display_logs) { PBL_LOG(LOG_LEVEL_DEBUG, ">>> Initializing data patterns..."); }
if (... |
if (((read_buffer != 0xFF) && (read_buffer != 0xAA)) || (test_addr == base_addr)) {
if (display_logs) {
PBL_LOG(LOG_LEVEL_DEBUG, ">> Erasing Addr 0x%"PRIx32, test_addr);
}
flash_erase_sector_blocking(test_addr);
// Verify data was erased
status = p... |
e;
if (meta_v1->pp_session_type >= PPoGATTSessionTypeCount) {
PBL_LOG(LOG_LEVEL_ERROR, "Invalid session type %u", meta_v1->pp_session_type);
goto handle_error;
}
session_type = meta_v1->pp_session_type;
}
BTErrno e = gatt_client_subscriptions_subscribe(client->characteristics.data,
... | prv_delete_client(client, true /* is_disconnected */, DeleteReason_InvalidateAllReferences) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (0, gothic_18_handle, 0, &s_font_info) | );
int8_t horiz_advance = text_resources_get_glyph_horiz_advance(&s_font_cache, 'a', &s_font_info);
cl_assert(horiz_advance != 0);
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_ho... |
"
// [MT] including <math.h> causes the jerry-libm header to get included again :(
extern double round(double d);
uintptr_t rocky_util_uint_from_value(const jerry_value_t value) {
uintptr_t rv = 0;
if (jerry_value_is_number(value)) {
rv = jerry_get_number_value(value);
} else if (jerry_value_is_string(value... | jerry_create_external_function(c_function_ptr) | ;
}
bool rocky_add_function(jerry_value_t parent, char *name, jerry_external_handler_t handler) {
bool result = false;
JS_UNUSED_VAL = rocky_get_or_create_object(parent, name, prv_create_function, handler, &result);
return result;
}
bool rocky_add_global_function(char *name, jerry_external_handler_t handler) {
... |
DCDC_V18_CUR_LIM_MAX_LV, 0xF);
REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_IDLE_HYST, 0x4);
REG_SETF(DCDC, DCDC_V18_1_REG, DCDC_V18_IDLE_MIN, 0x10);
REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_FAST_RAMPING, 0x1);
REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_VOLTAGE, 0x10);
REG_SETF(DCDC, DCDC_VDD_0_REG, DCDC_VDD_CUR_LIM_... | (CRG_TOP, FORCE_SLEEP_REG, FORCE_BLE_SLEEP, 0x0) | |
Intersection *intersections_down = NULL;
rot_points[0] = rot_end = GPointPreciseFromGPoint(
rotate_offset_point(&path->points[0], path->rotation, &path->offset));
min_x = max_x = rot_points[0].x.integer;
min_y = max_y = rot_points[0].y.integer;
// begin finding the last path segment's direction going ba... | ABS(delta_x / delta_y) | |
KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "drivers/flash/flash_impl.h"
#include <stdbool.h>
#include <stdint.h>
#include "drivers/gpio.h"
#include "drivers/periph_config.h"
#include "flash_region/flash_region... | {
flash_impl_release_many(1);
} |
static uint16_t flash_s29vs_read_short(FlashAddress addr) {
return *((__IO uint16_t*)(FMC_BANK_1_BASE_ADDRESS + addr));
}
FlashAddress flash_impl_get_sector_base_address(FlashAddress addr) {
if (addr < BOTTOM_BOOT_REGION_END) {
return addr & ~(BOTTOM_BOOT_SECTOR_SIZE - 1);
}
return addr & ~(SECTOR_SIZE_... |
P_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1);
prv_draw_hline_test_pattern(&ctx, prv_hline_pattern_assign_horizontal_line_delta_raw);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_core_assign_horizontal_line_delta_raw")));
};
// VERTICAL LINE TESTS
// These tests ... | cl_check(result) | |
aracteristic) {
if (!s_ams_client) {
return false;
}
for (int c = 0; c < NumAMSCharacteristic; ++c) {
if (s_ams_client->characteristics[c] == characteristic) {
return true;
}
}
return false;
}
void ams_handle_subscribe(BLECharacteristic subscribed_characteristic,
B... | if (!s_ams_client) {
return false;
} | |
st_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 1);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RE... | (&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT) | |
/*
* 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... | shared_prf_storage_get_root_key(SMRootKeyTypeEncryption, &keys[SMRootKeyTypeEncryption]) | &&
shared_prf_storage_get_root_key(SMRootKeyTypeIdentity, &keys[SMRootKeyTypeIdentity])) {
bluetooth_persistent_storage_debug_dump_root_keys(&keys[SMRootKeyTypeIdentity],
&keys[SMRootKeyTypeEncryption]);
} else {
prompt_send_response("Missing IRK an... |
ction 26.6.11 for SSR to milliseconds conversion
sub_seconds = RTC_GetSubSecond();
// Make sure neither date nor time rolled over since we read them.
RTC_GetTime(RTC_Format_BIN, &rtc_time);
// we need to read the DR again because reading the RTC_TR or RTC_SSR locks the shadow register
// for RTC_DR... | PBL_ASSERTN(now >= s_alarm_set_time_milliseconds_since_epoch) | ;
uint64_t milliseconds_elapsed = now - s_alarm_set_time_milliseconds_since_epoch;
return (milliseconds_elapsed * RTC_TICKS_HZ) / 1000;
}
bool rtc_alarm_is_initialized(void) {
return s_rtc_wakeup_initialized;
}
void RTC_WKUP_IRQHandler(void) {
if (RTC_GetITStatus(RTC_IT_WUT) != RESET) {
RTC_WakeUpCmd(DISA... |
{ 776, -40, 104},
{ 792, -40, 48},
{ 976, -120, -64},
{ 1072, -64, -96},
{ 1592, -192, 32},
{ 1456, 16, 72},
{ 1320, 216, -112},
{ 1288, 320, -96},
{ 968, 344, 40},
// 52 seconds
{ 792, 104, 136},
{ 864, 128, 144},
{ 896, 160, 168},
{ 824, 280, 72},
{ 824, 248, 15... | {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_25296_4
//> TEST_EXPECTED 100
//> TEST_EXPECTED_MIN 80
//> TEST_EXPECTED_MAX 120
//> TEST_WEIGHT 1.0
static AccelRawData samples[] = {
// 0 seconds
// elapsed: 0 minutes
{ -88, -264, -1008},
{ ... |
{ -16, -8, -688},
{ 8, 80, -680},
{ 48, 184, -608},
{ 120, 776, -896},
{ 208, 656, -848},
{ 176, 888, -872},
{ 320, 1120, -920},
{ 192, 944, -968},
{ 328, 944, -928},
{ 256, 608, -744},
{ 352, 496, -528},
{ 552, 648, -432},
{ 752, 424, -328},
{ 720, 280, -232},
... |
/*
* 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... | (sizeof(FrameBuffer)) | |
clude "services/normal/filesystem/app_file.h"
#include "system/hexdump.h"
#include "system/logging.h"
#include "system/passert.h"
#include "system/version.h"
#include "util/math.h"
#include "util/size.h"
static const ResourceStoreImplementation *s_resource_store_impls[] = {
#define RESOURCE_IMPL(impl) &impl,
#include ... | PBL_LOG(LOG_LEVEL_WARNING, "0x%"PRIx32" != 0x%"PRIx32, calculated_crc, manifest->version.crc) | ;
PBL_LOG(LOG_LEVEL_WARNING, "PBL-28517: If you see this please let Brad know");
const uint32_t calculated_crc_again = prv_get_crc(entry, num_bytes, 0);
PBL_LOG(LOG_LEVEL_WARNING, "Num bytes is %"PRIu32, num_bytes);
PBL_LOG(LOG_LEVEL_WARNING, "Calculated the CRC again, got 0x%"PRIx32, calculated_crc_... |
start_workout(ActivitySessionType_Run));
// Workout of 120 seconds duration. Should be valid
prv_inc_time(2 * SECONDS_PER_MINUTE);
cl_assert(workout_service_stop_workout());
// Wait 20 minutes. By this time, as soon as we leave the app, we should turn off the HR device.
prv_inc_time(20 * SECONDS_PER_MINUTE);... | (hr_zone_time_s[HRZone_Zone0], 10) | ;
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 20);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 10);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 20);
prv_inc_time(10);
prv_put_bpm_event(ZONE_2_HR, HRMQuality_Good);
cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s));
cl... |
re already initialized if at least the first job buffer is non-NULL
if (put_jobs->job[0].buffer != NULL) {
return true;
}
#if !CAPABILITY_HAS_PUTBYTES_PREACKING
put_jobs->enable_preack = false;
#else
put_jobs->enable_preack = true;
#endif
int i;
for (i = 0; i < MAX_BATCHED_PB_PUT_OPS; i++) {
// No... | {
#ifndef RECOVERY_FW
if (!firmware_update_is_in_progress()) {
bool is_fw_update_object = (type == ObjectFirmware ||
type == ObjectRecovery ||
type == ObjectSysResources);
if (is_fw_update_object) {
PBL_LOG(LOG_LEVEL_ERROR, "Cannot handle o... | |
{
return c;
} |
}
// "Define" libc functions we're testing
#include "pblibc_private.h"
#include "include/ctype.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Tests
#define ISCTYPE_TEST(CHK) \
for(int i = -128; i < 256; i++) { \
cl_assert_equal_b(CHK##_theirs(i), CHK... | |
peDef otype = (BOARD_CONFIG.power_5v0_options == OptionActiveLowOpenDrain)
? GPIO_OType_OD : GPIO_OType_PP;
gpio_output_init(&BOARD_CONFIG.power_ctl_5v0, otype, GPIO_Speed_50MHz);
}
if (BOARD_CONFIG.lcd_com.gpio) {
gpio_output_init(&BOARD_CONFIG.lcd_com, GPIO_OType_PP, GPIO_Speed_50MHz);
}
// ... | __get_PRIMASK() | ;
PBL_CROAK("display DMA failed: 0x%" PRIx32 " %d 0x%lx 0x%lx", pri_mask,
dma_status, spi_clock_status, dma_clock_status);
}
power_tracking_stop(PowerSystemMcuDma1);
prv_disable_display_spi_clock();
xSemaphoreGive(s_dma_update_in_progress_semaphore);
stop_mode_enable(InhibitorDisplay);
analyti... |
t_schedule(ad, NULL, 0,
unscheduled_callback, s_unscheduled_cb_data, 0);
cl_assert_equal_p(job, NULL);
// No ad data:
advert_term.min_interval_slots = 200;
advert_term.max_interval_slots = 200;
advert_term.duration_secs = 1;
job = gap_le_advert_schedule(NULL, &advert_term,
... | gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm),
unscheduled_callback, s_unscheduled_cb_data, GAPLEAdvertisingJobTagDiscovery) | ;
GAPLEAdvertisingJobRef job_b;
job_b = gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm),
unscheduled_callback, s_unscheduled_cb_data, GAPLEAdvertisingJobTagReconnection);
GAPLEAdvertisingJobRef job_c;
job_c = gap_le_advert_schedule(a... |
t update_interval_s,
uint16_t expire_s, HRMFeature features,
HRMSubscriberCallback callback, void *context) {
if (!s_hrm_present) {
return HRM_INVALID_SESSION_REF;
}
const PebbleTask current_task = pebble_task... | rtc_get_time() | );
}
*expire_s = MAX(0, expire_in_s);
}
if (features) {
*features = state->features;
}
}
mutex_unlock_recursive(s_manager_state.lock);
return (state != NULL);
}
DEFINE_SYSCALL(bool, sys_hrm_manager_set_features, HRMSessionRef session, HRMFeature features) {
bool success = false;
... |
_client->state == ANCSClientStateRequestedApp) {
prv_handle_app_attributes_response(data, length);
} else if (s_ancs_client->state == ANCSClientStateRequestedNotification ||
s_ancs_client->state == ANCSClientStateReassemblingNotification) {
prv_reassemble_ds_notification(length, data);
}
}
voi... | kernel_malloc_check(sizeof(PerformNotificationActionMsg)) | ;
*action_msg_ptr = (const PerformNotificationActionMsg) {
.command_id = CommandIDPerformNotificationAction,
.notification_uid = notification_uid,
.action_id = action_id,
};
if (is_kernel_main) {
prv_serialize_action(action_msg_ptr);
} else {
launcher_task_add_callback(prv_serialize_action_l... |
0,
.active_kcalories = length_min * 2,
.resting_kcalories = length_min / 10,
.distance_meters = (length_min * 1000) / 30,
},
};
}
bool activity_get_sessions(uint32_t *session_entries, ActivitySession *sessions) {
// Only return the sleep sessions that belong to "today"
time_t start_of_today... | (&time_tm) | ;
rtc_set_time(utc_sec);
s_activity_activation_delay_insight_bitmask = 0;
s_activation_time = 0;
s_activity_activation_delay_insight_bitmask = 0;
}
// =============================================================================================
// Start of unit tests
void test_activity_insights__initialize(vo... |
8},
{ 696, 408, -528},
{ 888, 688, -568},
{ 944, 632, -416},
{ 1272, 720, -400},
{ 1336, 904, -224},
{ 1232, 944, -88},
{ 1328, 920, -32},
{ 1160, 832, 200},
{ 760, 632, 96},
{ 656, 456, 96},
// 8 seconds
{ 640, 360, 176},
{ 664, 368, 40},
{ 736, 360, 112},
{ ... | { 1472, -48, -80},
{ 1520, 248, -400},
{ 1088, 232, -360},
{ 1224, 280, -432},
{ 1312, 208, -320},
{ 968, 216, -240},
{ 736, 272, -176},
{ 704, 280, -240},
{ 704, 184, -200},
{ 832, 176, -184},
{ 968, 240, -264},
{ 1064, 184, -304},
{ 1272, 304, -336},
{ 1520, 208... |
{ 1880, 320, -192},
{ 1416, 328, -240},
{ 1168, 272, -112},
// 16 seconds
{ 1368, 224, -96},
{ 1280, 192, -72},
{ 976, 184, -40},
{ 808, 200, -24},
{ 792, 160, -24},
{ 776, 120, 0},
{ 744, 128, 16},
{ 704, 120, 0},
{ 736, 96, -8},
{ 912, 112, -48},
{ 1048, 80... |
peline parser
static const struct {
const char *instr;
time_t intime;
const char *expect_str;
time_t expect_time;
bool expect_rv;
TemplateStringErrorStatus expect_status;
size_t expect_index;
} s_full_tests[] = {
{ "Basicist test~", 1000000000,
"Basicist test~",
0,
true,
},
{ "\\\\\\", ... | ("Invalid status code\n") | ;
} else {
printf("%s\n", s_error_strings[err.status]);
}
}
printf("\n");
#endif
cl_assert_equal_s(s_output, s_full_tests[i].expect_str);
cl_assert_equal_i(rv, s_full_tests[i].expect_rv);
cl_assert_equal_i(cond.eval_time, s_full_tests[i].expect_time);
if (cond.eval_time != 0... |
);
if (prv_is_auto_accept_repairing_mode(conn, conn_idx)) {
PBL_LOG(LOG_LEVEL_DEBUG, "Auto-accepting pairing request");
extern void pair_reply(uint16_t conn_idx, bool is_confirmed);
pair_reply(conn_idx, true);
return;
}
hc_endpoint_pairing_send_pairing_request(&device);
}
static void prv_handle... | ble_gap_role_set(GAP_PERIPHERAL_ROLE) | |
ttributes.h"
#include "util/struct.h"
#define LAUNCHER_MENU_LAYER_CONTENT_INDICATOR_LAYER_HEIGHT (32)
#define LAUNCHER_MENU_LAYER_GENERIC_APP_ICON (RESOURCE_ID_MENU_LAYER_GENERIC_WATCHAPP_ICON)
////////////////////////////
// Misc. callbacks/helpers
static void prv_launch_app_cb(void *data) {
const AppInstallId ap... | if (launcher_menu_layer->app_to_launch_after_next_render != INSTALL_ID_INVALID) {
const AppInstallId app_to_launch_install_id =
launcher_menu_layer->app_to_launch_after_next_render;
// Resetting this here in combination with disabling user input in the select click handler
// (the only place that se... |
}
static int16_t prv_menu_layer_get_cell_height(UNUSED MenuLayer *menu_layer,
UNUSED MenuIndex *cell_index, UNUSED void *context) {
#if PBL_RECT
return LAUNCHER_MENU_LAYER_CELL_RECT_CELL_HEIGHT;
#elif PBL_ROUND
return menu_layer_is_index_selected(menu_layer, cell_inde... |
end an event, because there might be more reminders than queue slots
reminder_db_delete_item(id, false /* send_event */);
}
}
static void prv_window_unload(Window *window) {
NotificationWindowData *data = window_get_user_data(window);
if (!data) {
return;
}
vibes_cancel();
prv_cleanup_timers(data)... | mutex_lock(s_notification_window_mutex) | ;
if (s_in_use) {
goto fail;
}
s_in_use = true;
data->pop_timer_is_final = false;
data->is_modal = is_modal;
data->notification_app_id = UUID_INVALID;
data->peek_layer_timer = EVENTED_TIMER_INVALID_ID;
data->peek_animation = NULL;
data->peek_layer = NULL;
data->peek_icon_info = (TimelineResourc... |
ight 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 in writing, ... | graphics_context_set_fill_color(ctx, GColorWhite) | ;
graphics_fill_rect(ctx, &layer->bounds);
// This is safe becase Layer is the first member in Window and Window is the first member in
// NumberWindow.
_Static_assert(offsetof(Window, layer) == 0, "");
_Static_assert(offsetof(NumberWindow, window) == 0, "");
NumberWindow *nw = (NumberWindow*) layer;
gr... |
/*
* 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... | (attr_list, action_group) | ;
if (data_size) {
item_out->allocated_buffer = task_malloc_check(data_size);
uint8_t *buf_end = item_out->allocated_buffer + data_size;
bool rv = attributes_actions_deep_copy(attr_list, &item_out->attr_list, action_group,
&item_out->action_group, item_out->all... |
(current_ticks - stopwatch->starting_ticks) | ;
return (((uint64_t) stopwatch->count_per_sec) * dt_ms) / MS_PER_SECOND;
}
void analytics_stopwatch_start(AnalyticsMetric metric, AnalyticsClient client) {
analytics_stopwatch_start_at_rate(metric, MS_PER_SECOND, client);
}
void analytics_stopwatch_start_at_rate(AnalyticsMetric metric, uint32_t count_per_sec, An... | |
IONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "actions_endpoint.h"
#include "attributes_actions.h"
#include "comm/ble/kernel_le_client/ancs/ancs_types.h"
#include "kernel/pbl_malloc.h"
#include "servic... | attributes_actions_deserialize(&action_result->attr_list, &action_result->action_group,
buffer, buf_end, data, size) | ) {
goto cleanup;
}
return action_result;
cleanup:
kernel_free(action_result);
return NULL;
}
void timeline_action_endpoint_invoke_action(const Uuid *id, TimelineItemActionType type,
uint8_t action_id, const AttributeList *attributes,
... |
/*
* 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... | strncpy(non_local_clock.buffer, text, sizeof(non_local_clock.buffer)) | ;
return non_local_clock;
}
// Configure the text displayed on the clock.
static ClockText prv_configure_clock_text(ClockTextType type, ClockTextLocation location,
GColor color, struct tm *tick_time) {
ClockText text = (ClockText) {
.location = location,
.color = c... |
ext;
}
}
#endif
// dummy iterator that always returns false
// Useful for when there aren't any items in pindb
// but we don't want an invalid iterator.
static bool prv_iter_dummy(IteratorState state) {
return false;
}
static bool prv_iter_next(IteratorState state) {
TimelineIterState *timeline_iter_state = (Ti... | (*timeline) | ;
PBL_LOG(LOG_LEVEL_DEBUG, "Finished building list.");
#ifdef TIMELINE_SERVICE_DEBUG
prv_debug_print_pins(*timeline);
#endif
return rv;
}
bool timeline_add(TimelineItem *item) {
return (S_SUCCESS == pin_db_insert_item(item));
}
bool timeline_exists(Uuid *id) {
return (pin_db_get_len((uint8_t *)id, UUID_SIZE... |
-360},
{ 1008, -40, -344},
{ 1016, -32, -336},
{ 984, -8, -344},
{ 984, 0, -344},
// 78 seconds
{ 912, 40, -312},
{ 968, 88, -336},
{ 1096, 104, -312},
{ 968, 120, -320},
{ 944, 120, -272},
{ 1056, 128, -240},
{ 1032, 152, -192},
{ 968, 128, -184},
{ 888, 120, -1... | { 1360, -80, 40},
{ 1608, -96, 96},
{ 1376, -224, 112},
{ 1192, -200, 72},
{ 1104, -144, 48},
{ 1016, -56, -112},
{ 944, -80, -120},
{ 864, -136, -168},
{ 752, -144, -256},
{ 736, -144, -336},
{ 656, -152, -352},
{ 640, -184, -344},
{ 680, -176, -304},
{ 800, -104... |
{ 928, -128, -392},
{ 920, -128, -376},
{ 912, -128, -376},
{ 952, -96, -376},
{ 936, -96, -344},
{ 928, -88, -320},
{ 944, -80, -320},
{ 952, -88, -328},
{ 992, -56, -312},
{ 984, -56, -336},
{ 1200, -56, -400},
{ 1416, -72, -488},
{ 1200, -144, -264},
{ 960, -1... |
HealthServiceTimeScopeDailyWeekdayOrWeekend);
snprintf(temp, sizeof(temp), "\ntypical: %d", (int)avg);
prv_safe_strcat(data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text));
prv_display_alert(data->debug_card.dialog_text);
}
// ----------------------------------... | (APP_LOG_LEVEL_DEBUG, "Result from aggregate_averaged_accessible heart rate, sum: 0x%x",
access) | |
mp(tuple->value->cstring, SOME_EMPTY_STRING, strlen(SOME_EMPTY_STRING) + 1) == 0);
// Check zero termination:
cl_assert(tuple->value->cstring[strlen(SOME_EMPTY_STRING)] == 0);
empty_cstring_found = true;
break;
}
tuple = dict_read_next(&iter);
}
cl_assert(count == key_count);... | for (int i = 0; i < 3; ++i) {
is_int8_updated = false;
is_string_updated = false;
is_data_updated = false;
test_not_enough_storage = (i == 2);
should_update_existing_keys_only = (i == 0) || test_not_enough_storage;
uint32_t tmp_size = 0;
const uint32_t source_size = dict_calc_buffer_size_f... |
enum {
INT8_IDX,
STRING_IDX,
DATA_IDX,
NUM_TUPLES,
};
bool has_tuple[NUM_TUPLES] = { false, false, false };
Tuple *tuple = dict_read_begin_from_buffer(&dest_iter, dest_buffer, tmp_size);
while (tuple) {
switch (tuple->key) {
case SOME_DATA_KEY:
has_t... |
t_expire_s, HRM_MANAGER_APP_EXIT_EXPIRATION_SEC);
sys_hrm_manager_unsubscribe(session_ref);
}
// Test that app subscriptions expire correctly
void test_hrm_manager__app_expiration(void) {
AppInstallId app_id = 1;
const uint16_t expire_s = SECONDS_PER_MINUTE;
HRMSessionRef session_ref = sys_hrm_manager_app_... | (PebbleTask_App, INSTALL_ID_INVALID) | |
SECONDS_PER_MINUTE)) % 255);
}
// Advance another minute.
rtc_set_time(utc_sec + (i * SECONDS_PER_MINUTE));
}
}
// ---------------------------------------------------------------------------------------
// Return the index of the step averages slot that contains the given minute
static uint16_t prv_ste... | (180, 100, ActivitySleepStateAwake) | ;
prv_feed_cannned_accel_data(180, 0, ActivitySleepStateRestfulSleep);
prv_feed_cannned_accel_data(180, 0, ActivitySleepStateLightSleep);
// Wait long enough for our recompute sleep logic to run.
prv_feed_cannned_accel_data(SECONDS_PER_MINUTE * ACTIVITY_SESSION_UPDATE_MIN, 0,
Acti... |
/*
* 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... | {
periph_config_enable(QUADSPI, dev->clock_ctrl);
} |
}
void qspi_release(QSPIPort *dev) {
PBL_ASSERTN(dev->state->use_count > 0);
if (--dev->state->use_count == 0) {
periph_config_disable(QUADSPI, dev->clock_ctrl);
}
}
static void prv_set_num_data_bytes(uint32_t length) {
// From the docs: QSPI_DataLength: Number of data to be retrieved, value+1.
// so 0... |
(FIXED_S16_3_PRECISION == 3) | ;
int Fixed_S16_3_size = sizeof(Fixed_S16_3);
cl_assert(Fixed_S16_3_size == sizeof(int16_t));
test_num = 1 << FIXED_S16_3_PRECISION;
num = (Fixed_S16_3){ .integer = 1, .fraction = 0 };
// Test number creation
test_num = (int16_t)((float)1 * (1 << FIXED_S16_3_PRECISION));
cl_assert(num.raw_value == test... | |
ove_notification_by_id(id);
}
static void prv_handle_notification_acted_upon(Uuid *id) {
app_notification_window_handle_notification_acted_upon_by_id(id);
}
static void prv_handle_notification_added(Uuid *id) {
TimelineItem notification;
if (!notification_storage_get(id, ¬ification)) {
return;
}
prv... | menu_layer_set_selected_index(menu_layer, MenuIndex(0, 1),
PBL_IF_RECT_ELSE(MenuRowAlignNone, MenuRowAlignCenter), false) | ;
}
static void prv_push_window(NotificationsData *data) {
Window *window = &data->window;
window_init(window, WINDOW_NAME("Notifications"));
window_set_user_data(window, data);
window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_window_load,
.appear = prv_window_appear,
.disappear =... |
/*
* 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(s_vibe_queue[0].duration_ms, 15) | ;
cl_assert_equal_i(s_vibe_queue[0].strength, 100);
cl_assert_equal_i(s_vibe_queue[1].duration_ms, 9);
cl_assert_equal_i(s_vibe_queue[1].strength, -100);
cl_assert_equal_i(s_vibe_queue[2].duration_ms, 100);
cl_assert_equal_i(s_vibe_queue[2].strength, 0);
cl_assert_equal_i(s_vibe_queue[3].duration_ms, 15);
... |
ribe(BUTTON_ID_UP, prv_raw_click_handler, NULL, context);
window_single_repeating_click_subscribe(BUTTON_ID_UP, SCROLL_REPEAT_MS,
prv_single_click_handler);
window_multi_click_subscribe(BUTTON_ID_UP, 2, 2, 100, false, prv_up_multi_click_handler);
// Use raw clicks to avo... | layer_set_update_proc(&swap_layer->arrow_layer.layer, prv_arrow_layer_update_proc) | ;
layer_add_child(layer, &swap_layer->arrow_layer.layer);
}
void swap_layer_deinit(SwapLayer *swap_layer) {
swap_layer->is_deiniting = true;
gbitmap_deinit(&swap_layer->arrow_layer.arrow_bitmap);
layer_deinit(&swap_layer->arrow_layer.layer);
prv_swap_layer_reset(swap_layer);
layer_deinit(&swap_layer->layer... |
96, 408, -808},
{ 104, 448, -816},
{ 96, 440, -824},
{ 104, 344, -824},
{ 112, 392, -856},
{ 80, 328, -856},
{ 64, 392, -872},
{ 80, 328, -848},
{ 72, 336, -848},
{ 64, 360, -872},
{ 72, 264, -896},
// 5 seconds
{ 32, 288, -832},
{ 64, 320, -880},
{ 56, 272, -872... | { 96, 608, -824},
{ 96, 368, -824},
{ 8, 312, -960},
{ 160, 288, -1056},
{ 96, 128, -1048},
{ -56, -120, -960},
{ -136, -248, -928},
{ -232, -128, -824},
{ -328, -144, -792},
{ -288, -304, -848},
{ -272, -264, -824},
{ -320, -352, -832},
{ -336, -328, -848},
{ -24... |
{ 192, 744, -512},
{ 136, 720, -368},
{ 120, 768, -384},
{ 168, 808, -544},
{ 136, 824, -360},
{ 144, 760, -344},
{ 152, 736, -448},
// 13 seconds
{ 128, 848, -320},
{ 128, 760, -456},
{ 144, 808, -296},
{ 128, 840, -240},
{ 168, 832, -208},
{ 192, 864, -128},
... |
->timer);
// Delay a bit so that we don't deassert the enable GPIO while in
// the loader and unintentionally activate force loader mode.
psleep(LOADER_READY_MAX_DELAY_MS);
// fallthrough
case HRMEnabledState_Enabled:
gpio_output_set(&dev->en_gpio, false);
dev->state->enabled_sta... | prv_log_running_apps(dev) | ;
return true;
}
static uint64_t prv_get_time_ms(void) {
time_t time_s;
uint16_t time_ms;
rtc_get_time_ms(&time_s, &time_ms);
return ((uint64_t)time_s) * 1000 + time_ms;
}
static bool prv_wait_for_loader_ready(HRMDevice *dev) {
uint64_t end_time_ms = prv_get_time_ms() + LOADER_READY_MAX_DELAY_MS;
do {
... |
/*
* 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... | __builtin_return_address(0) | );
#if NO_WATCHDOG
while (1) {};
#else
NVIC_SystemReset();
#endif
__builtin_unreachable();
}
|
lback, NULL);
}
// Issue regular pfs accesses from KernelBG
void pfs_command_stress(void) {
prompt_send_response("PFS stress from kernel BG");
system_task_add_callback(prv_pfs_stress_callback, NULL);
}
extern void command_read_word(const char* address_str) {
int32_t address = str_to_address(address_str);
if (... | str_to_address(address_str) | ;
if (address == -1) {
prompt_send_response("Invalid address");
return;
}
int length = atoi(length_str);
if (length <= 0) {
prompt_send_response("Invalid length");
return;
}
int value = atoi(value_str);
if ((value < 0) || (value > 0xFF)) {
prompt_send_response("Invalid value");
r... |
i].y; zp = d[i].z;
x += xr;
y += yr;
z += zr;
}
x /= (int)num_samples;
y /= (int)num_samples;
z /= (int)num_samples;
// TODO: could this ever be called in the middle of ecompass_service_handle?
// map accel data to NED coordinate system
s_accel_data.x = y;
s_accel_data.y = x;
s_accel_... | if (!s_calib_run) {
ecomp_corr_reset();
mag_change_sample_rate(MagSampleRate20Hz);
regular_timer_add_multiminute_callback(&s_cb_info, 2);
s_calib_run = true;
s_high_freq_calib_active = true;
samples_collected = 0;
return; // if we are switching to high freq mode, don't use 1st ... |
if (samples_collected < 5) {
return; // wait a few samples for ramp up error to stabilize
}
int16_t new_corr[3];
MagCalStatus cal_status = ecomp_corr_add_raw_mag_sample((int16_t *)&mag_data,
(s_saved_corr_present) ? s_saved_corr : NULL, new_corr);
if (cal_status != MagCalStatusNoSo... |
/*
* 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... | ((SECTOR_SIZE_BYTES > (64 * 1024)) ? 20 : 4) | |
}
prv_encode_and_send_data(&checksum, sizeof(checksum));
accessory_send_byte(HDLC_FLAG);
accessory_enable_input();
}
// Request processing
////////////////////////////////////////////////////////////////////
static void prv_erase_complete(void *ignored, status_t result) {
s_flash_erase_in_progress = false... | prv_send_frame(OPCODE_FLASH_GEOMETRY, &response, sizeof(response)) | |
ither express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "clar.h"
#include "test_jerry_port_common.h"
#include "test_rocky_common.h"
#include "applib/rockyjs/api/rocky_api_global.h"
#include "applib/rockyjs/pbl_jerry_port.h"
// St... | cl_assert(*s_log_internal__expected == NULL) | ;
}
void test_rocky_api_global__can_unsubsribe_event_handlers(void) {
static const RockyGlobalAPI api = {
.add_handler = prv_api_add,
.remove_handler = prv_api_remove,
};
static const RockyGlobalAPI *apis[] = {
&api,
NULL,
};
rocky_global_init(apis);
s_prv_api_add__result = true;
EXECUTE... |
----
static void prv_cleanup_accel_session_cb(void *session) {
kernel_free(session);
}
void accel_session_delete(AccelServiceState * session) {
prv_assert_session_task();
// we better have unsubscribed at this point
PBL_ASSERTN(session->manager_state == NULL);
// A deferred free means one lingering event w... | {
APP_LOG(LOG_LEVEL_WARNING, "%d samples per update requested, max is %d",
(int)samples_per_update, ACCEL_MAX_SAMPLES_PER_UPDATE);
samples_per_update = ACCEL_MAX_SAMPLES_PER_UPDATE;
} | |
{ -1048, 464, 40},
{ -768, 376, 64},
// 60 seconds
// elapsed: 1 minutes
{ -568, 352, 56},
{ -560, 312, 88},
{ -544, 248, 120},
{ -504, 184, 144},
{ -496, 168, 144},
{ -584, 240, 40},
{ -912, 288, 8},
{ -1056, 200, 64},
{ -1528, 192, 112},
{ -1392, 528, -208},
... |
{ -1544, 328, -48},
{ -1392, 344, -8},
{ -1048, 504, -184},
{ -864, 152, -216},
{ -592, 408, -208},
{ -424, 296, -184},
{ -352, 416, -208},
{ -408, 432, -168},
{ -512, 432, -112},
{ -720, 432, -72},
{ -808, 472, -40},
{ -1056, 624, -160},
// 63 seconds
{ -1272, 5... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.