prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
while (node) {
ListNode *next = list_pop_head(node);
free(node);
node = next;
}
*list = NULL;
}
static void prv_compare_recognizers_processed(int indices[], uint32_t count, ListNode **list) {
printf(list == &s_recognizers_handled ? "Handle touch: " : "");
printf(list == &s_recognizers_reset ? "Re... | cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL)) | ;
prv_compare_recognizers_processed((int[]) {0}, 1, &s_recognizers_handled);
// Two recognizers attached to the active layer - processed in order that they were added
recognizer_add_to_list(recognizers[1], &layer_c.recognizer_list);
cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, ... |
lse, ALARM_KIND_CUSTOM, schedule_1);
// It's currently Thursday @ 00:00.
s_current_day = s_friday;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 1);
s_current_day = s_saturday;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 2);
s_current_day = s_sunday;
cron_service_wa... | cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()) | ;
// First alarm goes off. Second one should be up
s_current_hour = 10;
s_current_minute = 30;
s_current_day = s_sunday;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 3);
cl_assert_equal_i(s_num_alarm_events_put, 3);
cl_assert_equal_i(s_num_timeline_adds, 11);
cl_assert_equal_i(s_num_t... |
Node *)find_str)->name;
}
s_head_callback_node_list = list_prepend(s_head_callback_node_list, &node->list_node);
mutex_unlock_recursive(s_pfs_mutex);
return node;
}
void pfs_unwatch_file(PFSCallbackHandle cb_handle) {
mutex_lock_recursive(s_pfs_mutex);
PFSFileChangedCallbackNode *callback_node = (PFSFil... | if ((rv = locate_flash_file(name, &page)) != S_SUCCESS) {
goto cleanup; // could not find the file on flash
} |
rv = unlink_flash_file(page);
// IMPORTANT: prv_invoke_watch_file_callbacks assumes that we already have s_pfs_mutex
prv_invoke_watch_file_callbacks(name, FILE_CHANGED_EVENT_REMOVED);
cleanup:
mutex_unlock_recursive(s_pfs_mutex);
return (rv);
}
PFSFileListEntry *pfs_create_file_list(PFSFilenameTestCallback... |
), 10);
#if PBL_COLOR
ASSERT_CALLED(graphics_circle_draw_stroked_aa(&context, GPoint(50, 50), 10, SW_ODD));
#else
ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_ODD));
#endif
setup_test(&context, true, SW_ODD, GColorBlack, GColorBlack, false);
graphics_draw_round_rect(&conte... | (&context, GPoint(50, 50), 10) | );
ASSERT_NO_CHANGE(graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4));
ASSERT_NO_CHANGE(graphics_fill_rect(&context, &GRect(10, 20, 40, 10)));
ASSERT_NO_CHANGE(graphics_fill_circle(&context, GPoint(50, 50), 10));
ASSERT_NO_CHANGE(graphics_fill_round_rect(&context, &GRect(20, 80, 40, 10), 4, GCorner... |
rite_offset:%d",
(int)new_size, (int)session->storage.num_bytes, (int)session->storage.write_offset);
success = true;
exit:
kernel_free(tmp_buf);
if (new_storage.fd != DLS_INVALID_FILE) {
pfs_close_and_remove(new_storage.fd);
}
if (!success) {
PBL_LOG(LOG_LEVEL_ERROR, "Migration failed o... | if (!success) {
goto exit;
} |
shared_circular_buffer_consume(&session->data->buffer, &session->data->buffer_client,
bytes_read);
bytes_remaining -= bytes_read;
}
exit:
if (got_session_file) {
prv_release_session_file(session);
}
if (!success) {
PBL_LOG(LOG_LEVEL_ERROR, "Nuking storage fo... |
the first spawn,
// finish before the primitives from the 2nd spawn start.
static void prv_test_sequence_of_spawns(int create_order[4]) {
const int duration_a = 150;
const int duration_total = 2 * duration_a;
const AnimationHandlers handlers = {
.started = prv_started_handler,
.stopped = prv_stopped_hand... | MIN(first_fire_b,
prv_last_handler_entry(&s_started_handler_calls, b1)->fire_order) | ;
first_fire_b = MIN(first_fire_b,
prv_last_handler_entry(&s_started_handler_calls, b2)->fire_order);
first_fire_b = MIN(first_fire_b,
prv_last_handler_entry(&s_started_handler_calls, b3)->fire_order);
first_fire_b = MIN(first_fire_b,
prv_last_handler_en... |
tyGenderMale, 2217, 1302, 1674},
{64, ActivityGenderMale, 4568, 1820, 4152},
};
// Init the time
struct tm time_tm = s_init_time_tm;
time_tm.tm_mday += 1;
time_t utc_sec = mktime(&time_tm);
rtc_set_time(utc_sec);
fake_system_task_callbacks_invoke_pending();
int act_distance[ARRAY_LENGTH(tests)];
... | rtc_get_time() | + 1);
if ((s_hrm_manager_update_interval == 1) || force_continuous) {
PebbleHRMEvent hrm_event = {
.event_type = HRMEvent_BPM,
.bpm.bpm = bpm,
.bpm.quality = quality,
};
prv_hrm_subscription_cb(&hrm_event, NULL);
s_num_hrm_callbacks++;
}
if ((rtc_get_time() ... |
se_long_click_start_handler(ClickRecognizerRef recognizer, void *context) {
prv_toggle_playing();
prv_set_action_bar_state(context, ActionBarStateLongPress);
prv_do_haptic_feedback_vibe(context);
}
static void prv_play_pause_long_click_end_handler(ClickRecognizerRef recognizer, void *context) {
prv_set_action_... | text_layer_init_with_parameters(&window->text_layer,
&NO_MUSIC_TEXT_RECT,
i18n_get("START PLAYBACK\nON YOUR PHONE", window),
fonts_get_system_font(config->no_music_font_key),
GColorBla... | ;
layer_add_child(&window->window.layer, &window->bitmap_layer.layer);
layer_add_child(&window->window.layer, &window->text_layer.layer);
window_set_click_config_provider(&window->window, prv_no_music_window_click_config);
return window;
}
static void prv_push_no_music_window(MusicAppData *data) {
if (data->... |
w) - SECONDS_PER_DAY,
now);
cl_assert_equal_i(result, 1000 + 2000);
}
void test_health__process_range(void) {
HealthValue values[4] = {1000, 1000, 1000, 1000};
HealthServiceTimeRange range = {
.num_days = 3,
.seconds_first_day = SECONDS_PER_DAY / 10,
.seconds_last_day = ... | (s_health_service.cache, NULL) | |
MENU_LAYER_APP_ID, APP_ID_MUSIC};
AppInstallId desired_order[] = {APP_ID_GOLF, APP_ID_WORKOUT, APP_ID_MUSIC,
APP_ID_SETTINGS, APP_ID_NOTIFICATIONS, APP_ID_ALARMS,
APP_ID_WATCHFACES, BG_COUNTER_APP_ID, MENU_LAYER_APP_ID};
uin... | app_menu_data_source_get_count(&data_source) | |
mbuf_set_data(&end_flag_mbuf, &flag_data, sizeof(flag_data)) | ;
mbuf_set_flag(&end_flag_mbuf, MBUF_FLAG_IS_FRAMING, true);
mbuf_append(&start_flag_mbuf, &end_flag_mbuf);
// send off the frame
mbuf_iterator_init(&s_send_info.mbuf_iter, &start_flag_mbuf);
accessory_use_dma(true);
if (!accessory_send_stream(prv_send_stream_callback, (void *)read_mbuf)) {
accessory_e... | |
NG_COUNT, AnalyticsClient_System);
}
void bluetooth_analytics_handle_bt_classic_pairing_request(void) {
analytics_inc(ANALYTICS_DEVICE_METRIC_BT_PAIRING_COUNT, AnalyticsClient_System);
}
void bluetooth_analytics_handle_ble_pairing_error(uint32_t error) {
analytics_event_bt_error(AnalyticsEvent_BtLePairingError, e... | count_bits_set((uint8_t *)&le_channel_map, NUM_LE_CHANNELS) | |
/*
* 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... | sys_get_time_ms(&t_s, &t_ms) | ;
if (out_ms) {
*out_ms = t_ms;
}
if (tloc) {
*tloc = t_s;
}
return (t_ms);
}
uint16_t pbl_override_time_ms_legacy(time_t *tloc, uint16_t *out_ms) {
uint16_t t_ms;
time_t t_s;
sys_get_time_ms(&t_s, &t_ms);
time_t legacy_time = sys_time_utc_to_local(t_s);
if (out_ms) {
*out_ms = t_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... | {
return false;
} |
layer = layer->parent;
}
return true;
}
typedef struct ProcessTouchCtx {
Recognizer *triggered;
const TouchEvent *touch_event;
} ProcessTouchCtx;
T_STATIC bool prv_dispatch_touch_event(Recognizer *recognizer, void *context) {
ProcessTouchCtx *ctx = context;
// Skip recognizer if it has already failed... |
/*
* 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 button_state = 0x00;
for (int i = 0; i < NUM_BUTTONS; ++i) {
button_state |= (button_is_pressed(i) ? 0x01 : 0x00) << i;
}
return button_state;
} |
void button_init(void) {
periph_config_acquire_lock();
periph_config_enable(SYSCFG, RCC_APB2Periph_SYSCFG);
initialize_button_common();
for (int i = 0; i < NUM_BUTTONS; ++i) {
initialize_button(&BOARD_CONFIG_BUTTON.buttons[i]);
}
periph_config_disable(SYSCFG, RCC_APB2Periph_SYSCFG);
periph_confi... |
ip it
if (token[0] == '#') {
continue;
}
// If this is a comment skip it
if (strcmp(token, "//") == 0) {
continue;
}
// If this is an AlgDlsMinuteData line, get the name
if (strcmp(token, "AlgDlsMinuteData") == 0) {
PBL_ASSERT(state->test_entry.name[0] == 0, "Unexpected s... | if (strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.force_shut_down_at);
} else if (strcmp(token, "TEST_WEIGHT") == 0) {
sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight);
} else if (strcmp(token, "TEST_NAME") == 0... |
}
// If this is a "static AlgDlsMinuteData samples[] = {" line, skip it
if (strcmp(token, "static") == 0) {
continue;
}
// Grab a sample
if (strcmp(token, "{") == 0) {
PBL_ASSERTN(state->test_entry.name[0] != 0);
int steps = 0;
int orientation = 0;
int vmc = 0;
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | health_util_get_pace(29, 4800) | , 10); // PBL-36661
cl_assert_equal_i(health_util_get_pace(10, 800), 20); // less than a mile
cl_assert_equal_i(health_util_get_pace(820, 262400), 5); // many miles / long distance
}
|
_layer_update_callback);
layer_render_tree(&layer, &ctx);
#if SCREEN_COLOR_DEPTH_BITS == 8
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_clear.8bit.pbi"));
#else
cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite));
#endif
}
#define RADIUS_DEFAULT 4
#de... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 4);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw4_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_... |
rt_equal_s(tmbuf, "Fri Jan 2 13:00:00 2015");
#if EXTENSION_SU
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%C %h", &jan_2_2015__13_00_00);
cl_assert_equal_s(tmbuf, "20 Jan");
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%D %e", &jan_2_2015__13_00_00);
cl_assert_equal_s(tmbuf, "01/02/15 2");
... | (tmbuf, 0xFF, sizeof(tmbuf)) | |
StationaryActionDisableStationary);
}
}
void stationary_handle_battery_connection_change_event(void) {
PBL_LOG_D(DEBUG_STATIONARY, LOG_LEVEL_DEBUG,
"Stationary mode battery state change event received");
if (battery_is_usb_connected()) {
analytics_event_stationary_state_change(rtc_get_time(), Sta... | analytics_event_stationary_state_change(rtc_get_time(), StationaryAnalyticsEnterFromPeek) | ;
} else if (s_current_state == StationaryStateAwake) {
analytics_event_stationary_state_change(rtc_get_time(), StationaryAnalyticsEnterNormally);
}
services_set_runlevel(RunLevel_Stationary);
accel_enable_high_sensitivity(true);
s_current_state = StationaryStateStationary;
}
static void prv_exit_station... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert(0 == strcmp(buf, "-1")) | ;
itoa_int(365, buf, 10);
cl_assert(0 == strcmp(buf, "365"));
itoa_int(-365, buf, 10);
cl_assert(0 == strcmp(buf, "-365"));
// max int32
itoa_int(2147483647, buf, 10);
cl_assert(0 == strcmp(buf, "2147483647"));
// min int32
itoa_int(-2147483647, buf, 10);
cl_assert(0 == strcmp(buf, "-2147483647"... |
NY, true, 1);
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw1_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// AA = true, SW = 2
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 2);
graphics_draw_rect(&ctx, &ORIGIN_DRAW... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
#endif
} |
void test_graphics_draw_rect_${BIT_DEPTH_NAME}__origin_sw(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// SW = 1
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "d... |
18n_noop("MI"), i18n_noop("KM"));
GTextNodeText *units_text_node = health_util_create_text_node_with_text(
i18n_get(units_string, i18n_owner), units_font, TEXT_COLOR, container);
units_text_node->node.offset.y = units_offset_y;
#endif
break;
}
case WorkoutMetricType_Custom:
{
... | (units_string, i18n_owner) | , units_font, TEXT_COLOR, container);
units_text_node->node.offset.y = units_offset_y;
#endif
break;
}
// don't have default here so when we have a new type, we don't forget to add it here
case WorkoutMetricType_None:
case WorkoutMetricTypeCount:
break;
}
return &container->node;
... |
ctx.mutex);
int32_t player_volume_percent = s_music_ctx.player_volume_percent;
mutex_unlock_recursive(s_music_ctx.mutex);
return player_volume_percent;
}
static void prv_put_state_changed_event(MusicPlayState playback_state) {
PebbleEvent event = {
.type = PEBBLE_MEDIA_EVENT,
.media = {
.type = P... | {
return false;
} |
return (func_ptr() & capability);
}
bool music_is_playback_state_reporting_supported(void) {
return prv_is_capability_supported(MusicServerCapabilityPlaybackStateReporting);
}
bool music_is_progress_reporting_supported(void) {
// Check capability and that track length is greater than 0
uint32_t track_length_... |
DataNode *data_node = kernel_malloc(sizeof(DataNode) + pp_header.length);
list_init(&data_node->node);
data_node->endpoint_id = pp_header.endpoint_id;
data_node->length = pp_header.length;
memcpy(data_node->data, buffer, pp_header.length);
fake_transport->sent_data = (DataNode *) list_pre... | {
FakeTransport *fake_transport = (FakeTransport *) transport;
cl_assert(transport);
cl_assert_equal_b(list_contains((const ListNode *)s_fake_transport_head,
(const ListNode *)fake_transport), true);
if (fake_transport->session) {
// Causes clean up of CommSession:
fake... |
////////////////////////////////////////////////////////////////////////////////////////////////////
// Transport helper functions
bool fake_comm_session_send_buffer_write_raw_by_transport(Transport *transport,
const uint8_t *data, size_t length) {
CommSess... |
e round down to largest
// radius that can be drawn
radius = prv_clamp_corner_radius(rect->size, corner_mask, radius);
if (radius <= alt_radius) {
prv_fill_rect_legacy2(ctx, *rect, radius, corner_mask, fill_color);
} else {
// These are used to optimize the rectangles that are drawn such that only thre... | (rect->origin.x, rect->origin.y, rect->size.w, 1) | |
reed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "settings.h"
#include "sett... | window_set_user_data(window, data) | |
rigger_cassette_icon_switch(&data->image_cassette, animated);
}
}
static void prv_update_ui_state_skipping(MusicAppData *data, bool animated) {
action_bar_layer_set_click_config_provider(&data->action_bar,
prv_skipping_click_config_provider);
action_bar_layer_set_icon... | (MusicCommandTogglePlayPause) | ;
}
static void prv_play_pause_click_handler(ClickRecognizerRef recognizer, void *context) {
reset_action_bar_revert_timer(context);
prv_toggle_playing();
}
static void prv_handle_volume_repeat(void *context) {
MusicAppData *data = context;
if (!data->volume_repeat_timer) {
return;
}
data->volume_repe... |
age governing permissions and
* limitations under the License.
*/
#include "qspi_flash.h"
#include "qspi_flash_definitions.h"
#include "board/board.h"
#include "drivers/flash/flash_impl.h"
#include "drivers/gpio.h"
#include "drivers/qspi.h"
#include "flash_region/flash_region.h"
#include "kernel/util/delay.h"
#incl... | if (status_reg & dev->state->part->status_bit_masks.busy) {
return E_BUSY;
} else if (flag_status_reg & dev->state->part->flag_status_bit_masks.erase_suspend) {
return E_AGAIN;
} else {
return S_SUCCESS;
} |
}
status_t qspi_flash_erase_begin(QSPIFlash *dev, uint32_t addr, bool is_subsector) {
uint8_t instruction;
if (is_subsector) {
instruction = dev->state->part->instructions.erase_sector_4k;
} else {
instruction = dev->state->part->instructions.erase_block_64k;
}
qspi_use(dev->qspi);
prv_write_enab... |
-488, 760, 120},
{ -472, 784, 128},
{ -456, 728, 88},
{ -408, 632, 184},
{ -552, 632, 184},
{ -536, 720, 176},
{ -504, 744, 144},
// 116 seconds
{ -408, 800, 288},
{ -408, 896, 368},
{ -360, 912, 456},
{ -344, 864, 424},
{ -352, 888, 376},
{ -368, 872, 368},
{ -37... | { -80, -176, -1016},
{ -48, -112, -1048},
{ 8, -168, -1072},
{ -48, -136, -1048},
{ -32, -152, -1056},
{ 24, -144, -1016},
{ 488, -40, -736},
{ -168, -88, -992},
{ -32, -104, -1032},
{ -80, -112, -1016},
{ -96, -88, -1048},
{ -40, -112, -1032},
{ -80, -112, -1032},
... |
{ -176, 920, 112},
{ -168, 888, 88},
// 124 seconds
{ -160, 912, 128},
{ -168, 896, 112},
{ -160, 888, 96},
{ -152, 936, 64},
{ -200, 976, 152},
{ -192, 904, 112},
{ -184, 904, 96},
{ -152, 904, 96},
{ -152, 928, 80},
{ -176, 904, 120},
{ -176, 904, 112},
{ -... |
plicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "apps/sys... | {
HealthDetailCardConfig config = {
.num_headings = 1,
.headings = &(HealthDetailHeading) {
.primary_label = "LABEL1",
.primary_value = "value1",
.secondary_label = "LABEL2",
.secondary_value = "value2",
.fill_color = GColorWhite,
#if PBL_BW
.outline_color = GColorBlack,
#e... |
void test_health_detail_card__render_no_subtitle(void) {
HealthDetailCardConfig config = {
.num_headings = 1,
.headings = &(HealthDetailHeading) {
.primary_label = "LABEL1",
.primary_value = "value1",
.fill_color = GColorWhite,
#if PBL_BW
.outline_color = GColorBlack,
#endif
},
... |
ime_t *timep, struct tm *result) {
return localtime_r(timep, result);
}
// i18n dummies
////////////////////////////////////
static bool s_i18n_translate = false;
static bool s_i18n_locale_other = false;
char *i18n_get_locale(void) {
if (s_i18n_locale_other) {
return "es_ES";
} else {
return "en_US";
... | cl_assert_equal_s(tmbuf, "13 01") | ;
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%j %m %M %p", &jan_2_2015__13_00_00);
cl_assert_equal_s(tmbuf, "002 01 00 PM");
#if EXTENSION_GNU
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%P", &jan_2_2015__13_00_00);
cl_assert_equal_s(tmbuf, "pm");
#endif
tmbuf[0] = '\0';
strftime(tmbuf, si... |
/*
* 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 true;} |
int32_t gbitmap_png_get_transparent_gray_value(upng_t *upng) {return -1;}
int32_t png_seek_chunk_in_resource(uint32_t resource_id, uint32_t offset,
bool seek_framedata, bool *found_actl) {return 0;}
int32_t png_seek_chunk_in_resource_system(ResAppNum app_num, uint32_t resource_id,... |
ta;
(void)menu_layer;
(void)section_index;
return MENU_CELL_BASIC_HEADER_HEIGHT;
}
static void draw_row_callback(GContext* ctx, Layer *cell_layer, MenuIndex *cell_index, AppData *data) {
(void)data;
switch (cell_index->row) {
case 0: {
int num_beers = persist_read_int(COUNT_PKEY);
char title[... | {
static const PebbleProcessMdSystem s_app_info = {
.common.main_func = &s_main,
.name = "Persist Demo"
};
return (const PebbleProcessMd*) &s_app_info;
} |
#undef BUFFER_SIZE
|
m curve works
void test_animation__property_int16(void) {
#ifdef TEST_INCLUDE_BASIC
PropertyAnimation *prop_h;
int16_t value = 0;
int16_t start_value = 0, end_value = 100;
const int duration = 200;
const int delay = 25;
const AnimationHandlers handlers = {
.started = prv_started_handler,
.stopped =... | GPoint(0, 0) | ;
end_value = GPoint(100, 200);
prop_h = property_animation_create(&implementation, &value, &start_value, &end_value);
Animation *h = property_animation_get_animation(prop_h);
void *context = &value;
animation_set_handlers(h, handlers, context);
animation_set_duration(h, duration);
animation_set_delay(h, ... |
bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite);
cl_assert(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE));
}
// Tests 2-bit palettized PBI loading into gbitmap
// Result:
// - gbitmap matches platform loaded PBI
void test_bitblt_circular__color_2_bit(void) {
GB... | (ctx, &framebuffer_bounds) | ;
bitblt_bitmap_into_bitmap(native_framebuffer, bitmap, GPointZero, GCompOpAssign, GColorWhite);
cl_assert(gbitmap_pbi_eq(native_framebuffer, TEST_PBI_FILE));
}
void test_bitblt_circular__8_bit_converted_circular_offset(void) {
GBitmap *bitmap = setup_png_test(TEST_NAMED_PNG_FILE("test_bitblt_circular__spiral"... |
/*
* 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... | (30, TEXT_LAYER_FLOW_DEFAULT_PAGING_HEIGHT) | );
scroll_layer_is_instance_value = &container;
cl_assert(true == text_layer_calc_text_flow_paging_values(&text_layer, &origin, &page));
cl_assert_equal_gpoint(origin, GPoint(40, 60));
// containers's absolute coordinate
cl_assert_equal_gpoint(page.origin, GPoint(30, 40));
cl_assert_equal_gsize(page.size,... |
uint32_t sectors_active) {
size_t num_entries = __builtin_popcount(sectors_active);
// We need space to store all the data for active pages, the
// page header for all pages, and the GCData struct
size_t space_needed = 0;
space_needed += (num_entries * (PFS_PAGE_SIZE - AVAIL_BYTES_OFFSET));
space_needed +... | (s_pfs_mutex) | ;
for (int i = FD_INDEX_OFFSET; i < FD_INDEX_OFFSET+PFS_FD_SET_SIZE; i++) {
mark_fd_free(i);
}
// clear out all pages
filesystem_regions_erase_all();
prv_invalidate_page_flags_cache_all();
if (write_erase_headers) {
prv_write_erased_header_on_page_range(0, s_pfs_page_count, 1);
}
mutex_unloc... |
/*
* 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, icon_to.size.h / 2) | |
efine TEST_TEXT "DUMMY TEXT"
#define TEST_FONT ((void *)0xf0a7f0a7)
#define TEST_TEXT_SIZE GSize(50, 18)
#define TEST_TEXT_BOX GRect(10, 10, 140, 200)
void graphics_draw_text(GContext *ctx, const char *text, GFont const font, const GRect box,
const GTextOverflowMode overflow_mode, const GTextAl... | cl_assert_equal_i(size.h, custom_node.node.cached_size.h) | ;
cl_assert_equal_i(s_num_draw_custom_calls, 1);
graphics_text_node_get_size(&custom_node.node, ctx, &TEST_TEXT_BOX, NULL, &size);
cl_assert(size.w > 0);
cl_assert(size.h > 0);
cl_assert_equal_i(size.w, TEST_TEXT_SIZE.w);
cl_assert_equal_i(size.h, TEST_TEXT_SIZE.h);
cl_assert_equal_i(size.w, custom_node.... |
.conn_idx = conn_idx,
.initial_addr = *initial_addr,
.local_addr = *local_addr,
.conn_params = *params,
};
s_connections = (Connection *)list_prepend((ListNode *)s_connections, (ListNode *)connection);
}
prv_unlock();
return connection;
}
void connection_destroy(Connection *connecti... | {
prv_lock();
{
*addr_buf = connection->local_addr;
}
prv_unlock();
} |
void connection_get_conn_params(const Connection *connection,
BleConnectionParams *params_out) {
prv_lock();
{
*params_out = connection->conn_params;
}
prv_unlock();
}
void connection_get_address_by_idx_check(uint16_t conn_idx, BTDeviceInternal *addr_out) {
prv_lock();
... |
apability) {
return true;
}
static int s_sys_psleep_last_millis;
void sys_psleep(int millis) {
s_sys_psleep_last_millis = millis;
}
AppMessageCtx *app_state_get_app_message_ctx(void) {
return &s_app_message_ctx;
}
bool app_message_receiver_open(size_t buffer_size) {
if (s_app_receiver_oom) {
return fals... | app_message_register_outbox_failed(prv_out_failed_callback) | |
red by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include ... | cl_assert_equal_i(circular_buffer_copy(&buffer, data_out, 6), 6) | ;
cl_assert(memcmp("234567", data_out, 6) == 0);
}
void test_circular_buffer__copy_offset(void) {
CircularBuffer buffer;
uint8_t storage[8];
circular_buffer_init(&buffer, storage, sizeof(storage));
const uint16_t data_out_size = 8;
uint8_t data_out[data_out_size];
// Assert zero bytes copied, empty buf... |
/*
* 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... | {
Uuid *removed_id = kernel_malloc(sizeof(Uuid));
if (!removed_id) {
return;
}
*removed_id = *reminder_id;
PebbleEvent event = {
.type = PEBBLE_REMINDER_EVENT,
.reminder = {
.type = type,
.reminder_id = removed_id,
}
};
event_put(&event);
} | |
ime_init(cur_time, cur_millis);
jerry_value_t now = rocky_util_create_date(NULL);
jerry_value_t getSeconds = jerry_get_object_field(now, "getSeconds");
jerry_value_t getMinutes = jerry_get_object_field(now, "getMinutes");
jerry_value_t getHours = jerry_get_object_field(now, "getHours");
jerry_value_t getDate... | jerry_get_number_value(result_date) | , 30.0);
cl_assert_equal_d(jerry_get_number_value(result_month), 9.0);
cl_assert_equal_d(jerry_get_number_value(result_year), 116.0);
jerry_release_value(result_year);
jerry_release_value(result_month);
jerry_release_value(result_date);
jerry_release_value(result_hours);
jerry_release_value(result_minute... |
qual(&state.pin.header.id, &s_items[0].header.id));
// check second
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check third
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id));
// check second again... | (uuid_equal(&state.pin.header.id, &s_extra_case_items[0].header.id)) | ;
// check next
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[1].header.id));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[2].header.id));
cl_assert(!iter_next(&iterator));
}
// 5am, no events passed
voi... |
d under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "clar.h"
#include "services/normal/blob_db/ios_notif_pref_db.h"
#inc... | (0, &attr_list) | ;
attribute_list_add_cstring(&attr_list, AttributeIdShortTitle, "Title");
attribute_list_add_uint8(&attr_list, AttributeIdMuteDayOfWeek, 0x1F);
attribute_list_add_cstring(&attr_list, AttributeIdAppName, "GMail");
TimelineItemActionGroup action_group = {
.num_actions = 0,
};
// Store them in the DB
ch... |
te_bits() & ~SELECT_BUTTON_MASK;
while (1) {
// See if we should restart
uint8_t button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK;
if (button_state != prev_button_state) {
system_reset();
}
delay_ms(10);
}
}
static void check_and_handle_resuming_from_standby(void) {
periph_c... | {
check_update_fw();
} |
if (check_and_increment_reset_loop_detection_bits()) {
sad_watch(ERROR_RESET_LOOP);
}
if (boot_bit_test(BOOT_BIT_SHUTDOWN_REQUESTED)) {
boot_bit_clear(BOOT_BIT_SHUTDOWN_REQUESTED);
dbgserial_putstr("Shutdown requested.");
// A full shutdown has been requested instead of booting.
// This nee... |
cl_assert_equal_i(ctx.idx, 4) | ;
prv_test_touch_event(&ctx.touch_events[2], 1, TouchEvent_Touchdown, &GPoint(55, 55), 3686480, 2,
NULL, 0, 0, false);
prv_test_touch_event(&ctx.touch_events[3], 1, TouchEvent_PositionUpdate, &GPoint(55, 55),
3686480, 2, &GPoint(-22, -22), 20, 5, true);
TouchEvent *to... | |
sting_notification(TimelineItem *notification,
CommonTimelineItemHeader *existing_header_out) {
// PBL-9509: iOS' Calendar app uses the timestamp of the ANCS notification for the time of the
// event, not the time the notification was sent. If a calendar event has multiple... | PBL_LOG(LOG_LEVEL_INFO, "Ignoring notification from <%s>: Muted", app_id_buffer) | ;
analytics_inc(ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_FILTERED_BECAUSE_MUTED_COUNT,
AnalyticsClient_System);
return true;
}
// filter out mail buggy mail messages
if (prv_should_ignore_because_apple_mail_dot_app_bug(app_id, message)) {
PBL_LOG(LOG_LEVEL_ERROR, "Ignoring ANCS not... |
/*
* 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... | display_firmware_update_progress(progress, total * 2) | |
void) {
TimelineItem *item = prv_set_timeline_item(&(TimelinePeekItemConfig) {
.title = "CoreUX Design x Eng",
.subtitle = "ConfRM-Missile Command",
.icon = TIMELINE_RESOURCE_TIMELINE_CALENDAR,
.num_concurrent = 0,
}, false /* animated */);
TimelinePeek *peek = timeline_peek_get_peek();
const La... | cl_assert(layer->frame.origin.y >= DISP_ROWS) | ;
// Transition away from the watchface
s_is_watchface_running = false;
timeline_peek_set_visible(false, false /* animated */);
// Peek should be hidden and off-screen.
cl_assert(layer->frame.origin.y >= DISP_ROWS);
// Transition back to the watchface
s_is_watchface_running = true;
timeline_peek_set_v... |
del_get_iter_state_with_timeline_idx(3));
cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(4));
cl_assert(timeline_model_iter_next(&new_idx, &has_next));
cl_assert(has_next);
cl_assert_equal_i(new_idx, 5);
cl_assert_equal_i(timeline_model_get_num_items(), 2);
cl... | (new_idx, 1) | |
e slot
int prv_expected_steps_per_min(int slot, int multiplier) {
if (multiplier == 1) {
// The slot % 50 was chosen so that the total # of steps per day does not exceeed 2^16
return ((slot % 50) + 1);
} else if (multiplier == 2) {
// The slot % 30 was chosen so that the total # of steps per day does no... | (filename) | + 3];
sprintf(out_path, "%s/%s/%s", CLAR_FIXTURE_PATH, ACTIVITY_FIXTURE_PATH, filename);
// Open and read the settings file from PFS
int fd = pfs_open(ACTIVITY_SETTINGS_FILE_NAME, OP_FLAG_READ, FILE_TYPE_STATIC,
ACTIVITY_SETTINGS_FILE_LEN);
cl_assert(fd >= S_SUCCESS);
size_t size = pfs_g... |
ize.h"
#include "applib/tick_timer_service.h"
#include "applib/ui/app_window_stack.h"
#include "applib/ui/property_animation.h"
#include "applib/ui/ui.h"
#include "kernel/pbl_malloc.h"
#include "kernel/ui/system_icons.h"
#include "services/common/clock.h"
#include "services/common/i18n/i18n.h"
#include "services/normal... | (config->horizontal_margin, config->title_field.origin_y,
prv_text_layer_width(), config->title_field.size_h) | |
/*
* 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... | IWDG_Enable() | ;
watchdog_feed();
}
// This behaves differently from the bootloader and the firmware.
void watchdog_feed(void) {
IWDG_ReloadCounter();
}
bool watchdog_check_reset_flag(void) {
return RCC_GetFlagStatus(RCC_FLAG_IWDGRST) != RESET;
}
void watchdog_clear_reset_flag(void) {
RCC_ClearFlag();
}
|
- 2px Red
// - Rest Blue
void test_bitblt__8bit_wrap_x(void) {
GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__8bit_wrap_x.8bit.pbi");
uint8_t dest_data[50*50];
GBitmap dest_bitmap = {
.addr = dest_data,
.row_size_bytes = 50,
.info.format = GBitmapFormat8Bit,
.info.version = GBITMA... | (gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_assign-expect.8bit.pbi")) | ;
memset(dest_data, GColorBlue.argb, sizeof(dest_data));
bitblt_bitmap_into_bitmap(&dest_bitmap, src_bitmap, GPointZero, GCompOpAssignInverted, GColorWhite);
cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_assigninverted-expect.8bit.pbi"));
memset(dest_data, GColorBlue.argb, sizeof(dest_data)... |
r in bank %u!",
process_metadata_get_code_bank_num(app_md));
return false;
}
// The rest of worker_ram is available for worker state to use as it sees fit.
if (!worker_state_configure(&worker_ram)) {
PBL_LOG(LOG_LEVEL_ERROR, "Worker state configuration failed");
return false;
}
// The... | process_manager_make_process_safe_to_kill(PebbleTask_Worker, gracefully) | ) {
// Maybe next time...
PBL_LOG(LOG_LEVEL_DEBUG, "Worker not ready to exit");
return;
}
// Save which worker we are exiting
AppInstallId closing_worker_install_id = s_worker_task_context.install_id;
// Perform generic process cleanup
process_manager_process_cleanup(PebbleTask_Worker);
// No... |
/*
* 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... | (&event->dev_address) | ;
if (!connection) {
goto unlock;
}
const bool has_mtu_changed = (connection->gatt_mtu != event->mtu);
PBL_LOG(LOG_LEVEL_DEBUG, "Handle MTU change from %d to %d bytes",
connection->gatt_mtu, event->mtu);
if (has_mtu_changed) {
connection->gatt_mtu = event->mtu;
bt_drive... |
/*
* 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 (!glance) {
return;
}
kino_reel_destroy(glance->reel);
app_free(glance);
} | |
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 express or implied.
* See the License for the specific language ... | (&s_app_uuid, RUNNING) | ;
// When no remote is set, this should just not run
cl_assert_equal_i(s_launcher_deprecated_messages, 0);
// Set the remote as being active
prv_set_remote_active();
stub_app_set_uuid(s_app_uuid);
// When app_run_state is not supported, should use launcher_app_message
prv_set_expected(RUNNING);
app_r... |
4},
{ 1088, 104, 104},
{ 1096, 104, 104},
{ 1112, 112, 112},
{ 1120, 104, 136},
{ 1152, 64, 152},
{ 1152, 72, 144},
{ 1160, 64, 152},
{ 1192, 72, 152},
// 51 seconds
{ 1136, 0, 176},
{ 1232, 0, 144},
{ 1088, -64, 176},
{ 1104, -88, 120},
{ 1056, -96, 96},
{ 99... | { 1272, 40, -120},
{ 1296, -56, 32},
{ 1200, -48, 16},
{ 1128, -72, 32},
{ 1056, -56, 32},
{ 1008, -48, 16},
{ 968, -64, 40},
{ 896, -56, 16},
{ 872, -48, 0},
{ 864, -72, 8},
{ 944, -80, 16},
{ 1056, -64, -40},
{ 1120, -56, -80},
{ 1624, -64, -56},
{ 1512, -56... | |
d *uuid) {
return E_INVALID_OPERATION;
}
void wakeup_enable(bool enable) {
}
bool phone_call_is_using_ANCS(void) {
return true;
}
#include "services/normal/notifications/alerts.h"
#include "services/normal/blob_db/app_db.h"
#include "services/normal/app_cache.h"
#include "services/normal/blob_db/pin_db.h"
stat... | {
return DISP_ROWS;
} |
void timeline_peek_handle_process_start(void) { }
void timeline_peek_handle_process_kill(void) { }
|
anager_event_loop_upkeep();
cl_assert_equal_i(modal_manager_get_properties(),
ModalProperty_Transparent | ModalProperty_Unfocused);
// Add priority 0 (discreet) opaque window 0
cl_assert(NumModalPriorities > 0);
window_stack_push(window_stacks[0], windows[0][0], false);
// A discreet win... | (windows[2][1]->on_screen, true) | ;
cl_assert_equal_i(windows[2][1]->is_click_configured, false);
cl_assert_equal_p(s_last_click_configured_window, windows[3][1]);
// Add priority 1 opaque window 0
cl_assert(NumModalPriorities > 1);
window_stack_push(window_stacks[1], windows[1][0], false);
// An opaque top window is now below two transpa... |
callback. Returns true if the chunk is within the designated key range and
// should be processed.
static bool prv_read_minute_file_record(SettingsFile *file, SettingsRecordInfo *info,
uint32_t key_range_start, uint32_t key_range_end,
AlgM... | settings_file_each(file, prv_log_minute_file_minutes_cb, &context) | ;
success = (status == S_SUCCESS);
exit:
if (file) {
prv_minute_data_file_close(file);
}
prv_unlock();
return success;
}
// ----------------------------------------------------------------------------------------------
// Settings file rewrite callback used by prv_validate_and_trim_minute_file() when t... |
ll still calculate the checksum on this byte
// and verify that the checksum is 0 at the end, so if this byte is the actual footer byte (aka.
// the checksum), we will still include it in the checksum.
s_read_info.footer_byte = data;
// increment the length and run the CRC calculation
s_read_info.length++;
... | (&s_read_consumer.mbuf_iter, &s_header_mbuf) | ;
system_task_add_callback_from_isr(prv_schedule_notify_timeout, NULL, &should_context_switch);
}
return should_context_switch;
}
// Sending functions
////////////////////////////////////////////////////////////////////////////////
static bool prv_send_byte_and_check(uint8_t data) {
// NOTE: THIS IS RUN WI... |
_handler(prv_receive_ack_nack_callback);
prv_receive_test_data(TEST_TRANSACTION_ID_1, false);
cl_assert_equal_i(s_app_inbox_consume_call_count, 1);
prv_process_sent_data();
// First Message
cl_assert(s_in_received_is_called == true);
// ACK the messages
// Check that state was reset properly
check_in... | app_message_app_protocol_system_nack_callback(s_fake_app_comm_session,
(const uint8_t *)&push, sizeof(push)) | ;
prv_process_sent_data();
cl_assert_equal_b(s_nack_received_for_id_2, true);
}
|
_app_outbox_sent_handler = sent_handler;
s_app_outbox_ctx = cb_ctx;
AppMessageAppOutboxData *outbox_data = (AppMessageAppOutboxData *)data;
prv_send_data(outbox_data->endpoint_id,
outbox_data->payload, length - sizeof(AppMessageAppOutboxData));
}
static void prv_process_sent_data(void) {
if (!s... | (s_ack_sent_is_called, true) | |
ert_equal_i(recognizers[1]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[3]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible);
// A touchdown occurs and the parent of the previous active recognizer becomes the active layer.
// No recognizer... | (k_rec_count) | ;
Window window = {};
layer_init(&window.layer, &GRectZero);
Layer *root = &window.layer;
RecognizerManager manager;
recognizer_manager_init(&manager);
Layer layer_a;
layer_init(&layer_a, &GRectZero);
layer_add_child(root, &layer_a);
manager.window = &window;
manager.active_layer = &layer_a;
ma... |
/*
* 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... | va_end(fmt_args) | ;
}
void passert_failed(const char* filename, int line_number, const char* message, ...) {
va_list fmt_args;
va_start(fmt_args, message);
prv_handle_passert_failed_vargs(filename, line_number,
(uintptr_t)__builtin_return_address(0), "ASSERT", message, fmt_args);
va_end(fmt_args);
}
void passert_failed_n... |
the "padding" we had left
// isn't enough to fit Rocky + Jerry's .bss:
app_segment_size -= 1400;
}
#endif
memset((char *)app_ram.start + stack_guard_size, 0,
memory_segment_get_size(&app_ram) - stack_guard_size);
MemorySegment app_segment;
PBL_ASSERTN(memory_segment_split(&app_ram, &app_segme... | (entry.install_id) | ;
}
}
app_manager_set_minimum_run_level(process_metadata_get_run_level(app_md));
// Use the static app event queue:
s_app_task_context.to_process_event_queue = s_to_app_event_queue;
// Init services required for this process before it starts to execute
process_manager_process_setup(PebbleTask_App);
... |
_mv = battery_curve_lookup_voltage_by_percent(3, false);
int critical_mv = battery_curve_lookup_voltage_by_percent(0, false);
fake_battery_init(good_mv, false, false);
battery_monitor_init();
periodic_timer_trigger(1);
cl_assert(!s_in_low_power && !battery_monitor_critical_lockout());
cl_assert_equal_i(s_... | (LOG_LEVEL_DEBUG, "▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼") | ;
fake_battery_set_millivolts(high_mv);
periodic_timer_trigger(20);
cl_assert_equal_i(battery_get_charge_state().charge_percent, 50);
PBL_LOG(LOG_LEVEL_DEBUG, "▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲");
// Should still update if it goes lower
fake_battery_set_millivolts(lower_mv);
periodic_timer_trigger(20);
cl_asser... |
/*
* 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... | decode_start(100) | ;
assert_decode_char_succeeds(0x01);
assert_decode_completed(0);
assert_buffer_not_touched(0);
}
void test_cobs_decode__output_too_small_1(void) {
const char vector[] = { 0x06, 'L', 'a', 'r', 'g', 'e', '.' };
decode_start(5);
assert_decode_fails(vector, sizeof(vector));
assert_decode_completed(SIZE_MAX);... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prv_task_get_stack_free(PebbleTask_KernelMain) | |
) {
power_states[next_state].enter();
}
}
static void prv_enter_lpm(void) {
#ifndef BATTERY_DEBUG
if (!firmware_update_is_in_progress()) {
low_power_enter();
}
#endif
PBL_LOG_COLOR(LOG_LEVEL_INFO, BATT_LOG_COLOR, "Battery low: enter low power mode");
}
static void prv_resume_normal_operation(void) {
... | ratio32_from_percent(BOARD_CONFIG_POWER.low_power_threshold) | |
13 seconds
{ 728, -112, 56},
{ 960, -48, -96},
{ 1272, 16, 40},
{ 1464, 120, -128},
{ 1552, 112, -112},
{ 1520, 48, -144},
{ 1096, 112, -160},
{ 880, 112, -160},
{ 1064, 200, 24},
{ 1224, 216, 136},
{ 1208, 264, 112},
{ 984, 336, 56},
{ 1176, 344, 120},
{ 1160, 52... | { 864, 16, -112},
{ 1032, 128, 8},
{ 1120, 192, 96},
{ 1032, 304, 72},
{ 992, 392, 128},
{ 1336, 464, 352},
{ 1080, 960, 376},
// 19 seconds
{ 856, 472, 0},
{ 1112, 320, 152},
{ 1256, 576, 80},
{ 1520, 456, 144},
{ 1784, 408, 224},
{ 1776, 296, 120},
{ 1632, 1... | |
nitiated_enter(void) {
PBL_ASSERTN(s_state.state == PostMessageStateAwaitingResetRequest ||
s_state.state == PostMessageStateAwaitingResetCompleteLocalInitiated ||
s_state.state == PostMessageStateSessionOpen);
s_state.state = PostMessageStateAwaitingResetCompleteRemoteInitiated;
prv_s... | (it, PostMessageKeyResetRequest) | |
* 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 "clar.h"
#include "services/normal/blob_db/pin_db.h"
#include "services/normal/timeline/timeline.h"
// Fixture
/////////////... | ((uint8_t *)&item4.header.id, sizeof(TimelineItemId),
(uint8_t *)&item4, sizeof(TimelineItem)) | ;
bool is_dirty = true;
cl_assert_equal_i(pin_db_is_dirty(&is_dirty), S_SUCCESS);
cl_assert(!is_dirty);
BlobDBDirtyItem *dirty_list = pin_db_get_dirty_list();
cl_assert(!dirty_list);
}
void test_pin_db__is_dirty_insert_locally(void) {
// Insert a bunch of pins "from the watch"
// These should not be di... |
/*
* 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... | event_service_client_subscribe(&button_event_info) | |
ze++) {
system_theme_set_content_size(settings_content_size_to_preferred_size(content_size));
callback(content_size, root_level, selected_index, additional_crumbs);
}
}
static void prv_render_action_menus_static(
SettingsContentSize content_size, const ActionMenuLevel *root_level,
unsigned int select... | action_menu_level_create(ARRAY_LENGTH(thin_values)) | ;
action_menu_level_set_display_mode(root_level, ActionMenuLevelDisplayModeThin);
for (size_t i = 0; i < ARRAY_LENGTH(thin_values); i++) {
action_menu_level_add_action(root_level, thin_values[i], prv_noop_action_callback, NULL);
}
const unsigned int selected_index = 0;
prv_prepare_canvas_and_render_actio... |
eNotifications *notifications_glance =
launcher_app_glance_structured_get_data(structured_glance);
if (notifications_glance) {
event_service_client_unsubscribe(¬ifications_glance->notification_event_info);
kino_reel_destroy(notifications_glance->icon);
}
app_free(notifications_glance);
}
static ... | {
PBL_ASSERTN(node);
LauncherAppGlanceNotifications *notifications_glance =
app_zalloc_check(sizeof(*notifications_glance));
// Copy the name of the Notifications app as the title
const size_t title_size = sizeof(notifications_glance->title);
strncpy(notifications_glance->title, node->name, title_size... | |
t this task to a spin function and tell the app manager to kill us.
prv_return_to_landing_zone(stacked_pc, stacked_lr, stacked_args); // We can't get LR or PC, so just set to 0's.
}
// Hardware Fault Handlers
///////////////////////////////////////////////////////////
extern void fault_handler_dump(char buffer[80... | PBL_LOG_FROM_FAULT_HANDLER("") | ;
attempt_handle_generic_fault(stacked_args);
}
void UsageFault_Handler(void) {
__asm("tst lr, #4\n"
"ite eq\n"
"mrseq r0, msp\n"
"mrsne r0, psp\n"
"b %0\n" :: "i" (usagefault_handler_c));
}
|
nge_event = (EventServiceInfo) {
.type = PEBBLE_TICK_EVENT,
.handler = prv_legacy2_status_bar_handler,
};
event_service_client_subscribe(
&events_info->legacy2_status_bar_change_event);
}
// NOTE: We could be super fancy and register and unregister when the fullscreen
// status changes... | app_heap_analytics_log_stats_to_app_heartbeat(false /* is_rocky_app */) | ;
}
|
test_ble_hrm__sub_unsub(void) {
cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 0);
cl_assert_equal_i(s_sys_hrm_manager_unsubscribe_call_count, 0);
prv_assert_event_service_subscribed(false);
// Device A subscribes:
bt_driver_cb_hrm_service_update_subscription(s_device_a, true);
// Exp... | prv_assert_last_disconnected(s_device_a) | ;
}
void test_ble_hrm__revoke_all(void) {
// Device A subscribes:
bt_driver_cb_hrm_service_update_subscription(s_device_a, true);
// Expect permissions UI to be presented:
prv_assert_permissions_ui_and_respond(true /* is_granted */);
// Device B subscribes:
bt_driver_cb_hrm_service_update_subscription(s_... |
IMASK and FAULTMASK
"mov lr, 0xFFFFFFFF\n"
"mov sp, %[initial_sp]\n"
"bx %[reset_handler]\n"
: : [initial_sp] "r" (initial_stack_pointer),
[reset_handler] "r" (reset_handler)
);
__builtin_unreachable();
}
static bool prv_check_and_increment_reset_loop_detection_bits(void) {
... | (&reset_vector, &initial_sp) | |
ze) { 3 * 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_assert(line_add_word(&s_ctx, &line, &word_iter_s... | (word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 1) | |
_configured = false;
static ExtiHandlerCallback s_exti_handlers[16];
//! Convert a exti number (value 0 to 22) to one of the EXTI_LineX defines
static uint32_t prv_exti_line_to_bit(int exti_line) {
return 0x1 << exti_line;
}
static void prv_lock(void) {
if (mcu_state_are_interrupts_enabled()) {
__disable_irq... | (exti_line) | ;
const ExtiHandlerCallback cb = s_exti_handlers[exti_line];
if (cb) {
bool should_context_switch = false;
cb(&should_context_switch);
portEND_SWITCHING_ISR(should_context_switch);
}
}
static void prv_check_handle_exti(int exti_line) {
if (EXTI->PR & prv_exti_line_to_bit(exti_line)) {
prv_hand... |
re
if (uses_perimeter) {
GRangeHorizontal text_horizontal_range = {.origin_x = line_in_perimeter_space.x,
.size_w = line->max_width_px};
const GRangeVertical vertical_range = {
.origin_y = line_in_perimeter_space.y + TEXT_LINE_CAP_LINE(line),
... | {
break;
} |
// Shouldn't have rendered the line if there was insufficient space
PBL_ASSERTN(iter_next(line_iter));
}
}
////////////////////////////////////////////////////////////
// Text layout
//! @return is_success
bool line_add_word(GContext* ctx, Line* line, Word* word, const TextBoxParams* const text_box_params... |
/*
* 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 -1;
} |
dict_write_tuplet(iter, &value);
dict_write_end(iter);
int result = app_message_outbox_send();
return result;
}
static void select_click_handler(ClickRecognizerRef recognizer, void *context) {
int result;
APP_LOG(APP_LOG_LEVEL_DEBUG, "Sending messages");
for (int i=0; i<10; i++) {
APP_LOG(APP_LOG_... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_b(s_mutex_locked, true) | ;
s_mutex_locked = false;
}
static const char DEVICE_NAME[BT_DEVICE_NAME_BUFFER_SIZE] = "ABCDEFGHIJKLMNOPQRS";
static const char *PAIRING_NAME = "Blah123";
static const BTDeviceAddress DEVICE_ADDR = {.octets = {0x88, 0x99, 0xaa, 0xbb, 0x00, 0x11}};
static const SMPairingInfo PAIRING_INFO = (const SMPairingInfo) {
... |
f is semi-transparent and the right half is completely opaque
// - Dest is 100x100, white.
// Result:
// - The top half will be alternating between dithered gray and black lines
// The bottom half consists of a diagonal white line on a black background
void test_bitblt_palette_1bit__2bit_palette_to_1bit_assign... | (GColorLightGray, 0) | , 0x55555555);
cl_assert_equal_i(graphics_private_get_1bit_grayscale_pattern(GColorLightGray, 1), 0xAAAAAAAA);
cl_assert_equal_i(graphics_private_get_1bit_grayscale_pattern(GColorDarkGray, 0), 0x55555555);
cl_assert_equal_i(graphics_private_get_1bit_grayscale_pattern(GColorDarkGray, 1), 0xAAAAAAAA);
cl_assert_e... |
ity.show_notification) {
prv_push_activity_summary_notification(pin_time_utc, steps, total_steps_avg, VARIANT_RANDOM);
}
}
}
// ------------------------------------------------------------------------------------------------
static const char* prv_get_intro_str_for_activity(ActivitySession *session) {
sw... | string_list_add_string(headings, headings_buf_size,
i18n_get("Avg Pace", headings), headings_buf_size) | ;
string_list_add_string(values, values_buf_size, pace_str, values_buf_size);
}
static void prv_add_distance_metric_info(StringList *headings, int headings_buf_size,
StringList *values, int values_buf_size,
ActivitySession *session) {
... |
p_manager.h"
#include "process_management/app_run_state.h"
#include "process_management/process_manager.h"
#include "process_management/worker_manager.h"
#include "resource/resource_ids.auto.h"
#include "services/common/analytics/analytics.h"
#include "services/common/battery/battery_state.h"
#include "services/common/... | {
// Start timer for force-quitting app
bool success = new_timer_start(s_back_hold_timer, FORCE_QUIT_HOLD_MS, back_button_force_quit_handler, NULL,
0 /*flags*/);
PBL_ASSERTN(success);
} |
light_button_pressed();
} else if (e->type == PEBBLE_BUTTON_UP_EVENT) {
if (button_id == BUTTON_ID_BACK) {
launcher_cancel_force_quit();
}
light_button_released();
}
app_idle_timeout_refresh();
if (compositor_is_animating()) {
// mask the app task if we're already animating
e->t... |
ata_source__check_default_order_watchfaces(void) {
static const AppInstallId watchface_default_order[] = {APP_ID_TICTOC,
BIG_TIME_APP_ID};
app_menu_data_source_init(&data_source, &(AppMenuDataSourceCallbacks) {
.changed = prv_menu_layer_reload_data,
.... | (&data_source, i) | ;
// MENU_LAYER_APP_ID isn't in file, but it should still be in the list at the end.
if (i == (num_apps - 1)) {
cl_assert_equal_i(node->install_id, MENU_LAYER_APP_ID);
} else {
cl_assert_equal_i(node->install_id, app_order[i]);
}
}
app_menu_data_source_deinit(&data_source);
}
void tes... |
/*
* 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... | (LOG_LEVEL_DEBUG, "SELECT long clicked!") | |
/*
* 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... | {
// This board doesn't use a button common pin.
return;
} |
// Configure BUTTON_COM to drive low. When the button
// is pressed this pin will be connected to the pin for the
// button.
gpio_use(BOARD_CONFIG_BUTTON.button_com.gpio);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = BOARD_CONFIG_BUTTON.butto... |
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 in writing, soft... | if (!prv_is_scheduled(job)) {
s_scheduled_jobs = list_sorted_add(s_scheduled_jobs, &job->list_node, prv_sort, true);
} | |
ed, void *buffer,
bool resume, const Uuid* uuid) {
// validate size parameter
if (item_size == 0 || (buffered && item_size > DLS_SESSION_MAX_BUFFERED_ITEM_SIZE)
|| (!buffered && item_size > DLS_ENDPOINT_MAX_PAYLOAD)) {
PBL_LOG(LOG_LEVEL_ERROR, "invalid logging_sess... | (
&logging_session->data->buffer, &logging_session->data->buffer_client) | ;
if (bytes_pending == 0) {
break;
}
// There's still bytes in the circular buffer that haven't been persisted to flash yet. Just
// unlock and wait a little bit, since the system task should be busy writing these to flash.
dls_unlock_session(logging_session, false /*inactivate*/);
timeou... |
ION_BAR_WIDTH(platform);
}
static int prv_vertical_icon_margin(void) {
const PlatformType platform = process_manager_current_platform();
return PBL_PLATFORM_SWITCH(platform,
/*aplite*/ 24,
/*basalt*/ 24,
/*chalk*/ 53,
... | {
const int16_t animation_offset = prv_press_animation_offset();
const GPoint offset[5] = {
GPointZero,
GPoint(-animation_offset, 0),
GPoint(0, -animation_offset),
GPoint(animation_offset, 0),
GPoint(0, animation_offset),
};
return offset[action_bar->animation[button_index]];
} |
static void prv_draw_background_rect(ActionBarLayer *action_bar, GContext *ctx, GColor bg_color) {
graphics_fill_rect(ctx, &action_bar->layer.bounds);
}
void prv_draw_background_round(ActionBarLayer *action_bar, GContext *ctx, GColor bg_color) {
const uint32_t action_bar_circle_diameter = DISP_ROWS * 19 / 9;
G... |
up in 10 seconds
wakeup_id = sys_wakeup_schedule(sys_get_time() + 10, 0, false);
cl_assert_equal_i(sys_wakeup_query(wakeup_id), sys_get_time() + 10);
// Cancel wakeup event
sys_wakeup_delete(wakeup_id);
cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST);
// Schedule again
wakeup_id = sys_w... | sys_get_time() | + WAKEUP_EVENT_WINDOW;
WakeupId first_wakeup_id = sys_wakeup_schedule(first_event, 0, false);
cl_assert_equal_i(sys_wakeup_query(first_wakeup_id), first_event);
TimerID first_timer = wakeup_get_current();
// Schedule another a minute away
time_t second_event = sys_get_time() + WAKEUP_EVENT_WINDOW * 2;
Wa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.