prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
.filename_part = "quad_top_right",
.mask = GCornerTopRight,
},
{
.filename_part = "quad_bottom_right",
.mask = GCornerBottomRight,
},
{
.filename_part = "quad_bottom_left",
.mask = GCornerBottomLeft,
},
{
.filename_part = "q... | (&ctx.dest_bitmap, "draw_circle_r0_aa_swX_black.${BIT_DEPTH_NAME}.pbi") | );
}
void test_graphics_draw_circle_8bit__zero_swX_color(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// Draw red circles with different alpha values in the stroke color with antialiasing disabled
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 0);
graphics_contex... |
/*
* 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... | {
PebbleEvent event = fake_event_get_last();
cl_assert_equal_i(event.type, PEBBLE_BLE_GATT_CLIENT_EVENT);
cl_assert_equal_i(event.bluetooth.le.gatt_client_service.subtype,
PebbleBLEGATTClientEventTypeServiceChange);
cl_assert_equal_i(event.bluetooth.le.gatt_client_service.info->status,
... |
static void prv_simulate_and_assert_discovery_of_one_service(const BTDeviceInternal *device) {
// Simulate discovery of Blood Pressure service:
fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_CONNECTION_ID);
fake_gatt_put_discovery_complete_event(GATT_SERVICE_DISCOVERY_STATUS_SUCCESS,
... |
uld have moved to the next page
cl_assert_equal_b(shared_prf_storage_get_valid_page_number(), 1);
// Let's do it again, but move the valid page to index NUM_PAGES - 1 so we force a wrap around
fake_spi_flash_erase();
shared_prf_storage_set_valid_page_number(SPRF_NUM_PAGES - 1);
shared_prf_storage_set_getting... | shared_prf_storage_get_ble_pairing_data(&pairing_info_out, device_name_out, NULL,
NULL) | ;
cl_assert_equal_b(rv, false);
shared_prf_storage_store_ble_pairing_data(&PAIRING_INFO, DEVICE_NAME,
true /* requires_address_pinning */,
true /* auto_accept_re_pairing */);
// It should detect the fields were already blank ... |
or the LE connection that supports PPoGATT:
GAPLEConnection *connection = gap_le_connection_by_device(gateway_device);
// It's possible the connection is gone in the mean time; this runs on KernelMain.
if (connection) {
bonding_id = connection->bonding_id;
}
bt_unlock();
// don't hold bt_lock while cal... | {
PBL_LOG(LOG_LEVEL_DEBUG, "Found an instance of %s at 0x%"PRIx16"-0x%"PRIx16"!",
client->debug_name, range.start, range.end);
} |
#endif
client->handle_service_discovered(characteristics);
}
}
}
static void prv_handle_gatt_service_discovery_event(const PebbleBLEGATTClientServiceEvent *event) {
PebbleBLEGATTClientServiceEventInfo *event_info = event->info;
if (event_info->status == BTErrnoServiceDiscoveryDisconnected) {
// TO... |
ations(&e, &r);
free(r.allocated_buffer);
notification_storage_set_status(&i, TimelineItemStatusActioned);
cl_assert(notification_storage_get(&i, &r));
cl_assert(uuid_equal(&e.header.id, &r.header.id));
cl_assert_equal_i(e.header.ancs_uid, r.header.ancs_uid);
cl_assert_equal_i(TimelineItemStatusActioned, r... | free(r.allocated_buffer) | ;
}
void test_notification_storage__remove_add_compress(void) {
time_t timestamp = 0x10000000;
TimelineItem e = {
.header = {
.type = TimelineItemTypeNotification,
.status = 0,
.ancs_uid = 0,
.layout = LayoutIdGeneric,
.timestamp = 0x53f0dda5,
},
.attr_list = {
.num_... |
GRect *box,
UNUSED const GTextNodeDrawConfig *config, UNUSED bool render, char *buffer, size_t buffer_size,
void *user_data) {
LauncherAppGlanceStructured *structured_glance = user_data;
LauncherAppGlanceWeather *weather_glance =
launcher_app_glance_structured_get_data(structured_glance);
if (weath... | (forecast->current_weather_phrase, weather_glance) | ;
const char *formatter_string = strlen(localized_phrase) ? temp_and_phrase_formatter :
temp_only_formatter;
// It's safe to pass more arguments to snprintf() than might be used by formatter_string
snprintf(weather_glance->subtitle, weather_glance_subtitle_size, fo... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | task_watchdog_mask_clear(pebble_task_get_current()) | |
/*
* 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 (!cond(font_key)) {
do_stuff(font_key, 5);
}
} |
}
void store_syscall(char * buf, int size) {
syscall_internal_elevate_privilege();
buf[0] = 'a';
char * new = buf;
do_stuff(new, size);
}
void load_syscall(char * buf, int size) {
syscall_internal_elevate_privilege();
char test = buf[0];
do_stuff(&test, size);
}
void bind_syscall(char * buf, int ... |
istributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "apps/watch/kickstart/kickstart.h"
#include "popups/timeline/peek.h"
#include "applib/ui/win... | (gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)) | |
or the specific language governing permissions and
* limitations under the License.
*/
#include "rocky_api_graphics_color.h"
#include "rocky_api_util.h"
#include "string.h"
#include "util/size.h"
#define GColorARGB8FromRGBA(red, green, blue, alpha) \
(uint8_t)( \
((((alpha) >> 6) & 0b11) << 6) | \
((((r... | GColorARGB8FromHEX(0xf0fff0) | },
{"hotpink", GColorARGB8FromHEX(0xff69b4)},
{"indianred", GColorARGB8FromHEX(0xcd5c5c)},
// {"indigo", GColorARGBFromHEX(0x4b0082)}, inconsistent with Pebble color
{"ivory", GColorARGB8FromHEX(0xfffff0)},
{"khaki", GColorARGB8FromHEX(0xf0e68c)},
{"lavender", GColorARGB8FromHEX(0xe6e6fa)},
{"lavenderblush... |
/*
* 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 (!weather_service_supported_by_phone()) {
// return E_RANGE, so the phone receives BLOB_DB_INVALID_DATABASE_ID and stops sending
// unwelcome weather records
return E_RANGE;
}
mutex_lock(s_weather_db.mutex);
pfs_remove(SETTINGS_FILE_NAME);
mutex_unlock(s_weather_db.mutex);
return S_SUCCESS... |
status_t weather_db_insert(const uint8_t *key, int key_len, const uint8_t *val, int val_len) {
if (!weather_service_supported_by_phone()) {
return E_RANGE;
}
if (key_len != sizeof(WeatherDBKey) ||
val_len < (int) MIN_ENTRY_SIZE ||
val_len > (int) MAX_ENTRY_SIZE) {
return E_INVALID_ARGUMENT;
... |
);
prv_display_start();
prv_disable_display_spi_clock();
s_initialized = true;
}
static void prv_display_context_init(DisplayContext* context) {
context->state = DISPLAY_STATE_IDLE;
context->get_next_row = NULL;
context->complete = NULL;
}
// Clear-all mode is entered by sending 0x04 to the panel
void d... | PBL_ASSERTN(s_display_context.get_next_row != NULL) | ;
bool is_end_of_buffer = !s_display_context.get_next_row(&r);
switch (s_display_context.state) {
case DISPLAY_STATE_IDLE:
{
if (is_end_of_buffer) {
// If nothing has been modified, bail out early
return false;
}
// Enable display slave select
prv_enable_chip_select();
s_displ... |
/*
* 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... | hw_gpio_set_active(gpio->port, gpio->pin) | ;
} else {
hw_gpio_set_inactive(gpio->port, gpio->pin);
}
gpio->is_active = active;
}
void debug_gpio_init(void) {
for (int i = 0; i < DEBUG_GPIOS->num_debug_gpios; i++) {
prv_config_gpio_as_output_and_set_state(&DEBUG_GPIOS->debug_gpio[i], false);
}
}
void debug_gpio_toggle(int debug_gpio_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... | (storage, size) | ;
}
return 0;
}
bool gb_storage_read_next_chunk(GetBytesStorage *storage, uint8_t *buffer, uint32_t len) {
if (storage->impl->setup) {
return storage->impl->read_next_chunk(storage, buffer, len);
}
return false;
}
void gb_storage_cleanup(GetBytesStorage *storage, bool successful) {
if (storage->impl... |
ket packet;
} PulsePPCallbackPacket;
typedef struct {
CommSession *session;
} PULSETransport;
//! The CommSession that the PULSE transport is managing.
//! Currently there's only one for the System session.
static PULSETransport s_transport;
static void prv_send_next(Transport *transport) {
CommSession *session ... | comm_session_set_capabilities(s_transport.session, capabilities) | ;
} else {
comm_session_close(s_transport.session, CommSessionCloseReason_UnderlyingDisconnection);
s_transport.session = NULL;
}
if (send_event) {
PebbleEvent e = {
.type = PEBBLE_BT_CONNECTION_EVENT,
.bluetooth = {
.connection = {
.state = (s_transport.session) ? Pebbl... |
/*
* 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... | (f->buffer, 0xff, framebuffer_get_size_bytes(f)) | ;
framebuffer_dirty_all(f);
f->is_dirty = true;
}
void framebuffer_mark_dirty_rect(FrameBuffer *f, GRect rect) {
if (!f->is_dirty) {
f->dirty_rect = rect;
} else {
f->dirty_rect = grect_union(&f->dirty_rect, &rect);
}
const GRect clip_rect = (GRect) { GPointZero, f->size };
grect_clip(&f->dirty_... |
alue of fffffffc");
// Minimum digits output
snprintf(dstbuf, 256, "There are %.3x lights, %.3x", 16, -4);
cl_assert_equal_s(dstbuf, "There are 010 lights, fffffffc");
// Minimum digits output (zero digits)
snprintf(dstbuf, 256, "%.0xzero%.0x", 0, 1);
cl_assert_equal_s(dstbuf, "zero1");
// Minimum digi... | (dstbuf, 256, "%hhX,%hX,%X,%lX", hurf, hurf, hurf, hurf) | ;
cl_assert_equal_s(dstbuf, "F0,DEF0,9ABCDEF0,9ABCDEF0");
snprintf(dstbuf, 256, "%llX,%jX", hurf, hurf);
cl_assert_equal_s(dstbuf, "123456789ABCDEF0,123456789ABCDEF0");
snprintf(dstbuf, 256, "%zX,%tX", hurf, hurf);
cl_assert_equal_s(dstbuf, "9ABCDEF0,9ABCDEF0");
}
void test_sprintf__percent_c(void) {
char ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | jerry_create_undefined() | , timer_data->argv, timer_data->argc);
} else if (jerry_value_is_string(timer_data->callback)) {
char *source_buf = rocky_string_alloc_and_copy(timer_data->callback);
rocky_util_eval_and_log_uncaught_error((const jerry_char_t *)source_buf, strlen(source_buf));
task_free(source_buf);
}
if (!timer_data... |
e "stubs_prompt.h"
extern const char *iOS_NOTIF_PREF_DB_FILE_NAME;
extern const int iOS_NOTIF_PREF_MAX_SIZE;
//! Data from iOS notif pref INSERT
//! 00 00 00 00 00 01 02 0d 03 01 05 00 52 65 70 6c ........ ....Repl
//! 79 08 71 00 4f 6b 00 59 65 73 00 4e 6f 00 43 61 y.q.Ok.Y es.No.Ca
//! 6c 6c 20 6d 65 00 43 61... | cl_assert_equal_i(mute->uint8, 0x1F) | |
t_equal_b(app_message_is_closed_inbound(), true);
cl_assert_equal_b(app_message_is_closed_outbound(), true);
fake_app_timer_deinit();
kernel_free(s_sent_data);
s_sent_data = NULL;
}
// Test OUTBOUND (watch->phone):
////////////////////////////////////
static void prv_send_test_data_expecting_result(AppMessage... | cl_assert_equal_i(s_failure_result, APP_MSG_SEND_REJECTED) | ;
// Check the state is reset properly
cl_assert_equal_b(app_message_is_accepting_outbound(), true);
}
void test_app_message__nack_then_outbox_sent(void) {
// Sending ack on timeout, but reject the send
prv_set_remote_receive_handler(prv_nack_sent_callback);
prv_send_test_data();
prv_process_sent_data();
... |
cl_assert_equal_i(event.type, PEBBLE_NULL_EVENT) | ;
}
static void prv_fake_connect(const BTDeviceInternal *device, bool is_master) {
// Simulate getting a Connection Complete event for the device from Bluetopia:
fake_gap_put_connection_event(HCI_ERROR_CODE_SUCCESS,
is_master, device);
cl_assert_equal_b(gap_le_connection_is_connec... | |
xpected message), should trigger initiating (local) ResetRequest:
RCV_RESET_COMPLETE();
ASSERT_JS_GLOBAL_EQUALS_I("d", 2);
}
void test_rocky_api_app_message__postmessageconnected_and_postmessagedisconnected_start_conn(void) {
prv_postmessageconnected_postmessagedisconnected_init(true /* start_connected */);
AS... | {
prv_init_api(false /* start_connected */);
EXECUTE_SCRIPT("var x = " SIMPLE_TEST_OBJECT ";"
"var hasError = false;"
"_rocky.on('postmessageerror', function() { hasError = true; });"
"_rocky.postMessage(x);");
// First send attempt fails because not in Session... |
void test_rocky_api_app_message__post_message_single_chunk(void) {
prv_init_and_goto_session_open();
EXECUTE_SCRIPT("var x = " SIMPLE_TEST_OBJECT "; _rocky.postMessage(x);");
prv_assert_simple_test_object_pending();
prv_rcv_app_message_ack(APP_MSG_OK);
EXPECT_OUTBOX_NO_MESSAGE_PENDING();
}
static void p... |
--------
// Sample captured: 2015-10-02 15:31:09 local
AccelRawData *activity_sample_walk_100_pbl_25478_3(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_25478_3
//> TEST_EXPECTED 100
//> TEST_EXPECTED_MIN 80
//> TEST_EXPECTED_MAX 120
//> TEST_WEIGH... | { -1368, 176, -40},
{ -1184, 104, -32},
{ -1064, 104, -32},
{ -928, 104, -8},
{ -808, 104, -8},
// 5 seconds
{ -712, 168, 32},
{ -776, 136, 16},
{ -800, 64, 72},
{ -760, 72, 24},
{ -976, 88, -56},
{ -1232, 112, -208},
{ -1440, 48, -288},
{ -1536, -80, -432},
{... |
{ -1096, 152, 32},
{ -864, 168, -40},
{ -880, 288, -72},
{ -704, -120, 56},
{ -520, -336, 80},
{ -576, -160, -120},
{ -856, 48, -176},
{ -1312, 24, -272},
{ -1672, 264, -496},
{ -1968, -208, -152},
{ -1904, 120, -264},
{ -1568, 544, -496},
{ -1528, 216, -160},
{ ... |
update the PrevSize field. */
heap->begin->PrevSize = heap_info_ptr->Size;
}
else {
HEAP_ASSERT_SANE(heap, next_block->PrevSize == (HEAP_INFO_FOR_PTR(ptr))->Size, next_block);
/* We are not pointing to the end of the heap, so if the */
/* next segment is allo... | UTIL_ASSERT((heap_info_ptr >= heap->begin) &&
(heap_info_ptr <= heap->end)) | ;
return heap_info_ptr;
}
//! Split a block into two smaller blocks, returning a pointer to the new second block.
//! The first block will be available at the same location as before, but with a smaller size.
//! Assumes the block is big enough to be split and is unallocated.
//! @param first_part_size the size of ... |
/*
* 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_byte_stream_read(&in_stream) | ) + 0x80;
}
for (int i = 0; i < count; ++i) {
prv_byte_stream_write(&out_stream, 0);
}
}
}
return out_stream.index;
}
|
riter can set it to anything they want, mostly for debugging purposes.
void *writer;
bool write_failed;
bool has_pending_event;
uint32_t num_failed;
uint32_t num_success;
struct {
//! The size of `storage`.
size_t size;
//! The positive offset relative relative to write_index, up until which ... | (storage, storage_size,
message_handler, dropped_handler, service_tag) | ;
}
DEFINE_SYSCALL(uint32_t, sys_app_inbox_service_unregister, uint8_t *storage) {
// No check is needed on the value of `storage `, we're not going to derefence it.
return app_inbox_service_unregister_by_storage(storage);
}
static bool prv_get_consumer_info(AppInboxServiceTag tag, AppInboxConsumerInfo *info_in_o... |
rt_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time());
// Second alarm goes off. First one should be up again, but not until Monday
s_current_hour = 11;
s_current_minute = 30;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 4);
cl_assert_equal_i(s_num_alarm_events_put, 4);
... | cl_assert_equal_i(s_num_alarms_fired, 6) | ;
}
void test_alarm__custom_alarm_weekends_and_weekday(void) {
AlarmId id1;
bool schedule_1[7] = {true, false, false, true, false, false, true};
id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 });
prv_assert_alarm_config(id1, 10, 30, false, ... |
x == ModalPriorityInvalid) {
iter.first_visible_idx = idx;
}
if (prv_has_transition_window(context) && (iter.first_transition_idx == ModalPriorityInvalid)) {
iter.first_transition_idx = idx;
}
if (prv_has_focusable_window(context) && (iter.first_focus_idx == ModalPriorityInvalid)) {
it... | {
context->highest_idx = ModalPriorityInvalid;
context->properties = ModalPropertyDefault;
prv_each_modal_stack(prv_update_modal_stack_callback, context);
} |
ModalProperty modal_manager_get_properties(void) {
return modal_manager_get_enabled() ? s_current_modal_properties : ModalPropertyDefault;
}
void modal_manager_render(GContext *ctx) {
PBL_ASSERTN(ctx);
prv_each_modal_stack(prv_render_modal_stack_callback, ctx);
}
typedef struct VisibleContext {
Window *win... |
"AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "action_toggle.h"
#include "applib/app_launch_button.h"
#include "applib/app_launch_reason.h"
#include "appli... | prv_vibe(next_state) | ;
}
static void prv_handle_prompt_confirm(ClickRecognizerRef recognizer, void *context) {
ActionableDialog *actionable_dialog = context;
ActionToggleContext *ctx = actionable_dialog->dialog.callback_context;
prv_push_result_dialog(ctx);
// Don't destroy the context since it is being reused for the result dialo... |
void launcher_task_add_callback(void (*callback)(void *data), void *data) {
callback(data);
}
uint16_t gaps_get_starting_att_handle(void) {
return 4;
}
// Helpers
///////////////////////////////////////////////////////////
extern TimerID bt_driver_gatt_get_watchdog_timer_id(void);
#define TEST_GATT_CONNECTION_... | fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_CONNECTION_ID) | ;
fake_gatt_put_discovery_complete_event(GATT_SERVICE_DISCOVERY_STATUS_SUCCESS,
TEST_GATT_CONNECTION_ID);
cl_assert_equal_b(fake_gatt_is_service_discovery_running(), false);
prv_assert_event(&device, BTErrnoOK);
fake_event_clear_last();
// Start discovery again, expe... |
open("a_test_0", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
fd = pfs_open("a_test_1", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
fd = pfs_open("b_test_0", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
fd = pfs_open("b_test_1", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
... | ("a_test_0") | |
prv_send_byte_and_check(s_send_info.escaped_byte);
}
// send the next byte
bool result = true;
MBufIterator *iter = &s_send_info.mbuf_iter;
MBuf *mbuf = mbuf_iterator_get_current_mbuf(iter);
uint8_t read_data;
PBL_ASSERTN(mbuf_iterator_read_byte(iter, &read_data));
if (mbuf_is_flag_set(mbuf, MBUF_FLAG_... | {
accessory_enable_input();
} | |
elineResourceTestAppId;
static const TimelineResourceTestAppData s_test_apps[TimelineResourceTestAppIdCount] = {
{
.install_entry = {
.install_id = TimelineResourceTestAppId_AppWithInvalidLUT,
.uuid = {0x3c, 0x6e, 0x2e, 0x1d, 0x61, 0x7d, 0x4d, 0x17,
0x97, 0xa1, 0xbc, 0x43, 0x2d, 0x87, ... | {
s_is_app_published_resource_invalid = false;
} |
// Tests
/////////////////////////
void test_timeline_resources__get_id_system(void) {
AppResourceInfo res_info;
// Calling the function with an invalid TimelineResourceId should return false
cl_assert(!timeline_resources_get_id_system(TIMELINE_RESOURCE_INVALID, TimelineResourceSizeTiny,
TimelineR... |
600, -816},
{ -144, 592, -800},
{ -128, 584, -800},
{ -128, 584, -784},
{ -136, 584, -792},
{ -136, 584, -808},
{ -128, 592, -816},
{ -136, 600, -808},
{ -136, 600, -792},
{ -136, 592, -792},
{ -144, 584, -808},
{ -136, 600, -808},
{ -144, 592, -808},
{ -136, 584, -8... | { -136, 552, -952},
{ -152, 448, -880},
{ -144, 432, -880},
{ -144, 448, -880},
{ -152, 472, -888},
{ -168, 488, -888},
{ -152, 504, -880},
{ -160, 488, -872},
{ -160, 472, -872},
{ -160, 480, -872},
{ -160, 480, -888},
// 341 seconds
{ -160, 480, -880},
{ -160, 4... | |
urrent_wakeup_id;
WakeupId next_wakeup_id;
time_t timestamp;
} WakeupState;
struct prv_missed_events_s {
uint8_t missed_apps_count;
AppInstallId *missed_app_ids;
};
struct prv_check_app_and_wakeup_event_s {
time_t wakeup_timestamp; //!< Timestamp of the WakupEntry
int wakeup_count; //!< wakeup event count... | settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) | |
ONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "applib/app.h"
#include "applib/fonts/fonts.h"
#include "applib/graphics/graphics.h"
#include "applib/graphics/text.h"
#include "applib/ui/window_private.h"
... | prv_handle_init() | ;
app_event_loop();
}
const PebbleProcessMd* panic_app_get_app_info() {
static const PebbleProcessMdSystem s_app_md = {
.common = {
.main_func = s_main,
.visibility = ProcessVisibilityHidden,
// UUID: 130fb6d7-da9e-485a-87ca-a5ca4bf21912
.uuid = {0x13, 0x0f, 0xb6, 0xd7, 0xda, 0x9e, 0x48... |
iph_WWDG
| RCC_APB1Periph_SPI2
| RCC_APB1Periph_SPI3
| RCC_APB1Periph_USART2
| RCC_APB1Periph_USART3
| RCC_APB1Periph_UART4
| RCC_APB1Periph_UART5
| RCC_APB1Periph_I2C1
| RCC_APB1Periph_I2C2
| RCC_APB1Periph_I2C3
| RCC_APB1Periph_CAN1
| RCC_APB1Periph_CAN2
| RCC_APB1Perip... | dbgserial_putstr("Software failure caused a reset") | ;
}
// Clean up after the last failure.
boot_bit_clear(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED);
// We have a "three strikes" algorithm: if the watch fails three times, return true
// to tell the parent we should load the recovery firmware. A reset for any other reason
// will reset this algorithm.
if (boot_... |
ponse("FAIL: sector not erased");
return;
}
// write data into the sector
const uint32_t BUFFER_SIZE = 256;
uint8_t buffer[BUFFER_SIZE];
for (uint32_t i = 0; i < BUFFER_SIZE; i++) {
buffer[i] = i;
}
for (uint32_t offset = 0; offset < TEST_LENGTH; offset += BUFFER_SIZE) {
const uint32_t addr =... | prompt_send_response_fmt(buffer, sizeof(buffer), " SUBSECTOR - 0X%-6"PRIx32" :: %s",
sub_addr, sub_erased ? "true" : "false") | ;
}
}
addr += SECTOR_SIZE_BYTES;
task_watchdog_bit_set(pebble_task_get_current());
}
}
/*
* Commented out by default because this command can harm your flash chip!!
static void prv_flash_stress_callback(void *data) {
uint32_t flash_addr = FLASH_REGION_DEBUG_DB_BEGIN;
uint32_t sector_address = ... |
text_attributes_destroy.call_count);
rocky_global_init(s_graphics_api);
cl_assert_equal_i(1, s_fonts_get_system_font.call_count);
cl_assert_equal_i(0, s_graphics_text_attributes_destroy.call_count);
rocky_global_deinit();
cl_assert_equal_i(1, s_fonts_get_system_font.call_count);
cl_assert_equal_i(0, s_graph... | GRect(5, 6, 7, 8) | , s_graphics_fill_rect.last_call.rect);
s_graphics_draw_rect_precise = (MockCallRecordings){};
EXECUTE_SCRIPT(
"ctx.strokeRect(9, 10.2, 11.5, 12.8);\n"
);
cl_assert_equal_i(1, s_graphics_draw_rect_precise.call_count);
GRectPrecise expected_rect = {(int)(8.5*8), 78, (int)(11.5*8), (int)(12.8*8)};
cl_as... |
/*
* 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 (dev->rx_gpio.gpio) {
const InputConfig input_config = {
.gpio = dev->rx_gpio.gpio,
.gpio_pin = dev->rx_gpio.gpio_pin
};
gpio_input_init(&input_config);
} | |
if ((transfer->direction == I2CTransferDirection_Write) && (i2c->ISR & I2C_ISR_TCR)) {
// done writing the register address for a write request - "reload" the write payload
transfer->state = I2CTransferState_WriteData;
prv_resume_transfer(bus, false /* !generate_start */);
} |
if ((i2c->ISR & I2C_ISR_NACKF) != 0) {
i2c->ICR |= I2C_ICR_NACKCF;
i2c_handle_transfer_event(bus, I2CTransferEvent_NackReceived);
return;
}
break;
case I2CTransferState_ReadData:
if ((i2c->ISR & I2C_ISR_RXNE) != 0) {
transfer->data[transfer->idx++] = i2c->RX... | |
oid* data) {
task_watchdog_bit_set(PebbleTask_NewTimers);
}
static void vcom_timer_callback(void* data) {
display_pulse_vcom();
}
static void register_system_timers(void) {
static RegularTimerInfo watchdog_timer = { .list_node = { 0, 0 }, .cb = watchdog_timer_callback };
regular_timer_add_seconds_callback(&wa... | {
// The Snowy bootloader does not clear the watchdog flag itself. Clear the
// flag ourselves so that a future safe reset does not look like a watchdog
// reset to the bootloader.
static McuRebootReason s_mcu_reboot_reason;
s_mcu_reboot_reason = watchdog_clear_reset_flag();
#if PULSE_EVERYWHERE
pulse_init... |
// not programmed when we attempt to initialize bluetooth, it prevents the
// clock from reaching the bluetooth module and initialization fails.
display_init();
// Use the MFG calibrated display offset to adjust the display
GPoint mfg_offset = mfg_info_get_disp_offsets();
display_set_offset(mfg_offset);
... |
oid click_manager_reset(ClickManager *click_manager) {
return;
}
void watchface_reset_click_manager(void) {
return;
}
Animation *window_transition_default_pop_create_animation(WindowTransitioningContext *context) {
window_transition_context_disappear(context);
window_transition_context_appear(context);
retu... | cl_check(new_window) | |
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 in wri... | window_render(&card->window, &s_ctx) | ;
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
|
{
break;
} |
// Dispatch the received message
PBL_LOG(LOG_LEVEL_DEBUG, "Dispatching msg of len %"PRIu32" for protocol %d", msg_bytes,
protocol);
const QemuMessageHandler* handler = prv_find_handler(protocol);
if (!handler) {
PBL_LOG(LOG_LEVEL_WARNING, "No handler for protocol: %d", protocol);
... | |
(void) {
hrm_manager_new_data_cb(&s_hrm_event_data);
}
static PebbleHRMEvent s_cb_events_1[16];
static int s_num_cb_events_1 = 0;
static void prv_fake_hrm_1_cb(PebbleHRMEvent *event, void *context) {
if (s_num_cb_events_1 >= ARRAY_LENGTH(s_cb_events_1)) {
return;
}
s_cb_events_1[s_num_cb_events_1++] = *eve... | sys_hrm_manager_get_app_subscription(app_id) | == session_ref);
sys_hrm_manager_get_subscription_info(session_ref, NULL, NULL, &ret_expire_s, NULL);
cl_assert_equal_i(ret_expire_s, HRM_MANAGER_APP_EXIT_EXPIRATION_SEC);
sys_hrm_manager_unsubscribe(session_ref);
}
// Test that app subscriptions expire correctly
void test_hrm_manager__app_expiration(void) {... |
graphics_draw_vertical_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_ROWS);
graphics_draw_vertical_line_dotted(&ctx, GPoint(2, 0), MAX_NUM_ROWS + 4);
graphics_draw_vertical_line_dotted(&ctx, GPoint(4, 0), 0);
graphics_draw_vertical_line_dotted(&ctx, GPoint(6, 0), 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(8,... | GPoint(10, 32) | , 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(4, 36), 10);
// cross - odd vert, odd horiz
graphics_draw_vertical_line_dotted(&ctx, GPoint(41, 33), 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(37, 37), 10);
// T facing up - lined up
graphics_draw_vertical_line_dotted(&ctx, GPoint(70, 3... |
->resource_id_80);
dialog_show_status_bar_layer(dialog, true);
actionable_dialog_set_action_bar_type(actionable_dialog, DialogActionBarConfirm, NULL);
actionable_dialog_set_click_config_provider(actionable_dialog,
prv_confirm_config_provider);
app_actionable_dialog_push(actionable_dialog);
}
///////////... | (dialog, data->resource_id_25) | ;
dialog_show_status_bar_layer(dialog, true);
expandable_dialog_set_header(expandable_dialog, "Header");
app_expandable_dialog_push(expandable_dialog);
}
////////////////////////////////
// Expandable Dialog with multi line header
static void prv_show_expandable_dialog_long_header(DialogsData *data) {
Expand... |
void test_pfs__watch_file_callbacks(void) {
const char* file_name = "newfile";
PFSCallbackHandle cb_handle = pfs_watch_file(file_name, prv_file_changed_callback,
FILE_CHANGED_EVENT_ALL, NULL);
// Callback should get invoked if we close with write access
s_watch_... | strncmp(name, "a_", 2) | == 0);
}
static bool prv_find_name(ListNode *node, void *data) {
PFSFileListEntry *entry = (PFSFileListEntry *)node;
return (strcmp(entry->name, (char *)data) == 0);
}
void test_pfs__file_list(void) {
pfs_format(true);
pfs_init(false);
// Create some files
int fd;
fd = pfs_open("a_test_0", OP_FLAG_WRI... |
/*
* 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... | (4, 2, 16, 8) | );
}
static void across_x_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_draw_rect(ctx, &GRect(10, 2, 18, 4));
}
static void across_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphic... |
he License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specifi... | cl_assert_equal_s(app_data.bundle_id, app_data_out.bundle_id) | ;
cl_assert_equal_i(app_data.flags, app_data_out.flags);
cl_assert_equal_s(app_data.display_name, app_data_out.display_name);
ancs_app_destroy_buffer(&app_data_out);
}
}
}
void test_ancs_app_storage__iter(void) {
ANCSAppData apps[] = {
{ .bundle_id = "com.apple.MobileSMS", .display_name ... |
row_height_for_selection(void) {
MenuLayer l;
const int height = 180;
menu_layer_init(&l, &GRect(10, 10, height, 180));
menu_layer_set_center_focused(&l, true);
menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){
.draw_row = prv_draw_row,
.get_num_rows = prv_get_num_rows,
.get_cell_hei... | cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section) | |
/*
* 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... | {
PebbleTask task = pebble_task_get_current();
if (task == PebbleTask_App) {
client = AnalyticsClient_App;
} else if (task == PebbleTask_Worker) {
client = AnalyticsClient_Worker;
} else {
return NULL; // System UUID
}
} |
if (client == AnalyticsClient_App) {
md = app_manager_get_current_app_md();
} else if (client == AnalyticsClient_Worker) {
md = worker_manager_get_current_worker_md();
} else if (client == AnalyticsClient_System) {
return NULL;
} else if (client == AnalyticsClient_Ignore) {
return NULL;
} el... |
24},
// 49 seconds
{ -984, 312, 0},
{ -1000, 184, -56},
{ -880, 208, -120},
{ -1104, 224, -56},
{ -1344, 368, 32},
{ -1480, 872, 0},
{ -1416, -64, -48},
{ -1072, 40, -152},
{ -1232, 352, -104},
{ -1352, 352, -16},
{ -1320, 184, 8},
{ -1112, 88, 16},
{ -1008, 32, ... | { -728, 256, 48},
{ -632, 216, -8},
{ -792, 256, 24},
{ -1152, 352, 0},
{ -1720, 368, 192},
{ -1528, 408, -88},
{ -1024, 32, -256},
{ -1256, 320, -320},
{ -1440, 280, -224},
{ -1216, 120, -216},
{ -1000, 64, -104},
{ -864, -16, -64},
{ -848, -8, -48},
// 55 second... |
{ -1112, 104, -128},
{ -968, 72, -24},
{ -760, 0, -80},
{ -648, 80, -88},
{ -560, 128, -104},
{ -584, 136, -40},
{ -752, 320, -40},
{ -840, 624, -128},
{ -1200, 760, -64},
{ -1272, 1152, -176},
{ -1032, 1152, -216},
{ -896, 776, -136},
{ -808, 616, -40},
{ -752, ... |
LauncherMenuLayer launcher_menu_layer = {};
launcher_menu_layer_init(&launcher_menu_layer, &data_source);
const bool animated = false;
// If we used MenuRowAlignCenter on rect then the test images would show the top and bottom
// rows being clipped by the edge of the screen
const MenuRowAlign row_align = P... | {
s_use_pdc_icons = true;
prv_render_launcher_menu_layer(LauncherMenuLayerTestApp_LongTitle);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
} |
void test_launcher_menu_layer__no_icon_pdc(void) {
s_use_pdc_icons = true;
prv_render_launcher_menu_layer(LauncherMenuLayerTestApp_NoIcon);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_launcher_menu_layer__interior_app_pdc(void) {
s_use_pdc_icons = true;
prv_render_launcher_menu... |
_ms_with_timers(start_ms + duration_a + delay_seq + delay_a + delay_b
+ 2 * MIN_FRAME_INTERVAL_MS + 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1);
cl_assert_equal_i(prv... | prv_count_handler_entries(&s_stopped_handler_calls, a) | |
icContext (used in the node's callback) as well
// as the size requested by the provided LayoutNodeTextDynamicConfig
GTextNodeTextDynamic *text_node = graphics_text_node_create_text_dynamic(
sizeof(TextDynamicContext) + config->buffer_size, prv_text_dynamic_node_callback, NULL);
if (text_node) {
TextDyn... | system_theme_get_font_key_for_size(ToPreferredContentSize(content_size), style_font) | ;
}
GTextNodeVertical *layout_create_headings_paragraphs_node(
const LayoutLayer *layout, const LayoutNodeHeadingsParagraphsConfig *config) {
const AttributeList *attributes = layout->attributes;
StringList *headings = attribute_get_string_list(attributes, AttributeIdHeadings);
StringList *paragraphs = attri... |
.h"
#include <string.h>
#include <stdio.h>
// Stubs
////////////////////////////////////
#include "graphics_common_stubs.h"
#include "stubs_applib_resource.h"
#include "test_graphics.h"
extern void prv_apply_tint_color(GColor *color, GColor tint_color);
static uint8_t s_dest_data[100 * 100];
static GBitmap s_dest_b... | (&s_dest_bitmap, src_bitmap, GPointZero, GCompOpSet, GColorWhite) | ;
cl_assert(gbitmap_pbi_eq(&s_dest_bitmap,
"test_bitblt_palette_1bit__2bit_palette_to_1bit_set-expect.pbi"));
gbitmap_destroy(src_bitmap);
}
// Tests assign, from same size to same size.
// Setup:
// - Source is 50x50, alternating lines between orange and blue for the top half.
// The bott... |
auto.h"
#include "applib/graphics/graphics.h"
#include "applib/graphics/gtypes.h"
#include "applib/ui/property_animation.h"
#include "applib/ui/status_bar_layer.h"
#include "applib/ui/shadows.h"
#include "applib/ui/window.h"
#include "resource/resource_ids.auto.h"
#include "services/normal/timeline/layout_layer.h"
#inc... | (swap_layer->layer.frame.size.w, size.w) | ,
.size.h = MAX(swap_layer->layer.frame.size.h, size.h),
});
return layout;
}
return NULL;
}
static void prv_announce_layout_will_appear(SwapLayer *swap_layer, LayoutLayer *layout) {
swap_layer->swap_in_progress = true;
if (swap_layer->callbacks.layout_will_appear_handler) {
return swap_layer... |
d ||
this->state->link_state == LinkState_AckSent) {
prv_transition_to(this, LinkState_RequestSent);
} else if (this->state->link_state == LinkState_Opened) {
this->state->restart_count = 0;
prv_start_timer(this);
prv_transition_to(this, LinkState_Stopping);
}
prv_send_terminate_ack(this, pa... | {
mutex_lock(this->state->lock);
LinkState state = this->state->link_state;
mutex_unlock(this->state->lock);
if (state == LinkState_Initial || state == LinkState_Closed) {
return;
}
psleep(2);
} |
}
}
void ppp_control_protocol_handle_incoming_packet(
PPPControlProtocol *this, void *raw_packet, size_t length) {
mutex_lock(this->state->lock);
if (this->state->link_state == LinkState_Initial ||
this->state->link_state == LinkState_Starting) {
// No packets should be received while the lower la... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | pfs_init(false) | ;
contacts_db_init();
}
void test_contacts__cleanup(void) {
}
static Attribute address1_attributes[] = {
{.id = AttributeIdTitle, .cstring = "home"},
{.id = AttributeIdAddress, .cstring = "0123456789"},
};
static Address addresses[] = {
{
.id = {ADDRESS_1_UUID},
.type = AddressTypePhoneNumber,
.a... |
, horizontal_divider_width / 2);
const int16_t horizontal_divider_x_offset = PBL_IF_ROUND_ELSE(vertical_divider_x_offset, 0);
const int16_t vertical_divider_y_offset = PBL_IF_ROUND_ELSE(
37, bounds.size.h - vertical_divider_height);
const uint16_t horizontal_divider_y_offset = PBL_IF_ROUND_ELSE(
verti... | (FONT_KEY_LECO_20_BOLD_NUMBERS,
FONT_KEY_LECO_28_LIGHT_NUMBERS) | ;
const char * const font_key_accent_numbers = PBL_IF_ROUND_ELSE(FONT_KEY_LECO_20_BOLD_NUMBERS,
FONT_KEY_LECO_38_BOLD_NUMBERS);
// hole, par numbers
const char * const font_key_large_numbers = PBL_IF_ROUND_ELSE(FONT_KEY_LECO_32_BOLD_NUMBERS,
... |
assert_equal_point_precise(PP(8.5, 9.5), s_graphics_line_draw_precise_stroked.last_call.pp0);
cl_assert_equal_point_precise(PP(10.5, 11.5), s_graphics_line_draw_precise_stroked.last_call.pp1);
EXECUTE_SCRIPT(
"ctx.fill();\n"
);
// only first shape has at least 3 points
cl_assert_equal_i(1, s_gpath_draw_f... | (
"ctx.beginPath();\n"
"ctx.moveTo(80, 40);\n"
"ctx.arc(60, 80, 20, 0, Math.PI, true);\n"
"ctx.stroke();\n"
) | ;
cl_assert_equal_i(1, s_graphics_line_draw_precise_stroked.call_count);
cl_assert_equal_i(1, s_graphics_draw_arc_precise.call_count);
MockCallRecording *lc = &s_graphics_draw_arc_precise.last_call;
cl_assert_equal_point_precise(PP(59.5, 79.5), lc->draw_arc.center);
cl_assert_equal_i(20 * 8, lc->draw_arc.ra... |
/*
* 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... | (&text_container_frame, &max_text_container_frame, GAlignCenter, clips) | ;
grect_align(&title_frame, &text_container_frame, GAlignTop, clips);
grect_align(&instruction_frame, &text_container_frame, GAlignBottom, clips);
const int16_t title_vertical_adjust_px = -fonts_get_font_cap_offset(title_font);
title_frame.origin.y += title_vertical_adjust_px;
graphics_draw_text(ctx, title_... |
&connection);
if (!subscription || !connection) {
// FIXME: When unsubscribing, the GATTClientSubscriptionNode is already removed at this point
PBL_LOG(LOG_LEVEL_DEBUG,
"No subscription and/or connection found for CCCD write response (%u)", error);
return;
}
// Mask to mask out all tasks
... | prv_lock() | ;
{
if (!prv_check_buffer(client)) {
has_more = false; // the client went away
goto unlock;
}
GATTBufferedNotificationHeader header = {};
const bool has_notification = prv_get_next_notification_header(client, &header);
if (LIKELY(has_notification)) {
if (LIKELY(*value_length_in_... |
ersection {
Fixed_S16_3 x;
Fixed_S16_3 delta;
} Intersection;
void gpath_init(GPath *path, const GPathInfo *init) {
memset(path, 0, sizeof(GPath));
path->num_points = init->num_points;
path->points = init->points;
}
GPath* gpath_create(const GPathInfo *init) {
// Can't pad this out because the definition ... | if (!path) {
return;
} |
path->rotation = angle % TRIG_MAX_ANGLE;
}
void gpath_move_to(GPath *path, GPoint point) {
if (!path) {
return;
}
path->offset = point;
}
void gpath_move(GPath *path, GPoint delta) {
if (!path) {
return;
}
path->offset.x += delta.x;
path->offset.y += delta.y;
}
GRect gpath_outer_rect(GPath *... |
cl_assert(parent.first_child == &child_b);
cl_assert(child_b.next_sibling == &child_c);
cl_assert(child_c.parent == &parent);
cl_assert(child_c.next_sibling == &child_a);
cl_assert(child_a.next_sibling == NULL);
}
void test_layer__traverse(void) {
Layer *stack[5];
uint8_t current_stack = 0;
Layer *a ... | layer_is_descendant(&child_c, &child_a) | |
/*
* 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... | (address + length - 1) | ;
if (first_sector < 0 || last_sector < 0) {
return false;
}
int count = last_sector - first_sector + 1;
if (progress_callback) {
progress_callback(0, count, progress_context);
}
FLASH_Unlock();
for (int sector = first_sector; sector <= last_sector; ++sector) {
FLASH_ClearFlag(FLASH_FLAG_EOP ... |
ual(&state.pin.header.id, &s_items[5].header.id));
// check second again
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check fourth
cl_assert(iter_next(&iterator));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_item... | cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[2].header.id)) | ;
cl_assert(!iter_next(&iterator));
}
// 5am, no events passed
void test_timeline__extra_case_none_backwards(void) {
prv_insert_extra_case_items();
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &... |
/*
* 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 cl_mock_type(size_t);
} | |
GlanceGeneric *generic_glance =
launcher_app_glance_structured_get_data(structured_glance);
// Reset the timer
generic_glance->slice_subtitle_template_string_reeval_timer = NULL;
prv_cancel_subtitle_reeval_timer(generic_glance);
// Notify the service that the glance changed
launcher_app_glance_structu... | prv_generic_glance_set_icon(generic_glance, &resource_info) | ;
prv_cancel_subtitle_reeval_timer(generic_glance);
// The glance will automatically be redrawn after this function is called (which will also update
// the glance's state regarding its subtitle template string), so no need to mark it as dirty
// (see launcher_app_glance_update_current_slice())
}
static cons... |
LIP, 2);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r2_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 3);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rou... | setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 3) | ;
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
// TODO: Fix offset calculation and reenable this: - PBL-16509
#if SCREEN_COLOR_DEPTH_BITS == 8
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi"));
#endif
setup_test_aa_sw(&ctx... |
atic const unsigned int TICKS_IN_INTERVAL = 60 * 60 * 24;
static uint32_t prv_get_asynchronous_prescaler(void) {
return (RTC->PRER >> 16) & 0x7f;
}
static uint32_t prv_get_synchronous_prescaler(void) {
return RTC->PRER & 0x1fff;
}
//! Are we in slow mode?
static bool prv_slow_mode() {
return prv_get_asynchrono... | {
if (!prv_slow_mode()) {
// If we're not in slow mode there's nothing to do
return;
}
// On standby the RTC is reset to date 0, so the RTC's time is really
// the number of seconds we've been in standby
int32_t elapsed_since_standby = prv_seconds_since_standby();
int32_t saved_time = RTC_ReadBacku... |
static uint32_t prv_bcd_to_byte(uint32_t value) {
const uint32_t tmp = ((value & 0xF0) >> 0x4) * 10;
return (tmp + (value & 0x0F));
}
static uint32_t prv_cur_ticks(void) {
uint32_t time_register = RTC->TR;
const uint32_t hours = prv_bcd_to_byte((time_register & (RTC_TR_HT | RTC_TR_HU)) >> 16);
const uint3... |
tRight, NULL);
content_box->size.w -= (indicator_size.w + (2 * horizontal_padding));
}
} else {
content_box->size.w -= horizontal_padding;
}
#if SCREEN_COLOR_DEPTH_BITS == 1
// Fill in the background layer. This effectively does nothing on watches where we have the
// ability to draw with color,... | (label_text_container->size.w, indicator_height) |
};
grect_align(&content_frame, label_text_container, GAlignCenter, true);
grect_align(&indicator_frame, &content_frame, GAlignBottom, true);
graphics_draw_text(ctx, INDICATOR, aml->layout_cache.font, indicator_frame,
GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL);
}
static void ... |
er(I2C_DEVICE_MAX14690, MAX14690_ADDR, PmicRegisters_HAND_SHK, 0x01);
// Power up 3.2V rail
prv_update_rail_state(PmicRail_LDO2, true);
return true;
}
static bool prv_update_rail_state(PmicRail rail, bool enable) {
static int8_t s_ldo2_ref_count = 0;
static int8_t s_ldo3_ref_count = 0;
int8_t *ref_count... | {
// TODO: Uncomment when there is i2c support in the bootloader
uint8_t val;
if (!prv_read_register(PmicRegisters_STATUSB, &val)) {
// NOTE: When running on QEMU, i2c reads return false. For now, just assume a failed
// i2c read means we are connected to a USB cable
return true;
}
bool usb_conne... | |
Y_DAYS]){0, 1000, 0, 0, 0, 0, 0}));
// Feed in 100 steps/min over 20 minutes, for a total of 2000 steps for today
prv_feed_cannned_accel_data(20 * SECONDS_PER_MINUTE, 100, ActivitySleepStateAwake);
ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount,
((const uint32_t [ACTIVITY_HISTORY_DAYS]){2000, 1000, ... | prv_feed_cannned_accel_data(k_elapsed_sec, steps_per_minute, ActivitySleepStateAwake) | ;
activity_get_metric(ActivityMetricStepCount, 1, &value);
cl_assert_near(value, ROUND(steps_per_minute * k_elapsed_sec, SECONDS_PER_MINUTE), 5);
activity_get_metric(ActivityMetricDistanceMeters, 1, &value);
act_distance[i] = value;
float err = abs(exp_distance_m - value);
float pct_err = err ... |
AX) / interpolate_moook_duration();
if (normalized >= ANIMATION_NORMALIZED_MAX - bounce_back_length) {
prv_update_pins_mode(timeline_layer);
animation_unschedule(animation);
}
}
Animation *timeline_layer_create_up_down_animation(TimelineLayer *layer, uint32_t duration,
... | PBL_IF_RECT_ELSE(16, bounds->size.h / 2) | ;
const int16_t arrow_point_x_offset = PBL_IF_RECT_ELSE(-arrow_size.w, arrow_size.w);
GPath arrow_path = {
.num_points = 3,
.points = (GPoint[]) { { arrow_base_x, arrow_base_center_y - (arrow_size.h / 2) },
{ arrow_base_x + arrow_point_x_offset, arrow_base_center_y },
... |
ut_buffer, &out_length));
cl_assert_equal_i(out_length, 4);
cl_assert(memcmp(out_buffer, (uint8_t*) "5678", 4) == 0);
cl_assert(circular_buffer_consume(&buffer, 4));
// Get the rest of the wrapped read
cl_assert(circular_buffer_read(&buffer, 2, &out_buffer, &out_length));
cl_assert_equal_i(out_length, 2);
... | circular_buffer_get_read_space_remaining(&buffer) | , 7);
contiguous_num_bytes_left = circular_buffer_write_prepare(&buffer, &data_out);
cl_assert_equal_i(contiguous_num_bytes_left, 1);
memcpy(data_out, "7", 1);
circular_buffer_write_finish(&buffer, 1);
cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 0);
cl_assert_equal_i(circular_buf... |
/*
* 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_bounds(s_nudge_layer, &bounds) | |
ation *prv_create_test_animation(void) {
Animation *h;
const AnimationHandlers handlers = {
.started = prv_started_handler,
.stopped = prv_stopped_handler
};
static const AnimationImplementation implementation = {
.setup = prv_setup_handler,
.update = prv_update_handler,
.teardown = prv_te... | (from_r, r) | ;
property_animation_get_to_grect(prop_h, &r);
cl_assert_equal_rect(to_r, r);
property_animation_get_subject(prop_h, &subject);
cl_assert(subject == &layer);
GRect set_r = GRect(1, 2, 3, 4);
property_animation_set_from_grect(prop_h, &set_r);
r = GRect(0, 0, 0, 0);
property_animation_get_from_grect(p... |
*animation_h) {
if (animation_private_using_legacy_2(NULL)) {
// We need to enable other applib modules like scroll_layer, menu_layer, etc. which are
// compiled to use the 3.0 animation API to work with 2.0 apps.
return ((AnimationLegacy2 *)animation_h)->abs_start_time_ms;
}
AnimationPrivate *animat... | {
if (curve != AnimationCurveCustomFunction) {
// 2.x doesn't support AnimationCurveCustomInterpolationFunction
return false;
}
// 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.
animati... |
AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/);
if (!prv_is_mutable(state, animation)) {
return false;
}
animation->custom_function = function;
if (function) {
animation->curve = curve;
} else {
animation->curve = AnimationCurveDefault;
}
r... |
back(const uint32_t key, const Tuple *new_tuple, const Tuple *old_tuple, void *context) {
cl_assert(CONTEXT == context);
switch (key) {
case SOME_INT8_KEY:
is_int8_updated = true;
cl_assert(should_update_existing_keys_only == false);
cl_assert(new_tuple->type == TUPLE_INT);
cl_assert(new... | {
// If there is insufficient storage, we don't expect this tuple to
// have been updated (since it can't fit!)
cl_assert(tuple->length == strlen(SOME_STRING) + 1);
cl_assert(strcmp(tuple->value->cstring, SOME_STRING) == 0);
} | |
if (address == -1) {
prompt_send_response("Invalid address");
return;
}
uint32_t word = *(uint32_t*) address;
char buffer[32];
prompt_send_response_fmt(buffer, sizeof(buffer), "0x%"PRIx32" = 0x%"PRIx32, address, word);
}
void command_format_flash(void) {
flash_erase_bulk();
}
void command_erase... | {
prompt_send_response("Invalid value");
return;
} | |
events
s_current_timer_id = new_timer_create();
s_wakeup_state.next_wakeup_id = rtc_get_time();
s_wakeup_state.timestamp = -1;
SettingsFile wakeup_settings;
if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) != S_SUCCESS) {
PBL_LOG(LOG_LEVEL_ERROR, "Error: could not open wak... | {
WakeupEntry entry = prv_wakeup_settings_get_entry(wakeup_id);
// Only allow owner to delete its own wakeup events
if (uuid_equal(&app_manager_get_current_app_md()->uuid, &entry.uuid)) {
if (wakeup_id == s_wakeup_state.current_wakeup_id &&
new_timer_scheduled(s_current_timer_id, NULL)) {
new_... |
static bool prv_check_count_and_availability_callback(SettingsFile *file,
SettingsRecordInfo *info, void *context) {
// Check if valid entry
if (!context || info->key_len != sizeof(WakeupId) || info->val_len != sizeof(WakeupEntry)) {
return true; // continue iterating
}
struct prv_check_app_and_wakeu... |
PebbleEvent event = fake_event_get_last();
cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT);
cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable);
TouchEvent *touch_event = touch_event_queue_get_event(0, 0);
prv_test_touch_event(touch_event, 0, TouchEvent_Touchdown, &GPoint(15, 100), 36864... | {
touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0);
touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400);
TouchEvent *touch_event = touch_event_queue_get_event(0, 0);
prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0,
... |
void test_touch__handle_update_merge_position(void) {
touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0);
touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400);
TouchEvent *touch_event = touch_event_queue_get_event(0, 0);
prv_test_touch_event(touch_event, 0, TouchEven... |
yer_is_highlighted(cell_layer);
callbacks->draw_row(callbacks, ctx, cell_layer, row, is_selected);
}
}
static uint16_t prv_get_num_rows_callback(MenuLayer *menu_layer,
uint16_t section_index, void *context) {
PBL_ASSERTN(section_index < SettingsMenuItem_Count);
Setti... | PBL_ASSERTN(callbacks && (category < SettingsMenuItem_Count)) | |
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.
*/
#inc... | GColorARGB8FromHEX(0xf8f8ff) | },
{"gold", GColorARGB8FromHEX(0xffd700)},
{"goldenrod", GColorARGB8FromHEX(0xdaa520)},
{"greenyellow", GColorARGB8FromHEX(0xadff2f)},
{"grey", GColorARGB8FromHEX(0x808080)},
{"honeydew", GColorARGB8FromHEX(0xf0fff0)},
{"hotpink", GColorARGB8FromHEX(0xff69b4)},
{"indianred", GColorARGB8FromHEX(0xcd5c5c)},... |
ming from a location based reminder
// This work-around is causing more trouble than the problem it was solving...
if (timestamp < (now - MAXIMUM_NOTIFY_TIME) && timestamp != INVALID_TIME) {
PBL_LOG(LOG_LEVEL_INFO, "Not presenting stale notif (ts=%ld)", timestamp);
return true;
}
return false;
}
stati... | if (prv_should_ignore_notification(uid, timestamp, notif_attributes, app_notif_prefs)) {
goto cleanup;
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | pfs_format(false /* write erase headers */) | ;
PBL_LOG(LOG_LEVEL_INFO, "\nFile system size: %d, avail: %d", (int)pfs_get_size(),
(int)get_available_pfs_space());
}
// ----------------------------------------------------------------------------------------
// fill a buffer, return it's CRC32
static uint32_t prv_get_random_buffer(uint8_t **buf, unsign... |
ld";
static const uint32_t SOME_NULL_KEY = 0x0;
static const uint32_t SOME_EMPTY_STRING_KEY = 0x1;
static const char *SOME_EMPTY_STRING = "";
static const uint32_t SOME_UINT8_KEY = 0x88888888;
static const uint32_t SOME_UINT16_KEY = 0x16161616;
static const uint32_t SOME_UINT32_KEY = 0x32323232;
static const uint32_... | cl_assert(result == DICT_OK) | ;
cl_assert(final_size == size);
cl_assert(iter.dictionary->count == key_count);
// Read:
Tuple *tuple = dict_read_begin_from_buffer(&iter, buffer, final_size);
uint8_t count = 0;
bool data_found = false;
bool string_found = false;
bool uint8_found = false;
bool uint16_found = false;
bool uint32_fo... |
bg_color.left = s_phone_ui_data->bg_color.right;
}
if (left_to_right) {
s_phone_ui_data->bg_color.left = color;
color_animation = property_animation_get_animation(
property_animation_create(&s_color_slide_animation_impl, NULL, &zero, &width));
s_phone_ui_data->bg_color.boundary = 0;
} else {
... | graphics_fill_rect(ctx, &GRect(0, 0, s_phone_ui_data->bg_color.boundary, layer->bounds.size.h)) | ;
graphics_context_set_fill_color(ctx, s_phone_ui_data->bg_color.right);
graphics_fill_rect(ctx, &GRect(s_phone_ui_data->bg_color.boundary, 0, layer->bounds.size.w,
layer->bounds.size.h));
#else
graphics_context_set_fill_color(ctx, DEFAULT_COLOR);
graphics_fill_rect(ctx, &layer-... |
.h = icon_size.h
};
grect_align(&icon_frame, root_frame, GAlignCenter, false);
static const int16_t UNFOLD_BOUNCE_AMOUNT = 10;
static const int16_t UNFOLD_EXPAND_AMOUNT = 5;
int16_t dot_size = data->mic_window.mic_dot_radius * 2;
GRect icon_from = {
.size = { dot_size, dot_size },
};
grect_align(&... | (voice_window) | ;
applib_free(voice_window->message);
applib_free(voice_window);
}
DictationSessionStatus voice_window_push(VoiceWindow *voice_window) {
if (!connection_service_peek_pebble_app_connection()) {
if (voice_window->show_error_dialog) {
prv_push_bt_dialog(voice_window);
// we return success because t... |
GAPLEClient client,
bool is_response_required) {
if (s_write_return_value != BTErrnoOK) {
return s_write_return_value;
}
Write *write = malloc(sizeof(Write));
uint8_t *buffer;
if (value_length) {
cl_assert(value);
buffer = malloc(value_le... | cl_assert_equal_i(characteristic, s_write_head->characteristic) | |
ero_bytes(void) {
cl_assert(system_flash_erase(FLASH_BASE, 0, NULL, NULL));
cl_assert_equal_i(0, erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_one_byte(void) {
cl_assert(system_flash_erase(FLASH_BASE, 1, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector);
cl_asser... | IS_FLASH_SECTOR(sector) | , "Sector number out of range");
cl_assert(IS_VOLTAGERANGE(voltage_range));
cl_check_(flash_flags_set == false, "Forgot to clear flags before erasing");
cl_check_((erased_sector & (1 << sector/8)) == 0,
"Re-erasing an already erased sector");
flash_flags_set = true;
if (return_status == FLASH_COMP... |
ize.h - UNFOLD_DOT_SIZE_PX) / 2,
.size = UNFOLD_DOT_SIZE,
};
#elif ANIMATION_SLIDE
GRect icon_frame;
TimelineLayout *first_timeline_layout = timeline_layer_get_current_layout(&data->timeline_layer);
if (first_timeline_layout && use_pin) {
GRect frame;
timeline_layer_get_layout_frame(&data->timeline_... | (sidebar_slide) | |
yticsClient_System);
}
if (src_reg & FIFO_WTM) {
accel_get_data(accel_raw_data, num_samples);
if (num_samples > 0) {
s_latest_reading = accel_raw_data[num_samples-1];
}
lis3dh_lock();
if (s_buffer.clients) {
// Only buffer the data if we have clients that are subscribed.
if (!... | (last_pos->y - cur_pos->y) | + abs(last_pos->z - cur_pos->z);
}
// Return true if we are "idle". We check for no movement for at least the last hour (the analytics snapshot
// position is updated once/hour).
bool accel_is_idle(void) {
if (!s_is_idle) {
return false;
}
// It was idle recently, see if it's still idle. Note we are avoid... |
/*
* 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, (uint8_t *)&c, &should_store, &is_invalid) | ;
cl_assert(is_complete == true);
cl_assert(should_store == false);
cl_assert(is_invalid == false);
}
}
void test_hdlc__decode_invalid(void) {
// invalid sequences
uint8_t data;
bool should_store, is_invalid, is_complete;
HdlcStreamingContext ctx;
// two consecutive escape characters
hdlc_st... |
9*item_size, false));
items_read = shared_circular_buffer_read_subsampled(
&buffer, &client, item_size, out_buffer, 100);
cl_assert_equal_i(items_read, 4);
cl_assert_equal_m(out_buffer, "0a3d5f8i", 8);
cl_assert(shared_circular_buffer_write(
&buffer, (uint8_t*)"9j0k1m2n3o4p5q", 7*item_size, false)... | shared_circular_buffer_init(&buffer, storage, sizeof(storage)) | ;
SubsampledSharedCircularBufferClient client = {};
shared_circular_buffer_add_subsampled_client(&buffer, &client, 1, 2);
cl_assert(shared_circular_buffer_write(
&buffer, (uint8_t*)"0a1b2c3d4e5f6g7h8i9j", 10*item_size, false));
// Consume "0a1b2c3d4e"
cl_assert_equal_i(shared_circular_buffer_read_subsa... |
/*
* 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... | {
*file = (SettingsFile){};
s_settings_file.open = true;
return S_SUCCESS;
} | |
buffer_init(&buffer, storage, sizeof(storage));
const uint8_t* out_buffer;
uint16_t out_length;
// Add a client
SharedCircularBufferClient client = (SharedCircularBufferClient) {};
shared_circular_buffer_add_client(&buffer, &client);
// We should start out empty
cl_assert(!shared_circular_buffer_read(&... | (shared_circular_buffer_get_write_space_remaining(&buffer), 2) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.