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... | (direction) | );
}
static const CompositorTransition *prv_get_action_compositor_animation(
CompositorTransitionDirection direction) {
return PBL_IF_RECT_ELSE(compositor_shutter_transition_get(direction, ACTION_SHUTTER_COLOR),
NULL);
}
const CompositorTransition *shell_get_watchface_compositor_animat... |
function anywhere in
// memory that exists.
//
// For reference, those ranges are:
// 0x0000 0000 - 0x0001 FFFF - Internal Flash, remapped at 0x0
// 0x0800 0000 - 0x0801 FFFF - Internal Flash
// 0x2000 0000 - 0x2002 FFFF - Internal SRAM
//
// When such a time comes that more ranges are required, the spare two
// ... | app_timer_reschedule(animation_legacy2_scheduler->timer_handle, interval_ms) | ;
// Ignore the return value of reschedule. If it fails it probably means the callback is already
// fired and we're waiting for the handler to be called. This will end up rescheduling us for
// the right time once that gets handled.
} else {
animation_legacy2_scheduler->timer_handle =
app_tim... |
/*
* 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 (minutes != INT_MIN && pos < (int)buffer_size - 1) {
buffer[pos++] = ' ';
} |
}
if (minutes != INT_MIN) {
pos += snprintf(buffer + pos, buffer_size - pos, i18n_get("%dM", i18n_owner), minutes);
}
return pos;
}
int health_util_format_hours_minutes_seconds(char *buffer, size_t buffer_size, int duration_s,
bool leading_zero, void *i18n_owne... |
amelen + 1];
file_name[f->namelen] = '\0';
memcpy(file_name, f->name, f->namelen);
if ((res = pfs_close(fd)) >= 0) {
res = pfs_remove(file_name);
}
}
mutex_unlock_recursive(s_pfs_mutex);
return (res);
}
status_t pfs_remove(const char *name) {
if (name == NULL) {
return E_INVALID_ARG... | (file_name) | ) {
// Don't include
continue;
}
// Make sure the rest of the page header contents are valid. We are doing this after the
// filename filter call because it requires more flash reads and is likely slower than the
// filter call.
if (read_header(pg, &pg_hdr, &file_hdr) != PageAndFileHdrV... |
ptions_assert_subscribe(s_characteristics[0][PPoGATTCharacteristicData],
BLESubscriptionNotifications,
GAPLEClientKernel);
// Simulate getting the subscription failure:
ppogatt_handle_subscribe(s_characteristics[0][P... | (s_characteristics[0][PPoGATTCharacteristicData]) | ;
prv_assert_sent_reset_complete(s_characteristics[0][PPoGATTCharacteristicData]);
prv_receive_reset_request(s_characteristics[0][PPoGATTCharacteristicData]);
fake_gatt_client_op_assert_no_write();
}
void test_ppogatt__ignore_server_reset_request_while_resetting_due_to_own_reset_request(void) {
prv_notify_ser... |
/*
* 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 (mcu_state_is_isr()) {
return DialogTask_ISR;
}
return task_to_dialogtask(xTaskGetCurrentTaskHandle());
} | |
ss, ControlServiceAttribute attr,
void *data, uint32_t length) {
if (!success) {
PBL_LOG(LOG_LEVEL_DEBUG, "Read of control attribute was not successful (0x%x)", attr);
return false;
}
if (attr == ControlServiceAttributeLaunchApp) {
if (length != UUID_SIZE)... | if (result != SmartstrapResultOk) {
mbuf_free(s_reserved_read_mbuf);
s_reserved_read_mbuf = NULL;
} |
}
static SmartstrapResult prv_send(const SmartstrapRequest *request) {
if (!s_has_done_service_discovery || !sys_smartstrap_is_service_connected(request->service_id)) {
return SmartstrapResultServiceUnavailable;
}
GenericServiceType type;
if (request->write_mbuf && request->read_mbuf) {
type = Generi... |
/*
* 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_erase_subsector_blocking(i) | ;
}
// Erase the full sectors...
for (int32_t i = sector_start; i < sector_end; i += SECTOR_SIZE_BYTES) {
flash_erase_sector_blocking(i);
}
// Erase the trailing subsectors
for (int32_t i = sector_end; i < subsector_end; i += SUBSECTOR_SIZE_BYTES) {
flash_erase_subsector_blocking(i... |
e_direction(
indicator, ContentIndicatorDirectionUp,
&(ContentIndicatorConfig) {
.layer = &expandable_dialog->dialog.status_layer.layer,
.times_out = true,
.colors.foreground = dialog->text_color,
.colors.background = dialog->window.background_color,
... | if (expandable_dialog) {
expandable_dialog_set_select_action(expandable_dialog, select_icon, select_click_handler);
Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog);
dialog_set_icon(dialog, icon);
dialog_set_text(dialog, text);
dialog_set_background_color(dialog, background_color);
... |
return expandable_dialog;
}
void expandable_dialog_show_action_bar(ExpandableDialog *expandable_dialog,
bool show_action_bar) {
expandable_dialog->show_action_bar = show_action_bar;
}
void expandable_dialog_set_action_icon_animated(ExpandableDialog *expandable_dialog,
... |
(hdr.last_written),
prv_page_to_flash_offset(next_page) + offsetof(PageHeader, last_written));
}
//! The wear leveling strategy deployed is as follows:
//! Always track the last page which was written. Every time a new page needs
//! to be allocated, search for the next page that comes after the
//! 'la... | (next_page) | ;
}
*free_page = s_last_page_written = next_page;
return (S_SUCCESS);
}
return (E_OUT_OF_STORAGE);
}
//! Note: expects that the caller does _not_ hold the pfs mutex
//! Note: If pages are already pre-erased on the FS, this routine will return
//! very quickly. If we need to do erases, it will take l... |
ert.h"
#include "util/math.h"
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
enum ActionBarState {
ActionBarStateSkip,
ActionBarStateVolume,
ActionBarStateLongPress,
};
typedef struct MusicAppSizeConfig {
const char *music_time_font_key;
const char *no_music_font_key;
int16_t horizontal_mar... | GRect(cassette_x, config->cassette_rect.origin.y,
config->cassette_rect.size.w, config->cassette_rect.size.h) | ;
}
static GRect prv_track_rect(void) {
const MusicAppSizeConfig *config = prv_config();
return GRect(config->horizontal_margin, config->track_field.origin_y,
prv_content_width(), config->track_field.size_h);
}
static const ButtonId BUTTON_FORWARD = BUTTON_ID_DOWN;
static const ButtonId BUTTON_BACK... |
izeof(filename_buf), 1);
load_fixture_on_pfs(APP1_RESOURCES_FIXTURE_NAME, filename_buf);
// simulate installing app2 on flash
app_db_insert((uint8_t *)&menu_layer.uuid, sizeof(Uuid), (uint8_t *)&menu_layer, sizeof(AppDBEntry));
menu_layer_id = app_db_get_install_id_for_uuid(&menu_layer.uuid);
app_cache_add_e... | cl_assert_equal_b(true, app_install_get_uuid_for_install_id(music_id, &uuid)) | ;
cl_assert_equal_uuid(uuid, music_uuid);
cl_assert_equal_b(true, app_install_get_uuid_for_install_id(sports_id, &uuid));
cl_assert_equal_uuid(uuid, sports_uuid);
cl_assert_equal_b(false, app_install_get_uuid_for_install_id(CRAZY_ID, &uuid));
cl_assert_equal_uuid(uuid, UUID_INVALID);
}
void test_app_install... |
eway_and_disconn_bt_classic(const BTDeviceInternal *gateway_device) {
BTBondingID bonding_id = BT_BONDING_ID_INVALID;
bt_lock();
// Find the Bonding ID for the LE connection that supports PPoGATT:
GAPLEConnection *connection = gap_le_connection_by_device(gateway_device);
// It's possible the connection is gon... | (LOG_LEVEL_INFO, "Found an instance of %s at 0x%"PRIx16"-0x%"PRIx16"!",
client->debug_name, range.start, range.end) | ;
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Found an instance of %s at 0x%"PRIx16"-0x%"PRIx16"!",
client->debug_name, range.start, range.end);
}
#endif
client->handle_service_discovered(characteristics);
}
}
}
static void prv_handle_gatt_service_discovery_event(const PebbleBLEG... |
e "services/normal/blob_db/weather_db.h"
#include "services/normal/weather/weather_service_private.h"
#define WEATHER_PREFS_DATA_SIZE (sizeof(SerializedWeatherAppPrefs) + \
(sizeof(Uuid) * WEATHER_DATA_SHARED_WEATHER_DB_NUM_DB_ENTRIES))
static uint8_t s_weather_app_prefs[WEATHER_PREFS_D... | {
PascalString16List pstring16_list;
PascalString16 *location_name;
PascalString16 *short_phrase;
size_t data_size;
location_name = pstring_create_pstring16_from_string(location);
short_phrase = pstring_create_pstring16_from_string(phrase);
data_size = strlen(location) +
strlen(phrase) +
... | |
/*
* 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_wait_for_conversion(VREF_ADC) | ) {
continue;
}
uint32_t vref = ADC_GetConversionValue(VREF_ADC);
ADC_SoftwareStartConv(device->adc);
if (!prv_wait_for_conversion(device->adc)) {
continue;
}
uint32_t vmon = ADC_GetConversionValue(device->adc);
// Only save values and increment counter if both reads were succe... |
0), 10);
#if PBL_COLOR
ASSERT_CALLED(graphics_internal_circle_quadrant_fill_aa(&context, GPoint(50, 50), 10, GCornersAll));
#else
ASSERT_CALLED(graphics_circle_fill_non_aa(&context, GPoint(50, 50), 10));
#endif
setup_test(&context, true, 5, GColorBlack, GColorBlack, false);
graphics_fill_round_rect(&context, &... | ASSERT_NO_CHANGE(graphics_fill_circle(&context, GPoint(50, 50), 10)) | |
/*
* 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... | plugin_service_unsubscribe(NULL) | ;
}
// ---------------------------------------------------------------------------------------------------------------
// Send an event to all registered subscribers of the given plugin service identified by UUID.
void app_worker_send_message(uint8_t type, AppWorkerMessage *data) {
_Static_assert(sizeof(AppWorkerMe... |
lanceFactory *factory = &s_system_glance_factories[i];
if (uuid_equal(&factory->uuid, &node->uuid)) {
glance = factory->constructor(node);
break;
}
}
// If we haven't loaded a glance yet, try loading a generic glance for the node
if (!glance) {
glance = launcher_app_glance_generic_create(... | (node, service) | |
16},
{ 1584, 352, -32},
{ 1456, 136, -32},
{ 672, -360, 120},
{ 760, -408, 16},
{ 1216, -144, -168},
{ 1472, -48, -152},
{ 1576, 72, -16},
{ 1608, 160, 64},
{ 1464, 272, -64},
{ 1448, 360, -104},
{ 1632, 520, -120},
{ 1744, 616, 56},
{ 1712, 688, 168},
{ 1360, 74... | { 1520, 784, -80},
{ 1608, 352, -160},
{ 1360, 872, -312},
{ 1224, 1456, -280},
{ 1080, 1040, -104},
{ 840, 816, -152},
{ 1056, 688, -48},
{ 1008, 648, -176},
{ 1216, 640, -48},
{ 1672, 696, 8},
{ 1848, 608, 48},
{ 1840, 432, 24},
{ 1768, 312, 72},
{ 1768, 320, -8... |
{ 1048, -304, -104},
{ 760, -408, -200},
{ 1112, -312, -280},
{ 1560, 96, -352},
{ 1728, 128, -192},
{ 1856, 208, -40},
{ 1872, 312, -96},
{ 1632, 496, -136},
{ 1472, 592, -104},
{ 1360, 616, 32},
{ 1448, 552, 0},
{ 1288, 584, -24},
{ 1080, 944, -104},
{ 1184, 15... |
/*
* 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(GColorWhite.r == 0b11);
cl_assert(GColorWhite.g == 0b11);
cl_assert(GColorWhite.b == 0b11);
cl_assert(GColorWhite.a == 0b11);
} |
void test_graphics_colors__red(void) {
cl_assert(GColorRed.r == 0b11);
cl_assert(GColorRed.g == 0b00);
cl_assert(GColorRed.b == 0b00);
cl_assert(GColorRed.a == 0b11);
}
void test_graphics_colors__green(void) {
cl_assert(GColorGreen.r == 0b00);
cl_assert(GColorGreen.g == 0b11);
cl_assert(GColorGreen.b =... |
/*
* 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... | (LOG_LEVEL_WARNING, "Resetting receive state - max packet time expired") | ;
}
state->callback_pending = false;
uint16_t bytes_avail = shared_circular_buffer_get_read_space_remaining(&state->isr_buffer,
&state->isr_buffer_client);
QEMU_LOG_DEBUG("prv_assemble_packet, state:%d, bytes:%d", state->recv_state,
bytes_avail);
// Log message if we detected an... |
r) {
return true;
}
return recognizer->subscriber.filter(recognizer, touch_event);
}
static void prv_send_subscriber_event(Recognizer *recognizer) {
RecognizerEvent event;
switch (recognizer->state) {
case RecognizerState_Started:
event = RecognizerEvent_Started;
break;
case Recognizer... | (recognizer) | ;
PBL_ASSERTN(recognizer->state == RecognizerState_Possible);
prv_set_state(recognizer, RecognizerState_Failed);
if (recognizer->impl->on_fail) {
recognizer->impl->on_fail(recognizer);
}
}
void recognizer_set_manager(Recognizer *recognizer, RecognizerManager *manager) {
PBL_ASSERTN(recognizer);
recog... |
/*
* 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 (layer->update_proc == (LayerUpdateProc) path_layer_update_proc) {
return "PathLayer";
} else if (layer->update_proc == (LayerUpdateProc) progress_layer_update_proc) {
return "ProgressLayer";
} else if (layer->update_proc == (LayerUpdateProc) rot_bitmap_layer_update_proc) {
return "RotBitmapLayer";
... |
}
static void layer_dump_tree_node(Layer* node, uint8_t indentation_level, char *buffer, uint8_t buffer_size);
void layer_dump_level(Layer* node, uint8_t indentation_level, char *buffer, uint8_t buffer_size) {
while (node) {
layer_dump_tree_node(node, indentation_level, buffer, buffer_size);
node = node->n... |
s_remote_encryption_info_valid = ble_data->is_remote_encryption_info_valid;
pairing_info_out->is_remote_identity_info_valid = ble_data->is_remote_identity_info_valid;
pairing_info_out->is_remote_signing_info_valid = ble_data->is_remote_signing_info_valid;
}
if (name_out) {
strncpy(name_out, data.ble_dat... | {
SharedPRFData data;
prv_fetch_struct(&data);
bool result = false;
const BTDeviceAddress invalid_address = (BTDeviceAddress) {};
if (memcmp(&data.bt_classic_data.address, &invalid_address, sizeof(invalid_address)) == 0) {
PBL_LOG(LOG_LEVEL_WARNING, "Invalid pairing stored");
goto done;
}
if (ad... |
static void prv_load_bt_classic_pairing_data(
BTClassicPairingData *data, BTDeviceAddress *addr, const char *device_name,
SM128BitKey *link_key, uint8_t platform_bits) {
*data = (BTClassicPairingData) {
.address = *addr,
.link_key = *link_key,
.platform_bits = platform_bits
};
strncpy(data->... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | gdraw_command_get_num_points(command) | ;
for (uint16_t i = 0; i < num_points; i++) {
const GSize size = (command->type == GDrawCommandTypePrecisePath)
? to_square->precise_size : to_square->integer_size;
command->points[i] = gpoint_attract_to_square(command->points[i],
size, to_square->norm... |
----------------------------------------------------------------------------------
DataLoggingSession* dls_create_current_process(uint32_t tag, DataLoggingItemType item_type,
uint16_t item_size, void* buffer, bool resume) {
const PebbleProcessMd *md = sys_process_manager... | (&session->data->buffer) | < num_bytes) {
result = DATA_LOGGING_BUSY;
goto unlock_and_exit;
}
shared_circular_buffer_write(&session->data->buffer, data, num_bytes,
false /*advance_slackers*/);
// Only enqueue work on the system_task if we're not already waiting on the system task to handle
// pre... |
t array_size = *num_records;
// Open the minute data file
file = prv_minute_data_file_open();
if (!file) {
success = false;
goto exit;
}
// Init for missing records
memset(minute_data, 0xFF, array_size * sizeof(HealthMinuteData));
// Figure out the lowest key value for for chunks that go into t... | {
bool success = false;
time_t utc_sec = rtc_get_time() - SECONDS_PER_MINUTE;
AlgMinuteFileRecord record = { };
prv_init_minute_record(&record.hdr, utc_sec, true /*for_file*/);
// Delete old file so this doesn't take forver, in case it's already got a lot of data in it
pfs_remove(ALG_MINUTE_DATA_FILE_NAME... | |
irection direction = ContentIndicatorDirectionUp;
dummy_config.layer->update_proc = s_content_indicator_dummy_layer_update_proc;
cl_assert(content_indicator_configure_direction(&content_indicator, direction, &dummy_config));
helper_check_configs_for_equality(dummy_config, direction_data[direction].config);
// S... | (content_indicator3->scroll_layer, &scroll_layer2) | ;
cl_assert(content_indicator3 != content_indicator);
}
void test_content_indicator__should_only_be_created_for_scroll_layer_upon_client_access(void) {
ContentIndicatorsBuffer *content_indicators_buffer = content_indicator_get_current_buffer();
Buffer *buffer = &content_indicators_buffer->buffer;
// At the sta... |
vent) {
.type = PEBBLE_BT_CONNECTION_EVENT,
.bluetooth.connection = {
.is_ble = true,
.state = PebbleBluetoothConnectionEventStateDisconnected,
}
};
PBL_LOG(LOG_LEVEL_DEBUG, "New BT Conn change event, We are now disconnected");
event_put(&event);
}
static void prv_comm_start(void) {
if ... | {
// Track when coming out of airplane mode and we've gone into airplane mode less than 30 secs ago:
static RtcTicks s_airplane_mode_last_toggle_ticks;
const RtcTicks now_ticks = rtc_get_ticks();
const uint64_t max_interval_secs = 30;
if (((now_ticks - s_airplane_mode_last_toggle_ticks) < (max_interval_secs *... |
void bt_ctl_set_airplane_mode_async(bool enabled) {
if (!s_comm_initialized) {
PBL_LOG(LOG_LEVEL_ERROR, "Error: Bluetooth isn't initialized yet");
return;
}
mutex_lock(s_comm_state_change_mutex);
prv_track_quick_airplane_mode_toggles(!enabled);
bt_persistent_storage_set_airplane_mode_enabled(enabled... |
/*
* 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_wakeup_cancel_all_for_app() | |
he 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.
*/
#include "fake_GATTAPI.h"
#include "clar_asserts.h"
#include <string.h>
static GATT_... | {
++s_service_changed_indication_count;
return 1; // fake transaction ID
} |
int fake_gatt_get_service_changed_indication_count(void) {
return s_service_changed_indication_count;
}
int GATT_Service_Changed_Read_Response(unsigned int BluetoothStackID,
unsigned int TransactionID,
GATT_Service_Changed_Data_t *Servic... |
/*
* 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... | graphics_context_set_text_color(&ctx, GColorBlack) | ;
graphics_context_set_fill_color(&ctx, GColorLightGray);
memset(s_dest_bitmap->addr, 0xff, s_dest_bitmap->row_size_bytes * s_dest_bitmap->bounds.size.h);
}
void prv_prepare_fb_steps(GSize size) {
prv_prepare_fb_steps_xy(size, NUM_STEPS, NUM_STEPS);
}
void test_graphics_draw_text_flow__initialize(void) {
fb =... |
v = NULL;
ScanResult *result = s_head;
while (result) {
if (bt_device_equal(&result->device, device)) {
// Match!
if (prev) {
// Unlink from previous node:
prev->next = result->next;
} else {
// Unlink from head:
s_head = result->next;
}
// Return fo... | {
if (s_is_scanning) {
ble_scan_stop();
s_is_scanning = false;
} else {
ble_scan_start(ble_scan_handler);
s_is_scanning = true;
}
menu_layer_reload_data(s_menu_layer);
} |
//------------------------------------------------------------------------------
// MenuLayer callbacks:
enum {
SectionControl = 0,
SectionData,
};
static uint16_t menu_get_num_sections_callback(struct MenuLayer *menu_layer,
void *callback_context) {
return 2;
}
static uint16_t menu_get_num_... |
>header.timestamp, rtc_get_time());
// First alarm goes off. Second one should be up
s_current_hour = 10;
s_current_minute = 30;
s_current_day = s_sunday;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 3);
cl_assert_equal_i(s_num_alarm_events_put, 3);
cl_assert_equal_i(s_num_timeline_adds... | cron_service_wakeup() | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | gdraw_command_list_get_command(&result->command_list, 1) | ->points, c1_points)
COPY_POINTS(gdraw_command_list_get_command(&result->command_list, 2)->points, c2_points)
COPY_POINTS(gdraw_command_list_get_command(&result->command_list, 3)->points, c3_points)
COPY_POINTS(gdraw_command_list_get_command(&result->command_list, 4)->points, c4_points)
return result;
}
GDrawC... |
us_idx].duty_cycle;
}
i2c_init_struct.I2C_ClockSpeed = BOARD_CONFIG.i2c_bus_configs[bus_idx].clock_speed;
i2c_init_struct.I2C_Ack = I2C_Ack_Enable;
I2C_Init(i2c_buses[bus_idx].i2c, &i2c_init_struct);
I2C_Cmd(i2c_buses[bus_idx].i2c, ENABLE);
}
//! Configure the bus pins, enable the peripheral clock and initi... | (s_initialized) | |
/*
* 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... | mutex_unlock(s_list_mutex) | ;
// We want to run any tasks we've skipped over.
prv_timer_callback(NULL);
}
// --------------------------------------------------------------------------------------------
void cron_service_init(void) {
PBL_ASSERTN(s_list_mutex == NULL);
s_list_mutex = mutex_create();
s_scheduled_jobs = NULL;
regular_... |
_COMPLEX
const int duration_a = 300;
const int duration_total = 2 * duration_a;
const int repeat_count = 2;
uint32_t distance;
// Create animations
Animation *a = prv_create_test_animation();
animation_set_duration(a, duration_a);
Animation *b = animation_clone(a);
animation_set_reverse(b, true);
... | prv_create_test_animation() | |
/*
* 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... | launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_display_calibration_app_get_info()) | ;
}
#endif
static void prv_select_accel(int index, void *context) {
launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_accel_app_get_info());
}
static void prv_select_button(int index, void *context) {
launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_button_app_get_info());
}
static void prv_sele... |
x SPI operations
//! (such as piecemeal reads or writes). Assertion and deassertion of SCS
//! is up to the caller. Asserts in the code will help to ensure that the
//! API is used correctly.
//
void spi_ll_slave_acquire(const SPISlavePort *slave) {
PBL_ASSERTN(slave->slave_state->initialized);
PBL_ASSERTN(slave... | PBL_ASSERTN(slave->slave_state->initialized) | ;
PBL_ASSERTN(slave->slave_state->acquired);
for (size_t elem = 0; elem < num_sg; ++elem) {
const SPIScatterGather *sg = &sc_info[elem];
spi_ll_slave_burst_read_write(slave, sg->sg_out, sg->sg_in, sg->sg_len);
}
}
static bool prv_dma_irq_handler(DMARequest *request, void *context) {
const SPISlavePort ... |
*sessions,
HealthIterationDirection direction) {
time_t now = rtc_get_time();
s_health_sessions_count = 0;
s_health_sessions_max = *session_entries;
s_health_sessions = sessions;
s_health_sessions_awake_time = 0;
s_health_sessions_sleep_time = 0;
health_... | ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricRestingKCalories, exp_resting_kcalories) | ;
// Start activity tracking. This method assumes it can be called from any task, so we must
// invoke system callbacks to handle its KernelBG callback.
activity_start_tracking(false /*test_mode*/);
fake_system_task_callbacks_invoke_pending();
// Feed in 100 steps/min over 1 min, 1 minute of deep and 1 min... |
tate_get_graphics_context());
}
click_manager_reset(app_state_get_click_manager());
} else if (window) {
// Do not call 'disappear' handler on window displaced by modal window
window_set_on_screen(window, false, false);
}
}
static void prv_app_button_down_handler(PebbleEvent *e, void *context) {
... | window_stack_unlock_push(app_window_stack) | ;
}
// Get the app_id for the current app or worker
// @return INSTALL_ID_INVALID if unsuccessful
AppInstallId app_get_app_id(void) {
// Only support from app or workers
PebbleTask task = pebble_task_get_current();
if ((task != PebbleTask_App) && (task != PebbleTask_Worker)) {
APP_LOG(APP_LOG_LEVEL_ERROR, "O... |
.h"
#include "stubs_pbl_malloc.h"
#include "stubs_pebble_tasks.h"
#include "stubs_print.h"
#include "stubs_prompt.h"
#include "stubs_serial.h"
#include "stubs_sleep.h"
#include "stubs_syscall_internal.h"
#include "stubs_syscalls.h"
#include "stubs_system_reset.h"
#include "stubs_task_watchdog.h"
#include "stubs_ui_wind... | {
const GTextLayoutCacheRef layout_cache = (GTextLayoutCacheRef const)layout;
int steps_x = ctx.dest_bitmap.bounds.size.w / ctx.draw_state.clip_box.size.w;
int steps_y = ctx.dest_bitmap.bounds.size.h / ctx.draw_state.clip_box.size.h;
int text_idx = 0;
for (int sx = -((steps_x - 1) / 2) ; sx <= steps_x / 2; ... |
void test_graphics_draw_text_flow__flow_no_paging(void) {
TextLayoutExtended layout = {
.flow_data = {
.perimeter.impl = &(GPerimeter){.callback=perimeter_for_display_round},
.perimeter.inset = 8,
},
};
render_steps(&layout, RenderMoveTextBox, DELTA, DISP_ROWS, NULL);
cl_check(gbitmap_pbi_... |
);
cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown);
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[1]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizers[2]->state, RecognizerState_Possible);
cl_assert_equal_i(recognizer... | cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered) | |
true);
cl_assert_equal_i(windows[1][0]->is_click_configured, false);
cl_assert_equal_p(s_last_click_configured_window, windows[3][1]);
for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) {
for (int i = 0; i < num_windows_per_stack; i++) {
window_stack_remove(windows[idx][i], fal... | (windows[3][0]->on_screen, false) | ;
cl_assert_equal_i(windows[3][0]->is_click_configured, false);
cl_assert_equal_i(windows[2][1]->on_screen, false);
cl_assert_equal_i(windows[2][1]->is_click_configured, false);
cl_assert_equal_p(s_last_click_configured_window, windows[3][0]);
// Add priority 1 opaque window 0
cl_assert(NumModalPriorities ... |
/*
* 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... | (AccessoryBaud115200) | |
id = AttributeIdTitle, .cstring = "test 2" }}
}
};
static void prv_insert_default_reminders(void) {
// add all four explicitly out of order
cl_assert_equal_i(S_SUCCESS, reminder_db_insert_item(&item4));
cl_assert_equal_i(S_SUCCESS, reminder_db_insert_item(&item2));
cl_assert_equal_i(S_SUCCESS, reminder_db_... | (reminder_db_get_len((uint8_t *)&item3.header.id, sizeof(Uuid)) == 0) | ;
}
cl_assert(S_NO_MORE_ITEMS == reminder_db_next_item_header(&temp));
}
void test_reminder_db__size_test(void) {
prv_insert_default_reminders();
cl_assert(sizeof(SerializedTimelineItemHeader) == reminder_db_get_len((uint8_t*) &item1.header.id, sizeof(TimelineItemId)));
cl_assert(sizeof(SerializedTimeline... |
/*
* 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(data->test, TEST_PATTERN) | ;
if (data->last_touch_event) {
*data->last_touch_event = *touch_event;
}
if (data->handled) {
*data->handled = true;
}
if(data->new_state && (*data->new_state != RecognizerState_Possible)) {
cl_assert(data->updated);
cl_assert_equal_p(*data->updated, false);
*data->updated = true;
rec... |
er) {
if (layer) {
return layer->window;
}
return NULL;
}
void layer_remove_from_parent(Layer *child) {
if (!child || child->parent == NULL) {
return;
}
if (child->parent->window) {
window_schedule_render(child->parent->window);
}
Layer *node = child->parent->first_child;
if (node == chil... | if (!layer->has_data) {
PBL_LOG(LOG_LEVEL_ERROR, "Layer was not allocated with a data region.");
return NULL;
} | |
icense for the specific language governing permissions and
* limitations under the License.
*/
#include "ice40lp.h"
#include "board/board.h"
#include "drivers/gpio.h"
#include "drivers/spi.h"
#include "drivers/pmic.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/delay.h"
#include "stm32f4... | {
// The display requires us to wait 1ms between each power rail coming up. The PMIC
// initialization brings up the 3.2V rail (VLCD on the display, LD02 on the PMIC) for us, but
// we still need to wait before turning on the subsequent rails.
delay_ms(2);
PBL_LOG(LOG_LEVEL_DEBUG, "Enabling 6v6 (Display VDDC... |
void display_power_disable(void) {
PBL_LOG(LOG_LEVEL_DEBUG, "Disabling 4v5 (Display VDDP)");
set_4V5_power_state(false);
delay_ms(2);
PBL_LOG(LOG_LEVEL_DEBUG, "Disabling 6v6 (Display VDDC)");
set_6V6_power_state(false);
delay_ms(2);
}
//!
//! Write a single byte synchronously to the display. Use this
... |
, 512, -104},
{ -1392, 472, -176},
{ -1272, 456, -160},
{ -1152, 536, -128},
{ -1120, 648, -56},
{ -936, 584, -136},
{ -1352, 800, -8},
{ -848, 504, -136},
{ -1184, 552, -144},
{ -1448, 480, -72},
{ -1712, 400, 24},
// 44 seconds
{ -1536, 200, 56},
{ -1392, 88, 56},
... | // 49 seconds
{ -224, 1712, 296},
{ -336, 1792, 304},
{ -192, 1536, 96},
{ -48, 1328, -104},
{ -80, 1008, -80},
{ -120, 760, -56},
{ -56, 656, -120},
{ -88, 536, -88},
{ -80, 400, -56},
{ -120, 336, -72},
{ -440, 304, -72},
{ -1136, 712, 192},
{ -1216, 272, 40},
... |
{ -1384, -56, 80},
{ -1216, 32, -208},
{ -1416, 200, -336},
{ -1488, -16, -248},
{ -1152, -232, -128},
{ -1008, 32, -288},
{ -1016, 120, -288},
{ -1088, 272, -312},
{ -1120, 200, -288},
{ -1280, 360, -392},
{ -1536, 336, -184},
// 52 seconds
{ -1304, 768, -384},
... |
nd_minute_data) only from the KernelBG task, so no
// need for a lock.
bool success = shared_circular_buffer_write(&s_alg_state->minute_data_cbuf, (uint8_t *)minute_rec,
sizeof(*minute_rec), false /*advance_slackers*/);
if (!success) {
// Although unlikely, we cou... | if (!activity_sessions_prv_is_sleep_activity(session->type)) {
ACTIVITY_LOG_DEBUG("Not a sleep session");
continue;
} |
// Skip if still ongoing
if (session->ongoing) {
ACTIVITY_LOG_DEBUG("Still ongoing");
continue;
}
// Skip if already labeled as a nap session
if ((session->type == ActivitySessionType_Nap)
|| (session->type == ActivitySessionType_RestfulNap)) {
if (session->type == Activ... |
736, -248},
{ 1104, 504, -192},
{ 1328, 424, -192},
{ 1456, 296, -136},
{ 1096, 176, -88},
{ 816, 168, -160},
{ 776, 112, -168},
{ 856, 152, -192},
{ 920, 144, -248},
{ 904, 104, -248},
{ 984, 96, -288},
{ 744, -64, -344},
{ 824, -16, -200},
{ 664, 24, -320},
{ 9... | { 528, -144, -368},
{ 648, -184, -424},
{ 1272, 88, -496},
// 23 seconds
{ 1784, 168, -520},
{ 1832, 184, -424},
{ 1328, 568, -496},
{ 896, 376, -216},
{ 1160, 416, -384},
{ 1088, 536, -344},
{ 928, 664, -464},
{ 824, 720, -632},
{ 912, 800, -600},
{ 1032, 624, -4... | |
/*
* 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... | {
TimelineItem pin;
if (S_SUCCESS != pin_db_get(&reminder->header.parent_id, &pin)) {
return reminder->header.timestamp;
}
timeline_item_free_allocated_buffer(&pin);
return pin.header.timestamp;
} | |
,
// 12 seconds
{ -1672, -40, -328},
{ -1808, 152, -296},
{ -1856, 72, -232},
{ -1872, 272, -120},
{ -1784, 360, -80},
{ -1680, 472, -128},
{ -1664, 464, -96},
{ -1528, 352, -64},
{ -1184, 784, -328},
{ -976, 536, 0},
{ -960, 680, -8},
{ -1032, 872, 0},
{ -888, 68... | { -992, 152, -40},
{ -1256, 280, 88},
{ -1592, 648, -184},
{ -1704, 600, 144},
{ -1560, 656, 128},
{ -1536, 552, 200},
{ -1536, 744, -296},
{ -1184, 760, -80},
{ -1592, 1160, -744},
{ -1104, 1296, -576},
{ -1200, 896, -536},
{ -1472, 648, -360},
{ -1560, 544, -320},
... |
{ -1928, 608, 48},
{ -1800, 176, -136},
{ -1704, 16, 32},
// 20 seconds
{ -1648, -40, 40},
{ -1616, 8, 0},
{ -1568, 96, 56},
{ -1520, 240, 160},
{ -1400, 80, 72},
{ -1376, -112, 400},
{ -1112, -488, 232},
{ -976, -344, -32},
{ -832, -112, -656},
{ -1192, -112, -4... |
/*
* 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... | (af_config->gpio, &init) | ;
GPIO_WriteBit(af_config->gpio, af_config->gpio_pin,
asserted? Bit_SET : Bit_RESET);
gpio_release(af_config->gpio);
}
void gpio_input_init(const InputConfig *input_config) {
if (input_config->gpio == NULL) {
return;
}
gpio_input_init_pull_up_down(input_config, GPIO_PuPd_NOPULL);
}
void... |
////
#include "fake_app_timer.h"
#include "fake_pebble_tasks.h"
// Structures and Externs
////////////////////////////////////
typedef struct PACKED {
AppMessageCmd command:8;
uint8_t transaction_id;
union PACKED {
struct PACKED {
Uuid uuid;
Dictionary dictionary; //!< Variable length!
} push... | (context, &s_context) | ;
prv_assert_dict_equal(failed, &s_expected_iter);
s_failure_result = reason;
// When the outbox failed callback is called, the outbox should be in the
// ACCEPTING state again.
cl_assert_equal_b(app_message_is_accepting_outbound(), true);
}
static void prv_in_received_callback(DictionaryIterator *received,... |
y_update, 0);
cl_assert_equal_i(s_count_animation_create, 0);
// Now the app has rendered something and we should actually update the display.
compositor_app_render_ready();
cl_assert_equal_i(s_count_display_update, 1);
}
void test_compositor__app_not_ready_modal_push_pop(void) {
// If a modal window is pop... | (s_count_animation_schedule, 2) | |
= prv_system_test_receiver_cleanup,
};
// Tests
///////////////////////////////////////////////////////////
void test_session_receive_router__initialize(void) {
s_session = comm_session_open(s_transport, &s_transport_implementation,
TransportDestinationSystem);
memset(s_protocol_c... | comm_session_open(s_transport, &s_transport_implementation,
TransportDestinationApp) | ;
// Length: 1, Endpoint ID: PUBLIC_TEST_ENDPOINT_ID, Payload: 0xaa
RECEIVE(0x00, 0x01, PRIVATE_TEST_ENDPOINT_ID >> 8, PRIVATE_TEST_ENDPOINT_ID & 0xff, 0xaa);
cl_assert_equal_i(s_prepare_count, 0);
assert_meta_response_sent(MetaResponseCodeDisallowed);
// Length: 1, Endpoint ID: PUBLIC_TEST_ENDPOINT_ID, Pay... |
6, 200, -1064},
{ 552, 240, -1024},
{ 552, -16, -864},
{ 488, -152, -824},
{ 408, -184, -712},
{ -216, -96, -688},
{ -24, -216, -536},
{ 232, -248, -504},
{ -176, -456, -488},
{ 96, -304, -496},
{ 304, -376, -688},
{ 344, -360, -744},
{ 1392, -368, -904},
{ -1528, 184... | { 1240, 328, -256},
{ 1072, 368, -232},
{ 1008, 320, -224},
{ 1120, 344, -192},
// 53 seconds
{ 1248, 296, -128},
{ 1152, 256, -88},
{ 944, 208, -32},
{ 808, 224, -56},
{ 792, 208, -48},
{ 776, 176, -8},
{ 824, 152, 0},
{ 840, 120, -24},
{ 936, 152, -32},
{ 10... |
{ 1024, 232, -80},
{ 880, 240, -72},
{ 824, 176, -32},
{ 840, 192, -16},
{ 904, 192, 8},
{ 888, 160, 56},
{ 984, 192, 32},
{ 1048, 216, 0},
{ 952, 160, -32},
{ 1136, 136, -144},
{ 1120, 104, -120},
{ 1040, 40, -176},
{ 944, 64, -248},
// 56 seconds
{ 1128, 12... |
ger_event_loop_upkeep();
cl_assert_equal_i(modal_manager_get_properties(),
ModalProperty_Exists | ModalProperty_CompositorTransitions |
ModalProperty_RenderRequested);
// Disable all modals
modal_manager_set_min_priority(ModalPriorityMax);
modal_manager_event_loop_upkee... | (window2->on_screen, false) | ;
// Switch to app happens via the compositor
compositor_transition(NULL);
// Call the upkeep function so the change in state is handled
modal_manager_event_loop_upkeep();
// The app is unobstructed, it should not be idle
cl_assert_equal_b(s_app_idle, false);
// Assert that the window pushed onto the a... |
bbleProcessMd *timeline_get_app_info(void) {
return NULL;
}
void launcher_task_add_callback(void *data) {
}
void timeline_pin_window_push_modal(TimelineItem *item) {
}
PebblePhoneCaller* phone_call_util_create_caller(const char *number, const char *name) {
return NULL;
}
void ancs_perform_action(uint32_t notifi... | attribute_get_string(&item_temp.attr_list, AttributeIdTitle, "none") | ,
"title");
cl_assert_equal_s(attribute_get_string(&item_temp.attr_list, AttributeIdSubtitle, "none"),
"subtitle");
cl_assert(timeline_remove(&id));
cl_assert(!timeline_exists(&id));
cl_assert_equal_i(pin_db_get(&id, &item_temp), -9);
}
|
ndex) {
return ((state_index == APP_STATE_DRAW_AA_SW) || (state_index == APP_STATE_DRAW_NON_AA_SW));
}
static void update_state(AppData *data, AppStateIndex state_index) {
data->state_index = state_index;
data->fill = ((data->state_index == APP_STATE_FILL_NON_AA) ||
(data->state_index == APP_STAT... | data->square.origin.x += (data->square_velocity_x * PIXEL_SPEED_PER_FRAME);
if (data->square.origin.x < 0 ||
data->square.origin.x + data->square.size.w > data->window.layer.bounds.size.w) {
data->square_velocity_x = data->square_velocity_x * -1;
}
data->square.origin.y += (da... |
data->rectr.origin.y += (data->rectr_velocity_y * PIXEL_SPEED_PER_FRAME * 4);
if (data->rectr.origin.y < 0 ||
data->rectr.origin.y + data->rectr.size.h > data->window.layer.bounds.size.h) {
data->rectr_velocity_y = data->rectr_velocity_y * -1;
}
} else if (shape == CIRCLE) {
... |
ystem_task_cb(void *unused) {
PutBytesPendingJobs *put_jobs = &s_pb_state.pb_pending_jobs;
prv_lock_pb_job_state();
uint8_t num_put_jobs = put_jobs->num_ops_pending;
uint8_t read_idx = put_jobs->read_idx;
uint32_t initial_remaining_bytes = s_pb_state.remaining_bytes;
prv_unlock_pb_job_state();
if (num_pu... | PBL_LOG(LOG_LEVEL_ERROR, "Failed to acquire the put-bytes semaphore") | ;
return;
}
if (s_pb_state.current_command == PutBytesIdle) {
PBL_LOG(LOG_LEVEL_DEBUG, "Attempted to cancel put_bytes while idle, %d",
s_pb_state.current_command);
} else if (s_pb_state.type == ObjectWatchApp ||
s_pb_state.type == ObjectAppResources ||
s_pb_state.typ... |
n %d val %s\n", i, val);
set_and_verify(&file, key, key_len, val, val_len);
}
// Finally, try to set a key to a large value. This should succeed with
// plenty of room to spare if our space tracking is functioning correctly.
uint8_t big_val[SETTINGS_VAL_MAX_LEN] = {};
set_and_verify(&file, key, key_len, ... | printf("\nTesting if we can set keys & values of zero length...\n") | ;
SettingsFile file;
cl_must_pass(settings_file_open(&file, "test_file_zero_length", 4096));
uint8_t key[4];
int key_len = sizeof(key) - 1;
memcpy(key, "key", sizeof(key));
uint8_t val[4];
int val_len = sizeof(val) - 1;
memcpy(val, "val", sizeof(val));
set_and_verify(&file, key, key_len, val, val_l... |
n *sessions, int num_sessions,
KAlgTestActivitySession *exp_session,
char *file, int line) {
for (int i = 0; i < num_sessions; i++) {
if (sessions[i].activity == exp_session->activity
&& sessions[i].start_utc == exp_session->s... | {
return;
} | |
IO_Mode_AN) {
pin_cfg_mask |= (0x1 << pin);
}
mode >>= 2;
}
dbgserial_putstr_fmt(buf, sizeof(buf), "Non Analog P%s cfg: 0x%"PRIx16,
name, (int)pin_cfg_mask);
name[0]++;
}
}
#endif /* DUMP_GPIO_CFG_STATE */
int main(void) {
gpio_init_all();
#if defined(MICRO_FAMILY_STM32F4) &... | battery_init() | ;
vibe_init();
#if CAPABILITY_HAS_ACCESSORY_CONNECTOR
accessory_init();
#endif
flash_init();
flash_sleep_when_idle(true);
flash_enable_write_protection();
flash_prf_set_protection(true);
#if CAPABILITY_HAS_PMIC
pmic_init();
#endif // CAPABILITY_HAS_PMIC
#if CAPABILITY_HAS_MICROPHONE
mic_init(MIC);
#... |
p_session = session;
} else if (session->type == ActivitySessionType_RestfulSleep) {
PBL_LOG(LOG_LEVEL_DEBUG, "Found restful nap - start_utc: %d, start_min: %u, len: %"PRIu16" ",
(int)session->start_utc, start_minute, session->length_min);
session->type = ActivitySessionType_RestfulNap;
... | if (consumed_samples != 0) {
s_alg_state->rate_steps = new_steps;
s_alg_state->rate_elapsed_ms = (consumed_samples * MS_PER_SECOND) / KALG_SAMPLE_HZ;
s_alg_state->rate_computed_time_s = timestamp_ms / MS_PER_SECOND;
} | |
= NULL;
cl_assert_equal_i(timeline_init(&head), S_SUCCESS);
const time_t time_21_00_march_1_pst = 1425272400;
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture,
time_21_00_march_1_pst), S_SUCCESS);
const time_t midnight_march_3_pst... | cl_assert(state.node->all_day) | |
/*
* 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 (!handle) {
return NULL;
}
// Default to state for the current task
if (!state) {
state = prv_animation_state_get(PebbleTask_Current);
}
// Look for this animation by id. It could either be in the unscheduled or scheduled list
ListNode* node = list_find(state->unscheduled_head, prv_handle_l... |
// -------------------------------------------------------------------------------------------
// Find animation by parent and child idx
typedef struct {
AnimationPrivate *parent;
uint8_t child_idx;
} ParentChildInfo;
static bool prv_parent_list_filter(ListNode* node, void* data) {
AnimationPrivate* animation... |
bi")));
}
void test_graphics_draw_text_flow__max_used_size_draw_text_doom(void) {
cl_assert(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},
.perimet... | (0, second_page_end_y) | , GPoint(180, second_page_end_y));
ctx.draw_state.drawing_box.origin.x += 180;
ctx.draw_state.clip_box.origin.x += 180;
}
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
}
void test_graphics_draw_text_flow__no_infinite_loop2(void) {
// replicates the bug described in PBL-29267 noticed in the not... |
ics_context_get_drawing_state(GContext *ctx) {
return (GDrawState) { };
}
bool graphics_release_frame_buffer(GContext *ctx, GBitmap *buffer) {
return false;
}
void graphics_context_set_drawing_state(GContext *ctx, GDrawState draw_state) {
}
void window_schedule_render(struct Window *window) {
}
TimerID animatio... | evt.callback.callback(evt.callback.data) | ;
}
// --------------------------------------------------------------------------------------
// Advance to the given time, firing all timers that are scheduled along the way
static void prv_advance_to_ms_with_timers(uint64_t dst_time) {
uint64_t now = prv_now_ms();
while (now < dst_time) {
TimerID sys_time... |
*data) {
bool failed = false;
if (!prv_run_test_step(BTLETestStep_BTLEStop, data)) {
failed = true;
goto cleanup;
} else if (data->current_test == BTLETestType_RX) {
snprintf(data->status_string, STATUS_STRING_LENGTH,
"Packets Received: %"PRIu16, data->rx_test_received_packets);
app_w... | app_window_stack_push(&data->payload_window, true) | ;
}
//--------------------------------------------------------------------------------
// Status Window
//--------------------------------------------------------------------------------
// Status window is just a simple window which will display to the user whatever
// data->status_string has been set to.
static voi... |
lf test failed for axis %c: %d < %d",
accel_test_axis[i].axis_name, axis_delta, accel_test_axis[i].pass_threshold);
pass = false;
}
}
prv_run_command(BMI160_CMD_SOFTRESET);
psleep(50);
bmi160_enable_spi_mode();
return pass;
}
bool gyro_run_selftest(void) {
prv_update_accel_interr... | {
sample_rate = BMI160SampleRate_400_HZ;
} | else if (BMI160SampleRate_800_HZ <= interval_us) {
sample_rate = BMI160SampleRate_800_HZ;
} else { // any interval < min supported must saturate to 1600Hz
sample_rate = BMI160SampleRate_1600_HZ;
}
return sample_rate;
}
static void prv_configure_operating_mode(void) {
BMI160SampleRate interval_us = prv... |
{ 712, 888, -160},
{ 616, 784, -216},
{ 584, 896, -160},
{ 536, 736, -184},
{ 560, 864, -296},
{ 656, 696, -336},
{ 568, 808, -328},
{ 560, 960, -280},
{ 520, 1048, -416},
{ 520, 760, -464},
{ 464, 712, -544},
{ 496, 472, -680},
{ 416, 184, -688},
{ 432, 128, -688... |
{ 368, 584, -264},
{ 312, 632, -328},
{ 328, 648, -424},
// 74 seconds
{ 296, 392, -272},
{ 280, 408, -352},
{ 208, 432, -288},
{ 232, 544, -192},
{ 640, 672, -288},
{ 848, 712, -520},
{ 952, 648, -536},
{ 1056, 608, -520},
{ 1112, 584, -512},
{ 1128, 384, -464},... | |
ST_STATUS_STOPPED = 2,
FLASH_TEST_STATUS_PASSED = 3,
FLASH_TEST_STATUS_FAILED = 4,
};
#define STATUS_TEXT_SIZE 18
struct FlashTestData {
Window window;
SimpleMenuLayer simple_menu_layer;
SimpleMenuSection menu_sections[1];
SimpleMenuItem menu_items[FLASH_TEST_CASE_NUM_MENU_ITEMS];
Window test_window;
T... | (msg_text_layer, &GRect(0, 64, window->layer.bounds.size.w, 40)) | ;
if (data->test_case >= FLASH_TEST_CASE_RUN_SWITCH_MODE_ASYNC) {
text_layer_set_text(msg_text_layer, "Press Back To Exit");
}
else {
text_layer_set_text(msg_text_layer, "Press Up to Exit, Down to Stop Test");
}
text_layer_set_text_alignment(msg_text_layer, GTextAlignmentCenter);
text_layer_set_back... |
-----------------
// Sample captured: 2015-10-02 15:19:17 local
AccelRawData *activity_sample_walk_100_pbl_25477_18(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_25477_18
//> TEST_EXPECTED 100
//> TEST_EXPECTED_MIN 50
//> TEST_EXPECTED_MAX 120
//>... | { 1048, 352, -192},
{ 992, 384, -200},
{ 1216, 1432, -936},
{ 896, -328, -152},
// 5 seconds
{ 952, -312, 312},
{ 792, -320, -32},
{ 824, 264, -296},
{ 912, 216, -208},
{ 1040, 120, -80},
{ 1096, 192, -40},
{ 1416, 216, -264},
{ 1032, 104, -192},
{ 848, -8, -264},... | |
/* Set system clock */
cm_sys_clk_set(sysclk_XTAL16M);
// Set the desired sleep mode.
// It's important to do this *AFTER* setting up the system clock. This is because cm_sys_clk_set()
// has the potential to block this task while waiting for the xtal to settle. When using deep
// sleep, you'd fall into an ... | memcpy( ( void * ) _pvHeapStart, ucExpectedInterruptStackValues, sizeof( ucExpectedInterruptStackValues ) ) | ;
#endif
}
|
/*
* 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... | (title, data) | , i18n_get(subtitle, data), NULL);
}
static void prv_selection_changed_cb(SettingsCallbacks *context, uint16_t new_row,
uint16_t old_row) {
vibes_cancel();
VibeScore *score;
switch (new_row) {
case VibeSettingsRow_Notifications: {
score = vibe_client_get_score(VibeC... |
/*
* 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... | emx_resources_read(1, id_3, 0, (uint8_t *)&buf, 1) | == 4);
ASSERT(buf == 3);
ASSERT(s_read_3_called == 2);
buf = 0;
ASSERT(emx_resources_read(1, id_1, 0, (uint8_t *)&buf, 1) == 4);
ASSERT(buf == 1);
ASSERT(s_read_1_called == 2);
// add 4
uint32_t id_4 = emx_resources_register_custom(custom_res_read_4, custom_res_size_4);
ASSERT(emx_resources_get_size... |
set_stroke_color(ctx, GColorWhite);
graphics_line_draw_precise_stroked_aa(ctx, center, watch_hand_end, hand->thickness + 2);
}
graphics_context_set_stroke_color(ctx, hand->color);
graphics_line_draw_precise_stroked_aa(ctx, center, watch_hand_end, hand->thickness);
}
static void prv_draw_watch_hand_pointed(GC... | if (clock_model->text.location == CLOCK_TEXT_LOCATION_BOTTOM) {
const GPoint point = (GPoint) { 90, 140 };
prv_graphics_draw_centered_text(ctx, &bounds->size, &point, data->text_font,
clock_model->text.color, clock_model->text.buffer);
} else if (clock_model->text.location ... |
// Draw the clocks.
for (uint32_t i = 0; i < clock_model->num_non_local_clocks; ++i) {
prv_draw_non_local_clock(ctx, &clock_model->non_local_clock[i]);
}
prv_draw_clock_face(ctx, &clock_model->local_clock);
}
static void prv_window_load(Window *window) {
MultiWatchData *data = app_state_get_user_data()... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (APP_ICON_NAME_UPDATED, app_id, NULL, NULL, NULL) | ;
}
#if ALLOW_SET_ICON
static void set_icon(const CustomizableAppType app_type, const uint16_t row_size_bytes,
const uint16_t info_flags, const GRect bounds,
const uint8_t image_data[], const uint16_t image_data_length) {
AppCustomizeInfo *info = &s_info[app_type];
const uint16_t desired_size = row_size_b... |
/*
* 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... | {
num_bytes = prv_check_resource_bounds(entry, offset, num_bytes);
if (!num_bytes) {
return 0;
}
return entry->impl->read(entry, offset, data, num_bytes);
} | |
ersistent_storage__get_ble_by_addr(void) {
bool ret;
// Output variables
SMIdentityResolvingKey irk_out;
// Store a pairing
SMPairingInfo pairing = (SMPairingInfo) {
.irk = (SMIdentityResolvingKey) {
.data = {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0... | bt_persistent_storage_get_ble_pairing_by_id(id, &irk_out, &device_out, NULL) | ;
cl_assert(!ret);
}
void test_bluetooth_persistent_storage__analytics_external_collect_ble_pairing_info(void) {
// No pairings yet
analytics_external_collect_ble_pairing_info();
cl_assert_equal_i(s_analytics_ble_pairings_count, 0);
// Store a pairing
SMPairingInfo pairing = (SMPairingInfo) {
.irk = ... |
_horizontal_line_dotted(&ctx, GPoint(101, 75), 5);
// T facing left - odd vert, even horiz
graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 71), 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(132, 76), 5);
// T facing right - lined up
graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 90), 10)... | graphics_draw_horizontal_line_dotted(&ctx, GPoint(67, 96), 5) | ;
// T facing left - even vert, even horiz
graphics_draw_vertical_line_dotted(&ctx, GPoint(100, 90), 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(100, 95), 5);
// T facing left - odd vert, odd horiz
graphics_draw_vertical_line_dotted(&ctx, GPoint(131, 91), 10);
graphics_draw_horizontal_line_dott... |
/*
* 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... | { 0, 0x78, 88, 147, 0},
{ 0, 0x78, 55, 147, 0},
{ 0, 0x78, 443, 148, 0},
{ 16, 0x67, 1882, 151, 0},
{ 0, 0x67, 2178, 146, 0},
// 30: Local time: 06:41:00 PM
{ 0, 0x67, 1356, 148, 0},
{ 15, 0x74, 4290, 148, 0},
{ 7, 0x52, 4157, 149, 0},
{ 49, 0x42, 3417, 146, 0},
{ 58, 0x42, 3... |
{ 0, 0x8b, 0, 155, 0},
{ 0, 0x8b, 0, 155, 0},
{ 0, 0x8b, 0, 155, 0},
{ 0, 0x8b, 0, 155, 0},
{ 0, 0x8b, 96, 156, 0},
{ 0, 0x8b, 0, 157, 0},
{ 0, 0x8b, 0, 157, 0},
{ 0, 0x8b, 0, 155, 0},
{ 0, 0x8b, 0, 155, 0},
{ 0, 0x8b, 0, 152, 0},
{ 0, 0x8b, 0, 155, 0},
{ 0, 0x8b, 0, 155... |
b = prv_create_test_animation();
animation_set_duration(b, duration_b);
animation_set_delay(b, delay_b);
Animation *c = prv_create_test_animation();
animation_set_duration(c, duration_c);
animation_set_delay(c, delay_c);
Animation *d = prv_create_test_animation();
animation_set_duration(d, duration_d);
... | animation_set_duration(c, duration_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... | app_window_stack_push(window, true) | ;
}
static void prv_click_config_proivider(void *context) {
window_single_click_subscribe(BUTTON_ID_SELECT, prv_handle_click);
}
static void prv_window_unload(Window *window) {
StatusBarDemoWindow *demo_window = (StatusBarDemoWindow *)window;
status_bar_layer_deinit(&demo_window->status_bar);
text_layer_dein... |
///////////////////////////////////////////////////
#define ANCS_CALL_UID 1
#define ANCS_UNUSED_UID 2
// Whenever we check the last phone ui event, we reset s_last_phone_ui_event so we don't end up
// checking the same event twice and assume everything went well
#define ASSERT_LAST_EVENT(event) \
cl_assert_equal_i(... | (PhoneEventType_Invalid) | ;
prv_put_incoming_call_event(PhoneCallSource_ANCS_Legacy, true);
ASSERT_LAST_EVENT(PhoneEventType_Incoming);
// Make sure we don't process incoming calls while we're in a call
prv_put_incoming_call_event(PhoneCallSource_ANCS_Legacy, true);
ASSERT_LAST_EVENT(PhoneEventType_Invalid);
// Losing ANCS connec... |
fixed_status_bar(window->parent_window_stack)) {
frame.origin.x = 0;
}
status_bar_layer_render(ctx, &frame, &config);
ctx->draw_state.clip_box = saved_clip_box;
}
}
void window_render(Window *window, GContext *ctx) {
PBL_ASSERTN(window);
if (window->on_screen == false) {
window->is_rende... | prv_get_current_click_manager() | , window);
window->is_click_configured = true;
}
static void prv_check_is_in_click_config_provider(Window *window, char *type) {
PBL_ASSERT(window->in_click_config_provider,
"Click %s must be set from click config provider (Window %p)", type, window);
}
void window_setup_click_config_provider(Window *window... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
case PEBBLE_BT_PAIRING_EVENT:
if (e->bluetooth.pair.type == PebbleBluetoothPairEventTypePairingComplete) {
prv_resume_reconnect_if_needed();
} else {
prv_pause_reconnect_if_needed();
}
bluetooth_pairing_ui_handle_event(&e->bluetooth.pair);
return;
default:
return;
} | |
/////////
// Public API
void launcher_app_glance_service_draw_glance_for_app_node(LauncherAppGlanceService *service,
GContext *ctx, const GRect *frame,
bool is_highlighted, AppMenuNode *node) {
const b... | event_service_client_unsubscribe(&service->glance_event_info) | ;
prv_glance_cache_deinit(service);
prv_reset_slice_expiration_timer(service);
kino_reel_destroy(service->generic_glance_icon);
}
|
---
// Get the current step count metric
static int32_t prv_get_step_count(void) {
int32_t steps;
activity_get_metric(ActivityMetricStepCount, 1, &steps);
return steps;
}
// ------------------------------------------------------------------------------------------------
// Creates a notification to notify the us... | if ((tier == PercentTier_BelowAverage || tier == PercentTier_Fail) && above_fail_threshold) {
// we don't want to show a negative insights if you've walked 10000 or more steps
tier = PercentTier_OnAverage;
}
// Enough to fit any filled out format string above and i18n variants
const int max_notif_lengt... |
// ------------------------------------------------------------------------------------------------
// Creates a notification to notify the user of the sleep summary
static void prv_push_sleep_summary_notification(time_t notif_time, int32_t sleep_total_seconds,
int32_t... |
/*
* 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_workout_data.s_workout_mutex) | |
ccelRawData captured_data[k_raw_samples];
prv_uncompress_captured_data(captured_data, k_raw_samples);
cl_assert_equal_m(raw_data, captured_data, k_raw_samples * sizeof(AccelRawData));
}
}
// ---------------------------------------------------------------------------------------
// Test getting the sleep ses... | time_t oldest_to_fetch = rtc_get_time() - (ALG_MINUTES_PER_FILE_RECORD * SECONDS_PER_MINUTE);
for (int i = 0; i < ALG_MINUTES_PER_FILE_RECORD; i++) {
// Ask for the last ALG_MINUTES_PER_RECORD minutes of data
num_records = ALG_MINUTES_PER_FILE_RECORD;
time_t start_time = oldest_to_fetch + (i * SECONDS_... | |
ew_attr = kernel_zalloc(sizeof(SmartstrapAttributeInternal));
if (!new_attr) {
PBL_LOG(LOG_LEVEL_ERROR, "Failed to allocate attribute");
return false;
}
*new_attr = (SmartstrapAttributeInternal) {
.service_id = service_id,
.attribute_id = attribute_id,
.mbuf = MBUF_EMPTY
};
list_init(&new... | if (!prv_start_transaction(attr, AttributeTransactionRead)) {
return SmartstrapResultBusy;
} |
} else {
// handle write request
if (!write_length || (write_length > mbuf_get_length(&attr->mbuf))) {
prv_cancel_transaction(attr);
return SmartstrapResultInvalidArgs;
} else if (!prv_start_transaction(attr, AttributeTransactionEndWrite)) {
// they didn't call smartstrap_begin_write fi... |
}
// This will read the flag status register and check it for the SectorLockStatus flag
void prv_check_protection_flag() {
uint8_t flag_status_register = prv_flash_get_register(FLASH_CMD_READ_FLAG_STATUS_REG);
// assert if we found the flag to be enabled
PBL_ASSERTN(!(flag_status_register & N25QFlagStatusBit_Sec... | flash_read_next_byte() | ;
buffer++;
}
} else {
enable_flash_dma_clock();
setup_dma_read(buffer, buffer_size);
do_dma_transfer();
disable_flash_dma_clock();
}
flash_end_cmd();
disable_flash_spi_clock();
power_tracking_stop(PowerSystemFlashRead);
flash_unlock();
}
void flash_write_bytes(const uint8_t* b... |
*****************/
void test_app_install_manager__get_id_invalid_uuid(void) {
const Uuid made_up = {0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17};
cl_assert_equal_i(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&made_up));
cl_asser... | cl_assert_equal_b(false, app_install_is_hidden(tictoc_id)) | ;
cl_assert_equal_b(false, app_install_is_hidden(music_id));
cl_assert_equal_b(true, app_install_is_hidden(sports_id));
cl_assert_equal_b(false, app_install_is_hidden(bg_counter_id));
cl_assert_equal_b(false, app_install_is_hidden(menu_layer_id));
cl_assert_equal_b(false, app_install_is_hidden(CRAZY_ID));
}... |
alyticsMetric metric) {
AnalyticsMetricKind metric_kind = analytics_metric_kind(metric);
if ((metric_kind == ANALYTICS_METRIC_KIND_DEVICE) &&
(heartbeat->kind == ANALYTICS_HEARTBEAT_KIND_DEVICE)) {
return true;
} else if ((metric_kind == ANALYTICS_METRIC_KIND_APP) &&
(heartbeat->kind == ANALYTICS_... | prv_heartbeat_get_location(heartbeat, metric) | ;
return prv_location_get_value(location, analytics_metric_element_type(metric));
}
int64_t analytics_heartbeat_get_array(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric, uint32_t index) {
uint8_t *location = prv_heartbeat_get_array_location(heartbeat, metric, index);
return prv_location_get_value(location... |
8, -264},
{ -504, -848, -264},
{ -504, -848, -272},
{ -504, -848, -272},
{ -504, -848, -272},
{ -504, -840, -272},
{ -504, -840, -272},
{ -504, -848, -264},
{ -504, -848, -272},
{ -504, -840, -264},
{ -504, -848, -272},
{ -504, -848, -264},
{ -512, -848, -272},
{ -504... | { -504, -832, -288},
{ -504, -832, -296},
{ -504, -840, -296},
{ -504, -824, -304},
{ -504, -824, -304},
{ -504, -824, -304},
{ -496, -840, -296},
{ -520, -840, -304},
{ -504, -856, -272},
{ -496, -872, -264},
{ -512, -856, -264},
{ -520, -824, -288},
{ -520, -808, -2... |
{ -496, -792, -352},
{ -488, -824, -320},
{ -480, -872, -320},
{ -480, -880, -288},
{ -480, -840, -304},
{ -480, -832, -312},
{ -488, -832, -304},
{ -488, -848, -320},
// 82 seconds
{ -480, -848, -328},
{ -480, -848, -344},
{ -504, -864, -328},
{ -504, -800, -304},
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.