prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
ransformNumberFromNumber(2), GTransformNumberFromNumber(5));
t_c = GTransformFromNumbers(2, 0, 0, 5, 0, 0);
cl_assert(gtransform_is_equal(&t, &t_c));
cl_assert(gtransform_is_only_scale(&t));
cl_assert(gtransform_is_only_scale(&t_c));
t_c = GTransformScaleFromNumber(2, 5);
cl_assert(gtransform_is_equal(&t,... | cl_assert(gtransform_is_equal(&t1, &t2)) | ; // ensure t1 has not changed
// Test pointer re-use
gtransform_scale(&t1, &t1, GTransformNumberFromNumber(10), GTransformNumberFromNumber(200));
cl_assert(gtransform_is_equal(&t1, &t_c));
}
void test_graphics_gtransform_${BIT_DEPTH_NAME}__translation(void) {
GTransform t_new;
GTransform t1;
GTransform t... |
// Returns the appropriate app id for the given phone number and call source
static const char *prv_get_app_id(const char *number, PhoneCallSource source) {
if (!number) {
return NULL;
}
// Select appropriate app id
switch (source) {
case PhoneCallSource_PP:
// We require the this to be a valid ... | prv_hide_action_bar() | ;
}
action_bar_layer_set_click_config_provider(&s_phone_ui_data->action_bar,
prv_click_config_provider);
}
//! Put the correct data in the 3 text fields
static void prv_display_caller_info(PebblePhoneCaller *caller) {
prv_set_caller_id_text(caller);
}
static void pr... |
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 express or ... | {
GFont font = fonts_get_system_font(chosen || selected?
FONT_KEY_GOTHIC_14_BOLD
: FONT_KEY_GOTHIC_14);
if (chosen && selected) {
// Draw rectangle behind text, invert text color
graphics_context_set_fill_color(ctx, GColorWhite);
... | |
d_pointer = (const uint8_t *)&app_message_send_job->header;
num_bytes_available = (sizeof(PebbleProtocolHeader) - offset);
}
read_pointer += offset;
*data_out = read_pointer;
return num_bytes_available;
}
static size_t prv_send_job_impl_get_length(const SessionSendQueueJob *send_job) {
return prv_get_le... | {
if (message->length < (sizeof(AppMessageAppOutboxData) + 1 /* Prohibit zero length PP msg */)) {
return AppMessageSenderErrorDataTooShort;
}
const AppMessageAppOutboxData *outbox_data = (const AppMessageAppOutboxData *)message->data;
const uint16_t endpoint_id = outbox_data->endpoint_id;
if (!prv_is_e... | |
row = (StatsRow *)row->node.next, row_idx++) {
fprintf(file, "\"%s\"", test_name);
StatsEpochType epoch_type;
if (!is_stepping) {
epoch_type = StatsEpochTypeNonStepping;
} else if (row_idx == 0 || !row->node.next) {
// We consider the first and last epoch of each sample as a "partial steppi... | {
ref_minute_stats(&orientation, &vmc);
samples_in_minute = 0;
} |
}
// leftover data, if any
if (chunk_size > 0) {
steps = ref_accel_data_handler(accel_buf, chunk_size);
}
steps = ref_finish_epoch();
ref_minute_stats(&orientation, &vmc);
PBL_LOG(LOG_LEVEL_DEBUG, "processed %d samples (%d seconds) of data: %d steps",
num_samples, num_samples / KALG_SAMPL... |
TimelineItemActionGroup *action_group;
ActionChainingMenuSelectCb select_cb;
ActionChainingMenuClosedCb closed_cb;
void *select_cb_context;
void *closed_cb_context;
} ChainingWindowData;
#if PBL_ROUND
static int16_t prv_get_header_height(struct MenuLayer *menu_layer,
uint1... | (GColorWhite, GColorBlack) | ,
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
status_bar_layer_set_title(&data->status_layer, data->title,
false /* revert */, false /* animated */);
status_bar_layer_set_separator_mode(&data->status_layer, StatusBarLayerSeparatorModeDotted);
layer_add_... |
date(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400);
PebbleEvent event = fake_event_get_last();
cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT);
cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable);
TouchEvent *touch_event = touch_event_queue_get_event(0, 0);
prv_test_touch_event(t... | GPoint(10, 10) | , 20, 5, true);
touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420);
touch_event = touch_event_queue_get_event(0, 1);
prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0,
&GPoint(13, 13), 40, 6, true);
touch_handle_update(0, Tou... |
ation(GContext *ctx, uint32_t distance_normalized, bool inner,
GPathDrawFilledCallback ring_fill_cb) {
const GRect bounds = ctx->draw_state.clip_box;
PBL_ASSERTN(bounds.origin.x == 0 && bounds.origin.y == 0);
int32_t rel_p = distance_normalized;
// calculate dynamic positio... | (sizeof(DotTransitionAnimationConfiguration) == sizeof(void *), "") | |
(manager.state, RecognizerManagerState_RecognizersActive);
cl_assert_equal_p(manager.triggered, NULL);
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[4]->state, RecognizerState_Possible);
// A touchdown occurs and the active layer goes from non-null to null. A... | cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown) | ;
cl_assert_equal_i(r2->state, RecognizerState_Possible);
cl_assert(!recognizer_get_manager(r1));
recognizer_set_manager(r1, &manager);
r1->state = RecognizerState_Possible;
r2->state = RecognizerState_Started;
manager.active_layer = &layer_a;
manager.triggered = r2;
manager.state = RecognizerManagerSt... |
window = modal_manager_get_top_window();
if (window) {
GContext ctx;
memset(&ctx, 0, sizeof(GContext));
modal_manager_render(&ctx);
}
}
void app_click_config_setup_with_window(ClickManager *click_manager, struct Window *window) {
s_last_click_configured_window = window;
}
// Helpers
////////////////... | (window_stack_count(window_stack), 1) | ;
window_stack_pop(window_stack, true);
cl_assert_equal_i(window_stack_count(window_stack), 0);
window_destroy(window);
}
void test_window_stack__basic_window_pop(void) {
Window *window1 = window_create();
Window *window2 = window_create();
// Switch to app state to push windows to the Application wind... |
IDTH / 2, SCREEN_HEIGHT / 2));
s_outline_mode = false;
s_path_angle = 0;
}
// setup and teardown
void test_graphics_gpath_${BIT_DEPTH_NAME}__initialize(void) {
fb = malloc(sizeof(FrameBuffer));
framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS});
s_house_path = gpath_create(&s_house_path_info);
s_bolt_pa... | gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled.${BIT_DEPTH_NAME}.pbi") | |
c uint32_t get_next_cursor_position(uint32_t old_address, Registry* registry) {
const uint32_t new_address =
round_up_to_nearest_subsector(old_address + registry->total_buffer_size_bytes);
const bool is_space_for_registry =
new_address + registry->total_buffer_size_bytes < registry->cursor->end;
if ... | memcmp(r->uuid, uuid, UUID_SIZE_BYTES) | == 0) &&
(memcmp(r->key, key, r->key_length) == 0)) {
return true;
}
return false;
}
static int record_get_index(const char* key, const uint8_t key_length, const uint8_t* uuid, Registry* registry) {
for (int i = 0; i < registry->num_records; i++) {
Record* r = registry->records + i;
if (r->ac... |
wing_box_x;
}
void status_bar_layer_init(StatusBarLayer *status_bar_layer) {
PBL_ASSERTN(status_bar_layer);
*status_bar_layer = (StatusBarLayer){
.previous_min_of_day = -1,
};
// The status bar needs to be as wide as the framebuffer we will render it into, which may be less
// wide than the display e.g.... | (status_bar_layer) | |
)&s_items[4].header.id, sizeof(Uuid)), 0);
// next item should be items[5], going back should skip over items[4]
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id));
cl_assert(iter_prev(&iterator));
cl_assert(!iter_prev(&iterator));
cl_assert(state.node);
... | cl_assert(timeline_iter_remove_node_with_id(&head, &multiday_item.header.id)) | ;
cl_assert(!timeline_iter_remove_node_with_id(&head, &multiday_item.header.id));
}
void test_timeline__all_day_single_day(void) {
const time_t midnight_march_3_utc = 1425340800;
TimelineItem all_day_item = {
.header = {
.id = { 0x29, 0xac, 0xd8, 0xb5, 0x09, 0xc7, 0x4c, 0x31,
0xbf, 0x6f, ... |
// Check zero termination:
cl_assert(tuple->value->cstring[strlen(SOME_STRING)] == 0);
string_found = true;
break;
case SOME_UINT8_KEY:
cl_assert(tuple->length == sizeof(uint8_t));
cl_assert(tuple->value->uint8 == 8);
uint8_found = true;
break;
... | cl_assert(new_tuple->length == sizeof(SOME_DATA)) | ;
cl_assert(old_tuple->type == TUPLE_BYTE_ARRAY);
cl_assert(old_tuple->length == sizeof(SOME_DATA));
cl_assert(memcmp(new_tuple->value->data, old_tuple->value->data, sizeof(SOME_DATA)) == 0);
break;
default:
break;
}
}
void test_dict__merge(void) {
Tuplet dest_tuplets[] = {
Tu... |
ocky_global_init(s_graphics_api);
// make this easily testable by putting it int JS context as global
Layer l = {.bounds = GRect(0, 0, 144, 168)};
const jerry_value_t ctx = prv_create_canvas_context_2d_for_layer(&l);
cl_assert_equal_b(jerry_value_is_object(ctx), true);
jerry_set_object_field(jerry_get_global... | prv_global_init_and_set_ctx() | ;
// inner radius = 0
EXECUTE_SCRIPT(
"ctx.rockyFillRadial(30, 40, 0, 20, 0, Math.PI);\n"
);
MockCallRecording *const lc = &s_graphics_fill_radial_precise_internal.last_call;
cl_assert_equal_i(1, s_graphics_fill_radial_precise_internal.call_count);
cl_assert_equal_point_precise((PP(29.5, 39.5)), lc->fil... |
/*
* 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 &s_ctx;
} |
void test_health_activity_summary_card__initialize(void) {
// Setup graphics context
framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS});
framebuffer_clear(&s_fb);
graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App);
s_app_state_get_graphics_context = &s_ctx;
// Setup resources
fa... |
/*
* 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... | date_util_get_max_days_in_month(month + 1, is_leap_year) | ;
return MIN(day, max_days);
}
int date_time_selection_step_year(int year, int delta) {
year += delta;
return CLIP(year, MIN_SELECTABLE_YEAR - STDTIME_YEAR_OFFSET,
MAX_SELECTABLE_YEAR - STDTIME_YEAR_OFFSET);
}
char *date_time_selection_get_text(TimeData *data, TimeInputIndex index, char *buf) {
switch (... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_LOG(LOG_LEVEL_ERROR, "Meta protocol error: 0x%x (endpoint=%u)",
meta_response_info->payload.error_code, meta_response_info->payload.endpoint_id) | ;
MetaResponseInfo *meta_response_info_heap_copy = kernel_zalloc_check(sizeof(*meta_response_info));
memcpy(meta_response_info_heap_copy, meta_response_info, sizeof(*meta_response_info));
system_task_add_callback(prv_send_meta_response_kernelbg_cb, meta_response_info_heap_copy);
}
void meta_protocol_msg_callbac... |
;
glyph_block_bits_left -= left_clip_shift;
glyph_block += clipped_blocks;
if (glyph_block_bits_left <= 0) {
src = *(++glyph_block);
glyph_block_bits_left += 32;
// Need to account for the dest_shift when loading up the new glyph block
rotl32(src, glyph_block_bits_lef... |
glyph_block += jump_words;
src = *glyph_block;
rotl32(src, src_rotated);
glyph_block_bits_left += 32 * jump_words;
}
glyph_block_bits_left -= right_clip;
// Rotate the bits into the right position for the next row:
dest_shift = dest_shift_at_line_begin - dest_shift;
rotl32... | }
void text_render_set_special_codepoint_cb(SpecialCodepointHandlerCb handler, void *context) {
TextRenderState *state = app_state_get_text_render_state();
state->special_codepoint_handler_cb = handler;
state->special_codepoint_handler_context = context;
}
|
c = s_content_indicator_dummy_layer_update_proc;
cl_assert(content_indicator_configure_direction(&content_indicator,
ContentIndicatorDirectionUp,
&dummy_config));
// Using the same dummy configuration (which has the... | (
&scroll_layer) | |
d);
EXECUTE_SCRIPT(
"ctx.rockyFillRadial(30, 40, 10, 30, 0, 2 * Math.PI);\n"
);
cl_assert_equal_i(2, s_graphics_fill_radial_precise_internal.call_count);
cl_assert_equal_point_precise(PP(29.5, 39.5), lc->fill_radial_precise.center);
cl_assert_equal_i(10*8, lc->fill_radial_precise.radius_inner.raw_value)... | (
"ctx.lineWidth = -1;",
"TypeError: Argument at index 0 is invalid: Value out of bounds for native type"
) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_LOG(LOG_LEVEL_DEBUG, "Removed pairing for "BT_DEVICE_ADDRESS_FMT,
BT_DEVICE_ADDRESS_XPLODE(info->identity.address)) | ;
}
void bonding_sync_handle_pairing_completed(Connection *connection, uint16_t conn_idx) {
BleBonding bonding = {};
SMPairingInfo *info = &bonding.pairing_info;
bool success = false;
storage_acquire();
device_t *dev = find_device_by_conn_idx(conn_idx);
if (dev && dev->bonded) {
// The LTK that's used... |
len);
cl_assert(fd >= 0);
cl_assert(pfs_write(fd, (uint8_t *)buf_small, len) == len);
cl_assert(pfs_close(fd) == S_SUCCESS);
// delete every few files and a bunch of pages near the end
if (((i & 0x1) == 0) ||
((i > ((num_pages() * 7) / 10)) && (i < ((num_pages() * 8) / 10)))) {
cl_asse... | pfs_seek(fd, 0, FSeekCur) | |
rn false;
}
static bool prv_prf_button_combination_is_pressed(void) {
return (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK)
&& button_is_pressed(BUTTON_ID_SELECT) && !button_is_pressed(BUTTON_ID_DOWN));
}
static bool check_force_boot_recovery(void) {
if (boot_bit_test(BOOT_BIT_FORCE_P... | (0x89abcdef) | ;
delay_us(200000);
display_error_code(0xcafebabe);
delay_us(200000);
display_error_code(0xfeedface);
delay_us(200000);
display_error_code(0x8badf00d);
delay_us(200000);
display_error_code(0xbad1ce40);
delay_us(200000);
display_error_code(0xbeefcace);
delay_us(200000);
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... | {
return NULL;
} |
}
void kino_layer_set_reel(KinoLayer *kino_layer, KinoReel *reel, bool take_ownership) {
kino_player_set_reel(&kino_layer->player, reel, take_ownership);
}
void kino_layer_set_reel_with_resource(KinoLayer *kino_layer, uint32_t resource_id) {
kino_player_set_reel_with_resource(&kino_layer->player, resource_id);
}... |
&jan_2_10015__13_00_00);
cl_assert_equal_s(tmbuf, "100 Jan");
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%02D %04e", &jan_2_10015__13_00_00);
cl_assert_equal_s(tmbuf, "01/02/15 0002");
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%05n %03r", &jan_2_10015__13_00_00);
cl_assert_equal_s(tmbuf, "... | (tmbuf, "Fri Friday Jan January") | ;
tmbuf[0] = '\0';
localized_strftime(tmbuf, sizeof(tmbuf), "%c", &jan_2_2015__13_00_00, i18n_get_locale());
cl_assert_equal_s(tmbuf, "Fri Jan 2 13:00:00 2015");
s_i18n_translate = false;
s_i18n_locale_other = true;
tmbuf[0] = '\0';
localized_strftime(tmbuf, sizeof(tmbuf), "%a %A %b %B", &jan_2_2015__13... |
r INT
// to fire and could get stuck in an infinite loop if it never fires
//
// NB: this function is used only by the bootloader.
static volatile int s_int_fired;
void dialog_spi_wait_for_int(void) {
while (s_int_fired == 0) {
delay_us(1000);
}
__disable_irq();
s_int_fired--;
__enable_irq();
}
// NB: t... | {
PBL_ASSERTN(tx_buffer || rx_buffer);
// FIXME: PBL-32864: Ugh, can't do this from ISR
// periph_config_acquire_lock();
s_dma_transfer_complete_cb = done_isr_callback;
prv_enable_spi_clock();
// Client code is supposed to ensure no transfer gets set up,
// while the previous one is still on-going:
PB... |
void dialog_spi_start_cmd(void) {
prv_enable_spi_clock();
dialog_spi_assert_chip_select(true);
}
void dialog_spi_end_cmd(void) {
dialog_spi_assert_chip_select(false);
prv_disable_spi_clock();
}
uint8_t dialog_spi_send_and_receive_byte(uint8_t byte) {
return spi_ll_slave_read_write(DIALOG_SPI, byte);
}
vo... |
es/common/comm_session/session_send_queue.h"
#include "services/common/comm_session/protocol.h"
#include "util/net.h"
#include "util/size.h"
#include "FreeRTOS.h"
#include "semphr.h"
#include "clar.h"
extern SendBuffer * comm_session_send_buffer_create(bool is_system);
extern void comm_session_send_buffer_destroy(S... | (write_sb, fake_data, max_length) | |
x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4,
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4,
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4,
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x7... | (s_insert_cmd_zero_value_size, sizeof(s_insert_cmd_zero_value_size)) | ;
// Check Response
cl_assert(0 < *(uint16_t*)resp_ptr);
resp_ptr += sizeof(uint16_t);
cl_assert(BLOB_DB_INVALID_DATA == *resp_ptr);
resp_ptr += sizeof(uint8_t);
cl_assert((resp_ptr - s_data) == s_sending_data_length);
}
/**************************************************
* Checking for below minimum s... |
GTextAttributes *text_attributes) {
record_mock_call(s_graphics_draw_text){
.draw_text.box = box,
.draw_text.color = ctx->draw_state.text_color,
};
strncpy(s_graphics_draw_text.last_call.draw_text.text,
text, sizeof(s_graphics_draw_text.last_call.draw_text.text));
}
static MockCallRecordi... | (s_graphics_api) | |
/*
* 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... | {
mutex_lock_recursive(s_watch_app_prefs_db.mutex);
status_t rv = settings_file_open(&s_watch_app_prefs_db.settings_file,
SETTINGS_FILE_NAME,
SETTINGS_FILE_SIZE);
if (rv != S_SUCCESS) {
mutex_unlock_recursive(s_watch_app_prefs_db.mutex);
... |
static void prv_close_file_and_unlock_mutex(void) {
settings_file_close(&s_watch_app_prefs_db.settings_file);
mutex_unlock_recursive(s_watch_app_prefs_db.mutex);
}
// WatchAppPrefDB API
////////////////////////////////////////////////////////////////////////////////
static void *prv_get_prefs(const char *pref_k... |
time_end_text), "%F %r", local_tm);
if (num_minutes > 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Got %d minutes in %"PRIu32" ms: %s to %s", num_minutes,
(uint32_t) elapsed_ms, time_start_text, time_end_text);
} else {
APP_LOG(APP_LOG_LEVEL_DEBUG, "No data available in last %d minutes", k_print_batch_s... | {
HealthAPITestAppData *data = context;
prv_intraday_metric_avg(data, HealthMetricStepCount, "Steps:");
} |
// -----------------------------------------------------------------------------------------
static void prv_debug_cmd_daily_active_seconds_avg(int index, void *context) {
HealthAPITestAppData *data = context;
prv_daily_metric_avg(data, HealthMetricActiveSeconds, "Active seconds:");
}
// ----------------------... |
PeekMenuIndexEnabledCount :
TimelinePeekMenuIndexDisabledCount;
}
static void prv_draw_row_cb(SettingsCallbacks *context, GContext *ctx,
const Layer *cell_layer, uint16_t row, bool selected) {
SettingsTimelinePeekData *data = (SettingsTimelineP... | {
return prv_create_settings_window();
} |
}
const SettingsModuleMetadata *settings_timeline_get_info(void) {
static const SettingsModuleMetadata s_module_info = {
.name = i18n_noop("Timeline"),
.init = prv_init,
};
return &s_module_info;
}
#endif // CAPABILITY_HAS_TIMELINE_PEEK
|
fake_transport_assert_sent(s_transport, 0 /* index */, meta_endpoint_id, data, length) | ;
}
// Tests
///////////////////////////////////////////////////////////
void test_meta_endpoint__initialize(void) {
fake_kernel_malloc_init();
fake_kernel_malloc_mark();
fake_comm_session_init();
s_transport = fake_transport_create(TransportDestinationSystem, NULL, NULL);
s_session = fake_transport_set_co... | |
can be called from any task, so we must
// invoke system callbacks to handle its KernelBG callback.
activity_start_tracking(false /*test_mode*/);
fake_system_task_callbacks_invoke_pending();
// No sessions active, ensure that asking if a sleep session is ongoing returns false
cl_assert_equal_b(false, activit... | activity_sessions_is_session_type_ongoing(ActivitySessionType_Run) | );
cl_assert_equal_b(true, activity_sessions_is_session_type_ongoing(ActivitySessionType_Walk));
cl_assert_equal_b(true, activity_sessions_is_session_type_ongoing(ActivitySessionType_Sleep));
cl_assert_equal_i(HealthActivityRun | HealthActivityWalk | HealthActivitySleep , health_service_peek_current_activities())... |
on_delay_timer);
}
s_just_connected = true;
const int post_connection_notification_ignore_seconds = 10;
s_notification_connection_delay_timer = (const RegularTimerInfo) {
.cb = prv_set_no_longer_just_connected,
};
regular_timer_add_multisecond_callback(&s_notification_connection_delay_timer,
... | prv_reset_due_to_parse_error() | ;
return;
}
}
const uint8_t *response_data = s_ancs_client->reassembly_ctx.buffer.data;
int response_length = s_ancs_client->reassembly_ctx.buffer.bytes_written;
// Is the response complete? Or do we need to wait for more DS notifications?
bool parse_error = false;
const bool is_complete = prv_... |
teners");
JS_VAR event_listeners = jerry_get_object_field(all_listeners, event_name);
// printf("event_listeners.refcount: %d", jerry_port_)
const uint32_t len = jerry_get_array_length(event_listeners);
for (uint32_t idx = 0; idx < len; idx++) {
JS_VAR listener = jerry_get_property_by_index(event_listeners,... | jerry_create_undefined() | ;
}
JERRY_FUNCTION(prv_add_event_listener) {
char event_name[32];
jerry_value_t func; // out parameter &func will not be acquired
JS_VAR arg_result = prv_event_listener_extract_args(argc, argv,
event_name, sizeof(event_name),
... |
+= excess_length;
}
}
static void prv_will_draw_container(GTextNodeDrawContext *ctx) {
GTextNodeContainer *container = (GTextNodeContainer *)ctx->node;
prv_set_size(&ctx->box.size, &container->size);
if (ctx->render) {
prv_align_axis(ctx);
}
}
static void prv_did_draw_container(GTextNodeDrawContext *ct... | prv_base(node) | ->destructor(node);
}
}
bool graphics_text_node_container_add_child(GTextNodeContainer *parent, GTextNode *child) {
if (!parent) {
return false;
}
return prv_container(&parent->node)->add_child(parent, child);
}
static void NOINLINE prv_init_draw_context(GTextNodeDrawContext *ctx, GTextNode *node,
... |
t
to_r = GRect(1000, 2000, 100, 200); // x, y, width, height
prop_h = property_animation_create_layer_frame(&layer, &from_r, &to_r);
Animation *h = property_animation_get_animation(prop_h);
void *context = &layer;
animation_set_handlers(h, handlers, context);
animation_set_duration(h, duration);
prv_clea... | animation_schedule(h) | ;
int max_loops = 20;
uint64_t start_ms = prv_now_ms();
bool detected_reset_of_elapsed = false;
bool reached_end_elapsed = false;
uint64_t time_ms;
while (s_stopped_handler_calls.num_calls < 2) {
prv_fire_animation_timer();
time_ms = prv_now_ms();
DPRINTF("rescheduled count: %d\n", s_stopped_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... | EXECUTE_SCRIPT_AND_ASSERT_RV_EQUALS_S("pileOfPooUTF8.length.toString()", "2") | ;
}
void test_rocky_text_encoding__jerry_cesu8_to_utf8_conversion(void) {
struct {
const char *const script;
size_t expected_utf_size;
const char *const expected_utf_data;
} cases[] = {
[0] = {
.script = "var str = '\\uDCA9';", // low surrogate only
.expected_utf_size = 0,
},
[1... |
04},
{ -136, 400, -944},
{ -304, 264, -872},
// 190 seconds
{ -112, 472, -928},
{ -296, 328, -888},
{ -168, 408, -872},
{ -216, 384, -992},
{ -216, 488, -944},
{ -184, 448, -984},
{ -288, 512, -904},
{ -248, 392, -832},
{ -328, 520, -984},
{ -192, 424, -872},
{ -2... | { -272, 432, -848},
{ -256, 400, -968},
{ -224, 368, -960},
{ -208, 456, -952},
{ -248, 496, -968},
{ -296, 464, -880},
{ -248, 464, -1000},
{ -272, 400, -936},
{ -168, 480, -1064},
{ -232, 448, -928},
{ -184, 440, -920},
{ -208, 296, -824},
{ -160, 504, -1128},
{... |
{ -336, 440, -1000},
{ -160, 424, -728},
{ -320, 496, -960},
{ -192, 504, -912},
{ -280, 320, -840},
{ -200, 504, -1016},
// 198 seconds
{ -176, 392, -760},
{ -256, 384, -1064},
{ -192, 456, -920},
{ -304, 544, -928},
{ -216, 456, -840},
{ -256, 456, -968},
{ -22... |
|| (iter > (data + length - VALUE_DATA_LENGTH))) {
prv_send_response(session, token, BLOB_DB_INVALID_DATA);
return;
}
// read value length and value bytes ptr
uint16_t value_size;
const uint8_t *value_bytes = NULL;
iter = prv_read_value_size(iter, data + length, &value_size);
iter = prv_read_ptr(i... | prv_send_response(session, 0, BLOB_DB_INVALID_DATA) | ;
return;
}
const BlobDBCommand cmd = *data;
data += sizeof(BlobDBCommand); // fwd to message contents
const size_t data_length = length - sizeof(BlobDBCommand);
if (!s_bdb_accepting_messages) {
prv_send_response(session, prv_try_read_token(data, length), BLOB_DB_TRY_LATER);
return;
}
prv_b... |
BTErrnoInvalidParameter);
}
void test_gap_le_connect__register_non_existing_bonding(void) {
BTErrno e = gap_le_connect_connect_by_bonding(~0,
true /* auto_reconnect */,
false /* is_pairing_required */,
... | cl_assert_equal_i(e, BTErrnoOK) | ;
// Assert registrations:
registered = gap_le_connect_has_connection_intent(&device, GAPLEClientApp);
cl_assert_equal_b(registered, true);
registered = gap_le_connect_has_connection_intent(&device, GAPLEClientKernel);
cl_assert_equal_b(registered, true);
// Only one registration (co-owned by the 2 client... |
},
.action_group = {
.num_actions = 0,
.actions = NULL,
},
.allocated_buffer = NULL,
}, {
.header = {
.id = {0x02},
.parent_id = {0},
.timestamp = 1421107200, // Tue Jan 13 midnight 2015 UTC
.duration = MINUTES_PER_DAY,
.type = TimelineItemTy... | (uuid_equal(&state.pin.header.id, &s_items[3].header.id)) | ;
cl_assert(state.node);
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id));
}
void test_timeline__forward_and_back(void) {
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
// Note: 1421178000 = Tue Jan 13 11:40:00 PST 20... |
{
i2c->SR1 &= ~I2C_SR1_BERR;
// Bus error: invalid start or stop condition detected
I2C_DEBUG("Bus error detected during I2C transaction; Bus: %s", bus->name);
} |
if ((i2c->SR1 & I2C_SR1_AF) != 0) {
i2c->SR1 &= ~I2C_SR1_AF;
// NACK received.
//
// The MFI chip will cause NACK errors during read operations after writing a start bit (first
// start or repeat start indicating that it is busy. The transfer must be paused and the start
// condition sent ag... | |
// For now make the active gateway the most recently added BT Classic pairing
if (op == BtPersistBondingOpDidAdd) {
bt_persistent_storage_set_active_gateway(key);
}
prv_call_bt_classic_bonding_change_handlers(key, op);
}
return key;
}
void bt_persistent_storage_delete_bt_classic_pairing_by_i... | prv_file_each(bt_persistent_storage_bt_classic_pairing_for_each_itr, &itr_data) | |
/*
* 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_handle_set_discoverable_pairable(cmd_data) | ;
break;
}
default:
PBL_LOG(LOG_LEVEL_DEBUG, "Unknown opcode %u", opcode);
break;
}
}
|
nt8_t rx_index = 0;
uint8_t tx_index = 0;
uint8_t buffer[sizeof(core_dump_connect_ping)];
uint16_t tx_start_ticks;
bool rx_mode;
printf("Waiting for host:\n");
for (int count = 10; count > 0; --count) {
printf(".");
// Feed the watchdog
hw_watchdog_set_pos_val(0xFF);
// Configure for RX m... | printf("\nHost connected\n") | ;
while (true) {
// Feed the watchdog
hw_watchdog_set_pos_val(0xFF);
prv_get_cmd((uint8_t *)&cmd, sizeof(cmd));
if (crc32(CRC32_INIT, &cmd, sizeof(cmd)) != CRC32_RESIDUE) {
printf("cmd CRC failed");
prv_low_power_mode();
}
// Feed the watchdog
hw_watchdog_set_pos_val(0xFF);
... |
overning permissions and
* limitations under the License.
*/
#include "weather_db.h"
#include "kernel/pbl_malloc.h"
#include "os/mutex.h"
#include "services/normal/filesystem/pfs.h"
#include "services/normal/settings/settings_file.h"
#include "services/normal/weather/weather_service.h"
#include "services/normal/wea... | (key_len == sizeof(WeatherDBKey)) | ;
int entry_len = settings_file_get_len(&s_weather_db.settings_file, key, key_len);
prv_close_file_and_unlock_mutex();
return entry_len;
}
status_t weather_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_out_len) {
status_t rv = prv_lock_mutex_and_open_file();
if (rv != S_SUCCESS) {
... |
60, 608, -720},
{ -360, 608, -720},
{ -352, 616, -712},
{ -360, 608, -720},
{ -352, 616, -720},
{ -360, 616, -712},
{ -360, 616, -712},
{ -360, 608, -720},
{ -360, 608, -712},
{ -360, 608, -712},
{ -360, 616, -712},
{ -360, 608, -720},
{ -360, 608, -720},
{ -344, 616,... | { -392, 616, -680},
{ -384, 624, -688},
{ -392, 632, -680},
{ -392, 632, -688},
{ -392, 632, -680},
{ -392, 632, -672},
{ -384, 632, -672},
{ -392, 632, -680},
{ -392, 624, -680},
{ -392, 632, -688},
{ -392, 616, -680},
{ -392, 632, -680},
{ -392, 632, -680},
{ -3... |
{ -392, 640, -664},
// 46 seconds
{ -392, 640, -672},
{ -400, 632, -664},
{ -400, 640, -664},
{ -400, 640, -664},
{ -392, 632, -664},
{ -400, 640, -672},
{ -400, 640, -664},
{ -400, 632, -672},
{ -392, 632, -672},
{ -392, 640, -664},
{ -400, 632, -664},
{ -400, 6... |
ext: "This is a test notification. Look at it and behold the awesome."
0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x6e,
0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x20, 0x4c, 0x6f, 0x6f,
0x6b, 0x20, 0x61, 0x74, 0x20, 0x69, 0x74, 0x20, ... | (item->attr_list.attributes[2].cstring, "This is a test notification. "
"Look at it and behold the awesome.") | |
stributed 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 "reminder_db.h"
#include "sync.h"
#include "sync_util.h"
#include "timeline_item_storage.h"
#... | {
timeline_item_free_allocated_buffer(reminder);
return true; // continue iteration
} |
reminder_info->match = true;
return false; // stop iteration
}
bool reminder_db_find_by_timestamp_title(time_t timestamp, const char *title,
TimelineItemStorageFilterCallback filter_cb,
TimelineItem *reminder_out) {
PBL_ASSERTN(r... |
// -------------------------------------------------------------------------------------------
Animation *animation_spawn_create_from_array(Animation **animation_array, uint32_t array_len) {
PBL_ASSERTN(!animation_private_using_legacy_2(NULL));
Animation *spawn = prv_complex_create(animation_array, array_len, An... | {
char buffer[128];
dbgserial_putstr_fmt(buffer, sizeof(buffer), "Now: %"PRIu32, prv_get_ms_since_system_start());
dbgserial_putstr_fmt(buffer, sizeof(buffer), "Kernel Animations:");
prv_dump_scheduler(buffer, sizeof(buffer), kernel_applib_get_animation_state());
dbgserial_putstr_fmt(buffer, sizeof(buffer),... |
// -------------------------------------------------------------------------------------------
void command_pause_animations(void) {
animation_private_pause();
}
// -------------------------------------------------------------------------------------------
void command_resume_animations(void) {
animation_priva... |
BASE_FULL;
case E_INVALID_OPERATION:
return BLOB_DB_DATA_STALE;
default:
PBL_LOG(LOG_LEVEL_WARNING, "BlobDB return value caught by default case");
return BLOB_DB_GENERAL_FAILURE;
}
}
static const uint8_t *prv_read_ptr(const uint8_t *iter, const uint8_t *iter_end,
... | if (length < MIN_CLEAR_LENGTH) {
prv_send_response(session, prv_try_read_token(data, length), BLOB_DB_INVALID_DATA);
return;
} |
BlobDBToken token;
BlobDBId db_id;
// Read token and db_id
endpoint_private_read_token_db_id(data, &token, &db_id);
// perform action on database and return result
status_t ret = blob_db_flush(db_id);
prv_send_response(session, token, prv_interpret_db_ret_val(ret));
// Mark the device as faithful a... |
fg_info_get_serialnumber(versions_msg.serial_number, sizeof(versions_msg.serial_number));
strncpy(versions_msg.iso_locale, i18n_get_locale(), ISO_LOCALE_LENGTH - 1);
versions_msg.iso_locale[ISO_LOCALE_LENGTH - 1] = '\0';
versions_msg.lang_version = htons(i18n_get_version());
PBL_LOG(LOG_LEVEL_DEBUG, "Sending l... | (build_id_string, sizeof(build_id_string)) | ;
prompt_send_response_fmt(buffer, sizeof(buffer), "Build Id:%s", build_id_string);
char serial_number[MFG_SERIAL_NUMBER_SIZE + 1];
mfg_info_get_serialnumber(serial_number, sizeof(serial_number));
char hw_version[MFG_HW_VERSION_SIZE + 1];
mfg_info_get_hw_version(hw_version, sizeof(hw_version));
const uin... |
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
// Stubs
///////////////////////////////////////////////////////////
#include "stubs_logging.h"
#include "stubs_passert.h"
// Tests
///////////////////////////////////////////////////////////
void test_utf8__decode_test_string_valid(voi... | (copied, 0) | ;
cl_assert_equal_s((char *)dest, "");
}
void test_utf8__invalid_character(void) {
utf8_t dest[5];
memset(dest, 0, 5);
size_t copied = utf8_copy_character(dest, (utf8_t *)"\xf0hi", 5);
cl_assert_equal_i(copied, 0);
cl_assert_equal_s((char *)dest, "");
}
void test_utf8__get_size_truncate(void) {
cl_ass... |
GEdgeInsets(0, 5, 0, text_left_margin));
const GFont title_font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle);
const GFont subtitle_font = system_theme_get_font_for_default_size(TextStyleFont_Caption);
menu_cell_basic_draw_custom(ctx, cell_layer, title_font, title, NUL... | {
// as measured from the design specs
const int horizontal_inset = MENU_CELL_ROUND_UNFOCUSED_HORIZONTAL_INSET;
const int top_inset = 2;
GRect frame = cell_layer->bounds;
// manually inset the frame to save stack space, instead of using grect_inset
frame.origin.x += horizontal_inset;
frame.size.w -= horiz... |
static void prv_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index,
void *data) {
NotificationsData *notifications_data = data;
if ((notifications_data->notification_list) && (cell_index->row == 0)) {
// Clear All button selected
prv_settings_clear_history_windo... |
array(Animation **animation_array,
uint32_t array_len) {
return prv_create_from_array(animation_array, array_len);
}
typedef void (*AnimationEachCallback)(AnimationPrivate *animation, uintptr_t context);
static void prv_each(AnimationPrivate *animation, AnimationEac... | animation->implementation->teardown((Animation *)animation) | |
r) {
*md = (PebbleProcessMdFlash){};
prv_init_from_info_common(&md->common, info, task, ProcessStorageFlash);
// Flash app specific fields
strncpy(md->name, info->name, sizeof(md->name));
md->name[sizeof(md->name) - 1] = 0;
md->size_bytes = info->virtual_size;
md->process_version = info->process_versi... | if (version_compare(app_sdk_version, first_4_2_version) < 0) {
return PBL_PLATFORM_SWITCH(PBL_PLATFORM_TYPE_CURRENT,
/* aplite */ PlatformTypeAplite, // unreachable, since we don't build for Tintin anymore
/* basalt */ PlatformTypeBasalt,
/* chalk */ PlatformTypeChalk,
/* diorite... |
// 4.2 <= SDK --> the flags should be filled correctly.
const uint32_t stored_value = md->stored_sdk_platform;
switch (stored_value) {
case PROCESS_INFO_PLATFORM_APLITE:
return PlatformTypeAplite;
case PROCESS_INFO_PLATFORM_BASALT:
return PlatformTypeBasalt;
case PROCESS_INFO_PLATFORM_CH... |
/*
* 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... | comm_session_send_buffer_get_max_payload_length(&s_session) | ;
SendBuffer *write_sb = comm_session_send_buffer_begin_write(&s_session, ENDPOINT_ID,
max_length + 1,
TIMEOUT_MS);
cl_assert_equal_p(write_sb, NULL);
}
TickType_t prv_session_closed_yield_cb... |
BLTEST_LOG("BOOTLOADER TEST STAGE 1") | ;
boot_bit_set(BOOT_BIT_FW_STABLE);
BLTEST_LOG("STAGE 1 -- Setting test boot bits");
boot_bit_clear(BOOT_BIT_BOOTLOADER_TEST_A | BOOT_BIT_BOOTLOADER_TEST_B);
boot_bit_set(BOOT_BIT_BOOTLOADER_TEST_A);
bool as_fw = true;
if (strcmp(dest_type, "prf") == 0) {
as_fw = false;
}
if (as_fw) {
BLTEST_L... | |
ActivitySessionType_Nap);
attribute_list_add_uint32(&pin_attr_list, AttributeIdTimestamp, session->start_utc);
attribute_list_add_cstring(&pin_attr_list, AttributeIdShortTitle,
i18n_get("Nap Time", &pin_attr_list));
// Fits the maximum strings "10H 30M of... | {
const int hours = session->length_min / MINUTES_PER_HOUR;
const int minutes = session->length_min % MINUTES_PER_HOUR;
// Enough to fit the filled out format string below and i18n variants
const int max_notif_length = 128;
char *body = kernel_malloc_check(max_notif_length);
snprintf(body, max_notif_length... |
// -----------------------------------------------------------------------------------------
static void prv_push_nap_session(time_t now_utc, ActivitySession *session) {
Uuid pin_uuid = UUID_INVALID;
TimelineItem *pin_item = prv_create_nap_pin(now_utc, session);
if (prv_push_pin(pin_item, &pin_uuid) &&
a... |
<= 1) {
strncpy(buf_out, "transparent", COLOR_BUFFER_LENGTH);
} else {
snprintf(buf_out, COLOR_BUFFER_LENGTH, "#%02X%02X%02X",
color.r * 85, color.g * 85, color.b * 85);
}
}
static jerry_value_t prv_graphics_get_color_string(GColor8 color) {
char buf[COLOR_BUFFER_LENGTH];
prv_graphics_col... | rocky_add_function(ctx_prototype, ROCKY_CONTEXT2D_SAVE, prv_save) | ;
rocky_add_function(ctx_prototype, ROCKY_CONTEXT2D_RESTORE, prv_restore);
rocky_define_property(ctx_prototype, ROCKY_CONTEXT2D_LINEWIDTH,
prv_get_stroke_width, prv_set_stroke_width);
rocky_define_property(ctx_prototype, ROCKY_CONTEXT2D_STROKESTYLE,
prv_get_stroke_s... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(e.type, PEBBLE_PHONE_EVENT) | |
/*
* 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... | (option_menu, ctx, cell_layer, cell_frame, title, selected, context) | ;
}
OptionMenu *settings_option_menu_create(
const char *i18n_title_key, OptionMenuContentType content_type, int choice,
const OptionMenuCallbacks *callbacks_ref, uint16_t num_rows, bool icons_enabled,
const char **rows, void *context) {
OptionMenu *option_menu = option_menu_create();
if (!option_menu)... |
rize.c */
static int clar_category_is_suite_enabled(const struct clar_suite *);
static void clar_category_enable(const char *category);
static void clar_category_enable_all(size_t, const struct clar_suite *);
static void clar_category_print_enabled(const char *prefix);
/* Event callback overrides */
${clar_event_overr... | clar_usage(argv[0]) | ;
else if (is_num) {
if ((size_t)num >= _clar_suite_count) {
clar_print_onabort("Suite number %d does not exist.\n", num);
exit(-1);
}
clar_run_suite(&_clar_suites[num]);
}
else if (!has_colon || argument[-1] == ':') {
for (j = 0; j < (int)_clar_suit... |
comm_session_send_queue_get_length(const CommSession *session) {
return 0;
}
void dls_private_handle_disconnect(void *data) {
}
void session_remote_version_start_requests(CommSession *session) {
}
void bt_persistent_storage_set_cached_system_capabilities(
const PebbleProtocolCapabilities *capabilities) {
}
//... | (s_write_length + length < sizeof(s_write_buffer)) | |
528, -824},
{ -248, 520, -832},
{ -248, 520, -840},
{ -264, 512, -832},
{ -256, 512, -832},
{ -256, 520, -824},
{ -248, 520, -832},
{ -256, 520, -824},
{ -256, 512, -832},
{ -256, 528, -832},
{ -256, 512, -840},
{ -248, 520, -832},
{ -256, 520, -832},
{ -248, 512, -8... | { -360, 608, -728},
{ -352, 600, -728},
{ -352, 608, -720},
{ -360, 616, -720},
{ -352, 600, -720},
{ -352, 608, -720},
{ -360, 616, -720},
{ -352, 608, -720},
{ -360, 608, -712},
// 36 seconds
{ -352, 608, -720},
{ -360, 600, -720},
{ -360, 608, -720},
{ -352, 61... |
{ -360, 616, -712},
{ -360, 616, -712},
{ -360, 608, -720},
{ -360, 608, -712},
{ -360, 608, -712},
{ -360, 616, -712},
{ -360, 608, -720},
{ -360, 608, -720},
{ -344, 616, -712},
{ -328, 576, -720},
{ -384, 608, -712},
{ -360, 616, -720},
{ -368, 584, -720},
{ -... |
cs_draw_line(ctx, p0, p1);
graphics_draw_line(ctx, p2, p3);
return;
}
if (data->operation == OP_TEST3) {
int x1 = 50,
x2 = 100,
y1 = 40,
y2 = 120;
GPoint p0 = GPoint(x1, y1);
GPoint p1 = GPoint(x1, y2);
GPoint p2 = GPoint(x2, y2);
GPoint p3 = GPoint(x2, y1);
// graphi... | (data->rotation_angle) | * line_length / TRIG_MAX_RATIO) + x1;
y2 = (-cos_lookup(data->rotation_angle) * line_length / TRIG_MAX_RATIO) + y1;
} else {
x1 = data->p1.x;
y1 = data->p1.y;
x2 = data->p2.x;
y2 = data->p2.y;
}
graphics_context_set_antialiased(ctx, true);
graphics_context_set_stroke_width(ctx, data->strok... |
{ 0, 0x8c, 0, 202},
{ 0, 0x8c, 0, 203},
{ 0, 0x8c, 0, 203},
{ 0, 0x8c, 0, 204},
{ 0, 0x8c, 0, 206},
{ 0, 0x8c, 0, 206},
{ 0, 0x8c, 0, 206},
{ 0, 0x8c, 0, 206},
{ 0, 0x8c, 0, 206},
{ 0, 0x8c, 0, 207},
{ 0, 0x8c, 0, 208},
{ 0, 0x8c, 0, 206},
// 75: Local time: 12:21:00 PM... | { 0, 0x8c, 0, 202},
{ 0, 0x8c, 0, 202},
{ 0, 0x8c, 0, 202},
{ 0, 0x8c, 0, 203},
{ 0, 0x8c, 0, 204},
{ 0, 0x8c, 0, 204},
{ 0, 0x7c, 195, 205},
{ 0, 0x7c, 0, 206},
{ 0, 0x7c, 0, 206},
{ 0, 0x7c, 0, 206},
{ 0, 0x7c, 0, 206},
{ 0, 0x7c, 0, 207},
{ 0, 0x7c, 0, 207},
{ ... |
// ----------------------------------------------------------------
// Sample captured at: 2015-09-16 20:02:00 local, 2015-09-17 03:02:00 GMT
// According to Fitbit:
// sleep entry 9:06pn (offset 65)
// sleep exit 6:03am (offset 602)
// Fitbit was wrong here, the real wake time is closer to 4:50am (offset 5... |
space is needed in the allocation of the PLogSession (useful for storing extra data).
static size_t prv_session_extra_space_needed(const ProtobufLogConfig *config) {
switch (config->type) {
case ProtobufLogType_Measurements:
return (config->measurements.num_types * sizeof(ProtobufLogMeasurementType));
... | ("Creating payload session with hdr size of %"PRIu32, payload_hdr_size) | ;
// Create a buffer for the encoded data blob. We form this first as the caller calls
// protobuf_log_session_add_* repeatedly. Once it's filled up, we grab it as the
// data blob portion of the payload that's formed in msg_buffer.
uint32_t max_data_size = max_msg_size - payload_hdr_size - sizeof(PLogMessageH... |
MAX(last_fire_a,
prv_last_handler_entry(&s_stopped_handler_calls, a0)->fire_order) | ;
last_fire_a = MAX(last_fire_a,
prv_last_handler_entry(&s_stopped_handler_calls, a1)->fire_order);
last_fire_a = MAX(last_fire_a,
prv_last_handler_entry(&s_stopped_handler_calls, a2)->fire_order);
last_fire_a = MAX(last_fire_a,
prv_last_handler_entry(&s... | |
e still have any notifications to display. If not, pop!
NotificationWindowData *data = window_get_user_data(window);
if (notifications_presented_list_current_idx() < 0) {
prv_pop_notification_window_after_delay(data, 0);
return;
}
prv_setup_reminder_watchdog(data);
prv_refresh_pop_timer(data);
// ... | PBL_IF_ROUND_ELSE(new_icon_layer_x_offset, 6) | ;
const uint16_t icon_layer_y_offset = PBL_IF_ROUND_ELSE(10, 2);
const GRect dnd_frame = (GRect) {
.origin = GPoint(icon_layer_x_offset, icon_layer_y_offset),
.size = icon_rect.size,
};
layer_set_frame(&data->dnd_icon_layer, &dnd_frame);
data->dnd_icon_visible = is_visible;
}
static void prv_dnd_sta... |
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 "comm/ble/kernel_le_c... | assert_float_parse("1.654321", 33, true, 55) | ;
}
void test_ams_util__float_string_negative_multiplier(void) {
// "1.987622" * -33 is approx -65.591526, round to -66
assert_float_parse("1.987622", -33, true, -66);
}
void test_ams_util__float_string_parse_overflow_positive(void) {
// fails:
// "2147483648" * 1
assert_float_parse("2147483648", 1, false, ... |
PebblePutBytesEvent *pb_event_copy = kernel_malloc_check(sizeof(PebblePutBytesEvent));
memcpy(pb_event_copy, pb_event, sizeof(PebblePutBytesEvent));
system_task_add_callback(prv_put_bytes_event_system_task_cb, pb_event_copy);
}
//! Callback for the system task to fire off the fetch request. Triggered by a call to... | {
PBL_LOG(LOG_LEVEL_DEBUG, "Attempted to cancel an app that is currently not being"
" fetched: %"PRId32, app_id);
return;
} |
PBL_LOG(LOG_LEVEL_DEBUG, "Cancelling app fetch from system task");
s_fetch_state.cancelling = true;
put_bytes_cancel();
}
void app_fetch_cancel_from_system_task(AppInstallId app_id) {
PBL_ASSERT_TASK(PebbleTask_KernelBackground);
prv_cancel_fetch_from_system_task((void *)(uintptr_t)app_id);
}
void app_fe... |
-----------------------------
// Run the minute callback enough times to cause everything that is normally periodically
// recomputed (walking rate, sleep, etc.) to be recomputed
static void prv_force_periodic_updates(void) {
for (int i = 0; i < ACTIVITY_SESSION_UPDATE_MIN; i++) {
activity_test_run_minute_callbac... | if (steps >= 27 && steps <= 33) {
passed = true;
} |
prv_test_end(context, passed);
}
// -------------------------------------------------------------------------------
static void prv_test_30_min_walk(void *context) {
bool passed = false;
activity_prefs_activity_insights_set_enabled(true);
// Reset all stored data
activity_test_reset(true /*reset_setting... |
// on this row, the delta is wider than the available pixels
if (patch_garbage) {
const uint8_t fill_byte = delta_neg ? left_pixel[num_pix_data_row - 1] :
left_pixel[0];
memset(left_pixel, fill_byte, num_pix_data_row);
}
... | for (int16_t i = 0; i < length; i++) {
const int16_t x = horiz_advance ? min_x + i : (edge_is_max_position ? end_x - 1 : min_x);
const int16_t y = !horiz_advance ? min_y + i : (edge_is_max_position ? end_y - 1 : min_y);
const GBitmapDataRowInfo data_row_info = gbitmap_get_data_row_info(bitmap, y);
GCol... |
return color;
}
|
AlarmId id;
s_current_hour = 11;
s_current_minute = 30;
id = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_WEEKDAYS });
prv_assert_alarm_config(id, 10, 30, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule);
// Only 1 pin should be added (for Friday)
cl_assert_equal_i(s_num_timeline... | prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday) | ;
// Only 1 pin should be added
cl_assert_equal_i(s_num_timeline_adds, 2);
// First alarm goes off. Second one should be up
s_current_hour = 10;
s_current_minute = 30;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 1);
prv_assert_alarm_config(id1, 10, 30, true, ALARM_KIND_JUST_ONCE, just_... |
ions) {
if (actions & PhoneCallActions_Answer) {
s_phone_ui_data->up_action = prv_answer_click_handler;
up_icon = RESOURCE_ID_ACTION_BAR_ICON_CHECK;
}
if (actions & PhoneCallActions_Reply) {
// Move to top if that place isn't taken
if (!s_phone_ui_data->up_action) {
s_phone_... | evented_timer_register(
delay_ms, false /* repeating */, prv_window_pop_cb, NULL) | ;
}
//! Window setup
//! Currently only 1 call window can exist at a time
static void prv_phone_ui_init(void) {
PBL_ASSERTN(s_phone_ui_data == NULL);
s_phone_ui_data = kernel_zalloc_check(sizeof(PhoneUIData));
s_phone_ui_data->hid_action_bar = false;
s_phone_ui_data->style = s_phone_styles[system_theme_get_c... |
ions
layer_set_clips((Layer *)&data->progress_layer, false); // Extending bounds to grow the dot
progress_layer_set_corner_radius(&data->progress_layer, DOT_TRANSITION_RADIUS);
mid.size.w = DOT_TRANSITION_RADIUS * 2;
mid.size.h = DOT_TRANSITION_RADIUS * 2;
mid.origin.x = DOT_OFFSET - DOT_TRANSITION_RADIUS + ... | (&data->progress_layer, data->progress_percent) | ;
}
static void prv_fake_update_progress(void *context) {
ProgressWindow *data = context;
prv_set_progress(data, data->progress_percent + FAKE_PROGRESS_UPDATE_AMOUNT);
if (data->progress_percent >= data->max_fake_progress_percent) {
// Hit the max, we're done
data->fake_progress_timer = EVENTED_TIMER_I... |
nt event = {
.type = PEBBLE_PUT_BYTES_EVENT,
.put_bytes = {
.type = PebblePutBytesEventTypeInitTimeout,
.object_type = ObjectUnknown,
.has_cookie = false,
.progress_percent = 0,
.total_size = 0,
.failed = true,
},
};
event_put(&event);
xSemaphoreGive(s_pb_semaphore... | if (prv_receiver_contains_put_request()) { // beginning of a PutRequest msg?
PutRequest *request = (PutRequest *)rcvd_data;
uint32_t tot_payload_size = s_pb_state.receiver.length;
// We only need the PutRequest Header to do some sanity checking so perform the check
// now so we don't pre-ACK malformed ... |
}
void prv_receiver_write(Receiver *receiver, const uint8_t *data, size_t length) {
if (!prv_take_lock_with_short_timeout()) {
s_pb_state.receiver.should_nack = true;
return;
}
if (!prv_is_message_pending_processing()) {
// Could happen if put_bytes_cancel() was called after "prepare"
PBL_LOG(LO... |
n(VoiceUiData *data);
static void prv_set_mic_window_state(VoiceUiData *data, VoiceUiState state);
static PropertyAnimation *prv_create_int16_prop_anim(int16_t from, int16_t to,
uint32_t duration,
const PropertyAni... | (text, data->error_text_buffer, sizeof(data->error_text_buffer)) | ;
dialog_set_text(dialog, data->error_text_buffer);
dialog_set_icon(dialog, resource_id);
dialog_set_background_color(dialog, color);
dialog_set_timeout(dialog, has_timeout ? ERROR_DIALOG_TIMEOUT : DIALOG_TIMEOUT_INFINITE);
dialog_set_destroy_on_pop(dialog, false /* free_on_pop */);
}
static void prv_push_er... |
const uint8_t num_characteristics =
gatt_client_service_get_characteristics_matching_uuids(
added_services->services[s], &characteristics[0], client->characteristic_uuids,
client->num_characteristics);
if (num_characteristics != client->num_characteristics) {
PB... | if (client->handle_read_or_notification) {
client->handle_read_or_notification(event->object_ref, buffer,
value_length, event->gatt_error);
} |
kernel_free(buffer);
}
static void prv_consume_notifications(const PebbleBLEGATTClientEvent *event) {
GATTBufferedNotificationHeader header = {};
bool has_more = gatt_client_subscriptions_get_notification_header(GAPLEClientKernel, &header);
const RtcTicks start_ticks = rtc_get_ticks();
while (has_more) {
... |
_equal_i(s_last_hr_event.data.heart_rate_update.current_bpm, 120);
cl_assert_equal_i(s_last_hr_event.data.heart_rate_update.quality, HRMQuality_Excellent);
// Should not fire off an event. Bad HR reading
prv_advance_time_hr(1 /*sec*/, 20 /*hr*/, HRMQuality_Excellent, true /*force_continuous*/);
cl_assert_equal... | (metric_values[1], 60) | ;
activity_stop_tracking();
fake_system_task_callbacks_invoke_pending();
activity_metrics_prv_set_metric(ActivityMetricStepCount, Thursday, 5555);
activity_get_metric(ActivityMetricStepCount, 1, metric_values);
cl_assert_equal_i(metric_values[0], 4444);
}
// Test that we report the that a run session is on... |
ad_data_length;
ad->scan_resp_data_length = scan_resp_data_length;
if (ad_data_length) {
strncpy((char *) ad->data,
ad_data, ad_data_length);
}
if (scan_resp_data_length) {
strncpy((char *) ad->data + ad_data_length,
scan_resp_data, scan_resp_data_length);
}
return ad;
}
void... | (advert_terms[1].min_interval_slots,
advert_terms[1].max_interval_slots) | ;
cl_assert_equal_i(s_unscheduled_cb_count, 0);
}
void test_gap_le_advert__single_job_multiple_terms(void) {
const char ad_data[] = "ad data";
const char scan_resp_data[] = "scan resp data";
BLEAdData *ad = create_ad(ad_data, scan_resp_data);
GAPLEAdvertisingJobTerm advert_terms[3] =
{
{
.min_i... |
e *dev, AS7000AppId app) {
uint8_t running_apps = 0;
if (!prv_read_register(dev, ADDR_APP_IDS, &running_apps)) {
return false;
}
PBL_LOG(LOG_LEVEL_DEBUG, "Apps running: 0x%"PRIx8, running_apps);
if (app == AS7000AppId_Idle) {
// no apps should be running
return running_apps == AS7000AppId_Idle;
... | mutex_lock(dev->state->lock) | ;
if (dev->state->enabled_state != HRMEnabledState_Enabled) {
goto exit;
}
// If we have gone too long without getting an interrupt, let's reset the device
if (s_missing_interrupt_count >= AS7000_MAX_WATCHDOG_INTERRUPTS) {
PBL_LOG(LOG_LEVEL_ERROR, "Watchdog logic detected frozen sensor. Resetting now."... |
s_color_slide_animation_impl, NULL, &zero, &width));
s_phone_ui_data->bg_color.boundary = 0;
} else {
s_phone_ui_data->bg_color.right = color;
color_animation = property_animation_get_animation(
property_animation_create(&s_color_slide_animation_impl, NULL, &width, &zero));
s_phone_ui_data->bg... | (s_phone_ui_data->bg_color.boundary, 0, layer->bounds.size.w,
layer->bounds.size.h) | |
_NO_CLIP, true, 11);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2));
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11);
... | (&ctx.dest_bitmap, "draw_round_rect_origin_rmax_sw11_no_clip.${BIT_DEPTH_NAME}.pbi") | );
// Should not draw anything
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2));
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_sw11_no_clip.${BIT_DEPTH_NAME}... |
IntentApply fp, void *data) {
GAPLEConnectionIntent *intent = s_intents;
while (intent) {
GAPLEConnectionIntent *next = (GAPLEConnectionIntent *) intent->node.next;
if (prv_intent_matches_connection(intent, connection)) {
fp(intent, data);
}
intent = next;
}
}
// ... | {
PBL_LOG(LOG_LEVEL_ERROR, "GAP_LE_Cancel_Create_Connection (r=%d)", r);
} | |
prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0);
// Complete A and start B
prv_advance_to_ms_with_timers(start_ms + duration_a + delay_seq + delay_a + delay_b
+ 2 * MIN_FRAME_INTERVAL_MS + 1);... | (start_ms + delay_spawn + duration_a + delay_a
+ 2 * MIN_FRAME_INTERVAL_MS + 1) | |
(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_V14, 0x0) | ;
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_FW, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_NSW, 0x0);
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_PSW, 0x0);
REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_COMP_CLK, 0x0);
REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_TEST_CURRENT, 0x0);
REG_SETF(DCDC, DCDC_TEST_1_REG, DC... | |
bool success = false;
if (dls_list_is_session_valid(entry->session) &&
uuid_equal(&entry->app_uuid, &entry->session->app_uuid) &&
entry->timestamp == entry->session->session_created_timestamp &&
entry->tag == entry->session->tag) {
PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Reopening s... | if ((command & ~DLS_ENDPOINT_CMD_MASK) == 0) {
PBL_LOG(LOG_LEVEL_ERROR, "Invalid data logging endpoint command 0x%x", command);
// TODO: send some error code back?
return;
} | |
ation_a, total_duration_b));
cl_assert_equal_i(animation_get_duration(spawn, true, true), duration_total);
animation_destroy(spawn);
#endif
}
// --------------------------------------------------------------------------------------
// Test unschedule all when we have multiple animations, some complex
void test_... | (animation_get_duration(h, true, true) == (duration + delay)) | ;
// Play count
cl_assert_equal_i(animation_get_play_count(h), 1);
animation_set_play_count(h, 2);
cl_assert_equal_i(animation_get_play_count(h), 2);
cl_assert(animation_get_duration(h, true, true) == 2*(duration + delay));
// Curve
cl_assert(animation_get_curve(h) == AnimationCurveDefault);
animation... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&data->window) | );
}
static GPointPrecise prv_gpoint_from_polar(const GPointPrecise *center, uint32_t distance,
int32_t angle) {
return gpoint_from_polar_precise(center, distance << GPOINT_PRECISE_PRECISION, angle);
}
static void prv_graphics_draw_centered_text(GContext *ctx, const G... |
in.y = interpolate_int16(
distance_normalized,
property_animation->values.from.grect.origin.y,
property_animation->values.to.grect.origin.y);
result.size.w = interpolate_int16(
distance_normalized,
property_animation->values.from.grect.size.w,
property_animation->values.to.grect.si... | animation_private_using_legacy_2(NULL) | );
PropertyAnimationPrivate *property_animation = prv_find_property_animation(property_animation_h);
if (!property_animation) {
return;
}
Fixed_S32_16 result = interpolate_fixed32(distance_normalized,
property_animation->values.from.fixed_s32_16,
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 10) | ;
graphics_line_draw_precise_stroked_aa(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_same_point_origin_layer_aa.${BIT_DEPTH_NAME}.pbi"));
#endif
}
void test_graphics_draw_stroke_precise_${BIT_DEPTH_NAME}__origin_layer_non_aa(void) {
GContext ct... |
allback has something to refer to
static ReminderId s_next_reminder_id;
bool reminders_mark_has_reminded(ReminderId *reminder_id);
static void prv_put_reminder_event(ReminderId *reminder_id, ReminderEventType type) {
Uuid *removed_id = kernel_malloc(sizeof(Uuid));
if (!removed_id) {
return;
}
*removed_id... | if (event_time_utc > current_time_utc &&
event_time_utc - current_time_utc > HALF_SNOOZE_END_MARK) {
// Half-time snooze
snooze_delay = (event_time_utc - reminder_time_utc) / 2;
} else if (current_time_utc > event_time_utc &&
current_time_utc - event_time_utc > CONSTANT_SNOOZE_END_MARK) {
... |
timeline_item_free_allocated_buffer(&parent_item);
return snooze_delay;
}
bool reminders_can_snooze(Reminder *reminder) {
return (prv_calculate_snooze_delay((TimelineItem *)reminder) > 0);
}
status_t reminders_snooze(Reminder *reminder) {
uint32_t snooze_delay = prv_calculate_snooze_delay((TimelineItem *)re... |
uality_Good, true /*force_continuous*/);
cl_assert_equal_i(s_num_hr_events, 0);
// Should fire off an event. Good HR and Good quality
prv_advance_time_hr(1 /*sec*/, 120 /*hr*/, HRMQuality_Good, true /*force_continuous*/);
cl_assert_equal_i(s_num_hr_events, 1);
// Should fire off an event. OffWrist, tell cli... | activity_metrics_prv_set_metric(ActivityMetricRestingKCalories, Thursday, 2000) | ;
activity_metrics_prv_set_metric(ActivityMetricRestingKCalories, Wednesday, 44);
activity_get_metric(ActivityMetricRestingKCalories, 2, metric_values);
cl_assert_equal_i(metric_values[0], 2000);
cl_assert_equal_i(metric_values[1], 44);
cl_assert_equal_i(activity_metrics_prv_get_resting_calories(), 2000 * ACT... |
len, val, val_len);
}
prv_print_stats(&file);
printf("Making sure we handle running out of storage gracefully...\n");
memcpy(key, "k255", 5);
memcpy(val, "v255", 5);
cl_assert_equal_i(settings_file_set(&file, key, key_len, val, val_len), E_OUT_OF_STORAGE);
int val_len_out = settings_file_get_len(&file, ke... | set_and_verify(&file_original, key, key_len, original_value, original_value_length) | ;
#define NEW_VALUE "new_value"
uint8_t new_value[sizeof(NEW_VALUE)];
int new_value_length = sizeof(NEW_VALUE) - 1;
memcpy(new_value, NEW_VALUE, sizeof(NEW_VALUE));
jmp_buf jmp;
if (setjmp(jmp)) {
// If we end up here, that means we wrote at least after_n_bytes to the
// SPI flash. Once we get here,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.