prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
);
tz_data->utc_offset_min = ntohs(tz_data->utc_offset_min);
const char *region_name = tz_data->region_name;
if (tz_data->region_name_len == 0) {
region_name = "[N/A]";
}
PBL_LOG(LOG_LEVEL_DEBUG, "set_timezone utc_time: %u offset: %d region_name: %s",
(int) tz_data->utc_time, (int) tz_data->utc... | {
format = add_space ? "%u:%02u PM" : "%u:%02uPM";
} |
}
return sniprintf(buffer, size, format, time_util_get_num_hours(hours, is24h), minutes);
}
size_t clock_copy_time_string_timestamp(char *buffer, uint8_t size, time_t timestamp) {
struct tm time;
sys_localtime_r(×tamp, &time);
return clock_format_time(buffer, size, time.tm_hour, time.tm_min, true);
}
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
*data ^= HDLC_ESCAPE_MASK;
return true;
} |
return false;
}
|
,
.attributes = attributes,
},
.action_group = {
.num_actions = ARRAY_LENGTH(actions),
.actions = actions,
}
};
Uuid i2;
uuid_generate(&i2);
TimelineItem e2 = {
.header = {
.id = i2,
.type = TimelineItemTypeNotification,
.status = 0,
.ancs_uid = 0,
... | {
uuid_generate(&uuids[i]);
e.header.id = uuids[i];
e.header.timestamp = timestamp + i;
notification_storage_store(&e);
} |
TimelineItem r;
cl_assert(notification_storage_get(&uuids[0], &r));
e.header.id = uuids[0];
e.header.timestamp = timestamp;
compare_notifications(&e, &r);
free(r.allocated_buffer);
cl_assert(notification_storage_get(&uuids[i - 1], &r));
e.header.id = uuids[i - 1];
e.header.timestamp = timestamp + 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... | {
return false;
} |
for (size_t j = 0; j < sentence->word_count; j++) {
TranscriptionWord *word = (TranscriptionWord *) cursor;
cursor = (uint8_t *) word->data;
// Check that word header fits into buffer and length is valid
if ((cursor >= end) || (word->length == 0) || (word->data + word->length > end) ||
... |
.h"
#include "services/normal/timeline/actions_endpoint.h"
#include "services/normal/timeline/layout_layer.h"
#include "services/normal/timeline/timeline.h"
#include "services/normal/timeline/timeline_actions.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/math.h"
#include <stdint.h>
#include... | {
animation_set_curve(animation, AnimationCurveEaseOut);
} | |
er *layer, bool finished, void *context) {
TimelineLayout *layout = context;
KinoReel *new_reel = kino_reel_create_with_resource_system(layout->icon_res_info.res_app_num,
layout->icon_res_info.res_id);
prv_change_reel(layout, new_reel);
if (!layout->i... | prv_change_reel(pin_timeline_layout, new_reel) | ;
layer_set_clips((Layer *)pin_timeline_layout, false);
layer_set_clips((Layer *)&pin_timeline_layout->icon_layer, false);
kino_layer_set_callbacks(&pin_timeline_layout->icon_layer, (KinoLayerCallbacks) {
.did_stop = prv_pin_to_card_first_half_stopped,
}, pin_timeline_layout);
kino_layer_play_section(&p... |
el + bytes - delta_bytes : left_pixel;
if (delta_bytes) {
memmove(to, from, bytes - delta_bytes);
if (patch_garbage) {
memset(garbage_start, fill_byte, delta_bytes);
}
}
if (delta_neg) {
if (delta_bits) {
const int rshift = delta_... | MIN(src_row_info.max_x, max_x) | ;
const int16_t src_pixels = src_max_x - src_min_x + 1;
const int16_t x_offset = src_min_x - dst_min_x;
const int16_t copy_pixels = MIN(src_pixels, dst_pixels);
memmove(dst_row_info.data + dst_min_x + x_offset, src_row_info.data + src_min_x,
(size_t)copy_pixels);
... |
express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "workout_selection.h"
#include "workout_utils.h"
#include "applib/app.h"
#include "applib/ui/ui.h"
#include "kernel/pbl_malloc.h"
#include "resource/resource_ids.auto.h"
#include ... | #else
graphics_draw_bitmap_in_rect(ctx, icon, &image_bounds);
#endif
GRect title_bounds = cell_layer->bounds;
title_bounds.origin.x = title_origin_x;
title_bounds.origin.y = title_top_padding;
title_bounds.size.w -= title_origin_x;
title_bounds.size.h = title_height;
graphics_draw_text(ctx, i18n_get(tit... |
static void prv_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *context) {
WorkoutSelectionWindow *selection_window = (WorkoutSelectionWindow *)context;
ActivitySessionType activity_type = prv_get_activity_type(cell_index->row);
selection_window->select_workout_cb(activity_type);
window_s... |
cope scope) {
#if !CAPABILITY_HAS_HEALTH_TRACKING
return HealthServiceAccessibilityMaskNotSupported;
#else
if (prv_is_heart_rate_metric(metric) && !sys_activity_prefs_heart_rate_is_enabled()) {
return HealthServiceAccessibilityMaskNoPermission;
}
if (!prv_metric_aggregation_implemented(metric, time_start, ... | if (metric == HealthMetricHeartRateBPM) {
if (query_cur_minute) {
// If the client is querying the service for the most recent Stable/Median/Filtered value
// and it is within the last X minutes, return it. If it's older than X minutes, return 0.
// This is the behavior we shipped in FW 4.1, so we... |
return raw_bpm;
}
// Invalid
return 0;
}
// ----------------------------------------------------------------------------------------------
HealthValue health_service_aggregate_averaged(HealthMetric metric, time_t time_start,
time_t time_end, HealthAggregation a... |
Zero;
}
const GFont title_font = prv_get_cell_title_font(config);
const uint8_t title_font_height = fonts_get_font_height(title_font);
GSize cell_layer_bounds_size = cell_layer_bounds->size;
// Bail out if we can't even fit a single line of the title
if (title_font_height > cell_layer_bounds_size.h) {
... | graphics_text_layout_get_max_used_size(
ctx, config->title, title_font, rect, config->overflow_mode, text_alignment, NULL) | |
/*
* 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 INSTALL_ID_INVALID;
} |
#include "process_management/process_loader.h"
void * process_loader_load(const PebbleProcessMd *app_md, PebbleTask task,
MemorySegment *destination) {
return app_md->main_func;
}
#include "services/normal/process_management/app_storage.h"
AppStorageGetAppInfoResult app_storage_get_process... |
rrupted by the app.
//! Note that it's in theory possible for a misbehaving app to pass in a consumed_up_to_ptr that is
//! mid-way in a message. If it does so, it won't crash the kernel, but it will result in delivery
//! of broken messages to the app, but it won't be our fault...
static void prv_consume(AppInboxConsu... | {
info.dropped_handler(info.num_failed);
} | else {
PBL_LOG(LOG_LEVEL_ERROR, "Dropped %"PRIu32" messages but no dropped_handler",
info.num_failed);
}
}
// Report back up to which byte we've consumed the data.
sys_app_inbox_service_consume(&info);
}
bool app_inbox_service_register(uint8_t *storage, size_t storage_size,
... |
_v_minor,
&s_parsed_msg.events.num_events,
s_parsed_msg.events.events,
s_parsed_msg.events.uuids,
&s_parsed_msg.events.num_sessions,
s_parsed_msg.events.sessions);
if (!success) {
LOG("No encoded msg available");
} else {
LOG("ProtobufLogType: %d", s_parsed_msg.type);
LOG("payload_s... | cl_assert_equal_i(a_event->activity_session.type.type.internal_type,
b_event->activity_session.type.type.internal_type) | ;
cl_assert_equal_i(a_event->activity_session.start_reason,
b_event->activity_session.start_reason);
// TODO: Add more detailed comparisons
}
}
}
}
static void prv_fill_version(TestPLParsedMsg *msg) {
msg->payload_sender_v_major = GIT_TAG_V_MAJOR;
msg->payload_... |
%aM %aS %aM %aS %aS
%0T = %0H:%0M:%0S %0M:%0S %0S
%fT = %fH:%0M:%0S %fM:%0S %fS
%0uT = %0uH, %0uM, and %0uS %0uM, and %0uS %0uS
%0aT = %0aH %0aM %0aS %0aM %0aS %0aS
%0fT = %0fH:%0M:%0S ... | ("TmplStringSing", " d") | |
/*
* 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_context_set_fill_color(ctx, bg_color) | ;
graphics_fill_round_rect(ctx, &rect, 3, GCornersAll);
rect.origin.y -= PBL_IF_RECT_ELSE(3, 2);
// Restrict the rect to draw one line at a time to prevent them from wrapping into each other
rect.size.h = 16;
graphics_context_set_text_color(ctx, text_color);
graphics_draw_text(ctx, typical_text, font, re... |
{
prv_clock_get_relative_time_string(buffer, buf_size, timestamp, false, max_relative_hrs, true);
} |
void clock_get_until_time_capitalized(char *buffer, int buf_size, time_t timestamp,
int max_relative_hrs) {
prv_clock_get_relative_time_string(buffer, buf_size, timestamp, true, max_relative_hrs, true);
}
void clock_get_until_time_without_fulltime(char *buffer, int buf_size, t... | |
-------------------------------------------------------------------------------------------
DEFINE_SYSCALL(uint32_t, sys_accel_manager_get_num_samples, AccelSessionRef session,
uint64_t *timestamp_ms) {
uint32_t result = 0;
mutex_lock_recursive(s_mutex);
{
AccelSubscriberState* state = prv_subs... | (LOG_LEVEL_ERROR, "Failed to start accel service") | |
// check third
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id));
// check fourth
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[3].header.id));
// check third again
cl_assert(iter_prev(&iterator));
cl_assert(uuid... | (timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast,
1421395200),
S_NO_MORE_ITEMS) | ;
fake_pbl_malloc_clear_tracking();
// Thursday Jan 16 14:00:00 PST 2015
// all items garbage collected
rtc_set_time(1421445600);
head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast,
1421445600)... |
/*
* 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... | {
*number_out = result;
} |
return number_started;
}
// -------------------------------------------------------------------------------------------------
// Parsing comma-separated value
uint8_t ams_util_csv_parse(const char *csv_value, uint32_t csv_length,
void *context, AMSUtilCSVCallback callback) {
if (csv_v... |
zeof(TimelineLayoutInfo));
timeline_layout_init_info(info, item, state->current_day);
info->scroll_direction = layer->scroll_direction;
info->app_id = item->header.parent_id;
GRect rect;
prv_get_frame(layer, index, &rect);
const LayoutLayerConfig config = {
.frame = &rect,
.attributes = &item->attr... | timeline_layout_create_up_down_animation(timeline_layout, &from, &to, &icon_from, &icon_to,
duration, interpolate) | |
/*
* 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... | atan2_lookup((int16_t)((y4 - y3) / fixedpoint_base),
(int16_t)((x4 - x3) / fixedpoint_base)) | - a23);
if (da1 >= TRIG_MAX_ANGLE) {
da1 = TRIG_MAX_ANGLE - da1;
}
if (da2 >= TRIG_MAX_ANGLE) {
da2 = TRIG_MAX_ANGLE - da2;
}
if (da1 + da2 < max_angle_tolerance) {
// Finally we can stop the recursion
return gpath_builder_line_to_point(builder, GPoint(x1234 / fixedpoint_base,
... |
(pfs_read(fd, &read_byte, sizeof(read_byte)), sizeof(read_byte)) | ;
cl_assert_equal_i(read_byte, 0xff - i);
}
}
pfs_close(fd);
}
void test_pfs__write(void) {
int rv = pfs_write(-1, NULL, 0);
cl_assert(rv == E_INVALID_ARGUMENT);
rv = pfs_write(1000000, NULL, 0);
cl_assert(rv == E_INVALID_ARGUMENT);
rv = pfs_write(0, NULL, 0);
cl_assert(rv == E_INVALID_ARG... | |
ALL_REGISTERS.AON_SPARE_REG = CRG_TOP->AON_SPARE_REG;
// QSPIC
ALL_REGISTERS.QSPIC_CTRLMODE_REG = QSPIC->QSPIC_CTRLMODE_REG;
ALL_REGISTERS.QSPIC_BURSTCMDA_REG = QSPIC->QSPIC_BURSTCMDA_REG;
ALL_REGISTERS.QSPIC_BURSTCMDB_REG = QSPIC->QSPIC_BURSTCMDB_REG;
ALL_REGISTERS.QSPIC_WRITEDATA_REG = QSPIC->QSPIC_WRITE... |
ALL_REGISTERS.CACHE_MRM_MISSES_REG = CACHE->CACHE_MRM_MISSES_REG;
ALL_REGISTERS.CACHE_MRM_CTRL_REG = CACHE->CACHE_MRM_CTRL_REG;
ALL_REGISTERS.CACHE_MRM_TINT_REG = CACHE->CACHE_MRM_TINT_REG;
ALL_REGISTERS.CACHE_MRM_THRES_REG = CACHE->CACHE_MRM_THRES_REG;
ALL_REGISTERS.SWD_RESET_REG = CACHE->SWD_RESET_REG;
#e... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&attr_list, AttributeIdIconTiny,
TIMELINE_RESOURCE_BLE_HRM_SHARING) | |
on Jan 1, 2015 for all of these tests
static struct tm s_init_time_tm = {
// Thursday, Jan 1, 2015, 10:00am
.tm_hour = 10,
.tm_mday = 1,
.tm_mon = 0,
.tm_year = 115
};
#define ACTIVE_MINUTES 2
#define AVERAGE_STEPS 1000
#define HIGH_STEPS 2000
#define MAX_ACTIVITY_SESSIONS 24
extern void prv_calculate_metr... | {
previous_exit_utc = s_data.activity_sessions[prev].start_utc
+ (s_data.activity_sessions[prev].length_min * SECONDS_PER_MINUTE);
} | else {
previous_exit_utc = midnight;
}
time_t start_utc = previous_exit_utc + offset_sec;
if (start_utc > rtc_get_time()) {
printf("now_utc: %ld, start_utc: %ld\n", rtc_get_time(), start_utc);
}
cl_assert(start_utc <= rtc_get_time());
if (start_utc + length_sec > rtc_get_time()) {
printf("now_... |
QSPIFlash *dev, uint32_t addr, void *buffer, uint32_t length,
uint8_t instruction, uint8_t dummy_cycles, bool is_ddr) {
qspi_mmap_start(dev->qspi, instruction, addr, dummy_cycles, length, is_ddr);
// Point the buffer at the QSPI region
memcpy(buffer, (uint32_t *)(QSPI_MMAP_B... | if (buffer[i] != FLASH_RESET_WORD_VALUE) {
return false;
} |
}
}
return true;
}
#endif
static bool prv_blank_check_mmap(QSPIFlash *dev, uint32_t addr, bool is_subsector) {
const uint32_t size_bytes = is_subsector ? SUBSECTOR_SIZE_BYTES : SECTOR_SIZE_BYTES;
bool result = true;
uint8_t instruction;
uint8_t dummy_cycles;
bool is_ddr;
prv_get_fast_read_params(d... |
----------------------------------
//! Apple's iBeacon AD DATA format.
//! The byte-order of Apple's fields (uuid, major and minor) is Big Endian (!!!)
//! @see Apple's docs for more info: http://goo.gl/iOrnpj
//! @see StackOverflow distance/accuracy calculations: http://goo.gl/yH0ubM
static const uint16_t COMPANY_ID_A... | (ad_out, COMPANY_ID_APPLE,
(uint8_t *) &raw_ibeacon,
sizeof(raw_ibeacon)) | |
.context = &(NotificationLayoutInfo) {
.item = notification,
#if !PLATFORM_TINTIN
.show_notification_timestamp = true,
#endif
},
};
LayoutLayer *layout = layout_create(notification->header.layout, &config);
data->layout_layers[i] = layout;
} |
const bool animated = true;
app_window_stack_push(window, animated);
}
////////////////////
// App boilerplate
static void s_main(void) {
handle_init();
app_event_loop();
}
const PebbleProcessMd* swap_layer_demo_get_app_info() {
static const PebbleProcessMdSystem s_app_info = {
.common = {
.ma... | |
4, -368},
{ 824, 456, -456},
{ 736, 816, -528},
{ 560, 856, -464},
{ 240, 920, -368},
{ -16, 1080, -232},
{ -224, 1024, 32},
{ -224, 1208, 144},
{ -176, 1080, 168},
{ 152, 1296, 264},
{ 216, 1096, 320},
{ 248, 1176, 384},
{ 224, 1160, 352},
{ 256, 1008, 152},
// 5... | { 16, -128, -1024},
{ 16, -168, -1040},
{ 32, -160, -1024},
{ 40, -168, -1008},
{ 40, -200, -1008},
{ 168, -112, -1048},
{ 64, -160, -1040},
{ 8, -136, -1032},
{ -32, -152, -1032},
{ -24, -152, -1016},
{ -24, -144, -1016},
{ -16, -152, -1032},
{ -24, -144, -1024},
... | |
LIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 2);
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// AA = true, SW = 3
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 3);
graphics... | (&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 1) | ;
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw1_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// SW = 2
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 2);
graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP);
cl_chec... |
ies(&s_started_handler_calls, a1), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a1), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a2), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a2), 1);
cl_assert_equal_i(prv_count_handler_... | prv_clear_handler_histories() | ;
uint64_t start_ms = prv_now_ms();
animation_schedule(seq);
// Test the elapsed
int32_t elapsed_ms;
animation_get_elapsed(seq, &elapsed_ms);
cl_assert_equal_i(elapsed_ms, -1 * (delay_seq));
animation_get_elapsed(a, &elapsed_ms);
cl_assert_equal_i(elapsed_ms, -1 * (delay_seq + delay_a));
animati... |
&bogus_session, slice) & APP_GLANCE_RESULT_INVALID_SESSION);
// Check that adding a slice with APP_GLANCE_SLICE_DEFAULT_ICON as the icon succeeds
slice = (AppGlanceSlice) {
.expiration_time = APP_GLANCE_SLICE_NO_EXPIRATION,
.layout.icon = APP_GLANCE_SLICE_DEFAULT_ICON,
.layout.subtitle_template_string ... | {
app_glance_reload(prv_reload_with_validation_cb, s_test_state.context);
cl_assert_equal_b(s_test_state.reload_callback_was_called, true);
} |
static void prv_glance_clear_test(AppGlanceReloadCallback reload_cb) {
// Insert some slices for the glance
const AppGlance glance = (AppGlance) {
.num_slices = 2,
.slices = {
{
.expiration_time = 1464734504, // (Tue, 31 May 2016 22:41:44 GMT)
.type = AppGlanceSliceType_IconAndSubtit... |
_after_midnight / SECONDS_PER_MINUTE;
uint32_t hour = minutes_after_midnight / MINUTES_PER_HOUR;
uint32_t minute = minutes_after_midnight % MINUTES_PER_HOUR;
snprintf(text, text_len, "%d:%02d", (int)hour, (int)minute);
}
// ----------------------------------------------------------------------------------------... | window_long_click_subscribe(BUTTON_ID_DOWN, k_long_press_timeout_ms,
sleep_down_long_click_handler, NULL) | ;
}
// -------------------------------------------------------------------------------
static void sleep_update_text(HealthAPITestAppData *data) {
if (!data->sleep_card.text_layer) {
return;
}
int32_t sleep_total_sec = health_service_sum_today(HealthMetricSleepSeconds);
int32_t sleep_deep_sec = health_ser... |
40, -160},
// 35 seconds
{ 1048, 344, -72},
{ 1136, 256, 0},
{ 1136, 232, 32},
{ 976, 232, 104},
{ 872, 264, 112},
{ 864, 256, 128},
{ 872, 224, 152},
{ 840, 184, 160},
{ 832, 216, 112},
{ 880, 168, 128},
{ 1048, 168, 88},
{ 1112, 176, 32},
{ 1360, -8, 96},
{ ... | { 936, 392, 8},
{ 1192, 448, -64},
{ 1344, 472, -80},
{ 1752, 416, -32},
{ 1512, 392, -56},
{ 1256, 376, -104},
{ 1256, 288, -48},
{ 1272, 208, 0},
// 41 seconds
{ 1232, 200, 8},
{ 992, 216, 40},
{ 832, 200, 72},
{ 808, 176, 88},
{ 808, 144, 88},
{ 768, 128, 9... |
{ 1088, 224, 64},
{ 976, 240, 56},
{ 928, 192, 88},
{ 920, 144, 120},
{ 872, 136, 128},
{ 808, 160, 56},
{ 784, 104, 80},
{ 896, 104, 80},
{ 1000, 56, 40},
{ 1320, 128, 32},
{ 1432, 240, -240},
{ 1312, 312, -368},
{ 1312, 400, -280},
{ 1384, 488, -248},
// 44... |
em/status_codes.h"
#include "util/math.h"
#define STM32F4_COMPATIBLE
#define STM32F7_COMPATIBLE
#include <mcu.h>
static QSPIFlashPart QSPI_FLASH_PART = {
.instructions = {
.fast_read = 0x0B,
.fast_read_ddr = 0x0D,
.page_program = 0x02,
.erase_sector_4k = 0x20,
.erase_block_64k = 0xD8,
.writ... | {
return qspi_flash_erase_suspend(QSPI_FLASH, sector_addr);
} | |
#include "board/board.h"
#include "drivers/accessory.h"
#include "drivers/dma.h"
#include "drivers/gpio.h"
#include "drivers/periph_config.h"
#include "drivers/pmic.h"
#include "kernel/events.h"
#include "kernel/pbl_malloc.h"
#include "kernel/util/stop.h"
#include "mfg/mfg_mode/mfg_factory_mode.h"
#include "services/c... | (BOARD_CONFIG.mic_config.i2s_sd.gpio, &GPIO_InitStructure) | ;
GPIO_PinAFConfig(BOARD_CONFIG.mic_config.i2s_sd.gpio,
BOARD_CONFIG.mic_config.i2s_sd.gpio_pin_source, BOARD_CONFIG.mic_config.i2s_sd.gpio_af);
gpio_release(BOARD_CONFIG.mic_config.i2s_ck.gpio);
gpio_release(BOARD_CONFIG.mic_config.i2s_sd.gpio);
// I2S configuration
SPI_I2S_DeInit(BOARD_CONFIG.mic_co... |
/*
* 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... | (TextStyleFont_MenuCellSubtitle) | |
_interval_within_last_minute(now_utc, time_start, time_end);
const bool valid_hr_sample_num = ((now_utc - time_start) <= HS_MAX_MINUTE_DATA_SEC);
if (metric == HealthMetricHeartRateBPM) {
if (query_cur_minute) {
// If the client is querying the service for the most recent Stable/Median/Filtered value
... | (APP_LOG_LEVEL_ERROR, "Unsupported scope: %d", (int) scope) | |
&ctx, GColorBlue);
graphics_fill_rect(&ctx, &GRect(0, 0, 20, 10));
graphics_draw_rotated_bitmap(&ctx, test_image_color,
GPoint(30, 30), DEG_TO_TRIGANGLE(45), GPointZero);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
"draw_rotated_bitmap_origin_color_set_cent... | (
test_image->bounds.size.w / 2 - 1,
test_image->bounds.size.h / 2 - 1) | |
GCornerMask corner_mask) {
s_graphics_fill_rect.call_count++;
s_graphics_fill_rect.last_call = (MockCallRecording) {
.ctx = ctx,
.rect = rect,
.radius = radius,
.corner_mask = corner_mask,
};
}
GPointPrecise gpoint_from_polar_precise(const GPointPrecise *precise_cente... | cl_assert(*s_log_internal__expected == NULL) | |
easons)
// see prv_adjust_drawing_state_for_legacy2_apps()
// so all we need to alter is the height of the frame
frame.size.h = STATUS_BAR_HEIGHT;
if (window_stack_is_animating_with_fixed_status_bar(window->parent_window_stack)) {
frame.origin.x = 0;
}
status_bar_layer_render(ctx, &frame... | {
return window_manager_get_window_click_manager(window_manager_get_top_window());
} | |
nce 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 exp... | if (id == APP_ID_DEFAULT_WATCHFACE) {
static const PebbleProcessMdSystem s_default_watchface_md = {
.common.process_type = ProcessTypeWatchface,
};
return (const PebbleProcessMd *)&s_default_watchface_md;
} else {
return launcher_menu_app_get_app_info();
} | |
ack enough times to cause everything that is normally periodically
// recomputed (walking rate, sleep, etc.) to be recomputed
static void prv_force_periodic_updates(void) {
for (int i = 0; i < ACTIVITY_SESSION_UPDATE_MIN; i++) {
activity_test_run_minute_callback();
}
}
// -------------------------------------... | (context, passed) | ;
}
// -------------------------------------------------------------------------------
static void prv_test_30_min_walk(void *context) {
bool passed = false;
activity_prefs_activity_insights_set_enabled(true);
// Reset all stored data
activity_test_reset(true /*reset_settings*/, true /*tracking_on*/, NULL, ... |
%-10s %-10s", "weight_err", "status");
printf("\n------------------------");
for (int i = 0; i < ARRAY_LENGTH(metrics); i++) {
printf("| ---------------------- ");
}
float weighted_sum = 0.0;
int pass_count = 0;
int fail_count = 0;
ActivityFileTestEntry *entry = &test_entry[0];
ActivityTestResult... | {
time_t now = rtc_get_time();
int start_idx = ((session->start_utc - now) / SECONDS_PER_MINUTE) + 1;
int len = session->len_minutes;
cl_assert(start_idx + len < samples_len);
for (int i = start_idx; i < start_idx + len; i++) {
samples[i] = (KAlgTestActivityMinute) {
.steps = session->steps / len,... |
// -----------------------------------------------------------------------------------
// Feed activity minute data into the kalg_activities_update method
static void prv_feed_activity_minutes(KAlgTestActivityMinute *samples, int samples_len) {
time_t now = rtc_get_time();
for (int i = 0; i < samples_len; i++) {... |
th an error,
// don't wait for an (N)ACK (it won't ever come), but finish right away:
outbox->result = result;
prv_transition_to_accepting(outbox);
}
//! Use sys_current_process_schedule_callback to maximize the stack space available to the
//! app's failed_callback.
static void prv_handle_outbox_error_async(App... | if (phase == OUT_WRITING) {
PBL_LOG(LOG_LEVEL_ERROR,
"Must call app_message_outbox_send() before calling app_message_outbox_begin() again!");
return APP_MSG_INVALID_STATE;
} else if (phase == OUT_CLOSED) {
PBL_LOG(LOG_LEVEL_ERROR,
"Must call app_message_open() before calling app_me... |
// Reset the send state (dictionary, counters, etc.)
// We do this here, as this function is only called when we begin a new outbox,
// so the state should always be clean when we return successfully.
prv_outbox_prepare(outbox);
*iterator = &outbox->iterator;
outbox->phase = OUT_WRITING;
outbox->result ... |
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 16, -1000},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 16, -1000},
{ 48, 32, -1000},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 40, 24, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 40, 16... |
{ 48, 24, -1000},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 16, -1000},
{ 48, 16, -1000},
{ 48, 32, -1008},
{ 40, 8, -1000},
{ 48, 24, -1000},
{ 48, 24, -1000},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 16, -1000},
{ 48, 24, -1000},
{ 48, 16... | |
e *)list_pop_head((ListNode *)node);
kernel_free(temp);
}
}
unlock:
mutex_unlock_recursive(s_app_cache_mutex);
return rv;
}
//////////////////////
// AppCache Helpers
//////////////////////
// Remove the filename entry in the PFSFileList (via context) that corresponds to the
// app install id passed i... | {
prv_delete_cached_files();
goto unlock;
} | |
NULL);
}
// ------------------------------------------------------------------------------------------------
bool activity_tracking_on(void) {
bool result;
mutex_lock_recursive(s_activity_state.mutex);
result = s_activity_state.started;
mutex_unlock_recursive(s_activity_state.mutex);
return result;
}
// ... | syscall_assert_userspace_buffer(utc_start, sizeof(*utc_start)) | ;
syscall_assert_userspace_buffer(num_records, sizeof(*num_records));
syscall_assert_userspace_buffer(minute_data, *num_records * sizeof(HealthMinuteData));
}
return activity_get_minute_history(minute_data, num_records, utc_start);
}
// --------------------------------------------------------------------... |
fset(&l.scroll_layer).y);
}
void test_menu_layer__test_set_selection_animation(void) {
MenuLayer l;
const int height = 180;
menu_layer_init(&l, &GRect(10, 10, height, 180));
menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){
.draw_row = prv_draw_row,
.get_num_rows = prv_get_num_rows,
});
cl_... | menu_layer_init(&l, &GRect(10, 10, height, 180)) | ;
menu_layer_set_center_focused(&l, true);
menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks){
.draw_row = prv_draw_row,
.get_num_rows = prv_get_num_rows,
.get_cell_height = prv_get_row_height_depending_on_selection_state,
});
const int FOCUSED = MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT... |
cord the first alarm time
if (!s_most_recent_alarm_recorded) {
s_most_recent_alarm_recorded = true;
// Read from flash since the in-memory cache can be modified
prv_alarm_operation(s_most_recent_alarm_id, prv_record_alarm_op, NULL);
}
}
}
// -------------------------------------------------... | memcpy(&config_out->scheduled_days, config.scheduled_days, sizeof(config.scheduled_days)) | ;
return true;
}
return false;
}
// ----------------------------------------------------------------------------------------------
static void prv_alarm_set_config(SettingsFile *file, AlarmId id, const AlarmConfig* config) {
PBL_ASSERTN(id >= 0 && id < MAX_CONFIGURED_ALARMS);
Alarm alarm = { .id = id, .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... | {
PBL_LOG(LOG_LEVEL_ERROR, "Failed to write all bytes of order list");
} |
pfs_close(fd);
cleanup:
kernel_free(storage);
mutex_unlock(s_data.order_mutex);
}
typedef struct {
const Uuid *uuid_list;
uint8_t count;
AppMenuOrderStorage *storage;
} UuidTranslateData;
// search for a UUID in a list of UUID's. Return the index in which it was found or -1 if not found.
int prv_uuid_se... |
ER_CELL_RECT_CELL_HEIGHT;
#elif PBL_ROUND
return menu_layer_is_index_selected(menu_layer, cell_index) ?
LAUNCHER_MENU_LAYER_CELL_ROUND_FOCUSED_CELL_HEIGHT :
LAUNCHER_MENU_LAYER_CELL_ROUND_UNFOCUSED_CELL_HEIGHT;
#else
#error "Unknown display shape type"
#endif
}
static void prv_play_glance_for_row(Launche... | layer_init(up_arrow_layer, &up_arrow_layer_frame) | ;
layer_add_child(container_layer, up_arrow_layer);
const int16_t down_arrow_layer_frame_origin_y =
(int16_t)(frame.size.h - LAUNCHER_MENU_LAYER_CONTENT_INDICATOR_LAYER_HEIGHT);
const GRect down_arrow_layer_frame =
grect_inset(frame, GEdgeInsets(down_arrow_layer_frame_origin_y, 0, 0, 0));
Layer *d... |
nd.
cl_assert_equal_b(shared_prf_storage_get_valid_page_number(), 0);
}
// Sets the getting started field, then corrupts the ble_pairing_data crc
// This tests that when setting a value, all fields in the struct must be valid.
void test_shared_prf_storage_v3__handle_currupt_field_during_setting(void) {
bool GETTIN... | cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 0) | ;
shared_prf_storage_set_getting_started_complete(true);
cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 1);
shared_prf_storage_set_getting_started_complete(true);
cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 1);
shared_prf_storage_set_getting_started_complete(false);
cl_asser... |
d);
activity_get_metric_typical(ActivityMetricSleepEnterAtSeconds, local_tm.tm_wday,
&health_data->typical_sleep_start);
activity_get_metric_typical(ActivityMetricSleepExitAtSeconds, local_tm.tm_wday,
&health_data->typical_sleep_end);
activity_get_metric... | (&utc_sec, &local_tm) | ;
int32_t today_min = local_tm.tm_hour * MINUTES_PER_HOUR + local_tm.tm_min;
const int k_minutes_per_step_avg = MINUTES_PER_DAY / ACTIVITY_NUM_METRIC_AVERAGES;
// each average chunk is 15 mins long
if (health_data->step_average_last_updated_time !=
((today_min / k_minutes_per_step_avg) * k_minutes_per... |
eHdr *hdr = (PLogMessageHdr *)buffer;
bool success = protobuf_log_private_mset_decode(
&s_parsed_msg.type,
(uint8_t *)buffer + sizeof(*hdr),
hdr->msg_size,
s_parsed_msg.payload_sender_type,
s_parsed_msg.payload_sender_id,
s_parsed_msg.payload_sender_version_patch,
&s_parsed_m... | ("payload_sender_version: major: %"PRIu32", minor: %"PRIu32", patch: %s",
s_parsed_msg.payload_sender_v_major,
s_parsed_msg.payload_sender_v_minor,
s_parsed_msg.payload_sender_version_patch) | ;
LOG("payload_send_time: %"PRIu32"", s_parsed_msg.payload_send_time);
const int num_events = s_parsed_msg.events.num_events;
LOG("Events: Number: %d", num_events);
for (int i = 0; i < num_events; i++) {
pebble_pipeline_Event *event = &s_parsed_msg.events.events[i];
LOG(" Event -- Type: %d... |
d_space_for_strings += prv_max_ellipsified_cstring_size(negative_action);
required_space_for_strings += prv_max_ellipsified_cstring_size(app_id);
if (prv_should_add_sender_attr(app_id, title)) {
required_space_for_strings += prv_max_ellipsified_cstring_size(title);
}
int num_pebble_actions = 0;
if (noti... | attribute_list_destroy_list(&dismiss->attr_list) | |
/*
* 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... | {
time_t timestamp = ancs_notifications_util_parse_timestamp(date);
if (timestamp == 0) {
// Another ANCS / iOS quirk, some apps (i.e. the Phone app)
// send an invalid-length string as date...
// Apple rdar://19639333
timestamp = rtc_get_time();
// copy out app ID to a char buffer
char app... |
static bool prv_should_ignore_because_calendar_reminder(const ANCSAttribute *app_id) {
// do not show calendar notifications if we have reminders set (PBL-13271)
return pstring_equal_cstring(&app_id->pstr, IOS_CALENDAR_APP_ID) && !reminder_db_is_empty();
}
static bool prv_reminder_filter(SerializedTimelineItemHe... |
ic bool prv_serial_dump_chunk_callback(uint8_t* msg, uint32_t total_length) {
LogBinaryMessage* message = (LogBinaryMessage *)msg;
char buffer[256];
char time_buffer[TIME_STRING_BUFFER_SIZE];
message->message[message->message_length] = 0;
prompt_send_response_fmt(buffer, sizeof(buffer), "%c %s %s:%d> %s",
... | (s_abusive_timer, 1, prv_waste_time_cb, context, 0) | ;
}
}
void command_waste_time(const char *count_arg, const char *delay_arg) {
int count = atoi(count_arg);
int delay = atoi(delay_arg);
if (count <= 0 || count > 0xFFFF || delay <= 0 || delay > 0xFFFF) {
prompt_send_response("Nope.");
return;
}
struct WasteTimerData data = { count, delay };
uin... |
,
{ 1344, 296, -152},
{ 1040, 304, 24},
{ 848, 256, 40},
{ 824, 240, 56},
{ 840, 256, 40},
// 89 seconds
{ 824, 304, 0},
{ 800, 304, -72},
{ 896, 376, -176},
{ 1120, 344, -184},
{ 1136, 312, -192},
{ 1344, 200, 32},
{ 1496, 320, 56},
{ 1288, 400, 0},
{ 1104, 2... | { 1456, 384, 0},
{ 976, 272, 40},
{ 1168, 200, 80},
{ 1312, -8, 240},
{ 1056, 16, 224},
{ 920, 48, 160},
{ 848, 48, 128},
{ 816, -16, 96},
{ 760, -96, 80},
{ 744, -176, 32},
{ 848, -208, 0},
// 95 seconds
{ 960, -120, -56},
{ 1472, -208, 32},
{ 1528, -96, 72},... |
{ 864, 216, 88},
{ 888, 296, 136},
{ 896, 368, 104},
{ 880, 296, 24},
{ 912, 320, -104},
{ 1008, 336, -176},
{ 1184, 304, -184},
{ 1304, 184, 48},
{ 1736, 264, 88},
{ 1264, 376, 24},
{ 1008, 240, 104},
{ 1176, 120, 232},
{ 1200, 40, 264},
{ 1000, 32, 240},
{ ... |
ader = { .common.id = UUID_INVALID };
// Find the most recent notification which matches this ANCS UID - this will be the last entry in
// the db. iOS can reset ANCS UIDs on reconnect, so we want to avoid finding an old notification
bool found = false;
while (prv_find_next_notification(&header, prv_ancs_id_com... | pfs_close(new_fd) | |
/*
* 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... | (t, lcltime) | ;
}
void launcher_task_add_callback(void (*callback)(void *data), void *data) {
callback(data);
}
// Tests
///////////////////////////
void test_clock__basic_no_timezone_set_time(void) {
s_prefs_24h_style = false;
fake_rtc_init(0, 0);
rtc_timezone_clear();
clock_init();
static const time_t jan1st_noon_200... |
grab session->data-mutex
// - if you already own session->data-mutex, it is OK to grab s_list_mutex
bool dls_lock_session(DataLoggingSession *session) {
mutex_lock_recursive(s_list_mutex);
if (session->status != DataLoggingStatusActive) {
mutex_unlock_recursive(s_list_mutex);
return false;
}
P... | while (iter != NULL) {
if (iter->tag == tag && uuid_equal(&(iter->app_uuid), app_uuid)
&& iter->status == DataLoggingStatusActive) {
mutex_unlock_recursive(s_list_mutex);
return (iter);
}
iter = iter->next;
} |
mutex_unlock_recursive(s_list_mutex);
return (NULL);
}
void dls_list_remove_session(DataLoggingSession *logging_session) {
if (uuid_is_system(&logging_session->app_uuid)) {
PBL_LOG(LOG_LEVEL_WARNING, "Deleting the system data logging session with tag %"PRIu32,
logging_session->tag);
}
mute... |
vity_get_sessions_values.out.num_sessions = 7;
health_service_activities_iterate(HealthActivityRun | HealthActivityWalk |
HealthActivityOpenWorkout,
now - (100 * SECONDS_PER_MINUTE),
now, HealthIterationDirecti... | (
&(ActivitySession) {.start_utc = now, .length_min = 10},
&(ActivitySession) {.start_utc = now - (2 * SECONDS_PER_MINUTE), .length_min = 5},
HealthIterationDirectionFuture) | |
h"
#include "stubs_calendar_layout.h"
#include "stubs_click.h"
#include "stubs_content_indicator.h"
#include "stubs_dialog.h"
#include "stubs_do_not_disturb.h"
#include "stubs_event_loop.h"
#include "stubs_event_service_client.h"
#include "stubs_evented_timer.h"
#include "stubs_generic_layout.h"
#include "stubs_health_... | attribute_list_add_resource_id(attr_list, AttributeIdIconTiny, s_test_data.icon_id) | ;
if (s_test_data.app_name) {
attribute_list_add_cstring(attr_list, AttributeIdAppName, s_test_data.app_name);
}
if (s_test_data.title) {
attribute_list_add_cstring(attr_list, AttributeIdTitle, s_test_data.title);
}
if (s_test_data.subtitle) {
attribute_list_add_cstring(attr_list, AttributeIdSubti... |
px;
} else {
text_top_margin_px += status_layer_offset;
icon_top_margin_px += status_layer_offset;
}
}
y = text_top_margin_px;
h = bounds->size.h - y;
// Set up the text.
TextLayer *text_layer = &dialog->text_layer;
text_layer_init_with_parameters(text_layer, &GRect(x, y, w, h),
... | { // DialogActionBarConfirm || DialogActionBarDecline
gbitmap_destroy(actionable_dialog->select_icon);
} |
}
if (actionable_dialog->dialog.destroy_on_pop) {
applib_free(actionable_dialog);
}
}
Dialog *actionable_dialog_get_dialog(ActionableDialog *actionable_dialog) {
return &actionable_dialog->dialog;
}
void actionable_dialog_push(ActionableDialog *actionable_dialog, WindowStack *window_stack) {
dialog_pus... |
);
{
if (connection_is_valid(connection)) {
PBL_LOG(LOG_LEVEL_DEBUG, "Changing connection flag: %c=%u",
prv_debug_char_for_flag(flag), enabled);
if (enabled) {
connection->flags |= (1 << flag);
} else {
connection->flags &= ~(1 << flag);
}
}
}
prv_unlo... | PBL_LOG(LOG_LEVEL_WARNING, "Gatt: Attempted to pop recent op when list empty") | ;
PBL_ASSERTN(0);
}
connection->gatt_op_list = (GattOperation *)
list_get_head(list_pop_tail((ListNode *)connection->gatt_op_list));
kernel_free(tmp_tail);
}
prv_unlock();
return rv;
}
|
er cell drawing functions using MenuCellLayerConfig
static void prv_menu_cell_draw_dispatch(GContext *ctx, Layer *cell_layer, MenuCellType cell_type,
const MenuCellLayerConfig *config, bool icon_subbitmap) {
GRect old_icon_bounds = GRectZero;
if (config->icon) {
old_icon_... | {
gbitmap_destroy(s_dest_bitmap);
const unsigned int num_row_heights = ARRAY_LENGTH(s_menu_system_cell_test_row_heights);
const unsigned int num_rows = ARRAY_LENGTH(s_menu_system_cell_test_row_data);
// Multiply num_columns * 2 to account for drawing both focused and unfocused side-by-side
const int num_col... |
const int16_t row_height = prv_get_row_height_for_index(row_height_index);
for (unsigned int column_index = 0; column_index < num_columns; column_index++) {
const MenuLayerSystemCellTestColumnData column_data = columns[column_index];
int16_t x_offset = GRID_CELL_PADDING + column_index * ((... |
/*
* 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... | (center, distance << GPOINT_PRECISE_PRECISION, angle) | ;
}
static void prv_graphics_draw_centered_text(GContext *ctx, const GSize *max_size,
const GPoint *center, const GFont font,
const GColor color, const char *text) {
GSize text_size = app_graphics_text_layout_get_content_size(
... |
ECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1);
prv_draw_hline_test_pattern(&ctx, prv_hline_pattern_blend_horizontal_line_raw);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_core_blend_horizontal_line_raw")));
};
void prv_assign_horizontal_line_delta_raw(GBitmap *fram... | (&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_core_blend_vertical_line_raw")) | |
.flags = 0,
.layout = LayoutIdTest,
},
.attr_list = {
.num_attributes = 0,
.attributes = NULL,
},
.action_group = {
.num_actions = 0,
.actions = NULL,
},
.allocated_buffer = NULL,
}, {
.header = { // [1]
.id = {0x6b, 0xf6, 0x21, 0x5b, 0xc... | (uuid_equal(&s_items[s_correct_order[0]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id)) | ;
cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id));
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(0));
cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(... |
running any apps whose
//! flags are set, and to stop all apps whose flags are unset. Depending
//! on the firmware loaded onto the HRM, multiple apps can be run
//! concurrently by setting the logical OR of the App IDs.
static bool prv_set_running_apps(HRMDevice *dev, AS7000AppId apps) {
return prv_write_register(de... | psleep(SHUT_DOWN_DELAY_MS) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
PBL_LOG(LOG_LEVEL_DEBUG, "SELECT long clicked!");
(void)data;
(void)recognizer;
} |
#endif
static void click_config_provider(ScrollAppData *data) {
// The config that gets passed in, has already the UP and DOWN buttons configured
// to scroll up and down. It's possible to override that here, if needed.
// Configure how the SELECT button should behave:
window_single_click_subscribe(BUTTON_ID... |
, 144},
{ 1344, -120, 0},
{ 1120, -16, -80},
{ 888, -8, -104},
{ 808, -32, -16},
{ 896, -56, 32},
{ 752, -24, -120},
{ 1080, -24, -128},
{ 1256, -40, 0},
{ 1352, 80, -168},
{ 1440, 80, -136},
// 82 seconds
{ 1368, 48, -88},
{ 1096, 104, -120},
{ 968, 136, -96},
... | { 976, 8, 8},
{ 936, -24, 32},
{ 1008, 40, -32},
{ 1000, -16, -56},
{ 1048, -168, 80},
{ 1136, 8, -216},
{ 1120, 152, -264},
{ 1224, 40, -80},
{ 1312, -40, -56},
{ 1160, 80, -96},
{ 1048, 224, -176},
{ 960, 200, -72},
{ 1016, 208, 64},
{ 1152, 216, 16},
{ 1072... |
{ 1304, 232, -80},
{ 1144, 288, -80},
{ 976, 360, -32},
{ 1320, 616, 160},
{ 1088, 696, -96},
{ 880, 120, 72},
{ 1216, 296, 0},
{ 1320, 440, -40},
{ 1160, 408, 120},
{ 1152, 304, 96},
{ 1312, 248, 88},
{ 1264, 208, 64},
{ 1280, 40, 120},
{ 1304, -48, 136},
{ ... |
StateInvalid:
return false;
}
WTF;
}
static void prv_update_glance_for_music_state(LauncherAppGlanceStructured *structured_glance) {
LauncherAppGlanceMusic *music_glance =
launcher_app_glance_structured_get_data(structured_glance);
PBL_ASSERTN(music_glance);
// Zero out the glance's subtitle buf... | (&music_glance->music_event_info) | ;
return &structured_glance->glance;
}
|
_ID, Payload: 0x55
RECEIVE(0x00, 0x01,
OTHER_NON_EXISTENT_ENDPOINT_ID >> 8, OTHER_NON_EXISTENT_ENDPOINT_ID & 0xff, 0x55);
cl_assert_equal_i(s_prepare_count, 0);
assert_meta_response_sent(MetaResponseCodeUnhandled);
// Length: 1, Endpoint ID: PRIVATE_TEST_ENDPOINT_ID, Payload: 0xaa
RECEIVE(0x00, 0x0... | (s_cleanup_count, 1) | ;
}
void test_session_receive_router__payload_in_pieces(void) {
// Expect that when a message's payload is received in pieces, the complete payload will be
// written and finish will only be called after the whole payload has been received.
const uint8_t expected_payload[] = { 0xaa, 0xbb, 0xcc, 0xdd, 0xee };
... |
er section & row combination than B or else -1
int16_t menu_index_compare(const MenuIndex *a, const MenuIndex *b) {
const int16_t max_rows = MAX(a->row, b->row) + 1;
const int32_t a_abs = ((a->section * max_rows) + a->row);
const int32_t b_abs = ((b->section * max_rows) + b->row);
if (a_abs > b_abs) {
retur... | {
if (change_ongoing_animation) {
prv_cancel_selection_animation(menu_layer);
}
// Move selection inverter layer:
const int16_t w = menu_layer->scroll_layer.layer.frame.size.w;
const GSize size = GSize(w, menu_layer->selection.h);
menu_layer->inverter.layer.bounds = (GRect) {
.origin... |
}
static MenuRowAlign prv_corrected_scroll_align(MenuLayer *menu_layer, MenuRowAlign align) {
if (menu_layer->center_focused) {
return MenuRowAlignCenter;
}
return align;
}
static void prv_menu_layer_update_selection_scroll_position(MenuLayer *menu_layer,
... |
glance_in_cache->current_slice.expiration_time);
}
}
/////////////////////
// Public API
void launcher_app_glance_service_draw_glance_for_app_node(LauncherAppGlanceService *service,
GContext *ctx, const GRect *frame,
... | {
return;
} |
kino_player_deinit(&service->glance_reel_player);
event_service_client_unsubscribe(&service->glance_event_info);
prv_glance_cache_deinit(service);
prv_reset_slice_expiration_timer(service);
kino_reel_destroy(service->generic_glance_icon);
}
|
/*
* 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... | (atoi("713713 4 job fiesta111"), 713713) | ;
}
void test_atoi__sign(void) {
cl_assert_equal_i(atoi("+500"), 500);
cl_assert_equal_i(atoi("-765"), -765);
cl_assert_equal_i(atoi(" -573888"), -573888);
cl_assert_equal_i(atoi(" +713713"), +713713);
}
void test_atoi__error(void) {
cl_assert_equal_i(atoi("2147483647"), 2147483647); // last valid value
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | gbitmap_create_blank(s10, GBitmapFormat4BitPalette) | ;
cl_assert(NULL != bmp);
cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette
bmp = gbitmap_create_blank(s10, GBitmapFormat8BitCircular);
cl_assert(NULL == bmp);
bmp = gbitmap_create_blank(s180, GBitmapFormat8BitCircular);
cl_assert(NULL == bmp);
#endif
#ifdef PLATF... |
/*
* 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... | ((uint8_t *)&crc, sizeof(crc), true) | ;
debug_print_str_and_int("Computed CRC: ", (int)crc);
}
static void prv_handle_load_data_command(void) {
debug_print_str("LD CMD\n");
struct __attribute__((packed)) {
uint32_t copy_address;
uint32_t length;
} send_data_cmd_payload = { };
prv_write_or_read_bytes(&send_data_cmd_pay... |
int8_t version) {
if (s_quick_launch_setup_opened != version) {
s_quick_launch_setup_opened = version;
prv_pref_set(PREF_KEY_QUICK_LAUNCH_SETUP_OPENED, &s_quick_launch_setup_opened,
sizeof(s_quick_launch_setup_opened));
}
}
uint8_t quick_launch_get_quick_launch_setup_opened(void) {
retur... | {
return s_activity_prefs_workout_app_opened;
} |
void activity_prefs_set_workout_app_opened_version(uint8_t version) {
if (s_activity_prefs_workout_app_opened != version) {
s_activity_prefs_workout_app_opened = version;
prv_pref_set(PREF_KEY_ACTIVITY_WORKOUT_APP_OPENED, &s_activity_prefs_workout_app_opened,
sizeof(s_activity_prefs_workout... |
[2].header.id));
// check fifth
cl_assert(iter_next(&iterator));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check sixth
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id));
}
void test_timeline__n... | (uuid_equal(&state.pin.header.id, &s_long_items[3].header.id)) | ;
#if CAPABILITY_HAS_CORE_NAVIGATION4
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[2].header.id));
#endif
cl_assert(!iter_prev(&iterator));
}
static int prv_num_items(Iterator iterator) {
int n = 1;
while (iter_next(&iterator)) {
n++;
}
return n;
}
void... |
--------
void process_manager_send_callback_event_to_process(PebbleTask task, void (*callback)(void *data), void *data) {
PBL_ASSERTN(callback != NULL);
PebbleEvent event = {
.type = PEBBLE_CALLBACK_EVENT,
.callback = {
.callback = callback,
.data = data,
},
};
process_manager_send_even... | prv_get_context() | ->app_md;
if (!app_md) {
return false;
}
*uuid_out = app_md->uuid;
return true;
}
// -------------------------------------------------------------------------------------------
DEFINE_SYSCALL(AppInstallId, sys_process_manager_get_current_process_id, void) {
return prv_get_context()->install_id;
}
// ---... |
sh_impl_use();
prv_issue_command(0, S29VSCommand_SectorLock);
prv_issue_command_argument(0, S29VSCommand_SectorLock);
start_sector = flash_impl_get_sector_base_address(start_sector);
end_sector = flash_impl_get_sector_base_address(end_sector);
((__IO uint16_t*) (FMC_BANK_1_BASE_ADDRESS + start_sector))[0] ... | flash_impl_get_sector_base_address(sector_addr) | ;
flash_impl_use();
prv_issue_command(sector_addr, S29VSCommand_ClearStatusRegister);
// Some sanity checks
{
status_t error = S_SUCCESS;
const uint8_t sr = prv_read_status_register(sector_addr);
if ((sr & S29VSStatusBit_DeviceReady) == 0) {
// Another operation is already in progress.
... |
/*
* 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_num, id, start_bytes, buffer, num_bytes) | |
ettings_file_delete(file, PREF_KEY_BACKLIGHT_BEHAVIOUR_DEPRECATED,
sizeof(PREF_KEY_BACKLIGHT_BEHAVIOUR_DEPRECATED));
}
}
// ------------------------------------------------------------------------------------
void shell_prefs_init(void) {
s_backlight_intensity =
prv_convert_backligh... | prv_prefs_entry(key, key_len) | |
2 KiB - 640 bytes workerlib static = 11648 bytes
return 11648;
}
static size_t prv_get_worker_stack_size(const PebbleProcessMd *app_md) {
return 1400;
}
// ------------------------------------------------------------------------------------------------
bool worker_manager_launch_new_worker_with_args(const PebbleP... | (LOG_LEVEL_DEBUG, "Worker heap init %p %p",
worker_segment.start, worker_segment.end) | ;
heap_init(worker_heap, worker_segment.start, worker_segment.end,
/* enable_heap_fuzzing */ false);
heap_set_lock_impl(worker_heap, (HeapLockImpl) {
.lock_function = prv_heap_lock,
});
process_heap_set_exception_handlers(worker_heap, app_md);
// Init services required for this process befo... |
p_malloc(num_sessions * sizeof(ActivitySession));
if (!sessions) {
snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text),
"Not enough memory");
return;
}
// Get sessions
bool success = activity_get_sessions(&num_sessions, sessions);
if (!success) {
snprintf(data... | (data->debug_card.dialog_text, temp, sizeof(data->debug_card.dialog_text)) | ;
// Write steps, calories, distance
snprintf(temp, sizeof(temp), " %"PRIu16", %"PRIu16"C, %"PRIu16"m\n", session->step_data.steps,
session->step_data.active_kcalories + session->step_data.resting_kcalories,
session->step_data.distance_meters);
safe_strcat(data->debug_card.dialog_... |
/*
* 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... | (m, MBUF_FLAG_IS_FREE) | |
P_METRIC_CRASHED_COUNT, AnalyticsClient_App);
} else if (task == PebbleTask_Worker) {
analytics_inc(ANALYTICS_APP_METRIC_BG_CRASHED_COUNT, AnalyticsClient_Worker);
}
if (context->app_md->is_rocky_app) {
analytics_inc(ANALYTICS_DEVICE_METRIC_APP_ROCKY_CRASHED_COUNT, AnalyticsClient_System);
}... | prv_handle_app_stop_analytics(context, task, gracefully) | ;
return true;
}
// Non-graceful close
if (context->closing_state == ProcessRunState_Running ||
context->closing_state == ProcessRunState_GracefullyClosing) {
// Right before a syscall drops privilege, it calls
// process_manager_force_close_syscall_exit_trap to check whether
... |
/*
* 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... | ("DISTANCE", card_data) | ,
.secondary_value = app_zalloc_check(buffer_len),
.fill_color = GColorWhite,
.outline_color = PBL_IF_COLOR_ELSE(GColorClear, GColorBlack),
};
prv_set_calories(heading->primary_value, buffer_len,
health_data_current_calories_get(health_data));
prv_set_distance(heading->secondary_v... |
/*
* 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, 64 * 1024, 2 * 64 * 1024, 3 * 64 * 1024) | ;
cl_assert_equal_i(s_command_list_index, 1);
cl_assert_equal_i(s_command_list[0].addr, 64 * 1024);
cl_assert_equal_i(s_command_list[0].type, SectorEraseCommand);
s_command_list_index = 0;
// Erase two sectors 0x10000 - 0x30000 but allow us to erase more
flash_region_erase_optimal_range(0, 64 * 1024, 3 *... |
1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornerTopRight);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_aa_topright.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphi... | (&ctx, fb) | |
&bpm, &hr_zone));
cl_assert_equal_i(steps, 10);
// Increment a lot so we can make sure that the wrap around of midnight works.
prv_inc_steps_and_put_event(1000);
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m,
... | workout_service_frontend_closed() | |
ta.swap_layer);
// Scroll down the specified number of times
SwapLayer *swap_layer = &s_notification_window_data.swap_layer;
for (int i = 0; i < num_down_scrolls; i++) {
prv_attempt_scroll(swap_layer, ScrollDirectionDown, false /* is_repeating */);
fake_animation_complete(swap_layer->animation);
swap... | ((PreferredContentSizeDefault < PreferredContentSizeLarge) ? 1 : 0, 0) | ;
prv_prepare_canvas_and_render_notification_windows(num_down_scrolls);
FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE();
}
void test_notification_window__title_subtitle_body(void) {
s_test_data = (NotificationWindowTestData) {
.icon_id = TIMELINE_RESOURCE_NOTIFICATION_GOOGLE_INBOX,
.title = "Henry Levak",... |
include "util/net.h"
#include "util/size.h"
#include "util/string.h"
#define STM32F2_COMPATIBLE
#define STM32F4_COMPATIBLE
#define STM32F7_COMPATIBLE
#include <mcu.h>
#include "FreeRTOS.h" /* FreeRTOS Kernal Prototypes/Constants. */
#include "task.h" /* FreeRTOS Task Prototypes/Constants. ... | (start_addr, total_bytes) | ;
} else {
uint32_t end = start_addr + total_bytes;
flash_region_erase_optimal_range_no_watchdog(start_addr, start_addr, end, end);
}
}
static void prv_flash_read_bytes(void* buffer_ptr, uint32_t start_addr, uint32_t buffer_size) {
if (s_use_cd_flash_driver) {
cd_flash_read_bytes(buffer_ptr, start_ad... |
(structured_glance, selection_animation_duration_ms, 0) | ;
}
static void prv_destructor(KinoReel *reel) {
LauncherAppGlanceStructured *structured_glance = kino_reel_custom_get_data(reel);
if (structured_glance && structured_glance->impl && structured_glance->impl->destructor) {
structured_glance->impl->destructor(structured_glance);
}
}
static const KinoReelImpl ... | |
{ 840, -96, 0},
{ 648, -168, -48},
{ 1048, 112, 16},
{ 1016, 272, -24},
{ 1400, 256, -88},
{ 1864, 312, -120},
{ 1696, 480, -200},
{ 1184, 384, -168},
// 13 seconds
{ 1080, 264, -112},
{ 1248, 200, -8},
{ 1472, 304, -48},
{ 1416, 472, -32},
{ 1544, 720, -80},
... | { 1184, 312, -176},
{ 1328, 352, -272},
{ 1288, 448, -176},
{ 1608, 536, -72},
{ 1392, 824, -64},
{ 888, 712, -152},
{ 1256, 888, -216},
{ 1208, 688, -112},
{ 1408, 488, -24},
{ 1560, 520, 56},
{ 1568, 376, 56},
{ 1336, 208, 64},
{ 1216, 136, 88},
{ 1272, 176, -32... |
// 21 seconds
{ 1304, 256, -16},
{ 1136, 240, -112},
{ 848, 56, -72},
{ 1056, -40, 0},
{ 832, 8, 64},
{ 1160, 208, -112},
{ 1448, 272, -152},
{ 1608, 336, -216},
{ 1416, 320, -232},
{ 1208, 296, -184},
{ 1184, 400, -168},
{ 1240, 464, -168},
{ 1448, 384, -160},
... |
Wrap);
if (text_attributes) {
text_layer->should_cache_layout = true;
text_layer->layout_cache = text_attributes;
}
layer_add_child(&window->layer, &text_layer->layer);
// Action bar. If the user hasn't given a custom action bar, we'll create one of the preset
// types.
if (actionable_dialog->acti... | app_dialog_push(&actionable_dialog->dialog) | ;
}
void actionable_dialog_pop(ActionableDialog *actionable_dialog) {
dialog_pop(&actionable_dialog->dialog);
}
void actionable_dialog_init(ActionableDialog *actionable_dialog, const char *dialog_name) {
PBL_ASSERTN(actionable_dialog);
*actionable_dialog = (ActionableDialog){};
dialog_init(&actionable_dialog... |
((y>>4 & 1) * xtime(xtime(xtime(xtime(x))))));
}
#else
#define Multiply(x, y) \
( ((y & 1) * x) ^ \
((y>>1 & 1) * xtime(x)) ^ \
((y>>2 & 1) * xtime(xtime(x))) ^ \
((y>>3 & 1) * xtime(xtime(xtime(x)))) ^ \
... | (output, input) | ;
state = (state_t*)output;
// The KeyExpansion routine must be called before encryption.
Key = key;
KeyExpansion();
InvCipher();
}
#endif // #if defined(ECB) && ECB
#if defined(CBC) && CBC
static void XorWithIv(uint8_t* buf)
{
uint8_t i;
for(i = 0; i < KEYLEN; ++i)
{
buf[i] ^= Iv[i];
}... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.