prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
, src_bitmap->bounds.size });
uint8_t dest_data[50*50];
GBitmap dest_bitmap = {
.addr = dest_data,
.row_size_bytes = 50,
.info.format = GBitmapFormat8Bit,
.info.version = GBITMAP_VERSION_CURRENT,
.bounds = { { 0, 0 }, { 50, 50 } }
};
memset(dest_data, GColorBlue.argb, sizeof(dest_data));
... | (&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_black_on_black-expect.1bit.pbi") | );
memset(dest_data, 0b00000000, sizeof(dest_data));
bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, (GPoint){0}, GCompOpTint, GColorWhite);
cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_1bit_comptint_white_on_black-expect.1bit.pbi"));
memset(dest_data, 0b00000000, sizeof(dest_data));
bitb... |
he "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS... | __builtin_return_address(0) | ;
OS_ASSERT(!mcu_state_is_isr());
xLightMutexLockRecursive(handle->common.freertos_mutex, portMAX_DELAY);
LOG_LOCKED(handle->common.lr, myLR);
}
bool mutex_lock_recursive_with_timeout_and_lr(PebbleRecursiveMutex * handle,
uint32_t timeout_ms, uint32_t myLR) {
OS_ASSERT(!mcu_state_is_isr());
TickType_t t... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prv_log(APP_LOG_LEVEL_WARNING, argc, argv) | ;
}
JERRY_FUNCTION(prv_console_error) {
return prv_log(APP_LOG_LEVEL_ERROR, argc, argv);
}
static void prv_init(void) {
bool was_created;
JS_VAR console =
rocky_get_or_create_object(jerry_create_undefined(), ROCKY_CONSOLE, rocky_creator_object,
NULL, &was_created);
// there... |
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) {
return rocky_add_function(jerry_create_undefined(), name, handler);
}
jerry_value_t rocky_add_constructor(char *name, jerry_externa... | (tick_time->tm_mday) | |
_t num_data = ARRAY_LENGTH(data);
const StatsBasicOp op = StatsBasicOp_ConsecutiveFirst;
int32_t result;
stats_calculate_basic(op, data, num_data, prv_filter, &s_context, &result);
cl_assert_equal_i(result, 3);
}
void test_stats__median(void) {
const int32_t data[] = { 10, 40, 6, 32, 73, 80, 34, 25, 62 };
... | cl_assert_equal_i(result.sum, 42) | |
t) == false) {
return false;
}
}
return true;
}
static GAxis prv_get_opposite_axis(GAxis axis) {
switch (axis) {
case GAxis_X:
return GAxis_Y;
case GAxis_Y:
return GAxis_X;
}
return GAxis_X;
}
GTextNodeText *graphics_text_node_create_text(size_t buffer_size) {
GTextNodeText *... | {
size->h = max_size->h;
} | |
/*
* 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... | {
graphics_context_set_fill_color(ctx, GColorBlack);
GRect dot_rect = { .size = { peek_layer->dot_diameter, peek_layer->dot_diameter } };
grect_align(&dot_rect, &peek_layer->layer.bounds, GAlignCenter, false /* clip */);
graphics_fill_radial(ctx, dot_rect, GOvalScaleModeFitCircle, peek_layer->dot_diamet... | |
-520, 432, -376},
{ -544, 472, -528},
{ -496, 224, -760},
{ -504, 64, -872},
{ -456, 192, -976},
{ -432, -48, -888},
{ -376, -48, -952},
{ -312, -80, -792},
{ -232, 40, -960},
{ -120, 264, -1128},
{ 32, 320, -1024},
{ -48, 440, -1152},
// 205 seconds
{ -200, 216, -10... | { 216, -544, -1200},
{ -64, -464, -784},
{ 80, -464, -984},
// 210 seconds
{ 56, -488, -920},
{ 48, -416, -904},
{ 64, -408, -912},
{ 16, -392, -944},
{ -8, -368, -960},
{ -32, -384, -968},
{ -64, -392, -1024},
{ -48, -384, -984},
{ -32, -400, -976},
{ -24, -384, ... |
{ -88, 112, -1000},
{ -112, 144, -1000},
{ -112, 192, -1024},
{ -120, 216, -1000},
{ -128, 184, -1000},
{ -144, 56, -912},
{ -104, -96, -896},
{ -96, -24, -952},
{ -104, -96, -936},
{ -96, -136, -1016},
{ -88, -176, -1024},
{ -72, -192, -1064},
{ -48, -144, -1080},
... |
return false;
}
// -------------------------------------------------------------------------------------------------
// Handling inbound GATT Notifications
static void prv_handle_ns_notification(uint32_t length, const uint8_t *notification) {
PBL_ASSERTN(notification != NULL);
analytics_inc(ANALYTICS_DEVICE_M... | PBL_LOG(LOG_LEVEL_ERROR, "Read or notification error: %d", error) | ;
prv_reset_due_to_bt_error();
return;
}
ANCSCharacteristic characteristic_id = prv_get_id_for_characteristic(characteristic);
void (*handler)(uint32_t, const uint8_t *);
switch (characteristic_id) {
case ANCSCharacteristicNotification:
handler = prv_handle_ns_notification;
break;
c... |
{
// No time left. Kill the subscription
sys_hrm_manager_unsubscribe(s_workout_data.hrm_session);
} |
#endif // CAPABILITY_HAS_BUILTIN_HRM
prv_put_event(PebbleWorkoutEvent_FrontendClosed);
}
prv_unlock();
}
// ---------------------------------------------------------------------------------------
bool workout_service_start_workout(ActivitySessionType type) {
bool rv = true;
prv_lock();
{
if (!work... | |
on (if one was provided and we have room for it)
if (render_icon && !gsize_equal(&rect.size, &GSizeZero)) {
// Only draw the icon if it fits within the cell
if (gsize_equal(&rect.size, &icon_frame_size)) {
// round has never worked with legacy2 apps
static const bool is_legacy2 = false;
// R... | prv_get_cell_value_font(config) | ;
if (config->value) {
right_element_size = graphics_text_layout_get_max_used_size(
ctx, config->value, value_font, *cell_layer_bounds, config->overflow_mode,
GTextAlignmentRight, NULL);
} else {
right_element_size = icon_size;
}
// We reuse this rect to save stack space; here it is the... |
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&white PBI loading into gbitmap
// Result:
// - gbitmap matches platform loaded PBI
void test_bitblt_circular__color_1_bit_bw(void) {
const char test_file[] = "test_bitblt_circular__color_1_b... | graphics_context_get_bitmap(ctx) | ;
cl_assert(native_framebuffer->info.format == GBitmapFormat8BitCircular);
cl_assert(DISPLAY_FRAMEBUFFER_BYTES == 25944);
bitblt_bitmap_into_bitmap_tiled(
native_framebuffer, bitmap, native_framebuffer->bounds,
GPointZero, GCompOpAssign, GColorWhite);
cl_assert(gbitmap_pbi_eq(native_framebuffer, TE... |
de "drivers/stm32f2/dma_definitions.h"
#include "drivers/stm32f2/i2c_hal_definitions.h"
#include "drivers/stm32f2/spi_definitions.h"
#include "drivers/stm32f2/uart_definitions.h"
#include "drivers/temperature.h"
#include "drivers/voltage_monitor.h"
#include "util/units.h"
// DMA Controllers
static DMAControllerState ... | (USART3, uart_irq_handler, DBG_UART) | ;
static UARTDeviceState s_accessory_uart_state;
static UARTDevice ACCESSORY_UART_DEVICE = {
.state = &s_accessory_uart_state,
.half_duplex = true,
.tx_gpio = {
.gpio = GPIOE,
.gpio_pin = GPIO_Pin_1,
.gpio_pin_source = GPIO_PinSource1,
.gpio_af = GPIO_AF_UART8
},
.periph = UART8,
.irq_chann... |
, 3);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 12), 4);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, ... | (&ctx, GPoint(16, 0), 21) | ;
graphics_draw_vertical_line_dotted(&ctx, GPoint(18, 0), 22);
graphics_draw_vertical_line_dotted(&ctx, GPoint(20, 0), MAX_NUM_ROWS - 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(22, 0), MAX_NUM_ROWS + 1 );
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_vert_dotted_line_orig... |
http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing per... | (ahb2_periphs, ENABLE) | |
_parsed_msg = (TestPLParsedMsg) {
.events = {
.num_events = ARRAY_LENGTH(events),
.events = events,
.uuids = event_uuids,
.num_sessions = ARRAY_LENGTH(event_sessions),
.sessions = event_sessions,
},
};
// Get the message size and pointer to encoded data
PLogMessageHdr *hdr =... | cl_assert_equal_i(a->events.num_sessions, b->events.num_sessions) | ;
for (int i = 0; i < a->events.num_events; i++) {
const pebble_pipeline_Event *a_event = &a->events.events[i];
const pebble_pipeline_Event *b_event = &b->events.events[i];
cl_assert_equal_i(a_event->type, b_event->type);
cl_assert_equal_i(a_event->created_time_utc, b_event->created_time_ut... |
// Subscribe app:
BLECharacteristic characteristic = prv_get_indicatable_characteristic();
BTErrno e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications,
GAPLEClientApp);
cl_assert_equal_i(e, BTErrnoOK);
// Simulate getting confirma... | fake_kernel_malloc_mark() | ;
// Subscribe app and kernel:
BLECharacteristic characteristic = prv_get_indicatable_characteristic();
BTErrno e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications,
GAPLEClientApp);
cl_assert_equal_i(e, BTErrnoOK);
e = gatt_clie... |
10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10... | (&health_data) | ;
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
|
/*
* 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_passert(app_file_name_make(buf, sizeof(buf), 123, "ab", 2)) | ;
}
void test_app_file__name_make_buf_too_small_for_prefix(void) {
char buf[10];
cl_assert_passert(app_file_name_make(buf, sizeof(buf), 123, "", 0));
}
// Tests for is_app_file_name()
void test_app_file__is_app_file_name_simple(void) {
cl_assert(is_app_file_name("@00000001/abc") == true);
}
void test_app_file... |
ack how long we have been in a lower
// latency state and subtract that from higher latency requests, but most of
// the time we should be in the maximum latency (low power) state anyway
// get & set the new state
prv_handle_response_latency_for_le_conn(hdl);
unlock:
bt_unlock();
}
static void prv_bt_le_ga... | regular_timer_is_scheduled(watchdog_cb_info) | |
l_count;
return jerry_create_undefined();
}
JERRY_FUNCTION(method_func_imp) {
++s_method_func_imp_call_count;
return jerry_create_undefined();
}
void test_rocky_api_util__rocky_add_constructor(void) {
static const RockyGlobalAPI *s_api[] = {
NULL,
};
rocky_global_init(s_api);
JS_VAR prototype = roc... | cl_assert(jerry_get_number_value(result_seconds) == 51.0) | ;
cl_assert(jerry_get_number_value(result_minutes) == 40.0);
cl_assert(jerry_get_number_value(result_hours) == 21.0);
cl_assert(jerry_get_number_value(result_date) == 17.0);
jerry_release_value(result_date);
jerry_release_value(result_hours);
jerry_release_value(result_minutes);
jerry_release_value(resul... |
NACK'ed
dls_endpoint_open_session(logging_session);
}
//! System task callback executed which reopens the next session in the list built up by report_cmd_system_task_cb
static void prv_reopen_next_session_system_task_cb(void* data) {
DataLoggingReopenEntry *entry = (DataLoggingReopenEntry *)data;
if (!entry) {
... | dls_private_send_session(logging_session, true /*empty_all_data*/) | ;
}
}
//! data_logging_protocol_msg_callback runs on Bluetooth task. Keep it quick.
void data_logging_protocol_msg_callback(CommSession *session, const uint8_t *data, size_t length) {
// consume the first byte to read the command
uint8_t command = data[0];
--length; // the length now reflects the sizeof the ... |
unt_handler_entries(&s_started_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
// A should end high
... | (&s_started_handler_calls, NULL) | , 3);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NULL), 3);
// If we keep going, we should repeat the whole sequence another time
prv_advance_to_ms_with_timers(start_ms + 2 * (duration_total + 4 * MIN_FRAME_INTERVAL_MS));
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler... |
ialog_set_icon(dialog, resource_id);
i18n_free_all(confirmation_dialog);
return confirmation_dialog;
}
// Information Window
//////////////////////
static const char* s_information_titles[SystemInformationItem_Count] = {
[SystemInformationItemBtAddress] = i18n_noop("BT Address"),
[SystemInformationItemFirmw... | window_single_click_subscribe(BUTTON_ID_UP, prv_coredump_reset_confirm_cb) | ;
window_single_click_subscribe(BUTTON_ID_DOWN, prv_coredump_reset_decline_cb);
}
static void prv_information_long_click_callback(MenuLayer *menu_layer,
MenuIndex *cell_index,
void *callback_context) {
if (cell_index->r... |
/*
* 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... | stop_mode_enable(InhibitorCommMode) | ;
analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_BT_OFF_TIME, AnalyticsClient_System);
s_comm_is_running = false;
// This is a legacy event used to update the Settings app.
prv_put_disconnection_event();
}
static void prv_send_state_change_event(void) {
PBL_LOG(LOG_LEVEL_DEBUG, "----> Sending a BT state ... |
(int i = 0; i < 30; i++) {
HealthValue value = health_service_sum(metric, day_start, day_start + SECONDS_PER_DAY);
char elapsed[8];
prv_convert_seconds_to_time(value, elapsed, sizeof(elapsed));
APP_LOG(APP_LOG_LEVEL_DEBUG, "%d: %s", i, elapsed);
char temp[32];
snprintf(temp, sizeof(temp), "\n%d... | (FONT_KEY_GOTHIC_28_BOLD) | |
/*
* 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... | (REBOOT_REASON_REGISTER_1) | |
(menu_layer, window) | ;
layer_add_child(&window->layer, menu_layer_get_layer(menu_layer));
}
static void prv_window_unload(Window *window) {
SettingsWatchfacesData *data = window_get_user_data(window);
menu_layer_deinit(&data->menu_layer);
app_menu_data_source_deinit(&data->data_source);
i18n_free_all(data);
}
static void handl... | |
_phone_ui_data->name_font;
}
text_layer_set_font(&s_phone_ui_data->caller_id_text_layer, caller_id_font);
if (lines == 1) {
s_phone_ui_data->caller_id_text_layer.layer.bounds.origin.y = SINGLE_LINE_BOUND_OFFSET;
} else {
s_phone_ui_data->caller_id_text_layer.layer.bounds.origin.y = DOUBLE_LINE_BOUND_OF... | (bounceback, BOUNCEBACK_ANIMATION_FRAMES * ANIMATION_FRAME_MS) | ;
Animation *animation = animation_sequence_create(upward, bounceback, NULL);
s_phone_ui_data->call_status_animation = animation;
animation_schedule(animation);
#else
s_phone_ui_data->call_status_text_layer.layer.bounds.origin = GPointZero;
#endif
}
static void prv_update_call_time(void *unused) {
if (s_pho... |
e, ble_hrm_is_sharing_to_connection(&s_conn_a));
// Expect permissions UI to be presented:
prv_assert_permissions_ui_and_respond(true /* is_granted */);
// Expect HRM manager to be subscribed to:
cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 1);
prv_assert_event_service_subscribed(true... | ble_hrm_is_sharing_to_connection(&s_conn_a) | );
cl_assert_equal_b(false, ble_hrm_is_sharing_to_connection(&s_conn_b));
cl_assert_equal_b(false, ble_hrm_is_sharing());
prv_assert_event_service_subscribed(false);
}
void test_ble_hrm__revoke_after_disconnection(void) {
ble_hrm_revoke_sharing_permission_for_connection(NULL);
s_connections[0] = NULL;
ble... |
prv_elapsed_getter,
.get_duration = prv_duration_getter
};
test_reel = kino_reel_custom_create(test_reel_impl, test_reel_data);
cl_assert(test_reel != NULL);
test_player = malloc(sizeof(KinoPlayer));
memset(test_player, 0, sizeof(KinoPlayer));
kino_player_set_reel(test_player, test_reel, true);
}
/... | (animation, 300) | ;
prv_play_animation_update(animation, 0); // intentionally bad value
cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 20);
}
void test_kino_player__infinite_animation_finite_reel_forward(void) {
// Choose duration and elapsed to have clean division for
// ANIMATION_NORMALIZED_MAX * elapsed / duration = w... |
size = prv_get_current_size(data);
const GPoint offset = interpolate_gpoint(data->normalized, grect_center_point(&data->from),
grect_center_point(&data->to));
return gpoint_sub(offset, GPoint(size.w / 2, size.h / 2));
}
static bool prv_image_size_eq_rect_size(KinoReelTran... | kino_reel_get_gdraw_command_list(reel) | ;
GDrawCommandList *list = prv_get_or_create_list_copy(data, source_list);
if (!list) {
return;
}
if (!gdraw_command_list_copy(list, gdraw_command_list_get_data_size(source_list),
source_list)) {
return;
}
if (data->impl->apply) {
const GSize size = kino_reel_get_... |
nst SMIdentityResolvingKey) {
.data = {
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
},
},
.identity = (const BTDeviceInternal) {
.opaque.opaque_64 = 0x1122334455667788,
},
.csrk = {
.data = {
0xcc, 0xdd,... | (memcmp(&pairing_info->csrk, &pairing_info_out.csrk,
sizeof(SM128BitKey)), 0) | ;
}
void test_shared_prf_storage_v2__bt_classic_and_le_pairing(void) {
shared_prf_storage_wipe_all();
cl_assert_equal_b(shared_prf_storage_get_bt_classic_pairing_data(NULL, NULL, NULL, NULL), false);
// Store a classic pairing
BTDeviceAddress addr = {
.octets = { 0x11, 0x22, 0x33, 0x44, 0x55,},
};
ch... |
!s_in_use) {
return;
}
NotificationWindowData *data = &s_notification_window_data;
if (!data->dnd_icon_visible) {
return;
}
graphics_context_set_tint_color(ctx, status_bar_layer_get_foreground_color(&data->status_layer));
graphics_context_set_compositing_mode(ctx, GCompOpTint);
graphics_draw_bit... | (sizeof(NotificationInfo) * num_notifications) | ;
for (int i = 0; i < num_notifications; i++) {
Uuid *id = notifications_presented_list_relative(first_id, i);
memcpy(¬if_list[i].id, id, sizeof(Uuid));
notif_list[i].type = notifications_presented_list_get_type(id);
}
PBL_LOG(LOG_LEVEL_DEBUG, "Dismissing %d notifications", num_notifications);
... |
r_set_clips(&data->cassette_container, false);
bitmap_layer_init(&data->cassette_layer, &cassette_rect);
bitmap_layer_set_bitmap(&data->cassette_layer, &data->image_cassette);
data->cassette_current_icon = &data->image_cassette;
const GAlign CASSETTE_LAYER_ALIGNMENT = PBL_IF_RECT_ELSE(GAlignTopLeft, GAlignTopR... | gbitmap_init_with_resource(&data->icon_play, RESOURCE_ID_MUSIC_ICON_PLAY) | ;
gbitmap_init_with_resource(&data->icon_pause, RESOURCE_ID_MUSIC_ICON_PAUSE);
gbitmap_init_with_resource(&data->icon_play_pause, RESOURCE_ID_MUSIC_ICON_PLAY_PAUSE);
gbitmap_init_with_resource(&data->icon_volume_up, RESOURCE_ID_MUSIC_ICON_VOLUME_UP);
gbitmap_init_with_resource(&data->icon_volume_down, RESOURCE_... |
comm_session_send_queue_get_length(s_app_session_ptr) | ;
cl_assert_equal_i(length, sizeof(PebbleProtocolHeader) + sizeof(TEST_PAYLOAD));
uint8_t bytes_out[length];
memset(bytes_out, 0xff, length);
// Consume byte by byte:
for (int c = 0; c < length; ++c) {
// Shift offset byte by byte:
for (int o = 0; o < (length - c); ++o) {
size_t length_to_copy... | |
er.app.pending = true;
return;
}
if (s_state == CompositorState_AppTransitionPending) {
// Huzzah, the app sent us the first frame!
if (s_animation_state.animation) {
// We have an animation to run, run it.
s_state = CompositorState_Transitioning;
animation_schedule(s_animation_state.... | compositor_transition_render(s_animation_state.impl->update, animation, distance_normalized) | ;
kernel_animation_state->aux->current_animation = saved_current_animation;
}
static void prv_finish_transition(void) {
const ModalProperty properties = modal_manager_get_properties();
if (properties & ModalProperty_Exists) {
s_state = (properties & ModalProperty_Transparent) ? CompositorState_AppAndModal :
... |
angerously";
}
// Keep hourly logging to keep track of hours without crashes.
analytics_set(ANALYTICS_DEVICE_METRIC_SYSTEM_CRASH_CODE,
0xDEAD0000 | reason.code, AnalyticsClient_System);
uint32_t lr = reason.extra;
// Leave this NULL to do your own printing.
const char *reason_string = NULL... | DEBUG_LOG(LOG_LEVEL_INFO, reason_string, restarted_safely_string, rebooted_due_to,
reason.extra) | ;
}
analytics_set(ANALYTICS_DEVICE_METRIC_SYSTEM_CRASH_LR, lr, AnalyticsClient_System);
// We need to wait for the logging service to initialize.
AnalyticsEventCrash *crash_report = kernel_malloc_check(sizeof(AnalyticsEventCrash));
*crash_report = (AnalyticsEventCrash) {
.crash_code = reason.code,
.... |
YS });
prv_assert_alarm_config(id, 6, 14, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule);
}
void test_alarm__alarm_create_just_once(void) {
AlarmId id;
// It's currently Thursday @ 00:00
bool just_once_schedule_thursday[7] = {false, false, false, false, true, false, false};
id = alarm_create(&(AlarmInfo) { ... | (&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_EVERYDAY }) | ;
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
alarm_set_kind(id, ALARM_KIND_WEEKENDS);
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule);
bool custom_schedule1[7] = {true, false, true, false, false, true, true};
id = alarm_create(&(Al... |
/*
* 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_ctx.dest_bitmap, TEST_PBI_FILE) | |
ication, &header);
int fd = prv_file_open(OP_FLAG_WRITE | OP_FLAG_READ);
if (fd < 0) {
return;
}
size_t size_needed = header.payload_length + sizeof(SerializedTimelineItemHeader);
if (size_needed > (NOTIFICATION_STORAGE_FILE_SIZE - s_write_offset)) {
if (!prv_compress(size_needed, &fd)) {
// No... | PBL_ASSERTN(item_out && (s_notif_storage_mutex != NULL)) | |
ART:
// Generate a repeat start
bus->i2c->CR1 |= I2C_CR1_START;
bus->transfer.state = TRANSFER_STATE_WRITE_ADDRESS_RX;
break;
case TRANSFER_STATE_WRITE_ADDRESS_RX:
// Write the I2C device address again, but this time in read mode.
bus->i2c->DR = bus->transfer.device_address | I2... | PBL_LOG(LOG_LEVEL_ERROR, "NACK received during I2C transfer; Bus: 0x%p", bus->i2c) | ;
}
}
return end_transfer_irq(bus, false);
}
void I2C1_EV_IRQHandler(void) {
portEND_SWITCHING_ISR(irq_event_handler(&i2c_buses[0]));
}
void I2C1_ER_IRQHandler(void) {
portEND_SWITCHING_ISR(irq_error_handler(&i2c_buses[0]));
}
void I2C2_EV_IRQHandler(void) {
portEND_SWITCHING_ISR(irq_event_handler(&i... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | memcpy(buffer + sizeof(cmd), data, length) | ;
// PBL_LOG(LOG_LEVEL_DEBUG, "Sending PhoneCmd: %d", cmd);
CommSession *session = comm_session_get_system_session();
if (!session) {
// Looks like we disconnected...
PBL_LOG(LOG_LEVEL_ERROR, "No CommSession for phone command, ending call");
prv_put_call_disconnect_event();
} else {
comm_sessio... |
variants
const int max_notif_length = 256;
const char *fmt = prv_get_variant(&s_tier_config[tier], variant);
if (fmt == NULL) {
// invalid variant
return;
}
char *body = kernel_malloc_check(max_notif_length);
snprintf(body, max_notif_length, i18n_get(fmt, body), hours, minutes, ABS(percentage));
... | if (prv_push_activity_summary_pin(now_utc, pin_time_utc, minute_of_day, steps, total_steps_avg,
&s_activity_pin_state.uuid)) {
SummaryPinLastState activity_pin_last_state = {
.uuid = s_activity_pin_state.uuid,
.last_triggered_utc = now_utc,
};
prv_save_state(A... |
}
// ------------------------------------------------------------------------------------------------
static const char* prv_get_intro_str_for_activity(ActivitySession *session) {
switch (session->type) {
case ActivitySessionType_Walk: {
static const InsightCopyVariants s_walking_intros = {
.num_v... |
elay index increases
lookup->max_index += delay_amount;
for (int i = 0; i < lookup->num_points; i++) {
// The lookup maps definition index => delay index
// We want to add delay to points at or above a certain delay index
if (lookup->index_lookup[i] >= delay_index) {
lookup->index_lookup[i] += del... | {
gpoint_add_eq(&point, gvalues->offset);
} |
command->points[i] = point;
scale->iter.current_index++;
}
return true;
}
void gdraw_command_list_scale_segmented_to(
GDrawCommandList *list, GSize size, GRect from, GRect to, AnimationProgress normalized,
InterpolateInt64Function interpolate, GPointIndexLookup *lookup, Fixed_S32_16 duration_fra... |
cense, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distribute... | (&ctx, &data, &should_store, &is_invalid) | ;
cl_assert(is_complete == false);
cl_assert(should_store == false);
cl_assert(is_invalid == false);
data = HDLC_FLAG ^ HDLC_ESCAPE_MASK;
is_complete = hdlc_streaming_decode(&ctx, &data, &should_store, &is_invalid);
cl_assert(is_complete == false);
cl_assert(should_store == true);
cl_assert(is_invalid =... |
nu_close(action_menu, true);
return;
}
prv_do_action_analytics(pin, item);
if (timeline_item_action_is_dismiss(action)) {
prv_push_dismiss_first_use_dialog(action_menu);
}
prv_invoke_action(action_menu, action, pin, item->label);
}
static void prv_invoke_voice_response(VoiceResponseData *voice_d... | (data->action_menu) | ;
// TODO: [AS] set reply as selected option
prv_cleanup_voice_data(data);
}
}
static void prv_start_voice_reply(ActionMenu *action_menu,
const ActionMenuItem *item,
void *context) {
#if CAPABILITY_HAS_MICROPHONE
TimelineActionMenu *timeli... |
»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿıŁłŒœŠšŸŽžƒˆˇ˘˙˚˛˜˝π–—‘’‚“”„†‡•…‰‹›⁄€™Ω∂∆∏∑−√∞∫≈≠≤≥◊fifl";
static void select_click_handler(ClickRecognizerRef recognizer, void* callback_param) {
(void) recognizer;
struct AppState* data = (struct AppState*) callback_param;
PBL_LOG(LOG_LEVEL_DE... | app_state_set_user_data(data) | ;
push_window(data);
}
static void handle_deinit(void) {
struct AppState* data = app_state_get_user_data();
app_free(data);
}
static void s_main(void) {
handle_init();
app_event_loop();
handle_deinit();
}
const PebbleProcessMd* text_layout_get_info() {
static const PebbleProcessMdSystem text_layout_i... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return s_session;
} |
void launcher_app_message_send_app_state_deprecated(const Uuid *uuid, bool running) {
s_launcher_deprecated_messages++;
cl_assert(running == (s_app_state == RUNNING ? true : false));
}
bool comm_session_send_data(CommSession *session, uint16_t endpoint_id,
const uint8_t *data, size_t ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (ctx, command->stroke_color) | ;
graphics_context_set_stroke_width(ctx, command->stroke_width);
gpath_draw_outline_precise_internal(ctx, command->precise_points,
command->num_precise_points, command->path_open);
}
}
void gdraw_command_draw(GContext *ctx, GDrawCommand *command) {
if (!command || co... |
_write_erased_header_on_page_range(0, s_pfs_page_count, 1);
}
mutex_unlock_recursive(s_pfs_mutex);
PBL_LOG(LOG_LEVEL_INFO, "FS-Format Done");
}
int pfs_sector_optimal_size(int min_size, int namelen) {
min_size += sizeof(FileHeader);
min_size += sizeof(FileMetaData);
min_size += namelen;
int bytes_per_... | snprintf(display_buf, sizeof(display_buf), "%3d: Corrupt Sector", pg) | ;
prompt_send_response(display_buf);
}
char file_name[file_hdr.file_namelen + 1];
file_name[file_hdr.file_namelen] = '\0';
prv_flash_read((uint8_t *)file_name, file_hdr.file_namelen,
prv_page_to_flash_offset(pg) + FILE_NAME_OFFSET);
snprintf(display_buf, sizeof(display_buf), "%3d:\t... |
Y_ARG(width),
);
graphics_context_set_stroke_width(rocky_api_graphics_get_gcontext(), width);
return jerry_create_undefined();
}
JERRY_FUNCTION(prv_get_stroke_width) {
return jerry_create_number((double)rocky_api_graphics_get_gcontext()->draw_state.stroke_width);
}
static jerry_value_t prv_graphics_set_color(... | {
return jerry_create_undefined();
} |
static void prv_configure_top_window_and_create_constructors(void) {
Window *const window = app_window_stack_get_top_window();
// rocky graphics require a window to already be on the current window stack
PBL_ASSERTN(window);
window->layer.update_proc = prv_rocky_update_proc;
// Create the CanvasRenderingCo... |
/*
* 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_s(written_pcba_serial1, pcba_serial) | ;
// Write second time
const char* written_pcba_serial2 = "abcdefghijkx";
command_pcba_serial_write(written_pcba_serial2);
pcba_serial = mfg_get_pcba_serial_number();
cl_assert_equal_s(written_pcba_serial2, pcba_serial);
// Write third time
const char* written_pcba_serial3 = "asdfghjklq";
command_pcba... |
,
2,
},
{ "'%R')", 66, true,
"1",
7,
},
{ "'%R')", 3607, true,
"1:00",
8,
},
{ "'%R')", -3666, true,
"-1:01",
7,
},
// Advanced %T tests
{ "'%0T')", 3666, true,
"01:01:06",
1,
},
{ "'%uT')", 3666, true,
"1 hour, 1 minute, and 6 seconds",
1,
},
{ "'%... | if (s_error.status >= TemplateStringErrorStatusCount) {
printf("Invalid status code\n");
} else {
printf("%s\n", s_error_strings[s_error.status]);
} | |
ts for popups (modal windows) which currently all
// run on Kernel Main
launcher_task_add_callback(prv_clear_stale_reminders, data);
}
static void prv_setup_reminder_watchdog(NotificationWindowData *data) {
if (!data->is_modal || regular_timer_is_scheduled(&data->reminder_watchdog_timer_id) ||
!do_not_dist... | {
SimpleDialog *simple_dialog = simple_dialog_create("Muted");
Dialog *dialog = simple_dialog_get_dialog(simple_dialog);
const char *msg = i18n_get("Muted", dialog);
dialog_set_text(dialog, msg);
dialog_set_icon(dialog, RESOURCE_ID_RESULT_MUTE_LARGE);
dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT);
i... |
static void prv_mute_notification(const ActionMenuItem *action_menu_item,
uint8_t muted_bitfield) {
NotificationWindowData *window_data = action_menu_item->action_data;
TimelineItem *item = prv_get_current_notification(window_data);
const char *app_id = attribute_get_string(&i... |
Start discovery:
cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK);
prv_mock_put_service_discovery_events();
const uint8_t num_services = 1;
// Test gatt_client_copy_service_refs():
BLEService service_refs[num_services];
const Service *bp_service = fake_gatt_get_blood_pressure_serv... | uuid_equal(&uuid, &bp_service->uuid) | );
// Thermo & Random 128 bit service should be part of the second gen
refs_out = gatt_client_copy_service_refs_by_discovery_generation(
&device, service_refs_out, 3, 1);
cl_assert_equal_i(2, refs_out);
const Uuid uuid1 = gatt_client_service_get_uuid(service_refs_out[0]);
const Uuid uuid2 = gatt_clien... |
(ctx, GPoint(40, 50), GPoint(35, 70)) | ;
}
void across_ny_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_line(ctx, GPoint(5, -30), GPoint(45, 30));
}
void test_graphics_draw_line__origin_layer(void) {
GContext ctx;
Layer layer;
t... | |
if (prv_attribute_type(id) != AttributeTypeUint8) {
PBL_LOG(LOG_LEVEL_WARNING, "Adding attribute with type uint8 for non-uint8_t attribute");
}
prv_add_attribute(list, id)->uint8 = uint8;
}
void attribute_list_add_string_list(AttributeList *list, AttributeId id, StringList *string_list) {
PBL_ASSERTN(prv_at... | PBL_ASSERTN(attr_list != NULL) | |
er size if we add this struct to it
const uint32_t size_if_added = session->data_stream.bytes_written + calc_size;
// If it fits, add it. If it doesn't, flush first.
if (size_if_added > session->max_data_size) {
// We would be over capacity if we added this message. Let's flush first.
PROTOBUF_LOG_DEBUG(... | (session->msg_buffer, hdr->msg_size + sizeof(PLogMessageHdr)) | |
subscription->event_type);
return;
}
PBL_ASSERTN(service->num_subscribers > 0);
--service->num_subscribers;
service->subscribers[subscription->task] = NULL;
if (service->remove_subscriber_callback != NULL) {
service->remove_subscriber_callback(subscription->task);
}
}
static void prv_event_s... | event_get_buffer(e) | |
if (success) {
PBL_LOG(LOG_LEVEL_WARNING, "Timeout cb executing while received successful completion event");
} |
}
// On failure, leave the message on screen for 60 seconds, on success, only for 5 seconds:
const uint32_t timeout_ms = (success ? 5 : 60) * 1000;
new_timer_start(data->timer, timeout_ms, prv_pop_window_timer_callback, NULL, 0 /* flags */);
window_set_click_config_provider(&data->window, prv_success_or_fa... | |
= 11, .priority = 29, .size = 82909 }, // priority rank 21
{ .id = 12, .priority = 53, .size = 132316 }, // priority rank 41
{ .id = 13, .priority = 45, .size = 214356 }, // priority rank 35
{ .id = 14, .priority = 47, .size = 258908 }, // priority rank 36
{ .id = 15, .priority = 19, .size = 117885 }, // prio... | fake_system_task_callbacks_invoke_pending() | ;
after_size = app_cache_get_size();
cl_assert_equal_i(after_size, (before_size - to_free));
// test lowest priority's size
prv_cleanup();
to_free = 1; // should remove 207357
before_size = app_cache_get_size();
cl_assert(before_size >= to_free);
cl_assert_equal_i(S_SUCCESS, app_cache_free_up_space(to_... |
0)) {
res = E_INVALID_ARGUMENT;
goto cleanup;
}
File *file = &PFS_FD(fd).file;
if ((file->op_flags & (OP_FLAG_WRITE | OP_FLAG_OVERWRITE)) == 0) {
res = E_INVALID_ARGUMENT;
goto cleanup;
}
if ((file->offset + size) > file->file_size) {
res = E_RANGE;
goto cleanup;
}
uint32_t pg_... | (LOG_LEVEL_WARNING, "Delete of %d did not complete", curr_pg) | ;
unlink_flash_file(curr_pg);
}
}
update_last_written_page();
}
static void prv_handle_sector_erase(uint16_t start_page, bool update_erase_count) {
if (!update_erase_count) {
prv_flash_erase_sector(start_page);
return;
}
uint16_t max_erase = 0;
uint16_t last_written_pg = INVALID_PAGE;
... |
s
///////////////////////////////////////////////////////////
extern const ReceiverImplementation g_default_kernel_receiver_implementation;
extern const PebbleTask g_default_kernel_receiver_opt_bg;
extern const PebbleTask g_default_kernel_receiver_opt_main;
typedef enum {
HandlerA = 0,
HandlerB,
HandlerC,
Num... | (receiver[i]) | ;
cl_assert_equal_i(s_handler_call_count[i], 0);
bool should_execute_on_kernel_main =
(s_endpoints[i].receiver_opt == &g_default_kernel_receiver_opt_main);
if (should_execute_on_kernel_main) {
cl_assert_equal_i(kernel_main_schedule_count_before + 1, s_kernel_main_schedule_count);
}
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... | {
pos += snprintf(buffer + pos, buffer_size - pos, i18n_get("%dM", i18n_owner), minutes);
} | |
/*
* 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(*s_test_item[2].freed);
} |
void test_circular_cache__get(void) {
cl_assert(!circular_cache_get(&s_test_cache, &s_test_item[0]));
cl_assert(!circular_cache_get(&s_test_cache, &s_test_item[1]));
cl_assert(!circular_cache_get(&s_test_cache, &s_test_item[2]));
circular_cache_push(&s_test_cache, &s_test_item[0]);
circular_cache_push(&s_t... |
icense");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* ... | (GRectZero, grect_inset_internal(rect, 0, 21)) | ;
cl_assert_equal_grect(GRectZero, grect_inset_internal(rect, 16, 21));
}
void test_gtypes__grect_crop_asserts_for_large_insets(void) {
GRect rect = GRect(10, 20, 30, 40);
cl_assert_equal_grect(GRect(25, 35, 0, 10), grect_crop(rect, 15));
cl_assert_passert(grect_crop(rect, 16));
}
void test_gtypes__pbl_if_re... |
ap_sequence->resource_id,
png_decoder_data->read_cursor, true, NULL);
if (metadata_bytes <= 0) {
goto cleanup;
}
buffer = applib_zalloc(metadata_bytes);
if (buffer == NULL) {
goto cleanup;
}
ResAppNum app_num = sys_get_current_resource_num();
const size_t bytes_r... | for (int32_t x = MAX(0, row_info.min_x - delta_x);
x < MIN((int32_t)fctl.width, row_info.max_x - delta_x + 1);
x++) {
const uint32_t corrected_dst_x = x + delta_x;
const uint8_t palette_index = raw_image_get_value_for_bitdepth(upng_buffer, x, y,
row_stride_bytes, bpp);
... |
}
} else if (png_format >= UPNG_LUMINANCE1 && png_format <= UPNG_LUMINANCE8) {
const int32_t transparent_gray = gbitmap_png_get_transparent_gray_value(upng);
for (uint32_t y = 0; y < fctl.height; y++) {
const uint16_t corrected_y = fctl.y_offset + y + bitmap->bounds.origin.y;
const GBitmapDa... |
//////////////////////
// Test Inbox Service Handlers
#define TEST_ARRAY_SIZE (4)
static int s_message_idx;
static struct {
uint8_t data[BUFFER_SIZE];
size_t length;
} s_messages[TEST_ARRAY_SIZE];
static int s_num_messages_to_consume_from_handler;
void test_message_handler(const uint8_t *data, size_t length, Ap... | app_inbox_create_and_register(BUFFER_SIZE, 1,
test_message_handler,
NOT_PERMITTED_DROP_HANDLER) | );
}
void test_app_inbox__app_inbox_create_and_register_happy_case(void) {
void *result = app_inbox_create_and_register(BUFFER_SIZE, 1,
test_message_handler, test_dropped_handler);
cl_assert(result != NULL);
cl_assert_equal_b(true, app_inbox_service_has_inbox_for_ta... |
equal_i(r->state, RecognizerState_Failed);
cl_assert_equal_b(cancelled, false);
cl_assert_equal_i(rec_event, -1);
r->state = RecognizerState_Cancelled;
recognizer_cancel(r);
cl_assert_equal_i(r->state, RecognizerState_Cancelled);
cl_assert_equal_b(cancelled, false);
cl_assert_equal_i(rec_event, -1);
r... | (last_touch_event.type, TouchEvent_Touchdown) | ;
cl_assert_equal_b(updated, true);
cl_assert_equal_i(rec_event, RecognizerEvent_Completed);
}
static bool prv_filter(const Recognizer *recognizer, const TouchEvent *touch_event) {
bool *allow = recognizer_get_user_data(recognizer);
return *allow;
}
void test_recognizer__handle_touch_events_filter_cb(void) {
... |
"aaaa aaaa aaaa aaaa " //200-220
"aaaa aaaa aaaa aaaa " //220-240
"aaaa aaaa aaaa aaaa " //240-260
"aaaa aaaa aaaa aaaa " //260-280
"%lnaaaa aaaa aaaa aaaa " //280-300
"aaaa aaaa aaaa aaaa " /... | (dstbuf, 512, "aaaa aaaa aaaa aaaa " // 0- 20
"aaaa aaaa aaaa aaaa " // 20- 40
"aaaa aaaa aaaa aaaa " // 40- 60
"aaaa aaaa aaaa aaaa " // 60- 80
"aaaa aaaa aaaa aaaa " // 80-100
"aaaa aaaa aaaa aaaa ... | ;
cl_assert_equal_i(tntest[0], 280);
cl_assert_equal_i(tntest[1], 0);
}
|
(120, 100, ActivitySleepStateAwake);
prv_feed_cannned_accel_data(120, 0, ActivitySleepStateRestfulSleep);
prv_feed_cannned_accel_data(120, 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,... | if ((event->type == PEBBLE_HEALTH_SERVICE_EVENT)
&& (event->health_event.type == HealthEventSleepUpdate)) {
s_captured_sleep_event = *event;
s_num_captured_sleep_events++;
} |
}
// ----------------------------------------------------------------------------
// fake_event callback used to look for history update events generated by the health_events test
static PebbleEvent s_captured_history_event = { };
static int s_num_captured_history_events = 0;
static void prv_fake_history_event_cb(Pe... |
onst BTDeviceInternal *device, bool is_master) {
// Simulate getting a Connection Complete event for the device from Bluetopia:
fake_gap_put_connection_event(HCI_ERROR_CODE_SUCCESS,
is_master, device);
cl_assert_equal_b(gap_le_connection_is_connected(device), true);
}
static void ... | (e, BTErrnoInvalidParameter) | ;
}
void test_gap_le_connect__unregister_null_device(void) {
BTErrno e = gap_le_connect_cancel(NULL, GAPLEClientApp);
cl_assert_equal_i(e, BTErrnoInvalidParameter);
}
void test_gap_le_connect__register_invalid_bonding(void) {
BTErrno e = gap_le_connect_connect_by_bonding(BT_BONDING_ID_INVALID,
... |
IGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 5, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r5_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics... | (gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r8_aa_no_clip.${BIT_DEPTH_NAME}.pbi")) | ;
// TODO: Remove these #ifdefs in PBL-15916 when support for non-antialiased rounded rect
#if SCREEN_COLOR_DEPTH_BITS == 8
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, 9, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_b... |
use_screen);
timeline_item_destroy(item);
}
// Visual Layout Tests
//////////////////////
void test_timeline_peek__peek(void) {
prv_render_timeline_peek(&(TimelinePeekItemConfig) {
.title = "CoreUX Design x Eng",
.subtitle = "ConfRM-Missile Command",
.icon = TIMELINE_RESOURCE_TIMELINE_CALENDAR,
.... | prv_set_timeline_item(NULL, false /* animated */) | ;
// Peek should now be off-screen.
cl_assert(layer->frame.origin.y >= DISP_ROWS);
}
void test_timeline_peek__peek_visible_to_hidden_outside_of_watchface(void) {
TimelineItem *item = prv_set_timeline_item(&(TimelinePeekItemConfig) {
.title = "CoreUX Design x Eng",
.subtitle = "ConfRM-Missile Command",
... |
angle line and sets
// angle masking values accordingly
if (quadrant & GCornersTop) {
if (center.y.raw_value - y.raw_value <= bottom.y.raw_value) {
if (center.y.raw_value - y.raw_value >= top.y.raw_value) {
*top_edge = prv_intersection_between_horizontal_and_line((Fixed_S16_3){.raw_value =
... | {
// Drawing config calculation
const EllipsisDrawConfig config = prv_calc_draw_config_ellipsis(angle_start, angle_end);
// This flag will skip calculation of angles
const bool is_full_circle = config.full_quadrants == GCornersAll;
// This will indicate special line in the middle of the circle, when center... |
(radius_inner_y.raw_value * radius_inner_y.raw_value) >> FIXED_S16_3_PRECISION;
// Intersection points of angles and radiuses
GPointPrecise start_top =
prv_get_rotated_precise_point_for_ellipsis(center,
radius_outer_x.raw_value, radius_outer_y.raw_value... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(prefs_db_read((uint8_t *)key, key_len, (uint8_t *)&get_value,
sizeof(get_value)), 0) | |
0xb3, 0x94, 0x1f, 0x87, 0xb6, 0xbe, 0xae, 0x67},
.info_flags = PROCESS_INFO_HAS_WORKER | PROCESS_INFO_STANDARD_APP,
.app_version = {
.major = 1,
.minor = 0,
},
.sdk_version = {
.major = 5,
.minor = 13,
},
.app_face_bg_color = {0},
.template_id = 0,
.icon_resource_id = 0,
};
// menu lay... | (&made_up) | |
void test_bt_conn_mgr__ble_latency_mgr(void) {
// 1 consumer at fastest rate should result in fastest rate getting scheduled
conn_mgr_set_ble_conn_response_time(
&s_hdl, BtConsumerLeServiceDiscovery, ResponseTimeMin, 100);
uint16_t secs_to_wait;
ResponseTimeState state;
state = conn_mgr_get_latency_... | {
fake_gap_le_connect_params_set_actual_state(ResponseTimeMax);
conn_mgr_set_ble_conn_response_time_ext(&s_hdl, BtConsumerLeServiceDiscovery, ResponseTimeMax, 1,
prv_granted_handler);
// Expect granted handler to be called immediately:
cl_assert_equal_i(s_granted_count,... |
void test_bt_conn_mgr__granted_handler_request_existing(void) {
fake_gap_le_connect_params_set_actual_state(ResponseTimeMax);
conn_mgr_set_ble_conn_response_time_ext(&s_hdl, BtConsumerLeServiceDiscovery, ResponseTimeMin, 1,
prv_granted_handler);
cl_assert_equal_i(s_gran... |
gisters_CHARGE_VOLTAGE_CNTL, 0x18 | (1 << 6));
}
pmic_set_charger_state(true);
// Enable AutoResume: Resumes charging on voltage drop after EOC
prv_set_register_bit(PmicRegisters_CHARGE_CNTL, 6, true);
}
static void prv_configure_battery_measure(void) {
// Set PMIC GPIO5 (the battery measure enable pin) as... | if (prv_set_register_bit(PmicRegisters_RESET_CNTL, 1, true)) {
while (1) {}
__builtin_unreachable();
} |
return false;
}
// We have no way of directly reading Vsup with as3701b on Silk. Just assume
// that we are getting what we've configured as regulated Vsup.
uint16_t pmic_get_vsys(void) {
uint8_t cfg;
prv_read_register(PmicRegisters_CHARGE_CONFIG_1, &cfg);
const uint8_t vsup_voltage = (cfg & 0x6) >> 1;
swit... |
nd_handle_resuming_from_standby(void) {
periph_config_enable(RCC_APB1PeriphClockCmd, RCC_APB1Periph_PWR);
if (PWR_GetFlagStatus(PWR_FLAG_SB) == SET) {
// We just woke up from standby. For some reason this leaves the system in a funny state,
// so clear the flag and reboot again to really clear things up.
... | sad_watch(ERROR_RESET_LOOP) | ;
}
watchdog_init();
#ifndef NO_WATCHDOG
watchdog_start();
#endif
jump_to_fw();
}
|
/*
* 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... | graphics_context_get_current_context() | ,
text_layer);
const uint16_t font_height = fonts_get_font_height(text_layer->font);
text_layer_set_size(text_layer, (GSize) { text_layer->layer.frame.size.w, size.h + font_height });
const GSize scroll_size = scroll_layer_get_content_size(scroll_layer);
const int16_t new_height = size.h + TEXT_OFFSET_V... |
s to the app, but it won't be our fault...
static void prv_consume(AppInboxConsumerInfo *consumer_info) {
prv_lock();
{
AppInboxNode *inbox = prv_find_inbox_by_tag_and_log_if_not_found(consumer_info->tag);
if (!inbox) {
goto unlock;
}
uint8_t *const consumed_up_to_ptr = consumer_info->it;
... | sys_app_inbox_service_consume(&info) | |
State state = {0};
TimelineNode *head = NULL;
// Tue Jan 13 11:40:00 PST 2015
rtc_set_time(1421178000);
fake_pbl_malloc_clear_tracking();
cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0);
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFutur... | cl_assert(iter_next(&iterator)) | ;
cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id));
// check second again
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check fourth
cl_assert(iter_next(&iterator));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.p... |
ide(GContext *ctx, const GRect *box, const GRect *box_inset,
GColor bar_color) {
const GColor border_color = GColorBlack;
graphics_context_set_fill_color(ctx, border_color);
graphics_fill_rect(ctx, box);
graphics_context_set_fill_color(ctx, bar_color);
graphics_fill_rect(ctx,... | const int16_t next_x = prv_draw_day_bar(ctx, i, &box, bar_color, is_wide);
// Draw the day character legend
const int char_offset_y = 1;
box.origin.y = LABEL_OFFSET_Y + char_offset_y;
box.size.h = legend_line_height;
char char_buffer[] = { graph_card->day_chars[i], '\0' };
const GColor acti... |
static void prv_draw_avg_line(HealthGraphCard *graph_card, GContext *ctx, int32_t avg,
int16_t offset_x, int16_t width) {
if (avg == 0) {
return;
}
const int offset_y = LABEL_OFFSET_Y - MAX(prv_convert_to_graph_height(graph_card, avg),
... |
;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_assign_0.Xbit.pbi"));
// Top-left corner rotation point, Angle 45
setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign);
graphics_draw_rotated_bitmap(&ctx, test_image_color,
... | setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign) | ;
graphics_draw_rotated_bitmap(&ctx, test_image_color,
GPoint(30, 30), DEG_TO_TRIGANGLE(45), GPoint(20, 20));
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_color_center_45.Xbit.pbi"));
}
void test_graphics_draw_rotated_bitmap__offset_edge(void) {
GContext c... |
w_stack__cleanup(void) {
stub_pebble_tasks_set_current(PebbleTask_App);
app_window_stack_pop_all(false);
stub_pebble_tasks_set_current(PebbleTask_KernelMain);
modal_manager_pop_all();
fake_animation_cleanup();
cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0);
}
// Tests
/////////////////////////... | (windows[2]->on_screen, true) | ;
window_stack_pop_all(stack, true);
cl_assert_equal_i(window_stack_count(stack), 0);
cl_assert_equal_i(windows[0]->on_screen, false);
cl_assert_equal_i(windows[1]->on_screen, false);
cl_assert_equal_i(windows[2]->on_screen, false);
for (uint8_t idx = 0; idx < 3; idx++) {
window_destroy(windows[idx])... |
st_remove_all(void) {
mutex_lock_recursive(s_list_mutex);
DataLoggingSession *cur = s_logging_sessions;
DataLoggingSession *next;
while (cur != NULL) {
next = cur->next;
if (cur->data) {
mutex_destroy(cur->data->mutex);
kernel_free(cur->data);
}
kernel_free(cur);
cur = next;
}
... | mutex_unlock_recursive(s_list_mutex) | ;
return false;
}
logging_session = next_logging_session;
}
mutex_unlock_recursive(s_list_mutex);
return true;
}
void dls_list_init(void) {
s_list_mutex = mutex_create_recursive();
s_logging_sessions = NULL;
}
bool dls_list_is_session_valid(DataLoggingSession *logging_session) {
mutex_lock_... |
ead_return_value;
BTErrno gatt_client_op_read(BLECharacteristic characteristic,
GAPLEClient client) {
if (s_read_return_value != BTErrnoOK) {
return s_read_return_value;
}
Read *read = malloc(sizeof(Read));
*read = (const Read) {
.characteristic = characteristic,
.client... | {
cl_assert_equal_i(characteristic, s_read_head->characteristic);
cl_assert_equal_i(client, s_read_head->client);
} | else {
cl_assert_(false, "No gatt_client_op_read() has happened at all");
}
Read *old_head = s_read_head;
s_read_head = (Read *) list_pop_head(&s_read_head->node);
free(old_head);
}
void fake_gatt_client_op_set_write_return_value(BTErrno e) {
s_write_return_value = e;
}
void fake_gatt_client_op_clear_w... |
d_ignore_because_apple_mail_dot_app_bug(app_id, message)) {
PBL_LOG(LOG_LEVEL_ERROR, "Ignoring ANCS notification because Mail.app bug");
return true;
}
// Calendar and time-based Reminders app reminders are handled through the mobile app and are
// added to reminder_db, so we filter them out to avoid dou... | ancs_notifications_util_get_app_metadata(app_id) | |
ors.getter.grect(subject);
#if !PLATFORM_TINTIN
} else if (property_animation->animation.implementation->update
== (AnimationUpdateImplementation)property_animation_update_gtransform) {
// NOTE: We are not exposing the GTransform in the public SDK, so the setter and getter
// must be typ... | (dst + offset, src + offset, size) | |
/*
* 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... | {
empty_count++;
} | else {
count += empty_count + 1;
empty_count = 0;
}
data_ptr += pstring_length + size;
} while ((&((pstring16_list->pstrings)->data[(pstring16_list->pstrings)->data_size]) - data_ptr) >
1); // Need at least 2 bytes for another pstring
if (count != 0) {
count += empty_count;
}
... |
!has_short_subtitle);
prv_add_weather_pin_with_params(-60 * 60, has_timestamp, has_short_title, has_short_subtitle);
// Peek pins
prv_add_calendar_pin(5 * 60, 60, !is_all_day, recurring, 0, 0);
prv_add_weather_pin(10 * 60 + 15);
prv_add_sports_pin(10 * 60 + 17, GColorWhite, !is_... | (&option_menu->window, animated) | ;
#endif
}
static void prv_main(void) {
prv_handle_init();
app_event_loop();
}
const PebbleProcessMd* timeline_pins_get_app_info(void) {
static const PebbleProcessMdSystem s_app_info = {
.common = {
.main_func = prv_main,
// UUID: c53a79d7-3472-4062-a7d0-39ada9bfa415
.uuid = ... |
GCompOpAssign);
graphics_draw_rotated_bitmap(&ctx, test_image_bw,
GPointZero, DEG_TO_TRIGANGLE(45), GPoint(20, 20));
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_bw_corner_45.Xbit.pbi"));
// Top-left center rotation point, Angle 45
setup_test_rotate_bit... | (&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_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign);
graphics_draw_rotated_bitmap(&ctx, test_image_color,
... |
/*
* 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(flash_written_data);
free(flash_written_flag);
} |
void test_system_flash__erase_zero_bytes(void) {
cl_assert(system_flash_erase(FLASH_BASE, 0, NULL, NULL));
cl_assert_equal_i(0, erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_one_byte(void) {
cl_assert(system_flash_erase(FLASH_BASE, 1, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(... |
(PebbleTask_App, real_callback, NULL) | ;
}
static void prv_update_state(GettingStartedButtonComboState *state) {
const uint32_t COMBO_HOLD_MS = 5 * 1000; // Wait for 5 seconds
// Map of button combos -> callback to call if we hit it.
const struct {
uint8_t desired_bitset;
void (*callback)(void*);
} BUTTON_COMBOS[] = {
{ (1 << BUTTON_ID... | |
= name,
.value = value,
.icon_info = &icon_res_info,
.icon_layer = i == 0 ? &layout->icon_layer :
layout->metric_icon_layers[i - 1],
},
};
GTextNodeText *metric_node =
(GTextNodeText *)layout_create_text_node_from_config(
layout_r... | kino_layer_get_alignment(kino_layer) | , false);
frame.origin.y = box->origin.y;
layer_set_frame(&kino_layer->layer, &frame);
}
if (size_out) {
*size_out = frame.size;
}
}
GTextNodeCustom *layout_node_create_kino_layer_wrapper(KinoLayer *kino_layer) {
return graphics_text_node_create_custom(prv_kino_layer_wrapper_callback, (void *)kino_... |
m);
} else {
const bool use_pin = false;
prv_setup_peek_animation(data, &first_timeline_layout->icon_info, use_pin);
}
}
static void NOINLINE prv_setup_peek(TimelineAppData *data) {
TimelineIterState *state = timeline_model_get_current_state();
TimelineItem *first_pin = state ? &state->pin : NULL;
Ev... | layer_add_child(&window->layer, (Layer *)timeline_layer) | |
);
}
void test_ppogatt__cap_number_of_data_packets_in_flight(void) {
test_ppogatt__open_session_when_found_pebble_app();
uint8_t sn = 0;
Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid);
// Get s_rx_window_size packets in flight:
for (sn = 0; sn < s_tx_window_size; ++sn) {
con... | fake_comm_session_send_buffer_write_raw_by_transport(transport,
s_short_data_fragment,
sizeof(s_short_data_fragment)) | |
// Attribute 1 Length
// Attribute text:
'L', 'i', 'k', 'e',
0x07, // Attribute 2 ID - ANCS UID
0x01, 0x00, // Attribute 2 Length
// Attribute text: "Test"
0x01
};
static uint8_t attr_list3_serialized[] = {
// Attribute 1
0x01, /... | attribute_get_string(&list2, AttributeIdBody, "") | , "Body");
// check that the pointers have moved
cl_assert(attribute_get_string(&list2, AttributeIdTitle, "") !=
attribute_get_string(&list, AttributeIdTitle, ""));
cl_assert(attribute_get_string(&list2, AttributeIdSubtitle, "") !=
attribute_get_string(&list, AttributeIdSubtitle, ""));
cl_assert(attrib... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.