prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
backStateForwarding: return MusicPlayStateForwarding;
default: return MusicPlayStateUnknown;
}
}
static bool prv_handle_player_playback_info_value(const char *value, uint32_t value_length,
uint32_t idx, void *context) {
// Default to -1 for playback state, or 0... | (update->value_str, value_length) | ;
PBL_LOG(LOG_LEVEL_DEBUG, "Queue index update: %"PRId32, idx);
// TODO: Do something with this info
}
static void prv_handle_queue_count_update(const AMSEntityUpdateNotification *update,
const uint16_t value_length) {
const int32_t count = prv_parse_queue_value(update->... |
(&s_pb_state.storage, 0, (uint8_t *)&fw_descr, sizeof(FirmwareDescription));
}
struct InstallableObject* o = s_ready_to_install + (s_pb_state.type - 1);
o->token = s_pb_state.token;
o->type = s_pb_state.type;
o->index = s_pb_state.index;
}
static void prv_finish_fw_update_if_completed(void) {
if (s_ready_... | PBL_LOG(LOG_LEVEL_ERROR, "Not in FW update state") | |
/ Use Acceptable because of the short circuiting in `prv_heart_rate_subscription_update`
prv_advance_time_hr(ACTIVITY_DEFAULT_HR_ON_TIME_SEC - 1, 100 /*bpm*/,
HRMQuality_Acceptable, false /*force_continuous*/);
// The last update time should be within a second
activity_get_metric(ActivityMe... | cl_assert_equal_i(median, 0) | ;
// But the last stable BPM shouldn't get wiped
activity_get_metric(ActivityMetricHeartRateFilteredBPM, 1, &last_median);
activity_get_metric(ActivityMetricHeartRateFilteredUpdatedTimeUTC, 1, &last_update_utc);
cl_assert_equal_i(last_median, 51);
cl_assert(last_update_utc >= rtc_get_time() - 1);
cl_assert... |
tick_timer_service.h"
#include "applib/ui/app_window_stack.h"
#include "applib/ui/kino/kino_layer.h"
#include "applib/ui/ui.h"
#include "kernel/pbl_malloc.h"
#include "process_state/app_state/app_state.h"
#include "resource/resource_ids.auto.h"
#include "services/common/battery/battery_monitor.h"
#include "services/com... | (MINUTE_UNIT, prv_minute_tick) | ;
}
static void low_power_main(void) {
init();
app_event_loop();
deinit();
}
const PebbleProcessMd* low_power_face_get_app_info() {
static const PebbleProcessMdSystem s_app_md = {
.common = {
// UUID: e9475244-5bbe-4e0f-a637-a218af4c3110
.uuid = {0xe9, 0x47, 0x52, 0x44, 0x5b, 0xbe, 0x4e, 0x0... |
/*
* 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... | gsize_equal(&size, &rect.size) | ;
}
static void prv_free_list_copy(KinoReelTransformData *data) {
applib_free(data->list_copy);
data->list_copy = NULL;
}
static GDrawCommandList *prv_get_or_create_list_copy(KinoReelTransformData *data,
GDrawCommandList *list) {
if (data->list_copy && (gdraw... |
;
prv_compare_recognizers_processed((int[]) {6, 5, 4, 2, 3}, 5, &s_recognizers_handled);
prv_destroy_recognizers(recognizers, k_rec_count);
}
bool prv_dispatch_touch_event(Recognizer *recognizer, void *context);
void test_recognizer_manager__dispatch_touch_event(void) {
bool handled = false;
s_test_impl_data... | (&layer_c, &GRectZero) | ;
layer_add_child(root, &layer_a);
layer_add_child(root, &layer_b);
layer_add_child(&layer_a, &layer_c);
recognizer_add_to_list(recognizers[0], window_get_recognizer_list(&window));
recognizer_add_to_list(recognizers[1], &layer_a.recognizer_list);
recognizer_add_to_list(recognizers[2], &layer_b.recognizer_... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (s_app_db.mutex) | |
rage, 2, false));
cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 2);
// Consume it
prv_read_and_consume(&buffer, &client, storage, 2);
cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client), 0);
}
void test_shared_circular_buffer__subsampling... | shared_circular_buffer_read_subsampled(
&buffer, &client, item_size, out_buffer, 3) | , 3);
cl_assert_equal_m(out_buffer, "0a2c4e", 6);
subsampled_shared_circular_buffer_client_set_ratio(&client, 2, 3);
// Consume "5f6g7h8i"
cl_assert_equal_i(shared_circular_buffer_read_subsampled(
&buffer, &client, item_size, out_buffer, 3), 3);
// Normally the next read would skip 5f, but changing the... |
n),
SCROLL_ANIMATION_DURATION);
}
layer_mark_dirty((Layer *)text_layer);
}
static void prv_start_text_animation(TranscriptionDialog *transcription_dialog) {
static const PropertyAnimationImplementation animated_text_len = {
.base = {
.update = (AnimationUpdateImplementation) property_animation... | ((ExpandableDialog *)transcription_dialog) | |
/*
* 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(floor(-0.5) == -1.0) | ;
cl_assert(floor( 0.0) == 0.0);
cl_assert(floor(-0.0) == -0.0);
cl_assert(floor( 1.5) == 1.0);
cl_assert(floor(-1.5) == -2.0);
cl_assert(floor( 2.0) == 2.0);
cl_assert(floor(-2.0) == -2.0);
cl_assert(floor( 0.0001) == 0.0);
cl_assert(floor(-0.0001) == -1.0);
cl_assert(isnan(floor(NAN)));
cl_ass... |
/*
* 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... | (false, "These tests are only for color displays") | ;
#endif
static GContext *ctx;
static FrameBuffer *fb = NULL;
// Setup
void test_bitblt_circular__initialize(void) {
fb = malloc(sizeof(FrameBuffer));
framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS});
ctx = malloc(sizeof(GContext));
test_graphics_context_init(ctx, fb);
framebuffer_clear(fb);
}
// Tear... |
cl_assert(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 1) | ;
line_reset(&line, utf8_bounds.start);
cl_assert(line_add_words(&line, &word_iter, NULL));
cl_assert(line.height_px == 10);
cl_assert(line.width_px == HORIZ_ADVANCE_PX * 1);
cl_assert(line.origin.x == 0);
cl_assert(line.suffix_codepoint == 0);
cl_assert(*line.start == 'b');
// \n
cl_assert(*word_it... | |
around in this case.
corr = TRIG_MAX_ANGLE / 2;
}
mx_rot = (mx * cos_lookup(pitch)) / TRIG_MAX_RATIO;
mx_rot += (((my * sin_lookup(pitch)) / TRIG_MAX_RATIO) * sin_lookup(roll)) /
TRIG_MAX_RATIO;
mx_rot += (((mz * sin_lookup(pitch)) / TRIG_MAX_RATIO) * cos_lookup(roll)) /
TRIG_MAX_RATIO;
my_... | for (int i = 0; i < 3; i++) {
s_active_corr[i] = s_saved_corr[i];
} |
}
s_service_init = true;
}
event_service_init(PEBBLE_COMPASS_DATA_EVENT, &prv_compass_data_service_start,
&prv_compass_data_service_stop);
}
void ecompass_service_handle(void) {
static int samples_collected = 0;
// read magnetometer sample
MagData mag_data;
MagReadStatus rv = mag_read_data(... |
must
// invoke system callbacks to handle its KernelBG callback.
activity_start_tracking(false /*test_mode*/);
fake_system_task_callbacks_invoke_pending();
// All tests start at 5pm, which is 1020 minutes into a 1440 minute day. The BMR for
// the above user is 1859 kcalories per day, so we expect to get:
... | cl_assert_equal_i(health_service_peek_current_activities(), HealthActivityNone);
int exp_value = 22 * SECONDS_PER_HOUR + 30 * SECONDS_PER_MINUTE; // 10:30pm in minutes
activity_get_metric(ActivityMetricSleepEnterAtSeconds, 1, &value);
cl_assert_equal_i(value, exp_value);
activity_get_metric(ActivityMetricSl... | |
(length_remaining) {
const uint8_t *part_data;
uint32_t data_out_pos = (length_to_copy - length_remaining);
size_t part_length =
prv_get_read_pointer(app_message_send_job,
app_message_send_job->consumed_length + start_offset + data_out_pos,
... | {
PBL_LOG(LOG_LEVEL_ERROR, "Outbound app message corrupted %u", err);
app_outbox_service_consume_message(message, (AppOutboxStatus)err);
return;
} |
const AppMessageAppOutboxData *outbox_data =
(const AppMessageAppOutboxData *)message->data;
app_message_send_job->session = outbox_data->session;
comm_session_sanitize_app_session(&app_message_send_job->session);
if (!app_message_send_job->session) {
// Most likely disconnected in the mean time, d... |
;
*num_samples = s_activity_state.sample_collection_num_samples;
if (*enabled) {
*seconds = rtc_get_time() - s_activity_state.sample_collection_seconds;
} else {
*seconds = s_activity_state.sample_collection_seconds;
}
}
mutex_unlock_recursive(s_activity_state.mutex);
return success;
}... | (ActivitySettingsKeySleepTotalMinutesHistory, sleep_history) | ;
}
if (step_history) {
prv_write_metric_history(ActivitySettingsKeyStepCountHistory, step_history);
}
activity_init();
activity_set_enabled(true);
// Restart tracking
if (tracking) {
activity_start_tracking(test_mode);
while (!s_activity_state.started) {
sys_psleep(1);
}
}
retu... |
ll_heights[OptionMenuContentType_SingleLine] = 46,
#endif
.top_inset = 1,
.right_icon_spacing = PBL_IF_RECT_ELSE(10, 35),
.text_inset_single = -1,
.text_inset_multi = -3,
.right_text_inset_with_icon = 4,
};
static const OptionMenuStyle * const s_styles[NumPreferredContentSizes] = {
[PreferredContentSizeSma... | grect_inset(remaining_rect,
GEdgeInsets(0, 0, 0, left_text_inset_to_prevent_clipping)) | ;
}
#else
const OptionMenuStyle * const style = prv_get_style();
const int32_t left_text_inset = menu_cell_basic_horizontal_inset();
const int32_t right_text_inset = option_menu->icons_enabled ? style->right_text_inset_with_icon :
left_text_inset;
... |
GBitmap *src_bitmap =
get_gbitmap_from_pbi("test_bitblt__1bit_to_8bit_src_origin_offset_wrap2.1bit.pbi");
uint8_t dest_data[100*100];
GBitmap dest_bitmap = {
.addr = dest_data,
.row_size_bytes = 100,
.info.format = GBitmapFormat8Bit,
.info.version = GBITMAP_VERSION_CURRENT,
.bounds = { { ... | cl_assert_equal_i(src_bitmap->info.format, GBitmapFormat1Bit) | ;
uint8_t dest_data[bounds.size.w * bounds.size.h];
GBitmap dest_bitmap = {
.addr = dest_data,
.row_size_bytes = src_bitmap->row_size_bytes,
.info.format = GBitmapFormat1Bit,
.info.version = GBITMAP_VERSION_CURRENT,
.bounds = src_bitmap->bounds
};
// Image name descriptions
// comptint_<... |
me);
const GRect icon_from = { grect_center_point(&frame), GSizeZero };
prv_get_day_sep_show_frame(timeline_layer, &frame);
peek_layer_set_frame(&timeline_layer->day_separator, &frame);
TimelineResourceInfo timeline_res = {
.res_id = TIMELINE_RESOURCE_DAY_SEPARATOR,
};
peek_layer_set_icon_with_size(&tim... | {
prv_get_day_sep_frame(layer, 0, &day_sep_frame);
} | else if (next && layer_get_hidden(&next->layout_layer.layer)) {
prv_get_day_sep_frame(layer, 2, &day_sep_frame);
} else {
// don't show the day separator
return;
}
layer_set_frame((Layer *)&layer->day_separator, &day_sep_frame);
layer_set_hidden((Layer *)&layer->day_separator, false);
}
static vo... |
r, uint8_t row_number) {
const GColor8Component luminance = (color.r + color.g + color.b) / 3;
switch (luminance) {
case 0:
return 0x00000000;
case 1:
case 2:
// This is done to create a checkerboard pattern for gray
return (row_number % 2) ? 0xAAAAAAAA : 0x55555555;
case 3:
... | Fixed_S16_3(x2 << FIXED_S16_3_PRECISION) | ;
ctx->draw_state.draw_implementation->assign_horizontal_line(ctx, y, x1_fixed, x2_fixed,
color);
}
void graphics_private_draw_vertical_line_prepared(GContext *ctx, GBitmap *framebuffer,
GRect *clip_box, ... |
}
// Callbacks for the main settings filter list menu.
////////////////////////////////////////////////////
#define SHUTDOWN_MIN_BOOT_VERSION 1354647953
static bool prv_shutdown_enabled(void) {
return boot_version_read() >= SHUTDOWN_MIN_BOOT_VERSION;
}
static void prv_shutdown_confirm_cb(ClickRecognizerRef recogn... | i18n_noop("System") | |
bar_layer_add_to_window(&workout_dialog->action_bar, window);
}
// Icon
// On rectangular displays we just center it horizontally b/w the left edge of the display and
// the left edge of the action bar
#if PBL_RECT
x = (grect_get_max_x(bounds) - action_bar_width - icon_size.w) / 2;
#else
// On round displa... | (&workout_dialog->dialog) | ;
}
void workout_dialog_pop(WorkoutDialog *workout_dialog) {
dialog_pop(&workout_dialog->dialog);
}
void workout_dialog_set_text(WorkoutDialog *workout_dialog, const char *text) {
dialog_set_text(&workout_dialog->dialog, text);
}
void workout_dialog_set_subtext(WorkoutDialog *workout_dialog, const char *text) {
... |
break;
case BTPairingUIStateFailed:
case BTPairingUIStateSuccess:
alignment = GAlignTop;
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
x_offset = 0;
y_offset = 59;
#else
x_offset = 2;
y_offset = PBL_IF_RECT_ELSE(30, 36);
#endif
width = window_width;
break;
default:
... | (&data->info_text_mask_layer, true) | ;
layer_add_child(&window->layer, &data->info_text_mask_layer);
TextLayer *info_text_layer = &data->info_text_layer;
text_layer_init_with_parameters(info_text_layer,
&pair_text_area,
data->info_text_layer_buffer,
#if PLATFORM_ROBERT || PLATFORM_... |
length);
cl_assert_equal_i(
string_list_count(list_a),
string_list_count(list_b)
);
uint32_t count = string_list_count(list_a);
for (uint32_t idx = 0; i<count; i++) {
cl_assert_equal_s(
string_list_get_at(list_a, idx),
string_... | (notification_storage_get(&i3, &r)) | ;
compare_notifications(&e3, &r);
free(r.allocated_buffer);
cl_assert(notification_storage_get(&i1, &r));
compare_notifications(&e1, &r);
free(r.allocated_buffer);
}
void test_notification_storage__remove_single(void) {
Uuid i;
uuid_generate(&i);
TimelineItem e = {
.header = {
.id = i,
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return;
} | |
OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_NOPULL
};
GPIO_Init(GPIOD, &gpio_init);
GPIO_WriteBit(GPIOD, GPIO_Pin_2, Bit_SET);
// Configure pins relating to the FMC peripheral (30 pins!)
// B7 - FMC AVD - FMC Address Valid aka Latch
// D0-D1, D8-D15, E2-15 - FMC A, AD - FMC Address and Address/Dat... | flash_s29vs_software_reset() | |
/*
* 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 DICT_INVALID_ARGS;
} |
if (length < sizeof(Dictionary)) {
return DICT_NOT_ENOUGH_STORAGE;
}
iter->dictionary = (Dictionary *) buffer;
iter->cursor = iter->dictionary->head;
iter->end = buffer + length;
return DICT_OK;
}
uint32_t dict_size(DictionaryIterator* iter) {
return (uint8_t*)iter->end - (uint8_t*)iter->dictionary;... |
ipes(Layer *layer, GContext *ctx) {
DisplayCalibrationData *data = window_get_user_data(layer_get_window(layer));
if ((data->state == DisplayCalibrationState_X_Adjust) ||
(data->state == DisplayCalibrationState_Confirm)) {
prv_draw_border_stripe(layer, ctx, GAlignLeft);
prv_draw_border_stripe(layer, ... | window_single_click_subscribe(BUTTON_ID_BACK, prv_back_click_handler) | ;
}
void prv_window_unload(struct Window *window) {
DisplayCalibrationData *data = window_get_user_data(window);
light_reset_user_controlled();
gbitmap_deinit(&data->arrow_down);
gbitmap_deinit(&data->arrow_left);
gbitmap_deinit(&data->arrow_up);
gbitmap_deinit(&data->arrow_right);
// reinitialize dis... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return &s_app_window_stack_get_top_window;
} |
GPointPrecise gpoint_from_polar_precise(const GPointPrecise *precise_center,
uint16_t precise_radius, int32_t angle) {
return GPointPreciseFromGPoint(GPointZero);
}
GContext s_context;
void rocky_api_graphics_text_init(void) {}
void rocky_api_graphics_text_deinit(void) {}
v... |
/*
* 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... | analytics_add(metric, 1, client) | |
/*
* 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... | (stream, PB_WT_STRING, field->tag) | ) {
return false;
}
// Encode the size
if (!pb_encode_varint(stream, packed_array_size)) {
return false;
}
// if just being called to size it up, the stream callback will be NULL
if (!stream->callback) {
return pb_write(stream, NULL, packed_array_size);
}
// Write out each of the values
... |
/*
* 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... | system_task_add_callback(erase_callback, (void *)ERASE_NORMAL_FW) | ;
}
#if 0
static void up_long_click_handler(ClickRecognizerRef recognizer, Window *window) {
(void) recognizer;
set_text(window, "Erasing All...");
system_task_add_callback(erase_callback, (void *)ERASE_ALL);
}
#endif
static void select_click_handler(ClickRecognizerRef recognizer, Window *window) {
(void) rec... |
/*
* 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... | (LOG_LEVEL_WARNING, "Unexpected error requesting remote device name (conn_idx %d): %d",
conn_idx, e) | ;
}
}
void gap_le_device_name_handle_request(const BTDeviceInternal *addr) {
Connection *connection = connection_by_address(addr);
if (!connection) {
PBL_LOG(LOG_LEVEL_WARNING, "No connection for dev_name_request: " BT_DEVICE_ADDRESS_FMT,
BT_DEVICE_ADDRESS_XPLODE_PTR(&addr->address));
return;... |
st_x2) {
return;
}
GBitmap *fb = graphics_capture_frame_buffer(ctx);
if (!fb) {
return;
}
prv_replicate_column_row_raw(fb, src_x, dst_x1, dst_x2);
graphics_release_frame_buffer(ctx, fb);
}
void graphics_private_move_pixels_horizontally(GBitmap *bitmap, int16_t delta_x,
... | break;
}
case 8: {
uint8_t *const left_pixel = row_info.data + min_x;
uint8_t *const right_pixel = left_pixel + abs_delta;
if (pixels_to_move <= 0) {
// on this row, the delta is wider than the available pixels
if (patch_garbage) {
const uint8... |
void graphics_private_move_pixels_vertically(GBitmap *bitmap, int16_t delta_y) {
if (!bitmap || (delta_y == 0)) {
return;
}
const int bpp = gbitmap_get_bits_per_pixel(bitmap->info.format);
const bool delta_neg = (delta_y < 0);
const int16_t abs_delta = ABS(delta_y);
const int16_t min_y = bitmap->bou... |
const char **categories;
const struct clar_func *tests;
size_t test_count;
};
/* From clar_print_*.c */
static void clar_print_init(int test_count, int suite_count, const char *suite_names);
static void clar_print_shutdown(int test_count, int suite_count, int error_count);
static void clar_print_error(int num, co... | printf(" -tXX\t\tRun a specifc test by name\n") | ;
exit(-1);
}
static void
clar_parse_args(int argc, char **argv)
{
int i;
for (i = 1; i < argc; ++i) {
char *argument = argv[i];
if (argument[0] != '-')
clar_usage(argv[0]);
switch (argument[1]) {
case 's': { /* given suite number, name, or prefix */
int num = 0, offset = (argument... |
/*
* 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("HardF:\n") | |
timeline_resources.h"
#include "util/buffer.h"
#include "util/graphics.h"
#include "util/hash.h"
#include "util/math.h"
#include "util/size.h"
#include "util/trig.h"
#include "clar.h"
#include <stdio.h>
// Fakes
/////////////////////
#include "fake_rtc.h"
#include "fake_spi_flash.h"
#include "fixtures/load_test_res... | bitblt_bitmap_into_bitmap(s_dest_bitmap, screen_bitmap, GPointZero, GCompOpAssign,
GColorClear) | ;
gbitmap_destroy(screen_bitmap);
}
}
typedef struct TimelinePeekItemConfig {
time_t timestamp;
const char *title;
const char *subtitle;
TimelineResourceId icon;
int num_concurrent;
} TimelinePeekItemConfig;
static TimelineItem *prv_set_timeline_item(const TimelinePeekItemConfig *config, bool animated... |
mmand) {
data->processor->command(data->processor, data->processed_draw_command, size, data->list,
draw_command);
}
gdraw_command_draw(data->ctx, data->processed_draw_command);
return true;
}
void gdraw_command_list_draw(GContext *ctx, GDrawCommandList *command_list) {
gdraw_co... | if (command->type == GDrawCommandTypePath && collect->values.is_precise) {
for (uint16_t i = 0; i < num_copied; i++) {
GPoint *point_buffer = &collect->values.points[collect->iter.current_index + i];
GPoint point = *point_buffer;
*(GPointPrecise *)point_buffer = GPointPreciseFromGPoint(point);
... |
collect->iter.current_index += num_copied;
collect->iter.bytes_left -= bytes_copied;
return true;
}
GPoint *gdraw_command_list_collect_points(GDrawCommandList *command_list, bool is_precise,
uint16_t *num_points_out) {
const uint16_t num_points = gdraw_command_list_get_num_points(command_list);
const... |
tribute struct
return 0;
}
}
static bool prv_deep_copy_attribute(Attribute *dest, const Attribute *src, uint8_t **buffer,
uint8_t *const buffer_end) {
const size_t attribute_length = prv_get_attribute_length(src);
if (*buffer + attribute_length > buffer_end) {
return... | prv_attribute_type(id) | |
.state = SPITransportState_WaitingForReceiving_Footer;
}
static void prv_handle_int_waiting_for_receiving(void) {
s_spi_transport.state = SPITransportState_Receiving;
dialog_spi_send_and_receive_dma(NULL, s_spi_transport.rx_write_ptr,
s_spi_transport.bytes_receivable_count,
... | {
prv_lock();
bool is_rx_buffer_full = (0 == circular_buffer_get_write_space_remaining(&s_spi_transport.rx));
if (is_rx_buffer_full) {
s_spi_transport.should_transact_after_consuming_rx = true;
}
prv_unlock();
return is_rx_buffer_full;
} |
static void prv_handle_rx_buffer_has_space_available(void) {
// The slave is waiting to send more, just fire the external interrupt again:
if (s_spi_transport.should_transact_after_consuming_rx) {
s_spi_transport.should_transact_after_consuming_rx = false;
dialog_spi_set_pending_int();
}
}
static void ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | circular_buffer_write(&buffer, (uint8_t*) "abc", 3) | |
2_t address = str_to_address(address_str);
if (address == -1) {
prompt_send_response("Invalid address");
return;
}
int length = atoi(length_str);
if (length == 0) {
prompt_send_response("Invalid length");
return;
}
// Allocate a 1KB buffer to read data in segments
uint8_t *buffer = (uint... | flash_read_bytes(buffer, addr, BUFFER_SIZE) | ;
for (uint32_t i = 0; i < BUFFER_SIZE; i++) {
if (buffer[i] != i) {
char err_buf[80];
prompt_send_response_fmt(err_buf, sizeof(err_buf), "FAIL: Incorrect value at 0x%"PRIx32,
addr + i);
return;
}
}
}
// read it back, albeit awkwardly. We... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
mutex_lock(s_mutex);
mutex_unlock(s_mutex);
} |
mutex_destroy(s_mutex);
s_mutex = NULL;
s_rmutex = mutex_create_recursive();
for (int i=0; i < 10000; i++) {
mutex_lock_recursive(s_rmutex);
}
for (int i=0; i < 10000; i++) {
mutex_unlock_recursive(s_rmutex);
}
mutex_destroy((PebbleMutex *)s_rmutex);
s_rmutex = NULL;
PROFILER_STOP;
PROF... |
) {
cl_assert_equal_p(NULL, comm_session_send_buffer_begin_write(NULL, ENDPOINT_ID, 1, TIMEOUT_MS));
}
void test_session_send_buffer__begin_write_with_more_than_max_payload(void) {
s_valid_session = &s_session;
size_t max_length = comm_session_send_buffer_get_max_payload_length(&s_session);
SendBuffer *write_... | (&s_session) | ;
SendBuffer *write_sb = comm_session_send_buffer_begin_write(&s_session, ENDPOINT_ID,
max_length /* required_free_length */,
TIMEOUT_MS);
uint8_t fake_data[max_length];
memset(fake_data, 0,... |
================================================================================================
// Public functions
// -------------------------------------------------------------------------------------------------
// Setup a very high priority interrupt to fire periodically. This ISR will call task_watchdog_feed()... | (TIM2, DISABLE) | |
e as push-pull to ensure we are
// sufficiently driving the line. Ideally, the accessory would have a strong-enough pull-up, but
// now that we've released use of the accessory port via the smartstrap APIs, we can't easily
// change this.
const bool is_open_drain = (baudrate <= 115200);
#endif
s_baudrate = ba... | {
uart_clear_rx_dma_buffer(ACCESSORY_UART);
} |
s_stream_context = context;
s_stream_cb = stream_callback;
s_has_sent_byte = false;
uart_set_tx_interrupt_enabled(ACCESSORY_UART, true);
// Block until the sending is complete, but timeout if we aren't able to send a byte for a while.
while (xSemaphoreTake(s_send_semaphore, milliseconds_to_ticks(SEND_BYTE_... |
break;
case KAlgActivityTypeCount:
WTF;
break;
}
int start_idx = (session->start_utc - test_start_utc) / SECONDS_PER_MINUTE;
printf("\nfound %s len: %d, start: %d, ", desc, (int) session->len_minutes,
start_idx);
// Only compare the first activi... | (samples, num_samples, exp_minutes, ARRAY_LENGTH(exp_minutes)) | ;
}
// Run the working at desk sample
// The expected results were obtained empirically on a known good commit
{
int num_samples;
AccelRawData *samples = activity_sample_working_at_desk(&num_samples);
TestMinuteData exp_minutes[] = {
{
.steps = 0,
.orientation = 0x72,
... |
goto failed;
}
// the INT line should be low
if (gpio_input_read(&dev->int_gpio)) {
PBL_LOG(LOG_LEVEL_ERROR, "INT line is not low!");
goto failed;
}
// Set the accelerometer sample frequency
PBL_LOG(LOG_LEVEL_DEBUG, "Setting accel frequency");
PBL_ASSERTN(HRM_MANAGER_ACCEL_RATE_MILLIHZ >= 1... | (LOG_LEVEL_DEBUG, "FW update image is v%" PRIu8 ".%" PRIu8 ".%" PRIu8,
HRM_SW_VERSION_PART_MAJOR(image_header.sw_version_major),
HRM_SW_VERSION_PART_MINOR(image_header.sw_version_major),
image_header.sw_version_minor) | |
sic_ctx.artist, artist, artist_length);
copy_and_truncate(s_music_ctx.album, album, album_length);
mutex_unlock_recursive(s_music_ctx.mutex);
prv_put_now_playing_changed_event();
}
static void prv_update_string_and_put_event(const char *value, size_t value_length, off_t offset) {
mutex_lock_recursive(s_music... | mutex_unlock_recursive(s_music_ctx.mutex) | ;
return playback_rate_percent;
}
uint8_t music_get_volume_percent(void) {
mutex_lock_recursive(s_music_ctx.mutex);
int32_t player_volume_percent = s_music_ctx.player_volume_percent;
mutex_unlock_recursive(s_music_ctx.mutex);
return player_volume_percent;
}
static void prv_put_state_changed_event(MusicPlayS... |
;
activity_prefs_set_gender(ACTIVITY_DEFAULT_GENDER);
activity_prefs_set_age_years(ACTIVITY_DEFAULT_AGE_YEARS);
}
// ---------------------------------------------------------------------------------------
void test_activity__cleanup(void) {
activity_stop_tracking();
fake_system_task_callbacks_invoke_pending()... | (s_exp_full_day_resting_kcalories * minutes_today,
MINUTES_PER_DAY) | ;
exp_resting_kcalories[0] = exp_resting_kcalories_now;
ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricRestingKCalories, exp_resting_kcalories);
// See what distance we walked
int32_t exp_distance;
activity_get_metric(ActivityMetricDistanceMeters, 1, &exp_distance);
cl_assert(exp_distance > 0);
// Read the a... |
(ARRAY_LENGTH(memory_with_attribute_id_at_end_p2), (uint8_t*) memory_with_attribute_id_at_end_p2) | ;
s_num_ds_notifications_received += 2;
} else if (uid == invalid_dict_uid) {
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_invalid_attribute_length), (uint8_t*) s_invalid_attribute_length);
s_num_ds_notifications_received++;
} else if (uid == loading_uid) {
prv_fake_receiving_ds_notificatio... | |
_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r16_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true... | layer_render_tree(&layer, &ctx) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_nx_offset_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_y_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_y_off... |
_CLIP, 3, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r3_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, 4, GCornersAll... | (&ctx.dest_bitmap, "fill_rect_origin_r3_aa_clip_xy.${BIT_DEPTH_NAME}.pbi") | );
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_a... |
ata_changed(void *context) {
LauncherAppWindowData *data = context;
launcher_menu_layer_reload_data(&data->launcher_menu_layer);
}
//! We're not 100% sure of the order of the launcher list yet, so use this function to transform
//! the row index to achieve the desired list ordering
static uint16_t prv_transform_in... | prv_launcher_menu_window_push() | ;
app_idle_timeout_start();
app_event_loop();
}
const PebbleProcessMd *launcher_menu_app_get_app_info(void) {
static const PebbleProcessMdSystem s_launcher_menu_app_info = {
.common = {
.main_func = prv_main,
// UUID: dec0424c-0625-4878-b1f2-147e57e83688
.uuid = {0xde, 0xc0, 0x42, 0x4c, 0... |
/ D-Cache definition doesn't always exist
#ifndef __DCACHE_PRESENT
# define __DCACHE_PRESENT 0U
#endif
// Most of these implementations are derived from CMSIS
#define CCSIDR_LINESIZE(x) (((x) & SCB_CCSIDR_LINESIZE_Msk) >> SCB_CCSIDR_LINESIZE_Pos)
#define CCSIDR_WAYS(x) (((x) & SCB_CCSIDR_ASSOCIATIVITY_Msk) >> SCB_... | prv_cache_operation_range(&SCB->DCIMVAC, dcache_line_size(), (uintptr_t)addr, size) | ;
#endif
}
MOCKABLE void dcache_flush_invalidate(const void *addr, size_t size) {
#if __DCACHE_PRESENT
prv_cache_operation_range(&SCB->DCCIMVAC, dcache_line_size(), (uintptr_t)addr, size);
#endif
}
static void prv_align(uintptr_t *addr, size_t *size, uint32_t line_size) {
uint32_t line_mask = line_size - 1;
if ... |
ol wait_for_busy_clear(uint8_t bus_idx) {
unsigned int attempts = I2C_TIMEOUT_ATTEMPTS_MAX;
while((i2c_buses[bus_idx].i2c->SR2 & I2C_SR2_BUSY) != 0) {
--attempts;
if (!attempts) {
return false;
}
}
return true;
}
//! Abort the transfer
//! Should only be called when the bus is locked
static ... | // which would cause the next transfer to fail
if (!wait_for_busy_clear(bus_idx)) {
// Reset I2C bus if busy flag does not clear
bus_reset(bus_idx);
}
bus_unlock(bus);
return result;
} |
bool i2c_read_register(I2cDevice device_id, uint8_t i2c_device_address, uint8_t register_address, uint8_t *result) {
return i2c_read_register_block(device_id, i2c_device_address, register_address, 1, result);
}
bool i2c_read_register_block(I2cDevice device_id, uint8_t i2c_device_address, uint8_t
... |
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_no_clip.${BIT_DEPTH_NAME}.pbi"));
#endif
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 3);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
// TODO: Fix offset calculation and ree... | (&ctx.dest_bitmap, "draw_round_rect_offset_r4_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_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_N... |
);
cl_assert_equal_p(comm_session_get_by_type(CommSessionTypeApp), session);
comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection);
fake_system_task_callbacks_invoke_pending(); // get dls called
cl_assert_equal_b(s_dls_private_handle_disconnect_called, false);
cl_assert_equal_b(s_comm_se... | (fake_system_task_count_callbacks(), 0) | ;
comm_session_send_next(session);
cl_assert_equal_i(fake_system_task_count_callbacks(), 1);
comm_session_send_next(session);
cl_assert_equal_i(fake_system_task_count_callbacks(), 1);
comm_session_send_next(session);
cl_assert_equal_i(fake_system_task_count_callbacks(), 1);
comm_session_send_next(session)... |
ss_action(item);
if (action) {
timeline_invoke_action(item, action, NULL);
}
}
static void prv_push_muted_dialog(void) {
SimpleDialog *simple_dialog = simple_dialog_create("Muted");
Dialog *dialog = simple_dialog_get_dialog(simple_dialog);
const char *msg = i18n_get("Muted", dialog);
dialog_set_text(d... | (item, &items_originator_id) | ;
const bool has_snooze_action = ((item->header.type == TimelineItemTypeReminder) &&
!uuid_equal(&(Uuid)UUID_REMINDERS_DATA_SOURCE, &items_originator_id) &&
reminders_can_snooze(item));
const bool has_dismiss_all_action = ((dismiss_action) &&
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (s_free_list) | );
PBL_ASSERTN(mbuf_get_length(m) == 0);
m = mbuf_get_next(m);
}
}
MBuf *mbuf_get(void *data, uint32_t length, MBufPool pool) {
PBL_ASSERTN(pool < NumMBufPools);
MBuf *m;
mutex_lock(s_free_list_lock);
// get an MBuf out of the free list if possible, or else allocate a new one
if (s_free_list) {
... |
text_layer.h"
#include "applib/ui/window_private.h"
#include "resource/resource.h"
#include "resource/resource_ids.auto.h"
#include "services/normal/timeline/timeline_resources.h"
#include "shell/system_theme.h"
#include "system/passert.h"
#include "util/graphics.h"
#include "util/hash.h"
#include "util/math.h"
#includ... | (s_dest_bitmap) | ;
const int16_t bitmap_width = DISP_COLS;
const int16_t bitmap_height = DISP_ROWS;
const GSize bitmap_size = GSize(bitmap_width, bitmap_height);
s_dest_bitmap = gbitmap_create_blank(bitmap_size, CANVAS_GBITMAP_FORMAT);
s_ctx.dest_bitmap = *s_dest_bitmap;
s_ctx.draw_state.clip_box.size = bitmap_size;
s_c... |
GIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax2_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"));
// AA = true, SW = 11
setup_test_aa_sw(&ctx, fb,... | gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r3_sw1_no_clip.${BIT_DEPTH_NAME}.pbi") | );
#endif
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"));
// Should ... |
prv_unschedule_animation(state, child, finished, allow_auto_destroy, force_destroy, teardown);
}
}
if (!prv_animation_is_scheduled(state, animation)) {
// When we unschedule a top-level animation, we call prv_unschedule_animation() on each of
// the children, which gives us a chance to destroy them.... | {
if (animation->implementation->setup != NULL) {
animation->implementation->setup(animation->handle);
}
animation->did_setup = true;
} |
const bool old_head_is_animating = state->scheduled_head
? (((AnimationPrivate *)state->scheduled_head)->abs_start_time_ms <= now)
: false;
// Move from the unscheduled to the scheduled list
PBL_ASSERTN(list_contains(state->unscheduled_head, &animation->list_node));
list_remove(&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... | if (need_to_all_caps_string) {
toupper_str(buffer);
} | |
ol process_manager_compiled_with_legacy2_sdk(void) {
return false;
}
GDrawState graphics_context_get_drawing_state(GContext *ctx) {
return (GDrawState) { };
}
bool graphics_release_frame_buffer(GContext *ctx, GBitmap *buffer) {
return false;
}
void graphics_context_set_drawing_state(GContext *ctx, GDrawState d... | fake_event_get_last() | ;
cl_assert_equal_i(evt.type, PEBBLE_CALLBACK_EVENT);
evt.callback.callback(evt.callback.data);
}
// --------------------------------------------------------------------------------------
// Advance to the given time, firing all timers that are scheduled along the way
static void prv_advance_to_ms_with_timers(uin... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return true;
} |
WindowStack *stack = app_state_get_window_stack();
if (!window_stack_is_animating(stack)) {
return false;
}
WindowTransitioningContext *transition_ctx = &stack->transition_context;
return prv_window_is_render_scheduled(transition_ctx->window_from) ||
prv_window_is_render_scheduled(transition_c... |
(arg);
}
static void prv_end_command(void) {
while (SPI_I2S_GetFlagStatus(DISP_SPI, SPI_I2S_FLAG_BSY)) continue;
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET);
}
static bool prv_wait_busy(void) {
// The display should come out of busy within 35 milliseconds;
// it is a waste of time to wait more than twice ... | ("Display initialized after ") | ;
dbgserial_print_hex(retries);
dbgserial_putstr(" retries.");
return;
}
prv_reset_fpga();
}
// It's taken too many attempts and the FPGA still isn't behaving. Give up on
// showing the splash screen and keep the screen off so that the user doesn't
// see a broken-looking staticky sc... |
er_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 = {
{
.expiration_time = 1464734484, // (Tue, 31 May 2016 22:41:24 GMT)
.type = AppGlanc... | (gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)) | ;
}
void test_launcher_menu_layer__app_selected_and_apps_above_and_below_with_glances_pdc(void) {
s_use_pdc_icons = true;
prv_insert_glances_for_app_selected_and_apps_above_and_below_with_glances_test();
prv_render_launcher_menu_layer(LauncherMenuLayerTestApp_InteriorApp);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_b... |
urn;
}
prompt_send_response("Starting BT sleep check test");
s_sleep_test_timer = new_timer_create();
new_timer_start(s_sleep_test_timer , 10, prv_sleep_timer_test_cb, (void *)(uintptr_t)0, 0);
prompt_command_continues_after_returning();
}
void command_btle_unmod_tx_start(char *tx_channel) {
bt_driver_st... | GPoint(0, 0) | , GPoint(DISP_COLS, DISP_ROWS));
// ~63 degrees
graphics_draw_line(ctx, GPoint(DISP_COLS/2, 0), GPoint(DISP_COLS, DISP_ROWS));
// ~33 degrees
graphics_draw_line(ctx, GPoint(0, DISP_ROWS/3), GPoint(DISP_COLS, DISP_ROWS));
// ~53 degrees
graphics_draw_line(ctx, GPoint(DISP_COLS/4, 0), GPoint(DISP_COLS, DISP_R... |
sert_equal_i(horiz_advance,
text_resources_get_glyph_horiz_advance(&s_font_cache, WILDCARD_CODEPOINT, &s_font_info));
const GlyphData *glyph = text_resources_get_glyph(&s_font_cache,
WILDCARD_CODEPOINT, &s_font_info);
cl_assert_equal_i(glyph->header.width_p... | cl_assert_equal_m(phone_bytes, glyph->data, glyph_size_bytes) | |
llback_data;
PebbleTask target_task;
bool expired; // This gets set when the timer's callback runs
bool repeating;
} EventedTimer;
//! The list of all the timers that have been created.
static ListNode* s_timer_list_head;
static PebbleMutex * s_mutex;
// ------------------------------------------------------... | mutex_unlock(s_mutex) | ;
PebbleEvent e = {
.type = PEBBLE_CALLBACK_EVENT,
.callback = {
.callback = prv_evented_timer_event_callback,
.data = (void*)(intptr_t)id,
}
};
switch (timer->target_task) {
case PebbleTask_KernelMain:
event_put(&e);
break;
case PebbleTask_App:
case PebbleTask_Wo... |
tatus;
*status = (LegacyFwUpdateCompletionStatus) {
.recovery_percent_completion = 0,
.resource_percent_completion = 0,
.firmware_percent_completion = 0
};
return true;
}
// End Legacy completion handlers
bool firmware_update_is_in_progress(void) {
return s_update_status == FirmwareUpdateRunning... | {
return;
} |
if (event->type != PebblePutBytesEventTypeProgress) {
return; // Only progress events report bytes_transferred updates
}
FwUpdateCompletionStatus *status = &s_current_completion_status.status;
status->bytes_transferred += event->bytes_transferred;
}
void firmware_update_pb_event_handler(PebblePutBytesEv... |
seconds
{ 520, 144, -144},
{ 600, 176, -48},
{ 728, 216, -104},
{ 840, 344, -176},
{ 992, 424, -232},
{ 1088, 464, -224},
{ 1408, 472, -208},
{ 1352, 472, -184},
{ 1208, 360, -112},
{ 1256, 272, -120},
{ 1184, 272, -56},
{ 1008, 280, -80},
{ 808, 240, -32},
{ 616,... | { 696, 208, -120},
{ 584, 184, -176},
{ 584, 160, -88},
{ 704, 192, -96},
{ 808, 248, -152},
{ 1024, 360, -144},
{ 1136, 448, -224},
{ 1176, 496, -256},
{ 1304, 512, -192},
// 113 seconds
{ 1152, 496, -176},
{ 1048, 360, -128},
{ 1168, 344, -88},
{ 1272, 312, -40}... |
{ 1000, 352, -40},
{ 1136, 296, 0},
{ 1048, 264, 56},
{ 848, 176, 32},
{ 672, 120, -16},
{ 696, 88, 88},
{ 800, 168, 136},
{ 960, 152, 144},
{ 1152, 136, 152},
{ 1240, 144, 112},
{ 1184, 120, -8},
{ 1320, 104, -8},
{ 1280, 120, 16},
{ 1144, 136, -80},
{ 1136,... |
ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 8, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r8_no_clip.${BIT_DEPTH_NAME}.pbi"));
// Should draw same as radius 8
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGI... | 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, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2), GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax1_aa_no_clip.${BIT_DEPTH_NAME}.pbi"));
// Should draw same as rmax1
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP... |
indow;
static const int s_hr_measuring_widths[] = {36, 0, 24, 28, 32};
static void prv_draw_heart_node_callback(GContext *ctx, const GRect *box,
const GTextNodeDrawConfig *config, bool render,
GSize *size_out, void *user_data);
static ... | hr_util_get_hr_zone(active_window->workout_controller->get_metric_value(
metric_type, active_window->workout_data)) | ) {
case HRZone_Zone0:
return GColorWhite;
case HRZone_Zone1:
return GColorMelon;
case HRZone_Zone2:
return GColorChromeYellow;
case HRZone_Zone3:
return GColorOrange;
default:
return BACKGROUND_COLOR;
}
} else {
return is_scrollable ? GCol... |
_is_handled) {
uint8_t msg[] = { 0x13, 17, 'c', 'o', 'm', '.', 's', 'p', 'o', 't', 'i', 'f', 'y', '.', 'm',
'u', 's', 'i', 'c', 7, 'S', 'p', 'o', 't', 'i', 'f', 'y' };
prv_receive_pp_data(msg, sizeof(msg));
PebbleEvent e = fake_event_get_last();
if (expect_is_handled) {
cl_assert_equal_... | (false /* connected */) | ;
}
void test_music_endpoint__ignore_now_playing_from_ios_app(void) {
// iOS app connects:
prv_receive_app_info_event(false /* is_android */);
// iOS app is not supposed to use this endpoint:
prv_receive_and_assert_all(false /* expect_is_handled*/);
}
void test_music_endpoint__request_now_playing_upon_connect... |
(name, sizeof(name), "bigfile");
//Fill up entire memory section, subtract 32768 for header space.
int fd = pfs_open(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, pfs_get_size() - (num_pages()*128));
printf("%d\n", pfs_get_size() - 1024);
cl_assert(fd >= 0);
cl_assert(pfs_close(fd) == S_SUCCESS);
cl_assert(pfs_... | (file_small, sizeof(file_small), "file%d", i) | ;
snprintf(buf, sizeof(buf), "This is small buf %d!", i);
int len = strlen(buf);
int fd = pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, len);
cl_assert(fd >= 0);
cl_assert(pfs_write(fd, (uint8_t *)buf, len) == len);
cl_assert(pfs_close(fd) == S_SUCCESS);
if (num_erases ... |
T_SCREEN_RES (PBL_DISPLAY_WIDTH == 200 && PBL_DISPLAY_HEIGHT == 228)
#define SNOWY_SCREEN_RES (PBL_DISPLAY_WIDTH == 144 && PBL_DISPLAY_HEIGHT == 168)
#define SPALDING_SCREEN_RES (PBL_DISPLAY_WIDTH == 180 && PBL_DISPLAY_HEIGHT == 180)
/////////////////////////////////////////////////////////////////////////////////////... | {
graphics_context_set_fill_color(ctx, color);
const GRect outer_bounds = grect_inset(frame, GEdgeInsets(-1));
#if PBL_RECT
GPoint start_outer_point = prv_steps_to_point(0, total, outer_bounds);
GPoint start_inner_point = prv_inset_point(&frame, start_outer_point, fill_thickness);
GPoint end_outer_point = p... |
path.points[path.num_points++] = start_outer_point;
// loop through and add all the corners b/w start and end
for (uint16_t i = 0; i < ARRAY_LENGTH(corners); i++) {
if (corners[i] > 0 && corners[i] < current) {
path.points[path.num_points++] = prv_steps_to_point(corners[i], total, outer_bounds);
}
... |
/*
* 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... | (sizeof(FrameBuffer)) | ;
framebuffer_init(fb, &(GSize) { DISP_COLS, DISP_ROWS });
test_graphics_context_init(&ctx, fb);
GBitmap *background_0_100 = get_gbitmap_from_pbi("blendtest_0_100_backdrop.pbi");
GBitmap *background_33_66 = get_gbitmap_from_pbi("blendtest_33_66_backdrop.pbi");
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ... |
ime) == current_day) {
// last day of multiday event
prv_copy_relative_time_string(number_buffer, number_buffer_size, word_buffer,
word_buffer_size, end_time, end_time);
} else {
// middle day of non-all day multiday event
prv_get_relative_all_day_string(word_buffer, word_buffer_size, current_... | ("Tomorrow", buffer, buf_size) | ;
} else if (midnight <= (today_midnight + (5 * SECONDS_PER_DAY))) {
// Use weekday name up to 5 days in the future, aka "Sunday"
prv_format_time(buffer, buf_size, i18n_noop("%A"), timestamp);
} else {
// Otherwise use "Month Day", aka "June 21"
prv_format_time(buffer, buf_size, i18n_noop("%B %d"), ... |
state.state].inbox_received;
if (inbox_rcv) {
inbox_rcv(it, context);
} else {
DBG_VERBOSE("No inbox_received handler for state %d", s_state.state);
}
}
static void prv_inbox_dropped(AppMessageResult reason, void *context) {
// Q: We don't know what got dropped here. Should we send/initiate a ResetRequ... | (s_state.state != PostMessageStateSessionOpen) | ;
DBG("Erroring out head object, 3s passed!");
s_state.out.session_closed_object_queue_timer = EVENTED_TIMER_INVALID_ID;
prv_object_queue_pop_head_and_emit_error_event_and_own_json_buffer();
if (s_state.out.object_queue) {
// Still not open and still things in the object queue, restart the timer:
prv... |
ayer_deinit(&status_bar_layer->layer);
if (status_bar_layer->title_timer_id != TIMER_INVALID_ID) {
app_timer_cancel(status_bar_layer->title_timer_id);
}
event_service_client_unsubscribe(&(status_bar_layer->tick_event));
}
Layer *status_bar_layer_get_layer(StatusBarLayer *status_bar_layer) {
PBL_ASSERTN(sta... | PBL_ASSERTN(status_bar_layer) | ;
memset(status_bar_layer->config.info_text_buffer, 0,
sizeof(status_bar_layer->config.info_text_buffer));
layer_mark_dirty(&status_bar_layer->layer);
}
void status_bar_layer_set_separator_mode(StatusBarLayer *status_bar_layer,
StatusBarLayerSeparatorMode mode) {
... |
_caller(const char *number, const char *name) {
return NULL;
}
void ancs_perform_action(uint32_t notification_uid, uint8_t action_id) {
}
void notifications_handle_notification_action_result(
PebbleSysNotificationActionResult *action_result) {
}
void notification_storage_set_status(const Uuid *id, uint8_t stat... | cl_assert(!timeline_exists(&id)) | |
ite_bytes((uint8_t *)&new_magic, prv_current_page_flash_addr(), sizeof(SprfMagic));
s_valid_page_idx++;
// Sanity check to make sure that the page we are moving to is actually empty.
if ((s_valid_page_idx >= SPRF_NUM_PAGES) ||
(prv_get_magic_for_page(s_valid_page_idx) != SprfMagic_UnpopulatedEntry)) {
... | (LOG_LEVEL_WARNING, "Shared PRF Storage sector # %"PRIu32" is corrupted. Invalidating"
" and starting a new one", s_valid_page_idx) | ;
prv_invalidate_current_page();
return false;
}
uint32_t written_crc = FIELD_CRC_FROM_FIELD(field_out);
if (written_crc == SPRF_UNWRITTEN_CRC) {
// If empty field, return that we have invalid data too
return false;
}
return true;
}
#define SPRF_PERSIST_FIELD(data, name) \
prv_persist_f... |
Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed un... | (
EM_DASH, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD), TEXT_COLOR, container) | ;
} else {
const size_t bpm_size = sizeof("000");
GTextNodeText *number_text_node =
health_util_create_text_node(bpm_size, data->bpm_font, TEXT_COLOR, container);
snprintf((char *)number_text_node->text, bpm_size, "%"PRIu32, data->now_bpm);
GTextNodeText *units_text_node = health_util_create... |
We can't change to analog inputs
// because those aren't 5V tolerant which these pins may need to be.
if (dev->tx_gpio.gpio) {
const InputConfig input_config = {
.gpio = dev->tx_gpio.gpio,
.gpio_pin = dev->tx_gpio.gpio_pin
};
gpio_input_init(&input_config);
}
if (dev->rx_gpio.gpio) {
... | {
PBL_ASSERTN(dev->state->initialized);
dev->state->rx_irq_handler = irq_handler;
} |
void uart_set_tx_interrupt_handler(UARTDevice *dev, UARTTXInterruptHandler irq_handler) {
PBL_ASSERTN(dev->state->initialized);
dev->state->tx_irq_handler = irq_handler;
}
void uart_set_rx_interrupt_enabled(UARTDevice *dev, bool enabled) {
PBL_ASSERTN(dev->state->initialized);
if (enabled) {
dev->state->... |
e <unistd.h>
# define _MAIN_CC
# define snprint_eq snprintf
typedef struct stat STAT_T;
#endif
#include "clar.h"
#define CL_WITHIN(n, min, max) ((n) >= (min) && (n) <= (max))
bool clar_expecting_passert = false;
bool clar_passert_occurred = false;
jmp_buf clar_passert_jmp_buf;
static void fs_rm(const char *_sourc... | if (!clar_category_is_suite_enabled(suite))
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... | {
#if CAPABILITY_HAS_SDK_SHELL4
WatchfaceData *data = &s_watchface_data;
click_manager_init(&data->click_manager);
prv_watchface_configure_click_handlers();
#endif
} |
void watchface_handle_button_event(PebbleEvent *e) {
#if CAPABILITY_HAS_SDK_SHELL4
// Only handle button press if app state indicates that the app is still running
// which is not in the process of closing
WatchfaceData *data = &s_watchface_data;
if (app_manager_get_task_context()->closing_state == ProcessRun... |
/*
* 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... | (sizeof(ReadResponseData) + val_len) | ;
if (!read_response) {
*gatt_value_length = 0;
return BLEGATTErrorLocalInsufficientResources;
}
*read_response = (const ReadResponseData) {
.object_ref = data->obj_ref,
.length = val_len,
};
memcpy(read_response->value, resp->value, val_len);
if (s_read_responses[data->c... |
ess_manager_send_callback_event_to_process(PebbleTask task, void (*callback)(void *data),
void *data) {
callback(data);
}
void accessory_imaging_enable(bool enable) {
}
// Tests
///////////////////////////////////////////////////////////////////////////////
stati... | cl_assert(timer) | ;
cl_assert_equal_i(stub_new_timer_timeout(timer->id), 5000);
stub_new_timer_fire(timer->id);
cl_assert(s_mfg_mode_entered);
cl_assert(!s_factory_reset_called);
}
|
S);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 3), MAX_NUM_COLS + 4);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 5), 0);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 7), 1);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 9), 2);
graphics_draw_horizontal_line_dotted(&ctx, GPoi... | (&ctx, GPoint(7, 0), 1) | |
/*
* 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 (buffer) {
strncpy(buffer, "15 minutes ago", buf_size);
buffer[buf_size - 1] = '\0';
}
} |
// Stubs
/////////////////////
#include "stubs_action_menu.h"
#include "stubs_analytics.h"
#include "stubs_animation_timing.h"
#include "stubs_app_install_manager.h"
#include "stubs_app_timer.h"
#include "stubs_app_window_stack.h"
#include "stubs_bootbits.h"
#include "stubs_click.h"
#include "stubs_event_service_cli... |
/*
* 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_destroy(window);
} | |
/*
* 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, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r8_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, STROKE_SMALL);
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MEDIUM);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap... |
clock_change();
s_current_hour = 13;
s_current_minute = 14;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 1);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//! Alarm Timeline Pin Tests
void test_alarm__pin_add(void) {
const AlarmId dum... | (s_num_timeline_removes, 0) | ;
alarm_get_next_enabled_alarm(&next_alarm_time);
cl_assert_equal_i(next_alarm_time,
s_current_day + 10 * SECONDS_PER_HOUR + 30 * SECONDS_PER_MINUTE);
// First alarm goes off. Second one should be up
s_current_hour = 10;
s_current_minute = 30;
cron_service_wakeup();
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... | pattern(i, item_size) | ;
int64_t got;
if (j == -1) {
got = analytics_heartbeat_get(heartbeat, metric);
} else {
got = analytics_heartbeat_get_array(heartbeat, metric, j);
}
printf("Expected %"PRIx64", got %"PRIx64" (item_size=%"PRIu32")\n",
expected, got, item_size);
cl_assert(got == expected);
}
void test_analytic... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
for (size_t i = 0; i < argc; i++) {
char buffer[100] = {0};
jerry_object_to_string_to_utf8_char_buffer(argv[i], (jerry_char_t *)buffer, sizeof(buffer));
app_log(level, "JS", 0, "%s", buffer);
}
return jerry_create_undefined();
} |
JERRY_FUNCTION(prv_console_log) {
return prv_log(APP_LOG_LEVEL_INFO, argc, argv);
}
JERRY_FUNCTION(prv_console_warn) {
return prv_log(APP_LOG_LEVEL_WARNING, argc, argv);
}
JERRY_FUNCTION(prv_console_error) {
return prv_log(APP_LOG_LEVEL_ERROR, argc, argv);
}
static void prv_init(void) {
bool was_created;
... |
WINDOW_SIZE;
}
}
static void prv_assert_sent_ack(BLECharacteristic characteristic, uint8_t sn) {
const PPoGATTPacket ack = (const PPoGATTPacket) {
.sn = sn,
.type = PPoGATTPacketTypeAck,
};
fake_gatt_client_op_assert_write(characteristic, (const uint8_t *) &ack, sizeof(ack),
... | (ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), false) | |
ting_calories = len * 100,
.active_calories = len * 200,
.distance_mm = len * 1000,
};
prv_insert_artificial_activity_session(minute_raw_data, k_minute_data_len, &exp_session);
prv_feed_activity_minutes(minute_raw_data, k_minute_data_len);
cl_assert_equal_i(s_num_captured_activity_sessions,... | {
cl_assert_equal_i(stats.sleep_start_utc, k_sleep_start_utc);
cl_assert_equal_i(stats.sleep_len_m, i - k_sleep_start_m - KALG_MAX_UNCERTAIN_SLEEP_M);
cl_assert_equal_i((now - stats.uncertain_start_utc) / SECONDS_PER_MINUTE,
KALG_MAX_UNCERTAIN_SLEEP_M);
} | |
nternal.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/list.h"
static PebbleRecursiveMutex *s_app_outbox_mutex;
typedef struct {
AppOutboxMessage *head;
AppOutboxMessageHandler message_handler;
size_t consumer_data_length;
PebbleTask consumer_task;
} AppOutboxConsumer;
//! Array wi... | {
if (!sent_handler) {
return;
}
PebbleEvent event = {
.type = PEBBLE_APP_OUTBOX_SENT_EVENT,
.app_outbox_sent = {
.sent_handler = sent_handler,
.cb_ctx = cb_ctx,
.status = status,
},
};
process_manager_send_event_to_process(PebbleTask_App, &event);
} |
//! @note This executes on App Task
static void prv_schedule_consumer_message_handler(AppOutboxConsumer *consumer,
AppOutboxMessage *message) {
void (*callback)(void *) = (__typeof__(callback))consumer->message_handler;
PebbleEvent event = {
.type = PEBBLE_APP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.