prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
{
if (!quiet) {
APP_LOG(APP_LOG_LEVEL_ERROR, "Animation %d does not exist", (int)handle);
}
return NULL;
}
return (AnimationPrivate *)node;
}
// -------------------------------------------------------------------------------------------
// Find animation by parent and child idx
typedef struct {... | {
return PLAY_DURATION_INFINITE;
} |
duration += child_duration;
}
} else if (animation->type == AnimationTypeSpawn) {
// For a spawn animation, get the max of each component
uint32_t max_child_duration = 0;
for (child_idx = 0; child_idx < ANIMATION_MAX_CHILDREN; child_idx++) {
AnimationPrivate *child = prv_find_animation... |
/*
* 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... | graphics_context_set_fill_color(ctx, bg_color) | |
st) {
return;
}
// Make sure to request the same security level when sending a request to refresh encryption:
ble_gap_get_sec_level(conn_idx, &level);
}
Connection *connection = connection_by_idx(conn_idx);
connection_set_should_pin_address(connection, req->should_pin_address);
connection_set... | if (evt->length < sizeof(uint16_t)) {
PBL_LOG(LOG_LEVEL_ERROR, "Invalid CCCD value length %u!", evt->length);
return ATT_ERROR_INVALID_VALUE_LENGTH;
} |
uint16_t cccd_value = 0;
memcpy(&cccd_value, evt->value, sizeof(cccd_value));
bool is_subscribed = (cccd_value & GATT_CCC_NOTIFICATIONS);
Connection *connection = connection_by_idx_check(evt->conn_idx);
uint16_t value_handle;
if (evt->handle == s_pps_ctx.att_hdl.conn_status_cccd) {
connection_set_subsc... |
ipsis, GTextAlignmentCenter, NULL);
}
void draw_text_single_line_ellipsis_clip_outside_nx(Layer* me, GContext* ctx) {
graphics_context_set_text_color(ctx, GColorBlack);
graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(-80, 4, 72, 32),
GTextOverflowModeTrailingEllipsis, GTextAlignment... | (0, 0, 144, 168) | );
layer_set_update_proc(&canvas, &canvas_layer_update_callback);
layer_init(&layer, &GRect(40, 40, 80, 40));
layer_add_child(&canvas, &layer);
// Corner cases
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_nx_zero_y_offset);
layer_render... |
/*
* 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... | (native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite) | |
memcpy(&data.keys, keys_in, sizeof(data.keys));
}
SPRF_PERSIST_FIELD(data, root_keys);
}
prv_unlock();
}
//!
//! BLE Pairing Data APIs
//!
bool shared_prf_storage_get_ble_pairing_data(SMPairingInfo *pairing_info_out, char *name_out,
bool *requires_address_pinn... | {
// only persist name if one is actually included
SprfBlePairingName name_data = {};
strncpy(name_data.name, name, sizeof(name_data.name));
SPRF_PERSIST_FIELD(name_data, ble_pairing_name);
} | |
outAppData *data) {
WorkoutDialog *workout_dialog = &data->detected_workout_dialog;
workout_dialog_init(workout_dialog, "Workout Detected");
Dialog *dialog = workout_dialog_get_dialog(workout_dialog);
dialog_show_status_bar_layer(dialog, true);
dialog_set_fullscreen(dialog, true);
dialog_set_background_co... | if (workout_service_is_workout_ongoing()) {
if (app_launch_get_args() == WorkoutLaunchArg_EndWorkout) {
workout_service_stop_workout();
prv_show_workout_ended_dialog(data);
} else {
ActivitySessionType existing_workout_type;
workout_service_get_current_workout_type(&existing_workout_type... |
const bool found_automatic_session =
workout_utils_find_ongoing_activity_session(&data->ongoing_session);
if (found_automatic_session) {
prv_show_workout_detected_dialog(data);
} else {
workout_push_summary_window();
}
}
static void prv_deinit(void) {
WorkoutAppData *data = app_state_get_use... |
metric_label_string();
case WorkoutMetricType_Duration:
/// Duration Label
return i18n_noop("DURATION");
case WorkoutMetricType_AvgPace:
#if PBL_RECT
/// Average Pace Label
return i18n_noop("AVG PACE");
#else
/// Average Pace Label with units
return active_window->workout_con... | {
const size_t buffer_size = sizeof("000");
GTextNodeText *number_text_node = health_util_create_text_node(buffer_size, number_font,
TEXT_COLOR, container);
active_window->workout_controller->metric_to_string(metric_type,
... | else {
// if metric value is 0, we draw another icon that needs different offset
heart_node_offset.x += 2;
heart_node_offset.y += 7;
heart_node = graphics_text_node_create_custom(prv_draw_hr_measuring_node_callback,
active_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... | {
clock_freq = clocks.PCLK1_Frequency;
ppre_mask = RCC_CFGR_PPRE1;
ppre_div1_mask = RCC_CFGR_PPRE1_DIV1;
} | else { // AHB2
clock_freq = clocks.PCLK2_Frequency;
ppre_mask = RCC_CFGR_PPRE1;
ppre_div1_mask = RCC_CFGR_PPRE1_DIV1;
}
// From STM32F2xx Reference manual, section 5.2 (Clocks):
// The timer clock frequencies are automatically set by hardware.
// There are two cases:
// 1. If the APB prescaler 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... | {
window = (Window){.layer.window = &window};
text_layer_init(&text_layer, &GRect(10, 20, 30, 40));
text_layer.layer.window = &window;
scroll_layer_is_instance_value = NULL;
} |
void test_text_layer_flow__cleanup(void) {
}
void test_text_layer_flow__return_value_handling(void) {
GPoint origin;
GRect page;
cl_assert(false == text_layer_calc_text_flow_paging_values(&text_layer, &origin, &page));
layer_add_child(&window.layer, &text_layer.layer);
cl_assert(true == text_layer_calc_tex... |
{
switch (recognizer->state) {
case RecognizerState_Possible:
PBL_ASSERTN((new_state == RecognizerState_Failed) ||
(new_state == RecognizerState_Possible) ||
(new_state == RecognizerState_Completed) ||
(new_state == RecognizerState_Started));
brea... | if (!recognizer->handling_touch_event) {
recognizer_manager_handle_state_change(recognizer->manager, recognizer);
} |
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Private interface
void recognizer_handle_touch_event(Recognizer *recognizer, const TouchEvent *touch_event) {
PBL_ASSERTN(recognizer_is_active(recognizer));
PBL_ASSERTN(recognizer->impl);
PBL_ASSERTN(touch... |
gbitmap_destroy(bitmap);
}
}
}
// Tests
////////////////////////////////////
void test_graphics_draw_bitmap__origin_layer_inside(void) {
prv_origin_layer_test(GPointZero);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_graphics_draw_bitmap__origin_layer_across_x(void) {
prv... | prv_composite_test(__func__, GCompOpClear) | ;
}
void test_graphics_draw_bitmap__composite_set(void) {
prv_composite_test(__func__, GCompOpSet);
}
void test_graphics_draw_bitmap__composite_tint(void) {
graphics_context_set_tint_color(&s_ctx, GColorOrange);
prv_composite_test(__func__, GCompOpTint);
}
void test_graphics_draw_bitmap__composite_tint_luminan... |
timeline_idx(4));
cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(5));
cl_assert(timeline_model_iter_next(&new_idx, &has_next));
cl_assert(!has_next);
cl_assert_equal_i(timeline_model_get_num_items(), 1);
cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.i... | (timeline_model_iter_prev(&new_idx, NULL)) | ;
cl_assert_equal_i(new_idx, 0);
cl_assert_equal_i(timeline_model_get_num_items(), 2);
cl_assert(uuid_equal(&s_items[s_correct_order[0]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id,
&timeline_model_get_iter_state(1)->pin.... |
/*
* 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... | (cmd_data) | |
000},
{ 48, 8, -1000},
{ 48, 8, -1000},
{ 48, 0, -1000},
{ 48, 0, -1000},
{ 48, 8, -1000},
{ 48, 0, -1000},
{ 48, 0, -1000},
{ 48, 8, -1008},
{ 48, 8, -1000},
{ 48, 0, -1000},
{ 40, 0, -1000},
{ 40, 8, -1000},
{ 48, 0, -1000},
{ 48, 8, -1008},
{ 48, 8, -1000},... | { 48, 8, -1000},
{ 48, 8, -1000},
{ 48, 8, -1000},
{ 48, 8, -1000},
{ 48, 8, -1000},
{ 40, 8, -1000},
{ 40, 8, -1000},
{ 48, 8, -1000},
{ 48, 0, -1000},
{ 48, 0, -1000},
{ 40, 8, -1000},
{ 48, 8, -1000},
{ 48, 0, -1008},
{ 40, 8, -1000},
{ 48, 8, -1000},
{... | |
er(HRMDevice *dev) {
// check if the loader is already running
if (!prv_is_app_running(dev, AS7000AppId_Loader)) {
PBL_LOG(LOG_LEVEL_DEBUG, "Switching to loader");
// we need to start the loader
if (!prv_set_running_apps(dev, AS7000AppId_Loader)) {
return false;
}
psleep(35);
// make ... | (LOG_LEVEL_ERROR, "Loader not ready") | ;
return false;
}
system_task_watchdog_feed();
cursor += load_length;
write_address += load_length;
bytes_remaining -= load_length;
}
}
// Write the EOF record, telling the loader that the image has been
// fully written.
uint8_t eof_record[IHEX_RECORD_LENGTH(0)];
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | shared_circular_buffer_consume(&buffer, &client, 4) | );
cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 6);
// Now there's just 56 in the buffer. Fill it to the brim
cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "789", 3, false));
cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 3);
cl_asser... |
gnTopLeft));
if (icon_align == GAlignTop) {
// The icon is on its own line at the top, extend accordingly
container_height += icon_frame_size.h;
} else if (render_icon && (icon_align == GAlignLeft)) {
// Let the icon extend the container height if it's taller than the title/subtitle combo
container_... | {
cap_offsets_to_apply += subtitle_text_cap_offset;
} |
rect.origin.y -= cap_offsets_to_apply;
graphics_draw_text(ctx, config->title, title_font, rect, config->overflow_mode,
text_alignment, NULL);
// Add back the cap offset so functions that use the returned title text frame can position
// themselves using the actual frame
rect.origin.y += ... |
, NULL);
prv_reset();
// set stroke width to non-zero value. stroke should be drawn, but no fill
gdraw_command_set_stroke_width(command, 2);
gdraw_command_draw(NULL, command);
cl_assert_equal_i(s_stroke_color.argb, GColorGreenARGB8);
cl_assert_equal_i(s_fill_color.argb, GColorClearARGB8);
cl_assert_equal... | memcpy(command->points, points2, sizeof(points2)) | ;
return command_list;
}
void test_gdraw_command__draw_command_list(void) {
GDrawCommandList *command_list = malloc(sizeof(GDrawCommandList) + sizeof(GDrawCommand) +
(sizeof(GPoint) * 2));
*command_list = (GDrawCommandList) {
.num_commands = 1
};
command_list->commands[0] = (GDrawCommand) {
.t... |
leDialog *simple_dialog = simple_dialog_create("Watchface crashed");
Dialog *dialog = simple_dialog_get_dialog(simple_dialog);
dialog_set_text(dialog, "Watchface is not responding");
dialog_set_icon(dialog, RESOURCE_ID_GENERIC_WARNING_LARGE);
dialog_set_timeout(dialog, DIALOG_TIMEOUT_INFINITE /* no timeout */);... | (cl_assert(!text_fits), cl_assert(text_fits)) | ;
msg = "This error is too long to fit on any display shape :(";
text_fits = simple_dialog_does_text_fit(msg, DISP_FRAME.size, icon_size, use_status_bar);
cl_assert(!text_fits);
}
|
(&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, "stroke_circle_origin_aa_... | (&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, STROKE_SMALL) | ;
graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT_NXNY, RADIUS_MEDIUM);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// Small circles
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, STROKE_SMALL);
graphics_draw_circle(&c... |
ss required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#... | {
uint8_t *temp = calloc(size, sizeof(uint8_t));
for (unsigned int i = 0; i < size; i++) {
temp[i] = (uint8_t)(rand() % 10);
}
*buf = temp;
return legacy_defective_checksum_memory(temp, size);
} |
// ----------------------------------------------------------------------------------------
static void prv_data_log_chain(DataLoggingSessionRef logging_session, uint8_t *buf,
int item_size, int num_items) {
int num_bytes = item_size * num_items;
while (num_bytes > 0) {
unsigned... |
_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("Yesterday, 16:00", time_buf);
// June 9th 2015, 02:00:00 (T-14:00:00)
rtc_set_time(event_time - (14 * SECONDS_PER_HOUR));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("16... | cl_assert_equal_s("Jun 9, 4:00 PM", time_buf) | ;
}
void test_clock__time_24h_lower_style(void) {
char time_buf[64];
const int jun10th_noon_2015 = 1433937600;
prv_clock_reset(0);
rtc_set_time(jun10th_noon_2015);
// Our test event is at June 9th 2015, 16:00:00
// Now - one day
const int event_time = jun10th_noon_2015 - SECONDS_PER_DAY + (4 * SECONDS... |
ec, value);
if (i != macro_end - 1) {
prv_append_string_i18n(state, s_splitters[add_units][i >= macro_end - 2]);
}
}
break;
}
default:
state->error->status = TemplateStringErrorStatus_InvalidConversionSpecifier;
return input;
}
// Skip the conversion specifi... | {
// No match, so let's move along to the next one.
while ((*state->position != delimiter) && (*state->position != '\0')) {
prv_handle_escape_character(state);
if (state->error->status != TemplateStringErrorStatus_Success) {
return;
}
state->position++;
}
if (*state->position == '\0') {
... |
static void prv_filter_format(TemplateStringState *state) {
bool match;
bool previously_matched = false;
bool did_output = false;
// We need to iterate all the way through for finding the proper 'next' time.
while (*state->position != ')') {
match = prv_format_predicate(state, previously_matched);
... |
except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY... | (RESOURCE_ID_HEART_TINY, msg, true) | ;
return;
}
activity_prefs_set_health_app_opened_version(CURRENT_HEALTH_APP_VERSION);
HealthAppData *health_app_data = app_zalloc_check(sizeof(HealthAppData));
app_state_set_user_data(health_app_data);
health_app_data->health_data = health_data_create();
health_data_update_quick(health_app_data->hea... |
LL;
new_timer_delete(s_keepalive_timer);
s_keepalive_timer = TIMER_INVALID_ID;
mutex_destroy(s_tx_buffer_mutex);
dbgserial_restore_baud_rate();
serial_console_set_state(SERIAL_CONSOLE_STATE_LOGGING);
}
void pulse_prepare_to_crash(void) {
}
static void prv_process_received_frame(void *frame_ptr) {
Incom... | (PULSE_MAX_SEND_SIZE) | , length);
memcpy(&frame[length + COBS_OVERHEAD(PULSE_MAX_SEND_SIZE)], &fcs, sizeof(fcs));
length += sizeof(fcs);
length = cobs_encode(frame, frame + COBS_OVERHEAD(PULSE_MAX_SEND_SIZE), length);
// TODO: DMA
dbgserial_putchar_lazy(FRAME_DELIMITER);
for (size_t i = 0; i < length; ++i) {
dbgserial_putch... |
argin_px < icon_top_default_margin_px) ? icon_top_adjusted_margin_px :
icon_top_default_margin_px;
}
static void prv_get_text_box(GSize frame_size, GSize icon_size,
int icon_top_margin_px, GRect *text_box_out) {
const... | {
dialog_push(&simple_dialog->dialog, window_stack);
} |
void app_simple_dialog_push(SimpleDialog *simple_dialog) {
app_dialog_push(&simple_dialog->dialog);
}
void simple_dialog_init(SimpleDialog *simple_dialog, const char *dialog_name) {
PBL_ASSERTN(simple_dialog);
*simple_dialog = (SimpleDialog) {
.icon_static = !SIMPLE_DIALOG_ANIMATED,
};
dialog_init(&si... |
const TimelineResourceTestAppData *data = &s_test_apps[i];
if (uuid_equal(uuid, &data->install_entry.uuid)) {
return data;
}
}
return NULL;
}
// Fakes
/////////////////////////
bool prv_validate_lut(ResAppNum res_app_num) {
// Just check if the .resource_lut pointer for the provided res_app_n... | timeline_resources_get_id_system(
(TimelineResourceId)TimelineResourceTestTimelineId_AlarmClock, TimelineResourceSizeTiny,
TimelineResourceTestAppId_ValidApp, NULL) | |
title_text_frame_origin_y =
cell_layer_bounds->origin.y +
((cell_layer_bounds->size.h - title_text_frame_height -
subtitle_text_frame_height - 1) / 2);
if (subtitle_text_frame_height) {
title_text_frame_origin_y -= icon_on_left_title_subtitle_vertical_spacing_... | grect_clip(&rect, cell_layer_bounds) | ;
grect_align(&rect, cell_layer_bounds, GAlignRight, true);
if (gsize_equal(&rect.size, &icon_size)) {
// round has never worked with legacy2 apps
static const bool is_legacy2 = false;
if (config->icon_box_model) {
rect.origin = gpoint_add(rect.origin, config->icon_box_model->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... | {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_circle(ctx, GPoint(14, 28), 12);
} |
void across_ny_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_circle(ctx, GPoint(14, -14), 12);
}
void test_graphics_draw_circle_${BIT_DEPTH_NAME}__origin_layer(void) {
GContext ctx;
Layer la... |
moves horizontally (to the right only) from 1 cell to another.
// In total we need to slide from our current x offset, to the x offset of the next cell
int next_cell_width = selection_layer->cell_widths[selection_layer->selected_cell_idx + 1];
int slide_distance = next_cell_width + selection_layer->cell_padding;
... | (i, selection_layer->callback_context) | ;
if (text) {
// We need to figure out the height of the box that the text is being drawn in so that
// it can be vertically centered
int height = selection_layer->layer.frame.size.h;
if (selection_layer->selected_cell_idx == i) {
// See prv_draw_cell_backgrounds() for re... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | gpio_input_init(&in_scl) | ;
InputConfig in_sda = {
.gpio = bus->sda_gpio.gpio,
.gpio_pin = bus->sda_gpio.gpio_pin,
};
gpio_input_init(&in_sda);
}
//! Power up I2C bus power supply
//! Always lock bus and peripheral config access before use
static void prv_bus_rail_power_up(I2CBus *bus) {
if (!bus->rail_ctl_fn) {
return;
... |
AY_ANY, CRON_MONTH_ANY, prv_cron_callback)
CRON_JOB(CRON_MINUTE_ANY, CRON_HOUR_ANY, 1, CRON_MONTH_ANY, prv_cron_callback)
};
CronJob new_job = {
.cb = prv_counting_cb,
.cb_data = (void*)0,
};
prv_set_rtc(s_2015_nov12_123456_gmt, &s_timezone_gmt);
cron_clear_all_jobs();
cl_assert_equal_i(cron_... | prv_basic_test(&s_timezone_gmt, &test_cron, s_2015_nov12_000000_gmt, advance, advance, 2) | ;
}
void test_cron__offset_positive_seconds_any_day_dst(void) {
CronJob test_cron = {
.cb = prv_cron_callback,
.cb_data = (void*)0,
.minute = 30,
.hour = 0,
.mday = CRON_MDAY_ANY,
.month = CRON_MONTH_ANY,
.offset_seconds = 30 * SECONDS_PER_MINUTE,
.may_be_instant = false,
};
co... |
/*
* 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... | (fmt_args, fmt) | ;
prv_handle_passert_failed_vargs(filename, line_number, lr, expr, fmt, fmt_args);
va_end(fmt_args);
}
void passert_failed(const char* filename, int line_number, const char* message, ...) {
va_list fmt_args;
va_start(fmt_args, message);
prv_handle_passert_failed_vargs(filename, line_number,
(uintptr_t... |
ternal device = *fake_GAPAPI_get_device_resolving_to_fake_irk();
BTBondingID bonding_id = prv_add_bonding_for_fake_resolvable_device();
prv_fake_connect(&device, false /* is_master*/);
// Register connection intent for app:
gap_le_connect_connect_by_bonding(bonding_id,
fals... | gap_le_connect_connect_by_bonding(bonding_id,
true /* no auto_reconnect */,
true /* is_pairing_required */,
GAPLEClientApp) | ;
// Verify the app task got a (virtual) connection event:
prv_assert_client_event(&device, true /* connected */, (1 << PebbleTask_App),
HCI_ERROR_CODE_SUCCESS);
}
// -----------------------------------------------------------------------------
// Handling Bonding Changes
void test_gap... |
/*
* 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_init(false /* run filesystem check */) | |
threshold = -50, \
.activity = { \
.trigger_minute = (20 * MINUTES_PER_HOUR) + 30, \
.update_threshold_steps = 1000, \
.update_max_interval_seconds = 30 * SECONDS_PER_MINUTE, \
.show_notification = true, \
.max_fail_steps = 10000, \
} \
} \
}
#define ACTIVITY_INSIGHTS_SETTINGS_A... | if (settings_out->version != ACTIVITY_INSIGHTS_SETTINGS_CURRENT_STRUCT_VERSION) {
// versions don't match, bail out!
PBL_LOG(LOG_LEVEL_WARNING, "activity insights struct version mismatch");
goto close;
} |
rv = true;
close:
prv_close_settings_and_unlock(&file);
}
if (!rv) {
// Use default value if we didn't find anything else
for (unsigned i = 0; i < ARRAY_LENGTH(AIS_DEFAULTS); ++i) {
if (strcmp(insight_name, AIS_DEFAULTS[i].key) == 0) {
PBL_LOG(LOG_LEVEL_DEBUG, "Using default for ins... |
pixel_data_bytes + // pixel data
gbitmap_get_palette_size(format); // palette data
const uint32_t required_row_size_bits =
(bitmap->bounds.size.w * gbitmap_get_bits_per_pixel(format));
// Convert from 8 bits in a byte, taking care to round up to the next whole byte.
const uint32_t required_row_si... | PBL_ASSERTN(!process_manager_compiled_with_legacy2_sdk()) | ;
if (!bitmap) {
return NULL;
}
return bitmap->palette;
}
void gbitmap_set_palette(GBitmap *bitmap, GColor *palette, bool free_on_destroy) {
PBL_ASSERTN(!process_manager_compiled_with_legacy2_sdk());
if (bitmap && palette) {
if (gbitmap_get_info(bitmap).is_palette_heap_allocated) {
applib_free(... |
/*
* 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... | dialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE) | ;
dialog_set_background_color(dialog, GColorJaegerGreen);
dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT);
return simple_dialog;
}
static void prv_edit_snooze_delay(ActionMenu *action_menu,
const ActionMenuItem *item,
void *context) {
alarm... |
bbleHRMEvent) * 2 + sizeof(PebbleHRMEvent) / 2;
uint8_t buffer[buf_size];
CircularBuffer cb;
circular_buffer_init(&cb, buffer, buf_size);
PebbleHRMEvent event[NUM_TEST_EVENTS] = {
{ .event_type = HRMEvent_BPM, .bpm = { .bpm = 65, .quality = 5 } },
{ .event_type = HRMEvent_LEDCurrent, .led = { .current... | prv_advance_time_ms(timeout_ms) | ;
stub_new_timer_fire(prv_get_timer_id());
fake_system_task_callbacks_invoke_pending();
cl_assert_equal_b(hrm_is_enabled(HRM), true);
// Send the next data, should be disabled again after that
for (num_updates = 0; num_updates < 1000 && hrm_is_enabled(HRM); num_updates++) {
prv_fake_send_new_data();
... |
_icon, &GRect(kino_padding, 0,
kino_width, STATUS_BAR_LAYER_HEIGHT));
kino_layer_set_alignment(&data->connectivity_icon, GAlignLeft);
layer_add_child(&window->layer, kino_layer_get_layer(&data->connectivity_icon));
kino_layer_init(&data->battery_icon, &GRect(DIS... | {
s_launcher_menu_persisted_data.valid = false;
} |
}
launcher_menu_push_window();
app_idle_timeout_start();
app_event_loop();
}
const PebbleProcessMd* launcher_menu_app_get_app_info() {
static const PebbleProcessMdSystem s_launcher_menu_app_info = {
.common = {
.main_func = s_main,
// UUID: dec0424c-0625-4878-b1f2-147e57e83688
.uuid... |
nding;
uint8_t read_idx = put_jobs->read_idx;
uint32_t initial_remaining_bytes = s_pb_state.remaining_bytes;
prv_unlock_pb_job_state();
if (num_put_jobs == 0) {
if (s_pb_state.current_command == PutBytesIdle) {
// We terminated the PB transfer before we were able to process the PutRequest
prv_s... | {
PBL_LOG(LOG_LEVEL_DEBUG, "Attempted to cancel put_bytes while idle, %d",
s_pb_state.current_command);
} | else if (s_pb_state.type == ObjectWatchApp ||
s_pb_state.type == ObjectAppResources ||
s_pb_state.type == ObjectWatchWorker) {
PBL_LOG(LOG_LEVEL_INFO, "Forcefully cancelling put_bytes transfer of app binaries");
prv_cleanup();
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Attempted to canc... |
ts.h"
#include "ble_service.h"
#include "ble_uuid.h"
#include "storage.h"
#include <inttypes.h>
#include <string.h>
#define READ_RESPONSE_BUFFER_SIZE \
(MAX(sizeof(PebblePairingServiceConnParamsReadNotif), \
sizeof(PebblePairingServiceConnectivityStatus)))
#define ATT_DEFAULT_MTU (23)
typedef struct {
... | {
Connection *connection = connection_by_idx_check(conn_idx);
BleConnectionParams params;
connection_get_conn_params(connection, ¶ms);
PebblePairingServiceConnParamsReadNotif *resp =
(PebblePairingServiceConnParamsReadNotif *)response_buffer;
#if SUPPORTS_PACKET_LENGTH_EXTENSION
resp->packet_length_... |
static void prv_handle_trigger_pairing(uint16_t conn_idx, const PairingTriggerRequestData *req) {
PBL_LOG(LOG_LEVEL_DEBUG,
"Trigger pairing! should_pin_address=%d, no_slave_security_request=%d, auto_acc=%d "
"rev_ppogatt=%d",
req->should_pin_address, req->no_slave_security_request,
... |
ProtobufLogMeasurementType_DistanceCM};
uint32_t offset_sec[] = {1, 2, 3};
uint32_t values[] = {0x11, 0x22, 0x33, 0x44,
0x1111, 0x2222, 0x3333, 0x4444,
0x111111, 0x222222, 0x333333, 0x444444};
TestPLParsedMsg input = {
.type = ProtobufLogT... | protobuf_log_session_delete(session_ref) | ;
}
// ---------------------------------------------------------------------------------------------
// Test the automatic flush functionality
void test_protobuf_log__measurements_auto_flush(void) {
ProtobufLogMeasurementType types[] = {ProtobufLogMeasurementType_Steps,
Protob... |
h_db_get_monthly_average_value(ActivityMetricStepCount, &val_out));
cl_assert_equal_i(val_out, average_steps_val);
const char *average_sleep_key = "average_sleepDuration";
int32_t average_sleep_val = 654321;
cl_assert_equal_i(health_db_insert((uint8_t *)average_sleep_key, strlen(average_sleep_key),
... | strlen(key) | ,
(uint8_t *)s_future_movement_data, sizeof(s_movement_data)),
S_SUCCESS);
cl_assert_equal_i(s_metric_updated_count, 0);
}
|
installed
static void prv_app_removed_callback(const AppInstallId install_id, void *data) {
AppMenuDataSource *data_source = data;
prv_send_callback_to_app(data_source, install_id, APP_REMOVED);
}
//! Must be run from the app task
static void prv_do_app_icon_name_updated(AppMenuDataSource *source, AppInstallId ins... | {
return;
} |
AppMenuNode *node = app_malloc_check(sizeof(AppMenuNode));
*node = (AppMenuNode) {
.install_id = entry->install_id,
.app_num = app_install_get_app_icon_bank(entry),
.icon_resource_id = app_install_entry_get_icon_resource_id(entry),
.uuid = entry->uuid,
.color = entry->color,
.visibility = ... |
/*
* 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... | (page.origin, GPoint(40, 60)) | |
/ Selection layer callbacks
static void prv_handle_complete(void *context) {
TimeSelectionWindowData *data = context;
data->complete_callback(data, data->callback_context);
}
static void prv_handle_inc(unsigned index, void *context) {
TimeSelectionWindowData *data = context;
date_time_handle_time_change(&data-... | layer_set_hidden(&label_text_layer->layer, false) | ;
// Range setup
TextLayer *range_text_layer = &time_selection_window->range_text_layer;
prv_text_layer_init(&window->layer, range_text_layer, header_font);
// Range subtitle setup
TextLayer *range_subtitle_text_layer = &time_selection_window->range_subtitle_text_layer;
prv_text_layer_init(&window->layer,... |
== &job->node) {
// Last job left...
job->node.next = NULL;
job->node.prev = NULL;
s_jobs = NULL;
} else {
list_remove(&job->node, (ListNode **) &s_jobs, NULL);
}
// Part of CC2564 advertising bug work-around:
if (job == s_current) {
bt_driver_advert_client_set_cycled(false);
}
}
st... | prv_perform_next_job(force_update) | ;
}
unlock:
bt_unlock();
}
// -----------------------------------------------------------------------------
//! Timer start / stop utilities
//! bt_lock is expected to be taken!
static void prv_timer_start(void) {
if (regular_timer_is_scheduled(&s_cycle_regular_timer)) {
PBL_LOG(LOG_LEVEL_ERROR, "Advertising... |
animation_set_custom_interpolation(animation, interpolate_moook) | ;
animation_set_handlers(animation, (AnimationHandlers) {
.stopped = prv_pop_animation_stopped,
}, pin_window);
animation_schedule(animation);
pin_window->pop_animation = animation;
}
void timeline_pin_window_init(TimelinePinWindow *pin_window, TimelineItem *item,
time_t curr... | |
-216, -992},
{ -160, -232, -1008},
// 136 seconds
{ -152, -224, -976},
{ -160, -192, -984},
{ -176, -184, -992},
{ -184, -200, -968},
{ -160, -200, -976},
{ -168, -208, -1000},
{ -160, -200, -976},
{ -168, -192, -984},
{ -176, -192, -1000},
{ -168, -192, -984},
{ -160... | // 141 seconds
{ -136, -144, -1008},
{ -120, -136, -1000},
{ -136, -152, -976},
{ -160, -136, -984},
{ -200, -128, -968},
{ -176, -112, -1000},
{ -144, -144, -1008},
{ -136, -168, -984},
{ -152, -168, -992},
{ -168, -160, -1008},
{ -160, -152, -992},
{ -152, -144, -10... |
{ -160, -160, -984},
{ -152, -160, -992},
{ -160, -152, -984},
{ -168, -168, -1016},
{ -160, -120, -976},
{ -168, -136, -1000},
{ -160, -224, -1032},
{ -152, -160, -920},
{ -152, -160, -1016},
{ -160, -160, -1008},
{ -176, -160, -1000},
{ -160, -144, -976},
{ -176, -... |
const void *val, size_t val_len) {
// Cannot set keys while iterating (Try settings_file_rewrite)
PBL_ASSERTN(file->cur_record_pos == 0);
if (key_len > SETTINGS_KEY_MAX_LEN) {
return E_RANGE;
}
if (val_len > SETTINGS_VAL_MAX_LEN) {
return E_RANGE;
}
const bool is_delete = (val_len == 0);
cons... | (&file->iter) | ;
settings_raw_iter_next(&file->iter)) {
if (overwritten(&file->iter.hdr) || deleted_and_expired(&file->iter.hdr)) {
continue;
}
info = (SettingsRecordInfo) {
.last_modified = file->iter.hdr.last_modified,
.get_key = prv_get_key,
.key_len = file->iter.hdr.key_len,
.get_va... |
ubs_resources.h"
#include "stubs_syscalls.h"
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <libgen.h>
#include "util_pbi.h"
static char *s_pbi2png_path;
// Stubs
void passert_failed(const char* filename, int line_number, const char* message, ...) {
e... | write_gbitmap_to_pbi(&ctx.dest_bitmap, output, s_pbi2png_path) | ;
prv_teardown_context(&ctx);
}
static void prv_convert_pdc(const char *filename) {
FILE *f = fopen(filename, "rb");
if (f == NULL) {
printf("File not found: %s\n", filename);
return;
}
// Check that file is a PDC file
char magic[4];
if (fread(magic, sizeof(magic), 1, f) != 1) {
printf("Fa... |
if (!s_flash_state.deep_sleep) {
flash_deep_sleep_enter();
} |
} else {
if (s_flash_state.deep_sleep) {
flash_deep_sleep_exit();
}
}
disable_flash_spi_clock();
flash_unlock();
}
bool flash_get_sleep_when_idle(void) {
bool result;
flash_lock();
result = s_flash_state.deep_sleep;
flash_unlock();
return result;
}
void debug_flash_dump_registers(voi... | |
state)[2][2]=temp;
temp=(*state)[1][2];
(*state)[1][2]=(*state)[3][2];
(*state)[3][2]=temp;
// Rotate third row 3 columns to right
temp=(*state)[0][3];
(*state)[0][3]=(*state)[1][3];
(*state)[1][3]=(*state)[2][3];
(*state)[2][3]=(*state)[3][3];
(*state)[3][3]=temp;
}
// Cipher is the main function... | for(i = 0; i < length; i += KEYLEN)
{
BlockCopy(output, input);
state = (state_t*)output;
InvCipher();
XorWithIv(output);
Iv = input;
input += KEYLEN;
output += KEYLEN;
} |
if(remainders)
{
BlockCopy(output, input);
memset(output+remainders, 0, KEYLEN - remainders); /* add 0-padding */
state = (state_t*)output;
InvCipher();
}
}
#endif // #if defined(CBC) && CBC
bool aes_128_encrypt_block(const uint8_t key[AES_128_KEY_SIZE],
const uint8... |
=======================================================================
// Tests
// ---------------------------------------------------------------------------------------
// Feed in X seconds of data with the given statistics.
// The fake algorithm we plug in assumes that each accel sample contains the following:
// ... | cl_assert(record->flags & ACTIVITY_RAW_SAMPLE_FLAG_FIRST_RECORD) | ;
} else {
cl_assert(!(record->flags & ACTIVITY_RAW_SAMPLE_FLAG_FIRST_RECORD));
}
if (i == s_num_dls_accel_records - 1) {
cl_assert(record->flags & ACTIVITY_RAW_SAMPLE_FLAG_LAST_RECORD);
} else {
cl_assert(!(record->flags & ACTIVITY_RAW_SAMPLE_FLAG_LAST_RECORD));
}
// Uncompr... |
{ -168, -152, -1000},
{ -160, -160, -992},
{ -168, -160, -984},
{ -160, -160, -992},
{ -160, -160, -992},
{ -160, -160, -992},
{ -160, -160, -992},
{ -168, -160, -992},
{ -160, -160, -984},
{ -160, -152, -1000},
{ -160, -168, -992},
{ -168, -160, -1000},
{ -168, -160, ... | { -160, -160, -992},
{ -160, -152, -992},
{ -152, -144, -992},
{ -168, -176, -1000},
{ -176, -160, -1000},
{ -168, -168, -976},
{ -160, -168, -992},
{ -160, -160, -984},
{ -160, -152, -992},
{ -160, -144, -1000},
{ -152, -160, -976},
{ -160, -160, -992},
{ -160, -152,... |
{ -168, -144, -992},
{ -160, -152, -992},
{ -160, -136, -1000},
{ -160, -152, -992},
{ -160, -152, -992},
{ -160, -144, -992},
{ -160, -144, -984},
{ -160, -128, -1016},
{ -160, -136, -984},
// 156 seconds
{ -160, -160, -992},
{ -160, -136, -1008},
{ -160, -144, -992... |
d.
const uint8_t *data_read;
uint16_t read_length;
// Read the header part
bool result = shared_circular_buffer_read(&s_buffer, &s_buffer_client, sizeof(uint8_t), &data_read, &read_length);
PBL_ASSERTN(result);
PBL_ASSERT(read_length == sizeof(uint8_t), "read_length %u sizeof(uint8_t) %u", read_length, si... | system_task_add_callback(handle_buffer_sync, (void *)(uintptr_t) true /* is_async */) | ;
}
mutex_unlock(s_buffer_mutex);
}
return success;
}
void pbl_log_advanced(char* buffer, int length, bool async) {
if (s_buffer_mutex == INVALID_MUTEX_HANDLE) {
return;
}
write_buffer_locking(buffer, length, async);
}
char pbl_log_get_level_char(const uint8_t log_level) {
switch (log_level) ... |
/*
* 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 (periph_clock == SpiPeriphClockAPB1) {
clock = clocks.PCLK1_Frequency;
} else if (periph_clock == SpiPeriphClockAPB2) {
clock = clocks.PCLK2_Frequency;
} else {
WTF;
} | |
= true;
}
// -------------------------------------------------------------------------------------------------
void gap_le_connection_deinit(void) {
bt_lock();
{
GAPLEConnection *connection = s_connections;
while (connection) {
GAPLEConnection *next_connection =
... | {
return;
} |
// Clean up the bonding_id field for the bonding that just got removed:
bt_lock();
GAPLEConnection *connection = gap_le_connection_find(prv_find_connection_with_bonding_id,
(void *)(uintptr_t)bonding);
if (connection) {
connection->bonding_id = BT_BOND... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | app_idle_timeout_pause() | ;
}
return;
case PEBBLE_SYS_NOTIFICATION_EVENT:
// This handles incoming Notifications and actions on Notifications and Reminders
notification_window_handle_notification(&e->sys_notification);
return;
case PEBBLE_CALENDAR_EVENT:
do_not_disturb_handle_calendar_event(&e->cale... |
/*
* 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... | {
initialized = prv_check_initialized();
if (initialized || !start) {
s_outstanding_enqueues += (start) ? 1 : -1;
}
} |
prv_unlock();
return initialized;
}
static bool prv_enqueue(HcProtocolMessage *message) {
PBL_ASSERTN(message->message_length >= sizeof(HcProtocolMessage));
if (!prv_update_enqueue_count(true)) {
return false;
}
bool success = true;
// Retry for 500ms
TickType_t start_ticks = xTaskGetTickCount(... |
e "applib/preferred_content_size.h"
#include "applib/ui/ui.h"
#include "apps/system_apps/timeline/text_node.h"
#include "drivers/rtc.h"
#include "font_resource_keys.auto.h"
#include "kernel/pbl_malloc.h"
#include "process_state/app_state/app_state.h"
#include "services/common/clock.h"
#include "services/common/i18n/i18... | PREFERRED_CONTENT_SIZE_SWITCH(PreferredContentSizeDefault,
//! @note this is the same as Medium until Small is designed
/* small */ PBL_IF_RECT_ELSE(2, 0),
/* medium */ PBL_IF_RECT_ELSE(2, 0),
/* large */ 1,
//! @note this is the same as Large until ExtraLarge is designed
/* extralar... | , // title margin height
};
static const LayoutNodeTextAttributeConfig s_subtitle_config = {
.attr_id = AttributeIdSubtitle,
.text.font_key = PREFERRED_CONTENT_SIZE_SWITCH(PreferredContentSizeDefault,
//! @note this is the same as Medium until Small is designed
/* small */ FONT_KEY_LECO_26_BOLD_... |
wCommandList *command_list);
static GColor s_fill_color;
static GColor s_stroke_color;
static uint8_t s_stroke_width;
static uint16_t s_path_num_points;
static GPoint *s_stroke_points = NULL;
static GPoint *s_fill_points = NULL;
static bool s_path_open;
static uint16_t s_radius;
struct PreciseLine {
GPointPrecise p... | {
free(s_precise_lines);
s_precise_lines = NULL;
} |
}
// tests
void test_gdraw_command__draw_command_stroke(void) {
GDrawCommand *command = malloc(sizeof(GDrawCommand) + (sizeof(GPoint) * 2));
*command = (GDrawCommand){
.type = GDrawCommandTypePath,
.hidden = false,
.stroke_color = GColorRed,
.stroke_width = 1,
.fill_color = GColorBlue,
.p... |
/*
* 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... | {
int num_scores = ARRAY_LENGTH(s_vibe_scores);
for (int i = 0; i < num_scores; i++) {
s_vibe_scores[i] = vibe_score_create_with_resource(s_vibe_score_resources[i]);
}
} |
static void prv_unload_scores(void) {
int num_scores = ARRAY_LENGTH(s_vibe_scores);
for (int i = 0; i < num_scores; i++) {
vibe_score_destroy(s_vibe_scores[i]);
}
}
static void handle_init(void) {
prv_load_scores();
NumberWindow *vibe_num_window = number_window_create("Vibe Patterns",
(NumberWin... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | gbitmap_init_with_resource(&s_tictoc_icon_bitmap, RESOURCE_ID_MENU_ICON_TICTOC_WATCH) | ;
gbitmap_init_with_resource(&s_smart_alarm_icon_bitmap, RESOURCE_ID_SMART_ALARM_ICON_BLACK);
}
void test_menu_layer_system_cells__initialize(void) {
process_manager_set_compiled_with_legacy2_sdk(false);
fb = malloc(sizeof(FrameBuffer));
framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS});
test_graphics_... |
0x85, 0, 0x0},
{ 0, 0x85, 0, 0x0},
{ 0, 0x85, 0, 0x0},
{ 6, 0x42, 4670, 0x0},
{ 18, 0x42, 6374, 0x0},
{ 0, 0x6, 3547, 0x0},
{ 0, 0x1c, 0, 0x0},
{ 0, 0x1c, 0, 0x0},
{ 0, 0x1c, 0, 0x0},
{ 0, 0x1c, 0, 0x0},
{ 0, 0x1c, 0, 0x0},
{ 0, 0x1c, 0, 0x0},
{ 0, 0x1c, 0, 0... | { 0, 0x74, 537, 0x0},
{ 0, 0x74, 902, 0x0},
{ 0, 0x74, 819, 0x0},
};
*len = ARRAY_LENGTH(samples);
return samples;
} |
// ----------------------------------------------------------------
// Sample captured at: 2015-09-04 19:31:00 local, 2015-09-05 02:31:00 GMT
// This sample should end in deep sleep mode
//
AlgDlsMinuteData *activity_sample_sleep_1_end_deep(int *len) {
// The unit tests parse the //> TEST_.* lines below for test ... |
((const char*) log_message, length, async) | ;
}
}
void kernel_pbl_log(LogBinaryMessage* log_message, bool async) {
kernel_pbl_log_serial(log_message, async);
if (!portIN_CRITICAL() && !mcu_state_is_isr() &&
xTaskGetSchedulerState() != taskSCHEDULER_SUSPENDED) {
kernel_pbl_log_flash(log_message, async);
}
}
void kernel_pbl_log_from_fault_hand... | |
_system.h"
#include "settings_bluetooth.h"
#include "settings_display.h"
#include "settings_menu.h"
#include "settings_notifications.h"
#include "settings_quick_launch.h"
#include "settings_remote.h"
#include "settings_time.h"
#include "settings_window.h"
#include "applib/app.h"
#include "applib/battery_state_service.... | prv_get_current_callbacks(data) | ;
return callbacks->num_rows ? callbacks->num_rows(callbacks) : (uint16_t)0;
}
static int16_t prv_get_cell_height_callback(MenuLayer *menu_layer,
MenuIndex *cell_index, void *context) {
PBL_ASSERTN(cell_index->section < SettingsMenuItem_Count);
SettingsData *data = con... |
UN), },
.header = { .version = BINLOGMSG_VERSION_STRING_V1, .length = 8, },
.string = "OVERRUN\0",
};
void pbl_log_set_level(uint8_t level) {
s_log_buffer.level = level;
}
uint8_t pbl_log_get_level(void) {
return s_log_buffer.level;
}
int printf(const char *__restrict format, ...) {
char line_buff... | {
// Out of memory! Attempt to print an overrun message
circular_buffer_write(&s_log_buffer.circular_buffer, (uint8_t *)&OVERRUN.header,
sizeof(OVERRUN) - sizeof(HcProtocolMessage));
} |
prv_start_tx();
prv_unlock();
}
#ifdef PBL_LOGS_HASHED
void pbl_log_hashed(const uint32_t packed_loghash, ...) {
unsigned num_fmt_conversions = (packed_loghash >> PACKED_NUM_FMT_OFFSET) & PACKED_NUM_FMT_MASK;
unsigned str_index_1 = (packed_loghash >> PACKED_STR1FMT_OFFSET) & PACKED_STR1FMT_MASK;
unsigned s... |
W_RECT_CLIP_NXNY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_radius_aa_sw(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// AA = true, SW = 1
setup_... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r2_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"));
#endif
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 3);
// TODO: Fix offset calculation and reenable this: ... |
void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_radius_sw(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// TODO: Fix offset calculation and reenable this: - PBL-16509
#if SCREEN_COLOR_DEPTH_BITS == 8
// AA = false, SW = 1
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_REC... |
ion_dialog, data->message, data->message_len);
transcription_dialog_set_callback(transcription_dialog, prv_voice_confirm_cb, data);
transcription_dialog_keep_alive_on_select(transcription_dialog,
data->transcription_dialog_keep_alive_on_select);
... | {
return StateStartWaitForReady;
} |
break;
case StateError:
case StateExiting:
if (next_state == StateWaitForReady) {
return next_state;
}
break;
default:
WTF;
}
// No valid transition found!
PBL_CROAK("Cannot transition from state %"PRIu16" to state %"PRIu16,
current_state, next_st... |
dle_notification_added_common(Uuid *id, NotificationType type) {
if (!alerts_should_notify_for_type(prv_alert_type_for_notification_type(type))) {
return;
}
NotificationWindowData *data = &s_notification_window_data;
// will fail and return early if already init'ed.
prv_init_notification_window(true /*i... | (&s_notification_window_data) | ;
} else {
prv_cancel_reminder_watchdog(&s_notification_window_data);
}
if (prv_should_pop_due_to_inactivity()) {
// Re-schedule the window pop timer after leaving DND mode
prv_refresh_pop_timer(&s_notification_window_data);
}
}
// This function is only used by the notifications_app.
// When it ca... |
d 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 under the ... | GRect(x, y + text_single_line_text_offset_px,
w, max_text_line_height_px) | ;
text_height = graphics_text_layout_get_max_used_size(ctx,
dialog->buffer,
dialog_text_font,
probe_rect,
... |
/*
* 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... | iter_next(&utf8_iter) | );
}
//! Decode multi-byte char
void test_utf8_iterator__decode_test_single_codepoint_string_multi_byte(void) {
// Mutable types
Iterator utf8_iter;
Utf8IterState utf8_iter_state;
// Immutable types
bool success = false;
const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "\xc3\xb0");
cl_assert(utf... |
ig, ActivityScalarStore cur_val,
ActivityScalarStore average, int *percentage) {
// Determine percentage of target
*percentage = (average > 0) ? (((cur_val * 100) / (average)) - 100) : 0;
if (*percentage < config->insight_settings->summary.fail_threshold) {
return PercentTie... | (percentage_buf, "0%") | ;
} else {
sniprintf(percentage_buf, SUBTITLE_BUFFER_LENGTH, "%+d%%", percentage);
}
attribute_list_add_cstring(&pin_attr_list, AttributeIdSubtitle, percentage_buf);
TimelineItem *item = prv_create_pin(pin_time_utc, now_utc, 0, LayoutIdWeather, &pin_attr_list,
config->... |
ally.
PBL_LOG_VERBOSE("We're good, we're just starting normally.");
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE);
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO);
return false;
}
// We failed to start our firmware successfully!
if (watchdog_check_reset_flag()) {
dbgserial_putstr("Watc... | ("██╔══██╗██╔═══██╗██╔══██╗██╔════╝██╔══██╗╚══██╔══╝") | ;
dbgserial_putstr("██████╔╝██║ ██║██████╔╝█████╗ ██████╔╝ ██║ ");
dbgserial_putstr("██╔══██╗██║ ██║██╔══██╗██╔══╝ ██╔══██╗ ██║ ");
dbgserial_putstr("██║ ██║╚██████╔╝██████╔╝███████╗██║ ██║ ██║ ");
dbgserial_putstr("╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ");
// Enable the 3.2V ... |
ient) {
if (!device || client >= GAPLEClientNum) {
return BTErrnoInvalidParameter;
}
bt_lock();
// Find the intent for the device:
GAPLEConnectionIntent *intent = prv_get_intent_by_device(device);
BTErrno ret_value;
if (!intent) {
// No intent for given device
ret_value = BTErrnoInvalidParamet... | {
GAPLEConnectionIntent *next = (GAPLEConnectionIntent *) intent->node.next;
prv_update_clients(intent, GAPLEConnectHCIReasonExtensionAirPlaneMode,
GAPLEConnectionEventDisconnected);
intent = next;
} |
if (s_is_connected_as_slave) {
// The BT controller will not send an etLE_Disconnection_Complete event
// when going to airplane mode while being connected.
// Stop analytics stopwatches manually:
bluetooth_analytics_handle_disconnect(false);
s_is_connected_as_slave = false;
}
... |
/*
* 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... | (FLASH_BASE, 128 KiB, NULL, NULL) | );
cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_full_flash(void) {
cl_assert(system_flash_erase(FLASH_BASE, 1024 KiB, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 11), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__eras... |
//////
//! Time Picker
static void prv_time_picker_window_unload(Window *window) {
AlarmEditorData *data = (AlarmEditorData *)window_get_user_data(window);
if (data->creating_alarm) {
#if !CAPABILITY_HAS_HEALTH_TRACKING
prv_call_complete_cancelled_if_no_alarm(data);
#endif
return;
}
// Editing time
... | (data->alarm_id, (data->alarm_type == AlarmType_Smart)) | ;
app_window_stack_remove(&option_menu->window, true);
}
}
static void prv_setup_type_menu_window(AlarmEditorData *data) {
const OptionMenuCallbacks callbacks = {
.select = prv_type_menu_select,
.unload = prv_type_menu_unload,
};
static const char *s_type_labels[AlarmTypeCount] = {
[AlarmType_B... |
ayer_set_text_alignment(data->steps_card.delta_step_layer, GTextAlignmentCenter);
text_layer_set_font(data->steps_card.delta_step_layer,
fonts_get_system_font(FONT_KEY_LECO_38_BOLD_NUMBERS));
text_layer_set_background_color(data->steps_card.delta_step_layer, GColorClear);
text_layer_set_text... | {
strncpy(data->results_card.text, text, sizeof(data->results_card.text));
data->results_card.text[sizeof(data->results_card.text) - 1] = 0;
text_layer_set_text(data->results_card.text_layer, data->results_card.text);
layer_mark_dirty(text_layer_get_layer(data->results_card.text_layer));
} |
// -------------------------------------------------------------------------------
static void results_window_load(Window *window) {
HealthAPITestAppData *data = window_get_user_data(window);
Layer *window_layer = window_get_root_layer(window);
GRect root_bounds = layer_get_bounds(window_layer);
data->resul... |
y say that the app is now fully focused.
const ModalProperty properties = modal_manager_get_properties();
s_state = ((properties & ModalProperty_Exists) && (properties & ModalProperty_Transparent)) ?
CompositorState_AppAndModal : CompositorState_App;
prv_send_did_focus_event(true);
}
}... | {
s_state = (properties & ModalProperty_Transparent) ? CompositorState_AppAndModal :
CompositorState_Modal;
compositor_modal_render_ready();
// Force the app framebuffer to be released. We hold it during transitions to keep the app
// framebuffer... | |
_SCRIPT("s = d.toLocaleTimeString(undefined, {second: 'numeric'});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "5");
EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {second: '2-digit'});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "05");
EXECUTE_SCRIPT("s = d.toLocaleTimeString(undefined, {minute: 'numeric'});");
ASSERT_JS_G... | ("s = d.toLocaleDateString(undefined, {year: '2-digit'});") | ;
ASSERT_JS_GLOBAL_EQUALS_S("s", "05");
}
void test_rocky_api_datetime__locale_date_string_time_options(void) {
rocky_global_init(s_api);
EXECUTE_SCRIPT("var d = new Date();");
EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {hour: 'numeric'});");
ASSERT_JS_GLOBAL_EQUALS_S("s", "07/25/05, 8 PM");
}
vo... |
set_text(&data->direction_layer, "Direction: Up/Down");
} else {
text_layer_set_text(&data->direction_layer, "Direction: Left/Right");
}
if (data->word_wrap) {
frame.size.w = 72;
frame.size.h = 60;
} else {
frame.size.w = 72;
frame.size.h = 32;
}
init_text_layer(data, frame);
if (da... | app_event_loop() | ;
handle_deinit();
}
const PebbleProcessMd* text_clipping_app_get_info() {
static const PebbleProcessMdSystem text_spacing_info = {
.common.main_func = &s_main,
.name = "Text Clipping"
};
return (const PebbleProcessMd*) &text_spacing_info;
}
|
-8, -984},
{ -200, -24, -992},
{ -192, -24, -992},
{ -192, -16, -992},
{ -200, -24, -984},
{ -200, -8, -960},
{ -200, -8, -992},
{ -208, -24, -992},
{ -200, -16, -992},
{ -200, -24, -976},
{ -192, -8, -984},
{ -192, -8, -1008},
{ -200, -40, -1000},
{ -192, -16, -976}... | { -200, -16, -992},
{ -192, -16, -1000},
{ -192, -8, -984},
{ -200, -8, -992},
{ -200, -16, -1000},
{ -192, -24, -992},
{ -192, -16, -984},
{ -192, -8, -984},
{ -200, -16, -992},
{ -200, -24, -976},
// 64 seconds
{ -192, -8, -976},
{ -200, -16, -1008},
{ -200, -16... |
{ -192, -32, -1000},
{ -192, -24, -984},
{ -200, -32, -992},
{ -200, -24, -984},
{ -200, -32, -992},
{ -192, -32, -984},
{ -192, -24, -984},
{ -200, -32, -992},
{ -200, -16, -984},
{ -200, -24, -992},
{ -192, -24, -992},
{ -200, -24, -1000},
{ -200, -40, -984},
{... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_b(s_test_state.reload_callback_was_called, true) | ;
// Read the glance back
AppGlance glance = {};
cl_assert_equal_i(app_glance_db_read_glance(&APP_GLANCE_TEST_UUID, &glance), S_SUCCESS);
// Compare the glance read back with the expected glance below
AppGlance expected_glance = (AppGlance) {
.num_slices = 2,
.slices = {
{
.expiration_... |
E-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the... | hc_endpoint_chip_id_query_chip_info(&chip_id) | ) {
return false;
}
// Sanity check the timestamp that should always be programmed:
return (chip_id.info.timestamp > DIALOG_CHIP_ID_MIN_TIMESTAMP);
}
bool bt_driver_test_mfi_chip_selftest(void) {
return false;
}
// A simple parser for HCI Command Complete events. If we are not in HCI
// passthrough mode, ... |
vities_iterate(HealthActivityMaskAll, now - (100 * SECONDS_PER_MINUTE), now,
HealthIterationDirectionPast, prv_activity_cb, NULL);
cl_assert_equal_i(0, s_prv_activity_cb__call_count);
s_sys_activity_get_sessions_values.out.result = true;
// result from mocked sys_activity_get_... | (activities, HealthActivitySleep | HealthActivityRestfulSleep) | ;
s_sys_activity_get_metric_values.out.history[0] = ActivitySleepStateAwake;
s_activity_sessions_ongoing[ActivitySessionType_Run] = true;
s_activity_sessions_ongoing[ActivitySessionType_Walk] = true;
s_activity_sessions_ongoing[ActivitySessionType_Open] = true;
activities = health_service_peek_current_activi... |
/*
* 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... | (chunk_size) | ;
}
return chunk_size;
}
uint32_t flash_crc32(uint32_t flash_addr, uint32_t num_bytes) {
void *buffer;
unsigned int chunk_size = prv_allocate_crc_buffer(&buffer);
uint32_t crc = CRC32_INIT;
while (num_bytes > chunk_size) {
flash_read_bytes(buffer, flash_addr, chunk_size);
crc = crc32(crc, buffer, ... |
me_buf);
// June 10th 2015, 13:30:29 (T-00:29:31)
rtc_set_time(event_time - (30 * SECONDS_PER_MINUTE) + 29);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("IN 30 MIN", time_buf);
// June 10th 2015, 13:30:30 (T-00:29:30)
rtc_set_time(event_tim... | rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) - 1) | |
24 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, softwar... | ((Layer *)&peek_layer->number.text_layer,
&(GRect) { { cursor.x, cursor.y + NUMBER_OFFSET_Y }, number_size }) | ;
cursor.x += number_size.w;
layer_set_frame((Layer *)&peek_layer->title.text_layer,
&(GRect) { { cursor.x, cursor.y + TEXT_OFFSET_Y },
{ title_size.w, title_size.h + font_height_fuzz } });
}
//////////////////////
// API
/////////////////////
PeekLayer *peek_layer_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... | bt_driver_test_enter_hci_passthrough() | ;
}
void bt_test_stop(void) {
if (!s_test_mode_enabled) {
prompt_send_response("Invalid operation: Run 'bt test start' first");
return;
}
bt_driver_test_stop();
stop_mode_enable(InhibitorBluetooth);
// Bring the normal BT stack back up - airplane mode makes this simple
bt_ctl_set_override_mode(Bt... |
t_protocol.h"
#include "dialog_spi.h"
#include "hc_protocol/hc_protocol.h"
#include "hc_protocol_cb_handler.h"
#include "core_dump.h"
#include "drivers/periph_config.h"
#include "drivers/timer.h"
#include "kernel/pbl_malloc.h"
#include "kernel/pebble_tasks.h"
#include "kernel/util/sleep.h"
#include "kernel/util/stop.h... | TIM_Cmd(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, DISABLE) | ;
TIM_ClearITPendingBit(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, TIM_IT_Update);
TIM_ITConfig(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, TIM_IT_Update, ENABLE);
}
static void prv_watchdog_deinit(void) {
TIM_Cmd(BOARD_BT_WATCHDOG_TIMER.timer.peripheral, DISABLE);
TIM_ITConfig(BOARD_BT_WATCHDOG_TIMER.timer.perip... |
d = notif_attributes[FetchedNotifAttributeIndexAppID];
if (!app_id || app_id->length == 0) {
PBL_LOG(LOG_LEVEL_ERROR, "Can't handle notifications without an app id");
return;
}
const ANCSAttribute *title = notif_attributes[FetchedNotifAttributeIndexTitle];
const ANCSAttribute *subtitle = notif_attribut... | { goto cleanup; } |
timeline_add_missed_call_pin(missed_call_pin, uid);
timeline_item_destroy(missed_call_pin);
}
cleanup:
ios_notif_pref_db_free_prefs(app_notif_prefs);
}
void ancs_notifications_handle_notification_removed(uint32_t ancs_uid, ANCSProperty properties) {
// Dismissal from phone is only properly supported on... |
;
cl_assert_equal_s(dump[2].name, "Window1");
kernel_free(dump);
}
void test_window_stack__pop_all_modals(void) {
Window *windows[NumModalPriorities];
WindowStack *window_stacks[NumModalPriorities];
for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) {
window_stacks[idx] = modal_... | window_stack_push(stack, window2, true) | ;
cl_assert_equal_i(window_stack_count(stack), 2);
cl_assert_equal_i(prv_get_load_unload_count(), 2);
cl_assert_equal_i(prv_get_appear_disappear_count(), 1);
window_stack_pop_all(stack, true);
cl_assert_equal_i(window_stack_count(stack), 2);
cl_assert_equal_i(prv_get_load_unload_count(), 2);
cl_assert_... |
856},
{ -616, -168, -848},
{ -544, -184, -728},
{ -496, -144, -784},
{ -560, -192, -800},
{ -472, -120, -824},
{ -512, -64, -872},
{ -480, -64, -792},
{ -576, -72, -824},
{ -488, -24, -816},
{ -528, -184, -792},
{ -584, -152, -840},
{ -544, -176, -776},
{ -608, -128, ... | { -536, -8, -728},
{ -504, -112, -848},
{ -608, 0, -760},
{ -472, -112, -760},
{ -528, -96, -784},
{ -520, 40, -768},
{ -488, -104, -728},
{ -504, -48, -776},
{ -416, -184, -720},
{ -472, -80, -832},
{ -520, -160, -784},
{ -472, -144, -808},
{ -488, -16, -848},
{ ... |
{ -352, -72, -776},
{ -504, 112, -856},
{ -560, -40, -872},
{ -472, 88, -864},
{ -544, -128, -904},
{ -496, -40, -896},
{ -592, -144, -944},
{ -632, -88, -840},
{ -480, -144, -856},
{ -648, -56, -856},
{ -488, -136, -816},
{ -544, -72, -800},
{ -424, -152, -728},
... |
/*
* 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(144, 168) | ;
text_layer_init(&data->text_layer,
&GRect(0, 0, data->text_layer_size.w, data->text_layer_size.h));
text_layer_set_background_color(&data->text_layer, GColorWhite);
text_layer_set_text_color(&data->text_layer, GColorBlack);
text_layer_set_text(&data->text_layer, TEXT_DELTA_BUF);
data->go... |
eld down or we hit a bounce. Wait
// for all the buttons to release again.
// 100000 is about a second in practice
for (int i = 0; i < 100000; ++i) {
if (button_get_state_bits() == 0) {
// All the buttons are released!
break;
}
}
}
}
static void prv_clear_wakeup_flags(void... | rtc_speed_up() | ;
}
|
l/system_theme.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/string.h"
#include "util/time/time.h"
#include "util/trig.h"
#include <stdio.h>
#include <string.h>
// Alarms app versions
// 0: Initial version or never opened
// 1: Smart alarms
#define CURRENT_ALARMS_APP_VERSION 1
typedef str... | menu_layer_set_selected_index(&data->menu_layer, selected_menu_index,
MenuRowAlignCenter, false) | |
the clip box with a clip box that will render the item in the right place with the
// right size, without menu layer's selection clipping. Menu layer will responsible for cleaning
// up the changes made to this clip box.
ctx->draw_state.clip_box.origin = ctx->draw_state.drawing_box.origin;
ctx->draw_sta... | MenuIndex(0, menu_layer_index) | ,
MenuRowAlignCenter, animated);
}
static void prv_scroll_handler(ClickRecognizerRef recognizer, void *context) {
ActionMenuLayer *aml = context;
const bool up = (click_recognizer_get_button_id(recognizer) == BUTTON_ID_UP);
const int new_idx = aml->selected_index + (up ? -1 : 1);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.