prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
100 * SECONDS_PER_MINUTE);
activity_get_metric(ActivityMetricSleepExitAtSeconds, 1, &value);
cl_assert_equal_i(value, 2 * SECONDS_PER_HOUR + 20 * SECONDS_PER_MINUTE
/* 2:20am in minutes */);
}
// ---------------------------------------------------------------------------------------
// T... | cl_assert_equal_i(seconds,
(k_raw_samples + ALGORITHM_SAMPLING_RATE - 1) / ALGORITHM_SAMPLING_RATE) | ;
// Verify the collected data
AccelRawData captured_data[k_raw_samples];
prv_uncompress_captured_data(captured_data, k_raw_samples);
cl_assert_equal_m(raw_data, captured_data, k_raw_samples * sizeof(AccelRawData));
}
// ----------------------------------------------------------------------------... |
graphics_context_mask_destroy(ctx, mask) | ;
}
//////////////////////////////////////
// APPLYING VERTICAL LINE HELPERS //
//////////////////////////////////////
static const int16_t vline_applying_test_row_height = hline_applying_test_column_width;
static void prv_prepare_canvas_for_vline_applying_test(GContext *ctx) {
const GSize bitmap_size = GSize(nu... | |
/*
* 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 (!ctx || ctx->lock || !rect_ref) {
return;
} | |
&config, (void *)info->scheduled_days);
} else {
prv_set_alarm_kind_op(id, &config, (void *)(uintptr_t)info->kind);
}
Alarm alarm = { .id = id, .config = config };
prv_add_and_schedule_alarm(&file, &alarm);
prv_file_close_and_unlock(&file);
analytics_event_alarm(AnalyticsEvent_AlarmCreated, info);
... | prv_alarm_operation(id, prv_set_alarm_custom_op, (void *)scheduled_days) | ;
}
// ----------------------------------------------------------------------------------------------
bool alarm_get_custom_days(AlarmId id, bool scheduled_days[DAYS_PER_WEEK]) {
SettingsFile file;
if (!prv_file_open_and_lock(&file)) {
return false;
}
AlarmConfig config;
bool rv = prv_alarm_get_config(&... |
/*
* 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... | activity_tracking_on() | ) {
// tell the activity service to pool the minutes it's got so far
activity_algorithm_send_minutes();
}
// send all data logging data
dls_send_all_sessions();
// ACK
prv_send_ack_nack(true /*ok*/);
}
static void prv_handle_sync(const uint8_t *msg, size_t len) {
if (len < sizeof(HealthSyncEndpoin... |
AMS instances registered!?");
return;
}
// Keep around the BLECharacteristic references:
memcpy(s_ams_client->characteristics, characteristics,
sizeof(BLECharacteristic) * NumAMSCharacteristic);
const BLECharacteristic entity_update_characteristic =
characteristics[AMSCharacteristicEntityU... | gatt_client_op_write(characteristic,
(const uint8_t *) &command_id, 1, GAPLEClientKernel) | ;
const bool has_error = (error != BTErrnoOK);
if (has_error) {
PBL_LOG(LOG_LEVEL_ERROR, "Couldn't write command: %d", error);
prv_analytics_log_event_with_info(AMSAnalyticsEventErrorSendRemoteCommand, error);
}
}
void ams_send_command(AMSRemoteCommandID command_id) {
prv_perform_on_kernel_main_task(pr... |
(APP_LOG_LEVEL_DEBUG, "Error with \"c\": %s", buf) | ;
}
r = strftime(buf, buf_size, "%d", &good_data);
if (r == 0 || strncmp(buf, "05", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"d\": %s", buf);
}
r = strftime(buf, buf_size, "%D", &good_data);
if (r == 0 || strncmp(buf, "05/05/15", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "E... | |
read_size = prv_file_get(&ROOT_KEYS_KEY, sizeof(ROOT_KEYS_KEY),
&keys, sizeof(keys));
if (!read_size) {
return false;
}
SM128BitKey nil_key = {};
if (0 == memcmp(&nil_key, &keys[key_type], sizeof(nil_key))) {
return false;
}
if (key_out) {
memcpy(key_out, &keys[k... | {
// Skip pairing entries
return;
} |
// Re-write non-pairing entries
void *key = kernel_zalloc_check(info->key_len);
info->get_key(old_file, key, info->key_len);
void *data = kernel_malloc_check(info->val_len);
info->get_val(old_file, data, info->val_len);
settings_file_set(new_file, key, info->key_len, &data, info->val_len);
kernel_fr... |
ALTH_DB_MAX_SIZE = KiBYTES(12);
static PebbleMutex *s_mutex;
#define MOVEMENT_DATA_KEY_SUFFIX "_movementData"
#define SLEEP_DATA_KEY_SUFFIX "_sleepData"
#define STEP_TYPICALS_KEY_SUFFIX "_steps" // Not the best suffix, but we are stuck with it now...
#define STEP_AVERAGE_KEY_SUFFIX "_dailySteps"
#define SLEEP_AVERAGE_... | (key, MOVEMENT_DATA_KEY_SUFFIX) | |
/*
* 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... | {
HealthActivitySummaryCardData *data = layer_get_data(base_layer);
char buffer[8];
GFont font;
if (data->current_steps) {
font = fonts_get_system_font(FONT_KEY_LECO_26_BOLD_NUMBERS_AM_PM);
snprintf(buffer, sizeof(buffer), "%"PRIu32"", data->current_steps);
} else {
font = fonts_get_system_font(F... |
static void prv_render_typical_steps(GContext *ctx, Layer *base_layer) {
HealthActivitySummaryCardData *data = layer_get_data(base_layer);
char steps_buffer[12];
if (data->typical_steps) {
snprintf(steps_buffer, sizeof(steps_buffer), "%"PRId32, data->typical_steps);
} else {
snprintf(steps_buffer, si... |
extern void gatt_client_discovery_discover_range(GAPLEConnection *connection,
ATTHandleRange *hdl_range);
void test_gatt_client_discovery__multiple_jobs_pending(void) {
BTDeviceInternal device = prv_connected_dummy_device(1);
GAPLEConnection *connection = gap_le_con... | (fake_gatt_is_service_discovery_running(), false) | ;
}
// -------------------------------------------------------------------------------------------------
// Test vectors
static void prv_assert_blood_pressure_service(const GATTService *service) {
const Service *bp_service = fake_gatt_get_blood_pressure_service();
const uint16_t service_handle = bp_service->hand... |
ax) || x1 > x2) {
// Outside of drawing bounds..
return;
}
// Capture framebuffer & pass it to drawing implementation
GBitmap *framebuffer = graphics_capture_frame_buffer(ctx);
if (!framebuffer) {
// Couldn't capture framebuffer
return;
}
ctx->draw_state.draw_implementation->blend_horizon... | if (y1.integer > y2.integer) {
return;
} |
// last pixel with blending (don't render the pixel if it overflows the framebuffer/clip box)
if (y2.integer >= max_valid_y) {
y2.fraction = 0;
}
ctx->draw_state.draw_implementation->assign_vertical_line(ctx, x, y1, y2, color);
}
void graphics_private_draw_horizontal_line(GContext *ctx, int16_t y, Fixed... |
| RCC_AHB1Periph_DMA1
| RCC_AHB1Periph_DMA2
| RCC_AHB1Periph_ETH_MAC
| RCC_AHB1Periph_OTG_HS;
RCC_AHB1PeriphResetCmd(ahb1_periphs, ENABLE);
RCC_AHB1PeriphResetCmd(ahb1_periphs, DISABLE);
const uint32_t ahb2_periphs = 0
| RCC_AHB2Periph_DCMI
| RCC_AHB2Periph_CRYP
| RCC_AHB2Periph_HASH
... | boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE) | ;
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO);
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_THREE);
return true;
}
return false;
}
static bool prv_check_for_recovery_start_failure() {
return boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS);
}
static bool prv_check_for_fw_start_failure() {
// Add... |
((GPoint) {
.x = app_data->axis_offsets[X_AdjustState],
.y = app_data->axis_offsets[Y_AdjustState]
}) | ;
app_window_stack_pop_all(false);
}
static void prv_back_click_handler(ClickRecognizerRef recognizer, void *data) {
AppData *app_data = app_state_get_user_data();
if (app_data->axis_offsets[X_AdjustState] == mfg_info_get_disp_offsets().x &&
app_data->axis_offsets[Y_AdjustState] == mfg_info_get_disp_offs... | |
data);
const bool is_selected = menu_layer_is_index_selected(menu_layer, cell_index);
return (callbacks->row_height) ?
callbacks->row_height(callbacks, row, is_selected) :
PBL_IF_RECT_ELSE(menu_cell_basic_cell_height(),
(is_selected ? MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT :
... | i18n_free_all(data) | ;
app_free(data);
}
void settings_menu_mark_dirty(SettingsMenuItem category) {
SettingsData *data = app_state_get_user_data();
if (data->current_category == category) {
layer_mark_dirty(menu_layer_get_layer(&data->menu_layer));
}
}
void settings_menu_reload_data(SettingsMenuItem category) {
SettingsData... |
ay.
// Simulate a reboot by clearing out PFS's state.
fake_spi_flash_force_future_failure(0, NULL);
extern void pfs_reset_all_state(void);
pfs_reset_all_state();
pfs_init(false);
// Reopen the file we were in the middle of writing.
SettingsFile file_new;
cl_must_pass(settings_file_open... | printf("\nTesting if we can use each...\n") | ;
SettingsFile file;
cl_must_pass(settings_file_open(&file, "test_file_each", 4096));
uint8_t key[5];
int key_len = 4;
uint8_t val[5];
int val_len = 4;
for (int i = 0; i < 255; i++) {
snprintf((char *)key, sizeof(key), "k%03d", i);
snprintf((char *)val, sizeof(val), "v%03d", i);
printf("Iter... |
e strings on round displays
#if PBL_RECT
// Hack: the pairing instruction is drawn in the cell callback, but outside of the cell...
if (!data->remote_list_head) {
const GDrawState draw_state = ctx->draw_state;
// Enable drawing outside of the cell:
ctx->draw_state.clip_box = ctx->des... | bt_driver_reconnect_resume() | |
);
extern void gap_le_connect_params_cleanup_by_connection(GAPLEConnection *connection);
// -------------------------------------------------------------------------------------------------
// Static Variables -- MUST be protected with bt_lock/unlock!
static GAPLEConnection *s_connections;
static bool s_le_connectio... | gap_le_connection_set_irk(connection, irk) | ;
s_connections = (GAPLEConnection *) list_prepend(&s_connections->node,
&connection->node);
gap_le_connect_params_setup_connection(connection);
return connection;
}
// ------------------------------------------------------------------------------------------... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | app_graphics_text_layout_get_content_size("00:00", text_font,
s_low_power_data->low_power_window.layer.bounds, text_alignment,
text_overflow_mode) | ;
const int text_pos_y_adjust = -9; // small vertical adjustment to match design specification
const int text_pos_y = (DISP_ROWS / 2) - (font_height / 2) + text_pos_y_adjust;
const GRect text_container_rect = GRect(0, text_pos_y, DISP_COLS, font_height);
GRect text_frame = (GRect) { .size = text_size };
grec... |
es;
}
logging_session->storage.read_offset += sizeof(DLSChunkHeader) + chunk_hdr.num_bytes;
consumed_bytes += chunk_hdr.num_bytes;
}
exit:
if (consumed_bytes > 0) {
PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG,
"Consumed %d bytes from session %d", (int)consumed_bytes,
... | if (head) {
// This operation can take awhile and tends to starve out other threads while it's on going.
// It typically takes 100-200ms to restore a session, so if you have a lot of sessions you
// can take 2-4 seconds to do. The KernelMain task_watchdog isn't a problem at this time
// because ... |
num_sessions_restored++;
continue;
bad_session:
pfs_remove(head->name);
kernel_free(session);
head = (PFSFileListEntry *)head->list_node.next;
}
PBL_LOG(LOG_LEVEL_INFO, "Restored %d sessions. Total %"PRIu32" bytes allocated",
num_sessions_restored, prv_get_total_file_system_bytes()... |
1xzero%.1x", 0, 1);
cl_assert_equal_s(dstbuf, "0zero1");
// Variable length character output
snprintf(dstbuf, 256, "There are %*x lights", 3, 16);
cl_assert_equal_s(dstbuf, "There are 10 lights");
// Variable length digits output
snprintf(dstbuf, 256, "There are %.*x lights", 3, 16);
cl_assert_equal_s(... | (dstbuf, 256, "Hur% c", 'f') | ;
cl_assert_equal_s(dstbuf, "Hurf");
// Plus for positive signed
// No signed conversion occurs, so this is a no-op
snprintf(dstbuf, 256, "Hur%+c", 'f');
cl_assert_equal_s(dstbuf, "Hurf");
// Variable length character output
snprintf(dstbuf, 256, "Hur%*c", 2, 'f');
cl_assert_equal_s(dstbuf, "Hur f");
... |
--------------------------------------------------------
uint32_t animation_get_abs_start_time_ms(Animation *animation_h) {
if (animation_private_using_legacy_2(NULL)) {
// We need to enable other applib modules like scroll_layer, menu_layer, etc. which are
// compiled to use the 3.0 animation API to work wit... | {
// 2.x doesn't support AnimationCurveCustomInterpolationFunction
return false;
} | |
uint32_t before_size;
uint32_t after_size;
// lets save ids 17, 25, 42, and 47 because they are my favorite numbers
uint32_t after_free = t_data[16].size + t_data[24].size + t_data[41].size + t_data[46].size;
s_test_id_ql_up = 17;
s_test_id_ql_down = 25;
s_test_id_watchface = 42;
s_test_id_worker = 47;... | for (uint32_t i = 0; i < 15; ++i) {
char filename[15];
int id = (i + 1) * 257;
prv_app_filename(filename, sizeof(filename), id);
prv_check_file_exists(filename);
prv_res_filename(filename, sizeof(filename), id);
prv_check_file_exists(filename);
} | |
/*
* 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... | ((ListNode *)entries, prv_filter_callback, &info) | ;
}
static void prv_delete(RamStorageEntry **entries, RamStorageEntry *entry) {
list_remove((ListNode *)entry, (ListNode **)entries, NULL);
kernel_free(entry->key);
kernel_free(entry->val);
kernel_free(entry);
}
status_t ram_storage_insert(RamStorage *storage,
const uint8_t *key, int key_len, const uint8_... |
ndow->base_layer, &base_layer_bounds);
layer_add_child(&window->layer, &active_window->base_layer);
base_layer_bounds.origin.y = 0;
if (active_window->layout == WorkoutLayout_SingleMetric) {
// Only 1 metric to show. It can have the whole screen
GRect metric_bounds = base_layer_bounds;
layer_init(&ac... | (RESOURCE_ID_ACTION_BAR_ICON_START) | ;
active_window->action_bar_pause =
gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_PAUSE);
active_window->action_bar_stop =
gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_STOP);
active_window->action_bar_more =
gbitmap_create_with_resource(RESOURCE_ID_ACTION_BAR_ICON_MORE);
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | app_menu_data_source_get_count(data_source) | |
_create_window_common(active_window, workout_data, workout_controller);
return active_window;
}
WorkoutActiveWindow *workout_active_create_double_layout(WorkoutMetricType top_metric,
int num_scrollable_metrics,
... | {
if (hrm_is_available) {
WorkoutMetricType top_metric = WorkoutMetricType_Hr;
WorkoutMetricType scrollable_metrics[] = {WorkoutMetricType_Duration,
WorkoutMetricType_Distance,
WorkoutMetricType_Avg... |
case ActivitySessionType_Run:
{
if (hrm_is_available) {
WorkoutMetricType top_metric = WorkoutMetricType_Hr;
WorkoutMetricType scrollable_metrics[] = {WorkoutMetricType_Duration,
WorkoutMetricType_AvgPace,
... |
read_status_register(sector_base_addr)) &
S29VSStatusBit_DeviceReady) == 0) {
delay_us(10);
}
return (status);
}
//! Issue the second part of a two-cycle command. This is not merged with the
//! prv_issue_command as not all commands have an argument.
//!
//! @param sector_address The address of the s... | flash_impl_get_sector_base_address(end_sector) | ;
((__IO uint16_t*) (FMC_BANK_1_BASE_ADDRESS + start_sector))[0] =
S29VSCommand_SectorLockRangeArg;
((__IO uint16_t*) (FMC_BANK_1_BASE_ADDRESS + end_sector))[0] =
S29VSCommand_SectorLockRangeArg;
flash_impl_release();
}
void flash_s29vs_hw_init(void) {
// Configure the reset pin (D2)
GPIO_InitT... |
/*
* 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... | ram_storage_read(&s_test_db.ram_storage, key, key_len, val_out, val_len) | ;
}
status_t test_db_delete(const uint8_t *key, int key_len) {
return ram_storage_delete(&s_test_db.ram_storage, key, key_len);
}
status_t test_db_flush(void) {
return ram_storage_flush(&s_test_db.ram_storage);
}
status_t test_db_is_dirty(bool *is_dirty_out) {
return ram_storage_is_dirty(&s_test_db.ram_storage... |
(void *)(uintptr_t)launch_code,
.common.reason = APP_LAUNCH_TIMELINE_ACTION,
});
PBL_LOG(LOG_LEVEL_INFO, "Opening watch app %s", uuid_buffer);
// Wait for the app we just launched to have something to render before hiding all modals.
// If we don't we'll end up with flashing in a blank ... | i18n_noop("Alarms") | |
/*
* 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... | i18n_get("Postpone", &pin_attr_list) | );
AttributeList remove_attr_list = {0};
attribute_list_add_cstring(&remove_attr_list, AttributeIdTitle,
i18n_get("Remove", &pin_attr_list));
const int num_actions = 3;
TimelineItemActionGroup action_group = {
.num_actions = num_actions,
.actions = (TimelineItemAction[]) {... |
INE_NUM_VISIBLE_ITEMS + 2] = {};
int num_animations = 0;
for (int i = 0; i < TIMELINE_NUM_VISIBLE_ITEMS; i++) {
TimelineLayout *layout = layer->layouts[s_visible_items[i]];
if (layout) {
GRect frame;
prv_get_frame(layer, i + 1, &frame);
animations[num_animations++] = prv_create_bounce_bac... | layer_set_hidden((Layer *)&layer->day_separator, true) | ;
layer_add_child((Layer *)layer, (Layer *)&layer->day_separator);
// end-of-timeline indicator
// TODO: PBL-21716 Fin icon layout on Spalding
prv_get_end_of_timeline_frame(layer, 3, &frame);
kino_layer_init(&layer->end_of_timeline, &frame);
kino_layer_set_reel_with_resource(&layer->end_of_timeline, RESOUR... |
ent index to be the previous index so that all parties in the ongoing
// animation will continue to reply with the proper values with respect to the selection
// half-way through the animation we then switch (back) to the new index
menu_layer->animation.new_selection = menu_layer->selection;
menu_layer->selecti... | (menu_layer) | :
false;
return (MenuLayerBeforeSelectionChangeState) {
.was_animating = was_animating,
.prev_selection = menu_layer->selection,
};
}
void menu_layer_set_selected_index(MenuLayer *menu_layer, MenuIndex index, MenuRowAlign scroll_align, bool animated) {
const MenuLayerBeforeS... |
*)peek_layer, (Layer *)&peek_layer->title.text_layer);
// subtitle layer
text_layer_init_with_parameters(&peek_layer->subtitle.text_layer,
&text_rect,
NULL, fonts_get_system_font(FONT_KEY_GOTHIC_18),
GColorBlack, G... | (kino_layer, (KinoLayerCallbacks) { 0 }, NULL) | ;
}
//! This is called after the scale to is complete
static void prv_scale_to_timer_callback(void *data) {
PeekLayer *peek_layer = data;
peek_layer->hidden_fields_timer = EVENTED_TIMER_INVALID_ID;
peek_layer_set_fields_hidden(peek_layer, false);
}
void peek_layer_set_scale_to_image(PeekLayer *peek_layer, const... |
/*
* 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... | (data, num_samples) | ;
}
if (s_raw_handler) {
AccelRawData raw_data[num_samples];
for (int i = 0; i < num_samples; i++) {
raw_data[i].x = data[i].x;
raw_data[i].y = data[i].y;
raw_data[i].z = data[i].z;
}
uint64_t timestamp = data[0].timestamp;
s_raw_handler(raw_data, num_samples, timestamp);
}... |
// From the F7 Spec: "When the SPI is used only to transmit data, it is possible to enable only
// the SPI Tx DMA channel. In this case, the OVR flag is set because the data received is not
// read." I assume this will only happen if more than 4 (FIFO size) bytes are read. NB: They will
// likely remain in the... | {
spi_ll_slave_read_write_dma_stop(DIALOG_SPI);
prv_cleanup_after_dma_transfer();
s_dma_pending_transfer = false;
} |
spi_slave_port_deinit(DIALOG_SPI);
}
|
GTextOverflowModeWordWrap,
text_alignment,
text_attributes).h;
if (text_height <= single_line_text_height_px) {
text_top_margin_px += text_single_line_text_offset_px;
icon_top_ma... | gbitmap_init_with_resource(&workout_dialog->confirm_icon, RESOURCE_ID_ACTION_BAR_ICON_CHECK) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | mutex_unlock(s_mutex) | ;
}
#define PERSIST_FILE_NAME_MAX_LENGTH sizeof("ps000001")
static status_t prv_get_file_name(char *name, size_t buf_len, const Uuid *uuid) {
// Firmware 2.x persist files are named "p%06d", the added "s" in the file
// name prefix indicates that it is in SettingsFile format.
int pid = persist_map_auto_id(uuid)... |
1000);
GPointPrecise p0;
GPointPrecise p1;
p0.x.raw_value = (data->canvas_layer->bounds.size.w / 2) * FIXED_S16_3_ONE.raw_value;
p0.y.raw_value = (data->canvas_layer->bounds.size.h / 2) * FIXED_S16_3_ONE.raw_value;
p1.x.raw_value = (sin_lookup(rotation) * (line_length * FIXED_S16_3_ONE.raw_value)
... | {
return;
} |
s_window = window_create();
window_set_user_data(s_window, data);
window_set_fullscreen(s_window, true);
window_set_window_handlers(s_window, &(WindowHandlers) {
.load = main_window_load,
.unload = main_window_unload,
});
data->p1.x = 10;
data->p1.y = 30;
data->p2.x = 100;
data->p2.y = 120;... |
{
HealthValue min = health_service_aggregate_averaged(
HealthMetricHeartRateBPM, end_time - ranges[i].seconds, end_time, HealthAggregationMin,
HealthServiceTimeScopeOnce);
HealthValue max = health_service_aggregate_averaged(
HealthMetricHeartRateBPM, end_time - ranges[i].seconds, end_tim... | window_create() | ;
window_set_background_color(data->sleep_window, GColorBlack);
window_set_user_data(data->sleep_window, data);
window_set_click_config_provider_with_context(data->sleep_window, sleep_click_config_provider,
data);
window_set_window_handlers(data->sleep_window, (Wi... |
/*
* 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... | {
// Fast path: 0% opacity, no-op!
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | notification_storage_remove((Uuid *)key) | ;
notifications_handle_notification_removed((Uuid *)key);
return S_SUCCESS;
}
status_t notif_db_flush(void) {
notification_storage_reset_and_init();
return S_SUCCESS;
}
|
achBLEInternal cb;
void *cb_data;
} ForEachBLEPairingInternalData;
typedef struct {
BtPersistBondingDBEachBLE cb;
void *cb_data;
} ForEachBLEPairingData;
static void prv_public_for_each_ble_cb(BTBondingID key,
BtPersistBondingData *stored_data, void *context) {
ForEachBL... | (&itr_data->address, &stored_data.bt_classic_data.addr, sizeof(itr_data->address)) | ) {
itr_data->key_out = key;
return false; // stop iterating
}
return true;
}
static BTBondingID prv_get_key_for_bt_classic_addr(const BTDeviceAddress *address) {
KeyForBTCAddrData itr_data = {
.address = *address,
.key_out = BT_BONDING_ID_INVALID,
};
prv_file_each(prv_get_key_for_bt_classic... |
t the number of full days until next schedule (Sunday = 0)
int num_full_days = ((next_schedule_day - curr_day + DAYS_PER_WEEK) % DAYS_PER_WEEK) - 1;
// Calculate the number of seconds until the start of the next schedule, update then
seconds_until_update = time_util_get_seconds_until_daily_time(&time, 0, 0)... | alerts_preferences_check_and_set_first_use_complete(FirstUseSourceSmartDND) | ) {
prv_push_smart_dnd_first_use_dialog();
} else {
prv_toggle_smart_dnd(NULL);
}
}
void do_not_disturb_get_schedule(DoNotDisturbScheduleType type,
DoNotDisturbSchedule *schedule_out) {
alerts_preferences_dnd_get_schedule(type, schedule_out);
}
void do_not_disturb_set_sc... |
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 the specific language governing... | 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_vibrate_for_type(AlertMobile));
alerts_set_notification_vibe_timestamp();
fake_rtc_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... | (i2c_write_block(EWD1000->i2c, len, data)) | ;
i2c_release(EWD1000->i2c);
}
static void prv_read_data(uint8_t *data, size_t len) {
i2c_use(EWD1000->i2c);
PBL_ASSERTN(i2c_read_block(EWD1000->i2c, len, data));
i2c_release(EWD1000->i2c);
}
static void prv_wait_for_interrupt(void) {
const RtcTicks timeout = rtc_get_ticks() + RTC_TICKS_HZ * INIT_TIMEOUT_S;... |
licable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "kernel/sy... | (LOG_LEVEL_DEBUG, "Deprecated available message received.") | |
/*
* 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... | blob_db_endpoint_send_writeback(session->db_id,
dirty_item->last_updated,
dirty_item->key,
dirty_item->key_len,
... | ;
} else {
session->current_token = blob_db_endpoint_send_write(session->db_id,
dirty_item->last_updated,
dirty_item->key,
dirty_item->key_len,... |
(0, health_service_peek_current_activities()) | ;
// Start on known boundary
struct tm start_tm = {
// Jan 1, 2015, 5am
.tm_hour = 5,
.tm_mday = 1,
.tm_mon = 0,
.tm_year = 115
};
time_t utc_sec = mktime(&start_tm);
rtc_set_time(utc_sec);
const time_t time_elapsed = (20 * SECONDS_PER_MINUTE);
// Add a run session
ActivitySession... | |
xsize, format, tim_p, locale);
}
DEFINE_SYSCALL(int, sys_strftime, char* s, size_t maxsize, const char* format,
const struct tm* tim_p, char *locale) {
if (PRIVILEGE_WAS_ELEVATED) {
syscall_assert_userspace_buffer(s, maxsize);
syscall_assert_userspace_buffer(format, strlen(... | va_end(args) | ;
return ret;
}
|
"services/normal/activity/activity.h"
#include "services/normal/activity/activity_private.h"
#include "services/normal/activity/activity_algorithm.h"
#include "services/normal/activity/kraepelin/activity_algorithm_kraepelin.h"
#include "services/normal/activity/kraepelin/kraepelin_algorithm.h"
#include "services/normal... | {
PBL_LOG(LOG_LEVEL_WARNING, "No more room for additional activities");
return;
} |
// Add this activity in
s_activity_sessions[s_activity_sessions_count++] = *session;
}
// ------------------------------------------------------------------------------------
void activity_sessions_prv_delete_activity_session(ActivitySession *session) {
}
// ====================================================... |
ash.h"
#include "kernel/pbl_malloc.h"
#include "kernel/pebble_tasks.h"
#include "kernel/util/sleep.h"
#include "services/common/analytics/analytics.h"
#include "services/normal/filesystem/pfs.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/attributes.h"
#include "util/math.h"
#include "util/st... | {
int bytes_wrote = pfs_write(fd, buf, size);
if (bytes_wrote < S_SUCCESS) {
PBL_LOG(LOG_LEVEL_ERROR, "Err %d while writing", (int)bytes_wrote);
return false;
} else if (bytes_wrote < (int)size) {
PBL_LOG(LOG_LEVEL_ERROR, "Wrote only %d bytes, expected %d", (int)bytes_wrote, (int)size);
return fal... |
// ----------------------------------------------------------------------------------------
// Logs if an error occurs, returns true on success
static bool prv_pfs_seek(int fd, int offset, FSeekType seek_type) {
int result;
result = pfs_seek(fd, offset, seek_type);
if (result < S_SUCCESS) {
PBL_LOG(LOG_LEV... |
Active Time
};
typedef enum SleepDataFields {
SD_Version,
SD_Timestamp,
SD_SleepDuration,
SD_DeepSleepDuration,
SD_FallAsleepTime,
SD_WakeupTime,
SD_TypicalSleepDuration,
SD_TypicalDeepSleepDuration,
SD_TypicalFallAsleepTime,
SD_TypicalWakeupTime,
} SleepDataFields;
static uint32_t s_sleep_data[]... | (ActivityMetricActiveSeconds, Monday, &val_out) | );
cl_assert(!health_db_get_typical_value(ActivityMetricRestingKCalories, Monday, &val_out));
cl_assert(!health_db_get_typical_value(ActivityMetricActiveKCalories, Monday, &val_out));
cl_assert(!health_db_get_typical_value(ActivityMetricDistanceMeters, Monday, &val_out));
}
void test_health_db__sleep_data(voi... |
app_db_insert((uint8_t *)&menu_layer.uuid, sizeof(Uuid), (uint8_t *)&menu_layer, sizeof(AppDBEntry));
menu_layer_id = app_db_get_install_id_for_uuid(&menu_layer.uuid);
app_cache_add_entry(menu_layer_id, menu_layer_size /* size */);
cl_assert_equal_i(2, menu_layer_id);
// load second app
app_storage_get_file_... | (true, app_install_get_uuid_for_install_id(sports_id, &uuid)) | ;
cl_assert_equal_uuid(uuid, sports_uuid);
cl_assert_equal_b(false, app_install_get_uuid_for_install_id(CRAZY_ID, &uuid));
cl_assert_equal_uuid(uuid, UUID_INVALID);
}
void test_app_install_manager__has_worker(void) {
cl_assert_equal_b(false, app_install_has_worker(tictoc_id));
cl_assert_equal_b(false, app_in... |
/*
* 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... | (list, prv_service_filter, (void*)(uintptr_t)service_index) | ;
if (!found) {
return;
}
// Call the handler provided by the client
PluginServiceEntry *entry = (PluginServiceEntry *)found;
entry->handler(e->plugin_service.type, &e->plugin_service.data);
}
// -----------------------------------------------------------------------------------------------------------... |
// Word length
'H', 'e', 'l', 'l', 'o',
// Word #2
74, // Confidence
0x08, 0x00, // Word length
'c', 'o', 'm', 'p', 'u', 't', 'e', 'r',
// Sentence #2
0x03, 0x00, // Word count
// Word #1
13, // Confidence
0x04, 0x00, // Word length
'h', 'e', 'l',... | generic_attribute_find_attribute(attr_list1, VEAttributeIdAppUuid,
sizeof(data1) - sizeof(Uuid) - 1) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_p(session, &s_session) | ;
s_capability_flags = capability_flags;
}
BTBondingID bt_persistent_storage_store_bt_classic_pairing(BTDeviceAddress *address, SM128BitKey *link_key,
char *name, uint8_t *platform_bits) {
return 1;
}
// Helpers
//////////////////////////////////////////////////... |
>data,
sizeof(expected_ad_data)), 0);
cl_assert_equal_i(ad->ad_data_length, sizeof(expected_ad_data));
cl_assert_equal_i(ad->scan_resp_data_length, 0);
ble_ad_destroy(ad);
}
void test_ble_ad_parse__set_service_uuids_32_bit(void) {
BLEAdData *ad;
Uuid uuid[8];
for (int i = 0; i ... | memcmp(expected_ad_data, ad->data, ad->ad_data_length) | , 0);
ble_ad_destroy(ad);
}
void test_ble_ad_parse__set_flags(void) {
BLEAdData *ad;
ad = ble_ad_create();
const uint8_t flags = 0x03;
const uint8_t expected_ad_data[] = {
1 /* +1 for Type byte */ + 1 /* uint8_t with value */,
0x01, // Flags type
flags,
};
// Should fit fine, expect true:... |
{
{
.filename_part = "quad_top_left",
.mask = GCornerTopLeft,
},
{
.filename_part = "quad_top_right",
.mask = GCornerTopRight,
},
{
.filename_part = "quad_bottom_right",
.mask = GCornerBottomRight,
},
{
.file... | graphics_context_set_stroke_color(&ctx, GColorBlack) | ;
prv_draw_circles(&ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_aa_swX_black.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_draw_circle_8bit__zero_swX_color(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// Draw red circles with different alpha values in the stroke color wit... |
the app name is min_text_len
while (text_height > max_text_height && name_len > min_text_len) {
name_len--;
sniprintf(text, DIALOG_MAX_MESSAGE_LEN, text_fmt, name_len, entry.name);
dialog_set_text(dialog, text);
text_height = text_layer_get_content_size(ctx, text_layer).h;
}
#endif
i18n_free_all(... | system_app_state_machine_system_start() | ;
PBL_ASSERTN(prv_app_start(app_md, 0, APP_LAUNCH_SYSTEM));
s_first_app_launched = true;
compositor_transition(NULL);
}
static const CompositorTransition *prv_get_transition(const LaunchConfigCommon *config,
AppInstallId new_app_id) {
return config->transit... |
/*
* 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... | {
WeatherAppWarningDialogData *data = task_zalloc_check(sizeof(WeatherAppWarningDialogData));
ExpandableDialog *expandable_dialog = expandable_dialog_create("Weather - warning dialog");
Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog);
dialog_set_destroy_on_pop(dialog, false);
dialog_set_icon... | |
/*
* 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... | layer_set_update_proc(&layer, prv_layer_test_update_proc) | ;
s_layer_test_image_bounds_offset = image_bounds_offset;
layer_render_tree(&layer, &s_ctx);
}
static void prv_origin_layer_test(GPoint image_bounds_offset) {
prv_layer_test(GPointZero, image_bounds_offset);
}
static void prv_offset_layer_test(GPoint image_bounds_offset) {
prv_layer_test(TEST_LAYER_OFFSET_O... |
{ -224, 376, -920},
{ -232, 392, -928},
{ -232, 352, -920},
{ -232, 360, -936},
{ -232, 344, -928},
{ -232, 376, -960},
{ -240, 296, -936},
{ -240, 312, -928},
{ -232, 288, -952},
{ -240, 320, -936},
{ -232, 272, -952},
{ -240, 304, -936},
{ -232, 312, -944},
{ -2... |
{ -192, 408, -968},
{ -216, 448, -976},
{ -200, 336, -928},
// 261 seconds
{ -208, 400, -928},
{ -200, 376, -912},
{ -216, 392, -912},
{ -208, 400, -928},
{ -216, 384, -920},
{ -216, 392, -912},
{ -224, 432, -912},
{ -224, 432, -888},
{ -224, 416, -880},
{ -216, ... | |
AnimationPrivate *)state->aux->iter_next;
}
// If no blocked parents, we can exit right away
if (!have_blocked_parents) {
break;
}
}
// We are done iterating
state->aux->iter_next = NULL;
}
// -------------------------------------------------------------------------------------------
typ... | {
// Exceed max # of children allowed?
return NULL;
} |
AnimationPrivate *parent = applib_type_malloc(AnimationPrivate);
if (!parent) {
return NULL;
}
Animation *parent_h = animation_private_animation_init(parent);
parent->implementation = &s_complex_implementation;
return prv_complex_init(parent_h, animation_array, array_len,
ty... |
cense.
* 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... | {
PBL_ASSERT(info_length <= pulse_reliable_max_send_size(),
"Packet too big to send");
ReliablePacket *packet = pulse_link_send_begin(
PULSE2_RELIABLE_TRANSPORT_COMMAND);
size_t packet_size = sizeof(ReliablePacket) + info_length;
packet->i = (struct ReliableInfoPacket) {
.sequence_number... |
static void prv_process_ack(uint8_t ack_number) {
if ((ack_number - 1) % MODULUS == s_send_variable) {
pulse2_reliable_retransmit_timer_cancel();
s_retransmit_count = 0;
s_send_variable = (s_send_variable + 1) % MODULUS;
xSemaphoreGive(s_tx_lock);
}
}
static void prv_send_port_closed_message(void... |
essory_enable_input();
}
return result;
}
SmartstrapResult smartstrap_send(SmartstrapProfile profile, MBuf *write_mbuf, MBuf *read_mbuf,
uint16_t timeout_ms) {
PBL_ASSERT_TASK(PebbleTask_KernelBackground);
smartstrap_state_assert_locked_by_current_task();
// we expect the ar... | smartstrap_fsm_state_get() | ;
if ((state != SmartstrapStateReadDisabled) && (state != SmartstrapStateReadInProgress) &&
(state != SmartstrapStateReadComplete)) {
// we aren't in a state where something is in progress, so there's nothing to do
portEXIT_CRITICAL();
return;
}
smartstrap_fsm_state_reset();
new_timer_stop(s_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... | (expected_response, response, sizeof(response)) | == 0) {
return true;
}
PBL_LOG(LOG_LEVEL_WARNING, "Got unexpected response, { 0x%x 0x%x 0x%x 0x%x }",
(int)response[0], (int)response[1], (int)response[2], (int)response[3]);
return false;
}
// This struct is packed at the beginning of the binary blob
// See main/ldscripts/mem.ld.h for more info... |
UTE)
void test_alarm_smart__trigger_30_min_early_awake(void) {
AlarmId id;
id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_EVERYDAY, .is_smart = true });
prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
cl_assert_equal_i(s_num_timeline_adds, 3... | cl_assert_equal_i(s_num_timeline_removes, 3) | ;
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time());
}
void test_alarm_smart__trigger_at_timeout(void) {
AlarmId id;
id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_EVERYDAY, .is_smart = true });
prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_E... |
nded) {
font_res->resource_id = resource_id;
font_res->app_num = app_num;
if (resource_id != RESOURCE_ID_FONT_FALLBACK_INTERNAL &&
!sys_resource_is_valid(app_num, resource_id)) {
if (!is_extended) {
PBL_LOG(LOG_LEVEL_WARNING, "Invalid text resource id %"PRId32, resource_id);
}
return fals... | MAX(font_info->extension.md.max_height, font_info->base.md.max_height) | ;
font_info->loaded = true;
return true;
}
static const GlyphData *prv_get_glyph(FontCache *font_cache, Codepoint codepoint,
FontInfo *font_info, bool need_bitmap) {
if (!font_info->loaded) {
sys_font_reload_font(font_info);
}
// if we cannot find the codepoint we a... |
;
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO);
return true;
} else if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_ONE)) {
dbgserial_putstr("Failed to start firmware, strike two.");
boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_TWO);
} else {
dbgserial_putstr("Failed to start firmware, strike... | {
display_firmware_update_progress(i, 91);
delay_us(80000);
} |
for (uint32_t i=0; i <= 0xf; ++i) {
display_error_code(i * 0x11111111);
delay_us(200000);
}
for (uint32_t i=0; i < 8; ++i) {
for (uint32_t j=1; j<=0xf; ++j) {
display_error_code(j << (i*4));
delay_us(200000);
}
}
display_error_code(0x01234567);
delay_us(... |
false);
} else {
prv_update_scroll_offset(item_layer, current_scroll + SCROLL_AMOUNT, false);
}
layer_mark_dirty(&item_layer->layer);
}
static void prv_handle_select_click(ClickRecognizerRef recognizer, void *context) {
TimelineItemLayer *item_layer = context;
TimelineItemActionGroup *action_group = &it... | (item_layer->animation) | ;
layer_deinit(&item_layer->layer);
if (item_layer->timeline_layout) {
layout_destroy((LayoutLayer *)item_layer->timeline_layout);
item_layer->timeline_layout = NULL;
}
}
void timeline_item_layer_set_item(TimelineItemLayer *item_layer, TimelineItem *item,
TimelineLayoutInfo *info) {
item_layer->ite... |
int8_t *tx_power_level_out) {
struct TxPowerLevelCtx ctx = {
.tx_power_level_out = tx_power_level_out,
.included = false,
};
const BLEAdParseCallbacks callbacks = {
.tx_power_level_cb = tx_power_level_cb,
};
ble_ad_parse_ad_data(ad, &callbacks, &ctx);
return ctx.included;
... | {
// Scan response data has already been added / started
return (ad_data->scan_resp_data_length != 0);
} |
void ble_ad_start_scan_response(BLEAdData *ad_data) {
if (prv_ad_is_finalized(ad_data)) {
// Already finalized
return;
}
ad_data->scan_resp_data_length = BLE_AD_DATA_FINALIZED;
}
// -----------------------------------------------------------------------------
//! Helper to calculate whether a number of... |
uid(&menu_layer.uuid);
app_cache_add_entry(menu_layer_id, menu_layer_size /* size */);
cl_assert_equal_i(2, menu_layer_id);
// load second app
app_storage_get_file_name(filename_buf, sizeof(filename_buf), 2,
PebbleTask_App);
load_fixture_on_pfs(APP2_APP_FIXTURE_NAME, filename_buf)... | (CRAZY_ID, &uuid) | );
cl_assert_equal_uuid(uuid, UUID_INVALID);
}
void test_app_install_manager__has_worker(void) {
cl_assert_equal_b(false, app_install_has_worker(tictoc_id));
cl_assert_equal_b(false, app_install_has_worker(music_id));
cl_assert_equal_b(false, app_install_has_worker(sports_id));
cl_assert_equal_b(true, app_i... |
imation_set_curve(animation, AnimationCurveEaseOut);
}
} else {
scroll_layer->animation = property_animation_create(&implementation, scroll_layer, NULL,
&offset);
animation = property_animation_get_animation(scroll_layer->animation);
... | PBL_ASSERTN(scroll_layer) | ;
// paging and shadow_sublayer are mutually exclusive
// so init shadow_sublayer if it was paging data
if (prv_scroll_layer_is_paging_enabled(scroll_layer) && hidden == false) {
prv_setup_shadow_layer(scroll_layer);
}
scroll_layer_property_changed_proc((Layer*)scroll_layer);
layer_set_hidden(&scroll_... |
/*
* 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... | event_service_client_unsubscribe(&session->dictation_result_sub) | ;
if (pebble_task_get_current() == PebbleTask_App) {
event_service_client_unsubscribe(&session->app_focus_sub);
}
}
#endif
DictationSession *dictation_session_create(uint32_t buffer_size,
DictationSessionStatusCallback callback, void *context) {
#if CAPABILITY_HAS_MI... |
ACTIVITY_DEFAULT_WEIGHT_DAG);
gender = activity_prefs_get_gender();
cl_assert_equal_i(gender, ACTIVITY_DEFAULT_GENDER);
age_years = activity_prefs_get_age_years();
cl_assert_equal_i(age_years, ACTIVITY_DEFAULT_AGE_YEARS);
// Set the settings, re-init, and make sure they stick
height_mm += 10;
weight_dag... | activity_sessions_prv_add_activity_session(&old_activity) | ;
activity_sessions_prv_add_activity_session(&new_activity);
ASSERT_NUM_ACTIVITY_SESSIONS(4); // 2 sleep sessions + 2 activity sessions
ASSERT_STEP_ACTIVITY_SESSION_PRESENT(&old_activity);
ASSERT_STEP_ACTIVITY_SESSION_PRESENT(&new_activity);
// Wait long enough for our midnight rollover to occur. We init ti... |
me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_draw_pixel(ctx, GPoint(15, -5));
}
void outside_nx_ny_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_draw_pixel(ctx, GPoint(-5, -5));
}
void test_graphics_draw_pi... | (&ctx.dest_bitmap, "draw_pixel_inside_origin_layer.${BIT_DEPTH_NAME}.pbi") | );
layer_set_update_proc(&layer, &white_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(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(&l... |
ense is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "applib/graphics/framebuffer.h"
#include "applib/graphics/graphics.h"
#include "appl... | framebuffer_clear(fb) | ;
// Setup resources
fake_spi_flash_init(0, 0x1000000);
pfs_init(false);
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */);
resource_init();
}
void test_simple_dialog__cleanup(void) {
free(fb);
gbitm... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | graphics_draw_round_rect(ctx, &GRect(16, 2, 28, 20), 4) | ;
}
void across_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_round_rect(ctx, &GRect(-14, 2, 28, 20), 4);
}
void across_y_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_s... |
se {
// something has reset the register, ignore
return;
}
// sign bit is zero if positive, 1 if negative
direction = (click_src & Sign) ? -1 : 1;
} else {
// when no-one has subscribed, we only listen to the x axis
axis = AXIS_X;
// no sign info
direction = 0;
}
PebbleEve... | shared_circular_buffer_add_client(&s_buffer, client) | );
lis3dh_unlock();
}
//! Removes a consumer from the circular buffer
//! @client which client to remove
void accel_remove_consumer(SharedCircularBufferClient *client) {
lis3dh_lock();
shared_circular_buffer_remove_client(&s_buffer, client);
lis3dh_unlock();
}
//! Returns number of samples actually read.
//... |
*extra_keys[] = { "keyA", "keyB" };
char *extra_values[] = { "valA", "valB" };
for (int i = 0; i < ARRAY_LENGTH(extra_keys); ++i) {
blob_db_insert(BlobDBIdTest, (uint8_t *)extra_keys[i], key_len,
(uint8_t *)extra_values[i], value_len);
}
prv_generate_responses_from_phone();
cl_assert_... | (test_session == blob_db_sync_get_session_for_token(1)) | ;
cl_assert(pins_session == blob_db_sync_get_session_for_token(2));
cl_assert(reminders_session == blob_db_sync_get_session_for_token(3));
// Cancel the sync sessions so they get cleaned up
blob_db_sync_cancel(test_session);
blob_db_sync_cancel(pins_session);
blob_db_sync_cancel(reminders_session);
// 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... | MULT_X((cur - limit_b), (limit_c - limit_b)) | ));
} else if (cur <= limit_d) {
// zone c - d
return GPoint(frame.origin.x +
DIV_X(frame.size.w * (1000 - MULT_X((cur - limit_c), (limit_d - limit_c)))),
frame.origin.y + frame.size.h);
} else if (cur <= limit_e) {
// zone d - e
return GPoint(frame.origin.x,
... |
= settings_file_get_len(file, &key, sizeof(key));
if (size <= 0) {
return false;
}
AlarmConfig config = {};
const int load_size = MIN(size, (int)sizeof(config));
if (settings_file_get(file, &key, sizeof(key), &config, load_size) == S_SUCCESS) {
if (config.hour > 23 || config.minute > 59) {
PBL... | if (info->kind == ALARM_KIND_CUSTOM && info->scheduled_days) {
prv_set_alarm_custom_op(id, &config, (void *)info->scheduled_days);
} else {
prv_set_alarm_kind_op(id, &config, (void *)(uintptr_t)info->kind);
} |
Alarm alarm = { .id = id, .config = config };
prv_add_and_schedule_alarm(&file, &alarm);
prv_file_close_and_unlock(&file);
analytics_event_alarm(AnalyticsEvent_AlarmCreated, info);
return id;
}
// ----------------------------------------------------------------------------------------------
typedef bool ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | app_window_stack_pop(true) | ;
} else {
AppMenuNode* app_menu_node =
app_menu_data_source_get_node_at_index(&data->data_source, selection - NUM_CUSTOM_CELLS);
quick_launch_set_app(data->button, app_menu_node->install_id);
app_window_stack_pop(true);
}
}
static void prv_menu_reload_data(void *context) {
OptionMenu *option... |
he 3.0 animation API to work with 2.0 apps.
animation_legacy2_set_duration((AnimationLegacy2 *)animation_h, duration_ms);
return true;
}
AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/);
if (!prv_is_mutable(state, animation)
|| animation->type != Anima... | (animation_h,
AnimationCurveCustomFunction,
curve_function) | ;
}
// -------------------------------------------------------------------------------------------
bool animation_set_custom_interpolation(Animation *animation_h,
InterpolateInt64Function interpolate_function) {
return prv_animation_set_custom_function(animation_h,
... |
/*
* 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 setting likely doesn't exist yet so set it to the default (true)
s_is_24h_style = true;
} |
if (settings_file_get(&file, PREF_KEY_DEFAULT_WATCHFACE, sizeof(PREF_KEY_DEFAULT_WATCHFACE),
&s_default_watchface, sizeof(s_default_watchface)) != S_SUCCESS) {
s_default_watchface = UUID_INVALID;
}
if (settings_file_get(&file, PREF_KEY_CONTENT_SIZE, sizeof(PREF_KEY_CONTENT_SIZE),
... |
/*
* 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... | CLEAR_BIT(RCC->AHB1ENR, (0x1 << idx)) | ;
}
}
|
TICS_DEVICE_METRIC_PHONE_CALL_END_COUNT, AnalyticsClient_System);
}
if (s_call_in_progress) {
prv_call_end_common();
phone_ui_handle_call_end(false /*call accepted*/, disconnected);
} else if (!disconnected) {
PBL_LOG(LOG_LEVEL_INFO, "Ignoring end call. A call is not in progress");
}
}
static void... | analytics_inc(ANALYTICS_DEVICE_METRIC_PHONE_CALL_DECLINE_COUNT, AnalyticsClient_System) | ;
PBL_LOG(LOG_LEVEL_INFO, "Call declined");
if (prv_call_is_ancs()) {
ancs_perform_action(s_call_identifier, ActionIDNegative);
ancs_phone_call_temporarily_block_missed_calls();
prv_cancel_call_watchdog();
} else {
pp_decline_call(s_call_identifier);
}
if (s_call_in_progress) {
s_call_in... |
/*
* 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... | qspi_flash_write_protection_enable(QSPI_FLASH) | == S_SUCCESS) {
// after flash protection is enabled, full array is locked. Unlock it.
qspi_flash_unlock_all(QSPI_FLASH);
}
}
}
status_t flash_impl_write_protect(FlashAddress start_sector, FlashAddress end_sector) {
if (!s_flash_protection_supported) {
return S_SUCCESS; // If not supported, pr... |
= 0,
.type = TimelineItemActionTypeComplete,
.attr_list = completed_attr_list,
},
{
.id = 1,
.type = TimelineItemActionTypePostpone,
.attr_list = postpone_attr_list,
},
{
.id = 2,
.type = TimelineItemActionTypeRemoteRemove,
.attr_l... | (data->dialog_text, " ", buf_space_remaining) | ;
buf_space_remaining = MAX(buf_space_remaining - 1, 0);;
clock_get_time_number(tmp, date_time_len, data->timestamp);
strncat(data->dialog_text, tmp, buf_space_remaining);
buf_space_remaining = MAX(buf_space_remaining - strlen(tmp), 0);
clock_get_time_word(tmp, date_time_len, data->timestamp);
strncat(dat... |
s = {
.setter = { .gcolor8 = (const GColor8Setter) prv_gcolor8_setter, },
.getter = { .gcolor8 = (const GColor8Getter) prv_gcolor8_getter },
},
};
start_value = (GColor8) {.a=0, .r=0, .g=0, .b=0};
end_value = (GColor8) {.a=3, .r=3, .g=3, .b=3};
mid_value = (GColor8) {.a=1, .r=1, .g=1, .b=1};
... | animation_destroy(h) | ;
#endif
}
// --------------------------------------------------------------------------------------
// Test that we can reschedule an animation after it completes and have it run again
void test_animation__reschedule(void) {
#ifdef TEST_INCLUDE_BASIC
PropertyAnimation *prop_h;
Layer layer;
GRect from_r;
GRec... |
/*
* 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 year + TM_YEAR_ORIGIN;
} |
static int prv_iso8601_base_week(const struct tm *t) {
// Not quite the same as prv_week_of_year
// The ISO-8601 week count is defined as the number of weeks with Thursday in it.
// Who knows why...
return (t->tm_yday + 10 - ((t->tm_wday + 6) % 7)) / 7;
}
// Here be dragons
static int prv_year_week_count(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... | cl_assert(s_msg.curr_msg_idx < s_msg.num_items) | |
le except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ... | {
comm_session_send_queue_cleanup(s_valid_session);
} |
// Check for leaks:
fake_kernel_malloc_mark_assert_equal();
fake_kernel_malloc_deinit();
}
void test_session_send_queue__get_length_returns_summed_length_of_all_jobs(void) {
cl_assert_equal_i(0, comm_session_send_queue_get_length(s_valid_session));
int num_jobs = 3;
for (int i = 0; i < num_jobs; ++i) {
... |
e_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("1 H AGO", time_buf);
// June 9th 2015, 13:29:30 (T+01:29:30)
rtc_set_time(event_time + SECONDS_PER_HOUR + (29 * SECONDS_PER_MINUTE) + 30);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("1... | ("12 H AGO", time_buf) | ;
// June 10th 2015, 00:00:00 (T+12:00:00)
rtc_set_time(event_time + (12 * SECONDS_PER_HOUR));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("Yesterday, 12:00 PM", time_buf);
// June 10th 2015, 11:00:00 (T+23:00:00)
rtc_set_time(event_time + ... |
BLE[1]
// PRIMASK = 0x0
// FAULTMASK = 0x0
// BASEPRI = 0x0
// CONTROL = 0x0
//
// Attempt to put the processor into as close to the reset state as possible
// before passing control to the firmware.
//
// No attempt is made to set CONTROL to zero as it should already be set to
// the ... | (BUTTON_ID_BACK) | |
k_config = {
.frames_in = s_custom_moook_frames_in,
.num_frames_in = ARRAY_LENGTH(s_custom_moook_frames_in),
.frames_out = s_custom_moook_frames_out,
.num_frames_out = ARRAY_LENGTH(s_custom_moook_frames_out),
};
static void prv_move_region_of_bitmap_horizontally(GBitmap *bitmap, const GRect *region,
... | graphics_context_set_fill_color(ctx, selection_color) | ;
graphics_fill_rect(ctx, &stretch_rect_below_selection_rect);
}
}
static void prv_launcher_app_transition_animation_update(GContext *ctx, Animation *UNUSED animation,
uint32_t distance_normalized) {
const bool is_right = s_data.app_is_destination;
con... |
ter since we're about to overwrite it
const bool transparent = false;
GDrawMask *mask = graphics_context_mask_create(ctx, transparent);
cl_assert(mask);
const GSize mask_size = ctx->dest_bitmap.bounds.size;
for (int16_t x = 0; x < mask_size.w; x++) {
const uint8_t mask_pixel_value = (uint8_t)(x / num_pix... | GSize(num_dest_colors * hline_applying_test_column_width,
num_src_colors) | ;
prv_prepare_canvas(ctx, bitmap_size);
// Fill the canvas so each column (of width hline_applying_test_column_width) is set to one of the
// different possible dest_colors
for (int16_t y = 0; y < bitmap_size.h; y++) {
for (int16_t column_index = 0; column_index < num_dest_colors; column_index++) {
c... |
{
if (text_layer == NULL) {
return;
}
GColor8 native_color = get_native_color(color);
const GColor text_color = get_native_color(text_layer->text_color);
if (gcolor_equal(native_color, text_color)) {
return;
}
text_layer->text_color = get_closest_gcolor2(native_color);
layer_mark_dirty(&(text_la... |
void text_layer_legacy2_set_text_alignment(TextLayerLegacy2 *text_layer,
GTextAlignment text_alignment) {
if (text_layer == NULL || text_alignment == text_layer->text_alignment) {
return;
}
text_layer->text_alignment = text_alignment;
layer_mark_dirty(&(text_laye... | |
/*
* 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 (!uuid) {
return INSTALL_ID_INVALID;
}
return s_app_install_id;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.