prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
on a known good commit
{
int num_samples;
AccelRawData *samples = activity_sample_30_steps(&num_samples);
TestMinuteData exp_minutes[] = {
{
.steps = 28,
.orientation = 0x47,
.vmc = 1205,
},
};
prv_test_minute_data(samples, num_samples, exp_minutes, ARRAY_LENGTH... | {
memset(minute_raw_data, 0, k_minute_data_bytes);
s_num_captured_activity_sessions = 0;
time_t now = rtc_get_time();
int len = 20;
KAlgTestActivitySession exp_session = {
.activity = KAlgActivityType_Walk,
.start_utc = now + 10 * SECONDS_PER_MINUTE,
.steps = len * 80, // 80 steps... |
// --------------------------------------------------------------------------------------
// Test a run session of 30 minutes long that starts 10 minutes in that has a 2 minute
// gap in the middle
{
memset(minute_raw_data, 0, k_minute_data_bytes);
s_num_captured_activity_sessions = 0;
time_t now... |
h,
},
[BlobDBIdReminders] = {
.init = reminder_db_init,
.insert = reminder_db_insert,
.get_len = reminder_db_get_len,
.read = reminder_db_read,
.del = reminder_db_delete,
.flush = reminder_db_flush,
.is_dirty = reminder_db_is_dirty,
.get_dirty_list = reminder_db_get_dirty_list,
.... | if (db->insert) {
status_t rv = db->insert(key, key_len, val, val_len);
if (rv == S_SUCCESS) {
blob_db_event_put(BlobDBEventTypeInsert, db_id, key, key_len);
}
return rv;
} |
return E_INVALID_OPERATION;
}
int blob_db_get_len(BlobDBId db_id,
const uint8_t *key, int key_len) {
if (!prv_db_valid(db_id)) {
return E_RANGE;
}
const BlobDB *db = &s_blob_dbs[db_id];
if (db->get_len) {
return db->get_len(key, key_len);
}
return E_INVALID_OPERATION;
}
status_t blob_db_... |
le_tasks_set_current(PebbleTask_App);
app_window_stack_pop_all(false);
stub_pebble_tasks_set_current(PebbleTask_KernelMain);
modal_manager_pop_all();
fake_animation_cleanup();
cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), 0);
}
// Tests
////////////////////////////////////
void test_window_stack_... | window_stack_pop_all(stack, true) | ;
cl_assert_equal_i(window_stack_count(stack), 0);
cl_assert_equal_i(windows[0]->on_screen, false);
cl_assert_equal_i(windows[1]->on_screen, false);
cl_assert_equal_i(windows[2]->on_screen, false);
for (uint8_t idx = 0; idx < 3; idx++) {
window_destroy(windows[idx]);
}
}
void test_window_stack__inser... |
cl_assert_equal_i(0, scroll_layer_get_content_offset(&l.scroll_layer).y);
cl_assert_equal_b(false, s_content_available[ContentIndicatorDirectionUp]);
cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]);
const int FOCUSED = MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT;
const int NORMAL = men... | (&l, true, MenuRowAlignNone, false) | ;
cl_assert_equal_i(2 * NORMAL, l.selection.y);
cl_assert_equal_i(NORMAL - FOCUSED, scroll_layer_get_content_offset(&l.scroll_layer).y);
cl_assert_equal_i(FOCUSED, l.selection.h);
cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionUp]);
cl_assert_equal_b(true, s_content_available[ContentIndi... |
VSCommand_SectorLock;
}
static uint16_t prv_read_manufacturer_id(void) {
// Issue the DeviceIDEntry command to change to the ID-CFI Address Map. This means that reading from the bank will
// give us ID-CFI information instead of the normal flash contents. See Table 11.2 (ID/CFI Data) for all the
// content you c... | flash_impl_release() | ;
gpio_release(GPIOE);
gpio_release(GPIOD);
gpio_release(GPIOB);
}
void flash_impl_enable_write_protection(void) {
}
// Protects start_sector - end_sector, inclusive, from any kind of program
// operation
status_t flash_impl_write_protect(FlashAddress start_sector,
FlashAddress... |
t8_t *) &incomplete_put_msg,
sizeof(incomplete_put_msg));
assert_ack_count(0);
assert_nack_count(1);
}
void test_put_bytes__put_message_length_field_too_long(void) {
prv_receive_init_fw_object();
prv_process_and_reset_test_counters();
const size_t payload_size = 2;
const ... | if (max_batched_ops < 2) { // This race condition is not possible if we aren't pre-Acking
return;
} |
prv_receive_init(VALID_OBJECT_SIZE * num_ops, ObjectFirmware);
fake_comm_session_process_send_next();
fake_system_task_callbacks_invoke_pending();
uint8_t buffer[num_ops * VALID_OBJECT_SIZE];
for (size_t i = 0; i < sizeof(buffer); i += VALID_OBJECT_SIZE) {
uint32_t towrite = i;
memcpy(&buffer[i], &... |
le;
session->db_id = db_id;
session->dirty_list = dirty_list;
session->session_type = session_type;
session->timeout_timer = (const RegularTimerInfo) {
.cb = prv_timeout_timer_callback,
.cb_data = session,
};
s_sync_sessions = (BlobDBSyncSession *)list_prepend((ListNode *)s_sync_sessions,
... | regular_timer_remove_callback(&session->timeout_timer) | ;
}
if (session->session_type == BlobDBSyncSessionTypeDB) {
// Only send the sync done when syncing an entire db
blob_db_endpoint_send_sync_done(session->db_id);
}
list_remove((ListNode *)session, (ListNode **)&s_sync_sessions, NULL);
kernel_free(session);
}
}
}
|
e TEXT_COLOR (GColorBlack)
#define TEXT_ALIGNMENT (PBL_IF_RECT_ELSE(GTextAlignmentLeft, GTextAlignmentRight))
#define BACKGROUND_COLOR PBL_IF_COLOR_ELSE(GColorYellow, GColorWhite)
typedef enum WorkoutLayout {
WorkoutLayout_SingleMetric,
WorkoutLayout_StaticAndScrollable,
WorkoutLayout_TwoStaticAndScrollable,
} W... | i18n_noop("PACE (/KM)") | |
ibuted 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 "pulse_logging.h"
#include "pebble_tasks.h"
#include "logging_private.h"
#include "util/stack_in... | ((const char*) log_message, length, async) | ;
}
}
void kernel_pbl_log(LogBinaryMessage* log_message, bool async) {
kernel_pbl_log_serial(log_message, async);
if (!portIN_CRITICAL() && !mcu_state_is_isr() &&
xTaskGetSchedulerState() != taskSCHEDULER_SUSPENDED) {
kernel_pbl_log_flash(log_message, async);
}
}
void kernel_pbl_log_from_fault_hand... |
is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "gdraw_command_transforms.h"
#include "applib/applib_malloc.auto.h"
#include "applib/gr... | {
GPointCreateIndexCBContext *lookup = context;
const uint16_t num_points = gdraw_command_get_num_points(command);
for (uint16_t i = 0; i < num_points; i++) {
GPoint point = command->points[i];
if (command->type == GDrawCommandTypePrecisePath) {
point = gpoint_scalar_rshift(point, GPOINT_PRECISE_PR... |
GPointIndexLookup *gdraw_command_list_create_index_lookup(GDrawCommandList *list,
GPointComparator comparator, void *context, bool reverse) {
uint16_t num_points = 0;
const bool is_precise = false;
GPoint * const points = gdraw_command_list_collect_points(list, is_precise, &num_points);
if (!points) {
... |
session;
// Session metadata to make sure the session pointer corresponds to
// the same session that was added to the reopen list. This guards
// against the session being destroyed and another getting allocated
// to the same address.
Uuid app_uuid;
time_t timestamp;
uint32_t tag;
} DataLoggingReopenEnt... | if (soonest_ack_timeout == 0) {
// No one is waiting for ack, just stop the timer
new_timer_stop(s_endpoint_data.ack_timer);
return;
} |
RtcTicks current_ticks = rtc_get_ticks();
if (soonest_ack_timeout < current_ticks) {
// Handle the timeout immediately. This will result the in the timer being rescheduled if we're still
// waiting for an ack.
check_ack_timeout();
return;
}
// Convert from ticks to ms for the timer
RtcTicks... |
/*
* 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... | kernel_malloc_check(sizeof(SerializedTimelineItemHeader) + payload_size) | ;
uint8_t *write_ptr = buffer;
// serialize the header
timeline_item_serialize_header(item, (SerializedTimelineItemHeader *) write_ptr);
write_ptr += sizeof(SerializedTimelineItemHeader);
// serialize the attributes / actions
size_t bytes_serialized = timeline_item_serialize_payload(item, write_ptr, paylo... |
intptr_t)job->cb_data, 0);
cl_assert_equal_i(job->cached_execute_time, target);
cl_assert_equal_i(cron_service_get_job_count(), 1);
// Mutate the execute time to see if we actually effect change.
job->cached_execute_time = UINT32_MAX;
job->clock_change_tolerance = 10;
prv_clock_change(0, 0, false);
cl_as... | (job->cached_execute_time, base + offset) | ;
cl_assert_equal_i(cron_service_get_job_count(), 0);
}
void test_cron__1_basic(void) {
CronJob test_cron = {
.cb = prv_cron_callback,
.cb_data = (void*)0,
.minute = CRON_MINUTE_ANY,
.hour = CRON_HOUR_ANY,
.mday = CRON_MDAY_ANY,
.month = CRON_MONTH_ANY,
.may_be_instant = true,
};
... |
cDistanceMeters:
info->value_p = &state->step_data.distance_meters;
info->settings_key = ActivitySettingsKeyDistanceMetersHistory;
info->has_history = true;
break;
case ActivityMetricRestingKCalories:
info->value_p = &state->step_data.resting_kcalories;
info->settings_key = Activ... | mutex_lock_recursive(state->mutex) | ;
switch (metric) {
case ActivityMetricActiveSeconds:
case ActivityMetricSleepTotalSeconds:
case ActivityMetricSleepRestfulSeconds:
case ActivityMetricSleepEnterAtSeconds:
case ActivityMetricSleepExitAtSeconds:
// We only store minutes for these metrics. Convert before saving
value /=... |
app_menu_data_source_get_count(AppMenuDataSource *source) {
cl_assert(source);
return ARRAY_LENGTH(s_fake_app_nodes);
}
static GBitmap s_default_app_icon_bitmap;
void app_menu_data_source_enable_icons(AppMenuDataSource *source, uint32_t fallback_icon_id) {
cl_assert(source);
source->show_icons = true;
gbitm... | graphics_context_set_antialiased(&s_ctx, true) | ;
// Setup resources
fake_spi_flash_init(0, 0x1000000);
pfs_init(false);
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME,
false /* is_next */);
resource_init();
// Setup content indicators b... |
buted 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 "fake_spi_flash.h"
#include "flash_region/flash_region.h"
#include "system/status_codes.h"
#incl... | (block_start >= s_state.offset) | ;
if (block_start + block_size > s_state.offset + s_state.length) {
printf("-0x%x 0x%x\n", block_start + block_size, s_state.offset + s_state.length);
}
cl_assert(block_start + block_size <= s_state.offset + s_state.length);
memset(&s_state.storage[block_start - s_state.offset], 0xff, block_size);
}
void... |
prv_is_add_alarm_cell(cell_index) | ) {
GRect box;
uint32_t new_bitmap_resource = RESOURCE_ID_PLUS_ICON_BLACK;
if (!data->can_schedule_alarm) { // alarm limit reached
if (menu_cell_layer_is_highlighted(cell_layer)) {
if (data->show_limit_reached_text) {
// Trying to add a new alarm when list is already full
... | |
-176},
{ 1016, 56, -208},
{ 1080, 24, -72},
{ 1144, 96, -184},
{ 1200, 160, -376},
{ 1168, 128, -280},
{ 832, 96, -96},
{ 688, 56, -160},
{ 752, 136, -120},
// 16 seconds
{ 840, 200, -88},
{ 912, 272, -168},
{ 928, 296, -208},
{ 1192, 288, -112},
{ 1328, 432, -16... | { 1248, 192, -144},
{ 1080, 128, -112},
{ 792, 104, -72},
{ 720, 192, -72},
{ 752, 264, -88},
{ 792, 312, -80},
{ 880, 344, -56},
{ 960, 320, 0},
{ 1360, 376, 24},
{ 1272, 608, -64},
{ 968, 456, -120},
{ 1200, 408, -64},
{ 1192, 432, -144},
{ 1184, 392, -136},
... |
{ 960, 272, -8},
{ 1112, 352, 32},
{ 960, 440, 104},
{ 752, 464, -24},
{ 936, 344, 16},
{ 1152, 368, 120},
{ 1088, 344, 160},
{ 1056, 208, 160},
{ 1192, 72, 104},
{ 1280, 16, -8},
{ 1288, 16, -80},
{ 1240, 0, -48},
{ 1200, -32, -56},
{ 1416, 0, -120},
{ 1072,... |
0, 0x64, 5},
{ 0, 0x64, 0},
{ 0, 0x64, 5},
{ 8, 0x56, 24},
{ 8, 0x65, 23},
// 180: Local time: 10:55:00 PM
{ 0, 0x65, 19},
{ 21, 0x56, 24},
{ 0, 0x54, 0},
{ 0, 0x64, 7},
{ 0, 0x64, 6},
{ 0, 0x65, 17},
{ 0, 0x64, 11},
{ 0, 0x64, 15},
{ 8, 0x65, 20},
{ 20, 0x53,... | { 0, 0x1a, 0},
{ 0, 0x1a, 0},
{ 0, 0x1a, 0},
// 330: Local time: 01:24:00 AM
{ 0, 0x1a, 0},
{ 0, 0x1a, 0},
{ 0, 0x1a, 0},
{ 0, 0x1a, 0},
{ 0, 0x1a, 0},
{ 0, 0x1a, 0},
{ 0, 0x1a, 0},
{ 0, 0x16, 16},
{ 0, 0x25, 0},
{ 0, 0x25, 0},
{ 0, 0x25, 0},
{ 0, 0x25, 0}... | |
e.angle_start = angle_start,
.fill_radial_precise.angle_end = angle_end,
};
}
void graphics_fill_round_rect_by_value(GContext *ctx, GRect rect, uint16_t corner_radius,
GCornerMask corner_mask) {}
static MockCallRecordings s_layer_mark_dirty;
void layer_mark_dirty(Layer *la... | cl_assert_equal_i(1, s_fonts_get_system_font.call_count) | |
_t xTicksToWait, portBASE_TYPE xCopyPosition) {
PBL_ASSERTN(xQueue == QUEUE_HANDLE);
s_queue_value++;
return true;
}
QueueHandle_t xQueueGenericCreate(unsigned portBASE_TYPE uxQueueLength,
unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType) {
return QUEUE_HANDLE;
}
... | (metric, ACTIVITY_HISTORY_DAYS, actual) | ;
for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) {
ASSERT_EQUAL_I(actual[i], expected[i], file, line);
}
}
#define ASSERT_EQUAL_METRIC_HISTORY(metric, expected) \
prv_assert_equal_metric_history((metric), (expected), __FILE__, __LINE__)
static void prv_assert_dls_activity_record_present(ActivitySess... |
ad_subsampled(
&buffer, &client, item_size, out_buffer, 2);
cl_assert_equal_i(items_read, 2);
cl_assert_equal_m(out_buffer, "0k3o", 4);
items_read = shared_circular_buffer_read_subsampled(
&buffer, &client, item_size, out_buffer, 2);
cl_assert_equal_i(items_read, 1);
cl_assert_equal_m(out_buffer,... | shared_circular_buffer_read_subsampled(
&buffer, &client, item_size, out_buffer, 3) | , 3);
cl_assert_equal_m(out_buffer, "0a2c4e", 6);
// This should be a no-op. the "5f" sample should still be skipped on the next
// read.
subsampled_shared_circular_buffer_client_set_ratio(&client, 1, 2);
cl_assert_equal_i(shared_circular_buffer_read_subsampled(
&buffer, &client, item_size, out_buffer,... |
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_dial... | (&expandable_dialog->dialog, dialog_name) | |
/ this fault handler we'll end up in a perfectly safe place while we wait to die.
SCB->BFAR &= 1 << 7; // Clear Bus Fault Address Register "address is valid" bit
SCB->MMFAR &= 1 << 7; // Clear Memory Manage Address Register "address is valid" bit
SCB->CFSR &= ~0; // Clear the complete status register
// Redir... | if (mmfsr & (1 << 7)) {
uint32_t fault_addr = SCB->MMFAR;
MpuRegion mpu_region = mpu_get_region(MemoryRegion_IsrStackGuard);
if (memory_layout_is_pointer_in_region(&mpu_region, (void *)fault_addr)) {
stack_overflow = true;
} else {
mpu_region = mpu_get_region(MemoryRegion_TaskStackGuard);
... |
// If it's a stack overflow, backup the stack so that attempt_handle_hardware_fault() can jam in
// our landing zone to return to
if (stack_overflow) {
// Zero out the saved registers. We won't have new values in them, and we want to make sure
// that they don't contain bogus values from a fault we prev... |
d_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_some_sectors_from_beginning(void) {
cl_assert(system_flash_erase(FLASH_BASE, 128 KiB, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_full_flash(void) {
cl_assert(... | (!flash_locked, "Attempted to write to a locked flash") | |
_SUCCESS);
cl_assert(pfs_remove(fname) == S_SUCCESS);
cl_assert(pfs_remove(fname) == E_DOES_NOT_EXIST);
cl_assert(pfs_open(fname, OP_FLAG_READ, 0, 0) == E_DOES_NOT_EXIST);
}
#define NUM_ENTRIES 3
void test_pfs__close_and_remove(void) {
cl_assert(pfs_close_and_remove(-1) == E_INVALID_ARGUMENT);
// there shou... | {
snprintf(file_name, sizeof(file_name), "file%d", i);
int fd = pfs_open(file_name, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
cl_assert(pfs_close(fd) == S_SUCCESS);
} |
cl_assert(pfs_active_in_region(0, pfs_get_size()));
// delete every page and make sure pfs is active
for (int i = 0; i < num_pages(); i++) {
snprintf(file_name, sizeof(file_name), "file%d", i);
cl_assert(pfs_remove(file_name) == S_SUCCESS);
}
cl_assert(pfs_active_in_region(0, pfs_get_size()));
/... |
d.attribute == attribute);
s_pending_notified.active = false;
}
// Setup
void test_app_smartstrap__initialize(void) {
smartstrap_attribute_init();
app_smartstrap_subscribe((SmartstrapHandlers) {
.did_read = prv_did_read_handler,
.did_write = prv_did_write_handler,
.notified = prv_notified_handler
... | (smartstrap_attribute_send_pending()) | ;
cl_assert(!s_pending_did_write.active);
// attempt to issue another read request (should report busy)
assert_result_busy(app_smartstrap_attribute_read(attr));
// check that it was sent successfully
SmartstrapRequest request = {
.service_id = 0x1111,
.attribute_id = 0x2222,
.write_mbuf = NULL,
... |
/
#include "crashed_ui.h"
#include "services/common/light.h"
#include "applib/ui/dialogs/dialog.h"
#include "applib/ui/dialogs/actionable_dialog.h"
#include "applib/ui/dialogs/expandable_dialog.h"
#include "applib/ui/window_stack.h"
#include "kernel/event_loop.h"
#include "kernel/pbl_malloc.h"
#include "kernel/ui/mo... | (check_icon, RESOURCE_ID_ACTION_BAR_ICON_CHECK) | ;
GBitmap *x_icon = &data->x_icon;
gbitmap_init_with_resource(x_icon, RESOURCE_ID_ACTION_BAR_ICON_X);
// Initialize and configure the worker crash dialog's action bar
ActionBarLayer *action_bar = &data->action_bar;
action_bar_layer_init(action_bar);
action_bar_layer_set_icon(action_bar, BUTTON_ID_UP, check... |
=
activity_private_compute_resting_calories(elapsed_minutes);
new_history.values[i] = ROUND(cur_day_resting_calories, ACTIVITY_CALORIES_PER_KCAL);
} else {
new_history.values[i] = ROUND(full_day_resting_calories, ACTIVITY_CALORIES_PER_KCAL);
}
}
... | syscall_assert_userspace_buffer(history, history_len * sizeof(*history)) | ;
}
}
return activity_get_metric(metric, history_len, history);
}
|
event used to update the Settings app.
prv_put_disconnection_event();
}
static void prv_send_state_change_event(void) {
PBL_LOG(LOG_LEVEL_DEBUG, "----> Sending a BT state event");
PebbleEvent event = {
.type = PEBBLE_BT_STATE_EVENT,
.bluetooth = {
.state = {
.airplane = s_comm_airplane_mod... | prv_send_state_change_event() | ;
}
mutex_unlock(s_comm_state_change_mutex);
}
void bt_ctl_reset_bluetooth(void) {
if (bt_ctl_is_bluetooth_active()) {
system_task_add_callback(prv_bt_ctl_reset_bluetooth_callback, NULL);
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Bluetooth is disabled, reset aborted");
}
}
void command_bt_airplane_mode(con... |
bool second_half,
AnimationProgress adjusted_progress) {
CenterFocusSelectionAnimationState state = prv_center_focus_animation_state(animation);
// values as seen in the design videos
const int16_t move_in_dist = 16;
const int16_t move_out_dist = 4;
const int1... | (menu_layer, MenuRowAlignNone, selection_animated) | ;
static const PropertyAnimationImplementation s_center_focus_selection_animation_in_out_impl = {
.base = {
.setup = prv_center_focus_animation_setup,
.update = prv_center_focus_animation_update_in_and_out,
.teardown = prv_center_focus_animation_teardown,
}
};
static const PropertyAnima... |
, else it reflects the error code
static NOINLINE bool file_found_in_cache(const char *name, uint8_t op_flags, int *fd_used) {
int fd, res;
bool is_tmp = ((op_flags & OP_FLAG_OVERWRITE) != 0);
bool file_found = false;
if ((res = get_avail_fd(name, &fd, is_tmp)) == NoFDAvail) {
res = E_OUT_OF_RESOURCES;
... | mark_fd_free(fd) | |
);
const GColor window_bg_color = PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite);
window_set_background_color(window, window_bg_color);
Layer *root_layer = window_get_root_layer(window);
const GRect *root_frame = &root_layer->frame;
Layer *mic_dot_layer = &data->mic_window.mic_dot_layer;
GRect dot_frame... | (root_layer, (Layer *)&data->mic_window.icon_layer) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (!alerts_should_notify_for_type(AlertInvalid)) | ;
}
void test_alerts__disabled(void) {
cl_assert(alerts_get_mask() == AlertMaskAllOn);
// Should not allow any notifications through
alerts_set_mask(AlertMaskAllOff);
cl_assert(!alerts_should_notify_for_type(AlertInvalid));
cl_assert(!alerts_should_notify_for_type(AlertMobile));
cl_assert(!alerts_should_... |
2, -792},
{ 56, 592, -808},
{ 48, 584, -792},
{ 56, 600, -800},
{ 64, 592, -800},
{ 56, 592, -792},
{ 48, 600, -792},
{ 48, 592, -800},
{ 56, 600, -800},
{ 56, 592, -800},
{ 56, 600, -792},
{ 56, 592, -808},
// 89 seconds
{ 56, 592, -800},
{ 48, 592, -800},
{ ... | { -136, 544, -560},
{ 24, 864, -624},
{ 56, 776, -552},
{ -48, 688, -360},
{ -96, 776, -400},
{ -64, 808, -504},
{ 24, 920, -528},
{ -16, 1056, -504},
{ 80, 976, -728},
{ -32, 824, -512},
{ -8, 920, -352},
{ -16, 792, -432},
{ -64, 848, -448},
{ 16, 808, -584},
... |
// 97 seconds
{ 32, 584, -824},
{ 32, 576, -832},
{ 24, 568, -832},
{ 8, 544, -824},
{ 32, 568, -856},
{ 8, 560, -840},
{ 24, 544, -824},
{ 24, 568, -800},
{ 32, 600, -816},
{ 32, 576, -832},
{ 24, 536, -832},
{ 32, 552, -840},
{ 16, 600, -824},
{ 16, 584, -7... |
ivity_get_step_averages_values_weekday.out.averages,
sizeof(*averages));
return s_sys_activity_get_step_averages_values_weekday.out.result;
}
}
typedef struct {
HealthActivity activity;
time_t time_start;
time_t time_end;
void *context;
} HealthActivityCBData;
static HealthActivityCBData s_pr... | health_service_sum_today(HealthMetricStepCount) | ;
cl_assert_equal_i(0, result);
}
void test_health__sum_today(void) {
s_sys_activity_get_metric_values.out.history[0] = 123;
s_sys_activity_get_metric_values.out.history[1] = 456;
HealthValue result = health_service_sum_today(HealthMetricStepCount);
cl_assert_equal_i(123, result);
cl_assert_equal_i(s_sys_a... |
tmap *bitmap = test_data->bitmap_create_func(test_image_filename);
cl_assert(bitmap);
cl_assert(gbitmap_get_format(bitmap) == test_data->expected_test_image_bitmap_format);
// Draw the two variations of the test image at GPointZero
prv_composite_test_draw_bitmap(&s_ctx, bitmap, GPointZero, compositing_... | gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
void test_graphics_draw_bitmap__offset_bitmap_layer_inside(void) {
prv_offset_bitmap_layer_test(GPointZero);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_graphics_draw_bitmap__offset_bitmap_layer_across_x(void) {
prv_offset_bitmap_layer_test(GPoint(25, 0));
cl_check(gbitmap_pb... |
/*
* 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... | (!airplane_mode) | ;
data->toggle_state =
airplane_mode ? ToggleStateEnablingBluetooth : ToggleStateDisablingBluetooth;
settings_menu_mark_dirty(SettingsMenuItemBluetooth);
}
bool is_remote_connected(StoredRemote* remote) {
switch (remote->type) {
case StoredRemoteTypeBTClassic:
return remote->classic.connected;
... |
ivityState *state = activity_private_state();
if (median_out) {
*median_out = state->hr.metrics.previous_median_bpm;
}
if (heart_rate_total_weight_x100_out) {
*heart_rate_total_weight_x100_out = state->hr.metrics.previous_median_total_weight_x100;
}
}
// -----------------------------------------------... | (elapsed_minutes) | ;
new_history.values[i] = ROUND(cur_day_resting_calories, ACTIVITY_CALORIES_PER_KCAL);
} else {
new_history.values[i] = ROUND(full_day_resting_calories, ACTIVITY_CALORIES_PER_KCAL);
}
}
}
// Copy values from old history into correct slot in new history
... |
ice_if_needed(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 = conn... | PBL_ASSERTN(ble_gatts_register_service(&ctx->svc.start_h,
&ctx->att_hdl.data,
&ctx->att_hdl.cccd,
&ctx->att_hdl.meta,
&ctx->att_hdl.data_wr,
... | |
SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_ADR_TX_MD, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST_TX_MD, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_EXT_BYTE, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST_WB, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST, 0x0);
REG_SETF(QSPIC, QSPI... | REG_SETF(CACHE, CACHE_ASSOCCFG_REG, CACHE_ASSOC, 0x2) | ;
REG_SETF(CACHE, CACHE_CTRL2_REG, ENABLE_ALSO_QSPIFLASH_CACHED, 0x0);
REG_SETF(CACHE, CACHE_CTRL2_REG, ENABLE_ALSO_OTP_CACHED, 0x0);
REG_SETF(CACHE, CACHE_CTRL2_REG, CACHE_CGEN, 0x0);
REG_SETF(CACHE, CACHE_CTRL2_REG, CACHE_WEN, 0x0);
REG_SETF(CACHE, CACHE_CTRL2_REG, CACHE_LEN, 0x0);
REG_SETF(CACHE, CACHE... |
PebbleTask consumer_task,
size_t consumer_data_length) {
prv_lock();
{
PBL_ASSERTN(!prv_consumer_for_tag(tag));
AppOutboxConsumer *consumer = &s_app_outbox_consumer[tag];
consumer->message_handler = message_handler;
consumer->consumer_data_leng... | ((PebbleMutex *)s_app_outbox_mutex) | ;
s_app_outbox_mutex = NULL;
}
uint32_t app_outbox_service_max_pending_messages(AppOutboxServiceTag tag) {
return s_app_outbox_sender_defs[tag].max_pending_messages;
}
uint32_t app_outbox_service_max_message_length(AppOutboxServiceTag tag) {
return s_app_outbox_sender_defs[tag].max_length;
}
|
prv_create_kino_reel_with_timeline_resource(
timeline_layout, icon_res_size, resource, fallback_resource, app_id) | ;
if (!icon_reel) {
return;
}
GSize icon_size = kino_reel_get_size(icon_reel);
const GSize max_icon_size = timeline_resources_get_gsize(icon_res_size);
if ((icon_size.w > max_icon_size.w) || (icon_size.h > max_icon_size.h)) {
// The icon is too large, use the fallback instead
kino_reel_destroy(ic... | |
.user_write = false
};
static const MpuRegion s_app_stack_guard_region = {
.region_num = MemoryRegion_TaskStackGuard,
.enabled = true,
.base_address = (uint32_t) __APP_RAM__,
.size = (uint32_t) __stack_guard_size__,
.cache_policy = MpuCachePolicy_NotCacheable,
.priv_read = false,
.priv_write = false,
... | memory_layout_is_pointer_in_region(region, buf) | && memory_layout_is_pointer_in_region(region, (char *)buf + length - 1);
}
bool memory_layout_is_cstring_in_region(const MpuRegion *region, const char *str, size_t max_length) {
uintptr_t region_end = region->base_address + region->size;
if ((uintptr_t) str < region->base_address || (uintptr_t) str >= region_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... | (resource_id != UINT32_MAX) | ;
KinoReel *kino_reel = kino_reel_create_with_resource(resource_id);
cl_assert(kino_reel);
cl_assert(kino_reel_get_type(kino_reel) == KinoReelTypeGBitmapSequence);
// We expect the default 0 because get_data_size hasn't been implemented for GBitmapSequence
cl_assert_equal_i(kino_reel_get_data_size(kino_reel)... |
ALLED(prv_draw_rect_stroked(&context, &GRect(10, 20, 40, 10), SW_ODD));
setup_test(&context, false, SW_ODD, GColorBlack, GColorBlack, false);
graphics_draw_circle(&context, GPoint(50, 50), 10);
ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_ODD));
setup_test(&context, false... | (prv_draw_rect_stroked(&context, &GRect(10, 20, 40, 10), SW_ODD)) | ;
#endif
setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, false);
graphics_draw_circle(&context, GPoint(50, 50), 10);
#if PBL_COLOR
ASSERT_CALLED(graphics_circle_draw_stroked_aa(&context, GPoint(50, 50), 10, SW_ODD));
#else
ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50),... |
e sure stress test has at least 1 iteration or its another test case
status = run_flash_test_case(test_case_num, iterations);
}
char buffer[80];
if (status == 0) {
prompt_send_response_fmt(buffer, sizeof(buffer), "PASS: TEST CASE %"PRId32, test_case_num);
} else {
prompt_send_response_fmt(buffer, s... | (buffer, sizeof(buffer),
"(Sub)Sector at addr: 0x%"PRIX32" not really erased. is_subsector: %d",
addr, is_subsector) | ;
goto done;
}
}
}
}
done:
return erased;
}
// ARG:
// 0 - Only show sectors
// 1 - Show subsectors too if sector is not erased
void command_flash_show_erased_sectors(const char *arg) {
const bool show_subsectors = (atoi(arg) == 1);
char buffer[64];
uint32_t addr = 0;
while (a... |
eLayer *layer = (TimelineLayer *)context;
if (timeline_layer_should_animate_day_separator(layer)) {
prv_rel_bar_reset_offsets(&layer->relbar_layer, RelationshipBarOffsetTypeCurr);
layer_set_hidden(&layer->relbar_layer.layer, true);
return;
}
layer_set_hidden(&layer->relbar_layer.layer, false);
if (... | {
curr_rel_bar_anim = prv_create_curr_rel_bar_animation(layer, duration, interpolate);
} |
Animation *rel_bar_anim = NULL;
if (prev_rel_bar_anim && curr_rel_bar_anim) {
rel_bar_anim = animation_spawn_create(prev_rel_bar_anim, curr_rel_bar_anim, NULL);
} else if (prev_rel_bar_anim) {
rel_bar_anim = prev_rel_bar_anim;
} else {
rel_bar_anim = curr_rel_bar_anim;
}
if (rel_bar_anim) {
... |
(const uint8_t *)&unsupported, sizeof(unsupported)));
// Expect No UnsupportedError!
// Immediately go back to AwaitingResetRequest:
cl_assert_equal_i(rocky_api_app_message_get_state(), PostMessageStateAwaitingResetRequest);
EXPECT_OUTBOX_NO_MESSAGE_PENDING();
}
void test_rocky_api_app... | ASSERT_JS_GLOBAL_EQUALS_B("isCalled", false) | ;
RCV_RESET_REQUEST();
cl_assert_equal_i(rocky_api_app_message_get_state(),
PostMessageStateAwaitingResetCompleteRemoteInitiated);
EXPECT_OUTBOX_RESET_COMPLETE_PENDING();
ASSERT_JS_GLOBAL_EQUALS_B("isCalled", true);
// TODO: assert:
// - flushed recv chunk reassembly buffer
}
void t... |
gging__invalid_session_use_after_close(void) {
uint32_t data[] = { 1, 2, 3 };
DataLoggingSessionRef session = data_logging_create(0x1234, DATA_LOGGING_UINT, 4, false);
cl_assert(session);
fake_system_task_callbacks_invoke_pending();
data_logging_finish(session);
fake_system_task_callbacks_invoke_pending()... | (rcv_buffer) | ;
}
// ----------------------------------------------------------------------------------------
// Test using the endpoint to empty the session
void test_data_logging__send_session_1(void) {
prv_endpoint_test(true /*buffered*/, 1, 1000);
}
// ------------------------------------------------------------------------... |
) ? delta_0 : delta_b;
return (int16_t) (value + delta * normalized / ANIMATION_NORMALIZED_MAX);
}
GPoint gpoint_attract_to_square(GPoint point, GSize size, int32_t normalized) {
// hacky to square - TODO: implement for real
point.y += 1;
point = GPoint(
prv_int_attract_to(point.x, size.w, normalized),
... | {
AngleComparatorContext *ctx = context;
const int16_t angle_a = ABS(positive_modulo(
(atan2_lookup(a->y - ctx->origin.y, a->x - ctx->origin.x) + ctx->angle), TRIG_MAX_ANGLE) -
TRIG_MAX_ANGLE / 2);
const int16_t angle_b = ABS(positive_modulo(
(atan2_lookup(b->y - ctx->origin.y, b->x - ctx->origi... |
GPointIndexLookup *gdraw_command_list_create_index_lookup_by_angle(GDrawCommandList *list,
GPoint origin, int32_t angle) {
AngleComparatorContext ctx = {
.origin = origin,
.angle = angle,
};
return gdraw_command_list_create_index_lookup(... |
ite_scatter(const SPISlavePort *slave,
const SPIScatterGather *sc_info,
size_t num_sg) {
prv_spi_acquire_helper(slave);
spi_ll_slave_burst_read_write_scatter(slave, sc_info, num_sg);
prv_spi_release_helper(slave);
}
void spi_slave_set_frequency(const SPIS... | prv_spi_transmit_flush_blocking(slave->spi_bus) | ;
}
}
void spi_ll_slave_burst_read_write(const SPISlavePort *slave,
const void *out,
void *in,
size_t len) {
PBL_ASSERTN(slave->slave_state->initialized);
PBL_ASSERTN(slave->slave_state->acquired);
const ui... |
zeof(read));
if (read != 0xffffffff) {
PBL_LOG_SYNC(LOG_LEVEL_INFO, ">>>> Address 0x%lx failed to erase: 0x%lx", i, read);
success = false;
}
}
return success;
}
// region: region to check (and possibly write)
// use_rand: write random values
// perform_writes: perform writes if true, else see... | (region, true, true) | |
/*
* 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(ctx) | ;
return graphics_capture_frame_buffer_format(ctx, CANVAS_GBITMAP_FORMAT);
}
// Overrides same function in graphics.c; we need to do this so we can release the framebuffer we're
// using even though its format doesn't match GBITMAP_NATIVE_FORMAT (see comment for mocked
// graphics_capture_frame_buffer() above)
bool ... |
ication(time_t notif_time, ActivitySession *session,
Uuid *pin_uuid) {
const int hours = session->length_min / MINUTES_PER_HOUR;
const int minutes = session->length_min % MINUTES_PER_HOUR;
// Enough to fit the filled out format string below and i18n variants
const ... | (ActivityMetricSleepState, 1, &sleep_state) | ;
if (sleep_state != ActivitySleepStateAwake) {
INSIGHTS_LOG_DEBUG("Not adding sleep pin - still asleep");
return;
}
// Get the sleep bounds for today and see if we actually have sleep data. The sleep bounds
// do NOT include naps
time_t sleep_enter_utc = 0;
time_t sleep_exit_utc = 0;
activity_se... |
/*
* 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(text_layer) | ;
const GColor bg_color = text_layer->background_color;
if (!(gcolor_equal(bg_color, GColorClear))) {
graphics_context_set_fill_color(ctx, bg_color);
graphics_fill_rect(ctx, &text_layer->layer.bounds);
}
if (text_layer->text && strlen(text_layer->text) > 0) {
graphics_context_set_text_color(ctx, tex... |
oid prv_dispatch_data(void) {
mutex_lock_recursive(s_accel_manager_mutex);
AccelManagerState * state = (AccelManagerState *)s_data_subscribers;
while (state) {
if (!state->raw_buffer) {
state = (AccelManagerState *)state->list_node.next;
continue;
}
// if subscribed but not looking for a... | (ANALYTICS_DEVICE_METRIC_ACCEL_SAMPLE_COUNT, samps_collected,
AnalyticsClient_System) | ;
}
void accel_manager_init(void) {
s_accel_manager_mutex = mutex_create_recursive();
shared_circular_buffer_init(&s_buffer, s_buffer_storage,
sizeof(s_buffer_storage));
event_service_init(PEBBLE_ACCEL_SHAKE_EVENT, &prv_shake_add_subscriber_cb,
&prv_shake_remove_subscriber_cb);
event_service_ini... |
lt = prv_calculate_time_range(now - 100, now - 200, NULL);
cl_assert_equal_b(result, false);
}
void test_health__range_to_day_id_clamps_values(void) {
const time_t now = rtc_get_time();
bool result;
HealthServiceTimeRange range;
// clamps value that goes into the future
result = prv_calculate_time_range(n... | (values[2], 1000) | ;
// ensure we can handle empty sets
values[0] = 1000;
prv_adjust_value_boundaries(values, 0, &range);
cl_assert_equal_i(values[0], 1000);
cl_assert_equal_i(values[1], 1000);
cl_assert_equal_i(values[2], 1000);
// ensure we can handle empty ranges
range.num_days = 0;
prv_adjust_value_boundaries(valu... |
pp_db_get_install_id_for_uuid(&bg_counter.uuid);
app_cache_add_entry(bg_counter_id, bg_counter_size /* size */);
cl_assert_equal_i(1, bg_counter_id);
// load first app
char filename_buf[32];
app_storage_get_file_name(filename_buf, sizeof(filename_buf), 1,
PebbleTask_App);
load_f... | {
cl_assert_equal_b(true, prv_app_install_is_watchface(tictoc_id));
cl_assert_equal_b(false, prv_app_install_is_watchface(music_id));
cl_assert_equal_b(false, prv_app_install_is_watchface(sports_id));
cl_assert_equal_b(false, prv_app_install_is_watchface(bg_counter_id));
cl_assert_equal_b(false, prv_app_inst... |
void test_app_install_manager__get_uuid_for_install_id(void) {
Uuid uuid = {};
cl_assert_equal_b(false, app_install_get_uuid_for_install_id(INSTALL_ID_INVALID, &uuid));
cl_assert_equal_uuid(uuid, UUID_INVALID);
cl_assert_equal_b(true, app_install_get_uuid_for_install_id(tictoc_id, &uuid));
cl_assert_equal_... |
< rot_start.x.raw_value ?
rot_end.x.raw_value : rot_start.x.raw_value;
int16_t max_x = rot_end.x.raw_value > rot_start.x.raw_value ?
rot_end.x.raw_value : rot_start.x.raw_value;
if (x.raw_value - (delta.raw_value / 2) < min_x) {
... | applib_zalloc(path->num_points * sizeof(int16_t)) | ;
// If either malloc failed, log message and cleanup
if (!intersections_up || !intersections_down) {
APP_LOG(APP_LOG_LEVEL_ERROR, GPATH_ERROR);
goto cleanup;
}
int intersection_up_count;
int intersection_down_count;
const int16_t clip_min_y = ctx->draw_state.clip_box.origin.y
- ctx->draw_s... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&p, 1, s_offset) | |
CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , 1, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r1_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1);
... | (gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_bottomleft.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerBottomRight);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_bottomright.${BIT_DEPTH_NAME}.pbi"));
}
void... |
ound
cl_assert_equal_i(s_num_requested_app_attributes, 1);
cl_assert_equal_i(s_num_ds_notifications_received, 2);
}
void test_ancs__ancs_invalid_param(void) {
NSNotification ns_notification = {
.event_id = EventIDNotificationAdded,
.event_flags = 0,
.category_id = CategoryIDSocial,
.category_c... | prv_send_notification((uint8_t *)&s_unknown_app_dict) | ;
prv_cmp_last_received_notification(&s_unknown_app_parsed_item);
// Make sure both apps attributes were requested (Messages and FakeApp)
cl_assert_equal_i(s_num_requested_app_attributes, 2);
// Test a recognized app with a unique title
prv_send_notification((uint8_t *)&s_message_dict);
prv_cmp_last_recei... |
se for the specific language governing permissions and
* limitations under the License.
*/
#include "menu_layer_right_icon.h"
#include "applib/app.h"
#include "applib/ui/ui.h"
#include "kernel/pbl_malloc.h"
#include "process_state/app_state/app_state.h"
#include "resource/resource_ids.auto.h"
#include "system/loggi... | {
AppData *data = app_state_get_user_data();
menu_layer_deinit(&data->menu_layer);
app_free(data);
} | |
Down, fg_color,
bg_color, GAlignBottom);
}
}
#endif
}
static void prv_update_aml_cache(ActionMenuLayer *aml, int selected_index) {
prv_unschedule_item_animation(aml);
if (aml->layout_cache.item_heights != NULL) {
applib_free(aml->layout_cache.item_heights);
aml->la... | (aml, &frame) | |
compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ei... | circular_cache_get(&s_test_cache, &s_test_item[1]) | |
nt8(app_data->out_iter, AppMessageKey_Status, AppStatus_Enabled_1HZ);
#if CAPABILITY_HAS_BUILTIN_HRM
if (mfg_info_is_hrm_present()) {
AS7000InfoRecord hrm_info = {};
as7000_get_version_info(HRM, &hrm_info);
dict_write_uint8(app_data->out_iter, AppMessageKey_HRMProtocolVersionMajor,
h... | if (hrm->debug->ppg_data.num_samples != 20) {
PBL_LOG_COLOR(LOG_LEVEL_DEBUG, LOG_COLOR_CYAN, "Only got %"PRIu16" samples!",
hrm->debug->ppg_data.num_samples);
}
if (hrm->debug->accel_data.num_samples) {
HRMAccelData *d = &hrm->debug->accel_data;
dict_writ... |
}
}
static void prv_enable_hrm(void) {
AppData *app_data = app_state_get_user_data();
app_data->hrm_event_info = (EventServiceInfo) {
.type = PEBBLE_HRM_EVENT,
.handler = prv_handle_hrm_data,
};
event_service_client_subscribe(&app_data->hrm_event_info);
// TODO: Let the mobile app control this?
... |
/*
* 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... | (CLAR_CATEGORY_DEFAULT) | ;
if (!suite->categories)
return clar_category_in_list(
&_clar_categorize_enabled, CLAR_CATEGORY_DEFAULT);
for (scan = suite->categories; *scan != NULL; scan++)
if (clar_category_in_list(&_clar_categorize_enabled, *scan))
return 1;
return 0;
}
|
repare draw_state for the current layer
// it will not be stored and restored but recalculated from the root
// for every layer
for (unsigned int level = 0; level <= current_depth; level++) {
const Layer *levels_layer = stack[level];
if (levels_layer->clips) {
const GRect levels_layer_fr... | (PebbleTask_App) | ;
if (!layer || !bounds_out) {
return;
}
GRect area;
unobstructed_area_service_get_area(app_state_get_unobstructed_area_state(), &area);
// Convert the area from screen coordinates to layer coordinates
gpoint_sub_eq(&area.origin, layer_convert_point_to_screen(layer->parent, GPointZero));
layer_get_bou... |
st_data, BUFFER_SIZE));
app_inbox_service_cancel(AppInboxServiceTagUnitTest);
// No events expected:
assert_num_callback_events(0);
// The buffer should be completely available again:
cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest,
... | app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data,
BUFFER_SIZE) | );
cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest));
// One callback event scheduled:
assert_num_callback_events(1);
prv_process_callback_events();
assert_num_callback_events(0);
}
void test_app_inbox__consume_inbox_closed_in_mean_time(void) {
prv_create_test_inbox_and_begin_wri... |
ys = &custom_schedule2 });
prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_CUSTOM, custom_schedule2);
bool custom_schedule3[7] = {true, true, true, true, true, true, true};
id = alarm_create(&(AlarmInfo) { .hour = 5, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &custom_schedule3 });
prv_asse... | (&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_EVERYDAY }) | ;
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
bool custom_schedule1[7] = {true, false, true, false, false, true, true};
alarm_set_custom(id, custom_schedule1);
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_CUSTOM, custom_schedule1);
id = alarm_create(&(AlarmIn... |
/*
* 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... | grect_inset_internal(rect, 16, 0) | |
(int)graph_card->selection > graph_card->current_day)));
}
size_t health_graph_format_weekday_prefix(HealthGraphCard *graph_card, char *buffer,
size_t buffer_size) {
if (prv_is_selection_last_weekday(graph_card)) {
// The graph starts on Monday, so wrap around the s... | layer_set_update_proc(&graph_card->layer, prv_health_graph_layer_update_proc) | ;
health_graph_card_configure(graph_card, config);
graph_card->title_font = fonts_get_system_font(PBL_IF_RECT_ELSE(FONT_KEY_GOTHIC_24_BOLD,
FONT_KEY_GOTHIC_18_BOLD));
graph_card->legend_font = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);... |
phics_context_set_fill_color(&ctx, GColorRed);
ctx.draw_state.fill_color.a = 0;
graphics_fill_rect(&ctx, &GRect(20, 20, 70, 20));
ctx.draw_state.fill_color.a = 1;
graphics_fill_rect(&ctx, &GRect(20, 50, 70, 20));
ctx.draw_state.fill_color.a = 2;
graphics_fill_rect(&ctx, &GRect(20, 80, 70, 20));
ctx.draw_s... | graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 2, GCornersAll) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r2_aa_no_clip.${BIT_DEPTH_NAME}.pbi"));
// TODO: Remove these #ifdefs in PBL-15916 when support for non-antialiased rounded rect
#if SCREEN_COLOR_DEPTH_BITS == 8
// TODO: Fix left corners PBL-15915
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGI... |
register_value);
if (success) {
// We enabled the rail!
*ref_count = 1;
// We need to wait a bit for the rail to stabilize before continuing to use the device.
// It takes 2.6ms for the LDO rails to ramp.
delay_ms(3);
return true;
}
return false;
... | {
gpio_output_set(&BOARD_CONFIG_POWER.rail_4V5_ctrl, enabled);
} |
void set_6V6_power_state(bool enabled) {
if (BOARD_CONFIG_POWER.rail_6V6_ctrl.gpio) {
gpio_output_set(&BOARD_CONFIG_POWER.rail_6V6_ctrl, enabled);
}
}
|
const HealthServiceTimeRange *range);
bool prv_activity_session_matches(const ActivitySession *session, HealthActivityMask mask,
time_t time_start, time_t time_end);
int64_t prv_session_compare(const ActivitySession *a, const ActivitySession *b,
... | {
sessions[i] = s_sys_activity_get_sessions_values.out.sessions[i];
} |
*num_sessions = s_sys_activity_get_sessions_values.out.num_sessions;
return s_sys_activity_get_sessions_values.out.result;
}
typedef struct {
struct {
uint16_t day_of_week;
} in;
struct {
ActivityMetricAverages averages;
bool result;
} out;
} sys_activity_get_step_averages_values;
static sy... |
/*
* 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_INIT_EMPTY) | ;
rocky_api_watchface_init();
}
bool rocky_is_snapshot(const uint8_t *buffer, size_t buffer_size) {
#if CAPABILITY_HAS_JAVASCRIPT
const size_t header_length = sizeof(ROCKY_EXPECTED_SNAPSHOT_HEADER);
if (buffer_size < header_length ||
memcmp(ROCKY_EXPECTED_SNAPSHOT_HEADER.signature,
buffer,
... |
dress(void) {
cl_will_return(bt_persistent_storage_has_pinned_ble_pairings, false);
cl_will_return(bt_persistent_storage_set_ble_pinned_address, true);
cl_will_return(bt_driver_set_local_address, 0);
s_last_bt_persist_pinned_addr_is_null = true;
bt_local_addr_init();
}
static void prv_assert_driver_addr_is_n... | (bt_driver_set_local_address, 0) | |
);
// Switch to the app state to push a window
stub_pebble_tasks_set_current(PebbleTask_App);
window_stack_push(app_stack, window1, true);
cl_assert_equal_i(window_stack_count(app_stack), 1);
cl_assert_equal_i(window1->on_screen, true);
cl_assert_equal_p(s_last_click_configured_window, window1);
// Sw... | cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT) | ;
cl_assert_equal_i(event.app_focus.in_focus, false);
cl_assert_equal_i(window_stack_count(app_stack), 1);
// Pop the modal window off the stack
window_stack_remove(window2, true);
cl_assert_equal_i(window_stack_count(modal_stack), 0);
cl_assert_equal_i(window2->on_screen, false);
// Switch to app hap... |
time_t timestamp,
ANCSProperty properties) {
const ANCSAttribute *app_id = notif_attributes[FetchedNotifAttributeIndexAppID];
const ANCSAttribute *display_name = app_attributes[FetchedAppAttributeIndexDisplayName];
const ANCSAttri... | (action, app_id, subtitle) | ) {
continue;
}
attributes_per_action[action_idx++] = action->attr_list.num_attributes;
}
}
int num_attr = ((title && title->length > 0 && !has_multimedia) ? 1 : 0) +
((display_name && display_name->length > 0) ? 1 : 0) +
((subtitle->length > 0) ? 1 : 0) +... |
sizeof(s_meta_v0_system) - 1 /* missing last byte */,
BLEGATTErrorSuccess);
// No client created:
cl_assert_equal_i(ppogatt_client_count(), 0);
cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), false);
}
void test_ppogatt__handles_meta_v1(voi... | (&s_meta_v0_system.app_uuid) | ;
}
void test_ppogatt__invalidate_characteristic_refs_immediately_after_update(void) {
prv_notify_services_discovered(1);
ppogatt_handle_service_removed(&s_characteristics[0][0], PPoGATTCharacteristicNum);
const bool can_handle =
ppogatt_can_handle_characteristic(s_characteristics[0][PPoGATTChar... |
der.id));
cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id));
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_i... | timeline_model_get_iter_state_with_timeline_idx(2) | );
cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3));
cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(4));
cl_assert(timeline_model_iter_prev(&new_idx, NULL));
cl_assert_equal_i(new_idx, 1);
cl_assert_equal_i(timeli... |
ll_id, &entry);
// Construct the crash reason string (copied by the dialog, so we don't have to free it ourselves)
// "Worker " is 7, optional space is 1, up to 15 for app name, rest of string is 32, 1 for '\0'
const uint8_t MAX_APP_NAME_STRING_LENGTH = 15;
const uint8_t CRASH_REASON_BUFFER_SIZE = 7 + 1 + MAX_... | {
launcher_task_add_callback(prv_push_reset_dialog, YOUR_PEBBLE_RESET);
} | |
RIGIN_RECT_NO_CLIP, true, 4);
for (int angle_offset=0; angle_offset < 4; angle_offset++) {
graphics_draw_arc_precise_internal(&ctx, center, radius, angle_start, angle_end);
center.x.integer += (angle_offset % 2 == 0) ? DRAWING_SPACING : -DRAWING_SPACING;
center.y.integer += (angle_offset... | (prv_calc_draw_config_ellipsis(TO_TRIG(0), TO_TRIG(180)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerTopRight},
.full_quadrants = GCornersRight,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(180),GCornerBottomLeft}
})) | ;
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(180), TO_TRIG(360)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(180),GCornerBottomLeft},
.full_quadrants = GCornersLeft,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerTopRight}
}));
cl_assert_equa... |
font_key_japanese = FONT_KEY_MINCHO_24_PAIR;
#else
const char *font_key_default = FONT_KEY_GOTHIC_24_BOLD;
const char *font_key_japanese = FONT_KEY_MINCHO_20_PAIR;
#endif
const Translation english_translation = { "Pair?", font_key_default };
const Translation translations[] = {
{ "Koppeln?", font_key_def... | (animation, false) | ;
animation_set_duration(animation, animation_duration_ms);
animation_set_delay(animation, animation_delay_ms);
// We only need a stop handler for one of the animations as they should finish at the same time
AnimationHandlers handlers = {
.stopped = prv_info_text_animation_stopped,
};
animation_set_han... |
}
prv_encode_and_send_data(&checksum, sizeof(checksum));
accessory_send_byte(HDLC_FLAG);
accessory_enable_input();
}
// Request processing
////////////////////////////////////////////////////////////////////
static void prv_erase_complete(void *ignored, status_t result) {
s_flash_erase_in_progress = false... | prv_send_frame(OPCODE_FLASH_GEOMETRY, &response, sizeof(response)) | ;
}
static void prv_handle_flash_erase_request(const void *payload, uint32_t length) {
if (length != sizeof(FlashEraseRequest)) {
PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length);
return;
}
const FlashEraseRequest *request = payload;
FlashEraseResponse response = {
.address = reques... |
/*
* 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(shared_circular_buffer_get_write_space_remaining(&buffer), 0) | ;
// Try a wrapped read
cl_assert(shared_circular_buffer_read(&buffer, &client, 6, &out_buffer, &out_length));
cl_assert_equal_i(out_length, 5);
cl_assert(memcmp(out_buffer, (uint8_t*) "56789", 5) == 0);
cl_assert(shared_circular_buffer_consume(&buffer, &client, 5));
// Get the rest of the wrapped read
... |
/*
* 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... | click_manager_clear(window_manager_get_window_click_manager(appeared_window)) | ;
}
static void prv_unload_removed_windows(WindowStack *window_stack) {
// Copy the removed windows list into a local array and then call the unload callback on
// each removed window.
WindowStackItem *items_to_unload[WINDOW_STACK_ITEMS_MAX];
unsigned int num_items = 0;
while (window_stack->removed_list_head... |
nt s_offset;
static GPoint *prv_copy_points(GPoint *points, uint16_t num_points, GPoint offset) {
s_path_num_points = num_points;
GPoint *copied_points = malloc(num_points * sizeof(GPoint));
cl_assert(copied_points != NULL);
for (int i = 0; i < num_points; i++) {
copied_points[i] = gpoint_add(points[i], of... | (s_fill_color.argb, GColorBlueARGB8) | ;
cl_assert_equal_i(s_stroke_width, 1);
cl_assert_equal_i(s_path_num_points, 2);
cl_assert_equal_b(s_path_open, false);
cl_assert_equal_i(s_path_fill_count, 1);
cl_assert_equal_i(s_path_stroke_count, 1);
cl_assert(prv_compare_points(points, s_stroke_points, s_path_num_points));
cl_assert(prv_compare_point... |
/*
* 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 (message) {
snprintf(buffer, warning_length, i18n_get("Powered 'til %s", dialog),
i18n_get(message, dialog));
dialog_set_text(dialog, buffer);
} |
dialog_set_icon(dialog, data->warning_icon);
}
static void prv_dialog_on_unload(void *context) {
Dialog *dialog = context;
i18n_free_all(dialog);
if (dialog == s_dialog) {
s_dialog = NULL;
}
}
static void prv_display_modal(WindowStack *stack, DialogUpdateFn update_fn, void *data) {
if (s_dialog) {
... |
20, 1160, 424},
{ -872, 680, 456},
{ -1120, 424, 232},
{ -1416, 512, -56},
{ -2152, 480, -56},
{ -1904, 808, 456},
{ -712, 688, -296},
{ -1504, 344, -96},
{ -1488, 616, 24},
{ -1248, 760, -128},
{ -1368, 768, -208},
{ -872, 616, -72},
// 18 seconds
{ -1144, 584, -160}... | { -1176, 264, 224},
// 23 seconds
{ -1192, 304, 240},
{ -1232, 424, 184},
{ -1224, 336, 376},
{ -1248, 608, 512},
{ -1112, 560, 736},
{ -936, 672, 384},
{ -1136, 912, 352},
{ -928, 776, 408},
{ -1192, 616, 264},
{ -1528, 528, 344},
{ -1752, 384, 312},
{ -1616, 272... | |
QSPIC_BURSTCMDA_REG, QSPIC_EXT_BYTE, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST_WB, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_DMY_FORCE, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_CS_HIGH_MIN, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDB... | (CACHE, CACHE_CTRL2_REG, ENABLE_ALSO_OTP_CACHED, 0x0) | ;
REG_SETF(CACHE, CACHE_CTRL2_REG, CACHE_CGEN, 0x0);
REG_SETF(CACHE, CACHE_CTRL2_REG, CACHE_WEN, 0x0);
REG_SETF(CACHE, CACHE_CTRL2_REG, CACHE_LEN, 0x0);
REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_CONTROLLER_RESET, 0x0);
REG_SETF(CACHE, CACHE_CTRL3_REG, CACHE_RAM_SIZE_RESET_VALUE, 0x2);
REG_SETF(CACHE, CACHE_CT... |
4, 8},
{ 1112, 328, -160},
{ 1016, 200, -224},
{ 784, 104, -40},
{ 672, 80, -16},
{ 664, 96, 72},
{ 720, 152, 48},
{ 792, 176, 40},
{ 800, 224, -32},
{ 936, 272, -128},
{ 1112, 224, -112},
{ 1312, 208, -152},
{ 1600, 88, -8},
{ 1688, 216, -72},
{ 1008, 344, -152},... | { 1920, 240, 16},
{ 1184, 376, -40},
{ 816, 280, -32},
{ 1016, 152, 80},
{ 1064, 40, 176},
{ 888, 40, 160},
{ 816, 72, 104},
{ 760, 56, 56},
{ 744, 8, 56},
{ 760, -24, 56},
{ 864, -56, 40},
{ 1008, -80, 8},
{ 1024, -56, -24},
{ 1680, -192, 176},
{ 1464, 56, 72... |
{ 800, 128, 8},
{ 848, 216, 96},
{ 896, 408, 96},
{ 744, 296, 0},
// 95 seconds
{ 864, 328, -64},
{ 984, 304, -144},
{ 1128, 296, -136},
{ 1280, 272, -40},
{ 1920, 304, 72},
{ 1416, 424, 8},
{ 840, 328, -16},
{ 968, 224, 88},
{ 1136, 152, 168},
{ 912, 104, 23... |
/*
* 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... | (filename, line_number, lr, expr, fmt, fmt_args) | ;
va_end(fmt_args);
}
void passert_failed(const char* filename, int line_number, const char* message, ...) {
va_list fmt_args;
va_start(fmt_args, message);
prv_handle_passert_failed_vargs(filename, line_number,
(uintptr_t)__builtin_return_address(0), "ASSERT", message, fmt_args);
va_end(fmt_args);
}
... |
command, s_pb_state.current_command);
return true;
}
return false;
}
static uint32_t prv_parse_token(const PutBytesCommand command, const SharedHeader *header) {
if (command == PutBytesInit) {
return 0;
}
return ntohl(header->token);
}
static bool prv_check_for_state_error(PutBytesCommand cmd,... | (ResponseNack, s_pb_state.token) | ;
goto finally;
}
const PutBytesCommand cmd = s_pb_state.receiver.buffer[0];
// Validation:
const uint32_t request_token =
prv_parse_token(cmd, (const SharedHeader *)s_pb_state.receiver.buffer);
const bool has_error = prv_check_for_state_error(cmd, request_token, s_pb_state.receiver.length);
if... |
ime_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("1 H AGO", time_buf);
// June 9th 2015, 17:30:00 (T+01:30:00)
rtc_set_time(event_time + SECONDS_PER_HOUR + (30 * SECONDS_PER_MINUTE));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATI... | (time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS) | ;
cl_assert_equal_s("2 minutes ago", time_buf);
// June 9th 2015, 15:00:00 (T-01:00:00)
rtc_set_time(event_time - (1 * SECONDS_PER_HOUR));
clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("In 1 hour", time_buf);
// June 9th 2015, 14:00:00 (T-02:00:00)
rtc... |
o don't buffer any data
}
AccelManagerBufferData accel_buffer_data;
accel_buffer_data.rawdata.x = data->x;
accel_buffer_data.rawdata.y = data->y;
accel_buffer_data.rawdata.z = data->z;
if (prv_shared_buffer_empty()) {
s_last_empty_timestamp_ms = data->timestamp_us / 1000;
}
// Note: the delta val... | (free_state) | |
/*
* 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... | {
char dest[NAME_LENGTH];
phone_format_caller_name("Katharine Berry", dest, NAME_LENGTH);
cl_assert_equal_s(dest, "Katharine B.");
} | |
xed_S32_16){ .raw_value = (int32_t)((float)-3.5 * (1 << FIXED_S32_16_PRECISION)) };
test_num = (int32_t)((float)-3.5 * (1 << FIXED_S32_16_PRECISION));
cl_assert(memcmp(&num, &test_num, sizeof(Fixed_S32_16)) == 0);
}
void test_math_fixed__S32_16_add(void) {
Fixed_S32_16 num1, num2;
Fixed_S32_16 sum, sum_c;
... | (sum.raw_value == sum_c.raw_value) | |
/*
* 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... | {
ConnectionServiceState *state = prv_get_state();
event_service_client_unsubscribe(&state->bcs_info);
memset(&state->handlers, 0x0, sizeof(state->handlers));
} |
void connection_service_subscribe(ConnectionHandlers conn_handlers) {
ConnectionServiceState *state = prv_get_state();
state->handlers = conn_handlers;
event_service_client_subscribe(&state->bcs_info);
}
void connection_service_state_init(ConnectionServiceState *state) {
*state = (ConnectionServiceState) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.