prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
d hold the Back button from a notification to turn " \
"Quiet Time on or off.", &s_data);
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);
}
}
... | (prv_current_schedule_type()) | );
}
static bool prv_is_schedule_active(void) {
return (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() &&
!... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
graphics_context_set_stroke_color(ctx, GColorClear);
graphics_context_set_antialiased(ctx, false);
graphics_draw_circle(ctx, GPoint(14, 14), 12);
} |
void across_x_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_circle(ctx, GPoint(28, 14), 12);
}
void across_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_colo... |
ncel_dictation(data->session_id);
data->session_id = VOICE_SESSION_ID_INVALID;
app_timer_cancel(data->dictation_timeout);
prv_set_mic_window_state(data, StateFinished);
}
}
// Microphone Window
///////////////////////////////////////////////////////////////////////////
#if (0) // https://pebbletechnolog... | (msg, data->mic_window.text_buffer, sizeof(data->mic_window.text_buffer)) | ;
text_layer_set_text(&data->mic_window.text_layer, data->mic_window.text_buffer);
}
static void prv_kino_reel_stopped_handler(KinoLayer *layer, bool finished, void *context) {
if (!finished) {
return;
}
// This stopped handler is used to defer the transition from recording to the wait for response
// s... |
to using a TimelineResourceId
music_glance->icon = kino_reel_create_with_resource(new_icon_resource_id);
PBL_ASSERTN(music_glance->icon);
music_glance->icon_resource_id = new_icon_resource_id;
}
static bool prv_should_display_music_state(MusicPlayState play_state,
uint3... | (music_glance->title, node->name, title_size) | ;
music_glance->title[title_size - 1] = '\0';
// Save the default icon resource ID for the Music app
music_glance->default_icon_resource_id = node->icon_resource_id;
const bool should_consider_slices = false;
LauncherAppGlanceStructured *structured_glance =
launcher_app_glance_structured_create(&node-... |
e License.
*/
#include "timeline_resources.h"
#include "applib/graphics/gdraw_command_private.h"
#include "applib/ui/kino/kino_reel.h"
#include "kernel/pbl_malloc.h"
#include "process_management/app_install_manager.h"
#include "resource/resource_ids.auto.h"
#include "system/logging.h"
#include "syscall/syscall.h"
#i... | (res_app_num) | |
/*
* 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... | (&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, true, 1) | ;
cl_assert_equal_i(ctx.dest_bitmap.info.format, GBitmapFormat8BitCircular);
memset(ctx.dest_bitmap.addr, GColorRedARGB8, FRAMEBUFFER_SIZE_BYTES);
GRect radial_container_rect = ctx.dest_bitmap.bounds;
radial_container_rect = grect_inset(radial_container_rect, GEdgeInsets(-10));
const uint16_t inset_thickne... |
* 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 "mfg_serials.h"
#include "console/prompt.h"
#include "util/size.h"
static const uint8_t OTP_SERIAL_SLOT_INDICES[] = {
O... | prv_mfg_write_data_to_slot(OTP_HWVER_SLOT_INDICES, ARRAY_LENGTH(OTP_HWVER_SLOT_INDICES),
hwver, hwver_size, out_index) | |
ories(&active_kcalories);
cl_assert_equal_i(200, active_kcalories);
// Add some time and steps
prv_inc_time(600); /* 10 mins */
prv_inc_steps_and_put_event(1800 /* 180 steps per min * 10 mins */);
// Grab the new distance and active_kcalories
int32_t new_active_kcalories, new_distance_m;
cl_assert(worko... | (workout_service_get_current_workout_info(&steps, &duration_s, &distance_m,
&bpm, &hr_zone)) | ;
cl_assert_equal_i(steps, 20);
cl_assert_equal_i(duration_s, 20);
cl_assert_equal_i(bpm, 80);
prv_inc_time(10);
prv_inc_steps_and_put_event(10);
prv_put_bpm_event(117, HRMQuality_Good);
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m,
... |
(&BOARD_CONFIG.lcd_com, GPIO_OType_PP, GPIO_Speed_50MHz) | ;
}
// Set up a SPI bus on SPI2
SPI_InitTypeDef spi_cfg;
SPI_I2S_DeInit(BOARD_CONFIG_DISPLAY.spi);
SPI_StructInit(&spi_cfg);
spi_cfg.SPI_Direction = SPI_Direction_1Line_Tx; // Write-only SPI
spi_cfg.SPI_Mode = SPI_Mode_Master;
spi_cfg.SPI_DataSize = SPI_DataSize_8b;
spi_cfg.SPI_CPOL = SPI_CPOL_Low;
... | |
const GDrawState draw_state = ctx->draw_state;
// Enable drawing outside of the cell:
ctx->draw_state.clip_box = ctx->dest_bitmap.bounds;
graphics_context_set_text_color(ctx, GColorBlack);
GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_18);
GRect box = cell_layer->bounds;... | event_service_client_unsubscribe(&data->ble_hrm_sharing_event_info) | ;
#endif
event_service_client_unsubscribe(&data->bt_airplane_event_info);
event_service_client_unsubscribe(&data->bt_connection_event_info);
event_service_client_unsubscribe(&data->bt_pairing_event_info);
event_service_client_unsubscribe(&data->ble_device_name_updated_event_info);
app_focus_service_unsubscrib... |
= (AnimationPrivate *)animation_array[i];
child->parent = parent;
if (i + 1 < (int)array_len) {
child->sibling = (AnimationPrivate *)animation_array[i + 1];
}
}
return (Animation *)parent;
}
static Animation *prv_create_from_vararg(Animation *animation_a, Animation *animation_b,
... | {
AnimationPrivate *animation = (AnimationPrivate *)animation_h;
if (!animation) {
return false;
}
if (!animation->scheduled) {
prv_each(animation, prv_call_scheduled, true);
// If your test is failing, build out this fake so that this is an async start
prv_each(animation, prv_call_started, (uin... |
bool animation_set_elapsed(Animation *animation_h, uint32_t elapsed_ms) {
AnimationPrivate *animation = (AnimationPrivate *)animation_h;
if (!animation) {
return false;
}
if (animation->duration_ms <= elapsed_ms) {
animation->is_completed = true;
animation_unschedule(animation_h);
}
return tru... |
SET_LOOP_DETECT_TWO);
break;
case 7:
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE);
break;
default:
PBL_CROAK("reset loop boot bits overrun");
break;
}
return false;
}
static bool prv_check_for_recovery_start_failure() {
return boot_bit_test(BOOT_BIT_RECOVERY_START_IN_PROGRESS);
}
static ... | boot_version_read() | , bootloader_version_str, 12);
dbgserial_putstr(bootloader_version_str);
dbgserial_putstr("");
dbgserial_putstr("");
}
int main(void) {
prv_check_and_handle_resuming_from_standby();
board_init();
dbgserial_init();
dbgserial_putstr("\r\n\r\n\r\n");
dbgserial_putstr("██████╗ ██████╗ ██████╗ ███████╗█... |
ClientServiceHandles);
PebbleBLEGATTClientServiceEventInfo *info = kernel_zalloc_check(memory_needed);
*info = (PebbleBLEGATTClientServiceEventInfo) {
.type = PebbleServicesRemoved,
.device = connection->device,
.status = BTErrnoOK
};
info->services_removed_data.num_services_removed = 1;
Pebble... | {
// We experienced some kind of conversion error, pass it on
if (error != BTErrnoOK) {
prv_send_services_added_event(connection, error);
return;
}
GATTServiceNode *node = kernel_zalloc_check(sizeof(GATTServiceNode));
node->service = service;
// tag the service with the generation it was discovere... | |
/*
* 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("Active", data) | : NULL;
const GCompOp op = (gbitmap_get_format(bitmap) == GBitmapFormat1Bit) ? GCompOpTint : GCompOpSet;
graphics_context_set_compositing_mode(ctx, op);
// TODO: PBL-22652 extract common way to configure simple lists on S4
UNUSED const bool selected = (cell_index->row == data->menu_layer.selection.index.row)... |
3]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[4]].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(2));
cl_assert(timeline_mode... | (first_time, &model) | ;
for (int i = 0; i < ARRAY_LENGTH(s_items); i++) {
timeline_model_remove(&s_items[i].header.id);
}
cl_assert_equal_i(timeline_model_get_num_items(), 0);
cl_assert(!timeline_model_iter_next(NULL, NULL));
cl_assert(!timeline_model_iter_prev(NULL, NULL));
}
void test_timeline_model__is_empty(void) {
Tim... |
if (BOARD_CONFIG.power_5v0_options != OptionNotPresent) {
// +5V to 5V_EN pin
gpio_output_set(&BOARD_CONFIG.power_ctl_5v0, true);
}
// +5V to LCD_DISP pin (Set this pin low to turn off the display)
gpio_output_set(&BOARD_CONFIG_DISPLAY.on_ctrl, true);
periph_config_release_lock();
}
uint32_t disp... | prv_do_dma_update() | ;
}
#if DISPLAY_ORIENTATION_ROTATED_180
//!
//! memcpy the src buffer to dst and reverse the bits
//! to match the display order
//!
static void prv_memcpy_reverse_bytes(uint8_t* dst, uint8_t* src, int bytes) {
// Skip the mode selection and column address bytes
dst+=2;
while (bytes--) {
*dst++ = r... |
_layer->callbacks.click_config_provider) {
swap_layer->callbacks.click_config_provider(swap_layer->context);
}
}
///////////////////////
// MISC FUNCTIONS
///////////////////////
static void prv_swap_layer_update_proc(Layer *layer, GContext* ctx) {
SwapLayer *swap_layer = (SwapLayer *)layer;
prv_update_arro... | (swap_layer) | |
/*
* 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... | { // pmap, where'd you go, we miss you so?!
PBL_HEXDUMP_D(LOG_LEVEL_INFO, LOG_LEVEL_INFO, (uint8_t *)s_pmap_fd_diagnostic_data,
sizeof(s_pmap_fd_diagnostic_data));
test_infra_quarantine_board("pmap file went missing");
} | else {
prv_pmap_grab_debug_fd_data(fd);
}
#endif /* IS_BIGBOARD */
return fd;
}
static int seek_map(int fd, SearchCallback callback, void *data) {
pfs_seek(fd, sizeof(PersistMapHeader), FSeekSet);
bool found = false;
PersistMapIdField field;
while (true) {
int read_result = pfs_read(fd, (uint8_t... |
ASIS,
* 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 "timeline_item_storage.h"
#include "kernel/pbl_malloc.h"
#include "services/normal/filesystem/pfs.h"
#include "service... | mutex_lock(storage->mutex) | ;
NextInfo next_info = {0};
next_info.current = rtc_get_time();
next_info.max_age = storage->max_item_age;
next_info.filter_cb = filter_cb;
status_t rv = settings_file_each(&storage->file, prv_each_first_item, &next_info);
if (rv) {
goto cleanup;
}
if (!next_info.found) {
rv = S_NO_MORE_ITEMS... |
per log
char msg[log_len + 1];
char **msg_arr = malloc(*num_logs * sizeof(char *));
for (int i = 0; i < *num_logs; i++) {
uint32_t uniq_msg_id = 0xDEADDEAD - i + (i << 16);
char buf[20];
snprintf(buf, sizeof(buf), "%x", uniq_msg_id);
for (int j = 0; j < log_len; j += strlen(buf)) {
mem... | if (!got_first_line) {
got_first_line = true;
return (true);
} |
char buf[tot_len + 1];
memcpy(&buf, (char*)msg, tot_len);
buf[tot_len] = '\0';
PBL_LOG(LOG_LEVEL_DEBUG, "flash_log_line_dump_long_lived: got %s", buf);
int curr_val;
int filled = sscanf(buf, "Loop Counter %d", &curr_val);
cl_assert_equal_i(filled, 1);
if (s_long_lived_last_val != -1) {
cl_asser... |
* From clar_mock.c */
static void clar_mock_reset(void);
static void clar_mock_cleanup(void);
/* From clar_categorize.c */
static int clar_category_is_suite_enabled(const struct clar_suite *);
static void clar_category_enable(const char *category);
static void clar_category_enable_all(size_t, const struct clar_suite *... | if (*argument == ':')
has_colon = 1; |
}
}
argument = argv[i] + offset;
if (!len)
clar_usage(argv[0]);
else if (is_num) {
if ((size_t)num >= _clar_suite_count) {
clar_print_onabort("Suite number %d does not exist.\n", num);
exit(-1);
}
clar_run_suite(&_clar_suites[num]);
... |
cl_assert(memcmp(tuple->value->data, SOME_DATA, sizeof(SOME_DATA)) == 0);
data_found = true;
break;
case SOME_STRING_KEY:
cl_assert(tuple->length == strlen(SOME_STRING) + 1);
cl_assert(strncmp(tuple->value->cstring, SOME_STRING, strlen(SOME_STRING) + 1) == 0);
// Chec... | (old_tuple->type == TUPLE_CSTRING) | ;
cl_assert(old_tuple->length == strlen(SOME_STRING) + 1);
cl_assert(strcmp(old_tuple->value->cstring, SOME_STRING) == 0);
break;
case SOME_DATA_KEY:
is_data_updated = true;
cl_assert(new_tuple->type == TUPLE_BYTE_ARRAY);
cl_assert(new_tuple->length == sizeof(SOME_DATA));
c... |
R(attr) {
if (attr->state == state) {
return attr;
}
}
return NULL;
}
// Attribute processing / request functions
// NOTE: These all run on KernelBG which moves attributes from the RequestPending to the Idle state
////////////////////////////////////////////////////////////////////////////////
bool... | process_manager_send_event_to_process(CONSUMER_TASK, &event) | ;
}
}
static void prv_do_deferred_delete_cb(void *context) {
s_deferred_delete_queued = false;
mutex_lock(s_attr_list_lock);
SmartstrapAttributeInternal *attr = s_attr_head;
while (attr) {
SmartstrapAttributeInternal *next = NEXT_ATTR(attr);
if (attr->deferred_delete) {
list_remove(&attr->list_... |
const BLEAdData *ad_data) {
const BTDeviceAddress address = bt_device_get_address(device);
APP_LOG(APP_LOG_LEVEL_INFO, "Got Advertisement from: " BT_DEVICE_ADDRESS_FMT,
BT_DEVICE_ADDRESS_XPLODE(address));
// Find existing ScanResult with BTDevice:
ScanResult *result = list_unlink(&d... | (result->device) | ;
snprintf(title, sizeof(title), BT_DEVICE_ADDRESS_FMT " %s",
BT_DEVICE_ADDRESS_XPLODE(address), hrm_str);
}
// Build the subtitle string:
char subtitle[UUID_STRING_BUFFER_LENGTH];
if (result->has_services) {
// Make a displayable string of the first Service UUID:
uuid_to_string(&resul... |
ude "system/logging.h"
#include "util/attributes.h"
#include "util/crc32.h"
#include "util/math.h"
#include "util/units.h"
//
// SPI bootloader protocol
//
static bool prv_load_data(uint32_t address, const uint8_t *data, size_t data_len) {
// PBL_LOG(LOG_LEVEL_DEBUG, "Loading %d bytes start at 0x%x", (int)data_len,... | if (!resource_load_byte_range_system(
SYSTEM_APP, RESOURCE_ID_BT_FW_IMAGE,
curr_send_offset + vt_and_info_blob_size,
data_buf, send_len)) {
PBL_LOG(LOG_LEVEL_WARNING, "Failed to read fw image data");
goto cleanup;
} | |
sleep" mode.
temp |= PWR_CR_LPLVDS;
#endif
PWR->CR = temp;
#endif
// Configure the processor core to enter deepsleep mode when we
// execute a WFI or WFE instruction.
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
// Go stop now.
__DSB(); // Drain any pending memory writes before entering sleep.
do_wfi(); // Wai... | prv_collect(ANALYTICS_DEVICE_METRIC_CPU_NOSTOP_FLASH_TIME, InhibitorFlash, now_ticks) | |
cense 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 the specific lan... | (strcmp(first, "Activée") == 0) | ;
const char *second = i18n_ctx_get("Quiet Time", "Enabled", __FILE__);
cl_assert(strcmp(second, "Activé") == 0);
const char *third = i18n_get(ctxt_txt_1, __FILE__);
cl_assert(third == first);
const char *fourth = i18n_get(ctxt_txt_2, __FILE__);
cl_assert(fourth == second);
i18n_free(ctxt_txt_1, __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... | {
APP_LOG(APP_LOG_LEVEL_ERROR, "Invalid timer %u used in app_timer_reschedule", (unsigned)timer);
syscall_failed();
} |
}
return evented_timer_get_data((EventedTimerID)timer);
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
window_deinit(&s_data.window);
} |
// Tests
//////////////////////
void test_kickstart__render_no_data(void) {
window_set_on_screen(&s_data.window, true, true);
window_render(&s_data.window, &s_ctx);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_kickstart__render_obstructed_area(void) {
#if !PBL_ROUND
prv_set_unobs... |
(!alerts_should_enable_backlight_for_type(AlertReminder)) | ;
cl_assert(!alerts_should_notify_for_type(AlertOther));
cl_assert(!alerts_should_vibrate_for_type(AlertOther));
alerts_set_notification_vibe_timestamp();
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS);
cl_assert(!alerts_should_enable_backlight_for_type(AlertOther));
s_dnd_active = ... | |
map dest_bitmap = {
.addr = dest_data,
.row_size_bytes = 50,
.info.format = GBitmapFormat8Bit,
.info.version = GBITMAP_VERSION_CURRENT,
.bounds = { { 0, 0 }, { 50, 50 } }
};
memset(dest_data, GColorGreen.argb, sizeof(dest_data));
const GRect dest_rect = GRect(4, 4, 10, 10);
const GPoint src_... | (4, 4, 140, 55) | ;
const GPoint src_origin_offset = GPoint(39, 11);
src_bitmap->bounds = (GRect) { { 37, 3}, { 63, 23 } };
bitblt_bitmap_into_bitmap_tiled_1bit_to_8bit(&dest_bitmap, src_bitmap, dest_rect,
src_origin_offset, GCompOpAssign, GColorWhite);
cl_assert(gbitmap_pbi_eq(&d... |
/*
* 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... | firmware_update_init() | ;
put_bytes_init();
poll_remote_init();
accel_manager_init();
light_init();
cron_service_init();
shared_prf_storage_init();
bt_persistent_storage_init();
comm_default_kernel_sender_init();
comm_session_app_session_capabilities_init();
comm_session_init();
bt_ctl_init();
#if CAPABILITY_HAS_TOU... |
/*
* 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 (!level || !child || !label ||
(level->num_items >= level->max_items)) {
return NULL;
}
child->parent_level = level;
ActionMenuItem *item = &level->items[level->num_items];
*item = (ActionMenuItem) {
.label = label,
.next_level = child,
};
++level->num_items;
return item;
} | |
otif.type;
// Reminders come first, then everything else. More recent reminders should appear before older
// reminders and more recent notifications should appear before older notifications
if (type_b == NotificationReminder) {
return 1;
} else if (type_b != NotificationReminder && type_a != NotificationR... | peek_layer_destroy(data->peek_layer) | ;
data->peek_layer = NULL;
TimelineItem *item = prv_get_current_notification(data);
layer_set_hidden((Layer *)&data->action_button_layer,
!prv_should_provide_action_menu_for_item(data, item));
}
static void prv_hide_peek_layer(void *context) {
NotificationWindowData *data = context;
// ge... |
0},
{ 0, 0x7c, 0, 205, 0},
{ 0, 0x7c, 0, 205, 0},
{ 0, 0x7c, 0, 205, 0},
// 690: Local time: 2015-11-13 06:52:00 AM
{ 0, 0x7c, 0, 205, 0},
{ 0, 0x7c, 0, 204, 0},
{ 0, 0x7c, 0, 205, 0},
{ 0, 0x7c, 0, 204, 0},
{ 0, 0x7c, 6, 193, 0},
{ 0, 0x7c, 0, 204, 0},
{ 0, 0x7c, 0, 204, 0}... | { 0, 0x53, 3646, 233, 0},
// 795: Local time: 2015-11-13 08:37:00 AM
{ 44, 0x41, 3304, 218, 0},
{ 77, 0x41, 4977, 208, 0},
{ 33, 0x43, 3133, 187, 0},
{ 0, 0x43, 2239, 167, 0},
{ 0, 0x43, 3691, 158, 0},
{ 0, 0x43, 1000, 153, 0},
{ 8, 0x43, 1173, 165, 0},
{ 0, 0x63, 6209, 168, 0},
... | |
)
);
uint32_t count = string_list_count(list_a);
for (uint32_t idx = 0; i<count; i++) {
cl_assert_equal_s(
string_list_get_at(list_a, idx),
string_list_get_at(list_b, idx)
);
}
break;
}
default:
cl_assert(false)... | (notification_storage_get(&i1, &r)) | |
/ FIXED_S16_3_ONE.raw_value;
if (x1_rounded > x2_rounded) {
// AA algorithm will draw lines in one way only, so non-AA should reject those too
return;
}
prv_assign_line_horizontal_non_aa(ctx, y, x1_rounded, x2_rounded);
}
void graphics_private_draw_vertical_line(GContext *ctx, int16_t x, Fixed_S16_3 y1... | MIN(y0, y1) | , clip_box->origin.y);
int16_t y_max = MIN(MAX(y0, y1), clip_box->origin.y + clip_box->size.h);
#if PBL_COLOR
color.a = (uint8_t)(MAX_PLOT_BRIGHTNESS - opacity);
#else
if (opacity > (MAX_PLOT_BRIGHTNESS / 2)) {
// We're not plotting anything, bail
return;
}
#endif // PBL_COLOR
ctx->draw_state.draw_i... |
(data->ui_state != BTPairingUIStateAwaitingResult) {
PBL_LOG(LOG_LEVEL_WARNING,
"Got completion (%u) but not right state", success);
return;
}
PBL_LOG(LOG_LEVEL_DEBUG, "Got Completion! %u", success);
data->ui_state = success ? BTPairingUIStateSuccess : BTPairingUIStateFailed;
prv_adjust_ba... | (&pair_event) | |
_subscribe(BUTTON_ID_UP, up_click_handler);
window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler);
}
static uint32_t s_seconds_count;
void handle_second_tick(struct tm *tick_time, TimeUnits units_changed) {
bool running = app_worker_is_running();
if (false) {
const char* status = "not";
if ... | (text_layer, "? ? ?") | |
_key_default = FONT_KEY_GOTHIC_28_BOLD;
const char *font_key_japanese = FONT_KEY_MINCHO_24_PAIR;
#else
const char *font_key_default = FONT_KEY_GOTHIC_24_BOLD;
const char *font_key_japanese = FONT_KEY_MINCHO_20_PAIR;
#endif
const Translation english_translation = { "Pair?", font_key_default };
const Translatio... | (data->info_text_out_animation) | |
rveFunction curve_function) {
return prv_animation_set_custom_function(animation_h,
AnimationCurveCustomFunction,
curve_function);
}
// -------------------------------------------------------------------------------------------
boo... | PBL_ASSERTN(!animation_private_using_legacy_2(state)) | |
ribe) {
prv_event_service_subscribe(subscription);
} else {
prv_event_service_unsubscribe(subscription);
}
}
void event_service_clear_process_subscriptions(PebbleTask task) {
EventServiceEntry *service;
for (int i = 0; i < PEBBLE_NUM_EVENTS; i++) {
if ((service = s_event_services[i]) == NULL) {
... | if (stolen) {
// we stole the buffer from the event, NULL it out
*buf_ptr = NULL;
} |
}
// -------------------------------------------------------------------------------------------------
static bool prv_buffer_find(ListNode *found_node, void *data) {
EventServiceBuffer *esb = (EventServiceBuffer *)found_node;
return (esb->ptr == data);
}
static EventServiceBuffer* prv_get_esb_for_event(PebbleEv... |
r the specific language governing permissions and
* limitations under the License.
*/
#include "action_bar_layer_legacy2.h"
#include "applib/graphics/graphics.h"
#include "applib/ui/window_private.h"
#include "kernel/pbl_malloc.h"
#include "system/passert.h"
#include <string.h>
inline static bool action_bar_legac... | (action_bar_layer) | |
/*
* 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_timer_register(timer_duration,
prv_pulsing_heart_timer_cb,
base_layer) | ;
}
layer_mark_dirty(base_layer);
}
static void prv_render_progress_bar(GContext *ctx, Layer *base_layer) {
HealthHrSummaryCardData *data = layer_get_data(base_layer);
health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_BACKGROUND_COLOR,
0, HEALTH_PROGRESS_BAR_MAX_VALUE);
}... |
//////////////////////////////////////
static int round_up_to_nearest_subsector(uint32_t addr) {
// - 1 because if we're currently on a subsector border we don't want to round up to the
// next one.
return (addr + SUBSECTOR_SIZE_BYTES - 1) & SUBSECTOR_ADDR_MASK;
}
static bool is_cursor_at_active_registry(uint32_... | ("UUID is:\n\t") | ;
for (int i = 0; i < UUID_SIZE_BYTES; i++) {
PBL_LOG_VERBOSE("%#.2hx, ",r->uuid[i]);
}
PBL_LOG_VERBOSE("\n");
PBL_LOG_VERBOSE("Description is:\n\t%#.2hx\n", r->description);
PBL_LOG_VERBOSE("Value is:\n\t");
for (int i = 0; i < r->value_length; i++) {
PBL_LOG_VERBOSE("%#.2hx, ",r->value[i]);
}
... |
#include <stdio.h>
#include <string.h>
#include "applib/ui/action_bar_layer.h"
#include "applib/ui/dialogs/confirmation_dialog.h"
#include "kernel/event_loop.h"
#include "kernel/pbl_malloc.h"
#include "kernel/ui/modals/modal_manager.h"
#include "process_management/app_install_manager.h"
#include "process_management/pr... | dialog_set_text(dialog, msg_buffer) | |
/*
* 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... | pebble_pairing_service_init() | |
_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_path_num_points));
prv_reset();
// restore stroke color and... | (s_path_fill_count, 2) | |
ertical_line_dotted(&ctx, GPoint(12, 6), 10);
graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 6), 10);
graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 7), 10);
graphics_draw_vertical_line_dotted(&ctx, GPoint(24, 7), 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_vert_do... | (&ctx, GPoint(24, 7), 10) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_vert_dotted_line_even_offset_no_clip")));
// Even cols of different lengths
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_ROWS);
graphics_dr... |
ible(Window *window) {
VisibleContext context = { .window = window };
prv_each_modal_stack(prv_is_window_visible_callback, &context);
return context.visible;
}
typedef struct FocusedContext {
Window *window;
bool focused;
} FocusedContext;
static bool prv_is_window_focused_callback(ModalContext *modal, Iter... | for (size_t i = 0; i < info.counts[priority]; ++i) {
prompt_send_response_fmt(buffer, sizeof(buffer), "window %p <%s>",
info.dumps[priority][i].addr,
info.dumps[priority][i].name);
} |
}
kernel_free(info.dumps[priority]);
}
}
void modal_manager_reset(void) {
for (ModalPriority idx = ModalPriorityInvalid + 1; idx < NumModalPriorities; idx++) {
memset(&s_modal_window_stacks[idx], 0, sizeof(ModalContext));
}
s_modal_min_priority = ModalPriorityDiscreet;
modal_manager_init();
}
|
ext *ctx, int16_t x, int16_t y1, int16_t y2,
GColor color) {
PBL_ASSERTN(ctx);
GBitmap *framebuffer = &ctx->dest_bitmap;
#if SCREEN_COLOR_DEPTH_BITS == 8
for (int i = y1; i < y2; i++) {
// Skip over pixels outside the bitmap data row's range
const GBitmapDataRowIn... | (ctx, output, data_row_offset, color, x1.integer,
(uint8_t)x2.fraction) | ;
}
// or last AA gradient with blending
} else {
for (int i = 0; i < right_aa_offset; i++) {
if (x1.integer > clip_box_max_x) {
break;
}
graphics_private_raw_blend_color_factor(ctx, output, data_row_offset, color, x1.integer,
(uint8_... |
graphics_draw_vertical_line_dotted(&ctx, GPoint(100, 90), 10) | ;
graphics_draw_horizontal_line_dotted(&ctx, GPoint(100, 95), 5);
// T facing left - odd vert, odd horiz
graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 91), 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(131, 96), 5);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_dotted_l... | |
p window, and there is another transparent window below
// Test: Multiple transparent top windows result in Transparent
modal_manager_event_loop_upkeep();
cl_assert_equal_i(modal_manager_get_properties(),
ModalProperty_Exists | ModalProperty_CompositorTransitions |
ModalPro... | cl_assert(NumModalPriorities > 3) | ;
window_stack_push(window_stacks[3], windows[3][0], false);
// An opaque top window of a different stack is now obstructing the unfocusable top window
// Top here throughout means that it is the top window of the window stack it is in
// Test: An opaque top window above a unfocusable top window removes Unfocu... |
/*
* 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... | {
// Reset the FPGA and wait for it to program itself via NVCM.
// NVCM configuration is initiated by pulling CRESET high while SCS is high.
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET);
// CRESET needs to be low for at least 200 ns
GPIO_WriteBit(DISP_GPIO, DISP_PIN_CRESET, Bit_RESET);
delay_ms(1);
GPI... | |
/*
* 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... | framebuffer_get_line(f, y) | ;
memset(line, 0xffffffff, FRAMEBUFFER_SIZE_BYTES);
bitset8_set(f->dirty_lines, y);
f->is_dirty = true;
}
void framebuffer_mark_dirty_rect(FrameBuffer* f, GRect rect) {
const uint16_t y_start = rect.origin.y;
const uint16_t y_end = y_start + rect.size.h;
for (uint16_t y = y_start; y < y_end; ++y) {
bi... |
/*
* 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... | alerts_should_notify_for_type(AlertInvalid) | );
cl_assert(!alerts_should_notify_for_type(AlertMobile));
cl_assert(!alerts_should_notify_for_type(AlertReminder));
cl_assert(!alerts_should_notify_for_type(AlertPhoneCall));
}
void test_alerts__do_not_disturb(void) {
cl_assert(alerts_get_mask() == AlertMaskAllOn);
// We now allow notifications to come thr... |
/*
* 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... | (light_num_window) | |
r the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licens... | if (app_data->reset_timer == TIMER_INVALID_ID) {
success = new_timer_start(app_data->reset_timer, 500, bt_test_reset_callback, app_data, 0 /*flags*/);
} |
if (app_data->reset_timer == TIMER_INVALID_ID || !success) {
bt_test_reset_callback(app_data);
}
}
}
static void config_provider(Window *window) {
// single click / repeat-on-hold config:
window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler) select_single_click_handler);
window_single_... |
/*
* 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 false;
} |
const uint8_t *sys_resource_read_only_bytes(ResAppNum app_num, uint32_t resource_id,
size_t *num_bytes_out) {
return NULL;
}
uint32_t sys_resource_get_and_cache(ResAppNum app_num, uint32_t resource_id) {
return resource_id;
}
bool sys_resource_is_valid(ResAppNum app_n... |
nbuffered
chunk_size = item_size;
} else {
chunk_size = MIN(num_bytes, DLS_SESSION_MAX_BUFFERED_ITEM_SIZE);
chunk_size -= (chunk_size % item_size);
}
PBL_ASSERTN(chunk_size <= num_bytes);
data_logging_log(logging_session, buf, chunk_size / item_size);
fake_system_task_callbacks_inv... | dls_create(i, DATA_LOGGING_BYTE_ARRAY, item_size,
false /*buffered*/, false /*resume*/, &system_uuid) | ;
cl_assert(logging_sessions[i]);
}
// Log Consume
for (int i = 0; i < 10; i++) {
prv_log_consume_random(logging_sessions[i], item_size, rand() % 16);
}
}
// ----------------------------------------------------------------------------------------
void test_data_logging__log_consume_large_items(void) ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | bt_driver_cb_pebble_pairing_service_handle_ios_app_termination_detected() | |
aa_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_no_clip.${BIT_D... | (&ctx.dest_bitmap, "fill_rect_origin_r2_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi") | );
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , 3, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r3_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLI... |
hrm_info.application_id == AS7000AppId_Loader ||
hrm_info.sw_version_major != image_header.sw_version_major ||
hrm_info.sw_version_minor != image_header.sw_version_minor) {
// We technically could leave the firmware on the HRM alone if the
// minor version in the chip is newer than in the update ima... | prv_interrupts_enable(dev, false) | ;
gpio_analog_init(&dev->int_gpio);
led_disable(LEDEnablerHRM);
}
mutex_unlock(dev->state->lock);
}
|
oGATTPacket) {
.sn = 0,
.type = PPoGATTPacketTypeResetComplete,
};
PPoGATTResetCompleteClientIDPayloadV1 *client_id_payload =
(PPoGATTResetCompleteClientIDPayloadV1 *) packet->payload;
*client_id_payload = (const PPoGATTResetCompleteClientIDPayloadV1) {
.ppogatt_max_r... | (comm_session_send_queue_copy(client->session, offset,
payload_size, packet->payload)) | ;
*payload_size_out = payload_size;
return packet;
}
// -------------------------------------------------------------------------------------------------
static void prv_finalize_queued_packet(PPoGATTClient *client, uint16_t payload_size) {
if (client->out.reset_packet_byte != 0) {
client->out.reset_packet_... |
up some space in the cache. If so, do it.
static void prv_cleanup_app_cache_if_needed(void *data) {
uint32_t pfs_space = get_available_pfs_space();
if (pfs_space < APP_SPACE_BUFFER) {
const uint32_t to_free = (APP_SPACE_BUFFER - pfs_space);
PBL_LOG(LOG_LEVEL_DEBUG, "Cache OOS: Need to free %"PRIu32" bytes,... | {
goto unlock;
} | |
/*
* 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_putstr("erase_old_firmware");
return system_flash_erase(
FIRMWARE_BASE, firmware_length, prv_display_erase_progress, 0);
} | |
cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id));
// check all day events
cl_assert(iter_next(&iterator));
Uuid first_all_day_event = state.pin.header.id;
cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[1].header.id) ||
uuid_equal(&state.pin.header.id, &s_all_day_items[2].heade... | iter_next(&iterator) | );
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[0].header.id));
cl_assert(!iter_next(&iterator));
}
// 11 am
void test_timeline__extra_case_none_forwards(void) {
prv_insert_extra_case_items();
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline... |
Samples) {
s_dls_accel_samples_created = false;
} else if (logging_session == (DataLoggingSession *) DataLoggingSession_ActivitySessions) {
s_dls_activity_sessions_created = false;
} else {
cl_assert(false);
}
}
// =================================================================================
// ... | {
ActivitySession sessions[ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT];
uint32_t num_sessions = ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT;
activity_get_sessions(&num_sessions, sessions);
for (int i = 0; i < num_sessions; i++) {
if (sessions[i].type == exp_session->type
&& sessions[i].start_utc == exp_session->st... |
exp_session->step_data.resting_kcalories,
exp_session->step_data.active_kcalories, exp_session->step_data.distance_meters);
clar__assert(false, file, line, "Missing activity record", "", true);
}
// Assert that a particular sleep activity session is present in the sessions list
static void prv_ass... |
ationLegacy2 *)animation_h,
(const AnimationLegacy2Implementation *)implementation);
return true;
}
AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/);
if (!prv_is_mutable(state, animation)) {
return false;
}
animati... | {
AnimationState *state = prv_animation_state_get(PebbleTask_Current);
if (animation_private_using_legacy_2(state)) {
// 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 with 2.0 apps.
animation_legacy2_set_duration((An... | |
tion
prv_cleanup_voice_data(data);
}
}
static void prv_start_voice_reply(ActionMenu *action_menu,
const ActionMenuItem *item,
void *context) {
#if CAPABILITY_HAS_MICROPHONE
TimelineActionMenu *timeline_action_menu = context;
action_menu_free... | rtc_get_time() | + (15 * SECONDS_PER_MINUTE);
prv_invoke_remote_action(action_menu, action, pin, (void *)(uintptr_t)new_time);
}
static void prv_postpone_later_today(ActionMenu *action_menu,
const ActionMenuItem *action_menu_item,
void *context) {
TimelineA... |
/*
* 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... | {
LOCK_AND_GET_STORE(store);
return settings_file_exists(store, &key, sizeof(key));
} |
DEFINE_SYSCALL(int, persist_get_size, const uint32_t key) {
LOCK_AND_GET_STORE(store);
int result = settings_file_get_len(store, &key, sizeof(key));
return result ?: E_DOES_NOT_EXIST;
}
DEFINE_SYSCALL(bool, persist_read_bool, const uint32_t key) {
bool value = false;
LOCK_AND_GET_STORE(store);
settings_f... |
if (recognizer->number_of_clicks_counted >= 1 && recognizer->is_repeating == false) {
int clicks_over = recognizer->number_of_clicks_counted;
for(int i = 0; i < clicks_over; i++) {
prv_dispatch_event(recognizer, ClickHandlerOffsetSingle, false);
}
}
prv_click_reset(recognizer);
}
static void prv_... | (&recognizer->hold_timer) | |
ameters_from_config(text_node, layout, config);
return text_node;
}
static void prv_setup_container_node_from_config(
GTextNodeContainer *container_node, const LayoutLayer *layout,
const LayoutNodeContainerConfig *config) {
const uint16_t num_nodes = config->num_nodes;
for (int i = 0; i < num_nodes; i++)... | for (unsigned int i = 0; i < num_headings; i++) {
const char *heading = string_list_get_at(headings, i);
const char *paragraph = string_list_get_at(paragraphs, i);
if (!heading || !paragraph) {
break;
}
GTextNodeText *heading_node =
(GTextNodeText *)layout_create_text_node_from_config... |
return vertical_node;
}
static GTextNode *prv_create_headings_paragraphs_node(
const LayoutLayer *layout, const LayoutNodeHeadingsParagraphsConfig *config) {
GTextNode *node = &layout_create_headings_paragraphs_node(layout, config)->container.node;
if (node) {
prv_set_text_node_extent(node, (LayoutNode... |
BLECharacteristic characteristic_ref,
GAPLEConnection **connection);
extern SemaphoreHandle_t gatt_client_subscription_get_semaphore(void);
extern void gatt_client_subscription_cleanup(void);
#define TEST_GATT_CONNECTION_ID (1234)
#define BOGUS_CHARAC... | cl_assert_equal_i(header.value_length, assert_value_length) | ;
cl_assert_equal_i(header.characteristic, characteristic);
if (should_consume) {
uint16_t value_length = assert_value_length;
gatt_client_subscriptions_consume_notification(&characteristic_out, buffer, &value_length,
GAPLEClientApp, NULL);
... |
n prv_get_flag(connection, ConnectionFlag_IsSubscribedToConnectionStatusNotifications);
}
bool connection_should_pin_address(const Connection *connection) {
return prv_get_flag(connection, ConnectionFlag_ShouldPinAddress);
}
bool connection_should_auto_accept_re_pairing(const Connection *connection) {
return prv_... | prv_unlock() | ;
}
void connection_update_address(Connection *connection, const BTDeviceInternal *updated_addr) {
prv_lock();
{
if (connection_is_valid(connection)) {
connection->updated_addr = *updated_addr;
connection->has_updated_addr = true;
}
}
prv_unlock();
}
//
// Other functions
//
void connecti... |
e,
&value, sizeof(value));
prv_assert_no_event();
}
void test_gatt_client_subscriptions__cccd_write_confirmation_but_no_subscription(void) {
s_last_cccd_ref = 1;
prv_confirm_cccd_write(BLEGATTErrorSuccess);
// This used to cause a crash:
// https://pebb... | prv_assert_notification_event(characteristic, value, sizeof(value),
true /* kernel */, true /* app */) | ;
// Send the 3rd notification:
gatt_client_subscriptions_handle_server_notification(s_connection, s_handle,
value, sizeof(value));
cl_assert_equal_i(fake_event_get_count(), 2);
prv_assert_notification_event(characteristic, value, sizeof(value),
... |
#include "mfg/results_ui.h"
#include "process_management/app_manager.h"
#include "process_management/pebble_process_md.h"
#include "process_state/app_state/app_state.h"
#include "resource/resource_ids.auto.h"
#include "resource/system_resource.h"
#include "services/common/light.h"
#include "util/size.h"
typedef enum {... | GPoint(layer->bounds.size.w - radial_padding_size - 1, layer->bounds.size.h / 2) | );
prv_draw_border(layer, ctx, radial_padding_size);
}
static void prv_draw_bitmap(struct Layer *layer, GContext *ctx, uint32_t res) {
GBitmap *bitmap = gbitmap_create_with_resource(res);
graphics_draw_bitmap_in_rect(ctx, bitmap, &layer->bounds);
gbitmap_destroy(bitmap);
}
static void prv_update_proc(struct ... |
const int16_t height = prv_height();
if (layer->frame.size.h != height) {
layer->frame.size.h = height;
}
if (layer->bounds.size.h != height) {
layer->bounds.size.h = height;
}
}
static void prv_status_bar_layer_render(Layer *layer, GContext *ctx) {
StatusBarLayer *status_bar_layer = (StatusBarLay... | (status_bar_layer) | |
0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 105, 141, 0},
// 180: Local time: 2016-05-20 12:05:00 AM
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0... | { 0, 0x6a, 0, 140, 0},
{ 0, 0x6a, 0, 140, 0},
{ 0, 0x6a, 0, 140, 0},
{ 0, 0x6a, 0, 140, 0},
{ 0, 0x6a, 0, 140, 0},
{ 0, 0x6a, 0, 140, 0},
// 285: Local time: 2016-05-20 01:51:00 AM
{ 0, 0x6a, 0, 140, 0},
{ 0, 0x6a, 0, 140, 0},
{ 0, 0x6a, 0, 140, 0},
{ 0, 0x6a, 0, 140, 0},
... |
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 271, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 14... |
tinfra.h"
#define NUM_SUCCESSFUL_OPENS_TO_TRACK 2
#define DIAGNOSTIC_ENTRY_SIZE 40
static uint8_t s_pmap_fd_diagnostic_data[NUM_SUCCESSFUL_OPENS_TO_TRACK][DIAGNOSTIC_ENTRY_SIZE];
static int s_next_pmap_fd_idx = 0;
#endif
// TODO: Remove once we figure out PBL-20973
static void prv_pmap_grab_debug_fd_data(int fd) {
#if... | kernel_free(buf) | ;
return (rv);
}
int persist_map_add_uuid(const Uuid *uuid) {
int id = get_next_id();
int fd = prv_pmap_open_debug_wrapper(s_map_filename, OP_FLAG_READ | OP_FLAG_WRITE,
FILE_TYPE_STATIC, 0);
if (fd < 0) {
PBL_LOG(LOG_LEVEL_WARNING, "pmap add uuid (open) failed: %d", fd);
return (fd);
}
int ... |
er.bounds.size.h) {
data->square_velocity_y = data->square_velocity_y * -1;
}
} else if (shape == RECTANGLE) {
// Move the rectangle X per 2*Y
data->rect.origin.x += (data->rect_velocity_x * PIXEL_SPEED_PER_FRAME);
if (data->rect.origin.x < 0 ||
data->rect.origin.x + data->... | (ctx, &data->rect) | ;
} else if (shape == RECTANGLE_ROUND) {
graphics_fill_round_rect(ctx, &data->rectr, data->rectr_radius, GCornersAll);
} else if (shape == CIRCLE) {
graphics_context_set_fill_color(ctx, data->circle_color);
graphics_context_set_stroke_color(ctx, data->circle_color);
graphics_fill_circle(... |
TERNAL : rv;
break;
}
curr_file_len -= bytes_to_read;
}
pfs_close(*fd);
pfs_close(new_fd);
*fd = prv_pmap_open_debug_wrapper(s_map_filename, OP_FLAG_READ | OP_FLAG_WRITE, 0, 0);
if (*fd < 0) {
PBL_LOG(LOG_LEVEL_WARNING, "pmap enlarge (re-open) failed: %d", *fd);
}
kernel_free(buf);
r... | if (fd < 0) {
if ((fd = prv_pmap_open_debug_wrapper(name, OP_FLAG_WRITE, FILE_TYPE_STATIC,
PMAP_FILE_SIZE)) < 0) {
PBL_LOG(LOG_LEVEL_WARNING, "pmap create failed: %d", fd);
return (fd);
}
PersistMapHeader header = {
.version = PERSIST_MAP_VERSION,
};
status = pfs_write(fd,... |
pfs_close(fd);
return (status);
}
|
age_too_short(void) {
prv_receive_init_put_and_commit_fw_object();
const uint8_t incomplete_install_msg = CmdInstall;
prv_receive_data(s_session, (const uint8_t *) &incomplete_install_msg,
sizeof(incomplete_install_msg));
assert_ack_count(0);
assert_nack_count(1);
}
void te... | stub_new_timer_fire(put_bytes_get_timer_id()) | ;
fake_system_task_callbacks_invoke_pending();
// Expect only "Cleanup" event:
cl_assert_equal_i(fake_event_get_count(), 1);
assert_cleanup_event(ObjectFirmware, VALID_OBJECT_SIZE);
}
void test_put_bytes__expect_init_event_upon_timeout(void) {
put_bytes_expect_init(EXPECT_INIT_TIMEOUT_MS);
stub_new_timer... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
*data_out = (SharedPRFData){};
} |
static void prv_get_empty_struct(SharedPRFData *data_out) {
*data_out = (SharedPRFData) { .version = SHARED_PRF_STORAGE_VERSION };
}
static void prv_fetch_struct(SharedPRFData *data_out) {
flash_read_bytes((uint8_t*) data_out, FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, sizeof(*data_out));
if (data_out->version !=... |
/*
* 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... | {
// We'll use a base clock speed of 360Mhz and try to get to 100kHz I2C. This requires a prescaler
// of 8 which gets us down to a base clock speed of 45MHz.
//
// 45MHz / 100kHz = 450 cycles => 450 - ceil(6 / 8) sync cycles = 449 cycles to play with
// minimum low = ceil(4700ns / (1 / 45MHz)) = 212 cycles
... |
void test_i2c_timingr__valid_no_prescaler_rise_fall_time(void) {
// We'll use a base clock speed of 20MHz and try to get to 100kHz I2C with fall and rise times of
// 500ns each.
//
// 20MHz / 100kHz = 200 cycles => 200 - 6 sync cycles - (2 * 500ns / (1 / 20MHz)) = 174 cycles to
// play with
// minimum low... |
/*
* 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... | for (int i = ARRAY_LENGTH(OTP_HWVER_SLOT_INDICES) - 1; i >= 0; --i) {
const uint8_t index = OTP_HWVER_SLOT_INDICES[i];
if (otp_is_locked(index)) {
return otp_get_slot(index);
}
} |
return DUMMY_HWVER;
}
const char* mfg_get_pcba_serial_number(void) {
// Trying from "most recent" slot to "least recent":
for (int i = ARRAY_LENGTH(OTP_PCBA_SLOT_INDICES) - 1; i >= 0; --i) {
const uint8_t index = OTP_PCBA_SLOT_INDICES[i];
if (otp_is_locked(index)) {
return otp_get_slot(index);
... |
PBL_LOG(LOG_LEVEL_DEBUG,
" Found Characteristic %s Handle 0x%"PRIx16, uuid_str, item->c.value_handle);
} else if (item->type == GATTC_ITEM_TYPE_DESCRIPTOR) {
if (char_dest == NULL) {
PBL_LOG(LOG_LEVEL_ERROR, "No characteristic found for descriptor! handle=0x%x",
(int)it... | // gah, Android doesn't seem to create the CCCD, but it does seem to auto-subscribe any
// bonded device so let's assume this is what happen and notify the main firmware that we are
// subscribed.
PBL_LOG(LOG_LEVEL_DEBUG, "No cccd found for service changed characteristic, assuming we are "
... |
}
void gatt_client_discovery_process_service(const ble_evt_gattc_browse_svc_t *service) {
uint32_t payload_size;
HcProtocolDiscoveryServiceFoundPayload *payload =
prv_gatt_client_discovery_build_gatt_service(service, &payload_size);
if (!payload) {
return;
}
Connection *connection = connection_by_... |
/*
* 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... | {
GBCoredumpData *data = storage->impl_data;
uint32_t image_base = data->core_dump_base + sizeof(CoreDumpFlashRegionHeader);
flash_read_bytes(buffer, image_base + storage->current_offset, len);
storage->current_offset += len;
return true;
} |
void gb_storage_coredump_cleanup(GetBytesStorage *storage, bool successful) {
// if successful, mark the coredump as read
if (successful) {
GBCoredumpData *data = storage->impl_data;
core_dump_mark_read(data->core_dump_base);
}
kernel_free(storage->impl_data);
}
bool is_unread_coredump_available(voi... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&s_state) | ;
}
void test_qemu_serial__cleanup(void) {
}
// ------------------------------------------------------------------------------------
static void prv_send_bytes(void *p, uint32_t size) {
uint8_t *src = (uint8_t *)p;
for (uint32_t i=0; i<size; i++) {
qemu_test_add_byte_from_isr(&s_state, *src++);
}
}
// --... |
uence_destroy(bitmap_sequence);
}
return bitmap_sequence;
}
bool gbitmap_sequence_restart(GBitmapSequence *bitmap_sequence) {
return prv_gbitmap_sequence_restart(bitmap_sequence, true);
}
void gbitmap_sequence_destroy(GBitmapSequence *bitmap_sequence) {
if (bitmap_sequence) {
upng_destroy(bitmap_sequence... | APP_LOG(APP_LOG_LEVEL_ERROR,
(upng_state == UPNG_ENOMEM) ? APNG_MEMORY_ERROR : APNG_DECODE_ERROR) | ;
goto cleanup;
}
applib_free(buffer);
bitmap_sequence->current_frame++;
const uint32_t width = bitmap_sequence->bitmap_size.w;
const uint32_t height = bitmap_sequence->bitmap_size.h;
const bool bitmap_supports_transparency = (bitmap_format != GBitmapFormat1Bit);
// DISPOSE_OP_BACKGROUND sets the ... |
include "system/passert.h"
#include "util/size.h"
#include <string.h>
#define MINUTES(m) ((m) * SECONDS_PER_MINUTE)
#define HOURS(m) ((m) * SECONDS_PER_MINUTE * MINUTES_PER_HOUR)
typedef struct {
TimelineItemType type;
LayoutId layout_id;
uint32_t icon_id;
uint8_t bg_color;
uint8_t prim_color;
uint8_t se... | window_single_click_subscribe(BUTTON_ID_SELECT, prv_select_single_click_handler) | ;
window_long_click_subscribe(BUTTON_ID_SELECT, 0, prv_select_long_click_handler, NULL);
window_set_click_context(BUTTON_ID_SELECT, data);
}
///////////////////
// Window callbacks
static void prv_window_load(Window *window) {
SwapLayerDemoData *data = app_state_get_user_data();
Layer *root = window_get_root_... |
/*
* 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... | (&contact->attr_list,
&contact->addr_list,
buffer,
buf_end,
serialized_contact->data,
serialized_contact_data_len) | ) {
kernel_free(contact);
return NULL;
}
contact->id = serialized_contact->uuid;
contact->flags = serialized_contact->flags;
return contact;
}
Contact* contacts_get_contact_by_uuid(const Uuid *uuid) {
SerializedContact *serialized_contact = NULL;
const int serialized_contact_data_len = contacts_db... |
e_db__initialize(void) {
s_app_cache_entry_exists = true;
s_app_install_id = 1;
s_launch_count = 0;
fake_event_init();
fake_settings_file_reset();
app_glance_db_init();
}
void app_glance_db_deinit(void);
void test_app_glance_db__cleanup(void) {
app_glance_db_deinit();
}
// Blob Tests
/////////////////... | test_app_glance_db__basic_glance_blob_insert_and_read() | ;
// Trying to delete the basic glance blob with an invalid key length should fail
const size_t invalid_key_length = 1337;
cl_assert_equal_i(app_glance_db_delete((uint8_t *)&APP_GLANCE_TEST_UUID, invalid_key_length),
E_INVALID_ARGUMENT);
}
void test_app_glance_db__glance_blob_with_older_crea... |
/*
* 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 resource_storage_builtin_bytes_are_readonly(bytes);
} |
bool applib_resource_is_mmapped(const void *bytes) {
return resource_storage_builtin_bytes_are_readonly(bytes);
}
bool applib_resource_munmap(const void *bytes) {
return resource_storage_builtin_bytes_are_readonly(bytes);
}
#endif // CAPABILITY_HAS_MAPPABLE_FLASH
|
ut = rect->size;
}
}
static void prv_draw_heart_node_callback(GContext *ctx, const GRect *box,
const GTextNodeDrawConfig *config, bool render,
GSize *size_out, void *user_data) {
WorkoutActiveWindow *active_window = user_data;
GRec... | GEdgeInsets(0, rl_margin) | );
// set rect y depending on layout, primary metric and display shape
if (active_window->layout == WorkoutLayout_SingleMetric) {
rect.origin.y = PBL_IF_RECT_ELSE(35, 41);
} else if (active_window->layout == WorkoutLayout_StaticAndScrollable) {
rect.origin.y = prefer_larger_font ? PBL_IF_RECT_ELSE(2, 13)... |
t->remote_encryption_info.ediv = ble_data->ediv;
pairing_info_out->irk = ble_data->irk;
pairing_info_out->identity = ble_data->identity;
pairing_info_out->csrk = ble_data->csrk;
pairing_info_out->is_local_encryption_info_valid = ble_data->is_local_encryption_info_valid;
pairing_info_out->is_remote_e... | prv_fetch_struct(&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... | prv_update_struct(&data) | ;
}
#endif
void mfg_info_get_model(char* buffer) {
MfgData data = prv_fetch_struct();
strncpy(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, mo... |
//////////////////////////////
void do_not_disturb_init(void) {
return;
}
void vibe_intensity_init(void) {
return;
}
static bool s_low_power_active = false;
bool low_power_is_active(void) {
return s_low_power_active;
}
static bool s_dnd_active = false;
bool do_not_disturb_is_active(void) {
return s_dnd_act... | alerts_should_enable_backlight_for_type(AlertOther) | );
cl_assert(alerts_should_notify_for_type(AlertPhoneCall));
cl_assert(!alerts_should_vibrate_for_type(AlertPhoneCall));
alerts_set_notification_vibe_timestamp();
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS);
cl_assert(!alerts_should_enable_backlight_for_type(AlertPhoneCall));
s_d... |
width, style->status_height);
text_layer_init_with_parameters(&s_phone_ui_data->call_status_text_layer,
&call_status_text_rect, NULL, s_phone_ui_data->status_font,
GColorBlack,
PBL_IF_COLOR_ELSE(GColorClea... | if (!s_phone_ui_data) {
PBL_LOG(LOG_LEVEL_ERROR, "Can't handle call end, UI isn't setup");
return;
} |
prv_stop_ringing();
prv_stop_call_duration_timer();
// This must be called before prv_set_status_text, otherwise the text will not be centered
prv_action_bar_setup(PhoneCallActions_None);
if (call_accepted) {
prv_set_icon_resource(TIMELINE_RESOURCE_DURING_PHONE_CALL);
prv_set_window_color(ACCEPT_... |
--------------------
// Count how many animations have been allocated
static uint32_t prv_count_animations(void) {
AnimationState *state = kernel_applib_get_animation_state();
return list_count(state->unscheduled_head) + list_count(state->scheduled_head);
}
// ------------------------------------------------------... | GRect(0, 0, 100, 200) | ; // x, y, width, height
to_r = GRect(1000, 2000, 100, 200); // x, y, width, height
prop_h = property_animation_create_layer_frame(&layer, &from_r, &to_r);
Animation *h = property_animation_get_animation(prop_h);
void *context = &layer;
animation_set_handlers(h, handlers, context);
animation_set_duratio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.