prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
RRY_VALUE_HAS_TYPE(value, 'undefined');
}
////////////////////////////////////////////////////////////////////////////////
// Jerry Value Getter Functions
////////////////////////////////////////////////////////////////////////////////
bool jerry_get_boolean_value(const jerry_value_t value) {
if (!jerry_value_is_bo... | {
case JERRY_ERROR_COMMON:
error_ref = JERRY_ERROR(Error, message_p, message_size);
break;
case JERRY_ERROR_EVAL:
error_ref = JERRY_ERROR(EvalError, message_p, message_size);
break;
case JERRY_ERROR_RANGE:
error_ref = JERRY_ERROR(RangeError, message_p, message_size);
brea... |
jerry_value_set_error_flag(&error_ref);
return error_ref;
}
jerry_value_t jerry_create_external_function(jerry_external_handler_t handler_p) {
return (jerry_value_t)EM_ASM_INT({
return __jerry_create_external_function($0);
}, handler_p);
}
jerry_value_t jerry_create_number(double value) {
return (j... |
/*
* 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 (s_connection) {
gap_le_connection_remove(&s_device);
s_connection = NULL;
} |
gap_le_connection_deinit();
stub_new_timer_cleanup();
}
void test_gatt_service_changed_server__unsubscribe(void) {
prv_cccd_write(false /* is_subscribing */);
prv_expect_service_changed_indication_api_call_count(0);
}
void test_gatt_service_changed_server__subscribe_event_but_no_connection(void) {
gap_le_... |
/*
* 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... | ( ( void * ) _pvHeapStart, ucExpectedInterruptStackValues, sizeof( ucExpectedInterruptStackValues ) ) | == 0U );
#endif /* mainCHECK_INTERRUPT_STACK */
}
#ifdef JUST_AN_EXAMPLE_ISR
void Dummy_IRQHandler(void)
{
/* Clear the interrupt if necessary. */
Dummy_ClearITPendingBit();
OS_EVENT_SIGNAL_FROM_ISR(xTestSemaphore);
}
#endif /* JUST_AN_EXAMPLE_ISR */
|
ttings_file_get_len(file, key, key_len);
cl_must_pass(val_len_out);
cl_assert_equal_i(val_len, val_len_out);
const bool is_immediate_delete = (val_len == 0 && DELETED_LIFETIME <= 0);
uint8_t *val_out = malloc(val_len_out);
cl_assert_equal_i(settings_file_get(file, key, key_len, val_out, val_len_out),
... | prv_test_settings_file_compaction(manual_compaction) | ;
}
static void prv_print_stats(SettingsFile *file) {
printf("file max used space = %d\n", file->max_used_space);
printf("file max space total = %d\n", file->max_space_total);
printf("file used space = %d\n", file->used_space);
printf("file dead space = %d\n", file->dead_space);
}
void test_settings_file__com... |
nt = 0;
s_out_failed_call_count = 0;
s_ack_sent_is_called = false;
s_nack_sent_is_called = false;
s_in_received_is_called = false;
s_in_dropped_is_called = false;
s_ack_received_for_id_1 = false;
s_nack_received_for_id_2 = false;
s_remote_receive_handler = NULL;
s_dropped_reason = APP_MSG_OK;
s_fail... | app_timer_trigger(app_message_ack_timer_id()) | |
/*
* 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... | (window_get_root_layer(window)) | ;
app_timer_register(1000 / FPS, timed_update, NULL);
}
static void init(void) {
window = window_create();
Layer *window_layer = window_get_root_layer(window);
GRect window_bounds = layer_get_bounds(window_layer);
TextLayer *text_layer = text_layer_create(window_bounds);
text_layer_set_text(text_layer, ... |
wm.h"
#include "drivers/timer.h"
#include "kernel/util/stop.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/math.h"
#include "services/common/analytics/analytics.h"
#include "services/common/battery/battery_monitor.h"
#include "services/common/battery/battery_state.h"
#include "services/commo... | prv_vibe_get_pwm_duty_cycle(strength) | ;
s_vibe_duty_cycle = MIN(duty_cycle, PWM_DUTY_CYCLE_FULL);
}
void vibe_ctl(bool on) {
if (!s_initialized) {
return;
}
if (on && battery_monitor_critical_lockout()) {
on = false;
}
static bool s_on = false;
if (on && !s_on) {
analytics_inc(ANALYTICS_DEVICE_METRIC_VIBRATOR_ON_COUNT, Analytic... |
vel>:<color>:<msg>,"\
"CORE_ID=" str(CORE_ID_MAIN_MCU) ",CORE_NAME=Tintin";
// Confirm the size calculations. If these fail, update tools/loghashing/check_elf_log_strings.py
// We can't currently handle 64 bit values.
_Static_assert(sizeof(long int) <= 4, "long int larger than expected");
_Static... | {
log_state = worker_state_get_log_state();
} |
if (log_state) {
if (log_state->in_progress) {
return NULL;
}
log_state->in_progress = true;
return log_state;
} else {
return kernel_applib_get_log_state();
}
}
// Release the LogState buffer obtained by prv_get_log_state()
static void prv_release_log_state(LogState *state) {
Pebbl... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | for (size_t i = 0; i < sizeof(vector); ++i) {
vector[i] = i + 1;
} | |
MemorySegment worker_ram = { __WORKER_RAM__, __WORKER_RAM_end__ };
memset((char *)worker_ram.start + stack_guard_size, 0,
memory_segment_get_size(&worker_ram) - stack_guard_size);
MemorySegment worker_segment;
PBL_ASSERTN(memory_segment_split(&worker_ram, &worker_segment,
... | {
worker_manager_launch_new_worker_with_args(s_next_worker.md, s_next_worker.args);
} | else {
// Do we have a default worker we should switch to that is different from the previous worker?
AppInstallId default_id = worker_manager_get_default_install_id();
if (default_id != INSTALL_ID_INVALID && default_id != previous_worker_install_id) {
worker_manager_put_launch_worker_event(default_i... |
n;
if (data->selection >= ATTRIBUTE_COUNT) {
data->selection = 0;
}
layer_mark_dirty(data->canvas_layer);
}
static void click_config_provider(void *context) {
window_single_repeating_click_subscribe(BUTTON_ID_UP, 100, up_handler);
window_single_repeating_click_subscribe(BUTTON_ID_SELECT, 100, select_han... | GRect(0, 0, window_bounds.size.w,
window_bounds.size.h) | );
layer_set_update_proc(data->canvas_layer, canvas_update_proc);
layer_add_child(window_layer, data->canvas_layer);
}
static void main_window_unload(Window *window) {
AppData *data = window_get_user_data(s_window);
layer_destroy(data->canvas_layer);
}
static void init(void) {
AppData *data = task_zalloc(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... | (test_reel) | ;
}
// Tests
////////////////////////////////////
extern void prv_play_animation_update(Animation *animation, const AnimationProgress normalized);
void test_kino_player__finite_animation_finite_reel_foward(void) {
// Choose duration and elapsed to have clean division for
// ANIMATION_NORMALIZED_MAX * elapsed / d... |
ent link control message which was sent
static LinkControlType s_type;
//! Number of consecutive bad status message responses received from the smartstrap
static int s_strikes;
static void prv_do_send(LinkControlType type) {
FrameHeader header = (FrameHeader) {
.version = LINK_CONTROL_VERSION,
.type = type
... | accessory_set_baudrate(BAUDS[requested_baud]) | ;
prv_do_send(LinkControlTypeStatus);
}
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Invalid response type (%d)", header->type);
smartstrap_link_control_disconnect();
success = false;
}
return success;
}
void smartstrap_link_control_connect(void) {
prv_do_send(LinkControlTypeProfiles);
accessory_... |
/*
* 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_pbi_test(TEST_PBI_FILE) | ;
cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE));
}
// Tests 4-bit palettized PBI loading into gbitmap
// Result:
// - gbitmap matches platform loaded PBI
void test_pbi__color_4_bit(void) {
GBitmap *bitmap = setup_pbi_test(TEST_PBI_FILE);
cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE));
}
// Tests 8-bit co... |
on(mute_level,
i18n_get("Mute Weekends", root_level),
prv_mute_notification_weekends,
window_data);
action_menu_level_add_action(mute_level,
i18n_get("Mute Weekdays", root_l... | 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);
// update status bar to the current info
prv_update_status_layer(data);
// Reload notification data from notification_storage in case of an action/remove
if (data->notifications_modified) {
data->notifications_modified = false;
prv_r... |
.line
};
WordIterState* word_iter_state = &line_iter_state->word_iter_state;
word_iter_init(&line_iter_state->word_iter, word_iter_state, ctx,
&ctx->text_draw_state.text_box, ctx->text_draw_state.text_box.utf8_bounds->start);
iter_init(line_iter, (IteratorCallback) line_iter_next, NULL, (Iter... | if (prv_line_iter_is_vertical_overflow(line_iter_state, text_box_params)) {
return false;
} |
line_iter_state->current->origin.x = text_box_params->box.origin.x;
line_iter_state->current->origin.y += prv_get_line_height(text_box_params);
line_iter_state->current->width_px = 0; // needs to be reset per line
line_iter_state->current->max_width_px = text_box_params->box.size.w;
line_iter_state->curren... |
G_LEVEL_DEBUG, "Shutting down device.");
switch (dev->state->enabled_state) {
case HRMEnabledState_PoweringOn:
new_timer_stop(dev->state->timer);
// Delay a bit so that we don't deassert the enable GPIO while in
// the loader and unintentionally activate force loader mode.
psleep(LOADER_RE... | psleep(35) | ;
// make sure the loader is running
if (!prv_is_app_running(dev, AS7000AppId_Loader)) {
return false;
}
}
prv_log_running_apps(dev);
return true;
}
static uint64_t prv_get_time_ms(void) {
time_t time_s;
uint16_t time_ms;
rtc_get_time_ms(&time_s, &time_ms);
return ((uint64_t)time_s) * ... |
ersistent_storage_update_ble_device_name(BTBondingID bonding, const char *device_name) {
BtPersistBondingData data;
if (!prv_file_get(&bonding, sizeof(bonding), &data, sizeof(data))) {
return false;
}
if (data.type != BtPersistBondingTypeBLE) {
PBL_LOG(LOG_LEVEL_ERROR, "Not getting BLE id %d. Type mism... | prv_fill_ble_data(
NULL, NULL, data.ble_data.name, NULL, NULL, name_out) | ;
return true;
}
typedef struct {
BTDeviceInternal device;
SMIdentityResolvingKey irk_out;
char name_out[BT_DEVICE_NAME_BUFFER_SIZE];
bool found;
} FindByAddrItrData;
static bool prv_find_by_addr_itr(SettingsFile *file,
SettingsRecordInfo *info, void *context) {
// check e... |
G_READ);
if (fd < 0) {
return false;
}
SerializedTimelineItemHeader header = { .common.id = UUID_INVALID };
bool found = prv_find_next_notification(&header, prv_uuid_equal_func, (void *)id, fd);
prv_file_close(fd);
return found;
}
static bool prv_get_notification(TimelineItem *notification,
Seri... | {
// Seek to the status field
pfs_seek(fd, (-(int)sizeof(*header) +
(int)offsetof(CommonTimelineItemHeader, status)),
FSeekCur);
// Invert flags & status to store on flash
status = ~status;
int result = pfs_write(fd, (uint8_t *)&status, sizeof(header->common.status));
if (result < 0) {
PBL... |
bool notification_storage_get_status(const Uuid *id, uint8_t *status) {
int fd = prv_file_open(OP_FLAG_READ);
bool rv = false;
if (fd < 0) {
return rv;
}
SerializedTimelineItemHeader header = { .common.id = UUID_INVALID };
if (prv_find_next_notification(&header, prv_uuid_equal_func, (void *) id, fd))... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
// If the existing name doesn't match our new name, update the name
app_name_buff = kernel_zalloc_check(app_name_attr->length + 1);
pstring_pstring16_to_string(&app_name_attr->pstr, app_name_buff);
attribute_list_add_cstring(&new_attr_list, AttributeIdAppName, app_name_buff);
list_dirty ... |
}
// Add the mute attribute if we don't have one already
// Default the app to not muted
const bool already_has_mute =
app_notif_prefs && attribute_find(&app_notif_prefs->attr_list, AttributeIdMuteDayOfWeek);
if (!already_has_mute) {
attribute_list_add_uint8(&new_attr_list, AttributeIdMuteDayOfWee... |
ntUpdate
int32_t last_event_step_count;
time_t last_movement_event_time_ts;
// Whether or not the current workout is paused
bool paused;
EventedTimerID workout_abandoned_timer;
} CurrentWorkoutData;
//! Persisted statically in RAM
typedef struct WorkoutServiceData {
PebbleRecursiveMutex *s_workout_mutex;... | {
// Reset to zero for OffWrist readings
prv_reset_hr_data();
} | else if (event->quality >= HRMQuality_Worst) {
const int prev_bpm_timestamp_ts = wrkt_data->current_bpm_timestamp_ts;
wrkt_data->current_bpm = event->current_bpm;
wrkt_data->current_hr_zone = hr_util_get_hr_zone(wrkt_data->current_bpm);
wrkt_data->current_bpm_timestamp_ts = time_get_uptime_seconds();
... |
* SECONDS_PER_MINUTE));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("2 H AGO", time_buf);
// June 9th 2015, 13:59:59 (T+01:59:59)
rtc_set_time(event_time + SECONDS_PER_HOUR + (59 * SECONDS_PER_MINUTE) + 59);
clock_get_until_time_capitalized(t... | (event_time - (14 * SECONDS_PER_HOUR)) | ;
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s(" 4:00 PM", time_buf);
// June 8th 2015, 16:00:00 (T-48:00:00)
rtc_set_time(event_time - SECONDS_PER_DAY - (24 * SECONDS_PER_HOUR));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), eve... |
NULL) {
// Get the ending \0 of the string
// Equivalent to ptr = fmt + strlen(fmt), but a bit faster/smaller
ptr = strchr(fmt, '\0');
}
size_t length = (ptrdiff_t)(ptr - fmt);
// Verify we have enough space for the copy
if (left <= length) {
goto _out_of_size;
}
memcpy(... | FMT_RECURSE("%m/%d/%y") | ;
break;
case 'e': // SU
FMT_INTCOPY(t->tm_mday, 2, INTFMT_PADSPACE);
break;
case 'F': // C99
FMT_RECURSE("%Y-%m-%d");
break;
case 'g': // TZ
FMT_INTCOPY(prv_iso8601_year(t) % 100, 2, INTFMT_PADZERO);
break;
case 'G': // TZ
FMT_INTC... |
/*
* 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 (app_notif_prefs) {
existing_name = attribute_get_string(&app_notif_prefs->attr_list, AttributeIdAppName, "");
} |
if (!pstring_equal_cstring(&app_name_attr->pstr, existing_name)) {
// If the existing name doesn't match our new name, update the name
app_name_buff = kernel_zalloc_check(app_name_attr->length + 1);
pstring_pstring16_to_string(&app_name_attr->pstr, app_name_buff);
attribute_list_add_cstrin... |
_manager__multiple_feature_callbacks(void) {
const int num_refs = 2;
HRMSessionRef session_refs[num_refs];
AppInstallId app_id = 1;
for (int i = 0; i < num_refs; ++i, app_id++) {
session_refs[i] = TO_SESSION_REF(i+1);
const uint16_t expire_s = SECONDS_PER_MINUTE;
sys_hrm_manager_app_subscribe(app_... | {
AppInstallId app_id = 1;
const uint16_t expire_s = SECONDS_PER_MINUTE;
const HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, 1, expire_s,
HRMFeature_BPM);
HRMSubscriberState *state = prv_get_subscriber_state_from_ref(session_... |
void test_hrm_manager__set_update_internal(void) {
AppInstallId app_id = 1;
const uint16_t expire_a_s = SECONDS_PER_MINUTE;
uint32_t update_interval_a_s = 1;
HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, update_interval_a_s,
expi... |
/*
* 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(bytes_written, (i + 1) * sizeof(test_data)) | ;
cl_assert_equal_i(buffer_get_bytes_remaining(b), buffer_size - ((i+1) * sizeof(test_data)));
}
cl_assert(buffer_get_bytes_remaining(b) > 0);
bytes_written = buffer_add(b, (uint8_t *) test_data, sizeof(test_data));
cl_assert_equal_i(bytes_written, 0);
free(b);
}
void test_buffer__cannot_remove_beyond_... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (time_layer) | );
// Time layer
struct tm *gm_time = gmtime(&the_time);
static char gmtime_buf[32];
snprintf(gmtime_buf, 32, "gmtime: %d:%02d, is_dst: %d",
gm_time->tm_hour, gm_time->tm_min, gm_time->tm_isdst);
gmtime_layer = text_layer_create(GRect(0, 40, 144, 168));
text_layer_set_text(gmtime_layer, gmtime_buf);... |
ew_state == ANCSClientStateIdle);
case ANCSClientStatePerformingAction:
return (new_state == ANCSClientStateIdle);
case ANCSClientStateRequestedApp:
return (new_state == ANCSClientStateIdle);
case ANCSClientStateAliveCheck:
return (new_state == ANCSClientStateIdle);
case ANCSClientSt... | {
return;
} |
prv_reset_reassembly_context();
prv_notif_queue_next();
}
static void prv_reset_and_next(void) {
prv_reset_and_idle();
prv_notif_queue_pop();
prv_notif_queue_next();
}
static void prv_reset_and_flush(void) {
prv_reset_and_idle();
prv_notif_queue_reset();
}
static void prv_reset_due_to_parse_error(voi... |
dler_calls, animation, finished, context);
if (s_stopped_handler_calls.num_calls == 1) {
DPRINTF("%"PRIu64" ms: Rescheduling from stopped handler for %d\n", prv_now_ms(),
(int)animation);
animation_schedule(animation);
} else {
DPRINTF("%"PRIu64" ms: NOT rescheduling from stopped handler fo... | {
*p = value;
} |
static uint32_t prv_uint32_getter(uint32_t *p) {
return *p;
}
// --------------------------------------------------------------------------------------
// Helper function for creating a int16 property animation
static Animation *prv_create_test_animation(void) {
Animation *h;
const AnimationHandlers handler... |
&average_ms);
cl_assert_equal_i(num_intervals, 0);
cl_assert_equal_i(average_ms, 0);
fake_rtc_increment_time_ms(1000);
interval_timer_take_sample(&timer);
num_intervals = interval_timer_get(&timer, &average_ms);
cl_assert_equal_i(num_intervals, 1);
cl_assert_equal_i(average_ms, 1000);
fake_rtc_incre... | cl_assert_equal_i(num_intervals, 3) | ;
cl_assert_equal_i(average_ms, 1006);
fake_rtc_increment_time_ms(1010);
interval_timer_take_sample(&timer);
num_intervals = interval_timer_get(&timer, &average_ms);
cl_assert_equal_i(num_intervals, 4);
cl_assert_equal_i(average_ms, 1007);
fake_rtc_increment_time_ms(1030);
interval_timer_take_sample(... |
_t update_interval_s = 600;
const uint16_t expire_s = 30 * SECONDS_PER_MINUTE;
HRMFeature features = HRMFeature_BPM;
HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, update_interval_s, expire_s,
features);
fake_system_task_callbacks_in... | hrm_manager_handle_prefs_changed() | ;
cl_assert(prv_can_turn_sensor_on());
fake_system_task_callbacks_invoke_pending();
cl_assert(hrm_is_enabled(HRM));
// Test charging state changes
prv_put_battery_state_change_event(true /* is plugged in */);
cl_assert(!prv_can_turn_sensor_on());
fake_system_task_callbacks_invoke_pending();
cl_assert(!... |
return 1;
} else if (b_node->size > a_node->size) {
return -1;
} else {
return 0;
}
}
}
//! Trim the applications with highest priority while still keeping (bytes_in_list > bytes_needed)
static void prv_trim_top_priorities(EvictListNode **list_node, uint32_t *bytes_in_list,
... | (&file, (uint8_t *)&app_id, sizeof(AppInstallId),
(uint8_t *)&entry, sizeof(AppCacheEntry)) | ;
} else {
app_storage_delete_app(app_id);
settings_file_delete(&file, (uint8_t *)&app_id, sizeof(AppInstallId));
}
settings_file_close(&file);
}
unlock:
mutex_unlock_recursive(s_app_cache_mutex);
return rv;
}
//! Asks the app cache to remove 'bytes_needed' bytes of application binaries ... |
dius_outer.raw_value);
}
void test_rocky_api_graphics__fill_radial_not_enough_args(void) {
prv_global_init_and_set_ctx();
EXECUTE_SCRIPT_EXPECT_ERROR(
"ctx.rockyFillRadial(30, 40, 10, 20, 0);\n",
"TypeError: Not enough arguments"
);
}
void test_rocky_api_graphics__fill_radial_type_error(void) {
prv... | (1, s_graphics_context_set_fill_color.call_count) | ;
cl_assert_equal_i(1, s_graphics_context_set_stroke_color.call_count);
}
void test_rocky_api_graphics__canvas_state(void) {
prv_global_init_and_set_ctx();
// calling restore if nothing was stored is a no-op
s_context.draw_state.fill_color.argb = 1;
EXECUTE_SCRIPT("ctx.restore()\n");
cl_assert_equal_i(1, ... |
MUST be protected with bt_lock/unlock!
static bool s_gap_le_advert_is_initialized;
static bool s_deinit_in_progress;
//! Circular list! Pointing to the current job that needs air-time.
static GAPLEAdvertisingJob *s_jobs;
//! Job that is currently on air.
static GAPLEAdvertisingJob *s_current;
//! Advertising data t... | BLE_LOG_DEBUG("Job looped around to term %"PRIu16,
job->terms[job->cur_term].loop_around_index) | |
quire_lock();
rtc_enable_backup_regs();
periph_config_release_lock();
restore_rtc_time_state();
initialize_fast_mode_state();
#ifdef PBL_LOG_ENABLED
char buffer[TIME_STRING_BUFFER_SIZE];
PBL_LOG(LOG_LEVEL_DEBUG, "Current time is <%s>", rtc_get_time_string(buffer));
#endif
}
void rtc_init_timers(void) {
... | RTC_ClearITPendingBit(RTC_IT_ALRA) | ;
}
RtcTicks rtc_alarm_get_elapsed_ticks(void) {
return rtc_get_ticks() - s_alarm_set_time;
}
bool rtc_alarm_is_initialized(void) {
return s_tick_alarm_initialized;
}
//! Handler for the RTC alarm interrupt. We don't actually have to do anything in this handler,
//! just the interrupt firing is enough to bring ... |
("test_bitblt__1bit_to_8bit_dest_origin_offset_clip.1bit.pbi") | ;
uint8_t dest_data[100*100];
GBitmap dest_bitmap = {
.addr = dest_data,
.row_size_bytes = 100,
.info.format = GBitmapFormat8Bit,
.info.version = GBITMAP_VERSION_CURRENT,
.bounds = { { 0, 0 }, { 100, 100 } }
};
memset(dest_data, GColorBlack.argb, sizeof(dest_data));
GRect dest_rect = GRec... | |
bytes_count, AnalyticsClient_App);
analytics_set(ANALYTICS_APP_METRIC_FLASH_WRITE_BYTES_COUNT,
s_analytics_write_bytes_count, AnalyticsClient_App);
// The overhead cost of tracking whether each flash read was due to the foreground
// or background app is large, so the best we can do is to attribu... | PBL_ASSERT(PASSED(status), "Erase suspend failure: %" PRId32, status) | |
OARD_CONFIG.mic_config.mic_gpio_power.gpio);
}
}
static void prv_i2s_gpio_init(void) {
// Enable the SPI clock
periph_config_acquire_lock();
// [AS] TODO: If I2S is moved to SPI1, this RCC function needs to be abstracted to board.h
PBL_ASSERTN(BOARD_CONFIG.mic_config.spi_clock_ctrl != RCC_APB2Periph_SPI1);
... | periph_config_disable(CRC, RCC_AHB1Periph_CRC) | |
IDR_LINESIZE_Msk) >> SCB_CCSIDR_LINESIZE_Pos)
#define CCSIDR_WAYS(x) (((x) & SCB_CCSIDR_ASSOCIATIVITY_Msk) >> SCB_CCSIDR_ASSOCIATIVITY_Pos)
#define CSSELR_L1_DCACHE 0
#define CSSELR_L1_ICACHE 1
#if __ICACHE_PRESENT
static uint32_t s_icache_cssidr;
#endif
#if __DCACHE_PRESENT
static uint32_t s_dcache_cssidr;
#end... | (&SCB->DCCIMVAC, dcache_line_size(), (uintptr_t)addr, size) | ;
#endif
}
static void prv_align(uintptr_t *addr, size_t *size, uint32_t line_size) {
uint32_t line_mask = line_size - 1;
if (*addr & line_mask) {
// Need to adjust the address and size because the address is unaligned.
*size += *addr & line_mask;
*addr &= ~line_mask;
}
if (*size & line_mask) {
... |
ap.h"
#include "stubs_text_resources.h"
#include "stubs_text_render.h"
#include "stubs_pbl_malloc.h"
#include "stubs_reboot_reason.h"
#include "stubs_resources.h"
#include "stubs_syscalls.h"
#include "stubs_compiled_with_legacy2_sdk.h"
///////////////////////////////////////////////////////////
// Fakes
static GConte... | (utf8_iter_state->codepoint == 'A') | ; // 0x41
cl_assert(iter_next(&char_iter));
cl_assert(utf8_iter_state->codepoint == '\n');
cl_assert(iter_next(&char_iter));
cl_assert(utf8_iter_state->codepoint == 'B');
cl_assert(iter_next(&char_iter));
cl_assert(utf8_iter_state->codepoint == ' ');
cl_assert(!iter_next(&char_iter));
cl_assert(!iter_ne... |
= {
.num_attributes = 1,
.attributes = &title_attr,
},
};
static TimelineItem item3 = {
.header = {
.id = {0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
.timestamp = 25*60,
.duration = 5,
.type = TimelineItemTypePin,
.all_day... | stub_new_timer_timeout(timer_id) | / 1000);
}
void test_calendar_handle__ongoing_event_added_and_removed(void) {
rtc_set_time(15 * 60);
timeline_event_init();
cl_assert_equal_i(fake_event_get_count(), 1);
cl_assert(!prv_get_calendar_ongoing());
TimerID timer_id = stub_new_timer_get_next();
cl_assert_equal_i(timer_id, TIMER_INVALID_ID);
c... |
m_session_reset(CommSession *session) {
bt_lock();
{
if (!comm_session_is_valid(session)) {
PBL_LOG(LOG_LEVEL_WARNING, "Already closed!");
goto unlock;
}
session->transport_imp->reset(session->transport);
}
unlock:
bt_unlock();
}
// ------------------------------------------------------... | prv_log_session_event(session, true /* is_open */) | ;
// Request capabilities for both the Pebble app and 3rd party companion apps:
session_remote_version_start_requests(session);
comm_session_analytics_open_session(session);
prv_put_comm_session_event(true, is_system);
if (is_system && (session->destination == TransportDestinationHybrid)) {
// For And... |
/*
* 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... | (&image->command_list, size - (sizeof(GDrawCommandImage) -
sizeof(GDrawCommandList))) | ) {
return false;
}
uint8_t *end = (uint8_t *)image + size;
return (end == gdraw_command_list_iterate_private(&image->command_list, NULL, NULL));
}
void gdraw_command_image_draw(GContext *ctx, GDrawCommandImage *image, GPoint offset) {
gdraw_command_image_draw_processed(ctx, image, offset, NULL);
}
void ... |
state it was in when we unscheduled it
cl_assert_equal_point(layer.frame.origin, stopped_at_r.origin);
// Make sure our started and stopped handlers got called at
cl_assert_equal_i(s_started_handler_calls.num_calls, 1);;
cl_assert(s_started_handler_calls.entries[0].fired_time_ms - start_ms <= 1);
cl_assert(... | animation_set_handlers(h, handlers, context) | ;
animation_set_duration(h, duration);
prv_clear_handler_histories();
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_fir... |
layout_mode, const GRect *bounds, GSize *size) {
const TimelineLayerStyle *style = prv_get_style();
const int16_t width = bounds->size.w - (style->left_margin + style->right_margin);
switch (layout_mode) {
default:
case LayoutLayerModePinnedFat:
*size = GSize(width, style->fat_pin_height);
br... | (item->header.layout, &config) | ;
layer_add_child(&layer->layouts_layer, (Layer *)layout);
GRect icon_rect;
timeline_layer_get_icon_frame(layer, index, &icon_rect);
layer_set_frame((Layer *)&layout->icon_layer, &icon_rect);
layer_add_child(&layer->layouts_layer, (Layer *)&layout->icon_layer);
layer->layouts[index] = layout;
layer->layou... |
/*
* 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... | (equal_devices, true) | ;
// clear the event
fake_event_clear_last();
fake_event_reset_count();
}
static void prv_simulate_and_assert_discovery_of_one_service(const BTDeviceInternal *device) {
// Simulate discovery of Blood Pressure service:
fake_gatt_put_discovery_indication_blood_pressure_service(TEST_GATT_CONNECTION_ID);
fake... |
t not looking for any samples then just drop the data
if (state->samples_per_update == 0) {
uint16_t len = shared_circular_buffer_get_read_space_remaining(
&s_buffer, &state->buffer_client.buffer_client);
shared_circular_buffer_consume(
&s_buffer, &state->buffer_client.buffer_client,... | (PEBBLE_ACCEL_SHAKE_EVENT, &prv_shake_add_subscriber_cb,
&prv_shake_remove_subscriber_cb) | ;
event_service_init(PEBBLE_ACCEL_DOUBLE_TAP_EVENT, &prv_double_tap_add_subscriber_cb,
&prv_double_tap_remove_subscriber_cb);
// we always listen for motion events to decide whether or not to enable the backlight
// TODO: KernelMain could probably subscribe to the motion service to accomplish this?
prv_... |
/*
* 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->menu) | |
const BTDeviceInternal *s_device_a;
static const BTDeviceInternal *s_device_b;
void test_ble_hrm__initialize(void) {
fake_pbl_malloc_clear_tracking();
for (int i = 0; i < ARRAY_LENGTH(s_connections); ++i) {
s_connections[i] = NULL;
}
s_activity_prefs_heart_rate_is_enabled = true;
s_bt_driver_hrm_service_... | cl_assert_equal_b(true, ble_hrm_is_sharing_to_connection(&s_conn_b));
prv_assert_event_service_subscribed(true);
cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 1);
cl_assert_equal_i(s_sys_hrm_manager_unsubscribe_call_count, 0);
// Device A disconnects, shouldn't unsubscribe from HRM mana... |
void test_ble_hrm__sub_unsub_resub(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 A unsubscribes:
bt_driver_cb_hrm_service_update_subscriptio... |
static const adapter_call_backs_t s_ad_uart_pm_call_backs = {
.ad_prepare_for_sleep = prv_pm_prepare_for_sleep,
.ad_sleep_canceled = prv_pm_sleep_canceled,
.ad_wake_up_ind = prv_pm_wake_up_ind,
.ad_xtal16m_ready_ind = prv_pm_xtal16m_ready_ind,
.ad_sleep_preparation_time = 0
};
pm_register_adap... | (msg_buffer, 0, msg_buffer_size) | ;
HcProtocolMessage *hc_msg = (HcProtocolMessage *)&msg_buffer[0];
BinLogMessage_Param_v1 *msg = (BinLogMessage_Param_v1 *)&msg_buffer[sizeof(HcProtocolMessage)];
msg->header.version = BINLOGMSG_VERSION_PARAM_V1;
msg->header.length = msg_size;
msg->header.time.millisecond = LEVEL_MAP[level]; // HACK: Carry ... |
VoiceUiState simple_state = prv_get_simple_state(data->state);
VOICE_LOG("Event received: %"PRIu8"; state:%"PRIu8, event->type, simple_state);
switch (simple_state) {
case StateWaitForReady:
if (event->type == VoiceEventTypeSessionSetup) {
prv_handle_ready_event(data, event);
}
bre... | if (!anim) {
return NULL;
} |
property_animation_set_from_int16(anim, &from);
property_animation_set_to_int16(anim, &to);
animation_set_duration((Animation *) anim, duration);
animation_set_curve((Animation *) anim, AnimationCurveEaseInOut);
return anim;
}
static const PropertyAnimationImplementation s_animated_dot_impl = {
.base... |
#include "process_management/app_manager.h"
#include "process_state/app_state/app_state.h"
#include "services/common/clock.h"
#include "shell/sdk/shell_sdk.h"
#include "shell/sdk/watchface.h"
#include "system/logging.h"
typedef struct SdkAppData {
Window window;
TextLayer info_text_layer;
#if CAPABILITY_HAS_SDK_S... | (window, true) | ;
layer_set_update_proc(&window->layer, prv_sdk_home_update_proc);
GRect frame = data->window.layer.frame;
#if CAPABILITY_HAS_SDK_SHELL4
const int top_margin = PBL_IF_RECT_ELSE(19, 25);
const int time_height = 46;
frame.origin.y = top_margin;
frame.size.h = time_height;
TextLayer *time_text_layer = &da... |
DS });
prv_assert_alarm_config(id, 5, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule);
id = alarm_create(&(AlarmInfo) { .hour = 6, .minute = 14, .kind = ALARM_KIND_WEEKENDS });
prv_assert_alarm_config(id, 6, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule);
}
void test_alarm__alarm_create_recurring_weekda... | prv_assert_alarm_config(id2, 23, 46, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule) | ;
}
void test_alarm__alarm_set_recurring_daily(void) {
AlarmId id;
id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_WEEKENDS });
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule);
alarm_set_kind(id, ALARM_KIND_EVERYDAY);
prv_assert_alarm_config(id,... |
EST:
text_layer_set_text(msg_text_layer, "Addr Bus Test");
break;
case FLASH_TEST_CASE_RUN_STRESS_ADDR_TEST:
text_layer_set_text(msg_text_layer, "Stress Addr Test");
break;
case FLASH_TEST_CASE_RUN_PERF_DATA_TEST:
text_layer_set_text(msg_text_layer, "Perf Data Test");
break;
... | {
PBL_LOG(LOG_LEVEL_DEBUG, ">>>>>FAILED TEST CASE<<<<<");
data->test_case_status = FLASH_TEST_STATUS_FAILED;
} |
update_test_case_status(data);
}
static void select_click_handler(ClickRecognizerRef recognizer, void *unusued) {
struct FlashTestData *data = app_state_get_user_data();
if ((data->test_case == FLASH_TEST_CASE_RUN_STRESS_ADDR_TEST) && (data->test_case_status == FLASH_TEST_STATUS_RUNNING)) {
data->test_cas... |
false /* is_next */);
memset(&s_font_info, 0, sizeof(s_font_info));
resource_init();
fb = malloc(sizeof(FrameBuffer));
framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS});
test_graphics_context_init(&s_ctx, fb);
framebuffer_clear(fb);
}
void test_emoji_fonts__cleanup(... | (RESOURCE_ID_GOTHIC_18_EMOJI) | |
ggregate_averaged(
HealthMetricHeartRateBPM, end_time - ranges[i].seconds, end_time, HealthAggregationMin,
HealthServiceTimeScopeOnce);
HealthValue max = health_service_aggregate_averaged(
HealthMetricHeartRateBPM, end_time - ranges[i].seconds, end_time, HealthAggregationMax,
HealthServ... | window_set_background_color(data->sleep_window, GColorBlack) | ;
window_set_user_data(data->sleep_window, data);
window_set_click_config_provider_with_context(data->sleep_window, sleep_click_config_provider,
data);
window_set_window_handlers(data->sleep_window, (WindowHandlers) {
.load = sleep_window_load,
.unload = sle... |
ticks = rtc_get_ticks();
if (curr_ticks < timeout) {
uint16_t wait_time = (timeout - curr_ticks) / RTC_TICKS_HZ;
*secs_to_wait = MAX(1, wait_time);
} else {
*secs_to_wait = 0;
}
}
return state;
}
/*
* LE connection manager handling for a gateway connection
*/
static void prv_bt_le... | (&curr_request->list_node, (ListNode **)&conn_mgr_info->requests, NULL) | ;
kernel_free(curr_request);
}
}
curr_request = next;
}
// Note: As an optimization, we could track how long we have been in a lower
// latency state and subtract that from higher latency requests, but most of
// the time we should be in the maximum latency (low power) state anyway
// ... |
ate required for a remote polling subsystem.
typedef struct {
PollRemoteService service;
//! The minimum interval between two "poll services" requests.
//! Calls to poll_remote_send_request() will be no-ops if min_interval_minutes has not been reached.
uint8_t min_interval_minutes;
//! The maximum interval b... | {
return;
} | |
v_update_hrm_bpm(data);
prv_normalize_data(data);
layer_mark_dirty(&data->base_layer);
}
#if UNITTEST
T_STATIC void prv_set_data(KickstartData *data, int32_t current_steps,
int32_t typical_steps, int32_t daily_steps_avg, int32_t current_bpm) {
data->current_steps = current_steps;
dat... | window_set_window_handlers(&data->window, &(WindowHandlers) {
.load = prv_window_load_handler,
.unload = prv_window_unload_handler,
}) | ;
app_window_stack_push(&data->window, true);
app_event_loop();
window_deinit(&data->window);
i18n_free_all(data);
app_free(data);
}
const PebbleProcessMd* kickstart_get_app_info() {
static const PebbleProcessMdSystem s_app_md = {
.common = {
// UUID: 3af858c3-16cb-4561-91e7-f1ad2df8725f
... |
't get messed up if the mobile changes the
// UTC time on us.
state->hr.last_sample_ts = now_uptime;
// Save the BPM, quality, and update time (UTC) of the last reading for activity_get_metric()
state->hr.metrics.current_bpm = hrm_event->bpm.bpm;
state->hr.metrics.current_quality = hrm_event->bpm.q... | pebble_task_get_current() | |
_send_event(VoiceEventTypeSessionResult, VoiceStatusTimeout, NULL);
mutex_unlock(s_lock);
}
static void prv_session_setup_timeout(void * data) {
mutex_lock(s_lock);
PBL_ASSERTN(s_state == SessionState_StartSession ||
s_state == SessionState_VoiceEndpointSetupReceived ||
s_state == Se... | {
goto unlock;
} |
if (s_state != SessionState_Idle) {
new_timer_stop(s_timeout);
if (s_state == SessionState_StartSession ||
s_state == SessionState_VoiceEndpointSetupReceived ||
s_state == SessionState_AudioEndpointSetupReceived) {
prv_cancel_recording();
} else if (s_state == SessionState_Recordin... |
NDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef UI_DEBUG
#include "ui.h"
#include "applib/ui/app_window_stack.h"
#include "kernel/ui/modals/modal_manager.h"
#include "console/dbgserial.h"
extern void... | (window_get_root_layer(window)) | |
ge);
}
}
bt_unlock();
}
void command_bt_disc_stop(void) {
bt_lock();
{
GAPLEConnection *conn = prv_get_le_connection_and_print_info();
if (conn) {
bt_driver_gatt_stop_discovery(conn);
}
}
bt_unlock();
}
#if BT_CONTROLLER_DA14681
static TimerID s_sleep_test_timer = TIMER_INVALID_ID;
s... | prompt_send_response_fmt(buffer, 32, "Ble Log level: %d", log_level) | ;
}
}
// ARG:
// 0 - Request BLE firmware to coredump
// 1 - Force BLE firmware to hard fault
// 2 - Force the BLE chip to watchdog (by wedging a task)
void command_ble_core_dump(const char *command) {
int option = atoi(command);
if ((option < 0) || (option >= BtleCoreDumpCount)) {
prompt_send_response("Inval... |
ad_parse__initialize(void) {
memset(s_ad_data, 0, sizeof(s_buffer_size));
}
// -----------------------------------------------------------------------------
// Consuming BLEAdData:
// -----------------------------------------------------------------------------
void test_ble_ad_parse__16_bit_uuid_and_device_name(vo... | cl_assert_equal_i(memcmp(expected_scan_resp_data,
ad->data + ad->ad_data_length,
ad->scan_resp_data_length), 0) | |
prv_display_write_byte(line[i]) | ;
}
prv_display_write_byte(0x00);
}
static void prv_display_end_write(void) {
prv_display_write_byte(0x00);
prv_disable_display_access();
}
// Round a bit offset to a byte offset
static unsigned prv_round_to_byte(unsigned x) {
return (x + 7) >> 3;
}
// Draw bitmap onto buffer.
static void prv_draw_bitma... | |
dding(aml);
const int16_t max_visible_height = line_height * MAX_NUM_VISIBLE_LINES;
const GRect *bounds = &aml->layer.bounds;
int16_t total_h = 0;
for (int16_t idx = 0; idx < aml->num_items; idx++) {
int16_t item_height = aml->layout_cache.item_heights[idx];
total_h += MIN(max_visible_height, item_hei... | {
aml->layout_cache.item_heights[idx] = prv_get_item_line_height(aml, idx);
} |
}
#if PBL_ROUND
const bool center_focused = !prv_aml_is_short(aml);
menu_layer_set_center_focused(&aml->menu_layer, center_focused);
#endif
layer_mark_dirty(&aml->layer);
menu_layer_reload_data(&aml->menu_layer);
prv_set_selected_index(aml, selected_index, false /* animated */);
}
// Public API
////////... |
-----------------------INTERRUPT FUNCTIONS--------------------------*/
//! End a transfer and disable further interrupts
//! Only call from interrupt functions
static portBASE_TYPE prv_end_transfer_irq(I2CBus *bus, bool result) {
prv_disable_all_interrupts(bus);
// Generate stop condition
bus->hal->i2c->CR1 |= ... | {
// End transfer after all bytes have been received
i2c->CR2 &= ~I2C_CR2_ITBUFEN;
should_context_switch = prv_end_transfer_irq(bus, true);
break;
} |
break;
case I2CTransferState_WriteData:
i2c->DR = transfer->data[transfer->idx];
transfer->idx++;
if (transfer->idx == transfer->size) {
i2c->CR2 &= ~I2C_CR2_ITBUFEN;
transfer->state = I2CTransferState_EndWrite;
break;
}
break;
case I2CTransferStat... |
{
connection = connection_by_idx(conn_idx);
PBL_ASSERTN(connection);
}
prv_unlock();
return connection;
}
static bool prv_connection_by_address_list_filter_cb(ListNode *found_node, void *data) {
const BTDeviceInternal *desired_addr = (const BTDeviceInternal *)data;
const Connection *connection = (con... | {
return prv_get_flag(connection, ConnectionFlag_ShouldPinAddress);
} |
bool connection_should_auto_accept_re_pairing(const Connection *connection) {
return prv_get_flag(connection, ConnectionFlag_ShouldAutoAcceptRePairing);
}
bool connection_is_reversed_ppogatt_enabled(const Connection *connection) {
return prv_get_flag(connection, ConnectionFlag_IsReversedPPoGATTEnabled);
}
bool ... |
_block(0);
// Call implementation directly instead of executing a script, to avoid mallocs by the VM itself:
extern jerry_value_t rocky_api_graphics_path2d_call_fill(void);
const jerry_value_t error_value = rocky_api_graphics_path2d_call_fill();
ASSERT_JS_ERROR(error_value, "RangeError: Out of memory: too many... | (0, s_rocky_path_steps_num) | ;
EXECUTE_SCRIPT(
"ctx.moveTo(1, 2);\n"
"ctx.closePath();\n"
);
cl_assert_equal_i(1, s_rocky_path_steps_num);
EXECUTE_SCRIPT(
"ctx.lineTo(3, 4);\n"
"ctx.closePath();\n"
);
cl_assert_equal_i(3, s_rocky_path_steps_num);
cl_assert_equal_i(RockyAPIPathStepType_LineTo, s_rocky_path_steps[2].typ... |
ssert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 1);
#endif
}
// ----------------------------------------------------------------------... | cl_assert(animation_get_custom_curve(h) == prv_custom_curve) | ;
// Reverse
cl_assert(animation_get_reverse(h) == false);
animation_set_reverse(h, true);
cl_assert(animation_get_reverse(h) == true);
animation_set_reverse(h, false);
// Position
int32_t elapsed_ms = 0;
AnimationProgress progress = 0;
animation_schedule(h);
cl_must_pass(animation_get_elapsed(h... |
, -56},
{ 1176, 136, 8},
{ 1008, 56, 72},
{ 784, 24, -16},
{ 952, 40, -56},
{ 976, 80, -72},
{ 768, 48, -152},
{ 1192, 56, -120},
{ 936, 40, -96},
{ 744, 120, -184},
{ 984, 224, -408},
{ 1136, 248, -400},
{ 976, 216, -168},
{ 824, 224, -120},
{ 864, 288, -136},
... | // 21 seconds
{ 1152, 112, -72},
{ 984, 96, -72},
{ 792, 72, -80},
{ 920, 88, -152},
{ 920, 40, -168},
{ 760, -16, -224},
{ 968, -64, -88},
{ 880, 0, -208},
{ 1000, 72, -256},
{ 1416, 184, -320},
{ 1232, 216, -192},
{ 808, 160, -88},
{ 792, 224, -120},
{ 904, ... | |
#include "process_management/app_install_manager.h"
#include "services/normal/app_outbox_service.h"
#include "util/math.h"
#include "util/net.h"
extern const SessionSendJobImpl s_app_message_send_job_impl;
extern void comm_session_send_queue_cleanup(CommSession *session);
// Fakes & Stubs
///////////////////////////... | (outbox_data) | ;
outbox_data->session = session;
outbox_data->endpoint_id = endpoint_id;
memcpy(outbox_data->payload, payload, payload_length);
prv_send_outbox_raw_data((const uint8_t *)outbox_data, outbox_data_size);
return outbox_data;
}
static void prv_process_send_queue(CommSession *session) {
cl_assert(session);
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... | (menu_layer) | ;
window_destroy(window);
}
static void s_main(void) {
init();
app_event_loop();
deinit();
}
const PebbleProcessMd* menu_overflow_app_get_info() {
static const PebbleProcessMdSystem s_app_info = {
.common.main_func = &s_main,
.name = "Menu Overflow"
};
return (const PebbleProcessMd*) &s_app_in... |
/*
* 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... | (&timeline_layer->layer) | ;
}
static int16_t prv_prev_rel_bar_getter(void *context) {
TimelineLayer *timeline_layer = context;
return timeline_layer->relbar_layer.prev_rel_bar.anim_offset;
}
static void prv_curr_rel_bar_setter(void *context, int16_t value) {
TimelineLayer *timeline_layer = context;
timeline_layer->relbar_layer.curr_re... |
;
cl_assert(id != BT_BONDING_ID_INVALID);
cl_assert_equal_i(s_ble_bonding_change_add_count, 2);
cl_assert_equal_i(fake_shared_prf_storage_get_ble_store_count(), 2);
// Delete a pairing that doesn't exist. Delete count should stay at 1
bt_persistent_storage_delete_ble_pairing_by_id(9);
cl_assert_equal_i(s_b... | bt_persistent_storage_store_ble_pairing(&pairing, true /* is_gateway */, NULL,
false /* requires_address_pinning */,
false /* auto_accept_re_pairing */) | ;
cl_assert(id2 != BT_BONDING_ID_INVALID);
// Find it
ancs_id = bt_persistent_storage_get_ble_ancs_bonding();
cl_assert_equal_i(ancs_id, id2);
ret = bt_persistent_storage_has_ble_ancs_bonding();
cl_assert(ret);
ret = bt_persistent_storage_is_ble_ancs_bonding(id2);
cl_assert(ret);
}
void test_bluetooth... |
lues.to.grect.origin.x);
result.origin.y = distance_interpolate(
distance_normalized,
property_animation->values.from.grect.origin.y,
property_animation->values.to.grect.origin.y);
result.size.w = distance_interpolate(
distance_normalized,
property_animation->values.from.grect.size.w,
... | (property_animation) | ;
}
void property_animation_legacy2_init_layer_frame(
PropertyAnimationLegacy2 *property_animation, struct Layer *layer,
GRect *from_frame, GRect *to_frame) {
static const PropertyAnimationLegacy2Implementation implementation = {
.base = {
.update = (AnimationLegacy2UpdateImplementation) property_a... |
ARM_KIND_WEEKENDS);
prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule);
}
void test_alarm__alarm_set_recurring_weekdays(void) {
AlarmId id;
id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_EVERYDAY });
prv_assert_alarm_config(id, 3, 14, false, ALARM_K... | (schedule_6, alarm_day_text_6) | |
/*
* 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... | (icon_layer) | |
is only recomputed every few minutes in order to reduce overhead and
// is done so from prv_minute_system_task_cb()
ActivityScalarStore prev_steps = s_activity_state.step_data.steps;
mutex_lock_recursive(s_activity_state.mutex);
{
activity_algorithm_get_steps(&s_activity_state.step_data.steps);
// Are... | prv_heart_rate_init() | ;
}
// Set the user data
ActivityGender gender = activity_prefs_get_gender();
uint16_t weight_dag = activity_prefs_get_weight_dag();
uint16_t height_mm = activity_prefs_get_height_mm();
uint8_t age_years = activity_prefs_get_age_years();
activity_algorithm_set_user(height_mm,
... |
{ 0, 0x7a, 0, 152},
{ 0, 0x7a, 0, 151},
// 600: Local time: 09:14:00 AM
{ 0, 0x2a, 1677, 147},
{ 0, 0x1a, 0, 148},
{ 0, 0x1a, 0, 148},
{ 0, 0x1a, 288, 151},
{ 0, 0x1b, 0, 153},
{ 12, 0x6b, 1539, 191},
{ 0, 0x6b, 0, 193},
{ 0, 0x6b, 0, 196},
{ 0, 0x6b, 0, 194},
{ 0, 0x6b, ... | { 16, 0x44, 4464, 173},
{ 36, 0x54, 3933, 184},
{ 65, 0x65, 4083, 220},
{ 108, 0x54, 3226, 211},
{ 108, 0x54, 3635, 222},
// 720: Local time: 11:14:00 AM
{ 107, 0x54, 3315, 233},
{ 98, 0x54, 3894, 210},
{ 110, 0x54, 4339, 228},
{ 106, 0x54, 3250, 227},
{ 23, 0x54, 1210, 167},... |
{ 0, 0x63, 692, 218},
{ 0, 0x66, 33, 219},
{ 0, 0x66, 29, 221},
{ 0, 0x65, 1002, 231},
{ 17, 0x64, 5729, 243},
{ 0, 0x51, 2757, 238},
{ 0, 0x61, 4162, 242},
{ 0, 0x61, 230, 218},
{ 0, 0x62, 4059, 237},
{ 0, 0x65, 4225, 239},
{ 0, 0x66, 2389, 237},
{ 0, 0x66, 1088, 233},
... |
activity_raw_sample_collection(false, true, &enabled, &session_id, &num_samples, &seconds);
cl_assert(!enabled);
cl_assert_equal_i(num_samples, k_raw_samples);
cl_assert_equal_i(seconds,
(k_raw_samples + ALGORITHM_SAMPLING_RATE - 1) / ALGORITHM_SAMPLING_RATE);
// Verify the c... | rtc_get_time() | - ((ALG_MINUTES_PER_FILE_RECORD * 2) * SECONDS_PER_MINUTE);
const time_t exp_utc_start = utc_start;
stub_pebble_tasks_set_current(PebbleTask_App);
uint32_t num_records = exp_num_records;
activity_get_minute_history(minutes, &num_records, &utc_start);
cl_assert_equal_i(num_records, exp_num_records);
cl_ass... |
/*
* 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... | (notification) | ;
}
static void prv_handle_ancs_update(TimelineItem *notification,
CommonTimelineItemHeader *existing_header) {
if (existing_header->dismissed) {
// this should be dismissed from iOS. Dismiss it again
PBL_LOG(LOG_LEVEL_DEBUG,
"ANCS notification already dismissed... |
eap *heap = app_state_get_heap();
void *mem = heap_zalloc(heap, bytes, saved_lr);
if (!mem && bytes != 0) {
PBL_CROAK_OOM(bytes, saved_lr, heap);
}
return mem;
}
void *app_calloc(size_t count, size_t size) {
register uintptr_t lr __asm("lr");
uintptr_t saved_lr = lr;
return (heap_calloc(app_state_g... | (task_heap_get_for_current_task(), count, size, saved_lr) | ;
}
|
ost_message) {
if (argc < 1) {
return rocky_error_arguments_missing();
}
const jerry_value_t js_msg = argv[0];
JS_VAR json_string = prv_json_stringify(js_msg);
if (jerry_value_has_error_flag(json_string)) {
return jerry_acquire_value(json_string);
}
if (jerry_value_is_undefined(json_string)) {
... | rocky_util_call_user_function_and_log_uncaught_error(handler, jerry_create_undefined(),
&event, 1) | |
================================================================
// Measurement logging stubs
ProtobufLogRef protobuf_log_hr_create(void) {
return (ProtobufLogRef)1;
}
bool protobuf_log_session_delete(ProtobufLogRef session) {
return true;
}
bool protobuf_log_hr_add_sample(ProtobufLogRef ref, time_t now_utc, uint... | for (int i = 0; i < num_sessions; i++) {
printf("\nFound: type: %d, start_utc: %d, len: %"PRIu16", steps: %"PRIu16", "
"rest_cal: %"PRIu32", active_cal: %"PRIu32", dist: %"PRIu32" ",
(int)sessions[i].type, (int)sessions[i].start_utc, sessions[i].length_min,
sessions[i].step_... |
printf("\nLooking for: type: %d, start_utc: %d, len: %"PRIu16", steps: %"PRIu16", "
"rest_cal: %"PRIu32", active_cal: %"PRIu32", dist: %"PRIu32" ",
(int)exp_session->type, (int)exp_session->start_utc,
exp_session->length_min, exp_session->step_data.steps,
exp_session->step_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... | if (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET) {
PBL_LOG(LOG_LEVEL_ERROR, "LSE oscillator did not start");
} |
}
}
bool clocksource_is_lse_started(void) {
return (RCC_GetFlagStatus(RCC_FLAG_LSERDY) != RESET);
}
void clocksource_MCO1_enable(bool on) {
static int8_t s_refcount = 0;
portENTER_CRITICAL();
PBL_ASSERTN(BOARD_CONFIG_MCO1.output_enabled);
if (on) {
gpio_af_init(
&BOARD_CONFIG_MCO1.af_cfg, G... |
"draw_round_rect_offset_r4_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 1);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw1_clip_xy.${BIT_DEPTH... | (&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, false, 11) | ;
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw11_no_clip.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 11);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_R... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | kernel_free(contact) | ;
return NULL;
}
contact->id = serialized_contact->uuid;
contact->flags = serialized_contact->flags;
return contact;
}
Contact* contacts_get_contact_by_uuid(const Uuid *uuid) {
SerializedContact *serialized_contact = NULL;
const int serialized_contact_data_len = contacts_db_get_serialized_contact(uuid... |
or_characteristic(event->object_ref);
if (!client) {
// Read responses still need to be consumed, even if the client has disappeared:
if (event->subtype == PebbleBLEGATTClientEventTypeCharacteristicRead && event->value_length) {
gatt_client_consume_read_response(event->object_ref,
... | gap_le_connect_connect_by_bonding(gateway_bonding, true /* auto_reconnect */,
true /* is_pairing_required */, GAPLEClientKernel) | ;
}
// -------------------------------------------------------------------------------------------------
static void prv_cancel_connect_gateway_bonding(BTBondingID gateway_bonding) {
gap_le_slave_reconnect_stop();
// FIXME: Redundant? since gap_le_connect will also clean up?
gap_le_connect_cancel_by_bonding(gate... |
/*
* 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, "Pointer %p not in app or microflash region", string) | ;
syscall_failed();
}
syscall_assert_userspace_buffer(buffer, length);
}
i18n_get_with_buffer(string, buffer, length);
}
DEFINE_SYSCALL(size_t, sys_i18n_get_length, const char *string) {
if (PRIVILEGE_WAS_ELEVATED) {
if (pebble_task_get_current() == PebbleTask_Worker) {
// not allowed fr... |
/*
* 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... | RCC_RTCCLKCmd(ENABLE) | ;
RTC_WaitForSynchro();
return true;
}
// Before entering standby we set the RTC to it's default time (Jan 1, 2000)
// here we calculate the seconds elapsed since then
static int32_t prv_seconds_since_standby(void) {
// This function assumes the RTC is running in slow mode
RTC_TimeTypeDef rtc_time;
RTC_GetT... |
/*
* 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... | window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler) | ;
window_single_click_subscribe(BUTTON_ID_UP, up_click_handler);
window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler);
}
static uint32_t s_seconds_count;
void handle_second_tick(struct tm *tick_time, TimeUnits units_changed) {
bool running = app_worker_is_running();
if (false) {
const char* ... |
se BTLETestStep_BTStart:
bt_test_start();
break;
case BTLETestStep_BTEnd:
bt_test_stop();
break;
case BTLETestStep_BTLETransmitStart:
if (data->is_unmodulated_cw_enabled) {
bt_driver_start_unmodulated_tx(data->channel);
wait_for_result = false;
} else {
... | (data->hrm_session) | ;
#endif
#if CAPABILITY_HAS_MICROPHONE
prv_stop_mic_and_cleanup(data);
#endif
if (failed) {
snprintf(data->status_string, STATUS_STRING_LENGTH, "Test Failed");
app_window_stack_push(&data->status_window, true);
}
}
static bool prv_test_is_running(AppData *data) {
return (data->current_test_step != BTL... |
/*
* 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... | menu_layer_reload_data(menu_layer) | ;
break;
}
case 2: {
int num_beers = persist_read_int(COUNT_PKEY);
persist_write_int(COUNT_PKEY, num_beers-1);
menu_layer_reload_data(menu_layer);
break;
}
}
}
static void select_long_callback(MenuLayer *menu_layer, MenuIndex *cell_index, AppData *data) {
(void)menu_layer;... |
destroy_list(&dismiss_action_attr_list);
attribute_list_destroy_list(&open_app_action_attr_list);
return item;
}
// ------------------------------------------------------------------------------------------------
static TimelineItem *prv_create_day_4_insight(time_t notif_time) {
if (activity_prefs_get_health_ap... | timeline_item_create_with_attributes(notif_time, 0,
TimelineItemTypeNotification,
LayoutIdNotification, ¬if_attr_list,
&action_group) | ;
i18n_free_all(¬if_attr_list);
attribute_list_destroy_list(¬if_attr_list);
attribute_list_destroy_list(&dismiss_action_attr_list);
attribute_list_destroy_list(&open_app_action_attr_list);
return item;
}
// -----------------------------------------------------------------------------------------------... |
dow_with_progress(data, icon, msg, success)) {
prv_cleanup_action_result(data, success);
}
}
typedef struct {
TimelineItem *item;
void *event_ref;
bool standalone_action;
} ChainingWindowCBData;
static void prv_cleanup_chaining_action_menu(void *context) {
ChainingWindowCBData *data = context;
timelin... | prv_cleanup_action_result(data, true /* succeeded */) | ;
}
static void prv_action_handle_response(PebbleEvent *e, void *context) {
ActionResultData *data = (ActionResultData *)context;
if (e->sys_notification.type != NotificationActionResult) {
// Not what we want
return;
}
PebbleSysNotificationActionResult *action_result = e->sys_notification.action_res... |
window && !window->is_transparent);
}
static bool prv_has_focusable_window(ModalContext *context) {
Window *window = window_stack_get_top_window(&context->window_stack);
return (window && !window->is_unfocusable);
}
static bool prv_has_visible_focusable_window(ModalContext *context, void *unused) {
return (prv_... | compositor_transition(prv_get_compositor_transition(false /* modal_is_destination */)) | ;
}
static void prv_handle_app_to_modal_transition_hidden_and_unfocused(void) {
#if !RECOVERY_FW && !SHELL_SDK
app_idle_timeout_pause();
#endif
}
static void prv_handle_modal_to_app_transition_hidden_and_unfocused(void) {
#if !RECOVERY_FW && !SHELL_SDK
app_idle_timeout_resume();
#endif
}
static void prv_handle_a... |
-----------
static void prv_send_bytes(void *p, uint32_t size) {
uint8_t *src = (uint8_t *)p;
for (uint32_t i=0; i<size; i++) {
qemu_test_add_byte_from_isr(&s_state, *src++);
}
}
// ------------------------------------------------------------------------------------
static void prv_send_hdr(uint16_t protoco... | cl_assert(!qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &rcv_protocol)) | |
struct AppInboxNode {
ListNode node;
AppInboxServiceTag tag;
AppInboxMessageHandler message_handler;
AppInboxDroppedHandler dropped_handler;
PebbleTask event_handler_task;
//! Indicates whether there is a writer.
//! The writer can set it to anything they want, mostly for debugging purposes.
void *writ... | (LOG_LEVEL_ERROR, "AppInbox event handlers not allowed <0x%"PRIx32", 0x%"PRIx32">",
// Ugh.. no more format signature slots free for %p %p...
(uint32_t)(uintptr_t)message_handler, (uint32_t)(uintptr_t)dropped_handler) | |
t_equal_i(4, string_list_count(list));
cl_assert_equal_s("", string_list_get_at(list, 0));
cl_assert_equal_s("", string_list_get_at(list, 1));
cl_assert_equal_s("", string_list_get_at(list, 2));
cl_assert_equal_s("", string_list_get_at(list, 3));
// non-null-terminated string is treated as one string - this ... | timeline_item_find_action_with_id(&item, 3) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.