prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
* limitations under the License.
*/
#include "data_logging_test.h"
#include "system/logging.h"
#include "services/common/comm_session/session.h"
#include "services/normal/data_logging/data_logging_service.h"
#include "services/normal/data_logging/dls_private.h"
#include "applib/app.h"
#include "applib/data_logging.... | (comm_session_get_system_session(), BtConsumerApp,
ResponseTimeMax, MAX_PERIOD_RUN_FOREVER) | ;
}
static void handle_init(void) {
dls_clear();
memset(&s_data, 0, sizeof(s_data));
// Init window
window_init(&s_data.window, "Logging Demo");
app_window_stack_push(&s_data.window, true /* Animated */);
window_set_click_config_provider_with_context(&s_data.window, click_config_provider,
... |
/*
* 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 (id == 0) {
prompt_send_response("invalid app number");
return;
} |
AppInstallEntry entry;
bool success = app_install_get_entry_for_install_id(id, &entry);
if (success) {
app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = id });
prompt_send_response("OK");
} else {
prompt_send_response("No app with id");
}
}
void command_worker_launch(const char ... |
/*
* 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... | simple_dialog_create("Stopped Sharing") | |
ed 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 "clar.h"
#include "applib/graphics/gdraw_command_private.h"
#include "applib/graphics/graphics.h"
#i... | cl_assert_equal_i(y, 255 + 255) | ;
}
void test_gdraw_command_transforms__int_scale_to_translate_overflow_neg(void) {
InterpolateInt64Function interp = prv_default_interpolate;
int y = prv_int_scale_and_translate_to(-255, 10, 10, 10, 0, -255, ANIMATION_NORMALIZED_MAX,
interp);
cl_assert_equal_i(y, -255 + ... |
/*
* 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... | (TEST_GATT_CONNECTION_ID) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return;
} |
// Data
/////////////////////////
static TimelineItem s_items[] = {
{
.header = { // [0]
.id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e,
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb1},
.parent_id = {0},
.timestamp = 1421178061, // Tue Jan 13 11:41:01 2015 PST
... |
false /* is_next */);
resource_init();
// Initialize peek
s_is_watchface_running = true;
timeline_peek_init();
}
void test_timeline_peek__cleanup(void) {
}
// Helpers
//////////////////////
static void prv_render_layer(Layer *layer, const GRect *box, bool use_screen) {
gbitmap_destroy(s_dest_b... | prv_render_timeline_peek(&(TimelinePeekItemConfig) {
.title = "NY 3 - SF 12",
.subtitle = "Bottom of the 9th",
.icon = TIMELINE_RESOURCE_TIMELINE_BASEBALL,
.num_concurrent = 1,
}) | ;
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
}
void test_timeline_peek__peek_concurrent_2(void) {
prv_render_timeline_peek(&(TimelinePeekItemConfig) {
.title = "Stock for party 🍺",
.subtitle = "Pebble Pad on Park",
.icon = TIMELINE_RESOURCE_NOTIFICATION_REMINDER,
.num_concurrent = 2,
... |
/*
* 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... | {
// The context for raw click events is overridable:
context = recognizer->config.raw.context;
} | else {
context = recognizer->config.context;
}
handler(recognizer, context);
}
if (needs_reset) {
prv_click_reset(recognizer);
}
return true;
} else {
return false;
}
}
inline static bool prv_is_hold_to_repeat_enabled(ClickRecognizer *recognizer) {
return (recogn... |
const int16_t current_flip_boundary_x = interpolate_int16(distance_normalized,
flip_boundary_from_x,
flip_boundary_to_x);
const GPoint circle_center = GPoint(current_flip_boundary_x - cir... | compositor_transition_app_to_app_should_be_skipped() | ) {
return NULL;
}
if (flip_to_the_right) {
static const CompositorTransition s_impl = {
.init = prv_round_flip_transition_to_launcher_animation_init,
.update = prv_round_flip_transition_animation_update,
};
return &s_impl;
} else {
static const CompositorTransition s_impl = {
... |
00, 0x00, 0x00, 0x00, 0x00, 0x00},
.timestamp = 10*60,
.duration = 10,
.type = TimelineItemTypePin,
.all_day = false,
.layout = LayoutIdCalendar,
},
.attr_list = {
.num_attributes = 1,
.attributes = &title_attr,
},
};
static TimelineItem item2 = {
.header = {
.id = {0x02, 0x00, ... | (fake_event_get_count(), 3) | ;
cl_assert(!prv_get_calendar_ongoing());
cl_assert(!stub_new_timer_is_scheduled(timer_id));
}
void test_calendar__init_with_ongoing_event(void) {
cl_assert(timeline_add(&item1));
timeline_event_handle_blobdb_event();
rtc_set_time(15 * 60);
timeline_event_init();
cl_assert_equal_i(fake_event_get_count()... |
t duration = prv_get_total_duration(state, child, true /*delay*/, true /*play_count*/);
// It is allowed that the first child may have already been scheduled and played a bit. If
// this is the case, backup the start time by reducing delay accordingly.
if (child_idx == 0 && child->abs_start_time_ms) ... | PBL_ASSERTN(animation->implementation->update != NULL) | ;
}
if (now != earliest_start_time) {
// This is a complex animation that has a child that was already scheduled. We must pretend that
// the top-level animation started at earliest_start_time. add_delay_ms may end up being
// negative here if the child already started.
animation->delay_ms = 0;
... |
TemplateStringVars vars = {};
TemplateStringError err = {};
TemplateStringEvalConditions cond = {};
vars.current_time = 0;
cond.eval_time = EVAL_FALL_THROUGH;
cond.force_eval_on_time = true;
memset(s_output, 'Z', sizeof(s_output));
bool ret = template_string_evaluate("test string {time_unt... | cl_assert_equal_b(s_state.filters_complete, false) | ;
cl_assert_equal_i(s_state.filter_state, -s_time_since_tests[i].done_state);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Test `format` filter
typedef struct FormatTestData {
const char *params;
intmax_t filter_state;
bool time_was_until;
... |
.variants = {
/// Sleep notification on wake up, slept similar to their typical sleep duration
i18n_noop("Good mornin’. You slept for %dH %dM. "
"Every good day begins with a solid night’s sleep..."
"kinda like that one 😉 Keep it up!"),
i18n_noop("Good mo... | sniprintf(ACTIVITY_SUMMARY_PIN_CONFIG.short_subtitle, SUBTITLE_BUFFER_LENGTH,
i18n_get("%u Steps", &ACTIVITY_SUMMARY_PIN_CONFIG), steps) | |
/*
* 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... | {
CD_ASSERTN(((start_addr & SUBSECTOR_ADDR_MASK) == start_addr) &&
((total_bytes & SUBSECTOR_ADDR_MASK) == total_bytes));
while (total_bytes > 0) {
watchdog_feed();
uint32_t erase_size = 0;
if (((start_addr & SECTOR_ADDR_MASK) == start_addr) &&
(total_bytes >= SECTOR_SIZE_BYTES)) ... |
uint32_t cd_flash_write_bytes(const void *buffer_ptr, uint32_t start_addr,
const uint32_t buffer_size) {
CD_ASSERTN(((start_addr + buffer_size) <= CORE_DUMP_FLASH_END) &&
(int)start_addr >= CORE_DUMP_FLASH_START);
const uint8_t *buffer = buffer_ptr;
uint32_t remaining = buff... |
----------------------------
//! Static, internal helper functions
static void prv_advert_job_unscheduled_callback(GAPLEAdvertisingJobRef job,
bool completed,
void *data) {
// bt_lock() is still held for us by gap_le_adver... | prv_is_advertising_for_reconnection() | ) {
// Already advertising for reconnection...
goto unlock;
}
if (gap_le_connect_is_connected_as_slave()) {
// Already connected as slave...
goto unlock;
}
if (!bt_persistent_storage_has_active_ble_gateway_bonding() &&
!bt_persistent_storage_has_ble_ancs_bonding()) {
... |
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 License is distributed on an "AS IS" B... | (PBL_IF_BW_ELSE(85, 83), 88) | ;
graphics_context_set_text_color(ctx, CURRENT_TEXT_COLOR);
graphics_draw_text(ctx, buffer, font,
GRect(0, y, base_layer->bounds.size.w, 35),
GTextOverflowModeFill, GTextAlignmentCenter, NULL);
}
static void prv_render_typical_steps(GContext *ctx, Layer *base_layer) {
He... |
/*
* 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... | regular_timer_remove_callback(&s_pairability_timer_info) | ;
bt_pairability_release_ble();
}
void bt_pairability_use_ble_for_period(uint16_t duration_secs) {
if (!regular_timer_is_scheduled(&s_pairability_timer_info)) {
// If this function is called multiple times before the timer is unscheduled, limit to calling
// "use" only once:
bt_pairability_use_ble();
... |
Window test_window;
TextLayer msg_text_layer[3];
TextLayer status_text_layer;
char status_text[STATUS_TEXT_SIZE];
FlashTestCaseType test_case;
uint8_t test_case_status;
};
/***********************************************************/
/******************* Window Related Functions **************/
/***********... | text_layer_set_text_alignment(msg_text_layer, GTextAlignmentCenter) | ;
text_layer_set_background_color(msg_text_layer, GColorBlack);
text_layer_set_text_color(msg_text_layer, GColorWhite);
text_layer_set_font(msg_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD));
layer_add_child(&window->layer, &msg_text_layer->layer);
TextLayer *status_text_layer = &data->status_te... |
if (activity_metrics_prv_steps_per_minute() >
s_sleep_summary_settings.summary.sleep.trigger_notif_activity) {
s_sleep_pin_state.active_minutes++;
}
// Check activity insights
if (activity_prefs_activity_insights_are_enabled()) {
prv_do_activity_reward(now_utc);
}
prv_do_activity_summary(no... | (file, ActivitySettingsKeyInsightActivitySummaryState,
&activity_pin_last_state, sizeof(activity_pin_last_state)) | |
2 * MIN_FRAME_INTERVAL_MS);
animation_destroy(a);
animation_destroy(b);
animation_destroy(c);
}
// --------------------------------------------------------------------------------------
// Test unscheduling animations arbitrarily in an update handler with auto destroy.
void test_animation__unschedule_all_in_upd... | animation_get_custom_curve(a) | , NULL);
cl_assert_equal_p(animation_get_custom_interpolation(a), NULL);
cl_assert_equal_i(animation_get_curve(a), AnimationCurveDefault);
animation_destroy(a);
}
void test_animation__current_interpolate_override(void) {
// just some pointer to compare against
AnimationCurveFunction curve = (void*)1;
Inte... |
_get(fmt, body), hours, minutes, ABS(percentage));
i18n_free_all(body);
const NotificationConfig config = {
.notif_time = notif_time,
.insight_type = ActivityInsightType_SleepSummary,
.icon_id = TIMELINE_RESOURCE_SLEEP,
.body = body,
.open_app = {
.enabled = true,
.health_card_type ... | if (activity_prefs_activity_insights_are_enabled() &&
(minute_of_day == s_activity_summary_settings.summary.activity.trigger_minute) &&
s_activity_summary_settings.summary.activity.show_notification) {
prv_push_activity_summary_notification(pin_time_utc, steps, total_steps_avg, VARIANT_RANDOM);
... |
}
}
// ------------------------------------------------------------------------------------------------
static const char* prv_get_intro_str_for_activity(ActivitySession *session) {
switch (session->type) {
case ActivitySessionType_Walk: {
static const InsightCopyVariants s_walking_intros = {
.n... |
seconds
{ 872, 88, 168},
{ 760, 104, 120},
{ 712, 56, 96},
{ 712, 32, 40},
{ 712, -48, 56},
{ 824, -72, 40},
{ 1080, -104, 32},
{ 1136, -80, 40},
{ 1680, -160, 128},
{ 1352, 40, 56},
{ 1168, 352, -208},
{ 1168, 256, -176},
{ 896, 208, 0},
{ 680, 104, -8},
{ 7... | { 800, 128, 8},
{ 848, 216, 96},
{ 896, 408, 96},
{ 744, 296, 0},
// 95 seconds
{ 864, 328, -64},
{ 984, 304, -144},
{ 1128, 296, -136},
{ 1280, 272, -40},
{ 1920, 304, 72},
{ 1416, 424, 8},
{ 840, 328, -16},
{ 968, 224, 88},
{ 1136, 152, 168},
{ 912, 104, 232... |
{ 704, 32, 24},
{ 784, -8, 64},
{ 936, -64, 64},
{ 1048, -32, 24},
{ 1384, -168, 208},
{ 1704, 8, 256},
{ 1224, 368, -72},
{ 992, 312, -184},
// 98 seconds
{ 968, 280, 8},
{ 776, 24, 144},
{ 760, 136, 88},
{ 784, 200, 120},
{ 848, 352, 8},
{ 784, 272, 24},
... |
p.h"
#include "process_management/pebble_process_md.h"
#include "process_management/pebble_process_md.h"
#include "process_state/app_state/app_state.h"
#include "services/common/new_timer/new_timer.h"
#include "services/common/system_task.h"
#include "system/logging.h"
#include "system/passert.h"
#include "FreeRTOSCon... | NVIC_EnableIRQ(OTG_FS_WKUP_IRQn) | |
/*
* 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... | fonts_get_font_height(dialog_text_font) | ;
const int max_text_line_height_px = 2 * single_line_text_height_px + 8;
const uint16_t status_layer_offset = dialog->show_status_layer ? 6 : 0;
uint16_t text_top_margin_px = icon ? icon_size.h + 22 : 6;
uint16_t subtext_top_margin_px = text_top_margin_px + single_line_text_height_px;
uint16_t icon_top_marg... |
) {
return ((uint32_t)page * PFS_PAGE_SIZE);
}
static void prv_flash_read(void *buffer, uint32_t size, uint32_t offset) {
if ((offset + size) <= s_pfs_size) {
ftl_read(buffer, size, offset);
} else {
PBL_LOG(LOG_LEVEL_ERROR, "FS read out of bounds 0x%x", (int)offset);
}
}
// Invalidates s_pfs_page_fla... | prv_page_to_flash_offset(start_page) | |
ectedValue *exp, ActualValue *act,
float weight, bool *all_passed) {
int error = 0;
float weighted_error = 0.0;
if (exp->value != -1) {
error = abs(act->value - exp->value);
weighted_error = (float)error * weight;
act->passed = (act->value >= exp->min && act->valu... | (session->start_utc) | |
}
static void prv_push_alarms_app_opened_dialog(AlarmsAppData *data) {
const char *first_use_text = i18n_get(
"Let us wake you in your lightest sleep so you're fully refreshed! "
"Smart Alarm wakes you up to 30min before your alarm.", data);
const char *header = i18n_get("Smart Alarm", data);
Expand... | {
prv_push_alarms_app_opened_dialog(data);
} |
alarm_prefs_set_alarms_app_opened(CURRENT_ALARMS_APP_VERSION);
#endif
}
static void prv_handle_deinit(void) {
AlarmsAppData *data = app_state_get_user_data();
status_bar_layer_deinit(&data->status_layer);
menu_layer_deinit(&data->menu_layer);
i18n_free_all(data);
prv_clear_alarm_list(data);
event_servic... |
8},
{ 776, 472, 40},
// 13 seconds
{ 912, 432, 80},
{ 1208, 392, 128},
{ 1328, 304, 128},
{ 1248, 152, 160},
{ 1216, 16, 128},
{ 1184, -16, 64},
{ 1056, 56, 24},
{ 952, 104, 0},
{ 968, 96, 24},
{ 1224, 112, 56},
{ 1168, 96, 40},
{ 1120, 56, 40},
{ 1264, 24, -2... | { 1440, 352, 272},
{ 2032, 480, 128},
{ 1992, 256, 80},
{ 1632, 16, 240},
{ 1240, -24, 160},
{ 928, -40, 24},
{ 816, 40, -80},
{ 792, 56, -104},
{ 800, 40, -8},
{ 1024, 16, 96},
// 19 seconds
{ 928, 16, 72},
{ 1040, 0, -56},
{ 1368, 112, -104},
{ 1424, 280, -2... |
{ 1288, 40, -40},
{ 1328, 256, -336},
{ 1264, 152, -168},
{ 1232, -32, -16},
{ 944, -8, -40},
{ 856, 96, -104},
{ 920, 208, -24},
{ 992, 264, 112},
{ 952, 320, 16},
{ 960, 320, -160},
{ 1304, 352, -104},
{ 1576, 552, -16},
{ 896, 688, 48},
{ 1120, 376, 0},
{ ... |
= GColorBlack,
.mode = StatusBarLayerModeClock,
};
GRect frame = window->layer.frame;
// window.frame.origin.y is 0 already (for 2.x compatibility reasons)
// see prv_adjust_drawing_state_for_legacy2_apps()
// so all we need to alter is the height of the frame
frame.size.h = STATUS_BAR_... | {
return;
} |
window->overrides_back_button = overrides_back_button;
}
static ClickManager* prv_get_current_click_manager(void) {
return window_manager_get_window_click_manager(window_manager_get_top_window());
}
static void prv_call_click_provider(Window *window) {
window->is_waiting_for_click_config = false;
app_click_c... |
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 License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CO... | PBL_IF_RECT_ELSE(0, STATUS_BAR_LAYER_HEIGHT) | ,
.right = PBL_IF_RECT_ELSE(0, crumbs_width),
.bottom = PBL_IF_RECT_ELSE(0, STATUS_BAR_LAYER_HEIGHT),
.left = crumbs_width,
};
}
static Animation* prv_create_content_in_animation(ActionMenuData *data,
const ActionMenuLevel *level) {
// animate the ease in of the new level
const GRect win... |
ed instead
return false;
}
typedef enum {
ToStringFormatUnsupported = 1 << 0,
ToStringFormatLocaleTime = 1 << 1,
ToStringFormatSecondNumeric = 1 << 2,
ToStringFormatSecond2Digit = 1 << 3,
ToStringFormatMinuteNumeric = 1 << 4,
ToStringFormatMinute2Digit = 1 << 5,
ToStringFormatHourNumeric = 1 << 6,
To... | {
// skip option values that are irrelevant
continue;
} |
if (rocky_str_equal(option_values[i].field, option_values[i].value)) {
result = option_values[i].format;
found_options++;
}
if (found_options > 1) {
// today, we don't support combinations of several options, it's either none or one
return ToStringFormatUnsupported;
}
}
ret... |
, 32},
{ -896, 472, 120},
// 81 seconds
{ -1096, 656, -8},
{ -1216, 424, 144},
{ -1528, 760, -64},
{ -1136, 472, 40},
{ -992, 648, 8},
{ -1040, 512, 88},
{ -888, 344, 264},
{ -592, 336, 136},
{ -408, 280, 136},
{ -448, 240, 152},
{ -512, 216, 184},
{ -664, 248, 15... | { -784, 456, 120},
{ -976, 600, -16},
{ -1088, 576, 64},
{ -1312, 696, 24},
{ -1272, 768, -152},
{ -1256, 656, 24},
{ -1272, 456, 8},
{ -1088, 488, 128},
{ -624, 352, 64},
{ -400, 376, 96},
{ -376, 280, 192},
{ -424, 336, 176},
{ -456, 288, 272},
// 87 seconds
... |
{ -488, 320, 64},
{ -512, 200, 112},
{ -608, 288, 168},
{ -616, 152, 120},
{ -736, 240, 88},
{ -1008, 416, 112},
{ -1088, -128, 80},
{ -1360, 248, -16},
{ -1360, 120, 0},
{ -1232, 456, -40},
{ -1008, 264, -56},
{ -936, 208, -48},
{ -688, 296, -96},
{ -472, 272, -... |
_push_pin(item, existing_uuid);
}
// ------------------------------------------------------------------------------------------------
// Pushes a new reward notification and saves the trigger time to flash
static void prv_push_reward(time_t now_utc, const RewardNotifConfig *notif_config) {
prv_push_reward_notificati... | {
if (history[i] < target) {
INSIGHTS_LOG_DEBUG("History validation failed - not above target on day %"PRIu32
": %"PRIi32, i, history[i]);
return false;
}
} |
return true;
}
// ------------------------------------------------------------------------------------------------
static TimelineItem *prv_create_day_1_insight(time_t notif_time) {
if (activity_prefs_get_health_app_opened_version() != 0) {
// The user already knows about the Health app
return 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... | GPIO_PinAFConfig(af_config.gpio, af_config.gpio_pin_source,
af_config.gpio_af) | ;
gpio_release(af_config.gpio);
}
|
CResponse) * num_entries);
}
static void prv_handle_flash_finalize_request(const void *payload, uint32_t length) {
if (length != sizeof(FlashFinalizeRequest)) {
PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length);
return;
}
const FlashFinalizeRequest *request = payload;
FlashFinalizeRespon... | if (s_buffers[i].is_free) {
s_buffers[i].is_free = false;
s_curr_buf = &s_buffers[i];
break;
} |
}
if (!s_curr_buf) {
// no available buffer :(
if (!has_no_buffer) {
s_no_buffer_count++;
}
has_no_buffer = true;
s_dropped_char_count++;
return false;
}
}
has_no_buffer = false;
return prv_handle_data((uint8_t)c);
}
// Other exported functions
/////////... |
/*
* 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... | timezone_database_load_region_name(i, cursor) | ;
prv_format_region_name(cursor);
// Split 'Continent/City' into the two parts
const int sep_pos = strcspn(cursor, "/");
cursor[sep_pos] = '\0';
// Store pointer to region name
region_names[i] = cursor + sep_pos + 1;
// If the continent is the same as the last entry, keep going as-is
if ... |
;
}
// ---------------------------------------------------------------------------------------
// Open the app, start a workout, 120s, stop the workout, 20 min, close app.
// Make sure the HR turns off right after we leave the app.
void test_workout_service__app_open_wait_close_valid_workout(void) {
// Put some time... | (hr_zone_time_s[HRZone_Zone3], 10) | ;
prv_inc_time(10);
prv_put_bpm_event(ZONE_1_HR, HRMQuality_Good);
cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s));
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 10);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 20);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 10);
cl... |
turn timeline_layer->relbar_layer.prev_rel_bar.anim_offset;
}
static void prv_curr_rel_bar_setter(void *context, int16_t value) {
TimelineLayer *timeline_layer = context;
timeline_layer->relbar_layer.curr_rel_bar.anim_offset = value;
layer_mark_dirty(&timeline_layer->layer);
}
static int16_t prv_curr_rel_bar_ge... | property_animation_create(
&prev_implementation, layer, &prev_from_rel_bar_value, &prev_to_rel_bar_value) | ;
} else if ((layer->relbar_layer.prev_rel_bar.rel_bar_type == RelationshipBarTypeBackToBack) ||
(layer->relbar_layer.prev_rel_bar.rel_bar_type == RelationshipBarTypeFreeTime)) {
layer->relbar_layer.prev_rel_bar.anim_offset = REL_BAR_PREV_ANIM_OFFSET;
prev_from_rel_bar_value = REL_BAR_PREV_ANIM_O... |
layer_render_tree(&layer, &ctx) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_inside_offset_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_x_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_x_offset_lay... | |
roll_layer);
content_indicator_configure_direction(
indicator, ContentIndicatorDirectionUp,
&(ContentIndicatorConfig) {
.layer = &expandable_dialog->dialog.status_layer.layer,
.times_out = true,
.colors.foreground = dialog->text_color,
.colors.ba... | (expandable_dialog) | ;
dialog_set_icon(dialog, icon);
dialog_set_text(dialog, text);
dialog_set_background_color(dialog, background_color);
dialog_set_text_color(dialog, gcolor_legible_over(background_color));
dialog_set_callbacks(dialog, callbacks, dialog);
}
return expandable_dialog;
}
void expandable_dialog_show... |
'\0';
}
bool pulse_is_started(void) {
return true;
}
void rtc_get_time_ms(time_t* out_seconds, uint16_t* out_ms) {
*out_seconds = 0;
*out_ms = 0;
}
void vPortEnterCritical(void) {
}
void vPortExitCritical(void) {
}
bool s_in_critical_section;
bool vPortInCritical(void) {
return s_in_critical_section;
}
B... | cl_assert_equal_i(s_num_packets_sent, 0) | ;
pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTestB");
cl_assert_equal_i(s_num_event_puts, 1);
cl_assert_equal_i(s_num_packets_sent, 0);
pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTestC");
cl_assert_equal_i(s_num_event_puts, 1);
cl_ass... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | task_zalloc(contact_len) | ;
if (!*contact_out) {
prv_close_file_and_unlock_mutex();
return 0;
}
rv = settings_file_get(&s_contacts_db.settings_file, (uint8_t *)uuid, UUID_SIZE,
(void *) *contact_out, contact_len);
prv_close_file_and_unlock_mutex();
if (rv != S_SUCCESS) {
task_free(*contact_out);
... |
/*
* 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_get_user_data(layer->window) | ;
GfxTest *test = app_data->current_test;
srand(RAND_SEED); // Setup rand for routines that need it
if (test->setup) {
test->setup(layer->window);
}
PROFILER_INIT;
PROFILER_START;
while (PROFILER_NODE_GET_TOTAL_US(gfx_test_update_proc) < (test->duration * US_PER_S)) {
PROFILER_NODE_START(gfx_te... |
/*
* 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... | new_timer_start(s_toggle_timer, 3000, prv_low_power_toggle_timer_callback,
NULL, 0 /*flags*/) | ;
// FIXME PBL-XXXXX: This should be in a shell/prf/battery_ui_fsm.c
#if RECOVERY_FW
if (active) {
app_manager_launch_new_app(&(AppLaunchConfig) {
.md = prf_low_power_app_get_info(),
});
} else {
// In MFG mode, disable low power mode above but don't close the app.
if (mfg_is_mfg_mode()) {
... |
_i(basic_cell_height, l.selection.y);
const int y_center_of_row_1 = basic_cell_height + basic_cell_height / 2;
const int row1_vertically_centered = height / 2 - y_center_of_row_1;
cl_assert_equal_i(row1_vertically_centered, scroll_layer_get_content_offset(&l.scroll_layer).y);
}
void test_menu_layer__test_set_se... | (false, s_content_available[ContentIndicatorDirectionUp]) | ;
cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]);
}
void test_menu_layer__center_focused_respects_row_height_for_selection(void) {
MenuLayer l;
const int height = 180;
menu_layer_init(&l, &GRect(10, 10, height, 180));
menu_layer_set_center_focused(&l, true);
menu_layer_set_call... |
bool second_half,
AnimationProgress adjusted_progress) {
CenterFocusSelectionAnimationState state = prv_center_focus_animation_state(animation);
// values as seen in the design videos
const int16_t move_in_dist = 16;
const int16_t move_out... | prv_menu_layer_update_selection_scroll_position(menu_layer, MenuRowAlignNone, selection_animated) | |
se.
*/
#include "applib/event_service_client.h"
#include "kernel/event_loop.h"
#include "kernel/pbl_malloc.h"
#include "kernel/pebble_tasks.h"
#include "process_management/app_manager.h"
#include "process_management/worker_manager.h"
#include "os/mutex.h"
#include "services/common/event_service.h"
#include "syscall/s... | {
EventServiceEntry *service;
for (int i = 0; i < PEBBLE_NUM_EVENTS; i++) {
if ((service = s_event_services[i]) == NULL) {
continue;
}
if (service->subscribers[task] == NULL) {
continue;
}
PebbleSubscriptionEvent event = {
.subscribe = false,
.task = task,
.event_... |
void event_service_system_init(void) {
s_plugin_list_mutex = mutex_create();
}
void event_service_init(PebbleEventType type, EventServiceAddSubscriberCallback add_subscriber_callback,
EventServiceRemoveSubscriberCallback remove_subscriber_callback) {
if(s_event_services[type] != NULL) {
// an event servi... |
ky_args_assign(argc, argv, &binding, 1);
// Canvas APIs do a no-op if the color string is invalid
if (!jerry_value_has_error_flag(error_value)) {
func(rocky_api_graphics_get_gcontext(), color);
};
return jerry_create_undefined();
}
#define COLOR_BUFFER_LENGTH (12)
T_STATIC void prv_graphics_color_to_char_... | jerry_create_undefined() | |
/*
* 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... | ((Transport *) &s_transport,
&s_qemu_transport_implementation,
TransportDestinationHybrid) | |
/*
* 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... | (BITS_BETWEEN(0, 2), erased_sector) | |
h"
#include "shell/system_theme.h"
#include "process_management/app_manager.h"
#include "process_state/app_state/app_state.h"
#include "resource/resource_ids.auto.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/math.h"
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
enum ActionB... | prv_config() | ;
const int16_t cassette_x = config->horizontal_margin +
PBL_IF_RECT_ELSE(0, prv_content_width() - config->cassette_rect.size.w);
return GRect(cassette_x, config->cassette_rect.origin.y,
config->cassette_rect.size.w, config->cassette_rect.size.h);
}
static GRect prv_track_rect(void) {
const ... |
us at a time
bus_lock(bus);
if (bus->user_count == 0) {
PBL_LOG(LOG_LEVEL_ERROR, "Attempted reset of disabled bus %d by device %d", bus_idx, device_id);
bus_unlock(bus);
return;
}
PBL_LOG(LOG_LEVEL_WARNING, "Resetting I2C bus %" PRId8, bus_idx);
// decrement user count for reset so that if this... | {
// Too many NACKs received, abort transfer
abort_transfer(bus);
break;
PBL_LOG(LOG_LEVEL_ERROR, "I2C Error: too many NACKs received on bus %" PRId8, bus_idx);
} |
} else {
// Timeout, abort transfer
abort_transfer(bus);
break;
PBL_LOG(LOG_LEVEL_ERROR, "Transfer timed out on bus %" PRId8, bus_idx);
}
} while (bus->transfer.state != TRANSFER_STATE_INVALID);
// Return semaphore token so another transfer can be started
semaphore_give(bus);
... |
/*
* 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... | kino_reel_get_size(prv_get_current_reel(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... | if (mcu_state_is_isr()) {
return DialogTask_ISR;
} |
return task_to_dialogtask(xTaskGetCurrentTaskHandle());
}
void task_unregister_task(OS_TASK task) {
DialogTask index = task_to_dialogtask(task);
if (index >= DialogTask_Last) {
return;
}
DialogTaskList[index] = NULL;
}
void task_unregister_dialogtask(DialogTask task) {
if (task >= DialogTask_Last) {
... |
_card.delta_step_layer) {
if (data->lap_steps) {
snprintf(data->steps_card.delta_step_text, sizeof(data->steps_card.delta_step_text),
"%d", (int) (data->cur_steps - data->lap_steps));
text_layer_set_text(data->steps_card.delta_step_layer, data->steps_card.delta_step_text);
}
}
}
/... | (FONT_KEY_LECO_38_BOLD_NUMBERS) | |
GTextOverflowModeTrailingEllipsis);
layer_set_hidden(&s_phone_ui_data->call_status_text_layer.layer, true);
layer_set_clips(&s_phone_ui_data->call_status_text_layer.layer, false);
layer_add_child(&s_phone_ui_data->core_ui_container,
&s_phone_ui_data->call_status_text_layer.layer);
// Shrink th... | if (call_accepted) {
prv_set_icon_resource(TIMELINE_RESOURCE_DURING_PHONE_CALL);
prv_set_window_color(ACCEPT_COLOR, true);
prv_set_status_text(ACCEPTED);
} else {
prv_set_icon_resource(TIMELINE_RESOURCE_DISMISSED_PHONE_CALL);
prv_set_window_color(DECLINE_COLOR, true);
if (disconnected) {
... | |
t(file);
}
// The overwrite completed, we just rebooted before getting a chance
// to flip the completion bit on the previous record. Flip it now so
// that we don't have to keep checking on every boot.
settings_raw_iter_set_current_record_pos(&file->iter,
pa... | memset(&new_hdr, 0xff, sizeof(new_hdr)) | |
nt's direction as the start direction
if (rot_end.y.integer != rot_start.y.integer) {
start_is_down = rot_end.y.integer > rot_start.y.integer;
found_start_direction = true;
}
rot_end = rot_start;
}
const int16_t clip_min_x = ctx->draw_state.clip_box.origin.x
- ctx->draw_state.drawing... | if (is_down) {
intersections_down[intersection_down_count].x.raw_value = x.raw_value;
intersections_down[intersection_down_count].delta = delta;
intersection_down_count++;
} else {
intersections_up[intersection_up_count].x.raw_value = x.raw_value;
in... | |
cs_context_set_stroke_color(GContext* ctx, GColor color) {}
void graphics_context_set_fill_color(GContext* ctx, GColor color) {}
void graphics_context_set_stroke_width(GContext* ctx, uint8_t stroke_width) {}
void gpath_draw_stroke(GContext* ctx, GPath* path, bool open) {}
void gpath_draw_filled(GContext* ctx, GPath *pa... | (!gdraw_command_sequence_validate(sequence, 0)) | ;
sequence->num_frames = 0;
cl_assert(!gdraw_command_sequence_validate(sequence, size));
sequence->num_frames = 1;
cl_assert(!gdraw_command_sequence_validate(sequence, size));
sequence->num_frames = 3;
cl_assert(!gdraw_command_sequence_validate(sequence, size));
sequence->num_frames = 2;
sequence->ver... |
/*
* 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... | (JERRY_INIT_EMPTY) | ;
s_log_internal__expected = NULL;
}
void test_rocky_api_console__cleanup(void) {
jerry_cleanup();
rocky_runtime_context_deinit();
}
void test_rocky_api_console__functions_exist(void) {
rocky_global_init(s_api);
EXECUTE_SCRIPT(
"var c = typeof console;\n"
"var cl = typeof console.log;\n"
"var 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... | (GPIOE, pin_source, GPIO_AF_FMC) | ;
}
gpio_init.GPIO_Pin = GPIO_Pin_All & (~GPIO_Pin_0) & (~GPIO_Pin_1);
GPIO_Init(GPIOE, &gpio_init);
// We have configured the pins, lets perform a full HW reset to put the chip
// in a good state
GPIO_WriteBit(GPIOD, GPIO_Pin_2, Bit_RESET);
delay_us(10); // only needs to be 50ns according to data sheet
... |
t's possible new data has been batched up while we were sending data.
// Check the circular buffer and notify the controller if that's the case
if (prv_host_transport_tx_get_length() > 0) {
prv_indicate_has_data_if_idle();
}
hc_protocol_process_receive_buffer();
prv_handle_rx_buffer_has_spac... | {
PBL_LOG(LOG_LEVEL_DEBUG, "BLE transport deinit");
s_is_host_transport_initialized = false;
prv_watchdog_deinit();
dialog_spi_deinit();
// Flag the task exit, wake the task, and wait for the task to exit before continuing
s_spi_transport.task_should_deinit = true;
xSemaphoreGive(s_spi_transport.semph)... | |
IS,
* 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 "settings_vibe_patterns.h"
#include "settings_window.h"
#include "applib/ui/ui.h"
#include "kernel/pbl_malloc.h"
#includ... | vibes_short_pulse() | ;
// Just return because the remainder of this function only applies to vibe scores
return;
}
default:
WTF;
}
if (!score) {
PBL_LOG(LOG_LEVEL_ERROR, "Null VibeScore!");
return;
}
vibe_score_do_vibe(score);
vibe_score_destroy(score);
}
static void prv_select_click_cb(Settings... |
etric_history(HealthMetricStepCount, 1, health_data->step_data);
// Get the typical step averages for every 15 minutes
activity_get_step_averages(local_tm.tm_wday, &health_data->step_averages);
health_data->current_hr_bpm = health_service_peek_current_value(HealthMetricHeartRateBPM);
// Get the most recent st... | (ActivityMetricHeartRateRawQuality, 1, &quality) | ;
if (quality < HRMQuality_Acceptable) {
return;
}
uint32_t current_hr_timestamp;
activity_get_metric(ActivityMetricHeartRateRawUpdatedTimeUTC, 1,
(int32_t *)¤t_hr_timestamp);
if (current_hr_timestamp > (uint32_t)health_data->hr_last_updated) {
health_data->current_hr_bpm ... |
ask() == AlertMaskAllOn);
alerts_set_mask(AlertMaskAllOnLegacy);
cl_assert(alerts_get_mask() == AlertMaskAllOn);
}
void test_alerts__dnd_interruptions(void) {
s_dnd_active = true;
alerts_set_dnd_mask(AlertMaskAllOff);
alerts_set_mask(AlertMaskAllOn);
cl_assert(alerts_should_notify_for_type(AlertMobile))... | cl_assert(!alerts_should_enable_backlight_for_type(AlertOther)) | ;
s_dnd_active = false;
alerts_set_dnd_mask(AlertMaskAllOff);
alerts_set_mask(AlertMaskPhoneCalls);
cl_assert(alerts_should_notify_for_type(AlertPhoneCall));
cl_assert(alerts_should_vibrate_for_type(AlertPhoneCall));
alerts_set_notification_vibe_timestamp();
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICA... |
ServiceTagUnitTest);
cl_assert_equal_b(success, true);
cl_assert_equal_b(true, app_inbox_service_has_inbox_for_storage(storage));
cl_assert_equal_b(true, app_inbox_service_has_inbox_for_tag(AppInboxServiceTagUnitTest));
fake_kernel_malloc_mark();
success = app_inbox_service_register(storage, sizeof(storage),... | cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest,
BUFFER_SIZE, s_writer)) | ;
cl_assert_equal_b(true, app_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest));
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// app_inbox_service_write / app_inbox_service_end
static const uint8_t s_test_data[] = {
0x01, 0x02, 0x03, 0x04... |
/*
* 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... | (TIMER_DURATION, prv_timer_callback, countdown_window) | |
allRecordings){};
s_graphics_context_set_fill_color = (MockCallRecordings){};
s_graphics_context_set_stroke_color = (MockCallRecordings){};
s_graphics_context_set_stroke_width = (MockCallRecordings){};
s_graphics_line_draw_precise_stroked = (MockCallRecordings){};
s_graphics_draw_line = (MockCallRecordings){}... | (root_layer, &ctx) | ;
}
}
void test_js__rocky_tictoc_color(void) {
prv_deinit(); // engine will be re-initialized in rocky_event_loop~
char *script = prv_load_js("color");
s_tictoc_callback_is_color = true;
s_app_event_loop_callback = prv_rocky_tictoc_callback;
bool result = rocky_event_loop_with_string_or_snapshot(script, s... |
equal_i(recognizers[4]->state, RecognizerState_Possible);
// A touchdown occurs where no layers are touched
s_active_layer = NULL;
e.type = TouchEvent_Touchdown;
recognizer_manager_handle_touch_event(&e, &manager);
prv_compare_recognizers_processed((int[]) {4, 0}, 2, &s_recognizers_handled);
prv_compare_re... | (manager.active_layer, &layer_a) | ;
recognizer_set_manager(r1, &manager);
r1->state = RecognizerState_Started;
r2->state = RecognizerState_Failed;
manager.triggered = r1;
manager.state = RecognizerManagerState_RecognizersTriggered;
recognizer_manager_deregister_recognizer(&manager, r1);
cl_assert(!manager.triggered);
cl_assert(!manager... |
const BleConnectionParams *params) {
ble_task_assert_is_executing_on_ble_task();
Connection *connection;
prv_lock();
{
connection = kernel_malloc_check(sizeof(Connection));
*connection = (Connection) {
.conn_idx = conn_idx,
.initial_addr = *initial_addr,
.local_addr = *local_addr,
... | if (connection->has_updated_addr) {
*addr_buf = connection->updated_addr;
} else {
*addr_buf = connection->initial_addr;
} |
}
prv_unlock();
}
void connection_get_local_address(Connection *connection, BTDeviceAddress *addr_buf) {
prv_lock();
{
*addr_buf = connection->local_addr;
}
prv_unlock();
}
void connection_get_conn_params(const Connection *connection,
BleConnectionParams *params_out) {... |
/*
* 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 (arg == NULL) {
break;
} |
animation_array[array_len++] = arg;
}
}
return prv_create_from_array(animation_array, array_len);
}
Animation *WEAK animation_sequence_create(Animation *animation_a, Animation *animation_b,
Animation *animation_c, ...) {
va_list args;
va_start(args, animatio... |
cted_services;
//! The number of connected services
static uint32_t s_num_connected_services = 0;
static PebbleMutex *s_services_lock;
void smartstrap_state_init(void) {
s_state_lock = mutex_create();
s_services_lock = mutex_create();
s_max_services = smartstrap_profiles_get_max_services();
s_connected_servic... | {
// already connected
return;
} |
// insert the service_id
PBL_ASSERTN(s_num_connected_services < s_max_services);
s_connected_services[s_num_connected_services++] = service_id;
} else if (!prv_remove_connected_service(service_id)) {
// we weren't previously connected
return;
}
PBL_LOG(LOG_LEVEL_INFO, "Connection state for s... |
ue;
}
// -------------------------------------------------------------------------------------------
bool animation_is_immutable(Animation *animation_h) {
AnimationState *state = prv_animation_state_get(PebbleTask_Current);
PBL_ASSERTN(!animation_private_using_legacy_2(state));
AnimationPrivate *animation = prv_... | {
AnimationState *state = prv_animation_state_get(PebbleTask_Current);
PBL_ASSERTN(!animation_private_using_legacy_2(state));
AnimationPrivate *parent = prv_find_animation_by_handle(state, parent_h, false /*quiet*/);
if (!parent || !prv_animation_is_scheduled(state, parent) || parent->parent) {
// Can only... |
// -------------------------------------------------------------------------------------------
bool animation_get_elapsed(Animation *animation_h, int32_t *elapsed_ms) {
AnimationState *state = prv_animation_state_get(PebbleTask_Current);
PBL_ASSERTN(!animation_private_using_legacy_2(state));
AnimationPrivate ... |
igin.y + rect.size.h) - radius) && (corner_mask & GCornersBottom)) {
if (corner_mask & GCornerBottomLeft) {
corner_insets_left = round_bottom_corner_lookup[radius];
}
if (corner_mask & GCornerBottomRight) {
corner_insets_right = round_bottom_corner_lookup[radius];
}
}
in... | (ctx, GRect(bottom_rect_origin_x, rect->origin.y + rect->size.h - radius,
bottom_rect_size_w, radius),
0, GCornerNone, fill_color) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_ASSERTN(bt_ctl_is_bluetooth_active()) | ;
app_data->test_state = BtTestStateStopped;
break;
}
case BtTestStateStopped:
case BtTestStateStarted:
break;
default:
WTF;
}
process_manager_send_callback_event_to_process(PebbleTask_App, update_text_layers_callback, (void*)data);
}
static void select_single_click_handler... |
v_qsort_sleep_test_entry_cb(const void *a, const void *b) {
SleepFileTestEntry *entry_a = (SleepFileTestEntry *)a;
SleepFileTestEntry *entry_b = (SleepFileTestEntry *)b;
return strcmp(entry_a->name, entry_b->name);
}
// --------------------------------------------------------------------------------------
// Ca... | (&s_accel_sample_discovery_state.common,
SampleFileType_AccelSamples, "activity/step_samples") | ;
cl_assert(success);
const uint32_t k_max_tests = 1000;
uint32_t num_tests = 0;
// Results
typedef struct {
int steps;
int ref_steps;
uint32_t test_idx;
} StepTestResults;
StepTestResults test_results[k_max_tests];
StepFileTestEntry test_entry[k_max_tests];
while (prv_accel_sample_disc... |
/*
* 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... | (mbuf_get_length(m) == 0) | ;
m = mbuf_get_next(m);
}
}
MBuf *mbuf_get(void *data, uint32_t length, MBufPool pool) {
PBL_ASSERTN(pool < NumMBufPools);
MBuf *m;
mutex_lock(s_free_list_lock);
// get an MBuf out of the free list if possible, or else allocate a new one
if (s_free_list) {
prv_check_free_list();
// remove the h... |
_node_destroy(&container->node);
}
#if PBL_BW || ROBERT_SCREEN_RES
static void prv_draw_bpm(GContext *ctx, int32_t current_bpm, GFont font, GBitmap *heart_icon,
GRect bounds, bool screen_is_obstructed, void *i18n_owner) {
#if PBL_BW
bounds.origin.y += screen_is_obstructed ? 52 : 89;
#elif RO... | prv_draw_steps_and_shoe(ctx, data->steps_buffer, data->steps_font, bounds, text_color, shoe,
screen_is_obstructed, has_bpm) | ;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Data
static void prv_update_steps_buffer(KickstartData *data) {
const int thousands = data->current_steps / 1000;
const int hundreds = data->current_steps % 1000;
if (thousands) {
/// Step count great... |
isturb_set_schedule_enabled(WeekdaySchedule, false);
rtc_set_time(s_thursday_01_00);
do_not_disturb_handle_clock_change();
active = do_not_disturb_is_active();
cl_assert(active == false);
// Timer will go off at 00:00 on Saturday. (47.0 hours)
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 16... | cl_assert(enabled == false) | ;
active = do_not_disturb_is_active();
cl_assert(active == false);
do_not_disturb_toggle_manually_enabled(ManualDNDFirstUseSourceActionMenu);
enabled = do_not_disturb_is_manually_enabled();
cl_assert(enabled == false);
active = do_not_disturb_is_active();
cl_assert(active == false);
///////////////////... |
turn s_manager_state.enabled_run_level &&
s_manager_state.enabled_charging_state &&
activity_prefs_heart_rate_is_enabled();
}
// Figure out if we should enable the HR sensor or not based on all subscribers and their
// desired sampling periods. Must be called from the KernelBG task.
static void prv_u... | {
system_task_add_callback(prv_update_hrm_enable_system_cb, NULL);
} |
//! The system task needs its own handler for HRM data since we can't queue up generic events.
static void prv_system_task_hrm_handler(void *context) {
time_t utc_now = rtc_get_time();
mutex_lock_recursive(s_manager_state.lock);
PebbleHRMEvent event;
prv_read_event_from_buffer_and_consume(&s_manager_state.sy... |
away_read_result);
prv_read_register(PmicRegisters_INT_STATUS_2, &throwaway_read_result);
}
static void prv_pmic_state_change_cb(void *null) {
prv_clear_pending_interrupts();
new_timer_start(s_debounce_charger_timer, CHARGER_DEBOUNCE_MS,
prv_handle_charge_state_change, NULL, 0 /*flags*/);
}
st... | prv_read_register(PmicRegisters_SD1_VOLTAGE, &sd1_vsel) | |
_value(argv[0]) : jerry_create_undefined();
JS_VAR options = argc >= 2 ? jerry_acquire_value(argv[1]) : jerry_create_object();
if (!prv_matches_system_locale(locale)) {
if (error) {
*error = rocky_error_argument_invalid("Unsupported locale");
}
return 0;
}
bool is_24h_style = clock_is_24h_sty... | {
return error;
} |
if (total_len != 0) {
// user picked options, so we formatted something into buffer
return jerry_create_string_utf8((jerry_char_t *) buffer);
}
// if total_len == 0, nothing was formatted and we default to "<date>, <time>"
return prv_to_locale_time_or_date_string(this_val, 0, NULL,
... |
(new_ticks) | ;
}
// --------------------------------------------------------------------------------------
// Fire the timer used by the animation service. Before doing so, advance the time to when
// the timer would fire next.
static void prv_fire_animation_timer(void) {
TimerID sys_timer_id = animation_service_test_get_timer_... | |
/*
* 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... | (&time, &t) | ;
// Just die if sanitization is necessary.
PBL_ASSERTN(!rtc_sanitize_struct_tm(&t));
RTC_TimeTypeDef rtc_time_struct = {
.RTC_Hours = t.tm_hour,
.RTC_Minutes = t.tm_min,
.RTC_Seconds = t.tm_sec
};
RTC_DateTypeDef rtc_date_struct = {
.RTC_Month = t.tm_mon + 1, // RTC_Month is 1-12, tm_mon i... |
rt_equal_i(metric, ANALYTICS_APP_METRIC_MEM_ROCKY_RECURSIVE_MEMORYPRESSURE_EVENT_COUNT);
++s_sys_analytics_inc_call_count;
}
static const RockyGlobalAPI *s_api[] = {
&MEMORY_APIS,
NULL,
};
static bool s_skip_pbl_malloc_check;
#define assert_oom_app_fault() \
cl_assert_equal_i(s_app_heap_analytics_log_rocky_h... | (s_sys_analytics_inc_call_count, 0) | ;
}
#if 0
// This doesn't work at the moment, because the `in` operator allocates a ton of memory... :( for
// the same reason as why Array.pop() has a footprint that's proportional to the number of elements.
void test_rocky_api_memory
__no_oom_app_fault_if_handler_frees_up_enough_mem_put_props_for_in(void) {
EXECUT... |
t* flash_data_region,
uint32_t num_words) {
for (uint32_t words_read = 0; words_read < num_words; words_read++) {
buffer[words_read] = flash_data_region[words_read];
}
}
// Currently this implementation reads halfwords at a time (16-bits). Burst
// length is currently 1 for synch... | {
status_t error = S_SUCCESS;
const uint8_t sr = prv_read_status_register(sector_addr);
if ((sr & S29VSStatusBit_DeviceReady) == 0) {
// Another operation is already in progress.
error = E_BUSY;
} else if (sr & S29VSStatusBit_ProgramSuspended) {
// Cannot program while another program ... |
prv_allow_write_if_sector_is_not_protected(false, sector_addr);
prv_issue_command(sector_addr, S29VSCommand_WriteBufferLoad);
prv_issue_command_argument(sector_addr, num_shorts - 1);
// We're now ready to write the words. Subsequent writes to the sector will
// actually write the data through to the write ... |
/*
* 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... | {
// Second half of the transition
const GBitmap app_bitmap = compositor_get_app_framebuffer_as_bitmap();
GBitmap sys_bitmap = compositor_get_framebuffer_as_bitmap();
const GPoint point = direction_vertical ? GPoint(0, -current_offset_px) :
GPoint(-current_o... | else {
// First half of the transition
const int16_t diff = s_data.animation_offset_px - current_offset_px;
if (direction_vertical) {
graphics_private_move_pixels_vertically(&ctx->dest_bitmap, diff);
} else {
graphics_private_move_pixels_horizontally(&ctx->dest_bitmap, diff,
... |
/*
* 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... | core_dump_get_slot_address(i) | ;
flash_read_bytes((uint8_t *)®ion_hdr, base_address, sizeof(region_hdr));
if (unread_only && !region_hdr.unread) {
continue;
}
if (region_hdr.last_used > max_last_used) {
max_last_used = region_hdr.last_used;
last_used_idx = i;
}
}
if (!max_last_used) {
return CORE_D... |
>refcount, 1) - 1;
PBL_ASSERT(refcount >= 0, "Attempted to release a DMA controller that is not in use!");
if (refcount == 0) {
periph_config_disable(this->periph, this->rcc_bit);
}
}
// Initialization
////////////////////////////////////////////////////////////////////////////////
static uint32_t prv_get_... | {
// Flush the source buffer from cache so that SRAM has the correct data.
uintptr_t aligned_src = (uintptr_t)src;
size_t aligned_length = length;
dcache_align(&aligned_src, &aligned_length);
dcache_flush((const void *)aligned_src, aligned_length);
} | |
/*
* 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_read(fd, (uint8_t *)&field, sizeof(field)) | ;
// short read, EOF, or check field to see if it matches
// what's being searched for
if ((read_result < (int)sizeof(field))) {
if (PASSED(read_result) || read_result == E_RANGE) {
return E_DOES_NOT_EXIST;
}
PBL_LOG(LOG_LEVEL_WARNING, "seek_map failed: %d", read_result);
re... |
imation, interpolate_moook_duration());
}
animation_set_auto_destroy(animation, false);
}
animation_schedule(animation);
} else {
prv_scroll_layer_set_content_offset_internal(scroll_layer, offset);
}
}
void scroll_layer_set_content_size(ScrollLayer *scroll_layer, GSize size) {
GRect bound... | layer_get_hidden(&scroll_layer->shadow_sublayer) | ;
}
void scroll_layer_set_paging(ScrollLayer *scroll_layer, bool paging_enabled) {
PBL_ASSERTN(scroll_layer);
if (paging_enabled) {
// Deinit shadow_sublayer to enable paging
if (!prv_scroll_layer_is_paging_enabled(scroll_layer)) {
layer_deinit(&scroll_layer->shadow_sublayer);
}
// paging an... |
og *actionable_dialog;
#if PBL_ROUND
StatusBarLayer status_bar_layer;
#endif
} NotificationsData;
static NotificationsData *s_data = NULL;
static const unsigned int MAX_ACTIVE_NOTIFICATIONS = 6;
static bool prv_loaded_notification_list_filter_cb(ListNode *node, void *data) {
LoadedNotificationNode *loaded_notifi... | {
if (node == NULL) {
return NULL;
}
LoadedNotificationNode *loaded_node = prv_find_loaded_notification(*loaded_list, &node->id);
if (loaded_node) {
return loaded_node;
}
// unload old notifications
if (list_count((ListNode*) *loaded_list) > MAX_ACTIVE_NOTIFICATIONS) {
LoadedNotificationNode... |
timeline_resources_get_id(&timeline_res, TimelineResourceSizeTiny, &icon_res_info);
loaded_node->icon = gdraw_command_image_create_with_resource_system(icon_res_info.res_app_num,
icon_res_info.res_id);
loaded_node->icon_is_default = (timeline_... |
lor8_setter(GColor8 *p, GColor8 value) {
*p = value;
}
static GColor8 prv_gcolor8_getter(GColor8 *p) {
return *p;
}
// --------------------------------------------------------------------------------------
static void prv_fixed_s32_16_setter(Fixed_S32_16 *p, Fixed_S32_16 value) {
*p = value;
}
static Fixed_S3... | cl_assert_equal_point(layer.frame.origin, to_r.origin) | ;
// Make sure our started and stopped handlers got called
cl_assert_equal_i(s_started_handler_calls.num_calls, 1);;
cl_assert(s_started_handler_calls.entries[0].fired_time_ms - start_ms <= 1);
cl_assert(s_started_handler_calls.entries[0].context == context);
cl_assert_equal_i(s_stopped_handler_calls.num_ca... |
return false;
}
DLSChunkHeader data_hdr = { .num_bytes = data_chunk_length, .valid = true };
if (!prv_pfs_write(storage->fd, &data_hdr, sizeof(DLSChunkHeader))) {
return false;
}
// Bump pointer and count
storage->write_offset += data_chunk_length + sizeof(DLSChunkHeader);
storage... | dls_storage_delete_logging_storage(session) | ;
}
return success;
}
// -----------------------------------------------------------------------------------------
void dls_storage_invalidate_all(void) {
// Iterate through all files in the file system, looking for all DLS storage files and
// deleting them.
pfs_remove_files(prv_filename_filter_cb);
}
//... |
ognizerRef recognizer, void *data) {
NotificationWindowData *window_data = data;
TimelineItem *item = prv_get_current_notification(window_data);
if (!prv_should_provide_action_menu_for_item(window_data, item)) {
return;
}
LayoutLayer *layout = swap_layer_get_current_layout(&window_data->swap_layer);
c... | layer_deinit(&data->dnd_icon_layer) | |
d_handlers = false;
#ifdef UNITTEST
// Make sure this animation didn't get deleted as a side effect of running the stopped handler
PBL_ASSERTN(list_contains(state->unscheduled_head, &animation->list_node)
|| list_contains(state->scheduled_head, &animation->list_node));
#endif
if (force_destroy || ... | prv_get_total_duration(state, child, true /*delay*/, true /*play_count*/) | ;
// It is allowed that the first child may have already been scheduled and played a bit. If
// this is the case, backup the start time by reducing delay accordingly.
if (child_idx == 0 && child->abs_start_time_ms) {
// Remove the sequence's delay, we will shift all of the delay into the firs... |
t = PBL_IF_RECT_ELSE(49, 67);
icon_y_offset = 38;
text_y_offset = 90;
#endif
}
if (first_use_is_complete) {
#if PBL_BW && !PLATFORM_TINTIN
// Override the icon to use the fullscreen version
icon_res_id = RESOURCE_ID_RECOVERY_LAUNCH_APP;
icon_x_offset = 0;
icon_y_offset = 0;
url_string ... | {
content_size = text_layer_get_content_size(app_state_get_graphics_context(),
&data->name_text_layer);
content_size.w += 4;
content_size.h += 4;
} |
// Actually set the frame centered on the screen and just below the url_text_layer.
const int16_t window_width = data->launch_app_window.layer.frame.size.w;
const int16_t text_x_offset = (window_width - content_size.w) / 2;
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
const int16_t text_y_offset = 33;
#else
con... |
isconnection to happen. See PBL-24737.
PBL_LOG(LOG_LEVEL_INFO, "Re-pairing previously paired LE device");
is_updating_existing = true;
} else {
// Since we only have one slot, this means we are about to delete what was
// already there so handle the deletion if a valid pairing was stored
... | {
return;
} | |
/passert.h"
#include <stdio.h>
#include <string.h>
#define UPDATE_FREQ_MS 1000
#define FAIL_SCREEN_VISIBLE_DURATION_MS 10000
#define COMPLETE_SCREEN_VISIBLE_DURATION_MS 5000
#define PROG_LAYER_START_VAL 6
// Used to force the progress bar to start at PROG_LAYER_START_VAL and scale
// the reset of the progress betwee... | prv_update_progress(data) | |
rs;
static int s_handler_call_count[NumHandlers] = { 0 };
typedef struct {
size_t len;
uint8_t *buf;
} ExpectedData;
static ExpectedData s_expected_data;
static void prv_set_expected_data(void *data, size_t len) {
s_expected_data.buf = data;
s_expected_data.len = len;
}
static void prv_assert_data_matches_... | prv_set_expected_data(data[i], strlen(data[i])) | ;
fake_system_task_callbacks_invoke_pending();
cl_assert_equal_i(s_handler_call_count[i], 1);
}
cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0);
}
//! It's possible the same session can receiver multiple messages before any
//! are processed on kernel BG. Make sure they do not interfere with one
//... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.