prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
und_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT);
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... | gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi") | );
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 11);
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_sw11_clip_nxny.${BIT_DEPTH_NAME}.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... | {
AnimatedDemoData *data = window_get_user_data(window);
text_layer_init(&data->text_layer, &GRect(0, 0, 60, 60));
text_layer_set_background_color(&data->text_layer, GColorBlack);
text_layer_set_text_color(&data->text_layer, GColorWhite);
text_layer_set_text(&data->text_layer, "Press Buttons");
GFont gothic... | |
-------------------------------------------------------------------------------
static void prv_safe_strcat(char* dst, const char* src, int dst_space) {
int remaining = dst_space - strlen(dst);
if (dst_space > 0) {
strncat(dst, src, remaining);
}
dst[dst_space-1] = 0;
}
// --------------------------------... | prv_debug_cmd_sleep_sessions(0 /*index*/, s_data) | |
ion_direction(direction);
GColor swap_collapse_dot_color = collapse_dot_color;
collapse_dot_color = final_dot_color;
final_dot_color = swap_collapse_dot_color;
}
DotTransitionAnimationConfiguration config = {
.collapse_starting_animation = collapse_starting_animation,
.collapse_dot_color = col... | compositor_transition_app_to_app_should_be_skipped() | ) {
return NULL;
}
static const CompositorTransition s_impl = {
.init = prv_dot_transition_from_app_fetch_animation_init,
.update = prv_static_dot_transition_animation_update,
};
return &s_impl;
}
|
or the specific language governing permissions and
* limitations under the License.
*/
#include "drivers/display.h"
#include <stdbool.h>
#include "board/board.h"
#include "drivers/dbgserial.h"
#include "drivers/display/bootloader_fpga_bitstream.auto.h"
#include "drivers/display/ice40lp.h"
#include "drivers/flash/s... | prv_start_command(CMD_DRAW_SCENE) | ;
prv_send_command_arg(scene);
prv_end_command();
}
void prv_set_parameter(uint32_t param) {
prv_start_command(CMD_SET_PARAMETER);
// Send in little-endian byte order
prv_send_command_arg(param & 0xff);
prv_send_command_arg((param >> 8) & 0xff);
prv_send_command_arg((param >> 16) & 0xff);
prv_send_comma... |
ffset);
s_path_fill_precise_count++;
}
void gpath_draw_filled(GContext* ctx, GPath *path) {
s_fill_points = prv_copy_points(path->points, path->num_points, s_offset);
s_path_fill_count++;
}
void gpath_draw_outline_precise_internal(GContext *ctx, GPointPrecise *points, size_t num_points,
... | gdraw_command_set_fill_color(command, color) | ;
gdraw_command_draw(NULL, command);
cl_assert_equal_i(s_stroke_color.argb, GColorClearARGB8);
cl_assert_equal_i(s_fill_color.argb, GColorClearARGB8);
cl_assert_equal_i(s_stroke_width, 0);
cl_assert_equal_i(s_path_num_points, 0);
cl_assert_equal_b(s_path_open, false);
cl_assert_equal_i(s_path_fill_count, ... |
-104, 816, -696},
{ -80, 784, -624},
{ -88, 792, -440},
{ -160, 952, -344},
{ -216, 1024, -320},
{ -224, 1104, -248},
{ -208, 1000, -272},
{ -208, 976, -248},
{ -224, 928, -256},
{ -192, 912, -288},
{ -200, 920, -256},
{ -256, 768, -264},
{ -264, 864, -224},
{ -280, 8... | { -512, 448, -592},
{ -600, 488, -616},
{ -632, 344, -584},
// 142 seconds
{ -608, 384, -672},
{ -720, 496, -544},
{ -664, 432, -472},
{ -768, 456, -336},
{ -832, 792, -224},
{ -1008, 560, -56},
{ -912, 656, -40},
{ -872, 672, -112},
{ -664, 792, -312},
{ -608, 56... | |
32},
{ 1144, 616, -472},
{ 1024, 368, -376},
{ 784, 296, -288},
{ 768, 128, -256},
{ 904, 128, -248},
{ 1136, 152, -208},
{ 1456, 80, -168},
{ 1504, 112, -80},
{ 1296, 168, -40},
{ 1184, 192, -216},
{ 1160, -136, 312},
{ 704, -208, -88},
{ 696, -112, -392},
{ 992,... | { -152, 128, -616},
{ -176, 520, -568},
{ -136, 1016, -352},
{ -248, 1064, 32},
{ -232, 1136, 176},
{ -152, 872, 704},
{ -160, 800, 776},
{ -152, 600, 656},
{ -264, 792, 680},
{ -272, 744, 880},
{ -336, 624, 992},
// 202 seconds
{ -344, 648, 768},
{ -320, 664, 704... |
{ 32, 1264, 352},
{ 120, 984, 24},
{ 200, 808, -144},
{ 136, 992, -288},
{ 88, 976, -224},
{ 72, 880, -136},
{ 80, 936, -96},
{ 72, 1000, -80},
{ 48, 920, -128},
{ 56, 888, -256},
{ 24, 944, -272},
{ 56, 904, -224},
{ 72, 880, -192},
{ 48, 800, -272},
{ 80, 7... |
/*
* 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 (layer) {
rot_bitmap_layer_init(layer, bitmap);
} |
return layer;
}
void rot_bitmap_layer_deinit(RotBitmapLayer *rot_bitmap_layer) {
layer_deinit(&rot_bitmap_layer->layer);
}
void rot_bitmap_layer_destroy(RotBitmapLayer *rot_bitmap_layer) {
if (rot_bitmap_layer == NULL) {
return;
}
rot_bitmap_layer_deinit(rot_bitmap_layer);
applib_free(rot_bitmap_laye... |
/*
* 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 (test_image_bw->addr) {
free(test_image_bw->addr);
} | |
size = (GATT_CLIENT_SUBSCRIPTIONS_BUFFER_SIZE -
sizeof(GATTBufferedNotificationHeader));
gatt_client_subscriptions_handle_server_notification(s_connection, s_handle,
value, fill_entirely_size);
prv_assert_notification_event_... | {
bool has_more = true;
BLECharacteristic handle_out = ~0;
uint8_t out[1];
uint16_t value_length = sizeof(out);
const uint16_t next_length =
gatt_client_subscriptions_consume_notification(&handle_out, out, &value_length,
GAPLEClientApp, &has_more);... |
void test_gatt_client_subscriptions__notification_consume_without_notification(void) {
BLECharacteristic characteristic = prv_get_indicatable_characteristic();
uint16_t value_length;
GATTBufferedNotificationHeader header = {
.characteristic = BLE_CHARACTERISTIC_INVALID,
.value_length = 0,
};
bool h... |
},
{ 1352, 264, -136},
{ 1544, 304, -240},
{ 1504, 256, -96},
{ 1304, 296, -304},
{ 1024, 384, -344},
{ 840, 416, -240},
{ 744, 496, -264},
{ 776, 560, -320},
{ 888, 592, -376},
{ 936, 632, -336},
{ 1016, 720, -344},
{ 960, 744, -264},
{ 1360, 720, -192},
{ 1168, ... | { 1480, 312, -216},
{ 1424, 192, 8},
// 110 seconds
{ 1176, 304, -384},
{ 840, 480, -360},
{ 744, 352, -224},
{ 760, 384, -232},
{ 824, 464, -320},
{ 856, 552, -312},
{ 864, 632, -296},
{ 952, 800, -320},
{ 936, 720, -296},
{ 1304, 704, -256},
{ 1296, 768, -376},
... |
{ 936, 680, -240},
{ 1168, 672, -208},
{ 1248, 752, -240},
{ 1344, 840, -248},
{ 1552, 784, -104},
{ 1616, 544, -24},
{ 1392, 368, -112},
{ 1176, 336, -80},
{ 1048, 328, -104},
{ 904, 232, -72},
{ 752, 168, -144},
// 113 seconds
{ 680, 104, -128},
{ 672, 64, -120... |
rrent_task, app_id);
if (state != NULL) {
session_ref = state->session_ref;
PBL_LOG(LOG_LEVEL_DEBUG, "Removing existing subscription for this app");
prv_remove_and_free_subscription(state);
}
}
// Get the session ref to use
if (session_ref == HRM_INVALID_SESSION_REF) {
session_ref =... | system_task_add_callback(prv_update_hrm_enable_system_cb, NULL) | ;
mutex_unlock_recursive(s_manager_state.lock);
return success;
}
DEFINE_SYSCALL(bool, sys_hrm_manager_is_hrm_present) {
return s_hrm_present;
}
void hrm_manager_enable(bool on) {
mutex_lock_recursive(s_manager_state.lock);
s_manager_state.enabled_run_level = on;
system_task_add_callback(prv_update_hrm_en... |
cal_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 0), MAX_NUM_ROWS + 1 );
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_odd_cols_no_clip")));
// Test to make sure drawing on all cols creates checkerboa... | TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_odd_cols_no_clip") | |
(LOG_LEVEL_ERROR, "Failed reading status") | ;
return false;
}
if (status == AS7000LoaderStatus_Ready) {
// ready
return true;
} else if ((status != AS7000LoaderStatus_Busy1) && (status != AS7000LoaderStatus_Busy2)) {
// error
PBL_LOG(LOG_LEVEL_ERROR, "Error status: %"PRIx8, status);
return false;
}
psleep(... | |
_state.current.width_px == 0);
}
void test_word_iterator__test_unprintable(void) {
// Allocate mutable types
Iterator word_iter = (Iterator) { 0 };
WordIterState word_iter_state = (WordIterState) { 0 };
// Allocate immutable types
bool success = false;
const Utf8Bounds utf8_bounds = utf8_get_bounds(&succe... | cl_assert(HORIZ_ADVANCE_PX * 2 == word_iter_state.current.width_px) | ;
cl_assert(iter_next(&word_iter));
cl_assert(*word_iter_state.current.start == '\n');
cl_assert(*word_iter_state.current.end == 'o');
cl_assert(iter_next(&word_iter));
cl_assert(*word_iter_state.current.start == 'o');
cl_assert(*word_iter_state.current.end == '\n');
cl_assert(iter_next(&word_iter));
... |
24},
{ -728, 560, -176},
{ -744, 664, -232},
{ -760, 720, -88},
{ -736, 720, -144},
{ -752, 800, -144},
{ -696, 656, -464},
// 70 seconds
{ -704, 552, -256},
{ -760, 688, -176},
{ -712, 560, -80},
{ -704, 552, 136},
{ -776, 544, 232},
{ -760, 672, 304},
{ -696, 85... | { -928, 488, -248},
{ -752, 40, -488},
{ -848, 272, -592},
{ -832, 416, -408},
{ -824, 384, -496},
{ -760, 208, -576},
{ -864, 472, -632},
{ -856, 592, -232},
{ -768, 352, -440},
{ -920, 448, -528},
{ -776, 56, -344},
{ -840, 360, -616},
{ -920, 368, -472},
{ -880... |
{ -896, 56, 528},
{ -824, 432, 584},
// 78 seconds
{ -752, 240, 824},
{ -968, 784, -256},
{ -736, 408, 416},
{ -824, 520, -104},
{ -616, 296, 104},
{ -792, 840, 760},
{ -760, 800, 544},
{ -744, 784, -240},
{ -824, 656, 512},
{ -704, 576, 336},
{ -712, 544, 312},
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | pbl_log_get_level_char(log_level) | ;
contents->task_char = pebble_task_get_char(task);
if (mcu_state_is_privileged()) {
contents->task_char = toupper(contents->task_char);
}
contents->time_ms = timestamp_ms;
// Obtain the filename
strncpy(contents->src_filename, GET_FILE_NAME(src_filename), sizeof(contents->src_filename));
// Obtain... |
-240},
{ 1000, 496, -152},
{ 1144, 416, -112},
{ 1088, 304, -56},
{ 1136, 272, -80},
{ 1200, 288, -40},
{ 1192, 288, -16},
{ 1104, 200, -48},
{ 1064, 168, -40},
{ 1120, 168, -104},
{ 1048, 152, -216},
{ 1048, 136, -328},
{ 1264, 96, -384},
{ 1000, 24, -232},
{ 93... | { 992, 544, -128},
{ 1424, 760, -24},
{ 1000, 632, -168},
{ 976, 512, -288},
{ 1032, 576, -256},
};
*len = ARRAY_LENGTH(samples);
return samples;
} |
// ----------------------------------------------------------------
// Sample captured: 2015-09-29 15:10:10 local
AccelRawData *activity_sample_walk_100_pbl_25298_2(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_25298_2
//> TEST_EXPECTED 100
//> T... |
clip_box.origin.y + clip_box.size.h);
// Remove offset from adjusted values
adjusted_top -= ctx->draw_state.drawing_box.origin.y;
adjusted_bottom -= ctx->draw_state.drawing_box.origin.y;
// Calculate distances from the middle of the circle (discard negative values)
int draw_max_top = MAX(center.y.integer -... | prv_draw_scanline_collision_points(ctx, center.y.integer, left, inner_left,
starting_edge, ending_edge, ignore_close_angles) | ;
prv_draw_scanline_collision_points(ctx, center.y.integer, inner_right, right,
starting_edge, ending_edge, ignore_close_angles);
} else {
prv_draw_scanline_collision_points(ctx, center.y.integer, left, right,
starting_edg... |
length;
PBL_LOG(LOG_LEVEL_DEBUG, "Wrote %zu bytes", length);
}
static void prv_system_test_receiver_finish(Receiver *receiver) {
++s_finish_count;
}
static void prv_system_test_receiver_cleanup(Receiver *receiver) {
++s_cleanup_count;
}
const ReceiverImplementation g_system_test_receiver_imp = {
.prepare = ... | cl_assert_equal_i(s_prepare_count, 1) | ;
}
void test_session_receive_router__app_disallowed_endpoint(void) {
// Expect "Disallowed" meta message to be replied to a message for an endpoint that is disallowed
// by use over a app session.
// The message should get eaten and not interfere with whatever comes next.
comm_session_close(s_session, CommSe... |
und_rect(ctx, &GRect(2, 12, 28, 20), 4);
}
void across_ny_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_round_rect(ctx, &GRect(2, -10, 28, 20), 4);
}
void test_graphics_draw_round_rect_${BIT_DEPT... | gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_clear.8bit.pbi") | );
#else
cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite));
#endif
}
#define RADIUS_DEFAULT 4
#define RECT_WIDTH 30
#define RECT_HEIGHT 40
#define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168)
#define ORIGIN_RECT_CLIP_XY GRect... |
#include "stubs_sleep.h"
#include "stubs_status_bar_layer.h"
#include "stubs_system_theme.h"
#include "stubs_syscalls.h"
#include "stubs_task_watchdog.h"
#include "stubs_tick.h"
#include "stubs_time.h"
#include "stubs_watchface.h"
#include "stubs_weather_service.h"
#include "stubs_weather_types.h"
#include "stubs_windo... | prv_render_launcher_menu_layer(LauncherMenuLayerTestApp_InteriorApp) | ;
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_launcher_menu_layer__no_icon_app_with_glance(void) {
// Insert a glance with a slice for the app that doesn't have a default icon
const AppGlance glance = (AppGlance) {
.num_slices = 1,
.slices = {
{
.expirat... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_ASSERTN(string_alloc_size != NULL) | ;
// Determine string buffer allocation size based on serialized data
uint8_t attributes_per_action[num_actions];
bool r = attributes_actions_parse_serial_data(num_attributes, num_actions, data, size,
string_alloc_size, attributes_per_action);
if (!r) {
retur... |
(EllipsisPartDrawConfig){TO_TRIG(30),GCornerTopRight},
.full_quadrants = GCornerNone,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(60),GCornerTopRight}
}));
// Starting quadrant filling up and ending quadrant finishing
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(45), TO_TRIG(270 + 45))... | (prv_calc_draw_config_ellipsis(TO_TRIG(70), TO_TRIG(90)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(70),GCornerTopRight},
.full_quadrants = GCornerNone,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(90),GCornerBottomRight}
})) | |
rceStoreEntry entry;
prv_get_store_entry(app_num, 0, &entry);
if (entry.impl) {
entry.impl->clear(&entry);
}
}
static bool prv_get_manifest_by_id(ResAppNum app_num, uint32_t resource_id,
ResourceManifest *manifest) {
ResourceStoreEntry entry;
prv_get_store_entry(app_num... | {
PBL_LOG(LOG_LEVEL_WARNING, "Resource %"PRId32" check for App %"PRIu32" failed",
resource_id, app_num);
return false;
} |
return true;
}
uint32_t resource_storage_generic_metadata_size(ResourceStoreEntry *entry) {
return RESOURCE_STORE_METADATA_BYTES;
}
bool resource_storage_generic_get_resource(ResourceStoreEntry *entry) {
ResourceManifest manifest;
prv_get_manifest(entry, &manifest);
if (entry->id > manifest.num_resources)... |
ommSession *session) {
prv_send_next(session, false /* is_callback */);
}
//! For unit test
//! bt_lock() is expected to be taken by the caller!
bool comm_session_send_next_is_scheduled(CommSession *session) {
return session->is_send_next_call_pending;
}
// --------------------------------------------------------... | {
return (CommSession *) list_find((ListNode *) s_session_head,
prv_find_session_is_type_filter, (void*)session_type);
} |
static CommSession *prv_get_system_session(void) {
// Attempt to explicitly find and return a session that isn't QEMU or PULSE
CommSession *session = (CommSession *) list_find((ListNode *) s_session_head,
prv_find_session_is_system_filter, NULL);
if (session) {... |
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language gov... | get_native_color(color) | ;
const GColor bg_color = get_native_color(text_layer->background_color);
if (gcolor_equal(native_color, bg_color)) {
return;
}
text_layer->background_color = get_closest_gcolor2(native_color);
layer_mark_dirty(&(text_layer->layer));
}
void text_layer_legacy2_set_text_color_2bit(TextLayerLegacy2 *text_la... |
EXT_NODES);
GTextNodeContainer *container = &horiz_container->container;
horiz_container->horizontal_alignment = GTextAlignmentCenter;
char time_buffer[8];
char am_pm_buffer[4];
const time_t now = rtc_get_time();
/// Current time in 24 or 12 hour
const char *time_fmt = clock_is_24h_style() ? "%R" : "%l:... | (ctx, bounds) | ;
#endif
// draw outer ring
prv_draw_outer_ring(ctx, data->current_steps, data->daily_steps_avg,
fill_thickness, bounds, fill_color);
const int goal_line_length = PBL_IF_COLOR_ELSE(fill_thickness + 3, 12);
const int goal_line_width = 4;
// draw yellow goal line
prv_draw_goal_line(ct... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (FONT_KEY_GOTHIC_24_BOLD) | ,
cell_layer->is_highlighted ? fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD)
: fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
const int title_height = fonts_get_font_height(title_font);
GRect image_bounds = gbitmap_get_bounds(icon);
image_bounds.origin.x = (max_icon_w / ... |
y_animation_destroy does nothing
// if the argument is NULL
Animation *animation = property_animation_get_animation(scroll_layer->animation);
bool was_running = false;
if (animation) {
was_running = animation_is_scheduled(animation);
if (was_running) {
animation_unschedule(animation);
}
}
... | window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 100, scroll_layer_scroll_down_click_handler) | ;
// Set the context for the SELECT button:
window_set_click_context(BUTTON_ID_SELECT, get_callback_context(scroll_layer));
// Callback to provide the client to setup the SELECT button:
if (scroll_layer->callbacks.click_config_provider) {
scroll_layer->callbacks.click_config_provider(get_callback_context(s... |
{
if (s_window_timeouts_ms[i] == timeout_ms) {
return i;
}
} |
// Should never happen (only should happen if we remove a timeout and don't migrate the user
// to a new setting automatically
return DEFAULT_IDX;
}
static void prv_window_timeout_menu_select(OptionMenu *option_menu, int selection, void *context) {
alerts_preferences_set_notification_window_timeout_ms(s_windo... | |
anager_handle_touch_event(&e, &manager);
prv_compare_recognizers_processed((int[]) {3}, 1, &s_recognizers_handled);
prv_compare_recognizers_processed((int[]) {4, 0, 3, 1}, 4, &s_recognizers_reset);
cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown);
cl_assert_equal_i(recognizers[0]->state... | (&e, &manager) | ;
prv_compare_recognizers_processed((int[]) {4, 0 }, 2, &s_recognizers_handled);
prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset);
cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered);
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Started);
cl_assert_equal_i... |
(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text),
"Failed") | ;
prv_display_alert(data->debug_card.dialog_text);
goto exit;
}
PBL_LOG(LOG_LEVEL_DEBUG, "Got last %d minutes with UTC of %d (delta of %d min)", (int)chunk,
(int)utc_start, (int)(utc_start - prior_start) / SECONDS_PER_MINUTE);
const unsigned int k_num_last_minutes = 6;
if (chunk >= k_num_las... | |
s_is_le_advertising_enabled = false;
s_min_advertising_interval_slots = 0;
s_max_advertising_interval_slots = 0;
}
int GAP_LE_Advertising_Disable(unsigned int BluetoothStackID) {
s_is_le_advertising_enabled = false;
s_le_adv_connection_event_callback = NULL;
s_le_adv_connection_callback_param = 0;
s_min_a... | (s_le_adv_connection_event_callback != NULL) | ;
s_le_adv_connection_event_callback(1, event, s_le_adv_connection_callback_param);
}
void fake_gap_put_connection_event(uint8_t status,
bool is_master,
const BTDeviceInternal *device) {
GAP_LE_Connection_Complete_Event_Data_t event_data =
... |
(PebbleHRMEvent)) {
circular_buffer_consume(&s_manager_state.system_task_event_buffer, sizeof(PebbleHRMEvent));
++s_manager_state.dropped_events;
}
circular_buffer_write(&s_manager_state.system_task_event_buffer,
(const uint8_t *)event, sizeof(PebbleHRMEvent));
}
static void prv_pop... | if (!stable_sensor && (feature == HRMFeature_BPM || feature == HRMFeature_HRV)) {
continue;
} |
if (state->callback_handler) {
// For kernel BG subscribers, we only queue one event of each type (which is then
// dispatched to all KernelBG subscribers from the KernelBG callback) so that we don't
// overfill our limited size circular buffer.
if (kernel_bg_features_sent & featu... |
/*
* 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_manager_is_app_window(window) | ) {
return (window == app_window_stack_get_top_window());
}
return callback(window);
}
bool window_manager_is_window_visible(Window *window) {
return prv_is_app_or_modal_predicate(modal_manager_is_window_visible, window);
}
bool window_manager_is_window_focused(Window *window) {
return prv_is_app_or_modal... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert(!error) | ;
ANCSAttribute* message = (ANCSAttribute*) attr_ptrs[3];
cl_assert(strncmp((char*) message->value, expected_message, message->length) == 0);
free(b);
}
void test_ancs_util__should_detect_duplicate_message(void) {
#if(0)
// Extract the dict
static const char* expected_message = "This is a very complicated... |
sys_hrm_manager_unsubscribe(s_activity_state.hr.hrm_session) | ;
protobuf_log_session_delete(s_activity_state.hr.log_session);
activity_metrics_prv_reset_hr_stats();
#endif // CAPABILITY_HAS_BUILTIN_HRM
}
// ----------------------------------------------------------------------------------------------
// Open the settings file and malloc space for the file struct
SettingsFi... | |
};
if (endpoint_id == ENDPOINT_ID) {
app_message_app_protocol_msg_callback(session, (const uint8_t*)&ack, sizeof(AppMessage), NULL);
} else {
cl_fail("Unhandled endpoint");
}
}
static void prv_nack_sent_callback(uint16_t endpoint_id, const uint8_t* data, unsigned int length) {
s_nack_sent_is_called ... | (endpoint_id, data, length) | ;
return true;
}
static AppOutboxSentHandler s_app_outbox_sent_handler;
static void *s_app_outbox_ctx;
static void prv_call_outbox_sent(int status) {
cl_assert(s_app_outbox_sent_handler);
s_app_outbox_sent_handler(status, s_app_outbox_ctx);
}
void app_outbox_send(const uint8_t *data, size_t length,
... |
ontainer's axis after drawing each child.
GRect box;
//! GRect of the clip box saved before apply a text node's draw box as its clip box. Only used
//! if the text node specifically requested clipping.
GRect cached_clip_box;
//! GSize representing the size of the container. Used by containers only. This size ... | (GTextNodeType_Horizontal,
sizeof(GTextNodeHorizontal), max_nodes) | ;
}
GTextNodeVertical *graphics_text_node_create_vertical(size_t max_nodes) {
return (GTextNodeVertical *)prv_create_container(GTextNodeType_Vertical,
sizeof(GTextNodeVertical), max_nodes);
}
GTextNodeCustom *graphics_text_node_create_custom(GTextNodeDrawCallback c... |
v_handlers_notify_state_changed(PulseLinkState_Open);
}
void pulse_end(void) {
prv_handlers_notify_state_changed(PulseLinkState_Closed);
pulse_llc_send_link_closed_msg();
for (unsigned int i = 0; i < ARRAY_LENGTH(s_receive_buffers); ++i) {
kernel_free(s_receive_buffers[i]);
}
s_current_receive_buffer = N... | (payload_length <= PULSE_MAX_SEND_SIZE, "PULSE frame payload too long") | ;
// Rewind the pointer to the beginning of the buffer
char *frame = ((char *) buf) - COBS_OVERHEAD(PULSE_MAX_SEND_SIZE) - LINK_HEADER_LEN;
size_t length = LINK_HEADER_LEN + payload_length;
uint32_t fcs = legacy_defective_checksum_memory(
frame + COBS_OVERHEAD(PULSE_MAX_SEND_SIZE), length);
memcpy(&fr... |
operties
0x14,
//// Num Descriptors
0x01,
////// Data descriptor
0x00, 0x00, 0x29, 0x02, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb,
///// Offset
EMULATED_DATA_CCCD_OFFSET,
0x00
};
typedef struct {
ble_service_t svc;
//! ATT handles
struct {
uint16_t data;
uin... | (LOG_LEVEL_ALWAYS, "Phone & Watch have hit CCCD, initiate PPoGatt WA!") | ;
hc_protocol_enqueue_with_payload(HcEndpointID_Gatt, HcMessageID_Gatt_WriteCompleted,
(uint8_t *)state->pending_response_data,
state->pending_data_size);
kernel_free(state->pending_response_data);
state->pending_response_data = NULL;
}
static... |
l(layer->bounds,
text_margin_x, text_margin_y);
GRect title_frame = (GRect) {
.size = GSize(max_text_container_frame.size.w, title_line_height)
};
GRect instruction_frame = (GRect) {
.size = GSize(max_text_container_frame.size.w,
... | {
prv_draw_arrow(layer, ctx, &data->arrow_up, GAlignTop);
} |
if (data->offset.y < MAX_OFFSET_MAGNITUDE) {
prv_draw_arrow(layer, ctx, &data->arrow_down, GAlignBottom);
}
break;
case DisplayCalibrationState_Confirm:
break;
}
}
static void prv_layer_update_proc(Layer *layer, GContext *ctx) {
DisplayCalibrationData *data = window_get_user_da... |
ss or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "../bitblt_private.h"
#include "applib/app_logging.h"
#include "applib/graphics/graphics.h"
#include "applib/graphics/graphics_private.h"
#include "applib/graphics/gtypes.h"
#include "s... | gbitmap_get_format(src_bitmap) | |
rv_unlock();
return connection;
}
Connection *connection_by_address_check(const BTDeviceInternal *addr) {
Connection *connection;
prv_lock();
{
connection = connection_by_address(addr);
PBL_ASSERTN(connection);
}
prv_unlock();
return connection;
}
static bool prv_connection_for_each_cb(ListNode ... | prv_lock() | |
lineIterDirectionFuture,
time_21_00_march_1_pst), S_SUCCESS);
// day 1
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->ti... | cl_assert_equal_i(state.node->timestamp, midnight_apr_28_pst) | ;
}
void test_timeline__all_day_ios_bug_2(void) {
TimelineItem item = {
.header = {
.id = {0x29, 0xac, 0xd8, 0xb5, 0x9, 0xc7, 0x4c, 0x31, 0xbf,
0x6f, 0x3, 0x64, 0xd0, 0x5b, 0x9b, 0xc2},
.parent_id = {0},
.timestamp = 1430200800, // 9am Apr 28, 2015 MSK
.duration = MINUT... |
/*
* 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_setup_state_config(ctx, &config, ActionToggleDialogType_Result) | ;
SimpleDialog *simple_dialog = simple_dialog_create(config.window_name);
prv_setup_dialog(simple_dialog_get_dialog(simple_dialog), &config, (void *)ctx);
simple_dialog_set_icon_animated(simple_dialog, !ctx->config.impl->result_icon_static);
simple_dialog_push(simple_dialog, prv_get_window_stack());
}
static b... |
teStopWaitForReady
StateRecording,
StateWaitForResponse, // StateStopRecording
StateWaitForResponse,
StateTransitionToText, // StateStopWaitForResponse
StateTransitionToText,
StateError,
StateFinished,
StateExiting,
};
_Static_assert(StateExiting < ARRAY_LENGTH(state_map), "The nu... | (ctx, grect_center_point(&layer->bounds), data->mic_window.mic_dot_radius) | ;
}
static void prv_set_dot_width(void *subject, int16_t radius) {
VoiceUiData *data = subject;
data->mic_window.mic_dot_radius = radius;
layer_mark_dirty(&data->mic_window.mic_dot_layer);
}
static PropertyAnimation *prv_create_int16_prop_anim(int16_t from, int16_t to,
... |
t_layer, GTextAlignmentCenter);
text_layer_set_overflow_mode(&data->text_layer, GTextOverflowModeTrailingEllipsis);
}
static void click_handler(ClickRecognizerRef recognizer, Window *window) {
AppState *data = window_get_user_data(window);
ButtonId button = click_recognizer_get_button_id(recognizer);
GRect fra... | (&data->direction_layer, GColorBlack) | ;
text_layer_set_text(&data->direction_layer, "Direction: Up/Down");
GFont gothic_14_bold = fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD);
text_layer_set_font(&data->direction_layer, gothic_14_bold);
text_layer_set_text_alignment(&data->direction_layer, GTextAlignmentCenter);
text_layer_set_overflow_mode(&da... |
(PeekLayer *peek_layer, GColor color) {
peek_layer->bg_color = color;
}
static bool prv_is_dot_size(GSize size) {
return (size.w <= UNFOLD_DOT_SIZE_PX && size.h <= UNFOLD_DOT_SIZE_PX);
}
void peek_layer_set_icon_with_size(PeekLayer *peek_layer, const TimelineResourceInfo *timeline_res,
... | if (timeline_res) {
AppResourceInfo res_info;
timeline_resources_get_id(timeline_res, res_size, &res_info);
to_reel = kino_reel_create_with_resource_system(res_info.res_app_num,
res_info.res_id);
} |
GSize size;
if (peek_layer->show_dot) {
size = UNFOLD_DOT_SIZE;
} else {
size = kino_reel_get_size(from_reel);
}
GRect layer_frame;
layer_get_global_frame((Layer *)&peek_layer->kino_layer, &layer_frame);
if (grect_equal(&icon_from, &GRectZero)) {
icon_from = (GRect) {
.origin.x = laye... |
F_DB_FILE_NAME = "iosnotifprefdb";
T_STATIC const int iOS_NOTIF_PREF_MAX_SIZE = KiBYTES(10);
typedef struct PACKED {
uint32_t flags;
uint8_t num_attributes;
uint8_t num_actions;
uint8_t data[]; // Serialized attributes followed by serialized actions
} SerializedNotifPrefs;
static PebbleMutex *s_mutex;
stati... | attributes_actions_get_required_buffer_size(serialized_prefs->num_attributes,
serialized_prefs->num_actions,
attributes_per_action,
string_alloc_size) | ;
iOSNotifPrefs *notif_prefs = kernel_zalloc_check(sizeof(iOSNotifPrefs) + alloc_size);
uint8_t *buffer = (uint8_t *)notif_prefs + sizeof(iOSNotifPrefs);
uint8_t *const buf_end = buffer + alloc_size;
attributes_actions_init(¬if_prefs->attr_list, ¬if_prefs->action_group,
&buffe... |
ctListNode *)list_pop_head((ListNode *)node);
kernel_free(temp);
}
}
unlock:
mutex_unlock_recursive(s_app_cache_mutex);
return rv;
}
//////////////////////
// AppCache Helpers
//////////////////////
// Remove the filename entry in the PFSFileList (via context) that corresponds to the
// app install id... | prv_delete_cached_files() | ;
goto unlock;
}
pfs_close(fd);
}
unlock:
mutex_unlock_recursive(s_app_cache_mutex);
prv_purge_orphaned_resource_files();
}
//! Adds an entry with the given AppInstallId to the cache
status_t app_cache_add_entry(AppInstallId app_id, uint32_t total_size) {
status_t rv;
mutex_lock_recursive(s_a... |
for the given aggregation type
static bool prv_metric_aggregation_implemented(HealthMetric metric, time_t time_start,
time_t time_end, HealthAggregation agg,
HealthServiceTimeScope scope) {
const time_t now_utc = sys_get_tim... | {
return false;
} |
// What day of the week is it now?
const time_t now_utc = sys_get_time();
struct tm *local_tm = pbl_override_localtime(&now_utc);
// Compute weekly, weekday, and daily stats
*stats = (HealthServiceMetricStats) {};
const StatsBasicOp op = (StatsBasicOp_Sum | StatsBasicOp_Average | StatsBasicOp_Count
|... |
/*
* 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... | state->handlers.availability_did_change(service_id, is_available) | |
t_error_t)PebblePairingServiceGATTError_ConnParamsMinSlotsTooLarge;
}
if (settings->connection_parameter_sets[i].interval_min_1_25ms +
settings->connection_parameter_sets[i].interval_max_delta_1_25ms >
LL_CONN_INTV_MAX_SLOTS) {
return (att_error_t)PebblePairingServiceGATTError_Co... | if (evt->handle == s_pps_ctx.att_hdl.trigger_pairing) {
const PairingTriggerRequestData *pairing_trigger_request =
(PairingTriggerRequestData *)evt->value;
prv_handle_trigger_pairing(evt->conn_idx, pairing_trigger_request);
} else if (evt->handle == s_pps_ctx.att_hdl.conn_status_cccd ||
e... |
ble_error_t e = ble_gatts_write_cfm(evt->conn_idx, evt->handle, rv);
if (e != BLE_STATUS_OK) {
PBL_LOG(LOG_LEVEL_ERROR, "ble_gatts_write_cfm: %u", e);
}
}
void pebble_pairing_service_handle_status_change(Connection *connection, uint16_t conn_idx) {
if (!connection_is_subscribed_to_connection_status_noti... |
_sessions(int index, void *context) {
ActivityDemoAppData *data = context;
// Allocate space for the sessions. Usually, there will only be about 4 or 5 sessions
// (1 container and a handful of restful periods). Allocating space for 32 (an arbitrary
// number) should be more than enough.
uint32_t num_session... | (data->debug_card.dialog_text) | ;
}
// -----------------------------------------------------------------------------------------
static void prv_debug_cmd_minute_data(int index, void *context) {
ActivityDemoAppData *data = context;
bool success;
const uint32_t k_size = 1000;
HealthMinuteData *minute_data = app_malloc(k_size * sizeof(Health... |
/*
* 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... | {
_write(0, str, strlen(str));
} |
void debug_print_hex(int val) {
char buffer[12] = { };
itoa(val, buffer, sizeof(buffer));
debug_print_str(buffer);
}
void debug_print_str_and_int(char *str, int value) {
debug_print_str(str);
debug_print_hex(value);
debug_print_str("\n");
}
|
tmap_pbi_eq(&ctx.dest_bitmap, "draw_text_jja00.${BIT_DEPTH_NAME}.pbi"));
// Test when clipping/drawing are at (2, 0) and text bounds is at (0, 0)
setup_test_aa_sw(&ctx, fb, RECT_TEXT_2_0, RECT_TEXT_2_0, false, 1);
graphics_context_set_text_color(&ctx, GColorBlack);
graphics_draw_text(&ctx, "jja", &s_font_info,... | (framebuffer_is_empty("draw_text_neg_w", fb, GColorWhite)) | ;
setup_test_aa_sw(&ctx, fb, RECT_TEXT_0_0, RECT_TEXT_0_0, false, 1);
graphics_context_set_text_color(&ctx, GColorBlack);
graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NEG_H,
GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL);
cl_check(framebuffer_is_empty("draw_text_neg_h",... |
ularBufferClient) {};
shared_circular_buffer_add_client(&buffer, &client);
// We should start out empty
cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 0);
// Write 2
cl_assert(shared_circular_buffer_write(&buffer, storage, 2, false));
cl_assert_equal_i(shared_circular... | (out_buffer, "9j0k1m", 6) | ;
}
void test_shared_circular_buffer__subsampling_variable_ratio(void) {
SharedCircularBuffer buffer;
uint16_t item_size = 2;
uint8_t storage[12*item_size];
uint8_t out_buffer[12*item_size];
shared_circular_buffer_init(&buffer, storage, sizeof(storage));
SubsampledSharedCircularBufferClient client = {};
... |
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 WARRANTIES OR CONDITIONS OF ANY KIND,... | prv_get_current_callbacks(data) | ;
prv_set_sub_menu_colors(ctx, cell_layer, highlight);
if (callbacks->draw_row) {
const bool is_selected = menu_cell_layer_is_highlighted(cell_layer);
callbacks->draw_row(callbacks, ctx, cell_layer, row, is_selected);
}
}
static uint16_t prv_get_num_rows_callback(MenuLayer *menu_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... | applib_type_size(GBitmapLegacy2) | |
= 0;
s_current_minute = 0;
// Default to Thursday
s_current_day = s_thursday;
timeline_item_destroy(s_last_timeline_item_added);
s_last_timeline_item_added = NULL;
s_last_timeline_item_removed_uuid = (Uuid) {};
fake_spi_flash_init(0, 0x1000000);
pfs_init(false);
pfs_format(false);
cron_service_i... | alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &custom_schedule1 }) | ;
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_CUSTOM, custom_schedule1);
bool custom_schedule2[7] = {false, false, false, false, false, true, false};
id = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &custom_schedule2 });
prv_assert_alarm_config(id,... |
/*
* 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... | {
debug_print_str("MemManag fault");
prv_handle_fault();
} |
void NMI_HandlerC(uint32_t *fault_args) {
debug_print_str("NMI Handler");
prv_handle_fault();
}
|
) {
type_matches = true;
} else {
type_matches = (session_a->type == session_b->type);
}
return type_matches && (session_a->start_utc == session_b->start_utc);
}
// ------------------------------------------------------------------------------------
// Register a new activity. Called by the algorithm c... | {
if ((session->type != ActivitySessionType_RestfulSleep)
&& (session->type != ActivitySessionType_RestfulNap)) {
continue;
}
if ((session->start_utc >= start_utc)
&& ((time_t)(session->start_utc + (session->length_min * SECONDS_PER_MINUTE)) <= end_utc)) {
restful_sec += session-... |
return restful_sec;
}
// --------------------------------------------------------------------------------------------
// Send an activity session (including sleep sessions) to data logging
void activity_sessions_prv_send_activity_session_to_data_logging(ActivitySession *session) {
ActivityState *state = activity... |
/ system tasks again to get th actual callback to trigger.
cl_assert_equal_i(s_out_sent_call_count, 1);
// Check that the state is reset properly after everything
cl_assert_equal_b(app_message_is_accepting_outbound(), true);
}
void test_app_message__send_happy_case_ack_then_outbox_sent(void) {
prv_set_remote_... | (app_message_outbox_begin(&iter), APP_MSG_BUSY) | ;
cl_assert_equal_i(app_message_outbox_send(), APP_MSG_BUSY);
}
void test_app_message__send_disconnected(void) {
prv_set_remote_receive_handler(prv_nack_sent_callback);
// Disconnect the comm session
s_is_connected = false;
// The return value should be APP_MSG_OK, even though we already know it's going to... |
(session, prv_try_read_token(data, length), BLOB_DB_TRY_LATER) | ;
return;
}
prv_blob_db_msg_decode_and_handle(session, cmd, data, data_length);
}
void blob_db_set_accepting_messages(bool enabled) {
s_bdb_accepting_messages = enabled;
}
| |
THRESHOLD(notification_layout_frame->size.h),
TEXT_VISIBLE_UPPER_THRESHOLD));
#else
const bool text_visible = render;
#endif
static const GRect box = {
.origin = { CARD_MARGIN, LAYOUT_TOP_BANNER_HEIGHT },
.size = { DISP_COLS - 2 * CARD_MARGIN, LAYOUT_MAX_HEIGHT },
};
static const... | {
NotificationLayout *layout = (NotificationLayout *)layout_ref;
if (layout->view_size.h == 0) {
prv_card_render(layout, graphics_context_get_current_context(), false);
}
return layout->view_size;
} | |
);
cl_assert(job);
// Minimum interval boundary (with scan resp):
char scan_resp_data[] = "scan resp data";
BLEAdData *ad_scannable = create_ad(NULL, scan_resp_data);
advert_term.min_interval_slots = 159;
advert_term.max_interval_slots = 159;
job = gap_le_advert_schedule(ad_scannable,
... | (job, NULL) | ;
cl_assert_equal_i(regular_timer_seconds_count(), 0);
}
void test_gap_le_advert__continue_after_slave_connection(void) {
BLEAdData *ad = create_ad(NULL, NULL);
GAPLEAdvertisingJobTerm advert_term = {
.min_interval_slots = 160,
.max_interval_slots = 320,
.duration_secs = 10,
};
GAPLEAdvertisingJo... |
ral(bus);
bus->state->initialized = true;
// SCLK
prv_configure_spi_sclk(&bus->spi_sclk, bus->spi_sclk_speed);
// MOSI
gpio_af_init(&bus->spi_mosi, GPIO_OType_PP, bus->spi_sclk_speed, GPIO_PuPd_NOPULL);
// MISO
if (is_bidirectional) {
gpio_af_init(&bus->spi_miso, GPIO_OType_PP, bus->spi_sclk_speed, GP... | prv_spi_acquire_helper(slave) | ;
uint8_t ret = spi_ll_slave_read_write(slave, out);
prv_spi_release_helper(slave);
return ret;
}
void spi_slave_write(const SPISlavePort *slave, uint8_t out) {
prv_spi_acquire_helper(slave);
spi_ll_slave_write(slave, out);
prv_spi_release_helper(slave);
}
void spi_slave_burst_read(const SPISlavePort *sla... |
backs_invoke_pending();
fake_event_reset_count();
fake_event_set_callback(prv_fake_hr_event_handler);
// Should not fire off an event. Bad HR reading
prv_advance_time_hr(1 /*sec*/, 0 /*hr*/, HRMQuality_Good, true /*force_continuous*/);
cl_assert_equal_i(s_num_hr_events, 0);
// Should fire off an event. G... | cl_assert_equal_i(metric_values[0], 22) | ;
cl_assert_equal_i(metric_values[1], 33);
cl_assert_equal_i(activity_metrics_prv_get_active_calories(), 22 * ACTIVITY_CALORIES_PER_KCAL);
activity_metrics_prv_set_metric(ActivityMetricRestingKCalories, Thursday, 2000);
activity_metrics_prv_set_metric(ActivityMetricRestingKCalories, Wednesday, 44);
activity_... |
ion *connection_by_address_check(const BTDeviceInternal *addr) {
Connection *connection;
prv_lock();
{
connection = connection_by_address(addr);
PBL_ASSERTN(connection);
}
prv_unlock();
return connection;
}
static bool prv_connection_for_each_cb(ListNode *found_node, void *data) {
ForEachCbData *... | (connection) | ) {
connection->is_gateway = is_gateway;
}
}
prv_unlock();
}
static char prv_debug_char_for_flag(ConnectionFlag flag) {
static const char s_debug_chars[] = {
[ConnectionFlag_IsSubscribedToConnectionStatusNotifications] = 'S',
[ConnectionFlag_IsSubscribedToGattMtuNotifications] = 'M',
[Conne... |
again
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check fourth
cl_assert(iter_next(&iterator));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id));
// check fifth
cl_assert(iter_next(&iterator));... | (&iterator) | );
}
// 5am, no events passed
void test_timeline__extra_case_none_backwards(void) {
prv_insert_extra_case_items();
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionP... |
//////////////////////////
#include "stubs_logging.h"
#include "stubs_passert.h"
// Tests
///////////////////////////////////////////////////////////
void test_utf8__decode_test_string_valid(void) {
static const int NUM_VALID_CODEPOINTS = sizeof(s_valid_test_codepoints) / sizeof(uint32_t);
bool is_valid = utf8_... | (dest, 0, 5) | ;
size_t copied = utf8_copy_character(dest, (utf8_t *)"\xf0hi", 5);
cl_assert_equal_i(copied, 0);
cl_assert_equal_s((char *)dest, "");
}
void test_utf8__get_size_truncate(void) {
cl_assert_equal_i(0, utf8_get_size_truncate("", 1));
cl_assert_equal_i(0, utf8_get_size_truncate("", 100));
cl_assert_equal_i(... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(job->cached_execute_time, target) | ;
job->cached_execute_time = UINT32_MAX;
job->clock_change_tolerance = 1;
prv_clock_change(0, 0, false);
cl_assert_equal_i(job->cached_execute_time, UINT32_MAX);
job->cached_execute_time = UINT32_MAX;
job->clock_change_tolerance = 1;
prv_clock_change(1, 0, false);
cl_assert_equal_i(job->cached_execute... |
/*
* 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... | (®ion_sub_bitmap, bitmap, *region) | ;
graphics_private_move_pixels_horizontally(®ion_sub_bitmap, delta_x, true /* patch_garbage */);
}
static void prv_copy_app_fb_patching_garbage(int16_t dest_origin_x) {
const GBitmap src_bitmap = compositor_get_app_framebuffer_as_bitmap();
GBitmap dest_bitmap = compositor_get_framebuffer_as_bitmap();
// Pa... |
m(prv_handle_alarm_editor_complete, data);
app_window_stack_push(editor, true);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Menu Layer Callbacks
static bool prv_is_add_alarm_cell(MenuIndex *cell_index) {
return cell_index->row == 0;
}
static uint16_t... | (ctx, GCompOpTint) | ;
// If the alarm is not smart, use the icon as spacing but don't render it.
// Otherwise if the alarm is smart draw according to the menu highlight.
graphics_context_set_tint_color(ctx, !node->info.is_smart ? GColorClear :
(cell_layer->is_highlighted ? GColorWhite : GColorB... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&send_header_mbuf, write_mbuf) | ;
// setup the MBuf chain for reading
s_read_header_mbuf = mbuf_get(&s_read_header, sizeof(s_read_header), MBufPoolSmartstrap);
mbuf_append(s_read_header_mbuf, read_mbuf);
SmartstrapResult result = smartstrap_send(SmartstrapProfileGenericService, &send_header_mbuf,
... |
partway through the delayof a
prv_advance_to_ms_with_timers(start_ms + 100);
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);
// -------------------------------------------------------------------------... | (b, delay_b) | ;
Animation *seq = animation_sequence_create(a, b, NULL);
animation_set_delay(seq, delay_seq);
animation_set_handlers(seq, handlers, seq);
animation_schedule(seq);
// The duration of seq should include all of b
uint32_t duration = animation_get_duration(seq, true, true);
cl_assert_equal_i(duration, dura... |
its
{ i18n_ctx_noop("TmplStringSing", " day"),
/// Plural suffix for days with full units
i18n_ctx_noop("TmplStringPlur", " days")},
};
#if SUPPORT_MONTH
static const char * const s_month_strings[3][2] = {
/// Singular suffix for months with no units
{ i18n_ctx_noop("TmplStringSing", ""),
/// Plural suff... | prv_do_conversion(state, value, 30 * SECONDS_PER_DAY, 12, s_month_strings,
add_units, zero_pad, modulus) | |
sert_equal_i(recognizers[3]->state, RecognizerState_Cancelled);
// Layer C's and layer A's recognizers get cancelled when there is no new active layer
prv_set_all_states(recognizers, k_rec_count, RecognizerState_Started);
prv_cancel_layer_tree_recognizers(&manager, NULL, &layer_c);
cl_assert_equal_i(recognizer... | cl_assert_equal_p(manager.active_layer, &layer_c) | ;
cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive);
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[3]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizer... |
id, true /* is_first_notification */);
modal_window_push(&data->window, NOTIFICATION_PRIORITY, true /* animated */);
} else if (in_view) {
// Only focus the new notification if it becomes the new front of the list.
// In DND mode notifications can get inserted into the middle of the list and we do... | notification_window_add_notification_by_id(id) | ;
if (should_focus) {
const bool animated = true;
notification_window_focus_notification(id, animated);
}
}
// This function is only used by the notifications_app.
// When it calls this function, it knows it is a valid notification already.
void app_notification_window_remove_notification_by_id(Uuid *id) {... |
should begin to decline - but should not reach the low value yet
fake_battery_set_millivolts(low_mv);
periodic_timer_trigger(1);
int delta = high_percent - battery_get_charge_state().charge_percent;
cl_assert(delta >= 0);
cl_assert(delta < high_percent - low_percent);
// But, it should approach that value ... | (s_power_state, PowerStateCritical) | ;
// critical -> lpm (only possible if unstable)
fake_battery_set_millivolts(low_mv);
battery_state_force_update();
periodic_timer_trigger(1);
cl_assert(s_in_low_power);
cl_assert_equal_i(s_power_state, PowerStateLowPower);
// lpm -> critical
fake_battery_set_millivolts(critical_mv);
periodic_timer_... |
{
prv_release_session_file(session);
}
if (!success) {
PBL_LOG(LOG_LEVEL_ERROR, "Nuking storage for session %d", session->comm.session_id);
dls_storage_delete_logging_storage(session);
}
return success;
}
// -----------------------------------------------------------------------------------------... | (logging_session->storage.fd, &chunk_hdr, sizeof(chunk_hdr)) | ) {
last_whole_items_read_bytes = -1;
goto exit;
}
// Reached the end of the valid data?
if (chunk_hdr.valid && chunk_hdr.num_bytes == DLS_CHUNK_HDR_NUM_BYTES_UNINITIALIZED) {
break;
}
// Valid data?
if (chunk_hdr.valid) {
if (buffer) {
if (chunk_hdr.num_bytes +... |
return;
}
time_t now_utc = rtc_get_time();
time_t total_paused_time_s = s_workout_data.current_workout->duration_completed_pauses_s;
if (workout_service_is_paused()) {
const time_t duration_current_pause = now_utc - s_workout_data.current_workout->last_paused_utc;
total_paused_time_s += duration_c... | (WORKOUT_ABANDON_WORKOUT_TIMEOUT_MS, false,
prv_abandon_workout_timer_callback, NULL) | ;
}
// ---------------------------------------------------------------------------------------
T_STATIC void prv_workout_timer_cb(void *unused) {
if (!workout_service_is_workout_ongoing()) {
return;
}
prv_lock();
{
// Update the duration
prv_update_duration();
// Check to make sure our HR sam... |
sult result = APP_GLANCE_RESULT_SUCCESS;
AppGlance *glance = app_state_get_glance();
// We use the glance set in the session as a crude way of validating the session
// Bail out if the session is invalid
if (!session || (glance != session->glance)) {
result |= APP_GLANCE_RESULT_INVALID_SESSION;
return... | (¤t_app_uuid, glance) | ;
}
|
_close(fd), S_SUCCESS);
}
}
static bool prv_filename_filter_a_prefix_cb(const char *name) {
return (strncmp(name, "a_", 2) == 0);
}
static bool prv_find_name(ListNode *node, void *data) {
PFSFileListEntry *entry = (PFSFileListEntry *)node;
return (strcmp(entry->name, (char *)data) == 0);
}
void test_pfs__fil... | cl_assert(fd >= 0) | ;
pfs_close(fd);
fd = pfs_open("a_test_1", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
pfs_close(fd);
fd = pfs_open("b_test_0", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
pfs_close(fd);
fd = pfs_open("b_test_1", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
p... |
// Stubs
//////////////////////////////////////////////////////////
#include "stubs_heap.h"
#include "stubs_hexdump.h"
#include "stubs_logging.h"
#include "stubs_mutex.h"
#include "stubs_passert.h"
#include "stubs_pbl_malloc.h"
#include "stubs_pebble_tasks.h"
#include "stubs_print.h"
#include "stubs_prompt.h"
#include... | strftime(tmbuf, sizeof(tmbuf), "%n %r", &jan_2_2015__13_00_00) | ;
cl_assert_equal_s(tmbuf, "\n 01:00:00 PM");
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%R %t %T", &jan_2_2015__13_00_00);
cl_assert_equal_s(tmbuf, "13:00 \t 13:00:00");
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%u %V", &jan_2_2015__13_00_00);
cl_assert_equal_s(tmbuf, "5 01");
tmbuf[0] ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (handle < UINT32_MAX) {
FILE* resource_file = resource_files[handle];
fseek(resource_file, 0, SEEK_END);
size_t resource_size = ftell(resource_file);
fseek(resource_file, 0, SEEK_SET);
return resource_size;
} |
return 0;
}
size_t sys_resource_load_range(ResAppNum app_num, uint32_t id, uint32_t start_bytes,
uint8_t *buffer, size_t num_bytes) {
if (buffer && id < UINT32_MAX) {
FILE* resource_file = resource_files[id];
fseek(resource_file, start_bytes, SEEK_SET);
return fread(buf... |
/*
* 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 (int32_t)
(jerry_get_number_value(value) * TRIG_MAX_ANGLE / (2 * M_PI)) + TRIG_MAX_ANGLE / 4;
} | |
nt8_t *val_out = malloc(val_len_out);
cl_must_pass(settings_file_get(&file_new, key, key_len, val_out, val_len_out));
if (val_len_out == original_value_length) {
printf("original! %d\n", original_value_length);
cl_assert_equal_m(original_value, val_out, val_len_out);
free(val_out);
retu... | settings_file_each(&file, prv_each_cb, counts) | |
ak;
case RecognizerState_Started:
PBL_ASSERTN((new_state == RecognizerState_Possible) ||
(new_state == RecognizerState_Cancelled) ||
(new_state == RecognizerState_Completed) ||
(new_state == RecognizerState_Updated));
break;
case RecognizerStat... | (recognizer) | );
PBL_ASSERTN(recognizer->impl);
PBL_ASSERTN(touch_event);
if (!prv_should_handle_touches(recognizer, touch_event)) {
return;
}
recognizer->handling_touch_event = true;
recognizer->impl->handle_touch_event(recognizer, touch_event);
recognizer->handling_touch_event = false;
}
void recognizer_reset(... |
ication), (uint8_t*) &ns_notification);
cl_assert_equal_i(fake_kernel_services_notifications_acted_upon_count(), 0);
// DIS service / iOS 9+ detected - enabling notification dismissal
ancs_handle_ios9_or_newer_detected();
prv_fake_receiving_ns_notification(sizeof(ns_notification), (uint8_t*) &ns_notification);... | (s_num_requested_notif_attributes, 2) | ;
cl_assert_equal_i(s_num_ds_notifications_received, 2);
cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1);
}
void test_ancs__get_notif_attributes_retry(void) {
s_gatt_client_op_write_should_fail_once = true;
prv_send_notification((uint8_t *)&s_complete_dict);
// We will be... |
},
.attr_list = {
.num_attributes = 0,
.attributes = NULL,
},
.action_group = {
.num_actions = 0,
.actions = NULL,
},
.allocated_buffer = NULL,
}
};
// Setup
/////////////////////////
void test_timeline_model__initialize(void) {
fake_spi_flash_init(0, 0x100000... | uuid_equal(&s_items[s_correct_order[3]].header.id,
&timeline_model_get_iter_state(-1)->pin.header.id) | );
cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id));
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_sta... |
{
PBL_LOG(LOG_LEVEL_DEBUG, ">>>>>FAIL FLASH TEST CASE %d, Status: %d<<<<<", test_case_num, status);
} |
// Re-enable watchdog state if previously enabled
if (previous_task_watchdog_state) {
task_watchdog_bit_set(pebble_task_get_current());
task_watchdog_mask_set(pebble_task_get_current());
}
return status;
}
#endif // CAPABILITY_USE_PARALLEL_FLASH
| |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (ctx, GPoint(5, 5)) | ;
}
void outside_x_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_draw_pixel(ctx, GPoint(15, 5));
}
void outside_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_draw_pixel(ctx, G... |
onst GRect *layer_frame = &swap_layer->layer.frame;
// don't allow scrolling up
if (current_frame->size.h < layer_frame->size.h) {
prv_scroll(swap_layer, -current_frame->size.h - current_frame->origin.y + layer_frame->size.h,
AnimationCurveEaseOut);
}
}
//! Attempt to swap up or down. 'full_sw... | if (offset >= swap_layer->current->layer.bounds.size.h - DISP_ROWS) {
prv_handle_swap_attempt(swap_layer, direction, is_repeating);
return;
} | |
/*
* 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... | {
++result;
} | else {
--result;
}
}
}
if (is_negative) {
result *= -1;
}
if (result > INT32_MAX || result < INT32_MIN) {
return false; // overflow
}
if (number_started && number_out) {
*number_out = result;
}
return number_started;
}
// ---------------------------------------------... |
-------------------------------------------------------
// Test the logic that detects naps. This logic is performed by the
// prv_sleep_sessions_post_process() method.
void test_activity_algorithm_kraepelin__sleep_post_process(void) {
// NOTE: All tests by default start at 5pm. Let's advance time to 9pm to give us m... | uint16_t session_entries = ARRAY_LENGTH(sessions);
activity_algorithm_post_process_sleep_sessions(session_entries, sessions);
cl_assert_equal_i(sessions[0].type, ActivitySessionType_Sleep);
}
{ // Create a 2 hour session that is still on-going - should register as normal sleep
time_t sleep_start_ut... |
// ---------------------------------------------------------------------------------------
// Test to make sure we don't get steps counted while sleeping
void test_activity_algorithm_kraepelin__steps_during_sleep(void) {
const int num_minutes = 120;
// The test data
AlgMinuteDLSSample minute_data[num_minutes];... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ble_root_keys_get_and_generate_if_needed(keys) | ;
prv_assert_key_is_equal_to_retrieved_key(&keys[SMRootKeyTypeEncryption], SMRootKeyTypeEncryption);
prv_assert_key_is_equal_to_retrieved_key(&keys[SMRootKeyTypeIdentity], SMRootKeyTypeIdentity);
}
void test_ble_root_keys__regenerate_if_key_not_present(void) {
// Pretend one of the root keys isn't there:
cl_wi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.