prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
iodic_timer_trigger(20);
cl_assert_equal_i(battery_get_charge_state().charge_percent, 50);
PBL_LOG(LOG_LEVEL_DEBUG, "▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲");
// Should still update if it goes lower
fake_battery_set_millivolts(lower_mv);
periodic_timer_trigger(20);
cl_assert_equal_i(battery_get_charge_state().charge_per... | (!result.is_plugged) | |
de "stubs_task_watchdog.h"
#include "stubs_app_state.h"
#include "stubs_worker_state.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;
}
int localized_strftime(char* s, size_t maxsize, c... | pbl_snprintf(str, STR_SIZE, "abc %jd%s", 42, "b") | |
nse.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
... | {
// Don't do anything if we're already animating to this position from our current position
int16_t offset;
property_animation_get_to_int16(item_layer->animation, &offset);
if (offset == new_offset) {
return;
}
animation_unschedule(property_animation_get_animation(item_layer->animation));... | |
tion_layer->slide_amin_progress = 0;
selection_layer->selected_cell_idx++;
}
static void prv_slide_settle_impl(struct Animation *animation,
const AnimationProgress distance_normalized) {
SelectionLayer *selection_layer = (SelectionLayer*) animation_get_context(animation);
// Up... | selection_layer->callbacks.complete(selection_layer->callback_context) | |
/*
* 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(strcspn(testbuf, "H"), 0) | ;
}
|
_LOG_LEVEL_INFO, "kill result: %d", result);
}
static void click_config_provider(void *context) {
window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler);
window_single_click_subscribe(BUTTON_ID_UP, up_click_handler);
window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler);
}
static uint... | (text_layer, GColorClear) | ;
text_layer_set_font(text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
layer_add_child(window_layer, text_layer_get_layer(text_layer));
text_layer_set_text(text_layer, "? ? ?");
// Subscribe to mesages published by the worker
app_worker_message_subscribe(steps_event_handler);
// Subscribe to seco... |
prv_reset_ack_timeout(client) | ; // Enable timeout if we don't already have it set
}
client->out.next_data_sn = prv_next_sn(sn);
}
}
// -------------------------------------------------------------------------------------------------
static void prv_send_next_packets(PPoGATTClient *client) {
uint16_t payload_size = 0;
const PPoGATTPa... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (S_SUCCESS != pin_db_get(&reminder->header.parent_id, &pin)) {
return reminder->header.timestamp;
} | |
/*
* 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... | {
uint8_t idx = ((((uint32_t)GPIOx) - AHB1PERIPH_BASE) / 0x0400);
if((idx < MAX_GPIO) && !(s_gpio_clock_count[idx]++)) {
SET_BIT(RCC->AHB1ENR, (0x1 << idx));
}
} | |
= bmp->data_row_infos); // union with .palette
bmp = gbitmap_create_blank(s10, GBitmapFormat4BitPalette);
cl_assert(NULL != bmp);
cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette
bmp = gbitmap_create_blank(s10, GBitmapFormat8BitCircular);
cl_assert(NULL == bmp);
... | (p == gbitmap_get_palette(bmp)) | ;
cl_assert(NULL == gbitmap_create_blank_with_palette(s10, GBitmapFormat8BitCircular, p, true));
cl_assert(NULL == gbitmap_create_blank_with_palette(s180, GBitmapFormat8BitCircular, p, true));
#endif
}
void test_gbitmap_formats__display_framebuffer_bytes(void) {
#ifdef PLATFORM_TINTIN
const size_t expected = 20... |
app_event_loop() | ;
deinit();
}
| |
uint16_t address;
uint16_t value;
uint8_t footer;
} MemoryPacket;
static bool s_callback_scheduled = false;
// Low-level helper functions
////////////////////////////////////////////////////////////////////////////////
static void prv_write_data(const uint8_t *data, size_t len) {
i2c_use(EWD1000->i2c);
PB... | ((uint8_t *)&data, sizeof(data)) | ;
}
#if 0
// TODO: we will use this to verify firmware when upgrading
static uint16_t prv_read_flash(uint16_t address) {
address = htons(address);
MemoryPacket packet = {
.packet_id = PACKET_ID_FLASH_READ,
.address = address,
.value = 0x00,
.footer = RAM_FLASH_FOOTER
};
prv_write_data((uint8_t ... |
if (tint_color.a != 0) {
tint_color.a = (*color).a;
*color = tint_color;
} |
}
T_STATIC void prv_calc_two_row_look_ups(TwoRowLookUp *look_up,
GCompOp compositing_mode,
const GColor8 *palette,
uint8_t num_entries,
GColor tint_color) {
for... | |
red;
recognizer_manager_deregister_recognizer(&manager, r1);
cl_assert_equal_p(manager.triggered, r2);
cl_assert_equal_p(manager.active_layer, &layer_a);
cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered);
cl_assert_equal_i(r2->state, RecognizerState_Started);
cl_assert(!recognize... | cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown) | ;
cl_assert_equal_p(manager.triggered, NULL);
cl_assert_equal_p(manager.active_layer, NULL);
prv_compare_recognizers_processed((int []) { 0, 1 }, 2, &s_recognizers_reset);
cl_assert_equal_i(r[0]->state, RecognizerState_Possible);
cl_assert_equal_i(r[1]->state, RecognizerState_Possible);
r[0]->state = 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... | write_register(RegPwmOut3, brightness) | ;
write_register(RegDataUpdate, 0xaa);
i2c_release(I2C_LED);
s_backlight_off = (brightness == 0);
if (s_backlight_off && s_rgb_current_color == LED_BLACK) {
prv_shutdown(true);
}
}
void led_controller_rgb_set_color(uint32_t rgb_color) {
if ((BOARD_CONFIG_BACKLIGHT.options & ActuatorOptions_IssiI2C... |
const uint8_t *attributes_per_actions) {
attribute_group_init(GROUP_TYPE,
attr_list,
action_group,
buffer,
num_attributes,
num_actions,
attributes_per_actions);... | (LOG_LEVEL_ERROR, "Error deep-copying pin attribute list") | ;
return false;
}
}
if (src_action_group && dest_action_group) {
rv = prv_action_group_copy(dest_action_group, src_action_group,
buffer + attr_list_size, buf_end);
if (!rv) {
PBL_LOG(LOG_LEVEL_ERROR, "Error deep-copying pin action group");
return false;
... |
ory!
fake_pbl_malloc_check_net_allocs();
}
// -----------------------------------------------------------------------------
// Edge cases
void test_gatt_client_discovery__not_connected(void) {
BTDeviceInternal device = prv_dummy_device(1);
cl_assert_equal_i(gatt_client_discovery_discover_all(&device),
... | (watchdog_timer) | ;
// Check whether GATT_Stop_Service_Discovery has been called:
cl_assert_equal_i(stop_count + 1, fake_gatt_is_service_discovery_stop_count());
if (i < GATT_CLIENT_DISCOVERY_MAX_RETRY) {
// Check whether GATT_Start_Service_Discovery has been called, except for the last iteration:
cl_assert_equ... |
/*
* 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 (r == 0 || strncmp(buf, "May", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"b\": %s", buf);
} |
r = strftime(buf, buf_size, "%B", &good_data);
if (r == 0 || strncmp(buf, "May", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"B\": %s", buf);
}
r = strftime(buf, buf_size, "%c", &good_data);
if (r == 0 || strncmp(buf, "Tue May 5 11:04:49 2015", buf_size) != 0) {
APP_LOG(APP_LOG_LEV... |
ctual_color =
gcolor_perform_lookup_using_color_luminance_and_multiply_alpha(
src_color, tint_luminance_lookup_table);
dest[dest_x] = gcolor_alpha_blend(actual_color, dest_color).argb;
break;
}
default:
PBL_LOG(LOG_LEVEL_DEBUG, "OP: %d NYI", (int... | (dest_bitmap, dest_y) | ;
uint8_t *dest = dest_row_info.data;
const int16_t dest_delta_begin_x = MAX(dest_row_info.min_x - dest_rect.origin.x, 0);
const int16_t dest_begin_x = dest_delta_begin_x ? dest_row_info.min_x : dest_rect.origin.x;
const int16_t dest_end_x = MIN(grect_get_max_x(&dest_rect), dest_row_info... |
et_current_app_id() == app_id)) {
// Lookup app, and if installed, launch
if (app_id != INSTALL_ID_INVALID) {
PebbleLaunchAppEventExtended* data =
kernel_malloc_check(sizeof(PebbleLaunchAppEventExtended));
*data = (PebbleLaunchAppEventExtended) {
.common.reason = APP_LAUNCH_WAKEUP,... | MAX(time_difference, WAKEUP_CATCHUP_WINDOW) | ;
}
// timers are in milliseconds, set main callback dispatch for wakeup
// WakeupId is used to save/restore/lookup wakeup events
new_timer_start(s_current_timer_id, (time_difference * 1000), prv_wakeup_dispatcher,
(void*)((intptr_t)s_wakeup_state.current_wakeup_id), 0);
}
}
static void prv... |
iteResponse {
uint8_t opcode;
uint8_t fd;
uint32_t address;
uint32_t length;
} WriteResponse;
typedef struct PACKED CRCResponse {
uint8_t opcode;
uint8_t fd;
uint32_t address;
uint32_t length;
uint32_t crc;
} CRCResponse;
typedef struct PACKED StatResponse {
uint8_t opcode;
uint8_t fd;
uint8_t... | MIN(pulse_fd->transfer_state.bytes_left, max_read_len) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | notification_window_service_init() | ;
app_inbox_service_init();
app_outbox_service_init();
app_message_sender_init();
watchface_init();
timeline_peek_init();
#if CAPABILITY_HAS_HEALTH_TRACKING
// Start activity tracking if enabled
if (activity_prefs_tracking_is_enabled()) {
activity_start_tracking(false /*test_mode*/);
}
#endif
}
voi... |
nt_logging_handler(const HcProtocolMessage *msg) {
switch (msg->command_id) {
case HcMessageID_Logging_LogMsg: {
BinLogMessage_Header *header = (BinLogMessage_Header *)msg->payload;
switch (header->version) {
case BINLOGMSG_VERSION_STRING_V1:
prv_log_string_v1((BinLogMessage_... | (msg->body.level, filename, msg->body.line_number, (const char *)msg->body.string) | ;
}
#endif // PBL_LOGS_HASHED
|
= PebbleEventToBTDeviceInternal(conn_event);
const bool is_same_device = bt_device_equal(&event_device.opaque,
&device->opaque);
cl_assert_equal_b(is_same_device, true);
cl_assert_equal_b(conn_event->connected, connected);
cl_assert_equal_i(conn_event->hci_reason, ... | {
BTErrno e = gap_le_connect_cancel_by_bonding(~0, GAPLEClientApp);
cl_assert_equal_i(e, BTErrnoInvalidParameter);
} |
void test_gap_le_connect__register_is_already_registered_for_same_client(void) {
BTErrno e;
bool registered;
BTDeviceInternal device = prv_dummy_device(1);
// Register connection intent:
e = gap_le_connect_connect(&device,
true /* auto_reconnect */,
f... |
nt32_t duration,
InterpolateInt64Function interpolate) {
Animation *curr_rel_bar_anim = NULL;
prv_rel_bar_reset_offsets(&layer->relbar_layer, RelationshipBarOffsetTypeCurr);
int16_t curr_from_rel_bar_value = 0;
int16_t curr_to_rel_bar_value = 0;
static cons... | grect_get_max_y(&line) | - line2.size.h;
graphics_fill_rect(ctx, &line2);
// Bar 2
// Filled rect used to draw line of REL_BAR_LINE_WIDTH stroke width
line.origin.x = layer_bounds.origin.x + layer_bounds.size.w - REL_BAR_LINE_HORIZ_OFFSET;
line.origin.y = second_icon_frame.origin.y - (REL_BAR_VERT_MARGIN + line_length) - prev_offse... |
compiled_with_legacy2_sdk());
GColor *palette = NULL;
uint8_t palette_size = gbitmap_get_palette_size(format);
if (palette_size > 0) {
palette = applib_zalloc(palette_size * sizeof(GColor));
}
return palette;
}
#define BITMAP_FORMAT_IS_CIRCULAR_FULL_SCREEN(size, format) \
((format) == GBitmapFormat8Bit... | {
gbitmap_set_palette(bitmap, palette, free_on_destroy);
} |
return bitmap;
}
// Adapted from http://aggregate.org/MAGIC/#Bit%20Reversal
T_STATIC uint8_t prv_byte_reverse(uint8_t b) {
b = (b & 0xaa) >> 1 | (b & 0x55) << 1;
b = (b & 0xcc) >> 2 | (b & 0x33) << 2;
b = (b & 0xf0) >> 4 | (b & 0x0f) << 4;
return b;
}
GBitmap* gbitmap_create_palettized_from_1bit(const GBi... |
/*
* 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_finished_failure_callback(data) | ;
}
}
static void prv_animation_stopped_failure(Animation *animation, bool finished, void *context) {
ProgressWindow *data = context;
prv_show_peek_layer(data);
}
static void prv_schedule_progress_success_animation(ProgressWindow *data) {
#if !PLATFORM_TINTIN
GRect beg = data->progress_layer.layer.bounds;
G... |
{ 872, 128, 8},
{ 920, 120, -32},
{ 1008, 104, -112},
{ 952, 88, -88},
{ 1024, 64, -160},
{ 1080, 128, -128},
// 137 seconds
{ 1080, 160, -128},
{ 1176, 200, -144},
{ 1304, 240, -136},
{ 1200, 240, -152},
{ 920, 232, -104},
{ 688, 232, -128},
{ 584, 232, -176},
{... | { 1000, 352, -176},
{ 1200, 344, -120},
{ 1336, 304, -96},
{ 1248, 248, -24},
{ 992, 192, -24},
{ 800, 168, -24},
{ 744, 128, -40},
{ 776, 120, -16},
{ 808, 72, 8},
{ 832, 40, -8},
{ 928, 40, -32},
{ 1088, 48, -56},
{ 1080, 16, -40},
{ 1344, 88, -16},
{ 1128, ... |
// ----------------------------------------------------------------
// Sample captured: 2015-10-05 16:06:25 local
AccelRawData *activity_sample_walk_200_pbl_25656_9(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_200_pbl_25656_9
//> TEST_EXPECTED 200
//> T... |
prv_object_queue_handle_chunk_sent();
} else {
if (s_state.out.failure_count >= CHUNK_MESSAGE_MAX_FAILURES) {
APP_LOG(APP_LOG_LEVEL_WARNING, "Dropping Message.");
prv_object_queue_pop_head_and_emit_error_event_and_own_json_buffer();
} else {
// Retry happens ... | prv_emit_post_message_connection_event(true /* is_connected */) | ;
// Kick the object queue upon entering SessionOpen:
prv_outbox_try_send_next();
DBG("SessionOpen enter");
}
static void prv_session_open__after_exit(void) {
DBG("After SessionOpen exit");
prv_cleanup_inbound_reassembly_buffer();
if (s_state.out.object_queue) {
// Make sure we'll re-transfer the ob... |
destroy(s_last_timeline_item_added);
s_last_timeline_item_added = NULL;
s_last_timeline_item_removed_uuid = (Uuid) {};
fake_spi_flash_init(0, 0x1000000);
pfs_init(false);
pfs_format(false);
cron_service_init();
alarm_init();
alarm_service_enable_alarms(true);
}
void test_alarm__cleanup(void) {
cro... | prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_CUSTOM, custom_schedule1) | ;
bool custom_schedule2[7] = {false, false, false, false, false, true, false};
id = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &custom_schedule2 });
prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_CUSTOM, custom_schedule2);
bool custom_schedule3[7] =... |
/*
* 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... | applib_malloc(buffer_size) | ;
bt_dialog->owns_buffer = true;
}
sys_i18n_get_with_buffer("Check bluetooth connection", bt_dialog->text_buffer, buffer_size);
dialog_set_text(dialog, bt_dialog->text_buffer);
dialog_set_icon(dialog, RESOURCE_ID_WATCH_DISCONNECTED_LARGE);
dialog_show_status_bar_layer(dialog, true);
dialog_set_callback... |
ResourceInfo timeline_res = {
.res_id = TIMELINE_RESOURCE_GENERIC_WARNING,
};
peek_layer_set_icon(peek_layer, &timeline_res);
peek_layer_set_title(peek_layer, i18n_get("Resetting...", data));
peek_layer_set_background_color(peek_layer, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite));
peek_layer_play(peek... | action_bar_layer_add_to_window(action_bar, window) | ;
action_bar_layer_set_click_config_provider(action_bar, (ClickConfigProvider) config_provider);
action_bar_layer_set_icon(action_bar, BUTTON_ID_UP, data->action_bar_icon_check);
action_bar_layer_set_icon(action_bar, BUTTON_ID_DOWN, data->action_bar_icon_x);
}
static void prv_window_unload(Window *window) {
Co... |
{
PBL_ASSERTN(list_contains(manager->running_timers, &timer->list_node));
list_remove(&timer->list_node, &manager->running_timers /* &head */, NULL /* &tail */);
} else {
PBL_ASSERTN(list_contains(manager->idle_timers, &timer->list_node));
list_remove(&timer->list_node, &manager->idle_timers /* &head ... | if (timer->executing) {
timer->defer_delete = true;
mutex_unlock(manager->mutex);
} else {
PBL_ASSERTN(list_contains(manager->idle_timers, &timer->list_node));
list_remove(&timer->list_node, &manager->idle_timers /* &head */, NULL /* &tail */);
mutex_unlock(manager->mutex);
kernel_free(timer);... |
}
void task_timer_manager_init(TaskTimerManager *manager, SemaphoreHandle_t semaphore) {
*manager = (TaskTimerManager) {
.mutex = mutex_create(),
// Initialize next id to be a number that's theoretically unique per-task
.next_id = (pebble_task_get_current() << 28) + 1,
.semaphore = semaphore
};
... |
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 (delta_bytes) {
memmove(to, from, bytes - delta_... | (dst_row_info.max_x, max_x) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | pfs_open(process_name, OP_FLAG_READ, 0, 0) | ) < S_SUCCESS) {
return (GET_APP_INFO_COULD_NOT_READ_FORMAT);
}
if (pfs_read(fd, (uint8_t *)app_info, sizeof(PebbleProcessInfo)) != sizeof(PebbleProcessInfo)) {
pfs_close(fd);
return (GET_APP_INFO_COULD_NOT_READ_FORMAT);
}
if (build_id_out) {
const uint8_t padding_size = sizeof(PebbleProcessInfo... |
DMA_Cmd(FLASH_DMA_STREAM, ENABLE) | ;
DMA_Cmd(FLASH_TX_DMA_STREAM, ENABLE);
xSemaphoreTake(s_flash_state.dma_semaphore, portMAX_DELAY);
stop_mode_enable(InhibitorFlash);
xSemaphoreGive(s_flash_state.dma_semaphore);
}
void DMA2_Stream0_IRQHandler(void) {
if (DMA_GetITStatus(FLASH_DMA_STREAM, DMA_IT_TCIF3)) {
DMA_ClearITPendingBit(FLASH_DMA_... | |
/*
* 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_LOG(APP_LOG_LEVEL_INFO, "0x%02x", value[i]) | ;
}
}
static void write_handler(BLECharacteristic characteristic,
BLEGATTError error) {
char uuid_buffer[UUID_STRING_BUFFER_LENGTH];
Uuid characteristic_uuid = ble_characteristic_get_uuid(characteristic);
uuid_to_string(&characteristic_uuid, uuid_buffer);
APP_LOG(APP_LOG_LEVEL_INFO... |
gth > max_length) {
// Using cl_assert_equal_i for the nicer printing.
// when getting at this point, it will always trip:
cl_assert_equal_i(length, max_length);
}
cl_assert_equal_p(s_sent_data, NULL);
s_sent_data = kernel_malloc(length);
cl_assert(s_sent_data);
memcpy(s_sent_data, data, length);... | (app_message_is_closed_inbound(), true) | ;
cl_assert_equal_b(app_message_is_closed_outbound(), true);
fake_app_timer_deinit();
kernel_free(s_sent_data);
s_sent_data = NULL;
}
// Test OUTBOUND (watch->phone):
////////////////////////////////////
static void prv_send_test_data_expecting_result(AppMessageResult result) {
DictionaryIterator *iter;
c... |
under the License.
*/
#include "dls_private.h"
#include "dls_endpoint.h"
#include "dls_list.h"
#include "dls_storage.h"
#include "services/common/analytics/analytics.h"
#include "services/common/comm_session/protocol.h"
#include "services/common/comm_session/session_send_buffer.h"
#include "services/common/system_ta... | reschedule_ack_timeout() | ;
}
static void ack_timer_cb(void *cb_data) {
mutex_lock(s_endpoint_data.mutex);
check_ack_timeout();
mutex_unlock(s_endpoint_data.mutex);
}
static bool find_soonest_ack_timeout_cb(DataLoggingSession *session, void *data) {
RtcTicks *soonest_ack_timeout = (RtcTicks*) data;
if (session->comm.ack_timeout !=... |
ui.h"
#include <stdint.h>
#include "applib/ui/vibes.h"
#include "apps/system_app_ids.h"
#include "apps/system_apps/battery_critical_app.h"
#include "kernel/low_power.h"
#include "kernel/ui/modals/modal_manager.h"
#include "kernel/util/standby.h"
#include "process_management/app_manager.h"
#include "services/common/ba... | while (s_warning_points_index < num_points && (percent <=
battery_curve_get_percent_remaining(s_warning_points[s_warning_points_index + 1]))) {
s_warning_points_index++;
new_warning = true;
} | |
nclude "stubs_mutex.h"
#include "stubs_pbl_malloc.h"
#include "stubs_prompt.h"
#include "stubs_serial.h"
#include "stubs_sleep.h"
#include "stubs_passert.h"
#include "stubs_task_watchdog.h"
void app_storage_delete_app(AppInstallId id) {
char buffer[30];
itoa_int(id, buffer, 10);
pfs_remove(buffer);
}
bool app_s... | app_cache_add_entry(app2.id, app2.size) | );
cl_assert_equal_i(S_SUCCESS, app_cache_add_entry(app3.id, app3.size));
// remove 3
cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app1.id));
cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app2.id));
cl_assert_equal_i(S_SUCCESS, app_cache_remove_entry(app3.id));
cl_assert_equal_i(fake_event_ge... |
/*
* 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... | (Module.frameBufferMarkDirty) | {
Module.frameBufferMarkDirty()
}
);
}
}
void emx_app_init(void) {
emx_graphics_init();
emx_resources_init();
emx_tick_timer_service_init();
}
void emx_app_deinit(void) {
emx_resources_deinit();
}
void emx_app_event_loop(void) {
emscripten_set_main_loop(prv_event_loop,
... |
n(entry, op_flags), offset, data, num_bytes);
}
static const uint8_t *resource_storage_file_readonly_bytes_unsupported(ResourceStoreEntry *entry,
bool has_privileged_access) {
return NULL;
}
static bool resource_storage_file_find_resource(Resour... | resource_storage_get_file_name(filename, sizeof(filename), app_num) | |
buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"R\": %s", buf);
}
r = strftime(buf, buf_size, "%S", &good_data);
if (r == 0 || strncmp(buf, "49", buf_size) != 0) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"S\": %s", buf);
}
r = strftime(buf, buf_size, "%T", &good_data);
if (r == 0 |... | prv_test_valid_data() | ;
prv_test_invalid_data();
Layer *window_layer = window_get_root_layer(window);
result_layer = text_layer_create(GRect(0, 0, 144, 168));
text_layer_set_text(result_layer, "strftime() test. Check the app logs for details");
text_layer_set_font(result_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
... |
m_p0.y.raw_value)
* (x - ((bm_p0.x.raw_value + add_bottom) / FIXED_S16_3_ONE.raw_value)))
* FIXED_S16_3_ONE.raw_value / (bm_p1.x.raw_value - bm_p0.x.raw_value);
} else {
bottom_margin.raw_value = bm_p0.y.raw_value;
}
}
// Find edges for both caps
... | if (ctx->lock) {
return;
} |
#if PBL_COLOR
if (ctx->draw_state.antialiased) {
if (ctx->draw_state.stroke_width > 1) {
// Antialiased and Stroke Width > 1
graphics_line_draw_stroked_aa(ctx, p0, p1, ctx->draw_state.stroke_width);
return;
} else {
// Antialiased and Stroke Width == 1 (not suppported on 1-bit color)... |
/*
* 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_JS_GLOBAL_EQUALS_S("f", "function") | ;
// yes, JerryScript provides some default behavior but it's not what we want
ASSERT_JS_GLOBAL_EQUALS_S("s2", "23:04:05.000");
ASSERT_JS_GLOBAL_EQUALS_S("s3", "2005-07-25");
ASSERT_JS_GLOBAL_EQUALS_S("s4", "Mon Jul 25 2005 20:04:05 GMT-03:00");
}
void test_rocky_api_datetime__locale_time_string_12h(void) {
... |
ace_lots_apps(void) {
uint32_t to_free;
uint32_t before_size;
uint32_t after_size;
// test random number
prv_cleanup();
to_free = 150000;
before_size = app_cache_get_size();
cl_assert(before_size >= to_free);
cl_assert_equal_i(S_SUCCESS, app_cache_free_up_space(to_free));
fake_system_task_callbacks... | (after_size == (before_size - to_free)) | ;
}
struct file_description {
const char *name;
size_t size;
};
static struct file_description descriptions[] = {
// this first set of files match some I found on my snowy bb2
{"gap_bonding_db", 8102},
{"pmap", 5632},
{"pindb", 57095},
{"appdb", 32603},
{"reminderdb", 57090},
{"appcache", 8108},
{... |
e "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,... | settings_file_set(store, &key, sizeof(key),
&value, sizeof(value)) | ;
return PASSED(result) ? (status_t)sizeof(value) : result;
}
// FIXME: PBL-23877 Disallow and document persist write data of length 0 edge case
DEFINE_SYSCALL(int, persist_write_data, const uint32_t key,
const void *buffer, const size_t buffer_size) {
if (PRIVILEGE_WAS_ELEVATED) {
sysca... |
epeat_timer = NULL;
}
static void prv_play_pause_long_click_start_handler(ClickRecognizerRef recognizer, void *context) {
prv_toggle_playing();
prv_set_action_bar_state(context, ActionBarStateLongPress);
prv_do_haptic_feedback_vibe(context);
}
static void prv_play_pause_long_click_end_handler(ClickRecognizerRef... | i18n_get("START PLAYBACK\nON YOUR PHONE", window) | ,
fonts_get_system_font(config->no_music_font_key),
GColorBlack, GColorClear, GTextAlignmentCenter,
GTextOverflowModeTrailingEllipsis);
layer_add_child(&window->window.layer, &window->bitmap_layer.layer);
layer_add... |
sion = {
.major = 2,
.minor = 0,
},
.sdk_version = {
.major = 5,
.minor = 13,
},
.app_face_bg_color = {0},
.template_id = 0,
.icon_resource_id = 0,
};
static const Uuid tictoc_uuid = { 0x8f, 0x3c, 0x86, 0x86, 0x31, 0xa1, 0x4f, 0x5f,
0x91, 0xf5, 0x01, 0x60,... | cl_assert_equal_b(true, app_install_get_entry_for_install_id(music_id, &id_entry)) | ;
cl_assert_equal_b(true, app_install_get_entry_for_uuid(&music_uuid, &uuid_entry));
cl_assert_equal_b(true, app_install_entries_equal(&id_entry, &uuid_entry));
cl_assert_equal_b(true, app_install_get_entry_for_install_id(sports_id, &id_entry));
cl_assert_equal_b(true, app_install_get_entry_for_uuid(&sports_uu... |
missions and
* limitations under the License.
*/
#include "mfg/mfg_serials.h"
#include "console/prompt_commands.h"
#include "clar.h"
#include "stubs_passert.h"
#include "stubs_logging.h"
#include "stubs_prompt.h"
#include "fake_otp.h"
#include <signal.h>
extern void command_hwver_write(const char*);
extern void ... | cl_assert_equal_s(sn, "XXXXXXXXXXXX") | |
/*
* 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 ((neg = (n < 0))) { /* record sign */
n = -n; /* make n positive */
} |
int i = 0;
do { /* generate digits in reverse order */
str[i++] = (n % base) + '0'; /* get next digit */
} while ((n /= base) > 0); /* delete it */
if (neg) {
str[i++] = '-'; /* append sign */
}
str[i] = '\0';
string_reverse(str);
}
static in... |
/*
* 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_DEBUG, ">> Flash operation time!") | ;
PBL_LOG(LOG_LEVEL_DEBUG, ">> Flash operation time!");
PBL_LOG(LOG_LEVEL_DEBUG, ">> Flash operation time!");
PBL_LOG(LOG_LEVEL_DEBUG, ">> Flash operation time!");
PBL_LOG(LOG_LEVEL_DEBUG, ">> Flash operation time!");
PBL_LOG(LOG_LEVEL_DEBUG, ">> Erasing 0x%x", BASE_ADDRESS);
flash_erase_sector_blocking(BA... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_LOG(LOG_LEVEL_ALWAYS, "TX'ing unmodulated CW on BT channel %d", cmd->tx_channel) | |
ding us bytes.
bus->i2c->CR1 &= ~I2C_CR1_ACK;
}
bus->transfer.state = TRANSFER_STATE_WAIT_FOR_DATA;
break;
case TRANSFER_STATE_WAIT_FOR_DATA:
//This state just ensures that the transition to receive mode event happened
// Enable RXNE interrupt for writing
bus->i2c->CR2 ... | (irq_error_handler(&i2c_buses[1])) | ;
}
void I2C3_EV_IRQHandler(void) {
portEND_SWITCHING_ISR(irq_event_handler(&i2c_buses[0]));
}
void I2C3_ER_IRQHandler(void) {
portEND_SWITCHING_ISR(irq_error_handler(&i2c_buses[0]));
}
/*------------------------COMMAND FUNCTIONS--------------------------*/
void command_power_2v5(char *arg) {
// Intentionally... |
/*
* 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... | (pwm->timer.peripheral, pwm->timer.config_clock) | ;
gpio_output_init(&pwm->output, GPIO_OType_PP, GPIO_Speed_100MHz);
// The ".active_high" attribute determines the idle state of the PWM output
gpio_output_set(&pwm->output, false /* force low */);
}
const FunctionalState state = (enable) ? ENABLE : DISABLE;
if (IS_LPTIM(pwm->timer.peripheral)) {
... |
compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ei... | {
return rv;
} |
rv = settings_file_get(&s_contacts_db.settings_file, key, key_len, val_out, val_out_len);
prv_close_file_and_unlock_mutex();
SerializedContact *serialized_contact = (SerializedContact *)val_out;
return rv;
}
status_t contacts_db_delete(const uint8_t *key, int key_len) {
if (key_len != UUID_SIZE) {
re... |
DE_COMPLEX
const int duration_a = 300;
const int duration_b = 500;
const int duration_c = 400;
const int play_count_b = 2;
int duration_total = duration_a + play_count_b * duration_b;
const AnimationHandlers handlers = {
.started = prv_started_handler,
.stopped = prv_stopped_handler
};
// Cre... | 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), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c)... |
the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specif... | bt_persistent_storage_has_pinned_ble_pairings() | |
s/common/analytics/analytics.h"
#include "services/common/bluetooth/ble_root_keys.h"
#include "services/common/bluetooth/bluetooth_ctl.h"
#include "services/common/bluetooth/bluetooth_persistent_storage.h"
#include "services/common/bluetooth/dis.h"
#include "services/common/bluetooth/local_addr.h"
#include "services/co... | prv_comm_stop() | |
u_layer_get_selected_index(&l).row);
const int16_t basic_cell_height = menu_cell_basic_cell_height();
cl_assert_equal_i(basic_cell_height, l.selection.y);
cl_assert_equal_i(-basic_cell_height,
scroll_layer_get_content_offset(&l.scroll_layer).y);
}
void test_menu_layer__test_set_selected_cente... | cl_assert_equal_b(false, s_content_available[ContentIndicatorDirectionUp]) | ;
cl_assert_equal_b(true, s_content_available[ContentIndicatorDirectionDown]);
// in general, the default behavior does not handle changes in row height correctly
menu_layer_set_selected_next(&l, false, MenuRowAlignNone, false);
cl_assert_equal_i(2 * FOCUSED + NORMAL, l.selection.y);
cl_assert_equal_i(NORMAL... |
e this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDI... | (ctx, s_text_buffer, &s_font_info, GRect(-44, 4, 72, 32),
GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL) | |
te_layer_frame(&data->info_text_layer.layer,
&pair_text_area, &below_pair_text);
PBL_ASSERTN(data->info_text_out_animation);
animation = property_animation_get_animation(data->info_text_out_animation);
animation_set_auto_destroy(animation, false);
animation_set_dura... | layer_remove_from_parent(&data->device_name_text_layer.layer) | ;
}
if (prv_has_confirmation_token(data)) {
layer_remove_from_parent(&data->code_text_layer.layer);
}
// Disable all buttons in this screen:
action_bar_layer_remove_from_window(&data->action_bar_layer);
action_bar_layer_set_click_config_provider(&data->action_bar_layer, NULL);
}
static void prv_confir... |
AL = menu_cell_basic_cell_height();
cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row);
cl_assert_equal_i(0, l.selection.y);
const int row0_vertically_centered = (height - FOCUSED)/2;
cl_assert_equal_i(row0_vertically_centered, scroll_layer_get_content_offset(&l.scroll_layer).y);
cl_assert_equal_i(F... | (&l, true, MenuRowAlignNone, false) | |
4 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 in writing, software... | WINDOW_NAME("Demo Menu") | |
{ -1160, 632, -80},
{ -1184, 392, -216},
{ -960, 408, -104},
{ -1456, 472, -120},
{ -1504, 200, -240},
{ -1504, 240, -280},
{ -1384, 152, -208},
{ -1344, 104, -152},
{ -1424, 112, -128},
{ -1536, 56, -32},
{ -1560, 64, -16},
{ -1568, 72, 24},
{ -1312, -304, 136},
{... | { -1408, 392, -96},
{ -1808, 320, 40},
{ -1848, 184, 56},
{ -1680, 120, 64},
{ -1584, 112, 80},
{ -1528, 88, 88},
{ -1472, 72, 104},
// 51 seconds
{ -1400, 40, 120},
{ -1432, 8, 176},
{ -1224, -448, 176},
{ -936, -728, 40},
{ -1248, -112, -208},
{ -1304, -64, -312... |
{ -976, -368, -256},
{ -1264, -224, -256},
{ -1640, -48, -208},
{ -1616, -8, -88},
{ -1592, -24, -40},
{ -1592, 16, 112},
{ -1568, 408, 208},
{ -1432, 416, 136},
{ -1416, 328, -16},
{ -1592, 992, -392},
{ -1288, 344, 24},
{ -1200, 640, -40},
{ -1152, 984, -104},
... |
_measuring_timer);
gbitmap_destroy(active_window->action_bar_start);
gbitmap_destroy(active_window->action_bar_pause);
gbitmap_destroy(active_window->action_bar_stop);
gbitmap_destroy(active_window->action_bar_more);
gbitmap_destroy(active_window->action_bar_next);
gbitmap_destroy(active_window-... | // Three metrics. Two static metrics above a scrollable metric
const int layer_height = 51;
GRect top_metric_bounds = base_layer_bounds;
top_metric_bounds.size.h = layer_height;
layer_init(&active_window->top_metric_layer, &top_metric_bounds);
layer_set_update_proc(&active_window->top_metric_lay... |
StatusBarLayer *status_layer = &active_window->status_layer;
status_bar_layer_init(status_layer);
status_bar_layer_set_colors(status_layer, GColorClear, GColorBlack);
layer_add_child(&window->layer, status_bar_layer_get_layer(status_layer));
#if PBL_RECT
GRect status_layer_bounds = window->layer.bounds;
... |
// There isn't really anything we can do.
PBL_LOG(LOG_LEVEL_ERROR, "Configure-Request too large to Reject");
return;
}
struct LCPPacket *packet = pulse_link_send_begin(this->protocol_number);
memcpy(packet, bad_packet, ntoh16(bad_packet->length));
packet->code = ControlCode_ConfigureReject;
pulse_... | {
switch (this->state->link_state) {
case LinkState_Closing:
case LinkState_Stopping:
// Do nothing
break;
case LinkState_Closed:
prv_send_terminate_ack(this, -1);
break;
case LinkState_Stopped:
this->state->restart_count = MAX_CONFIGURE;
// fallthrough
case Lin... |
static void prv_on_configure_ack(PPPControlProtocol *this,
struct LCPPacket *packet) {
if (packet->identifier != this->state->last_configure_request_id) {
// Invalid packet; silently discard
return;
}
if (ntoh16(packet->length) != LCP_HEADER_LEN) {
// Only configure ... |
ission has just been
// Ack'd. We can determine whether or not a packet is pending retransmission by checking if the
// payload size for next_data_sn is not 0. This means the packet has been enqueued to get sent
if (prv_is_packet_with_sn_awaiting_ack(client, client->out.next_data_sn)) {
client->out.ne... | PBL_LOG(LOG_LEVEL_DEBUG, "Resetting, ignoring data/ack packets (%u)", packet->type) | ;
}
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Ignoring all packets in state %u", client->state);
}
}
// -------------------------------------------------------------------------------------------------
static void prv_handle_meta_read(PPoGATTClient *client, const uint8_t *value,
... |
/*
* 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... | {
HealthData health_data = {
.sleep_start = (16 * SECONDS_PER_HOUR),
.sleep_end = (16 * SECONDS_PER_HOUR),
};
prv_create_card_and_render(&health_data);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
} |
void test_health_sleep_detail_card__render_30_day_avg(void) {
HealthData health_data = {
.monthly_sleep_average = (8 * SECONDS_PER_HOUR) + (17 * SECONDS_PER_MINUTE),
};
prv_create_card_and_render(&health_data);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
}
void test_health_sleep_detail_... |
/*
* 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... | clock_copy_time_string_timestamp(time_buffer, sizeof(time_buffer), layout->info->timestamp) | ;
strncpy(buffer + pos, time_buffer, config->buffer_size - pos);
buffer[config->buffer_size - 1] = '\0';
}
}
static void prv_body_header_update(const LayoutLayer *layout_ref,
const LayoutNodeTextDynamicConfig *config, char *buffer,
bool re... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | layer->property_changed_proc(layer) | ;
}
if (layer->window) {
window_schedule_render(layer->window);
}
}
static bool layer_process_tree_level(Layer *node, void *ctx, LayerIteratorFunc iterator_func);
static bool layer_property_changed_tree_node(Layer *node, void *ctx) {
if (node) {
if (node->property_changed_proc) {
node->property_... |
/*
* 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... | {
resp->opcode = PULSE_PP_OPCODE_DATA;
const size_t bytes_to_copy = MIN(bytes_remaining, mss);
comm_session_send_queue_copy(session, 0 /* start_offset */,
bytes_to_copy, &resp->data[0]);
pulse_reliable_send(resp, bytes_to_copy + sizeof(PulsePPPacket));
c... | else {
// Reliable transport went down while waiting to send.
// The CommSession has already been closed so simply return without doing
// anything further.
break;
}
}
}
static void prv_reset(Transport *transport) {
PBL_LOG(LOG_LEVEL_INFO, "Unimplemented");
}
static void prv_granted_k... |
struct MenuCellDimensions {
int16_t basic_cell_height;
int16_t small_cell_height;
int16_t horizontal_inset;
int16_t title_subtitle_left_margin;
} MenuCellDimensions;
static const MenuCellDimensions s_menu_cell_dimensions[NumPreferredContentSizes] = {
//! @note these are the same as Medium until Small is des... | {
box.origin.x += bounds->size.w - (horizontal_margin + config->icon->bounds.size.w);
} | else { // icon on left
box.origin.x += ((config->icon->bounds.size.w & 1) + // Nudge odd-width icons one right
((s_icon_size.w - config->icon->bounds.size.w) / 2));
}
box.origin.y += (s_icon_size.h - config->icon->bounds.size.h) / 2;
} else {
const GRect contain... |
* data) {
PBL_LOG(LOG_LEVEL_DEBUG, "STT running reg_timer_2_callback");
if (s_app_data->reg_timers[0].cb != 0) {
PBL_LOG(LOG_LEVEL_DEBUG, "STT reg_timer_2_callback deleting from callback");
regular_timer_remove_callback(&s_app_data->reg_timers[0]);
}
}
// ================================================... | (s_app_data->timer[timer_idx_0], 300, timer_callback, (void*)timer_idx_0, zero_flags) | |
in thumb state, which must always be set on Cortex-M3, since the micro doesn't
// even support non-thumb instructions.
// See: https://pebbletech.campfirenow.com/room/508662/transcript/message/1111369053#message_1111369053
// http://stackoverflow.com/a/9538628/1546
stacked_args[7] = 1 << 24;
mcu_state_s... | (stacked_args) | ;
fault_handler_dump(buffer, stacked_args);
// BREAKPOINT;
// NOTE: If you want to get a stack trace at this point. Set a breakpoint here (you can compile in the above
// BREAKPOINT call if you want) and issue the following commands in gdb:
// set var $sp=<value of SP above>
// set var $... |
e PATH_INTERP_DEF_TL_CORNER \
{ { 0, 0 }, \
{ 0, 0 }, }
#define PATH_INTERP_DEF_TR_CORNER \
{ { DISP_COLS, 0 }, \
{ DISP_COLS, 0 }, }
#define PATH_INTERP_DEF_BL_CORNER \
{ { 0, DISP_ROWS }, \
{ 0, DISP_ROWS }, }
#define PATH_INTERP_DEF_BR_CORNER \
{ { DISP_COLS, DISP_ROWS }, \
{ DISP_COLS, DISP_... | (&ctx->dest_bitmap, -diff) | |
qual_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest,
BUFFER_SIZE, s_writer));
cl_assert_equal_b(true, app_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest));
}
//////////////////////////////////////////////////////////////////////////////... | (AppInboxServiceTagUnitTest, s_test_data, 1) | );
cl_assert_equal_b(true, app_inbox_service_end(AppInboxServiceTagUnitTest));
// Message 2:
cl_assert_equal_b(true, app_inbox_service_begin(AppInboxServiceTagUnitTest, 1, s_writer));
cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1));
cl_assert_equal_b(true, app_inb... |
yer, &ctx);
cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_inside_origin_l... | gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi") | );
// TODO: Fix offset calculation and reenable this: - PBL-16509
#if SCREEN_COLOR_DEPTH_BITS == 8
// AA = true, SW = 4
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 4);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_b... |
q(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_y.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_y_second_line);
layer_render_tree(&canvas, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_sin... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_ajj22.${BIT_DEPTH_NAME}.pbi")) | ;
// Test when clipping/drawing and text bounds are all at (2, 0) - no negative offset
setup_test_aa_sw(&ctx, fb, RECT_TEXT_2_0, RECT_TEXT_2_0, false, 1);
graphics_context_set_text_color(&ctx, GColorBlack);
graphics_draw_text(&ctx, "aaa", &s_font_info, RECT_TEXT_2_0,
GTextOverflowModeTrail... |
;
strftime(tmbuf, sizeof(tmbuf), "%02D %04e", &jan_2_10015__13_00_00);
cl_assert_equal_s(tmbuf, "01/02/15 0002");
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%05n %03r", &jan_2_10015__13_00_00);
cl_assert_equal_s(tmbuf, "\n 01:00:00 PM");
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%02R %06t %... | localized_strftime(tmbuf, sizeof(tmbuf), "%c", &jan_2_2015__13_00_00, i18n_get_locale()) | |
/*
* 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... | (valid_test_string_utf8) | |
ite_end(DictionaryIterator *iter) {
if (iter == NULL ||
iter->dictionary == NULL ||
iter->cursor == NULL) {
return 0;
}
iter->end = iter->cursor;
return dict_size(iter);
}
//! Returns the cursor, or NULL if the tuple at cursor extends beyond the bounds of the backing storage
static Tuple * get_... | if (size_in_out == NULL ||
buffer == NULL ||
tuplets == NULL) {
return DICT_INVALID_ARGS;
} |
DictionaryResult result;
if ((result = dict_write_begin(iter, buffer, *size_in_out)) != DICT_OK) {
return result;
}
for (unsigned int i = 0; i < tuplets_count; ++i) {
if ((result = dict_write_tuplet(iter, &tuplets[i])) != DICT_OK) {
return result;
}
}
*size_in_out = dict_write_end(iter);
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (dstbuf, 256, "There are %#d lights, %#d", 4, -4) | |
essionType_RestfulNap:
case ActivitySessionType_Walk:
case ActivitySessionType_Run:
case ActivitySessionType_Open:
break;
case ActivitySessionType_None:
case ActivitySessionTypeCount:
PBL_LOG(LOG_LEVEL_WARNING, "Invalid activity type: %d", (int)session->type);
return false;
}
... | if (found_session_idx < 0) {
PBL_LOG(LOG_LEVEL_WARNING, "Session to delete not found");
goto unlock;
} |
// The session we are deleting must be ongoing
PBL_ASSERT(stored_session->ongoing, "Only ongoing sessions can be deleted");
// Remove this session
int num_to_move = state->activity_sessions_count - found_session_idx - 1;
PBL_ASSERTN(num_to_move >= 0);
if (num_to_move == 0) {
memset(&sta... |
ength, "Unknown command opcode");
return;
}
}
prv_respond_malformed_command(command, length, "Empty command");
}
void pulse_flash_imaging_link_state_handler(PulseLinkState link_state) {
}
static bool s_erase_in_progress = false;
static uint32_t s_erase_start_address;
static uint32_t s_erase_length;
t... | if (length != sizeof(cmd->region)) {
prv_respond_malformed_command(cmd, length, NULL);
return;
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (ufsr != 0) {
PBL_LOG_FROM_FAULT_HANDLER(" Usage Fault Status Register:");
print_set_indexes(buffer, (const uint8_t*) &ufsr, ufsr_mappings, ARRAY_LENGTH(ufsr_mappings));
} |
// Bus Fault Status Register
const uint8_t bfsr = (cfsr >> 8) & 0xff;
static const IndexToName bfsr_mappings[] = {
{ 4, "STKERR" },
{ 3, "UNSTKERR" },
{ 2, "IMPRECISERR" },
{ 1, "PRECISERR" },
{ 0, "IBUSERR" },
};
if (bfsr != 0) {
PBL_LOG_FROM_FAULT_HANDLER(" Bus Fault Status Regist... |
accessory_manager.h"
#include "services/normal/accessory/smartstrap_attribute.h"
#include "services/normal/accessory/smartstrap_comms.h"
#include "services/normal/accessory/smartstrap_connection.h"
#include "services/normal/accessory/smartstrap_link_control.h"
#include "services/normal/accessory/smartstrap_state.h"
#in... | smartstrap_profiles_send_control() | |
/*
* 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 (prv_should_use_item(state, header)) {
*state->filter_header = *header;
} |
filter = true;
}
}
return filter;
}
static void prv_update_status(void) {
PBL_ASSERT_TASK(PebbleTask_KernelBackground);
if (!s_mutex) {
return;
}
mutex_lock(s_mutex);
new_timer_stop(s_timer);
SerializedTimelineItemHeader *filter_headers =
kernel_zalloc_check(TimelineEventServiceCou... |
----------------------------------------------
// Return true if the given activity type is a sleep activity
bool activity_sessions_prv_is_sleep_activity(ActivitySessionType activity_type) {
switch (activity_type) {
case ActivitySessionType_Sleep:
case ActivitySessionType_RestfulSleep:
case ActivitySessio... | {
*total_weight = s_activity_next_heart_rate_heart_rate_total_weight_x100;
} |
}
void activity_metrics_prv_reset_hr_stats(void) {
s_activity_next_heart_rate_bpm = 0;
s_activity_next_heart_rate_zone = 0;
}
// =============================================================================================
// Algorithm stubs
uint32_t kalg_state_size(void) {
return 1;
}
bool kalg_init(KAlgSt... |
/*
* 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... | {
lis3dh_power_down();
} | |
w;
static bool check_region_erased(struct Region region) {
PBL_LOG_SYNC(LOG_LEVEL_INFO, "Checking Erase ...");
bool success = true;
for (uint32_t i = region.begin; i < region.end; i += sizeof(uint32_t)) {
uint32_t read = 0;
flash_read_bytes((uint8_t *)&read, i, sizeof(read));
if (read != 0xffffffff)... | PBL_LOG(LOG_LEVEL_INFO, "Erasing 0x%lx to 0x%lx", region.begin, region.end) | ;
flash_region_erase_optimal_range(region.begin, region.begin, region.end, region.end);
bool failed = true;
if (stress_data.stress_index == FILE_WRITE_STRESS) {
failed = (!check_region_erased(region) || !check_region_write(region, true, true));
} else if (stress_data.stress_index == FILE_SUBSECTOR_STRESS) ... |
state it was in when we unscheduled it
cl_assert_equal_point(layer.frame.origin, stopped_at_r.origin);
// Make sure our started and stopped handlers got called at
cl_assert_equal_i(s_started_handler_calls.num_calls, 1);;
cl_assert(s_started_handler_calls.entries[0].fired_time_ms - start_ms <= 1);
cl_assert(... | animation_set_handlers(h, handlers, context) | |
)",
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 down_handler(ClickRecognizerRef recognizer, void *context) {
AppData *data = window_get_user_data(s_window);
switch (data->operation) {
case OP_ROTATE:... | graphics_context_set_antialiased(ctx, true) | ;
graphics_context_set_stroke_width(ctx, data->stroke_width);
graphics_draw_line(ctx, p1, p2);
graphics_draw_line(ctx, p3, p0);
/*
graphics_context_set_stroke_color(ctx, GColorWhite);
graphics_context_set_antialiased(ctx, true);
graphics_context_set_stroke_width(ctx, data->stroke_width);
... |
/*
* 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;
} |
if (ctx->draw_state.draw_mask && !mask) {
// TODO PBL-33766: Update the ctx->draw_state.draw_mask's .mask_row_infos
}
const GDrawRawImplementation *draw_implementation_to_set =
mask ? &g_mask_recording_draw_implementation : &g_default_draw_implementation;
ctx->draw_state.draw_implementation = draw_i... |
penEntry *entry = new_head;
new_head = (DataLoggingReopenEntry *)list_pop_head((ListNode *)new_head);
kernel_free(entry);
}
}
}
//! For use with dls_list_for_each_session. Appends this session to our list of sesions we need to open.
//! On entry, 'data' points to the variable holding the head of the ... | dls_set_send_enable_pp(data[1]) | ;
break;
}
}
void dls_endpoint_init(void) {
s_endpoint_data.mutex = mutex_create();
s_endpoint_data.ack_timer = new_timer_create();
}
static bool prv_handle_disconnect_cb(DataLoggingSession *session, void *data) {
session->comm.state = DataLoggingSessionCommStateIdle;
return true;
}
void dls_private_... |
((uint8_t *)&hdr->erase_count, sizeof(hdr->erase_count),
prv_page_to_flash_offset(page) + offsetof(PageHeader, erase_count)) | ;
prv_flash_read((uint8_t *)&hdr->last_written, sizeof(hdr->last_written),
prv_page_to_flash_offset(page) + offsetof(PageHeader, last_written));
// feed watchdog since erases can take a while & give lower priority tasks
// a little time in case we are calling this from a high priority task and
// stallin... | |
t_mm, uint32_t weight_g, ActivityGender gender,
uint32_t age_years) {
return true;
}
bool activity_algorithm_get_steps(uint16_t *steps) {
*steps = s_test_alg_state.steps;
return true;
}
bool activity_algorithm_get_step_rate(uint16_t *steps, uint32_t *elapsed_ms, time_t *end_sec)... | if (record_start_time + SECONDS_PER_MINUTE > last_second_available) {
// This record not available yet.
break;
} | |
/*
* 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... | {
// Soft reset of the state machine and status bits by disabling the peripheral.
// Note: PE must be low for 3 APB cycles after this is done for the reset to be successful
i2c->CR1 &= ~I2C_CR1_PE;
i2c->CR1 &= ~CR1_CLEAR_MASK;
// Set the timing register
i2c->TIMINGR = timingr.reg;
// I2C only used as a... |
void i2c_hal_enable(I2CBus *bus) {
// We don't need to support Fast Mode Plus yet, so make sure the desired clock speed is less than
// the maximum Fast Mode clock speed.
// When Fast Mode support is added the duty-cycle settings will probably have to be re-thought.
PBL_ASSERT(bus->hal->clock_speed <= I2C_FAS... |
phics_draw_vertical_line_dotted(&ctx, GPoint(10, 90), 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(10, 96), 5);
// T facing right - even vert, even horiz
graphics_draw_vertical_line_dotted(&ctx, GPoint(50, 90), 10);
graphics_draw_horizontal_line_dotted(&ctx, GPoint(46, 95), 5);
// T facing right -... | GPoint(10, 18) | , GPoint(10, 22)); // bottom
graphics_draw_line(ctx, GPoint(5, 22), GPoint(-2, 15)); // bottom left corner
}
void test_graphics_draw_line__clipping_rect(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
setup_test_aa_sw(&ctx, fb, CLIP_RECT_CLIP_BOX, CLIP_RECT_DRAW_BOX, false, 1);
graphics_conte... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.