prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
_size > RESOURCE_MAX_SIZE) {
APP_LOG(APP_LOG_LEVEL_ERROR, "Published icon size %zuB > %dB max", resource_size,
RESOURCE_MAX_SIZE);
is_valid = false;
}
}
kino_reel_destroy(reel);
return is_valid;
}
T_STATIC bool prv_validate_lut(ResAppNum res_app_num) {
uint32_t data_signature;
... | if (timeline_resources_is_system(timeline_res->res_id) || uuid_is_system(timeline_res->app_id)) {
if (!prv_get_sys_resource(timeline_res->res_id, size, res_info_out)) {
goto fail;
}
if (res_info_out->res_id == RESOURCE_ID_INVALID) {
goto fail;
}
} else {
const AppInstallId install_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... | ("Battery Status") | );
Dialog *new_dialog = simple_dialog_get_dialog(new_simple_dialog);
dialog_set_callbacks(new_dialog, &(DialogCallbacks) {
.unload = prv_dialog_on_unload,
}, NULL);
update_fn(new_dialog, data);
Dialog *old_dialog = s_dialog;
s_dialog = new_dialog;
simple_dialog_push(new_simple_dialog, stack);
#if P... |
olorBlue,
.path_open = false,
.num_points = 2,
};
GPoint points[] = {{ 3, 97 }, {5, 5} };
memcpy(command->points, points, sizeof(points));
gdraw_command_draw(NULL, command);
cl_assert_equal_i(s_stroke_color.argb, GColorRedARGB8);
cl_assert_equal_i(s_fill_color.argb, GColorBlueARGB8);
cl_assert_eq... | (prv_compare_points(points2, s_stroke_points, s_path_num_points)) | ;
cl_assert(prv_compare_points(points2, s_fill_points, s_path_num_points));
prv_reset();
// set path to be open
gdraw_command_set_path_open(command, true);
gdraw_command_draw(NULL, command);
cl_assert_equal_i(s_stroke_color.argb, GColorPurpleARGB8);
cl_assert_equal_i(s_fill_color.argb, GColorGreenARGB8);... |
;
setup_test(&context, false, 1, GColorBlack, GColorBlack, false);
graphics_draw_rect(&context, &GRect(10, 20, 40, 10));
ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10)));
setup_test(&context, false, 1, GColorBlack, GColorBlack, false);
graphics_draw_circle(&context, GPoint(50, 50), 10);
ASSE... | setup_test(&context, true, 2, GColorBlack, GColorBlack, false) | ;
graphics_draw_rect(&context, &GRect(10, 20, 40, 10));
ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10)));
setup_test(&context, true, 2, GColorBlack, GColorBlack, false);
graphics_draw_circle(&context, GPoint(50, 50), 10);
#if PBL_COLOR
ASSERT_CALLED(graphics_circle_draw_stroked_aa(&context, GPo... |
iptionIndications,
GAPLEClientApp);
cl_assert_equal_i(e, BTErrnoOK);
// Simulate getting confirmation from remote:
prv_confirm_cccd_write(BLEGATTErrorSuccess);
fake_event_clear_last();
// We had a bug at some point where the header size was not taken into ac... | cl_assert_equal_i(e, BTErrnoOK) | |
/*
* 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... | memchr(s, c, n) | ;
}
char *strrchr(const char *s, int c) {
char ch = (char)c;
size_t i = strlen(s);
do {
if (s[i] == ch) {
return (char*)&s[i];
}
} while (i--);
return NULL;
}
|
, &client), 0);
}
void test_shared_circular_buffer__subsampling_2of5(void) {
SharedCircularBuffer buffer;
uint16_t item_size = 2;
uint8_t storage[12*item_size];
uint8_t out_buffer[12*item_size];
uint16_t items_read;
shared_circular_buffer_init(&buffer, storage, sizeof(storage));
SubsampledSharedCircula... | shared_circular_buffer_read_subsampled(
&buffer, &client, item_size, out_buffer, 3) | , 3);
// Normally the next read would skip 5f, but changing the ratio resets the
// subsampling state and the first sample after resetting the state is never
// skipped.
cl_assert_equal_m(out_buffer, "5f7h8i", 6);
}
void test_shared_circular_buffer__subsampling_set_ratio_is_idempotent(void) {
SharedCircular... |
d_lr = lr;
QueueHandle_t queue = event_get_to_kernel_queue(task);
prv_event_put(queue, "from app", saved_lr, event);
}
bool event_try_put_from_process(PebbleTask task, PebbleEvent* event) {
QueueHandle_t queue = event_get_to_kernel_queue(task);
return prv_try_event_put(queue, event);
}
bool event_take_timeou... | return (void **)&event->timeline_peek.item_id;
default:
break; // Nothing to do!
} | |
en);
if (rv == S_SUCCESS) {
char buffer[key_len + 1];
strncpy(buffer, (const char *)key, key_len);
buffer[key_len] = '\0';
PBL_LOG(LOG_LEVEL_INFO, "iOS notif pref insert <%s>", buffer);
// All records inserted from the phone are not dirty (the phone is the source of truth)
rv = settings_file_... | prompt_send_response("") | ;
return true;
}
void command_dump_notif_pref_db(void) {
SettingsFile file;
if (S_SUCCESS != prv_file_open_and_lock(&file)) {
return;
}
settings_file_each(&file, prv_print_notif_pref_db, NULL);
prv_file_close_and_unlock(&file);
}
|
static void prv_internal_write_cccd_response_cb(GattClientOpResponseHdr *event) {
const GattClientEventContext *data = event->context;
const BLEDescriptor cccd = data->obj_ref;
const BLEGATTError error = event->error_code;
gatt_client_subscriptions_handle_write_cccd_response(cccd, error);
}
static BLEGATTErro... | kernel_zalloc(sizeof(GattClientEventContext)) | |
/*
* 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... | gdraw_command_list_scale_segmented_to(
list, size, intermediate, *to, second_normalized, data->interpolate, index_lookup,
data->point_duration, two_stage) | ;
const AnimationProgress stroke_width_progress = data->stroke_width.curve ?
data->stroke_width.curve(normalized) :
animation_timing_curve(normalized, AnimationCurveEaseInOut);
gdraw_command_list_scale_stroke_width(
list, data->stroke_width.from, data->stroke_width.to,
data->stroke_width.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... | {
case GBitmapFormat1Bit:
case GBitmapFormat8Bit:
case GBitmapFormat8BitCircular:
return 0;
default:
return (1 << gbitmap_get_bits_per_pixel(format));
} |
return 0;
}
uint16_t gbitmap_format_get_row_size_bytes(int16_t width, GBitmapFormat format) {
switch (format) {
case GBitmapFormat1Bit:
return ((width + 31) / 32 ) * 4; // word aligned bytes
case GBitmapFormat8Bit:
return width;
case GBitmapFormat1BitPalette:
case GBitmapFormat2BitPal... |
, &zone2_minutes);
cl_assert_equal_i(zone2_minutes, 2);
activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes);
cl_assert_equal_i(zone3_minutes, 2);
// Advance to a new day. The HR zone stats should get reset
time_t utc_sec = rtc_get_time();
utc_sec += SECONDS_PER_DAY;
rtc_set_time(u... | cl_assert_equal_m(&activity_private_state()->activity_sessions[0], &empty_session,
sizeof(ActivitySession)) | ;
// Add 3 sessions and delete from the middle
ActivitySession a1 = walk_activity;
a1.start_utc = 1;
ActivitySession a2 = walk_activity;
a2.start_utc = 2;
ActivitySession a3 = walk_activity;
a3.start_utc = 3;
activity_sessions_prv_add_activity_session(&a1);
activity_sessions_prv_add_activity_session... |
/*
* 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... | i18n_noop("Low") | ,
i18n_noop("Medium"),
i18n_noop("High"),
i18n_noop("Blinding")
};
#define BACKLIGHT_SCALE_GRANULARITY 5
// Normalize the result from light get brightness as it sometimes
// will round down/up by a %
static uint8_t prv_get_scaled_brightness(void) {
return BACKLIGHT_SCALE_GRANULARITY
* ((backligh... |
prv_get_range_and_daily_history(state, metric, time_start, time_end, &time_range,
&daily_history);
if (accessible != HealthServiceAccessibilityMaskAvailable) {
return accessible;
}
for (size_t i = 0; i < time_range.num_days; i++) {
if (daily_history.totals[time_ran... | {
// We don't allow the user to gather data from raw HR samples. Only return the current and
// return. If time_start and time_end were not for the current time, they are filtered out
// by the function above `prv_metric_aggregation_implemented`.
int32_t raw_bpm;
sys_activity_get_metric(ActivityMetr... | |
/*
* 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... | i18n_ctx_noop("NotifVibe", "Medium") | ,
i18n_ctx_noop("NotifVibe", "High")
};
static void prv_vibe_menu_select(OptionMenu *option_menu, int selection, void *context) {
const bool enable_vibration = (selection != 0);
const VibeIntensity new_vibe_intensity = enable_vibration ? (selection - INTENSITY_ROW_OFFSET) :
... |
/*
* 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... | {
AppData *data = (AppData*) app_malloc(sizeof(AppData));
app_state_set_user_data(data);
window_init(&data->window, WINDOW_NAME("Double Tap Test"));
window_set_user_data(&data->window, data);
window_set_window_handlers(&data->window, &(WindowHandlers) {
.load = prv_window_load });
const bool animat... |
static void prv_handle_deinit(void) {
AppData *data = app_state_get_user_data();
app_free(data);
}
static void s_main(void) {
prv_handle_init();
app_event_loop();
prv_handle_deinit();
}
const PebbleProcessMd* double_tap_test_get_info() {
static const PebbleProcessMdSystem s_accel_config_info = {
.... |
EMPERATURE_DEVICE;
// Temperature sensor
// STM32F412 datasheet rev 2
// Section 6.3.21
TemperatureSensor const TEMPERATURE_SENSOR_DEVICE = {
.voltage_monitor = &VOLTAGE_MONITOR_TEMPERATURE_DEVICE,
.millivolts_ref = 760,
.millidegrees_ref = 25000,
.slope_numerator = 5,
.slope_denominator = 2000,
};
Temperat... | (&I2C_PMIC_HRM_BUS) | ;
voltage_monitor_device_init(VOLTAGE_MONITOR_ALS);
voltage_monitor_device_init(VOLTAGE_MONITOR_BATTERY);
qspi_init(QSPI, BOARD_NOR_FLASH_SIZE);
}
|
NINITIALIZED");
// Forward declarations
static bool prv_realloc_storage(DataLoggingSession *session, uint32_t new_size);
static bool prv_get_session_file(DataLoggingSession *session, uint32_t space_needed);
static void prv_release_session_file(DataLoggingSession *session);
// ----------------------------------------... | {
*size_p += prv_pfs_get_file_size(session->storage.fd);
prv_release_session_file(session);
} |
}
return true;
}
// ----------------------------------------------------------------------------------------
// Get total amount of space we have allocated from the file system. This is the sum of the
// file sizes of all the DLS files.
static uint32_t prv_get_total_file_system_bytes(void) {
uint32_t size = 0;... |
if (click_recognizer_is_repeating(recognizer)) {
// Don't animate if the button is being held down. Just update the text
SelectionLayerIncrementCallback func = (is_up)
? selection_layer->callbacks.increment
: select... | {
if (selection_layer) {
selection_layer->font = font;
}
} |
void selection_layer_set_inactive_bg_color(SelectionLayer *selection_layer, GColor color) {
if (selection_layer) {
selection_layer->inactive_background_color = color;
}
}
void selection_layer_set_active_bg_color(SelectionLayer *selection_layer, GColor color) {
if (selection_layer) {
selection_layer->ac... |
,
};
time_selection_window_configure(&data->time_picker_window, &config);
// Reset the selection layer to the first cell
data->time_picker_window.selection_layer.selected_cell_idx = 0;
}
static void prv_time_picker_complete(TimeSelectionWindowData *time_picker_window, void *cb_data) {
AlarmEditorData *data =... | prv_setup_type_menu_window(data) | ;
return &data->alarm_type_menu->window;
#else
return &data->time_picker_window.window;
#endif
}
void alarm_editor_update_alarm_time(AlarmId alarm_id, AlarmType alarm_type,
AlarmEditorCompleteCallback complete_callback,
void *callback_context)... |
icensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed unde... | PBL_LOG(LOG_LEVEL_ERROR, "Unknown server <%p> disconnected", implementation) | ;
}
}
if (change_type != None) {
// Upon connect and disconnect, reset the cached data:
music_update_player_volume_percent(0);
// Taking short-cut here, music_update_now_playing already puts NowPlayingChanged event, no
// need to put it again by calling music_update_player_name:
s_music_ct... |
/*
* 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_ASSERTN(s_erase_state.next_erase_addr <= s_erase_state.end_addr) | ;
flash_erase_subsector(addr, prv_async_erase_done_cb, NULL);
}
}
void flash_erase_optimal_range(
uint32_t min_start, uint32_t max_start, uint32_t min_end, uint32_t max_end,
FlashOperationCompleteCb on_complete, void *context) {
PBL_ASSERTN(((min_start & (~SUBSECTOR_ADDR_MASK)) == 0) &&
(... |
ustom_actionable_dialog(DialogsData *data) {
ActionableDialog *actionable_dialog = actionable_dialog_create("Custom Actionable Dialog");
Dialog *dialog = actionable_dialog_get_dialog(actionable_dialog);
dialog_set_text(dialog, "Custom Actionable Dialog");
dialog_set_background_color(dialog, GColorRed);
dialog... | dialog_set_text(dialog, data->lorem_ipsum) | ;
dialog_set_background_color(dialog, GColorLightGray);
dialog_set_icon(dialog, data->resource_id_25);
dialog_show_status_bar_layer(dialog, true);
expandable_dialog_show_action_bar(expandable_dialog, false);
expandable_dialog_set_header(expandable_dialog, "Header");
app_expandable_dialog_push(expandable_di... |
ad, (ListNode *)nodes[i],
prv_time_comparator, true);
}
}
static bool prv_each(SettingsFile *file, SettingsRecordInfo *info, void *context) {
// check entry is valid
if (info->key_len != UUID_SIZE || info->val_len == 0) {
return true; // continue iteration
}
TimelineNode **list_head = context;
... | (timeline_iter_state->node, timeline_iter_state->start_time,
timeline_iter_state->midnight, timeline_iter_state->direction,
timeline_iter_state->show_all_day_events) | |
/*
* 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... | IHEX_RECORD_LENGTH(2) | |
/*
* 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, sys_profiler_stop, void) | {
profiler_stop();
}
DEFINE_SYSCALL(void, sys_profiler_print_stats, void) {
profiler_print_stats();
}
DEFINE_SYSCALL(void, sys_profiler_node_start, ProfilerNode *node) {
if (PRIVILEGE_WAS_ELEVATED) {
if (!list_contains(g_profiler.nodes, (ListNode *)node)) {
// Instead of calling syscall_failed(), sim... |
/*
* 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;
} | |
/*
* 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... | (
CHARGER_DISCONNECT_TIMEOUT_MS, prv_power_off_timer_expired, NULL) | ;
}
DialogState next_dialog_state = DialogState_Uninitialized;
if (charge.is_charging) {
next_dialog_state = DialogState_Charging;
} else if (charge.is_plugged) {
next_dialog_state = DialogState_FullyCharged;
} else {
// Unplugged. We'll be shutting down in a couple seconds if the user doesn't
... |
scrollable_metrics(data);
}
break;
}
case SPORTS_CUSTOM_VALUE_KEY:
{
if (strncmp(new_tuple->value->cstring,
data->custom_value_string,
sizeof(data->custom_value_string)) != 0) {
strncpy(data->custom_value_string,
new_tuple->value-... | (SPORTS_CUSTOM_LABEL_KEY, "") | ,
TupletCString(SPORTS_CUSTOM_VALUE_KEY, "")
};
app_sync_init(&data->sync, data->sync_buffer, sizeof(data->sync_buffer), initial_values,
ARRAY_LENGTH(initial_values), prv_sync_tuple_changed_callback,
prv_sync_error_callback, data);
data->workout_controller = (WorkoutControlle... |
);
}
static void prv_inactive_timer_refresh(TimelineAppData *data) {
static const uint32_t INACTIVITY_TIMEOUT_MS = 30 * 1000;
s_app_data->inactive_timer_id = evented_timer_register_or_reschedule(
s_app_data->inactive_timer_id, INACTIVITY_TIMEOUT_MS, prv_inactive_timer_callack, data);
}
/////////////////////... | animation_unschedule(data->current_animation) | ;
data->current_animation = NULL;
timeline_layer_reset(timeline_layer);
if (timeline_model_is_empty() &&
prv_set_state(data, TimelineAppStateNoEvents)) {
// Hide layouts and animate to "No events"
timeline_layer_set_layouts_hidden(&data->timeline_layer, true);
prv_init_peek_layer(data);
pr... |
Also see ECMA 5.1 -- 10.4.2 Entering Eval Code.
var indirectEval = eval;
try {
return __jerryRefs.ref(indirectEval(Module.Pointer_stringify($0, $1)));
} catch (e) {
var error_ref = __jerryRefs.ref(e);
__jerryRefs.setError(error_ref, true);
return error_ref;
}
... | jerry_get_utf8_string_size(value) | ;
if (str_size == 0 || buffer_size < str_size || buffer_p == NULL) {
return 0;
}
EM_ASM_INT({
var str = __jerryRefs.get($0);
// Add one onto the buffer size, since Module.stringToUTF8 adds a null
// character at the end. This will lead to truncation if we just use
// buffer_size. Sinc... |
/*
* 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... | {
// Hide the up arrow as we've reached the top.
action_bar_layer_clear_icon(action_bar, BUTTON_ID_UP);
} | |
{
.filename_part = "quads_right",
.mask = GCornersRight,
},
{
.filename_part = "quads_left",
.mask = GCornersLeft,
},
};
// note: not the prettiest, fast a quick way to render all the scenarios Nitin was interested in
for (int i = 0; i < ARRAY_LENGTH(test... | (&ctx.dest_bitmap, "draw_circle_r0_swX_color.8bit.pbi") | );
}
void test_graphics_draw_circle_8bit__zero_aa_swX_color(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// Draw red circles with different alpha values in the stroke color with antialiasing enabled
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 0);
graphics_conte... |
bed_to_connection_status_notifications(const Connection *connection) {
return prv_get_flag(connection, ConnectionFlag_IsSubscribedToConnectionStatusNotifications);
}
bool connection_should_pin_address(const Connection *connection) {
return prv_get_flag(connection, ConnectionFlag_ShouldPinAddress);
}
bool connecti... | connection_is_valid(connection) | ) {
connection->conn_params = *params;
}
}
prv_unlock();
}
void connection_update_address(Connection *connection, const BTDeviceInternal *updated_addr) {
prv_lock();
{
if (connection_is_valid(connection)) {
connection->updated_addr = *updated_addr;
connection->has_updated_addr = true;... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&s_last_bt_persist_pinned_addr, 0xff, sizeof(s_last_bt_persist_pinned_addr)) | ;
memset(&s_last_driver_addr, 0xff, sizeof(s_last_driver_addr));
s_last_bt_persist_pinned_addr_is_null = false;
s_last_driver_allow_cycling = false;
s_last_driver_addr_is_null = false;
}
void test_local_addr__cleanup(void) {
}
void test_local_addr__init_generates_pinned_address_if_needed(void) {
prv_init_no... |
* 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 implied.
* See... | (QemuProtocol_SPP, sizeof(msg_data)) | ;
cl_assert(!qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &rcv_protocol));
prv_send_bytes(msg_data, sizeof(msg_data));
cl_assert(qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &rcv_protocol));
prv_send_footer();
cl_assert(!qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &r... |
}
static inline void prv_unlock(void) {
mutex_unlock(s_mutex);
}
#define PERSIST_FILE_NAME_MAX_LENGTH sizeof("ps000001")
static status_t prv_get_file_name(char *name, size_t buf_len, const Uuid *uuid) {
// Firmware 2.x persist files are named "p%06d", the added "s" in the file
// name prefix indicates that it... | prv_find_open_store(uuid) | |
, "not subscribed");
goto unlock;
}
result = state->num_samples;
*timestamp_ms = state->timestamp_ms;
}
unlock:
mutex_unlock_recursive(s_mutex);
return result;
}
// ---------------------------------------------------------------------------------------------
DEFINE_SYSCALL(bool, sys_accel_mana... | PBL_ASSERTN(s_tap_subscribers_count > 0) | ;
if (--s_tap_subscribers_count == 0 && !s_data_subscribers) {
PBL_LOG(LOG_LEVEL_DEBUG, "Stopping accel service");
if (accel_running()) {
accel_stop();
}
}
}
mutex_unlock_recursive(s_mutex);
}
// ------------------------------------------------------------------------------------... |
}
WeatherLocationForecast *forecast_out = task_zalloc_check(sizeof(WeatherLocationForecast));
if (prv_fill_forecast_from_entry(entry, forecast_out)) {
s_default_forecast = forecast_out;
} else {
task_free(forecast_out);
}
free_entry:
task_free(entry);
cleanup:
mutex_unlock(s_mutex);
}
WeatherLoca... | (LOG_LEVEL_WARNING, "No weather support on phone") | |
test_timeline_model__initialize(void) {
fake_spi_flash_init(0, 0x1000000);
fake_rtc_init(0, 0);
pfs_init(false);
// Note: creating a settings file is going to result in one malloc for the FD name
pin_db_init();
time_util_update_timezone(&tz);
fake_pbl_malloc_clear_tracking();
for (unsigned int i = 0; i ... | (&s_items[s_correct_order[5]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id) | );
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(4));
cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(5));
cl_assert(timeline_model_iter_next(&new_idx, &has_next));
cl_assert(!has_next);
cl_assert_equal_i(timeline_m... |
if (connection_should_auto_accept_re_pairing(connection)) {
flags |= BleBondingFlag_ShouldAutoAcceptRePairing;
} |
if (connection_is_reversed_ppogatt_enabled(connection)) {
flags |= BleBondingFlag_IsReversedPPoGATTEnabled;
}
bonding.flags = flags;
dev->flags = flags;
success = true;
} else {
PBL_LOG(LOG_LEVEL_ERROR, "Pairing fail? conn=%p, dev=%p", connection, dev);
}
storage_release();
if... | |
_graphics_draw_circle_${BIT_DEPTH_NAME}__zero_aa_swX_black(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// Draw black circles with different alpha values in the stroke color with antialiasing enabled
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 0);
graphics_conte... | (&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, RADIUS_BIG * 2) | ;
graphics_draw_arc_internal(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG, angle_end, angle_start);
cl_check(framebuffer_is_empty(NULL, ctx.parent_framebuffer, GColorWhite));
// table with most popular angles to test
typedef struct {
char *filename_part;
uint32_t angle;
} TestAngles;
TestAngles test_an... |
ROCKY_ARG(radius2),
ROCKY_ARG_ANGLE(angle_1),
ROCKY_ARG_ANGLE(angle_2),
);
// adjust for coordinate system
center.x.raw_value -= FIXED_S16_3_HALF.raw_value;
center.y.raw_value -= FIXED_S16_3_HALF.raw_value;
radius1.raw_value = MAX(0, radius1.raw_value);
radius2.raw_value = MAX(0, radius2.raw... | {
while (s_canvas_context_2d_stored_states) {
Context2DStoredState *state = s_canvas_context_2d_stored_states;
s_canvas_context_2d_stored_states =
(Context2DStoredState *)s_canvas_context_2d_stored_states->node.next;
task_free(state);
}
rocky_api_graphics_text_deinit();
rocky_api_graphics_path... |
static bool prv_add_handler(const char *event_name, jerry_value_t handler) {
return strcmp(ROCKY_EVENT_DRAW, event_name) == 0;
}
const RockyGlobalAPI GRAPHIC_APIS = {
.init = prv_init_apis,
.deinit = prv_deinit_apis,
.add_handler = prv_add_handler,
};
|
he session now
protobuf_log_session_delete(session_ref);
}
// ---------------------------------------------------------------------------------------------
// Test using the data logging transport
void test_protobuf_log__measurements_with_data_logging(void) {
ProtobufLogMeasurementType types[] = {ProtobufLogMeasur... | (&input, false /*use_data_logging*/, session_ref) | ;
}
|
);
cl_assert(session->start_utc >= container_session->start_utc);
cl_assert(session->start_utc < container_session->start_utc
+ container_session->len_m * SECONDS_PER_MINUTE);
last_deep_session_len_m = session->len_m;
// Accumulate restful sleep stats
r... | (s_kalg_state, 0, kalg_state_size()) | ;
kalg_init(s_kalg_state, prv_stats_cb);
s_num_captured_sleep_sessions = 0;
// Run samples through the activity detector
time_t now = rtc_get_time();
time_t test_start_utc = now;
for (int i = 0; i < entry->num_samples; i++) {
uint16_t vmc = entry->samples[i].v5_fields.vmc;
if (entry... |
,
{ 888, 56, 168},
{ 744, 56, 104},
{ 608, 8, 48},
{ 504, -40, 32},
{ 608, -32, -48},
// 5 seconds
{ 944, 128, -144},
{ 1424, 8, 32},
{ 1704, -16, 288},
{ 1400, 496, -72},
{ 1344, 544, -136},
{ 1296, 464, 80},
{ 1096, 408, 176},
{ 1016, 264, 304},
{ 984, 336, ... | { 1008, 56, -64},
{ 1672, -88, 56},
{ 1952, -48, 432},
{ 1360, 456, -184},
{ 1184, 448, -456},
{ 1144, 272, 40},
{ 1024, 144, 96},
{ 1024, 272, 120},
{ 976, 368, 176},
{ 848, 360, 160},
{ 752, 408, 32},
// 11 seconds
{ 768, 336, 48},
{ 880, 424, -8},
{ 1128, 3... |
{ 1264, 296, 32},
{ 1808, 272, 112},
{ 1728, 368, 96},
{ 960, 304, 104},
{ 1544, 96, -152},
{ 1336, 192, 248},
{ 1248, 88, 160},
{ 1080, 24, 272},
{ 960, 56, 120},
{ 856, 8, 96},
{ 744, 0, 120},
{ 720, -72, 136},
{ 528, -160, 112},
{ 704, -8, -72},
{ 984, 72,... |
/*
* 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... | attribute_list_destroy_list(&dismiss_action_attr_list) | ;
if (!item) {
PBL_LOG(LOG_LEVEL_WARNING, "Failed to welcome the user.");
return;
}
item->header.from_watch = true;
notifications_add_notification(item);
timeline_item_destroy(item);
welcome_set_welcome_version(WelcomeVersionCurrent);
}
void welcome_push_notification(bool factory_reset_or_first_u... |
/*
* 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_m(msg_data, rcv_msg, sizeof(msg_data)) | ;
}
// -----------------------------------------------------------------------------
// Check after each part
prv_send_hdr(QemuProtocol_SPP, sizeof(msg_data));
cl_assert(!qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &rcv_protocol));
prv_send_bytes(msg_data, sizeof(msg_data));
// Message is ... |
ice_max_message_length(AppOutboxServiceTagUnitTest);
s_test_data = kernel_malloc(s_test_data_length);
memset(s_test_data, 0x88, s_test_data_length);
s_num_sent_handler_called = 0;
s_num_app_outbox_events_sent = 0;
s_num_message_handler_calls = 0;
s_last_message = NULL;
stubs_syscall_init();
s_app_stat... | cl_assert_equal_i(s_num_app_outbox_events_sent, 0) | ;
cl_assert_equal_i(s_num_message_handler_calls, i + 1);
cl_assert(s_last_message);
cl_assert_equal_p(s_test_data, s_last_message->data);
cl_assert_equal_i(s_test_data_length, s_last_message->length);
cl_assert_equal_b(false, app_outbox_service_is_message_cancelled(s_last_message));
message[i]... |
.h"
#include "drivers/gpio.h"
#include "drivers/periph_config.h"
#include "drivers/uart.h"
#include "kernel/util/delay.h"
#include "resource/resource.h"
#include "resource/resource_ids.auto.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/math.h"
#include <inttypes.h>
#include <stdint.h>
// T... | {
PBL_LOG(LOG_LEVEL_DEBUG, "Dialog bootrom framing error, continuing onward");
} | |
METER
ecompass_service_handle();
#endif
return;
case PEBBLE_SET_TIME_EVENT:
{
#ifndef RECOVERY_FW
PebbleSetTimeEvent *set_time_info = &e->set_time_info;
// The phone and watch time may be out of sync by a second or two (since
// we don't account for the time it takes for the requ... | (LOG_LEVEL_INFO, "Not launching worker because button held") | ;
} else if (boot_bit_test(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)) {
PBL_LOG(LOG_LEVEL_INFO, "Not launching worker because of 2 strikes");
} else {
process_manager_launch_process(&(ProcessLaunchConfig) {
.id = worker_manager_get_default_install_id(),
.worker = true,
});
}
#endif
notify_syst... |
0 /* offset */,
1 /* length */, &byte_out));
cl_assert_equal_i(TEST_EXPECTED_PP_MSG[i], byte_out);
comm_session_send_queue_consume(s_app_session_ptr, 1 /* length */);
}
assert_consumed(AppMessageSenderErrorSuccess, 1);
cl_assert_equal_i(s_app_instal... | prv_quit_app_after_pp_msg_byte(sizeof(PebbleProtocolHeader) + 1) | ;
}
|
indow_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 window stack
stub_pebble_tasks_set_current(PebbleTask_App);
cl_c... | (app_window_stack_count(), 0) | ;
cl_assert_equal_i(window2->on_screen, false);
window_destroy(window1);
window_destroy(window2);
}
// Description:
// During the push of a window, we push another window in the load handler of
// the window being pushed. This causes the loading window to disappaer from
// the screen (before it even appeared) ... |
shared_prf_storage_set_getting_started_complete(true);
cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), true);
shared_prf_storage_wipe_all();
cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), false);
}
void test_shared_prf_storage_v3__ble_pairing(void) {
shared_prf_stor... | {
cl_assert_equal_b(shared_prf_storage_get_local_device_name(NULL, 0), false);
shared_prf_storage_set_local_device_name(DEVICE_NAME);
char device_name_out[BT_DEVICE_NAME_BUFFER_SIZE];
cl_assert_equal_b(shared_prf_storage_get_local_device_name(device_name_out,
... |
// Test that setting a local_name to NULL will rewrite the field with 0xFF and allow it to
// be rewritten without causing a new page to be written
void test_shared_prf_storage_v3__local_device_name_NULL_new_erased_field(void) {
shared_prf_storage_set_local_device_name(DEVICE_NAME);
char device_name_out[BT_DEVIC... |
BtPersistBondingType type:8;
union PACKED {
BtPersistBondingBTClassicData bt_classic_data;
BtPersistBondingBLEData ble_data;
};
} BtPersistBondingData;
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Settings File
#define BT_PERSISTENT_STORAGE_FI... | {
SettingsFile fd;
status_t rv = settings_file_open(&fd, BT_PERSISTENT_STORAGE_FILE_NAME,
BT_PERSISTENT_STORAGE_FILE_SIZE);
if (rv != S_SUCCESS) {
goto cleanup;
}
data_len = settings_file_get_len(&fd, key, key_len);
// If a big enough buffer wasn't pas... |
cleanup:
prv_unlock();
return data_len;
}
//! @return the value that was read at that key or `default_value` if the key does not exist,
//! or if the stored data has been corrupted.
static bool prv_file_get_bool(const void *key, size_t key_len, bool default_value) {
uint8_t bool_data;
int read_size = prv_file... |
struct Layer *layer, GContext *ctx) {
AppData *data = app_state_get_user_data();
if (data->rendered_frames == 0) {
data->time_started = prv_time_64();
PROFILER_INIT;
PROFILER_START;
}
data->rendered_frames++;
}
static void prv_window_disapper(Window *window) {
}
void prv_syncing_content_offset_cha... | {
AppData *data = app_malloc_check(sizeof(AppData));
memset(data, 0, sizeof(AppData));
app_state_set_user_data(data);
Window *window = &data->window;
window_init(window, WINDOW_NAME("FPS test"));
window_set_user_data(window, data);
window_set_fullscreen(window, true);
layer_set_update_proc(&window->lay... |
const PebbleProcessMd* fps_test_get_app_info(void) {
static const PebbleProcessMdSystem s_app_info = {
.common.main_func = s_main,
.name = "FPS Test"
};
return (const PebbleProcessMd*) &s_app_info;
}
|
= EOF_PERSIST_ID_TAG) {
break;
} else if ((found = callback(&field, data))) {
pfs_seek(fd, -(int)sizeof(field), FSeekCur); // unwind to entry found
break;
}
}
return ((found) ? S_SUCCESS : E_DOES_NOT_EXIST);
}
static int search_map(SearchCallback callback, void *data) {
int fd = prv_pm... | {
PersistMapIdField *out_field = data;
if (uuid_equal(&field->uuid, &out_field->uuid)) {
out_field->id = field->id;
return true;
}
return false;
} |
int persist_map_get_id(const Uuid *uuid) {
PersistMapIdField field = {
.uuid = *uuid,
};
int search_result = search_map(walk_get_id, &field);
if (FAILED(search_result)) {
RETURN_STATUS_UP(search_result);
}
return field.id;
}
int persist_map_auto_id(const Uuid *uuid) {
int id = persist_map_get_i... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (filename, line_number,
(uintptr_t)__builtin_return_address(0), "ASSERT", message, fmt_args) | ;
va_end(fmt_args);
}
NORETURN passert_failed_hashed(uint32_t packed_loghash, ...) {
uintptr_t saved_lr = (uintptr_t) __builtin_return_address(0);
PBL_LOG(LOG_LEVEL_ALWAYS, "ASSERTION at LR 0x%x", saved_lr);
va_list fmt_args;
va_start(fmt_args, packed_loghash);
pbl_log_hashed_vargs(false, CORE_NUMBER, p... |
aphics_private_draw_vertical_line(ctx, x, top_margin, bottom_margin);
}
}
// Blending of last line
if (fraction_for_right != 0) {
int16_t x = x_max + 1;
// Starting and ending point of the line, initialized with extremes
Fixed_S16_3 top_margin = {.raw_value = INT16_MAX};
Fixe... | if (ctx->draw_state.stroke_width > 1) {
// Non-Antialiased and Stroke Width > 1
graphics_line_draw_stroked_non_aa(ctx, p0, p1, ctx->draw_state.stroke_width);
} else {
// Non-Antialiased and Stroke Width == 1
graphics_line_draw_1px_non_aa(ctx, p0, p1);
} | |
3 11:41:01 2015 PST
.duration = 1,
.type = TimelineItemTypePin,
.flags = 0,
.layout = LayoutIdTest,
},
.attr_list = {
.num_attributes = 0,
.attributes = NULL,
},
.action_group = {
.num_actions = 0,
.actions = NULL,
},
.allocated_buf... | (timeline_model_get_num_items(), 2) | ;
cl_assert(uuid_equal(&s_items[s_correct_order[0]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id));
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_stat... |
/*
* 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 (ctx->draw_state.draw_mask && !mask) {
// TODO PBL-33766: Update the ctx->draw_state.draw_mask's .mask_row_infos
} |
const GDrawRawImplementation *draw_implementation_to_set =
mask ? &g_mask_recording_draw_implementation : &g_default_draw_implementation;
ctx->draw_state.draw_implementation = draw_implementation_to_set;
ctx->draw_state.draw_mask = mask;
return true;
#else
return false;
#endif
}
bool graphics_context... |
ed_execute_time, target);
cl_assert_equal_i(cron_service_get_job_count(), 1);
// Mutate the execute time to see if we actually effect change.
job->cached_execute_time = UINT32_MAX;
job->clock_change_tolerance = 10;
prv_clock_change(0, 0, false);
cl_assert_equal_i(job->cached_execute_time, UINT32_MAX);
jo... | cron_service_get_job_count() | , 0);
}
void test_cron__1_basic(void) {
CronJob test_cron = {
.cb = prv_cron_callback,
.cb_data = (void*)0,
.minute = CRON_MINUTE_ANY,
.hour = CRON_HOUR_ANY,
.mday = CRON_MDAY_ANY,
.month = CRON_MONTH_ANY,
.may_be_instant = true,
};
prv_basic_test(&s_timezone_gmt, &test_cron, s_201... |
/*
* 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_window_distance_from_screen_bounds(window_to) | ;
compositor_port_hole_transition_draw_outer_ring(ctx, gap_to_cover, GColorBlack);
}
}
static void prv_window_transition_animation_setup(Animation *animation) {
WindowTransitioningContext *context = animation_get_context(animation);
window_transition_context_appearance_call_all(context);
const AnimationIm... |
lse);
int charge_terminate_mv = battery_curve_lookup_voltage_by_percent(95, false);
fake_battery_init(charge_mv, true, true);
battery_monitor_init();
periodic_timer_trigger(1);
fake_battery_set_millivolts(charge_terminate_mv);
fake_battery_set_charging(false);
periodic_timer_trigger(1);
cl_assert_eq... | cl_assert(s_entered_standby) | ;
}
void test_battery_monitor__critical_plugged_in(void) {
int good_mv = battery_curve_lookup_voltage_by_percent(10, false);
int critical_mv = battery_curve_lookup_voltage_by_percent(0, false);
fake_battery_init(good_mv, false, false);
battery_monitor_init();
periodic_timer_trigger(1);
cl_assert(!battery... |
continue;
}
// End of a sample
if (strcmp(token, "}") == 0) {
PBL_ASSERTN(state->test_entry.name[0] != 0);
break;
}
}
// Did we get samples?
if (state->test_entry.num_samples > 0) {
return true;
} else {
return false;
}
}
// ---------------------------------------... | sscanf(token + strlen(token) + 1, "%d, 0x%x, %d", &steps, &orientation, &vmc) | ;
} else if (state->test_entry.version == 2) {
sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d", &steps, &orientation, &vmc, &light);
} else if (state->test_entry.version == 3) {
sscanf(token + strlen(token) + 1, "%d, 0x%x, %d, %d, %d", &steps, &orientation, &vmc,
&light, ... |
/*
* 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 (event == HealthEventHeartRateUpdate) {
health_data_update_current_bpm(health_app_data->health_data);
} else {
health_data_update(health_app_data->health_data);
} |
health_card_view_mark_dirty(health_app_data->health_card_view);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Initialization and Termination
//
//! Initialize application
static void prv_finish_initilization_cb(bool in_focus) {
if (in_focus) {
Heal... |
* 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 implied.
* Se... | text_resources_get_glyph_horiz_advance(&s_font_cache, 'c', &s_font_info) | ;
cl_assert(horiz_advance != 0);
cl_assert_equal_i(horiz_advance,
text_resources_get_glyph_horiz_advance(&s_font_cache, 'c', &s_font_info));
}
void test_text_resources__get_glyph_multiple(void) {
const uint8_t a_glyph_data_bytes[] = {0x2e, 0x42, 0x2e, 0x63, 0xb6};
const uint8_t b_glyph_data_bytes[] = {0x2... |
for the FD name
pin_db_init();
time_util_update_timezone(&tz);
uint8_t num_net_allocs = fake_pbl_malloc_num_net_allocs();
for (unsigned int i = 0; i < ARRAY_LENGTH(s_items); ++i) {
cl_assert_equal_i(pin_db_insert_item(&s_items[i]), 0);
}
cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), num_net_alloc... | (iter_next(&iterator)) | ;
cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id));
}
void test_timeline__none_backwards(void) {
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPas... |
for (int i = 0; i < ARRAY_LENGTH(cases); ++i) {
int16_t output = ~0;
jerry_value_t v = jerry_create_number(cases[i].input);
JERRY_ARGS_MAKE(v);
ROCKY_ARGS_ASSIGN(ROCKY_ARG(output));
cl_assert_equal_i(output, cases[i].expected_output);
ASSERT_JS_ERROR(error_value, NULL);
jerry_release_value(v... |
}
void test_rocky_api_util_args__numbers(void) {
uint8_t u8;
uint16_t u16;
uint32_t u32;
uint64_t u64;
int8_t s8;
int16_t s16;
int32_t s32;
int64_t s64;
double d;
typedef struct {
long double u8;
long double u16;
long double u32;
long double u64;
long double s8;
long doubl... | |
ct_31);
cl_assert_equal_i(clock_to_timestamp(SATURDAY, 0, 15), mktime(&nov_7));
}
void test_clock__today(void) {
struct tm may_30 = {
.tm_sec = 0,
.tm_min = 59,
.tm_hour = 7,
.tm_mday = 30,
.tm_mon = 4, // May
.tm_year = 2016 - 1900,
.tm_isdst = 1,
.tm_gmtoff = -5 * SECONDS_PER_HOUR... | (event_time - (1 * SECONDS_PER_HOUR) + 1) | |
/*
* 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... | memory_layout_is_pointer_in_region(®ion, (void*) 999) | );
cl_assert(memory_layout_is_pointer_in_region(®ion, (void*) 1000));
cl_assert(memory_layout_is_pointer_in_region(®ion, (void*) 1500));
cl_assert(memory_layout_is_pointer_in_region(®ion, (void*) 1999));
cl_assert(!memory_layout_is_pointer_in_region(®ion, (void*) 2000));
cl_assert(!memory_layout_i... |
tain_start_utc = now - KALG_MAX_UNCERTAIN_SLEEP_M * SECONDS_PER_MINUTE,
};
} else {
// The sleep was in the past and has ended
*stats = (KAlgOngoingSleepStats) {
.sleep_start_utc = s_kalg_sleep_start_utc,
.sleep_len_m = s_kalg_sleep_m,
.uncertain_start_utc = 0,
};
... | mktime(&s_start_time_tm) | ;
fake_rtc_init(100 /*initial_ticks*/, utc_sec);
fake_spi_flash_init(0, 0x1000000);
pfs_init(false);
pfs_format(false);
// Init the algorithm
s_activity_next_resting_calories = 0;
s_activity_next_distance_mm = 0;
s_activity_next_active_calories = 0;
s_activity_next_heart_rate_bpm = 0;
s_activity_n... |
/*
* 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... | {
ch = ch - '0';
} | else if (ch >= 'A' && ch <= 'Z') {
ch = ch - 'A' + 10;
} else if (ch >= 'a' && ch <= 'z') {
ch = ch - 'a' + 10;
} else { // This will catch '\0'
break;
}
if (ch >= base) {
break;
}
value *= base;
value += ch;
if (do_errors) {
if ((sign > 0) && (value > max)... |
call.h"
#include "util/attributes.h"
#include "util/math.h"
#include "util/string.h"
#define DEBUG_ROCKY_APPMESSAGE 1
#if DEBUG_ROCKY_APPMESSAGE
#define DBG(fmt, ...) PBL_LOG(LOG_LEVEL_DEBUG, fmt, ## __VA_ARGS__)
#else
#define DBG(fmt, ...)
#endif
#define DEBUG_VERBOSE_ROCKY_APPMESSAGE 1
#if DEBUG_VERBOSE_ROCKY_APPME... | prv_awaiting_reset_request__enter() | ;
}
T_STATIC void prv_handle_disconnection(void) {
if (s_state.state == PostMessageStateDisconnected) {
// Handle the race. See comment in prv_init_apis().
return;
}
DBG("Transport Disconnected");
const bool did_exit_session_open = (s_state.state == PostMessageStateSessionOpen);
s_state.state = PostM... |
msg = prv_parse_encoded_mset_payload(s_saved_encoded_msg);
cl_assert_equal_m(msg->msrmt.values, &values[num_samples_encoded * num_values_per_sample],
msg->msrmt.num_values * sizeof(uint32_t));
num_samples_encoded += msg->msrmt.num_samples;
free(s_saved_encoded_msg);
... | rtc_get_time() | - 3000,
},
{
.type = pebble_pipeline_Event_Type_UnknownEvent,
.duration = 34,
.has_duration = true,
.time_utc = rtc_get_time() - 2000,
}
};
TestPLParsedMsg input = {
.type = ProtobufLogType_Events,
.events = {
.num_events = ARRAY_LENGTH(events),
.events = ev... |
global_has_event_handlers("hourchange"));
cl_assert_equal_b(true, rocky_global_has_event_handlers("daychange"));
cl_assert_equal_i(5, s_tick_timer_service_subscribe.call_count);
cl_assert_equal_i(SECOND_UNIT | MINUTE_UNIT | HOUR_UNIT | DAY_UNIT | MONTH_UNIT | YEAR_UNIT,
s_tick_timer_service_su... | EXECUTE_SCRIPT(
"s = null;\n"
"m = null;\n"
"h = null;\n"
"d = null;\n"
) | ;
struct tm tm = {
.tm_sec = 1,
.tm_min = 2,
.tm_hour = 3,
.tm_mday = 4,
.tm_mon = 5,
.tm_year = 116, // 2016
};
prv_tick_handler(&tm, SECOND_UNIT | MINUTE_UNIT | HOUR_UNIT | DAY_UNIT);
ASSERT_JS_GLOBAL_EQUALS_D("s", 1.0);
ASSERT_JS_GLOBAL_EQUALS_D("m", 2.0);
ASSERT_JS_GLOBAL_EQUAL... |
ssert.h"
#include <bluetooth/bluetooth_types.h>
#include <bluetooth/id.h>
#include <btutil/bt_device.h>
static uint32_t s_pra_cycling_pause_count;
static BTDeviceAddress s_pinned_addr;
static bool s_cycling_paused_due_to_dependent_bondings;
static void prv_allow_cycling(bool allow_cycling) {
bt_driver_set_local_ad... | bt_local_addr_pause_cycling() | ;
#else
PBL_LOG(LOG_LEVEL_INFO, "No bondings found that require address pinning!");
bt_driver_set_local_address(true /* allow_cycling */, NULL);
#endif
}
}
|
-24, -16, -960},
{ -24, -16, -952},
{ -16, -16, -960},
{ -16, -16, -952},
{ -16, -8, -952},
{ -24, -16, -960},
{ -16, -16, -960},
{ -16, -8, -960},
{ -16, -16, -952},
{ -24, -8, -960},
{ -16, -16, -952},
{ -24, -24, -944},
{ -24, -8, -960},
// 250 seconds
{ -16, -... | { -24, -24, -960},
{ -16, -24, -960},
{ -24, -8, -960},
{ -16, -16, -960},
{ -24, -32, -952},
{ -24, -24, -952},
{ -16, -16, -960},
{ -16, -16, -952},
{ -16, -24, -960},
{ -16, -16, -952},
{ -16, -16, -960},
{ -16, -24, -952},
{ -24, -24, -960},
{ -16, -16, -960},... |
{ -24, -24, -952},
{ -16, -24, -952},
{ -16, -16, -960},
{ -24, -24, -960},
{ -24, -16, -952},
// 258 seconds
{ -16, -8, -952},
{ -16, -24, -952},
{ -16, -24, -960},
{ -24, -24, -952},
{ -16, -16, -960},
{ -16, -24, -960},
{ -16, -24, -952},
{ -16, -16, -952},
... |
th_create(&s_bolt_path_info);
s_duplicates_path = gpath_create(&s_duplicates_path_info);
s_crossing_path = gpath_create(&s_crossing_path_info);
s_infinite_path = gpath_create(&s_infinite_path_info);
s_aa_clipping_path = gpath_create(&s_aa_clipping_path_info);
prv_reset();
}
void test_graphics_gpath_${BIT_DEP... | gpath_move_to(s_house_path, GPoint(SCREEN_WIDTH, SCREEN_HEIGHT / 2));
ctx.draw_state.drawing_box = GRect(-SCREEN_WIDTH / 2, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
ctx.draw_state.clip_box = GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
prv_filled_update_proc(NULL, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_... |
// AA section
void test_graphics_gpath_${BIT_DEPTH_NAME}__filled_aa(void) {
GContext ctx;
Layer layer;
// House path - tests horizontal line edge case
prv_reset();
s_current_path = s_house_path;
test_graphics_context_init(&ctx, fb);
graphics_context_set_antialiased(&ctx, true);
prv_filled_update_proc... |
_id(&timeline_res_info, TimelineResourceSizeTiny, NULL));
// Set the TimelineResourceInfo to have the UUID of an app with an invalid LUT
const TimelineResourceTestAppData *app_with_invalid_lut_data =
prv_get_data_for_app_with_id(TimelineResourceTestAppId_AppWithInvalidLUT);
PBL_ASSERTN(app_with_invalid_lut... | timeline_resources_is_system(NUM_TIMELINE_RESOURCES) | );
}
|
ervices/normal/blob_db/contacts_db.h"
#include "services/normal/contacts/contacts.h"
#include "util/uuid.h"
// Fixture
////////////////////////////////////////////////////////////////
// Fakes
////////////////////////////////////////////////////////////////
#include "fake_spi_flash.h"
#include "fake_system_task.h"
#i... | cl_assert_equal_i(contacts_db_insert((uint8_t *)&contact, UUID_SIZE, (uint8_t *)&contact, sizeof(contact)), 0) | ;
cl_assert_equal_i(contacts_db_flush(), 0);
fake_system_task_callbacks_invoke_pending();
cl_assert_equal_i(contacts_db_get_len((uint8_t *)&contact, UUID_SIZE), 0);
}
void test_contacts_db__get_serialized_contact(void) {
uint8_t contact[sizeof(s_contact_1)];
memcpy(contact, s_contact_1, sizeof(s_contact_1));... |
colors.foreground);
}
void option_menu_set_highlight_colors(OptionMenu *option_menu, GColor background,
GColor foreground) {
option_menu->highlight_colors.background = background;
option_menu->highlight_colors.foreground = foreground;
menu_layer_set_highlight_colors(&option_... | (option_menu) | ;
}
void option_menu_system_draw_row(OptionMenu *option_menu, GContext *ctx, const Layer *cell_layer,
const GRect *cell_frame, const char *title, bool selected,
void *context) {
const GTextOverflowMode overflow_mode = GTextOverflowModeTrailingEllipsis... |
, true)) {
success = false;
break;
}
uint32_t subsec_begin = block_size - write_size;
PBL_ASSERTN((subsec_begin % (32*1024)) == 0);
for (uint32_t subsec = subsec_begin; subsec < block_size;
subsec += subsector_size) {
uint32_t erase = subsec + i;
PBL_ASSERTN((erase % (4... | for (unsigned int i = 0; i < NUM_REGIONS; ++i) {
menu_items[i] = (SimpleMenuItem) {
.title = s_flash_regions[i].name,
.callback = menu_select_callback,
};
} | |
n, &response_attributes);
break;
}
case TimelineItemActionTypePostpone: {
Attribute timestamp_attr = {
.id = AttributeIdTimestamp,
.uint32 = (uint32_t)(uintptr_t)context,
};
AttributeList response_attributes = {
.num_attributes = 1,
.attributes = ×ta... | (action_menu, pin) | ;
return NULL;
#else
case TimelineItemActionTypeBLEHRMStopSharing:
break;
#endif
}
PBL_LOG(LOG_LEVEL_ERROR, "Unsupported action type %d", action->type);
if (action_menu) {
action_menu_close(action_menu, true);
}
return NULL;
}
void timeline_actions_invoke_action(const TimelineItemAction ... |
ection, subtract 32768 for header space.
int fd = pfs_open(name, OP_FLAG_WRITE, FILE_TYPE_STATIC, pfs_get_size() - (num_pages()*128));
printf("%d\n", pfs_get_size() - 1024);
cl_assert(fd >= 0);
cl_assert(pfs_close(fd) == S_SUCCESS);
cl_assert(pfs_remove(name) == S_SUCCESS);
}
void test_pfs__active_regions(... | (buf, sizeof(buf), "This is small buf %d!", i) | ;
int len = strlen(buf);
int fd = pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, len);
cl_assert(fd >= 0);
cl_assert(pfs_write(fd, (uint8_t *)buf, len) == len);
cl_assert(pfs_close(fd) == S_SUCCESS);
if (num_erases != (erase_count - 1)) {
cl_assert(pfs_remove(file_smal... |
/*
* 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->icon_layer, &window_layer->bounds) | ;
KinoReel *from_image = kino_reel_create_with_resource(RESOURCE_ID_NOTIFICATION_GENERIC_LARGE);
KinoReel *to_image = kino_reel_create_with_resource(RESOURCE_ID_GENERIC_CONFIRMATION_LARGE);
KinoReel *icon_reel = kino_reel_morph_square_create(from_image, true);
kino_reel_transform_set_to_reel(icon_reel, to_ima... |
(buffer, sizeof(buffer),
"MCU Serial: %08"PRIx32" %08"PRIx32" %08"PRIx32,
mcu_serial[0], mcu_serial[1], mcu_serial[2]) | ;
prompt_send_response_fmt(buffer, sizeof(buffer), "Boot:%"PRIu32"\nHW:%s\nSN:%s",
boot_version_read(), hw_version, serial_number);
ResourceVersion system_resources_version = resource_get_system_version();
prompt_send_response_fmt(buffer, sizeof(buffer),
"Sy... | |
x_unlock(s_mon_config_mutex);
}
static bool prv_read_register(uint8_t register_address, uint8_t *result) {
i2c_use(I2C_MAX14690);
bool rv = i2c_read_register(I2C_MAX14690, register_address, result);
i2c_release(I2C_MAX14690);
return (rv);
}
static bool prv_write_register(uint8_t register_address, uint8_t valu... | (BOARD_CONFIG.mfi_reset_pin.gpio, &gpio_cfg) | ;
GPIO_WriteBit(BOARD_CONFIG.mfi_reset_pin.gpio, BOARD_CONFIG.mfi_reset_pin.gpio_pin, Bit_RESET);
gpio_release(BOARD_CONFIG.mfi_reset_pin.gpio);
}
return true;
}
static bool prv_update_rail_state(PmicRail rail, bool enable) {
static int8_t s_ldo2_ref_count = 0;
static int8_t s_ldo3_ref_count = 0;
... |
ore);
vibe_repeat_interval_sec = DIVIDE_CEIL(vibe_interval_ms, MS_PER_SECOND);
#else
vibe_repeat_interval_sec = 2;
#endif
prv_ring(NULL);
regular_timer_add_multisecond_callback(&s_phone_ui_data->ring_timer, vibe_repeat_interval_sec);
}
static void prv_stop_ringing(void) {
regular_timer_remove_callback(&s_pho... | ("Call Declined", s_phone_ui_data->call_status_text_buf,
CALL_STATUS_BUFFER_LENGTH) | ;
}
}
text_layer_set_text(&s_phone_ui_data->call_status_text_layer,
s_phone_ui_data->call_status_text_buf);
prv_show_call_status();
}
// Handles cleanup when the SMS reply menu closes
static void prv_action_menu_did_close(ActionMenu *action_menu, const ActionMenuItem *item,
... |
http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing p... | ((2 % GVECTOR_PRECISE_MAX) << GVECTOR_PRECISE_PRECISION,
(5 % GVECTOR_PRECISE_MAX) << GVECTOR_PRECISE_PRECISION) | ;
cl_assert(gvectorprecise_equal(&vectorP, &vectorP_c));
}
void test_graphics_gtransform_${BIT_DEPTH_NAME}__init(void) {
GTransform t;
GTransform t_c; // matrix to compare against
// Test Identity Matrix
t = GTransformIdentity();
t_c = GTransformFromNumbers(1, 0, 0, 1, 0, 0);
cl_assert(gtransform_is_e... |
ip_select(false);
// FIXME: PBL-32865: The "OVR" (overrun) status flag gets set at some point, not sure why because
// the data arrives OK. Need to reset it, otherwise the next transfer will get a 0x00 byte
// prepended to the beginning...
// From the F7 Spec: "When the SPI is used only to transmit data, it is... | prv_init_spi() | ;
periph_config_release_lock();
prv_init_exti(int_exti_cb ?: prv_exti_cb);
}
void dialog_spi_deinit(void) {
exti_disable(DIALOG_EXTI);
if (s_dma_pending_transfer) {
spi_ll_slave_read_write_dma_stop(DIALOG_SPI);
prv_cleanup_after_dma_transfer();
s_dma_pending_transfer = false;
}
spi_slave_por... |
or));
Uuid first_all_day_event = state.pin.header.id;
cl_assert(uuid_equal(&state.pin.header.id, &s_all_day_items[1].header.id) ||
uuid_equal(&state.pin.header.id, &s_all_day_items[2].header.id));
cl_assert(state.node->all_day);
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, ... | (&iterator) | |
------------------------------------
// Test a sequence animation with a play count of 0
void test_animation__sequence_with_0_play_count(void) {
#ifdef TEST_INCLUDE_COMPLEX
const int duration_a = 300;
const int duration_b = 500;
const int play_count_seq = 0;
// Create 2 animations
Animation *a = prv_create_t... | (prv_count_handler_entries(&s_started_handler_calls, b), 0) | ;
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, inner_seq), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_ca... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (this->state->restart_timer, RESTART_TIMEOUT_MS,
prv_on_timeout, (void *)this, 0) | |
(&ctx, GColorGreen);
graphics_draw_arc_internal(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG, angle_start, angle_end);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_arc_origin_aa_letter_c_color_1px.8bit.pbi"));
// Letter C SW 4
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 4);
graph... | TO_TRIG(0) | , TO_TRIG(90)), ((EllipsisDrawConfig){
.start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerTopRight},
.full_quadrants = GCornerTopRight,
.end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(90),GCornerBottomRight}
}));
cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(90), TO_TRIG(180)), (... |
Green,
.stroke_width = 1,
.fill_color = GColorPurple,
.path_open = false,
.num_points = 3,
};
GPoint points2[] = { { 6, 7 }, {5, 5}, { 0, 0 } };
memcpy(command->points, points2, sizeof(points2));
return command_list;
}
void test_gdraw_command__draw_command_list(void) {
GDrawCommandList *comm... | (size, gdraw_command_image_get_data_size(image)) | ;
image->version = 2;
cl_assert(!gdraw_command_image_validate(image, size));
free(image);
}
void test_gdraw_command__clone_image(void) {
cl_assert_equal_p(gdraw_command_image_clone(NULL), NULL);
size_t size = sizeof(GDrawCommandImage) + (3 * sizeof(GDrawCommand)) +
(sizeof(GPoint) * 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... | app_message_outbox_begin(&iter) | |
/*
* 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... | stub_new_timer_callback_data(get_reminder_timer_id()) | |
168, 24},
{ 1264, 184, 72},
{ 1112, 216, 96},
{ 968, 152, 0},
{ 952, 96, 0},
{ 1000, 160, 24},
{ 960, 192, 32},
{ 936, 208, 56},
{ 848, 176, 88},
{ 792, 128, 96},
{ 784, 64, 120},
{ 776, 64, 112},
{ 784, 88, 72},
{ 880, 104, 80},
{ 960, 128, 80},
{ 1016, 184,... | { 832, 144, -64},
{ 904, 40, 40},
{ 928, 48, 96},
{ 912, 120, 80},
{ 856, 144, 24},
{ 824, 144, -32},
{ 856, 152, -64},
{ 856, 136, -72},
{ 848, 152, -64},
{ 856, 136, -64},
{ 928, 128, -32},
{ 1024, 152, 0},
{ 976, 136, 48},
{ 1176, 80, 104},
{ 1312, 112, 168... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.