prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
to ensure we don't miss any bytes of the response due to
// KernelBG not getting scheduled quickly enough.
PBL_ASSERTN(!mbuf_get_next(&s_header_mbuf));
mbuf_append(&s_header_mbuf, context);
mbuf_iterator_init(&s_read_consumer.mbuf_iter, &s_header_mbuf);
smartstrap_fsm_state_set(Smartstrap... | smartstrap_fsm_state_set(SmartstrapStateReadReady) | |
oke_points = NULL;
}
if (s_fill_points) {
free(s_fill_points);
s_fill_points = NULL;
}
if (s_precise_lines) {
free(s_precise_lines);
s_precise_lines = NULL;
}
}
// tests
void test_gdraw_command__draw_command_stroke(void) {
GDrawCommand *command = malloc(sizeof(GDrawCommand) + (sizeof(GPoint... | gdraw_command_set_point(command, 0, points2[0]) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (mask, offset) | );
graphics_draw_pixel(ctx, GPoint(offset, mask));
// Top-right quadrant
graphics_draw_pixel(ctx, GPoint(mask, layer->bounds.size.h - offset - 1));
graphics_draw_pixel(ctx, GPoint(layer->bounds.size.w - offset - 1, mask));
// Bottom-left quadrant
graphics_draw_pixel(ctx, GPoint(layer->bounds.siz... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_ASSERTN(service->num_subscribers > 0) | ;
--service->num_subscribers;
service->subscribers[subscription->task] = NULL;
if (service->remove_subscriber_callback != NULL) {
service->remove_subscriber_callback(subscription->task);
}
}
static void prv_event_service_subscribe(PebbleSubscriptionEvent *subscription) {
EventServiceEntry *service = s_e... |
/*
* 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... | {
SerializedTimelineItemHeader hdr = {{{0}}};
status_t rv = reminder_db_read((uint8_t *)id, sizeof(TimelineItemId), (uint8_t *)&hdr,
sizeof(SerializedTimelineItemHeader));
timeline_item_deserialize_header(item_out, &hdr);
return rv;
} |
/////////////////////////
// Reminder DB specific API
/////////////////////////
status_t reminder_db_delete_with_parent(const TimelineItemId *parent_id) {
return (timeline_item_storage_delete_with_parent(&s_storage, parent_id,
reminders_handle_reminder_removed));
... |
y();
HealthValue per_day_default = (daily_totals.totals[0] * SECONDS_PER_DAY)
/ MAX(1, seconds_today);
if (stats->weekday.sum == 0) {
stats->weekday = (HealthServiceStats) {
.sum = per_day_default,
.avg = per_day_default,
.min = per_day_default,
.max = per_day_default,
.count =... | ((time_end - time_start) <= SECONDS_PER_DAY) | ;
struct tm *local_tm = pbl_override_localtime(&time_start);
// Add up the metric averages for the passed in time range
time_t chunk_start_time = time_start;
const int k_seconds_per_step_avg = SECONDS_PER_DAY / ACTIVITY_NUM_METRIC_AVERAGES;
unsigned int second_idx = local_tm->tm_hour * SECONDS_PER_HOUR
+... |
rvice_removed(&s_characteristics[0][0], PPoGATTCharacteristicNum);
const bool can_handle =
ppogatt_can_handle_characteristic(s_characteristics[0][PPoGATTCharacteristicData]);
cl_assert_equal_b(can_handle, false);
}
void test_ppogatt__handle_subscribe_to_unknown_characteristic(void) {
ppogatt_han... | (fake_comm_session_open_call_count(), 0) | ;
}
void test_ppogatt__open_session_when_found_pebble_app(void) {
prv_discover_and_read_meta_and_reset();
// Simulate getting "Reset Complete" from remote:
prv_receive_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]);
// Expect "Reset Complete" to be sent by FW:
prv_assert_sent_reset_complet... |
Window results_window;
MfgResultsUI results_ui;
#endif
} AppData;
static void prv_draw_solid(Layer *layer, GContext *ctx, GColor color) {
graphics_context_set_fill_color(ctx, color);
graphics_fill_rect(ctx, &layer->bounds);
}
static void prv_fill_cols(GContext *ctx, uint8_t color, int16_t *row, int16_t colum... | prv_draw_crosshair_screen(layer, ctx, 0) | ;
break;
#if PBL_COLOR
case TestPattern_Red:
prv_draw_solid(layer, ctx, GColorRed);
break;
case TestPattern_Green:
prv_draw_solid(layer, ctx, GColorGreen);
break;
case TestPattern_Blue:
prv_draw_solid(layer, ctx, GColorBlue);
break;
#endif
#if PBL_ROUND
case TestPattern_Border1:
... |
etrics(WorkoutActiveWindow *active_window) {
active_window->current_scrollable_metric =
(active_window->current_scrollable_metric + 1) % active_window->num_scrollable_metrics;
}
static void prv_down_click_handler(ClickRecognizerRef recognizer, void *context) {
WorkoutActiveWindow *active_window = context;
... | if (active_window->layout == WorkoutLayout_StaticAndScrollable) {
// Two metrics. 1 big static metric above a smaller scrollable metric
GRect top_metric_bounds = base_layer_bounds;
top_metric_bounds.size.h = PBL_IF_RECT_ELSE(90, 77);
layer_init(&active_window->top_metric_layer, &top_metric_bounds);
... |
GRect middle_metric_bounds = top_metric_bounds;
middle_metric_bounds.origin.y = top_metric_bounds.size.h;
middle_metric_bounds.size.h = layer_height - 2;
layer_init(&active_window->middle_metric_layer, &middle_metric_bounds);
layer_set_update_proc(&active_window->middle_metric_layer, prv_static_lay... |
nnection_params_update(conn_params);
uint8_t link_quality = 0;
int8_t rssi = 0;
bool success = bt_driver_analytics_get_connection_quality(peer_addr, &link_quality, &rssi);
if (success) {
PBL_LOG(LOG_LEVEL_DEBUG, "Link quality: %x, RSSI: %d", link_quality, rssi);
analytics_add(ANALYTICS_DEVICE_METRIC_B... | {
SlaveConnEventStats new_stats = {};
prv_calc_stats_and_print(orig_stats, &new_stats, true /* is_putbytes */);
analytics_event_put_byte_stats(
comm_session_get_system_session(), successful, type,
total_size, elapsed_time_ms, new_stats.num_conn_events,
new_stats.num_sync_errors, new_stats.num_conn_ev... |
void bluetooth_analytics_handle_get_bytes_stats(uint8_t type, uint32_t total_size,
uint32_t elapsed_time_ms,
const SlaveConnEventStats *orig_stats) {
SlaveConnEventStats new_stats = {};
prv_calc_stats_and_print(orig_st... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (kino_reel_get_data_size(kino_reel), 0) | ;
kino_reel_draw(kino_reel, &ctx, GPointZero);
}
void test_kino_reel__resource_pdci(void) {
// Test loading PDCI Kino Reel
uint32_t resource_id = sys_resource_load_file_as_resource(
TEST_IMAGES_PATH, "test_kino_reel__resource_pdci.pdc");
cl_assert(resource_id != UINT32_MAX);
KinoReel *kino_reel = kin... |
nder:
case AttributeIdRankAway:
case AttributeIdRankHome:
case AttributeIdNameAway:
case AttributeIdNameHome:
case AttributeIdRecordAway:
case AttributeIdRecordHome:
case AttributeIdScoreAway:
case AttributeIdScoreHome:
case AttributeIdBroadcaster:
case AttributeIdAppName:
ca... | {
notif_attr->uint32_list = (Uint32List *)*buffer;
*buffer += attribute->length;
PBL_ASSERTN(*buffer <= buf_end);
memcpy(notif_attr->uint32_list, *cursor, attribute->length);
break;
} |
default:
return false;
break;
}
*cursor += attribute->length;
return true;
}
static int32_t prv_get_buffer_size_for_serialized_attribute(const uint8_t **cursor,
const uint8_t *end) {
SerializedAttributeHeader *attribute = (SerializedAttributeHeader *)*cursor;
*cursor += sizeof(Serialize... |
/*
* 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;
} |
void launcher_task_add_callback(void (*callback)(void *data), void *data) {
callback(data);
}
void app_idle_timeout_pause(void) {
s_app_idle = true;
}
void app_idle_timeout_resume(void) {
s_app_idle = false;
}
bool app_install_id_from_app_db(AppInstallId id) {
return false;
}
void framebuffer_dirty_all(Fr... |
/*
* 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 needed, try to get our headroom back at the level where we want it to be.
if (ctx->headroom &&
ctx->headroom_size < ROCKY_API_MEMORY_HEADROOM_DESIRED_SIZE_BYTES) {
prv_deallocate_headroom(ctx);
prv_allocate_headroom_or_die(ctx);
}
} |
static void prv_collect_all_garbage(void) {
ecma_free_unused_memory(JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH, 0, true);
jmem_pools_collect_empty();
}
static void prv_memorypressure_app_log(const char *level, const jmem_heap_stats_t *stats) {
APP_LOG(LOG_LEVEL_WARNING, "Memory pressure level: %s", level);
APP_LO... |
RANSPORT_DEBUG_LOG("Local Status: %u bytes sendable, %u bytes receivable",
local_status_out.bytes_sendable_count,
local_status_out.bytes_receivable_count);
HOST_TRANSPORT_DEBUG_LOG("Remote Status: %u bytes sendable, %u bytes receivable",
... | while (true) {
sys_watchdog_notify(s_ble_host_transport_wdog_id);
sys_watchdog_suspend(s_ble_host_transport_wdog_id);
// Handle missed SPI CS edge:
prv_sample_spi_cs_and_unblock_loop_if_needed();
// Block the transaction loop until there's either data to transmit, or until the master
// assert... |
}
HostTransportEnqueueStatus host_transport_tx_enqueue(const uint8_t *buffer, size_t length) {
PBL_ASSERTN(length < HOST_TRANSPORT_CTLR_TX_BUFFER_SIZE &&
length < HOST_TRANSPORT_HOST_RX_BUFFER_SIZE);
prv_lock();
bool success = circular_buffer_write(&s_tx_buffer, buffer, length);
prv_unlock();
... |
// tests
void test_gdraw_command_sequence__validate(void) {
GDrawCommandSequence *sequence;
size_t size = prv_create_test_sequence(&sequence);
cl_assert_equal_i(size, gdraw_command_sequence_get_data_size(sequence));
cl_assert(gdraw_command_sequence_validate(sequence, size));
cl_assert(!gdraw_command_sequence... | (frame->duration, 30) | ;
cl_assert_equal_i(frame->command_list.num_commands, 1);
command = gdraw_command_list_get_command(&frame->command_list, 0);
cl_assert_equal_i(command->type, GDrawCommandTypePath);
cl_assert_equal_i(command->num_points, 3);
cl_assert_equal_i(command->stroke_color.argb, GColorRedARGB8);
cl_assert_equal_i(com... |
/*
* 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_each(animation->sibling, callback, context);
} |
callback(animation, context);
}
static void prv_free(AnimationPrivate *animation, uintptr_t context) {
list_remove(&animation->list_node, NULL, NULL);
free(animation);
}
bool animation_destroy(Animation *animation) {
prv_each((AnimationPrivate *)animation, prv_free, (uintptr_t)NULL);
return true;
}
bool a... |
(MusicServerCapabilityVolumeReporting) | ;
}
void command_print_now_playing(void) {
char title[MUSIC_BUFFER_LENGTH];
char artist[MUSIC_BUFFER_LENGTH];
char album[MUSIC_BUFFER_LENGTH];
music_get_now_playing(title, artist, album);
char buffer[128];
dbgserial_putstr_fmt(buffer, 128, "title=%s; artist=%s; album=%s", title, artist, album);
}
| |
"file%d", i);
uint8_t buf[PFS_SECTOR_SIZE * 2];
memset(&buf[0], i, sizeof(buf));
int fd = pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(buf));
printf("fd=%d\n", fd);
cl_assert(fd >= 0);
cl_assert_equal_i(pfs_write(fd, &buf[0], sizeof(buf)), sizeof(buf));
if (i == 0) {
... | if (((i & 0x1) == 0) ||
((i > ((num_pages() * 7) / 10)) && (i < ((num_pages() * 8) / 10)))) {
cl_assert(pfs_remove(file_small) == S_SUCCESS);
} |
}
// We limit this number because we would overflow our uint8_t.
const int num_regions = MIN(UINT8_MAX, (num_pages() * 5) / 10);
int fd = pfs_open("page_lookup", OP_FLAG_WRITE, FILE_TYPE_STATIC, PFS_SECTOR_SIZE * num_regions);
cl_assert(fd >= 0);
char buf[PFS_SECTOR_SIZE];
for (int i = 0; i < num_regio... |
/*
* 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_will_return(syscall_internal_check_return_address, true) | ;
s_user_start = 0x00;
s_user_size = 0x20;
memory_cache_flush((void*)0x20, 0x1);
cl_assert_equal_i(s_flush_addr, 0x20);
cl_assert_equal_i(s_flush_size, 0x01);
cl_assert_equal_i(s_invalidate_addr, 0x20);
cl_assert_equal_i(s_invalidate_size, 0x01);
cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Inval... |
GColorARGB8FromHEX(0x7fffd4)},
{"azure", GColorARGB8FromHEX(0xf0ffff)},
{"beige", GColorARGB8FromHEX(0xf5f5dc)},
{"bisque", GColorARGB8FromHEX(0xffe4c4)},
{"blanchedalmond", GColorARGB8FromHEX(0xffebcd)},
{"blueviolet", GColorARGB8FromHEX(0x8a2be2)},
{"brown", GColorARGB8FromHEX(0xa52a2a)},
{"burlywood",... | GColorARGB8FromHEX(0x7b68ee) | },
// {"mediumspringgreen", GColorARGBFromHEX(0x00fa9a)}, inconsistent with Pebble color
{"mediumturquoise", GColorARGB8FromHEX(0x48d1cc)},
{"mediumvioletred", GColorARGB8FromHEX(0xc71585)},
{"midnightblue", GColorARGB8FromHEX(0x191970)},
{"mintcream", GColorARGB8FromHEX(0xf5fffa)},
{"mistyrose", GColorARGB8... |
old_node = (LoadedNotificationNode*) list_get_tail(
(ListNode*) *loaded_list);
list_remove((ListNode*) old_node, (ListNode**) loaded_list, NULL);
prv_unload_loaded_notification(old_node);
}
// load the notification
TimelineItem notification;
if (!notification_storage_get(&node->id, ¬ificatio... | app_window_stack_pop_all(true /* animated */) | |
l_value(ActivityMetricSleepEnterAtSeconds, Monday, &val_out));
cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalFallAsleepTime]);
cl_assert(health_db_get_typical_value(ActivityMetricSleepExitAtSeconds, Monday, &val_out));
cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalWakeupTime]);
}
void test_health_db__hr... | {
int32_t val_out;
const char *average_step_key = "average_dailySteps";
int32_t average_steps_val = 123456;
cl_assert_equal_i(health_db_insert((uint8_t *)average_step_key, strlen(average_step_key),
(uint8_t *)&average_steps_val, sizeof(average_steps_val)),
... |
void test_health_db__notify_listeners(void) {
char *key;
s_metric_updated_count = 0;
key = "tuesday_sleepData";
cl_assert_equal_i(health_db_insert((uint8_t *)key, strlen(key),
(uint8_t *)s_sleep_data, sizeof(s_sleep_data)),
S_SUCCESS);
cl_assert_equa... |
NULL,
};
rocky_global_init(apis);
s_prv_api_add__result = true;
EXECUTE_SCRIPT(
"var f1 = function(){};\n"
"var f2 = function(){};\n"
"_rocky.on('foo', f1)\n"
);
cl_assert_equal_i(1, s_prv_api_add__callcount);
cl_assert_equal_b(true, rocky_global_has_event_handlers("foo"));
// variables f1... | EXECUTE_SCRIPT(
"_rocky.Event.prototype.myCustomThing = 'xyz';\n"
"var e = new _rocky.Event('myevent');\n"
"var t = e.type;\n"
"var c = e.myCustomThing;\n"
) | ;
ASSERT_JS_GLOBAL_EQUALS_S("t", "myevent");
ASSERT_JS_GLOBAL_EQUALS_S("c", "xyz");
}
void test_rocky_api_global__call_event_handlers_async(void) {
static const RockyGlobalAPI api = {
.init = prv_api_init,
.add_handler = prv_api_add,
};
static const RockyGlobalAPI *apis[] = {
&api,
NULL,
};... |
truct.I2C_Ack = I2C_Ack_Enable;
I2C_Init(i2c_buses[bus_idx].i2c, &i2c_init_struct);
I2C_Cmd(i2c_buses[bus_idx].i2c, ENABLE);
}
//! Configure the bus pins, enable the peripheral clock and initialize the I2C peripheral.
//! Always lock the bus and peripheral config access before enabling it
static void bus_enable(u... | PBL_ASSERTN(s_initialized) | ;
PBL_ASSERTN(device_id < BOARD_CONFIG.i2c_device_count);
uint8_t bus_idx = BOARD_CONFIG.i2c_device_map[device_id];
I2cBus *bus = &i2c_buses[bus_idx];
// Take control of bus; only one task may use bus at a time
bus_lock(bus);
if (bus->user_count == 0) {
PBL_LOG(LOG_LEVEL_ERROR, "Attempted reset of di... |
allbacks(), 0);
cl_assert_equal_i(s_send_next_count, 1);
comm_session_send_next(session);
cl_assert_equal_i(fake_system_task_count_callbacks(), 1);
comm_session_send_next(session);
cl_assert_equal_i(fake_system_task_count_callbacks(), 1);
cl_assert_equal_i(s_send_next_count, 1);
fake_system_task_callbac... | comm_session_send_next_is_scheduled(session) | , true);
// Calling comm_session_send_next_immediately should NOT result in the flag to get unset
comm_session_send_next_immediately(session);
cl_assert_equal_b(comm_session_send_next_is_scheduled(session), true);
fake_system_task_callbacks_invoke_pending();
cl_assert_equal_b(comm_session_send_next_is_sched... |
const bool render = false;
prv_render_view(layout, ctx, render, size_out);
}
/////////////////////////
// Card View
/////////////////////////
GTextNodeCustom *timeline_layout_create_icon_node(const TimelineLayout *layout) {
return layout_node_create_kino_layer_wrapper((void *)&layout->icon_layer);
}
static void... | {
graphics_context_set_fill_color(ctx, layout_get_colors((LayoutLayer *)layout)->primary_color);
const int arrow_offset = ((int[NumPreferredContentSizes]) {
//! @note this is the same as Medium until Small is designed
[PreferredContentSizeSmall] = PBL_IF_ROUND_ELSE(-1, 0),
[PreferredContentSiz... | else {
layout->page_break_height = height;
layout->has_page_break = true;
}
if (size_out) {
*size_out = (GSize) { bounds->size.w, height };
}
}
GTextNodeCustom *timeline_layout_create_page_break_node(const TimelineLayout *layout) {
GTextNodeCustom *page_break_node =
graphics_text_node_create... |
true;
s_flash_state.sleep_when_idle = false;
// Assume that last time we shut down we were asleep. Come back out.
s_flash_state.deep_sleep = true;
flash_deep_sleep_exit();
prv_clear_flag_status_register();
disable_flash_spi_clock();
flash_unlock();
flash_whoami();
PBL_LOG_VERBOSE("Detected SPI F... | power_tracking_stop(PowerSystemFlashErase) | |
_handler(ClickRecognizerRef recognizer, void *context) {
AppWorkerResult result = app_worker_kill();
APP_LOG(APP_LOG_LEVEL_INFO, "kill result: %d", result);
}
static void click_config_provider(void *context) {
window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler);
window_single_click_subscribe(... | GRect(7, 40, 144-7, 168-40) | );
text_layer_set_text_color(text_layer, GColorWhite);
text_layer_set_background_color(text_layer, GColorClear);
text_layer_set_font(text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
layer_add_child(window_layer, text_layer_get_layer(text_layer));
text_layer_set_text(text_layer, "? ? ?");
// Subscr... |
(cur_app_id) | ))) {
PBL_LOG(LOG_LEVEL_DEBUG, "close and delay callbacks for app closing");
s_install_callback_data.callback_paused_for_app = true;
s_pending_app_deletion = cur_app_id;
app_manager_close_current_app(true);
}
// Close the current worker if it is the one we are trying to rem... | |
/*
* 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... | { 1472, 344, -304},
{ 1512, 280, -248},
{ 1480, 248, -296},
{ 1392, 216, -304},
{ 1256, 160, -312},
{ 1152, 80, -376},
{ 992, 48, -392},
{ 968, 0, -424},
{ 1024, -16, -440},
{ 840, -136, -392},
{ 1016, -136, -384},
{ 1000, 0, -256},
{ 864, 88, -264},
{ 1000, 152, ... |
{ 1064, 104, -360},
{ 1304, 96, -368},
{ 1232, 136, -376},
{ 944, 216, -272},
{ 816, 232, -320},
// 5 seconds
{ 928, 280, -224},
{ 1192, 328, -280},
{ 1296, 384, -280},
{ 1264, 400, -328},
{ 1512, 704, -448},
{ 1056, 832, -472},
{ 936, 616, -472},
{ 1032, 608, -4... |
n_page;
}
status_t qspi_flash_get_write_status(QSPIFlash *dev) {
qspi_use(dev->qspi);
uint8_t status_reg;
prv_read_register(dev, dev->state->part->instructions.read_status, &status_reg, 1);
qspi_release(dev->qspi);
return (status_reg & dev->state->part->status_bit_masks.busy) ? E_BUSY : S_SUCCESS;
}
void qs... | (LOG_LEVEL_INFO, "Enabling flash protection") | ;
// Enable write protection
prv_write_cmd_no_addr(dev, dev->state->part->instructions.write_protection_enable);
// Poll busy status until done
qspi_poll_bit(dev->qspi, dev->state->part->instructions.read_status,
dev->state->part->status_bit_masks.busy, false /* !set */, QSPI_NO_TIMEO... |
on_and_connection_for_cccd(
BLEDescriptor cccd_ref,
GAPLEConnection **connection_out) {
BLECharacteristic characteristic_ref =
gatt_client_descriptor_get_characteristic... | prv_check_buffer(client) | ) {
goto unlock;
}
has_notification = prv_get_next_notification_header(client, header_out);
const uint16_t read_space = circular_buffer_get_read_space_remaining(s_circular_buffer[client]);
if (has_notification && header_out) {
// When tackling https://pebbletechnology.atlassian.net/browse/PBL-14151 this... |
{
TimelinePeekMenuIndex_Toggle,
TimelinePeekMenuIndex_Timing,
TimelinePeekMenuIndexCount,
TimelinePeekMenuIndexEnabledCount = TimelinePeekMenuIndexCount,
TimelinePeekMenuIndexDisabledCount = (TimelinePeekMenuIndex_Toggle + 1),
} TimelinePeekMenuIndex;
typedef enum PeekBeforeTimingMenuIndex {
PeekBeforeTi... | ("Timing") | ;
subtitle = s_before_time_strings[
prv_before_time_min_to_index(timeline_peek_prefs_get_before_time())];
break;
case TimelinePeekMenuIndexCount:
break;
}
PBL_ASSERTN(title);
menu_cell_basic_draw(ctx, cell_layer, i18n_get(title, data), i18n_get(subtitle, data), NULL);
}
static vo... |
required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#in... | WINDOW_NAME("Settings") | );
window_set_user_data(window, data);
window_set_window_handlers(window, &(WindowHandlers){
.load = prv_window_load,
.unload = prv_window_unload,
});
window_set_background_color(window, GColorBlack);
app_window_stack_push(window, true);
}
static void handle_deinit(void) {
// Window unload deinits ... |
/normal/bluetooth/ble_hrm.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/string.h"
#include <bluetooth/bluetooth_types.h>
#include <bluetooth/classic_connect.h>
#include <bluetooth/reconnect.h>
#include <bluetooth/sm_types.h>
#include <btutil/bt_device.h>
#include <stdio.h>
#include <string... | memcmp(addr, &active_addr, sizeof(*addr)) | )) {
remote->classic.connected = true;
} else {
remote->classic.connected = false;
}
add_remote(data, remote);
}
static void prv_add_bt_classic_remotes(SettingsBluetoothData *data) {
bt_persistent_storage_for_each_bt_classic_pairing(prv_add_bt_classic_remote, data);
}
static bool dual_remote_filter(... |
vertical_line_dotted(&ctx, GPoint(70, 36), 5);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(66, 36), 10);
// T facing down - lined up
graphics_draw_vertical_line_dotted(&ctx, GPoint(101, 33), 5);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(97, 37), 10);
// T facing left - lined up
graphics_dra... | GPoint(71, 71) | , 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(66, 76), 5);
// T facing left - even vert, odd horiz
graphics_draw_vertical_line_dotted(&ctx, GPoint(100, 70), 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(101, 75), 5);
// T facing left - odd vert, even horiz
graphics_draw_vertical_line_d... |
ize = 183331 }, // priority rank 10
{ .id = 31, .priority = 61, .size = 111155 }, // priority rank 50
{ .id = 32, .priority = 42, .size = 211695 }, // priority rank 30
{ .id = 33, .priority = 49, .size = 35653 }, // priority rank 38
{ .id = 34, .priority = 57, .size = 11541 }, // priority rank 44
{ .id = 35... | (before_size >= to_free) | ;
cl_assert_equal_i(E_INVALID_ARGUMENT, app_cache_free_up_space(to_free));
fake_system_task_callbacks_invoke_pending();
after_size = app_cache_get_size();
cl_assert_equal_i(after_size, before_size);
// test removing all and more bytes
prv_cleanup();
to_free = SIZE_SUM + 1;
before_size = app_cache_get_s... |
uint16_t read_length) {
PBL_ASSERT_TASK(PebbleTask_KernelBackground);
PebbleEvent event = {
.type = PEBBLE_SMARTSTRAP_EVENT,
.smartstrap = {
.type = type,
.profile = profile,
.result = result,
.read_length = read_length,
},
};
mutex_lock(s_attr_list_lock);
SmartstrapAttribu... | system_task_add_callback(prv_do_deferred_delete_cb, NULL) | |
d_line_odd_offset_even_rows_no_clip")));
// Odd rows of different lengths
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 1), MAX_NUM_COLS);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 3), MAX_NUM_COLS + 4);
graphics_draw_h... | graphics_draw_vertical_line_dotted(&ctx, GPoint(1, 0), MAX_NUM_ROWS) | |
{
if (cell_index->section == SectionControl) {
toggle_scan();
return;
}
// Connect
ScanResult *result = list_get_by_index(cell_index->row);
BTErrno e = ble_central_connect(result->device,
true /* auto_reconnect */,
false /* is_pairi... |
static void menu_select_long_callback(MenuLayer *menu_layer, MenuIndex *cell_index,
void *data) {
if (cell_index->section == SectionControl) {
return;
}
// Disconnect
ScanResult *result = list_get_by_index(cell_index->row);
BTErrno e = ble_central_cancel_connect(result... | |
UETTE_ICON_WIDTH (16)
#define BATTERY_SILHOUETTE_ICON_HEIGHT (9)
typedef struct LauncherAppGlanceSettingsState {
BatteryChargeState battery_charge_state;
bool is_pebble_app_connected;
bool is_airplane_mode_enabled;
bool is_quiet_time_enabled;
#if CAPABILITY_HAS_BUILTIN_HRM
bool is_sharing_hrm;
#endif
} Launc... | PBL_IF_COLOR_ELSE(gcolor_legible_over(battery_silhouette_color), GColorWhite) | ;
graphics_context_set_fill_color(ctx, battery_silhouette_color);
// Draw the battery silhouette
const GRect battery_silhouette_frame = (GRect) {
.origin = rect->origin,
.size = battery_silhouette_icon_size,
};
gpath_draw_filled(ctx, &battery_silhouette_path);
// Inset the filled ... |
action_bar_layer_set_background_color(action_bar,
expandable_dialog->action_bar_background_color) | ;
}
if (expandable_dialog->select_icon) {
action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_SELECT,
expandable_dialog->select_icon, expandable_dialog->show_action_icon_animated);
}
action_bar_layer_set_context(action_bar, expandable_dialog);
action_bar_layer_set_click_config_p... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (mfg_is_mfg_mode()) {
return mfg_menu_app_get_info();
} |
return recovery_first_use_app_get_app_info();
}
void system_app_state_machine_register_app_launch(AppInstallId app_id) {
}
void system_app_state_machine_panic(void) {
if (app_manager_is_first_app_launched()) {
app_manager_launch_new_app(&(AppLaunchConfig) {
.md = panic_app_get_app_info(),
});
}
... |
{
ActionMenuLevel *root_level = action_menu_get_root_level(action_menu);
action_menu_hierarchy_destroy(root_level, NULL, NULL);
} |
static void prv_noop_action_callback(ActionMenu *action_menu, const ActionMenuItem *action,
void *context) {
// Do nothing
}
// From action_menu_layer.c, needed to scroll the action menu layer to the point of interest
void prv_set_selected_index(ActionMenuLayer *aml, int select... | |
ta = prv_get_data_for_app_with_id(res_app_num);
if (!data) {
return RESOURCE_ID_INVALID;
}
// The app must have a valid LUT
if (!data->resource_lut) {
return RESOURCE_ID_INVALID;
}
return data->resource_lut[timeline_id][size];
}
static bool s_is_app_published_resource_invalid;
bool prv_is_app_pu... | (res_info.res_app_num, SYSTEM_APP) | ;
cl_assert_equal_i(res_info.res_id, RESOURCE_ID_AUDIO_CASSETTE_SMALL);
}
void test_timeline_resources__get_id(void) {
TimelineResourceInfo timeline_res_info;
AppResourceInfo res_info;
const TimelineResourceTestAppData *valid_app_data =
prv_get_data_for_app_with_id(TimelineResourceTestAppId_ValidApp);
... |
se);
s_test_transcription_example[8] = 'e'; // restore word
s_test_transcription_example[11] = '\0'; // insert null terminator at the end of a word
result = transcription_validate(validate_test, test_size);
cl_assert_equal_p(result, false);
s_test_transcription_example[9] = '\xe2'; // insert valid utf8... | (result, end) | ;
}
|
/*
* 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->window) | ;
GRect bounds = window_layer->bounds;
data->text_layer = text_layer_create((GRect)
{ .origin = { 0, 40 }, .size = { bounds.size.w, 100 } });
prv_populate_amb_read_str(&data->ambient_reading[0]);
text_layer_set_font(data->text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
text_layer_set_tex... |
gacy2.h"
#include "applib/app_logging.h"
#include "applib/applib_malloc.auto.h"
#include "process_state/app_state/app_state.h"
#include "kernel/kernel_applib_state.h"
#include "kernel/memory_layout.h"
#include "services/common/animation_service.h"
#include "system/passert.h"
#include "util/math.h"
#include <strin... | if (!node) {
return NULL;
} |
return (AnimationPrivate *)node;
}
// -------------------------------------------------------------------------------------------
// Remove from being iterated after unscheduling. This must be called on any animation being
// unscheduled.
static void prv_iter_remove(AnimationState *state, AnimationPrivate *animatio... |
ndow pushed onto the app stack has remained focused
event = fake_event_get_last();
cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT);
cl_assert_equal_i(event.app_focus.in_focus, true);
cl_assert_equal_i(window1->on_screen, true);
window_stack_remove(window1, true);
cl_assert_equal_i(wind... | for (ModalPriority idx = ModalPriorityDiscreet + 1; idx < NumModalPriorities; idx++) {
cl_assert_equal_b(windows[idx]->on_screen, false);
} |
}
// Edge Case Tests
////////////////////////////////////
// Description:
// During the load handler of a window, we pop it.
void test_window_stack__pop_during_window_load(void) {
Window *window = window_create();
window_set_window_handlers(window, &(WindowHandlers){
.load = prv_pop_window_load,
.unload... |
_connection_delay_timer)) {
regular_timer_remove_callback(&s_notification_connection_delay_timer);
}
s_just_connected = true;
const int post_connection_notification_ignore_seconds = 10;
s_notification_connection_delay_timer = (const RegularTimerInfo) {
.cb = prv_set_no_longer_just_connected,
};
reg... | if (!is_success) {
PBL_LOG(LOG_LEVEL_ERROR, "ANCS reassembly buffer overflow; resetting ctx");
// TODO: separate analytics trackers instead of piling onto "parse error count"
prv_reset_due_to_parse_error();
return;
} |
}
const uint8_t *response_data = s_ancs_client->reassembly_ctx.buffer.data;
int response_length = s_ancs_client->reassembly_ctx.buffer.bytes_written;
// Is the response complete? Or do we need to wait for more DS notifications?
bool parse_error = false;
const bool is_complete = prv_reassembly_is_complet... |
ep_test_timer, 31, prv_sleep_timer_test_cb, (void *)(uintptr_t)count, 0);
}
}
// Attempts to check that the Dialog chip sleep mode is working correctly by forcing wakeups at
// different times. (See PBL-39777). The timeouts delays may seem a little random but I found with
// this combo of values I was able to hit th... | memset(fb->buffer, 0xff, FRAMEBUFFER_SIZE_BYTES) | ;
graphics_context_init(ctx, fb, GContextInitializationMode_App);
return ctx;
}
void watchdog_feed(void);
void command_perftest_line(const char *do_aa, const char *width) {
watchdog_feed();
GContext *ctx = prv_perftest_get_context();
GColor color = { .argb = (uint8_t)0x33 };
graphics_context_set_stroke_c... |
flows since time_t might be signed and now ~1.4 billion, so 2*now > INT_MAX
time_t midtime = timestamp / 2 + end_time / 2;
if (midtime > now) { // future
time_t difference = timestamp - now;
if (timestamp < now || difference < SECONDS_PER_MINUTE) {
i18n_get_with_buffer("Now", word_buffer, word_buffer_... | (buffer, 80, "Time is now <%s>", rtc_get_time_string(time_buffer)) | ;
}
void clock_get_timezone_region(char* region_name, const size_t buffer_size) {
if (!region_name) {
return;
}
if (clock_is_timezone_set()) {
int region_id = clock_get_timezone_region_id();
if (region_id != UNKNOWN_TIMEZONE_ID) {
timezone_database_load_region_name(region_id, region_name);
... |
L_LOG(LOG_LEVEL_INFO, "Starting app-initiated voice dictation session for app %s", uuid_str);
}
#if !defined(TARGET_QEMU)
// TODO: replace stub
#endif
// TODO: replace fake values
AudioTransferInfoSpeex transfer_info = (AudioTransferInfoSpeex) {
.sample_rate = 0,
.bit_rate = 0,
.frame_size = 0,
... | (LOG_LEVEL_WARNING, "Received session setup result for non-app session when an app "
"session result was expected") | |
/*
* 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 (md->codepoint_bytes == 2) {
return offset_16 ? sizeof(OffsetTableEntry_2_2) : sizeof(OffsetTableEntry_2_4);
} else {
return offset_16 ? sizeof(OffsetTableEntry_4_2) : sizeof(OffsetTableEntry_4_4);
} |
}
static int prv_offset_table_get_id(const FontMetaData *md, Codepoint codepoint) {
if (FONT_VERSION(md->version) == FONT_VERSION_1) {
return (1);
} else {
return prv_font_hash(codepoint, md->hash_table_size);
}
}
static int prv_load_offset_table(Codepoint codepoint, FontCache *font_cache,
... |
teps, &duration_s, &distance_m,
&bpm, &hr_zone));
cl_assert_equal_i(steps, 10);
// Increment a lot so we can make sure that the wrap around of midnight works.
prv_inc_steps_and_put_event(1000);
cl_assert(workout_service_get_current_workout_info(&steps, &dura... | (2 * SECONDS_PER_MINUTE) | ;
workout_service_frontend_closed();
cl_assert_equal_b(s_hrm_subscribed, true);
cl_assert_equal_i(s_hrm_expiration, 8 * SECONDS_PER_MINUTE);
}
// ---------------------------------------------------------------------------------------
// Open the app, start a workout, 120s, stop the workout, 20 min, close app.
/... |
ded(uint16_t conn_idx) {
if (!ppogatt_emulated_server_wa_enabled(conn_idx)) {
return;
}
uint32_t payload_size = sizeof(BTDeviceInternal) + sizeof(s_emulated_ppogatt_gatt_service);
HcProtocolDiscoveryServiceFoundPayload *payload = kernel_zalloc_check(payload_size);
Connection *connection = connection_by_... | (&ctx->svc.start_h,
&ctx->att_hdl.data,
&ctx->att_hdl.cccd,
&ctx->att_hdl.meta,
&ctx->att_hdl.data_wr,
NULL) | == BLE_STATUS_OK);
ctx->svc.end_h = ctx->svc.start_h + num_attr;
PBL_ASSERTN(ctx->svc.start_h == start_hdl);
}
|
/*
* 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_receive_pp_data(msg, sizeof(msg)) | ;
PebbleEvent e = fake_event_get_last();
if (expect_is_handled) {
cl_assert_equal_i(e.type, PEBBLE_MEDIA_EVENT);
cl_assert_equal_i(e.media.type, PebbleMediaEventTypeTrackPosChanged);
char artist[MUSIC_BUFFER_LENGTH];
char album[MUSIC_BUFFER_LENGTH];
char title[MUSIC_BUFFER_LENGTH];
music_... |
Y);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 5);
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw5_c... | (&ctx.dest_bitmap, "draw_rect_offset_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi") | |
/*
* 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(prefs_db_insert((uint8_t *)bad_key, bad_key_len, (uint8_t *)&set_value,
sizeof(set_value)) < 0) | ;
cl_assert(prefs_db_get_len((uint8_t *)bad_key, bad_key_len) < 0);
cl_assert(prefs_db_read((uint8_t *)bad_key, bad_key_len, (uint8_t *)&get_value,
sizeof(get_value)) < 0);
// Try and insert the wrong size for a known key, it should fail
cl_assert(prefs_db_insert((uint8_t *)k... |
4; // dismiss, open app, open pin, response
int num_actions = 0;
int action_id = 0;
TimelineItemAction actions[max_num_actions];
actions[num_actions++] = (TimelineItemAction) {
.id = action_id++,
.type = TimelineItemActionTypeDismiss,
.attr_list = dismiss_action_attr_list,
};
if (config->open_p... | ("Good job! You walked %d steps today–do it again tomorrow.") | ,
i18n_noop("Someone's on the move 👊 You walked %d steps today; "
"keep doing what you're doing!"),
i18n_noop("You keep moving, we'll keep counting! You've clocked in %d steps today. "
"Keep it rolling, hot stuff."),
},
},
[PercentTier_BelowAverage] = {... |
scription_error_response(void) {
prv_notify_services_discovered(1);
ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta],
(const uint8_t *) &s_meta_v0_system,
sizeof(s_meta_v0_system),
... | (s_characteristics[0][PPoGATTCharacteristicData], 0) | ;
// The retransmitted ACK should be ignored.
fake_gatt_client_op_assert_no_write();
// Session shouldn't get closed:
cl_assert_equal_i(fake_comm_session_close_call_count(), 0);
}
void test_ppogatt__ignore_server_reset_request_while_resetting_due_to_server_reset_request(void) {
test_ppogatt__open_session_w... |
"services/normal/app_cache.h"
#include "services/normal/blob_db/app_db.h"
#include "util/build_id.h"
#include "util/time/time.h"
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "fixtures/load_test_resources.h"
// Stub Includes
////////////////////////////////////
#include "stubs_analytics.h... | app_install_get_entry_for_install_id(id, &entry) | ;
if (!exists) {
return false;
}
return app_install_entry_has_worker(&entry);
}
bool app_install_is_hidden(AppInstallId id) {
AppInstallEntry entry;
bool exists = app_install_get_entry_for_install_id(id, &entry);
if (!exists) {
return false;
}
return app_install_entry_is_hidden(&entry);
}
bool... |
&set_value);
property_animation_get_to_gpoint(prop_h, &test_value);
cl_assert_equal_point(test_value, set_value);
// Destroy it
animation_destroy(h);
#endif
}
// --------------------------------------------------------------------------------------
// Test a basic gtransform property animation
void test_ani... | prv_clear_handler_histories() | ;
uint64_t start_ms = prv_now_ms();
animation_schedule(h);
// Test the accessor functions
Fixed_S32_16 test_value;
property_animation_get_from_fixed_s32_16(prop_h, &test_value);
cl_assert_equal_fixed_s32_16(test_value, start_value);
property_animation_get_to_fixed_s32_16(prop_h, &test_value);
cl_ass... |
ams.box.size.h;
cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params));
cl_assert(line.height_px == 10);
cl_assert(line.width_px == 2 * HORIZ_ADVANCE_PX);
cl_assert(iter_next(&word_iter));
cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params));
c... | cl_assert(line.height_px == 10) | ;
cl_assert(line.width_px == HORIZ_ADVANCE_PX * 4);
cl_assert(line.origin.x == 0);
cl_assert(line.suffix_codepoint == '-');
cl_assert(*line.start == 'a');
// mal-
cl_assert(*word_iter_state.current.start == 'm');
cl_assert(*word_iter_state.current.end == '\0');
cl_assert(word_iter_state.current.width_p... |
ude "weather_app_warning_dialog.h"
#include "applib/app.h"
#include "applib/event_service_client.h"
#include "applib/ui/click.h"
#include "applib/ui/content_indicator.h"
#include "applib/ui/ui.h"
#include "kernel/events.h"
#include "kernel/pbl_malloc.h"
#include "process_management/pebble_process_md.h"
#include "proce... | layer_add_child(&window->layer, &data->layout.root_layer) | ;
}
static void prv_main_window_disappear(Window *window) {
WeatherAppData *data = app_state_get_user_data();
event_service_client_unsubscribe(&data->weather_event_info);
}
static void prv_up_down_click_handler(ClickRecognizerRef recognizer, void *context) {
WeatherAppData *data = app_state_get_user_data();
c... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
layer_set_frame(layer, &to);
} |
}
|
r);
graphics_context_set_fill_color(ctx, bg_color);
const uint8_t radius = 3;
const uint8_t margin = 1;
graphics_fill_round_rect(ctx, &action_bar->layer.bounds, radius,
GCornerTopLeft | GCornerBottomLeft);
GRect rect = action_bar->layer.bounds;
rect.origin.x += margin;
rect.orig... | action_bar_legacy2_raw_up_down_handler(recognizer, action_bar, true) | ;
}
static void action_bar_legacy2_click_config_provider(ActionBarLayerLegacy2 *action_bar) {
void *context = action_bar_legacy2_get_context(action_bar);
// For UP, SELECT and DOWN, setup the raw handler and assign the user specified context:
for (ButtonId button_id = BUTTON_ID_UP; button_id < NUM_BUTTONS; ++but... |
ection_index,
void *callback_context) {
return ARRAY_LENGTH(prv_row_texts);
}
static void prv_draw_row(GContext* ctx, const Layer *cell_layer, char const *title,
int16_t offset) {
// mostly copied from menu_cell_basic_draw_with_value
// (that unfortunately doesn't respect bounds.origin.x)
const int16_t... | layer_add_child(&window->layer, menu_layer_get_layer(&data->action_list1)) | ;
menu_layer_init(&data->action_list2, &menu_layer_rect);
menu_layer_set_callbacks(&data->action_list2, NULL, &(MenuLayerCallbacks){
.get_num_rows = prv_get_num_rows,
.draw_row = prv_draw_row_2,
.get_separator_height = prv_get_separator_height,
});
scroll_layer_set_shadow_hidden(&data->action... |
on *session, const uint8_t *data, size_t length) {
s_handler_call_count[HandlerB]++;
prv_assert_data_matches_expected(data, length);
}
static void prv_endpoint_handler_c(
CommSession *session, const uint8_t *data, size_t length) {
s_handler_call_count[HandlerC]++;
prv_assert_data_matches_expected(data, len... | prv_assert_no_handler_calls() | ;
char expected_data = 'a';
for (int i = 0; i < batch_num; i++) {
prv_set_expected_data(&expected_data, 1);
fake_system_task_callbacks_invoke(1);
cl_assert_equal_i(s_handler_call_count[HandlerA], i + 1);
expected_data += 1;
}
cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0);
}
//! Make ... |
uint32_t QSPIC_UCODE_START;
// GPREG
uint16_t PLL_SYS_CTRL1_REG;
uint16_t PLL_SYS_CTRL2_REG;
uint16_t PLL_SYS_CTRL3_REG;
uint16_t PLL_SYS_TEST_REG;
// CACHE
uint32_t CACHE_CTRL1_REG;
uint32_t CACHE_LNSIZECFG_REG;
uint32_t CACHE_ASSOCCFG_REG;
uint32_t CACHE_CTRL2_REG;
uint32_t CACHE_CT... | (DCDC, DCDC_V18_1_REG, DCDC_V18_ENABLE_HV, 0x1) | |
PBL_ASSERTN((duty_cycle_low <= TIMINGR_MASK_SCLL) &&
(duty_cycle_high <= TIMINGR_MASK_SCLH) &&
(prescaler <= TIMINGR_MASK_PRESC)) | ;
periph_config_enable(bus->hal->i2c, bus->hal->clock_ctrl);
// We currently don't need to worry about the other TIMINGR fields (they come out to 0), but might
// need to revisit this if we ever need FM+ speeds.
TIMINGR timingr = {
.PRESC = prescaler,
.SCLH = duty_cycle_high - 1, // Duty cycle high is... | |
/*
* 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_last_driver_addr, 0x00, sizeof(s_last_driver_addr)) | ;
}
return cl_mock_type(void);
}
BTDeviceAddress s_last_bt_persist_pinned_addr;
bool s_last_bt_persist_pinned_addr_is_null;
bool bt_persistent_storage_get_ble_pinned_address(BTDeviceAddress *address_out) {
if (s_last_bt_persist_pinned_addr_is_null) {
return false;
}
if (address_out) {
*address_out =... |
units
i18n_ctx_noop("TmplStringPlur", " hr")},
/// Singular suffix for hours with full units
{ i18n_ctx_noop("TmplStringSing", " hour"),
/// Plural suffix for hours with full units
i18n_ctx_noop("TmplStringPlur", " hours")},
};
static const char * const s_day_strings[3][2] = {
/// Singular suffix for d... | {
prv_append_char(state, '-');
value = -value;
} | |
a(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_same_point_origin_layer_aa.${BIT_DEPTH_NAME}.pbi"));
#endif
}
void test_graphics_draw_stroke_precise_${BIT_DEPTH_NAME}__origin_layer_non_aa(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb... | graphics_line_draw_precise_stroked_non_aa(&ctx, START_ON_ORIGIN_RECT_NXNY, END_ON_ORIGIN_RECT_NXNY, 10) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_offset_layer_non_aa.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 10);
graphics_line_draw_precise_stroked_non_aa(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10);
cl_check(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... | (LOG_LEVEL_DEBUG, "STT: Entering infinite loop in timer callback") | |
nt32_t new_connectivity_icon_id = RESOURCE_ID_INVALID;
if (bt_ctl_is_airplane_mode_on()) {
new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_AIRPLANE_MODE;
} else if (do_not_disturb_is_active()) {
new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_DND;
} else if (!prv_is_pebble_app_... | layer_add_child(&window->layer, kino_layer_get_layer(&data->connectivity_icon)) | |
NVIC_SetPriority(dev->irq_channel, dev->irq_priority) | ;
NVIC_EnableIRQ(dev->irq_channel);
} else {
// disable the interrupt
NVIC_DisableIRQ(dev->irq_channel);
}
}
void uart_set_rx_interrupt_handler(UARTDevice *dev, UARTRXInterruptHandler irq_handler) {
PBL_ASSERTN(dev->state->initialized);
dev->state->rx_irq_handler = irq_handler;
}
void uart_set_tx_... | |
t));
cl_assert(has_next);
cl_assert_equal_i(new_idx, 4);
cl_assert_equal_i(timeline_model_get_num_items(), 2);
cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id,
&timeline_model_get_iter_state(-1)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id,
&timeline_mo... | 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_model_get_iter_state(1) == timeline_model_get_iter_state_w... |
m temp = {{{0}}};
cl_assert(S_SUCCESS == reminder_db_read((uint8_t*)&item1.header.id, sizeof(Uuid), (uint8_t*)&temp,
sizeof(CommonTimelineItemHeader)));
// Note: we set things to null because it makes it easier to compare two
// TimelineItems with memcmp
// check item 1
memset(&temp, 0, sizeof(Timeline... | reminder_db_delete_with_parent(parent_id) | , S_SUCCESS);
// confirm the two are gone
cl_assert(reminder_db_get_len((uint8_t *)&item1.header.id, sizeof(Uuid)) == 0);
cl_assert(reminder_db_get_len((uint8_t *)&item2.header.id, sizeof(Uuid)) == 0);
// confirm the others are still here
cl_assert(reminder_db_get_len((uint8_t*)&item3.header.id, sizeof(Uuid))... |
on()) {
data->error_count++;
if (data->error_count < MAX_ERROR_COUNT) {
prv_set_mic_window_state(data, StateError);
prv_push_bt_dialog(data);
} else {
prv_push_final_error_dialog(data);
data->error_exit_status = DictationSessionStatusFailureConnectivityErr... | app_timer_cancel(data->dictation_timeout) | ;
prv_set_mic_window_state(data, StateFinished);
}
}
// Microphone Window
///////////////////////////////////////////////////////////////////////////
#if (0) // https://pebbletechnology.atlassian.net/browse/PBL-20406
static void prv_short_vibe(void) {
static const uint32_t VIBE_DURATIONS[] = { 50 };
VibePat... |
ULL,
};
void test_rocky_api_datetime__jerry_script_default(void) {
static const RockyGlobalAPI *apis[] = {NULL};
rocky_global_init(apis);
EXECUTE_SCRIPT(
"var d = new Date();\n"
"var s1 = d.toString();\n"
"var f = typeof(d.toLocaleTimeString);\n"
"var s2 = d.toLocaleTimeString();\n"
"var s3 =... | ("s", "8 PM") | |
/*
* 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_i(attr1->length, 0x2F) | ;
size_t offset = sizeof(GenericAttributeList) + sizeof(GenericAttribute);
cl_assert_equal_p(attr1->data, &data1[offset]);
GenericAttribute *attr2 = generic_attribute_find_attribute(attr_list1, VEAttributeIdAppUuid,
sizeof(data1));
cl_assert(attr2);
... |
;
s_test_impl_data.last_touch_event = &last_touch_event;
s_test_impl_data.new_state = &new_state;
s_test_impl_data.updated = &updated;
NEW_RECOGNIZER(r) = test_recognizer_create(&s_test_impl_data, &rec_event);
new_state = RecognizerState_Possible;
recognizer_handle_touch_event(r, &(TouchEvent) { .type = To... | cl_assert_equal_i(r->state, new_state) | |
e.pin.header.id, &s_all_day_items[1].header.id) ||
uuid_equal(&state.pin.header.id, &s_all_day_items[2].header.id));
cl_assert(state.node->all_day);
// check that the item we see is timestamped at local midnight rather than utc midnight
// 1421136000 is midnight Jan 13, PST
cl_assert_equal_i(state.pin.heade... | (&state.pin.header.id, &s_all_day_items[0].header.id) | );
cl_assert(state.node->all_day);
cl_assert(!iter_next(&iterator));
cl_assert(iter_prev(&iterator));
cl_assert(!iter_prev(&iterator));
}
void test_timeline__all_day_middle_past(void) {
prv_insert_all_day_items();
// 1421183640 is 13:14 on Jan 13, 2015
// after first timed event of the day but not all ... |
enable_interaction();
} else {
// Chances are the Pebble of our dear customer has been charging away
// from the phone and is disconnected because of that. Try reconnecting
// immediately upon disconnecting the charger:
bt_driver_reconnect_reset_interval();
bt_driver_reconn... | wakeup_handle_clock_change() | ;
cron_service_handle_clock_change(set_time_info);
}
// TODO: evaluate if these need to change on every time update
do_not_disturb_handle_clock_change();
reminders_update_timer();
#endif
return;
}
case PEBBLE_BLE_SCAN_EVENT:
case PEBBLE_BLE_CONNECTION_EVENT:
case P... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prv_handle_fault() | ;
}
void BusFault_HandlerC(uint32_t *fault_args) {
debug_print_str("Bus fault");
prv_handle_fault();
}
void MemManag_HandlerC(uint32_t *fault_args) {
debug_print_str("MemManag fault");
prv_handle_fault();
}
void NMI_HandlerC(uint32_t *fault_args) {
debug_print_str("NMI Handler");
prv_handle_fault();
}
|
pp_window_stack_pop_all(true);
}
static void prv_no_music_window_click_config(void *context) {
window_single_click_subscribe(BUTTON_ID_BACK, prv_handle_no_music_back);
}
static MusicNoMusicWindow *prv_create_no_music_window(void) {
MusicNoMusicWindow *window = app_malloc_check(sizeof(MusicNoMusicWindow));
windo... | snprintf(buffer, n, "%"PRIu32":%02"PRIu32, minutes, seconds) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | animation_set_duration(animation, interpolate_moook_duration()) | ;
}
static void prv_transition_from_launcher_animation_init(Animation *animation) {
prv_configure_transition_animation(animation, CompositorTransitionDirectionRight);
}
static void prv_transition_to_launcher_animation_init(Animation *animation) {
prv_configure_transition_animation(animation, CompositorTransitionD... |
TRANSFER_STATE_WRITE_ADDRESS_RX:
// Write the I2C device address again, but this time in read mode.
bus->i2c->DR = bus->transfer.device_address | I2C_READ_WRITE_BIT;
if (bus->transfer.size == 1) {
// Last byte, we want to NACK this one to tell the slave to stop sending us bytes.
bus->... | portEND_SWITCHING_ISR(irq_event_handler(&i2c_buses[0])) | ;
}
void I2C1_ER_IRQHandler(void) {
portEND_SWITCHING_ISR(irq_error_handler(&i2c_buses[0]));
}
void I2C2_EV_IRQHandler(void) {
portEND_SWITCHING_ISR(irq_event_handler(&i2c_buses[1]));
}
void I2C2_ER_IRQHandler(void) {
portEND_SWITCHING_ISR(irq_error_handler(&i2c_buses[1]));
}
/*------------------------COMMAND... |
mTypePin,
.all_day = false,
.layout = LayoutIdCalendar,
},
.attr_list = {
.num_attributes = 1,
.attributes = &title_attr,
},
};
static TimelineItem item2 = {
.header = {
.id = {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
.t... | (timer_id) | );
}
void test_calendar__init_with_ongoing_event(void) {
cl_assert(timeline_add(&item1));
timeline_event_handle_blobdb_event();
rtc_set_time(15 * 60);
timeline_event_init();
cl_assert_equal_i(fake_event_get_count(), 1);
cl_assert(prv_get_calendar_ongoing());
TimerID timer_id = stub_new_timer_get_next();... |
for (int sector = first_sector; sector <= last_sector; ++sector) {
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |
FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR);
if (FLASH_EraseSector(s_sectors[sector], VoltageRange_1) != FLASH_COMPLETE) {
dbgserial... |
FLASH_Lock();
return true;
}
bool system_flash_write(uint32_t address, const void *data, size_t length) {
// enable programming of flash
FLASH_Unlock();
// clear errors
FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |
FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_F... | |
ude "process_management/pebble_process_md.h"
#include "resource/resource_storage.h"
#include "resource/resource_storage_file.h"
#include "services/common/light.h"
#include "services/normal/notifications/do_not_disturb.h"
#include "services/normal/notifications/alerts_private.h"
#include "services/normal/persist.h"
#inc... | {
return AlertMaskAllOff;
} | |
ude "applib/graphics/graphics.h"
#include "applib/fonts/fonts.h"
#include "kernel/pbl_malloc.h"
#include "system/logging.h"
#include "system/passert.h"
#include <string.h>
#include <stddef.h>
static GTextLayoutCacheRef prv_text_layer_legacy2_get_cache_handle(TextLayerLegacy2 *text_layer) {
if (text_layer == NULL) {... | (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_layer->layer));
}
void text_layer_legacy2_set_text_alignment(TextLayerLegacy2 *text_layer,
GTextAlignment text_alignment) ... |
00];
snprintf(filename, sizeof(filename),
"draw_arc_offset_aa_end_angle_%s.${BIT_DEPTH_NAME}.pbi", test_angles[i].filename_part);
cl_check_(gbitmap_pbi_eq(&ctx.dest_bitmap, filename), filename);
}
for (int i = 0; i < ARRAY_LENGTH(test_angles); i++) {
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_... | (filename, sizeof(filename),
"draw_arc_origin_aa_precise_%s_%s_.${BIT_DEPTH_NAME}.pbi", precision_modes[precision_mode], mode_names[mode]) | ;
cl_check_(gbitmap_pbi_eq(&ctx.dest_bitmap, filename), filename);
center.y.integer -= DRAWING_SPACING;
angle_end += TRIG_MAX_ANGLE / 4;
}
center.x.fraction = 4;
center.y.fraction = 4;
radius.fraction = 4;
angle_start = TRIG_MAX_ANGLE / 8;
angle_end = angle_start + (TRIG_MAX_... |
BAR_WIDTH, 0),
window_bounds.size.h);
Animation *action_bar_animation = property_animation_get_animation(
property_animation_create_layer_frame(&s_phone_ui_data->action_bar.layer, NULL, &offscreen));
animation_set_duration(action_bar_animation, ACTION_BAR_DISAPPEAR_ANIMATION_FRAMES
... | attribute_list_add_cstring(&attributes, AttributeIdSender, number) | ;
attribute_list_add_cstring(&attributes, AttributeIdiOSAppIdentifier, app_id);
TimelineItem *item = timeline_item_create_with_attributes(0, 0, TimelineItemTypeNotification,
LayoutIdUnknown,
&att... |
window_single_click_subscribe(BUTTON_ID_BACK, back_handler);
window_single_click_subscribe(BUTTON_ID_UP, up_handler);
window_single_click_subscribe(BUTTON_ID_SELECT, select_handler);
window_single_click_subscribe(BUTTON_ID_DOWN, down_handler);
}
static void prv_move_shape(AppData *data) {
for (uint8_t shape... | {
// Move the line X per Y
data->circle_origin.x += (data->circle_velocity_x * PIXEL_SPEED_PER_FRAME);
if (data->circle_origin.x - data->circle_radius < 0 ||
data->circle_origin.x + data->circle_radius > data->window.layer.bounds.size.w) {
data->circle_velocity_x = data->circle_velo... | else if (shape == GPATH_TRIANGLE) {
// Move the line 3*X per Y
data->triangle_offset.x += (data->triangle_velocity_x * PIXEL_SPEED_PER_FRAME * 3);
if (data->triangle_offset.x < 0 ||
data->triangle_offset.x > data->window.layer.bounds.size.w) {
data->triangle_velocity_x = data->trian... |
// won't get here, rest gets optimized out
#endif
#ifdef RECOVERY_FW
boot_bit_clear(BOOT_BIT_RECOVERY_START_IN_PROGRESS);
#endif
extern uint32_t __kernel_main_stack_start__[];
extern uint32_t __kernel_main_stack_size__[];
extern uint32_t __stack_guard_size__[];
const uint32_t kernel_main_stack_words = ( (u... | {
PBL_ASSERT(s_sjlj_num == 0, "SJLJ TRACK INCORRECT @ FIRST");
s_sjlj_num++;
prv_sjlj_second(r);
PBL_ASSERT(1, "SJLJ IS BROKEN (longjmp didn't occur)");
} |
static void prv_sjlj_main(int r) {
PBL_ASSERT(s_sjlj_num == 2, "SJLJ TRACK INCORRECT @ MAIN");
s_sjlj_num++;
PBL_ASSERT(r == 1, "SETJMP IS BROKEN (longjmp value wasn't correct)");
}
static void prv_test_sjlj(void) {
int r;
s_sjlj_num = 0;
if (!(r = setjmp(s_sjlj_jmpbuf)))
prv_sjlj_first(r);
else
... |
g FIFO to 1 deep for peek");
accel_set_num_samples(1);
s_accel_samples_per_update = 1;
// Set a timer to restore settings after a while
prv_set_restore_fifo_mode_timer();
int max_loops = 12;
result = -3;
while (max_loops--) {
accel_data->timestamp = accel_get_latest_t... | if (state->num_samples >= state->samples_per_update) {
prv_call_data_callback(state);
ACCEL_LOG_DEBUG("full set of %d samples for session %d", state->num_samples,
(int)state->session_ref);
} |
state = (AccelSubscriberState *)state->list_node.next;
}
}
mutex_unlock_recursive(s_mutex);
}
// ---------------------------------------------------------------------------------------------
DEFINE_SYSCALL(uint32_t, sys_accel_manager_get_num_samples, AccelSessionRef session,
uint64_t *ti... |
sert_equal_i(event.type, PEBBLE_TOUCH_EVENT);
cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable);
touch_event = touch_event_queue_get_event(1, 0);
prv_test_touch_event(touch_event, 1, TouchEvent_Liftoff, &GPointZero, 0, 0, &GPoint(1, 13),
3686401, 0, true);
}
void test_... | GPoint(13, 13) | , 6, 3686420);
touch_event = touch_event_queue_get_event(0, 1);
prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0,
&GPoint(13, 13), 40, 6, true);
touch_handle_update(0, TouchState_FingerUp, &GPoint(18, 5), 0, 3686440);
// Test the same event (event a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.