prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
/*
* 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... | text_layer_get_layer(localtime_layer) | );
char localtime_strftime_buf[32];
strftime(localtime_strftime_buf, 32, "%z %Z", lt_time);
APP_LOG(APP_LOG_LEVEL_DEBUG, "localtime: %s", localtime_strftime_buf);
}
static void window_unload(Window *window) {
text_layer_destroy(time_layer);
text_layer_destroy(gmtime_layer);
text_layer_destroy(localtime_la... |
it->it.menu_layer, &it->cell_layer, &it->it.cursor, it->ctx);
// Draw the separator on top of the cell
if (top_diff >= it->it.cursor.sep) {
prv_menu_layer_draw_separator(it->it.menu_layer, &it->cell_layer, &it->it.cursor, it->ctx);
}
// Update the cache with the center-most row
it->it.cursor.y... | { // rows
// Previous row
if (it->cursor.index.row == 0) {
// Reached top-most row in current section
break;
}
--(it->cursor.index.row);
if (it->row_callback_before_geometry) {
it->row_callback_before_geometry(it);
}
// when walking upwards, selected_i... | // for() rows
if (it->cursor.index.row == 0) {
// If top-most row, layout the section header
it->cursor.h = prv_menu_layer_get_header_height(it->menu_layer, it->cursor.index.section);
it->cursor.sep = prv_menu_layer_get_separator_height(it->menu_layer, &it->cursor.index);
if (it->cursor.h... |
t int16_t cell_height =
PBL_IF_ROUND_ELSE(selected ? MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT :
MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT,
style->cell_heights[content_type]);
return cell_height ?: menu_cell_basic_cell_height();
}
static int16_t prv_g... | {
option_menu->callbacks.select(option_menu, option_menu->choice, option_menu->context);
} |
}
static void prv_window_load(Window *window) {
OptionMenu *option_menu = window_get_user_data(window);
menu_layer_set_callbacks(&option_menu->menu_layer, option_menu, &(MenuLayerCallbacks) {
.get_cell_height = prv_get_cell_height_callback,
.get_num_rows = prv_get_num_rows_callback,
.draw_row =... |
Sample *minute_data,
bool simulate_bg_delays) {
// Call the minute handler, which computes the minute stats and saves them to data logging
// as well as the sleep PFS file.
for (int i = 0; i < num_minutes; i++) {
fake_rtc_increment_time(SECONDS_PER_MINUTE);
s_alg_next_step... | (actual->vmc, expected->base.vmc) | |
*
* 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 in... | system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL) | );
cl_assert(flash_locked);
}
void error_in_middle_cb(uint32_t num, uint32_t den, void *context) {
int *countdown = context;
if ((*countdown)-- == 0) {
return_status = FLASH_ERROR_OPERATION;
}
}
void test_system_flash__handle_erase_error_mid_operation(void) {
int countdown = 3;
cl_assert(!system_flash... |
&ctx.dest_bitmap, "draw_pixel_inside_offset_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &outside_x_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(framebuffer_is_empty("outside_x_offset_layer", ctx.parent_framebuffer, GColorWhite));
... | (p.x + 6, p.y + 1) | );
graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y + 1));
graphics_draw_pixel(ctx, GPoint(p.x + 0, p.y + 2));
graphics_draw_pixel(ctx, GPoint(p.x + 1, p.y + 2));
graphics_draw_pixel(ctx, GPoint(p.x + 2, p.y + 2));
graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y + 2));
graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y... |
].angle, TRIG_MAX_ANGLE);
stroke_width += 1;
radius += 3;
pt.x += (radius + stroke_width) * 2;
if (pt.x > 120) {
pt.x = CENTER_OF_ORIGIN_RECT.x;
pt.y += (radius + stroke_width) * 2;
}
}
char filename[100];
snprintf(filename, sizeof(filename),
"dra... | (TO_TRIG(0), TO_TRIG(0)) | , ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerNone},
.full_quadrants = GCornerNone,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerNone}
}));
// Tests for 360° angle
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(0), TO_TRIG(360)), ((Elli... |
list->attributes[i].uint32_list, attribute->length);
break;
default:
attribute->length = 0;
break;
}
buffer += attribute->length;
PBL_ASSERTN(buffer <= buf_end);
}
return buffer - buf_start;
}
bool attribute_deserialize_list(char **buffer, char *const buf_end,
... | {
PBL_LOG(LOG_LEVEL_WARNING, "Adding attribute with type cstring for non-cstring attribute");
} | |
EST_PBI_FILE));
}
void test_action_menu_window__wide_display_mode_with_chevron(void) {
ActionMenuLevel *root_level = action_menu_level_create(3);
ActionMenuLevel *voice_level = action_menu_level_create(1);
action_menu_level_add_action(voice_level,
"This won't be seen",
... | (s_dest_bitmap, TEST_PBI_FILE) | );
}
void test_action_menu_window__wide_display_mode_with_separator(void) {
ActionMenuLevel *root_level = action_menu_level_create(3);
action_menu_level_add_action(root_level,
"Change Time",
prv_noop_action_callback,
NULL)... |
/*
* 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... | QSPI_ClearFlag(QSPI_FLAG_TC) | ;
}
}
static void prv_wait_for_qspi_not_busy(void) {
while (QSPI_GetFlagStatus(QSPI_FLAG_BUSY) != RESET) { }
}
static void prv_quad_enable() {
QSPI_ComConfig_InitTypeDef qspi_com_config;
QSPI_ComConfig_StructInit(&qspi_com_config);
qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Write;
... |
b vs unsub calls should be the same, there should be no subscription any more
// after de-initing:
cl_assert_equal_i(s_sys_hrm_manager_unsubscribe_call_count,
s_hrm_manager_subscribe_with_callback_call_count);
fake_pbl_malloc_check_net_allocs();
// Assert all regular timers are deregistere... | prv_assert_event_service_subscribed(true) | ;
cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 1);
cl_assert_equal_i(s_sys_hrm_manager_unsubscribe_call_count, 0);
// Device A disconnects, shouldn't unsubscribe from HRM manager because A is still subscribed:
ble_hrm_handle_disconnection(&s_conn_a);
cl_assert_equal_b(false, ble_hrm_is... |
/*
* 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 (PRIVILEGE_WAS_ELEVATED) {
if (pebble_task_get_current() == PebbleTask_Worker) {
// not allowed from workers
syscall_failed();
}
if (!memory_layout_is_cstring_in_region(memory_layout_get_app_region(), string, 100) &&
!memory_layout_is_cstring_in_region(memory_layout_get_microflash_reg... | |
nu->status_colors.foreground);
}
void option_menu_set_normal_colors(OptionMenu *option_menu, GColor background, GColor foreground) {
option_menu->normal_colors.background = background;
option_menu->normal_colors.foreground = foreground;
menu_layer_set_normal_colors(&option_menu->menu_layer,
... | (&option_menu->window) | ;
gbitmap_deinit(&option_menu->chosen_image);
gbitmap_deinit(&option_menu->not_chosen_image);
}
OptionMenu *option_menu_create(void) {
OptionMenu *option_menu = applib_type_malloc(OptionMenu);
if (!option_menu) {
return NULL;
}
option_menu_init(option_menu);
return option_menu;
}
void option_menu_d... |
r completed in the time between starting the erase
// and polling the status register, or the erase was never started. The
// former case could be due to a context switch at the worst time and
// subsequent task starvation, or being run in QEMU. The latter could be
// due to a software bug or ha... | prv_read_words_pio(buff_ptr, (uint16_t*)(flash_data_addr + bytes_read), num_words) | ;
bytes_read += num_words*2;
} else {
// Not aligned - read into temporary buffer and copy over
__IO uint16_t *flash_data_region = (__IO uint16_t*)(flash_data_addr + bytes_read);
uint32_t num_words = (buffer_size - bytes_read) / 2;
for (uint32_t words_read = 0; words_read < num_words; ... |
;
stop_mode_enable(InhibitorFlash);
xSemaphoreGive(s_flash_state.dma_semaphore);
}
void DMA2_Stream0_IRQHandler(void) {
if (DMA_GetITStatus(FLASH_DMA_STREAM, DMA_IT_TCIF3)) {
DMA_ClearITPendingBit(FLASH_DMA_STREAM, DMA_IT_TCIF3);
NVIC_DisableIRQ(FLASH_DMA_IRQn);
signed portBASE_TYPE was_higher_priori... | (s_flash_state.mutex) | |
eck_type)(const jerry_value_t argv[], RockyArgTypeCheckError *type_error_out);
uint8_t expected_num_args;
} RockyArgAssignImp;
static bool prv_check_value_number_within_bounds(RockyArgType type, const double *val,
RockyArgValueCheckError *value_error_out) {
const st... | {
prv_convert_to_string_and_apply(argv[0], prv_malloc_and_assign_string_applier, binding);
return true;
} | |
te_sun();
gdraw_command_image_attract_to_square(l, t += dt);
gdraw_command_image_draw(&ctx, l, GPoint(48, 96));
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "test_gdraw_command_transforms__to_square.8bit.pbi"));
}
// re-enable this "test" to debug per-frame transitions
void _test_gdraw_command_transforms__to_squar... | gdraw_command_image_draw(&ctx, l, GPoint(0, 144)) | ;
l = weather_app_resource_create_sun();
gdraw_command_image_scale_segmented_to(l, from, to, t += dt, interp, index_lookup, f, false);
gdraw_command_image_draw(&ctx, l, GPoint(0, 192));
free(index_lookup);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "test_gdraw_command_transforms__segmented_scale.8bit.pbi"))... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (menu_items) |
}
};
s_main_window_data.menu_layer = simple_menu_layer_create(bounds, window, sections, ARRAY_LENGTH(sections), NULL);
layer_add_child(window_layer, simple_menu_layer_get_layer(s_main_window_data.menu_layer));
}
static void window_unload(Window *window) {
simple_menu_layer_destroy(s_main_window_data.men... |
cs/gdraw_command_private.h"
#include "applib/graphics/graphics.h"
#include "applib/graphics/graphics_line.h"
#include "applib/graphics/gtypes.h"
#include "applib/graphics/framebuffer.h"
#include "applib/ui/animation.h"
#include "applib/ui/animation_timing.h"
#include "applib/ui/animation_interpolate.h"
#include "appli... | (-255, 10, 10, 10, 0, -255, ANIMATION_NORMALIZED_MAX,
interp) | |
/*
* 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 false;
} |
if (endpoint_id != TIMELINE_ACTION_ENDPOINT) {
return false;
}
cl_assert_equal_m(s_expected_send_data, data, length);
s_sent_action = true;
return true;
}
static void prv_support_sms_replies(void) {
// Store the preference in our DB
char *key = "com.apple.MobileSMS";
int key_len = strlen(key);
... |
t num_samps = s_le_conn_params.num_samps;
if (num_samps != 0) {
params[0] = s_le_conn_params.slave_latency_events / num_samps;
params[1] = s_le_conn_params.supervision_to_ms / num_samps;
}
s_le_conn_params = (LeConnectionParams){};
}
static void prv_update_conn_params(uint16_t slave_latency_events,
... | analytics_add(ANALYTICS_DEVICE_METRIC_BLE_RSSI_SUM,
ABS(rssi), AnalyticsClient_System) | ;
}
}
void bluetooth_analytics_handle_disconnect(bool local_is_master) {
if (!local_is_master) {
analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_TIME);
analytics_stopwatch_stop(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_ENCRYPTED_TIME);
prv_update_conn_event_timer(0, true);
}
}
void bluetooth... |
.compositing_mode = compositing_mode,
.tint_color = tint_color,
};
}
// Helpers
///////////////////////
static void cl_assert_equal_rect(const GRect a, const GRect b) {
cl_assert_equal_i(a.origin.x, b.origin.x);
cl_assert_equal_i(a.origin.y, b.origin.y);
cl_assert_equal_i(a.size.w, b.size.w);
cl_asser... | cl_assert(ctx->draw_state.compositing_mode == COMPOSITING_MODE_TO_SPECIFY_IN_PRE_FUNCTION) | ;
cl_assert(gcolor_equal(ctx->draw_state.tint_color, TINT_COLOR_TO_SPECIFY_IN_PRE_FUNCTION));
// Reverse the changes to the GContext that were made in .pre
ctx->draw_state.compositing_mode = processor_with_data->previous_compositing_mode;
ctx->draw_state.tint_color = processor_with_data->previous_tint_color;
... |
ecting_passert = false;
bool clar_passert_occurred = false;
jmp_buf clar_passert_jmp_buf;
static void fs_rm(const char *_source);
static void fs_copy(const char *_source, const char *dest);
static const char *
fixture_path(const char *base, const char *fixture_name);
struct clar_error {
const char *test;
int tes... | {
const struct clar_func *test = suite->tests;
size_t i;
if (!clar_category_is_suite_enabled(suite))
return;
if (_clar.exit_on_error && _clar.total_errors)
return;
if (!_clar.report_errors_only)
clar_print_onsuite(suite->name, suite->index);
clar_on_suite();
_clar.active_suite = suite->nam... |
#if 0 /* temporarily disabled */
static void
clar_run_single(const struct clar_func *test,
const struct clar_suite *suite)
{
_clar.suite_errors = 0;
_clar.active_suite = suite->name;
_clar.active_test = test->name;
clar_run_test(test, &suite->initialize, &suite->cleanup);
}
#endif
static void
clar_usage(c... |
232, -8, -224},
{ -1152, -64, -280},
{ -1448, 56, -408},
{ -1416, -120, -272},
// 23 seconds
{ -1240, -128, -336},
{ -1208, 40, -240},
{ -1240, 168, -72},
{ -1288, 288, -40},
{ -1288, 328, -64},
{ -1264, 624, -112},
{ -1104, 648, -320},
{ -952, 520, -232},
{ -1256, 66... | { -1264, -112, -184},
{ -1336, -168, 40},
{ -1232, 40, 8},
{ -1112, 232, 72},
{ -1096, 376, 120},
{ -1176, 416, 80},
{ -1248, 416, -40},
{ -1184, 424, -32},
{ -1240, 752, -48},
{ -1160, 336, -16},
{ -1536, 496, -96},
{ -1360, 512, -128},
{ -1056, 432, -368},
{ -12... |
{ -1536, 376, -208},
{ -1152, 400, -280},
{ -1320, 336, -192},
{ -1496, 320, -56},
{ -1536, 304, -56},
// 31 seconds
{ -1296, 312, -48},
{ -1200, 224, 16},
{ -1200, 192, 56},
{ -1064, 176, 24},
{ -912, 264, -48},
{ -848, 200, 104},
{ -784, -56, -64},
{ -696, 560,... |
ze < total_size) {
return false;
}
total_size += attribute->length;
if (data_size < total_size) {
return false;
}
}
if (data_size != total_size) {
return false;
}
// check to see all indices point to valid notes
GenericAttribute *notes_attribute = generic_attribute_find_attrib... | {
uint16_t *repeat_delay = (uint16_t *) repeat_delay_attribute->data;
return *repeat_delay;
} |
return 0;
}
void vibe_score_do_vibe(VibeScore *score) {
PBL_ASSERTN(score);
GenericAttribute *notes_attribute = generic_attribute_find_attribute(&score->attr_list,
VibeAttributeId_Notes,
... |
ute = 30, .kind = ALARM_KIND_WEEKDAYS });
prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule);
// Only 1 pin should be added (for Friday)
cl_assert_equal_i(s_num_timeline_adds, 1);
}
void test_alarm__recurring_weekday_alarm(void) {
AlarmId id1, id2;
id1 = alarm_create(&(AlarmI... | (s_num_timeline_adds, 2) | ;
// First alarm goes off. Second one should be up
s_current_hour = 10;
s_current_minute = 30;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 1);
prv_assert_alarm_config(id1, 10, 30, true, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday);
cl_assert_equal_i(s_num_alarm_events_put, 1);
cl... |
mentLeft, NULL);
graphics_draw_text(&gcontext, "\n\n", font, box,
GTextOverflowModeFill, GTextAlignmentLeft, NULL);
graphics_draw_text(&gcontext, "\1\n", font, box,
GTextOverflowModeFill, GTextAlignmentLeft, NULL);
graphics_draw_text(&gcontext, "", font, box,
... | (attributes) | ;
}
void test_text_layout__get_default_flow_data(void) {
const TextLayoutFlowData *data1 = graphics_text_layout_get_flow_data(NULL);
cl_assert(data1 != NULL);
cl_assert_equal_p(data1->perimeter.impl, NULL);
cl_assert_equal_i(data1->paging.page_on_screen.size_h, 0);
// change SP so that we can make sure that... |
,
{ 1088, 528, -40},
// 50 seconds
{ 936, 328, 144},
{ 904, 272, 176},
{ 896, 280, 184},
{ 872, 344, 136},
{ 832, 336, 104},
{ 864, 360, 32},
{ 888, 392, -8},
{ 936, 376, -24},
{ 1088, 384, -16},
{ 1152, 408, 24},
{ 1560, 416, 72},
{ 1592, 496, 96},
{ 1032, 41... | { 864, 456, 32},
{ 768, 288, 88},
{ 776, 240, 136},
{ 768, 272, 120},
{ 736, 328, 160},
{ 744, 360, 248},
// 56 seconds
{ 752, 656, 184},
{ 800, 616, 296},
{ 912, 496, 360},
{ 1088, 408, 504},
{ 1416, 424, 472},
{ 1600, 432, 416},
{ 1072, 512, 224},
{ 920, 272... |
{ 1744, 616, 200},
{ 1456, 728, 200},
{ 888, 656, -16},
{ 792, 256, 16},
{ 760, 112, 128},
{ 768, 224, 64},
{ 704, 248, 64},
{ 760, 288, 16},
{ 712, 240, 120},
{ 720, 280, 112},
{ 728, 256, 104},
{ 872, 208, 152},
// 59 seconds
{ 1032, 264, 112},
{ 1104, 264,... |
sForMock *last_args) {
memcpy(actual_args, last_args, sizeof(ArgsForMock));
}
// Zero out the arguments from the last run
static void reset_last_args_for_mock() {
memset(&s_last_args_for_mock, 0x00, sizeof(s_last_args_for_mock));
}
// Validate the arguments based on the shape that is drawn
static bool validate_ar... | (context.draw_state.stroke_color, GColorBlack) | |
} else if (uid == attribute_at_end_uid) {
prv_fake_receiving_ds_notification(ARRAY_LENGTH(memory_with_attribute_id_at_end.attribute_data), (uint8_t*) memory_with_attribute_id_at_end.attribute_data);
prv_fake_receiving_ds_notification(ARRAY_LENGTH(memory_with_attribute_id_at_end_p2), (uint8_t*) memory_with_att... | {
ancs_destroy();
cl_assert_equal_i(regular_timer_seconds_count(), 0);
cl_assert_equal_i(regular_timer_minutes_count(), 0);
regular_timer_deinit();
} |
// Janky black box smoke-test to exercise the ANCS message re-assembly state
// machine
void test_ancs__should_handle_small_and_large_messages(void) {
// Get 4 complete notifications
prv_send_notification((uint8_t *)&s_complete_dict);
prv_send_notification((uint8_t *)&s_complete_dict);
prv_send_notification((... |
)) {
return true;
}
PBL_LOG(LOG_LEVEL_WARNING, "App requires support for SDK version (%"PRIu8".%"PRIu8"), "
"we only support version (%"PRIu8".%"PRIu8").",
entry.sdk_version.major, entry.sdk_version.minor,
(uint8_t) PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR,
... | if (!app_manager_is_app_supported(md)) {
PBL_LOG(LOG_LEVEL_WARNING, "Tried to launch an app with an unsupported SDK version.");
AppInstallEntry entry;
if (!app_install_get_entry_for_install_id(id, &entry)) {
// can't retrieve app install entry for id
PBL_LOG(LOG_LEVEL_ERROR, "Failed to... |
}
#endif
if (is_worker) {
worker_manager_launch_new_worker_with_args(md, NULL);
} else {
app_manager_launch_new_app(&(AppLaunchConfig) {
.md = md,
.common = config->common,
.forcefully = config->forcefully,
});
}
}
// -------------------------------------------------------------... |
1234567890123456789";
mfg_info_set_model(long_string);
// We only expect to see the first 15 (MFG_INFO_MODEL_STRING_LENGTH - 1) characters
mfg_info_get_model(buffer);
cl_assert_equal_s(buffer, "012345678901234");
}
}
void test_spalding_mfg_info__1_to_2_conversion(void) {
// Force in an old dat... | mfg_info_get_disp_offsets() | .y, 0);
// Set x and y offsets and make sure others don't change.
mfg_info_set_disp_offsets((GPoint) {-2, 1});
cl_assert_equal_i(mfg_info_get_disp_offsets().x, -2);
cl_assert_equal_i(mfg_info_get_disp_offsets().y, 1);
cl_assert_equal_i(mfg_info_get_watch_color(), 3);
cl_assert_equal_i(mfg_info_get_... |
status;
if (mark_as_synced) {
settings_file_mark_synced(&storage->file, key, key_len);
}
mutex_unlock(storage->mutex);
return rv;
}
int timeline_item_storage_get_len(TimelineItemStorage *storage,
const uint8_t *key, int key_len) {
mutex_lock(storage->mutex);
status_t rv = settings_file_get_len(&... | (storage->mutex) | ;
status_t rv = settings_file_rewrite(&storage->file, prv_flush_rewrite_cb, NULL);
mutex_unlock(storage->mutex);
return rv;
}
|
/*
* 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_will_return(bt_driver_set_local_address, 0) | ;
s_last_bt_persist_pinned_addr_is_null = true;
bt_local_addr_init();
}
static void prv_assert_driver_addr_is_null(void) {
cl_assert_equal_b(s_last_driver_addr_is_null, true);
cl_assert_equal_m(&s_last_driver_addr, &(BTDeviceAddress){}, sizeof(s_last_driver_addr));
}
static void prv_assert_driver_addr_is_addr... |
ght_callback(struct MenuLayer *menu_layer,
MenuIndex *cell_index,
void *callback_context) {
return menu_cell_basic_cell_height();
}
static void prv_alarm_list_draw_row_callback(GContext *ctx, const Layer *ce... | alarm_get_string_for_kind(node->info.kind, all_caps) | , data);
} else {
alarm_get_string_for_custom(node->scheduled_days, alarm_day_text);
config.subtitle = alarm_day_text;
}
menu_cell_layer_draw(ctx, cell_layer, &config);
}
static void prv_alarm_list_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index,
vo... |
enses/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 permissions and
* limitatio... | {
QueueHandle_t queue;
switch (task) {
case PebbleTask_KernelMain:
queue = event_get_to_kernel_queue(pebble_task_get_current());
break;
case PebbleTask_Worker:
queue = worker_manager_get_task_context()->to_process_event_queue;
break;
case PebbleTask_App:
queue = app_manager... |
void pebble_task_create(PebbleTask pebble_task, TaskParameters_t *task_params,
TaskHandle_t *handle) {
MpuRegion app_region;
MpuRegion worker_region;
switch (pebble_task) {
case PebbleTask_App:
mpu_init_region_from_region(&app_region, memory_layout_get_app_region(),
... |
//pebbletechnology.atlassian.net/wiki/display/DEV/PBW+3.0
#if PLATFORM_TINTIN || PLATFORM_SILK || UNITTEST
#define APP_SPACE_BUFFER KiBYTES(300)
#else
#define APP_SPACE_BUFFER MiBYTES(4)
#endif
#define MAX_PRIORITY ((uint32_t)~0)
// 4 quick launch apps, 1 default watchface, 1 default worker
#define DO_NOT_EVICT_LIST_... | list_init((ListNode *)node) | ;
// give them an extremely high priority so that we only remove them if we really NEED to
// This list contains defaults that we shouldn't be removing.
uint32_t priority = 0;
if (prv_is_in_list(id, data->do_not_evict, DO_NOT_EVICT_LIST_SIZE)) {
priority = MAX_PRIORITY;
}
*node = (EvictListNode) {
... |
rev_to_rel_bar_value);
} else if ((layer->relbar_layer.prev_rel_bar.rel_bar_type == RelationshipBarTypeBackToBack) ||
(layer->relbar_layer.prev_rel_bar.rel_bar_type == RelationshipBarTypeFreeTime)) {
layer->relbar_layer.prev_rel_bar.anim_offset = REL_BAR_PREV_ANIM_OFFSET;
prev_from_rel_bar_value ... | prv_get_line_length(timeline_layer, &first_icon_frame,
&second_icon_frame) | - REL_BAR_LINE_WIDTH) / 2;
// Draw two lines that are centered in the side bar
// Bar 1
// Filled rect used to draw line of REL_BAR_LINE_WIDTH stroke width
graphics_context_set_fill_color(ctx, GColorWhite);
GRect layer_bounds = timeline_layer->layer.bounds;
GRect line;
line.origin.x = layer_bounds.origi... |
/*
* 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... | ("4294967287") | |
tt_op(conn, context_ref, resp_dest, op_type);
return true;
}
static bool prv_pop_errored_op(uint16_t conn_idx) {
Connection *conn = connection_by_idx(conn_idx);
if (!conn) {
PBL_LOG(LOG_LEVEL_WARNING, "Failed to find connection during queue pop attempt");
return false;
}
connection_pop_gatt_op(conn);... | (conn, addr) | ;
return resp_dest;
}
void gatt_wrapper_handle_read_completed(const ble_evt_gattc_read_completed_t *evt) {
BTDeviceInternal addr;
uintptr_t context_ref;
GATT_LOG_DEBUG("gatt_wrapper_handle_read_completed: handle: %d, status: %d",
evt->handle, evt->status);
const BLEGATTError status = (BLEGAT... |
/*
* 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 ARRAY_LENGTH(s_delta_moook_in) * ANIMATION_TARGET_FRAME_INTERVAL_MS;
} | |
onnect_connect_by_bonding(BT_BONDING_ID_INVALID,
true /* auto_reconnect */,
false /* is_pairing_required */,
GAPLEClientApp);
cl_assert_equal_i(e, BTErrnoInvalidParameter);
}... | (registered, true) | ;
// Try registering the device again for different client:
e = gap_le_connect_connect(&device,
true /* auto_reconnect */,
false /* is_pairing_required */,
GAPLEClientKernel);
cl_assert_equal_i(e, BTErrnoOK);
// Assert registr... |
/*
* 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... | for (int i = 0; i < metric_values->num_values; i++) {
cl_assert_equal_i(metric_values->values[i], other->values[i]);
} |
const size_t serialized_size = attribute_list_get_serialized_size(&attr_list);
cl_assert_equal_i(serialized_size, 19);
uint8_t serialized_buffer[serialized_size];
attribute_list_serialize(&attr_list, serialized_buffer, &serialized_buffer[serialized_size]);
const size_t buffer_size = attribute_list_get_stri... |
/*
* 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, 144, 168) | ,
},
};
static const GRect BITMAP_LAYER_FRAME = GRect(0, 0, 640, 64);
static const GRect BITMAP_LAYER_BOUNDS = GRect(-32, 0, 640, 64);
static const GRect BITMAP_BOUNDS = GRect(0, 0, 640, 64);
GBitmap bitmap = {
.bounds = BITMAP_BOUNDS,
};
BitmapLayer layer;
bitmap_layer_init(&layer, &BITMAP_LA... |
bool is_adding) {
// If there are already connection intents, cancel connecting briefly,
// otherwise it's illegal to modify the white-list.
prv_stop_connecting();
// Mutate white-list:
prv_mutate_whitelist(device, is_adding);
// Start/continue connecting:
prv_start_connecting_if_need... | if (is_pairing_required && !is_already_encrypted) {
if (local_is_master) {
// TODO:
// - Check if pairing process is on-going, if so, do nothing
// - If not on-going, kick it off (we're the master)
// See https://pebbletechnology.atlassian.net/browse/PBL-6850
} else {
// Pebble is ... |
// Notify client of the virtual connection:
prv_update_clients(intent, HciStatusCode_Success,
is_already_encrypted ? GAPLEConnectionEventConnectedAndEncrypted :
GAPLEConnectionEventConnectedNotEncrypted);
return BTErrnoOK;
}
// -------------------------... |
animation_unschedule(animation) | ;
}
}
Animation *timeline_layer_create_up_down_animation(TimelineLayer *layer, uint32_t duration,
InterpolateInt64Function interpolate) {
Animation *animation = prv_create_up_down_animation(layer, duration, interpolate);
animation_set_handlers(animation, (Anima... | |
s_activity_reward_state.common.last_triggered_utc);
// Recalculate metric stats
activity_insights_recalculate_stats();
// If the pin we loaded was created on the previous day, we don't bother loading the UUID
const time_t midnight_today = time_util_get_midnight_of(now_utc);
if (time_util_... | rtc_get_time() | ;
for (int i = 0; i < ActivationDelayInsightTypeCount; i++) {
prv_trigger_activation_delay_insight(now_utc, &ACTIVATION_DELAY_INSIGHTS[i]);
}
}
static void prv_test_push_walk_run_session(void *unused) {
const time_t now_utc = rtc_get_time();
ActivitySession walk_session = {
.type = ActivitySessionType_... |
"Sunday"
prv_format_time(buffer, buf_size, i18n_noop("%A"), timestamp);
} else {
// Otherwise use "Month Day", aka "June 21"
prv_format_time(buffer, buf_size, i18n_noop("%B %d"), timestamp);
}
}
enum {
RoundTypeHalfUp,
RoundTypeHalfDown,
RoundTypeAlwaysUp,
RoundTypeAlwaysDown,
};
static time_... | (rtc_get_time()) | ;
time_t timestamp_midnight = time_util_get_midnight_of(timestamp);
if (today_midnight != timestamp_midnight) {
prv_clock_get_full_relative_time(buffer, buf_size, timestamp, capitalized, with_fulltime);
} else if (difference >= (SECONDS_PER_HOUR * max_relative_hrs)) {
prv_clock_get_full_relative_time(bu... |
handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped... | (b, delay_b) | ;
animation_set_play_count(b, play_count_b);
// Create a spawn
Animation *spawn = animation_spawn_create(a, b, NULL);
cl_assert(spawn != NULL);
animation_set_delay(spawn, delay_spawn);
animation_set_play_count(spawn, play_count_spawn);
// Check durations
cl_assert_equal_i(animation_get_duration(a, fa... |
/*
* 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... | gpio_release(pin_config.gpio) | ;
}
//! Configure bus pins for use by I2C peripheral
//! Lock bus and peripheral config access before configuring pins
static void bus_pin_cfg_i2c(AfConfig pin_config) {
gpio_use(pin_config.gpio);
GPIO_InitTypeDef gpio_init_struct;
gpio_init_struct.GPIO_Pin = pin_config.gpio_pin;
gpio_init_struct.GPIO_Mode = ... |
/*
* 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... | gbitmap_create_blank(s10, GBitmapFormat2BitPalette) | ;
cl_assert(NULL != bmp);
cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette
bmp = gbitmap_create_blank(s10, GBitmapFormat4BitPalette);
cl_assert(NULL != bmp);
cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette
bmp = gbitmap... |
ist:
const size_t alloc_size = sizeof(GAPLEConnectionIntent) +
(request->is_bonding_based ? sizeof(GAPLEConnectionIntentBonding) : 0);
intent = (GAPLEConnectionIntent *) kernel_malloc(alloc_size);
if (!intent) {
return BTErrnoNotEnoughResources;
}
memset(intent, 0,... | if (should_remove_and_free) {
// Delete the intent:
prv_intent_remove_and_free(intent);
} | |
/*
* 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... | attribute_get_buffer_size_for_serialized_attributes(
attributes_per_group_type_element_out[i], &data, end) | ;
if (result < 0) {
return false;
}
*string_alloc_size_out += result;
}
return true;
}
bool attribute_group_parse_serial_data(AttributeGroupType type,
uint8_t num_attributes,
uint8_t num_group_type_elements,
... |
s_screenshot_in_progress = false;
}
static void prv_request_fast_connection(CommSession *session) {
comm_session_set_responsiveness(session, BtConsumerPpScreenshot, ResponseTimeMin,
MIN_LATENCY_MODE_TIMEOUT_SCREENSHOT_SECS);
}
static uint32_t prv_framebuffer_next_chunk(FrameBuffe... | (state->framebuffer.width) | |
}
//! Decode a bit more information out about an event and pack it into a uint32_t
static uint32_t prv_get_fancy_type_from_event(const PebbleEvent *event) {
if (event->type == PEBBLE_CALLBACK_EVENT) {
return (uint32_t) event->callback.callback;
}
return event->type;
}
static void prv_log_event_put_failure... | if (result) {
s_current_event = prv_get_fancy_type_from_event(event);
return true;
} |
// Wait for either the from_app, from_worker, or kernel queue to be ready.
QueueSetMemberHandle_t activated_queue = xQueueSelectFromSet(s_system_event_queue_set,
milliseconds_to_ticks(timeout_ms));
if (!activated_queue) {
return false;
}
// ... |
ocky_global_init(s_api);
EXECUTE_SCRIPT(
"var d = new Date();\n"
"var s = d.toLocaleTimeString();\n"
);
ASSERT_JS_GLOBAL_EQUALS_S("s", "20:04:05");
s_time += 4 * SECONDS_PER_HOUR;
EXECUTE_SCRIPT(
"var d = new Date();\n"
"var s = d.toLocaleTimeString();\n"
);
ASSERT_JS_GLOBAL_EQUALS_S("s... | rocky_global_init(s_api) | ;
EXECUTE_SCRIPT("var d = new Date();");
EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: 'numeric'});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "25");
EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {day: '2-digit'});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "25");
EXECUTE_SCRIPT("s = d.toLocaleDateString(... |
ngHeader;
// indicates the region is erased and no logs are stored in it
#define LOG_MAGIC_PAGE_FREE 0xffffffff
#define LOG_MAGIC 0x21474F4C /* LOG! */
#define LOG_VERSION 0x1
typedef struct PACKED {
uint8_t flags;
uint8_t length;
} LogRecordHeader;
#define LOG_FLAGS_VALID (0x1 << 0)
typedef struct {
uint32... | flash_get_sector_base_address(addr) | ;
#elif PLATFORM_SILK || PLATFORM_CALCULUS || PLATFORM_ROBERT
return flash_get_subsector_base_address(addr);
#else
#error "Invalid platform!"
#endif
}
static void prv_erase_unit(uint32_t addr) {
#if PLATFORM_SNOWY || PLATFORM_SPALDING
flash_erase_sector_blocking(addr);
#elif PLATFORM_SILK || PLATFORM_CALCULUS || P... |
/pbl_malloc.h"
#include "process_state/app_state/app_state.h"
#include "services/common/system_task.h"
#include "services/runlevel.h"
#include "system/bootbits.h"
#include "system/firmware_storage.h"
#include "system/logging.h"
#include "system/passert.h"
#include "system/reset.h"
#include <stdio.h>
///////////
// He... | window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_window_load,
}) | ;
window_set_click_config_provider(window, (ClickConfigProvider) config_provider);
window_set_fullscreen(window, true);
const bool animated = false;
app_window_stack_push(window, animated);
}
////////////////////
// App boilerplate
static void handle_init(void) {
AppData *data = app_malloc_check(sizeof(AppD... |
{ 1264, 408, -152},
{ 1392, 384, -184},
{ 1640, 360, -120},
{ 1640, 232, -120},
{ 1456, 264, -136},
{ 1136, -128, 40},
{ 584, -336, -104},
{ 832, -336, -32},
{ 976, -152, -160},
{ 1112, 120, -224},
{ 1272, 336, -312},
{ 1136, 296, -312},
{ 1128, 296, -272},
{ 1336, ... | { 904, 984, -312},
{ 696, 936, -248},
{ 1104, 1096, -200},
{ 936, 728, -200},
// 13 seconds
{ 1240, 792, -184},
{ 1528, 656, -120},
{ 1336, 384, -96},
{ 1280, 272, -208},
{ 1232, 184, -40},
{ 1280, 328, -136},
{ 1328, 264, -120},
{ 1360, 272, -96},
{ 1184, 176, -1... |
{ 1144, 72, -168},
{ 1328, 296, -328},
{ 1184, 272, -264},
{ 1152, 296, -264},
{ 1280, 480, -288},
{ 1624, 704, -152},
{ 1408, 776, -176},
{ 1248, 912, -56},
{ 944, 1088, -80},
{ 912, 952, 32},
{ 1064, 920, -16},
{ 808, 696, 32},
{ 1064, 712, 8},
{ 1376, 696, -12... |
/ui.h"
#include "applib/ui/window.h"
#include "applib/ui/window_private.h"
#include "comm/ble/kernel_le_client/kernel_le_client.h"
#include "console/serial_console.h"
#include "console/prompt.h"
#include "drivers/backlight.h"
#include "drivers/battery.h"
#include "drivers/button.h"
#include "drivers/task_watchdog.h"
#i... | {
launcher_task_add_callback(launcher_force_quit_app, NULL);
} |
static void launcher_handle_button_event(PebbleEvent* e) {
ButtonId button_id = e->button.button_id;
const bool watchface_running = app_manager_is_watchface_running();
// trigger the backlight on any button down event
if (e->type == PEBBLE_BUTTON_DOWN_EVENT) {
analytics_inc(ANALYTICS_DEVICE_METRIC_BUTTON... |
(event.task_mask, task_mask);
BLECharacteristic characteristic_out;
uint8_t *buffer = (uint8_t *) malloc(assert_value_length);
memset(buffer, 0, assert_value_length);
if (kernel) {
GATTBufferedNotificationHeader header = {};
gatt_client_subscriptions_get_notification_header(GAPLEClientKernel, &header);... | (&s_device) | ;
fake_event_clear_last();
}
void test_gatt_client_subscriptions__cleanup(void) {
for (GAPLEClient c = 0; c < GAPLEClientNum; ++c) {
gatt_client_subscriptions_cleanup_by_client(c);
}
gap_le_connection_deinit();
gatt_client_subscription_cleanup();
fake_pbl_malloc_check_net_allocs();
fake_pbl_malloc_... |
/*
* 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... | timed_update(NULL) | ;
}
int main(void) {
init();
app_event_loop();
}
|
m, sizeof(s_meta_v0_system),
BLEGATTErrorSuccess);
cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), true);
ppogatt_handle_read_or_notification(s_characteristics[1][PPoGATTCharacteristicMeta],
(const uint8_t *) &s_... | ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta],
(const uint8_t *) &s_meta_v0_system,
sizeof(s_meta_v0_system),
BLEGATTErrorSuccess) | ;
// Client created:
cl_assert_equal_i(ppogatt_client_count(), 1);
cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), true);
Transport *client = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid);
// Rediscovery:
ppogatt_invalidate_all_references();
prv_notify_services_discovered... |
rs();
s_firmware_update_is_in_progress = false;
const uint8_t chunk[] = { 0xaa, 0xbb, 0xcc };
prv_receive_put(s_last_response_cookie, chunk, sizeof(chunk));
assert_ack_count(0);
assert_nack_count(1);
}
void test_put_bytes__previous_chunk_not_acked_yet(void) {
uint8_t max_put_ops = prv_put_bytes_get_max_... | prv_receive_init_and_put_fw_object() | ;
const uint8_t incomplete_put_msg = CmdCommit;
prv_receive_data(s_session, (const uint8_t *) &incomplete_put_msg,
sizeof(incomplete_put_msg));
assert_ack_count(0);
assert_nack_count(1);
}
void test_put_bytes__commit_message_sent_while_previous_put_was_not_acked_yet(void) {
... |
/*
* 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 msgid;
} | |
/*
* 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, &s_fb, GContextInitializationMode_App) | ;
s_app_state_get_graphics_context = &s_ctx;
// Setup resources
fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */);
pfs_init(false /* run filesystem check */);
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME,
... |
st uint8_t expected_raw_data[] = {
0x01, 0x00, 0x69, 0x50, 0x68, 0x6f, 0x6e, 0x65,
0x20, 0x4d, 0x61, 0x72, 0x74, 0x79, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf9,
0x92, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x75, 0x36,
0x9c, 0x6e, 0x1a, 0x1b, 0xeb, 0x5f, 0xfb, 0x89,
0xdb, 0x0b, 0xec, 0xa... | (&key, sizeof(key), data, data_size) | ;
cl_assert_equal_i(data_len, data_size);
cl_assert_equal_m(expected_raw_data, data, sizeof(expected_raw_data));
}
void test_bluetooth_persistent_storage__v1_bt_classic(void) {
#if UNITTEST_BT_PERSISTENT_STORAGE_VERSION != 1
// We only care about BT Classic in v1.
return;
#endif
BTDeviceAddress address = {
... |
alog);
dialog_set_text(dialog, msg);
i18n_free(msg, dialog);
dialog_set_icon(dialog, config->icon);
dialog_set_text_color(dialog, config->text_color);
dialog_set_background_color(dialog, config->background_color);
dialog_set_timeout(dialog, config->timeout_ms);
dialog_set_callbacks(dialog, &(DialogCallba... | {
ActionToggleContext *context = applib_zalloc(sizeof(ActionToggleContext));
PBL_ASSERTN(context);
*context = (ActionToggleContext) {
.config = *config,
};
prv_call_get_state_callback(context);
if (prv_should_prompt(config)) {
prv_push_prompt_dialog(context);
} else {
prv_push_result_dialog(co... | |
16, -64, -264},
{ 952, -80, -296},
{ 896, -120, -304},
{ 944, -144, -280},
{ 984, -136, -240},
{ 976, -120, -232},
{ 936, -96, -216},
{ 936, -64, -256},
{ 944, -56, -224},
{ 968, -48, -216},
{ 968, -32, -240},
{ 984, -32, -256},
{ 1016, -24, -280},
{ 992, -24, -256},
... | { 992, -56, -320},
{ 888, -104, -320},
{ 904, -304, -336},
{ 952, -368, -360},
{ 1136, -544, -320},
{ 968, -320, -376},
{ 896, -424, -408},
{ 856, -432, -472},
{ 904, -360, -544},
{ 856, -240, -488},
{ 888, -144, -456},
{ 1136, -56, -424},
// 24 seconds
{ 1440, 88... |
{ 960, 168, -240},
{ 928, 120, -232},
{ 968, 80, -232},
{ 992, 56, -240},
{ 1008, 0, -272},
{ 1056, -32, -288},
{ 1056, -120, -232},
{ 1144, -120, -240},
{ 1264, -80, -232},
{ 1456, -40, -240},
{ 1208, -56, -176},
{ 976, -24, -256},
{ 736, -16, -248},
{ 744, -8, ... |
0; i < ARRAY_LENGTH(s_composite_tests); i++) {
const CompositeTest *test_data = &s_composite_tests[i];
// Skip invalid GBitmapFormat and GCompOp combinations
if (!prv_gbitmap_format_and_compositing_mode_combo_is_valid(
test_data->expected_test_image_bitmap_format, compositing_mode)) {
break;
... | GPoint(25, 0) | );
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_graphics_draw_bitmap__offset_layer_across_nx(void) {
prv_offset_layer_test(GPoint(-25, 0));
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_graphics_draw_bitmap__offset_layer_across_y(void) {
prv_offset_layer_... |
j = jerry_create_object();
JS_VAR json_str = prv_json_stringify(obj);
char *json_c_str = rocky_string_alloc_and_copy(json_str);
cl_assert_equal_s(json_c_str, "{}");
task_free(json_c_str);
}
void test_rocky_api_app_message__json_parse(void) {
JS_VAR number = prv_json_parse("1");
cl_assert(jerry_value_is_num... | (PostMessageKeyResetComplete, \
(const uint8_t *)&TINY_RESET_COMPLETE, sizeof(TINY_RESET_COMPLETE)) | |
ake_kernel_malloc_mark();
s_send_next_count = 0;
comm_default_kernel_sender_init();
}
void test_session_send_buffer__cleanup(void) {
comm_default_kernel_sender_deinit();
// Check for leaks:
fake_kernel_malloc_mark_assert_equal();
fake_kernel_malloc_deinit();
}
void test_session_send_buffer__null_session(... | (write_sb) | ; ++i) {
if (!write_sb[i]) {
break;
}
prv_cleanup_send_buffer(write_sb[i]);
}
}
void test_session_send_buffer__not_enough_space_kernel_bg(void) {
s_valid_session = &s_session;
// Fill the send buffer completely:
const size_t max_length = comm_session_send_buffer_get_max_payload_length(&s_ses... |
cal_tm;
localtime_r(&utc_sec, &local_tm);
if (local_tm.tm_hour < 10) {
local_tm.tm_hour = 12;
local_tm.tm_min = 0;
local_tm.tm_sec = 0;
} else if (local_tm.tm_hour < 16) {
local_tm.tm_hour = 18;
local_tm.tm_min = 0;
local_tm.tm_sec = 0;
} else {
local_tm.tm_hour += 2;
local_tm.t... | {
ActionMenuLevel *root_level = action_menu_get_root_level(action_menu);
action_menu_hierarchy_destroy(root_level, NULL, NULL);
i18n_free_all(root_level);
prv_reset_session_responsiveness();
} |
static void prv_timeline_action_menu_did_close(ActionMenu *action_menu, const ActionMenuItem *item,
void *context) {
TimelineActionMenu *timeline_action_menu = context;
if (timeline_action_menu->did_close) {
timeline_action_menu->did_close(action_menu, item, time... |
visible_height, 0);
}
}
layer_mark_dirty(layer);
}
void layer_set_frame_by_value(Layer *layer, GRect frame) {
layer_set_frame(layer, &frame);
}
void layer_get_frame(const Layer *layer, GRect *frame) {
*frame = layer->frame;
}
GRect layer_get_frame_by_value(const Layer *layer) {
GRect frame;
layer_ge... | (layer_to_insert, below_layer->window) | ;
if (layer_to_insert->window) {
window_schedule_render(layer_to_insert->window);
}
Layer *prev_sibling = below_layer->parent->first_child;
if (below_layer == prev_sibling) {
below_layer->parent->first_child = layer_to_insert;
} else {
while (prev_sibling->next_sibling != below_layer) {
prev... |
id = 0,
.layout = LayoutIdGeneric,
.timestamp = 0x53f0dda6,
},
.attr_list = {
.num_attributes = 2,
.attributes = attributes,
},
.action_group = {
.num_actions = 1,
.actions = &actions[2],
}
};
Uuid i3;
uuid_generate(&i3);
TimelineItem e3 = {
.header =... | (notification_storage_get(&uuids[i % count], &r)) | ;
compare_notifications(&e, &r);
free(r.allocated_buffer);
}
//Check that no notifications have been deleted
e.header.id = uuids[j];
e.header.timestamp = timestamp + j;
cl_assert(notification_storage_get(&uuids[j], &r));
compare_notifications(&e, &r);
free(r.allocated_buffer);
//Free up enough... |
player_state_update.playback_state = MusicPlayStateRewinding;
break;
case MusicEndpointPlaybackStateForwarding:
player_state_update.playback_state = MusicPlayStateForwarding;
break;
case MusicEndpointPlaybackStateUnknown:
player_state_update.playback_state = MusicPlayStateUnknown;
... | comm_session_get_system_session() | ,
CommSessionExtendedMusicService)) {
if (s_progress_reporting_supported) {
return (MusicServerCapabilityPlaybackStateReporting |
MusicServerCapabilityProgressReporting |
MusicServerCapabilityVolumeReporting);
} else {
return (MusicServer... |
l, "test_file_atomic", 4096));
uint8_t key[4];
int key_len = sizeof(key) - 1;
memcpy(key, "key", sizeof(key));
#define ORIGINAL_VALUE "original_value"
uint8_t original_value[sizeof(ORIGINAL_VALUE)];
int original_value_length = sizeof(ORIGINAL_VALUE) - 1;
memcpy(original_value, ORIGINAL_VALUE, sizeof(ORIGI... | set_and_verify(&file, key, 0, val, val_len) | ;
}
static bool prv_each_cb(SettingsFile *file, SettingsRecordInfo *info,
void *context) {
uint8_t *key = malloc(info->key_len + 1);
uint8_t *val = malloc(info->val_len + 1);
info->get_key(file, key, info->key_len);
info->get_val(file, val, info->val_len);
key[info->key_len] = '\0';
... |
start, angle_end);
}
MOCKABLE void graphics_fill_radial_precise_internal(GContext *ctx, GPointPrecise center,
Fixed_S16_3 radius_inner, Fixed_S16_3
radius_outer, int32_t angle_start,
... | {
// Filling a circle of radius zero should just draw a single pixel.
// Backup the stroke color and set that to the current fill color since the stroke color
// is what is used for draw pixel. Restore the stroke color afterwards.
GColor backup_stroke_color = ctx->draw_state.stroke_color;
ctx->draw_... |
#if PBL_COLOR
if (ctx->draw_state.antialiased) {
graphics_internal_circle_quadrant_fill_aa(ctx, p, radius, GCornersAll);
return;
}
#endif
graphics_circle_fill_non_aa(ctx, p, radius);
}
GPointPrecise gpoint_from_polar_precise(const GPointPrecise *precise_center,
u... |
.length = s_erase_length,
.complete = 0
};
pulse_best_effort_send(ack, sizeof(EraseAndWriteAck));
} else {
s_erase_in_progress = true;
s_erase_start_address = cmd->erase.address;
s_erase_length = cmd->erase.length;
EraseAndWriteAck *message = pulse_best_effort_send_begin(
PULS... | pulse_best_effort_send_begin(
PULSE_PROTOCOL_FLASH_IMAGING) | ;
*resp = (RegionGeometry) {
.opcode = IMAGING_RESP_REGION_GEOMETRY,
.region = cmd->region.region,
.address = region_base,
.length = region_length
};
pulse_best_effort_send(resp, sizeof(RegionGeometry));
}
static void prv_handle_finalize_region(Command *cmd, size_t length) {
if (length != 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... | mutex_unlock(s_list_mutex) | ;
job->cb(job, job->cb_data);
mutex_lock(s_list_mutex);
}
mutex_unlock(s_list_mutex);
}
// --------------------------------------------------------------------------------------------
void cron_service_handle_clock_change(PebbleSetTimeEvent *set_time_info) {
mutex_lock(s_list_mutex);
const bool must_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... | if (!glance || !uuid) {
return;
} |
*glance = (LauncherAppGlance) {
.uuid = *uuid,
.reel = impl,
.should_consider_slices = should_consider_slices,
};
if (handlers) {
glance->handlers = *handlers;
}
launcher_app_glance_update_current_slice(glance);
}
void launcher_app_glance_update_current_slice(LauncherAppGlance *glance) {
... |
minderEventType type) {
Uuid *removed_id = kernel_malloc(sizeof(Uuid));
if (!removed_id) {
return;
}
*removed_id = *reminder_id;
PebbleEvent event = {
.type = PEBBLE_REMINDER_EVENT,
.reminder = {
.type = type,
.reminder_id = removed_id,
}
};
event_put(&event);
}
void reminder... | {
// Constant-time snooze
snooze_delay = CONSTANT_SNOOZE_DELAY;
} |
timeline_item_free_allocated_buffer(&parent_item);
return snooze_delay;
}
bool reminders_can_snooze(Reminder *reminder) {
return (prv_calculate_snooze_delay((TimelineItem *)reminder) > 0);
}
status_t reminders_snooze(Reminder *reminder) {
uint32_t snooze_delay = prv_calculate_snooze_delay((TimelineItem *)re... |
le 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.
*/
#include "applib/graphic... | (&ctx.dest_bitmap, "draw_circle_across_ny_origin_layer.${BIT_DEPTH_NAME}.pbi") | );
}
#define RADIUS_BIG 15
#define RADIUS_MEDIUM 8
#define RADIUS_MIN_CALCULATED 3
#define RADIUS_MAX_PRECOMPUTED 2
#define RADIUS_SMALL 1
#define RADIUS_NONE 0
#define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168)
#define ORIGIN_RECT_CLIP_XY GRect(0, 0, 30, 40)
#define ORIGIN_RECT_CLIP_NXNY GRect(0, 0... |
"applib/ui/window_private.h"
#include "applib/ui/layer.h"
#include "util/math.h"
#include "util.h"
#include "clar.h"
#include <stdio.h>
// Helper Functions
////////////////////////////////////
#include "test_graphics.h"
#include "${BIT_DEPTH_NAME}/test_framebuffer.h"
// Stubs
////////////////////////////////////
#... | (gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_inside_offset_layer.${BIT_DEPTH_NAME}.pbi")) | ;
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_x_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_across_x_offset_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(... |
e, i, &config)) {
if (config.kind == ALARM_KIND_JUST_ONCE) {
prv_set_day_for_just_once_alarm(&config, config.hour, config.minute);
Alarm alarm = {
.id = i,
.config = config,
};
prv_persist_alarm(&file, &alarm);
}
}
}
prv_reload_alarms(&file);
p... | i18n_noop("Tue") | ,
i18n_noop("Wed"),
i18n_noop("Thu"),
i18n_noop("Fri"),
i18n_noop("Sat")
};
static const char *full_day_strings[7] = {
... |
2, -8, -48},
{ 960, -8, -64},
{ 936, -24, -48},
{ 952, -48, -40},
{ 968, -48, -48},
{ 1008, -40, -72},
{ 1096, -56, -96},
{ 1128, -80, -112},
{ 1464, -56, -160},
{ 1312, -64, -144},
{ 1112, -32, -224},
{ 784, -16, -264},
{ 752, 0, -240},
{ 1064, 8, -184},
{ 1184, ... | { 960, 88, 192},
{ 1024, 64, 152},
{ 1080, 72, 72},
{ 1112, 88, 8},
{ 1072, 120, -56},
{ 1072, 112, -32},
{ 1080, 192, -128},
{ 1064, 208, -144},
{ 1056, 184, -144},
{ 1064, 184, -128},
{ 1064, 160, -128},
{ 1088, 168, -176},
{ 1464, 216, -120},
{ 1352, 288, -208}... |
{ 1440, 216, -472},
{ 1440, -240, -368},
{ 1136, 120, -240},
{ 872, 168, -248},
{ 832, 112, -72},
{ 1248, 0, 128},
{ 1192, 40, 280},
// 75 seconds
{ 1024, -40, 288},
{ 912, 32, 208},
{ 928, 40, 128},
{ 976, 56, 128},
{ 1016, 16, 104},
{ 1064, 80, 8},
{ 1104, ... |
{ -616, 1000, -512},
{ -520, 1056, -576},
{ -712, 1184, -488},
{ -344, 1712, -712},
{ -80, 912, -384},
{ -184, 736, -368},
{ -224, 880, -424},
{ -176, 584, -256},
{ -104, 504, -264},
{ -184, 560, -360},
{ -248, 688, -400},
{ -232, 896, -488},
{ -280, 1144, -672},
... |
{ 24, 1288, -512},
{ 120, 1096, -464},
{ 0, 824, -464},
{ -40, 584, -416},
{ -32, 520, -304},
{ -144, 512, -224},
// 49 seconds
{ -288, 608, -344},
{ -368, 816, -368},
{ -408, 920, -392},
{ -528, 1112, -520},
{ -440, 1224, -600},
{ -536, 1096, -640},
{ -168, 1376... | |
h"
#include "gdraw_command_private.h"
#include "applib/applib_malloc.auto.h"
#include "system/passert.h"
bool gdraw_command_list_copy(void *buffer, size_t buffer_length, GDrawCommandList *src) {
size_t src_size = gdraw_command_list_get_data_size(src);
if (buffer_length < src_size) {
return false;
}
memcp... | {
if (!command_list) {
return 0;
}
size_t size = 0;
gdraw_command_list_iterate(command_list, prv_iterate_max_command_size, &size);
return size;
} | |
_utc);
return success;
}
// -----------------------------------------------------------------------------------------
// Free all memory associated with a session
static void prv_session_free(PLogSession *session) {
kernel_free(session->msg_buffer);
kernel_free(session->data_buffer);
kernel_free(session);
}
... | if (!transport) {
transport = prv_dls_transport;
} |
// Create a buffer for the final fully-formed record. Since we send it out through data logging,
// make it the size of a data logging record
uint8_t *msg_buffer = kernel_zalloc(PLOG_DLS_RECORD_SIZE);
if (!msg_buffer) {
return NULL;
}
// Number of bytes that are needed to encode the payload structure... |
ent_to_kernel(&event);
}
static uint32_t prv_num_pending_messages(const AppOutboxConsumer *consumer) {
return list_count((ListNode *)consumer->head);
}
static AppOutboxConsumer *prv_find_consumer_with_message(const AppOutboxMessage *message) {
AppOutboxMessage *head = (AppOutboxMessage *)list_get_head((ListNode *... | if (app_outbox_service_is_message_cancelled(message)) {
// Don't call the sent_handler
goto finally;
} |
AppOutboxConsumer *consumer = prv_find_consumer_with_message(message);
PBL_ASSERTN(consumer);
list_remove(&message->node, (ListNode **)&consumer->head, NULL);
prv_schedule_sent_handler(message->sent_handler, message->cb_ctx, status);
}
finally:
kernel_free(message);
prv_unlock();
}
void app_outb... |
// We should still be able to create more sessions up to the max
for (int i = num_sessions; i < DLS_MAX_NUM_SESSIONS; i++) {
logging_sessions[i] = data_logging_create(i, DATA_LOGGING_UINT, item_size, false);
cl_assert(logging_sessions[i]);
fake_system_task_callbacks_invoke_pending();
prv_log_random_d... | cl_assert(logging_session == NULL) | ;
}
void test_data_logging__recover_one(void) {
prv_do_recovery_test(1);
}
void test_data_logging__recover_five(void) {
prv_do_recovery_test(5);
}
// ----------------------------------------------------------------------------------------
//! Try passing garbage pointers to sessions to data logging functions.
vo... |
if (data->creating_alarm) {
const AlarmInfo info = {
.hour = data->alarm_hour,
.minute = data->alarm_minute,
.kind = data->alarm_kind,
.is_smart = (data->alarm_type == AlarmType_Smart),
};
data->alarm_id = alarm_create(&info);
data->complete_callback(CREATED, data->alarm_id, data... |
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Custom Day Picker
static void prv_custom_day_picker_window_unload(Window *window) {
AlarmEditorData *data = (AlarmEditorData*) window_get_user_data(window);
if (!data->custom_day_picker_was_completed) {
... | |
ers_processed(NULL, 0, &s_recognizers_reset);
cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown);
// Layer A's recognizer's gesture completes immediately. All recognizers receive the touch event
// because Layer A's recognizers receive the touch events last. All recognizers in the chain ar... | (recognizers[1]->state, RecognizerState_Cancelled) | ; // was already cancelled
cl_assert_equal_i(recognizers[4]->state, RecognizerState_Failed);
// A child layer of the active layer becomes active when a window recognizer is triggered
e.type = TouchEvent_Touchdown;
s_active_layer = &layer_c;
recognizers[3]->state = RecognizerState_Possible;
recognizer_manag... |
/*
* 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 (!t) {
return false;
}
if ((t->a.raw_value == GTransformNumberOne.raw_value) &&
(t->b.raw_value == GTransformNumberZero.raw_value) &&
(t->c.raw_value == GTransformNumberZero.raw_value) &&
(t->d.raw_value == GTransformNumberOne.raw_value)) {
return true;
}
return false;
} |
bool gtransform_is_only_scale_or_translation(const GTransform * const t) {
if (!t) {
return false;
}
if ((t->b.raw_value != GTransformNumberZero.raw_value) ||
(t->c.raw_value != GTransformNumberZero.raw_value)) {
return true;
}
return false;
}
bool gtransform_is_equal(const GTransform * 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... | portEXIT_CRITICAL() | ;
}
void gpio_release(GPIO_TypeDef* GPIOx) {
uint8_t idx = ((((uint32_t)GPIOx) - AHB1PERIPH_BASE) / 0x0400);
portENTER_CRITICAL();
if((idx < MAX_GPIO) && s_gpio_clock_count[idx] && !(--s_gpio_clock_count[idx])) {
CLEAR_BIT(RCC->AHB1ENR, (0x1 << idx));
power_tracking_stop(s_gpio_to_power_system_map[idx]);... |
alse;
}
char key[HEALTH_DB_MAX_KEY_LEN];
snprintf(key, HEALTH_DB_MAX_KEY_LEN, "average%s", (metric == ActivityMetricStepCount) ?
STEP_AVERAGE_KEY_SUFFIX : SLEEP_AVERAGE_KEY_SUFFIX);
const int key_len = strlen(key);
status_t s = settings_file_get(&file, key, key_len, value_out, sizeof(uint32_t));
... | prv_key_is_valid(key, key_len) | ) {
return E_INVALID_ARGUMENT;
}
SettingsFile file;
status_t rv = prv_file_open_and_lock(&file);
if (rv != S_SUCCESS) {
return rv;
}
rv = settings_file_delete(&file, key, key_len);
prv_file_close_and_unlock(&file);
return rv;
}
status_t health_db_flush(void) {
mutex_lock(s_mutex);
statu... |
},
.parent_id = {0xff, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e,
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0x03},
.timestamp = 4,
.duration = 0,
.type = TimelineItemTypeReminder,
.layout = LayoutIdTest,
}
};
static SerializedTimelineItemHeader bad_item = {
.common = {
.id = {0x... | uuid_equal(&item3.header.id, &temp.header.id) | ) {
temp.attr_list.attributes = NULL;
timeline_item_free_allocated_buffer(&temp);
cl_assert(memcmp(&item3, &temp, sizeof(TimelineItem)) == 0);
cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */));
cl_assert(reminder_db_get_len((uint8_t *) &item3, sizeof(Uuid)) == 0... |
e "stubs_sleep.h"
#include "stubs_status_bar_layer.h"
#include "stubs_syscalls.h"
#include "stubs_system_theme.h"
#include "stubs_task_watchdog.h"
#include "stubs_window_manager.h"
#include "stubs_window_stack.h"
// Helper Functions
/////////////////////
#include "fw/graphics/test_graphics.h"
#include "fw/graphics/ut... | (&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
void test_weather_app_layout__render_large_numbers(void) {
const WeatherLocationForecast forecast = {
.location_name = "PALO ALTO",
.current_temp = -88,
.today_high = -88,
.today_low = -88,
.current_weather_type = WeatherType_Sun,
.current_weather_phrase = "Sunny",
.tomorrow_high = -... |
UG 0
#if EVENT_DEBUG
static void prv_queue_dump(QueueHandle_t queue) {
PebbleEvent event;
PBL_LOG(LOG_LEVEL_DEBUG, "Dumping queue:");
while (xQueueReceive(queue, &event, 0) == pdTRUE) {
PBL_LOG(LOG_LEVEL_DEBUG, "Event type: %u", event.type);
}
for(;;);
}
#endif
void events_init(void) {
PBL_ASSERTN(s_s... | {
PBL_ASSERTN(queue);
if (!xQueueSendToBack(queue, event, milliseconds_to_ticks(3000))) {
// We waited a reasonable amount of time here before failing. We don't want to wait too long because
// if the queue really is stuck we'll just get a watchdog reset, which will be harder to debug than
// just diei... |
void event_deinit(PebbleEvent* event) {
void **buffer = event_get_buffer(event);
if (buffer && *buffer) {
kernel_free(*buffer);
*buffer = NULL;
}
}
void event_put(PebbleEvent* event) {
register uintptr_t lr __asm("lr");
uintptr_t saved_lr = lr;
// If we are posting from the KernelMain task, use 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... | {
utf8_t dest[5];
dest[0] = 0;
size_t copied = utf8_copy_character(dest, (utf8_t *)NIHAO, 2);
cl_assert_equal_i(copied, 0);
cl_assert_equal_s((char *)dest, "");
} |
void test_utf8__copy_fill_buffer(void) {
utf8_t dest[5];
memset(dest, 0, 5);
size_t copied = utf8_copy_character(dest, (utf8_t *)NIHAO, 3);
cl_assert_equal_i(copied, NIHAO_FIRST_CHARACTER_BYTES);
cl_assert_equal_s((char *)dest, NIHAO_FIRST_CHARACTER);
}
void test_utf8__copy_last_character(void) {
utf8_t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.