prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
/*
* 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 (less > greater) {
max = max_lt_guess;
} else {
min = min_gt_guess;
} |
}
if (less >= ((num_values + 1) / 2)) {
return max_lt_guess;
} else if ((less + equal) >= ((num_values + 1) / 2)) {
return guess;
} else {
return min_gt_guess;
}
}
// ------------------------------------------------------------------------------------------------
void stats_calculate_basic(Stat... |
b)
// we can't be sure that the host isn't still clocking out data from the previous command.
// Shift incoming data through a pattern buffer. When we get a match, send our response.
static bool prv_initial_handshake(void) {
uint8_t rx_index = 0;
uint8_t tx_index = 0;
uint8_t buffer[sizeof(core_dump_connect_ping... | (s_spi->bus_id, (void *)&crc, sizeof(crc), prv_spi_dma_tx_cb, NULL) | ;
host_transport_set_mcu_int(true);
prv_wait_for_dma(true);
host_transport_set_mcu_int(false);
}
static void prv_cmd_handler(bool text_crc_matches) {
CoreDumpSPICmd cmd;
printf("\nHost connected\n");
while (true) {
// Feed the watchdog
hw_watchdog_set_pos_val(0xFF);
prv_get_cmd((uint8_t *)&... |
d) {
prv_insert_extra_case_items();
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast,
s_feb_5_midnight + 11 * 60 * 60), 0);
cl_assert(uuid_equal(&state.pin... | uuid_equal(&state.pin.header.id, &s_items[0].header.id) | );
// check second
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check third
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id));
// check second again
cl_assert(iter_prev(&iterator));
cl_assert(u... |
E);
break;
case 6:
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE);
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO);
break;
case 7:
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE);
break;
default:
PBL_CROAK("reset loop boot bits overrun");
break;
}
return false;
}
static bool check_f... | periph_config_disable(RCC_APB1PeriphClockCmd, RCC_APB1Periph_PWR) | ;
}
void boot_main(void) {
gpio_enable_all();
check_and_handle_resuming_from_standby();
dbgserial_init();
dbgserial_putstr("");
dbgserial_putstr(" ___ _ _ _ ");
dbgserial_putstr("/ __><_>| || |__");
dbgserial_putstr("\\__ \\| || || / /");
dbgserial_putstr("<___/|_||_||_\\_\\");
dbgserial_puts... |
/*
* 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... | (bus->hal->ev_irq_channel, I2C_IRQ_PRIORITY) | ;
NVIC_SetPriority(bus->hal->er_irq_channel, I2C_IRQ_PRIORITY);
NVIC_EnableIRQ(bus->hal->ev_irq_channel);
NVIC_EnableIRQ(bus->hal->er_irq_channel);
prv_i2c_deinit(bus);
}
static void prv_i2c_init(I2C_TypeDef *i2c, TIMINGR timingr) {
// Soft reset of the state machine and status bits by disabling the peripher... |
/*
* 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... | while (1) ; |
}
void passert_failed_hashed_no_message(void) {
EM_ASM_INT_V({ abort(); });
while (1);
}
void passert_failed_hashed(uint32_t packed_loghash, ...) {
EM_ASM_INT_V({ abort(); });
while (1);
}
void pbl_log(uint8_t log_level, const char* src_filename,
int src_line_number, const char* fmt, ...) {
p... |
ource_id) - VIBE_DATA_OFFSET;
*data_size = output_data_size;
}
return true;
}
bool vibe_score_validate(VibeScore *score, uint32_t data_size) {
if (!score) {
return false;
}
uint32_t total_size = sizeof(VibeScore);
// check large enough to contain non-flexible parts
if (data_size < total_size) {... | PBL_ASSERTN(notes_attribute && pattern_attribute) | ;
unsigned int duration_ms = 0;
VibeNote *note_list = prv_vibe_score_get_note_list(notes_attribute);
VibeNoteIndex *pattern_list = prv_vibe_score_get_pattern_list(pattern_attribute);
unsigned int pattern_length = prv_vibe_score_get_pattern_length(pattern_attribute);
for (unsigned int i = 0; i < pattern_leng... |
512, -992},
{ -184, 592, -840},
// 10 seconds
{ -72, 472, -704},
{ 0, 296, -584},
{ -80, 296, -504},
{ -152, 344, -624},
{ -128, 376, -824},
{ -64, 472, -984},
{ -136, 520, -1160},
{ -16, 568, -1264},
{ -48, 480, -1184},
{ 32, 720, -1152},
{ 248, 584, -1152},
{ 22... | { 16, 416, -1136},
{ -24, 456, -1168},
{ 64, 552, -1120},
{ 136, 576, -1048},
{ 64, 552, -1016},
{ 80, 488, -912},
{ 56, 320, -696},
{ -80, 272, -640},
{ -160, 208, -664},
{ -208, 192, -768},
{ -232, 296, -920},
{ -352, 368, -1096},
{ -240, 512, -1296},
{ -240, 52... |
{ -120, 616, -1176},
// 18 seconds
{ -128, 480, -968},
{ -136, 560, -984},
{ -80, 448, -880},
{ -40, 320, -728},
{ -136, 304, -704},
{ -192, 296, -720},
{ -168, 288, -808},
{ -88, 392, -976},
{ -128, 464, -1112},
{ -80, 456, -1176},
{ -48, 424, -1080},
{ -64, 544... |
}
s_num_precise_lines = 0;
}
// setup and teardown
void test_gdraw_command__initialize(void) {
prv_reset();
}
void test_gdraw_command__cleanup(void) {
if (s_stroke_points) {
free(s_stroke_points);
s_stroke_points = NULL;
}
if (s_fill_points) {
free(s_fill_points);
s_fill_points = NULL;
... | (points, s_fill_points, s_path_num_points) | );
prv_reset();
// restore stroke color and change both points
gdraw_command_set_stroke_color(command, GColorPurple);
GPoint points2[] = { { 23, 45 }, { 67, 13} };
gdraw_command_set_point(command, 0, points2[0]);
gdraw_command_set_point(command, 1, points2[1]);
gdraw_command_draw(NULL, command);
cl_as... |
ck_handler(ClickRecognizerRef recognizer, void *context) {
}
// -------------------------------------------------------------------------------
static void down_click_handler(ClickRecognizerRef recognizer, void *context) {
}
// -------------------------------------------------------------------------------
static vo... | (CUR_TEMP_RECT) | ;
text_layer_set_text_alignment(data->cur_temp_layer, GTextAlignmentCenter);
text_layer_set_font(data->cur_temp_layer,
fonts_get_system_font(FONT_KEY_LECO_20_BOLD_NUMBERS));
text_layer_set_background_color(data->cur_temp_layer, GColorClear);
text_layer_set_text_color(data->cur_temp_layer, ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert_equal_i(-8 * 60 * 60, tz_info.tm_gmtoff) | ;
TimezoneDSTRule start;
TimezoneDSTRule end;
result = timezone_database_load_dst_rule(tz_info.dst_id, &start, &end);
cl_assert_equal_i(start.ds_label, 'D');
cl_assert_equal_i(start.month, 2);
cl_assert_equal_i(start.mday, 8);
cl_assert_equal_i(start.hour, 2);
cl_assert_equal_i(end.ds_label, 'S');
... |
;
cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]);
// totally wrong
menu_layer_set_selected_next(&l, true, MenuRowAlignNone, false);
cl_assert_equal_i(2 * FOCUSED, l.selection.y);
cl_assert_equal_i(NORMAL, l.selection.h);
cl_assert_equal_b(false, s_content_available[ContentIndic... | (&l, true) | ;
menu_layer_set_callbacks(&l, NULL, &(MenuLayerCallbacks) {
.draw_row = prv_draw_row,
.get_num_rows = prv_get_num_rows,
.selection_will_change = prv_skip_odd_rows,
});
menu_layer_reload_data(&l);
cl_assert_equal_i(0, menu_layer_get_selected_index(&l).section);
cl_assert_equal_i(0, menu_layer_get_... |
ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "applib/graphics/graphics.h"
#include "applib/graphics/framebuffer.h"
#include "applib/ui/window_private.h"
#include "applib/ui/layer.h"... | (&ctx.dest_bitmap, "stroke_circle_origin_aa_r1_clip_nxny.${BIT_DEPTH_NAME}.pbi") | );
// Testing of the special cases for radius:
// Radius of 3 - starting point for calculated edges
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_THREE);
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_MIN_CALCULATED);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitma... |
ot_points[i].y.integer; }
if (max_y < rot_points[i].y.integer) { max_y = rot_points[i].y.integer; }
if (found_start_direction) {
continue;
}
// use the first non-horizontal path segment's direction as the start direction
if (rot_end.y.integer != rot_start.y.integer) {
start_is_down = r... | FIXED_S16_3_ONE.raw_value};
if (delta.integer > 1) {
// this is where we try to fix edges diving in and out of paths
int16_t min_x = rot_end.x.raw_value < rot_start.x.raw_value ?
rot_end.x.raw_valu... |
Intersection x_b = intersections_down[j];
if (x_a.x.integer != x_b.x.integer) {
if (x_a.x.integer > x_b.x.integer) {
swapIntersections(&x_a, &x_b);
}
// this is done by callback now...
// x_a.x.integer++;
// x_b.x.integer--;
cb(ctx, i, x_a.x, x_b.x... |
ResultIncompatibleJSFailure);
} else {
// Set prev_error as a Success.
s_fetch_state.prev_error = AppFetchResultSuccess;
prv_put_event_simple(AppFetchEventTypeFinish);
}
app_install_release_md(md);
} else {
PBL_LOG(LOG_LEVEL_ERROR, "Failed to insert into app cache: %"... | (sizeof(AppFetchInstallRequest)) | ;
// reset all state
s_fetch_state = (AppFetchState){};
// Mark whether the worker needs to be sent over.
s_fetch_state.worker = !has_worker;
s_fetch_state.app_id = app_id;
s_fetch_state.in_progress = true;
// populate fields
request->command = APP_FETCH_INSTALL_COMMAND;
request->uuid = *uuid;
... |
{ 0, 0x41, 167, 151, 0},
{ 0, 0x51, 1670, 154, 0},
{ 0, 0x51, 260, 138, 0},
{ 0, 0x51, 787, 156, 0},
{ 0, 0x62, 1150, 172, 0},
{ 0, 0x41, 2070, 152, 0},
{ 0, 0x51, 1533, 162, 0},
{ 0, 0x51, 229, 164, 0},
{ 0, 0x51, 144, 160, 0},
{ 0, 0x72, 720, 167, 0},
{ 0, 0x73, 277, 165, 0},
... | { 0, 0x5c, 0, 128, 0},
{ 0, 0x5c, 0, 128, 0},
{ 0, 0x5c, 0, 128, 0},
{ 0, 0x5c, 0, 128, 0},
{ 0, 0x5c, 0, 128, 0},
{ 0, 0x5c, 0, 129, 0},
{ 0, 0x5c, 0, 128, 0},
{ 0, 0x5c, 0, 128, 0},
{ 0, 0x5c, 0, 129, 0},
{ 0, 0x5c, 0, 129, 0},
{ 0, 0x5c, 0, 128, 0},
// 135: Local time:... |
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 105, 141, 0},
// 180: Local time: 2016-05-20 12:05:00 AM
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
... |
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 the License for t... | (vsys_mv > 0) | ;
duty_cycle = (BOARD_CONFIG_VIBE.vsys_scale * duty_cycle) / vsys_mv;
}
return duty_cycle;
}
}
static void prv_vibe_raw_ctl(bool on) {
if (BOARD_CONFIG_VIBE.options & ActuatorOptions_Pwm) {
const uint32_t duty_cycle = (on) ? s_vibe_duty_cycle : PWM_DUTY_CYCLE_OFF;
prv_vibe_pwm_enable(on);
... |
.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 permissions and
* l... | {
uint32_t sub_seconds = 0;
RTC_DateTypeDef rtc_date;
RTC_TimeTypeDef rtc_time;
// NOTE: There is a tricky rollover situation that can occur here if the date rolls over
// between when we read the date and time registers. For example:
// read date: 1/1/14 (actual time 11:59:59 PM)
// [date rolls o... |
// This causes time to go backwards once a day unless we unlock it after reading from RTC_TR
RTC_GetDate(RTC_Format_BIN, &rtc_date);
if (rtc_time.RTC_Seconds == rtc_time_before.RTC_Seconds) {
break;
}
}
PBL_ASSERTN(max_loops > 0);
struct tm current_time = {
.tm_sec = rtc_time.RTC_Secon... |
rent platform
const PlatformType sdk_platform =
process_metadata_get_app_sdk_platform(s_app_task_context.app_md);
if (sdk_platform == PBL_PLATFORM_TYPE_CURRENT) {
*size = GSize(DISP_COLS, DISP_ROWS);
return;
}
// We cannot use the SDK type for this compatibility check but there's
// also no easy... | {
syscall_assert_userspace_buffer(uuid, sizeof(*uuid));
} |
*uuid = app_manager_get_current_app_md()->uuid;
}
DEFINE_SYSCALL(Version, sys_get_current_app_sdk_version, void) {
return process_metadata_get_sdk_version(app_manager_get_current_app_md());
}
DEFINE_SYSCALL(bool, sys_get_current_app_is_js_allowed, void) {
return (app_manager_get_current_app_md()->allow_js);
}... |
/*
* 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... | jerry_object_to_string_to_utf8_char_buffer(exception, buffer,
sizeof(buffer) - 1) | ;
if (written > 0) {
APP_LOG(APP_LOG_LEVEL_ERROR, "%s", buffer);
} else {
APP_LOG(APP_LOG_LEVEL_ERROR, "no further info.");
}
}
void jerry_set_object_field(jerry_value_t object, const char *field, jerry_value_t value) {
JS_VAR prop_name = jerry_create_string((jerry_char_t *)field);
JS_UNUSED_VAL = je... |
e "process_management/app_manager.h"
#include "process_management/worker_manager.h"
#include "prompt.h"
#include "resource/resource_storage_flash.h"
#include "services/common/compositor/compositor.h"
#include "services/common/system_task.h"
#include "services/normal/filesystem/pfs.h"
#include "syscall/syscall.h"
#inclu... | if (length == 0) {
prompt_send_response("Invalid length");
return;
} |
// Allocate a 1KB buffer to read data in segments
uint8_t *buffer = (uint8_t *) kernel_malloc(MIN(MAX_READ_FLASH_SIZE,length));
if (buffer == 0) {
prompt_send_response("Unable to allocate read buffer");
return;
}
while (length > 0) {
uint32_t read_length = MAX_READ_FLASH_SIZE;
if (length < ... |
ver_ams(2 /* num_instances */);
// Assert ams.c can now handle the characteristic reference for the first instance:
prv_assert_can_handle_characteristics(0, true /* expect_can_handle */);
// Assert ams.c can not handle the characteristic reference for the second instance:
prv_assert_can_handle_characteristics... | ams_handle_write_response(entity_update, BLEGATTErrorSuccess) | ;
cl_assert_equal_b(ams_is_registered_for_all_entity_updates(), false);
// Expect to have written the command to register for the Track entity:
fake_gatt_client_op_assert_write(entity_update, s_register_track_entity,
sizeof(s_register_track_entity), GAPLEClientKernel,
... |
racteristics[0][PPoGATTCharacteristicData], sn,
s_short_data_fragment, sizeof(s_short_data_fragment) - sn);
if (sn == 0 || sn == 1) {
// Make the first and second packet time out each, one second earlier
// than the 3rd and 4rd packets:
regular_timer_fire_seconds(PPOGATT_T... | prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn,
s_short_data_fragment, sizeof(s_short_data_fragment) - sn) | ;
}
// The last straw:
for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) {
regular_timer_fire_seconds(PPOGATT_TIMEOUT_TICK_INTERVAL_SECS);
}
prv_assert_sent_reset_request(s_characteristics[0][PPoGATTCharacteristicData]);
}
void test_ppogatt__make_sure_timeout_reset_after_data_ack(void) {
test_ppogatt__o... |
on);
}
////////////////////////////////////////////////////////////////////////////////
// Unsupported Protocol
////////////////////////////////////////////////////////////////////////////////
static bool prv_is_version_supported(const PostMessageResetCompletePayload *rc) {
const bool is_unsupported = (rc->min_supp... | PBL_LOG(LOG_LEVEL_ERROR, "Resetting because got RC while open") | |
/*
* 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... | (&layer, &across_y_layer_update_callback) | ;
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_y_origin_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_ny_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_... |
two because
// in the future, the health APIs may need to go other services besides just the Activity service
// to get information.
static ActivityMetric prv_get_activity_metric(HealthMetric metric) {
switch (metric) {
case HealthMetricStepCount:
return ActivityMetricStepCount;
case HealthMetricActive... | (prv_get_activity_metric(metric),
ARRAY_LENGTH(daily->totals), daily->totals) | ) {
PBL_LOG(LOG_LEVEL_ERROR, "Error fetching metric data");
return false;
}
// Store in cache if we have space for it.
if (state->cache && (metric == HealthMetricStepCount)) {
memcpy(&state->cache->steps_daily, daily, sizeof(*daily));
state->cache->step_daily_valid = true;
}
return true;
}
/... |
), clip_box->origin.x);
const int16_t x_max = MIN(MAX(x0, x1), grect_get_max_x(clip_box));
#if PBL_COLOR
color.a = (uint8_t)(MAX_PLOT_BRIGHTNESS - opacity);
#else
if (opacity > (MAX_PLOT_BRIGHTNESS / 2)) {
// We're not plotting anything, bail
return;
}
#endif // PBL_COLOR
ctx->draw_state.draw_implem... | {
int16_t y1_rounded = (y1.raw_value + (FIXED_S16_3_ONE.raw_value / 2))
/ FIXED_S16_3_ONE.raw_value;
int16_t y2_rounded = (y2.raw_value + (FIXED_S16_3_ONE.raw_value / 2))
/ FIXED_S16_3_ONE.raw_value;
prv_assign_line_vertical_non_aa(ctx, x, y1_rounded, y2_... |
}
#if PBL_COLOR
void graphics_private_draw_horizontal_line_delta_prepared(GContext *ctx, GBitmap *framebuffer,
GRect *clip_box, int16_t y,
Fixed_S16_3 x1, Fixed_S16_3 x2,
... |
/*
* 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... | {
alerts_set_mask(AlertMaskAllOn);
cl_assert(alerts_get_mask() == AlertMaskAllOn);
// Should allow all notifications to go through
cl_assert(alerts_should_notify_for_type(AlertMobile));
cl_assert(alerts_should_notify_for_type(AlertReminder));
cl_assert(alerts_should_notify_for_type(AlertPhoneCall));
// ... |
void test_alerts__disabled(void) {
cl_assert(alerts_get_mask() == AlertMaskAllOn);
// Should not allow any notifications through
alerts_set_mask(AlertMaskAllOff);
cl_assert(!alerts_should_notify_for_type(AlertInvalid));
cl_assert(!alerts_should_notify_for_type(AlertMobile));
cl_assert(!alerts_should_not... |
hed to have something to render before hiding all modals.
// If we don't we'll end up with flashing in a blank framebuffer.
OpenAppContext *ctx = kernel_malloc_check(sizeof(OpenAppContext));
*ctx = (OpenAppContext) {
.event_info = {
.type = PEBBLE_RENDER_READY_EVENT,
.handl... | ("Intercom") | ,
},
};
const char *timeline_get_private_data_source(Uuid *parent_id) {
for (int i = 0; i < (int) ARRAY_LENGTH(s_data_sources); i++) {
if (uuid_equal(parent_id, &s_data_sources[i].id)) {
return s_data_sources[i].name;
}
}
return NULL;
}
/////////////////
// Analytics
typedef struct {
unsigned... |
/*
* 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;
} | |
cl_assert_equal_i(s_out_sent_call_count, 1);
// Check that the state is reset properly after everything
cl_assert_equal_b(app_message_is_accepting_outbound(), true);
}
void test_app_message__send_happy_case_ack_then_outbox_sent(void) {
prv_set_remote_receive_handler(prv_ack_sent_callback);
prv_send_test_da... | app_message_outbox_send() | , APP_MSG_BUSY);
}
void test_app_message__send_disconnected(void) {
prv_set_remote_receive_handler(prv_nack_sent_callback);
// Disconnect the comm session
s_is_connected = false;
// The return value should be APP_MSG_OK, even though we already know it's going to fail.
// The failure should be delivered aft... |
ime_us(&res[6]);
BMI160_DBG("%"PRId16" %"PRId16" %"PRId16, data->x, data->y, data->z);
}
static IMUCoordinateAxis prv_get_axis_direction(uint8_t int0_status, uint8_t int2_status,
uint8_t mask, uint8_t shift, int32_t *direction) {
*direction = ((int2_status & BMI160_... | {
BMI160_DBG("%s", "We fell behind on motion interrupt handling!");
} | |
HAS_BUILTIN_HRM
case TimelineItemActionTypeBLEHRMStopSharing:
prv_invoke_ble_hrm_stop_sharing_action(action_menu, pin);
return NULL;
#else
case TimelineItemActionTypeBLEHRMStopSharing:
break;
#endif
}
PBL_LOG(LOG_LEVEL_ERROR, "Unsupported action type %d", action->type);
if (action_menu)... | (num_items) | ;
level->parent_level = parent_level;
return level;
}
static ActionMenuLevel *prv_create_template_level_from_action(ActionMenuLevel *parent_level,
TimelineItemAction *action,
void *i18n_owner... |
allback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_y_origin_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_ny_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(... | setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1) | ;
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_NONE);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_origin_aa_r0_no_clip.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_draw_circle_${BIT_DEPTH_NAME}__offset_layer(void) {
GContext ctx;
Layer layer;
test_graphics_context_init(&ctx, fb)... |
app_window_stack_push(&data->status_window, true);
}
}
static bool prv_test_is_running(AppData *data) {
return (data->current_test_step != BTLETestStep_None);
}
//--------------------------------------------------------------------------------
// Number Windows
//--------------------------------------------------... | fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD) | );
layer_add_child(window_layer, text_layer_get_layer(&data->status_text));
}
//--------------------------------------------------------------------------------
// TX/RX Menus & Windows
//--------------------------------------------------------------------------------
// The same menu layer is reused for TX / RX, we... |
/*
* 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... | ("Enabling clock %s", prv_string_for_cmd(clock_cmd)) | |
pFromScratch = 0x00, //!< Battery or charger insertion from scratch
PmicResetReason_ResVoltFall = 0x01, //!< Battery voltage drop below 2.75V
PmicResetReason_ForcedReset = 0x02, //!< sw force_reset
PmicResetReason_OnPulledHigh = 0x03, //!< Force sw power_off, ON pulled high
PmicResetReason_Charger = 0x04, //!... | {
PBL_LOG(LOG_LEVEL_DEBUG, "Error: read as3701b whoami byte 0x%x, expecting 0x11", chip_id);
} |
return found;
}
bool pmic_init(void) {
prv_init_gpio();
if (!prv_is_alive()) {
return false;
}
prv_start_120hz_clock();
return true;
}
bool pmic_is_usb_connected(void) {
uint8_t status;
if (!prv_read_register(PmicRegisters_CHARGE_STATUS_2, &status)) {
return false;
}
// ChargerStatus2 (Fi... |
tination(session->destination), uuid_string);
}
static bool prv_is_transport_type(Transport *transport,
const TransportImplementation *implementation,
CommSessionTransportType expected_transport_type) {
CommSessionTransportType transport_type = impl... | if (is_system && (session->destination == TransportDestinationHybrid)) {
prv_put_comm_session_event(true, false);
} |
// Cleanup:
comm_session_receive_router_cleanup(session);
comm_session_send_queue_cleanup(session);
list_remove(&session->node, (ListNode **) &s_session_head, NULL);
kernel_free(session);
}
void comm_session_set_responsiveness(
CommSession *session, BtConsumer consumer, ResponseTimeState state,
uin... |
e.w - insets.left - insets.right;
const int16_t new_height = r.size.h - insets.top - insets.bottom;
if (new_width < 0 || new_height < 0) {
return GRectZero;
}
return GRect(r.origin.x + insets.left, r.origin.y + insets.top, new_width, new_height);
}
GPoint gpoint_to_global_coordinates(const GPoint point, GC... | {
return (BitmapInfo) { 0 };
} |
// In 2.x, GBitmap was exposed and info_flags was only used for keeping track of heap allocation.
// Some apps were constructing their own GBitmaps, and not setting info_flags.
// For a legacy2 app, zero out all info fields except for bitmap heap allocation, and assume
// that if the flag is set and the bitma... |
n completely written yet. Records in this
// state are removed on bootup, since they are 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... | (&new_file.iter, key) | ;
settings_raw_iter_write_val(&new_file.iter, val);
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 wil... |
/*
* 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 (PRIVILEGE_WAS_ELEVATED) {
if (pebble_task_get_current() == PebbleTask_Worker) {
// Not allowed from workers
syscall_failed();
}
syscall_assert_userspace_buffer(data, num_bytes);
}
return resource_load_byte_range_system(app_num, id, start_offset, data, num_bytes);
} |
DEFINE_SYSCALL(bool, sys_resource_bytes_are_readonly, void *ptr) {
return resource_bytes_are_readonly(ptr);
}
DEFINE_SYSCALL(const uint8_t *, sys_resource_read_only_bytes, ResAppNum app_num, uint32_t
resource_id, size_t *num_bytes_out) {
bool caller_is_privileged = true;
if (PRIVILEGE_WAS_ELEVAT... |
DEBUG_DB_BEGIN - 0;
fake_flash_assert_region_untouched(0, size);
size = FLASH_SIZE - FLASH_REGION_DEBUG_DB_END;
fake_flash_assert_region_untouched(FLASH_REGION_DEBUG_DB_END, size);
fake_spi_flash_cleanup();
}
typedef struct {
char **msg_arr;
int curr_msg_idx;
int num_items;
int num_processed;
} Expect... | snprintf(buf, sizeof(buf), "%x", uniq_msg_id) | ;
for (int j = 0; j < log_len; j += strlen(buf)) {
memcpy(&msg[j], buf, MIN(strlen(buf), log_len - j));
}
msg[log_len] = '\0';
msg_arr[i] = task_strdup(msg);
}
return (msg_arr);
}
static void free_logs(char **msg_arr, int num_logs) {
for (int i = 0; i < num_logs; i++) {
free(msg_arr[... |
/*
* 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... | ("\xF0\x9F\x98\x84") | );
cl_assert(utf8_is_valid_string("😃"));
}
void test_utf8__copy_single_byte_char(void) {
utf8_t dest[5];
memset(dest, 0, 5);
size_t copied = utf8_copy_character(dest, (utf8_t *)"hello", 5);
cl_assert_equal_i(copied, 1);
cl_assert_equal_s((char *)dest, "h");
}
void test_utf8__copy_multibyte_char(void) {
... |
false);
}
if (data->alarm_type_menu && app_window_stack_contains_window(&data->alarm_type_menu->window)) {
app_window_stack_remove(&data->alarm_type_menu->window, false);
}
}
static void prv_call_complete_cancelled_if_no_alarm(AlarmEditorData *data) {
if (data->alarm_id == ALARM_INVALID_ID && data->complet... | {
return 1;
} |
static uint16_t prv_day_picker_get_num_rows(struct MenuLayer *menu_layer,
uint16_t section_index,
void *callback_context) {
return DayPickerMenuItemsNumItems;
}
static int16_t prv_day_picker_get_cell_height(struct MenuLayer *me... |
/*
* 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_test_db.ram_storage, key, key_len) | ;
}
status_t test_db_read(const uint8_t *key, int key_len, uint8_t *val_out, int val_len) {
return ram_storage_read(&s_test_db.ram_storage, key, key_len, val_out, val_len);
}
status_t test_db_delete(const uint8_t *key, int key_len) {
return ram_storage_delete(&s_test_db.ram_storage, key, key_len);
}
status_t tes... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (result->pixel_mask_data, pixel_data_initial_byte_value,
num_bytes_needed_for_pixel_mask_data) | |
ributesMsg*)s_invalid_attribute_length)->notification_uid;
const uint32_t attribute_at_end_uid = ((GetNotificationAttributesMsg*)memory_with_attribute_id_at_end.attribute_data)->notification_uid;
const uint32_t loading_uid = ((GetNotificationAttributesMsg*)s_loading_response)->notification_uid;
const uint32_t no_... | (s_multiple_complete_dicts) | , (uint8_t*) s_multiple_complete_dicts);
s_num_ds_notifications_received += 3;
} else if (uid == split_timestamp_uid) {
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_split_timestamp_dict_part_one), (uint8_t*) s_split_timestamp_dict_part_one);
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_split_tim... |
ode, now, midnight, direction, show_all_day);
const bool show_old = prv_show_event(old_node, now, midnight, direction, show_all_day);
if (show_new != show_old) {
return (show_old ? 1 : 0) - (show_new ? 1 : 0);
} else {
return prv_time_comparator(old_node, new_node);
}
}
static void prv_set_node_from_he... | {
TimelineIterState *timeline_iter_state = (TimelineIterState *)state;
// at the past-most item
if (timeline_iter_state->node == NULL) {
return false;
}
TimelineNode *orig = timeline_iter_state->node;
do {
timeline_iter_state->node = (TimelineNode *)timeline_iter_state->node->node.prev;
if (time... |
static void prv_prune_ordered_timeline_list(TimelineNode **head) {
TimelineNode *node = *head;
TimelineNode *next_node;
while (node) {
next_node = (TimelineNode *)list_get_next((ListNode *)node);
time_t end_time = node->timestamp + (node->duration * SECONDS_PER_MINUTE);
if (pin_db_has_entry_expired(... |
/*
* 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... | service->remove_subscriber_callback(subscription->task) | ;
}
}
static void prv_event_service_subscribe(PebbleSubscriptionEvent *subscription) {
EventServiceEntry *service = s_event_services[subscription->event_type];
if (service == NULL) {
// No event service for this event type, create one
event_service_init(subscription->event_type, NULL, NULL);
servic... |
ontext);
}
// If we haven't set an animation, either because create_animation() was NULL or it returned
// NULL, use g_window_transition_none_implementation
if (!context->animation) {
context->animation = g_window_transition_none_implementation.create_animation(context);
}
PBL_ASSERTN(context->animation... | window_get_debug_name(window) | );
}
static Window *prv_remove_item(WindowStackItem *pop_item,
const WindowTransitionImplementation *transition) {
PBL_ASSERTN(pop_item->window);
WindowStack *window_stack = pop_item->window->parent_window_stack;
// Do a transition from element that needs to be removed only if it 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... | rtc_get_ticks() | ;
int64_t millis_since_last_vibe =
(current_ticks - s_notification_vibe_tick_timestamp) * 1000 / RTC_TICKS_HZ; // x1000 for ms
return millis_since_last_vibe;
}
//////////////////
// Public Functions
//////////////////
void alerts_incoming_alert_analytics() {
if (do_not_disturb_is_active()) {
analytics... |
ossible;
event_type = -1;
recognizer_transition_state(r, RecognizerState_Failed);
cl_assert(!s_manager_state_change);
cl_assert_equal_i(r->state, RecognizerState_Failed);
cl_assert_equal_i(event_type, -1);
// Test that invalid state transitions get caught by asserts
cl_assert_passert(recognizer_transitio... | test_recognizer_create(&s_test_impl_data, NULL) | |
data->hrm_bpm,
.quality = data->hrm_quality,
},
};
break;
case HRMFeature_HRV:
*event = (PebbleHRMEvent) {
.event_type = HRMEvent_HRV,
.hrv = {
.ppi_ms = data->hrv_ppi_ms,
.quality = data->hrv_quality,
},
};
break;
case ... | prv_event_put(state, &hrm_event) | );
}
// If this is an app subscription, see if we need to send an "expiring" event. We check
// KernelBG subscribers from the system callback function (prv_system_task_hrm_handler).
if (!state->callback_handler && prv_needs_expiring_event(state, utc_now)) {
hrm_event = (PebbleHRMEvent) {
... |
/*
* 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(BLOB_DB_ENDPOINT_ID == s_sending_endpoint_id) | ;
return s_data;
}
/* Start of test */
extern void blob_db_set_accepting_messages(bool enabled);
void test_blob_db_endpoint__initialize(void) {
blob_db_set_accepting_messages(true);
fake_comm_session_init();
Transport *transport = fake_transport_create(TransportDestinationSystem, NULL, prv_sent_data_cb);
s_... |
dle_t subscribers[NumPebbleTask];
EventServiceAddSubscriberCallback add_subscriber_callback;
EventServiceRemoveSubscriberCallback remove_subscriber_callback;
} EventServiceEntry;
typedef struct {
ListNode list_node;
void *ptr;
// There is an intent bit for each task + a special "claimed" bit
uint16_t inten... | {
// an event service was already inited, free it
kernel_free(s_event_services[type]);
} | |
Determine the current chunk
ActivityMetricAverages *averages = kernel_malloc_check(sizeof(ActivityMetricAverages));
activity_get_step_averages(time_util_get_day_in_week(now_utc), averages);
// Sum up the averages
const int minutes_per_step_avg = MINUTES_PER_DAY / ACTIVITY_NUM_METRIC_AVERAGES;
int num_chunks ... | (config->notif_time, 0,
TimelineItemTypeNotification,
LayoutIdNotification, ¬if_attr_list,
&action_group) | |
/*
* 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_emoji_table, NULL) | == INVALID_RESOURCE);
// Empty string is not an emoji
cl_check(prv_get_emoji_icon_by_string(s_emoji_table, "") == INVALID_RESOURCE);
// Single emoji is detected
cl_check(prv_get_emoji_icon_by_string(s_emoji_table, "😀") ==
RESOURCE_ID_EMOJI_BIG_OPEN_SMILE_LARGE);
// Leading whitespace is ignore... |
y = FONT_KEY_GOTHIC_18_BOLD,
};
const LayoutNodeConfig * const icon_config_node =
(context->index == 0) ? &timeline_icon_config.node :
&icon_config.extent.node;
const LayoutNodeConfig * const vertical_config_nodes[] = {
PBL_IF_ROUND_ELSE(icon_config_node, NULL),
&name_c... | (values, i) | ;
if (!name || !value) {
break;
}
TimelineResourceInfo icon_info = {
.res_id = icons->values[i],
.app_id = &layout->info->app_id,
};
AppResourceInfo icon_res_info;
timeline_resources_get_id(&icon_info, TimelineResourceSizeTiny, &icon_res_info);
const LayoutNodeConstructor... |
rame.size.w * (500 + (MULT_X(cur, limit_b) / 2))),
frame.origin.y);
} else if (cur <= limit_c) {
// zone b - c
return GPoint(frame.origin.x + frame.size.w,
frame.origin.y +
DIV_X(frame.size.h * MULT_X((cur - limit_b), (limit_c - limit_b))));
} else i... | prv_inset_point(
&frame, prv_steps_to_point(corners[i], total, outer_bounds), fill_thickness) | ;
}
}
// add start_inner_point
path.points[path.num_points++] = start_inner_point;
gpath_draw_filled(ctx, &path);
#if PBL_COLOR
graphics_context_set_stroke_color(ctx, color);
gpath_draw_outline(ctx, &path);
#else
graphics_context_set_stroke_color(ctx, GColorWhite);
GRect inner_bounds = grect_inset... |
/*
* 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... | (config->peek_timer, PEEK_TIMEOUT_MS) | ;
}
return (0);
}
int compass_service_set_heading_filter(CompassHeading filter) {
if ((filter < 0) || (filter > (TRIG_MAX_ANGLE / 2))) {
return (-1);
}
CompassServiceConfig *config = *prv_get_config(PebbleTask_Unknown);
config->compass_filter = filter;
return (0);
}
void compass_service_subscribe(... |
/*
* 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_state_set_user_data(data) | ;
Window *window = &data->window;
window_init(window, "");
window_set_fullscreen(window, true);
TextLayer *title = &data->title;
text_layer_init(title, &window->layer.frame);
text_layer_set_font(title, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
text_layer_set_text_alignment(title, GTextAlignmentCe... |
&l, MenuIndex(0, 0), MenuRowAlignTop, true);
cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row);
cl_assert(l.animation.animation);
}
int16_t prv_get_row_height_depending_on_selection_state(struct MenuLayer *menu_layer,
MenuIndex *cell_index,
... | (false, s_content_available[ContentIndicatorDirectionUp]) | ;
cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]);
menu_layer_set_selected_index(&l, MenuIndex(0, 2), MenuRowAlignNone, false);
// new center-focus behavior: adjust for changed row sizes depending on focused row
cl_assert(menu_layer_get_center_focused(&l) == true);
cl_assert_equal... |
cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette
bmp = gbitmap_create_blank(s10, GBitmapFormat2BitPalette);
cl_assert(NULL != bmp);
cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette
bmp = gbitmap_create_blank(s10, GBitmapFo... | (s10, GBitmapFormat2BitPalette, p, true) | ;
cl_assert(NULL != bmp);
cl_assert(p == gbitmap_get_palette(bmp));
bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat4BitPalette, p, true);
cl_assert(NULL != bmp);
cl_assert(p == gbitmap_get_palette(bmp));
cl_assert(NULL == gbitmap_create_blank_with_palette(s10, GBitmapFormat8BitCircular, p, 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... | pfs_write(iter->fd, data, data_len) | ;
if (status >= 0) {
return status;
}
int pos = pfs_seek(iter->fd, 0, FSeekCur);
PBL_LOG(LOG_LEVEL_ERROR, "Could not write from %p, %d bytes at pos %d: %"PRId32,
data, data_len, pos, status);
fatal_logic_error(iter);
}
///////////////////////////
// Actual Iteration Code //
////////////////... |
,
{ -952, 736, 120},
{ -1040, 656, 112},
{ -1376, 664, 128},
{ -1784, 568, 176},
{ -2144, 464, 128},
{ -2128, 200, 144},
{ -1888, 96, 160},
{ -1824, 184, 96},
{ -1624, 120, 104},
{ -1312, 136, 120},
{ -1064, 120, 104},
{ -904, -96, 80},
{ -560, -216, -40},
{ -856,... | { -1168, 528, 56},
// 36 seconds
{ -920, 536, -56},
{ -1104, 272, -8},
{ -1648, 368, -24},
{ -1856, 344, 32},
{ -2024, 272, 72},
{ -1856, 192, 104},
{ -1696, 136, 96},
{ -1568, 112, 168},
{ -1336, 80, 144},
{ -1136, 120, 128},
{ -1056, 56, 96},
{ -984, -112, 184},... |
{ -1416, 240, 104},
{ -1200, 152, 96},
{ -984, 24, 48},
{ -736, -408, 112},
{ -712, -240, -32},
{ -928, -120, -16},
{ -1280, 136, 8},
{ -1488, 336, -320},
{ -1512, 448, -256},
{ -1552, 56, -32},
{ -1656, 112, -104},
// 39 seconds
{ -1576, 312, -104},
{ -1424, 424... |
s_prv_activity_cb__call_count = 0;
s_prv_activity_cb__false_at_call_no = UINT32_MAX;
s_sys_activity_get_minute_history_values = (sys_activity_get_minute_history_values) {
// as all these values need to be configured in the test, we assert per default
.out[0].asserts = true,
};
s_activity_prefs_hear... | (now - SECONDS_PER_DAY, now, &range) | |
(1);
--seconds_left;
}
cl_assert(!gap_le_is_advertising_enabled());
cl_assert_equal_i(regular_timer_seconds_count(), 0);
// The job should been have been unscheduled:
cl_assert_equal_i(s_unscheduled_cb_count, 1);
cl_assert_equal_p(s_unscheduled_job, job);
cl_assert_equal_b(s_unscheduled_completed, t... | (NULL, NULL) | ;
GAPLEAdvertisingJobTerm advert_term = {
.min_interval_slots = 160,
.max_interval_slots = 320,
.duration_secs = 10,
};
GAPLEAdvertisingJobRef job;
job = gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm),
unscheduled_callback... |
ndle! %u", value_handle);
return;
}
ble_error_t e = ble_gatts_send_event(conn_idx, value_handle,
GATT_EVENT_NOTIFICATION, length, data);
if (e != BLE_STATUS_OK) {
PBL_LOG(LOG_LEVEL_ERROR, "ble_gatts_send_event: %u", e);
}
}
static att_error_t prv_handle_cccd_writ... | {
return (att_error_t)PebblePairingServiceGATTError_ConnParamsMaxSlotsTooLarge;
} | |
d_draw`.
//
// In order to visualize this algorithm, imagine these lines below overlaid on the major control
// statements below:
//
// for ___ Ascent loop caused by the "if container". With nested containers, the algorithm
// \ \ / will keep ascending by branching into the if and hitting the ... | if (prv_should_draw_text_node(node, ctx, box, render)) {
prv_draw_text_node_tree(node, ctx, box, config, render, size_out);
} else if (size_out) {
*size_out = node->cached_size;
} |
}
void graphics_text_node_get_size(GTextNode *node, GContext *ctx, const GRect *box,
const GTextNodeDrawConfig *config, GSize *size_out) {
const bool render = false;
return prv_draw_text_node(node, ctx, box, config, render, size_out);
}
void graphics_text_node_draw(GTextNode *nod... |
/*
* 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_data->result_text) | ;
}
static void init(AppData *app_data) {
app_data->session = dictation_session_create(1024, prv_result_handler, app_data);
if (!app_data->session) {
APP_LOG(APP_LOG_LEVEL_ERROR, "Failed to create dictation session");
}
app_data->confirm = true;
app_data->window = window_create();
window_set_click_co... |
} else {
time_fmt = i18n_noop("Yesterday");
}
break;
case FullStyleLower24h:
case FullStyleCapital24h:
if (with_fulltime) {
time_fmt = i18n_noop("Yesterday, %R");
} else {
time_fmt = i18n_noop("Yesterday");
}
break;
}
} else... | {
str_fmt = i18n_noop("In %lu hours");
} |
snprintf(buffer, buf_size, i18n_get(str_fmt, buffer), num_hrs);
} else {
prv_clock_get_full_relative_time(buffer, buf_size, timestamp, capitalized, with_fulltime);
}
i18n_free_all(buffer);
}
size_t clock_get_date(char *buffer, int buf_size, time_t timestamp) {
return prv_format_time(buffer, buf_size,... |
/*
* 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... | prompt_send_response_fmt(buffer, sizeof(buffer), "%"PRIu32"", ambient_light_get_light_level()) | ;
}
uint32_t ambient_light_get_dark_threshold(void) {
return s_sensor_light_dark_threshold;
}
void ambient_light_set_dark_threshold(uint32_t new_threshold) {
PBL_ASSERTN(new_threshold <= AMBIENT_LIGHT_LEVEL_MAX);
s_sensor_light_dark_threshold = new_threshold;
}
bool ambient_light_is_light(void) {
// if the s... |
rt_equal_i(pairing_info->remote_encryption_info.ediv,
pairing_info_out.remote_encryption_info.ediv);
cl_assert_equal_i(memcmp(&pairing_info->remote_encryption_info.ltk,
&pairing_info_out.remote_encryption_info.ltk, sizeof(SMLongTermKey)), 0);
cl_assert_equal_i(memcmp(&... | (NULL, NULL, NULL, NULL) | , false);
char device_name[BT_DEVICE_NAME_BUFFER_SIZE] = "ABCDEFGHIJKLMNOPQRS";
shared_prf_storage_store_ble_pairing_data(&s_pairing_info, device_name,
false /* requires_address_pinning */, 0 /* flags */);
prv_fire_writeback_timer();
prv_validate_ble_pairing_info(&... |
clar.h"
#include "util.h"
// Helper Functions
////////////////////////////////////
#include "test_graphics.h"
#include "${BIT_DEPTH_NAME}/test_framebuffer.h"
// Stubs
////////////////////////////////////
#include "graphics_common_stubs.h"
#include "stubs_applib_resource.h"
// Definitions
#define SW_EVEN 4
#define S... | strncpy(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func)) | ;
}
void graphics_circle_draw_stroked_aa(GContext* ctx, GPoint p, uint16_t radius, uint8_t stroke_width) {
s_last_args_for_mock = (ArgsForMock){
.ctx = *ctx,
.p0 = p,
.radius = radius
};
strncpy(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func));
}
void graphics_circle_draw_stro... |
/*
* 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... | {
// Erase flash
flash_erase_sector_blocking(start_address); // Set everything high
// Set up the firmware description
FirmwareDescription desc;
desc.description_length = sizeof(FirmwareDescription);
desc.firmware_length = (64 * 1024) - sizeof(FirmwareDescription);
desc.checksum = 0xdeadbeef;
// Write... | |
{ 768, 464, -240},
{ 888, 480, -320},
{ 1056, 544, -400},
{ 1096, 528, -368},
{ 952, 488, -368},
{ 1160, 472, -328},
{ 1320, 592, -424},
{ 1448, 624, -384},
{ 1432, 448, -144},
{ 1368, 360, -136},
{ 1064, 304, -216},
// 29 seconds
{ 872, 248, -160},
{ 744, 200, -40}... | { 752, 360, -280},
{ 648, 424, -296},
{ 688, 392, -264},
{ 800, 424, -312},
{ 864, 456, -344},
{ 920, 504, -368},
{ 1016, 568, -448},
{ 968, 528, -392},
{ 1280, 504, -368},
{ 1336, 528, -416},
{ 1320, 520, -432},
{ 1528, 416, -224},
{ 1520, 344, -128},
{ 1168, 312... | |
/*
* 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_set_time(SECONDS_PER_DAY) | |
nst int16_t new_width = rect->size.w - insets->left - insets->right;
const int16_t new_height = rect->size.h - insets->top - insets->bottom;
if (new_width < 0 || new_height < 0) {
*rect = GRectZero;
} else {
*rect = GRect(rect->origin.x + insets->left, rect->origin.y + insets->top,
new_w... | if (container_height > cell_layer_bounds_size.h) {
// If we couldn't fit one title line and the subtitle, try cutting out the subtitle instead
container_height = title_text_frame_height + icon_frame_size.h;
if (container_height > cell_layer_bounds_size.h) {
// If we couldn't fit just the title... |
}
// We'll reuse this rect to conserve stack space; here it is used as the title text frame
GRect rect = (GRect) {
.origin = cell_layer_bounds->origin,
.size = GSize(cell_layer_bounds_size.w, title_text_frame_height),
};
// Update the title text frame's height using the max used size of the title t... |
{ -64, -136, -952},
{ -64, -152, -952},
{ -56, -144, -944},
// 41 seconds
{ -64, -144, -952},
{ -64, -136, -952},
{ -64, -144, -952},
{ -64, -152, -952},
{ -64, -144, -952},
{ -64, -144, -952},
{ -64, -144, -960},
{ -64, -144, -952},
{ -64, -152, -952},
{ -64, -144, ... | { -64, -144, -952},
{ -56, -152, -960},
{ -64, -144, -952},
{ -64, -136, -960},
{ -64, -152, -952},
{ -64, -144, -952},
{ -56, -136, -952},
{ -64, -144, -960},
{ -72, -152, -952},
{ -48, -144, -960},
{ -64, -152, -944},
{ -72, -152, -952},
{ -56, -136, -952},
{ -7... |
{ -160, -664, -712},
{ -152, -576, -824},
{ -96, -496, -800},
{ -136, -496, -864},
{ -88, -408, -896},
{ -96, -408, -896},
// 49 seconds
{ -80, -312, -952},
{ -56, -320, -952},
{ -48, -304, -920},
{ -16, -208, -968},
{ 8, -232, -968},
{ -32, -208, -952},
{ -40, -... |
t32_t sleep_state;
const bool rv = activity_get_metric(ActivityMetricSleepState, 1, &sleep_state);
return rv ? sleep_state : ActivitySleepStateUnknown;
#else
return ActivitySleepStateUnknown;
#endif
}
// ----------------------------------------------------------------------------------------------
static int prv... | (sizeof(struct tm)) | ;
uint8_t *settings_file_buffer = kernel_malloc_check(ALARM_ENTRY_SIZE);
AppInstallEntry *entry = kernel_malloc_check(sizeof(AppInstallEntry));
if (!app_install_get_entry_for_install_id(APP_ID_ALARMS, entry)) {
goto cleanup;
}
int num_pin_adds = 0;
time_t alarm_time = prv_get_alarm_time(alarm, cron_job... |
= {
.id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e,
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4},
.parent_id = {0xff, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e,
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0x01},
.timestamp = 1,
.duration = 0,
.type = TimelineItemTyp... | (S_SUCCESS == reminder_db_insert_item(&item1)) | |
press or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "contacts_db.h"
#include "kernel/pbl_malloc.h"
#include "services/normal/filesystem/pfs.h"
#include "services/normal/settings/settings_file.h"
#include "services/normal/contacts/attr... | if (key_len != UUID_SIZE) {
return E_INVALID_ARGUMENT;
} |
status_t rv = prv_lock_mutex_and_open_file();
if (rv != S_SUCCESS) {
return rv;
}
rv = settings_file_delete(&s_contacts_db.settings_file, key, key_len);
prv_close_file_and_unlock_mutex();
return rv;
}
status_t contacts_db_flush(void) {
mutex_lock(s_contacts_db.mutex);
status_t rv = pfs_remove(S... |
"Cloudy with rain and snow");
}
TimelineItem *item = timeline_item_create_with_attributes(now + delta_time_s, 0,
TimelineItemTypePin, LayoutIdWeather,
&list, NULL);
pin_db_insert_item_without_... | timeline_item_create_with_attributes(target, duration_m,
TimelineItemTypePin, LayoutIdCalendar,
&list, NULL) | ;
pin_db_insert_item_without_event(item);
timeline_item_destroy(item);
attribute_list_destroy_list(&list);
}
static void prv_add_generic_pin(int32_t delta_time_s, bool has_subtitle) {
const time_t now = rtc_get_time();
AttributeList list = {};
prv_set_timeline_icon(&list, TIMELINE_RESOURCE_NOTIFICATION_F... |
ces/normal/blob_db/app_glance_db_private.h"
#include "services/normal/filesystem/pfs.h"
#include "services/normal/timeline/timeline_resources.h"
#include "util/uuid.h"
#define APP_GLANCE_TEST_UUID \
(UuidMake(0x3d, 0xc6, 0xb9, 0x4c, 0x4, 0x2, 0x48, 0xf4, \
0xbe, 0x14, 0x81, 0x17, 0xf1, 0xa, 0xa9, 0xc... | cl_assert_equal_i(limit, APP_GLANCE_DB_MAX_SLICES_PER_GLANCE) | ;
unsigned int num_slices_added = 0;
AppGlanceSlice slice = {};
// Check that using a bogus session variable fails
AppGlanceReloadSession bogus_session;
cl_assert(app_glance_add_slice(&bogus_session, slice) & APP_GLANCE_RESULT_INVALID_SESSION);
// Check that adding a slice with APP_GLANCE_SLICE_DEFAULT_I... |
font(config);
}
static ALWAYS_INLINE void prv_draw_icon(GContext *ctx, GBitmap *icon, const GRect *icon_frame,
bool is_legacy2) {
if (!is_legacy2) {
bool tint_icon = (icon && (gbitmap_get_format(icon) == GBitmapFormat1Bit));
if (tint_icon) {
graphics_context_set_... | if (config->value && (icon_align != GAlignRight)) {
value_box.size.w -= horizontal_margin;
const GFont value_font = prv_get_cell_value_font(config);
const GSize text_size = graphics_text_layout_get_max_used_size(
ctx, config->value, value_font, value_box, config->overflow_mode,
GTextAlignme... |
if (config->title) {
graphics_draw_text(ctx, config->title, title_font, box,
config->overflow_mode, GTextAlignmentLeft, NULL);
}
if (config->subtitle) {
box.origin.y += title_height;
box.size.h = subtitle_height + 4;
graphics_draw_text(ctx, config->subtitle, subtitle_font... |
; // nothing to flush yet
}
bool success = false;
uint8_t *buffer = kernel_malloc_check(DLS_ENDPOINT_MAX_PAYLOAD);
unsigned int num_bytes = DLS_ENDPOINT_MAX_PAYLOAD;
PBL_ASSERTN(logging_session->item_size <= num_bytes);
num_bytes -= (num_bytes % logging_session->item_size);
uint32_t new_read_offset;
i... | if (task == session->task) {
PBL_LOG_D(LOG_DOMAIN_DATA_LOGGING, LOG_LEVEL_DEBUG, "Inactivating session: %"PRIu8,
session->comm.session_id);
// Free the buffer if it's in kernel heap. If not in kernel heap we are intentionally not
// freeing the data->buffer_storage because it was allo... |
}
return true;
}
// ----------------------------------------------------------------------------------------
void dls_send_all_sessions(void) {
// If sends are not enabled, do nothing
if (!prv_sends_enabled()) {
PBL_LOG(LOG_LEVEL_INFO, "Not sending sessions beause sending is disabled");
return;
}
... |
ib_malloc(sizeof(GPath));
if (path) {
gpath_init(path, init);
} else {
APP_LOG(APP_LOG_LEVEL_ERROR, GPATH_ERROR);
}
return path;
}
void gpath_destroy(GPath* gpath) {
applib_free(gpath);
}
static GPoint rotate_offset_point(const GPoint *orig, int32_t rotation, const GPoint *offset) {
int32_t cosine... | if (path->points[i].x > max_x) {
max_x = path->points[i].x;
} |
if (path->points[i].x < min_x) {
min_x = path->points[i].x;
}
if (path->points[i].y > max_y) {
max_y = path->points[i].y;
}
if (path->points[i].y < min_y) {
min_y = path->points[i].y;
}
}
return GRect(min_x, min_y, (max_x - min_x), (max_y - min_y));
}
#if PBL_COLOR
void p... |
/*
* 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_connection_lock) | ;
}
static void prv_unlock(void) {
mutex_unlock_recursive(s_connection_lock);
}
Connection *connection_create(uint16_t conn_idx, const BTDeviceInternal *initial_addr,
const BTDeviceAddress *local_addr,
const BleConnectionParams *params) {
ble_task_assert... |
PBL_LOG(LOG_LEVEL_WARNING, "Dropped notification due to not being connected.") | ;
return;
}
// dispatch the notification based on the profile
const SmartstrapProfileInfo *info = prv_get_info_by_profile(profile);
if (info && info->notify) {
smartstrap_state_lock();
info->notify();
smartstrap_state_unlock();
} else {
PBL_LOG(LOG_LEVEL_WARNING, "Dropped notification for... | |
system_flash_erase(FLASH_BASE, 128 KiB, NULL, NULL) | );
cl_assert_equal_i(BITS_BETWEEN(0, 4), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_full_flash(void) {
cl_assert(system_flash_erase(FLASH_BASE, 1024 KiB, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 11), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__eras... | |
/*
* 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(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos) | ; // union with .palette
bmp = gbitmap_create_blank(s10, GBitmapFormat8BitCircular);
cl_assert(NULL == bmp);
bmp = gbitmap_create_blank(s180, GBitmapFormat8BitCircular);
cl_assert(NULL != bmp);
cl_assert(g_gbitmap_spalding_data_row_infos == bmp->data_row_infos);
#endif
}
void test_gbitmap_formats__create_b... |
OUNT; i++) {
if (*(dest_arr[i]) > curr_arr[i]) {
// In future
return 1;
} else if (*(dest_arr[i]) < curr_arr[i]) {
// In past
return -1;
}
}
return 0;
}
// Increase the day in `cron_tm` to fit into the wday set in `cron`.
// This doesn't take mday into account because that's way... | if (spec_arr[i] <= CRON_GENERIC_ANY) {
switch (assign_mode) {
case CronAssignMode_LocalEpoch:
// value will be the local epoch's value, we don't need to change anything
break;
case CronAssignMode_Zero:
// value will be set to 0
*(dest_arr[i]) = 0;
... |
if (assign_mode == CronAssignMode_LocalEpoch) {
// If we haven't started adjusting things yet, we need to do checking.
const int direction = prv_future_past_direction(dest_arr, curr_arr);
if (direction < 0) {
// If the target is _behind_ the current time, we need to increase a higher or... |
ET, 0x6);
REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V18_RET_CYCLES, 0x5);
REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V18_CUR_LIM_RET, 0xA);
REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V14_RET_CYCLES, 0x2);
REG_SETF(DCDC, DCDC_RET_1_REG, DCDC_V14_CUR_LIM_RET, 0x6);
REG_SETF(DCDC, DCDC_TRIM_REG, DCDC_P_COMP_MAN_TRIM, 0x0);
REG_... | (QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_DMY_TX_MD, 0x0) | ;
REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_EXT_TX_MD, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_ADR_TX_MD, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST_TX_MD, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_EXT_BYTE, 0x0);
REG_SETF(QSPIC, QSPIC_BURSTCMDA_REG, QSPIC_INST_WB, 0x0);
REG_SETF... |
ot_disturb_set_schedule(WeekdaySchedule, &schedule_3);
cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true);
cl_assert(do_not_disturb_is_manually_enabled() == false);
active = do_not_disturb_is_active();
cl_assert(active == false); // Scheduled ON
}
void test_do_not_disturb__smart_dnd(void) ... | (stub_new_timer_timeout(get_dnd_timer_id()), 25200 * MS_PER_SECOND) | ;
// Check that there is a timer scheduled
cl_assert(stub_new_timer_is_scheduled(get_dnd_timer_id()));
do_not_disturb_set_schedule_enabled(WeekdaySchedule, false);
active = do_not_disturb_is_active();
cl_assert(active == false);
// Neither schedules enabled, timer should not be scheduled
cl_assert(!stub_... |
// June 16th 2015, 17:00:00 (T+7DAY+01:00:00)
rtc_set_time(event_time + (7 * SECONDS_PER_DAY) + (1 * SECONDS_PER_HOUR));
clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("Jun 9, 16:00", time_buf);
}
void test_clock__month_named_date(void) {
char time_buf[64];
... | cl_assert_equal_s(morning, daypart_string) | ;
// (8am today) time before 12pm is this morning
daypart_string = clock_get_relative_daypart_string(timestamp, 4 /* hours_in_the_future */);
cl_assert_equal_s(morning, daypart_string);
// (9am today) time before 12pm is this morning
daypart_string = clock_get_relative_daypart_string(timestamp, 5 /* hours_i... |
ual++, expected++) {
result.weighted_err += prv_compute_test_error(
metrics[j], expected, actual, entry->weight, &result.all_passed);
}
test_results[num_tests] = result;
num_tests++;
if (num_tests >= k_max_tests) {
printf("RAN INTO MAX NUMBER OF TESTS WE SUPPORT");
break;
... | {
int num_samples;
AccelRawData *samples = activity_sample_not_moving(&num_samples);
TestMinuteData exp_minutes[2] = {
{
.steps = 0,
.orientation = 0x81,
.vmc = 181,
},
{
.steps = 0,
.orientation = 0x81,
.vmc = 0,
},
};
prv_test... |
}
// ---------------------------------------------------------------------------------------
// Utility for feeding in artificial walk/run activity samples into the algorithm's
// activity detector logic
static void prv_insert_artificial_activity_session(KAlgTestActivityMinute *samples, int samples_len,
... |
/*
* 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... | (entry, op_flags) | , num_bytes, entry_offset);
}
static uint32_t resource_storage_file_read(ResourceStoreEntry *entry, uint32_t offset, void *data,
size_t num_bytes) {
const uint8_t op_flags = OP_FLAG_READ | OP_FLAG_SKIP_HDR_CRC_CHECK | OP_FLAG_USE_PAGE_CACHE;
return prv_file_common_read(pr... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&test_uuid_1, &test_uuid_1) | );
cl_assert(uuid_equal(&test_uuid_2, &test_uuid_2));
cl_assert(uuid_equal(&test_uuid_3, &test_uuid_3));
cl_assert(!uuid_equal(&test_uuid_1, &test_uuid_2));
cl_assert(!uuid_equal(&test_uuid_1, &test_uuid_3));
}
void test_uuid__invalid(void) {
const Uuid system = UUID_SYSTEM;
const Uuid invalid = UUID_INVAL... |
connection(&s_conn_a));
prv_assert_event_service_subscribed(true);
cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 1);
cl_assert_equal_i(s_sys_hrm_manager_unsubscribe_call_count, 0);
// Device B unsubscribes, expect to be unsubscribed from HRM manager, because there are no more
// devices... | (&s_conn_a) | |
/*
* 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... | (FLASH_BASE, 16 KiB, callback_is_called_cb,
(void *)8675309) | );
cl_assert(callback_called);
cl_assert(flash_locked);
}
void test_system_flash__handle_erase_error(void) {
return_status = FLASH_ERROR_OPERATION;
cl_assert(!system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL));
cl_assert(flash_locked);
}
void error_in_middle_cb(uint32_t num, uint32_t den, void *context) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.