prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
sert_equal_p(s_stroke_points, NULL);
cl_assert(prv_compare_points(¢er, s_fill_points, s_path_num_points));
prv_reset();
// restore stroke color and set radius to zero - only a stroke should be drawn
gdraw_command_set_stroke_color(command, GColorPurple);
gdraw_command_set_radius(command, 0);
gdraw_comma... | (command_list, 2) | |
block->Size);
}
//! Move the block pointer back to the previous block.
static HeapInfo_t* get_previous_block(Heap * const heap, HeapInfo_t* block) {
HEAP_ASSERT_SANE(heap, block->PrevSize != 0, block);
return (HeapInfo_t *)(((Alignment_t *)block) - block->PrevSize);
}
static void prv_calc_totals(Heap* const heap,... | if ((allocation_size < HEAP_INFO_BLOCK_SIZE(1)) || (allocation_size >= SEGMENT_SIZE_MAX)) {
return NULL;
} |
HeapInfo_t* allocated_block;
heap_lock(heap);
{
HeapInfo_t* free_block = find_segment(heap, allocation_size);
allocated_block = allocate_block(heap, allocation_size, free_block);
if (allocated_block != NULL) {
// We've allocated a new block, update our metrics
#ifdef MALLOC_INSTRUMENTATION
... |
flash_write_bytes(data_to_write, addr, read_length);
s_curr_state.offset_in_log_page += read_length;
s_curr_state.bytes_remaining -= read_length;
if (s_curr_state.bytes_remaining == 0) {
// we are done with the current log record, mark it valid
uint8_t flags = ~(LOG_FLAGS_VALID);
flash_write_bytes... | (LOG_LEVEL_DEBUG, "Dumping generation %d, %d pages", generation, num_log_pages) | ;
if (num_log_pages == 0) {
completed_cb(false);
return (false); // no match found
}
DumpLogState *state = kernel_malloc_check(sizeof(DumpLogState));
// Init our state
*state = (DumpLogState) {
.log_start_addr = log_start_addr,
.page_index = 0,
.num_pages = num_log_pages,
.page_offs... |
/*
* 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... | {
const WelcomeVersion version = welcome_get_welcome_version();
// This check only works if it is called before getting started complete is set
if (!factory_reset_or_first_use && (version < WelcomeVersion_4xNormalFirmware)) {
// This has completed getting started on a previous normal firmware, welcome them if... | |
ler_histories();
uint64_t start_ms = prv_now_ms();
animation_schedule(seq);
// Complete A and start B. This should unschedule the parent
prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS + 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0);
cl_a... | prv_count_handler_entries(&s_stopped_handler_calls, c) | , 1);
// A should be at the end
int32_t update_a_after = prv_last_update_distance(a);
cl_assert_equal_i(update_a_after, ANIMATION_NORMALIZED_MAX);
// B should be in the middle
int32_t update_b_after = prv_last_update_distance(b);
cl_assert(abs(update_b_after - ANIMATION_NORMALIZED_MAX/2) < 5000);
// C ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (node->first_child, ++indentation_level, buffer, buffer_size) | |
on(state, animation, false /*finished*/, true /*allow_auto_destroy*/,
false /*force_destroy*/, true /*teardown*/);
}
}
// -------------------------------------------------------------------------------------------
bool animation_is_scheduled(Animation *animation_h) {
if (!animation_h)... | if (!animation) {
return NULL;
} |
return animation->implementation;
}
// -------------------------------------------------------------------------------------------
void *animation_get_context(Animation *animation_h) {
if (animation_private_using_legacy_2(NULL)) {
// We need to enable other applib modules like scroll_layer, menu_layer, etc. w... |
dress, FirmwareDescription* desc) {
dbgserial_putstr("Checksumming firmware update");
uint32_t crc = crc_calculate_flash(flash_address, desc->firmware_length);
return crc == desc->checksum;
}
// Fills in the first 50% of the progress bar
static void prv_display_erase_progress(
uint32_t progress, uint32_t tot... | boot_bit_set(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS) | ;
FirmwareDescription firmware_description =
firmware_storage_read_firmware_description(flash_new_fw_addr);
if (!firmware_storage_check_valid_firmware_description(&firmware_description)) {
dbgserial_print("Desclen ");
dbgserial_print_hex(firmware_description.description_length);
dbgserial_print(... |
inters are valid because we check them
//! before calling this callback.
typedef void (*InitAttributeListFromSliceFunc)(const AppGlanceSliceInternal *slice,
AttributeList *attr_list_to_init);
typedef struct SliceTypeImplementation {
AttributeListValidationFunc is_attr_l... | if (!cb(current_slice, context)) {
break;
} | |
lib/graphics/graphics_private_raw.h"
#include "applib/graphics/framebuffer.h"
#include "applib/ui/window_private.h"
#include "applib/ui/layer.h"
#include "clar.h"
#include "util.h"
#include <stdio.h>
// Helper Functions
////////////////////////////////////
#include "test_graphics.h"
#include "8bit/test_framebuffer... | graphics_fill_rect(ctx, bitmap_bounds) | ;
const GSize *bitmap_bounds_size = &bitmap_bounds->size;
// Draw the left rectangle blue with 66% opacity
// (will appear at the top because data rows are vertically flipped)
const GRect left_rect = GRect(0, 0, bitmap_bounds_size->w * 2 / 5, bitmap_bounds_size->h);
GColor left_rect_color = GColorBlue;
l... |
ppNum app_num, uint32_t resource_id,
uint32_t expected_signature, uint32_t *data_size) {
// Load file signature, and check that it matches the expected_signature
uint32_t data_signature;
if (!(sys_resource_load_range(app_num, resource_id, 0, (uint8_t*)&data_signature,
... | if (!command) {
return GDrawCommandTypeInvalid;
} |
return command->type;
}
void gdraw_command_set_fill_color(GDrawCommand *command, GColor fill_color) {
if (!command) {
return;
}
command->fill_color = fill_color;
}
GColor gdraw_command_get_fill_color(GDrawCommand *command) {
if (!command) {
return (GColor) {0};
} else {
return command->fill_c... |
APIS.init();
EXECUTE_SCRIPT(script);
prv_deinit();
}
prv_init();
}
static char *prv_load_js(char *suffix) {
char path[512] = {0};
snprintf(path, sizeof(path), "%s/js/tictoc~rect~%s.js", CLAR_FIXTURE_PATH, suffix);
FILE *f = fopen(path, "r");
cl_assert(f);
fseek(f, 0, SEEK_END);
size_t length =... | (100, jerry_get_int32_value(prv_js_global_get_value("s1"))) | |
hile last byte is emitted by the SPI peripheral
delay_us(7);
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_RESET);
// hold time > 1us
// produce a delay 4ms
delay_us(4);
gpio_release(DISP_GPIO);
}
//! These functions needed to be called around any commands that
//! are sent to the display. NOINLINE only for ... | GPIO_Init(DISP_GPIO, &s_disp_gpio_init) | |
te->subscriber = (struct MicSubscriber) {
.callback = data_handler,
.buffer = audio_buffer,
.context = context,
.size = audio_buffer_len,
.idx = 0
};
this->state->overflow_cnt = 0;
this->state->bytes_received = 0;
this->state->samples_to_discard = (MIC_SAMPLE_RATE * this->settling_delay_ms) ... | if (this->state->bytes_received == 0) {
// Seed the filter state to prevent transient at the beginning of recording
this->state->hpf_y1 = dfsdm_buffer[0] >> 8;
} |
this->state->bytes_received += DFSDM_BUFFER_LENGTH * sizeof(*dfsdm_buffer);
for (int i = 0; i < DFSDM_BUFFER_LENGTH; i++) {
// move 24-bit value stored in upper 24-bits down to lower 24 bits
int32_t sample = dfsdm_buffer[i] >> 8;
// Single pole IIR filter to remove DC offset (cutoff frequency: 10Hz)... |
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 "test_alarm_common.h"
// Stubs
#include "stubs_activity.h"
#include "stubs_blob_db_sync.h"
#include "stubs_blo... | prv_assert_alarm_config(id, 6, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule) | ;
}
void test_alarm__alarm_create_recurring_weekdays(void) {
AlarmId id;
id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_WEEKDAYS });
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule);
id = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind ... |
ID_CELL_PADDING + DISP_COLS));
s_ctx.draw_state.drawing_box.origin = GPoint(x_offset, 0);
prv_render_action_menu_window(root_level, selected_index,
ActionMenuLayerLongLabelScrollingAnimationState_Top,
additional_crumbs);
}
static void prv_ren... | (s_dest_bitmap, TEST_PBI_FILE) | |
e <string.h>
#include <stdlib.h>
#include "drivers/flash.h"
#include "flash_region/flash_region.h"
#include "services/normal/filesystem/pfs.h"
#include "services/normal/filesystem/flash_translation.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/math.h"
#include "util/size.h"
#include "clar.... | cl_assert_equal_i(pfs_close(fd), S_SUCCESS) | ;
}
}
void test_pfs__garbage_collection_when_full(void) {
char file_name[10];
int num = 0;
int fd;
while (1) {
snprintf(file_name, sizeof(file_name), "file%d", num++);
fd = pfs_open(file_name, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(file_name));
cl_assert((fd >= 0) || (fd == E_OUT_OF_STORAGE));
... |
exact same uid
uint32_t uid = ((GetNotificationAttributesMsg *)&s_complete_dict)->notification_uid;
fake_notification_storage_set_existing_ancs_notification(&(Uuid)UUID_SYSTEM, uid);
prv_send_notification((uint8_t *)&s_complete_dict);
cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_coun... | prv_get_state() | |
ssage_length = buffer_len - sizeof(LogBinaryMessage);
// Use vnsiprintf only if we don't have sufficient stack space
if (!prv_use_default_log_msg(msg, max_message_length)) {
prv_sprintf_to_msg(msg, max_message_length, fmt, args);
}
return sizeof(*msg) + msg->message_length;
}
int pbl_log_get_bin_format(c... | htonl(time_seconds) | ;
msg->message_length = 0;
/*
* The file name and line number are stored in the log_strings section
* so the waf console displays it.
*/
msg->line_number = 0;
msg->filename[0] = '\0';
/*
* Unpack the log level
* Duplicate _VERBOSE -- let's have a reasonable entry for every value should someth... |
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the Licen... | (&mfg_data.serial_number,
mfg_get_serial_number(),
MFG_SERIAL_NUMBER_SIZE) | ;
ble_ad_set_manufacturer_specific_data(ad,
PEBBLE_BT_VENDOR_ID,
(const uint8_t *) &mfg_data,
sizeof(struct ManufacturerSpecificData));
#if !RECOVERY_FW
// Initial high-rate period of 5 minutes long... |
/*
* 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... | (length > 0) | ;
QSPI_SetDataLength(length - 1);
}
#if DEBUG_QSPI_WAITS
#define QSPI_WAIT_TIME (100000)
// These are a bit dangerous on long erase commands, but they can also be very useful to find out
// why the QSPI driver is locking up when doing development
static void prv_wait_for_transfer_complete(void) {
int i = 0;
w... |
, 56, -312},
{ 1056, 24, -272},
{ 1120, 80, -312},
{ 1328, 40, -400},
{ 1408, 80, -440},
{ 1248, 64, -376},
{ 976, 16, -336},
{ 960, 24, -328},
{ 1096, 16, -264},
{ 1128, -8, -208},
{ 1080, -40, -176},
{ 1016, -72, -104},
{ 1000, -56, -88},
{ 1024, -48, -80},
{ 10... | { 848, -24, -16},
{ 848, -16, -16},
{ 936, 16, -104},
{ 1024, 0, -152},
{ 1104, -8, -224},
{ 1168, -32, -240},
{ 1152, -24, -288},
{ 1208, 8, -296},
{ 1128, 8, -248},
// 112 seconds
{ 1280, 8, -264},
{ 1352, 56, -288},
{ 1248, 80, -240},
{ 960, 24, -208},
{ 89... |
{ 1080, -48, -24},
{ 1136, -32, -24},
{ 1144, -8, -32},
{ 1448, -16, 16},
{ 1624, 48, -16},
{ 1160, 72, -120},
{ 808, 112, -264},
{ 576, 112, -240},
{ 848, 48, -152},
{ 1352, -8, -88},
{ 1224, -64, -16},
{ 1064, -8, -80},
{ 1000, 64, -96},
{ 968, 80, -64},
{ ... |
gender,
age_years);
activity_algorithm_metrics_changed_notification();
// Register our minutes callback
cron_job_schedule(&s_activity_job);
s_activity_state.started = true;
PBL_LOG(LOG_LEVEL_INFO, "Activity tracking started");
PebbleEvent e... | if (!success) {
return false;
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
graphics_draw_line(ctx, start, end);
} |
__profiler_stop();
__profiler_print_stats();
}
static void prv_update_proc(Layer *layer, GContext *ctx) {
static const uint32_t NUM_LINES_TO_DRAW = 10000;
GRect bounds = layer_get_bounds(layer);
prv_draw_lines(ctx, bounds, NUM_LINES_TO_DRAW, LineDirection_Vertical);
prv_draw_lines(ctx, bounds, NUM_LINES_... |
/*
* 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... | (r->subscriber.data, &sub_data) | ;
cl_assert_equal_i(r->state, RecognizerState_Possible);
cl_assert_equal_i(r->flags, 0);
cl_assert_equal_p(r->simultaneous_with_cb, NULL);
cl_assert_equal_p(r->fail_after, NULL);
cl_assert_passert(recognizer_create_with_data(NULL, &s_test_impl_data,
sizeof(s_te... |
r)) {
flash_read_bytes((uint8_t *)buffer, i_addr, sizeof(buffer));
for (uint32_t j = 0; j < sizeof(buffer); j++) {
if (buffer[j] != 0xFF) {
erased = false;
prompt_send_response_fmt(buffer, sizeof(buffer),
"(Sub)Sector at addr: 0x%"PRIX32" not really erased. is_subse... | strlen(bit) | |
= (int16_t)((float)-0.875 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_value = test_num };
cl_assert(num.integer == -1);
cl_assert(num.fraction == 1);
test_num = (int32_t)((float)-0.750 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_value = test_num };
cl_assert(num.integer == -1... | (num.fraction == 7) | ;
num = (Fixed_S16_3){ .raw_value = 0x7FFF };
cl_assert(num.integer == 4095);
cl_assert(num.fraction == 7);
test_num = (int32_t)((float)4095.875 * (1 << FIXED_S16_3_PRECISION));
cl_assert(memcmp(&num, &test_num, sizeof(Fixed_S16_3)) == 0);
// overflowing positively from 4095.875 results in going to -4096
... |
(r, &(TouchEvent) { .type = TouchEvent_Touchdown }) | ;
cl_assert_equal_i(last_touch_event.type, TouchEvent_Touchdown);
cl_assert_equal_b(updated, true);
cl_assert_equal_i(r->state, new_state);
}
bool s_simultaneous = false;
static bool prv_simultaneous_with_cb(const Recognizer *recognizer,
const Recognizer *simultaneous_with) {... | |
static GContext *s_ctx = NULL;
static GBitmap *s_dest_bitmap = NULL;
// Setup
void test_graphics_context_mask__initialize(void) {
s_fb = malloc(sizeof(*s_fb));
s_ctx = malloc(sizeof(*s_ctx));
framebuffer_init(s_fb, &(GSize) {DISP_COLS, DISP_ROWS});
test_graphics_context_init(s_ctx, s_fb);
framebuffer_clear(... | graphics_context_mask_create(ctx, transparent) | |
AG_READ, 0, 0);
rv = pfs_read(fd, buf, rd_len);
cl_assert(rv == rd_len);
rv = pfs_read(fd, buf, 1);
cl_assert(rv == E_RANGE);
rv = pfs_seek(fd, 0, FSeekSet);
cl_assert(rv == 0);
rv = pfs_read(fd, NULL, rd_len);
cl_assert(rv == E_INVALID_ARGUMENT);
rv = pfs_read(fd, buf, rd_len + 1);
cl_assert(rv == ... | cl_assert(*val == (curr | (curr << 16))) | ;
curr++;
}
cl_assert(pfs_close(fd) == S_SUCCESS);
free(b);
}
}
void test_pfs__file_span_regions(void) {
pfs_format(false /* write erase headers */); // start with an empty flash
pfs_init(false);
char name[128];
snprintf(name, sizeof(name), "bigfile");
//Fill up entire memory 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... | (i < QSPI_WAIT_TIME, "Waited too long for the QSPI transfer to complete") | ;
}
static void prv_wait_for_not_busy(void) {
int i = 0;
while (QSPI_GetFlagStatus(QSPI_FLAG_BUSY) != RESET) {
if (++i > QSPI_WAIT_TIME) {
break;
}
}
PBL_ASSERT(i < QSPI_WAIT_TIME, "Waited too long for the QSPI to become not busy");
}
#else
static void prv_wait_for_transfer_complete(void) {
w... |
/*
* 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... | {
CircularBuffer buffer;
uint8_t storage[8];
circular_buffer_init(&buffer, storage, sizeof(storage));
const uint16_t data_out_size = 8;
uint8_t data_out[data_out_size];
// Test copy when there is nothing in the buffer:
cl_assert_equal_i(circular_buffer_copy(&buffer, data_out, data_out_size), 0);
// W... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (list_get_prev(&b) == &a) | ;
cl_assert(list_get_next(&b) == &c);
cl_assert(list_get_prev(&c) == &b);
cl_assert(list_get_next(&c) == NULL);
}
void test_list__count(void) {
ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL;
ListNode *tail = list_append(list_append(&a, &b), &c);
cl_assert(list_count(tail) == 3);
cl_... |
oid) {
for (unsigned int i = 0; i < ARRAY_LENGTH(BOARD_CONFIG_ACCEL.accel_ints); i++) {
exti_enable(BOARD_CONFIG_ACCEL.accel_ints[i]);
}
}
static void clear_accel_interrupts(void) {
for (unsigned int i = 0; i < ARRAY_LENGTH(BOARD_CONFIG_ACCEL.accel_ints); i++) {
EXTI_ClearFlag(BOARD_CONFIG_ACCEL.accel_in... | (ACCEL_AXIS_X, ptr) | ;
data->y = get_axis_data(ACCEL_AXIS_Y, ptr);
data->z = get_axis_data(ACCEL_AXIS_Z, ptr);
s_accel_data = *data;
data++;
}
}
void lis3dh_init(void) {
PBL_ASSERTN(!s_initialized);
lis3dh_init_mutex();
s_initialized = true;
if (!accel_start()) {
s_initialized = false;
return;
}
i... |
/*
* 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... | ("Default_Handler") | void BusFault_Handler(void);
ALIAS("Default_Handler") void UsageFault_Handler(void);
ALIAS("Default_Handler") void SVC_Handler(void);
ALIAS("Default_Handler") void DebugMon_Handler(void);
ALIAS("Default_Handler") void PendSV_Handler(void);
ALIAS("Default_Handler") void SysTick_Handler(void);
// External Interrupts
#d... |
CCD_Z_LSB,
};
static int16_t prv_read_axis(BMA255Axis axis, uint8_t *new_data) {
uint8_t raw_buf[2];
bma255_burst_read(AXIS_REGISTERS[axis], raw_buf, sizeof(raw_buf));
int16_t reading = prv_conv_raw_to_12bit(raw_buf);
if (new_data) {
*new_data = raw_buf[0] & 0x01;
}
return reading;
}
static bool prv_s... | (buf, 64, " suspend: 0x%"PRIx8, (lpw & (1 << 7)) != 0) | ;
prompt_send_response_fmt(buf, 64, " lowpower_en: 0x%"PRIx8, (lpw & (1 << 6)) != 0);
prompt_send_response_fmt(buf, 64, " deep_suspend: 0x%"PRIx8, (lpw & (1 << 5)) != 0);
prompt_send_response_fmt(buf, 64, " sleep_dur: 0x%"PRIx8, (lpw & 0b11110) >> 1);
prompt_send_response_fmt(buf, 64, "(0x12) Low_Power: 0x%... |
/*
* 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... | mfg_info_set_watch_color(5) | ;
cl_assert_equal_i(mfg_info_get_watch_color(), 5);
cl_assert_equal_i(mfg_info_get_rtc_freq(), 4);
mfg_info_get_model(buffer);
cl_assert_equal_s(buffer, "");
// Make sure we have space for the model.
mfg_info_set_model("test_model");
cl_assert_equal_i(mfg_info_get_watch_color(), 5);
cl_asser... |
int num_attributes,
int num_actions, uint8_t attributes_per_action[], size_t required_size_for_strings,
uint8_t **string_buffer) {
if (num_actions > 0) {
PBL_ASSERTN(attributes_per_action != NULL);
}
const size_t alloc_size = attributes_actions_get_required_buffer_size(num_attributes, num_actions,
... | timeline_item_destroy(item_out) | ;
return NULL;
}
return item_out;
}
size_t timeline_item_get_serialized_payload_size(TimelineItem *item) {
PBL_ASSERTN(item);
return attributes_actions_get_serialized_payload_size(&item->attr_list, &item->action_group);
}
bool timeline_item_deserialize_item(TimelineItem *item_out,
... |
0, 304},
{ -128, 1296, 584},
{ 176, 1360, 624},
{ 184, 1168, 496},
// 5 seconds
{ 56, 968, 416},
{ 96, 864, 448},
{ 144, 792, 368},
{ 208, 728, 216},
{ 112, 616, 160},
{ 88, 616, 120},
{ 80, 760, 80},
{ 72, 784, 104},
{ 8, 976, 160},
{ 64, 1136, 296},
{ -24, 1... | { 1368, 480, -368},
{ 1256, 360, -224},
{ 1344, 264, -192},
{ 1216, 248, -152},
{ 928, 224, -112},
{ 784, 232, -88},
{ 752, 176, -64},
{ 720, 96, 8},
{ 720, 80, -32},
{ 752, 80, -56},
{ 816, 48, -56},
{ 1016, 72, -112},
{ 1584, -16, -32},
// 11 seconds
{ 1632,... |
{ 1472, -48, -80},
{ 1520, 248, -400},
{ 1088, 232, -360},
{ 1224, 280, -432},
{ 1312, 208, -320},
{ 968, 216, -240},
{ 736, 272, -176},
{ 704, 280, -240},
{ 704, 184, -200},
{ 832, 176, -184},
{ 968, 240, -264},
{ 1064, 184, -304},
{ 1272, 304, -336},
{ 1520, 20... |
app_glance_db.mutex);
pfs_remove(SETTINGS_FILE_NAME);
mutex_unlock(s_app_glance_db.mutex);
return S_SUCCESS;
}
static status_t prv_validate_glance(const Uuid *app_uuid,
const SerializedAppGlanceHeader *serialized_glance, size_t *len) {
// Change this block if we support multiple a... | {
// Bump the app's priority by telling the cache we're using it
if (app_cache_entry_exists(app_id)) {
app_cache_app_launched(app_id);
} else {
// The app isn't cached. Fetch it!
PebbleEvent e = {
.type = PEBBLE_APP_FETCH_REQUEST_EVENT,
.app_fetch_request = {
.id ... | else if (!app_install_id_from_system(app_id)) {
// App is not installed (not in app db and not a system app). Do not insert the glance
// String initialized on the heap to reduce stack usage
char *app_uuid_string = kernel_malloc_check(UUID_STRING_BUFFER_LENGTH);
uuid_to_string(app_uuid, app_uuid_strin... |
336, 600, -304},
{ -424, 736, -360},
{ -464, 800, -416},
{ -680, 960, -464},
{ -512, 1160, -576},
{ -584, 1128, -648},
{ -416, 1616, -648},
{ -16, 1048, -376},
{ -192, 680, -344},
{ -192, 848, -392},
{ -64, 688, -320},
{ -64, 504, -328},
{ -128, 504, -336},
{ -224, 71... | {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_28397_13
//> TEST_EXPECTED 100
//> TEST_EXPECTED_MIN 80
//> TEST_EXPECTED_MAX 120
//> TEST_WEIGHT 1.0
static AccelRawData samples[] = {
// 0 seconds
// elapsed: 0 minutes
{ -80, 640, -824},
{ -... | |
lance = user_data;
LauncherAppGlanceSettings *settings_glance =
launcher_app_glance_structured_get_data(structured_glance);
if (settings_glance) {
buffer_size = MIN(sizeof(settings_glance->battery_percent_text), buffer_size);
strncpy(buffer, settings_glance->battery_percent_text, buffer_size);
buf... | {
LauncherAppGlanceSettings *settings_glance =
launcher_app_glance_structured_get_data(structured_glance);
if (settings_glance) {
event_service_client_unsubscribe(&settings_glance->battery_state_event_info);
event_service_client_unsubscribe(&settings_glance->pebble_app_event_info);
event_service_c... |
static void prv_set_glance_icon(LauncherAppGlanceSettings *settings_glance,
uint32_t new_icon_resource_id) {
if (settings_glance->icon_resource_id == new_icon_resource_id) {
// Nothing to do, bail out
return;
}
// Destroy the existing icon
kino_reel_destroy(settings_gl... |
112, 1040, -656},
{ 264, 1128, -480},
{ 184, 1064, -608},
{ 136, 872, -568},
{ 232, 720, -504},
{ 128, 592, -408},
{ 48, 560, -328},
{ 16, 448, -280},
{ -112, 432, -288},
{ -80, 688, -368},
{ -96, 808, -440},
{ -88, 952, -552},
{ 0, 1032, -688},
{ -64, 1176, -560},
... | { 160, 1048, -584},
{ 200, 1064, -480},
{ 288, 928, -504},
{ 232, 624, -480},
{ 144, 512, -464},
{ 48, 440, -424},
{ -8, 480, -320},
{ 8, 696, -416},
// 75 seconds
{ 136, 880, -456},
{ 232, 904, -504},
{ 232, 752, -584},
{ 432, 1024, -720},
{ 200, 816, -544},
... |
{ 240, 768, -600},
{ 136, 624, -496},
{ 64, 536, -352},
{ 40, 560, -376},
{ 48, 616, -336},
{ 40, 672, -392},
{ 8, 656, -464},
{ -32, 776, -520},
{ -40, 864, -528},
{ 48, 808, -624},
{ 120, 1152, -648},
{ 536, 1152, -552},
{ 384, 920, -632},
{ 240, 872, -512},
... |
though it
// may indicate off-wrist.
s_manager_state.sensor_stable = true;
s_manager_state.off_wrist_when_stable = (quality == HRMQuality_OffWrist);
}
}
return s_manager_state.sensor_stable;
}
T_STATIC bool prv_can_turn_sensor_on(void) {
#if IS_BIGBOARD || RECOVERY_FW
return true;
#endif
... | prv_update_enable_timer_cb, NULL /*context*/, 0 /*flags*/);
} else {
new_timer_stop(s_manager_state.update_enable_timer_id);
}
}
} | |
#include "applib/app.h"
#include "applib/app_focus_service.h"
#include "applib/event_service_client.h"
#include "applib/fonts/fonts.h"
#include "applib/graphics/graphics.h"
#include "applib/graphics/gtypes.h"
#include "applib/ui/ui.h"
#include "comm/bt_lock.h"
#include "comm/ble/gap_le_connection.h"
#include "comm/ble/... | i18n_get_with_buffer("<Untitled>", remote->name, sizeof(remote->name)) | ;
} else {
strncpy(remote->name, name, sizeof(remote->name));
}
}
static void prv_add_bt_classic_remote(BTDeviceAddress *addr, SM128BitKey *link_key,
const char *name, uint8_t *platform_bits, void *context) {
SettingsBluetoothData *data = (SettingsBluetoothData*) context... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
s_test_impl = (RecognizerImpl) {
.handle_touch_event = prv_handle_touch_event,
.cancel = prv_cancel,
.reset = prv_reset,
.on_fail = prv_on_fail
};
test_impl_data->test = TEST_PATTERN;
return recognizer_create_with_data(&s_test_impl, test_impl_data,
sizeof(*... | |
anim, interpolate_moook_soft_duration(NUM_MID_FRAMES));
animation_set_handlers(bg_anim, (AnimationHandlers){
.started = prv_bg_animation_started_handler,
.stopped = prv_bg_animation_stopped_handler,
}, health_card_view);
animation_set_implementation(bg_anim, &prv_bg_animation_implementation);
healt... | (window_root->frame.size.h - content_indicator_height, 0, 0) | );
layer_init(&health_card_view->down_arrow_layer, &down_arrow_layer_frame);
layer_add_child(window_root, &health_card_view->down_arrow_layer);
content_indicator_init(&health_card_view->down_indicator);
const GRect up_arrow_layer_frame = grect_inset(window_root->frame,
GEdgeInsets(0, 0, window_root->fram... |
/*
* 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... | (default_only_define()) | ;
}
void test_test_infra__overridden_custom_header(void) {
// Check that the header in the custom override directory shadowed the default
// override directory's version.
cl_assert(overridden_define() == 42);
}
void test_test_infra__custom_only_header(void) {
// Check that the header only in the custom overri... |
bss_size__[];
extern const uint32_t __isr_stack_start__[];
extern const uint32_t __stack_guard_size__[];
extern const uint32_t __APP_RAM__[];
extern const uint32_t __WORKER_RAM__[];
extern const uint32_t __FLASH_start__[];
extern const uint32_t __FLASH_size__[];
extern const uint32_t __kernel_main_stack_start__[];
e... | mpu_enable() | ;
}
const MpuRegion* memory_layout_get_app_region(void) {
return &s_app_region;
}
const MpuRegion* memory_layout_get_readonly_bss_region(void) {
return &s_readonly_bss_region;
}
const MpuRegion* memory_layout_get_app_stack_guard_region(void) {
return &s_app_stack_guard_region;
}
const MpuRegion* memory_layout... |
s)++] = value;
}
}
return true;
}
// -----------------------------------------------------------------------------------------
// Callback used to decode measurements. Called once for each measurement
static bool prv_decode_measurements(pb_istream_t *stream, const pb_field_t *field, void **arg) {
PLogMeasur... | pb_read(stream, (uint8_t *)ret_sender_id, str_len) | ;
}
// -----------------------------------------------------------------------------------------
// Callback used to decode the payload sender version patch
static bool prv_decode_sender_version_patch(pb_istream_t *stream, const pb_field_t *field,
void **arg) {
char *ret_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... | app_install_entry_is_watchface(entry) | && !app_install_entry_is_hidden((entry)));
}
static void prv_data_changed(void *context) {
LauncherAppWindowData *data = context;
launcher_menu_layer_reload_data(&data->launcher_menu_layer);
}
//! We're not 100% sure of the order of the launcher list yet, so use this function to transform
//! the row index to ac... |
onIntent *intent) {
return (intent->client[GAPLEClientKernel].is_pairing_required ||
intent->client[GAPLEClientApp].is_pairing_required);
}
// -------------------------------------------------------------------------------------------------
static bool prv_is_intent_using_whitelist(const GAPLEConnectionInt... | {
if (intent->client[c].is_used) {
return BTErrnoInvalidState;
}
} | else {
// Create intent for device and add to list:
const size_t alloc_size = sizeof(GAPLEConnectionIntent) +
(request->is_bonding_based ? sizeof(GAPLEConnectionIntentBonding) : 0);
intent = (GAPLEConnectionIntent *) kernel_malloc(alloc_size);
if (!intent) {
return BT... |
= SQUARE) {
graphics_draw_rect(ctx, &data->square);
} else if (shape == RECTANGLE) {
graphics_draw_rect(ctx, &data->rect);
} else if (shape == RECTANGLE_ROUND) {
graphics_draw_round_rect(ctx, &data->rectr, data->rectr_radius);
} else if (shape == CIRCLE) {
graphics_context_set_fill_c... | gpath_move_to(data->triangle, data->triangle_offset) | ;
data->triangle_velocity_x = 1;
data->triangle_velocity_y = 1;
// Open bucket
data->bucket = gpath_create(&s_bucket_path);
data->bucket_offset = GPoint(20, 30);
gpath_move_to(data->bucket, data->bucket_offset);
data->bucket_velocity_x = 1;
data->bucket_velocity_y = 1;
// Other properties
update_s... |
data->info_text_layer_buffer,
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD),
#else
fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD),
#endif
GColorBlack, GColorClear, G... | (prv_pop_window_kernel_main_cb, NULL) | ;
}
static void prv_push_pairing_window(void) {
BTPairingUIData *data = s_data_ptr;
Window *window = &data->window;
window_init(window, WINDOW_NAME("Bluetooth SSP"));
window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_window_load,
.unload = prv_window_unload,
});
window_set_user_dat... |
720, 304},
{ -456, 720, 296},
{ -464, 712, 296},
{ -448, 720, 304},
{ -448, 728, 304},
{ -448, 736, 288},
{ -440, 720, 288},
{ -448, 720, 304},
{ -440, 720, 288},
{ -416, 712, 256},
{ -432, 744, 280},
{ -440, 736, 336},
{ -440, 736, 296},
{ -448, 728, 288},
{ -44... | { -424, 744, 264},
{ -432, 744, 256},
{ -432, 744, 264},
{ -424, 744, 256},
{ -432, 744, 264},
// 96 seconds
{ -432, 752, 264},
{ -424, 744, 264},
{ -424, 744, 264},
{ -416, 752, 264},
{ -416, 752, 264},
{ -424, 744, 264},
{ -424, 744, 256},
{ -424, 744, 264},
... | |
;
int duration_total = duration_a + MAX(duration_b, duration_c);
// Create 3 animations
Animation *a = prv_create_test_animation();
animation_set_duration(a, duration_a);
Animation *b = prv_create_test_animation();
animation_set_duration(b, duration_b);
Animation *c = prv_create_test_animation();
ani... | cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 1) | |
ons += (has_snooze_action) ? 1 : 0;
num_item_specific_actions += (has_ancs_mute_action) ? 1 : 0;
// Create root level
uint8_t num_actions = num_timeline_actions + num_local_actions;
uint8_t separator_index = num_actions > num_item_specific_actions ? num_item_specific_actions : 0;
ActionMenuLevel *root_level ... | i18n_get("End Quiet Time", root_level) | :
i18n_get("Start Quiet Time", root_level),
prv_toggle_dnd_from_action_menu,
window_data);
}
return root_level;
}
static void prv_action_menu_did_close(ActionMenu *action_menu, const ActionMenuItem *item,
... |
nt = {
.endpoint_id = APP_MESSAGE_ENDPOINT_ID,
.handler = app_message_app_protocol_system_nack_callback,
.access_mask = PebbleProtocolAccessAny,
.receiver_imp = &g_default_kernel_receiver_implementation,
.receiver_opt = NULL,
};
Receiver *kernel_receiver = g_default_kernel_receiver_implementatio... | (receiver) | ;
}
static void prv_app_message_receiver_finish(Receiver *receiver) {
AppMessageReceiver *rcv = (AppMessageReceiver *)receiver;
// Default to letting the system receiver process the message and thus nack it:
void (*kernel_receiver_finally_cb)(Receiver *) = g_default_kernel_receiver_implementation.finish;
if ... |
um_fifo_subscribers++;
ms_per_update = state->samples_per_update * 1000 / state->sampling_rate;
if (ms_per_update < lowest_ms_per_update) {
lowest_ms_per_update = ms_per_update;
}
}
state = (AccelSubscriberState *)state->list_node.next;
}
// Setup the subsampling numerator and den... | prv_set_restore_fifo_mode_timer() | ; // Give us another N seconds
}
accel_get_latest_reading((AccelRawData *)accel_data);
accel_data->timestamp = accel_get_latest_timestamp();
result = 0;
} else {
uint64_t old_timestamp_ms = accel_get_latest_timestamp();
// Else, change the FIFO to 1 deep and wait for a read... |
include "standby.h"
#include "system/bootbits.h"
#include "system/reset.h"
#include "util/delay.h"
#include "stm32f2xx.h"
static const uint8_t SELECT_BUTTON_MASK = 0x4;
bool firmware_is_new_world(void* base) {
uint32_t* fw_base = base;
if (fw_base == NULL) {
fw_base = (uint32_t*)FIRMWARE_NEWWORLD_BASE;
}
... | dbgserial_print("Booting firmware @ ") | |
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, either expres... | (&window->layer, &data->text_layer.layer) | ;
}
static void config_provider(Window *window) {
window_single_click_subscribe(BUTTON_ID_UP, (ClickHandler)click_handler);
window_single_click_subscribe(BUTTON_ID_SELECT, (ClickHandler)click_handler);
window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler)click_handler);
(void)window;
}
static void hand... |
t GRect container_rect2 = GRect(2, 2, 4, 4);
const GRect resulting_rect2 = grect_centered_from_polar(container_rect2, mode, 0, GSize(2, 4));
cl_assert_equal_grect(resulting_rect2, GRect(3, 0, 2, 4));
// Odd-length width and height for container rect, 180 degree angle
const GRect container_rect3 = GRect(2, 2, 5... | GRect(0, 5, 0, 0) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (-19, 0, 20, 20) | , 4, GCornersAll);
}
void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_layer(void) {
GContext ctx;
Layer layer;
test_graphics_context_init(&ctx, fb);
layer_init(&layer, &GRect(0, 0, 20, 10));
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbit... |
_kcalories(&active_kcalories);
cl_assert_equal_i(200, active_kcalories);
// Add some time and steps
prv_inc_time(600); /* 10 mins */
prv_inc_steps_and_put_event(1800 /* 180 steps per min * 10 mins */);
// Grab the new distance and active_kcalories
int32_t new_active_kcalories, new_distance_m;
cl_assert(... | cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m,
&bpm, &hr_zone)) | ;
cl_assert_equal_i(steps, 20);
cl_assert_equal_i(duration_s, 20);
cl_assert_equal_i(bpm, 80);
prv_inc_time(10);
prv_inc_steps_and_put_event(10);
prv_put_bpm_event(117, HRMQuality_Good);
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m,
... |
advert_terms_a, sizeof(advert_terms_a)/sizeof(GAPLEAdvertisingJobTerm),
unscheduled_callback, s_unscheduled_cb_data, 0);
cl_assert(job_a);
assert_ad_data("A");
// Schedule job "B":
BLEAdData *ad_b = create_ad("B", NULL);
GAPLEAdvertisingJobRef job_b... | for (int i = 0; i < 9; ++i) {
regular_timer_fire_seconds(1);
assert_ad_data("A");
cl_assert_equal_i(s_unscheduled_cb_count, 0);
regular_timer_fire_seconds(1);
assert_ad_data("B");
cl_assert_equal_i(s_unscheduled_cb_count, 0);
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (0, grect_shortest_side(GRectZero)) | |
SSERTN(success);
return num_samples;
}
// ---------------------------------------------------------------------------------------------
// Called by sys_accel_manager when we have data available for this subscriber
static void prv_do_data_handle(void *context) {
AccelServiceState *state = (AccelServiceState *)con... | accel_session_shake_subscribe(session, handler) | |
data->track_pos / 1000);
prv_copy_time_period(data->length_buffer, sizeof(data->length_buffer),
data->track_length / 1000);
}
}
static void prv_update_pos(void) {
MusicAppData *data = app_state_get_user_data();
music_get_pos(&data->track_pos, &data->track_le... | bitmap_layer_set_bitmap(&data->cassette_layer, &data->image_cassette) | ;
data->cassette_current_icon = &data->image_cassette;
const GAlign CASSETTE_LAYER_ALIGNMENT = PBL_IF_RECT_ELSE(GAlignTopLeft, GAlignTopRight);
bitmap_layer_set_alignment(&data->cassette_layer, CASSETTE_LAYER_ALIGNMENT);
bitmap_layer_set_compositing_mode(&data->cassette_layer, GCompOpSet);
layer_add_child(&da... |
ed points
*/
prv_plot4(fb, clip_box, center, offset, brightness, stroke_color, quadrant);
// Swapping x and y for rest of the circle
prv_plot4(fb, clip_box, center, GPoint(offset.y, offset.x), brightness, stroke_color, quadrant);
}
#if PBL_COLOR
T_STATIC void graphics_circle_quadrant_draw_1px_aa(GContext* c... | prv_plot4(framebuffer, &ctx->draw_state.clip_box, p, GPoint(edge.integer - 1, progress),
weighting, stroke_color, quadrant) | ;
}
if (edge.integer > radius - stop_progress) {
prv_plot4(framebuffer, &ctx->draw_state.clip_box, p, GPoint(edge.integer, progress),
weighting ^ weighting_compliment_mask, stroke_color, quadrant);
}
} else {
if (edge.integer > radius - stop_progress) {
prv... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | graphics_fill_rect(
ctx, &(GRect) { { x_range_begin.integer + 1, y },
{ x_range_end.integer - x_range_begin.integer - 1, 1 } }) | ;
}
void gpath_draw_filled(GContext* ctx, GPath* path) {
#if PBL_COLOR
// This algorithm makes sense only in 8bit mode...
if (ctx->draw_state.antialiased) {
prv_fill_path_with_cb_aa(ctx, path, prv_gpath_draw_filled_cb, NULL);
return;
}
#endif
gpath_draw_filled_with_cb(ctx, path, prv_gpath_draw_filled_... |
new) {
timeline_layer_set_prev_item(&data->timeline_layer, new_idx);
}
timeline_layer_move_data(&data->timeline_layer, -1);
}
// If we interrupted a previous scroll, hasten this scroll
const bool is_hasted = !was_stationary;
const uint32_t duration = TIMELINE_UP_DOWN_ANIMATION_DURATION_MS;
cons... | GPoint(0, -1) | ;
#else
GPoint direction = GPoint(1, 0);
#endif
Animation *layer_bounce = timeline_layer_create_bounce_back_animation(&data->timeline_layer,
direction);
data->current_animation = layer_bounce;
animation_schedule(layer_bounce);
}... |
uint16_t gatt_err_code = BLEGATTErrorSuccess;
if (event->error_code != BLEGATTErrorSuccess) {
gatt_err_code = event->error_code;
} else {
switch (event->type) {
case GattClientOpResponseRead: {
const GattClientOpReadReponse *resp = (GattClientOpReadReponse *)event;
PB... | (value_length) | ;
PBL_ASSERTN(s_read_responses[client]);
ReadResponseData *read_response = s_read_responses[client];
PBL_ASSERTN(value_length == read_response->length);
PBL_ASSERTN(object_ref == read_response->object_ref);
if (value_out) {
memcpy(value_out, read_response->value, read_response->length);
}... |
/*
* 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... | ("Endurance") | , card_data);
prv_set_zone(&card_data->zones[card_data->num_zones++], zone3_minutes, &max_progress, buffer_size,
i18n_noop("Performance"), card_data);
HealthDetailHeading *heading = &card_data->headings[card_data->num_headings++];
*heading = (HealthDetailHeading) {
/// Resting HR
.primar... |
ne.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/units.h"
#include "util/uuid.h"
#define PIN_DB_MAX_AGE (3 * SECONDS_PER_DAY) // so we get at two full past days in there
#define PIN_DB_FILE_NAME "pindb"
#define PIN_DB_MAX_SIZE KiBYTES(40) // TODO [FBO] variable size / reasonable value
stat... | blob_db_event_put(BlobDBEventTypeInsert, BlobDBIdPins, (uint8_t *)&item->header.id,
sizeof(TimelineItemId)) | ;
}
if (!mark_synced) {
blob_db_sync_record(BlobDBIdPins, (uint8_t *)&item->header.id, sizeof(TimelineItemId),
rtc_get_time());
}
cleanup:
kernel_free(buffer);
return rv;
}
status_t pin_db_insert_item(TimelineItem *item) {
return prv_insert_item(item, true /* emit_event */);
}... |
0xff, 0xff, 0xff, /* bytes 3280 - 3296 */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, /* bytes 3296 - 3312 */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bytes 3312 - 3328 */
0xff, 0xff, 0x00, 0x00, 0xff, 0... | resource_watch(SYSTEM_APP, RESOURCE_ID_PUG,
prv_res_changed_callback, NULL) | ;
cl_assert(cb_handle);
// Callback should get invoked if resource was written to
s_watch_res_callback_called_count = 0;
load_resource_fixture_on_pfs(RESOURCES_FIXTURE_PATH, PUG_FIXTURE_NAME, "pug");
cl_assert(s_watch_res_callback_called_count == 1);
// Turn off watch
resource_unwatch(cb_handle);
// ... |
Green.a == 0b11);
}
void test_graphics_colors__blue(void) {
cl_assert(GColorBlue.r == 0b00);
cl_assert(GColorBlue.g == 0b00);
cl_assert(GColorBlue.b == 0b11);
cl_assert(GColorBlue.a == 0b11);
}
void test_graphics_colors__equal(void) {
cl_assert(gcolor_equal(GColorBlue, GColorBlue));
cl_assert(gcolor_equal... | (GColorLightGray) | .argb);
cl_assert_equal_i(GColorBlackARGB8, gcolor_get_bw(GColorDarkGray).argb);
cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_bw(GColorYellow).argb);
cl_assert_equal_i(GColorBlackARGB8, gcolor_get_bw(GColorBlue).argb);
cl_assert_equal_i(GColorWhiteARGB8, gcolor_get_bw(GColorTiffanyBlue).argb);
cl_assert_equ... |
},
{ "'%R')", 66, true,
"1",
7,
},
{ "'%R')", 3607, true,
"1:00",
8,
},
{ "'%R')", -3666, true,
"-1:01",
7,
},
// Advanced %T tests
{ "'%0T')", 3666, true,
"01:01:06",
1,
},
{ "'%uT')", 3666, true,
"1 hour, 1 minute, and 6 seconds",
1,
},
{ "'%aT')", 3... | {
#if DEBUG_PRINTING
printf("\"%s\"\n", test->params);
printf("%*s^\n", (int)err_index + 1, "");
if (s_error.status >= TemplateStringErrorStatusCount) {
printf("Invalid status code\n");
} else {
printf("%s\n", s_error_strings[s_error.status]);
}
#endif
cl_assert_equal... |
cl_assert_equal_s(s_output, test->expect_str);
cl_assert_equal_i(s_cond.eval_time, test->expect_eval_time);
#if DEBUG_PRINTING
printf("\n");
#endif
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Test pipeline parser
static const struct {
... |
stent_storage_assign_sm_pairing_info(&info, &data->ble_data.pairing_info);
bluetooth_persistent_storage_debug_dump_ble_pairing_info(&display_buf[0], &info);
// does this info match the key stored in shared resources
SMPairingInfo sprf_info = {};
bool requires_address_pinning;
uint8_t flags;
sha... | } else if (memcmp(key, BLE_PINNED_ADDRESS_KEY, info->key_len) == 0) {
if (info->val_len == sizeof(BTDeviceAddress)) {
const BTDeviceAddress *address = (const BTDeviceAddress *)val;
prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN,
"Pinned address: "BT_DEVICE_ADDRESS... |
prompt_send_response("");
kernel_free(display_buf);
return true;
}
void bluetooth_persistent_storage_dump_contents(void) {
prv_file_each(prv_dump_bt_persistent_storage_contents, NULL);
}
|
gain
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_timeline_adds, 34);
cl_assert_equal_i(s_num_timeline_removes, 24);
cl_assert_equal_i(s_last_timeline_item_added->header.... | (s_num_timeline_removes, 5) | ;
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time());
// First alarm goes off. Second one should be up
s_current_hour = 10;
s_current_minute = 30;
s_current_day = s_sunday;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 3);
cl_assert_equal_i(s_num_alarm_events... |
n(transport, &s_transport_imp,
TransportDestinationSystem);
cl_assert_equal_i(comm_session_get_type(session), CommSessionTypeSystem);
cl_assert_equal_p(comm_session_get_system_session(), session);
cl_assert_equal_p(comm_session_get_by_type(CommSessionTypeSystem), session... | comm_session_close(modern_app_session, CommSessionCloseReason_UnderlyingDisconnection) | |
/*
* 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... | ASSERT(s_read_4_called == 2) | ;
// remove 4
emx_resources_remove_custom(id_4);
ASSERT(emx_resources_get_size(1, id_4) == 0);
ASSERT(s_size_4_called == 1);
// add 4 again
id_4 = emx_resources_register_custom(custom_res_read_4, custom_res_size_4);
ASSERT(emx_resources_get_size(1, id_4) == 4);
buf = 0;
ASSERT(emx_resources_read(1, ... |
{ 0, 0x3b, 0, 0x0},
{ 0, 0x3b, 0, 0x0},
{ 0, 0x3b, 17, 0x0},
{ 0, 0x3b, 0, 0x0},
{ 0, 0x3b, 0, 0x0},
// 90: Local time: 11:04:01 PM
{ 0, 0x3b, 583, 0x0},
{ 0, 0x75, 0, 0x0},
{ 0, 0x75, 0, 0x0},
{ 0, 0x75, 0, 0x0},
{ 0, 0x75, 0, 0x0},
{ 0, 0x75, 0, 0x0},
{ 7, 0x87, 1854, ... | { 0, 0x4b, 392, 0x0},
{ 0, 0x5c, 19, 0x0},
// 210: Local time: 01:04:00 AM
{ 0, 0x5a, 4287, 0x0},
{ 0, 0x79, 1827, 0x0},
{ 0, 0x3b, 2037, 0x0},
{ 0, 0x2c, 1838, 0x0},
{ 0, 0x2d, 1981, 0x0},
{ 0, 0x3c, 1956, 0x0},
{ 0, 0x4a, 1753, 0x0},
{ 0, 0x55, 503, 0x0},
{ 0, 0x55, 344... |
{ 0, 0x71, 1519, 0x0},
{ 9, 0x61, 867, 0x0},
{ 0, 0x5d, 79, 0x0},
{ 0, 0x5d, 0, 0x0},
// 270: Local time: 02:04:00 AM
{ 0, 0x5d, 26, 0x0},
{ 0, 0x5d, 0, 0x0},
{ 6, 0x5d, 259, 0x0},
{ 3, 0x6d, 301, 0x0},
{ 0, 0x59, 1361, 0x0},
{ 0, 0x58, 29, 0x0},
{ 0, 0x59, 241, 0x0},
... |
i18n_get("Distance", headings), headings_buf_size);
string_list_add_string(values, values_buf_size, distance_str, values_buf_size);
}
static void prv_add_step_metric_info(StringList *headings, int headings_buf_size,
StringList *values, int values_buf_size,
... | i18n_get(intro_str, body) | );
const int headings_buf_size = 128;
StringList *headings = kernel_zalloc_check(headings_buf_size);
const int values_buf_size = 128;
StringList *values = kernel_zalloc_check(values_buf_size);
if (session->type == ActivitySessionType_Run) {
type = ActivityInsightType_ActivitySessionRun;
icon = TIM... |
},
{"maygreen", GColorMayGreenARGB8},
{"cadetblue", GColorCadetBlueARGB8},
{"pictonblue", GColorPictonBlueARGB8},
{"brightgreen", GColorBrightGreenARGB8},
{"screamingreen", GColorScreaminGreenARGB8},
{"mediumaquamarine", GColorMediumAquamarineARGB8},
{"electricblue", GColorElectricBlueARGB8},
{"darkcand... | {
*parsed_color = GColorFromRGBA(r, g, b, a);
if (parsed_color->a == 0) {
*parsed_color = GColorClear;
}
return true;
} |
}
}
return false;
}
bool rocky_api_graphics_color_parse(const char *color_value, GColor8 *parsed_color) {
return prv_parse_name(color_value, parsed_color) ||
prv_parse_hex(color_value, parsed_color);
}
bool rocky_api_graphics_color_from_value(jerry_value_t value, GColor *result) {
if (jerry_value_is... |
imeline item for contact lookup
AttributeList attributes = {};
attribute_list_add_cstring(&attributes, AttributeIdSender, number);
attribute_list_add_cstring(&attributes, AttributeIdiOSAppIdentifier, app_id);
TimelineItem *item = timeline_item_create_with_attributes(0, 0, TimelineItemTypeNotification,
... | (&s_phone_ui_data->status_bar) | |
_connected = remote->classic.connected;
remote->type = StoredRemoteTypeBTDual;
remote->dual.classic.connected = classic_connected;
// Note: We update remote->dual.ble.connected outside this cb
remote->dual.ble.bonding = *id;
} else {
// Remote for which we only have a BLE key, add it in the menu a... | settings_bluetooth_update_remotes_private(settings_data) | |
case PlatformTypeChalk:
// yes, this is misleading, e.g. on Spalding, these defines are always 180x180
// oh dear...
*size = GSize(LEGACY_3X_DISP_COLS, LEGACY_3X_DISP_ROWS);
return;
case PlatformTypeDiorite:
case PlatformTypeEmery:
*size = GSize(DISP_COLS, DISP_ROWS);
retur... | process_metadata_get_app_sdk_platform(app_manager_get_current_app_md()) | ;
}
DEFINE_SYSCALL(bool, sys_app_is_watchface, void) {
return app_manager_is_watchface_running();
}
DEFINE_SYSCALL(ResAppNum, sys_get_current_resource_num, void) {
if (pebble_task_get_current() == PebbleTask_KernelMain) {
return SYSTEM_APP;
}
return process_metadata_get_res_bank_num(app_manager_get_curr... |
&custom_schedule1 });
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_CUSTOM, custom_schedule1);
bool custom_schedule2[7] = {false, false, false, false, false, true, false};
id = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &custom_schedule2 });
prv_ass... | prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_CUSTOM, custom_schedule1) | ;
alarm_set_kind(id, ALARM_KIND_WEEKDAYS);
prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule);
}
void test_alarm__alarm_set_custom(void) {
AlarmId id;
id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_EVERYDAY });
prv_assert_alarm_config(id, 3, 14, f... |
ialiased(ctx, true);
graphics_context_set_stroke_width(ctx, 2);
graphics_draw_line(ctx, GPoint(40,40), GPoint(40,40));
graphics_context_set_antialiased(ctx, false);
graphics_context_set_stroke_width(ctx, 3);
graphics_draw_line(ctx, GPoint(50,50), GPoint(50,50));
graphics_context_set_antialiased(ctx, true)... | prv_draw_lines(&ctx, 3, 0, CLIP_OFFSET) | ;
// Draw lines around boundaries of clipping box - AA true, SW 4
prv_draw_lines(&ctx, 4, CLIP_OFFSET, CLIP_OFFSET);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_line_clip_rect_aa")));
}
|
peek_layer_play(&data->peek_layer);
Animation *sidebar_slide = prv_create_sidebar_animation(data, false /* open */);
data->current_animation = sidebar_slide;
animation_schedule(sidebar_slide);
}
}
static void prv_back_click_handler(ClickRecognizerRef recognizer, void *context) {
TimelineAppData *da... | (data->current_animation) | |
pplicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ams.h"
... | {
const BLECharacteristic characteristic = s_ams_client->characteristics[0];
const BTDeviceInternal device = gatt_client_characteristic_get_device(characteristic);
if (!bt_device_is_invalid(&device.opaque)) {
GAPLEConnection *connection = gap_le_connection_by_device(&device);
conn_mgr_set_ble_co... |
bt_unlock();
}
static void prv_request_reduced_latency_cb(void *data) {
const bool reduced_latency = (uintptr_t)data;
const ResponseTimeState state = reduced_latency ? ResponseTimeMiddle : ResponseTimeMax;
prv_request_response_time(BtConsumerMusicServiceIndefinite, state, MAX_PERIOD_RUN_FOREVER);
}
static vo... |
e/time.h"
#include "system/logging.h"
typedef enum ReminderAppUIState {
ReminderAppUIState_Start,
ReminderAppUIState_WaitForDictationEvent,
ReminderAppUIState_Exit,
} ReminderAppUIState;
typedef struct ReminderAppData {
Window window;
VoiceWindow *voice_window;
EventServiceInfo event_service_info;
Tran... | transcription_dialog_set_callback(transcription_dialog, prv_confirm_cb, data) | |
SH_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(system_flash_erase(FLASH_BASE, 1024 KiB, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 11), erased_sector);
cl_assert(flash_locked);
}
... | cl_check_((erased_sector & (1 << sector/8)) == 0,
"Re-erasing an already erased sector") | ;
flash_flags_set = true;
if (return_status == FLASH_COMPLETE) {
erased_sector |= (1 << sector/8);
}
return return_status;
}
extern FLASH_Status FLASH_ProgramByte(uint32_t address, uint8_t data) {
cl_assert_(!flash_locked, "Attempted to write to a locked flash");
cl_assert_(address >= flash_data_start ... |
time_end,
agg, HealthServiceTimeScopeOnce);
cl_assert_equal_i(s_sys_activity_get_minute_history_values.in[0].utc_start, time_start);
cl_assert_equal_i(s_sys_activity_get_minute_history_values.in[0].num_records,
num_minutes_per_ca... | health_service_register_metric_alert(HealthMetricHeartRateBPM, 65) | ;
cl_assert(alert != NULL);
}
|
x;
#else
return original_index;
#endif
}
static void select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, SettingsWatchfacesData *data) {
const AppMenuNode* app_node =
app_menu_data_source_get_node_at_index(&data->data_source, cell_index->row);
// NOTE: The default watchface is not set here in ca... | (menu_layer, data, &(MenuLayerCallbacks) {
#if PBL_ROUND
.get_cell_height = (MenuLayerGetCellHeightCallback) get_cell_height_callback,
#endif
.get_num_rows = (MenuLayerGetNumberOfRowsInSectionsCallback) get_num_rows_callback,
.draw_row = (MenuLayerDrawRowCallback) draw_row_callback,
.select_click = (Men... | ;
menu_layer_set_highlight_colors(&data->menu_layer,
PBL_IF_COLOR_ELSE(GColorJazzberryJam, GColorBlack),
GColorWhite);
menu_layer_set_click_config_onto_window(menu_layer, window);
layer_add_child(&window->layer, menu_layer_get_layer(menu_layer));... |
GPoint(5, 0), 0);
graphics_draw_vertical_line_dotted(&ctx, GPoint(7, 0), 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(9, 0), 2);
graphics_draw_vertical_line_dotted(&ctx, GPoint(11, 0), 3);
graphics_draw_vertical_line_dotted(&ctx, GPoint(13, 0), 4);
graphics_draw_vertical_line_dotted(&ctx, GPoint(15, 0)... | (&ctx, GPoint(101, 75), 5) | ;
// T facing left - odd vert, even horiz
graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 71), 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(132, 76), 5);
// T facing right - lined up
graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 90), 10);
graphics_draw_horizontal_line_dotted(&ctx, GP... |
lvable_device();
prv_fake_connect(&device, false /* is_master*/);
fake_GAPAPI_set_encrypted_for_device(&device);
fake_GAPAPI_put_encryption_change_event(true /* encrypted */, GAP_LE_PAIRING_STATUS_NO_ERROR,
false /* is_master */, &device);
fake_event_clear_last();
c... | prv_dummy_device(1) | ;
// Register connection intent for app:
gap_le_connect_connect(&device,
false /* no auto_reconnect */,
false /* is_pairing_required */,
GAPLEClientApp);
prv_fake_connect(&device, true /* is_master*/);
gap_le_connect_cancel(&device, GAPLE... |
// are any of the pages already erased?
for (uint16_t pg = 0; pg < remaining_pgs_in_block && !in_gc_region; pg++) {
uint16_t curr_page = start_pg + pg;
uint8_t page_flags = prv_get_page_flags(curr_page);
if (page_is_erased(page_flags)) {
next_page = curr_page;
break;
}
... | {
PageHeader hdr;
prv_flash_read((uint8_t *)&hdr.next_page_crc, sizeof(hdr.next_page_crc) +
sizeof(hdr.next_page), prv_page_to_flash_offset(curr_page) +
offsetof(PageHeader, next_page_crc));
*next_page = hdr.next_page;
if (*next_page == INVALID_PAGE) {
return (S_NO_MORE_ITEMS);
}
if (crc8_... |
static status_t unlink_flash_file(uint16_t page) {
uint16_t first_page = page;
if (page > s_pfs_page_count) { // should never happen
return (E_INTERNAL);
}
// Mark the files to indicate that they are ready to be erased
PageHeader hdr;
hdr.page_flags = 0xff;
SET_PAGE_FLAGS(hdr.page_flags, PAGE_FLAG_... |
+= (has_snooze_action) ? 1 : 0;
num_item_specific_actions += (has_ancs_mute_action) ? 1 : 0;
// Create root level
uint8_t num_actions = num_timeline_actions + num_local_actions;
uint8_t separator_index = num_actions > num_item_specific_actions ? num_item_specific_actions : 0;
ActionMenuLevel *root_level = ti... | ("End Quiet Time", root_level) | |
{ 48, 16, -1000},
{ 48, 16, -992},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 16, -1000},
{ 40, 24, -1000},
{ 40, 24, -992},
{ 48, 16, -1000},
{ 40, 24, -992},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 24, -992},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 16, -10... | { 48, 24, -1000},
{ 48, 16, -1000},
{ 48, 32, -1000},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 24, -992},
{ 48, 16, -1000},
{ 48, 32, -1000},
{ 48, 16, -1000},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 40, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 24,... |
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 16, -1000},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 16, -992},
{ 48, 24, -992},
{ 48, 16, -1000},
{ 40, 16, -1000},
{ 40, 16,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.