prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
1152, -88, 88},
{ 1656, -40, 272},
// 53 seconds
{ 1296, 72, 64},
{ 1176, 336, -248},
{ 960, 240, -40},
{ 736, 168, 80},
{ 776, 112, 80},
{ 824, 136, 80},
{ 856, 192, 72},
{ 800, 256, -16},
{ 880, 336, -80},
{ 1056, 336, -88},
{ 1232, 272, -48},
{ 1416, 144, 112},... | { 1288, 232, 40},
{ 1912, 280, 176},
{ 1368, 360, 192},
{ 1008, 240, 160},
{ 1160, 128, 256},
{ 1176, 72, 328},
{ 984, 96, 264},
// 59 seconds
{ 824, 64, 224},
{ 784, 40, 176},
{ 760, -16, 136},
{ 728, -32, 136},
{ 784, -56, 104},
{ 872, -72, 72},
{ 968, 24, -... |
{ 1528, 440, 24},
{ 1216, 544, -240},
{ 864, 240, 48},
{ 672, 192, 88},
{ 768, 288, 80},
{ 816, 176, 240},
{ 792, 280, 120},
{ 720, 256, 104},
{ 824, 368, -64},
{ 1056, 352, -88},
{ 1304, 432, -96},
{ 1720, 224, 112},
{ 1816, 312, 24},
// 62 seconds
{ 1128, 2... |
};
// In case we change the length of the history, fetch the old size
int fetch_size = sizeof(old_history);
fetch_size = MIN(fetch_size, settings_file_get_len(file, &m_info.settings_key,
sizeof(m_info.settings_key)));
settings_file_get(file, &m_info.settings_key, sizeof(m... | (LOG_LEVEL_ERROR, "Settings file DNE. No need to continue getting metric") | ;
success = false;
goto unlock;
}
settings_file_get(file, &m_info.settings_key, sizeof(m_info.settings_key), &setting_history,
sizeof(setting_history));
for (uint32_t i = 1; i < history_len; i++) {
history[i] = m_info.converter(setting_history.values[i])... |
ssion = {
.start_utc = 10,
.length_min = 10,
.type = ActivitySessionType_Run,
.ongoing = true,
.manual = false,
.step_data = {
.steps = 2000,
.active_kcalories = 200,
.resting_kcalories = 100,
.distance_meters = 1600,
},
};
cl_assert(workout_service_takeover_acti... | cl_assert_equal_i(duration_s, 10) | ;
cl_assert_equal_i(bpm, 190);
// Resume the workout and get more data (it updates this time)
cl_assert(workout_service_pause_workout(false));
prv_inc_time(10);
prv_inc_steps_and_put_event(10);
prv_put_bpm_event(80, HRMQuality_Good);
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s,... |
RECT_WIDTH, RECT_HEIGHT)
void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_aa_sw(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// TODO: Fix offset calculation and reenable this: - PBL-16509
#if SCREEN_COLOR_DEPTH_BITS == 8
// AA = true, SW = 1
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_... | graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw5_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 5);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "dr... |
, pfs_get_size() - (num_pages()*128));
printf("%d\n", pfs_get_size() - 1024);
cl_assert(fd >= 0);
cl_assert(pfs_close(fd) == S_SUCCESS);
cl_assert(pfs_remove(name) == S_SUCCESS);
}
void test_pfs__active_regions(void) {
pfs_format(false);
cl_assert(!pfs_active_in_region(0, pfs_get_size()));
// erase ev... | pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, len) | ;
cl_assert(fd >= 0);
cl_assert(pfs_write(fd, (uint8_t *)buf, len) == len);
cl_assert(pfs_close(fd) == S_SUCCESS);
if (num_erases != (erase_count - 1)) {
cl_assert(pfs_remove(file_small) == S_SUCCESS);
}
}
}
int original_page_count = num_pages();
ftl_populate_region_list... |
"os/mutex.h"
#include "system/passert.h"
#include "kernel/util/delay.h"
#include "util/size.h"
#include "kernel/util/sleep.h"
#include "kernel/events.h"
#include "services/common/system_task.h"
#include "services/common/new_timer/new_timer.h"
#define STM32F2_COMPATIBLE
#define STM32F4_COMPATIBLE
#define STM32F7_COMP... | {
i2c_use(I2C_MAX14690);
bool rv = i2c_write_register(I2C_MAX14690, register_address, value);
i2c_release(I2C_MAX14690);
return (rv);
} | |
4, -32, -960},
{ -24, -32, -952},
{ -24, -24, -952},
{ -24, -24, -952},
{ -16, -32, -952},
{ -24, -40, -952},
{ -24, -32, -952},
{ -24, -32, -960},
{ -16, -32, -952},
{ -24, -24, -952},
{ -24, -32, -960},
{ -24, -32, -952},
{ -16, -40, -952},
{ -24, -32, -960},
{ ... | { -24, -40, -952},
{ -16, -32, -960},
{ -24, -40, -960},
{ -16, -40, -952},
// 239 seconds
{ -24, -40, -960},
{ -24, -32, -960},
{ -16, -32, -960},
{ -24, -40, -960},
{ -24, -40, -960},
{ -24, -32, -960},
{ -16, -40, -952},
{ -24, -32, -952},
{ -24, -32, -960},
... |
{ -16, -40, -952},
{ -24, -32, -960},
{ -24, -40, -960},
{ -24, -40, -960},
{ -24, -40, -960},
{ -24, -32, -952},
{ -24, -40, -952},
{ -24, -32, -952},
{ -24, -40, -960},
{ -24, -40, -952},
{ -24, -32, -960},
{ -24, -32, -960},
{ -16, -40, -960},
// 242 seconds
... |
int16_t *)result |= (response.data[1] << 4) | (response.data[2] >> 4);
} else {
// invalid type
WTF;
}
}
#endif
// Memory Operations
////////////////////////////////////////////////////////////////////////////////
#if 0
// TODO: we might want to use these this to verify configuration settings
static uint... | {
return;
} |
PebbleEvent e = {
.type = PEBBLE_CALLBACK_EVENT,
.callback.callback = prv_process_pending_messages
};
*should_context_switch = event_put_isr(&e);
s_callback_scheduled = true;
}
// Initialization
////////////////////////////////////////////////////////////////////////////////
void touch_sensor_init(v... |
ervices/normal/filesystem/pfs.h"
#include "services/normal/settings/settings_raw_iter.h"
#include "system/logging.h"
#define MAX_CHILDREN_PER_PIN 3
typedef struct {
Uuid parent_id;
Uuid children_ids[MAX_CHILDREN_PER_PIN];
int num_children;
bool find_all;
} FindChildrenInfo;
typedef struct {
time_t current;... | {
goto cleanup;
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | gbitmap_destroy(s_dest_bitmap) | ;
s_dest_bitmap = NULL;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Helpers
////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////
// COMMON HELPERS ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return ptr;
} |
}
int string_list_add_string(StringList *list, size_t max_list_size, const char *buffer,
size_t max_str_size) {
if (!list) {
return 0;
}
const size_t str_length = strnlen(buffer, max_str_size);
const int size_remaining =
max_list_size - (sizeof(StringList) + list->seriali... |
ight_of(now), &range);
cl_assert(result);
cl_assert_equal_range(range, ((HealthServiceTimeRange){
.last_day_idx = 1,
.num_days = 1,
.seconds_first_day = 86400,
.seconds_last_day = 86400,
.seconds_total_last_day = 86400,
}));
// some time yesterday + today
result = prv_calculate_time_range... | (result, 1000) | ;
cl_assert_equal_i(s_sys_activity_get_metric_values.in.history_len, ACTIVITY_HISTORY_DAYS);
// today into future
result = health_service_sum(HealthMetricStepCount,
time_util_get_midnight_of(now),
now + 12345);
cl_assert_equal_i(result, 1000);
// y... |
r_set_window(child, NULL);
child->next_sibling = NULL;
}
void layer_remove_child_layers(Layer *parent) {
Layer *child = parent->first_child;
while (child) {
// Get the reference to the next now; layer_remove_from_parent will unlink them.
Layer *next_sibling = child->next_sibling;
layer_remove_from_pa... | {
while (layer) {
// don't consider window's root layer's frame/bounds
// and no, we don't need to check for l->window != NULL as &l->window->layer is just an offset
// (an offset of 0 to be precise)
if (&layer->window->layer == layer) {
break;
}
// follow how the drawing_box is computed... | |
/*
* 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... | GPoint(base_layer->bounds.size.w / 2 - x_center_offset, y) | );
}
static void prv_render_current_steps(GContext *ctx, Layer *base_layer) {
HealthActivitySummaryCardData *data = layer_get_data(base_layer);
char buffer[8];
GFont font;
if (data->current_steps) {
font = fonts_get_system_font(FONT_KEY_LECO_26_BOLD_NUMBERS_AM_PM);
snprintf(buffer, sizeof(buffer), "%"... |
{ 32, 440, -936},
{ 48, 408, -952},
{ 40, 392, -936},
{ 48, 368, -968},
{ 56, 360, -960},
{ 72, 384, -984},
{ 96, 408, -1016},
{ 88, 392, -960},
{ 64, 400, -944},
{ 56, 416, -960},
{ 56, 408, -944},
{ 88, 448, -928},
{ 104, 400, -944},
{ 112, 592, -920},
{ 128... | { -392, 936, 80},
{ -392, 936, 80},
// 55 seconds
{ -392, 944, 72},
{ -400, 936, 88},
{ -392, 920, 72},
{ -392, 920, 72},
{ -368, 888, 32},
{ -384, 936, 88},
{ -392, 1008, 120},
{ -424, 912, 144},
{ -408, 944, 128},
{ -392, 920, 136},
{ -392, 960, 88},
{ -368,... |
{ -400, 944, 16},
{ -400, 896, 16},
{ -424, 960, 72},
{ -408, 928, 112},
{ -408, 896, 80},
{ -400, 912, 104},
{ -408, 912, 120},
{ -400, 928, 120},
// 58 seconds
{ -408, 936, 120},
{ -408, 944, 120},
{ -408, 952, 112},
{ -408, 952, 112},
{ -408, 952, 120},
{ ... |
reminders_handle_reminder_removed));
}
status_t reminder_db_read_item(TimelineItem *item_out, TimelineItemId *id) {
size_t size = reminder_db_get_len((uint8_t *)id, sizeof(TimelineItemId));
if (size == 0) {
return E_DOES_NOT_EXIST;
}
uint8_t *read_buf = kernel_malloc_... | if (item->header.type != TimelineItemTypeReminder) {
return E_INVALID_ARGUMENT;
} |
size_t payload_size = timeline_item_get_serialized_payload_size(item);
uint8_t *buffer = kernel_malloc_check(sizeof(SerializedTimelineItemHeader) + payload_size);
timeline_item_serialize_header(item, (SerializedTimelineItemHeader *) buffer);
timeline_item_serialize_payload(item, buffer + sizeof(SerializedTime... |
it_for_write_bounded(64000000);
prv_flash_start_cmd();
prv_flash_send_and_receive_byte(FLASH_CMD_READ_ID);
uint32_t manufacturer = prv_flash_read_next_byte();
uint32_t type = prv_flash_read_next_byte();
uint32_t capacity = prv_flash_read_next_byte();
prv_flash_end_cmd();
// If we can't ready the flash in... | prv_flash_erase_subsector(start_addr) | ;
total_bytes -= SUBSECTOR_SIZE_BYTES;
start_addr += SUBSECTOR_SIZE_BYTES;
}
watchdog_feed();
}
}
|
assert_equal_i(a.y, b.y);
}
// --------------------------------------------------------------------------------------
static void cl_assert_equal_rect(const GRect a, const GRect b) {
cl_assert_equal_point(a.origin, b.origin);
cl_assert_equal_i(a.size.w, b.size.w);
cl_assert_equal_i(a.size.h, b.size.h);
}
// -... | stub_new_timer_is_scheduled(sys_timer_id) | ) {
DPRINTF("timer not scheduled\n");
prv_advance_by_ms_no_timers(dst_time - now);
return;
}
// Advance time to when timer would fire and fire it
uint32_t ms_delta = stub_new_timer_timeout(sys_timer_id);
if (ms_delta < dst_time - now) {
prv_fire_animation_timer();
} else {
... |
{
regular_timer_remove_callback(&s_shared_prf_writeback_timer);
s_shared_prf_writeback_timer.cb(NULL);
} |
}
//! For unit tests
RegularTimerInfo *shared_prf_storage_get_writeback_timer(void) {
return &s_shared_prf_writeback_timer;
}
| |
text ctx = {
.idx = 0
};
touch_dispatch_touch_events(0, prv_touch_event_dispatch_cb, &ctx);
cl_assert_equal_i(ctx.idx, 0);
touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420);
touch_handle_update(0, TouchState_FingerDown, &GPoint(15, 15), 6, 3686440);
touch_handle_update(1, Touch... | (TouchDriverEvent_PalmDetect) | ;
// Cancelled event, followed by a palm detection event
cl_assert_equal_i(s_expected_palm_events[0].type, PEBBLE_TOUCH_EVENT);
cl_assert_equal_i(s_expected_palm_events[0].touch.type, PebbleTouchEvent_TouchesCancelled);
cl_assert_equal_i(s_expected_palm_events[1].type, PEBBLE_TOUCH_EVENT);
cl_assert_equal_i(... |
(error_code) | ;
prv_draw_scene(SCENE_ERROR);
}
void display_prepare_for_reset(void) {
prv_screen_off();
}
| |
t plugged_in = 0;
if (state->test_entry.version == 1) {
sscanf(token + strlen(token) + 1, "%d, 0x%x, %d", &steps, &orientation, &vmc);
} else if (state->test_entry.version == 2) {
sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d", &steps, &orientation, &vmc, &light);
} else if (stat... | {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.max);
} | else if (strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.force_shut_down_at);
} else if (strcmp(token, "TEST_WEIGHT") == 0) {
sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight);
} else if (strcmp(token, "TEST_NAME"... |
de_Serial, 0 };
reboot_reason_set(&reason);
system_reset();
}
void command_crash() {
prompt_command_finish();
RebootReason reason = { RebootReasonCode_LauncherPanic, 0 };
reboot_reason_set(&reason);
system_reset();
}
void command_hard_crash() {
prompt_command_finish();
RebootReason reason = { Reboot... | if (!result) {
return false;
} | |
dow, NOTIFICATION_PRIORITY, true /* animated */);
}
return;
}
// get the current layout so we can get the color and icon
LayoutLayer *layout = swap_layer_get_current_layout(&data->swap_layer);
if (!layout) {
return;
}
// Get color and icon
const LayoutColors *colors = layout_get_notification... | notification_storage_get(id, item) | ) {
PBL_LOG(LOG_LEVEL_ERROR, "Failed to read notification");
goto cleanup;
}
} else if (type == NotificationReminder) {
// validate reminder
int rv = reminder_db_read_item(item, id);
if (rv != S_SUCCESS) {
PBL_LOG(LOG_LEVEL_ERROR, "Failed to read reminder");
goto cleanup;
}... |
xt) {
*result = (EventServiceInfo) {
.type = type,
.handler = prv_event_handler,
.context = callback_context,
};
event_service_client_subscribe(result);
}
///////////////////
// AppMenuDataSource callbacks
static bool prv_app_filter_callback(struct AppMenuDataSource * const source,
... | (0, s_launcher_menu_persisted_data.scroll_offset_y) | ,
false);
} else {
// If we are resetting the launcher, select the second entry (Settings is at the top)
menu_layer_set_selected_index(&data->menu_layer, MenuIndex(0, 1), MenuRowAlignNone, false);
}
prv_subscribe_to_event(&data->battery_state_event_info, PEBBLE_BATTERY... |
itmap, "fill_rect_transparent.8bit.pbi"));
}
void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_radius(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// AA = true, SW has no effect, all corners
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_fill_rou... | (&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 3, GCornersAll) | |
((Animation *)anim, prv_interpolate_moook_soft) | ;
animation_set_duration((Animation *)anim, interpolate_moook_soft_duration(NUM_MOOOK_FRAMES_MID));
animation_set_handlers((Animation *)anim, (AnimationHandlers) {
.stopped = prv_handle_animation_stop,
}, data);
data->mic_window.fly_anim = anim;
animation_schedule((Animation *)anim);
}
// cancel the fly... | |
language governing permissions and
* limitations under the License.
*/
#include <inttypes.h>
#include "drivers/flash.h"
#include "drivers/flash/micron_n25q/flash_private.h"
#include "drivers/watchdog.h"
#include "flash_region/flash_region.h"
#include "kernel/util/delay.h"
#include "util/math.h"
#include "kernel/co... | (FLASH_CMD_PAGE_PROGRAM) | ;
prv_flash_send_24b_address(start_addr);
while (buffer_size--) {
prv_flash_send_and_receive_byte(*buffer);
buffer++;
}
prv_flash_end_cmd();
prv_flash_wait_for_write();
}
void cd_flash_read_bytes(void* buffer_ptr, uint32_t start_addr, uint32_t buffer_size) {
uint8_t* buffer = buffer_ptr;
prv_fla... |
h"
#include "kernel/ui/kernel_ui.h"
#include "resource/resource_ids.auto.h"
#include "system/passert.h"
#include <stdlib.h>
#include <string.h>
#define SCROLL_ANIMATION_DURATION (300)
#define POP_WINDOW_DELAY (400)
#define CHARACTER_DELAY (20)
#define TEXT_OFFSET_VERTICAL (6)
static void prv_show_next_character(Tr... | (transcription_dialog->animation) | ;
animation_set_duration(anim, (count - begin) * CHARACTER_DELAY);
animation_set_curve(anim, AnimationCurveEaseInOut);
// Text is shown if creating the property animation fails
*transcription_dialog->zero = '\0';
animation_set_curve(anim, AnimationCurveLinear);
animation_schedule(anim);
}
static void pr... |
e_scs_deassert(slave);
spi_ll_slave_release(slave);
}
uint8_t spi_slave_read_write(const SPISlavePort *slave, uint8_t out) {
prv_spi_acquire_helper(slave);
uint8_t ret = spi_ll_slave_read_write(slave, out);
prv_spi_release_helper(slave);
return ret;
}
void spi_slave_write(const SPISlavePort *slave, uint8_t ... | (slave->spi_bus, out) | ;
prv_spi_receive_wait_ready_blocking(slave->spi_bus);
return prv_spi_receive_data(slave->spi_bus);
}
void spi_ll_slave_write(const SPISlavePort *slave, uint8_t out) {
PBL_ASSERTN(slave->slave_state->initialized);
PBL_ASSERTN(slave->slave_state->acquired);
PBL_ASSERTN(slave->slave_state->scs_selected);
prv... |
{ 456, -112, -368},
{ 296, -184, -608},
{ 192, -176, -672},
{ 128, -272, -848},
{ 216, -56, -1072},
{ 312, 8, -1056},
{ 288, -32, -944},
{ 200, 8, -872},
{ 24, -120, -800},
{ -112, -112, -824},
{ -144, -56, -896},
// 60 seconds
// elapsed: 1 minutes
{ -112, -40, -944}... | { 784, -24, 0},
{ 1016, 0, 8},
{ 1192, 40, -32},
{ 1264, 136, -248},
{ 1392, 112, -200},
{ 1432, 0, -88},
{ 1216, 88, -112},
{ 952, 136, -120},
{ 1016, 152, -120},
{ 1088, 184, -48},
{ 1112, 232, -24},
{ 1072, 280, -56},
{ 1088, 304, -32},
{ 1256, 408, -8},
{ ... |
{ 1144, 728, 240},
// 68 seconds
{ 1056, 496, -40},
{ 1088, 336, 56},
{ 944, 392, -40},
{ 1024, 384, 24},
{ 1280, 384, 96},
{ 1256, 288, 64},
{ 1168, 136, 96},
{ 1264, -16, 120},
{ 1304, -40, 48},
{ 1272, 8, 0},
{ 1104, 32, 0},
{ 888, 16, -16},
{ 1056, -8, 24... |
8 we can safely use the legacy2 behavior
const uint16_t alt_radius = 8;
FillCircleImplFunc circle_func = graphics_circle_quadrant_fill_non_aa;
prv_fill_rect_internal(ctx, rect, radius, corner_mask, fill_color, alt_radius, circle_func);
}
#if PBL_COLOR
T_STATIC void prv_fill_rect_aa(GContext* ctx, const GRect *re... | prv_draw_rect_stroked(ctx, rect, ctx->draw_state.stroke_width) | ;
}
void graphics_draw_rect_by_value(GContext* ctx, GRect rect) {
graphics_draw_rect(ctx, &rect);
}
void graphics_draw_rect_precise(GContext* ctx, const GRectPrecise *rect) {
const Fixed_S16_3 right = grect_precise_get_max_x(rect);
const Fixed_S16_3 bottom = grect_precise_get_max_y(rect);
const GPointPrecise... |
cl_assert_equal_b(cancelled, false) | ;
reset = false;
r->state = RecognizerState_Failed;
recognizer_reset(r);
cl_assert_equal_i(r->state, RecognizerState_Possible);
cl_assert_equal_b(reset, true);
cl_assert_equal_b(cancelled, false);
reset = false;
r->state = RecognizerState_Cancelled;
recognizer_reset(r);
cl_assert_equal_i(r->state,... | |
SizeConfig *config = prv_config();
return GRect(config->horizontal_margin, config->artist_field.origin_y,
prv_text_layer_width(), config->artist_field.size_h);
}
static GRect prv_title_rect(void) {
const MusicAppSizeConfig *config = prv_config();
return GRect(config->horizontal_margin, config->tit... | app_timer_register(VOLUME_ICON_TIMEOUT_MS,
prv_handle_volume_icon_timer, data) | ;
}
prv_trigger_cassette_icon_switch(bitmap, true);
}
static void prv_change_volume(bool volume_is_up) {
if (!music_is_command_supported(MusicCommandVolumeUp) ||
!music_is_command_supported(MusicCommandVolumeDown)) {
return;
}
MusicAppData *data = app_state_get_user_data();
prv_show_volume_image... |
/*
* 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... | ble_task_init(config) | ;
hc_protocol_enqueue_response(request, NULL, 0);
}
static void prv_handle_shutdown(const HcProtocolMessage *request) {
#if 0 // Fixme once some space is really freed up
// Dump some statistics on stack usage before we shutdown
tasks_dump_free_space();
#endif
PBL_LOG(LOG_LEVEL_DEBUG, "Got shutdown message! G... |
(app_message_send_job) | ;
const size_t length_after_offset = (length_available - start_offset);
const size_t length_to_copy = MIN(length_after_offset, length);
size_t length_remaining = length_to_copy;
while (length_remaining) {
const uint8_t *part_data;
uint32_t data_out_pos = (length_to_copy - length_remaining);
size_t ... | |
if we're not fullscreen
if (!window->is_fullscreen) {
// a little logic to only force update when the minute changes
ApplibInternalEventsInfo *events_info =
app_state_get_applib_internal_events_info();
struct tm currtime;
sys_localtime_r(&e->clock_tick.tick_time, &currtime);
const int min... | (&events_info->button_down_event) | ;
event_service_client_subscribe(&events_info->button_up_event);
prv_legacy2_status_bar_timer_subscribe(); // a no-op on sdk3+ applications
event_loop_upkeep();
// Event loop:
while (1) {
PebbleEvent event;
sys_get_pebble_event(&event);
if (event.type == PEBBLE_PROCESS_DEINIT_EVENT) {
pr... |
/*
* 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... | flash_read_bytes(buffer, address, num_bytes) | ;
const uint32_t res = prv_calculate_incremental_remaining_bytes(buffer, num_bytes);
prv_calculate_incremental_stop();
return (res);
}
|
*
* 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 Lice... | (swap_layer, rel_change,
swap_layer->context) | |
memset(&property_animation->values, 0xff, sizeof(property_animation->values)) | ;
property_animation->animation.implementation = (AnimationImplementation*) implementation;
property_animation->subject = subject;
if (implementation->accessors.getter.int16) {
if (property_animation->animation.implementation->update
== (AnimationUpdateImplementation) property_animation_update_int16) ... | |
/*
* 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_weather_db.mutex) | ;
status_t rv = settings_file_open(&s_weather_db.settings_file,
SETTINGS_FILE_NAME,
SETTINGS_FILE_SIZE);
if (rv != S_SUCCESS) {
mutex_unlock(s_weather_db.mutex);
}
return rv;
}
static void prv_close_file_and_unlock_mutex(void) {
settin... |
ct_session_cb, NULL);
used_space = prv_get_total_file_system_bytes();
if (used_space + needed >= DLS_MAX_DATA_BYTES) {
return false;
}
}
return true;
}
// -----------------------------------------------------------------------------------------
// Open an existing or create a new storage file. ... | if (space_needed <= space_avail) {
// We have enough space
return true;
} |
uint32_t min_delta_size = space_needed - space_avail;
// The remaining strategies rely on reallocating the file, so we need to close it first
prv_release_session_file(session);
// If we can free up space by reallocating this file, try that next. Since we are
// reallocating anyways, take this chance to opt... |
e),
play_count_seq * (total_duration_a + total_duration_b));
cl_assert_equal_i(animation_get_duration(seq, true, false),
delay_seq + total_duration_a + total_duration_b);
cl_assert_equal_i(animation_get_duration(seq, true, true), duration_total);
animation_destroy(seq);
#... | (prv_count_handler_entries(&s_stopped_handler_calls, a), 0) | ;
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1);
#endif
}
// --------------------------------------------------------------------------------------
// Test that we fail if we try and put a component in more than 1 complex animation
void test_animation__reuse_components(void) {
#ifde... |
4, 136, -80},
{ 1056, 160, -96},
{ 1104, 96, -80},
{ 1224, 160, -80},
// 114 seconds
{ 1176, 160, -88},
{ 1024, 168, -104},
{ 1176, 144, -104},
{ 1272, 224, -136},
{ 1072, 224, -168},
{ 752, 208, -160},
{ 544, 192, -152},
{ 480, 184, -120},
{ 544, 184, -80},
{ 680... | {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_200_pbl_25670_12
//> TEST_EXPECTED 200
//> TEST_EXPECTED_MIN 165
//> TEST_EXPECTED_MAX 230
//> TEST_WEIGHT 1.0
static AccelRawData samples[] = {
// 0 seconds
// elapsed: 0 minutes
{ -624, 800, -16},
{ ... |
{ 976, 312, -472},
{ 920, 384, -392},
{ 928, 256, -360},
{ 936, 248, -344},
{ 912, 296, -288},
{ 896, 296, -280},
{ 880, 256, -232},
{ 864, 232, -256},
{ 880, 224, -232},
{ 904, 184, -256},
{ 904, 184, -232},
{ 904, 168, -240},
{ 912, 208, -232},
{ 904, 216, -224... |
{
fprintf(stderr, "%s\n", str);
} | ||
d[] = {
// Attribute 1
0x01, // Attribute ID - Title
0x11, 0x00, // Attribute Length
// Attribute text: "Test Notification"
0x54, 0x65, 0x73, 0x74, 0x20, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e,
// Attribute 2
0x02, ... | cl_assert(attribute_get_string(&list2, AttributeIdSubtitle, "") !=
attribute_get_string(&list, AttributeIdSubtitle, "")) | ;
cl_assert(attribute_get_string(&list2, AttributeIdBody, "") !=
attribute_get_string(&list, AttributeIdBody, ""));
attribute_list_destroy_list(&list);
kernel_free(buffer);
}
static void prv_check_app_glance_subtitle_in_attribute_list_deserializes(
const uint8_t *serialized_attribute_list_to_deserialize,... |
t_kill_process_event(task, false);
return false;
}
return true;
}
// ----------------------------------------------------------------------------------------------
uint32_t process_manager_process_events_waiting(PebbleTask task) {
ProcessContext *context = prv_get_context_for_task(task);
if (context->to... | prv_get_context() | ->wakeup_info;
}
// -------------------------------------------------------------------------------------------
DEFINE_SYSCALL(const PebbleProcessMd*, sys_process_manager_get_current_process_md, void) {
return prv_get_context()->app_md;
}
// --------------------------------------------------------------------------... |
mplementation = {
.base = {
.update = (AnimationUpdateImplementation) property_animation_update_gtransform,
},
.accessors = {
.setter = { .int16 = (const Int16Setter) prv_gtransform_setter, },
.getter = { .int16 = (const Int16Getter) prv_gtransform_getter },
},
};
start_value = GT... | (start_ms + 1) | |
, app_cache_get_next_eviction());
cl_assert_equal_i(fake_event_get_count(), 2);
}
/*************************************
* Add 3, update 2, evict 1 *
*************************************/
void test_app_cache__add_update_evict(void) {
// add all three
cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app1.id, ... | settings_file_close(&file) | ;
// End Raw SettingsFile calls
// force iteration on the app_cache. This will find the corrupted entry, and delete the app cache
app_cache_free_up_space(1);
fake_system_task_callbacks_invoke_pending();
cl_assert_equal_b(false, app_cache_entry_exists(app1.id));
cl_assert_equal_b(false, app_cache_entry_exi... |
= (typical_sleep_start_24h < sleep_start_24h);
if (fell_asleep_late) {
health_progress_bar_fill(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR,
typical_start, sleep_start);
} else {
health_progress_bar_mark(ctx, &data->progress_bar, PROGRESS_TYPICAL_COLOR, typical_st... | (base_layer) | ;
const int y = PBL_IF_RECT_ELSE(91, 100);
const GRect rect = GRect(0, y, base_layer->bounds.size.w, 60);
const char *text = i18n_get("No sleep data,\nwear your watch\nto sleep", base_layer);
graphics_context_set_text_color(ctx, NO_DATA_TEXT_COLOR);
graphics_draw_text(ctx, text, data->typical_font,
... |
itBW",
.expected_test_image_bitmap_format = GBitmapFormat1Bit,
.bitmap_create_func = prv_create_bitmap_from_pbi_file,
.need_to_destroy_bitmap = false,
},
{
.test_name = "2bitTrns",
.expected_test_image_bitmap_format = GBitmapFormat2BitPalette,
.bitmap_create_func = prv_create_bitmap_from_png... | namecat(unit_test_result_image_file_base_name, ".pbi") | ));
if (test_data->need_to_destroy_bitmap) {
gbitmap_destroy(bitmap);
}
}
}
// Tests
////////////////////////////////////
void test_graphics_draw_bitmap__origin_layer_inside(void) {
prv_origin_layer_test(GPointZero);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_graphi... |
PERSISTENT_STORAGE_FILE_SIZE);
if (rv != S_SUCCESS) {
goto cleanup;
}
data_len = settings_file_get_len(&fd, key, key_len);
// If a big enough buffer wasn't passed in, then the data can't be read.
if (data_len > buf_len ||
settings_file_get(&fd, key, key_len, data_out, buf_len) != S_SU... | prv_unlock() | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prv_lock() | ;
{
initialized = prv_check_initialized();
if (initialized || !start) {
s_outstanding_enqueues += (start) ? 1 : -1;
}
}
prv_unlock();
return initialized;
}
static bool prv_enqueue(HcProtocolMessage *message) {
PBL_ASSERTN(message->message_length >= sizeof(HcProtocolMessage));
if (!prv_up... |
services/common/regular_timer.h"
#include "services/normal/blob_db/ios_notif_pref_db.h"
#include "services/normal/blob_db/pin_db.h"
#include "services/normal/blob_db/reminder_db.h"
#include "services/normal/notifications/alerts.h"
#include "services/normal/notifications/alerts_preferences.h"
#include "services/normal/n... | {
// if more than one, then show the current index in relation to the total number
status_bar_layer_set_info_progress(&data->status_layer,
notifications_presented_list_current_idx() + 1,
notif_count);
} |
}
static void prv_cleanup_timer(EventedTimerID *timer_id) {
if (*timer_id != EVENTED_TIMER_INVALID_ID) {
evented_timer_cancel(*timer_id);
*timer_id = EVENTED_TIMER_INVALID_ID;
}
}
static void prv_cancel_reminder_watchdog(NotificationWindowData *data) {
if (regular_timer_is_scheduled(&data->reminder_wat... |
Node *prv_find_first_past(TimelineNode *head, time_t timestamp,
time_t today_midnight, bool show_all_day_events) {
TimelineNode *current = (TimelineNode *)list_get_tail((ListNode *)head);
while (current) {
if (prv_show_event(current, timestamp, today_midnight, TimelineIterDirectionPast,
show_all_day_even... | {
midnight = timeline_item_get_tz_timestamp(header);
} |
for (int i = 0; i < num_nodes; i++) {
nodes[i]->timestamp = midnight;
nodes[i]->duration = MINUTES_PER_DAY;
nodes[i]->all_day = true;
midnight += SECONDS_PER_DAY;
}
}
static void prv_add_nodes_for_serialized_item(TimelineNode **list_head,
CommonTimelineItemHeader *header) {
int num_nodes = prv... |
= comm_session_send_buffer_write_semaphore();
fake_queue_set_yield_callback(write_semph, prv_receive_but_no_bytes_freed_yield_cb);
// Try to begin writing again, requesting only one byte:
SendBuffer *write_sb2 = comm_session_send_buffer_begin_write(&s_session, ENDPOINT_ID,
... | (write_sb,
fake_data_payload + second_write_length,
second_write_length) | , true);
cl_assert_equal_i(s_send_next_count, 0);
comm_session_send_buffer_end_write(write_sb);
// Expect comm_session_send_next to be called to trigger the transport:
cl_assert_equal_i(s_send_next_count, 1);
// Exercise the transport interface:
const SessionSendQueueJob *job = (const SessionSendQueueJob ... |
test_force_garbage_collection(target_start_page);
// now lets try to create a file
fd = pfs_open(file_name, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(file_name));
cl_assert_equal_i(target_start_page, test_get_file_start_page(fd));
cl_assert(fd >= 0);
cl_assert_equal_i(pfs_close(fd), S_SUCCESS);
}
void test_... | (fd, bigbuf, sizeof(bigbuf)) | ;
cl_assert(rv == E_RANGE);
rv = pfs_read(fd, buf, sizeof(buf));
cl_assert(rv == sizeof(buf));
for (int i = 0; i < sizeof(buf); i++) {
cl_assert(buf[i] == i);
}
pfs_close(fd);
fd = pfs_open("newfile", OP_FLAG_READ, 0, 0);
rv = pfs_write(fd, buf, sizeof(buf));
cl_assert(rv == E_INVALID_ARGUMENT);... |
/*
* 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 (*flash_sr & (0x1f << 4)) {
// error raised, set bad state
header->state = *flash_sr;
} |
if (header->addr[i] != data[i]) {
header->state = 0xbd;
}
}
header->addr += header->length / sizeof(p_size_t);
header->state = STATE_WAITING;
break;
case STATE_CRC:
*data = prv_crc8((uint8_t *)header->addr, header->length);
header->s... |
he 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;
}
} else {
if (*ref_count <= 1) {
// Set the register byte to XXXXX00X to disable the rail, just mask
register_value... | {
if (BOARD_CONFIG_POWER.rail_6V6_ctrl.gpio) {
gpio_output_set(&BOARD_CONFIG_POWER.rail_6V6_ctrl, enabled);
}
} | |
n++) {
if ((mode & GPIO_MODER_MODER0) != GPIO_Mode_AN) {
pin_cfg_mask |= (0x1 << pin);
}
mode >>= 2;
}
dbgserial_putstr_fmt(buf, sizeof(buf), "Non Analog P%s cfg: 0x%"PRIx16,
name, (int)pin_cfg_mask);
name[0]++;
}
}
#endif /* DUMP_GPIO_CFG_STATE */
int main(void) {
gpio... | serial_console_init() | |
&schedule_1 });
prv_assert_alarm_config(id1, 10, 30, false, ALARM_KIND_CUSTOM, schedule_1);
// It's currently Thursday @ 00:00.
s_current_day = s_friday;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 1);
s_current_day = s_saturday;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_... | (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... |
_BW
icon_bounds.origin.x += 20; // icon left offset
#endif
graphics_context_set_compositing_mode(ctx, GCompOpSet);
graphics_draw_bitmap_in_rect(ctx, heart_icon, &icon_bounds);
char bpm_text[16];
snprintf(bpm_text, sizeof(bpm_text), i18n_get("%d BPM", i18n_owner), current_bpm);
#if PBL_BW
bounds.origin.x ... | snprintf(data->steps_buffer, sizeof(data->steps_buffer), i18n_get("%d,%03d", data),
thousands, hundreds) | ;
} else {
/// Step count less than 1000
snprintf(data->steps_buffer, sizeof(data->steps_buffer), i18n_get("%d", data),
hundreds);
}
layer_mark_dirty(&data->base_layer);
}
static void prv_update_current_steps(KickstartData *data) {
data->current_steps = health_service_sum_today(HealthMetri... |
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 int max_notif_length = 128;
char *body = kernel_malloc_check(max_notif_length);
snprintf(body, max_notif_... | {
INSIGHTS_LOG_DEBUG("Not adding sleep pin - still asleep");
return;
} | |
!gcolor_equal(color, GColorBlack);
bitset8_update(row_data, x, pixel_is_white);
}
} else if ((bitmap_format == GBitmapFormat8Bit) ||
(bitmap_format == GBitmapFormat8BitCircular)) {
GColor8 *const destination_pixel = (GColor8 *)(row_data + x);
*destination_pixel = color;
} else {
... | MIN((uint32_t)row_info.max_x,
(x_origin + png_decoder_data->previous_width - 1)) | ;
const int16_t num_bytes = max_x - min_x + 1;
if (num_bytes > 0) {
memset(row_info.data + min_x, 0, num_bytes);
}
}
}
apng_fctl fctl = {0}; // Defaults work for IDAT frame without fctl data
// If this frame doesn't have fctl, use the full width & height
if (!upng_get_apng_fctl(... |
pdFALSE;
(void)xSemaphoreGiveFromISR(bus->event_semaphore, &should_context_switch);
return should_context_switch;
}
/*-------------------BUS/PIN CONFIG FUNCTIONS--------------------------*/
// FIXME: These rail control functions should be moved to board-specific implementations
// https://pebbletechnology.atlassi... | i2c_hal_disable(bus) | ;
// Do not de-power rail if there are still devices using bus (just reset peripheral and pin
// configuration during a bus reset)
if (bus->state->user_count == 0) {
prv_bus_rail_power_down(bus);
} else {
prv_bus_pins_cfg_input(bus);
}
}
//! Perform a soft reset of the bus
//! Always lock the bus be... |
= &pin_window->status_layer;
status_bar_layer_init(status_layer);
status_bar_layer_set_separator_mode(status_layer, StatusBarLayerSeparatorModeNone);
layer_add_child(&pin_window->layer, &status_layer->layer);
const LayoutColors *colors =
layout_get_colors((LayoutLayer *)pin_window->item_detail_layer.tim... | (pin_window, item, time_util_get_midnight_of(rtc_get_time())) | |
ll_layer, &scroll_layer2);
cl_assert(content_indicator3 != content_indicator);
}
void test_content_indicator__should_only_be_created_for_scroll_layer_upon_client_access(void) {
ContentIndicatorsBuffer *content_indicators_buffer = content_indicator_get_current_buffer();
Buffer *buffer = &content_indicators_buffer... | (!content_indicator_configure_direction(&content_indicator, down, &dummy_config)) | ;
}
|
/*
* 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... | (e->accel_tap.axis, e->accel_tap.direction) | ;
}
// -----------------------------------------------------------------------------------------------
// Handle a chunk of data received for a data subscription. Called by prv_do_data_handle.
static uint32_t prv_do_data_handle_chunk(AccelServiceState *state, uint16_t time_interval_ms) {
uint32_t num_samples = 0;
... |
// the next match
if (compare_func(header, data)) {
return true;
}
}
if (pfs_seek(fd, header->payload_length, FSeekCur) < 0) {
break;
}
}
return false;
}
static bool prv_uuid_equal_func(SerializedTimelineItemHeader *header, void *data) {
Uuid *uuid = (Uuid *)data;
... | (LOG_LEVEL_ERROR, "Error reading notification header while iterating %d", result) | ;
return false;
}
if (iter_state->header.common.status & TimelineItemStatusDeleted) {
return true;
}
return prv_get_notification(&iter_state->notification, &iter_state->header, iter_state->fd);
}
static void prv_set_header_status(SerializedTimelineItemHeader *header, uint8_t status, int fd) {
// See... |
////////////////////////
status_t reminder_db_delete_with_parent(const TimelineItemId *parent_id) {
return (timeline_item_storage_delete_with_parent(&s_storage, parent_id,
reminders_handle_reminder_removed));
}
status_t reminder_db_read_item(TimelineItem *item_out,... | (&hdr->common.id) | |
{ -48, 856, -384},
{ -40, 864, -384},
{ -40, 864, -384},
{ -40, 864, -384},
{ -40, 864, -384},
{ -40, 864, -384},
{ -40, 864, -376},
{ -40, 872, -384},
{ -48, 864, -384},
{ -40, 864, -384},
{ -40, 864, -392},
{ -40, 864, -384},
{ -40, 864, -384},
{ -48, 864, -384},
... | { -32, 864, -384},
// 117 seconds
{ -40, 864, -384},
{ -32, 864, -384},
{ -32, 856, -384},
{ -32, 864, -384},
{ -32, 856, -392},
{ -40, 864, -384},
{ -32, 864, -384},
{ -32, 864, -384},
{ -32, 856, -384},
{ -40, 864, -384},
{ -32, 864, -384},
{ -32, 864, -376},
... |
{ -32, 856, -384},
{ -32, 864, -384},
{ -32, 856, -384},
{ -40, 864, -384},
{ -32, 856, -384},
{ -32, 864, -384},
{ -32, 856, -392},
{ -32, 864, -384},
{ -32, 864, -384},
// 120 seconds
// elapsed: 2 minutes
{ -32, 856, -384},
{ -32, 864, -384},
{ -40, 864, -384}... |
// different regions in flash to avoid premature burnout of any particular region.
// @param[in] new If true, then return a pointer to a region where a new image can be stored.
// If false, then return the region containing the most recent stored image or
// CORE_DUMP_FLASH_INVALID_ADDR ... | if (s_test_force_inf_loop) {
while (true) ;
} |
if (s_test_force_assert) {
PBL_ASSERTN(false);
}
// Create the packed chunk header
strncpy ((char *)packed_info.name, task_info->pcName, CORE_DUMP_THREAD_NAME_SIZE);
packed_info.id = (uint32_t)task_info->taskHandle;
packed_info.running = (current_task_id == task_info->taskHandle);
for (int i = 0; i ... |
ngs_raw_iter logic error. "
"Attempting to read affected file into RAM for easier debugging...");
uint8_t *contents = read_file_into_ram(iter);
PBL_LOG(LOG_LEVEL_INFO, "Removing affected file %s...", iter->file_name);
// Remove the file that caused us to get into this state before we reboot,
// that w... | (iter, key_out, iter->hdr.key_len) | |
ond_line.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_y);
layer_render_tree(&canvas, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_y.${BIT_DEPTH_NAME}.pbi"));
test_gra... | graphics_context_set_text_color(&ctx, GColorBlack) | |
r (int i=0; i < MAX_PULSE_FDS; ++i) {
if (s_transfer_fds[i].impl == NULL) {
s_transfer_fds[i] = (PulseTransferFD) {
.impl = domain_handler,
.domain_state = NULL,
.transfer_state = { 0 }
};
*fd = &s_transfer_fds[i];
return i;
}
}
return -1;
}
static void prv_f... | {
if (cmd->read.length == 0) {
prv_respond_internal_error(cmd, length, E_INVALID_ARGUMENT);
return;
}
PulseTransferFD *pulse_fd = prv_get_fd(cmd, length);
if (!pulse_fd) {
// prv_get_fd has already sent an error response
return;
}
pulse_fd->transfer_state.offset = cmd->read.address;
puls... |
static void prv_handle_write(Command *cmd, size_t length) {
PulseTransferFD *pulse_fd = prv_get_fd(cmd, length);
if (!pulse_fd) {
// prv_get_fd has already sent an error response
return;
}
size_t payload_length = length - sizeof(cmd->opcode) - sizeof(cmd->write);
int ret = pulse_fd->impl->write_pro... |
/*
* 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... | TEST_PBI_FILE_FMT(8bit) | |
// time, or you BusFault (maybe). Set this to true
// for memory regions where reads smaller than 32
// bits will fail. The start pointer must also be
// word-aligned.
} MemoryRegion;
// Memory regions to dump
static const M... | dbgserial_putchar(*msg) | ;
++msg;
}
dbgserial_putstr(buffer);
#endif
}
static NORETURN prv_reset(void) {
dbgserial_flush();
system_hard_reset();
}
// -----------------------------------------------------------------------------------------
void coredump_assert(int line) {
prv_debug_str_int("CD: assert - line ", line);
boot_bi... |
{
jerry_cleanup();
rocky_runtime_context_deinit();
} |
}
static const RockyGlobalAPI *s_graphics_api[] = {
&GRAPHIC_APIS,
NULL,
};
extern RockyAPITextState s_rocky_text_state;
void test_rocky_api_graphics__handles_text_state(void) {
cl_assert_equal_i(0, s_fonts_get_system_font.call_count);
cl_assert_equal_i(0, s_graphics_text_attributes_destroy.call_count);
r... | |
/*
* 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... | (rot_bitmap_layer) | ;
}
void rot_bitmap_layer_set_corner_clip_color(RotBitmapLayer *image, GColor color) {
if (gcolor_equal(color, image->corner_clip_color)) {
return;
}
image->corner_clip_color = color;
layer_mark_dirty(&(image->layer));
}
void rot_bitmap_layer_set_corner_clip_color_2bit(RotBitmapLayer *bitmap, GColor2 colo... |
/*
* 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... | (db_id == s_blobdb_id) | |
e, RecognizerState_Failed);
cl_assert_equal_i(recognizers[4]->state, RecognizerState_Failed);
// Touchdown occurs, Window recognizer completes, active layer becomes non-null
e.type = TouchEvent_Touchdown;
s_next_state = RecognizerState_Completed;
s_idx_to_change = 0;
s_active_layer = &layer_a;
recognizer... | (&window.layer, &GRectZero) | ;
Layer *root = &window.layer;
RecognizerManager manager;
recognizer_manager_init(&manager);
Layer layer_a;
layer_init(&layer_a, &GRectZero);
layer_add_child(root, &layer_a);
manager.window = &window;
manager.active_layer = &layer_a;
recognizer_add_to_list(r1, &layer_a.recognizer_list);
recognize... |
MS; i++) {
if (prv_clocksource_is_lse_started()) {
return true;
}
delay_us(1000);
}
dbgserial_putstr("LSE oscillator did not start");
return false;
}
//! This routine relies on bootbits already having enabled
//! access to the PWR clock and backup domain. Re-enabling
//! it here breaks wakeup ... | prv_bcd_to_byte(time_register & (RTC_TR_ST | RTC_TR_SU)) | ;
return (((hours * 60) + minutes) * 60) + seconds;
}
static uint32_t prv_elapsed_ticks(uint32_t before, uint32_t after) {
int32_t result = after - before;
if (result < 0) {
result = (TICKS_IN_INTERVAL - before) + after;
}
return result;
}
void rtc_slow_down(void) {
if (prv_slow_mode()) {
// If w... |
false;
} else {
// Default timestamp for next chunk
state->timestamp_ms += samples * 1000 / state->sampling_rate;
state->num_samples = 0;
// Fill it again from accel circular buffer
accel_manager_dispatch_data();
}
}
unlock:
mutex_unlock_recursive(s_mutex);
return success;
}... | list_remove(&state->list_node, &s_data_subscribers /* &head */, NULL /* &tail */) | ;
kernel_free(state);
// All data subscribes are also tap subscribers
prv_tap_remove_subscriber_cb(pebble_task_get_current());
if (!s_data_subscribers) {
// If no one left using the data subscription, disable it
sys_vibe_history_stop_collecting();
accel_set_num_samples(... |
d prv_coredump_click_config(void *context) {
window_single_click_subscribe(BUTTON_ID_UP, prv_coredump_confirm_cb);
window_single_click_subscribe(BUTTON_ID_DOWN, prv_confirm_pop);
window_single_click_subscribe(BUTTON_ID_BACK, prv_confirm_pop);
}
static void prv_coredump_reset_confirm_cb(ClickRecognizerRef recogni... | layer_add_child(&data->window.layer, menu_layer_get_layer(menu_layer)) | |
OFF_TIME);
} else {
PBL_LOG(LOG_LEVEL_ERROR, "BT driver failed to start!");
// FIXME: PBL-36163 -- handle this better
}
stop_mode_enable(InhibitorCommMode);
}
static void prv_comm_stop(void) {
if (!s_comm_is_running) {
return;
}
stop_mode_disable(InhibitorCommMode);
#if CAPABILITY_HAS_BUILTIN_... | (ANALYTICS_DEVICE_METRIC_BT_OFF_TIME, AnalyticsClient_System) | ;
gatt_client_subscription_boot();
}
static void prv_bt_ctl_reset_bluetooth_callback(void *context) {
PBL_LOG(LOG_LEVEL_DEBUG, "Resetting Bluetooth");
mutex_lock(s_comm_state_change_mutex);
bool was_already_running = s_comm_is_running;
prv_comm_stop();
prv_comm_start();
// It's possible a reset was t... |
app_state_get_user_data() | ;
++(app_data->axis_offsets[app_data->app_state]);
layer_mark_dirty(&app_data->window.layer);
}
static void prv_save_offsets_callback(void *data) {
AppData *app_data = app_state_get_user_data();
mfg_info_set_disp_offsets((GPoint) {
.x = app_data->axis_offsets[X_AdjustState],
.y = app_data->axis_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... | (s_sectors[sector], VoltageRange_1) | |
k app 1
memset(&temp, 0, sizeof(AppDBEntry));
cl_assert_equal_i(S_SUCCESS, app_db_get_app_entry_for_uuid(&app1.uuid, &temp));
cl_assert_equal_b(true, uuid_equal(&app1.uuid, &temp.uuid));
cl_assert_equal_i(0 , strncmp((char *)&app1.name, (char *)&temp.name, APP_NAME_SIZE_BYTES));
// check app 2
memset(&temp... | (false, app_db_exists_install_id(4)) | ;
}
static const uint8_t some_data[] = {0x01, 0x02, 0x17, 0x54};
void prv_enumerate_entries(AppInstallId install_id, AppDBEntry *entry, void *data) {
switch(install_id) {
case 1:
cl_assert_equal_m(&app1, entry, sizeof(AppDBEntry));
break;
case 2:
cl_assert_equal_m(&app2, entry, sizeof(AppD... |
/*
* 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... | {
SimpleDialog *simple_dialog = simple_dialog_create("AlarmSnoozeSet");
Dialog *dialog = simple_dialog_get_dialog(simple_dialog);
const char *snooze_text = i18n_noop("Snooze delay set to %d minutes");
char snooze_buf[64];
snprintf(snooze_buf, sizeof(snooze_buf), i18n_get(snooze_text, dialog), alarm_get_snooze... | |
static MockCallRecordings s_layer_mark_dirty;
void layer_mark_dirty(Layer *layer) {
s_layer_mark_dirty.call_count++;
s_layer_mark_dirty.last_call = (MockCallRecording){.layer = layer};
}
static MockCallRecordings s_graphics_context_set_fill_color;
void graphics_context_set_fill_color(GContext* ctx, GColor color) ... | {
rocky_runtime_context_init();
jerry_init(JERRY_INIT_EMPTY);
} |
static void prv_deinit(void) {
jerry_cleanup();
rocky_runtime_context_deinit();
}
void test_js__initialize(void) {
fake_pbl_malloc_clear_tracking();
s_skip_mem_leak_check = false;
fake_app_timer_init();
prv_init();
s_app_window_stack_get_top_window = (Window){};
s_app_state_get_graphics_context = NU... |
l_i(gap_le_get_advertising_data(&ad_data_out), data_length); \
cl_assert_equal_s((const char *) &ad_data_out, ad_data_cstring); \
}
//! Helper to create BLEAdData from C strings.
//! In reality, people will use ble_ad_create() and the ble_ad_set_* functions,
//! but that's part of another test.
static BLEAdData *cre... | assert_ad_data("yo") | ;
gap_le_assert_advertising_interval(advert_terms[0].min_interval_slots,
advert_terms[0].max_interval_slots);
regular_timer_fire_seconds(1);
// Second term:
cl_assert(gap_le_is_advertising_enabled());
assert_ad_data("yo");
gap_le_assert_advertising_interval(advert_term... |
/*
* 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... | {
// Setup graphics context
framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS});
framebuffer_clear(&s_fb);
graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App);
s_app_state_get_graphics_context = &s_ctx;
// Setup resources
fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */);
... |
void test_health_sleep_detail_card__cleanup(void) {
}
// Helpers
//////////////////////
// static void prv_create_card_and_render(HealthData *health_data) {
// Window *window = health_sleep_detail_card_create(health_data);
// window_set_on_screen(window, true, true);
// window_render(window, &s_ctx);
// }
st... |
_timezone_title(void) {
/// Title of the menu for changing the watch's timezone.
return i18n_noop("Timezone");
}
// Timezone Region Menu
/////////////////////////
static void prv_region_menu_select(OptionMenu *option_menu, int selection, void *context) {
SettingsTimeData *data = ((SettingsOptionMenuData *)conte... | (subtitle, data) | , NULL);
}
static void prv_selection_will_change_cb(SettingsCallbacks *context, uint16_t *new_row,
uint16_t old_row) {
if (!clock_timezone_source_is_manual() && *new_row == TimeRow_Timezone) {
*new_row = old_row;
}
}
static uint16_t prv_num_rows_cb(SettingsCallbacks *c... |
s_has_pending_create_connection = false;
}
#endif
}
static void prv_mutate_whitelist(const BTDeviceInternal *device, bool is_adding) {
#if !BLE_MASTER_CONNECT_SUPPORT // PBL-32761
PBL_LOG(LOG_LEVEL_WARNING, "BLE whitelist mutation unimplemented");
#else
unsigned int stack_id = bt_stack_id();
BLE_GAP_LOG_DEB... | (&s_intents->node, prv_intent_filter_disconnected, NULL) | ;
}
static uint32_t prv_intents_count(void) {
return list_count(&s_intents->node);
}
static bool prv_is_intent_used(const GAPLEConnectionIntent *intent) {
return (intent->client[GAPLEClientKernel].is_used |
intent->client[GAPLEClientApp].is_used);
}
// --------------------------------------------------... |
sort the UUID's and then search more quickly. This will most likely
// require many changes to the JSON generation script.
AppInstallId app_get_install_id_for_uuid_from_registry(const Uuid *uuid) {
for (uint16_t i = 0; i < ARRAY_LENGTH(APP_RECORDS); i++) {
const AppRegistryEntry *reg_entry = &APP_RECORDS[i];
... | (callback_node->node.prev == NULL) | ;
PBL_ASSERTN(s_head_callback_node_list != &callback_node->node);
PBL_ASSERTN(callback_node->callbacks != NULL);
callback_node->registered_by = pebble_task_get_current();
s_head_callback_node_list = list_prepend(s_head_callback_node_list, &callback_node->node);
}
void app_install_deregister_callback(struct A... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | alerts_should_notify_for_type(AlertReminder) | );
cl_assert(!alerts_should_notify_for_type(AlertPhoneCall));
}
void test_alerts__do_not_disturb(void) {
cl_assert(alerts_get_mask() == AlertMaskAllOn);
// We now allow notifications to come through in DND mode
s_dnd_active = true;
cl_assert(alerts_should_notify_for_type(AlertMobile));
cl_assert(alerts_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... | (
list, size, intermediate, *to, second_normalized, data->interpolate, index_lookup,
data->point_duration, two_stage) | ;
const AnimationProgress stroke_width_progress = data->stroke_width.curve ?
data->stroke_width.curve(normalized) :
animation_timing_curve(normalized, AnimationCurveEaseInOut);
gdraw_command_list_scale_stroke_width(
list, data->stroke_width.from, data->stroke_width.to,
data->stroke_width.fr... |
icon(&s_phone_ui_data->action_bar, button);
return;
}
gbitmap_deinit(storage);
gbitmap_init_with_resource_system(storage, SYSTEM_APP, resource);
action_bar_layer_set_icon(&s_phone_ui_data->action_bar, button, storage);
}
// Returns the appropriate app id for the given phone number and call source
static c... | (BUTTON_ID_UP, up_icon, &s_phone_ui_data->up_bitmap) | ;
prv_set_action_bar_icon(BUTTON_ID_SELECT, select_icon, &s_phone_ui_data->select_bitmap);
prv_set_action_bar_icon(BUTTON_ID_DOWN, down_icon, &s_phone_ui_data->down_bitmap);
} else {
prv_hide_action_bar();
}
action_bar_layer_set_click_config_provider(&s_phone_ui_data->action_bar,
... |
mation_schedule(selection_layer->next_cell_animation);
#else
selection_layer->selected_cell_idx++;
layer_mark_dirty(&selection_layer->layer);
#endif
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Click handlers
void prv_up_down_click_handler(ClickRecognize... | animation_unschedule(selection_layer->value_change_animation) | ;
}
void selection_layer_destroy(SelectionLayer* selection_layer) {
if (selection_layer) {
selection_layer_deinit(selection_layer);
applib_free(selection_layer);
}
}
void selection_layer_set_cell_width(SelectionLayer *selection_layer, unsigned idx, unsigned width) {
if (selection_layer && idx < selectio... |
/*
* 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... | {
// Do not call 'disappear' handler on window displaced by modal window
window_set_on_screen(window, false, false);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.