prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
false, 1);
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 1);
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY);
cl_check(gbitm... | (&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 11) | |
/*
* 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... | circular_buffer_consume(buffer, sizeof(*event)) | ;
}
static void prv_remove_and_free_subscription(HRMSubscriberState *state) {
list_remove((ListNode *)state, &s_manager_state.subscribers, NULL);
kernel_free(state);
}
#if UNITTEST
// Used by unit tests
T_STATIC TimerID prv_get_timer_id(void) {
return s_manager_state.update_enable_timer_id;
}
// Used by unit t... |
}
child->parent = NULL;
layer_set_window(child, NULL);
child->next_sibling = NULL;
}
void layer_remove_child_layers(Layer *parent) {
Layer *child = parent->first_child;
while (child) {
// Get the reference to the next now; layer_remove_from_parent will unlink them.
Layer *next_sibling = child->next_... | if (&layer->window->layer == layer) {
break;
} |
// follow how the drawing_box is computed to obtain the global frame
// see \ref layer_render_tree
point.x += layer->frame.origin.x + layer->bounds.origin.x;
point.y += layer->frame.origin.y + layer->bounds.origin.y;
layer = layer->parent;
}
return point;
}
GRect layer_convert_rect_to_screen(... |
/*
* 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... | (
"Our internal flash contents are bad (checksum failed)! "
"This is really bad!") | |
/*
* 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 (!gdraw_command_image_validate(draw_command_image, data_size)) {
gdraw_command_image_destroy(draw_command_image);
return NULL;
} |
return draw_command_image;
}
bool gdraw_command_image_copy(void *buffer, size_t buffer_length, GDrawCommandImage *src) {
size_t src_size = gdraw_command_image_get_data_size(src);
if (buffer_length < src_size) {
return false;
}
memcpy(buffer, src, src_size);
return true;
}
GDrawCommandImage *gdraw_c... |
atic KinoReel *prv_get_icon(LauncherAppGlanceStructured *structured_glance) {
LauncherAppGlanceWorkout *workout_glance =
launcher_app_glance_structured_get_data(structured_glance);
return NULL_SAFE_FIELD_ACCESS(workout_glance, icon, NULL);
}
static const char *prv_get_title(LauncherAppGlanceStructured *struc... | (workout_glance->subtitle) | ) {
memset(workout_glance->subtitle, 0, sizeof(workout_glance->subtitle));
glance_changed = true;
}
// Broadcast to the service that we changed the glance if it was changed
if (glance_changed) {
launcher_app_glance_structured_notify_service_glance_changed(structured_glance);
}
//... |
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 "system/logging.h"
#include "system/passert.h"
#include "util/bitset.h"
#include "util/graphics.h"
#include ... | (src_palette_size <= MAX_SUPPORTED_PALETTE_ENTRIES) | ;
// The bitblt loops:
int16_t src_y = src_begin_y + src_origin_offset.y;
int16_t dest_y = dest_rect.origin.y;
TwoRowLookUp look_ups;
prv_calc_two_row_look_ups(&look_ups, compositing_mode, palette, src_palette_size, tint_color);
while (dest_y < dest_y_end) {
if (src_y >= src_end_y) {
src_y = src... |
tmap, "fill_rect_origin_r1_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 2, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_no_clip.${BIT_DEPTH_NAME}.pbi"));
... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r5_aa_no_clip.${BIT_DEPTH_NAME}.pbi")) | ;
// TODO: Fix left corners PBL-15915
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 6, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r6_aa_no_clip.${BIT_DEPTH_NAME}.pbi"));
// TODO: Fix lef... |
init_struct.GPIO_Speed = GPIO_Speed_2MHz;
gpio_init_struct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(pin_config.gpio, &gpio_init_struct);
gpio_release(pin_config.gpio);
}
//! Configure bus pin as output
//! Lock bus and peripheral config access before use
static void bus_pin_cfg_output(AfConfig pin_config, bool p... | (BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_sda) | |
.dst_end = 0,
};
void test_cron__initialize(void) {
cron_service_init();
}
void test_cron__cleanup(void) {
cron_service_deinit();
}
static TimezoneInfo g_timezone;
static void prv_set_rtc(time_t t, const TimezoneInfo *tz_info) {
fake_rtc_init(0, t);
g_timezone = *tz_info;
time_util_update_timezone(&g_tim... | (job->cached_execute_time, target) | ;
cl_assert_equal_i(cron_service_get_job_count(), 0);
cron_clear_all_jobs();
}
static void prv_basic_test(const TimezoneInfo *tz_info, CronJob *job, time_t base,
time_t offset, time_t increment, int dst_type) {
TimezoneInfo new_tz_info = *tz_info;
switch (dst_type) {
case 0:
... |
splay the day separator
// by first hiding the pin of the "last" day that is about to come in and placing it there
if (layer->layouts[0]) {
prv_set_layout_hidden(layer->layouts[0], true);
}
prv_place_day_separator(layer);
} else {
// continue to hide the day separator
layer_set_hidden((L... | (animation, interpolate_moook_in_only) | ;
return animation;
}
static void prv_speed_lines_update(Animation *animation, AnimationProgress progress) {}
Animation *timeline_layer_create_speed_lines_animation(TimelineLayer *timeline_layer) {
static const AnimationImplementation s_speed_lines_impl = {
.update = prv_speed_lines_update,
};
Animation ... |
ain 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, either express or implied.
* See the License ... | ARRAY_LENGTH(attributes) | ,
.attributes = attributes
};
static uint8_t attr_list1_serialized[] = {
// Action Attributes
0x01, // Attribute ID - Title
0x07, 0x00, // Attribute Length
// Attribute text:
'D', 'i', 's', 'm', 'i', 's', 's',
};
static uint8_t attr_list2_serialized[... |
, AttributeIdIconTiny, timeline_res);
attribute_list_add_uint32(list, AttributeIdIconSmall, card_res ?: timeline_res);
attribute_list_add_uint32(list, AttributeIdIconLarge, card_res ?: timeline_res);
}
#define ARRAY_RAND(arr) arr[rand() % ARRAY_LENGTH(arr)]
static void prv_add_notification(int32_t delta_time_s) {... | attribute_list_add_cstring(&list, AttributeIdNameAway, "GSW") | ;
attribute_list_add_cstring(&list, AttributeIdRecordAway, "114-152");
attribute_list_add_cstring(&list, AttributeIdScoreAway, "86");
attribute_list_add_cstring(&list, AttributeIdNameHome, "CHI");
attribute_list_add_cstring(&list, AttributeIdRecordHome, "110-15");
attribute_list_add_cstring(&list, AttributeId... |
ool app_outbox_service_is_message_cancelled(AppOutboxMessage *message) {
return s_is_message_cancelled;
}
void app_outbox_service_cleanup_all_pending_messages(void) {
s_is_message_cancelled = true;
}
void comm_session_analytics_inc_bytes_sent(CommSession *session, uint16_t length) {
}
static CommSession s_system... | htons(sizeof(TEST_PAYLOAD)) | ;
header->endpoint_id = htons(ALLOWED_ENDPOINT_ID);
memcpy(TEST_EXPECTED_PP_MSG + sizeof(*header), TEST_PAYLOAD, sizeof(TEST_PAYLOAD));
app_message_sender_init();
cl_assert(s_outbox_message_handler);
}
void test_app_message_sender__cleanup(void) {
// Flush out to avoid other tests failing:
if (s_system_se... |
ect_polar_calc_values(&r, mode, ¢er, &radius);
cl_assert_gpoint_precise(center, 2, 2);
cl_assert_fixedS16_3(radius, 2);
r = GRect(0, 0, 6, 6);
grect_polar_calc_values(&r, mode, ¢er, &radius);
cl_assert_gpoint_precise(center, 2.5, 2.5);
cl_assert_fixedS16_3(radius, 2.5);
r = GRect(0, 0, 10, 10);
... | DEG_TO_TRIGANGLE(360) | |
nt_info));
test_graphics_context_init(&ctx, fb);
// Test zero text bounds size - ensure nothing is rendered
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_NULL,
GT... | graphics_context_set_text_color(&ctx, GColorBlack) | ;
graphics_draw_text(&ctx, "jja", &s_font_info, RECT_NULL,
GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL);
cl_check(framebuffer_is_empty("draw_text_null_null", fb, GColorWhite));
}
void test_graphics_draw_text_8bit__color(void) {
GContext ctx;
prv_setup_resources();
uint3... |
/*
* 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 (((SimpleMenuLayer*)callback_context)->sections[section_index].title) {
return MENU_CELL_BASIC_HEADER_HEIGHT;
} else {
return 0;
} |
}
static uint16_t get_num_sections(MenuLayer *menu_layer, void *callback_context) {
(void)menu_layer;
return ((SimpleMenuLayer*)callback_context)->num_sections;
}
static uint16_t get_num_rows(MenuLayer *menu_layer, uint16_t section_index, void *callback_context) {
(void)menu_layer;
return ((SimpleMenuLayer*)... |
/*
* 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... | pfs_close(fd) | ;
return length;
}
static uint32_t prv_file_common_get_crc(int fd, uint32_t num_bytes, uint32_t entry_offset) {
if (fd < 0) {
return 0xFFFFFFFF;
}
uint32_t crc = pfs_crc_calculate_file(fd, RESOURCE_STORE_METADATA_BYTES + entry_offset,
num_bytes);
pfs_close(fd);
r... |
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, either express or implied.
* See the License for the sp... | if (bus->state->transfer.direction == I2CTransferDirection_Read) {
bus->hal->i2c->CR1 |= I2C_CR1_RXIE; // Enable receive interrupt
} |
}
static void prv_resume_transfer(I2CBus *bus, bool generate_start) {
const I2CTransfer *transfer = &bus->state->transfer;
uint32_t cr2_value = transfer->device_address & I2C_CR2_SADD;
if ((transfer->direction == I2CTransferDirection_Read) &&
(transfer->state != I2CTransferState_WriteRegAddress)) {
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... | (task, TEST_TARGET_TASK) | |
GSize(cell_layer_bounds_size.w, title_text_frame_height),
};
// Update the title text frame's height using the max used size of the title text because we
// might only have one line of text to render even though we have space for two lines
title_text_frame_height = graphics_text_layout_get_max_used_size(
... | (ctx, config->subtitle, subtitle_font, rect, config->overflow_mode,
text_alignment, NULL) | ;
}
// Draw the title, which we're guaranteed to have room for because otherwise we would have bailed
// out at the beginning of this function
// Reuse rect as the title text frame
rect = (GRect) {
.origin = GPoint(cell_layer_bounds_origin_x, title_text_frame_origin_y),
.size = GSize(cell_layer_bound... |
mark_fd_free(fd);
}
unlink_flash_file(pg);
// IMPORTANT: prv_invoke_watch_file_callbacks assumes that we already have s_pfs_mutex
prv_invoke_watch_file_callbacks(file_name, FILE_CHANGED_EVENT_REMOVED);
}
mutex_unlock_recursive(s_pfs_mutex);
}
#define MAX_PAGE_CACHE_ENTRIES 10 // 6 bytes per en... | {
// make sure the header is not corrupted
PageHeader pg_hdr;
FileHeader file_hdr;
if ((res = read_header(file->start_page, &pg_hdr, &file_hdr)) !=
PageAndFileHdrValid) {
mark_fd_free(fd); // file has been corrupted so clear fd
goto cleanup;
}
} |
PFS_FD(fd).fd_status = FD_STATUS_IN_USE;
file_found = true;
}
cleanup:
*fd_used = (res >= 0) ? fd : res;
return (file_found);
}
// handles the creation of a file which was not previously on the FS
static NOINLINE status_t pfs_open_handle_create_request(int fd, uint8_t file_type,
size_t start_size)... |
port_tx_enqueue((const uint8_t *)message, message->message_length);
if (status != HostTransportEnqueueStatus_RetryLater) {
success = (status == HostTransportEnqueueStatus_Success);
goto done;
}
TickType_t remaining_ticks = prv_remaining_ticks(TIMEOUT_TICKS, start_ticks);
bool is_timeout;
... | {
time_ticks = milliseconds_to_ticks(HC_PROTOCOL_DEFAULT_CTL_ENDPOINT_RESPONSE_TIMEOUT_MS);
} | |
(QSPI_FLASH, read_instruction, write_instruction, value, mask) | ;
}
status_t flash_impl_init(bool coredump_mode) {
qspi_flash_init(QSPI_FLASH, &QSPI_FLASH_PART, coredump_mode);
#if BOARD_CUTTS_BB || BOARD_ROBERT_BB || BOARD_ROBERT_EVT
prv_set_high_drive_strength();
#endif
return S_SUCCESS;
}
status_t flash_impl_get_erase_status(void) {
return qspi_flash_is_erase_complete(... | |
name[0] != 0);
break;
}
}
// Did we get samples?
if (state->test_entry.num_samples > 0) {
return true;
} else {
return false;
}
}
// ---------------------------------------------------------------------------------------
static bool prv_parse_sleep_samples_file(SleepSampleDiscoveryState *... | } else if (strcmp(token, "TEST_END_AT_MIN") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.end_at.min);
} else if (strcmp(token, "TEST_END_AT_MAX") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.end_at.max);
} else if (strcmp(token, "TEST_CUR_S... |
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_deep_sleep.max);
} else if (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 +... |
(layer, &origin, &target) | );
animation_set_duration(animation, 4 * ANIMATION_FRAME_MS);
animation_set_curve(animation, AnimationCurveEaseIn);
return animation;
}
static Animation* prv_create_upwards_animation(MusicAppData *data) {
return animation_spawn_create(
prv_create_layer_upwards_animation(&data->artist_text_layer.layer, AR... | |
l prv_app_filter_callback(struct AppMenuDataSource * const source,
AppInstallEntry *entry) {
if (app_install_entry_is_watchface(entry)
|| app_install_entry_is_hidden((entry))) {
return false; // Skip watchfaces and hidden apps
}
return true;
}
static void prv_data_ch... | (&data->menu_layer, MenuIndex(0, 1), MenuRowAlignNone, false) | ;
}
prv_subscribe_to_event(&data->battery_state_event_info, PEBBLE_BATTERY_STATE_CHANGE_EVENT, data);
prv_subscribe_to_event(&data->do_not_disturb_event_info, PEBBLE_DO_NOT_DISTURB_EVENT, data);
prv_subscribe_to_event(&data->pebble_app_event_info, PEBBLE_COMM_SESSION_EVENT, data);
}
static void prv_window_unl... |
ListenerQueryData *query_data = data;
if (query_data->listener == listener) {
// calling `event_listeners.splice(idx, 1)` to remove item at idx
// wow, this is a lot of code for this
JS_VAR splice = jerry_get_object_field(event_listeners, "splice");
const jerry_value_t args[] = {jerry_create_number(... | jerry_create_undefined() | ;
}
JERRY_FUNCTION(prv_event_constructor) {
if (argc < 1) {
return rocky_error_arguments_missing();
}
if (!jerry_value_is_string(argv[0])) {
return rocky_error_unexpected_type(0, "String");
}
jerry_set_object_field(this_val, ROCKY_EVENT_TYPE, argv[0]);
return jerry_create_undefined();
}
static voi... |
_is_valid(
test_data->expected_test_image_bitmap_format, compositing_mode)) {
break;
}
framebuffer_clear(s_fb);
char test_image_filename[PATH_STRING_LENGTH] = {0};
snprintf(test_image_filename, PATH_STRING_LENGTH, "test_graphics_draw_bitmap_%s_test_image",
test_data->test_name... | (&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
void test_graphics_draw_bitmap__offset_layer_across_y(void) {
prv_offset_layer_test(GPoint(0, 40));
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_graphics_draw_bitmap__offset_layer_across_ny(void) {
prv_offset_layer_test(GPoint(0, -40));
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitm... |
layer, to_index, &to_frame);
PropertyAnimation *prop_animation = property_animation_create_layer_frame(
(Layer *)&layer->end_of_timeline, &from_frame, &to_frame);
Animation *animation = property_animation_get_animation(prop_animation);
animation_set_duration(animation, duration);
animation_set_custom_inte... | {
timeline_layer_unfold_day_sep(timeline_layer);
} |
}
// TODO: PBL-21717 Day separator on Spalding
Animation *timeline_layer_create_day_sep_show(TimelineLayer *timeline_layer) {
GRect *from = &((Layer *)&timeline_layer->day_separator)->frame;
GRect to;
prv_get_day_sep_show_frame(timeline_layer, &to);
// Keep the x-axis values until the actual unfold to maintai... |
/*
* 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... | (FIXED_S16_3_PRECISION == 3) | ;
int Fixed_S16_3_size = sizeof(Fixed_S16_3);
cl_assert(Fixed_S16_3_size == sizeof(int16_t));
test_num = 1 << FIXED_S16_3_PRECISION;
num = (Fixed_S16_3){ .integer = 1, .fraction = 0 };
// Test number creation
test_num = (int16_t)((float)1 * (1 << FIXED_S16_3_PRECISION));
cl_assert(num.raw_value == test... |
jerry_char_t *buffer_p,
jerry_size_t buffer_size) {
return jerry_object_to_string_to_utf8_char_buffer(object,
buffer_p,
buffer_siz... | if (jerry_value_has_error_flag(value)) {
return TYPE_ERROR_FLAG;
} | |
epeatedly. We should really be enforcing this
// within pfs_open but for now we will just let external callers use this
// routine before allocating large files
uint32_t tot_capacity = (pfs_get_size() * 8) / 10;
return ((allocated_space >= tot_capacity) ?
0 : (tot_capacity - allocated_space));
}
uin... | {
char buf[16];
uint8_t *bytes = kernel_malloc(num_bytes);
if (bytes == NULL) {
prompt_send_response("malloc error");
goto cleanup;
}
memset(bytes, 0x00, num_bytes);
if ((num_bytes = pfs_read(fd, bytes, num_bytes)) < 0) {
prompt_send_response_fmt(buf, sizeof(buf), "rd err: %d", num_bytes);
... |
void pfs_command_cat(const char *filename, const char *num_chars) {
int fd = pfs_open(filename, OP_FLAG_READ, 0, 0);
char buf[16];
if (fd < 0) {
prompt_send_response_fmt(buf, sizeof(buf), "fd open err: %d", fd);
return;
}
int num_bytes = atoi(num_chars);
pfs_debug_dump(fd, num_bytes);
pfs_close(... |
(num_loops, s_custom_curve_call_count) | ;
// -------------------------------------------------------------------------------------------
// Test the int16 accessor functions
int16_t test_value;
property_animation_get_from_int16(prop_h, &test_value);
cl_assert_equal_i(test_value, start_value);
property_animation_get_to_int16(prop_h, &test_value... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)) | ;
}
void test_health_activity_detail_card__render_day_label_no_steps(void) {
HealthData health_data = {
.step_data = {600, 0, 700},
.monthly_step_average = 1000,
};
HealthDetailCard *card = (HealthDetailCard *)prv_create_card_and_render(&health_data);
#if PBL_ROUND
menu_layer_set_selected_index(&card... |
or the given 15-minute time slot
int prv_expected_steps_per_min(int slot, int multiplier) {
if (multiplier == 1) {
// The slot % 50 was chosen so that the total # of steps per day does not exceeed 2^16
return ((slot % 50) + 1);
} else if (multiplier == 2) {
// The slot % 30 was chosen so that the total ... | (ACTIVITY_FIXTURE_PATH) | + strlen(filename) + 3];
sprintf(out_path, "%s/%s/%s", CLAR_FIXTURE_PATH, ACTIVITY_FIXTURE_PATH, filename);
// Open and read the settings file from PFS
int fd = pfs_open(ACTIVITY_SETTINGS_FILE_NAME, OP_FLAG_READ, FILE_TYPE_STATIC,
ACTIVITY_SETTINGS_FILE_LEN);
cl_assert(fd >= S_SUCCESS);
... |
t same uid
uint32_t uid = ((GetNotificationAttributesMsg *)&s_complete_dict)->notification_uid;
fake_notification_storage_set_existing_ancs_notification(&(Uuid)UUID_SYSTEM, uid);
prv_send_notification((uint8_t *)&s_complete_dict);
cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), ... | cl_assert_equal_i(prv_get_state(), ANCSClientStateAliveCheck) | ;
cl_assert_equal_i(s_num_requested_notif_attributes, 1);
// simulate a disconnection/reconnection
ancs_handle_service_removed(s_characteristics, NumANCSCharacteristic);
ancs_handle_service_discovered(s_characteristics);
// we should be back in the Idle state
cl_assert_equal_i(prv_get_state(), ANCSClientSta... |
ListNode* node = list_find(state->unscheduled_head, prv_handle_list_filter, (void*)handle);
if (!node) {
node = list_find(state->scheduled_head, prv_handle_list_filter, (void*)handle);
}
if (!node) {
if (!quiet) {
APP_LOG(APP_LOG_LEVEL_ERROR, "Animation %d does not exist", (int)handle);
}
r... | (state, animation, child_idx) | |
/*
* 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->func != 0) { // Test is implemented
pass_fail = bool_to_pass_fail(bitset32_get(&result, i));
} else {
pass_fail = "NYI";
} |
prompt_send_response_fmt(buffer, 32, "%15s: %s", test->name, pass_fail);
}
}
|
_length) {
int32_t value_out = 0;
const bool success = prv_float_string_parse(update->value_str, value_length, 100, &value_out);
if (success) {
music_update_player_volume_percent(value_out);
} else {
prv_analytics_log_event_with_info(AMSAnalyticsEventErrorPlayerVolumeUpdate, value_length);
}
}
// ---... | prv_handle_player_name_update(update, value_length) | |
*peek_layer, const TimelineResourceInfo *timeline_res,
TimelineResourceSize res_size, GRect icon_from) {
kino_layer_set_reel(&peek_layer->kino_layer, NULL, false);
AppResourceInfo icon_res_info;
timeline_resources_get_id(timeline_res, res_size, &icon_res_info);
KinoReel *from... | {
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 = layer_frame.origin.x + (layer_frame.size.w - size.w) / 2,
.origin.y = layer_frame.origin.y + (layer_frame.size.h - size.h) / 2,
... |
, 10);
cl_assert(fd >= 0);
// Get a directory listing with no filtering
PFSFileListEntry *dir_list;
dir_list = pfs_create_file_list(NULL);
// Should have 4 entries in it
cl_assert_equal_i(list_count(&dir_list->list_node), 4);
cl_assert(list_find(&dir_list->list_node, prv_find_name, "a_test_0"));
cl_as... | cl_assert_equal_b(prv_file_exists("a_test_0"), false) | ;
cl_assert_equal_b(prv_file_exists("a_test_1"), false);
cl_assert_equal_b(prv_file_exists("b_test_0"), true);
cl_assert_equal_b(prv_file_exists("b_test_1"), true);
}
void test_pfs__doesnt_give_out_fd_zero(void) {
for (int i = 5; i > 0; --i) {
char filename[20];
sprintf(filename, "test%d", i);
int ... |
e;
ctx.triggered = NULL;
NEW_RECOGNIZER(s) = test_recognizer_create(&s_test_impl_data, NULL);
s->state = RecognizerState_Started;
r->state = RecognizerState_Possible;
ctx.triggered = s;
cl_assert(prv_dispatch_touch_event(r, &ctx));
cl_assert(!handled);
recognizer_set_simultaneous_with(r, prv_simultane... | prv_set_all_states(recognizers, k_rec_count, RecognizerState_Started) | |
_get_slot_address(start_idx);
CD_ASSERTN(base_address + CORE_DUMP_MAX_SIZE <= CORE_DUMP_FLASH_END);
prv_flash_erase_region(base_address, CORE_DUMP_MAX_SIZE);
region_hdr = (CoreDumpFlashRegionHeader) {
.magic = CORE_DUMP_FLASH_HDR_MAGIC,
.last_used = max_last_used + 1,
.unread = true,
};
prv_flash_... | // The 10th bit of the pushed xPSR indicates whether an alignment word was
// inserted into the stack frame during exception entry in order to make
// sp 8-byte aligned.
// Note that this is going to be wrong if the floating-point registers
// were stacked. The only way to know for sure wh... |
// Write out this thread info
chunk_hdr.key = CORE_DUMP_CHUNK_KEY_THREAD;
chunk_hdr.size = sizeof(packed_info);
s_flash_addr += prv_flash_write_bytes(&chunk_hdr, s_flash_addr,
sizeof(chunk_hdr));
s_flash_addr += prv_flash_write_bytes(&packed_info, s_flash_addr,
... |
/*
* 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... | {
while (n--) {
*dest++ = *src++;
}
} | else {
while (n--) {
dest[n] = src[n];
}
}
return s1;
}
|
(&qspi_com_config) | ;
qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Write;
qspi_com_config.QSPI_ComConfig_IMode = QSPI_ComConfig_IMode_4Line;
qspi_com_config.QSPI_ComConfig_Ins = MX25UCommand_ResetEnable;
QSPI_ComConfig_Init(&qspi_com_config);
prv_wait_for_qspi_transfer_complete(QSPIFlag_ClearTC);
QSPI... | |
/*
* 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... | printf("Version: %"PRIu16"\n", got_version) | ;
cl_assert(got_version == ANALYTICS_DEVICE_HEARTBEAT_BLOB_VERSION);
uint32_t got_value = *((uint32_t *)(data + 28));
printf("Battery change period: %"PRIu32"\n", got_value);
cl_assert(got_value == expected_value);
dls_log_called = true;
return DATA_LOGGING_SUCCESS;
}
DataLoggingSession *dls_create(uint3... |
e "fake_app_manager.h"
// Stubs
#include "stubs_analytics.h"
#include "stubs_bootbits.h"
#include "stubs_logging.h"
#include "stubs_mutex.h"
#include "stubs_pbl_malloc.h"
#include "stubs_pebble_tasks.h"
#include "stubs_passert.h"
#include "stubs_print.h"
#include "stubs_prompt.h"
#include "stubs_queue.h"
#include "stu... | text_resources_get_glyph(&s_font_cache, 'a', &s_font_info) | ;
glyph_size_bytes = glyph_get_size_bytes(glyph);
cl_assert_equal_m(a_glyph_data_bytes, glyph->data, glyph_size_bytes);
glyph = text_resources_get_glyph(&s_font_cache, 'b', &s_font_info);
glyph_size_bytes = glyph_get_size_bytes(glyph);
cl_assert_equal_m(b_glyph_data_bytes, glyph->data, glyph_size_bytes);
... |
();
prv_receive_short_data_fragment(s_characteristics[0][PPoGATTCharacteristicData], sn);
prv_assert_sent_ack(s_characteristics[0][PPoGATTCharacteristicData], sn);
}
}
void test_ppogatt__close(void) {
test_ppogatt__open_session_when_found_pebble_app();
Transport *client = ppogatt_client_for_uuid(&s_meta... | prv_receive_ack(s_characteristics[0][PPoGATTCharacteristicData],
s_tx_window_size - 1 /* sn */) | ;
// We should now be able to submit s_tx_window_size packets again:
for (sn = s_tx_window_size; sn < 2 * s_tx_window_size; ++sn) {
cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport,
s_short_data_fragment,
... |
, 280, -488},
{ -400, 336, -488},
{ -184, 208, -280},
{ 24, 152, -144},
{ 424, 312, -80},
{ 760, 320, 64},
{ 1528, 1184, 376},
{ 1704, 1008, 552},
{ 2112, 1000, 240},
{ 2656, 1320, 408},
{ 2056, 1208, 784},
// 343 seconds
{ 1304, 784, 480},
{ 1272, 392, 248},
{ 14... | { 760, 1416, 824},
{ 496, 1088, 712},
{ 848, 1120, 920},
{ 920, 688, 552},
{ 1216, 776, 472},
{ 1584, 880, 536},
{ 1608, 680, 496},
{ 1432, 512, 368},
{ 1464, 408, 368},
{ 1552, 480, 320},
{ 1744, 328, 424},
{ 1488, 120, 400},
{ 1232, 256, 224},
{ 1192, -320, -392... |
{ -560, 448, -720},
{ -792, 112, -544},
{ -784, -72, -280},
{ -928, 160, -440},
{ -952, 48, -880},
{ -888, -248, -680},
// 351 seconds
{ -1008, -264, -576},
{ -632, -216, -912},
{ -672, -256, -1064},
{ -632, -280, -1048},
{ -520, -416, -1008},
{ -568, -392, -856},
... |
cs_draw_vertical_line_dotted(&ctx, GPoint(5, 0), 0);
graphics_draw_vertical_line_dotted(&ctx, GPoint(7, 0), 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(9, 0), 2);
graphics_draw_vertical_line_dotted(&ctx, GPoint(11, 0), 3);
graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4);
graphics_draw_verti... | (&ctx, GPoint(11, 0), 3) | ;
graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4);
graphics_draw_vertical_line_dotted(&ctx, GPoint(15, 0), 20);
graphics_draw_vertical_line_dotted(&ctx, GPoint(17, 0), 21);
graphics_draw_vertical_line_dotted(&ctx, GPoint(19, 0), 22);
graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_R... |
t(s_dest_bitmap->addr, GColorShockingPinkARGB8,
s_dest_bitmap->row_size_bytes * s_dest_bitmap->bounds.size.h);
process_manager_set_compiled_with_legacy2_sdk(is_legacy2);
int16_t y_offset = 0;
for (unsigned int row_index = 0; row_index < num_rows; row_index++) {
const MenuLayerSystemCellTestRowData ... | (
MenuCellType_CellLayer, cell_width,
s_menu_system_cell_layer_test_column_data,
ARRAY_LENGTH(s_menu_system_cell_layer_test_column_data),
/* is_legacy2 */ false) | ;
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | for (int i=0; i<40; i++) {
PBL_LOG(LOG_LEVEL_INFO, "%d Running app timer callback", i);
vibes_short_pulse();
} |
s_app_timer = app_timer_register(100 /* milliseconds */, app_timer_callback, NULL);
}
#if 0
static void sys_timer_callback(void* data) {
for (int i=0; i<1; i++) {
PBL_LOG(LOG_LEVEL_INFO, "%d Running sys timer callback", i);
vibes_short_pulse();
}
new_timer_start(s_sys_timer, 20, sys_timer_callback, NU... |
GenericServiceType;
typedef enum {
ReservedServiceManagement = 0x0101,
ReservedServiceControl = 0x0102,
ReservedServiceMax = 0x0fff
} ReservedService;
typedef enum {
ManagementServiceAttributeServiceDiscovery = 0x0001,
ManagementServiceAttributeNotificationInfo = 0x0002
} ManagementServiceAttribute;
typed... | if (has_valid_service) {
s_has_done_service_discovery = true;
} else {
return false;
} |
} else if (attr == ManagementServiceAttributeNotificationInfo) {
if (length != sizeof(NotificationInfoData)) {
PBL_LOG(LOG_LEVEL_WARNING, "Notification info response is invalid length: %"PRIu32, length);
return false;
}
const NotificationInfoData *notification_info = data;
if (notificatio... |
ndow *window1 = window_create();
Window *window2 = window_create();
cl_assert_equal_b(window_is_focusable(window2), true);
window_set_focusable(window2, false);
cl_assert_equal_b(window_is_focusable(window2), false);
WindowStack *app_stack = app_state_get_window_stack();
WindowStack *modal_stack = modal_ma... | cl_assert_equal_i(prv_get_appear_disappear_count(), 0) | |
cable recognizers receive events
// while none have started recognizing
e.type = TouchEvent_Touchdown;
recognizer_manager_handle_touch_event(&e, &manager);
prv_compare_recognizers_processed((int[]) {4, 0, 3, 1}, 4, &s_recognizers_handled);
cl_assert_equal_p(manager.active_layer, &layer_c);
cl_assert_equal_i... | // Layer A recognizer's gesture updates. Only that recognizer receives touch events
e.type = TouchEvent_Liftoff;
s_next_state = RecognizerState_Updated;
s_idx_to_change = 3;
recognizer_manager_handle_touch_event(&e, &manager);
prv_compare_recognizers_processed((int[]) {3}, 1, &s_recognizers_handled);
cl_a... | |
/*
* 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 (uint32_t i = 0; i < AES_128_BLOCK_SIZE / 2; ++i) {
uint8_t *a = &block[i];
uint8_t *b = &block[AES_128_BLOCK_SIZE - i - 1];
uint8_t temp = *a;
*a = *b;
*b = temp;
}
} |
static bool prv_emulate_hci_le_encrypt(const SM128BitKey *key,
const uint8_t plain_text_block[AES_128_BLOCK_SIZE],
uint8_t cipher_text_block_out[AES_128_BLOCK_SIZE]) {
const SM128BitKey key_reversed = *key;
prv_reverse_byte_order((uint8... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | qspi_release(dev->qspi) | ;
return result;
}
static void prv_set_fast_read_ddr_enabled(QSPIFlash *dev, bool enabled) {
// If we're supposed to use DDR for fast read, make sure the part can support it
PBL_ASSERTN(!enabled || dev->state->part->supports_fast_read_ddr);
dev->state->fast_read_ddr_enabled = enabled;
}
bool qspi_flash_is_in_... |
te_encryption_info_valid = ble_data->is_remote_encryption_info_valid;
pairing_info_out->is_remote_identity_info_valid = ble_data->is_remote_identity_info_valid;
pairing_info_out->is_remote_signing_info_valid = ble_data->is_remote_signing_info_valid;
}
if (name_out) {
strncpy(name_out, data.ble_data.name... | {
*addr_out = data.bt_classic_data.address;
} |
if (link_key_out) {
*link_key_out = data.bt_classic_data.link_key;
}
if (platform_bits) {
*platform_bits = data.bt_classic_data.platform_bits;
}
if (device_name_out) {
strcpy(device_name_out, data.bt_classic_data.name);
}
result = true;
done:
prv_cleanup_struct(&data);
return result;
}
s... |
read();
// Delete the basic glance blob
cl_assert_equal_i(app_glance_db_delete((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE),
S_SUCCESS);
const size_t glance_size = sizeof(s_app_glance_basic);
uint8_t glance_out[glance_size];
// Trying to read the basic glance blob now should fail becaus... | cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE,
(uint8_t *)&app_glance, sizeof(app_glance)),
E_INVALID_ARGUMENT) | ;
}
void test_app_glance_db__lower_version_blob_not_inserted(void) {
for (uint8_t version = 0; version < APP_GLANCE_DB_CURRENT_VERSION; version++) {
prv_check_invalid_version_code_blob_not_inserted(version);
}
}
void test_app_glance_db__higher_version_not_blob_inserted(void) {
prv_check_invalid_version_code... |
ibute_at_end_uid) {
prv_fake_receiving_ds_notification(ARRAY_LENGTH(memory_with_attribute_id_at_end.attribute_data), (uint8_t*) memory_with_attribute_id_at_end.attribute_data);
prv_fake_receiving_ds_notification(ARRAY_LENGTH(memory_with_attribute_id_at_end_p2), (uint8_t*) memory_with_attribute_id_at_end_p2);
... | cl_assert_equal_i(regular_timer_minutes_count(), 0) | ;
regular_timer_deinit();
}
// Janky black box smoke-test to exercise the ANCS message re-assembly state
// machine
void test_ancs__should_handle_small_and_large_messages(void) {
// Get 4 complete notifications
prv_send_notification((uint8_t *)&s_complete_dict);
prv_send_notification((uint8_t *)&s_complete_dic... |
/*
* 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... | (true, scroll_layer_get_shadow_hidden(scroll_layer)) | ;
}
void test_scroll_layer__paging_vs_shadow_bits(void) {
ScrollLayer *scroll_layer = scroll_layer_create(GRect(0,0,180,180));
// Validate that paging_disabled is same position as shadow clips
scroll_layer->shadow_sublayer.clips = true;
cl_assert_equal_b(true, scroll_layer->paging.paging_disabled);
cl_asser... |
_stripe(layer, ctx, GAlignTop);
prv_draw_border_stripe(layer, ctx, GAlignBottom);
}
}
static void prv_draw_arrow(Layer *layer, GContext *ctx, GBitmap *arrow_bitmap, GAlign alignment) {
graphics_context_set_compositing_mode(ctx, GCompOpSet);
const int16_t margin = 8;
const GRect bounds = grect_inset_interna... | i18n_free_all(data) | ;
task_free(data);
}
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 *pal... |
(void) {
GContext ctx;
Layer layer;
test_graphics_context_init(&ctx, fb);
layer_init(&layer, &GRect(0, 0, 100, 100));
layer_set_update_proc(&layer, &corners_clipped_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_clipped.${BIT_DEPTH_NAME}.pbi"));
}
... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r4_no_clip.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 5, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r5_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_R... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
GColor8 result = (GColor8){.argb = (color.argb + 1) % 64};
result.a = color.a;
return result;
} |
// Tests
////////////////////////////////////
// setup and teardown
void test_bitblt__initialize(void) {
framebuffer_init(&framebuffer, &(GSize) {DISP_COLS, DISP_ROWS});
test_graphics_context_init(&ctx, &framebuffer);
}
void test_bitblt__cleanup(void) {
}
// Test images reside in "tests/fw/graphics/test_images... |
ne DEFAULT_ACTIVITY_TYPE (ActivitySessionType_Run)
static ActivitySessionType s_activity_type = DEFAULT_ACTIVITY_TYPE;
////////////////////////////////////////////////////////////////////////////////////////////////////
// Helpers
static void prv_prep_and_open_active_window(ActivitySessionType type) {
WorkoutAppDa... | (workout_dialog) | ;
dialog_show_status_bar_layer(dialog, true);
dialog_set_fullscreen(dialog, true);
dialog_set_background_color(dialog, PBL_IF_COLOR_ELSE(GColorYellow, GColorWhite));
dialog_set_text_color(dialog, GColorBlack);
dialog_set_icon(dialog, RESOURCE_ID_WORKOUT_APP_END);
dialog_set_icon_animate_direction(dialog, D... |
ta...
// TODO: https://pebbletechnology.atlassian.net/browse/PBL-14164
buffer = (uint8_t *) kernel_malloc(value_length);
if (UNLIKELY(!buffer)) {
PBL_LOG(LOG_LEVEL_ERROR, "OOM for GATT read response - %d bytes", (int)value_length);
return;
}
gatt_client_consume_read_response(event->objec... | {
goto log_error;
} |
prv_consume_read_response(event, client);
return;
default:
break;
}
log_error:
PBL_LOG(LOG_LEVEL_ERROR,
"Unhandled GATT event:%u ref:%"PRIu32" err:%"PRIu16" len:%"PRIu16" cl:%p",
event->subtype,
(uint32_t)event->object_ref,
(uint16_t)event->gatt_error... |
/*
* 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... | xLightMutexUnlock(handle->common.freertos_mutex) | ;
}
static void prv_assert_held_by_curr_task(PebbleMutex * handle, bool is_held, uint32_t lr) {
LightMutexHandle_t mutex = handle->common.freertos_mutex;
OS_ASSERT_LR((xLightMutexGetHolder(mutex) == xTaskGetCurrentTaskHandle()) == is_held,
lr);
}
void mutex_assert_held_by_curr_task(PebbleMutex * ... |
{
.hdr.cmd_id = GET_BYTES_CMD_OBJECT_DATA,
.hdr.transaction_id = state->transaction_id,
.byte_offset = htonl(state->storage.current_offset),
};
// read the next chunk from storage
gb_storage_read_next_chunk(&state->storage, rsp->data, data_len);
comm_session_send_buffer_write(sb, (co... | prv_protocol_send_err_response(session, 0 /*transaction_id*/,
GET_BYTES_MALFORMED_COMMAND) | ;
return;
}
GetBytesHeader *hdr = (GetBytesHeader *)msg_data;
switch (hdr->cmd_id) {
case GET_BYTES_CMD_GET_COREDUMP:
case GET_BYTES_CMD_GET_FILE:
case GET_BYTES_CMD_GET_FLASH:
case GET_BYTES_CMD_GET_NEW_COREDUMP:
break;
default:
PBL_LOG(LOG_LEVEL_ERROR, "first byte can't be %... |
/*
* 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... | gdraw_command_image_draw(&ctx, l, GPoint(48, 0)) | ;
l = weather_app_resource_create_sun();
gdraw_command_image_attract_to_square(l, t += dt);
gdraw_command_image_draw(&ctx, l, GPoint(0, 48));
l = weather_app_resource_create_sun();
gdraw_command_image_attract_to_square(l, t += dt);
gdraw_command_image_draw(&ctx, l, GPoint(48, 48));
l = weather_app_reso... |
/*
* 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... | GPoint(45, 40) | );
}
void clear_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorClear);
graphics_context_set_antialiased(ctx, false);
graphics_draw_line(ctx, GPoint(5, 35), GPoint(45, 40));
}
void across_x_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_st... |
ivityScalarStore prev_steps = s_activity_state.step_data.steps;
mutex_lock_recursive(s_activity_state.mutex);
{
activity_algorithm_get_steps(&s_activity_state.step_data.steps);
// Are we logging raw accel samples?
if (s_activity_state.sample_collection_enabled) {
prv_collect_raw_samples(data, num... | {
PBL_LOG(LOG_LEVEL_DEBUG, "Starting activity tracking...");
// Subscribe to the accelerometer from KernelBG
s_activity_state.test_mode = test_mode;
if (!test_mode) {
PBL_ASSERTN(s_activity_state.accel_session == NULL);
s_activity_state.accel_session = accel_session_create();
accel_se... |
}
// ------------------------------------------------------------------------------------------------
// Stop activity tracking system callback
static void prv_stop_tracking_cb(void *context) {
s_activity_state.should_be_started = false;
if (!s_activity_state.started) {
return;
}
cron_job_unschedule(&s_... |
stom_schedule4);
}
void test_alarm__alarm_set_time(void) {
AlarmId id1, id2;
id1 = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_EVERYDAY });
prv_assert_alarm_config(id1, 3, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
alarm_set_time(id1, 5, 6);
prv_assert_alarm_config(id1... | (id, 4, 14, false, ALARM_KIND_CUSTOM, custom_schedule2) | ;
}
void test_alarm__alarm_get_custom_days(void) {
AlarmId id1, id2;
bool schedule_1[7] = {true, false, false, false, false, false, true};
bool verify_schedule_1[7] = {false, false, false, false, false, false, false};
id1 = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_CUSTOM, .sched... |
fs_command_stress(void) {
prompt_send_response("PFS stress from kernel BG");
system_task_add_callback(prv_pfs_stress_callback, NULL);
}
extern void command_read_word(const char* address_str) {
int32_t address = str_to_address(address_str);
if (address == -1) {
prompt_send_response("Invalid address");
r... | {
prompt_send_response("Invalid address");
return;
} |
int length = atoi(length_str);
if (length <= 0) {
prompt_send_response("Invalid length");
return;
}
int value = atoi(value_str);
if ((value < 0) || (value > 0xFF)) {
prompt_send_response("Invalid value");
return;
}
// Fill flash with a character value
uint8_t page[WRITE_PAGE_SIZE_BYT... |
s_updated_value = steps_today;
}
}
// -------------------------------------------------------------------------------
// Tests
typedef struct {
const char *title;
AppTimerCallback callback;
} TestEntry;
static TestEntry s_test_entries[] = {
{
.title = "steps",
.callback = prv_test_steps,
}, {
.... | (data->window, data) | ;
window_set_click_config_provider_with_context(data->window, click_config_provider, data);
window_set_window_handlers(data->window, &(WindowHandlers) {
.load = prv_window_load,
.unload = prv_window_unload,
});
app_window_stack_push(data->window, true /* Animated */);
}
// ---------------------------... |
htStateCommon;
static struct {
InsightStateCommon common;
} s_sleep_reward_state;
static struct {
InsightStateCommon common;
ActivityScalarStore active_minutes;
} s_activity_reward_state;
// Cached insight settings
static ActivityInsightSettings s_sleep_reward_settings;
static ActivityInsightSettings s_sleep_s... | ("Keep it up!") | ,
.text_negative_response = i18n_noop("We'll get there!"),
.icon_positive_response = TIMELINE_RESOURCE_REWARD_GOOD,
.icon_neutral_response = TIMELINE_RESOURCE_REWARD_AVERAGE,
.icon_negative_response = TIMELINE_RESOURCE_REWARD_BAD,
};
// --------------------------------------------------------------------------... |
"services/normal/activity/activity.h"
#include "services/normal/alarms/alarm.h"
#include "system/logging.h"
#include "system/passert.h"
#include <string.h>
#define ALARM_DAY_LIST_CELL_HEIGHT PBL_IF_RECT_ELSE(menu_cell_small_cell_height(), \
menu_cell_basic_cell_hei... | task_free(data) | ;
data = NULL;
}
static void prv_handle_selection(int index, void *callback_context) {
AlarmEditorData *data = (AlarmEditorData *)callback_context;
data->day_picker_was_completed = true;
data->alarm_kind = prv_index_to_alarm_kind(index);
if (data->creating_alarm) {
const AlarmInfo info = {
.hour ... |
int16_t y, int16_t min_x, int16_t max_x,
GColor color) {
PBL_ASSERTN(ctx);
if (gcolor_is_invisible(color)) {
return;
}
GDrawMask *mask = ctx->draw_state.draw_mask;
PBL_ASSERTN(mask);
const GBitmap *framebuffer = &ctx->dest_bitmap;
const GBitmapDataRowInfo current_data_ro... | {
// Skip over pixels outside the bitmap data row's range
const GBitmapDataRowInfo data_row_info = gbitmap_get_data_row_info(framebuffer, (uint16_t)i);
if (!WITHIN(x, data_row_info.min_x, data_row_info.max_x)) {
continue;
}
prv_update_mask(ctx, i, x, x, color);
} |
}
T_STATIC void prv_mask_recording_assign_horizontal_line_delta_raw(GContext *ctx, int16_t y,
Fixed_S16_3 x1, Fixed_S16_3 x2,
uint8_t left_aa_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... | get_current_address(s_current_chunk, 0) | |
{ 1256, 392, -56},
{ 1216, 352, -96},
{ 1152, 392, -152},
{ 1048, 432, -248},
{ 936, 360, -264},
{ 792, 440, -376},
{ 664, 344, -512},
{ 584, 280, -560},
{ 472, 176, -680},
{ 376, 72, -688},
{ 288, 72, -760},
{ 224, 0, -832},
{ 280, -80, -920},
{ 168, -48, -848},
... | { 1320, 320, -64},
{ 1368, 312, -8},
{ 1248, 288, 24},
{ 936, 184, -24},
{ 728, 136, -48},
{ 680, 112, 0},
{ 672, 176, -8},
{ 760, 112, -24},
{ 888, 104, -16},
// 62 seconds
{ 1016, 72, -24},
{ 1120, 72, -16},
{ 1144, 56, -16},
{ 1256, 136, -48},
{ 1152, 112, ... |
{ 1088, 40, 8},
{ 1296, 120, 40},
{ 1256, 152, 32},
{ 1160, 176, -112},
{ 1328, 168, -88},
{ 1192, 216, -128},
{ 880, 240, -160},
{ 592, 200, -176},
{ 504, 176, -136},
{ 536, 168, -136},
{ 656, 192, -144},
{ 808, 216, -208},
{ 1008, 240, -232},
{ 1112, 312, -272}... |
.cstring = "Title" },
{ .id = AttributeIdBody, .cstring = "Body" },
{ .id = AttributeIdMuteDayOfWeek, .uint8 = MuteBitfield_Always },
{ .id = AttributeIdAppName, .cstring = "Awesome" },
{ .id = AttributeIdLastUpdated, .uint32 = s_now },
}
};
s_expected_attributes = &expected_attributes;
... | cl_assert(!ancs_filtering_is_muted(&mute_weekdays)) | ;
s_now += SECONDS_PER_DAY; // Sunday Jan 3, 2016
cl_assert(ancs_filtering_is_muted(&mute_always));
cl_assert(ancs_filtering_is_muted(&mute_weekends));
cl_assert(!ancs_filtering_is_muted(&mute_weekdays));
s_now += SECONDS_PER_DAY; // Monday Jan 4, 2016
cl_assert(ancs_filtering_is_muted(&mute_always));
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... | (ADCx, ADC_FLAG_EOC) | == RESET) {
if (ADC_GetFlagStatus(ADCx, ADC_FLAG_OVR) == SET) {
ADC_ClearFlag(ADCx, ADC_FLAG_OVR);
return false;
}
}
return true;
}
void voltage_monitor_read(VoltageMonitorDevice *device, VoltageReading *reading_out) {
mutex_lock(s_adc_mutex);
bool same_adc = (device->adc == VREF_ADC);
... |
/*
* 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... | RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value) | ;
}
void boot_bit_clear(BootBitValue bit) {
uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR);
current_value &= ~bit;
RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value);
}
bool boot_bit_test(BootBitValue bit) {
uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR);
re... |
s or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "action_chaining_window.h"
#include "applib/ui/ui.h"
#include "kernel/pbl_malloc.h"
typedef struct {
Window window;
MenuLayer menu_layer;
StatusBarLayer status_layer;
const cha... | (GColorIslamicGreen, GColorBlack) | , GColorWhite);
menu_layer_set_click_config_onto_window(&data->menu_layer, &data->window);
layer_add_child(&data->window.layer, menu_layer_get_layer(&data->menu_layer));
#if PBL_RECT
status_bar_layer_init(&data->status_layer);
status_bar_layer_set_colors(&data->status_layer, PBL_IF_COLOR_ELSE(GColorWhite, GCol... |
/*
* 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, prv_click_config_proivider) | ;
window_set_window_handlers(&window->window, &(WindowHandlers){
.unload = prv_window_unload,
});
return result;
}
static void prv_handle_init(void) {
Window *window = prv_window_create();
app_window_stack_push(window, true);
}
static void prv_main(void) {
prv_handle_init();
app_event_loop();
}
... |
lse if (scale_reg_val == BMI160_ACC_RANGE_4G) {
return BMI160_SCALE_4G;
} else if (scale_reg_val == BMI160_ACC_RANGE_8G) {
return BMI160_SCALE_8G;
} else if (scale_reg_val == BMI160_ACC_RANGE_16G) {
return BMI160_SCALE_16G;
}
WTF;
return 0;
}
static void prv_set_accel_scale(Bmi160Scale scale) {
... | BMI160_DBG("%"PRIu32" us delay since sample was collected",
time_since_data_collection_us) | ;
return (curr_time_us - time_since_data_collection_us);
}
static void prv_read_curr_accel_data(AccelDriverSample *data) {
uint8_t res[9]; /* x, y, z & timestamp */
prv_burst_read(BMI160_REG_ACC_X_LSB, res, sizeof(res));
*data = (AccelDriverSample){};
prv_convert_accel_raw_data_to_mgs(res, data);
data->... |
e_origin_aa_r1_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 1);
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_SMALL);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r1_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// T... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_aa_r8_no_clip.${BIT_DEPTH_NAME}.pbi")) | |
);
}
return time_normalized_raw;
}
AnimationProgress animation_private_get_animation_progress(const AnimationPrivate *animation) {
// FIXME PBL-25497: Make this function less fragile
// Calling prv_get_ms_since_system_start() here means this function will have different return
// values if it's called multip... | {
blocked_on_children_complete = true;
} |
}
return blocked_on_children_complete;
}
// -------------------------------------------------------------------------------------------
// @param state our context
// @param now the time we are running to. When called from animation_set_elapsed, this will
// be in the future, otherwise it will be the curren... |
ed_encoded_msg);
s_saved_encoded_msg = NULL;
}
}
// Flush it out now, this should send any remaining data out
success = protobuf_log_session_flush(session_ref);
cl_assert(success);
if (num_samples_encoded < num_samples) {
if (s_saved_encoded_msg == NULL) {
LOG("No message available yet..... | ARRAY_LENGTH(events) | |
/*
* 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... | (session->db_id,
dirty_item->key,
dirty_item->key_len,
item_buf, item_size) | ;
if (PASSED(status)) {
regular_timer_add_multisecond_callback(&session->timeout_timer, SYNC_TIMEOUT_SECONDS);
} else if (status == E_DOES_NOT_EXIST) {
// item was removed
blob_db_sync_next(session);
} else {
// something went terribly wrong
PBL_LOG(LOG_LEVEL_ERROR, "Failed to read blob DB dur... |
{ 1064, 208, 0},
{ 1000, 240, -80},
{ 888, 224, -96},
{ 1224, 200, -184},
{ 1120, 160, -112},
{ 1128, 192, -160},
{ 1288, 208, -280},
{ 1256, 184, -120},
{ 1072, 208, -136},
{ 912, 280, -184},
{ 960, 304, -192},
{ 1032, 288, -96},
{ 1104, 320, -64},
// 92 seconds... | { 1296, 208, 56},
{ 1216, 200, 56},
{ 976, 208, 48},
{ 832, 184, 24},
{ 1000, 224, 0},
{ 1048, 240, -88},
{ 904, 192, -24},
{ 1168, 152, -40},
{ 1096, 152, 48},
{ 1064, 296, -240},
{ 1272, 280, -288},
{ 1296, 208, -72},
{ 1088, 152, -8},
{ 936, 224, -72},
{ 10... |
{ 1576, 416, -320},
{ 1872, 512, -544},
{ 1616, 216, 144},
// 100 seconds
{ 1264, 112, 16},
{ 1120, -56, -336},
{ 1008, 792, -336},
{ 1136, 200, -80},
{ 1184, 376, 0},
{ 1248, 392, 40},
{ 1600, 480, 144},
{ 1312, 576, 328},
{ 1264, 800, 168},
{ 936, 1088, -64},
... |
);
for (int i = 0; i < 7; i++) {
char elapsed[8];
prv_convert_seconds_to_time(values[i], elapsed, sizeof(elapsed));
char temp[32];
snprintf(temp, sizeof(temp), "\n%d: %s", i, elapsed);
strcat(data->debug_card.dialog_text, temp);
}
prv_display_alert(data->debug_card.dialog_text);
}
// -------... | (data->debug_card.dialog_text) | ;
}
// -----------------------------------------------------------------------------------------
static void prv_debug_cmd_set_sleep_history(int index, void *context) {
ActivityDemoAppData *data = context;
activity_test_set_sleep_history();
snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_... |
&read_pointer);
cl_assert(read_pointer);
cl_assert_equal_i(TEST_EXPECTED_PP_MSG[i], *read_pointer);
// Expect that the header and payload will be non-contiguous:
if (i < sizeof(PebbleProtocolHeader)) {
cl_assert_equal_i(sizeof(PebbleProtocolHeader) - i, length_available);
} else {
cl_as... | // Expect the remainder to be filled with zeroes:
for (int i = 0; i < (length - intact_size); ++i) {
cl_assert_equal_i(bytes_out[intact_size + i], 0x00);
}
app_free(outbox_data);
} |
void test_app_message_sender__cancelled_message_in_flight_header_and_payload_not_finished(void) {
// Expect header to get sent out normally, then a payload with all zeroes
prv_quit_app_after_pp_msg_byte(sizeof(PebbleProtocolHeader) - 1);
}
void test_app_message_sender__cancelled_message_in_flight_payload_not_fin... |
Flushing...");
// remove the number of leftover bytes so we fall back on our feet
read_bytes -= leftover_bytes;
dls_storage_consume(logging_session, leftover_bytes);
analytics_inc(ANALYTICS_DEVICE_METRIC_DATA_LOGGING_FLUSH_COUNT, AnalyticsClient_System);
}
success = dls_endpoint_send_data(logging_... | prv_sends_enabled() | ) {
PBL_LOG(LOG_LEVEL_INFO, "Not sending sessions beause sending is disabled");
return;
}
system_task_add_callback(prv_send_all_sessions_system_task_cb, (void*) true);
}
// ----------------------------------------------------------------------------------------
// Mark all sessions belonging to 'task' as ... |
/*
* 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... | (str, STR_SIZE, "%f", 1.0) | ;
cl_assert_equal_s(str, fp_msg);
//----------------------------------------------------
pbl_snprintf(str, STR_SIZE, "%s%f%s", "a", 1.0, "b");
cl_assert_equal_s(str, fp_msg);
pbl_snprintf(str, STR_SIZE, "%s%d%s", "a", 1, "b");
cl_assert_equal_s(str, "a1b");
//--------------------------------------------... |
/*
* 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, GColorWhite) | ;
const int16_t y_offset = 1;
const int16_t padding = r.size.w / 6;
const uint16_t corner_radius = 4;
GRect bg_rect = r;
bg_rect.origin.y = layer_bounds->origin.y;
bg_rect.size.h = layer_bounds->size.h;
bg_rect = grect_inset_internal(bg_rect, padding, y_offset);
graphics... |
new_state == ANCSClientStateIdle);
default:
WTF;
}
}
static void prv_set_state(ANCSClientState new_state) {
PBL_ASSERTN(prv_can_transition_state(new_state));
s_ancs_client->state = new_state;
}
T_STATIC ANCSClientState prv_get_state(void) {
return s_ancs_client->state;
}
// ----------... | {
analytics_inc(ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_PARSE_ERROR_COUNT,
AnalyticsClient_System);
prv_reset_and_next();
} | |
16_t value_length = sizeof(out);
bool has_more = true;
const uint16_t next_length =
gatt_client_subscriptions_consume_notification(&handle_out, out, &value_length,
GAPLEClientApp, &has_more);
cl_assert_equal_i(handle_out, BLE_CHARACTERISTIC_INVALI... | cl_assert_equal_b(gatt_client_get_event_pending_state(GAPLEClientKernel), true) | |
usic_id));
cl_assert_equal_b(true, app_install_is_hidden(sports_id));
cl_assert_equal_b(false, app_install_is_hidden(bg_counter_id));
cl_assert_equal_b(false, app_install_is_hidden(menu_layer_id));
cl_assert_equal_b(false, app_install_is_hidden(CRAZY_ID));
}
void test_app_install_manager__is_from_system(void... | (sports_id, true /* can_expire */) | ;
cl_assert(false == app_install_entry_is_hidden(&entry));
}
// clear and ensure hidden
app_install_unmark_prioritized(sports_id);
cl_assert(true == app_install_entry_is_hidden(&entry));
// simulates multiple messages from app
for (int i = 0; i < 10; i++) {
// visible after communication
app_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... | if (iter == NULL ||
iter->dictionary == NULL ||
iter->cursor == NULL) {
return DICT_INVALID_ARGS;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.