prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
LOR_DEPTH_BITS == 8
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, 1, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r1_aa_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_REC... | test_graphics_context_init(&ctx, fb) | |
timer.h"
#include "fake_rtc.h"
#include "fake_system_task.h"
#include "fake_pbl_malloc.h"
// Stubs
#include "stubs_bluetopia_interface.h"
#include "stubs_bt_lock.h"
#include "stubs_logging.h"
#include "stubs_mutex.h"
#include "stubs_passert.h"
extern void conn_mgr_handle_desired_state_granted(GAPLEConnection *hdl,
... | cl_assert_equal_i(secs_to_wait, 30) | ;
cl_assert_equal_i(fake_gap_le_connect_params_get_last_requested(), ResponseTimeMiddle);
// higher rate should take over lower rate already scheduled
conn_mgr_set_ble_conn_response_time(
&s_hdl, BtConsumerLeServiceDiscovery, ResponseTimeMin, 25);
state = conn_mgr_get_latency_for_le_connection(&s_hdl, &s... |
/*
* 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... | (state->combo_timer) | ;
}
void getting_started_button_combo_button_pressed(GettingStartedButtonComboState *state,
ButtonId button_id) {
bitset8_set(&state->buttons_held_bitset, button_id);
prv_update_state(state);
}
void getting_started_button_combo_button_released(GettingStartedBut... |
false;
static bool s_vibe_service_enabled = true;
DEFINE_SYSCALL(bool, sys_vibe_history_was_vibrating, uint64_t time_search) {
bool rc = false;
PBL_ASSERTN(s_vibe_history_mutex);
mutex_lock(s_vibe_history_mutex);
VibeHistory *node = s_vibe_history;
while (node) {
if (node->time_end == END_NOT_SET && tim... | vibe_set_strength(new_strength) | ;
vibe_ctl(true /* on */);
if (s_vibe_strength == VIBE_STRENGTH_OFF) {
prv_vibe_history_start_event();
}
} else {
vibe_ctl(false /* on */);
if (s_vibe_strength != VIBE_STRENGTH_OFF) {
prv_vibe_history_end_event();
}
}
s_vibe_strength = new_strength;
}
void vibe_service_set_ena... |
ll
// overlaps the outline and things look weird
health_progress_bar_outline(ctx, &data->progress_bar, PROGRESS_OUTLINE_COLOR);
}
static void prv_render_icon(GContext *ctx, Layer *base_layer) {
HealthActivitySummaryCardData *data = layer_get_data(base_layer);
const int y = PBL_IF_RECT_ELSE(PBL_IF_BW_ELSE(43, ... | {
return true;
} | |
3248 - 3264 */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3264 - 3280 */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* bytes 3280 - 3296 */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff... | {
s_watch_res_callback_called_count++;
} |
void test_resource__watch(void) {
load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, PUG_FIXTURE_NAME, "pug");
ResourceCallbackHandle cb_handle = resource_watch(SYSTEM_APP, RESOURCE_ID_PUG,
prv_res_changed_callback, NULL);
cl_assert(cb_handle);
// Callback should get invoked if resource was written ... |
(&s_items[s_correct_order[5]].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(3));
cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(4));
cl_assert(timelin... | (timeline_model_get_num_items(), 2) | ;
cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id));
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_stat... |
/*
* 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... | {
// No session connected that can serve the currently running app
return false;
} |
const AppInstallId app_id = app_manager_get_current_app_id();
app_install_mark_prioritized(app_id, true /* can_expire */);
analytics_add(ANALYTICS_APP_METRIC_MSG_BYTE_OUT_COUNT, length, AnalyticsClient_App);
// TODO: apply some heuristic to decide whether to put connection in fast mode or not:
// https://... |
f (evt->handle == s_pps_ctx.att_hdl.trigger_pairing) {
const PairingTriggerRequestData request = {
.should_pin_address = false,
.no_slave_security_request = false,
};
prv_handle_trigger_pairing(evt->conn_idx, &request);
} else if (evt->handle == s_pps_ctx.att_hdl.conn_status_cccd ||
... | ble_gattc_exchange_mtu(evt->conn_idx) | ;
if (e != BLE_STATUS_OK) {
PBL_LOG(LOG_LEVEL_ERROR, "ble_gattc_exchange_mtu: %u", e);
return ATT_ERROR_UNLIKELY;
}
return ATT_ERROR_OK;
}
static att_error_t prv_validate_set_remote_param_mgmt_settings_cmd(
const PebblePairingServiceRemoteParamMgmtSettings *settings, size_t length) {
if (length < s... |
e:8;
} ResponseHeader;
typedef struct PACKED {
ResponseHeader header;
uint8_t num_attributes;
uint8_t data[];
} PhoneResponseMsg;
typedef struct PACKED {
ResponseHeader header;
uint8_t num_attributes;
uint8_t num_actions;
uint8_t data[];
} PhoneActionResponseMsg;
typedef struct PACKED {
Command comma... | {
size_t attr_data_size = (attributes != NULL) ? attribute_list_get_serialized_size(attributes) : 0;
InvokeActionMsgCbData *invoke_action_data =
kernel_zalloc_check(sizeof(InvokeActionMsgCbData) + attr_data_size);
invoke_action_data->length = sizeof(invoke_action_data->msg) + attr_data_size;
if (type == ... |
COMM_SESSION_DEFAULT_TIMEOUT);
kernel_free(invoke_action_data);
}
}
void timeline_action_endpoint_protocol_msg_callback(CommSession *session,
const uint8_t* data, size_t length) {
if (length < sizeof(ResponseHeader)) {
PBL_LOG(LOG_LEVEL_WARNING, "Invalid phone response message length %d", (int... |
/*
* 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 ((const PebbleProcessMdFlash*) md)->sdk_version;
} |
return (Version) { PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR, PROCESS_INFO_CURRENT_SDK_VERSION_MINOR };
}
ProcessAppRunLevel process_metadata_get_run_level(const PebbleProcessMd *md) {
if (md->process_storage == ProcessStorageFlash) {
return ProcessAppRunLevelNormal;
} else if (md->process_storage == ProcessSt... |
framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite) | );
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_inside_origin_layer.${BIT_DEPTH_NAME}.pbi"));
layer_set_update_proc(&layer, &clear_layer_update_callback);
layer_rend... | |
s = 0;
time_t alarm_time = prv_get_alarm_time(alarm, cron_job_get_execute_time(cron));
time_t last_alarm = 0;
for (int i = 0; alarm_time <= current_time + SECONDS_PER_DAY * 3; i++) {
if (last_alarm != alarm_time) {
last_alarm = alarm_time;
localtime_r(&alarm_time, local_alarm_time);
if (ala... | {
return;
} |
AlarmConfig *config = s_most_recent_alarm_id != ALARM_INVALID_ID ? &s_most_recent_alarm_config :
NULL;
const bool is_smart = (config && config->is_smart && CAPABILITY_HAS_HEALTH_TRACKING &&
activity_tracking_on());
Peb... |
as regained focus,
// this is also done by checking the last event.
event = fake_event_get_last();
cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT);
cl_assert_equal_i(event.app_focus.in_focus, true);
cl_assert_equal_i(window1->on_screen, true);
window_stack_remove(window1, true);
cl_a... | stub_pebble_tasks_set_current(PebbleTask_App) | |
der[] = {APP_ID_MUSIC, APP_ID_SETTINGS, APP_ID_NOTIFICATIONS,
APP_ID_ALARMS, APP_ID_WATCHFACES, APP_ID_WORKOUT,
BG_COUNTER_APP_ID, MENU_LAYER_APP_ID};
uint8_t num_entries = ARRAY_LENGTH(written_order);
prv_write_order_to_file(written_order, num_en... | cl_assert_equal_i(node->install_id, desired_order[i]) | ;
}
app_menu_data_source_deinit(&data_source);
}
void test_app_menu_data_source__settings_app_floats_to_top_if_absent_from_storage_order(void) {
AppInstallId storage_order[] = {APP_ID_NOTIFICATIONS, BG_COUNTER_APP_ID, APP_ID_MUSIC};
AppInstallId desired_order[] = {
// Settings floats above storage entrie... |
e SPI clock to run at 2MHz by default
static uint32_t s_spi_clock_hz;
// DMA constants
static DMA_Stream_TypeDef* DISPLAY_DMA_STREAM = DMA1_Stream4;
static const uint32_t DISPLAY_DMA_CLOCK = RCC_AHB1Periph_DMA1;
static bool s_initialized = false;
// DMA state
static DisplayContext s_display_context;
static uint32_t ... | {
if (s_initialized) {
return;
}
s_spi_clock_hz = MHZ_TO_HZ(2);
prv_display_context_init(&s_display_context);
vSemaphoreCreateBinary(s_dma_update_in_progress_semaphore);
dma_request_init(SHARP_SPI_TX_DMA);
prv_enable_display_spi_clock();
prv_display_start();
prv_disable_display_spi_clock();... |
static void prv_display_context_init(DisplayContext* context) {
context->state = DISPLAY_STATE_IDLE;
context->get_next_row = NULL;
context->complete = NULL;
}
// Clear-all mode is entered by sending 0x04 to the panel
void display_clear(void) {
prv_enable_display_spi_clock();
prv_enable_chip_select();
pr... |
) == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.version);
} else if (strcmp(token, "TEST_ACTIVITY_TYPE") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.activity_type.value);
} else if (strcmp(token, "TEST_ACTIVITY_TYPE_MIN") == 0) {
sscanf(to... | printf("\nCould not open directory %s", state->res_path) | ;
return false;
}
state->type = samples_type;
return true;
}
// ---------------------------------------------------------------------------------------
// Advance to the next file in the directory. Return true if successful
static bool prv_sample_discovery_next_file(SampleDiscoveryState *state) {
if (sta... |
nce_last_save / RTC_TICKS_HZ);
s_time_tick_base = -(((int64_t)current_ticks) % RTC_TICKS_HZ);
#ifdef VERBOSE_LOGGING
char buffer[TIME_STRING_BUFFER_SIZE];
PBL_LOG_VERBOSE("Restore RTC: saved: %"PRIu32" diff: %"PRIu32, last_save_time_ticks, ticks_since_last_save);
PBL_LOG_VERBOSE("Restore RTC: saved_time: %s r... | if (save_needed) {
save_rtc_time_state(rtc_ticks);
} |
}
static RtcTicks get_ticks(void) {
// Prevent this from being interrupted
bool ints_enabled = mcu_state_are_interrupts_enabled();
if (ints_enabled) {
__disable_irq();
}
RtcTicks rtc_interval_ticks = get_rtc_interval_ticks();
check_and_handle_rollover(rtc_interval_ticks);
if (ints_enabled) {
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
flash_read_bytes(buf, address, length);
return length;
} |
static int external_flash_domain_write(uint8_t *buf, uint32_t address, uint32_t length,
void *context) {
flash_write_bytes(buf, address, length);
return length;
}
static int external_flash_domain_stat(uint8_t *resp, size_t resp_max_len, void *context) {
return E_INVALID_OP... |
.select_long_click = prv_information_long_click_callback,
});
menu_layer_set_highlight_colors(menu_layer, SETTINGS_MENU_HIGHLIGHT_COLOR, GColorWhite);
menu_layer_set_click_config_onto_window(menu_layer, &data->window);
layer_add_child(&data->window.layer, menu_layer_get_layer(menu_layer));
}
static void prv... | prv_draw_generic_mark(ctx, mark, mark_origin, highlight) | + (MARK_PADDING / 2);
box.origin.x = x;
box.origin.y += 8;
box.size.w -= x;
box.size.h -= 8;
const GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_18);
graphics_draw_text(ctx, text, font, box, GTextOverflowModeFill, GTextAlignmentLeft, NULL);
}
static void prv_draw_rt_cell_round(GContext *ctx, const La... |
s addr) {
get_sector_base_calls++;
return addr & 0xfffff000;
}
int erase_subsector_begin_calls = 0;
status_t erase_subsector_begin_return = S_SUCCESS;
status_t flash_impl_erase_subsector_begin(FlashAddress addr) {
erase_subsector_begin_calls++;
return erase_subsector_begin_return;
}
int erase_sector_begin_cal... | (erase_sector_begin_calls, 2) | ;
}
///////////////////////////////////////////////////////////////////////
bool uncorrectable_erase_error_cb_called = false;
void uncorrectable_erase_error_cb(void *context, status_t result) {
cl_assert_equal_i(E_ERROR, result);
uncorrectable_erase_error_cb_called = true;
}
void test_flash_api__handle_uncorrect... |
125 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_value = test_num };
cl_assert(num.integer == -1);
cl_assert(num.fraction == 7);
test_num = (int32_t)((float)-0 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_value = test_num };
cl_assert(num.integer == 0);
cl_assert(num.fract... | Fixed_S16_3(-12) | ));
}
void test_math_fixed__S16_3_rounding(void) {
Fixed_S16_3 num;
int16_t test_num;
// This test shows how the in between fractional values evaluate to the fixed representation
// Positive numbers round down to nearest fraction
// Negative numbers round up to neareset fraction
test_num = (int16_t)((floa... |
ineItemHeader) ||
info->key_len != UUID_SIZE) {
// malformed values; deleted values have their lengths set to 0
if (info->key_len != UUID_SIZE) {
PBL_LOG(LOG_LEVEL_WARNING, "Found malformed item with invalid key/val sizes; ignoring.");
}
return true;
}
SerializedTimelineItemHeader hdr;
... | settings_file_close(&storage->file) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | analytics_storage_take_lock() | ;
AnalyticsHeartbeat *heartbeat = analytics_storage_find(metric, uuid, AnalyticsClient_Ignore);
if (heartbeat) {
// We allow only a limited number of app heartbeats to accumulate. A NULL means we reached the
// limit
analytics_heartbeat_set(heartbeat, metric, value);
}
analytics_storage_give_lock(... |
/*
* 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 (!s_animations) {
s_animations = (ListNode *)animation;
} else {
list_append(s_animations, (ListNode *)animation);
} |
return (Animation *)animation;
}
static Animation *prv_create_from_array(Animation **animation_array, size_t array_len) {
AnimationPrivate *parent = (AnimationPrivate *)animation_create();
parent->first_child = (AnimationPrivate *)animation_array[0];
for (int i = 0; i < (int)array_len; i++) {
AnimationPr... |
/*
* 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... | {
PWR_FlashPowerDownCmd(power_down ? ENABLE : DISABLE);
} |
void pwr_access_backup_domain(bool enable_access) {
periph_config_enable(PWR, RCC_APB1Periph_PWR);
PWR_BackupAccessCmd(enable_access ? ENABLE : DISABLE);
periph_config_disable(PWR, RCC_APB1Periph_PWR);
}
|
fication_storage.h"
#include "services/normal/notifications/notification_types.h"
#include "services/normal/notifications/notifications.h"
#include "services/normal/timeline/attribute.h"
#include "services/normal/timeline/notification_layout.h"
#include "services/normal/timeline/swap_layer.h"
#include "services/normal/... | {
regular_timer_remove_callback(&data->reminder_watchdog_timer_id);
} | |
ancel(session);
return;
}
// read item into a temporary buffer
void *item_buf = kernel_malloc_check(item_size);
status_t status = blob_db_read(session->db_id,
dirty_item->key,
dirty_item->key_len,
item_buf, i... | if (session) {
// This will get picked up by the current session when it is done with its dirty list
return S_SUCCESS;
} |
char buffer[key_len + 1];
strncpy(buffer, (const char *)key, key_len);
buffer[key_len] = '\0';
PBL_LOG(LOG_LEVEL_INFO, "Starting BlobDB record sync: <%s>", buffer);
BlobDBDirtyItem *dirty_list = kernel_zalloc_check(sizeof(BlobDBDirtyItem) + key_len);
list_init((ListNode *)dirty_list);
dirty_list->last_... |
command);
}
gdraw_command_draw(data->ctx, data->processed_draw_command);
return true;
}
void gdraw_command_list_draw(GContext *ctx, GDrawCommandList *command_list) {
gdraw_command_list_draw_processed(ctx, command_list, NULL);
}
static bool prv_iterate_max_command_size(GDrawCommand *command, uint32_t idx, void... | GPointPreciseFromGPoint(point) | ;
}
}
collect->iter.current_index += num_copied;
collect->iter.bytes_left -= bytes_copied;
return true;
}
GPoint *gdraw_command_list_collect_points(GDrawCommandList *command_list, bool is_precise,
uint16_t *num_points_out) {
const uint16_t num_points = gdraw_command_list_get_num_points(command_lis... |
4, 184},
{ -360, 920, 208},
{ -360, 896, 208},
{ -352, 872, 216},
{ -376, 864, 232},
{ -376, 888, 240},
{ -376, 904, 264},
{ -376, 896, 264},
{ -376, 888, 256},
{ -368, 864, 248},
{ -368, 856, 264},
{ -376, 856, 264},
{ -360, 864, 272},
{ -368, 888, 272},
// 168 s... | { -360, 848, 296},
{ -368, 856, 304},
{ -376, 848, 304},
{ -384, 864, 312},
{ -392, 880, 312},
{ -384, 880, 320},
{ -368, 864, 312},
{ -368, 872, 304},
{ -360, 864, 320},
{ -360, 856, 320},
{ -368, 864, 336},
{ -368, 872, 336},
{ -360, 872, 328},
{ -360, 832, 328}... |
{ -320, 880, -80},
{ -312, 896, -72},
{ -312, 928, -88},
{ -312, 896, -120},
{ -336, 904, -96},
{ -328, 928, -128},
{ -352, 912, -24},
// 176 seconds
{ -336, 928, -48},
{ -328, 928, -56},
{ -320, 944, -48},
{ -312, 912, -32},
{ -296, 928, -80},
{ -312, 944, -24},... |
- s_activity_state.sample_collection_seconds;
}
*enabled = s_activity_state.sample_collection_enabled;
*session_id = s_activity_state.sample_collection_session_id;
*num_samples = s_activity_state.sample_collection_num_samples;
if (*enabled) {
*sec... | (&s_activity_job) | ;
mutex_destroy((PebbleMutex *)s_activity_state.mutex);
if (reset_settings) {
pfs_remove(ACTIVITY_SETTINGS_FILE_NAME);
}
if (sleep_history) {
prv_write_metric_history(ActivitySettingsKeySleepTotalMinutesHistory, sleep_history);
}
if (step_history) {
prv_write_metric_history(ActivitySettingsKeyS... |
plib/ui/dialogs/expandable_dialog.h"
#include "applib/ui/option_menu_window.h"
#include "applib/ui/ui.h"
#include "kernel/core_dump.h"
#include "kernel/event_loop.h"
#include "kernel/pbl_malloc.h"
#include "kernel/ui/modals/modal_manager.h"
#include "mfg/mfg_info.h"
#include "mfg/mfg_serials.h"
#include "resource/resou... | status_bar_layer_init(status_layer) | ;
status_bar_layer_set_title(status_layer, text, false, false);
status_bar_layer_set_separator_mode(status_layer, OPTION_MENU_STATUS_SEPARATOR_MODE);
status_bar_layer_set_colors(status_layer, GColorWhite, GColorBlack);
layer_add_child(&window->layer, status_bar_layer_get_layer(status_layer));
}
// Deinit the c... |
);
}
static int prv_get_overlap_line_length(TimelineLayer *layer, GRect *first_icon_frame_out,
GRect *second_icon_frame_out) {
const int full_line_length =
prv_get_line_length(layer, first_icon_frame_out, second_icon_frame_out);
return (3 * full_line_length) / 5;
}
#de... | animation_set_delay(curr_rel_bar_anim, REL_BAR_CURR_ANIM_DELAY(duration)) | ;
animation_set_duration(curr_rel_bar_anim, REL_BAR_CURR_ANIM_DURATION(duration));
animation_set_custom_interpolation(curr_rel_bar_anim, interpolate);
}
return curr_rel_bar_anim;
}
#define REL_BAR_LINE_CHECK_LENGTH 6
#define REL_BAR_LINE_WIDTH 2
#define REL_BAR_LINE_HORIZ_OFFSET ((SIDEBAR_WIDTH / 2) + (R... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_IF_RECT_ELSE(107, 104) | ,
.size_h = 58,
},
};
static const MusicAppSizeConfig s_music_size_config_large = {
.music_time_font_key = FONT_KEY_GOTHIC_18_BOLD,
.no_music_font_key = FONT_KEY_GOTHIC_28,
.horizontal_margin = 10,
.artist_field = {
.origin_y = 30,
.size_h = 21,
},
.title_field = {
.origin_y = 60,
.s... |
ServiceInfo service_info;
HRMSessionRef manager_session;
} s_ble_hrm_session;
typedef enum {
HrmSharingPermission_Unknown,
HrmSharingPermission_Granted,
HrmSharingPermission_Declined,
} HrmSharingPermission;
typedef struct BLEHRMSharingPermission {
ListNode node;
BTDeviceInternal device;
//! Whether th... | bt_unlock() | ;
return (max_devices - ctx.slots_left);
}
static void prv_ble_hrm_handle_hrm_data(PebbleEvent *e, void *context) {
if (!s_ble_hrm_is_inited) {
return;
}
if (s_ble_hrm_subscription_count == 0) {
return;
}
PBL_ASSERTN(e->type == PEBBLE_HRM_EVENT);
const PebbleHRMEvent *const hrm_event = &e->hrm;
... |
he License for the specific language governing permissions and
* limitations under the License.
*/
//! This file displays the main Quick Launch menu that is found in our settings menu
//! It allows the feature to be enabled or for an app to be set
//! The list of apps that the user can choose from is found in settin... | (s_button_order[row]) | ;
}
static uint16_t prv_num_rows_cb(SettingsCallbacks *context) {
return NUM_BUTTONS;
}
static void prv_appear(SettingsCallbacks *context) {
QuickLaunchData *data = (QuickLaunchData *)context;
prv_update_app_names(data);
}
static Window *prv_init(void) {
QuickLaunchData *data = app_malloc_check(sizeof(*data)... |
nnectedClosedAwaitingResetCompleteSelfInitiatedReset)) {
client->out.reset_packet_to_send = (const PPoGATTPacket) {
.sn = 0,
.type = PPoGATTPacketTypeResetComplete,
};
prv_send_next_packets(client);
}
client->state = StateConnectedOpen;
client->session = session;
if (prv_client_supports... | if (client->in.next_expected_data_sn == packet->sn) {
client->out.ack_packet_to_send = (const PPoGATTPacket) {
.sn = client->in.next_expected_data_sn,
.type = PPoGATTPacketTypeAck,
};
prv_send_next_packets(client);
client->in.next_expected_data_sn = prv_next_sn(client->in.next_expected_data... |
}
// -------------------------------------------------------------------------------------------------
static void prv_handle_data_notification(PPoGATTClient *client,
const uint8_t *value, uint16_t value_length) {
// PBL_LOG(LOG_LEVEL_DEBUG, "IN:");
// PBL_HEXDUMP(LOG_LEVEL... |
ScrollingAnimationStateCount,
0 /* additional_crumbs */);
}
// Tests
//////////////////////
void test_action_menu_window__wide_display_mode_with_just_titles(void) {
ActionMenuLevel *root_level = action_menu_level_create(3);
action_menu_level_add_action(root_level,
"I will text... | (gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
case 0:
return 0x00000000;
case 1:
case 2:
// This is done to create a checkerboard pattern for gray
return (row_number % 2) ? 0xAAAAAAAA : 0x55555555;
case 3:
return 0xFFFFFFFF;
default:
WTF;
} |
}
void prv_assign_line_horizontal_non_aa(GContext* ctx, int16_t y, int16_t x1, int16_t x2) {
y += ctx->draw_state.drawing_box.origin.y;
x1 += ctx->draw_state.drawing_box.origin.x;
x2 += ctx->draw_state.drawing_box.origin.x;
// Clip results
const int y_min = ctx->draw_state.clip_box.origin.y;
const int y_... |
{ 888, 104, -168},
{ 848, 120, -216},
{ 808, 80, -280},
{ 872, 144, -392},
{ 936, 192, -400},
{ 1008, 208, -408},
{ 1000, 152, -464},
{ 1216, 240, -448},
{ 1176, 224, -392},
{ 1200, 280, -384},
{ 1136, 200, -336},
{ 952, 256, -272},
{ 936, 288, -296},
{ 840, 248, ... | { 1136, 40, -112},
{ 1176, -96, 16},
{ 1024, -224, 176},
{ 1032, -152, -16},
{ 1080, -8, -88},
{ 1048, -56, -88},
{ 1056, -80, -112},
{ 976, -88, -192},
{ 920, -120, -232},
{ 976, -136, -216},
// 13 seconds
{ 928, -136, -192},
{ 896, -96, -192},
{ 984, -16, -200},... |
{ 1000, -88, -56},
{ 1048, -96, -72},
{ 1072, -96, -80},
{ 1040, -112, -112},
{ 1056, -96, -152},
{ 1048, -168, -144},
{ 1032, -256, -120},
{ 1064, -344, -112},
{ 1080, -360, -224},
{ 1160, -584, -360},
{ 1320, -456, -376},
{ 1152, -280, -160},
{ 1128, -120, -136},
... |
n application is uninstalled
static void prv_app_removed_callback(const AppInstallId install_id, void *data) {
AppMenuDataSource *data_source = data;
prv_send_callback_to_app(data_source, install_id, APP_REMOVED);
}
//! Must be run from the app task
static void prv_do_app_icon_name_updated(AppMenuDataSource *sourc... | if (source->is_list_loaded == false) {
return;
} | |
et();
}
static void prv_noop_sample_handler(void *context) {
}
static void prv_validate_sample_rates(int *arr, int num_samples) {
for (int i = 0; i < num_samples; i++) {
// force a compiler error if user has not added all possible sample rates to array
switch ((AccelSamplingRate)arr[i]) {
case ACCEL_... | cl_assert_equal_i(samples_per_update, ARRAY_LENGTH(fake_buf)) | ;
}
void test_accel_manager__batched_samples(void) {
AccelRawData fake_buf[30];
stub_pebble_tasks_set_current(PebbleTask_KernelMain);
AccelManagerState *main_session = sys_accel_manager_data_subscribe(
ACCEL_SAMPLING_10HZ, prv_noop_sample_handler, NULL, PebbleTask_KernelMain);
sys_accel_manager_set_sam... |
erase_block(sector_addr, SECTOR_SIZE_BYTES) | ;
}
uint32_t flash_get_subsector_base_address(uint32_t flash_addr) {
return flash_addr & ~(SUBSECTOR_SIZE_BYTES - 1);
}
void flash_erase_subsector_blocking(uint32_t subsector_addr) {
erase_block(subsector_addr, SUBSECTOR_SIZE_BYTES);
}
uint32_t flash_get_sector_base_address(uint32_t flash_addr) {
#if PLATFORM_SN... | |
copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for th... | (ctx, command_list, NULL) | ;
}
static bool prv_iterate_max_command_size(GDrawCommand *command, uint32_t idx, void *ctx) {
size_t *size = ctx;
const size_t command_size = gdraw_command_get_data_size(command);
if (command_size > *size) {
*size = command_size;
}
return true;
}
T_STATIC size_t prv_get_list_max_command_size(GDrawComma... |
ession *session, uint16_t endpoint_id,
const uint8_t *data, size_t length, uint32_t timeout_ms) {
if (!session) {
return false;
}
SendBuffer *sb = comm_session_send_buffer_begin_write(session, endpoint_id, length, timeout_ms);
if (!sb) {
PBL_LOG(LOG_LEVEL_WARNING, "Could not ... | {
return session;
} |
// If we don't find one, try to find a QEMU session as a last resort
return prv_find_session_by_type(CommSessionTransportType_QEMU);
}
static CommSession *prv_get_session_by_type(CommSessionType type) {
switch (type) {
case CommSessionTypeSystem:
return prv_get_system_session();
case CommSessionT... |
/*
* 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... | {
dbgserial_putchar('>');
s_dbgserial_prompt_context.write_index = 0;
} |
void console_switch_to_prompt(void) {
serial_console_set_state(SERIAL_CONSOLE_STATE_PROMPT);
dbgserial_putstr("");
start_prompt();
}
/////////////////////////////////////////////////////////////////
// Prompt infrastructure
/////////////////////////////////////////////////////////////////
typedef void (*Comma... |
/*
* 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... | (&draw_state->clip_box, &saved_state->clip_box) | ;
}
static void prv_restore_drawing_state(DrawingStateOrigins *saved_state, GContext *ctx) {
ctx->draw_state.drawing_box.origin = saved_state->drawing_box_origin;
ctx->draw_state.clip_box = saved_state->clip_box;
}
void prv_render_legacy2_system_status_bar(GContext *ctx, Window *window) {
if (!window->is_fullsc... |
/*
* 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... | animation_sequence_create(Animation *animation_a, Animation *animation_b,
Animation *animation_c, ...) {
va_list args;
va_start(args, animation_c);
Animation *animation = prv_create_from_vararg(animation_a, animation_b, animation_c, args);
va_end(args);
return animati... | {
return prv_create_from_array(animation_array, array_len);
}
Animation *WEAK animation_spawn_create(Animation *animation_a, Animation *animation_b,
Animation *animation_c, ...) {
va_list args;
va_start(args, animation_c);
Animation *animation = prv_create_from_vararg(an... |
ics_external_collect_app_flash_read_stats();
}
// ---------------------------------------------------------------------------------------------
//! This method returns true if the process is safe to kill (it has exited out of it's main function). If the
//! the process is not already safe to kill, it will "prod" it t... | {
// Right before a syscall drops privilege, it calls
// process_manager_force_close_syscall_exit_trap to check whether
// it is about to return control to a misbehaving app. This
// function checks the process context's closing state and makes
// the process safe to kill if its state is s... | |
.
* 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 or implied.
* ... | prv_send_connection_event(false) | ;
check_waiting_to_send_second_disconnect();
// No event put
cl_assert_equal_i(s_event_count, 0);
}
void test_debounced_connection_service__disconnected_wait_disconnected(void) {
//! Currently disconnected
init(false /* disconnected */);
check_disconnected();
//! Get disconnected event
prv_send_con... |
/*
* 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 we haven't had the length set yet, just assume we're ok.
if (entry->length == ENTRY_LENGTH_UNSET) {
return num_bytes;
}
uint32_t resource_offset = store_offset - entry->offset;
if (entry->length < resource_offset) {
PBL_LOG(LOG_LEVEL_ERROR, "Resource offset past its own ending.");
return... |
static uint32_t prv_read(ResourceStoreEntry *entry, uint32_t offset, void *data, size_t num_bytes) {
num_bytes = prv_check_resource_bounds(entry, offset, num_bytes);
if (!num_bytes) {
return 0;
}
return entry->impl->read(entry, offset, data, num_bytes);
}
static void prv_get_manifest(ResourceStoreEntry *... |
/*
* 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 (isupper(c)) return (c - 'A') + 10; |
if (islower(c)) return (c - 'a') + 10;
return -1;
}
static uint8_t ascii_hex_to_uint(const uint8_t msb, const uint8_t lsb) {
return 16 * ascii_hex_to_int(msb) + ascii_hex_to_int(lsb);
}
uintptr_t str_to_address(const char *address_str) {
unsigned int address_str_length = strlen(address_str);
if (address_... |
* ACTIVITY_CALORIES_PER_KCAL;
int minute_of_day = time_util_get_minute_of_day(utc_now);
s_activity_state.resting_calories = activity_private_compute_resting_calories(minute_of_day);
key = ActivitySettingsKeyLastSleepActivityUTC;
settings_file_get(file, &key, sizeof(key),
... | {
syscall_assert_userspace_buffer(sessions, sizeof(*sessions) * (*session_entries));
} |
}
return activity_get_sessions(session_entries, sessions);
}
// ------------------------------------------------------------------------------------------------
DEFINE_SYSCALL(bool, sys_activity_prefs_heart_rate_is_enabled, void) {
return activity_prefs_heart_rate_is_enabled();
}
// ------------------------... |
lue = 2,.y.raw_value = 7 }
};
memcpy(command->precise_points, points, sizeof(points));
gdraw_command_draw(NULL, command);
cl_assert_equal_i(1, s_path_fill_precise_count);
cl_assert(prv_compare_points((GPoint*)points, s_fill_points, s_path_num_points));
cl_assert_equal_i(1, s_path_stroke_precise_count);
... | (s_fill_color.argb, GColorRedARGB8) | ;
cl_assert_equal_i(s_stroke_width, 0);
cl_assert_equal_i(s_path_num_points, 1);
cl_assert_equal_b(s_path_open, false);
cl_assert_equal_i(s_circle_fill_count, 1);
cl_assert_equal_i(s_circle_stroke_count, 0);
cl_assert_equal_p(s_stroke_points, NULL);
cl_assert(prv_compare_points(¢er, s_fill_points, s_p... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (buffer, data.model, sizeof(data.model)) | ;
data.model[MFG_INFO_MODEL_STRING_LENGTH - 1] = '\0'; // Just in case
}
void mfg_info_set_model(const char* model) {
MfgData data = prv_fetch_struct();
strncpy(data.model, model, sizeof(data.model));
data.model[MFG_INFO_MODEL_STRING_LENGTH - 1] = '\0';
prv_update_struct(&data);
}
void mfg_info_update_const... |
sec = 0, // 13:00:00
.tm_year = 10015 - 1900, .tm_mon = 0, .tm_mday = 2, // 10015/01/02
.tm_wday = 5, .tm_yday = 1, // Friday, 2nd day of the year
.tm_gmtoff = 0, .tm_isdst = 0, .tm_zone = "UTC", // No DST, UTC+0
};
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%02a %01A %06b %04B", &jan_2_10015__... | localized_strftime(tmbuf, sizeof(tmbuf), "%c", &jan_2_2015__13_00_00, i18n_get_locale()) | ;
cl_assert_equal_s(tmbuf, "Fri Jan 2 13:00:00 2015");
s_i18n_translate = true;
s_i18n_locale_other = false;
tmbuf[0] = '\0';
localized_strftime(tmbuf, sizeof(tmbuf), "%a %A %b %B", &jan_2_2015__13_00_00, NULL);
cl_assert_equal_s(tmbuf, "Hola Hola Hola Hola");
tmbuf[0] = '\0';
localized_strftime(tmbuf... |
PerftestTextString s_perftest_text_strings[TestStringCount] = {
[TestString_Best] = {
.string = "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM... | dialog_load(dialog) | |
ata);
if (source == ManualDNDFirstUseSourceActionMenu) {
prv_push_first_use_dialog(msg, prv_toggle_manual_dnd_from_action_menu);
} else {
prv_push_first_use_dialog(msg, prv_toggle_manual_dnd_from_settings_menu);
}
}
static void prv_try_update_schedule_mode(void *data) {
const bool clear_override = (boo... | prv_is_current_schedule_enabled() | && s_data.is_in_schedule_period &&
!s_data.manually_override_dnd);
}
static bool prv_is_smart_dnd_active(void) {
return (calendar_event_is_ongoing() &&
do_not_disturb_is_smart_dnd_enabled() &&
!s_data.manually_override_dnd);
}
//////////////////////////////////////////////////////////... |
{
strncpy(buffer, EN_DASH, buffer_size);
return;
}
health_util_format_hours_and_minutes(buffer, buffer_size, sleep_duration, i18n_owner);
}
static void prv_set_avg(char *buffer, size_t buffer_size, int32_t daily_avg, void *i18n_owner) {
#if PBL_ROUND
int avg_len = snprintf(buffer, buffer_size, "%s\n", i... | app_free(card_data->zones[i].label) | ;
}
i18n_free_all(card_data);
app_free(card_data);
health_detail_card_destroy(card);
}
|
NDS_PER_MINUTE,
HRMFeature_BPM);
fake_system_task_callbacks_invoke_pending();
cl_assert_equal_b(hrm_is_enabled(HRM), false);
// 3. Enabling with a subscriber should turn HRM on
hrm_manager_enable(true);
fake_system_task_callbacks_invoke_pending();
... | hrm_is_enabled(HRM) | , false);
}
void test_hrm_manager__can_turn_sensor_on(void) {
fake_event_set_callback(prv_charger_event_cb);
cl_assert(prv_can_turn_sensor_on());
// Add a subscription so we have a reason to turn the sensor on (if the conditions are right)
sys_hrm_manager_app_subscribe(1, 1, 60, HRMFeature_BPM);
fake_syste... |
n);
}
//////////////////////
// Player Callbacks
//////////////////////
static void prv_player_frame_did_change(KinoPlayer *player, void *context) {
KinoLayer *kino_layer = context;
layer_mark_dirty((Layer *)kino_layer);
}
static void prv_player_did_stop(KinoPlayer *player, bool finished, void *context) {
Kino... | kino_reel_get_size(reel) | ;
GRect rect = (GRect){{0, 0}, size};
grect_align(&rect, &kino_layer->layer.bounds, kino_layer->alignment, false /*clips*/);
return rect;
}
void kino_layer_set_callbacks(KinoLayer *kino_layer, KinoLayerCallbacks callbacks, void *context) {
kino_layer->callbacks = callbacks;
kino_layer->context = context;
}
|
RT_TASK(PebbleTask_KernelBackground);
} else if ((prev_state == SmartstrapStateReadInProgress) &&
(new_state == SmartstrapStateReadComplete)) {
PBL_ASSERTN(mcu_state_is_isr() || (pebble_task_get_current() == PebbleTask_NewTimers));
} else if ((prev_state == SmartstrapStateReadComplete) &&
... | {
if (!smartstrap_is_connected()) {
return false;
}
mutex_lock(s_services_lock);
bool result = prv_find_connected_service(service_id) != -1;
mutex_unlock(s_services_lock);
return result;
} | |
eTask_App) {
if (context->app_md->is_rocky_app) {
analytics_inc(ANALYTICS_APP_METRIC_ROCKY_CRASHED_COUNT, AnalyticsClient_App);
}
analytics_inc(ANALYTICS_APP_METRIC_CRASHED_COUNT, AnalyticsClient_App);
} else if (task == PebbleTask_Worker) {
analytics_inc(ANALYTICS_APP_METRIC_BG_CRAS... | PBL_LOG(LOG_LEVEL_DEBUG, "Check if we can force stop the %s task", pebble_task_get_name(task)) | |
d_gothic_codepoints_utf8 = (utf8_t*) s_valid_gothic_codepoints_string;
for (int i = 0; i < NUM_GOTHIC_CODEPOINTS; i++) {
uint32_t decoded_codepoint = utf8_peek_codepoint(valid_gothic_codepoints_utf8, NULL);
uint32_t actual_codepoint = s_valid_gothic_codepoints[i];
cl_assert_equal_i(decoded_codepoint, act... | (output_buffer, 12) | ;
trunc_size = utf8_truncate_with_ellipsis("Hello there", output_buffer, 12);
cl_assert_equal_s(output_buffer, "Hello there");
cl_assert_equal_i(trunc_size, 12);
// test that our utf8 support works properly and doesn't split multibyte characters
output_buffer = realloc(output_buffer, 19);
trunc_size = utf8... |
ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax2_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"));
// AA = false, SW = 11
setup_test_aa_sw(&ctx, f... | (&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 2) | ;
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 2);
graphics_draw_round_rect(&ctx, &OFFSET_DR... |
formation_data;
*info = (SystemInformationData){};
bool success = version_copy_recovery_fw_version(info->recovery_version_string,
ARRAY_LENGTH(info->recovery_version_string));
if (success == false) {
info->recovery_version_string[0] = '\0';
}
sniprintf(i... | (rt_rect, horizontal_padding, vertical_padding) | ;
// Calculate where the mark should be drawn
const GSize mark_size = mark->bounds.size;
GRect mark_rect = (GRect) { .size = mark_size };
// If the cell is selected, align the mark at the top center so we can draw the text below it
const GAlign alignment = is_selected ? GAlignTop : GAlignCenter;
grect_alig... |
eleted yet until the top-level
// animation is done.
uint32_t duration = animation_get_duration(a, false, false);
cl_assert_equal_i(duration, duration_a);
// -------------------------------------------------------------------------------------
// Advance to the end
animation_set_elapsed(complex, duration_... | (prv_count_handler_entries(&s_stopped_handler_calls, a), 1) | ;
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), ... |
>session_ref,
};
PBL_ASSERTN(prv_event_put(state, &hrm_event));
state->sent_expiration_event = true;
}
if (state->expire_utc && (utc_now >= state->expire_utc)) {
// This subscription has expired
expired_state = state;
}
state = (HRMSubscriberState *)state->list_node.next;
... | system_task_add_callback(prv_update_hrm_enable_system_cb, NULL) | ;
mutex_unlock_recursive(s_manager_state.lock);
return state->session_ref;
}
DEFINE_SYSCALL(HRMSessionRef, sys_hrm_manager_app_subscribe,
AppInstallId app_id, uint32_t update_interval_s, uint16_t expire_sec, HRMFeature features) {
return hrm_manager_subscribe_with_callback(app_id, update_interval_s, expire_... |
app_timer_register(interval_ms, (AppTimerCallback) animation_legacy2_timer_callback,
animation_legacy2_scheduler);
PBL_ASSERTN(animation_legacy2_scheduler->timer_handle != NULL);
}
}
static void animation_legacy2_private_schedule(AnimationLegacy2 *animation,
AnimationLegacy... | {
AnimationLegacy2Scheduler *animation_legacy2_scheduler = get_current_scheduler();
return list_contains(animation_legacy2_scheduler->head, &animation->list_node);
} |
static void animation_legacy2_private_run(AnimationLegacy2Scheduler *animation_legacy2_scheduler) {
AnimationLegacy2 *animation = (AnimationLegacy2 *) animation_legacy2_scheduler->head;
const uint32_t now = animation_legacy2_get_ms_since_system_start();
while (animation) {
const int32_t rel_ms_running = s... |
_16(prop_h, &test_value);
cl_assert_equal_fixed_s32_16(test_value, end_value);
Fixed_S32_16 set_value;
set_value = FIXED_S32_16_ONE;
property_animation_set_from_fixed_s32_16(prop_h, &set_value);
property_animation_get_from_fixed_s32_16(prop_h, &test_value);
cl_assert_equal_fixed_s32_16(test_value, FIXED_S3... | (&implementation, &value, &start_value, NULL) | ;
Animation *h = property_animation_get_animation(prop_h);
void *context = &value;
animation_set_handlers(h, handlers, context);
animation_set_duration(h, duration);
prv_clear_handler_histories();
uint64_t start_ms = prv_now_ms();
animation_schedule(h);
// Test the accessor functions
GColor8 test_... |
AppMenuDataSource *source, AppMenuNode *node) {
cl_assert(source);
cl_assert(node);
if (!node->icon_resource_id) {
return &s_default_app_icon_bitmap;
}
gbitmap_deinit(&s_app_icon_bitmap);
gbitmap_init_with_resource(&s_app_icon_bitmap, node->icon_resource_id);
return &s_app_icon_bitmap;
}
//! We use... | app_glance_service_init() | ;
// Default to showing bitmap icons
s_use_pdc_icons = false;
}
void app_glance_db_deinit(void);
void test_launcher_menu_layer__cleanup(void) {
app_glance_db_deinit();
gbitmap_deinit(&s_app_icon_bitmap);
gbitmap_deinit(&s_default_app_icon_bitmap);
free(fb);
}
// Helpers
//////////////////////
//! Decla... |
->circle_color.argb + 1) & 0x3F) | 0xC0);
}
} else if (shape == GPATH_TRIANGLE) {
// Move the line 3*X per Y
data->triangle_offset.x += (data->triangle_velocity_x * PIXEL_SPEED_PER_FRAME * 3);
if (data->triangle_offset.x < 0 ||
data->triangle_offset.x > data->window.layer.bounds.si... | {
AppData *data = app_state_get_user_data();
graphics_context_set_fill_color(ctx, GColorBlack);
if (stroke_width_enabled(data->state_index)) {
graphics_context_set_stroke_width(ctx, data->stroke_width);
} else {
graphics_context_set_stroke_width(ctx, 1);
}
graphics_context_set_antialiased(ctx, 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... | (crc, buffer, num_bytes) | ;
}
|
OP_FLAG_OVERWRITE | OP_FLAG_READ,
file->max_used_space);
if (status < 0) {
PBL_LOG(LOG_LEVEL_ERROR,
"Could not open temporary file to compact settings file. Error %"PRIi32".",
status);
return status;
}
settings_raw_iter_begin(&new_file.iter);
for (... | {
if (prv_is_desired_hdr(iter, key, key_len)) {
return true;
}
} |
// No record found
return false;
}
static status_t cleanup_partial_transactions(SettingsFile *file) {
for (settings_raw_iter_begin(&file->iter); !settings_raw_iter_end(&file->iter);
settings_raw_iter_next(&file->iter)) {
if (partially_written(&file->iter.hdr)) {
// Compact will remove partiall... |
const TimelineLayerStyle *style = prv_get_style();
frame->origin.y += is_future ? style->future_day_sep_dot_offset_y :
style->past_day_sep_dot_offset_y;
// Remove the built-in margins and subtract the sidebar
frame->origin.x -= style->left_margin;
frame->size.w += ((style->lef... | ((LayoutLayer *)timeline_layout, mode) | |
{ 408, 640, -632},
{ 416, 592, -632},
{ 416, 584, -640},
{ 408, 608, -640},
{ 400, 600, -632},
{ 400, 632, -632},
{ 432, 688, -616},
{ 424, 664, -632},
{ 408, 656, -632},
{ 376, 432, -696},
// 243 seconds
{ 392, 656, -656},
{ 464, 608, -632},
{ 336, 568, -744},
{ ... | { 424, 624, -656},
{ 392, 664, -656},
{ 400, 560, -664},
{ 408, 576, -656},
{ 416, 592, -648},
{ 408, 624, -656},
{ 416, 568, -648},
{ 416, 592, -648},
{ 408, 624, -648},
{ 408, 600, -648},
{ 416, 576, -656},
{ 416, 608, -656},
{ 416, 616, -656},
{ 440, 520, -616}... |
{ 392, 536, -712},
{ 384, 528, -712},
{ 376, 560, -712},
{ 376, 536, -704},
// 251 seconds
{ 384, 576, -704},
{ 384, 528, -712},
{ 384, 504, -712},
{ 376, 544, -712},
{ 384, 544, -712},
{ 384, 544, -712},
{ 376, 520, -720},
{ 376, 528, -712},
{ 384, 544, -712},
... |
}
break;
case WordStateJoining:
if (codepoint == NEWLINE_CODEPOINT) {
new_state = WordStateEnd;
} else if (codepoint_is_ideograph(codepoint)) {
new_state = WordStateIdeograph;
} else if (codepoint == WORD_JOINER_CODEPOINT) {
new_state = WordStateJoining;
}... | {
if (!iter_next(char_iter)) {
return false;
}
} |
while (codepoint_is_zero_width(utf8_iter_state->codepoint)) {
if (utf8_iter_state->codepoint == 0) {
PBL_ASSERTN(utf8_iter_state->current == utf8_iter_state->bounds->end);
return false;
}
if (!iter_next(char_iter)) {
break;
}
}
return true;
}
static bool prv_line_iter_is_ver... |
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 "dbgserial.h"
#include "drivers/gpio.h"
#include "drivers/periph_config.h"
#include "stm32... | (raw_length) | ];
size_t cooked_length = cobs_encode(cooked_packet, raw_packet, raw_length);
prv_putchar(FRAME_DELIMITER);
for (size_t i = 0; i < cooked_length; ++i) {
if (cooked_packet[i] == FRAME_DELIMITER) {
prv_putchar('\0');
} else {
prv_putchar(cooked_packet[i]);
}
}
prv_putchar(FRAME_DELIMITE... |
torConfig dummy_config = helper_get_dummy_config();
const ContentIndicatorDirection direction = ContentIndicatorDirectionUp;
dummy_config.layer->update_proc = s_content_indicator_dummy_layer_update_proc;
cl_assert(content_indicator_configure_direction(&content_indicator, direction, &dummy_config));
cl_assert_eq... | content_indicator_init(&content_indicator) | ;
ContentIndicatorDirectionData *direction_data = content_indicator.direction_data;
const ContentIndicatorConfig dummy_config = helper_get_dummy_config();
const ContentIndicatorDirection direction = ContentIndicatorDirectionUp;
dummy_config.layer->update_proc = s_content_indicator_dummy_layer_update_proc;
c... |
COMPOSITE_TEST_OFFSET_Y));
prv_composite_test_draw_bitmap(&s_ctx, bitmap, offset_point, compositing_mode);
// Check the result
char unit_test_result_image_file_base_name[PATH_STRING_LENGTH] = {0};
snprintf(unit_test_result_image_file_base_name, PATH_STRING_LENGTH,
... | (gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)) | ;
}
void test_graphics_draw_bitmap__composite_assign(void) {
prv_composite_test(__func__, GCompOpAssign);
}
void test_graphics_draw_bitmap__composite_assign_inverted(void) {
prv_composite_test(__func__, GCompOpAssignInverted);
}
void test_graphics_draw_bitmap__composite_or(void) {
prv_composite_test(__func__, ... |
/*
* 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... | memcpy(data->value, value, value_length) | ;
hc_protocol_enqueue_with_payload(HcEndpointID_Gatt, HcMessageID_Gatt_ReadCompleted,
(uint8_t *)data, alloc_size);
kernel_free(data);
}
void hc_endpoint_gatt_send_write_complete(const BTDeviceInternal *addr, uint16_t handle,
BLEGATTError... |
nt_app_md()->process_type == ProcessTypeWatchface);
}
ResAppNum app_manager_get_current_resource_num(void) {
return process_metadata_get_res_bank_num(s_app_task_context.app_md);
}
AppLaunchReason app_manager_get_launch_reason(void) {
return s_next_app.common.reason;
}
ButtonId app_manager_get_launch_button(void)... | analytics_inc(ANALYTICS_DEVICE_METRIC_APP_QUICK_LAUNCH_COUNT, AnalyticsClient_System) | ;
analytics_inc(ANALYTICS_APP_METRIC_QUICK_LAUNCH_COUNT, AnalyticsClient_App);
} else if (launch_reason == APP_LAUNCH_USER) {
analytics_inc(ANALYTICS_DEVICE_METRIC_APP_USER_LAUNCH_COUNT, AnalyticsClient_System);
analytics_inc(ANALYTICS_APP_METRIC_USER_LAUNCH_COUNT, AnalyticsClient_App);
}
}
// -------... |
turb_handle_clock_change(); // In scheduled period
active = do_not_disturb_is_active();
cl_assert(active == true); // Both ON
rtc_set_time(s_thursday_13_00);
do_not_disturb_handle_clock_change(); // Out of scheduled period
active = do_not_disturb_is_active();
cl_assert(active == false); // Both should be t... | cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_SECOND) | ;
rtc_set_time(s_saturday_00_30);
do_not_disturb_handle_clock_change();
active = do_not_disturb_is_active();
cl_assert(active == false);
// Timer will go off at 01:00 on Saturday. (0.5 hours)
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_SECOND);
rtc_set_time(s_saturday_01_... |
_unschedule_animation(state, animation, animation->is_completed,
!animation->parent /*allow_destroy*/, false /*force_destroy*/,
!animation->parent /*teardown*/);
} else {
blocked_on_children_complete = true;
}
}
return blocked_on_children_c... | {
return false;
} |
animation_array[0] = animation_a;
animation_array[1] = animation_b;
if (animation_c) {
// If c is not NULL, we need to figure out the array length
animation_array[array_len++] = animation_c;
while (array_len < max_args) {
void *arg = va_arg(args, void *);
if (arg == NULL) {
break... |
/*
* 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... | prv_put_dnd_event(is_active) | |
ing this animation shouldn't run yet.
break;
}
// Get a pointer to next now, because after possible unscheduling, this animation may change
// into a node of the unscheduled list or become freed
state->aux->iter_next = list_get_next(&animation->list_node);
// If only running from... | {
success = false;
break;
} |
component->parent = parent;
component->child_idx = child_idx++;
used_children[i] = true;
}
if (!success) {
for (uint32_t i = 0; i < array_len; i++) {
if (!used_children[i]) {
continue;
}
// Undo setting of the parent and child_idx on the components we modified.
Anim... |
tionSessionStatusSuccess));
}
sys_light_reset_to_timed_mode();
prv_teardown(data);
}
static void prv_handle_error_retries(VoiceUiData *data) {
if (data->error_count < MAX_ERROR_COUNT) {
VOICE_LOG("Restarting dictation after error");
prv_start_dictation(data);
} else {
VOICE_LOG("Too many errors... | if (connected) {
if (data->state == StateError) {
// We got here after a dictation result timeout, so restart the dictation
prv_start_dictation(data);
} else {
prv_voice_window_push(data);
}
} else {
VOICE_LOG("Bluetooth not restored! Exiting...");
prv_exit_and_send_result_event(... | |
r state structure
gb_storage_cleanup(&state->storage, true /* successful */);
kernel_free(state);
s_get_bytes_in_progress = false;
prv_put_status_event(DebugInfoStateFinished);
comm_session_set_responsiveness(state->session, BtConsumerPpGetBytes, ResponseTimeMax, 0);
return;
} else {
com... | if (!prv_setup_state_for_command(hdr->cmd_id, state, msg_data, msg_len)) {
kernel_free(state);
prv_protocol_send_err_response(session, hdr->transaction_id, GET_BYTES_MALFORMED_COMMAND);
return;
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
// the count is 1 byte (1-127)
ctx->zeros_remaining = byte - 1;
} | else {
ctx->zeros_remaining = (((byte & 0x7f) << 8) | *(ctx->sle_buffer++)) + 0x80 - 1;
}
*out = 0;
}
}
return true;
}
|
NSTALL_ID_INVALID) {
// If we get here, the app exit reason didn't override the destination app ID
if (!s_next_app.md) {
destination_app_id = system_app_state_machine_get_last_registered_app();
} else {
// If we get here, s_next_app is already setup and so we can call prv_app_switch() directly
... | (buffer, sizeof(buffer), "is watchface: %d",
(app_metadata->process_type == ProcessTypeWatchface)) | ;
prompt_send_response_fmt(buffer, sizeof(buffer), "visibility: %u", app_metadata->visibility);
prompt_send_response_fmt(buffer, sizeof(buffer), "bank: %d",
(uint8_t) process_metadata_get_res_bank_num(app_metadata));
} else {
prompt_send_response("metadata lookup failed: no ap... |
G
if (!data->alarm_info.is_smart && !activity_prefs_tracking_is_enabled()) {
// Notify about Health and keep the menu open
health_tracking_ui_feature_show_disabled();
return;
}
#endif
alarm_set_smart(data->alarm_id, !data->alarm_info.is_smart);
if (data->alarm_editor_callback) {
data->alarm_edi... | i18n_get("Change Time", data) | ,
.perform_action = prv_edit_time_handler,
.action_data = data,
};
main_menu->items[DetailMenuItemIndexChangeDays] = (ActionMenuItem) {
.label = i18n_get("Change Days", data),
.perform_action = prv_edit_day_handler,
.action_data = data,
};
#if CAPABILITY_HAS_HEALTH_TRACKING
main_menu->items[... |
sleep_card;
DebugCard debug_card;
ResultsCard results_card;
HeartRateCard hr_card;
uint32_t steps_offset;
uint32_t cur_steps;
uint32_t lap_steps;
time_t bed_time_utc;
time_t awake_time_utc;
uint32_t cur_hr_bpm;
uint32_t resting_hr_bpm;
uint32_t num_hr_alerts;
HealthMetricAlert *hr_alert;
} Healt... | {
HealthAPITestAppData *data = (HealthAPITestAppData *)context;
window_stack_pop(true);
window_stack_push(data->hr_window, true);
} | |
(driver_event < TouchDriverEventCount) | ;
mutex_lock(s_touch_mutex);
for (uint32_t i = 0; i < ARRAY_LENGTH(s_touch_ctx); i++) {
TouchContext *ctx = &s_touch_ctx[i];
prv_touch_context_reset(ctx);
// If there is an event on the kernel queue, we need to set a flag to not dispatch touches in
// the queue when that event is called, because t... | |
ebuffer.h"
#include "applib/graphics/graphics.h"
#include "applib/ui/app_window_stack.h"
#include "applib/ui/content_indicator.h"
#include "applib/ui/content_indicator_private.h"
#include "applib/ui/dialogs/simple_dialog.h"
#include "applib/ui/text_layer.h"
#include "applib/ui/window_private.h"
#include "resource/resou... | resource_init() | ;
}
void test_simple_dialog__cleanup(void) {
free(fb);
gbitmap_destroy(s_dest_bitmap);
s_dest_bitmap = NULL;
}
// Helpers
//////////////////////
void prv_push_and_render_simple_dialog(Dialog *dialog) {
gbitmap_destroy(s_dest_bitmap);
const int16_t bitmap_width = DISP_COLS;
const int16_t bitmap_height =... |
/*
* 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... | ios_notif_pref_db_free_prefs(notif_prefs) | ;
return has_reply_action;
}
static void prv_blobdb_event_handler(PebbleEvent *event, void *context) {
const PebbleBlobDBEvent *blobdb_event = &event->blob_db;
if (blobdb_event->db_id != BlobDBIdiOSNotifPref) {
return;
}
if (blobdb_event->type != BlobDBEventTypeFlush &&
memcmp(blobdb_event->key, (... |
e.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* ... | {
PBL_ASSERTN(s_layer_up);
PBL_ASSERT(length <= pulse_link_max_send_size() - sizeof(BestEffortPacket),
"Packet too big to send");
// We're blindly assuming that buf is the same pointer returned by
// pulse_best_effort_send_begin. If it isn't, we'll either crash here
// when trying to dereference ... |
// Shared events
// =============
void pulse2_best_effort_on_link_up(void) {
ppp_control_protocol_lower_layer_is_up(PULSE2_BECP);
}
void pulse2_best_effort_on_link_down(void) {
ppp_control_protocol_lower_layer_is_down(PULSE2_BECP);
}
void pulse2_best_effort_init(void) {
ppp_control_protocol_init(PULSE2_BECP);... |
lient *client) {
const uint16_t value_length = event->value_length;
uint8_t *buffer = NULL;
if (value_length) {
// This is ugly and causes double-copying the data...
// TODO: https://pebbletechnology.atlassian.net/browse/PBL-14164
buffer = (uint8_t *) kernel_malloc(value_length);
if (UNLIKELY(!bu... | (event->object_ref, event->subscription_type, event->gatt_error) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (calculated, 0) | |
}
#endif
}
}
}
}
if (!prv_task_is_masked_out(e, cur_task) && service->subscribers[cur_task]) {
// we are on the current task, so we just tell the client to handle it inline
event_service_client_handle_event(e);
}
if (stolen) {
// we stole the buffer from the event, NULL it out
... | syscall_assert_userspace_buffer(e, sizeof(PebbleEvent)) | ;
}
EventServiceBuffer *esb = prv_get_esb_for_event(e);
if (esb) {
uint16_t task_bit = 1 << pebble_task_get_current();
uint16_t intents_pending = __sync_and_and_fetch(&esb->intents_pending, ~task_bit);
if (intents_pending) {
// zero out buf_ptr so it won't be freed by cleanup. Other tasks are... |
/*
* 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... | ("AlarmSnooze") | ;
Dialog *dialog = simple_dialog_get_dialog(simple_dialog);
const char *snooze_text = i18n_noop("Snooze for %d minutes");
char snooze_buf[32];
snprintf(snooze_buf, sizeof(snooze_buf), i18n_get(snooze_text, dialog), alarm_get_snooze_delay());
i18n_free(snooze_text, dialog);
dialog_set_text(dialog, snooze_buf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.