prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
< oldest_valid_time_utc);
}
static bool prv_fill_forecast_from_entry(WeatherDBEntry *entry,
WeatherLocationForecast *forecast_out) {
PascalString16List pstring16_list;
pstring_project_list_on_serialized_array(&pstring16_list, &entry->pstring16s);
PascalString16 *location... | if (!prefs) {
PBL_LOG(LOG_LEVEL_ERROR, "No SerializedWeatherAppPrefs available!");
return false;
} |
// Can occur if the user removes all weather locations from their mobile app
if (prefs->num_locations == 0) {
watch_app_prefs_destroy_weather(prefs);
return false;
}
const size_t default_location_index = 0;
*key_out = prefs->locations[default_location_index];
watch_app_prefs_destroy_weather(pref... |
ialized);
PBL_ASSERTN(this->state->transfer_type == DMARequestTransferType_None);
this->state->transfer_type = DMARequestTransferType_Direct;
this->state->direct_transfer_handler = handler;
this->state->context = context;
PBL_ASSERTN(!this->stream->state->current_request);
this->stream->state->current_req... | if (this->state->circular_transfer_handler(this, this->state->context, has_tc)) {
should_context_switch = true;
} |
}
break;
case DMARequestTransferType_None:
default:
WTF;
}
portEND_SWITCHING_ISR(should_context_switch);
}
|
ButtonId pause_button;
WorkoutController *workout_controller;
void *workout_data;
WorkoutLayout layout;
WorkoutMetricType top_metric;
WorkoutMetricType middle_metric;
int num_scrollable_metrics;
int current_scrollable_metric;
WorkoutMetricType scrollable_metrics[WorkoutMetricTypeCount];
GBitma... | i18n_noop("DISTANCE (MI)") | ,
i18n_noop("DISTANCE (KM)"));
#endif
case WorkoutMetricType_Steps:
/// Steps Label
return i18n_noop("STEPS");
default:
return "";
}
}
static GColor prv_get_bg_color_for_metric(WorkoutMetricType metric_type,
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | cl_assert(list_count_to_head_from(&c) == 3) | ;
cl_assert(list_count_to_head_from(&b) == 2);
cl_assert(list_count_to_head_from(&a) == 1);
}
typedef struct IntNode {
ListNode list_node;
int value;
} IntNode;
int sorting_comparator(IntNode* a, IntNode* b) {
return b->value - a->value;
}
void test_list__sort_ascending(void) {
IntNode bar1 = { .value = ... |
data, ctx, offset, data->from, processor);
return;
}
if (data->normalized == ANIMATION_NORMALIZED_MAX) {
prv_draw_processed_at_rect(data, ctx, offset, data->to, processor);
return;
}
prv_transform_list(data);
if (data->global) {
prv_draw_processed_in_global(data, ctx, offset, processor);
... | {
KinoReelTransformData *data = kino_reel_custom_get_data(reel);
if (data) {
data->duration = duration;
}
} | |
/*
* 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 (ibeacon && !ble_ibeacon_parse(ad, rssi, ibeacon)) {
// Failed to parse.
applib_free(ibeacon);
ibeacon = NULL;
} |
return ibeacon;
}
void ble_ibeacon_destroy(BLEiBeacon *ibeacon) {
applib_free(ibeacon);
}
// -----------------------------------------------------------------------------
// Below is the iBeacon advertisement parsing code.
static uint16_t calculate_distance_cm(int8_t tx_power, int8_t rssi) {
return 0; // TODO... |
set = scroll_layer_get_content_offset(scroll_layer);
int32_t scroll_height = 32;
// If process is 3.x and has enabled paging
if (prv_scroll_layer_is_paging_enabled(scroll_layer)) {
uint16_t page_height = prv_scroll_layer_get_paging_height(scroll_layer);
if (page_height) {
// Force offset to start (... | {
return;
} |
const GSize scroll_layer_frame_size = scroll_layer_get_layer(scroll_layer)->frame.size;
const GSize scroll_layer_content_size = scroll_layer_get_content_size(scroll_layer);
const int16_t scroll_layer_content_offset_y = scroll_layer_get_content_offset(scroll_layer).y;
const bool content_available_up = (scroll... |
f enum UpdateFirmwareResult {
UPDATE_FW_SUCCESS = 0,
UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED = 1,
UPDATE_FW_ERROR_MICRO_FLASH_MANGLED = 2
} UpdateFirmwareResult;
static UpdateFirmwareResult update_fw(uint32_t flash_address) {
crc_init();
display_firmware_update_progress(0, 1);
boot_bit_set(BOOT_BIT_NEW_FW_U... | dbgserial_putstr("Failed to load recovery firmware, strike two. Try again.") | ;
boot_bit_set(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO);
boot_bit_set(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED);
system_reset();
} else {
dbgserial_putstr("Failed to load recovery firmware, strike three. SAD WATCH");
boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE);
boot_bit_clear(BOOT... |
/*
* 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... | ulTaskDebugGetStackedLR(task_handle) | ;
void *current_pc = (void*) ulTaskDebugGetStackedPC(task_handle);
PBL_LOG_SYNC(LOG_LEVEL_WARNING, "Task <%s> stuck: LR: %p PC: %p", pebble_task_get_name(task), current_lr, current_pc);
reboot_reason->watchdog.stuck_task_pc = (uint32_t)current_pc;
reboot_reason->watchdog.stuck_task_lr = (uint32_t)current_lr;
}... |
accel_manager_mutex);
PBL_ASSERTN(s_double_tap_subscribers_count > 0);
if (--s_double_tap_subscribers_count == 0) {
PBL_LOG(LOG_LEVEL_DEBUG, "Stopping accel double tap service");
accel_enable_double_tap_detection(false);
prv_setup_subsampling(accel_get_sampling_interval());
}
mutex_unlock_recursiv... | prv_setup_subsampling(interval_us) | ;
PBL_LOG(LOG_LEVEL_DEBUG, "setting accel rate:%"PRIu32", num_samples:%"PRIu32,
US_PER_SECOND / interval_us, max_batch);
accel_set_num_samples(max_batch);
}
static bool prv_call_data_callback(AccelManagerState *state) {
switch (state->task) {
case PebbleTask_App:
case PebbleTask_Worker:
c... |
jerry_create_error(jerry_error_t error_type, const jerry_char_t *message_p) {
return jerry_create_error_sz(error_type, message_p, strlen((const char *)message_p));
}
#define JERRY_ERROR(type, msg, sz) (jerry_value_t)(EM_ASM_INT({ \
return __jerryRefs.ref(new (type)(Module.Pointer_stringify($0, $1))) \
}, (... | obj.hasOwnProperty(name) | ;
}, obj_val, prop_name_val);
}
bool jerry_delete_property(const jerry_value_t obj_val, const jerry_value_t prop_name_val) {
if (!jerry_value_is_object(obj_val) || !jerry_value_is_string(prop_name_val)) {
return false;
}
return (bool)EM_ASM_INT({
var obj = __jerryRefs.get($0);
var name = __je... |
* 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
* limitations under the License... | pebble_task_get_current() | ;
ProcessContext *context = prv_get_context_for_task(task);
if (context->closing_state == ProcessRunState_ForceClosing) {
PBL_LOG(LOG_LEVEL_DEBUG, "Hit syscall exit trap!");
context->safe_to_kill = true;
process_manager_put_kill_process_event(task, false);
vTaskSuspend(xTaskGetCurrentTaskHandle())... |
{ 56, 432, 704},
{ 48, 544, 768},
{ 144, 392, 608},
{ 248, 600, 464},
{ 280, 736, 360},
{ 304, 864, 400},
{ 344, 904, 480},
{ 288, 936, 536},
{ 304, 784, 504},
{ 264, 736, 528},
{ 240, 736, 528},
{ 216, 672, 568},
{ 184, 584, 616},
{ 128, 624, 640},
{ 128, 504,... | { 264, 616, 632},
{ 264, 608, 640},
{ 288, 624, 608},
{ 304, 656, 592},
{ 288, 640, 640},
{ 280, 608, 688},
{ 264, 584, 640},
{ 296, 632, 568},
{ 304, 640, 616},
{ 304, 632, 640},
{ 296, 608, 656},
{ 256, 592, 640},
{ 256, 584, 616},
{ 272, 616, 656},
{ 288, 6... | |
a, StoredRemote* remote) {
const bool ascending = false;
data->remote_list_head = list_sorted_add(data->remote_list_head, &remote->list_node,
(Comparator) remote_comparator, ascending);
}
static StoredRemote* stored_remote_create(void) {
StoredRemote* remote = task_malloc_check(sizeof(*remote));
*remote ... | {
SMIdentityResolvingKey irk;
BTDeviceInternal device;
if (bt_persistent_storage_get_ble_pairing_by_id(ble_rem->bonding, &irk, &device, NULL)) {
bt_lock();
GAPLEConnection *connection = gap_le_connection_find_by_irk(&irk);
if (!connection) {
connection = gap_le_conne... |
remote = (StoredRemote *)remote->list_node.next;
}
}
static void prv_clear_remote_list(SettingsBluetoothData* data) {
while (data->remote_list_head) {
StoredRemote* remote = (StoredRemote*) data->remote_list_head;
data->remote_list_head = list_pop_head(&remote->list_node);
task_free(remote);
}
}... |
void * volatile g_worker_load_address;
typedef struct NextWorker {
const PebbleProcessMd *md;
const void *args;
} NextWorker;
static NextWorker s_next_worker;
static bool s_workers_enabled = true;
static AppInstallId s_last_worker_crashed_install_id;
static time_t s_last_worker_crash_timestamp;
static bool s_w... | prv_get_worker_stack_size(app_md) | - stack_guard_size;
MemorySegment worker_ram = { __WORKER_RAM__, __WORKER_RAM_end__ };
memset((char *)worker_ram.start + stack_guard_size, 0,
memory_segment_get_size(&worker_ram) - stack_guard_size);
MemorySegment worker_segment;
PBL_ASSERTN(memory_segment_split(&worker_ram, &worker_segment,
... |
/*
* 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... | assert_decode_completed(5) | ;
assert_output_equal("Hello", 5);
}
void test_cobs_decode__zeroes(void) {
const char vector[] = { 0x01, 0x02, 'A', 0x01, 0x02, 'B', 0x01 };
decode_start(6);
assert_decode_succeeds(vector, sizeof(vector));
assert_decode_completed(6);
assert_output_equal("\0A\0\0B\0", 6);
}
void test_cobs_decode__max_lengt... |
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME,
false /* is_next */);
resource_init();
// Setup content indicator
ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer();
conte... | (gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)) | |
ate.h"
// Overrides
//////////////////////////////////////////////////////////
void sys_get_time_ms(time_t *t, uint16_t *out_ms) {}
time_t sys_time_utc_to_local(time_t t) {
return t;
}
const char *get_timezone_abbr(void) {
static const char s_timezone_abbr[] = "A";
return s_timezone_abbr;
}
void sys_copy_time... | strftime(tmbuf, sizeof(tmbuf), "%d", &jan_2_2015__13_00_00) | ;
cl_assert_equal_s(tmbuf, "02");
#if EXTENSION_C99
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%F", &jan_2_2015__13_00_00);
cl_assert_equal_s(tmbuf, "2015-01-02");
#endif
#if EXTENSION_TZ
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%G %g", &jan_2_2015__13_00_00);
cl_assert_equal_s(tmbuf, "201... |
pt_context);
}
bool prompt_context_append_char(PromptContext *prompt_context, char c) {
if (UNLIKELY(prompt_context->write_index + 1 >= PROMPT_BUFFER_SIZE_BYTES)) {
return false;
}
prompt_context->buffer[prompt_context->write_index++] = c;
return true;
}
// Crank up the optimization on this bad boy.
OPTI... | (contents->message, response, response_length) | ;
}
#if PULSE_EVERYWHERE
pulse_reliable_send(contents, total_size);
#else
pulse_best_effort_send(contents, total_size);
#endif
}
static void prv_pulse_done_command(void) {
pulse_send_message(PROMPT_RESP_DONE, NULL);
s_executing_command = ExecutingCommandNone;
}
#if PULSE_EVERYWHERE
void pulse2_prompt_packe... |
77 min
// Fitbit was wrong here, the total sleep is closer to 420 min)
AlgDlsMinuteData *activity_sample_sleep_8(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME sleep_8
//> TEST_VERSION 2
//> TEST_TOTAL 420
//> TEST_TOTAL_MIN 400
//> TEST_TOTAL_MAX 440
//>... | { 0, 0x19, 0, 143},
{ 0, 0x19, 0, 143},
{ 0, 0x19, 0, 143},
{ 0, 0x19, 0, 143},
{ 0, 0x19, 0, 141},
{ 0, 0x19, 0, 143},
// 90: Local time: 09:31:00 PM
{ 0, 0x19, 0, 144},
{ 0, 0x19, 0, 144},
{ 0, 0x19, 0, 143},
{ 0, 0x19, 0, 143},
{ 0, 0x19, 0, 144},
{ 0, 0x19, 0, 143... |
{ 0, 0x19, 0, 144},
{ 0, 0x18, 26, 144},
{ 0, 0x18, 14, 144},
{ 0, 0x17, 0, 144},
{ 0, 0x17, 0, 149},
{ 0, 0x17, 0, 144},
// 150: Local time: 10:31:00 PM
{ 0, 0x17, 0, 144},
{ 0, 0x17, 0, 144},
{ 0, 0x17, 0, 144},
{ 0, 0x17, 0, 143},
{ 0, 0x17, 0, 144},
{ 0, 0x17, 0,... |
subscription(void) {
AppInstallId app_id = 1;
const uint32_t update_interval_s = 1;
const uint16_t expire_s = SECONDS_PER_MINUTE;
HRMFeature features = HRMFeature_BPM;
HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, update_interval_s, expire_s,
... | (s_events_received[2].type, PEBBLE_HRM_EVENT) | ;
cl_assert_equal_i(s_events_received[2].hrm.event_type, HRMEvent_SubscriptionExpiring);
// Subscription should be gone
cl_assert(prv_get_subscriber_state_from_ref(session_ref) == NULL);
cl_assert(sys_hrm_manager_get_app_subscription(app_id) == HRM_INVALID_SESSION_REF);
}
// Test that system subscriptions ex... |
al_a_s,
expire_a_s, HRMFeature_BPM);
HRMSubscriberState *state = prv_get_subscriber_state_from_ref(session_ref);
cl_assert(state->update_interval_s == update_interval_a_s);
cl_assert(state->expire_utc == rtc_get_time() + expire_a_s);
// Change update ... | (app_id, update_interval_s, expire_s,
features) | ;
fake_system_task_callbacks_invoke_pending();
// Should start out enabled before we get the first good reading
cl_assert_equal_b(hrm_is_enabled(HRM), true);
// Send some data while enabled
int num_updates;
for (num_updates = 0; num_updates < 1000 && hrm_is_enabled(HRM); num_updates++) {
prv_fake_send... |
delay_a
+ 2 * MIN_FRAME_INTERVAL_MS + 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1);
cl_a... | (prv_count_handler_entries(&s_teardown_handler_calls, b), 0) | |
ude "stubs_logging.h"
#include "stubs_process_manager.h"
#include "stubs_passert.h"
// Stubs
///////////////////////
bool gbitmap_init_with_png_data(GBitmap *bitmap, const uint8_t *data, size_t data_size) {
return false;
}
bool gbitmap_png_data_is_png(const uint8_t *data, size_t data_size) {
return false;
}
ResA... | (&bitmap, 0, 0) | |
= TimelineItemTypePin,
.flags = 0,
.layout = LayoutIdTest,
},
.attr_list = {
.num_attributes = 0,
.attributes = NULL,
},
.action_group = {
.num_actions = 0,
.actions = NULL,
},
.allocated_buffer = NULL,
}, {
.header = { // [3]
.id = {... | cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(2)) | ;
cl_assert(timeline_model_iter_next(&new_idx, &has_next));
cl_assert(has_next);
cl_assert_equal_i(new_idx, 3);
cl_assert_equal_i(timeline_model_get_num_items(), 2);
cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id,
&timeline_model_get_iter_state(-1)->pin.header.id));
cl_assert(uuid_equal(... |
ous action bar items in the phone ui
typedef enum {
PhoneCallActions_None = 0,
PhoneCallActions_Decline = 1 << 0,
PhoneCallActions_Answer = 1 << 1,
PhoneCallActions_Reply = 1 << 2,
} PhoneCallActions;
typedef struct {
TimelineResourceSize icon_size;
GPoint icon_pos;
int16_t caller_id_pos_y;
int16_t cal... | kino_reel_transform_set_to_reel(icon_reel, new_image, false) | ;
kino_reel_transform_set_transform_duration(icon_reel,
SQUARE_ANIMATION_FRAMES * ANIMATION_FRAME_MS);
kino_layer_set_reel(&s_phone_ui_data->icon_layer, icon_reel, true);
kino_layer_play(&s_phone_ui_data->icon_layer);
s_phone_ui_data->current_icon = new_image;
s_ph... |
}
// Grab a sample
if (strcmp(token, "{") == 0) {
PBL_ASSERTN(state->test_entry.name[0] != 0);
int steps = 0;
int orientation = 0;
int vmc = 0;
int light = 0;
int plugged_in = 0;
if (state->test_entry.version == 1) {
sscanf(token + strlen(token) + 1, "%d, 0x... | (token, "TEST_START_AT_MIN") | == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.min);
} else if (strcmp(token, "TEST_START_AT_MAX") == 0) {
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.max);
} else if (strcmp(token, "TEST_FORCE_SHUT_DOWN_AT") == 0) {
sscanf(token ... |
8, 768, -416},
{ -56, 864, -488},
{ 8, 976, -632},
{ -16, 1024, -600},
{ 328, 1176, -560},
{ 224, 1208, -496},
{ 248, 1080, -424},
{ 264, 888, -392},
{ 192, 776, -384},
{ 88, 496, -312},
{ 16, 400, -288},
{ 0, 472, -264},
{ 56, 664, -320},
{ 72, 728, -368},
{ 160... | { 128, 904, -656},
// 56 seconds
{ 264, 1064, -560},
{ 232, 1176, -568},
{ 240, 912, -656},
{ 176, 712, -608},
{ 144, 672, -384},
{ 24, 480, -304},
{ -48, 368, -304},
{ -56, 560, -272},
{ -152, 720, -352},
{ -192, 904, -424},
{ -96, 1008, -536},
{ -104, 1040, -648... |
{ 160, 992, -392},
{ 152, 784, -368},
{ 64, 592, -360},
{ 16, 488, -296},
{ 24, 544, -248},
{ 40, 680, -280},
{ 72, 728, -352},
{ 136, 888, -528},
{ 168, 888, -584},
{ 280, 992, -624},
// 59 seconds
{ 240, 848, -648},
{ 192, 1000, -656},
{ 336, 904, -640},
{ ... |
ed = prv_stopped_handler_check_finished
};
animation_set_handlers(a, handlers, animation_get_context(a));
animation_set_duration(a, duration_a);
prv_clear_handler_histories();
uint64_t start_ms = prv_now_ms();
animation_schedule(a);
// Seek to just after the end of the second A
prv_advance_to_ms_with_... | prv_count_handler_entries(&s_started_handler_calls, seq) | , 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0);
cl_assert(prv_last_handler_entry(&s_stopped_handler_calls, a)->fire_order
< prv_last_handler_entry(&s_started_handler_calls, b)->fire_order);
// Finish the sequence
prv_advance_to_ms_with_timers(prv_now_ms() + le... |
th the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o... | {
return menu_layer_get_layer(&simple_menu->menu);
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | prv_get_entry(storage->entries, key, key_len) | ;
if (entry) {
memcpy(val_out, entry->val, val_len);
return S_SUCCESS;
}
return E_DOES_NOT_EXIST;
}
status_t ram_storage_delete(RamStorage *storage, const uint8_t *key, int key_len) {
RamStorageEntry *entry = prv_get_entry(storage->entries, key, key_len);
if (entry) {
prv_delete(&storage->entrie... |
/*
* 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... | (sys_get_time() + 10, 0, false) | ;
cl_assert_equal_i(sys_wakeup_query(wakeup_id), sys_get_time() + 10);
// Cancel all wakeup events
sys_wakeup_cancel_all_for_app();
cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST);
}
void test_wakeup__max_events(void) {
WakeupId wakeup_id = 0;
sys_wakeup_cancel_all_for_app();
// Schedu... |
OD, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL);
gpio_af_init(&bus->sda_gpio, GPIO_OType_OD, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL);
}
static void prv_bus_pins_cfg_input(I2CBus *bus) {
InputConfig in_scl = {
.gpio = bus->scl_gpio.gpio,
.gpio_pin = bus->scl_gpio.gpio_pin,
};
gpio_input_init(&in_scl);
InputConfi... | PBL_LOG(LOG_LEVEL_WARNING, "Resetting I2C bus %s", slave->bus->name) | ;
// decrement user count for reset so that if this user is the only user, the
// bus will be powered down during the reset
slave->bus->state->user_count--;
// Reset and reconfigure bus and pins
prv_bus_reset(slave->bus);
// Restore user count
slave->bus->state->user_count++;
mutex_unlock(slave->bus... |
= 0,
.today_low = -11,
.current_weather_type = WeatherType_PartlyCloudy,
.current_weather_phrase = TEST_WEATHER_DB_SHORT_PHRASE_PARTLY_CLOUDY,
.tomorrow_high = 2,
.tomorrow_low = -3,
.tomorrow_weather_type = WeatherType_CloudyDay
},
{
.location_name = TEST_WEATHER_DB_LOCATION_WATERLOO,
... | (!forecast) | ;
const int default_location_index = 0;
const WeatherDBKey *default_location_key = weather_shared_data_get_key(0);
PebbleEvent insert_event = (PebbleEvent) {
.type = PEBBLE_BLOBDB_EVENT,
.blob_db = {
.db_id = BlobDBIdWatchAppPrefs,
.type = BlobDBEventTypeInsert,
.key = (uint8_t *)PREF_... |
e(&wakeup_settings);
}
}
mutex_unlock(s_mutex);
}
static WakeupEntry prv_wakeup_settings_get_entry(WakeupId wakeup_id) {
WakeupEntry entry = {{0}};
mutex_lock(s_mutex);
{
SettingsFile wakeup_settings;
if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) == S_SUCCESS) ... | new_timer_stop(s_current_timer_id) | |
ernelBackground);
smartstrap_state_lock();
if (s_subscriber_count == 0) {
prv_release_accessory();
smartstrap_state_unlock();
return;
}
if (smartstrap_fsm_state_get() == SmartstrapStateUnsubscribed) {
if (prv_acquire_accessory()) {
// we will now start to attempt to connect to the smartst... | smartstrap_state_lock() | |
= NULL);
animation_set_duration(c, duration_c);
Animation *complex = animation_spawn_create(seq, c, NULL);
cl_assert(complex != NULL);
animation_set_handlers(complex, handlers, complex);
prv_clear_handler_histories();
uint64_t start_ms = prv_now_ms();
animation_schedule(complex);
// ----------------... | animation_set_elapsed(complex, duration_total) | ;
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), ... |
ve queue or start the timer.
static SemaphoreHandle_t s_pulse_task_service_semaphore;
static volatile bool s_pulse_task_idle = true;
static uint8_t s_current_rx_frame[RX_MAX_FRAME_SIZE];
static PebbleMutex *s_tx_buffer_mutex;
static char s_tx_buffer[MAX_SIZE_AFTER_COBS_ENCODING(
FRAME_MAX_SEND_SIZE + PULSE_MI... | {
prv_pulse_task_feed_watchdog();
} |
}
static void prv_pulse_task_main(void *unused) {
task_watchdog_mask_set(PebbleTask_PULSE);
static RegularTimerInfo idle_watchdog_timer = {
.cb = prv_pulse_task_idle_timer_callback
};
regular_timer_add_seconds_callback(&idle_watchdog_timer);
CobsDecodeContext frame_decode_ctx;
cobs_streaming_decode_... |
/*
* 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... | solution_and_estimate_match(solution, expected_final_solution) | ;
}
}
}
|
racteristic_get_device():
BTDeviceInternal returned_device = gatt_client_characteristic_get_device(characteristic_ref);
cl_assert(bt_device_equal(&returned_device.opaque, &device.opaque));
// Test gatt_client_characteristic_get_descriptors():
const uint8_t num_descriptors = expected_characteris... | cl_assert_equal_i(found, 2) | |
uct {
SettingsCallbacks callbacks;
EventServiceInfo battery_connection_event_info;
} SettingsNotificationsData;
enum NotificationsItem {
NotificationsItemFilter,
#if !CAPABILITY_HAS_VIBE_SCORES
NotificationsItemVibration,
#endif
NotificationsItemTextSize,
NotificationsItemWindowTimeout,
NotificationsItem... | (&option_menu->window, true /* animated */) | ;
}
static void prv_text_size_menu_push(SettingsNotificationsData *data) {
const OptionMenuCallbacks callbacks = {
.select = prv_text_size_menu_select,
};
/// The option in the Settings app for choosing the text size of notifications.
const char *title = i18n_noop("Text Size");
const SettingsContentSize ... |
/*
* 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... | quick_launch_get_quick_launch_setup_opened() | ;
quick_launch_set_quick_launch_setup_opened(QuickLaunchSetupVersionCurrent);
if (version == QuickLaunchSetupVersion_InitialVersion) {
prv_push_first_use_dialog();
} else {
prv_push_settings_menu();
}
}
static void prv_main(void) {
prv_init();
app_event_loop();
}
const PebbleProcessMd* quick_launc... |
#endif
// Pebble Pairing Service UUID:
service_uuids[num_uuids++] = bt_uuid_expand_16bit(PEBBLE_BT_PAIRING_SERVICE_UUID_16BIT);
ble_ad_set_service_uuids(ad, service_uuids, num_uuids);
char device_name[BT_DEVICE_NAME_BUFFER_SIZE];
bt_local_id_copy_device_name(device_name, true);
ble_ad_set_local_name(ad,... | {
gap_le_advert_unschedule(s_discovery_advert_job);
} | |
,
{ 1560, 600, -232},
{ 1152, 752, -256},
{ 1240, 1032, -512},
{ 816, 304, -336},
{ 856, 344, -296},
{ 1048, 576, -272},
{ 1360, 584, -144},
{ 1544, 272, -24},
{ 1384, 104, 48},
// 5 seconds
{ 1432, 80, -24},
{ 1472, 160, -32},
{ 1360, 200, -24},
{ 1160, 232, -32}... | { 1040, 1112, -320},
{ 1288, 656, -88},
{ 1408, 480, 160},
{ 1816, 344, 144},
{ 1560, 128, 112},
{ 1424, 128, 56},
{ 1440, 200, 56},
{ 1640, 312, 48},
{ 1608, 352, 136},
{ 1568, 288, 64},
{ 1176, 288, -72},
{ 1000, -272, 32},
{ 808, -296, 128},
{ 776, 80, -32},
... |
{ 1864, 312, -120},
{ 1696, 480, -200},
{ 1184, 384, -168},
// 13 seconds
{ 1080, 264, -112},
{ 1248, 200, -8},
{ 1472, 304, -48},
{ 1416, 472, -32},
{ 1544, 720, -80},
{ 1072, 1000, 80},
{ 1008, 1016, -280},
{ 1008, 560, -216},
{ 1304, 536, -136},
{ 1456, 536, -... |
/*
* 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... | mfg_info_set_model("test_model") | |
but instead let the compositor animate.
transition_insert = &g_window_transition_none_implementation;
transition_pop = &g_window_transition_none_implementation;
}
// This is a backwards compatibility hack for legacy2 applications. By default, watchface
// windows are not fullscreen until they're pushed ... | prv_transition_to(window_from, window_to, transition) | ;
} else {
// We don't fire a transition in this case, but to ensure that all window-callbacks
// will still be called and the click handler is managed correctly, we call the
// appropriate helper functions manually with a fake transitioning context.
WindowTransitioningContext ctx = {
.window_fr... |
left_pixel, fill_byte, bytes);
}
break;
}
uint8_t *const from = delta_neg ? right_pixel : left_pixel;
uint8_t *const to = delta_neg ? left_pixel : right_pixel;
uint8_t *const garbage_start = delta_neg ? left_pixel + bytes - delta_bytes : left_pixel;
if (delt... | for (int16_t y = start_y; y != end_y; y -= iterate_dir) {
const GBitmapDataRowInfo dst_row_info = gbitmap_get_data_row_info(bitmap, y + delta_y);
const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(bitmap, y);
switch (bpp) {
case 1: {
// Note: this doesn't care about the boundin... | |
m the previous worker?
AppInstallId default_id = worker_manager_get_default_install_id();
if (default_id != INSTALL_ID_INVALID && default_id != previous_worker_install_id) {
worker_manager_put_launch_worker_event(default_id);
}
}
}
// ----------------------------------------------------------------... | (id != INSTALL_ID_INVALID) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (RCC_APB1PeriphClockCmd, DISPLAY_SPI_CLOCK) | ;
}
static void prv_enable_chip_select(void) {
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET);
// required setup time > 3us
delay_us(7);
}
static void prv_disable_chip_select(void) {
// delay while last byte is emitted by the SPI peripheral
delay_us(7);
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_RESET);... |
dirty_item->last_updated,
dirty_item->key,
dirty_item->key_len,
item_buf,
... | {
prv_send_writeback(session);
} | else {
// Check if new records became dirty while syncing the current list
// New records could have been added while we were syncing OR
// the list could be incomplete because we ran out of memory
session->dirty_list = blob_db_get_dirty_list(session->db_id);
if (session->dirty_list) {
prv_se... |
RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 8, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r8_no_clip.${BIT_DEPTH_NAME}.pbi"));
// Should draw same as radius 8
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_N... | (&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1) | ;
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2), GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax1_aa_no_clip.${BIT_DEPTH_NAME}.pbi"));
// Should draw same as rmax1
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP... |
/ Helpers
///////////////////////////////////////
static void prv_set_remote_active(void) {
static const int deadbeef = 0xdeadbeef;
s_session = (void*)&deadbeef;
s_flags = 0;
}
static void prv_set_expected(AppState app_state) {
s_app_state = app_state;
}
static void prv_set_remote_capability(CommSessionCapabi... | app_run_state_protocol_msg_callback(&session, (uint8_t*)&msg, sizeof(msg)) | ;
// This should be a noop since the key is invalid
cl_assert_equal_i(s_launcher_deprecated_messages, 0);
cl_assert_equal_i(s_app_run_state_messages, 0);
AppRunStateCommand commands[] = {
APP_RUN_STATE_INVALID_COMMAND,
APP_RUN_STATE_RUN_COMMAND,
APP_RUN_STATE_STOP_COMMAND,
APP_RUN_STATE_STATUS... |
oint) || codepoint_is_formatting_indicator(codepoint)) {
if (!iter_next(char_iter)) {
return false;
}
}
while (codepoint_is_zero_width(utf8_iter_state->codepoint)) {
if (utf8_iter_state->codepoint == 0) {
PBL_ASSERTN(utf8_iter_state->current == utf8_iter_state->bounds->end);
return fa... | if (!is_utf8_advanced) {
return is_utf8_advanced;
} |
PBL_ASSERTN(codepoint != 0);
if (codepoint_is_formatting_indicator(codepoint)) {
continue;
}
if (codepoint_should_skip(codepoint)) {
continue;
};
return true;
}
}
bool char_iter_prev(IteratorState state) {
CharIterState* char_iter_state = (CharIterState*) state;
Codepoin... |
/*
* 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... | (&child_a, &grand_child_a) | ;
cl_assert(grand_child_a.parent == &child_a);
// Remove non-first-child (child_b):
//
// +-parent
// |
// '->child_a->child_c
// |
// '->grand_child_a
//
// +-child_b
//
layer_remove_from_parent(&child_b);
cl_assert(child_b.parent == NULL);
cl_assert(child_b.nex... |
case MusicEndpointPlaybackStateUnknown:
player_state_update.playback_state = MusicPlayStateUnknown;
break;
default:
player_state_update.playback_state = MusicPlayStateInvalid;
}
player_state_update.playback_rate_percent = play_state_info->play_rate;
s_progress_reporting_supported = (play_... | if (comm_session_has_capability(comm_session_get_system_session(),
CommSessionExtendedMusicService)) {
if (s_progress_reporting_supported) {
return (MusicServerCapabilityPlaybackStateReporting |
MusicServerCapabilityProgressReporting |
MusicServerC... |
}
static bool prv_music_needs_user_to_start_playback_on_phone(void) {
return false; // On Android, we can initiate playback from Pebble.
}
static void prv_music_request_reduced_latency(bool reduced_latency) {
const ResponseTimeState state = reduced_latency ? ResponseTimeMiddle : ResponseTimeMax;
comm_session_... |
tic);
const BLECharacteristic entity_update_characteristic =
characteristics[AMSCharacteristicEntityUpdate];
const BTErrno e = gatt_client_subscriptions_subscribe(entity_update_characteristic,
BLESubscriptionNotifications,
... | {
PBL_LOG(LOG_LEVEL_ERROR, "Couldn't write command: %d", error);
prv_analytics_log_event_with_info(AMSAnalyticsEventErrorSendRemoteCommand, error);
} | |
/*
* 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... | update_output_value(nf) | ;
}
}
static void select_click_handler(ClickRecognizerRef recognizer, NumberWindow *nf) {
if (nf->callbacks.selected != NULL) {
nf->callbacks.selected(nf, nf->callback_context);
}
}
static void click_config_provider(NumberWindow *nf) {
window_single_repeating_click_subscribe(BUTTON_ID_UP, 50, (ClickHandle... |
ec, bool ongoing,
bool delete, uint32_t steps, uint32_t resting_calories,
uint32_t active_calories, uint32_t distance_mm) {
// Translate to one of the activity.h activity types
ActivitySessionType activity = ActivitySessionTypeCou... | (LOG_LEVEL_INFO, __FILE_NAME__, __LINE__, "SLP: %s", base64_buf) | |
ration = 0,
.type = TimelineItemTypeReminder,
.layout = LayoutIdTest,
},
};
static TimelineItem item3 = {
.header = {
.id = {0x7c, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c,
0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05},
.parent_id = {0xff, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e,
... | cl_assert(reminder_db_get_len((uint8_t *)&item1.header.id, sizeof(Uuid)) == 0) | ;
// check item 2
memset(&temp, 0, sizeof(TimelineItem));
cl_assert(S_SUCCESS == reminder_db_next_item_header(&temp));
cl_assert(uuid_equal(&item2.header.id, &temp.header.id));
temp.attr_list.attributes = NULL;
cl_assert(memcmp(&item2, &temp, sizeof(TimelineItem)) == 0);
cl_assert(S_SUCCESS == reminder_d... |
/*
* 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... | {
// The desired prescaler is not an integer, so we'll round up so that the clock is never
// faster than the desired frequency.
prescaler++;
} |
// enable clock while we initialize QSPI
qspi_use(dev);
// round the flash size up to the nearest power of 2 and calculate QSPI_FSize
uint32_t fsize_value = ceil_log_two(flash_size) - 1;
PBL_ASSERTN(flash_size == (uint32_t)1 << ceil_log_two(flash_size));
// Init QSPI peripheral
QSPI_InitTypeDef qspi_c... |
/*
* 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 false;
} |
void shared_prf_storage_set_root_keys(SM128BitKey *keys_in) {
return;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! BLE Pairing Data
bool shared_prf_storage_get_ble_pairing_data(SMPairingInfo *pairing_info_out,
... |
ble pairing is really supported so this works for now
// FIXME: https://pebbletechnology.atlassian.net/browse/PBL-15277
.ble_data.supports_ancs = is_gateway,
.ble_data.requires_address_pinning = requires_address_pinning,
};
bt_persistent_storage_assign_persist_pairing_info(&new_data.ble_data.pairing_inf... | {
BtPersistBondingData data;
if (!prv_file_get(&bonding, sizeof(bonding), &data, sizeof(data))) {
return false;
}
if (data.type != BtPersistBondingTypeBLE) {
PBL_LOG(LOG_LEVEL_ERROR, "Not getting BT Classic id %d. Type mismatch", bonding);
return false;
}
prv_fill_ble_data(&data.ble_data.pairi... |
static bool prv_bt_persistent_storage_get_ble_smpairinginfo_by_id(
BTBondingID bonding, SMPairingInfo *info_out, char *name_out, bool *requires_address_pinning,
uint8_t *flags) {
BtPersistBondingData data;
if (!prv_file_get(&bonding, sizeof(bonding), &data, sizeof(data))) {
return false;
}
if (da... |
/*
* 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... | framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}) | ;
}
// Teardown
void test_graphics_draw_stroke_${BIT_DEPTH_NAME}__cleanup(void) {
free(fb);
}
// Tests
////////////////////////////////////
void inside_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_stroke_width(ctx, 10);
graphics_c... |
true /* auto_reconnect */,
false /* is_pairing_required */,
GAPLEClientApp);
cl_assert_equal_i(e, BTErrnoOK);
registered = gap_le_connect_has_connection_intent(&device, GAPLEClientApp);
cl_assert_equal_b(registered, true);
// Try registering the d... | (&device, false /* connected */, (1 << PebbleTask_App),
HCI_ERROR_CODE_CONNECTION_TERMINATED_BY_LOCAL_HOST) | |
request->address, request->address, end_address,
(end_address + SECTOR_SIZE_BYTES - 1) & SECTOR_ADDR_MASK,
prv_erase_complete, NULL);
}
}
static void prv_handle_flash_write_request(const void *payload, uint32_t length) {
if (length < sizeof(FlashWriteRequest)) {
PBL_LOG(LOG_LEVEL_ERROR, "I... | prv_handle_ping_request(payload, payload_length) | ;
} else if (header->opcode == OPCODE_DISCONNECT) {
prv_handle_disconnect_request(payload, payload_length);
} else if (header->opcode == OPCODE_RESET) {
prv_handle_reset_request(payload, payload_length);
} else if (header->opcode == OPCODE_FLASH_GEOMETRY) {
prv_handle_flash_geometry_request(payload, p... |
e=%d)",
data->p1.x, data->p1.y, data->p2.x, data->p2.y, data->stroke_width,
(int)(data->rotation_angle * 360 / TRIG_MAX_ANGLE));
}
static void select_handler(ClickRecognizerRef recognizer, void *context) {
AppData *data = window_get_user_data(s_window);
data->operation = (data->operation + 1) ... | time_ms(&now, 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... | {
initialize_button(&BOARD_CONFIG_BUTTON.buttons[i]);
} |
periph_config_disable(RCC_APB2PeriphClockCmd, RCC_APB2Periph_SYSCFG);
periph_config_release_lock();
}
bool button_selftest(void) {
return button_get_state_bits() == 0;
}
|
PBL-17806 in future, store frames and config values as well
if (transition->create_animation) {
context->animation = transition->create_animation(context);
}
// If we haven't set an animation, either because create_animation() was NULL or it returned
// NULL, use g_window_transition_none_implementation
if... | {
prv_transition_to(window_from, window, transition_insert);
} |
PBL_LOG(LOG_LEVEL_DEBUG, "(+) %s=%p <%s>", is_app_window ? "window" : "modal window",
window, window_get_debug_name(window));
}
static Window *prv_remove_item(WindowStackItem *pop_item,
const WindowTransitionImplementation *transition) {
PBL_ASSERTN(pop_item->window);
Windo... |
/*
* 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... | pebble_task_get_current() | ;
}
if (task == PebbleTask_App) {
return app_state_get_plugin_service();
} else {
PBL_ASSERTN(task == PebbleTask_Worker);
return worker_state_get_plugin_service();
}
}
// ---------------------------------------------------------------------------------------------------------------
// Lookup the p... |
e, third_page_two_lines, third_page_full, fourth_page_one_line,
};
const int16_t num_steps = ARRAY_LENGTH(texts);
const GSize size = GSize(144, 300);
prv_prepare_fb_steps_xy(size, num_steps, 1);
ctx.draw_state.avoid_text_orphans = true;
render_steps(&layout, RenderMoveDrawBox, 0, size.h, texts);
// dr... | text_resources_init_font(0, RESOURCE_ID_GOTHIC_24_BOLD, 0, &s_font_info) | );
TextLayoutExtended layout = {
.flow_data = {
.perimeter.impl = &(GPerimeter){.callback = prv_perimeter_for_display_round},
.perimeter.inset = 8,
.paging.page_on_screen = {
.origin_y = 48,
.size_h = 85
},
.paging.origin_on_screen.y = 412,
},
};
void *layout... |
false /* requires_address_pinning */, 0 /* flags */);
// Sync LE and Classic data
prv_fire_writeback_timer();
// Make sure everything checks out
prv_validate_ble_pairing_info(&s_pairing_info, device_name_le);
BTDeviceAddress out_addr = {};
char device_name_out[BT_DEVICE_... | cl_assert_equal_b(shared_prf_storage_get_local_device_name(NULL, 0), false) | ;
char device_name[BT_DEVICE_NAME_BUFFER_SIZE] = "ABCDEFGHIJKLMNOPQRS";
shared_prf_storage_set_local_device_name(device_name);
char device_name_out[BT_DEVICE_NAME_BUFFER_SIZE];
cl_assert_equal_b(shared_prf_storage_get_local_device_name(device_name_out,
... |
%lx", flash_addr, flash_addr_max);
// Read every region from the region table in blocks of 16k.
cmd.cmd = CoreDumpCmd_ReadMemory;
for (int region = 0; region < MemoryRegionTagCount; ++region) {
if (region == MemoryRegionTag_Text && text_crc_matches) {
continue;
}
// Write out a chunk header
... | xSemaphoreCreateBinary() | ;
s_spi_int_semph = xSemaphoreCreateBinary();
// Enable SPI. Use our own interrupt handler.
dialog_spi_init(prv_handshake_int_exti_cb);
if (prv_handshake()) {
dialog_spi_deinit();
dialog_spi_init(prv_int_exti_cb);
prv_core_dump_main();
}
dialog_spi_deinit();
vSemaphoreDelete(s_spi_dma_semph)... |
-48, 920, 232},
{ -48, 920, 232},
{ -40, 920, 232},
{ -40, 920, 232},
{ -48, 920, 232},
{ -48, 920, 232},
{ -48, 928, 232},
// 167 seconds
{ -40, 928, 232},
{ -48, 920, 240},
{ -48, 920, 224},
{ -48, 920, 224},
{ -40, 928, 232},
{ -40, 920, 216},
{ -48, 920, 224},... | { -56, 920, 240},
{ -48, 920, 240},
{ -48, 920, 240},
{ -48, 928, 240},
{ -48, 920, 232},
{ -48, 928, 232},
{ -48, 928, 224},
{ -48, 928, 224},
{ -48, 928, 216},
{ -40, 928, 224},
{ -40, 928, 224},
{ -56, 928, 232},
// 173 seconds
{ -48, 920, 216},
{ -48, 920,... |
{ -48, 928, 208},
{ -48, 928, 208},
{ -48, 928, 208},
{ -48, 928, 208},
{ -48, 928, 208},
{ -48, 928, 216},
{ -48, 928, 208},
{ -48, 928, 216},
{ -40, 928, 216},
{ -48, 928, 224},
{ -40, 928, 216},
{ -48, 920, 216},
{ -48, 920, 216},
{ -48, 928, 208},
{ -48, ... |
s/normal/notifications/alerts_private.h"
#include "clar.h"
#include "stdbool.h"
// Stubs
/////////////////////////////////
#include "stubs_analytics.h"
#include "stubs_events.h"
#include "stubs_firmware_update.h"
#include "stubs_hexdump.h"
#include "stubs_logging.h"
#include "stubs_mutex.h"
#include "stubs_notificat... | alerts_should_enable_backlight_for_type(AlertMobile) | );
cl_assert(alerts_should_notify_for_type(AlertReminder));
cl_assert(!alerts_should_vibrate_for_type(AlertReminder));
alerts_set_notification_vibe_timestamp();
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS);
cl_assert(!alerts_should_enable_backlight_for_type(AlertReminder));
cl_ass... |
//! The TimerID type used for sys_timers is a non-repeating integer that we also use as our key for finding
//! EventedTimers by id.
TimerID sys_timer_id;
EventedTimerCallback callback;
void* callback_data;
PebbleTask target_task;
bool expired; // This gets set when the timer's callback runs
bool rep... | (s_last_event.type, PEBBLE_NULL_EVENT) | ;
cl_assert(!s_times_callback_executed);
}
void test_evented_timer__cancel_during_app_event(void) {
EventedTimerID timer = evented_timer_register(100, false, stub_evented_timer_callback, 0);
// We've started the timer, but it hasn't fired yet.
TimerID sys_timer_id = timer;
cl_assert(stub_new_timer_is_schedu... |
32_t active_calories;
uint32_t distance_mm;
} KAlgTestActivitySession;
// ---------------------------------------------------------------------------------------------
// Globals
void *s_kalg_state;
// ==================================================================================
// Assertion utilities
// Ass... | {
printf("%s: %d, ", names[i], values[i]);
stats->values[i] = values[i];
} |
printf("\n");
// Append to the list
if (s_stat_rows) {
list_append(&s_stat_rows->node, &stats->node);
} else {
s_stat_rows = stats;
}
}
// ---------------------------------------------------------------------------------------
// Set a specific column in the last row by name
static void prv_stats_... |
{ 1128, 352, -264},
{ 1184, 392, -304},
{ 1256, 400, -272},
{ 1024, 456, -280},
{ 1016, 392, -232},
{ 1128, 408, -168},
{ 1208, 336, -120},
{ 1056, 272, -48},
{ 816, 216, -72},
// 29 seconds
{ 688, 192, -56},
{ 664, 176, -48},
{ 752, 200, -72},
{ 928, 168, -56},
... | { 496, 184, -256},
{ 704, 216, -256},
{ 960, 296, -224},
{ 1136, 368, -256},
{ 1192, 432, -208},
{ 1128, 392, -192},
{ 1160, 400, -224},
{ 1152, 408, -216},
{ 1344, 376, -160},
{ 1416, 336, -160},
{ 1296, 272, -144},
{ 976, 216, -72},
{ 736, 152, -96},
{ 640, 80, ... |
{ 1072, 344, -232},
{ 1048, 312, -176},
{ 960, 256, -112},
// 37 seconds
{ 840, 208, -96},
{ 784, 192, -64},
{ 768, 184, -64},
{ 792, 184, -32},
{ 808, 144, -24},
{ 888, 120, -32},
{ 1008, 120, -40},
{ 1024, 112, -40},
{ 1040, 152, -128},
{ 1208, 208, -176},
... |
ation"
0x54, 0x65, 0x73, 0x74, 0x20, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e,
// Attribute 2
0x02, // Attribute ID - Subtitle
0x08, 0x00, // Attribute Length
// Attribute text: "Subtitle"
'S', 'u', 'b', 't', 'i', 't', 'l', 'e... | (&list, AttributeIdBody, "") | );
attribute_list_destroy_list(&list);
kernel_free(buffer);
}
static void prv_check_app_glance_subtitle_in_attribute_list_deserializes(
const uint8_t *serialized_attribute_list_to_deserialize,
size_t serialized_attribute_list_to_deserialize_size, uint8_t num_attributes,
const char *expected_app_glance_... |
oid test_do_not_disturb__weekday_weekend_schedule(void) {
bool active;
cl_assert(do_not_disturb_is_smart_dnd_enabled() == false);
cl_assert(do_not_disturb_is_manually_enabled() == false);
cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == false);
cl_assert(do_not_disturb_is_schedule_enabled(Wee... | get_dnd_timer_id() | ), 169200 * MS_PER_SECOND);
do_not_disturb_set_schedule_enabled(WeekendSchedule, false);
do_not_disturb_set_schedule_enabled(WeekdaySchedule, true);
rtc_set_time(s_saturday_01_30);
do_not_disturb_handle_clock_change();
cl_assert(active == false);
// Timer will go off at 00:00 on Saturday. (46.5 hours)
cl... |
lient, 1));
// Consume one without reading it
cl_assert(shared_circular_buffer_consume(&buffer, &client, 1));
// Read the last little bit
cl_assert(shared_circular_buffer_read(&buffer, &client, 1, &out_buffer, &out_length));
cl_assert_equal_i(out_length, 1);
cl_assert(memcmp(out_buffer, (uint8_t*) "c", 1)... | (&buffer, &client1) | , 3);
cl_assert_equal_i(shared_circular_buffer_get_read_space_remaining(&buffer, &client2), 5);
cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 3);
// If we remove client2, it should create more space
shared_circular_buffer_remove_client(&buffer, &client2);
cl_assert_equal_i(shar... |
/*
* 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... | {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_120_pbl_25478_1
//> TEST_EXPECTED 120
//> TEST_EXPECTED_MIN 50
//> TEST_EXPECTED_MAX 130
//> TEST_WEIGHT 1.0
static AccelRawData samples[] = {
// 0 seconds
// elapsed: 0 minutes
{ 184, -208, -960},
{ 1... |
{ 296, 344, -792},
{ 224, 448, -744},
{ 280, 440, -736},
{ 248, 520, -680},
{ 256, 512, -656},
{ 248, 512, -664},
{ 216, 464, -648},
{ 176, 512, -608},
{ 72, 616, -608},
{ -16, 768, -520},
{ 104, 1080, -360},
{ 0, 1440, -368},
{ 232, 1048, -336},
{ 256, 808, -200... |
/*
* 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->setup(layer->window);
} |
PROFILER_INIT;
PROFILER_START;
while (PROFILER_NODE_GET_TOTAL_US(gfx_test_update_proc) < (test->duration * US_PER_S)) {
PROFILER_NODE_START(gfx_test_update_proc);
test->test_proc(layer, ctx);
PROFILER_NODE_STOP(gfx_test_update_proc);
}
PROFILER_STOP;
PROFILER_PRINT_STATS;
if (test->teardown... |
ore overwritten
// records.
static bool partially_written(SettingsRecordHeader *hdr) {
return !flag_is_set(hdr, SETTINGS_FLAG_WRITE_COMPLETE);
}
static bool partially_overwritten(SettingsRecordHeader *hdr) {
return flag_is_set(hdr, SETTINGS_FLAG_OVERWRITE_STARTED)
&& !flag_is_set(hdr, SETTINGS_FLAG_OVERWR... | (&new_file) | ;
status = prv_open(file, name, OP_FLAG_READ | OP_FLAG_WRITE, file->max_used_space);
kernel_free(name);
return status;
}
T_STATIC status_t settings_file_compact(SettingsFile *file) {
return settings_file_rewrite_filtered(file, NULL, NULL);
}
static bool key_matches(SettingsRawIter *iter, const uint8_t *key, i... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (flash_locked) | ;
}
void test_system_flash__erase_some_sectors_from_beginning(void) {
cl_assert(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 ... |
ox_params->alignment) {
case GTextAlignmentCenter:
line->origin.x = line->origin.x + (horiz_px_remaining / 2);
break;
case GTextAlignmentRight:
line->origin.x = line->origin.x + horiz_px_remaining;
break;
case GTextAlignmentLeft:
break;
}
}
//! @return is_text_remaining
bool... | prv_text_layout_is_fresh(layout, font, box, overflow_mode, alignment, text_hash) | ) {
return;
}
layout->max_used_size = GSizeZero;
layout->hash = text_hash;
layout->box = box;
layout->overflow_mode = overflow_mode;
layout->alignment = alignment;
layout->font = font;
WalkLinesCallbacks callbacks = {
.layout_update_cb = update_all_layout_update_cb
};
int16_t line_spacing... |
der[1]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id));
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(0));
cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(1));
int new_idx;
bool has_next;
cl_ass... | cl_assert(timeline_model_iter_next(NULL, NULL)) | ;
cl_assert(timeline_model_iter_next(NULL, NULL));
cl_assert(timeline_model_iter_next(NULL, NULL));
cl_assert(!timeline_model_iter_next(NULL, NULL));
int new_idx;
cl_assert(timeline_model_iter_prev(&new_idx, NULL));
cl_assert_equal_i(new_idx, 4);
cl_assert_equal_i(timeline_model_get_num_items(), 2);
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... | ((Uuid *)key) | ;
notifications_handle_notification_removed((Uuid *)key);
return S_SUCCESS;
}
status_t notif_db_flush(void) {
notification_storage_reset_and_init();
return S_SUCCESS;
}
|
not_disturb.h"
#include "applib/ui/action_toggle.h"
#include "kernel/events.h"
#include "resource/resource.h"
#include "services/common/new_timer/new_timer.h"
#include "services/common/system_task.h"
#include "services/common/system_task.h"
#include "services/normal/filesystem/pfs.h"
#include "services/normal/notifica... | (0, 0x1000000) | ;
pfs_init(false);
pfs_format(false);
rtc_set_time(s_thursday_00_00);
alerts_preferences_init();
do_not_disturb_init();
do_not_disturb_set_manually_enabled(false);
do_not_disturb_set_schedule_enabled(WeekdaySchedule, false);
do_not_disturb_set_schedule_enabled(WeekendSchedule, false);
if (do_not_dis... |
-16},
// 102 seconds
{ -664, 712, -16},
{ -672, 712, -16},
{ -656, 720, -16},
{ -672, 712, -8},
{ -656, 728, -24},
{ -664, 736, -16},
{ -656, 728, 0},
{ -672, 712, -8},
{ -664, 712, -16},
{ -664, 736, -8},
{ -672, 736, -8},
{ -672, 712, -8},
{ -672, 728, -16},
... | { -672, 704, 8},
{ -680, 688, 0},
{ -680, 704, 16},
{ -680, 720, 8},
// 108 seconds
{ -672, 704, 0},
{ -688, 712, 0},
{ -664, 704, -8},
{ -664, 760, -40},
{ -680, 672, 16},
{ -672, 744, 8},
{ -680, 712, 16},
{ -688, 704, 8},
{ -680, 704, -8},
{ -672, 720, 0},
... |
{ -552, 768, -288},
{ -552, 752, -272},
{ -560, 768, -296},
{ -560, 768, -280},
{ -560, 736, -296},
{ -560, 736, -304},
{ -560, 728, -296},
{ -576, 728, -280},
{ -584, 800, -152},
{ -512, 904, -240},
{ -552, 712, -152},
{ -656, 736, -56},
// 111 seconds
{ -648, 7... |
if (callbacks->tx_power_level_cb) {
parse_func = parse_power_level;
} |
break;
case BLEAdTypeManufacturerSpecific:
if (callbacks->manufacturer_cb) {
parse_func = parse_manufact_spec;
}
break;
default: // parse_func == NULL
break;
} // switch()
if (parse_func) {
if (!parse_func(elem, callbacks, cb_data)) {
... | |
gion_menu_push(SettingsTimeData *data) {
const char *title = prv_get_timezone_title();
const OptionMenuCallbacks callbacks = {
.select = prv_region_menu_select,
};
const int start_index = data->continent_start[data->continent_selected];
const int end_index = data->continent_end[data->continent_selected];
... | (sizeof(*data)) | ;
*data = (SettingsTimeData){};
data->callbacks = (SettingsCallbacks) {
.deinit = prv_deinit_cb,
.draw_row = prv_draw_row_cb,
.select_click = prv_select_click_cb,
.num_rows = prv_num_rows_cb,
.selection_will_change = prv_selection_will_change_cb,
};
prv_init_continent_and_region_names(data... |
{
return;
} |
const bool is_entity_update_characteristic =
(characteristic == s_ams_client->characteristics[AMSCharacteristicEntityUpdate]);
const bool has_error = (error != BLEGATTErrorSuccess);
if (has_error) {
const AMSAnalyticsEvent event = is_entity_update_characteristic ?
A... | |
ionCurveEaseIn);
return animation;
}
static Animation* prv_create_upwards_animation(MusicAppData *data) {
return animation_spawn_create(
prv_create_layer_upwards_animation(&data->artist_text_layer.layer, ARTIST_BOUNDS_OFFSET),
prv_create_layer_upwards_animation(&data->title_text_layer.layer, TITLE_BOUN... | (cassette_left, cassette_right,
cassette_bounceback, NULL) | |
to start");
prv_exit_and_send_result_event(data, DictationSessionStatusFailureInternalError);
return;
}
if (data->state != StateStartWaitForReady) {
// This is a bit of a hack to prevent jumps in the fly in animation when a session fail comes
// back quickly
prv_set_mic_window_state(data, State... | (min, max, stage_duration, &s_animated_dot_impl, data) | |
+= (data->line_velocity_y * PIXEL_SPEED_PER_FRAME);
if (data->line_p0.y < 0 || data->line_p0.y > data->window.layer.bounds.size.h ||
data->line_p1.y < 0 || data->line_p1.y > data->window.layer.bounds.size.h ) {
data->line_velocity_y = data->line_velocity_y * -1;
}
} else if (shape == ... | // Move the line 2*X per 3*Y
data->bucket_offset.x += (data->bucket_velocity_x * PIXEL_SPEED_PER_FRAME * 2);
if (data->bucket_offset.x < 0 ||
data->bucket_offset.x > data->window.layer.bounds.size.w) {
data->bucket_velocity_x = data->bucket_velocity_x * -1;
}
data->bucke... |
}
}
static void draw_shape(GContext* ctx, AppData *data, DrawShape shape, GColor color) {
graphics_context_set_fill_color(ctx, color);
graphics_context_set_stroke_color(ctx, color);
if (data->fill) {
if (shape == POINT) {
graphics_draw_pixel(ctx, data->point_p0);
} else if (shape == LINE) {
... |
pitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("IN 59 MIN", time_buf);
// June 10th 2015, 13:30:00 (T-00:30:00)
rtc_set_time(event_time - (30 * SECONDS_PER_MINUTE));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_e... | cl_assert_equal_s("Fri, 12:00 PM", time_buf) | |
wn = animation_spawn_create(b, c, NULL);
cl_assert(spawn != NULL);
// Create a sequence by putting a in front
// We now have a -> (b | c)
Animation *seq = animation_sequence_create(a, spawn, NULL);
// Make it repeat
animation_set_play_count(seq, repeat_count);
prv_clear_handler_histories();
uint64_t ... | (prv_count_handler_entries(&s_teardown_handler_calls, c), 1) | ;
#endif
}
// --------------------------------------------------------------------------------------
// Test using clone and reverse in a complex animation
void test_animation__complex_reverse(void) {
#ifdef TEST_INCLUDE_COMPLEX
const int duration_a = 300;
const int duration_total = 2 * duration_a;
const int re... |
;
exit(-1);
}
clar_run_suite(&_clar_suites[num]);
}
else if (!has_colon || argument[-1] == ':') {
for (j = 0; j < (int)_clar_suite_count; ++j)
if (strncmp(argument, _clar_suites[j].name, len) == 0)
clar_run_suite(&_clar_suites[j]);
}
else {... | if (description != NULL)
error->description = strdup(description); | |
/*
* 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;
} | |
rocessed.
// Probably not a big deal.
gatt_client_subscriptions_reschedule(GAPLEClientKernel);
return; // yield
}
// This is ugly and causes double-copying the data...
// TODO: https://pebbletechnology.atlassian.net/browse/PBL-14164
uint8_t *buffer = (uint8_t *) kernel_malloc(header.... | gatt_client_discovery_discover_all(&device) | ;
const bool gateway_is_classic_paired = true; // TODO
if (gateway_is_classic_paired) {
// [MT] Kick reconnection for BT Classic when BLE comes up.
// If BLE is able to reconnect, chances are BT Classic is able too, so try
// immediately instead of waiting for reconnect.c's timer to fire.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.