prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
direction
prv_write_reg(BMI160_REG_SELF_TEST, 0x8 | 0b01);
psleep(50);
struct {
char axis_name;
uint8_t register_address;
int pass_threshold;
int16_t negative_value;
int16_t positive_value;
} accel_test_axis[] = {
{
.axis_name = 'X',
.register_address = BMI160_REG_ACC_X_LS... | if (status == mode) {
break;
} |
psleep(5);
BMI160_DBG("GYRO: want mode %d, actual %d", mode, status);
}
PBL_ASSERT(retries > 0, "Gyro: Could not set power mode to %d", mode);
s_gyro_power_mode = mode;
BMI160_DBG("PMU_STATUS: 0x%x", bmi160_read_reg(BMI160_REG_PMU_STATUS));
}
/*
* accel.h driver interface exposed to higher level cod... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_LOG(LOG_LEVEL_ERROR, "HcLog: received unhashed log in hashed build") | ;
#else
prv_log_unhashed_v1((BinLogMessage_Unhashed_v1 *)header);
#endif
break;
default:
PBL_LOG(LOG_LEVEL_ERROR, "HcLog: unexpected log header version %d", header->version);
break;
}
}
break;
default:
PBL_LOG(LOG_LEVEL_INFO, "HcLog... |
i"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
... | (&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersBottom) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_bottom.${BIT_DEPTH_NAME}.pbi"));
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) - 1, GCornersTop);
cl_check(gbitma... |
t_expire_s, HRM_MANAGER_APP_EXIT_EXPIRATION_SEC);
sys_hrm_manager_unsubscribe(session_ref);
}
// Test that app subscriptions expire correctly
void test_hrm_manager__app_expiration(void) {
AppInstallId app_id = 1;
const uint16_t expire_s = SECONDS_PER_MINUTE;
HRMSessionRef session_ref = sys_hrm_manager_app_... | (PebbleTask_App, INSTALL_ID_INVALID) | == NULL);
// Unsubscribe, HRM should be disabled after
for (int i = 0; i < num_refs; ++i) {
sys_hrm_manager_unsubscribe(session_refs[i]);
cl_assert(prv_get_subscriber_state_from_ref(session_refs[i]) == NULL);
cl_assert(prv_get_subscriber_state_from_app_id(PebbleTask_App, app_ids[i]) == NULL);
}
cl... |
width_1(void) {
// Stroke width 1, non-antialiased
setup_test(&context, false, 1, GColorBlack, GColorBlack, false);
graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10));
ASSERT_CALLED(graphics_line_draw_1px_non_aa(&context, GPoint(5, 5), GPoint(45, 10)));
setup_test(&context, false, 1, GColorBlack, GCo... | (&context, GPoint(5, 5), GPoint(45, 10)) | ;
#if PBL_COLOR
ASSERT_CALLED(graphics_line_draw_stroked_aa(&context, GPoint(5, 5), GPoint(45, 10), 2));
#else
ASSERT_CALLED(graphics_line_draw_stroked_non_aa(&context, GPoint(5, 5), GPoint(45, 10), 2));
#endif
setup_test(&context, true, 2, GColorBlack, GColorBlack, false);
graphics_draw_rect(&context, &GRect(1... |
perty == PROPERTY_ALPHA) {
data->alpha = (data->alpha + 0x40) & ALPHA_100;
set_text_layers(data);
} else if (data->property == PROPERTY_COLOR_TABLE) {
if (s_color_table == color_table_hsv) {
s_color_table = color_table_hvs;
} else if (s_color_table == color_table_hvs) {
s_color_table = col... | text_layer_get_layer(data->fg_color_text) | );
data->fg_color_index = 8;
data->bg_text = text_layer_create(GRect(2, 48, 28, 20));
layer_add_child(window_get_root_layer(window), text_layer_get_layer(data->bg_text));
data->bg_color_text = text_layer_create(GRect(2, 70, 64, 20));
layer_add_child(window_get_root_layer(window), text_layer_get_layer(data-... |
/*
* 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_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_USART1) | ;
/* Configure USART Tx as alternate function */
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_Init(GPIOA, &GPIO_In... |
-784},
// 2 seconds
{ 96, 504, -720},
{ 48, 360, -616},
{ 152, 512, -456},
{ 480, 800, -512},
{ 336, 760, -472},
{ 328, 728, -320},
{ 360, 608, -200},
{ 992, 968, -480},
{ 568, 616, -136},
{ 968, 960, -56},
{ 864, 712, -8},
{ 976, 696, -32},
{ 976, 728, -24},
... | { 1112, 168, 40},
{ 1568, 80, 184},
{ 1696, 144, 200},
// 8 seconds
{ 1240, 488, -168},
{ 960, 288, -184},
{ 792, 48, 80},
{ 792, -56, 64},
{ 720, 152, 136},
{ 696, 160, 120},
{ 664, 312, -32},
{ 736, 200, 40},
{ 712, 328, -104},
{ 776, 256, -40},
{ 944, 232, ... | |
e
* 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.
*/
#include "animated_demo.h"
#include "applib/app.h"
#include "p... | window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler)click_handler) | ;
window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler)click_handler);
(void)window;
}
static void handle_init(void) {
AnimatedDemoData *data = (AnimatedDemoData*) app_malloc_check(sizeof(AnimatedDemoData));
data->toggle = false;
app_state_set_user_data(data);
Window *window = &data->window;
wind... |
tocol_msg_callback(CommSession *session,
const uint8_t *data, size_t length);
// Fakes & Stubs
////////////////////////////////////////////////////////////////////////////////////////////////////
#include "fake_pbl_malloc.h"
#include "fake_events.h"
#include "f... | cl_assert_equal_i(fake_event_get_count(), 0) | ;
}
static const CommSessionCapability s_expected_capabilities =
(CommSessionAppMessage8kSupport |
CommSessionVoiceApiSupport);
void test_session_remote_version__system_session(void) {
s_session_is_system = true;
prv_receive_v3_response(3, 2, 1, s_expected_capabilities);
// Triggers PEBBLE_REMOTE_APP_I... |
// 151 seconds
{ 152, 912, 8},
{ 120, 1208, 24},
{ 168, 1152, -8},
{ 184, 936, 0},
{ 216, 968, 0},
{ 232, 1040, 8},
{ 264, 1096, 8},
{ 248, 1016, 8},
{ 208, 992, 40},
{ 200, 1024, 56},
{ 200, 1064, 88},
{ 216, 1032, 80},
{ 216, 1024, 56},
{ 224, 1024, 40},
... | { 232, 1016, -48},
{ 232, 1024, -48},
{ 232, 1008, -32},
{ 216, 1032, -24},
{ 216, 1048, -16},
// 157 seconds
{ 216, 1032, -24},
{ 224, 1016, -8},
{ 224, 1016, -24},
{ 224, 1024, -24},
{ 216, 1032, -24},
{ 216, 1040, -16},
{ 224, 1024, -24},
{ 216, 1032, -24},
... |
{ -400, 872, -488},
{ -384, 896, -472},
{ -328, 1000, -496},
{ -360, 864, -600},
{ -288, 704, -680},
{ -304, 384, -848},
{ -296, 320, -896},
{ -320, 480, -896},
{ -336, 624, -832},
{ -352, 640, -728},
{ -376, 664, -696},
{ -392, 680, -672},
{ -408, 704, -648},
{ ... |
nit(&layer, &GRect(10, 10, 10, 10));
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_inside_offset_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &outside... | (p.x + 3, p.y + 1) | );
graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y + 1));
graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y + 1));
graphics_draw_pixel(ctx, GPoint(p.x + 6, p.y + 1));
graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y + 1));
graphics_draw_pixel(ctx, GPoint(p.x + 0, p.y + 2));
graphics_draw_pixel(ctx, GPoint(p.x + 1, p.y... |
tests by name
qsort(&test_entry[0], num_tests, sizeof(test_entry[0]), prv_qsort_sleep_test_entry_cb);
// ---------------------------------------------------------------------------------
// Print results in a table
printf("\n\n");
printf("\n%-24s", "name");
// Print header line
for (int i = 0; i < ARRA... | {
ActivityFileTestEntry *entry = &test_entry[num_tests];
#ifdef ACTIVITY_TEST_ONLY
if (strcmp(entry->name, ACTIVITY_TEST_ONLY)) {
continue;
}
#endif
entry->test_idx = num_tests;
printf("\n\n========================================================");
printf("\nRunning activity sample set:... |
continue;
case KAlgActivityType_Walk:
desc = "walk";
break;
case KAlgActivityType_Run:
desc = "run";
break;
case KAlgActivityTypeCount:
WTF;
break;
}
int start_idx = (session->start_utc - test_start_utc) / SECOND... |
lse {
map_val = BMI160_INT_MAP_1_INT2_FIFO_WATERMARK;
int_en_val = BMI160_INT_EN_1_FWM_EN;
}
prv_read_modify_write(BMI160_REG_INT_MAP_1, map_val, map_mask);
prv_read_modify_write(BMI160_REG_INT_EN_1, int_en_val, int_en_mask);
BMI160_DBG("INT_MAP[1] = 0x%"PRIx8, bmi160_read_reg(BMI160_REG_INT_MAP_1));
... | {
// don't worry about the configuration registers but disable interrupts
// generated for taps from the accel
uint8_t dis_mask = BMI160_INT_MAP_ANYMOTION_EN_MASK;
prv_read_modify_write(BMI160_REG_INT_MAP_0, 0, dis_mask);
dis_mask = (BMI160_INT_EN_0_ANYMOTION_X_EN | BMI160_INT_EN_0_ANYMOTION_Y_EN |
B... |
static void prv_enable_double_tap_detection(void) {
uint8_t tap_0_cfg =
(0x1 << BMI160_INT_TAP_QUIET_SHIFT) | // 0 = 20 ms, 1 = 30ms
(0x1 << BMI160_INT_TAP_SHOCK_SHIFT) | // 0 = 50 ms, 1 = 75ms
(0x4 << BMI160_INT_TAP_DUR_SHIFT); // 4 = 300 ms
prv_write_reg(BMI160_REG_INT_TAP_0, tap_0_cfg);
... |
ceUiData *data = applib_type_malloc(VoiceWindow);
if (!data) {
return NULL;
}
*data = (VoiceUiData) {
.state = StateStart,
.show_confirmation_dialog = true,
.show_error_dialog = true,
.message = buffer,
.buffer_size = buffer_size,
.session_type = session_type,
};
return data;
}
v... | if (buffer) {
// do not allocate a buffer is one is allocated already
sentence = buffer;
} else {
// allocate a buffer if one is not yet allocated
sentence = applib_malloc(len + 1);
} |
memcpy(sentence, e->data->sentence, len);
sentence[len] = '\0'; // Ensure that string is NULL-terminated
*sentence_len = len;
return sentence;
}
DEFINE_SYSCALL(void, sys_voice_analytics_log_event, AnalyticsEvent event_type,
uint16_t response_size, uint16_t response_len_chars, uint32_t respon... |
nclude "clar.h"
#include "services/normal/notifications/alerts_preferences.h"
#include "services/normal/notifications/ancs/ancs_notifications.h"
#include "services/normal/blob_db/ios_notif_pref_db.h"
// Stubs
////////////////////////////////////////////////////////////////
#include "stubs_analytics.h"
#include "stub... | ancs_notifications_handle_notification_removed(uid, ANCSProperty_IncomingCall) | |
1], true);
window_stack_push(window_stacks[2], windows[2][1], false);
// A transparent window is now the top window
// Test: Opaque windows that are not the top window have no affect on transparency
// Test: One transparent top window results in Transparent
modal_manager_event_loop_upkeep();
cl_assert_equa... | window_destroy(windows[idx][i]) | |
(index, ctx) | ;
// Repeating timer
s_app_data->timer[timer_idx_0] = new_timer_create();
bool success = new_timer_start(s_app_data->timer[timer_idx_0], 500, timer_callback, (void*)timer_idx_0,
TIMER_START_FLAG_REPEATING);
PBL_ASSERTN(success);
scheduled = new_timer_scheduled(s_app_da... | |
rame_in_ctx_space);
}
// translate the drawing_box to the bounds of the layer:
ctx->draw_state.drawing_box.origin.x +=
levels_layer->frame.origin.x + levels_layer->bounds.origin.x;
ctx->draw_state.drawing_box.origin.y +=
levels_layer->frame.origin.y + levels_layer->bounds.or... | layer_set_window(child, window) | ;
child = child->next_sibling;
}
}
struct Window *layer_get_window(const Layer *layer) {
if (layer) {
return layer->window;
}
return NULL;
}
void layer_remove_from_parent(Layer *child) {
if (!child || child->parent == NULL) {
return;
}
if (child->parent->window) {
window_schedule_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... | ("s3", "2005-07-25") | ;
ASSERT_JS_GLOBAL_EQUALS_S("s4", "Mon Jul 25 2005 20:04:05 GMT-03:00");
}
void test_rocky_api_datetime__locale_time_string_12h(void) {
s_clock_is_24h_style = false;
rocky_global_init(s_api);
EXECUTE_SCRIPT(
"var d = new Date();\n"
"var s = d.toLocaleTimeString();\n"
);
ASSERT_JS_GLOBAL_EQUALS_S("... |
(unsigned int) data_size);
PBL_LOG(LOG_LEVEL_WARNING, "format %u row_size_bytes %"PRIu16" width %"PRId16" height %"PRId16,
format, bitmap->row_size_bytes, bitmap->bounds.size.w, bitmap->bounds.size.h);
return false;
}
// Move the actual pixel data up to the front of the buffer.
... | {
return GRectZero;
} |
return bitmap->bounds;
}
void gbitmap_set_bounds(GBitmap *bitmap, GRect bounds) {
if (bitmap) {
bitmap->bounds = bounds;
}
}
void gbitmap_deinit(GBitmap* bitmap) {
if (gbitmap_get_info(bitmap).is_bitmap_heap_allocated) {
applib_resource_munmap_or_free(bitmap->addr);
}
bitmap->addr = NULL;
if (... |
/*
* 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... | dict_write_begin(&s_outbox_iterator, s_outbox_buffer, s_outbox_size) | ;
*iterator = &s_outbox_iterator;
return APP_MSG_OK;
}
static int s_app_message_outbox_send_call_count;
AppMessageResult app_message_outbox_send(void) {
++s_app_message_outbox_send_call_count;
s_is_outbox_message_pending = true;
return APP_MSG_OK;
}
static bool s_comm_session_connected;
CommSession *sys_ap... |
rder[4]].header.id,
&timeline_model_get_iter_state(-1)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[5]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id));
cl_assert(!timeline_model_iter_next(&new_idx, &has_next));
}
void test_timeline_model__and_back(void) {
TimelineMo... | (&s_items[s_correct_order[1]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id) | );
cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id,
&timeline_model_get_iter_state(2)->pin.header.id));
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(0));
cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx... |
void *context) {
if (info->key_len != sizeof(BTBondingID)) {
return true;
}
if (info->val_len == 0) {
return true;
}
BtPersistBondingData data;
info->get_val(file, &data, sizeof(data));
if (data.ble_data.requires_address_pinning) {
bool *has_pinned_... | {
BTDeviceAddress bd_addr;
char name[BT_DEVICE_NAME_BUFFER_SIZE];
SM128BitKey link_key;
uint8_t platform_bits;
if (!shared_prf_storage_get_bt_classic_pairing_data(&bd_addr, name, &link_key, &platform_bits)) {
// No pairing available, check to see if we have a pairing in the gapDB
prv_push_bt_persist_t... |
static void prv_load_ble_pairing_from_prf(void) {
SMPairingInfo prf_pairing_info;
char device_name[BT_DEVICE_NAME_BUFFER_SIZE];
bool requires_address_pinning;
uint8_t flags;
if (!shared_prf_storage_get_ble_pairing_data(&prf_pairing_info, device_name,
&requires_... |
tage_by_percent(percent, false);
fake_battery_init(discharge_mv, false, false);
battery_monitor_init();
periodic_timer_trigger(1);
cl_assert_equal_i(battery_get_charge_state().charge_percent, percent);
fake_battery_set_charging(true);
fake_battery_set_millivolts(charge_mv);
fake_battery_set_connected(t... | (low_mv, false, false) | ;
battery_monitor_init();
periodic_timer_trigger(1);
cl_assert(battery_monitor_critical_lockout());
cl_assert_equal_i(standby_timer_get_timeout(), 2000);
standby_timer_trigger(1);
cl_assert(s_entered_standby);
}
void test_battery_monitor__critical(void) {
int good_mv = battery_curve_lookup_voltage_by_p... |
te(&s_test_impl_data, NULL);
// Copied from recognizer_manager.c
TouchEvent t;
struct ProcessTouchCtx {
Recognizer *triggered;
const TouchEvent *touch_event;
} ctx = { .triggered = NULL, .touch_event = &t };
cl_assert(prv_dispatch_touch_event(r, &ctx));
cl_assert(handled);
cl_assert(!ctx.trigger... | (recognizers[3], &layer_c.recognizer_list) | |
ache_free_up_space(uint32_t bytes_needed) {
if (bytes_needed == 0) {
return E_INVALID_ARGUMENT;
}
status_t rv;
mutex_lock_recursive(s_app_cache_mutex);
{
SettingsFile file;
rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE);
if (rv != S_SUCCESS) {
goto unlock;
}... | pfs_remove(iter->name) | ;
iter = (PFSFileListEntry *)iter->list_node.next;
}
}
// The bug addressed in PBL-34010 caused resource files to remain in the filesystem even
// after the associated application had been deleted. This function attempts to find such
// orphaned files and remove them. Note: further to the bug in PBL-34010, thi... |
d glyph> not overlap at any time. This is checked by fontgen.py and confirmed
// by the code below.
//
// RLE4 data is encoded as a stream of RLE Units.
// 0 1 2 3
// +-+-+-+-+
// |*| Len | Where * is the encoded symbol [0,1] and 'Len + 1' is the number of symbols
// +-+-+-+-+ in the run [1,8... | if (HAS_FEATURE(font_res->md.version, VERSION_FIELD_FEATURE_RLE4)) {
// Load the glyph data at the end of the buffer
target = &((uint8_t *)g->data)[CACHE_GLYPH_SIZE - glyph_size_bytes];
} else {
target = (uint8_t *)g->data;
} |
SYS_PROFILER_NODE_START(text_render_flash);
size_t num_bytes_loaded = sys_resource_load_range(font_res->app_num, font_res->resource_id,
bitmap_addr, target, glyph_size_bytes);
SYS_PROFILER_NODE_STOP(text_render_flash);
if (glyph_size_bytes && !num_b... |
vent_Cancelled);
cl_assert_equal_i(r->state, RecognizerState_Cancelled);
cl_assert(!s_manager_state_change);
cl_assert_passert(recognizer_transition_state(r, RecognizerState_Failed));
cl_assert_passert(recognizer_transition_state(r, RecognizerState_Possible));
cl_assert_passert(recognizer_transition_state(r, ... | cl_assert_equal_b(cancelled, true) | ;
}
void test_recognizer__cancel(void) {
bool cancelled = false;
s_test_impl_data.cancelled = &cancelled;
RecognizerEvent rec_event = -1;
NEW_RECOGNIZER(r) = test_recognizer_create(&s_test_impl_data, &rec_event);
recognizer_cancel(r);
cl_assert_equal_i(r->state, RecognizerState_Possible);
cl_assert_equa... |
(&frame->origin,
GPoint(style->fin_offset_x,
is_future ? style->future_fin_offset_y : style->past_fin_offset_y)) | ;
frame->size.w -= PBL_IF_RECT_ELSE(style->sidebar_width, 0);
}
static void prv_get_day_sep_frame(TimelineLayer *layer, int index, GRect *frame) {
prv_get_frame(layer, index, frame);
const bool is_future = (layer->scroll_direction == TimelineScrollDirectionDown);
const TimelineLayerStyle *style = prv_get_style... | |
e_hrm_push_sharing_request_window(BLEHRMSharingRequest *sharing_request) {
++s_ble_hrm_push_sharing_request_window_call_count;
cl_assert_equal_p(s_last_sharing_request, NULL);
s_last_sharing_request = sharing_request;
}
bool bt_driver_is_hrm_service_supported(void) {
return true;
}
static BTDeviceInternal s_l... | memset(s_last_permitted_devices, 0, sizeof(s_last_permitted_devices)) | ;
s_bt_driver_hrm_service_enable_call_count = 0;
s_hrm_manager_subscribe_with_callback_call_count = 0;
s_sys_hrm_manager_unsubscribe_call_count = 0;
s_bt_driver_hrm_service_handle_measurement_call_count = 0;
s_ble_hrm_push_sharing_request_window_call_count = 0;
s_ble_hrm_push_reminder_popup_call_count = 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... | (S_SUCCESS, app_db_insert((uint8_t*)&app1.uuid,
sizeof(Uuid), (uint8_t*)&app1, sizeof(AppDBEntry))) | ;
cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app2.uuid,
sizeof(Uuid), (uint8_t*)&app2, sizeof(AppDBEntry)));
cl_assert_equal_i(S_SUCCESS, app_db_insert((uint8_t*)&app3.uuid,
sizeof(Uuid), (uint8_t*)&app3, sizeof(AppDBEntry)));
}
void test_app_db__cleanup(void) {
//nada
}
// Tests
//////... |
= true;
}
cleanup:
*fd_used = (res >= 0) ? fd : res;
return (file_found);
}
// handles the creation of a file which was not previously on the FS
static NOINLINE status_t pfs_open_handle_create_request(int fd, uint8_t file_type,
size_t start_size) {
if (!VALID_TYPE(file_type) || (start_size == 0)) {
... | (s_pfs_mutex) | ;
return (res);
}
static int pfs_open_gc_file(uint32_t space_needed, bool create) {
int fd = GC_FD_HANDLE_ID; // the gc fd follows the avail fd
File *file = &PFS_FD(fd).file;
// settings for cached & new fds
file->op_flags = OP_FLAG_READ;
if (create) {
file->op_flags |= OP_FLAG_WRITE;
}
file->offs... |
#include "services/normal/filesystem/app_file.h"
#include "system/hexdump.h"
#include "system/logging.h"
#include "system/passert.h"
#include "system/version.h"
#include "util/math.h"
#include "util/size.h"
static const ResourceStoreImplementation *s_resource_store_impls[] = {
#define RESOURCE_IMPL(impl) &impl,
#inclu... | {
uint32_t num_bytes;
if ((num_bytes = prv_get_store_length(entry, manifest)) == 0) {
PBL_LOG(LOG_LEVEL_WARNING, "Resource table check failed. Table or manifest may be corrupted");
return false;
}
uint32_t calculated_crc = prv_get_crc(entry, num_bytes, 0);
if (calculated_crc != manifest->version.crc... | |
fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11);
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 11);
graphics_draw_rect(... | (&ctx.dest_bitmap, "draw_rect_origin_sw5_no_clip.${BIT_DEPTH_NAME}.pbi") | );
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 5);
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, fal... |
J5zCoXiGIkav4cW8" \
"SSxw7WtwGnhobAOXwqbvGDDwElpRG6cll8CwM9Wysh01Mj0aFWxEVN0z5w7yQHt8bwiWVabrMeUUAek2J5zCoXiGIkav4cW8",
},
};
for (int i = 0; i < ARRAY_LENGTH(entries); ++i) {
cl_assert_equal_i(health_db_insert((uint8_t *)entries[i].key,
strlen(entries[i... | cl_assert_equal_i(s_metric_updated_count, NUM_CURRENT_SLEEP_METRICS);
s_metric_updated_count = 0;
key = "sunday_movementData";
cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key),
(uint8_t *)s_movement_data, sizeof(s_movement_data)),
S_SUCCESS... | |
/*
* 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... | (analytic_id, AnalyticsClient_System) | ;
analytics_inc(ANALYTICS_DEVICE_METRIC_BT_SYSTEM_SESSION_OPEN_COUNT, AnalyticsClient_System);
}
session->open_ticks = rtc_get_ticks();
}
void comm_session_analytics_close_session(CommSession *session, CommSessionCloseReason reason) {
const bool is_system = (session->destination != TransportDestinationApp);
... |
/*
* 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... | notification_storage_get(&last_notification_received_id, ¬ification) | ) {
// We couldn't load the notification for some reason; just bail out with the subtitle cleared
notifications_glance->subtitle[0] = '\0';
return;
}
const char *title = attribute_get_string(¬ification.attr_list, AttributeIdTitle, "");
const char *subtitle = attribute_get_string(¬ification.attr... |
/*
* 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_sectors[sector], VoltageRange_1) | != FLASH_COMPLETE) {
dbgserial_print("failed to erase sector ");
dbgserial_print_hex(sector);
dbgserial_putstr("");
FLASH_Lock();
return false;
}
if (progress_callback) {
progress_callback(sector - first_sector + 1, count, progress_context);
}
}
FLASH_Lock();
retur... |
/*
* 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... | {
connection = kernel_malloc_check(sizeof(Connection));
*connection = (Connection) {
.conn_idx = conn_idx,
.initial_addr = *initial_addr,
.local_addr = *local_addr,
.conn_params = *params,
};
s_connections = (Connection *)list_prepend((ListNode *)s_connections, (ListNode *)connec... |
prv_unlock();
return connection;
}
void connection_destroy(Connection *connection) {
ble_task_assert_is_executing_on_ble_task();
prv_lock();
{
if (connection_is_valid(connection)) {
list_remove((ListNode *)connection, (ListNode **)&s_connections, NULL);
ListNode *tmp = (ListNode *) connecti... |
e(r, (const uint8_t *)&s_push, sizeof(s_push));
// Expect only up to MAX_HEADER_SIZE bytes has been written:
cl_assert_equal_i(s_kernel_receiver_buffer_idx, MAX_HEADER_SIZE);
// Check that the header is received correctly:
cl_assert_equal_m(s_kernel_receiver_buffer, &s_push, MAX_HEADER_SIZE);
s_rcv_imp->fin... | s_rcv_imp->write(r, (const uint8_t *)&s_push, sizeof(s_push)) | |
led, or if the play_count is 0 (in which case we allow it to
// be auto-destroyed).
if (animation->abs_start_time_ms || animation->play_count == 0) {
const bool allow_auto_destroy = (animation->play_count == 0);
prv_unschedule_animation(state, animation, false /*finished=false*/, allow_auto_destroy,
... | if (!prv_is_mutable(state, animation)) {
return false;
} |
animation->context = context;
animation->handlers = handlers;
return true;
}
// -------------------------------------------------------------------------------------------
AnimationHandlers animation_get_handlers(Animation *animation_h) {
if (animation_private_using_legacy_2(NULL)) {
// We need to enabl... |
* (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_value = test_num };
cl_assert(num.integer == 0);
cl_assert(num.fraction == 6);
test_num = (int32_t)((float)0.875 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_value = test_num };
cl_assert(num.integer == 0);
cl_assert(num.fraction =... | cl_assert(num.integer == 1) | ;
cl_assert(num.fraction == 1); // rounds down to 1.125
}
void test_math_fixed__S16_3_add(void) {
Fixed_S16_3 num1, num2;
Fixed_S16_3 sum, sum_c;
// Test number addition
num1 = FIXED_S16_3_ONE;
num2 = FIXED_S16_3_ONE;
sum = Fixed_S16_3_add(num1, num2);
sum_c = (Fixed_S16_3){ .raw_value = (int16_t)((f... |
strftime(text.buffer, sizeof(text.buffer), "$l:%M%P", tick_time);
}
for (uint32_t i = 0; i < sizeof(text.buffer); i++) {
text.buffer[i] = toupper((unsigned char)text.buffer[i]);
}
// TODO: Don't return a struct
return text;
}
static ClockModel prv_clock_model_default(struct tm *tick_time) {
// Cre... | prv_intro_animation_finished(NULL) | |
/*
* 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_test_file_c) | ; ++i) {
s_test_file_c[i] = 'c';
}
pfs_write(fd, (uint8_t *)s_test_file_c, sizeof(s_test_file_c));
pfs_close(fd);
}
void test_pfs__cleanup(void) {
fake_spi_flash_cleanup();
}
void test_pfs__create(void) {
char hello[] = { 'h', 'e', 'l', 'l', 'o' };
int fd_z = pfs_open("z", OP_FLAG_WRITE, FILE_TYPE_STA... |
tex_unlock_recursive(s_resource_mutex);
return rv;
}
void resource_init(void) {
// see if there's a system bank waiting to be loaded
resource_storage_init();
s_resource_mutex = mutex_create_recursive();
}
uint32_t resource_get_and_cache(ResAppNum app_num, uint32_t resource_id) {
PBL_ASSERTN(app_num == SYST... | mutex_lock_recursive(s_resource_mutex) | ;
bool rv = resource_storage_check(app_num, resource_id, NULL /* No expected version */);
if (rv) {
ResourceStoreEntry entry;
prv_get_resource(app_num, resource_id, &entry);
rv = (entry.id != 0);
}
mutex_unlock_recursive(s_resource_mutex);
return rv;
}
bool resource_version_matches(const Resource... |
*context;
int num_will_change_calls;
int num_change_calls;
int num_did_change_calls;
GRect last_will_change_final_area;
AnimationProgress last_change_progress;
} UnobstructedAreaTestData;
UnobstructedAreaTestData s_data;
static void prv_will_change(GRect final_area, void *context) {
s_data.last_will_chang... | cl_assert(fake_event_service_get_info(PEBBLE_UNOBSTRUCTED_AREA_EVENT)->handler) | ;
cl_assert_equal_p(app_state_get_unobstructed_area_state()->handlers.will_change, prv_will_change);
const GRect from_area = GRect(0, 0, DISP_COLS, 400);
const GRect to_area = GRect(0, 0, DISP_COLS, 200);
unobstructed_area_service_will_change(from_area.size.h, to_area.size.h);
fake_event_service_handle_last(... |
prv_validate_set_desired_state_cmd(&conn_params->remote_desired_state, length) | ;
break;
case PebblePairingServiceConnParamsWriteCmd_EnablePacketLengthExtension:
rv = prv_handle_ple_update_request(evt->conn_idx, &conn_params->ple_req, length);
break;
case PebblePairingServiceConnParamsWriteCmd_InhibitBLESleep:
power_inhibit_sleep();
rv = (length >= sizeof(Pebb... | |
0, -192},
{ 1056, 400, 32},
{ 1200, 216, 232},
{ 1192, 40, 176},
{ 928, 280, -160},
{ 768, 440, -216},
{ 776, 520, -104},
{ 760, 408, -32},
{ 800, 248, 72},
{ 1008, 256, 200},
{ 920, 240, 216},
{ 1056, 320, 152},
{ 1032, 320, 208},
{ 1136, 160, 304},
{ 1384, 520, ... | { 1152, 584, 88},
{ 1416, 616, 280},
{ 2184, 584, 368},
// 30 seconds
{ 1320, 520, 288},
{ 1384, 296, 232},
{ 1480, 320, 272},
{ 1384, 432, 344},
{ 1024, 336, 288},
{ 792, 224, 192},
{ 720, 160, 200},
{ 696, 128, 224},
{ 624, 104, 200},
{ 576, 88, 184},
{ 648,... |
{ 1256, 72, 424},
{ 1728, 312, 616},
{ 2008, 1160, 192},
{ 1600, 1560, 264},
{ 1328, 424, 696},
{ 896, 24, 144},
{ 840, 296, 32},
{ 704, 896, 8},
{ 816, 440, -264},
// 33 seconds
{ 360, 192, 88},
{ 752, 272, 224},
{ 880, 456, 184},
{ 1312, 656, 176},
{ 1456, ... |
- time_start) <= HS_MAX_MINUTE_DATA_SEC);
if (metric == HealthMetricHeartRateBPM) {
if (query_cur_minute) {
// If the client is querying the service for the most recent Stable/Median/Filtered value
// and it is within the last X minutes, return it. If it's older than X minutes, return 0.
// Thi... | ROUND(result, num_sums) | ;
}
return result;
}
// --------
// Default handling is to use daily totals
if (scope == HealthServiceTimeScopeOnce) {
return prv_compute_aggregate_using_daily_totals(state, metric, time_start, time_end,
aggregation);
} else {
return prv_com... |
th the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o... | cl_assert(NULL != bmp) | ;
cl_assert(g_gbitmap_spalding_data_row_infos == bmp->data_row_infos);
#endif
}
void test_gbitmap_formats__create_blank_with_palette(void) {
const GSize s10 = GSize(10, 10);
const GSize s180 = GSize(180, 180);
GBitmap *bmp;
GColor8 *p = (GColor8 *)&p; // some value to test against
#ifdef PLATFORM_TINTIN
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... | {
return desc->description_length == sizeof(FirmwareDescription);
} | |
/*
* 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... | (destbuf, "larity") | ;
cl_assert_equal_m(expectbuf, destbuf, 9);
}
void test_strcat__return(void) {
char destbuf[9] = "hi";
char expectbuf[9] = "hilarity";
cl_assert_equal_p(strcat(destbuf, "larity"), destbuf);
}
void test_strcat__n_basic(void) {
char destbuf[9] = "hi";
char expectbuf[9] = "hilarity";
strncat(destbuf, "lari... |
UTTON_ID_BACK raw handler");
return;
}
ClickManager *mgr = prv_get_current_click_manager();
ClickConfig *cfg = &mgr->recognizers[button_id].config;
cfg->raw.up_handler = up_handler;
cfg->raw.down_handler = down_handler;
cfg->raw.context = context;
}
ClickConfigProvider window_get_click_config_provider... | (&window->layer) | ;
}
bool window_get_fullscreen(const Window *window) {
return window->is_fullscreen;
}
void window_set_status_bar_icon(Window *window, const GBitmap *icon) {
return;
}
bool window_is_on_screen(Window *window) {
return (window->on_screen);
}
bool window_is_loaded(Window *window) {
return (window->is_loaded);... |
1016, 248, -40},
// 34 seconds
{ 1200, 176, 8},
{ 1192, 184, -136},
{ 1080, 152, -184},
{ 1248, 88, -128},
{ 1288, 112, -112},
{ 1160, 144, -272},
{ 1304, 168, -352},
{ 1160, 200, -320},
{ 880, 208, -192},
{ 808, 280, -176},
{ 864, 328, -80},
{ 936, 360, -104},
{ ... | { 960, 200, -264},
{ 1176, 136, -160},
{ 1312, 256, -96},
{ 1328, 256, -200},
{ 1368, 272, -96},
{ 1288, 288, -168},
{ 944, 280, -200},
{ 856, 328, -200},
{ 936, 368, -96},
{ 1056, 344, -216},
{ 1096, 376, -248},
{ 1064, 416, -192},
// 40 seconds
{ 1432, 576, -96}... |
{ 1544, 208, 184},
{ 1160, 712, 408},
{ 1184, 1072, -136},
{ 1104, 672, -160},
{ 1024, 520, -96},
{ 1184, 528, -40},
{ 1536, 576, 40},
{ 1448, 312, 136},
{ 1280, 24, 120},
{ 1072, -40, 56},
{ 1032, 104, 0},
{ 1024, 184, -24},
{ 936, 256, -32},
{ 1024, 192, 40},
... |
/*
* 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... | stub_new_timer_fire(get_reminder_timer_id()) | |
is number of modulus is a hack! See PBL-39903
#if SUPPORT_MONTH
prv_do_conversion(state, value, SECONDS_PER_DAY, 30, s_day_strings,
add_units, zero_pad, modulus);
#else
prv_do_conversion(state, value, SECONDS_PER_DAY, 0, s_day_strings,
add_units, zero_pad, mod... | if (predicate_cond == cond_to_valid) {
wait_time++;
} |
} else {
wait_time = INT_MAX;
}
if (state->eval_cond) {
if (wait_time < state->eval_cond->eval_time) {
state->eval_cond->eval_time = wait_time;
}
}
// Only characters possible here are :,)
if (*state->position == ':') {
state->position++;
}
return match;
}
static void prv_forma... |
/*
* 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... | fake_gap_le_connect_params_get_last_requested() | , ResponseTimeInvalid);
prv_regular_timer_spend_seconds(BT_CONN_MGR_INACTIVITY_TIMEOUT_SECS);
state = conn_mgr_get_latency_for_le_connection(&s_hdl, &secs_to_wait);
cl_assert_equal_i(state, ResponseTimeMiddle);
cl_assert_equal_i(secs_to_wait, 30 - BT_CONN_MGR_INACTIVITY_TIMEOUT_SECS);
cl_assert_equal_i(fake... |
{
menu_layer->highlight_colors[MenuLayerColorBackground] = background;
menu_layer->highlight_colors[MenuLayerColorForeground] = foreground;
} |
bool menu_layer_get_center_focused(MenuLayer *menu_layer) {
return menu_layer->center_focused;
}
void menu_layer_set_center_focused(MenuLayer *menu_layer, bool center_focused) {
if (!menu_layer) {
return;
}
prv_set_center_focused(menu_layer, center_focused);
menu_layer_update_caches(menu_layer);
}
| |
{ 0 };
// Allocate immutable types
bool success = false;
const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, (char[]) { 0x10, 0x0 });
cl_assert(success);
const TextBoxParams text_box_params = (TextBoxParams) {
.utf8_bounds = &utf8_bounds,
};
// Init mutable types
word_iter_init(&word_iter, &... | (&word_iter) | );
cl_assert(*word_iter_state.current.start == 'o');
cl_assert(*word_iter_state.current.end == '\n');
cl_assert(iter_next(&word_iter));
cl_assert(*word_iter_state.current.start == '\n');
cl_assert(*word_iter_state.current.end == '\0');
cl_assert(!iter_next(&word_iter));
}
|
/*
* 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... | ((Uuid *)key) | |
/*
* 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... | (QUADSPI, dev->clock_ctrl) | ;
}
}
static void prv_set_num_data_bytes(uint32_t length) {
// From the docs: QSPI_DataLength: Number of data to be retrieved, value+1.
// so 0 is 1 byte, so we substract 1 from the length. -1 is read the entire flash length.
PBL_ASSERTN(length > 0);
QSPI_SetDataLength(length - 1);
}
#if DEBUG_QSPI_WAITS
#... |
/*
* 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_worker_send_message(1 /*type*/, &battery_data) | ;
}
// -----------------------------------------------------------------------------------------------
static void connection_handler(bool connected) {
APP_LOG(APP_LOG_LEVEL_INFO, "got phone connection update");
APP_LOG(APP_LOG_LEVEL_INFO, "connected: %d", connected);
}
// --------------------------------------... |
while (*result_string != '\0') {
if (*result_string != ' ' &&
*result_string != '\n') {
break;
}
result_string++;
} |
return result_string;
}
void string_strip_trailing_whitespace(const char *string, char *string_out) {
int string_len = strlen(string);
bool trim = true;
for (int i = string_len; i >= 0; i--) {
if (trim &&
(string[i] == ' ' || string[i] == '\n' || string[i] == '\0')) {
string_out[i] = '\0';
... | |
w_rect_stroked(GContext *ctx, const GRect *rect, uint8_t stroke_width) {
const GPoint tl = GPoint(rect->origin.x, rect->origin.y);
const GPoint tr = GPoint(rect->origin.x + rect->size.w - 1, rect->origin.y);
const GPoint bl = GPoint(rect->origin.x, rect->origin.y + rect->size.h - 1);
const GPoint br = GPoint(re... | (ctx, tr, radius, GCornerTopRight) | ;
graphics_circle_quadrant_draw(ctx, br, radius, GCornerBottomRight);
}
#if PBL_COLOR
T_STATIC void prv_draw_round_rect_aa(GContext* ctx, const GRect *rect, uint16_t radius) {
// Assumes AA and stroke_width is set appropriately in ctx
prv_draw_round_rect(ctx, rect, radius);
}
T_STATIC void prv_draw_round_rect_a... |
ected_text_height = 24;
// magic numbers measured from design spec
const int16_t distance_column_x_offset = 0;
const int16_t distance_column_width = PBL_IF_ROUND_ELSE(63, background_width);
const int16_t back_value_y_offset = STATUS_BAR_LAYER_HEIGHT + PBL_IF_ROUND_ELSE(24, 0);
const int16_t mid_value_y_offse... | i18n_get("Disconnected", data) | , GTextAlignmentCenter);
layer_add_child(window_layer, text_layer_get_layer(data->disconnected_text));
layer_set_hidden(text_layer_get_layer(data->disconnected_text), true);
// Sync setup:
Tuplet initial_values[] = {
TupletCString(GOLF_PAR_KEY, "0"),
TupletCString(GOLF_HOLE_KEY, "0"),
TupletCString... |
, -80, -216},
{ 936, -80, -200},
{ 944, -64, -264},
{ 960, -120, -264},
{ 920, -136, -264},
{ 944, -112, -256},
{ 976, -72, -280},
{ 1016, -64, -264},
// 64 seconds
{ 1040, -48, -224},
{ 1184, -16, -192},
{ 1568, -16, -232},
{ 1384, -40, -256},
{ 904, -64, -280},
... | { 1104, -152, -168},
{ 1360, -168, -200},
{ 1336, -168, -248},
{ 1176, -120, -184},
{ 920, -56, -120},
{ 1048, 32, -176},
{ 1272, 0, -88},
{ 1232, -56, 0},
{ 1080, -96, 16},
{ 1024, -112, -8},
{ 1008, -80, -24},
{ 960, -80, -8},
{ 912, -104, 0},
{ 912, -104, -8},
... |
{ 1160, -96, -224},
{ 1216, -104, -184},
{ 1528, -80, -272},
{ 1376, -88, -208},
// 72 seconds
{ 1056, -72, -152},
{ 832, -16, -144},
{ 1136, 8, -184},
{ 1320, -72, -56},
{ 1232, -104, 40},
{ 1136, -56, 0},
{ 1072, -80, 32},
{ 1024, -64, 48},
{ 1000, -32, 24},
... |
arm_set_snooze_alarm();
cl_assert_equal_i(s_snooze_timer_timeout_ms, 10 * 1000);
cl_assert_equal_i(s_num_alarm_events_put, 0);
s_current_minute = 10;
cl_assert_equal_i(s_num_alarm_events_put, 1);
}
void test_alarm__get_string_for_kind(void) {
bool all_caps = false;
cl_assert_equal_s(alarm_get_string_for_ki... | (s_num_timeline_adds , 3) | ;
s_current_hour = 10;
s_current_minute = 30;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 1);
}
void test_alarm__recurring_daily_alarm_timeout_behind(void) {
AlarmId id;
s_current_hour = 11;
s_current_minute = 30;
id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALAR... |
bool s_in_use = false;
PebbleMutex *s_notification_window_mutex;
static bool prv_should_provide_action_menu_for_item(NotificationWindowData *data,
const TimelineItem *item);
static void prv_handle_notification_removed_common(Uuid *, NotificationType);
static bool ... | {
return -1;
} |
}
static void prv_notification_window_add_notification(Uuid *id, NotificationType type) {
if (do_not_disturb_is_active()) {
notifications_presented_list_add_sorted(id, type, prv_reminders_on_top_comparator, false);
} else {
notifications_presented_list_add(id, type);
}
}
static void prv_reload_swap_lay... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return;
} | |
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_offset_layer_aa.${BIT_DEPTH_NAME}.pbi"));
// TODO: Fix offset calculation and reenable this: - PBL-16509
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 10);
graphics_line_draw_precise_stroked_aa(&ctx, END_ON_ORIGIN_RECT... | (&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 10) | |
/*
* 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... | {
prompt_send_response("ERROR");
} |
}
void command_disp_offset_read(void) {
char buffer[16];
prompt_send_response_fmt(buffer, sizeof(buffer), "X: %"PRId16" Y: %"PRId16,
mfg_info_get_disp_offsets().x,
mfg_info_get_disp_offsets().y);
}
void command_disp_offset_write(const char* offset_x_str, cons... |
kPayload *chunk = (PostMessageChunkPayload *)buffer;
*chunk = (PostMessageChunkPayload) {
.total_size_bytes = expected_json_size,
.is_first = true,
};
memcpy(chunk->chunk_data, expected_json, expected_json_size);
EXPECT_OUTBOX_MESSAGE_PENDING(TupletBytes(PostMessageKeyChunk,
... | (chunk->chunk_data, expected_json + payload_offset, TINY_CHUNK_SIZE) | |
ct {
AppInstallId new_worker_id;
bool set_as_default;
ConfirmationDialog *confirmation_dialog;
} SwitchWorkerUIArgs;
static bool s_is_on_screen = false;
static void prv_click_confirm_decline_callback(ClickRecognizerRef recognizer, void *context) {
// TODO: Currently set_as_default does nothing. This will be... | confirmation_dialog_get_action_bar(confirmation_dialog) | ;
action_bar_layer_set_context(action_bar, args);
confirmation_dialog_push(confirmation_dialog, window_stack);
}
|
e if (strcmp(token, "TEST_NAME") == 0) {
sscanf(token + strlen(token) + 1, "%s", state->test_entry.name);
}
}
// If this is a "static AccelRawData samples[] = {" line, skip it
if (strcmp(token, "static") == 0) {
continue;
}
// Grab a sample
if (strcmp(token, "{") == 0) {
... | sscanf(token + strlen(token) + 1, "%d", &state->test_entry.end_at.value) | ;
} else if (strcmp(token, "TEST_END_AT_MIN") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.end_at.min);
} else if (strcmp(token, "TEST_END_AT_MAX") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.end_at.max);
} else if (strcmp(token, "TEST_CUR... |
code",
"Exception while Evaluating JS",
"SyntaxError: Identifier expected. [line: 1, column: 12]",
NULL };
rocky_event_loop_with_string_or_snapshot(script, sizeof(script));
cl_assert(*s_log_internal__expected == NULL);
}
AppTimer *rocky_timer_get_app_timer(void *data);
void test_js__init_deinit(void)... | (true, jerry_value_is_undefined(print_builtin)) | ;
}
void test_js__sin_cos(void) {
EXECUTE_SCRIPT(
"var s1 = 100 + 50 * Math.sin(0);\n"
"var s2 = 100 + 50 * Math.sin(2 * Math.PI);\n"
"var c1 = 100 + 50 * Math.cos(0);\n"
"var c2 = 100 + 50 * Math.cos(2 * Math.PI);\n"
);
cl_assert_equal_i(100, (int32_t)jerry_get_number_value(prv_js_global_get_val... |
l_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_aa_swX_clear.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_draw_circle_${BIT_DEPTH_NAME}__arc_stroked(void){
GContext ctx;
test_graphics_context_init(&ctx, fb);
// Letter C
uint32_t angle_end = TRIG_MAX_ANGLE + (TRIG_MAX_ANGLE / 8);
uint32_t angle_st... | for (int r = 1; r <= 7; r++) {
graphics_context_set_stroke_width(&ctx, stroke_width);
graphics_draw_arc_internal(&ctx, pt, radius, test_angles[i].angle, TRIG_MAX_ANGLE);
stroke_width += 1;
radius += 3;
pt.x += (radius + stroke_width) * 2;
if (pt.x > 120) {
pt.x = CENTER_OF_O... |
char filename[100];
snprintf(filename, sizeof(filename),
"draw_arc_offset_aa_start_angle_%s.${BIT_DEPTH_NAME}.pbi", test_angles[i].filename_part);
cl_check_(gbitmap_pbi_eq(&ctx.dest_bitmap, filename), filename);
}
// Additional 90° end_angle unit tests:
angle_start = TO_TRIG(45);
ang... |
/*
* 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... | (response, sizeof(response)) | ;
}
static void prv_send_fail_response(void) {
const uint8_t error_response = 0xff;
prv_send_response(&error_response, sizeof(error_response));
}
void factory_registry_protocol_msg_callback(CommSession *session, const uint8_t* data, size_t length_bytes) {
// Expected message is 0x0 (Read), 0x09 (Length of key),... |
prv_pref_set(PREF_KEY_LANG_ENGLISH, &english, sizeof(english));
}
void shell_prefs_toggle_language_english(void) {
shell_prefs_set_language_english(!shell_prefs_get_language_english());
}
#if CAPABILITY_HAS_HEALTH_TRACKING
static void prv_activity_pref_set(void) {
prv_pref_set(PREF_KEY_ACTIVITY_PREFERENCES, &s_... | {
return s_activity_hr_preferences.max_hr;
} |
uint8_t activity_prefs_heart_get_zone1_threshold(void) {
return s_activity_hr_preferences.zone1_threshold;
}
uint8_t activity_prefs_heart_get_zone2_threshold(void) {
return s_activity_hr_preferences.zone2_threshold;
}
uint8_t activity_prefs_heart_get_zone3_threshold(void) {
return s_activity_hr_preferences.zo... |
/*
* 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... | (buffer, "/tmp", length) | |
rce, install_id);
break;
case APP_DB_CLEARED:
prv_do_app_db_cleared(source);
break;
default:
break;
}
kernel_free(install_data);
}
void prv_send_callback_to_app(AppMenuDataSource *data_source, AppInstallId install_id,
InstallEventType event_type) {
I... | (node->icon == NULL) | ;
if (node->icon_resource_id != RESOURCE_ID_INVALID) {
// If we have some sort of valid resource_id, try loading it
node->icon = gbitmap_create_with_resource_system(node->app_num, node->icon_resource_id);
}
if (!node->icon) {
// If we failed to load the app's icon or it didn't have one, use the defa... |
/*
* 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... | hw_gpio_get_pin_status(HOST_SPI->spi.cs.port, HOST_SPI->spi.cs.pin) | );
}
// TODO: Can we avoid re-configuring every time? We might be missing a trigger if it happens
// before this reconfiguring is completed... :(
// Dialog Aart: "Unfortunately it is not possible to program an I/O pin with both functions as
// Wake-up and SPI (or other). Either toggle between the 2 functions or define... |
DAY) + (1 * SECONDS_PER_HOUR));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("Jun 9, 12:00 PM", time_buf);
}
void test_clock__time_past_twenty_four_hour_relative(void) {
char time_buf[64];
const int jun10th_noon_2015 = 1433937600;
prv_clock_... | (event_time - (1 * SECONDS_PER_MINUTE)) | ;
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("IN 1 MIN", time_buf);
// June 9th 2015, 15:58:00 (T-00:02:00)
rtc_set_time(event_time - (2 * SECONDS_PER_MINUTE));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELA... |
/*
* 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... | _Static_assert(DIALOG_SPI_DMA_PRIORITY < EXTI_PRIORITY, "Dialog SPI DMA priority too low!") | |
care about the rest
}
};
static TimelineItem item2 = {
.header = {
.id = {0x55, 0xcb, 0x7c, 0x75, 0x8a, 0x35, 0x44, 0x87,
0x90, 0xa4, 0x91, 0x3f, 0x1f, 0xa6, 0x76, 0x01},
.parent_id = {0xff, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e,
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0x01},... | (pin_db_read_item_header(&item, &item1.header.id)) | ;
cl_assert_equal_i(item.header.status, TimelineItemStatusDismissed);
}
|
/*
* 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... | {
// third side of triangle based on pythagorean theorem
return integer_sqrt(ABS(((uint32_t)hypotenuse * hypotenuse) - ((uint32_t)side * side)));
} |
T_STATIC GRangeHorizontal perimeter_for_circle(GRangeVertical vertical_range, GPoint center,
int32_t radius) {
radius = MAX(0, radius);
int32_t height = 0;
int32_t width = 0;
const int32_t top = center.y - radius;
const int32_t bottom = center.y + radius;
int32_t ra... |
, 128, -904},
// 220 seconds
{ -80, 472, -704},
{ -304, 864, -536},
{ -264, 968, -680},
{ -184, 1016, -552},
{ -328, 744, -464},
{ -368, 480, -808},
{ -224, 648, -784},
{ -264, 528, -768},
{ -48, 480, -944},
{ 24, 488, -840},
{ -80, 568, -744},
{ 24, 696, -808},
{... | { -104, 936, -8},
{ -104, 928, -16},
{ -104, 928, -16},
{ -104, 936, -16},
{ -104, 936, -16},
{ -104, 936, -8},
{ -104, 928, -16},
{ -104, 936, -8},
{ -104, 936, -16},
{ -96, 928, -8},
{ -104, 928, -16},
{ -104, 936, -16},
// 226 seconds
{ -112, 936, -16},
{ -... |
{ -104, 936, -16},
{ -96, 928, -16},
{ -96, 936, -16},
{ -104, 936, -8},
{ -104, 936, -16},
{ -96, 928, -16},
{ -104, 936, -24},
{ -96, 928, -16},
{ -96, 936, -16},
{ -104, 928, -16},
{ -104, 928, -8},
{ -96, 928, -16},
{ -104, 928, -16},
{ -96, 928, -8},
{ -... |
/*
* 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_m(buf1, buf2, attributes_actions_get_serialized_payload_size(s_expected_attributes, s_expected_actions)) | ;
s_performed_store = true;
return S_SUCCESS;
}
static uint32_t s_expected_uid = 0;
static bool s_performed_dismiss = false;
void ancs_perform_action(uint32_t notification_uid, uint8_t action_id) {
cl_assert_equal_i(notification_uid, s_expected_uid);
cl_assert_equal_i(action_id, ActionIDNegative);
s_perfo... |
NTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#undef PBL_LOGS_HASHED
#include "applib/app.h"
#include "applib/ui/ui.h"
#include "kernel/pbl_malloc.h"
#include "kernel/util/sleep.h"
#include "proc... | new_timer_stop(s_app_data->timer[i]) | ;
new_timer_delete(s_app_data->timer[i]);
s_app_data->timer[i] = TIMER_INVALID_ID;
}
}
if (s_app_data->app_timer != NULL) {
app_timer_cancel(s_app_data->app_timer);
s_app_data->app_timer = 0;
}
// Cancel and delete old regular timers if present
for (int i=0; i<NUM_MAX_TIMERS; i++) {
... |
m_logs + 2);
}
//! Keep simulating reboots and generating new logs. Confirm that
//! the most recent generations are not removed during reboots.
void test_flash_logging__generations(void) {
uint32_t tot_size, erase_size, page_size, page_hdr_size;
test_flash_logging_get_info(&tot_size, &erase_size, &page_size,
... | flash_logging_init() | ;
const int log_len = 49;
int num_logs = 0;
char **logs = generate_unique_logs(20222, log_len, &num_logs);
for (int i = 0; i < num_logs; i++) {
uint8_t write_sizes[4] = { log_len / 2, log_len / 4, log_len / 8, log_len };
int bytes_remaining = log_len;
uint32_t addr = flash_logging_log_start(log_l... |
int32_t*)data);
for(int bit = 0; bit < 32; ++bit) {
if ((crc & 0x80000000) != 0) {
crc = (crc << 1) ^ CRC_POLY;
} else {
crc = (crc << 1);
}
}
data += 4;
}
if (num_remainder_bytes) {
uint32_t last_word = 0;
for (unsigned int i = 0; i < num_remainder_bytes; ++i)... | layer_add_child(&s_data.window.layer, &s_data.log_layer.layer) | ;
start_logging();
comm_session_set_responsiveness(comm_session_get_system_session(), BtConsumerApp,
ResponseTimeMax, MAX_PERIOD_RUN_FOREVER);
}
////////////////////
// App boilerplate
static void s_main(void) {
handle_init();
app_event_loop();
handle_deinit();
}
const... |
py_device_name_with_fallback(remote, name);
if (is_connected && (0 == memcmp(addr, &active_addr, sizeof(*addr)))) {
remote->classic.connected = true;
} else {
remote->classic.connected = false;
}
add_remote(data, remote);
}
static void prv_add_bt_classic_remotes(SettingsBluetoothData *data) {
bt_p... | sniprintf(data->header_buffer, HEADER_BUFFER_SIZE,
(num_remotes != 1) ? i18n_get("%u Paired Phones", data) :
i18n_get("%u Paired Phone", data),
num_remotes) | ;
}
}
void settings_bluetooth_update_remotes(SettingsBluetoothData *data) {
settings_bluetooth_update_remotes_private(data);
settings_menu_reload_data(SettingsMenuItemBluetooth);
}
//////////
static void prv_settings_bluetooth_event_handler(PebbleEvent *event, void *context) {
SettingsBluetoothData* settings... |
{
uint16_t chunk;
const uint8_t *read_ptr;
shared_circular_buffer_read(buffer, client, bytes_left, &read_ptr, &chunk);
memcpy(data, read_ptr, chunk);
shared_circular_buffer_consume(buffer, client, chunk);
data += chunk;
bytes_left -= chunk;
} |
return (*length_out == length);
}
// -------------------------------------------------------------------------------------------------
void shared_circular_buffer_add_subsampled_client(
SharedCircularBuffer *buffer, SubsampledSharedCircularBufferClient *client,
uint16_t subsample_numerator, uint16_t subsa... | |
uint16_t wait_time = (timeout - curr_ticks) / RTC_TICKS_HZ;
*secs_to_wait = MAX(1, wait_time);
} else {
*secs_to_wait = 0;
}
}
return state;
}
/*
* LE connection manager handling for a gateway connection
*/
static void prv_bt_le_gateway_response_latency_watchdog_cb(void *data);
static void... | (curr_request) | ;
}
}
curr_request = next;
}
// Note: As an optimization, we could track how long we have been in a lower
// latency state and subtract that from higher latency requests, but most of
// the time we should be in the maximum latency (low power) state anyway
// get & set the new state
prv_handl... |
--------------------------------------------------------------------------------------
static void prv_assign_alarm(Alarm *alarm, CronJob *cron) {
cron_job_unschedule(&s_next_alarm_cron);
s_next_alarm_cron = *cron;
s_next_alarm_cron.cb_data = (void*)(intptr_t)alarm->id;
s_next_alarm = *alarm;
s_next_alarm_tim... | {
trigger = prv_should_smart_alarm_trigger(config);
if (!trigger) {
// Not triggering an event, increment to signify elapsed time and snooze
s_smart_snooze_counter++;
prv_snooze_alarm(SMART_ALARM_SNOOZE_DELAY_S);
return;
}
} |
if (trigger) {
prv_put_alarm_event();
// Alarm events are triggered for both the initial alarm time and subsequent user snoozes
// Ensure that we only record the first alarm time
if (!s_most_recent_alarm_recorded) {
s_most_recent_alarm_recorded = true;
// Read from flash since the in-memo... |
ng),
"%s, v%u", i18n_get_locale(), i18n_get_version());
info->subtitle_text[SystemInformationItemBtAddress] = info->bt_mac_addr;
info->subtitle_text[SystemInformationItemFirmware] = (char*)TINTIN_METADATA.version_tag;
info->subtitle_text[SystemInformationItemLanguage] = info->language_string;
... | if (is_selected) {
const GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_18);
GRect text_rect = rt_rect;
text_rect.size.h = fonts_get_font_height(font);
grect_align(&text_rect, &rt_rect, GAlignBottom, true /* clip */);
graphics_draw_text(ctx, text, font, text_rect, GTextOverflowModeFill, GTextAli... |
}
static void prv_draw_rt_cell(
GContext *ctx, const Layer *cell_layer, SystemCertificationData *cd,
bool is_selected, const void *arg1, const void *arg2) {
GBitmap *mark = (GBitmap *)arg1;
const char *text = arg2;
PBL_IF_RECT_ELSE(prv_draw_rt_cell_rect,
prv_draw_rt_cell_round)(ctx, c... |
) == 0) { \
*result = value; \
return true; \
}
HANDLE_CASE("left", GTextAlignmentLeft);
HANDLE_CASE("right", GTextAlignmentRight);
HANDLE_CASE("center", GTextAlignmentCenter);
// assuming left-to-right
HANDLE_CASE("start", GTextAlignmentLeft);
HANDLE_CASE("end", GTextAlignmentRight);
#u... | (
ROCKY_ARG(str_buffer),
) | ;
GContext *const ctx = rocky_api_graphics_get_gcontext();
const int16_t box_x = argc >= 2 ? (int16_t)jerry_get_int32_value(argv[1]) : 0;
const int16_t box_y = argc >= 3 ? (int16_t)jerry_get_int32_value(argv[2]) : 0;
const int16_t box_width = argc >= 4 ? (int16_t)jerry_get_int32_value(argv[3]) : INT16_MAX;
... |
orBlack, GColorClear, align, GTextOverflowModeFill);
layer_set_bounds(&text_layer->layer, &GRect(0, -y_offset,
rect->size.w, rect->size.h + y_offset));
}
static void prv_init_ui(Window *window) {
MusicAppData *data = window_get_user_data(window);
window_set_backgrou... | PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
progress_layer_set_foreground_color(&data->track_pos_bar,
PBL_IF_COLOR_ELSE(GColorRed, GColorBlack));
progress_layer_set_corner_radius(&data->track_pos_bar, config->track_corner_radius);
layer... |
static void prv_push_window(MusicAppData *data) {
Window *window = &data->window;
window_init(window, WINDOW_NAME("Music"));
window_set_user_data(window, data);
window_set_status_bar_icon(window, (GBitmap*)&s_status_icon_music_bitmap);
const bool animated = true;
app_window_stack_push(window, animated);
... |
se);
// Set clipper to the inverter layer in clipping box coordinates
GRect selection_clipper;
layer_get_global_frame(&menu_layer->inverter.layer, &selection_clipper);
grect_clip((GRect *const)&ctx->draw_state.clip_box, &selection_clipper);
// Render with highlight
prv_prepare_and_draw_row(ctx... | prv_menu_layer_get_num_sections(it->menu_layer) | ;
it->should_continue = true;
for (;;) { // sections
const uint16_t num_rows_in_section = prv_menu_layer_get_num_rows(it->menu_layer,
it->cursor.index.section);
for (;;) { // rows
if (it->cursor.index.row >= num_rows_in_section) {
// Reached last row
break;
}
if (i... |
S: {
break;
}
case PROGRESS_UI_SOURCE_FW_UPDATE: {
if (firmware_update_current_status() == FirmwareUpdateFailed) {
prv_handle_finished(data, false /* success */);
return;
} else if (firmware_update_current_status() == FirmwareUpdateStopped) {
prv_handle_finished(data, t... | (window, &(WindowHandlers){
.load = prv_window_load_handler,
.unload = prv_window_unload_handler,
}) | ;
app_window_stack_push(window, false);
}
static void prv_main(void) {
if (!app_manager_get_task_context()->args) {
PBL_LOG(LOG_LEVEL_WARNING, "Progress UI App must be launched with args");
return;
}
launcher_block_popups(true);
prv_progress_ui_window_push();
app_event_loop();
launcher_block_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.