prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
TION_ID (1234)
static BTDeviceInternal prv_dummy_device(uint8_t octet) {
BTDeviceAddress address = {
.octets = {
[0] = octet,
[1] = octet,
[2] = octet,
[3] = octet,
[4] = octet,
[5] = octet,
},
};
BTDevice device = bt_device_init_with_address(address, true /* is_random... | fake_event_clear_last() | ;
// Start discovery again, expect not to run (already discovered):
cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK);
cl_assert_equal_b(fake_gatt_is_service_discovery_running(), false);
// Expect event:
prv_assert_event(&device, BTErrnoOK);
}
void test_gatt_client_discovery__discon... |
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_offset_layer_aa.${BIT_DEPTH_NAME}.pbi") | );
// TODO: Fix offset calculation and reenable this: - PBL-16509
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 10);
graphics_line_draw_precise_stroked_aa(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_same_point_of... | |
/*
* 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... | syscall_internal_elevate_privilege() | ;
char * new = buf;
do_stuff(new, size);
}
void malloc_syscall() {
syscall_internal_elevate_privilege();
void *buf = app_malloc(5);
syscall_assert_userspace_buffer(buf, 5);
do_stuff(buf, 5);
}
|
imum_frequency) {
const uint32_t pclk1 = prv_get_apb1_frequency();
uint32_t prescalar =
pclk1 / (desired_maximum_frequency * DUTY_CYCLE_DIVIDERS[duty_cycle]);
// Check to see what frequency our calculated prescalar is actually going to give us. If the
// numbers don't divide evenly, that means we'll hav... | I2C_CheckEvent(i2c, s_guard_events[transfer->state]) | |
&s_next_alarm, s_next_alarm_time);
}
mutex_unlock(s_mutex);
return alarm_is_scheduled;
}
// ----------------------------------------------------------------------------------------------
bool alarm_is_next_enabled_alarm_smart(void) {
mutex_lock_with_timeout(s_mutex, portMAX_DELAY);
const bool alarm_is_sch... | if (key.type != ALARM_DATA_CONFIG) {
return 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... | {
return prv_fetch_struct().color;
} |
void mfg_info_set_watch_color(WatchInfoColor color) {
MfgData data = prv_fetch_struct();
data.color = color;
prv_update_struct(&data);
}
GPoint mfg_info_get_disp_offsets(void) {
return (GPoint) {
.x = prv_fetch_struct().disp_offset_x,
.y = prv_fetch_struct().disp_offset_y
};
}
void mfg_info_set_di... |
G_LEVEL_ERROR, "AMS playback info value failed to parse: %s", value);
prv_analytics_log_event_with_info(AMSAnalyticsEventErrorPlayerPlaybackInfoFloatParse, idx);
return false /* should_continue */;
}
PBL_LOG(LOG_LEVEL_DEBUG, "Playback info value update %"PRId32"=%"PRId32, idx, value_out);
MusicPlayerSta... | prv_parse_queue_value(update->value_str, value_length) | ;
PBL_LOG(LOG_LEVEL_DEBUG, "Queue repeat mode update: %d", repeat_mode);
// TODO: Do something with this info
}
// -------------------------------------------------------------------------------------------------
// Track entity update handlers
static void prv_handle_track_artist_update(const AMSEntityUpdateNotif... |
",
0,
true,
},
{ "\\{end()}", 1000000000,
"{end()}",
0,
true,
},
{ "Harder test {} bazza", 1000000000,
"Harder test ",
EVAL_DEFAULT,
false,
TemplateStringErrorStatus_NoResultGenerated,
13,
},
{ "Failer {time_until}", 1000000000,
"Failer ",
EVAL_DEFAULT,
fa... | cl_assert_equal_i(err.index_in_string, s_full_tests[i].expect_index) | ;
}
}
}
|
how the action menu
timeline_actions_invoke_action(reply_action, item, prv_ancs_response_action_result_handler,
item);
break;
default:
break;
}
}
//! Action bar click handlers
static void prv_answer_click_handler(ClickRecognizerRef recognizer, void *unused) ... | (ui_bounceback, 2 * ANIMATION_FRAME_MS) | ;
Animation *ui_animation = animation_sequence_create(ui_movement, ui_bounceback, NULL);
Animation *combined = animation_spawn_create(action_bar_animation, ui_animation, NULL);
s_phone_ui_data->action_bar_animation = combined;
animation_schedule(combined);
#if PBL_ROUND
// Extend the bounds to center the call... |
ata_subscription_error_response(void) {
prv_notify_services_discovered(1);
ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta],
(const uint8_t *) &s_meta_v0_system,
sizeof(s_meta_v0_system),
... | prv_receive_ack(s_characteristics[0][PPoGATTCharacteristicData], 0) | ;
// The retransmitted ACK should be ignored.
fake_gatt_client_op_assert_no_write();
// Session shouldn't get closed:
cl_assert_equal_i(fake_comm_session_close_call_count(), 0);
}
void test_ppogatt__ignore_server_reset_request_while_resetting_due_to_server_reset_request(void) {
test_ppogatt__open_session_w... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
x = (x + delta) % max;
return x < 0 ? x + max : x;
} |
int date_time_selection_step_hour(int hour, int delta) {
return prv_wrap(hour, 24, delta);
}
int date_time_selection_step_minute(int minute, int delta) {
return prv_wrap(minute, 60, delta);
}
int date_time_selection_step_day(int year, int month, int day, int delta) {
bool is_leap_year = date_util_is_leap_year... |
("Not adding activity pin - before trigger time (%d < %d) or removed (%d)",
minute_of_day, s_activity_summary_settings.summary.activity.trigger_minute,
s_activity_pin_state.removed) | ;
return;
}
// Make sure we actually have a step count
const int32_t steps = prv_get_step_count();
if (steps <= 0) {
INSIGHTS_LOG_DEBUG("Not adding activity pin - no steps");
return;
}
// Make sure we're overdue for an update (either time interval or change in steps)
const time_t next_update... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (RTC_BKP_BOOTBIT_DR) | ;
return (current_value & bit);
}
void boot_bit_dump(void) {
dbgserial_print("Boot bits: ");
dbgserial_print_hex(RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR));
dbgserial_newline();
}
void boot_version_write(void) {
if (boot_version_read() == s_bootloader_timestamp) {
return;
}
RTC_WriteBackupRegister(... |
/*
* 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... | (unaligned_buffer) | ;
app_state_set_rocky_runtime_context(unaligned_buffer, ctx);
}
void rocky_runtime_context_deinit(void) {
task_free(app_state_get_rocky_runtime_context_buffer());
app_state_set_rocky_runtime_context(NULL, NULL);
}
double jerry_port_get_current_time (void) {
time_t seconds;
uint16_t millis;
time_ms(&second... |
ctors_simple_1(void) {
// Erase one sector 0x10000 - 0x20000
prv_test_erase_optimal_range(
64 * 1024, 64 * 1024, 2 * 64 * 1024, 2 * 64 * 1024,
(EraseCommand[]) {
{ 64 * 1024, SectorEraseCommand },
{ },
});
}
void test_flash_erase__sectors_simple_2(void) {
// Erase one sectors 0x... | (
0x320000, 0x320000, 0x33177c, 0x338000,
(EraseCommand[]) {
{ 0x320000, SectorEraseCommand },
{ 0x330000, SubsectorEraseCommand },
{ 0x331000, SubsectorEraseCommand },
{ },
}) | ;
}
void test_flash_erase__handle_work_queue_full(void) {
s_simulate_work_queue_full_countdown = 3;
flash_erase_optimal_range(
32 * 1024, 32 * 1024, (32 + 71) * 1024, (32 + 96) * 1024,
prv_callback, s_callback_ctx);
prv_assert_callback_called(E_INTERNAL);
prv_assert_erase_commands((EraseCommand[]) ... |
ld time, with the PNG file copied to TEST_IMAGES_PATH
// and a separate PBI generated by bitmapgen.py from the PNG copied to TEST_IMAGES_PATH
// covers 1,2,4,8 bit palettized
// covers 1,2,4,8 bit palettized with transparency
// covers 1, 2 bit greyscale
// covers 1, 2 bit greyscale with transparency
// covers 4 bit g... | (bitmap, TEST_PBI_FILE_FMT(1bitpalette)) | );
cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat1BitPalette);
}
// Tests 1-bit b&w greyscale PNG loading into gbitmap
// Result:
// - gbitmap matches platform loaded PNG
void test_png__greyscale_1_bit(void) {
GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(1bitpalette));
cl_assert(gbitmap_pbi_... |
ticks_to_time(s_coarse_ticks));
//save_rtc_time_state(0);
}
void rtc_init(void) {
periph_config_acquire_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_LEV... | (RTC_Alarm_A, ENABLE) | ;
RTC_ClearFlag(RTC_FLAG_ALRAF);
EXTI_ClearITPendingBit(EXTI_Line17);
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 inte... |
;
agg_str = "min";
break;
case HealthAggregationMax:
exp_value = stats->max;
agg_str = "max";
break;
}
// Get the value. Since we are computing min, max, avg and we only store 1 value per day
// in our history, passing in a time range less tha... | cl_assert_equal_i(s_sys_activity_get_minute_history_values.in[1].num_records,
num_minutes_per_call) | ;
if (agg == HealthAggregationAvg) {
cl_assert_equal_i(result, avg_value);
} else if (agg == HealthAggregationMin) {
cl_assert_equal_i(result, min_value);
} else if (agg == HealthAggregationMax) {
cl_assert_equal_i(result, max_value);
} else {
cl_assert(false);
}
}
}
//... |
count = 0;
s_max_results_count = ~0;
}
void test_ams_util__cleanup(void) {
}
// ams_util_float_string_parse() tests
///////////////////////////////////////////////////////////
#define assert_float_parse(in, mul, succeeds, expected_result) \
{ \
const char *input = (const char *)in; \
const uint32_t input... | {
const char empty_string[] = "";
const uint8_t count = ams_util_csv_parse(empty_string, sizeof(empty_string), NULL,
prv_result_callback);
cl_assert_equal_i(s_results_count, 1);
cl_assert_equal_i(count, 1);
cl_assert_equal_s(empty_string, s_results[0]);
} | |
s_data->notification_list) + 1;
}
static int16_t prv_get_cell_height(struct MenuLayer *menu_layer, MenuIndex *cell_index,
void *data) {
#if PBL_ROUND
MenuIndex selected_index = menu_layer_get_selected_index(menu_layer);
bool is_selected = menu_index_compare(cell_index, &selected... | if (IS_EMPTY_STRING(subtitle)) {
// no subtitle, but yes title
subtitle = body;
} else {
WTF;
} |
draw_cell(ctx, cell_layer, title, subtitle, loaded_node->icon);
}
// Display the appropriate layer
static void prv_update_text_layer_visibility(NotificationsData *data) {
NotificationNode *node = data->notification_list;
// Toggle which layer is visible
if (node == NULL) {
layer_set_hidden((Layer *) &da... |
in an indeterminate state.
// - written: The typical state for a record. == !partially_written
// - partially_overwritten: This record has been superceeded by another, which
// we are currently in the process of writing out to flash. Records in
// this state are restored on bootup.
// - overwritten: This record... | settings_raw_iter_next(&new_file.iter) | ;
}
kernel_free(key);
kernel_free(val);
}
settings_file_close(file);
// We have to close and reopen the new_file so that it's temp flag is cleared.
// Before the close succeeds, if we reboot, we will just end up reading the
// old file. After the close suceeds, we will end up reading the new
// ... |
AME, APP_CACHE_MAX_SIZE);
if (rv != S_SUCCESS) {
goto unlock;
}
AppCacheEntry entry = { 0 };
rv = settings_file_get(&file, (uint8_t *)&app_id, sizeof(AppInstallId),
(uint8_t *)&entry, sizeof(AppCacheEntry));
if (rv == S_SUCCESS) {
entry.last_launch = rtc_get_time();
entry... | (s_app_cache_mutex) | ;
return;
}
// resource_list contains all of the resource files we found. We only
// want to delete orphans so we can remove any entries from the list that correspond
// to items in the app cache...
// prv_remove_matching_resource_file_callback scans resource_list and removes the entry
// corresponding... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | bt_driver_stop() | ;
s_test_mode_enabled = false;
}
void bt_driver_test_enter_hci_passthrough(void) {
s_hci_passthrough_enabled = true;
}
bool bt_driver_test_enter_rf_test_mode(void) {
return true;
}
void bt_driver_test_set_spoof_address(const BTDeviceAddress *addr) {
prompt_send_response("NYI!");
}
#define HCI_CMD_HEADER_LEN... |
payload->ppogatt_max_tx_window);
}
}
PBL_LOG(LOG_LEVEL_DEBUG, "Hurray! PPoGATT Session is opened (Vers: %d TXW: %d RXW: %d)!",
client->version, client->out.tx_window_size, client->out.rx_window_size);
}
// ---------------------------------------------------------------------------------------------... | prv_handle_reset_request(client) | ;
return;
}
if (LIKELY(client->state == StateConnectedOpen)) {
if (LIKELY(packet->type == PPoGATTPacketTypeData)) {
prv_handle_data(client, packet, value_length - sizeof(PPoGATTPacket));
} else if (LIKELY(packet->type == PPoGATTPacketTypeAck)) {
prv_handle_ack(client, packet->sn);
} else... |
/*
* 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... | {
callback(data);
} | |
s distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "flash_region.h"
#include "drivers/flash.h"
#include "drivers/task_watchdog.h"
#include "... | (min_start, max_start, min_end, max_end, false /* feed_watchdog */) | ;
}
void flash_region_erase_optimal_range_no_watchdog(uint32_t min_start, uint32_t max_start,
uint32_t min_end, uint32_t max_end) {
prv_erase_optimal_range(min_start, max_start, min_end, max_end, true /* feed_watchdog */);
}
|
action = FIXED_S16_3_HALF.raw_value
};
prv_fill_oval_precise(ctx, center_precise, outer_x_precise, outer_y_precise,
inner_x_precise, inner_y_precise, angle_start, angle_end);
}
void prv_fill_oval_quadrant_precise(GContext *ctx, GPointPrecise point,
Fixed... | {
uint16_t stroke_width = ctx->draw_state.stroke_width;
// We accept only .0 and .5 precision for now:
center.x.raw_value -= center.x.raw_value % (FIXED_S16_3_ONE.raw_value / 2);
center.y.raw_value -= center.y.raw_value % (FIXED_S16_3_ONE.raw_value / 2);
// To maintain compability we have to adjust from int... |
angle_start, angle_end);
if (half_stroke_width.integer >= 1) {
GPointPrecise starting_point =
prv_get_rotated_precise_point(center, radius.raw_value, angle_start);
GPointPrecise ending_point =
prv_get_rotated_precise_point(center, radius.raw_value, angle_e... |
/*
* 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... | (fmt_args, packed_loghash) | ;
pbl_log_hashed_vargs(false, CORE_NUMBER, packed_loghash, fmt_args);
va_end(fmt_args);
trigger_fault(RebootReasonCode_Assert, lr);
}
NORETURN passert_failed_hashed_no_message_with_lr(uint32_t lr) {
PBL_LOG(LOG_LEVEL_ALWAYS, "ASSERTION at LR 0x%"PRIx32, lr);
trigger_fault(RebootReasonCode_Assert, lr);
}
... |
{ 1216, 16, -32},
{ 1240, -16, -48},
{ 1128, -56, -112},
{ 1008, -88, -120},
{ 1056, 32, -136},
{ 1136, 72, -200},
{ 952, 72, -232},
{ 1128, 16, -240},
{ 976, 16, -168},
{ 928, 40, -240},
{ 1136, 112, -216},
{ 1152, 144, -144},
{ 912, 64, -64},
{ 776, 88, -32},
/... | { 72, 88, -176},
{ 248, -8, -256},
{ 520, -24, -480},
{ 928, 8, -504},
{ 1120, 72, -256},
{ 1624, 288, -88},
{ 1912, 208, 56},
{ 1824, 400, -24},
{ 1600, 624, -248},
{ 1248, 560, -120},
{ 1040, 312, -40},
{ 1000, 136, -72},
{ 1048, 136, -24},
{ 1120, 128, 16},
... |
{ -48, 536, -688},
{ -152, 576, -584},
{ -136, 424, -696},
{ 0, 312, -776},
// 62 seconds
{ 112, 320, -864},
{ 136, 256, -904},
{ 72, 160, -952},
{ 104, 40, -1000},
{ 16, 120, -984},
{ -40, 176, -968},
{ -72, 184, -976},
{ -96, 168, -928},
{ -160, 184, -904},
... |
4000
//! Keep enough room for the maximum sized application based on platform, plus a little more room.
//! Source: https://pebbletechnology.atlassian.net/wiki/display/DEV/PBW+3.0
#if PLATFORM_TINTIN || PLATFORM_SILK || UNITTEST
#define APP_SPACE_BUFFER KiBYTES(300)
#else
#define APP_SPACE_BUFFER MiBYTES(4)
#endif
#... | (file, (uint8_t *)&entry, info->val_len) | ;
// create node
EvictListNode *node = kernel_malloc_check(sizeof(EvictListNode));
list_init((ListNode *)node);
// give them an extremely high priority so that we only remove them if we really NEED to
// This list contains defaults that we shouldn't be removing.
uint32_t priority = 0;
if (prv_is_in_list... |
const uint8_t min_x = MIN(s_r2.origin.x, s_r1.origin.x);
const uint8_t min_y = MIN(s_r2.origin.y, s_r1.origin.y);
const uint8_t max_x = MAX(s_r2.origin.x + s_r2.size.w,
s_r1.origin.x + s_r1.size.w);
const uint8_t max_y = MAX(s_r2.origin.y + s_r2.size.h,
s_r... | (r.origin.x + insets.left, r.origin.y + insets.top, new_width, new_height) | ;
}
GPoint gpoint_to_global_coordinates(const GPoint point, GContext *ctx) {
return gpoint_add(point, ctx->draw_state.drawing_box.origin);
}
GPoint gpoint_to_local_coordinates(const GPoint point, GContext *ctx) {
return gpoint_sub(point, ctx->draw_state.drawing_box.origin);
}
GRect grect_to_global_coordinates(co... |
process is safe to kill. If this method returns false, it will have set a timer to post
// another KILL event in a few seconds, thus giving the process a chance to clean up.
if (!process_manager_make_process_safe_to_kill(PebbleTask_App, gracefully)) {
// Maybe next time...
return false;
}
AppInstallI... | process_metadata_get_run_level(app_md) | );
app_install_release_md(app_md);
return false;
}
s_next_app = (NextApp) {
.md = app_md,
.common = config->common,
};
s_next_app.common.transition = prv_get_transition(&config->common, new_app_id);
if ((config->common.reason == APP_LAUNCH_WAKEUP) && (config->common.args != NULL)) {
Wak... |
return_success;
status_t flash_impl_get_erase_status(void) {
get_erase_status_calls++;
return get_erase_status_fn();
}
int blank_check_subsector_calls = 0;
status_t blank_check_subsector_return = S_FALSE;
status_t flash_impl_blank_check_subsector(FlashAddress addr) {
blank_check_subsector_calls++;
return blank... | {
get_erase_status_fn = return_error;
TimerID erase_timer = flash_api_get_erase_poll_timer_for_test();
flash_erase_sector(0, uncorrectable_erase_error_cb, NULL);
int i;
for (i = 0; i < 20 && !uncorrectable_erase_error_cb_called; ++i) {
cl_assert(stub_new_timer_is_scheduled(erase_timer));
stub_new_time... | |
/*
* 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 (!e->bluetooth.comm_session_event.is_system) {
return;
} |
if (e->bluetooth.comm_session_event.is_open) {
if (bt_dialog->connected_handler) {
bt_dialog->connected_handler(true, bt_dialog->context);
}
// handler to NULL so it won't be called again during the unload
bt_dialog->connected_handler = NULL;
dialog_pop(&bt_dialog->dialog.dialog);
}
}
s... |
minutes, seconds);
}
text_layer_set_text(&s_phone_ui_data->call_status_text_layer,
s_phone_ui_data->call_status_text_buf);
}
static void prv_start_call_duration_timer(void) {
if (s_phone_ui_data->call_start_time == 0) {
s_phone_ui_data->call_start_time = rtc_get_time();
}
s_phone_... | (ACCEPT_COLOR, false) | ;
prv_set_icon_resource(TIMELINE_RESOURCE_DURING_PHONE_CALL);
if (s_phone_ui_data->show_ongoing_call_ui) {
prv_start_call_duration_timer();
} else {
prv_set_status_text(ACCEPTED);
prv_window_pop_with_delay(ACCEPT_DELAY_MS);
}
prv_set_answer_window();
}
static void prv_decline_call(void) {
prv... |
sert(pfs_read(fd, buf, size) == size);
pfs_close(fd);
// Save it to the local file system
FILE *file = fopen(out_path, "wb");
cl_assert(file != NULL);
cl_assert_equal_i(fwrite(buf, size, 1, file), 1);
fclose(file);
free(buf);
printf("\nSaved current settings file to %s", out_path);
}
// ------------... | (event.type, PEBBLE_HEALTH_SERVICE_EVENT) | ;
cl_assert_equal_i(event.health_event.type, HealthEventMovementUpdate);
// -----------------------------------
// Test that we receive sleep update events
prv_reset_captured_dls_data();
// Falling asleep for 30 minutes
prv_feed_cannned_accel_data(30 * SECONDS_PER_MINUTE, 5, ActivitySleepStateAwake);
/... |
event_enqueued) {
PBL_LOG(LOG_LEVEL_ERROR, "Event queue full");
}
inbox->has_pending_event = is_event_enqueued;
}
static void prv_mark_failed_if_no_writer(AppInboxNode *inbox) {
if (!inbox->writer) {
// See PBL-41464
// App message has been reset (closed and opened again) while a message was being re... | prv_unlock() | |
/*
* 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... | (ctx, &GRect(16, 2, 28, 20), 4) | ;
}
void across_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_round_rect(ctx, &GRect(-14, 2, 28, 20), 4);
}
void across_y_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_s... |
EPTH_NAME}.pbi"));
// TODO: Fix offset calculation and reenable this: - PBL-16509
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 10);
graphics_line_draw_precise_stroked_aa(&ctx, END_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_preci... | graphics_line_draw_precise_stroked_aa(&ctx, CLOSE_POINTS_AROUND_1PX_START, CLOSE_POINTS_AROUND_1PX_END, 10) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_close_points_around_1px_aa.${BIT_DEPTH_NAME}.pbi"));
#endif
}
void test_graphics_draw_stroke_precise_${BIT_DEPTH_NAME}__close_points_non_aa(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CL... |
/*
* 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... | (contents->src_filename, GET_FILE_NAME(src_filename), sizeof(contents->src_filename)) | ;
// Obtain the line number
contents->line_number = src_line_number;
return offsetof(MessageContents, message);
}
//! Serialize a message into contents, returning the number of bytes used.
static size_t prv_serialize_log(MessageContents *contents,
uint8_t log_level, uint64_t ti... |
u_layer->center_focused) {
// in this mode, the selected row is always the best candidate for the cache
menu_layer->cache.cursor = menu_layer->selection;
}
*render_iter = (MenuRenderIterator) {
.it = {
.menu_layer = menu_layer,
.cursor = menu_layer->cache.cursor,
.row_callback_after_g... | (menu_layer) | ;
applib_free(menu_layer);
}
Layer* menu_layer_get_layer(const MenuLayer *menu_layer) {
return &((MenuLayer *)menu_layer)->scroll_layer.layer;
}
ScrollLayer* menu_layer_get_scroll_layer(const MenuLayer *menu_layer) {
return &((MenuLayer *)menu_layer)->scroll_layer;
}
typedef struct MenuPrimeCacheIterator {
M... |
/*
* 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_initialized) {
return;
}
while (USART_GetFlagStatus(USART3, USART_FLAG_TC) == RESET) continue;
USART_SendData(USART3, c);
while (USART_GetFlagStatus(USART3, USART_FLAG_TC) == RESET) continue;
} |
static void prv_flush(void) {
uint32_t crc;
size_t raw_length = sizeof(PulseFrame) + sizeof(PushPacket) +
sizeof(s_message_header) + s_message_length + sizeof(crc);
unsigned char raw_packet[raw_length];
PulseFrame *frame = (PulseFrame *)raw_packet;
frame->protocol = hton16(PULSE_TRANS... |
_bytes,
uint8_t length, void *cb_data);
// -----------------------------------------------------------------------------
//! Internal parser callback. Gets called for a parsed TX Power Level element.
//! @param tx_power_level The TX Power Level value.
//! @param cb_data Poin... | {
// In case the length is not what it should be, do not add data element.
return true; // continue parsing
} |
const int8_t tx_power_level = *(int8_t *)elem->data;
// Call back to client with parsed data:
return callbacks->tx_power_level_cb(tx_power_level, cb_data);
}
// -----------------------------------------------------------------------------
//! Parser for Manufacturer Specific data element.
static bool parse_m... |
et new sessions created and reach the limit
// of the max # of sessions allowed.
PBL_LOG(LOG_LEVEL_WARNING, "Error creating activity logging session");
return NULL;
}
}
return s_alg_state->dls_session;
}
// -------------------------------------------------------------------------------------... | WITHIN(cbuf_record->utc_sec, sleep_start_utc,
sleep_end_utc - SECONDS_PER_MINUTE) | ;
// Handle writing the record out to PFS
if (file_record) {
prv_set_file_minute_record_entry(file_record, &cbuf_record->data, i, cbuf_record->utc_sec,
was_sleeping);
// Handle writing the record out to data logging
} else {
prv_set_dls_minute_recor... |
ched = false;
bool did_output = false;
// We need to iterate all the way through for finding the proper 'next' time.
while (*state->position != ')') {
match = prv_format_predicate(state, previously_matched);
if (state->error->status != TemplateStringErrorStatus_Success) {
return;
}
// A fo... | if (*state->position == '}') {
continue;
} else {
state->error->status = TemplateStringErrorStatus_MissingClosingBrace;
return;
} |
}
// Must end on a closing brace.
if (*state->position != '}') {
state->error->status = TemplateStringErrorStatus_MissingClosingBrace;
return;
}
// Did not generate an output.
if (!state->filters_complete) {
state->error->status = TemplateStringErrorStatus_NoResultGenerated;
return;
}
... |
/system_apps/health/health_data_private.h"
#include "test_health_app_includes.h"
// Setup and Teardown
////////////////////////////////////
static GContext s_ctx;
static FrameBuffer s_fb;
GContext *graphics_context_get_current_context(void) {
return &s_ctx;
}
void test_health_sleep_detail_card__initialize(void) ... | (&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
void test_health_sleep_detail_card__render_sleep_data_2(void) {
HealthData health_data = {
.sleep_data[0] = (7 * SECONDS_PER_HOUR) + (14 * SECONDS_PER_MINUTE),
.sleep_data[1] = (4 * SECONDS_PER_HOUR) + (59 * SECONDS_PER_MINUTE),
.sleep_data[2] = (8 * SECONDS_PER_HOUR) + (17 * SECONDS_PER_MINUTE),
... |
e click config, and the click config is set properly.
void test_window_stack__window_flow(void) {
Window *window = window_create();
window_set_window_handlers(window, &(WindowHandlers){
.load = prv_window_load,
.unload = prv_window_unload,
.appear = prv_window_appear,
.disappear = prv_window_disapp... | (stack, window, true) | ;
cl_assert_equal_i(window_stack_count(stack), 0);
// We popped the window off the screen, but the unload handler
// should not have been called for it, as it hasn't finished
// unloading.
cl_assert_equal_i(prv_get_load_unload_count(), 1);
}
// Description:
// In this test, we push a window during the unlo... |
/*
* 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... | (connection,
event->attr_handle,
event->attr_val,
event->attr_val_len) | ;
BLE_LOG_DEBUG("GATT Server Notification for handle %u " BT_DEVICE_ADDRESS_FMT,
event->attr_handle, BT_DEVICE_ADDRESS_XPLODE(event->dev_address));
}
void bt_driver_cb_gatt_handle_indication(const GattServerNotifIndicEvent *event) {
GAPLEConnection *connection = NULL;
bool done = false;
bt_lock... |
s_values(void) {
const time_t now = rtc_get_time();
bool result;
HealthServiceTimeRange range;
// clamps value that goes into the future
result = prv_calculate_time_range(now - 10, now + 11, &range);
cl_assert_equal_b(result, true);
cl_assert_equal_range(range, ((HealthServiceTimeRange){
.last_day_id... | cl_assert_equal_i(values[0], 1000) | ;
cl_assert_equal_i(values[1], 1000);
cl_assert_equal_i(values[2], 1000);
// ensure we can handle empty ranges
range.num_days = 0;
prv_adjust_value_boundaries(values, ARRAY_LENGTH(values), &range);
cl_assert_equal_i(values[0], 1000);
cl_assert_equal_i(values[1], 1000);
cl_assert_equal_i(values[2], 1000... |
nst int32_t transparent_gray = gbitmap_png_get_transparent_gray_value(upng);
for (uint32_t y = 0; y < fctl.height; y++) {
const uint16_t corrected_y = fctl.y_offset + y + bitmap->bounds.origin.y;
const GBitmapDataRowInfo row_info = gbitmap_get_data_row_info(bitmap, corrected_y);
// delta_x is th... | {
if (bitmap_sequence) {
return bitmap_sequence->total_duration_ms;
}
return 0;
} | |
ivers/i2c.h"
#include "drivers/periph_config.h"
#include "kernel/events.h"
#include "services/common/system_task.h"
#include "system/logging.h"
#include "system/passert.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_adc.h"
static TimerID s_debounce_charger_timer = TIMER_INVALID_ID;
#def... | i2c_release(I2C_AS3701B) | |
/*
* 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... | (sizeof(log_buffer) > sizeof(AppLogBinaryMessage), "log_buffer too small for AppLogBinaryMessage") | ;
AppLogBinaryMessage* msg = (AppLogBinaryMessage*)log_buffer;
sys_get_app_uuid(&msg->uuid);
const size_t log_msg_offset = offsetof(AppLogBinaryMessage, log_msg);
int bin_msg_length = pbl_log_binary_format((char*)&msg->log_msg, sizeof(log_buffer) - log_msg_offset, log_level,
... |
/*
* 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... | ("...\r\n\r\n") | ;
// Disable all interrupts, just in case.
for (int i = 0; i < 8; ++i) {
// Interrupt Clear-Enable Register
NVIC->ICER[i] = 0xFFFFFFFF;
// Interrupt Clear-Pending Register
NVIC->ICPR[i] = 0xFFFFFFFF;
}
// Disable all of the peripheral clocks we may have on, but don't touch any of
// the rese... |
0,
.type = TimelineItemActionTypeResponse,
.attr_list = {
.num_attributes = ARRAY_LENGTH(action1_attributes),
.attributes = action1_attributes
}
},
{
.id = 1, .type = TimelineItemActionTypeResponse,
.attr_list = {
.num_attributes = ARRAY_LENGTH(action2_attributes),
.attri... | cl_assert(notification_storage_get(&id, &r)) | ;
compare_notifications(&e, &r);
free(r.allocated_buffer);
Uuid invalid_uuid;
uuid_generate(&invalid_uuid);
cl_assert_equal_b(notification_storage_get(&invalid_uuid, &r), false);
}
void test_notification_storage__multiple(void) {
Uuid i1 ;
uuid_generate(&i1);
TimelineItem e1 = {
.header = {
... |
/*
* 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_buffer, &s_buffer_client) | > 0) {
write_message();
// The above function mucks with the mutex
mutex_assert_held_by_curr_task(s_buffer_mutex, true /* is_held */);
}
if (is_async) {
s_is_flash_write_scheduled = false;
}
mutex_unlock(s_buffer_mutex);
mutex_unlock(s_flash_write_mutex);
}
void advanced_logging_init(void... |
roll_layer);
extern void prv_scroll_layer_set_content_offset_internal(ScrollLayer *scroll_layer, GPoint offset);
extern uint16_t prv_scroll_layer_get_paging_height(ScrollLayer *scroll_layer);
// Setup
////////////////////////////////////
void test_scroll_layer__initialize(void) {}
void test_scroll_layer__cleanup(void... | scroll_layer_create(GRect(0,0,180,page_height)) | ;
// validate enable paging works for paging height
scroll_layer_set_paging(scroll_layer, true);
cl_assert_equal_i(page_height, prv_scroll_layer_get_paging_height(scroll_layer));
int pages = 2;
int offset = 0;
// setup content size to be slightly more than 2 pages
GSize content_size = GSize(180, page_he... |
/*
* 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... | memcpy(response.name, evt->value, evt->length) | ;
hc_protocol_enqueue_with_payload(HcEndpointID_GapService,
HcMessageID_GapService_DeviceNameRequest,
(void *)&response, sizeof(HcProtocol_GapDeviceNameResponse));
}
|
_REG;
uint16_t FORCE_SLEEP_REG;
uint16_t LDOS_DISABLE_REG;
uint16_t AON_SPARE_REG;
// QSPIC
uint32_t QSPIC_CTRLMODE_REG;
uint32_t QSPIC_BURSTCMDA_REG;
uint32_t QSPIC_BURSTCMDB_REG;
uint32_t QSPIC_WRITEDATA_REG;
uint32_t QSPIC_DUMMYDATA_REG;
uint32_t QSPIC_ERASECTRL_REG;
uint32_t QSPIC_ERAS... | (DCDC, DCDC_V14_1_REG, DCDC_V14_ENABLE_LV, 0x1) | ;
REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_CUR_LIM_MAX_LV, 0x6);
REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_IDLE_HYST, 0x4);
REG_SETF(DCDC, DCDC_V14_1_REG, DCDC_V14_IDLE_MIN, 0x10);
REG_SETF(DCDC, DCDC_V18_0_REG, DCDC_V18_FAST_RAMPING, 0x1);
REG_SETF(DCDC, DCDC_V18_0_REG, DCDC_V18_VOLTAGE, 0x18);
REG_SETF(DCDC... |
u_set_content_type(option_menu, config->content_type);
option_menu_set_status_colors(option_menu, config->status_colors.background,
config->status_colors.foreground);
option_menu_set_highlight_colors(option_menu, config->highlight_colors.background,
... | GEdgeInsets(0, text_inset) | );
text_frame.origin.y -= fonts_get_font_cap_offset(title_font);
if (title) {
graphics_draw_text(ctx, title, title_font, text_frame, overflow_mode, text_alignment, NULL);
}
}
|
/*
* 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... | (&chip_id) | ) {
response_payload = (const uint8_t *)&chip_id;
}
// Send back empty response in case of failure.
hc_protocol_enqueue_response(request, response_payload, response_payload ? sizeof(chip_id) : 0);
}
void hc_endpoint_chip_id_handler(const HcProtocolMessage *msg) {
switch (msg->command_id) {
case HcMessa... |
zone_database_load_region_info(region_id, tz_info);
prv_update_dstrule_timestamps_by_dstzone_id(tz_info, utc_time);
#endif
}
static TimezoneInfo prv_get_timezone_info_from_data(TimezoneCBData *tz_data) {
int region_id = -1;
if (tz_data->region_name_len) {
region_id = timezone_database_find_region_by_name(tz... | prv_migrate_local_time_to_UTC(new_time) | |
, 408, -632},
{ -808, 536, -528},
{ -784, 488, -600},
{ -768, 472, -600},
{ -728, 472, -552},
{ -728, 496, -528},
{ -704, 496, -512},
{ -720, 440, -528},
{ -728, 528, -424},
{ -704, 432, -504},
{ -720, 504, -440},
{ -704, 520, -472},
{ -744, 552, -480},
{ -688, 568, -... | { -96, -736, -808},
{ -144, -720, -752},
{ -216, -776, -848},
{ -224, -696, -840},
{ -352, -672, -888},
{ -336, -768, -856},
{ -400, -752, -872},
{ -368, -736, -920},
{ -312, -520, -896},
{ -448, -648, -912},
{ -584, -424, -752},
{ -376, -728, -872},
{ -544, -424, -72... | |
/* begin as the next segment. */
if(next_block == heap->end) {
/* We can't combine the begin with the end, so just */
/* update the PrevSize field. */
heap->begin->PrevSize = heap_info_ptr->Size;
}
else {
HEAP_ASSERT_SA... | get_next_block(heap, heap_info_ptr) | ;
}
} else {
break;
}
}
// make sure the space we found is within the bounds of the heap
UTIL_ASSERT((heap_info_ptr >= heap->begin) &&
(heap_info_ptr <= heap->end));
return heap_info_ptr;
}
//! Split a block into two smaller blocks, returning a pointer to the new second block.
//! T... |
ST_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 is in SettingsFile format.
int pid = persist_map_auto_id(uuid);
if (FAILED(pid... | PBL_ASSERTN(store &&
list_contains(s_client_stores, &store->list_node) &&
store->usage_count >= 1) | ;
if (--store->usage_count == 0) {
if (store->file_open) {
settings_file_close(&store->file);
}
list_remove(&store->list_node,
&s_client_stores /* &head */, NULL /* &tail */);
kernel_free(store);
}
}
prv_unlock();
}
|
s.h"
#include "util/uuid.h"
// Fixture
////////////////////////////////////////////////////////////////
// Fakes
////////////////////////////////////////////////////////////////
#include "fake_spi_flash.h"
#include "fake_system_task.h"
#include "fake_kernel_services_notifications.h"
// Stubs
////////////////////////... | 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));
cl_assert_equal_i(contacts_db_insert((uin... |
BBLE_PROTOCOL);
bt_lock();
if (resp) {
resp->opcode = PULSE_PP_OPCODE_DATA;
const size_t bytes_to_copy = MIN(bytes_remaining, mss);
comm_session_send_queue_copy(session, 0 /* start_offset */,
bytes_to_copy, &resp->data[0]);
pulse_reliable_send(resp, b... | bt_unlock() | ;
}
static void prv_pulse_pp_handle_data(void *data, size_t length) {
bt_lock();
if (!s_transport.session) {
PBL_LOG(LOG_LEVEL_ERROR, "Received PULSE serial data, but session not connected!");
goto unlock;
}
comm_session_receive_router_write(s_transport.session, data, length);
unlock:
bt_unlock();
... |
imer_get_ticks(void) {
return hw_timer0_get_on();
}
static uint16_t prv_timer_delta(uint16_t start_ticks, uint16_t end_ticks) {
// The timer is configured to repeatedly count down from 65535, resetting at 0 back to 65535.
// The delta calculated here takes advantage of the underflow to produce the correct result... | {
// Buffer is full. Shift everything down one byte.
rx_index--;
memmove(&buffer[0], &buffer[1], rx_index);
} |
}
} else { // Tx Mode
if (hw_spi_is_tx_fifo_full(s_spi->bus_id)) {
// Don't spin for too long, just in case the host doesn't clock out our response
if (!prv_timer_check_delta(tx_start_ticks, TIMER0_10_MS)) {
break;
}
continue;
}
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
va_list args;
va_start(args, animation_c);
Animation *animation = prv_create_from_vararg(animation_a, animation_b, animation_c, args);
va_end(args);
return animation;
} | |
nd_start_direction = false;
bool start_is_down = false;
int16_t *intersections_up = NULL;
int16_t *intersections_down = NULL;
rot_points[0] = rot_end = rotate_offset_point(&path->points[0], path->rotation, &path->offset);
min_x = max_x = rot_points[0].x;
min_y = max_y = rot_points[0].y;
// begin finding... | sort16(intersections_down, intersection_down_count);
// draw the line segments
for (int j = 0; j < MIN(intersection_up_count, intersection_down_count); j++) {
int16_t x_a = intersections_up[j];
int16_t x_b = intersections_down[j];
if (x_a != x_b) {
if (x_a > x_b) {
swap1... |
cleanup:
applib_free(rot_points);
applib_free(intersections_up);
applib_free(intersections_down);
}
void gpath_fill_precise_internal(GContext *ctx, GPointPrecise *points, size_t num_points) {
if (!points) {
return;
}
// Convert precise points to normal points and draw filled path with converted point... |
st, prv_compare_analytic, (void *)(uintptr_t)metric);
}
static void prv_add_analytic_node(DialogAnalyticsMetric metric) {
AnalyticsNode *node = kernel_malloc_check(sizeof(AnalyticsNode));
*node = (AnalyticsNode) {
.metric = metric,
};
s_analytics_list = list_prepend(s_analytics_list, (ListNode *)node);
}
... | analytics_stopwatches_update(rtc_get()) | ;
prv_lock();
ListNode *iter = s_analytics_list;
while (iter) {
AnalyticsNode *node = (AnalyticsNode *)iter;
cb(node->metric, node->value, context);
iter = iter->next;
}
prv_unlock();
}
// Unit Test Helpers
uint32_t analytics_get_value(DialogAnalyticsMetric metric) {
AnalyticsNode *node = pr... |
ss_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_line(ctx, GPoint(-25, 35), GPoint(15, 40));
}
void across_y_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_colo... | layer_set_update_proc(&layer, &inside_layer_update_callback) | ;
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_line_inside_origin_layer")));
layer_set_update_proc(&layer, &clear_layer_update_callback);
layer_render_tree(&layer, &ctx);
#if SCREEN_COLOR_DEPTH_BITS == 8
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ... |
click_subscribe(BUTTON_ID_SELECT, prv_raw_down_handler, prv_raw_up_handler, NULL);
window_raw_click_subscribe(BUTTON_ID_DOWN, prv_raw_down_handler, prv_raw_up_handler, NULL);
}
////////////////////////////////////////////////////////////
// Windows
static void prv_update_background_image_and_url_text(RecoveryFUAppD... | memmove(&data->name_text_buffer[1], &data->name_text_buffer[0], BT_DEVICE_NAME_BUFFER_SIZE) | ;
data->name_text_buffer[0] = '-';
strcat(data->name_text_buffer, "-");
}
}
text_layer_set_text(&data->name_text_layer, data->name_text_buffer);
// Set the name font
#if !PLATFORM_ROBERT && !PLATFORM_CALCULUS
const bool first_use_is_complete = shared_prf_storage_get_getting_started_complete();
... |
/*
* 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... | text_layer_set_background_color(text_layer, GColorWhite) | ;
text_layer_set_text_color(text_layer, GColorBlack);
} else {
text_layer_set_background_color(text_layer, GColorClear);
text_layer_set_text_color(text_layer, GColorWhite);
}
text_layer_set_text_alignment(text_layer, GTextAlignmentLeft);
text_layer_set_text(text_layer, text_buffer);
}
static void s... |
ed_prf_storage_set_getting_started_complete(toggle);
cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), toggle);
cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), i);
toggle = !toggle;
}
}
}
void test_shared_prf_storage_v3__save_all_data_confirm_all_data_correct(... | SPRF_PAGE_FLASH_OFFSET(shared_prf_storage_get_valid_page_number()) | |
d prv_send_ack_nack(uint16_t endpoint_id, const uint8_t* data,
unsigned int length, bool nack) {
const int o = offsetof(AppMessage, payload[0].push.dictionary);
cl_assert_equal_i(length, o + dict_calc_buffer_size(1, MAX_DATA_SIZE));
CommSession *session = s_fake_app_comm_session;
AppMessage *message = ... | cl_assert_equal_i(length, max_length) | ;
}
cl_assert_equal_p(s_sent_data, NULL);
s_sent_data = kernel_malloc(length);
cl_assert(s_sent_data);
memcpy(s_sent_data, data, length);
s_sent_data_length = length;
s_sent_endpoint_id = endpoint_id;
}
bool sys_app_pp_send_data(CommSession *session, uint16_t endpoint_id,
const... |
riteData;
}
}
}
static void prv_enable_interrupts(I2CBus *bus) {
bus->hal->i2c->CR1 |= I2C_CR1_ERRIE | // Enable error interrupt
I2C_CR1_NACKIE | // Enable NACK interrupt
I2C_CR1_TCIE | // Enable transfer complete interrupt
I2C_CR1_TXIE; ... | (bus, I2CTransferEvent_NackReceived) | ;
}
if ((i2c->ISR & I2C_ISR_TCR) != 0) {
prv_resume_transfer(bus, false /* !generate_start */);
}
if ((i2c->ISR & I2C_ISR_TC) != 0) {
return prv_end_transfer_irq(bus, I2CTransferEvent_TransferComplete);
}
break;
case I2CTransferState_Complete:
if (i2c->ISR ... |
/*
* 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... | {
uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR);
current_value |= bit;
RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value);
} |
void boot_bit_clear(BootBitValue bit) {
uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR);
current_value &= ~bit;
RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value);
}
bool boot_bit_test(BootBitValue bit) {
uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR);
retur... |
BL_LOG(LOG_LEVEL_INFO, "Size of session %d: %d", i, size);
total_bytes += size;
}
PBL_LOG(LOG_LEVEL_INFO, "total bytes: %d", total_bytes);
cl_assert(total_bytes < DLS_TOTAL_STORAGE_BYTES);
}
// ----------------------------------------------------------------------------------------
// Test logging a LOT of... | {
uint32_t data[] = { 1, 2, 3 };
// Make sure logging to bogus sessions does the right thing.
cl_assert_equal_i(data_logging_log(0, data, ARRAY_LENGTH(data)), DATA_LOGGING_INVALID_PARAMS);
cl_assert_equal_i(data_logging_log(&data, data, ARRAY_LENGTH(data)), DATA_LOGGING_INVALID_PARAMS);
// Make sure closing... |
// ----------------------------------------------------------------------------------------
//! Try using sessions after we've closed them.
void test_data_logging__invalid_session_use_after_close(void) {
uint32_t data[] = { 1, 2, 3 };
DataLoggingSessionRef session = data_logging_create(0x1234, DATA_LOGGING_UINT,... |
num_attributes,
uint8_t num_actions,
const uint8_t *attributes_per_actions) {
attribute_group_init(GROUP_TYPE,
attr_list,
action_group,
buffer,
num_attributes,
... | (buffer + attr_list_size, buf_end) | );
if (!rv) {
PBL_LOG(LOG_LEVEL_ERROR, "Error deep-copying pin attribute list");
return false;
}
}
if (src_action_group && dest_action_group) {
rv = prv_action_group_copy(dest_action_group, src_action_group,
buffer + attr_list_size, buf_end);
if (!rv) {
... |
/*
* 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... | (ctx, (GBitmap*)&s_gfx_rotated_bitmap_bitmap,
bitmap_center, DEG_TO_TRIGANGLE(45), bitmap_center) | ;
}
static void prv_test_0_assign_64px(Layer *layer, GContext* ctx) {
graphics_context_set_compositing_mode(ctx, GCompOpAssign);
graphics_draw_rotated_bitmap(ctx, (GBitmap*)&s_gfx_rotated_bitmap_64_bitmap,
GPointZero, 0, GPointZero);
}
static void prv_test_0_set_64px(Layer *layer, G... |
ia have been met, show reward
prv_push_reward(now_utc, &SLEEP_REWARD_NOTIF_CONFIG);
}
// -----------------------------------------------------------------------------------------
// Format a time given in seconds after midnight
static void prv_strcat_formatted_time(int32_t time_seconds, char *out_buf, size_t buf_len... | ("%s of sleep", &pin_attr_list) | ; /// "10H 30M of sleep"
snprintf(short_subtitle, max_attr_length, short_subtitle_fmt, elapsed);
attribute_list_add_cstring(&pin_attr_list, AttributeIdShortSubtitle, short_subtitle);
attribute_list_add_cstring(&pin_attr_list, AttributeIdSubtitle, elapsed);
const char *title_i18n = PBL_IF_RECT_ELSE(i18n_noop("Y... |
/ // expectation as derived from Appfaces_all.psd
cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0xff0000)).argb);
cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0x00aaff)).argb);
cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0xaa0055)).argb);
cl_assert_equal_i(GColorBlackARGB8, fun(GColo... | cl_assert(gcolor_equal(lookup_table_out[1], GColorDarkGray)) | ;
cl_assert(gcolor_equal(lookup_table_out[2], GColorLightGray));
cl_assert(gcolor_equal(lookup_table_out[3], GColorWhite));
// Setting the tint color to blue should result in a gradient from blue to yellow
tint_color = GColorBlue;
gcolor_tint_luminance_lookup_table_init(tint_color, lookup_table_out);
cl_as... |
/*
* 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... | (cursor, "/") | ;
cursor[sep_pos] = '\0';
// Store pointer to region name
region_names[i] = cursor + sep_pos + 1;
// If the continent is the same as the last entry, keep going as-is
if (strcmp(cursor, last_cursor) == 0) {
data->continent_end[continent_index] = i + 1;
continue;
}
// If the new co... |
if (dir == CompositorTransitionDirectionLeft) {
graphics_fill_radial_internal(ctx, circle_center, circle_radius,
DISP_COLS - circle_center.x + 1, 0, TRIG_MAX_ANGLE);
} else {
graphics_fill_circle(ctx, circle_center, circle_radius);
}
} else {
const int16_t ... | {
static const CompositorTransition s_impl = {
.init = prv_round_flip_transition_from_launcher_animation_init,
.update = prv_round_flip_transition_animation_update,
};
return &s_impl;
} |
}
|
long_click = prv_information_long_click_callback,
});
menu_layer_set_highlight_colors(menu_layer, SETTINGS_MENU_HIGHLIGHT_COLOR, GColorWhite);
menu_layer_set_click_config_onto_window(menu_layer, &data->window);
layer_add_child(&data->window.layer, menu_layer_get_layer(menu_layer));
}
static void prv_informati... | {
int16_t x = (MARK_PADDING / 2);
GRect box = cell_layer->bounds;
const bool highlight = menu_cell_layer_is_highlighted(cell_layer);
const int16_t vertical_padding = 6;
const GPoint mark_origin = GPoint(x, vertical_padding);
x = prv_draw_generic_mark(ctx, mark, mark_origin, highlight) + (MARK_PADDING / 2);
... |
static void prv_draw_rt_cell_round(GContext *ctx, const Layer *cell_layer, GBitmap *mark,
const char *text, bool is_selected) {
GRect rt_rect = cell_layer->bounds;
const int16_t horizontal_padding = 10;
const int16_t vertical_padding = is_selected ? 6 : 0;
rt_rect = grect_in... |
((baudrate != s_baudrate) || force_update) {
PBL_LOG(LOG_LEVEL_DEBUG, "Changing accessory connector baud rate to %"PRIu32, baudrate);
prv_initialize_uart(baudrate);
if (s_dma_enabled) {
// we need to reset DMA after resetting the UART
prv_disable_dma();
prv_enable_dma();
}
}
}
void ... | prv_unlock() | ;
}
void accessory_disable_input(void) {
// NOTE: This function may be called from an ISR
prv_lock();
PBL_ASSERTN(s_input_enabled);
s_input_enabled = false;
s_send_history.has_data = false;
s_bus_contention_detected = false;
prv_unlock();
}
void accessory_enable_input(void) {
// NOTE: This function m... |
box_params));
cl_assert(line.height_px == 10);
cl_assert(line.width_px == 2 * HORIZ_ADVANCE_PX);
cl_assert(iter_next(&word_iter));
cl_assert(!line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params));
cl_assert(line.height_px == 10);
cl_assert(line.width_px == 2 * HORIZ_ADVANCE_PX);
cl_... | (line.origin.x == 0) | ;
cl_assert(line.suffix_codepoint == '-');
cl_assert(*line.start == 'a');
// mal-
cl_assert(*word_iter_state.current.start == 'm');
cl_assert(*word_iter_state.current.end == '\0');
cl_assert(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 8);
line_reset(&line, utf8_bounds.start);
cl_assert(line... |
&s_all_day_items[2].header.id));
cl_assert(state.node->all_day);
// check that the item we see is timestamped at local midnight rather than utc midnight
// 1421136000 is midnight Jan 13, PST
cl_assert_equal_i(state.pin.header.timestamp, 1421136000);
// second all day event
cl_assert(iter_next(&iterator));... | cl_assert(!iter_next(&iterator)) | ;
}
static void prv_insert_extra_case_items(void) {
pin_db_flush();
for (int i = 0; i < ARRAY_LENGTH(s_extra_case_items); i++) {
cl_assert_equal_i(pin_db_insert_item(&s_extra_case_items[i]), 0);
}
}
// 5am, no events passed
void test_timeline__extra_case_forwards(void) {
prv_insert_extra_case_items();
... |
r_start_unmodulated_tx(atoi(tx_channel));
}
void command_btle_unmod_tx_stop(void) {
bt_driver_stop_unmodulated_tx();
}
void command_btle_test_le_tx_start(
char *tx_channel, char *tx_packet_length, char *packet_payload_type) {
bt_driver_le_transmitter_test(
atoi(tx_channel), atoi(tx_packet_length), atoi(... | GPoint(DISP_COLS, DISP_ROWS) | );
// ~39 degrees
graphics_draw_line(ctx, GPoint(0, DISP_ROWS/5), GPoint(DISP_COLS, DISP_ROWS));
profiler_stop();
uint32_t total_time = profiler_get_total_duration(false);
uint32_t us = profiler_get_total_duration(true);
char buf[80];
prompt_send_response_fmt(buf, sizeof(buf),
... |
, 4);
}
void across_x_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_round_rect(ctx, &GRect(16, 2, 28, 20), 4);
}
void across_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics_contex... | (&ctx.dest_bitmap, "draw_round_rect_inside_origin_layer.${BIT_DEPTH_NAME}.pbi") | );
layer_set_update_proc(&layer, &white_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&l... |
const jerry_value_t argv[],
ToStringFormat date_default_format,
ToStringFormat time_default_format) {
// both, .toLocaleTimeString() and .toLocaleDateString() fall back to "<date>... | {
JS_VAR global = jerry_get_global_object();
prv_rocky_add_date_functions(global);
} |
const RockyGlobalAPI DATETIME_APIS = {
.init = prv_init,
};
|
erences);
client = next;
}
}
bt_unlock();
}
void ppogatt_handle_service_discovered(BLECharacteristic *characteristics) {
bt_lock();
{
// Create new clients:
PPoGATTClient *client = prv_create_client();
BLECharacteristic meta = characteristics[PPoGATTCharacteristicMeta];
client->charac... | if (!packet) {
return NULL;
} | |
tingCommandNone = 0,
ExecutingCommandDbgSerial, //!< Currently executing command through dbgserial
ExecutingCommandPulse, //!< Currently executing command is through Pulse
ExecutingCommandContext, //!< Currently executing command is a custom \ref PromptContext
} ExecutingCommand;
static bool s_command_cont... | (cmd_iter->cmd_str, cmd, cmd_iter_length) | == 0) {
prv_execute_given_command(cmd_iter, cmd + cmd_iter_length, cmd + cmd_len);
command_found = true;
break;
}
}
if (!command_found) {
cmd[cmd_len] = '\0';
char buffer[64];
prompt_send_response_fmt(buffer, sizeof(buffer), "Invalid command <%s>! Try 'help'", cmd);
prompt... |
ebble_task_bit_for_client(c);
s_is_notification_event_pending[c] = true;
}
}
prv_unlock();
}
if (UNLIKELY(task_mask != task_mask_none)) {
prv_send_notification_event(task_mask);
}
unlock:
bt_unlock();
}
// ------------------------------------------------------------------------------... | {
*header_out = header;
} |
}
return has_notification;
}
// -------------------------------------------------------------------------------------------------
bool gatt_client_subscriptions_get_notification_header(GAPLEClient client,
GATTBufferedNotificationHeader *header_out) {
bool ... |
_t processed_command_max_size,
const GDrawCommandList* list,
const GDrawCommand *command) {
gdraw_command_set_stroke_color(processed_command,
prv_invert_bw_color(gdraw_command_get_stroke_color((GDrawCommand *)command)));
gdraw_command_set_fil... | gdraw_command_image_draw(ctx, icon, icon_rect.origin) | ;
// more box by icon + some margin
const int16_t icon_space = icon_rect.origin.y + icon_rect.size.h - 12;
// manually inset to save stack space, instead of using grect_inset
box->origin.y += icon_space;
box->size.h -= icon_space;
}
// hack: compensate for text placement inside a rect
box->... |
_task_context.safe_to_kill = false;
// Enter unprivileged mode!
const bool is_unprivileged = s_worker_task_context.app_md->is_unprivileged;
if (is_unprivileged) {
mcu_state_set_thread_privilege(false);
}
const PebbleMain main_func = entry_point;
main_func();
// Clean up after the worker. Remember ... | (&worker_segment, NULL,
stack_size) | ;
PBL_ASSERTN(stack);
s_worker_task_context.load_start = worker_segment.start;
g_worker_load_address = worker_segment.start;
void *entry_point = process_loader_load(app_md, PebbleTask_Worker,
&worker_segment);
s_worker_task_context.load_end = worker_segment.start;
i... |
n the new application's framebuffer and any transparent modal
static void prv_draw_in(GContext *ctx, int move_size, uint32_t distance, bool vertical,
bool invert) {
const int16_t current_offset_px = prv_interpolate_two_ways(distance, invert ? -move_size :
... | animation_create() | ;
if (s_data.first_anim) {
anim_array[anim_count++] = s_data.first_anim;
static const AnimationImplementation s_first_animation_impl = {
.update = prv_transition_animation_first_update,
};
animation_set_implementation(s_data.first_anim, &s_first_animation_impl);
animation_set_duration(s_data... |
(freertos_mutex) | ;
return mutex;
}
void mutex_lock_recursive(PebbleRecursiveMutex * handle) {
uintptr_t myLR = (uintptr_t) __builtin_return_address(0);
OS_ASSERT(!mcu_state_is_isr());
xLightMutexLockRecursive(handle->common.freertos_mutex, portMAX_DELAY);
LOG_LOCKED(handle->common.lr, myLR);
}
bool mutex_lock_recursive_wit... | |
/*
* 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... | (out_error) | ;
// Search for end of the App ID before checking that all attributes are present.
while (length > 0) {
length--;
if (*data++ == 0) {
break;
}
}
if (length == 0) {
*out_error = false;
return false;
}
return ancs_util_get_attr_ptrs(data, length,
s_f... |
sion 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 under the License is distributed on an "A... | {
GContext ctx;
test_graphics_context_init(&ctx, fb);
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 10);
graphics_line_draw_precise_stroked_non_aa(&ctx, START_ON_ORIGIN_RECT, END_ON_ORIGIN_RECT, 10);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_inside_origin_la... |
#define OFFSET_RECT_NO_CLIP GRect(10, 10, 144, 168)
#define OFFSET_RECT_CLIP_XY GRect(10, 10, 30, 40)
#define OFFSET_RECT_CLIP_NXNY GRect(10, 10, 30, 40)
void test_graphics_draw_stroke_precise_${BIT_DEPTH_NAME}__offset_layer_aa(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.