prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
ptr) {
task_free((char *)ptr);
}
JERRY_FUNCTION(prv_postmessageerror_data_getter) {
char *json_buffer = NULL;
PBL_ASSERTN(jerry_get_object_native_handle(this_val, (uintptr_t *)&json_buffer));
PBL_ASSERTN(json_buffer);
return prv_json_parse(json_buffer);
}
static void prv_object_queue_pop_head_and_emit_error... | {
task_free(data_buffer);
return prv_create_oom_error();
} |
*obj = (OutgoingObject) {
.data_buffer = data_buffer,
};
const bool is_first = prv_object_queue_add(obj);
if (is_first) {
if (s_state.state == PostMessageStateSessionOpen) {
prv_outbox_try_send_next();
} else {
prv_start_session_closed_object_queue_timer();
}
}
return jerry_cr... |
anager) {
return;
}
void watchface_reset_click_manager(void) {
return;
}
Animation *window_transition_default_pop_create_animation(WindowTransitioningContext *context) {
window_transition_context_disappear(context);
window_transition_context_appear(context);
return animation_create();
}
const WindowTransit... | (stack, new_window, true) | ;
}
static void prv_pop_window_unload(Window *window) {
window_stack_remove(window, true);
prv_window_unload(window);
}
// Setup and Teardown
////////////////////////////////////
void test_window_stack__initialize(void) {
s_last_click_configured_window = NULL;
WindowStack *stack = app_state_get_window_stack... |
(fake_notification_storage_get_store_count(), 1) | ;
cl_assert_equal_i(fake_notification_storage_get_remove_count(), 0);
// We should reject any notification that matches and has the exact same uid
uint32_t uid = ((GetNotificationAttributesMsg *)&s_complete_dict)->notification_uid;
fake_notification_storage_set_existing_ancs_notification(&(Uuid)UUID_SYSTEM, ui... | |
/*
* 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 (size_t i = 0; i < size; ++i) {
if (codepoints[i] >= codepoint) {
return (codepoints[i] == codepoint);
}
} |
return false;
}
bool codepoint_is_formatting_indicator(const Codepoint codepoint) {
return codepoint_in_list(codepoint, FORMATTING_CODEPOINTS, ARRAY_LENGTH(FORMATTING_CODEPOINTS));
}
bool codepoint_is_ideograph(const Codepoint codepoint) {
if (codepoint > MIN_IDEOGRAPH_CODEPOINT) {
// non ideographic char... |
cmd_value, cmd_length,
GAPLEClientKernel);
if (e != BTErrnoOK) {
if (e == BTErrnoNotEnoughResources) {
// Need to wait for space to become available
launcher_task_add_callback(&prv_register_next_entity, NULL);
} else {
// Most likely th... | {
MusicPlayerStateUpdate state = {};
const uint8_t num_results = ams_util_csv_parse(update->value_str, value_length, &state,
prv_handle_player_playback_info_value);
const bool success = (num_results == 3);
if (success) {
music_update_player_playback_state(&st... | |
l_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->state = RecognizerState_Completed;
recognizer_cancel(r);
cl_assert_equal_i(r->state, Recogni... | (rec_event, RecognizerEvent_Completed) | |
cl_assert_equal_s(s_output, "test string 5 seconds") | ;
cl_assert_equal_i(cond.eval_time, 1);
cl_assert_equal_b(cond.force_eval_on_time, true);
}
{
TemplateStringVars vars = {};
TemplateStringError err = {};
TemplateStringEvalConditions cond = {};
vars.current_time = 0;
cond.eval_time = EVAL_FALL_THROUGH;
cond.force_eval_on_time = tru... | |
/*
* 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_WriteBit(gpio, gpio_pin, active_high ? Bit_SET : Bit_RESET) | ;
// wait for the bus supply to stabilize and the peripherals to start up.
// the MFI chip requires its reset pin to be stable for at least 10ms from startup.
delay_ms(20);
gpio_release(gpio);
} else {
gpio_use(gpio);
// disable the bus supply
GPIO_WriteBit(gpio, gpio_pin, active_high ? B... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | health_tracking_ui_feature_show_disabled() | ;
return;
}
#endif
alarm_set_smart(data->alarm_id, !data->alarm_info.is_smart);
if (data->alarm_editor_callback) {
data->alarm_editor_callback(EDITED, data->alarm_id, data->callback_context);
}
}
static void prv_edit_time_handler(ActionMenu *action_menu,
const ActionMe... |
t_blob_db_sync__sync_oom(void) {
char *keys[] = { "key1", "key2", "key3", "key4", "key5" };
int key_len = strlen(keys[0]);
char *values[] = { "val1", "val2", "val3", "val4", "val5" };
int value_len = strlen(values[0]);
// insert all keys
for (int i = 0; i < ARRAY_LENGTH(keys); ++i) {
blob_db_insert(Blo... | (BlobDBIdTest) | ;
cl_assert(test_session);
cl_assert_equal_i(test_session->db_id, BlobDBIdTest);
BlobDBSyncSession *pins_session = blob_db_sync_get_session_for_id(BlobDBIdPins);
cl_assert(pins_session);
cl_assert_equal_i(pins_session->db_id, BlobDBIdPins);
BlobDBSyncSession *reminders_session = blob_db_sync_get_session_for... |
5,
0x0a,
0x0f,
0x0b,
0x1b,
0x06,
0x07,
0x2b,
0x16,
0x17,
0x01,
0x02,
0x03,
0x13,
0x27,
0x12,
0x23,
0x3b,
0x26,
0x37,
0x11,
0x22,
0x33,
0x32,
0x36,
0x21,
0x31,
};
typedef enum {
PROPERTY_FG_COLOR,
PROPERTY_BG_COLOR,
PROPERTY_ALPHA,
// Add more above here
PR... | {
graphics_context_set_stroke_color(ctx, fg_color);
graphics_draw_pixel(ctx, point);
graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y));
graphics_draw_pixel(ctx, GPoint(point.x, point.y + 1));
graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1));
} | else if (alpha == ALPHA_66) {
graphics_context_set_stroke_color(ctx, fg_color);
graphics_draw_pixel(ctx, point);
graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1));
graphics_context_set_stroke_color(ctx, bg_color);
graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y));
graphics_draw_pi... |
window below a transparent
// window that just disappeared, it was already on screen and may need its click configured.
const bool is_focused = (iter->current_idx == iter->first_focus_idx);
if (!window->is_click_configured && is_focused) {
// Input is now exposed by a higher priority modal window stack empty... | (prv_has_visible_focusable_window, NULL) | ;
return window_stack_get_top_window(stack);
}
void modal_manager_handle_button_event(PebbleEvent *event) {
ClickManager *click_manager = modal_manager_get_click_manager();
switch (event->type) {
case PEBBLE_BUTTON_DOWN_EVENT: {
// If we get a button event, it must also be for the top modal window.
... |
onst char *title, const char *subtitle,
GDrawCommandImage *icon) {
// as measured from the design specs
const int horizontal_inset = MENU_CELL_ROUND_UNFOCUSED_HORIZONTAL_INSET;
const int top_inset = 2;
GRect frame = cell_layer->bounds;
// manually inset ... | {
draw_cell = prv_draw_notification_cell_round_unselected;
} |
#endif
bool first_row = (cell_index->row == 0);
// Test if there are any notifications in the list.
if (first_row) {
// Draw "Clear all" box and exit
#if PBL_ROUND
draw_cell(ctx, cell_layer, i18n_get("Clear All", data), NULL, NULL);
#else
const GFont font = system_theme_get_font_for_default_size(Tex... |
l_assert_equal_i(pin_db_flush(), 0);
cl_assert(timeline_add(&item));
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
cl_assert_equal_i(timeline_init(&head), S_SUCCESS);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture,
1430... | cl_assert(uuid_equal(&state.pin.header.id, &all_day_item.header.id)) | ;
cl_assert(uuid_equal(&state.node->id, &all_day_item.header.id));
cl_assert(!state.node->all_day);
cl_assert_equal_i(state.node->timestamp, midnight_march_3_utc);
cl_assert_equal_i(state.node->duration, 0);
cl_assert_equal_i(state.current_day, midnight_march_2_pst);
// no more
cl_assert(!iter_next(&iter... |
implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "notifications_app.h"
#include <stdio.h>
#include <time.h>
#include "applib/app.h"
#include "applib/app_exit_reason.h"
#include "applib/preferred_content_size.h"
#include "applib/fonts/fonts... | {
prv_notification_list_remove_notification_by_id(&data->notification_list, id);
} |
static bool prv_notif_iterator_callback(void *data, SerializedTimelineItemHeader *header) {
return (prv_add_notification(data, &header->common.id) != NULL);
}
static void prv_load_notification_storage(NotificationsData *data) {
notification_storage_iterate(&prv_notif_iterator_callback, data);
}
static void prv_... |
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 920, 264},
{ -48, 912, 264},
{ -40, 912, 264},
{ -40, 912, 264},
{ -48, 912, 272},
// 235 seconds
{ -56, 920, 264},
{ -48, 912, 264},
{ -48, 912, 264},
{ -40, 912,... |
{ -32, 912, 264},
{ -40, 912, 272},
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 912, 264},
{ -40, 912, 272},
{ -40, 912, 264},
{ -32, 920, 256},
{ -32, 920, 264},
{ -40, 904, 264},
{ -32, 912, 264},
{ -32, 912, 256},
{ -40, 912, 272},
{ -40, ... | |
if (!path || path->num_points < 2) {
return;
}
GPoint* rot_points = applib_malloc(path->num_points * sizeof(GPoint));
if (!rot_points) {
APP_LOG(APP_LOG_LEVEL_ERROR, GPATH_ERROR);
return;
}
int min_x, max_x, min_y, max_y;
GPoint rot_start, rot_end;
bool found_start_direction = false;
bool ... | (intersections_up, intersection_up_count) | ;
sort16(intersections_down, intersection_down_count);
// draw the line segments
for (int j = 0; j < MIN(intersection_up_count, intersection_down_count); j++) {
int16_t x_a = intersections_up[j];
int16_t x_b = intersections_down[j];
if (x_a != x_b) {
if (x_a > x_b) {
swa... |
);
regular_timer_fire_seconds(1);
// Silent term:
cl_assert(!gap_le_is_advertising_enabled());
regular_timer_fire_seconds(1);
// Looped around to second term (index==1):
cl_assert(gap_le_is_advertising_enabled());
assert_ad_data("yo");
gap_le_assert_advertising_interval(advert_terms[1].min_interval_... | for (int i = 0; i < 10; ++i) {
regular_timer_fire_seconds(1);
assert_ad_data("A");
regular_timer_fire_seconds(1);
assert_ad_data("B");
} | |
0),GCornerBottomRight},
.full_quadrants = (GCornersBottom | GCornerTopLeft),
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerTopRight}
}));
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(180), TO_TRIG(360 + 90)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO... | (prv_calc_draw_config_ellipsis(TO_TRIG(90 + 45 - 360), TO_TRIG(360 + 45 - 360)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(90 + 45),GCornerBottomRight},
.full_quadrants = GCornersLeft,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(45),GCornerTopRight}
})) | ;
// Pair of quadrants
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(0 - 360), TO_TRIG(180 - 360)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(360),GCornerTopRight},
.full_quadrants = GCornersRight,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(180),GCorner... |
E_NAME, SHELL_PREFS_FILE_LEN) != S_SUCCESS) {
goto cleanup;
}
if (settings_file_get(&file, PREF_KEY_CLOCK_24H, sizeof(PREF_KEY_CLOCK_24H),
&s_is_24h_style, sizeof(s_is_24h_style)) != S_SUCCESS) {
// The setting likely doesn't exist yet so set it to the default (true)
s_is_24h_sty... | {
mutex_lock(s_mutex);
const uint8_t content_size_uint = content_size;
if (content_size >= NumPreferredContentSizes) {
PBL_LOG(LOG_LEVEL_WARNING, "Ignoring attempt to set content size to invalid size %d",
content_size);
} else if (prv_pref_set(PREF_KEY_CONTENT_SIZE, &content_size_uint, sizeof(co... |
PreferredContentSize system_theme_get_content_size(void) {
return system_theme_convert_host_content_size_to_runtime_platform(
(PreferredContentSize)s_content_size);
}
bool activity_prefs_tracking_is_enabled(void) {
#if CAPABILITY_HAS_HEALTH_TRACKING
return true;
#else
return false;
#endif
}
#if CAPABILI... |
->bounds;
}
GRect layer_get_bounds_by_value(const Layer *layer) {
GRect bounds;
layer_get_bounds(layer, &bounds);
return bounds;
}
void layer_get_unobstructed_bounds(const Layer *layer, GRect *bounds_out) {
PBL_ASSERT_TASK(PebbleTask_App);
if (!layer || !bounds_out) {
return;
}
GRect area;
unobstr... | if (above_layer->parent == NULL) {
return;
} |
if (layer_to_insert->parent) {
layer_remove_from_parent(layer_to_insert);
}
PBL_ASSERTN(layer_to_insert->next_sibling == NULL);
layer_to_insert->parent = above_layer->parent;
layer_set_window(layer_to_insert, above_layer->window);
if (layer_to_insert->window) {
window_schedule_render(layer_to_inser... |
/*
* 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... | (val, 0, UINT8_MAX) | ;
return;
}
case ANALYTICS_METRIC_ELEMENT_TYPE_UINT16:
{
*((uint16_t*)location) = (uint16_t)CLIP(val, 0, UINT16_MAX);
return;
}
case ANALYTICS_METRIC_ELEMENT_TYPE_UINT32:
{
*((uint32_t*)location) = (uint32_t)CLIP(val, 0, UINT32_MAX);
return;
}
case ANALYTICS_METRIC_ELEME... |
));
ios_notif_pref_db_insert(key, sizeof(key), val, sizeof(val));
SettingsFile file;
settings_file_open(&file, iOS_NOTIF_PREF_DB_FILE_NAME, iOS_NOTIF_PREF_MAX_SIZE);
const unsigned prefs_len = settings_file_get_len(&file, key, sizeof(key));
void *prefs_out = kernel_zalloc(prefs_len);
settings_file_get(&f... | for (int i = 0; i < ARRAY_LENGTH(keys); ++i) {
ios_notif_pref_db_insert((uint8_t *)keys[i], key_len, (uint8_t *)values[i], value_len);
} |
bool is_dirty = true;
cl_assert_equal_i(ios_notif_pref_db_is_dirty(&is_dirty), S_SUCCESS);
cl_assert(!is_dirty);
BlobDBDirtyItem *dirty_list = ios_notif_pref_db_get_dirty_list();
cl_assert(!dirty_list);
}
void test_ios_notif_pref_db__is_dirty_insert_locally(void) {
char *keys[] = { "key1", "key2", "key3... |
/*
* 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... | layer_set_update_proc(&layer, &across_x_layer_update_callback) | ;
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_x_origin_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_nx_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_... |
cense for the specific language governing permissions and
* limitations under the License.
*/
#include "pebble_colors.h"
#include "applib/app.h"
#include "applib/graphics/graphics.h"
#include "applib/graphics/gtypes.h"
#include "applib/graphics/text.h"
#include "applib/ui/app_window_stack.h"
#include "applib/ui/tex... | (data->fg_text, data->fg_text_buffer, false) | |
ding_change(bonding, op);
kernel_le_client_handle_bonding_change(bonding, op);
bt_pairability_update_due_to_bonding_change();
}
static BTBondingID prv_bt_persistent_storage_store_ble_pairing(
const SMPairingInfo *new_pairing_info, bool is_gateway, bool requires_address_pinning,
uint8_t flags, const char *d... | shared_prf_storage_get_ble_pairing_data(&bonding.pairing_info, NULL, NULL, NULL) | ) {
return;
}
bt_driver_handle_host_removed_bonding(&bonding);
}
void bt_persistent_storage_delete_ble_pairing_by_id(BTBondingID bonding) {
prv_remove_ble_bonding_from_bt_driver();
shared_prf_storage_erase_ble_pairing_data();
prv_call_ble_bonding_change_handlers(bonding, BtPersistBondingOpWillDelete);
}
... |
J K L M N O P Q R S T U V W X Y Z "
"a b c d e f g h j k l m n o p q r s t u v w x y z "
"A B C D E F G";
char third_page_two_lines[] = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z "
"a b c d e f g h j k l m n o p q... | graphics_draw_text(&ctx, text, &s_font_info, GRect(0, 0, 180, 1000),
GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter,
(GTextAttributes *const) &layout) | ;
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
prv_prepare_fb_steps_xy(GSize(180, 300), 1, 1);
ctx.draw_state.avoid_text_orphans = true;
ctx.draw_state.clip_box.origin.y = 48;
ctx.draw_state.clip_box.size.h = 85;
ctx.draw_state.drawing_box.origin.y = -183;
graphics_draw_text(&ctx, text, &s_fon... |
);
}
static void prv_voice_confirm_cb(void *context) {
prv_exit_and_send_result_event((VoiceUiData *)context, DictationSessionStatusSuccess);
}
// Initiates transitions triggered by animations finishing
static void prv_handle_stop_transition(VoiceUiData *data) {
// Transition to next state
switch (data->state) ... | {
return next_state;
} |
break;
case StateRecording:
if ((next_state == StateWaitForResponse) || (next_state == StateTransitionToText)) {
return StateStopRecording;
}
break;
case StateStopRecording:
if (next_state == StateTransitionToText) {
*defer_transition = true;
// Spoof the... |
memcmp(&sprf_bt_data, &data->bt_classic_data, sizeof(sprf_bt_data)) | == 0;
prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN,
" BT Pairing Data matches Shared PRF: %s",
bool_to_str(matches_prf));
} else if (data->type == BtPersistBondingTypeBLE) {
prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN, "LE Key %d",
... | |
n false;
}
delay_us(100);
}
return true;
}
static bool prv_try_program(const uint8_t *fpga_bitstream,
uint32_t bitstream_size) {
display_spi_configure_default();
spi_ll_slave_acquire(ICE40LP->spi_port);
spi_ll_slave_scs_assert(ICE40LP->spi_port);
gpio_output_set(&ICE40L... | delay_us(5) | ;
spi_ll_slave_write(ICE40LP->spi_port, CMD_FRAME_BEGIN);
// Make sure command has been transferred.
spi_slave_wait_until_idle_blocking(ICE40LP->spi_port);
}
|
/*
* 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 (GBitmap) {
.addr = fb,
.row_size_bytes = FrameBuffer_MaxX,
.info = (BitmapInfo) {.format = GBitmapFormat8Bit, .version = GBITMAP_VERSION_CURRENT},
.bounds = (GRect) { { 0, 0 }, { FrameBuffer_MaxX, FrameBuffer_MaxY } },
};
} |
// tests
void test_graphics_blending__closest_opaque(void) {
cl_assert_equal_i(GColorRedARGB8, gcolor_closest_opaque((GColor8){.a= 3, .r = 3}).argb);
cl_assert_equal_i(GColorRedARGB8, gcolor_closest_opaque((GColor8){.a= 2, .r = 3}).argb);
cl_assert_equal_i(GColorClearARGB8, gcolor_closest_opaque((GColor8){.a= 1... |
136, -840},
{ 72, -96, -832},
{ 72, -200, -824},
{ 184, -240, -792},
{ 224, -448, -768},
{ 192, -432, -864},
{ 296, -544, -728},
{ 256, -504, -864},
{ 264, -448, -856},
{ 184, -472, -904},
{ 200, -472, -880},
// 105 seconds
{ 192, -328, -856},
{ 184, -344, -888},
... | { 336, 352, -856},
{ 328, 288, -864},
{ 344, 232, -984},
{ 328, 144, -960},
{ 264, -464, -616},
{ 320, -320, -872},
{ 304, -376, -816},
{ 304, -448, -768},
{ 304, -432, -784},
{ 288, -400, -816},
{ 272, -432, -808},
{ 240, -440, -808},
{ 240, -480, -784},
{ 240, -... |
{ 136, -152, -1032},
{ 136, -136, -872},
{ 128, -208, -872},
{ 120, -128, -992},
{ 128, -48, -976},
// 113 seconds
{ 136, -32, -912},
{ 120, -96, -952},
{ 136, -128, -912},
{ 152, -104, -936},
{ 136, -168, -928},
{ 160, -88, -952},
{ 248, 96, -1072},
{ 120, -424,... |
66B7", },
{ -2147483647LL, 15, "-c87e66b7", },
{ 2147483646LL, 16, "7FFFFFFE", },
{ 2147483646LL, 16, "7ffffffe", },
{ -2147483647LL, 16, "-7FFFFFFF", },
{ -2147483647LL, 16, "-7fffffff", },
{ 2147483646LL, 17, "53G7F547", },
{ 2147483646LL, 17, "53g7f547", },
{ -2147483647LL, 17, "-53G7F548", },
{ -2... | (" -", NULL, 10) | , 0);
cl_assert_equal_i(strtol("-", NULL, 10), 0);
cl_assert_equal_i(strtol(" +", NULL, 10), 0);
cl_assert_equal_i(strtol("+", NULL, 10), 0);
cl_assert_equal_i(strtol(" -+123", NULL, 10), 0);
cl_assert_equal_i(strtol("+-123", NULL, 10), 0);
}
void test_strtol__end(void) {
char *end;
char *s;
s = "";
... |
,
* 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 "board/board.h"
#include "drivers/mic.h"
#include "drivers/accessory.h"
#include "kernel/events.h"
#include "kernel/pbl_mal... | (AccessoryInputStateMic) | ) {
PBL_LOG(LOG_LEVEL_ERROR, "The accessory is already in use!");
return;
}
s_timeout = strtol(timeout_str, NULL, 10);
if (s_timeout <= 0) {
s_timeout = 1;
} else if (s_timeout > MAX_TIMEOUT) {
s_timeout = MAX_TIMEOUT;
}
int volume = strtol(volume_str, NULL, 10);
mic_set_volume(MIC, MIN(v... |
tivitySession temp = sessions[i];
sessions[i] = sessions[j];
sessions[j] = temp;
}
}
}
}
// ----------------------------------------------------------------------------------------------
static MeasurementSystem prv_get_shell_prefs_metric_for_distance(void) {
#if !CAPABILITY_HAS_HEALTH_TRAC... | if (!prv_metric_aggregation_implemented(metric, time_start, time_end, aggregation, scope)) {
return HealthServiceAccessibilityMaskNotSupported;
} |
// Get our state
HealthServiceState *state = prv_get_state(false);
HealthServiceTimeRange time_range = {};
HealthServiceDailyHistory daily_history = {};
const HealthServiceAccessibilityMask accessible =
prv_get_range_and_daily_history(state, metric, time_start, time_end, &time_range,
... |
ebbleProcessMd* app_manager_get_current_app_md(void) {
return &s_app_md;
}
CommSessionCapability comm_session_get_capabilities(CommSession *session) {
if (!session) {
return 0;
}
return s_live_capabilities;
}
static CommSession *s_app_session_ptr;
CommSession *comm_session_get_current_app_session(void) {
... | comm_session_current_app_session_cache_has_capability(CommSessionExtendedNotificationService) | |
, 136},
{ 696, 24, 136},
{ 728, -16, 128},
{ 776, 0, 88},
{ 1000, -40, 56},
{ 1120, 8, 16},
// 89 seconds
{ 1592, -40, 56},
{ 1632, 24, 160},
{ 1112, 456, -168},
{ 1040, 432, -240},
{ 1104, 312, 80},
{ 792, 168, 88},
{ 768, 120, 120},
{ 840, 312, 40},
{ 848, 4... | { 856, 296, 56},
{ 832, 344, -24},
{ 816, 416, -104},
{ 840, 432, -120},
{ 920, 416, -152},
{ 1208, 360, -136},
{ 1264, 272, 40},
{ 1880, 312, 64},
{ 1360, 312, 64},
{ 1080, 264, 88},
{ 1192, 136, 168},
// 95 seconds
{ 1168, 64, 240},
{ 984, 64, 200},
{ 784, 1... |
{ 744, -128, 88},
{ 824, -96, 0},
{ 800, -56, -48},
{ 1376, -264, 56},
{ 1304, 24, 160},
{ 1448, 104, 48},
{ 1584, 304, 0},
{ 1104, 336, 136},
{ 912, 248, 120},
{ 896, 288, 144},
{ 928, 296, 128},
{ 880, 352, 72},
{ 840, 416, -16},
{ 936, 456, -80},
{ 1136, 3... |
-128, -120},
{ 952, -112, -120},
{ 1000, -104, -136},
{ 976, -96, -120},
{ 992, -64, -136},
{ 1048, -56, -168},
{ 1072, -56, -168},
{ 1072, -112, -112},
{ 1672, -72, -264},
{ 1424, -88, -208},
{ 984, -96, -128},
{ 832, -88, -144},
{ 1160, -8, -224},
{ 1392, -72, -136}... | { 928, 112, -184},
{ 992, 112, -216},
{ 1168, 56, -224},
{ 1368, 56, -280},
{ 1272, 16, -248},
{ 1160, 72, -408},
// 168 seconds
{ 920, 80, -432},
{ 872, 144, -520},
{ 1000, 120, -456},
{ 1112, 184, -464},
{ 1120, 232, -472},
{ 1024, 256, -472},
{ 944, 376, -512},... |
{ -32, -152, -1056},
{ -96, -248, -992},
{ -56, -200, -968},
{ -112, -240, -896},
{ -144, -280, -856},
{ -144, -272, -848},
{ -144, -320, -872},
{ -160, -344, -840},
{ -192, -384, -824},
{ -200, -400, -848},
{ -232, -384, -832},
{ -256, -424, -824},
{ -264, -400, -85... |
/*
* 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_handle_init();
app_event_loop();
// Bring us out of test mode. Do this on the kernel main thread as this app is currently
// closing and if we take too long we'll get force-killed.
bt_ctl_reset_bluetooth();
} |
const PebbleProcessMd* mfg_bt_sig_rf_app_get_info(void) {
static const PebbleProcessMdSystem s_app_info = {
.common.main_func = &s_main,
// UUID: 278f66e0-11a1-4139-a5f4-fceb64efcf55
.common.uuid = { 0x27, 0x8f, 0x66, 0xe0, 0x11, 0xa1, 0x41, 0x39,
0xa5, 0xf4, 0xfc, 0xeb, 0x64, 0xef,... |
ackground(menu_layer, ctx, &menu_layer->scroll_layer.layer, false);
}
MenuRenderIterator *render_iter = applib_type_malloc(MenuRenderIterator);
PBL_ASSERTN(render_iter);
if (menu_layer->center_focused) {
// in this mode, the selected row is always the best candidate for the cache
menu_layer->cache.cur... | (&menu_layer->inverter.layer) | ;
scroll_layer_deinit(&menu_layer->scroll_layer);
}
void menu_layer_destroy(MenuLayer* menu_layer) {
if (menu_layer == NULL) {
return;
}
menu_layer_deinit(menu_layer);
applib_free(menu_layer);
}
Layer* menu_layer_get_layer(const MenuLayer *menu_layer) {
return &((MenuLayer *)menu_layer)->scroll_layer.... |
/*
* 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... | app_message_inbox_receive(session, (AppMessagePush *) message, length, consumer_info) | ;
return;
case CMD_REQUEST:
// Incoming request for an update push:
// TODO PBL-1636: decide to implement CMD_REQUEST, or remove it
return;
case CMD_ACK:
case CMD_NACK:
// Received ACK/NACK in response to previously pushed update:
app_message_out_handle_ack_nack_receive... |
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,
* WITHOUT WARRA... | ARRAY_LENGTH(s_connections) | |
PBL_HEXDUMP(LOG_LEVEL_INFO, (const uint8_t *)&bonding->pairing_info.local_encryption_info.ltk,
sizeof(bonding->pairing_info.local_encryption_info.ltk)) | ;
PBL_HEXDUMP(LOG_LEVEL_INFO, (const uint8_t *)&bonding->pairing_info.local_encryption_info.rand,
sizeof(bonding->pairing_info.local_encryption_info.rand));
PBL_HEXDUMP(LOG_LEVEL_INFO, (const uint8_t *)&bonding->pairing_info.local_encryption_info.ediv,
sizeof(bonding->pairing_info.local_... | |
CONDS_PER_MINUTE) + 30);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("IN 30 MIN", time_buf);
// June 10th 2015, 13:30:59 (T-00:29:01)
rtc_set_time(event_time - (30 * SECONDS_PER_MINUTE) + 59);
clock_get_until_time_capitalized(time_buf, sizeof(... | (time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS) | ;
cl_assert_equal_s("IN 12 H", time_buf);
// June 12th 2015, 00:00:01 (T-11:59:59)
rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) + 1);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("IN 12 H", time_buf);
// June 12th 2015, 00:29:29 (T-11:3... |
t's still a valid value as we assume grect_get_max_x(.bounds) < .row_size_bytes * bpp
// that way this is an efficient implementation of this functions contract
.max_x = grect_get_max_x(&bitmap->bounds) - 1,
};
}
}
MOCKABLE GBitmapDataRowInfo gbitmap_get_data_row_info(const GBitmap *bitmap, uint1... | {
return false;
} | |
#include "drivers/battery.h"
#include "drivers/exti.h"
#include "drivers/gpio.h"
#include "board/board.h"
#include "drivers/otp.h"
#include "drivers/periph_config.h"
#include "system/logging.h"
#define STM32F2_COMPATIBLE
#include <mcu.h>
#include <stdlib.h>
#include <string.h>
#include "kernel/events.h"
#include "... | (BOARD_CONFIG_POWER.chg_en.gpio, &GPIO_InitStructure) | |
e_ble_bonding_from_bt_driver();
shared_prf_storage_erase_ble_pairing_data();
prv_call_ble_bonding_change_handlers(bonding, BtPersistBondingOpWillDelete);
}
bool bt_persistent_storage_get_ble_pairing_by_id(BTBondingID bonding,
SMIdentityResolvingKey *IRK_out,
... | bt_persistent_storage_delete_bt_classic_pairing_by_id(BT_CLASSIC_BONDING_ID) | ;
}
bool bt_persistent_storage_get_bt_classic_pairing_by_id(BTBondingID bonding,
BTDeviceAddress *address_out,
SM128BitKey *link_key_out,
char *name_out,
... |
ICENSE-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
* limitations unde... | (sizeof(BlobDBSyncSession)) | ;
session->state = BlobDBSyncSessionStateIdle;
session->db_id = db_id;
session->dirty_list = dirty_list;
session->session_type = session_type;
session->timeout_timer = (const RegularTimerInfo) {
.cb = prv_timeout_timer_callback,
.cb_data = session,
};
s_sync_sessions = (BlobDBSyncSession *)list_pr... |
y registered server got disconnected
change_type = Disconnected;
s_music_ctx.implementation = NULL;
PBL_LOG(LOG_LEVEL_INFO, "Music server disconnected: %s", implementation->debug_name);
} else {
PBL_LOG(LOG_LEVEL_ERROR, "Unknown server <%p> disconnected", implementation);
}
}
if (ch... | mutex_lock_recursive(s_music_ctx.mutex) | ;
if (title) {
strcpy(title, s_music_ctx.title);
}
if (artist) {
strcpy(artist, s_music_ctx.artist);
}
if (album) {
strcpy(album, s_music_ctx.album);
}
mutex_unlock_recursive(s_music_ctx.mutex);
}
bool music_get_player_name(char *player_name_out) {
mutex_lock_recursive(s_music_ctx.mutex);... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | window_set_user_data(window, data) | |
_out, data_out_size), 0);
// Free up 2 bytes at the beginning:
circular_buffer_consume(&buffer, 2);
// Write data that will be wrapped:
cl_assert_equal_b(circular_buffer_write(&buffer, (uint8_t *)"456789", 6), true);
cl_assert_equal_i(circular_buffer_copy_offset(&buffer, 2 /* start_offset */,
... | (true, circular_buffer_read_or_copy(&buffer, &data_out, sizeof(storage),
malloc, &caller_should_free)) | ;
cl_assert_equal_b(true, caller_should_free);
cl_assert_equal_m(data_out, "12345678", sizeof(storage));
free(data_out);
// Test OOM scenario:
cl_assert_equal_b(false, circular_buffer_read_or_copy(&buffer, &data_out, sizeof(storage),
prv_oom_malloc, &ca... |
a->timeline_layer);
animation_set_handlers(day_sep_hide, (AnimationHandlers){
.stopped = prv_hide_day_sep_stopped,
}, data);
data->current_animation = day_sep_hide;
animation_schedule(day_sep_hide);
}
static bool prv_attempt_hide_day_sep(TimelineAppData *data) {
if (data->state == TimelineAppStateDaySepa... | {
animation_set_handlers(move_animation, (AnimationHandlers) {
.stopped = prv_up_down_stopped,
}, data);
} |
data->current_animation = move_animation;
animation_schedule(move_animation);
done:
if (data->timeline_model.direction == TimelineIterDirectionPast) {
analytics_inc(ANALYTICS_DEVICE_METRIC_TIMELINE_PAST_NAVIGATION_COUNT, AnalyticsClient_System);
} else {
analytics_inc(ANALYTICS_DEVICE_METRIC_TIMELINE... |
gpoint_scale_by_gsize_to_zero(void) {
GSize from = GSize(10, 20);
GSize to = GSizeZero;
GPoint point = GPoint(10, 10);
GPoint result = GPointZero;
result = gpoint_scale_by_gsize(point, from, to);
cl_assert_equal_i(result.x, 0);
cl_assert_equal_i(result.y, 0);
}
#define cl_assert_equal_insets(i1, i2) \
... | PBL_IF_COLOR_ELSE(1,2) | );
#elif defined(PLATFORM_SNOWY)
cl_assert_equal_i(1, PBL_IF_COLOR_ELSE(1,2));
#elif defined(PLATFORM_SPALDING)
cl_assert_equal_i(1, PBL_IF_COLOR_ELSE(1,2));
#else
#error "unknown platform"
#endif
}
void test_gtypes__color_fallback(void) {
#if defined(PLATFORM_TINTIN)
cl_assert_equal_i(2, COLOR_FALLBACK(1,2));
#... |
buffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS});
test_graphics_context_init(&s_ctx, fb);
framebuffer_clear(fb);
// Setup resources
fake_spi_flash_init(0, 0x1000000);
pfs_init(false);
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTU... | dialog_set_text(dialog, "Alarm Deleted") | |
/*
* 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... | app_manager_is_initialized() | ) {
app_manager_launch_new_app(&(AppLaunchConfig) {
.md = panic_app_get_app_info(),
});
}
}
|
bool should_store;
bool is_complete = hdlc_streaming_decode(&s_read_info.hdlc_ctx, &data, &should_store, &hdlc_err);
if (hdlc_err) {
// the rest of the frame is invalid
s_read_info.should_drop = true;
} else if (is_complete) {
prv_handle_complete_frame(&should_context_switch);
} else if (should_st... | (PebbleTask_KernelBackground) | ;
smartstrap_state_assert_locked_by_current_task();
// we expect the arguments to be valid
const bool is_read = (read_mbuf != NULL);
PBL_ASSERTN((profile > SmartstrapProfileInvalid) && (profile < NumSmartstrapProfiles));
PBL_ASSERTN(!is_read || (mbuf_get_chain_length(read_mbuf) > 0));
PBL_ASSERTN((!write_mb... |
/*
* 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_release_button(BUTTON_ID_SELECT) | |
&ctx.dest_bitmap, "draw_rect_origin_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 11);
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi"));
se... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw4_clip_nxny.${BIT_DEPTH_NAME}.pbi")) | ;
#endif
// AA = true, SW = 5
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 5);
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw5_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_... |
ace(&entry);
}
bool app_install_has_worker(AppInstallId id) {
AppInstallEntry entry;
bool exists = app_install_get_entry_for_install_id(id, &entry);
if (!exists) {
return false;
}
return app_install_entry_has_worker(&entry);
}
bool app_install_is_hidden(AppInstallId id) {
AppInstallEntry entry;
bool... | load_fixture_on_pfs(APP1_WORKER_FIXTURE_NAME, filename_buf) | ;
resource_storage_get_file_name(filename_buf, sizeof(filename_buf), 1);
load_fixture_on_pfs(APP1_RESOURCES_FIXTURE_NAME, filename_buf);
// simulate installing app2 on flash
app_db_insert((uint8_t *)&menu_layer.uuid, sizeof(Uuid), (uint8_t *)&menu_layer, sizeof(AppDBEntry));
menu_layer_id = app_db_get_instal... |
\nGot line: %s", line);
// Find first token
char *token = strtok(line, " \t\n");
if (!token) {
continue;
}
// If this is a pre-processor directive, skip it
if (token[0] == '#') {
continue;
}
// If this is a comment skip it
if (strcmp(token, "//") == 0) {
continue... | strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") | == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.force_shut_down_at);
} else if (strcmp(token, "TEST_WEIGHT") == 0) {
sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight);
} else if (strcmp(token, "TEST_NAME") == 0) {
sscanf(token + strlen(token) + 1... |
if (s_ancs_client) {
s_ancs_client->alive_check_pending = false;
prv_set_state(ANCSClientStateAliveCheck);
//! Sends an ANCS attribute fetch (to the Control Point). The notification UID is invalid, ANCS
//! will reply with 0xA2 (invalid param)
const GetNotificationAttributesMsg dummy_cmd = {
... | (data, length, out_error) | ;
case CommandIDGetAppAttributes:
return ancs_util_is_complete_app_attr_dict(data, length, out_error);
default:
*out_error = false;
break;
}
return false;
}
static void prv_reassembly_handle_complete_response(const uint8_t* data, const size_t length) {
analytics_inc(ANALYTICS_DEVICE_ME... |
= &data[1];
hc_endpoint_enqueue_hci_cmd(hci_cmd, payload_len);
kernel_free(hci_data);
}
//! A barebones HCI CMD parser. Looks for an HCI start byte (0x1) and then
//! makes sure the param length is less than the static buffer we have for
//! holding a single command. If anything goes wrong, the state machine reset... | (buf, sizeof(buf), "HCI Event:") | ;
flush_data(buf);
for (int i = 0; i < payload_len; i++) {
snprintf(buf, sizeof(buf), " 0x%02x", hci_msg[i]);
flush_data(buf);
}
flush_data("\r\n");
if (s_response_callback) {
s_response_callback(status, e->payload);
}
return true;
}
bool bt_test_chip_in_test_mode(void) {
return s_test_... |
layer);
for (unsigned i = 0; i < selection_layer->num_cells; i++) {
if (selection_layer->selected_cell_idx == i) {
break;
}
starting_x_offset += selection_layer->cell_widths[i] + selection_layer->cell_padding;
}
// After the slider is done sliding then active cell is updated and filled in with ... | {
prv_draw_slider_slide(selection_layer, ctx);
} |
if (selection_layer->slide_settle_anim_progress) {
prv_draw_slider_settle(selection_layer, ctx);
}
// Finally the text is drawn over everything
prv_draw_text(selection_layer, ctx);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Increment / Decrem... |
gnizerEvent_Started);
cl_assert(!s_manager_state_change);
cl_assert_passert(recognizer_transition_state(r, RecognizerState_Failed));
cl_assert_passert(recognizer_transition_state(r, RecognizerState_Possible));
cl_assert_passert(recognizer_transition_state(r, RecognizerState_Started));
recognizer_transition_s... | (r, prv_sub_destroy) | ;
// can't destroy a recognizer if it is owned
r->is_owned = true;
recognizer_destroy(r);
cl_assert_equal_b(impl_destroyed, false);
cl_assert_equal_b(sub_destroyed, false);
r->is_owned = false;
recognizer_destroy(r);
cl_assert_equal_b(impl_destroyed, true);
cl_assert_equal_b(sub_destroyed, true);
}
... |
ngth (%"PRIu32")", length);
return;
}
const FlashWriteRequest *request = payload;
length -= offsetof(FlashWriteRequest, data);
flash_write_bytes(request->data, request->address, length);
}
static void prv_handle_flash_read_request(const void *payload, uint32_t length) {
if (length < sizeof(FlashReadReq... | {
prv_handle_flash_geometry_request(payload, payload_length);
} | else if (header->opcode == OPCODE_FLASH_ERASE) {
prv_handle_flash_erase_request(payload, payload_length);
} else if (header->opcode == OPCODE_FLASH_WRITE) {
prv_handle_flash_write_request(payload, payload_length);
} else if (header->opcode == OPCODE_FLASH_READ) {
prv_handle_flash_read_request(payload, ... |
ECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 3);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// TODO: Fix offset calculation and reenable this: - PBL-16509
#if SCREEN_CO... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw1_clip_nxny.${BIT_DEPTH_NAME}.pbi")) | ;
// SW = 2
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 2);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw2_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_... |
/*
* 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_is_valid_string("\xF0\x9F\x98\x84") | |
ics_draw_circle_${BIT_DEPTH_NAME}__offset_layer(void) {
GContext ctx;
Layer layer;
test_graphics_context_init(&ctx, fb);
layer_init(&layer, &GRect(10, 15, 28, 28));
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "dra... | (&ctx.dest_bitmap, "draw_circle_offset_aa_r1_clip_nxny.${BIT_DEPTH_NAME}.pbi") | );
}
extern void graphics_circle_quadrant_draw_1px_non_aa(GContext* ctx, GPoint p,
uint16_t radius,
GCornerMask quadrant);
void test_graphics_draw_circle_${BIT_DEPTH_NAME}__quadrants(void) {
GContext ctx;
tes... |
sizeof(Intersection));
// If either malloc failed, log message and cleanup
if (!intersections_up || !intersections_down) {
APP_LOG(APP_LOG_LEVEL_ERROR, GPATH_ERROR);
goto cleanup;
}
int intersection_up_count;
int intersection_down_count;
// convert clip coordinates to drawing coordinates
const ... | {
swapIntersections(&x_a, &x_b);
} |
// this is done by callback now...
// x_a.x.integer++;
// x_b.x.integer--;
cb(ctx, i, x_a.x, x_b.x, x_a.delta, x_b.delta, user_data);
}
}
}
// restore original stroke color
ctx->draw_state.stroke_color = tmp;
cleanup:
applib_free(rot_points);
applib_free(intersect... |
v_fill_points(points, points_num);
points_num = 0;
ADD_P(step->pt);
break;
}
case RockyAPIPathStepType_LineTo: {
ADD_P(step->pt);
break;
}
case RockyAPIPathStepType_Arc: {
rv = rocky_error_argument_invalid("fill() does not support arc()");
... | jerry_create_undefined() | ;
}
TRY_ALLOCATE_STEPS_OR_RETURN_ERROR(1);
do {
step--;
if (step->type == RockyAPIPathStepType_MoveTo) {
// add a lintTo() at the end
s_rocky_path_steps[s_rocky_path_steps_num++] = (RockyAPIPathStep) {
.type = RockyAPIPathStepType_LineTo,
.pt = step->pt,
};
break;... |
ers_can_snooze(item));
const bool has_dismiss_all_action = ((dismiss_action) &&
(notifications_presented_list_count() > 1));
const bool has_quiet_time_action = true; // Always true
const bool has_ancs_mute_action = prv_has_mute_action(item);
uint8_t num_local_actions = 0... | action_menu_level_add_action(mute_level,
i18n_get("Mute Weekdays", root_level),
prv_mute_notification_weekdays,
window_data) | ;
}
ios_notif_pref_db_free_prefs(notif_prefs);
}
if (has_dismiss_all_action) {
action_menu_level_add_action(root_level,
i18n_get("Dismiss All", root_level),
prv_dismiss_all_action_cb,
window_data);
}
... |
P_TEST) {
int x1 = 50,
x2 = 100,
y1 = 40,
y2 = 120;
GPoint p0 = GPoint(x1, y1);
GPoint p1 = GPoint(x1, y2);
GPoint p2 = GPoint(x2, y2);
GPoint p3 = GPoint(x2, y1);
graphics_context_set_antialiased(ctx, true);
graphics_context_set_stroke_width(ctx, data->stroke_width);
graph... | if (data->operation == OP_ROTATE3) {
int line_length = 60;
time_t now;
uint16_t now_ms = time_ms(&now, NULL);
uint32_t seconds = pbl_override_localtime(&now)->tm_sec;
uint32_t miliseconds = seconds * 1000 + now_ms;
uint32_t rotation = miliseconds * TRIG_MAX_ANGLE / (60 * 1000);
GPointPreci... |
int x1, y1, x2, y2;
if (data->operation == OP_ROTATE) {
int line_length = 60;
x1 = data->canvas_layer->bounds.size.w / 2;
y1 = data->canvas_layer->bounds.size.h / 2;
x2 = (sin_lookup(data->rotation_angle) * line_length / TRIG_MAX_RATIO) + x1;
y2 = (-cos_lookup(data->rotation_angle) * line_le... |
/*
* 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 true;
} |
static bool s_modal_window_present = false;
Window* modal_manager_get_top_window(void) {
return (Window*)(uintptr_t)s_modal_window_present;
}
static int s_modal_manager_render_count;
void modal_manager_render(GContext *ctx) {
++s_modal_manager_render_count;
}
ModalProperty modal_manager_get_properties(void) {
... |
gap_le_get_scan_response_data(&scan_resp_data_out) | ,
sizeof(scan_resp_data));
cl_assert(memcmp(&scan_resp_data_out, scan_resp_data,
sizeof(scan_resp_data)) == 0);
// Expect one regular timer to be running for advertisements:
cl_assert_equal_i(regular_timer_seconds_count(), 1);
// Unschedule callback should not have been c... | |
/*
* 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... | framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}) | |
432},
{ 864, 536, 272},
{ 680, 392, 160},
{ 640, 256, 24},
{ 544, 168, 64},
{ 728, 336, 48},
{ 840, 504, 24},
{ 896, 600, 48},
{ 920, 624, 112},
{ 1032, 640, 104},
{ 1056, 608, -8},
{ 816, 448, 32},
{ 944, 520, -48},
{ 1488, 1240, 192},
{ 1056, 216, 432},
{ 4... | { 880, 280, 264},
{ 792, 24, 352},
{ 944, -8, 464},
{ 952, 280, 440},
{ 984, 464, 384},
{ 880, 560, 240},
{ 720, 464, 80},
{ 656, 288, 8},
{ 600, 168, 32},
{ 728, 320, 16},
{ 832, 520, 8},
{ 880, 664, 32},
{ 864, 608, 24},
{ 928, 608, 24},
{ 1032, 592, 8},
... | |
nt64_t time_search) {
bool rc = false;
PBL_ASSERTN(s_vibe_history_mutex);
mutex_lock(s_vibe_history_mutex);
VibeHistory *node = s_vibe_history;
while (node) {
if (node->time_end == END_NOT_SET && time_search >= node->time_start) {
rc = true;
break;
}
if (time_search >= node->time_star... | if (new_strength != VIBE_STRENGTH_OFF) {
vibe_set_strength(new_strength);
vibe_ctl(true /* on */);
if (s_vibe_strength == VIBE_STRENGTH_OFF) {
prv_vibe_history_start_event();
}
} else {
vibe_ctl(false /* on */);
if (s_vibe_strength != VIBE_STRENGTH_OFF) {
prv_vibe_history_end_event... | |
/*
* 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_delete(&storage->entries, entry);
} | |
"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 1);
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw1_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// AA = true, SW = 2
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO... | (&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
#endif
}
void test_graphics_draw_rect_${BIT_DEPTH_NAME}__origin_sw(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// SW = 1
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_... |
/*
* 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;
} |
return memcmp(uu1, uu2, sizeof(Uuid)) == 0;
}
bool uuid_is_system(const Uuid *uuid) {
return uuid_equal(uuid, &system_uuid);
}
bool uuid_is_invalid(const Uuid *uuid) {
return !uuid || uuid_equal(uuid, &invalid_uuid);
}
void uuid_to_string(const Uuid *uuid, char *buffer) {
if (!uuid) {
strcpy(buffer, "{N... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | launcher_task_add_callback(framebuffer_domain_close_cb, NULL) | ;
return S_SUCCESS;
}
PulseBulkIODomainHandler pulse_bulkio_domain_framebuffer = {
.id = PulseBulkIODomainType_Framebuffer,
.open_proc = framebuffer_domain_open,
.close_proc = framebuffer_domain_close,
.read_proc = framebuffer_domain_read,
.write_proc = framebuffer_domain_write,
.stat_proc = framebuffer... |
ite_byte(DISP_MODE_STATIC);
prv_display_write_byte(0x00);
prv_display_write_byte(0x00);
prv_disable_display_access();
}
// Helper to reverse command bytes
static uint8_t prv_reverse_bits(uint8_t input) {
uint8_t result;
__asm__ ("rev %[result], %[input]\n\t"
"rbit %[result], %[result]"
... | prv_display_enter_static() | ;
}
//! Display the progress of a firmware update.
//!
//! The progress is expressed as a rational number less than or equal to 1.
//! When numerator == denominator, the progress indicator shows that the update
//! is complete.
void display_firmware_update_progress(uint32_t numerator, uint32_t denominator) {
// Dime... |
prv_handle_app_event,
install_data);
}
//! Must be run from the app task
static void prv_do_app_added(AppMenuDataSource *source, AppInstallId install_id) {
AppInstallEntry entry;
if (!app_install_get_entry_for_install_id(install_id, &entry) ||
p... | grect_clip(&node->icon->bounds, &icon_clip) | ;
}
static void prv_unload_list_item_icon(const AppMenuDataSource *source, AppMenuNode *node) {
// Don't destroy the default icon here, we'll destroy it later.
if (node->icon && node->icon != source->default_icon) {
gbitmap_destroy(node->icon);
node->icon = NULL;
}
}
static void prv_load_list_if_needed(... |
cl_assert_equal_i(a_tuple->type, b_tuple->type);
cl_assert_equal_m(a_tuple->value, b_tuple->value, a_tuple->length);
a_tuple = dict_read_next(a);
b_tuple = dict_read_next(b);
}
if (b_tuple) {
cl_fail("Dictionary `B` contained more tuples than dictionary `A`.");
} else if (a_tuple) {
cl_fail... | if (message->transaction_id == TEST_TRANSACTION_ID_1) {
cl_assert_equal_b(s_ack_received_for_id_1, false);
s_ack_received_for_id_1 = true;
cl_assert_equal_i(message->command, CMD_ACK);
} else if (message->transaction_id == TEST_TRANSACTION_ID_2) {
cl_assert_equal_b(s_nack_received_for_id_2, false);
... |
}
static void prv_no_reply_callback(uint16_t endpoint_id,
const uint8_t* data, unsigned int length) {
}
// Overrides
///////////////////////////////////
bool sys_app_pp_has_capability(CommSessionCapability capability) {
return true;
}
static int s_sys_psleep_last_millis;
void sys_psleep(int millis) {
s... |
ave the
//! value 0x03 (both bits set).
static const uint8_t VALID_FILE_HEADER_MAGIC = 0x02;
//! Which file we're writing to this boot. [0 - DEBUG_DB_NUM_FILES)
static int s_current_file_index;
//! The id we're using for the current file.
static uint8_t s_current_file_id;
static int generation_to_index(int file_gener... | PBL_ASSERTN(file_generation >= 0 && file_generation < DEBUG_DB_NUM_FILES) | |
_border_stripe(layer, ctx, GAlignRight);
}
if ((data->state == DisplayCalibrationState_Y_Adjust) ||
(data->state == DisplayCalibrationState_Confirm)) {
prv_draw_border_stripe(layer, ctx, GAlignTop);
prv_draw_border_stripe(layer, ctx, GAlignBottom);
}
}
static void prv_draw_arrow(Layer *layer, GCont... | {
DisplayCalibrationData *data = window_get_user_data(window);
light_reset_user_controlled();
gbitmap_deinit(&data->arrow_down);
gbitmap_deinit(&data->arrow_left);
gbitmap_deinit(&data->arrow_up);
gbitmap_deinit(&data->arrow_right);
// reinitialize display offset now that values may have changed
shel... |
static void prv_init_arrow_bitmap(GBitmap *bitmap, uint32_t resource_id) {
gbitmap_init_with_resource(bitmap, resource_id);
// tint cyan
PBL_ASSERTN(bitmap->info.format == GBitmapFormat2BitPalette);
unsigned int palette_size = gbitmap_get_palette_size(bitmap->info.format);
GColor *palette = task_zalloc_che... |
te *state, const char *filter_name,
const char *params);
static const char *s_error_strings[] = {
"Success.",
"Can't resolve.",
"Missing closing brace.",
"Missing argument.",
"No result generated.",
"Unknown filter.",
"format() was not last filter.",
"Time unit in pred... | cl_assert_equal_s(s_output, "test string 5 seconds") | ;
cl_assert_equal_i(cond.eval_time, 1);
cl_assert_equal_b(cond.force_eval_on_time, true);
}
{
TemplateStringVars vars = {};
TemplateStringError err = {};
TemplateStringEvalConditions cond = {};
vars.current_time = 0;
cond.eval_time = EVAL_FALL_THROUGH;
cond.force_eval_on_time = tru... |
/*
* 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_get_next(valid_gothic_codepoints_utf8) | ;
}
}
void test_utf8__emoji_codepoints(void) {
cl_assert(utf8_is_valid_string("\xF0\x9F\x98\x84"));
cl_assert(utf8_is_valid_string("😃"));
}
void test_utf8__copy_single_byte_char(void) {
utf8_t dest[5];
memset(dest, 0, 5);
size_t copied = utf8_copy_character(dest, (utf8_t *)"hello", 5);
cl_assert_equal... |
UNUSED KinoReelProcessor *processor) {
LauncherAppGlanceStructured *structured_glance = kino_reel_custom_get_data(reel);
if (!structured_glance) {
return;
}
GRect glance_frame = (GRect) { .origin = offset, .size = structured_glance->glance.size };
#if PLATFORM_ROBERT
const int16_t h... | NULL_SAFE_FIELD_ACCESS(structured_glance, data, NULL) | |
heduled && expire_ms <= 100);
PBL_LOG(LOG_LEVEL_DEBUG, "STT firing in %d ms", (int)expire_ms);
// Wait for it to fire
psleep(300);
PBL_ASSERTN(s_app_data->fired_time[timer_idx_0] != 0);
scheduled = new_timer_scheduled(s_app_data->timer[timer_idx_0], &expire_ms);
PBL_ASSERTN(!scheduled);
}
// ============... | new_timer_start(s_app_data->timer[0], 1, timer_callback, cb_data,
TIMER_START_FLAG_FAIL_IF_SCHEDULED) | ;
PBL_ASSERTN(!success);
}
// =================================================================================
void evented_timer_menu_cb(int index, void *ctx) {
void *cb_data = 0;
menu_callback_prefix(index, ctx);
// Test evented_timer
s_app_data->app_timer = app_timer_register(100 /*ms*/, timer_callb... |
/*
* 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... | (mktime(&real_leap), 1330509600) | ;
}
|
_wday, data->minutes_in_zone[0]);
activity_metrics_prv_set_metric(ActivityMetricHeartRateZone1Minutes, wday,
data->minutes_in_zone[0]);
activity_metrics_prv_set_metric(ActivityMetricHeartRateZone2Minutes, wday,
data->minutes_in_zone[1]);
... | (&file, key, key_len, averages->average, sizeof(averages->average)) | ;
prv_file_close_and_unlock(&file);
return (s == S_SUCCESS);
}
//! For test / debug purposes only
bool health_db_set_typical_values(ActivityMetric metric,
DayInWeek day,
uint16_t *values,
int num_values) {
char... |
/*
* 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... | {
CommSession *session = s_transport.session;
PBL_ASSERTN(session);
size_t bytes_remaining = comm_session_send_queue_get_length(session);
if (bytes_remaining == 0) {
return;
}
const size_t temp_buffer_size = MIN(bytes_remaining, QEMU_MAX_DATA_LEN);
uint8_t *temp_buffer = kernel_malloc_check(temp_buff... | |
/*
* 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... | (&layer, &ctx) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_y_origin_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_ny_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_ny_origin... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | launcher_app_glance_update_current_slice(glance) | ;
}
void launcher_app_glance_update_current_slice(LauncherAppGlance *glance) {
if (!glance || !glance->should_consider_slices) {
return;
}
const Uuid *uuid = &glance->uuid;
AppGlanceSliceInternal current_slice = {};
// If there's no current slice, this function won't modify the zeroed-out current_slice... |
_WARNING, "Found reminder with invalid key size %d; ignoring.",
info->key_len);
}
return true;
}
SerializedTimelineItemHeader hdr;
info->get_val(file, &hdr, sizeof(SerializedTimelineItemHeader));
// Restore flags & status
hdr.common.flags = ~hdr.common.flags;
hdr.common.status = ~hdr.common... | mutex_lock(storage->mutex) | ;
FindChildrenInfo info = {
.parent_id = *parent_id,
.num_children = 0,
.find_all = true,
};
status_t rv = settings_file_each(&storage->file, prv_each_find_children, &info);
if (rv) {
goto cleanup;
}
for (int i = 0; i < info.num_children; ++i) {
const void *key = &info.children_ids[i];... |
it back
ret = bt_persistent_storage_get_ble_pairing_by_id(id_1, &irk_out, &device_out, NULL /* name */);
cl_assert(ret);
cl_assert_equal_m(&irk_out, &pairing_1.irk, sizeof(irk_out));
cl_assert_equal_m(&device_out, &pairing_1.identity, sizeof(device_out));
// Store another pairing
SMPairingInfo pairing_2;
... | cl_assert_equal_i(s_ble_bonding_change_add_count, 3) | |
elay_spawn));
animation_get_elapsed(a, &elapsed_ms);
cl_assert_equal_i(elapsed_ms, -1 * (delay_spawn + delay_a));
animation_get_elapsed(b, &elapsed_ms);
cl_assert_equal_i(elapsed_ms, -1 * (delay_spawn + delay_b));
// Start
prv_advance_to_ms_with_timers(start_ms + 1);
cl_assert_equal_i(prv_count_handler... | prv_count_handler_entries(&s_stopped_handler_calls, b) | |
_6[7] = {false, false, false, false, true, false, false};
char alarm_day_text_6[32] = {0};
alarm_get_string_for_custom(schedule_6, alarm_day_text_6);
cl_assert_equal_s(alarm_day_text_6, "Thursdays");
bool schedule_7[7] = {false, false, false, false, false, true, false};
char alarm_day_text_7[32] = {0};
ala... | (ALARM_KIND_WEEKENDS, all_caps) | , "Weekends");
cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_JUST_ONCE, all_caps), "Once");
cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_CUSTOM, all_caps), "Custom");
all_caps = true;
cl_assert_equal_s(alarm_get_string_for_kind(ALARM_KIND_EVERYDAY, all_caps), "EVERY DAY");
cl_assert_equal_... |
etric, time_start, time_end, aggregation, scope)) {
return 0;
}
// Get our state
HealthServiceState *state = prv_get_state(true);
if (scope == HealthServiceTimeScopeOnce && prv_is_heart_rate_metric(metric)) {
return prv_hr_aggregate_averaged(state, metric, time_start, time_end, aggregation);
}
//... | if (!state->cache) {
return NULL;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.