prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
= context;
if (animation_is_scheduled(data->level_change_anim)) {
animation_set_elapsed(data->level_change_anim,
animation_get_duration(data->level_change_anim, true, true));
}
ActionMenuLevel *parent_level = data->view_model.cur_level->parent_level;
if (parent_level) {
prv_s... | (action_menu, result_window) | ;
}
data->result_window = result_window;
}
void action_menu_set_align(ActionMenuConfig *config, ActionMenuAlign align) {
if (!config) {
return;
}
config->align = align;
}
ActionMenu *action_menu_open(WindowStack *window_stack, ActionMenuConfig *config) {
ActionMenuData *data = applib_type_zalloc(Act... |
/*
* 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_window_stack_push(&s_low_power_data->low_power_window, true /* Animated */) | |
336, -856},
{ 104, 328, -864},
// 95 seconds
{ 112, 328, -864},
{ 104, 336, -856},
{ 112, 320, -864},
{ 104, 336, -856},
{ 104, 336, -856},
{ 112, 328, -864},
{ 104, 336, -856},
{ 104, 328, -856},
{ 104, 336, -864},
{ 112, 328, -864},
{ 104, 336, -856},
{ 104, 328... | {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_25673_4
//> TEST_EXPECTED 100
//> TEST_EXPECTED_MIN 80
//> TEST_EXPECTED_MAX 125
//> TEST_WEIGHT 1.0
static AccelRawData samples[] = {
// 0 seconds
// elapsed: 0 minutes
{ -48, -472, -928},
{ -... | |
/*
* 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... | (font_key) | |
ion() {
return ARRAY_LENGTH(s_delta_moook_out) * ANIMATION_TARGET_FRAME_INTERVAL_MS;
}
uint32_t interpolate_moook_duration() {
return interpolate_moook_in_duration() + interpolate_moook_out_duration();
}
uint32_t interpolate_moook_soft_duration(int32_t num_frames_mid) {
return interpolate_moook_duration() + num... | {
PBL_ASSERTN(config);
return prv_interpolate_moook(normalized, from, to,
config->frames_in, config->num_frames_in,
config->frames_out, config->num_frames_out,
config->num_frames_mid, !config->no_bounce_back);
} | |
[HRZoneCount];
cl_assert(workout_service_start_workout(ActivitySessionType_Run));
cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s));
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 0);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 0);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2]... | (hr_zone_time_s) | );
}
// ---------------------------------------------------------------------------------------
void test_workout_service__avg_hr(void) {
int32_t avg_hr;
cl_assert(!workout_service_get_avg_hr(&avg_hr));
cl_assert(workout_service_start_workout(ActivitySessionType_Run));
prv_put_bpm_event(140, HRMQuality_Good)... |
ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_fill_rect_${BIT_DEPTH_NAME}__clipped(void) {
GContext ctx;
Layer layer;
test_graphics_context_init(&ctx, fb);
layer_init(&layer, &GRect(0, 0, 100, 100));
layer_set_update_proc(&l... | setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1) | ;
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 4, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r4_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP,... |
ounds,
.box = (GRect) { GPointZero, (GSize) { 7 * HORIZ_ADVANCE_PX, 10 } }
};
line.max_width_px = text_box_params.box.size.w;
line.height_px = text_box_params.box.size.h;
// Init mutable types
word_iter_init(&word_iter, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start);
// Tests
cl_asse... | (&s_ctx, &line, &word_iter_state.current, &text_box_params) | );
cl_assert(line.height_px == 10);
cl_assert(line.width_px == 1 * HORIZ_ADVANCE_PX);
// reset line
line = (Line) { 0 };
line.max_width_px = text_box_params.box.size.w;
line.height_px = text_box_params.box.size.h;
cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params));
cl_... |
a,
SPRF_PAGE_FLASH_OFFSET(shared_prf_storage_get_valid_page_number()),
sizeof(data));
cl_assert_equal_i(data.getting_started.crc, new_crc);
// Should be corrupt, so it should return false
cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), false);
// Shoul... | (shared_prf_storage_get_valid_page_number(), 0) | ;
shared_prf_storage_erase_ble_pairing_data();
cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 2);
char device_name_out[BT_DEVICE_NAME_BUFFER_SIZE];
SMPairingInfo pairing_info_out;
const bool rv = shared_prf_storage_get_ble_pairing_data(&pairing_info_out, device_name_out, NULL,
... |
type);
return false;
}
}
return true;
#else // safe mode FW
return true;
#endif
}
static bool prv_has_invalid_fw_update_state(const PutBytesCommand command) {
if (command == PutBytesAbort ||
command == PutBytesInit) {
return false;
}
// Check only for Put, Commit, Install
return !prv... | ("Installation succeeded!") | ;
prv_mark_pb_jobs_complete(1);
// Clean up the current command state before sending an ACK
prv_cleanup_and_send_response(ResponseAck);
}
static void prv_do_abort(void) {
PBL_LOG(LOG_LEVEL_INFO, "PutBytes abort CB. Tok: %"PRIu32".", s_pb_state.token);
prv_mark_pb_jobs_complete(1);
prv_cleanup_and_send_res... |
on->attr_list;
}
static AttributeList *prv_deserialize_address(Address *address,
const uint8_t **cursor,
const uint8_t *payload_end,
const uint8_t *buffer,
... | attribute_list_get_serialized_size(attr_list) | ;
}
if (group_ptr) {
if (type == AttributeGroupType_Action) {
size += prv_get_serialized_action_group_size((TimelineItemActionGroup *)group_ptr);
} else {
size += prv_get_serialized_address_list_size((AddressList *)group_ptr);
}
}
return size;
}
// -------------------------------------... |
pen in parallel with op_1, so the effective frame period is:
frame_period = MAX(op_1_time + op_2_time, op2_time + op_3_time)
This app measures op_1_time + op_2_time and does so by counting the number of times
the app window's update callback got called within a set amount of time. The window update
callback... | {
AppData *data = app_state_get_user_data();
data->prv_orig_content_offset_changed(scroll_layer, context);
GPoint offset = scroll_layer_get_content_offset(scroll_layer);
scroll_layer_set_content_offset(&data->action_list1.scroll_layer, offset, false);
} |
static void prv_window_load(Window *window) {
// creates a structure as outlined at
// https://pebbletechnology.atlassian.net/wiki/display/DEV/3.0+Notifications+UI+MVP
// it's one full screen background image .background_layer,
// one image at the top left .topleft_layer,
// and two menu layers .action_lis... |
bs_dls.h"
#include "stubs_evented_timer.h"
#include "stubs_expandable_dialog.h"
#include "stubs_freertos.h"
#include "stubs_heap.h"
#include "stubs_i18n.h"
#include "stubs_logging.h"
#include "stubs_modal_manager.h"
#include "stubs_new_timer.h"
#include "stubs_passert.h"
#include "stubs_pbl_malloc.h"
#include "stubs_pe... | {
return s_process_metadata_get_res_bank_num__result;
} |
static RockyResourceValidation s_rocky_app_validate_resources__result;
RockyResourceValidation rocky_app_validate_resources(const PebbleProcessMd *md) {
return s_rocky_app_validate_resources__result;
}
static PebbleEvent* s_event_put__event;
void event_put(PebbleEvent* event) {
s_event_put__event = event;
cl_a... |
repend((ListNode*) *notification_list,
(ListNode*) new_node);
return new_node;
}
static void prv_notification_list_remove_notification_by_id(
NotificationNode **notification_list, Uuid *id) {
NotificationNode *node = prv_find_notification(*notification_list, id);
list_remove((ListNode *)node, (ListNo... | ((ListNode*) loaded_list) | |
icense is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "core_dump.h"
#include "hc_protocol/hc_protocol.h"
#include "host_transport.h"
#i... | PBL_LOG(LOG_LEVEL_ERROR, "Failed to enqueue HC request (endpoint:%d, command:%"PRIu8")",
message->endpoint_id, message->command_id) | ;
s_num_consec_enqueue_failures++;
if (initialized && (s_num_consec_enqueue_failures >= NUM_CONSEC_FAILURES)) {
core_dump_and_reset_or_reboot();
}
success = false;
goto done;
}
}
s_num_consec_enqueue_failures = 0;
done:
prv_update_enqueue_count(false /* stopping */);
r... |
if (prv_attribute_type(id) != AttributeTypeUint8) {
PBL_LOG(LOG_LEVEL_WARNING, "Adding attribute with type uint8 for non-uint8_t attribute");
}
prv_add_attribute(list, id)->uint8 = uint8;
}
void attribute_list_add_string_list(AttributeList *list, AttributeId id, StringList *string_list) {
PBL_ASSERTN(prv_at... | PBL_ASSERTN(attr_list != NULL) | ;
PBL_ASSERTN(prv_attribute_type(id) == AttributeTypeUint32List);
Attribute *attribute = attribute_find(attr_list, id);
return attribute ? attribute->uint32_list : NULL;
}
|
ccd_value);
}
static bool prv_get_value(uint16_t conn_idx, uint16_t value_handle,
uint8_t response[READ_RESPONSE_BUFFER_SIZE],
size_t *response_length_out) {
if (value_handle == s_pps_ctx.att_hdl.conn_status) {
*response_length_out = prv_handle_connection_state... | connection_set_subscribed_to_conn_param_notifications(connection, is_subscribed) | ;
value_handle = s_pps_ctx.att_hdl.conn_params;
} else {
PBL_LOG(LOG_LEVEL_ERROR, "Unknown CCCD handle %u!", evt->handle);
return ATT_ERROR_INVALID_HANDLE;
}
if (is_subscribed) {
prv_send_notification(evt->conn_idx, value_handle);
}
return ATT_ERROR_OK;
}
static att_error_t prv_handle_mtu_v... |
lgorithm: if the watch fails three times, return true
// to tell the parent we should load the recovery firmware. A reset for any other reason
// will reset this algorithm.
if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)) {
// Yikes, our firmware is screwed. Boot into recovery mode.
dbgserial_putstr(... | rtc_initialize_fast_mode() | ;
}
// Print out our super cool bootloader logo:
// ______ __
// /_ __/ __/ /_
// / / /_ __/
// /_/ /_/
dbgserial_putstr(" ______ __\r\n/_ __/ __/ /\r\n / / /_ __/\r\n/_/ /_/\r\n");
boot_version_write();
// Write the bootloader version to serial-out
dbgserial_print("Bootl... |
{
if (client->characteristics.meta == characteristics[i] ||
client->characteristics.data == characteristics[i]) {
client_removed = true;
prv_delete_client(client, true, DeleteReason_ServiceRemoved);
break;
}
}
client = next;
}
// PBL-42768 ... | {
PBL_LOG(LOG_LEVEL_DEBUG, "Got notification/read for unknown client");
goto unlock;
} |
if (is_data) {
prv_handle_data_notification(client, value, value_length);
} else {
prv_handle_meta_read(client, value, value_length, error);
}
}
unlock:
bt_unlock();
}
// -------------------------------------------------------------------------------------------------
static PPoGATTPacket... |
leton = "A";
char *doubleton = "AA";
GFont font = (GFont){ 0 };
GRect box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 3 * HORIZ_ADVANCE_PX + 1, FONT_HEIGHT + 1 } };
TextLayoutExtended layout = (TextLayoutExtended) { };
GContext gcontext = (GContext) { };
layout.hash = 0;
layout.box = (GRect) { (GPoint) { 0,... | memset(change_stack, 0xff, 500) | ;
const TextLayoutFlowData *data2 = graphics_text_layout_get_flow_data(NULL);
cl_assert_equal_p(data1, data2);
// values are still 0
cl_assert_equal_p(data2->perimeter.impl, NULL);
cl_assert_equal_i(data2->paging.page_on_screen.size_h, 0);
}
#include "applib/legacy2/ui/text_layer_legacy2.h"
void test_text_... |
/*
* 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... | periph_config_acquire_lock() | ;
gpio_use(BOARD_CONFIG_POWER.vusb_stat.gpio);
gpio_use(BOARD_CONFIG_POWER.chg_stat.gpio);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;... |
equal_i(0b00111000, BITS_BETWEEN(3, 5));
cl_assert_equal_i(0b00010000, BITS_BETWEEN(4, 4));
}
// Flash memory is organized into twelve sectors of unequal sizes.
// Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB.
// The remaining sectors are 128 KiB.
// Bitset of sectors that have been "erased"
static uint32_t erased_se... | cl_assert(flash_locked) | |
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governi... | layer_set_frame((Layer *)&peek_layer->title.text_layer,
&(GRect) { { cursor.x, cursor.y + TEXT_OFFSET_Y },
{ title_size.w, title_size.h + font_height_fuzz } }) | ;
}
//////////////////////
// API
/////////////////////
PeekLayer *peek_layer_create(GRect frame) {
PeekLayer *peek_layer = task_malloc(sizeof(PeekLayer));
if (peek_layer) {
peek_layer_init(peek_layer, &frame);
}
return peek_layer;
}
void peek_layer_destroy(PeekLayer *peek_layer) {
if (peek_layer) {
... |
if (!node) {
return;
} |
GTextNodeContainer *container_node = (GTextNodeContainer *)node;
prv_container_each(container_node, prv_destroy_container_iter, NULL);
prv_destroy_text_node_base(&container_node->node);
}
static bool prv_container_add_child(GTextNodeContainer *container_node, GTextNode *child) {
if (!container_node || !child)... | |
ntHandler s_event_handler;
static PendingInfo s_pending_did_read;
static PendingInfo s_pending_did_write;
static PendingInfo s_pending_notified;
// Stubs / fakes
void event_service_client_subscribe(EventServiceInfo *info) {
cl_assert(info->type == PEBBLE_SMARTSTRAP_EVENT);
s_event_handler = info->handler;
}
voi... | (app_smartstrap_attribute_end_write(NULL, 100, false)) | ;
assert_result_invalid(app_smartstrap_attribute_end_write(NULL, 100, true));
assert_result_invalid(app_smartstrap_attribute_end_write(attr, 0, false));
assert_result_invalid(app_smartstrap_attribute_end_write(attr, 0, true));
assert_result_invalid(app_smartstrap_attribute_end_write(attr, 100, false));
assert... |
1 2:00s 0 S
Sep 27th 2014 14:00 UTC ~ Apr 4th 2015 14:00 UTC, GMT+12 */
[24]={ 1411826400, 1428156000,12 * SECONDS_PER_HOUR },
/* Namibia (Namibia) [Africa/Windhoek]
Rule Namibia 1994 max - Sep Sun>=1 2:00 1:00 S
Rule Namibia 1995 max - Apr Sun>=1 2:00 0 -
Sep 7th 20... | ("start [%d] tz_info: %ld s_dst_correct_values: %ld\n",
dstid, tz_info.dst_start, s_dst_correct_values[dstid][0]) | |
PBL_IF_ROUND_ELSE(30, 26);
const int16_t front_value_y_offset = mid_value_y_offset + PBL_IF_ROUND_ELSE(30, 40);
const int16_t disconnected_text_y_offset = mid_value_y_offset + PBL_IF_ROUND_ELSE(-5, 8);
const int16_t stroke_box_width = PBL_IF_ROUND_ELSE(54, background_width / 2);
const int16_t stroke_box_height... | (GOLF_BACK_KEY, "000") | ,
TupletCString(GOLF_MID_KEY, "000"),
TupletCString(GOLF_FRONT_KEY, "000"),
};
app_sync_init(&data->sync, data->sync_buffer, sizeof(data->sync_buffer), initial_values,
ARRAY_LENGTH(initial_values), sync_tuple_changed_callback, sync_error_callback,
data);
}
static void push_w... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (pin_config.gpio) | |
d) {
cl_assert(pfs_get_size() == (ftl_get_size() - SECTOR_SIZE_BYTES));
}
void test_pfs__migration(void) {
// reset the flash
fake_spi_flash_cleanup();
fake_spi_flash_init(0, 0x1000000);
extern void ftl_force_version(int version_idx);
pfs_init(true);
ftl_force_version(1);
// simulate a migration by l... | cl_assert(fd >= 0) | ;
cl_assert(test_scan_for_last_written() >= 0);
}
extern void test_force_reboot_during_garbage_collection(uint16_t start_page);
extern void pfs_reset_all_state(void);
void test_pfs__reboot_during_gc(void) {
pfs_format(true);
pfs_reset_all_state();
pfs_init(false);
const int pages_to_write = 16;
char fi... |
ion_s / SECONDS_PER_MINUTE;
int seconds = duration_s % SECONDS_PER_MINUTE;
return snprintf(buffer, buffer_size, i18n_get("%d:%d", i18n_owner), minutes, seconds);
}
GTextNodeText *health_util_create_text_node(int buffer_size, GFont font, GColor color,
GTextNodeContainer *... | {
case UnitsDistance_Miles:
return METERS_PER_MILE;
case UnitsDistance_KM:
return METERS_PER_KM;
case UnitsDistanceCount:
break;
} |
return 1;
}
const char *health_util_get_distance_string(const char *miles_string, const char *km_string) {
switch (shell_prefs_get_units_distance()) {
case UnitsDistance_Miles:
return miles_string;
case UnitsDistance_KM:
return km_string;
case UnitsDistanceCount:
break;
}
return ... |
_origin_aa_r8_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// Small circles
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_SMALL);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r1_no_clip.${BIT_DEPTH_NAME}.pbi"))... | (&ctx.dest_bitmap, "draw_circle_offset_aa_r16_clip_xy.${BIT_DEPTH_NAME}.pbi") | |
on *spawn = animation_spawn_create(b, c, NULL);
cl_assert(spawn != NULL);
// Create a sequence by putting a in front and repeat it 5 times
// We now have a -> (b | c)
Animation *seq = animation_sequence_create(a, spawn, NULL);
animation_set_play_count(seq, repeat_count);
// Now, clone it
Animation *clo... | (&s_stopped_handler_calls, a0) | |
.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... | cl_assert(timeline_model_iter_next(NULL, NULL)) | ;
cl_assert(timeline_model_iter_next(NULL, NULL));
cl_assert(timeline_model_iter_next(NULL, NULL));
cl_assert(timeline_model_iter_next(NULL, NULL));
cl_assert(!timeline_model_iter_next(NULL, NULL));
int new_idx;
cl_assert(timeline_model_iter_prev(&new_idx, NULL));
cl_assert_equal_i(new_idx, 4);
cl_asse... |
if (hours < 12) {
format = add_space ? "%u:%02u AM" : "%u:%02uAM";
} else {
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 t... | {
// all day event, multiday or single day
prv_get_relative_all_day_string(word_buffer, word_buffer_size, current_day);
strncpy(number_buffer, "", number_buffer_size);
} | else if (time_util_get_midnight_of(timestamp) == current_day) {
// first day of multiday event or only day
prv_copy_relative_time_string(number_buffer, number_buffer_size, word_buffer,
word_buffer_size, timestamp, end_time);
} else if (time_util_get_midnight_of(end_time) == current_day) {
// last... |
w.h"
// Setup
////////////////////////////////////
static GBitmap *test_image_bw;
static GBitmap *test_image_color;
static FrameBuffer *fb = NULL;
#if SCREEN_COLOR_DEPTH_BITS == 1
extern bool get_bitmap_bit(GBitmap *bmp, int x, int y);
#elif SCREEN_COLOR_DEPTH_BITS == 8
extern GColor get_bitmap_color(GBitmap *bmp, in... | setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet) | ;
graphics_draw_rotated_bitmap(&ctx, test_image_bw,
GPointZero, DEG_TO_TRIGANGLE(0), GPointZero);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_bw_set_0.Xbit.pbi"));
// Top-left corner rotation point, Angle 45
setup_test_rotate_bitmap(&ctx, fb, ORIGIN_REC... |
/*
* 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... | (BUTTON_ID_SELECT, (ClickHandler)click_handler) | ;
window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler)click_handler);
(void)window;
}
static void prv_window_load(Window *window) {
AppState *data = window_get_user_data(window);
data->text_layer_size = GSize(144, 168);
text_layer_init(&data->text_layer,
&GRect(0, 0, data->text_laye... |
IP, true, 5);
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, &O... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi")) | |
, BITS(4));
cl_assert_equal_i(0b00111111, BITS_BETWEEN(0, 5));
cl_assert_equal_i(0b00111000, BITS_BETWEEN(3, 5));
cl_assert_equal_i(0b00010000, BITS_BETWEEN(4, 4));
}
// Flash memory is organized into twelve sectors of unequal sizes.
// Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB.
// The remaining sectors are 128... | (system_flash_write(
FLASH_BASE + 10, testdata, sizeof(testdata), callback_is_called_cb,
(void *)8675309)) | ;
cl_assert(flash_locked);
cl_assert_equal_s(testdata, (const char *)&flash_written_data[10]);
assert_flash_unwritten(0, 10);
assert_flash_unwritten(10 + sizeof(testdata), 90 - sizeof(testdata));
cl_assert(callback_called);
}
void test_system_flash__write_error(void) {
return_status = FLASH_ERROR_OPERATION... |
/*
* 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 (action_bar->layer.window && action_bar->layer.window->on_screen == false) {
// clear first, fixes issue of returning from other page while highlighted
for (int i = 0; i < NUM_ACTION_BAR_LEGACY2_ITEMS; i++) {
action_bar_legacy2_set_highlighted(action_bar, i, false);
}
}
} |
static void action_bar_legacy2_update_proc(ActionBarLayerLegacy2 *action_bar, GContext* ctx) {
const GColor bg_color = get_native_color(action_bar->background_color);
graphics_context_set_fill_color(ctx, bg_color);
const uint8_t radius = 3;
const uint8_t margin = 1;
graphics_fill_round_rect(ctx, &action_bar... |
static const uint32_t DELAY_DURATION = 1000;
static const uint32_t START_ELAPSED = 800; // show pulse just after the start of the animation
layer_mark_dirty(&data->mic_window.mic_dot_layer);
data->mic_window.mic_dot_radius = MIC_DOT_MAX_RADIUS;
data->mic_window.mic_dot_anim = prv_create_pulse_dot_anim(dat... | loading_layer_grow(&data->mic_window.progress_bar, 0,
(animated ? ANIMATE_IN_DURATION : 0)) | ;
}
static void prv_progress_stop(Animation *animation, bool finished, void *context) {
if (!finished) {
return;
}
static const uint32_t SHRINK_DELAY = 100;
static const uint32_t SHRINK_DURATION = 200;
VoiceUiData *data = context;
loading_layer_shrink(&data->mic_window.progress_bar, SHRINK_DELAY, SHRIN... |
_mark;
GBitmap kcc_mark;
GBitmap ce_mark;
GBitmap weee_mark;
GBitmap r_mark;
GBitmap t_mark;
GBitmap aus_rcm_mark;
GBitmap nom_nyce_mark;
GBitmap **regulatory_marks;
uint8_t regulatory_marks_count;
// For buiding up regulatory marks cells when constructing the menu
uint8_t current_regulatory_mark... | ("Hardware") | ,
[SystemInformationItemSerial] = i18n_noop("Serial"),
[SystemInformationItemUptime] = i18n_noop("Uptime"),
[SystemInformationItemLegal] = i18n_noop("Legal")
};
static void prv_populate_uptime_string(SystemInformationData* data) {
uint32_t seconds_since_reboot = time_get_uptime_seconds();
uint32_t days, hou... |
32_t read_len = MIN(cmd->crc.length - bytes_read, chunk_size);
int ret = pulse_fd->impl->read_proc(buffer, cmd->crc.address+bytes_read, read_len,
pulse_fd->domain_state);
if (FAILED(ret)) {
prv_respond_internal_error(cmd, length, E_INTERNAL);
return;
}
... | if (s_transfer_fds[i].impl) {
PulseTransferFD *pulse_fd = &s_transfer_fds[i];
pulse_fd->impl->close_proc(pulse_fd->domain_state);
prv_free_fd(i);
} |
}
}
|
animation_set_duration(test_player->animation, ANIMATION_DURATION_INFINITE);
prv_play_animation_update(test_player->animation, 0); // intentionally bad value
cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 20);
}
void test_kino_player__create_infinite_animation_infinite_reel_forward(void) {
// Choose dura... | prv_play_animation_update(test_player->animation, 0) | ; // intentionally bad value
cl_assert_equal_i(kino_reel_get_elapsed(test_reel), ANIMATION_DURATION_INFINITE);
}
void test_kino_player__create_infinite_animation_infinite_reel_reverse(void) {
// Choose duration and elapsed to have clean division for
// ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_numb... |
gistryEntry *reg_entry = prv_get_registry_list_entry(install_id, &record_order);
if (reg_entry) {
bool rv = false;
// switch on registry type
switch (reg_entry->type) {
case AppInstallStorageFw:
rv = prv_app_install_entry_from_fw_registry_entry(reg_entry, entry);
break;
case Ap... | prv_get_md_for_flash_id(id, worker) | ;
}
// Not a registered app, fail.
PBL_LOG(LOG_LEVEL_ERROR, "Can't get PebbleProcessMd for app id %"PRId32, id);
return NULL;
}
void app_install_release_md(const PebbleProcessMd *md) {
if (!md) {
return;
}
switch (md->process_storage) {
case ProcessStorageBuiltin:
break;
case ProcessStorage... |
/*
* 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... | analytics_storage_init() | ;
analytics_logging_init();
}
void analytics_set(AnalyticsMetric metric, int64_t value, AnalyticsClient client) {
analytics_set_for_uuid(metric, value, analytics_uuid_for_client(client));
}
void analytics_max(AnalyticsMetric metric, int64_t val, AnalyticsClient client) {
const Uuid *uuid = analytics_uuid_for_cl... |
bool comm_session_is_current_task_send_next_task(CommSession *session) {
if (session->transport_imp->schedule) {
return session->transport_imp->is_current_task_schedule_task(session->transport);
}
return bt_driver_comm_is_current_task_send_next_task();
}
void prv_send_next(CommSession *session, bool is_callb... | (LOG_LEVEL_ERROR, "Fallback session already set!?") | ;
}
ctx->fallback_session = session;
}
return false;
}
static CommSession *prv_get_app_session(void) {
const Uuid *app_uuid = &app_manager_get_current_app_md()->uuid;
if (uuid_is_system(app_uuid) || uuid_is_invalid(app_uuid)) {
return NULL;
}
FindByAppUUIDContext ctx = (FindByAppUUIDContext) {
... |
null terminator, so we add 1 to key_len
success = (settings_file_get(&file, entry->key, key_len + 1, value, value_len)
== S_SUCCESS);
settings_file_close(&file);
}
}
mutex_unlock(s_mutex);
return success;
}
// ---------------------------------------------------... | backlight_get_intensity() | * 100) / BACKLIGHT_BRIGHTNESS_MAX;
}
void backlight_set_intensity_percent(uint8_t percent_intensity) {
PBL_ASSERTN(percent_intensity > 0 && percent_intensity <= 100);
uint16_t intensity = prv_convert_backlight_percent_to_intensity(percent_intensity);
PBL_ASSERTN(intensity > BACKLIGHT_BRIGHTNESS_OFF);
prv_pref... |
tusRegisterRequest;
typedef struct PACKED {
uint8_t packet_id;
uint8_t data[DATA_LEN_STATUS_RESPONSE];
uint32_t padding;
} StatusRegisterResponse;
#endif
typedef struct PACKED {
uint8_t packet_id;
uint16_t address;
uint16_t value;
uint8_t footer;
} MemoryPacket;
static bool s_callback_scheduled = false... | htons(address) | |
prv_get_pixels_for_bump_settle(int anim_percent_complete) {
if (anim_percent_complete) {
return SETTLE_HEIGHT_DIFF - ((SETTLE_HEIGHT_DIFF * anim_percent_complete) / 100);
} else {
return 0;
}
}
static int prv_get_font_top_padding(GFont font) {
if (font == fonts_get_system_font(FONT_KEY_GOTHIC_36_BOLD))... | {
bg_color = selection_layer->active_background_color;
} |
graphics_context_set_fill_color(ctx, bg_color);
// Use the original height to determine the cell's corner info
const CellCornerInfo cell_corner_info = prv_get_cell_corner_info(original_height);
graphics_fill_round_rect(ctx, &rect, cell_corner_info.corner_radius,
cell_corner... |
/*
* 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... | rtc_get_ticks() | ;
}
DEFINE_SYSCALL(void, sys_pbl_log, LogBinaryMessage* log_message, bool async) {
kernel_pbl_log(log_message, async);
}
DEFINE_SYSCALL(void, sys_copy_timezone_abbr, char* timezone_abbr, time_t time) {
if (PRIVILEGE_WAS_ELEVATED) {
syscall_assert_userspace_buffer(timezone_abbr, TZ_LEN);
}
time_get_timezon... |
_private.h"
#include "services/normal/weather/weather_types.h"
#include "util/pstring.h"
// Fixture
////////////////////////////////////////////////////////////////
// Fakes
////////////////////////////////////////////////////////////////
#include "fake_pbl_malloc.h"
#include "fake_spi_flash.h"
// Stubs
////////////... | {
size_t count_out;
WeatherDataListNode *head = weather_service_locations_list_create(&count_out);
WeatherLocationID id = 0;
WeatherDataListNode *current = head;
while (current) {
cl_assert_equal_i(current->id, id);
prv_assert_forecast_equal(¤t->forecast, &s_forecasts[id]);
id++;
curren... |
void test_weather_service__get_default_location_forecast_from_weather_db_update(void) {
WeatherLocationForecast *forecast = weather_service_create_default_forecast();
// no blob db events were fired during unit test, therefore forecast cache never updated
cl_assert(!forecast);
const int default_location_inde... |
/*
* 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... | expandable_dialog_set_select_action(expandable_dialog, RESOURCE_ID_ACTION_BAR_ICON_CHECK,
prv_select_handler) | ;
}
expandable_dialog_push(expandable_dialog, prv_get_window_stack());
light_enable_interaction();
kernel_free(data);
}
// ---------------------------------------------------------------------------
void health_tracking_ui_show_message(uint32_t res_id, const char *text, bool show_action_bar) {
HealthTrack... |
{ 2147483646LL, 13, "282ba4aa9", },
{ -2147483647LL, 13, "-282BA4AAA", },
{ -2147483647LL, 13, "-282ba4aaa", },
{ 2147483646LL, 14, "1652CA930", },
{ 2147483646LL, 14, "1652ca930", },
{ -2147483647LL, 14, "-1652CA931", },
{ -2147483647LL, 14, "-1652ca931", },
{ 2147483646LL, 15, "C87E66B6", },
{ 2147... | (strtol(" +0x573ghghghgh", NULL, 0), 0x573) | ;
cl_assert_equal_i(strtol(" +0573faf", NULL, 0), 0573);
cl_assert_equal_i(strtol(" -573bb", NULL, 0), -573);
cl_assert_equal_i(strtol(" -0x573ghghghgh", NULL, 0), -0x573);
cl_assert_equal_i(strtol(" -0573faf", NULL, 0), -0573);
}
void test_strtol__bogus(void) {
cl_assert_equal_i(strtol(" ", NULL, 10), 0... |
(s_app_cache_mutex) | ;
return rv;
}
//! Tests if an entry with the given AppInstallId is in the cache
bool app_cache_entry_exists(AppInstallId app_id) {
bool exists = false;
mutex_lock_recursive(s_app_cache_mutex);
{
SettingsFile file;
status_t rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE);
if... | |
conds to delay per line */
// Top offset represents when the text has scrolled to its minimum y value so the last line of
// text is visible. Bottom offset represents when the text has scrolled all the way to its
// maximum y so the first line of text is visible.
item_animation->top_offset_y = ... | if (selected) {
indicator = INDICATOR;
} else {
const GSize indicator_size = graphics_text_layout_get_max_used_size(
ctx, INDICATOR, font, *content_box, GTextOverflowModeWordWrap, GTextAlignmentRight, NULL);
content_box->size.w -= (indicator_size.w + (2 * horizontal_padding));
} |
} else {
content_box->size.w -= horizontal_padding;
}
#if SCREEN_COLOR_DEPTH_BITS == 1
// Fill in the background layer. This effectively does nothing on watches where we have the
// ability to draw with color, but on others, it will render a background behind the selected
// cell.
const int x_offset ... |
00:00 on Monday. (46.5 hours)
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 167400 * MS_PER_SECOND);
rtc_set_time(s_thursday_00_00);
do_not_disturb_handle_clock_change();
active = do_not_disturb_is_active();
cl_assert(active == true);
// Timer will go off at 07:00 on Thursday. (7.0 hours)
... | cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 1800 * MS_PER_SECOND) | ;
rtc_set_time(s_monday_10_30);
do_not_disturb_handle_clock_change();
active = do_not_disturb_is_active();
cl_assert(active == false);
// Timer will go off at 01:00 on Sunday. (12 hours)
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 43200 * MS_PER_SECOND);
}
void test_do_not_disturb__toggl... |
s = NULL;
}
s_num_precise_lines = 0;
}
// setup and teardown
void test_gdraw_command__initialize(void) {
prv_reset();
}
void test_gdraw_command__cleanup(void) {
if (s_stroke_points) {
free(s_stroke_points);
s_stroke_points = NULL;
}
if (s_fill_points) {
free(s_fill_points);
s_fill_points =... | (prv_compare_points(points, s_fill_points, s_path_num_points)) | ;
prv_reset();
// restore stroke color and change both points
gdraw_command_set_stroke_color(command, GColorPurple);
GPoint points2[] = { { 23, 45 }, { 67, 13} };
gdraw_command_set_point(command, 0, points2[0]);
gdraw_command_set_point(command, 1, points2[1]);
gdraw_command_draw(NULL, command);
cl_ass... |
&s_sleep_stats, now_utc)) {
return;
}
// Make sure we've been awake long enough
int32_t sleep_state_seconds;
activity_get_metric(ActivityMetricSleepStateSeconds, 1, &sleep_state_seconds);
if (sleep_state_seconds < s_sleep_reward_settings.reward.sleep.trigger_after_wakeup_seconds) {
... | i18n_get("Nap Time", &pin_attr_list) | );
// Fits the maximum strings "10H 30M of sleep", "10:00AM - 11:00PM" and i18n variants
const size_t max_attr_length = 64;
char *elapsed = kernel_zalloc_check(max_attr_length);
char *short_subtitle = kernel_zalloc_check(max_attr_length);
const uint32_t duration_s = session->length_min * SECONDS_PER_MINUTE;
... |
, timeline_res);
#elif ANIMATION_SLIDE
GRect icon_from;
GRect icon_to;
const bool shift_offscreen_from = true;
const bool shift_offscreen_to = false;
prv_get_icon_animation_frame(data, &icon_from, use_pin, shift_offscreen_from);
prv_get_icon_animation_frame(data, &icon_to, use_pin, shift_offscreen_to);
pe... | (&data->timeline_layer, &data->timeline_layer.layer.frame) | ;
#elif ANIMATION_SLIDE
GRect frame;
layer_get_frame(&data->timeline_layer.day_separator.layer, &frame);
const bool is_future = (s_app_data->timeline_model.direction == TimelineIterDirectionFuture);
frame.origin.y += is_future ? DISP_ROWS : -DISP_ROWS;
timeline_layer_set_day_sep_frame(&data->timelin... |
return false;
}
bool app_install_entry_is_quick_launch_visible_only(const AppInstallEntry *entry) {
return (entry->visibility == ProcessVisibilityQuickLaunch);
}
bool app_install_entry_is_SDK_compatible(const AppInstallEntry *entry) {
return (entry->sdk_version.major == PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR &&... | {
// remove settings associated with the app
pin_db_delete_with_parent(uuid);
} |
if (delete_cache) {
// only log when we actually delete the cache entry. This is so we don't print out 100 logs
// during an app cache clear
PBL_LOG(LOG_LEVEL_INFO, "Deleting app with id %"PRId32"", id);
app_cache_remove_entry(id);
}
}
static void prv_delete_pending_id(AppInstallId *app_id) {
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... | bt_driver_cb_gatt_client_discovery_handle_indication(connection, service_copy, e) | ;
}
static void prv_handle_discovery_complete(const HcProtocolDiscoveryCompletePayload *payload) {
PBL_LOG(LOG_LEVEL_DEBUG, "Discovery Complete, status = 0x%x", payload->status);
GAPLEConnection *connection = gap_le_connection_by_device(&payload->address);
if (connection == NULL) {
PBL_LOG(LOG_LEVEL_WARNING,... |
er_R12];
s_thread_info.ti.registers[portCANONICAL_REG_INDEX_LR] = g_stacked_regs[Stacked_Register_LR];
s_thread_info.ti.registers[portCANONICAL_REG_INDEX_PC] = g_stacked_regs[Stacked_Register_PC];
s_thread_info.ti.registers[portCANONICAL_REG_INDEX_XPSR] = \
... | {
prv_cmd_handler(text_crc_calculated == text_crc_from_image);
} |
printf("Done. Going to sleep");
// Go to low power mode? Reset doesn't actually get back to the ROM bootrom.
prv_low_power_mode();
}
|
,
{ -736, 56, 80},
{ -632, 312, 312},
{ -552, 552, 616},
{ -528, 656, 944},
{ -592, 568, 792},
{ -840, 488, 776},
{ -1024, 584, 912},
{ -848, 600, 640},
{ -728, 720, 408},
{ -696, 672, 296},
{ -672, 600, 248},
// 391 seconds
{ -680, 456, 288},
{ -704, 400, 312},
... | { -944, 152, 408},
{ -992, 80, 448},
{ -1000, 96, 384},
{ -1080, 128, 400},
{ -1032, 72, 352},
{ -960, 64, 368},
{ -928, 96, 360},
{ -864, 128, 272},
{ -840, 120, 128},
{ -880, 176, 104},
{ -864, 128, 48},
{ -896, 176, 88},
{ -912, 216, 288},
{ -952, 192, 368},
... | |
ick_subscribe(BUTTON_ID_UP, prv_end_workout_up_click_handler);
window_single_click_subscribe(BUTTON_ID_DOWN, prv_end_workout_down_click_handler);
}
static void prv_end_workout(void *context) {
WorkoutActiveWindow *active_window = context;
WorkoutDialog *workout_dialog = &active_window->end_workout_dialog;
wo... | gbitmap_destroy(active_window->action_bar_more) | ;
gbitmap_destroy(active_window->action_bar_next);
gbitmap_destroy(active_window->heart_icon);
gbitmap_destroy(active_window->hr_measuring_icon);
action_bar_layer_deinit(&active_window->action_bar);
status_bar_layer_deinit(&active_window->status_layer);
layer_deinit(&active_window->top_metric_la... |
etooth_analytics_ble_mic_error(uint32_t num_sequential_mic_errors) {
PBL_LOG(LOG_LEVEL_INFO, "MIC Error detected ... %"PRIu32" packets", num_sequential_mic_errors);
analytics_event_bt_error(AnalyticsEvent_BtLeMicError, num_sequential_mic_errors);
}
static uint32_t prv_calc_other_errors(const SlaveConnEventStats *s... | bt_driver_analytics_external_collect_bt_chip_heartbeat() | ;
}
#endif
}
|
AME, APP_CACHE_MAX_SIZE);
if (rv != S_SUCCESS) {
goto unlock;
}
AppCacheEntry entry = { 0 };
rv = settings_file_get(&file, (uint8_t *)&app_id, sizeof(AppInstallId),
(uint8_t *)&entry, sizeof(AppCacheEntry));
if (rv == S_SUCCESS) {
entry.last_launch = rtc_get_time();
entry... | (s_app_cache_mutex) | |
_get_sector_base_address(flash_addr);
PBL_LOG(LOG_LEVEL_DEBUG, "erasing flash address %x", sector_address);
flash_erase_sector_blocking(sector_address);
const char* data_to_write = "hello world";
PBL_LOG(LOG_LEVEL_DEBUG, "writing to flash address %x", flash_addr);
flash_write_bytes((const uint8_t *)data_to_w... | event_put(&next_button_event) | ;
// Decrement the number of presses remaining if the button is currently held down (because we
// just pushed it up by adding that event)
if (button_is_held_down) {
context->num_presses_remaining--;
}
if (context->num_presses_remaining > 0) {
// Toggle the state of the button
context->button_is... |
return s_health_app_opened_version;
}
ActivityScalarStore activity_metrics_prv_steps_per_minute(void) {
return s_data.steps_per_minute;
}
// =========================================================================================
// PFS stubs
static PFSFileChangedCallback pfs_watch_cb = NULL;
PFSCallbackHandle p... | (stats.total_days, 16) | ;
cl_assert_equal_i(stats.consecutive_days, 3);
}
// ---------------------------------------------------------------------------------------
// Test that the sleep reward triggers when it should, and doesn't trigger when it shouldn't
void test_activity_insights__sleep_reward(void) {
// Use reasonable insight setti... |
ocusable window 1
window_set_focusable(windows[2][1], false);
window_stack_push(window_stacks[2], windows[2][1], false);
// An unfocusable window is now the top window
// Test: Opaque windows that are not the top window have no affect on unfocusable
// Test: One unfocusable top window results in Unfocused
... | {
for (int i = 0; i < num_windows_per_stack; i++) {
window_stack_remove(windows[idx][i], false);
window_destroy(windows[idx][i]);
}
} | |
_value_t object);
T_STATIC jerry_value_t prv_json_parse(const char *);
T_STATIC void prv_handle_connection(void);
T_STATIC void prv_handle_disconnection(void);
// App message mocks
static AppMessageInboxReceived s_received_callback;
AppMessageInboxReceived app_message_register_inbox_received(
... | jerry_cleanup() | ;
rocky_runtime_context_deinit();
prv_app_message_teardown();
fake_pbl_malloc_check_net_allocs();
fake_app_timer_deinit();
}
static const PostMessageResetCompletePayload VALID_RESET_COMPLETE = {
.min_supported_version = POSTMESSAGE_PROTOCOL_MIN_VERSION,
.max_supported_version = POSTMESSAGE_PROTOCOL_MAX_VER... |
case TimelineResourceSizeSmall:
card_attr_id = AttributeIdIconSmall;
break;
case TimelineResourceSizeLarge:
card_attr_id = AttributeIdIconLarge;
break;
}
const bool is_card = (mode == LayoutLayerModeCard);
const AttributeId primary_id = is_card ? card_attr_id : AttributeIdIconPin;
... | (info->end_time) | == current_day)
? info->end_time : info->timestamp;
}
void timeline_layout_get_icon_frame(const GRect *bounds, TimelineScrollDirection scroll_direction,
GRect *frame) {
const GSize size = timeline_resources_get_gsize(TimelineResourceSizeTiny);
const bool is_future = (scro... |
ction_menu_window_private.h"
#include "applib/ui/dialogs/dialog.h"
#include "applib/ui/dialogs/dialog_private.h"
#include "applib/ui/dialogs/expandable_dialog.h"
#include "applib/ui/dialogs/simple_dialog.h"
#include "applib/ui/progress_window.h"
#include "applib/ui/window.h"
#include "applib/ui/window_manager.h"
#inclu... | evented_timer_exists(data->response.timer) | |
pliance 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... | (ctx->parent_framebuffer) | |
onds
{ 848, 48, 112},
{ 776, 8, 104},
{ 720, -24, 80},
{ 696, -24, 80},
{ 784, -64, 120},
{ 888, -88, 48},
{ 1008, -40, -24},
{ 1416, -184, 96},
{ 1648, -48, 160},
{ 1392, 272, -120},
{ 1280, 376, -224},
{ 976, 360, 16},
{ 744, 104, 40},
{ 792, 80, 168},
{ 824... | { 880, 280, 120},
{ 864, 312, 32},
{ 984, 368, -104},
{ 1128, 304, -104},
// 50 seconds
{ 1216, 264, -64},
{ 1800, 264, 88},
{ 1536, 392, 48},
{ 912, 304, 32},
{ 1024, 200, 96},
{ 1200, 144, 200},
{ 1008, 136, 208},
{ 792, 72, 168},
{ 736, 40, 128},
{ 728, 8, ... |
{ 1096, -72, 0},
{ 1128, -112, 16},
{ 1440, -96, 56},
{ 1264, 168, -112},
{ 1328, 200, -272},
{ 1304, 232, -80},
{ 928, 304, 80},
{ 792, 328, 48},
{ 800, 296, 120},
// 53 seconds
{ 816, 296, 136},
{ 816, 344, 32},
{ 816, 280, -32},
{ 960, 248, -128},
{ 1344, ... |
ib/graphics/bitblt.h"
#include "applib/graphics/framebuffer.h"
#include "applib/graphics/gtypes.h"
#include "applib/graphics/graphics.h"
#include "applib/graphics/gpath.h"
#include "applib/graphics/gdraw_command_transforms.h"
#include "util/trig.h"
#include "system/passert.h"
#include "util/attributes.h"
#include "util... | {
// gpath that creates a solid "ring"
GPoint path_points[] = {
tl, tr, br, bl,
l, scaled_l,
scaled_bl, scaled_br, scaled_tr, scaled_tl,
scaled_l, l,
};
GPath path = {
.num_points = ARRAY_LENGTH(path_points),
.points = path_points
};
gpath_draw_fille... |
ctx->draw_state.stroke_width = sw;
graphics_draw_line(ctx, scaled_tl, scaled_tr);
graphics_draw_line(ctx, scaled_tr, scaled_br);
graphics_draw_line(ctx, scaled_br, scaled_bl);
graphics_draw_line(ctx, scaled_bl, scaled_tl);
}
//! Callback to be used with prv_collapse_animation to fill with the current fill... |
/*
* 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... | (vibe_num_window, VIBE_STRENGTH_MIN) | |
/*
* 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... | (buffer, size_in_out) | ;
}
// -----------------------------------------------------------------------------
// ble_ad_parse.h
DEFINE_SYSCALL(int8_t, sys_ble_get_advertising_tx_power, void) {
return gap_le_advert_get_tx_power();
}
// -----------------------------------------------------------------------------
// ble_central.h
DEFINE_SY... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | launcher_app_message_send_app_state_deprecated(&app_run_state->uuid, is_running) | ;
}
}
kernel_free(app_run_state);
}
void app_run_state_command(CommSession *session, AppRunStateCommand cmd, const Uuid *uuid) {
const AppInstallId install_id = app_install_get_id_for_uuid(uuid);
// Log most recent communication timestamp:
app_install_mark_prioritized(install_id, true /* can_expire */)... |
erviceStats yesterday_stats = {
.min = INT32_MAX,
.max = INT32_MIN,
};
DayInWeek day_in_week = todays_day_in_week;
for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++, day_in_week--) {
day_in_week = positive_modulo(day_in_week, DAYS_PER_WEEK);
HealthValue value = 1000 + (i * 50);
s_sys_activity_ge... | (result, exp_value) | ;
}
}
}
}
// --------------------------------------------------------------------------------------
// Test calls to compute heart rate stats with scope once. This ends up being implemented using
// the minute history
void test_health__heart_rate_scope_once(void) {
const time_t now = rtc_get_time();
c... |
, 1);
prv_postmessageconnected_postmessagedisconnected_negotiate_to_open_session();
ASSERT_JS_GLOBAL_EQUALS_I("c", 1);
ASSERT_JS_GLOBAL_EQUALS_I("d", 1);
// Get a ResetComplete (unexpected message), should trigger initiating (local) ResetRequest:
RCV_RESET_COMPLETE();
ASSERT_JS_GLOBAL_EQUALS_I("d", 2);
}
... | EXECUTE_SCRIPT("var x = " SIMPLE_TEST_OBJECT ";"
"var hasError = false;"
"_rocky.on('postmessageerror', function() { hasError = true; });"
"_rocky.postMessage(x);") | |
/*
* 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... | (0xff5500) | ).argb);
cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0xaaaaaa)).argb);
// // expectation as derived from Appfaces_generic_colors.psd
cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0x0000aa)).argb);
cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0x005500)).argb);
cl_assert_equal_i(GColo... |
Tell the task manager that we want to be killed. This may be redundant if we're responding to a DEINIT
// message, but just in case we're exiting on our own (someone found the sys_exit syscall and called in when
// we weren't expecting it?) we should let the app manager know.
process_manager_put_kill_process_eve... | {
PBL_LOG(LOG_LEVEL_WARNING, "Dropped app event! Type: %u", e->type);
return false;
} |
// Put on app's own queue:
if (!xQueueSend(context->to_process_event_queue, e, milliseconds_to_ticks(1000))) {
PBL_LOG(LOG_LEVEL_ERROR, "Failed to send event %u to app! Closing it!", e->type);
// We could be called from a timer task callback, so post a kill event rather than call
// process_manager_c... |
"
#include "dls_endpoint.h"
#include "dls_list.h"
#include "dls_storage.h"
#include "comm/bt_lock.h"
#include "drivers/flash.h"
#include "drivers/rtc.h"
#include "drivers/watchdog.h"
#include "flash_region/flash_region.h"
#include "kernel/pbl_malloc.h"
#include "process_management/pebble_process_md.h"
#include "proces... | (PebbleTask_KernelBackground) | |
/*
* 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... | for (int i=0; i<2; i++) {
prv_send_hdr(QemuProtocol_SPP, sizeof(msg_data));
prv_send_bytes(msg_data, sizeof(msg_data));
prv_send_footer();
} |
for (int i=0; i<2; i++) {
rcv_msg = qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &rcv_protocol);
cl_assert(rcv_msg);
cl_assert_equal_i(rcv_protocol, QemuProtocol_SPP);
cl_assert_equal_i(rcv_bytes, sizeof(msg_data));
cl_assert_equal_m(msg_data, rcv_msg, sizeof(msg_data));
}
// -... |
int16_t virtual_pg;
uint16_t physical_pg;
uint16_t contiguous_pgs;
} FilePageCache;
typedef struct File {
// file specifics loaded from header
char *name;
uint8_t namelen;
uint32_t file_size;
uint16_t start_page; //!< the physical page at which the file begins
uint16_t sta... | {
if (!s_pfs_page_flags_cache) {
return;
}
// Prefetch any page flags which fall within the range of bytes which have been updated.
const uint16_t start_page = offset / PFS_PAGE_SIZE;
const uint16_t end_page = (offset + size - 1) / PFS_PAGE_SIZE;
PBL_ASSERTN(end_page < s_pfs_page_count);
const int pa... |
static void prv_invalidate_page_flags_cache_all(void) {
prv_invalidate_page_flags_cache(0, s_pfs_page_count * PFS_PAGE_SIZE);
}
static void prv_flash_write(const void *buffer, uint32_t size, uint32_t offset) {
if ((offset + size) <= s_pfs_size) {
ftl_write(buffer, size, offset);
prv_invalidate_page_flags... |
tatic void prv_flash_log_dump_completed_cb(bool success) {
PBL_LOG(LOG_LEVEL_DEBUG, "Called prv_flash_log_dump_completed_cb(%d)", (int)success);
s_completed = true;
s_completed_success = success;
}
static void setup_and_test_expected_msg(char **msg_arr, int log_gen,
int start_idx, int num_items) {
for (in... | (&logs[start_log], 0, num_wrapped, num_wrapped + 2) | ;
free_logs(logs, num_logs + 2);
}
//! Keep simulating reboots and generating new logs. Confirm that
//! the most recent generations are not removed during reboots.
void test_flash_logging__generations(void) {
uint32_t tot_size, erase_size, page_size, page_hdr_size;
test_flash_logging_get_info(&tot_size, &eras... |
tted_line_origin_odd_rows_no_clip")));
// Test to make sure drawing on all rows creates checkerboard pattern
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
for (int16_t row = 0; row < MAX_NUM_ROWS; row++) {
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_CO... | GPoint(0, 23) | |
AP_MS, dy,
NULL);
return animation_spawn_create(prev_down, current_down, next_down, NULL);
}
static bool prv_setup_swap_up(SwapLayer *swap_layer) {
LayoutLayer *new_previous = prv_fetch_next_layout(swap_layer, -1);
// if there is no layout to swap up to, abo... | (animation) | ;
}
// scroll to top of current notification
static void prv_scroll_to_top(SwapLayer *swap_layer) {
int16_t offset = prv_get_current_notification_offset(swap_layer);
prv_scroll(swap_layer, offset, AnimationCurveEaseOut);
}
// scroll to bottom of current notification
static void prv_scroll_to_bottom(SwapLayer *swa... |
e entry for every value should something go
* wrong on the packing end.
*/
static const uint8_t LEVEL_MAP[8] = { LOG_LEVEL_ALWAYS, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING,
LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_VERBOSE,
LOG_LEVEL_DEBUG_V... | circular_buffer_get_read_space_remaining(&s_log_buffer.circular_buffer) | ;
if (length == 0) {
return;
}
s_log_buffer.transmitting = true;
circular_buffer_read(&s_log_buffer.circular_buffer, length, &data, &length);
hw_uart_send(CONFIG_LOG_UART, data, length, prv_uart_tx_callback, NULL);
}
static void prv_log_to_buffer(uint8_t *buffer, uint16_t length) {
prv_lock();
if (... |
nizers(RecognizerManager *manager, Layer *top_layer,
Layer *bottom_layer) {
prv_process_layer_tree_recognizers(manager, top_layer, bottom_layer, prv_reset_recognizer);
}
static void prv_reset_all_recognizers(RecognizerManager *manager) {
prv_process_all_recognizers(m... | {
prv_set_triggered(manager, triggered);
} |
prv_fail_then_reset_if_no_active_recognizers(manager);
if (manager->state == RecognizerManagerState_RecognizersTriggered) {
prv_set_triggered(manager, prv_any_recognizers_active_triggered(manager));
}
}
void recognizer_manager_handle_touch_event(const TouchEvent *touch_event, void *context) {
RecognizerMa... |
/*
* 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... | {
handler(message);
} | |
w_text(ctx, s_text_buffer, &s_font_info, GRect(4, 40, 72, 32),
GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL);
}
void draw_text_single_line_ellipsis_clip_outside_nx(Layer* me, GContext* ctx) {
graphics_context_set_text_color(ctx, GColorBlack);
graphics_draw_text(ctx, s_text_buf... | text_resources_init_font(0, gothic_24_handle, 0, &s_font_info) | );
test_graphics_context_init(&ctx, fb);
layer_init(&canvas, &GRect(0, 0, 144, 168));
layer_set_update_proc(&canvas, &canvas_layer_update_callback);
layer_init(&layer, &GRect(40, 40, 80, 40));
layer_add_child(&canvas, &layer);
// Corner cases
test_graphics_context_reset(&ctx, fb);
layer_set_update_p... |
/*
* 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_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"a\": %s", buf) | ;
}
r = strftime(buf, buf_size, "%A", &good_data);
if (r == 0 || strncmp(buf, "Tuesday", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"A\": %s", buf);
}
r = strftime(buf, buf_size, "%b", &good_data);
if (r == 0 || strncmp(buf, "May", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "E... |
ct, name,
prv_create_function, handler, NULL);
// JerryScript doesn't create a prototype for external/C functions :( probably to save memory?
jerry_set_object_field(prototype, "constructor", constructor);
jerry_set_object_field(constructor, "prototype", prototype)... | {
jerry_release_value(*var);
} | |
/*
* 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... | ((OutputConfig){ GPIOH, GPIO_Pin_0, true}) | ;
}
// v1_5
/////////
void v1_5_rail_ctl_fn(bool enable) {
do_rail_power(enable, GPIOH, GPIO_Pin_0, true);
}
void v1_5_rail_cfg_fn(void) {
i2c_bus_rail_ctl_config((OutputConfig){ GPIOH, GPIO_Pin_0, true});
}
// v2_0
/////////
void v2_0_rail_ctl_fn(bool enable) {
do_rail_power(enable, GPIOH, GPIO_Pin_0, true);
... |
draw :
graphics_text_node_get_size)(layout->view_node, ctx, &box, &config, size_out);
}
void timeline_layout_render_view(TimelineLayout *layout, GContext *ctx) {
const bool render = true;
prv_render_view(layout, ctx, render, NULL);
}
void timeline_layout_get_size(TimelineLayout *layout, GContext *ctx,... | layout_get_colors((LayoutLayer *)layout) | |
,
{ -416, 864, -64},
{ -472, 600, -40},
{ -480, 360, -16},
{ -472, 272, -104},
{ -632, 112, -64},
{ -752, 104, 128},
{ -1016, 304, 144},
{ -1360, 432, 128},
{ -1784, 632, 128},
{ -2024, 928, 240},
// 31 seconds
{ -1384, 1248, 176},
{ -1640, -48, -360},
{ -1464, 59... | // 36 seconds
{ -1152, -24, -160},
{ -1016, 136, -104},
{ -952, 184, 64},
{ -1000, 248, 176},
{ -1096, 336, -80},
{ -1136, 424, -176},
{ -1456, 544, -152},
{ -1344, 1064, -136},
{ -1496, 40, -248},
{ -1368, 448, -256},
{ -992, 496, -296},
{ -1200, 392, -168},
{ -1... | |
_op_tracking();
BTBondingID id_3 = bt_persistent_storage_store_ble_pairing(&pairing_2, false /* is_gateway */,
NULL,
false /* requires_address_pinning */,
... | false /* auto_accept_re_pairing */);
prv_fire_writeback_timer();
cl_assert(id != BT_BONDING_ID_INVALID);
} |
// ///////////////////////////////////////////////////////////////////////////////////////////////////
// //! BT Classic Pairing Info
void test_bluetooth_persistent_storage_prf__bt_classic_store_and_get(void) {
bool ret;
// Output variables
BTDeviceAddress addr_out;
SM128BitKey link_key_out;
char name_ou... |
t_on();
}
static uint16_t prv_timer_delta(uint16_t start_ticks, uint16_t end_ticks) {
// The timer is configured to repeatedly count down from 65535, resetting at 0 back to 65535.
// The delta calculated here takes advantage of the underflow to produce the correct result.
return start_ticks - end_ticks;
}
stati... | memmove(&buffer[0], &buffer[1], rx_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... | CREATE_DMA_STREAM(1, 6) | ; // DMA1_STREAM6_DEVICE - Accessory UART RX
CREATE_DMA_STREAM(2, 0); // DMA2_STREAM0_DEVICE - Compositor DMA
CREATE_DMA_STREAM(2, 5); // DMA2_STREAM5_DEVICE - ICE40LP TX
// DMA Requests
static DMARequestState s_dbg_uart_dma_request_state;
static DMARequest DBG_UART_RX_DMA_REQUEST = {
.state = &s_dbg_uart_dma_reque... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.