prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
action->type = is_phone_app ? TimelineItemActionTypeAncsDial :
TimelineItemActionTypeAncsPositive;
}
action->attr_list.attributes[0].id = AttributeIdAncsAction;
action->attr_list.attributes[0].uint8 = ancs_action_id;
// Allocate a new buffer if none provided
if (!(*buf... | if (subtitle && subtitle->length > 0) {
*buffer = prv_add_pstring_to_attribute(*buffer, subtitle, SUBTITLE_MAX_LENGTH,
&item->attr_list.attributes[attr_idx],
AttributeIdSubtitle);
attr_idx++;
} |
if (sender && sender->length > 0 && has_multimedia) {
char action_msg[MULTIMEDIA_INDICATOR_LENGTH];
prv_set_multimedia_action_msg(action_msg, sizeof(action_msg));
*buffer = prv_add_action_msg_to_attribute(*buffer, sender, TITLE_MAX_LENGTH,
message, MESSAGE_MA... |
slave->slave_state->dma_complete_handler = handler;
slave->slave_state->dma_complete_context = context;
prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqRx, true);
dma_request_start_direct(slave->rx_dma, in, (void *)&slave->spi_bus->spi->DR, len,
prv_dma_irq_handler, (void *)slave);
}
void... | PBL_ASSERTN(slave->tx_dma || slave->rx_dma) | |
// enable the interrupt
NVIC_SetPriority(dev->irq_channel, dev->irq_priority);
NVIC_EnableIRQ(dev->irq_channel);
} else {
// disable the interrupt
NVIC_DisableIRQ(dev->irq_channel);
}
}
void uart_set_rx_interrupt_handler(UARTDevice *dev, UARTRXInterruptHandler irq_handler) {
PBL_ASSERTN(dev->sta... | dma_request_get_current_data_counter(dev->rx_dma) | ;
}
|
shared_circular_buffer_consume(&buffer, &client2, 4) | );
cl_assert(memcmp(out_buffer, "1234", 4) == 0);
cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&buffer), 6);
// Make client2 fall behind
cl_assert(shared_circular_buffer_write(&buffer, (uint8_t*) "abcdef", 6, false));
cl_assert_equal_i(shared_circular_buffer_get_write_space_remaining(&... | |
/*
* 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... | atoi(id_str) | ;
if (id == 0) {
prompt_send_response("invalid app number");
return;
}
AppInstallEntry entry;
bool success = app_install_get_entry_for_install_id(id, &entry);
if (success && app_install_entry_has_worker(&entry)) {
app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = id });
prompt... |
cl_assert_equal_i(event.type, PEBBLE_TOUCH_EVENT);
cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable);
TouchEvent *touch_event = touch_event_queue_get_event(0, 0);
prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0,
&GPoint(10, 10), 2... | {
touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0);
touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400);
TouchEvent *touch_event = touch_event_queue_get_event(0, 0);
prv_test_touch_event(touch_event, 0, TouchEvent_PositionUpdate, &GPointZero, 3686380, 0,
... | |
{ -304, 1160, 600},
{ -320, 904, 888},
{ -184, 1008, 1200},
{ -224, 744, 1144},
{ -288, 704, 888},
{ -240, 560, 760},
{ -312, 512, 616},
{ -272, 344, 504},
{ -336, 376, 464},
{ -440, 360, 544},
{ -488, 288, 720},
{ -520, 328, 792},
{ -520, 360, 832},
{ -568, 424, 768... | { 1264, 552, -280},
{ 1384, 720, -384},
{ 1264, 672, -448},
{ 1424, 536, -376},
{ 1392, 328, -176},
{ 1032, 312, -208},
// 16 seconds
{ 784, 344, -216},
{ 680, 344, -192},
{ 688, 280, -120},
{ 768, 264, -136},
{ 824, 240, -112},
{ 920, 176, -144},
{ 1008, 104, -12... |
{ 592, 376, -528},
{ 816, 288, -288},
{ 1120, 368, -120},
{ 1440, 456, -64},
{ 1744, 432, -160},
{ 1904, 448, -176},
{ 1648, 528, -240},
{ 1144, 520, -400},
{ 840, 496, -328},
{ 696, 520, -352},
{ 712, 520, -376},
{ 776, 512, -408},
{ 816, 504, -392},
{ 888, 616,... |
_count;
static bool prv_result_callback(const char *value, uint32_t value_length,
uint32_t index, void *context) {
strcpy(s_results[s_results_count], value);
s_results_lengths[s_results_count] = value_length;
cl_assert_equal_i(index, s_results_count);
++s_results_count;
retur... | assert_float_parse("-2147483648", 1, true, -2147483648) | |
ETER),
},
};
if (delete) {
activity_sessions_prv_delete_activity_session(&session);
} else {
activity_sessions_prv_add_activity_session(&session);
}
}
// ------------------------------------------------------------------------------------------
// Used from settings_file_each() callback to read in... | (k_oldest_valid_utc) | - 1,
.newest_key = prv_minute_file_get_settings_key(k_newest_valid_utc) + 1,
.oldest_valid_utc = k_oldest_valid_utc,
.newest_valid_utc = k_newest_valid_utc,
};
// Feed in the saved data, reading chunks out of the saved minute data and compressing
// it into algorithm sleep minute structures.
statu... |
Size mark_size = cd->regulatory_marks[start_idx + i]->bounds.size;
overall_size.h = MAX(overall_size.h, mark_size.h);
overall_size.w += mark_size.w;
}
GRect regulatory_marks_rect = (GRect) { .size = overall_size };
// Align the rect based on the display shape
const GAlign alignment = PBL_IF_RECT_ELSE(GA... | PBL_ASSERTN(cell_index->section == 0) | ;
SystemCertificationData *cd = &data->certification_data;
const bool is_selected = menu_layer_is_index_selected(&data->menu_layer, cell_index);
SystemCertificationMenuItem * const item = &cd->menu_items[cell_index->row];
item->draw_cell_fn(ctx, cell_layer, cd, is_selected, item->arg1, item->arg2);
}
static u... |
st before the end of the second B
// Save the current update elapsed
animation_set_elapsed(complex, duration_total - 2 * MIN_FRAME_INTERVAL_MS);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1);
cl_asser... | prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS) | ;
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0... |
w *window) {}
void window_set_click_config_provider_with_context(
struct Window *window, ClickConfigProvider click_config_provider, void *context) {}
void window_set_click_context(ButtonId button_id, void *context) {}
void window_single_repeating_click_subscribe(
ButtonId button_id, uint16_t repeat_interval_ms,... | {
ScrollLayer *scroll_layer = scroll_layer_create(GRect(0,0,180,180));
int16_t page_height = 0;
page_height = scroll_layer->layer.frame.size.h;
scroll_layer_set_paging(scroll_layer, true);
cl_assert_equal_i(page_height, prv_scroll_layer_get_paging_height(scroll_layer));
// paging should force < page_hei... | |
/*
* 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_delete_file_list(bad_file_list) | ;
}
// Return a pointer to the store for the given UUID. Each task that uses persist
// must call persist_service_client_open() to create/open the store during its
// startup and persist_service_client_close() during its shutdown.
//
// The SettingsFile is opened/created lazily. A persist file will not be
// created f... |
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(0)) | ;
cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(1));
cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(2));
cl_assert(!timeline_model_iter_prev(&new_idx, NULL));
}
void test_timeline_model__graceful_delete_middle(void) {... | |
in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "kino_reel_pdcs.h"
#include "appl... | (sequence, 0) | ;
}
return (KinoReel *)reel;
}
KinoReel *kino_reel_pdcs_create_with_resource(uint32_t resource_id) {
ResAppNum app_num = sys_get_current_resource_num();
return kino_reel_pdcs_create_with_resource_system(app_num, resource_id);
}
KinoReel *kino_reel_pdcs_create_with_resource_system(ResAppNum app_num, uint32_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... | (info->filename) | ;
if (total_size == 0) {
// a file of size zero is valid at the moment
return true;
}
int fd = pfs_open(info->filename, OP_FLAG_READ | OP_FLAG_WRITE, FILE_TYPE_STATIC, total_size);
storage->impl_data = (void*)(uintptr_t) fd;
return fd >= 0;
}
uint32_t pb_storage_file_get_max_size(PutBytesObjectType... |
rror));
cl_assert(!error);
}
void test_ancs_util__should_identify_invalid_attr_length(void) {
bool error = false;
cl_assert(!ancs_util_is_complete_notif_attr_response(s_invalid_attribute_length, sizeof(s_invalid_attribute_length),
&error));
cl_assert(error);
}
void test_ancs_util__should_parse_incompl... | (
attr_ptrs[FetchedAttributeIndexAppID],
attr_ptrs[FetchedAttributeIndexTitle],
attr_ptrs[FetchedAttributeIndexSubtitle],
attr_ptrs[FetchedAttributeIndexMessage],
attr_ptrs[FetchedAttributeIndexDate]
) | ;
cl_assert(was_added_to_cache == false);
// Ensure the dupe is no longer detected
ancs_util_reset_notification_cache();
was_added_to_cache = ancs_util_cache_notification(
attr_ptrs[FetchedAttributeIndexAppID],
attr_ptrs[FetchedAttributeIndexTitle],
attr_ptrs[FetchedAttributeIndexSubtitle],
... |
16, -224},
// 31 seconds
{ 984, 112, -288},
{ 1032, 160, -320},
{ 912, 176, -296},
{ 816, 168, -240},
{ 856, 176, -200},
{ 968, 264, -168},
{ 1096, 328, -120},
{ 1216, 384, -152},
{ 1664, 488, -96},
{ 1424, 632, -104},
{ 1368, 664, -176},
{ 1056, 712, -136},
{ 85... | { 1080, 144, -328},
{ 1176, 104, -352},
{ 968, 112, -328},
{ 808, 104, -296},
{ 840, 168, -384},
{ 1136, 256, -352},
{ 1088, 240, -248},
{ 1008, 256, -192},
{ 984, 288, -136},
{ 1024, 288, -80},
{ 1088, 320, -72},
{ 1048, 344, -48},
// 37 seconds
{ 1064, 352, -80}... | |
/*
* 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... | rocky_global_init(s_api) | ;
}
void test_rocky_api_memory__cleanup(void) {
rocky_global_deinit();
jerry_cleanup();
rocky_runtime_context_deinit();
if (!s_skip_pbl_malloc_check) {
fake_pbl_malloc_check_net_allocs();
}
}
void test_rocky_api_memory__event(void) {
cl_assert_equal_b(false, rocky_global_has_event_handlers("memorypre... |
tm *sys_gmtime_r(const time_t *timep, struct tm *result) {
return gmtime_r(timep, result);
}
struct tm *sys_localtime_r(const time_t *timep, struct tm *result) {
return localtime_r(timep, result);
}
// i18n dummies
////////////////////////////////////
static bool s_i18n_translate = false;
static bool s_i18n_local... | cl_assert_equal_s(tmbuf, "13 1") | ;
#endif
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%H %I", &jan_2_2015__13_00_00);
cl_assert_equal_s(tmbuf, "13 01");
tmbuf[0] = '\0';
strftime(tmbuf, sizeof(tmbuf), "%j %m %M %p", &jan_2_2015__13_00_00);
cl_assert_equal_s(tmbuf, "002 01 00 PM");
#if EXTENSION_GNU
tmbuf[0] = '\0';
strftime(tmb... |
nfig) {
.layer = indicator_layer,
.colors.foreground = gcolor_legible_over(card_bg_color),
.colors.background = card_bg_color,
});
}
static void prv_refresh_content_indicators(HealthCardView *health_card_view) {
prv_content_indicator_setup_direction(health_card_view,
... | (NUM_MID_FRAMES) | |
required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#inc... | gbitmap_destroy(s_dest_bitmap) | ;
const GRect *drawing_box = use_screen ? &DISP_FRAME : box;
const GSize bitmap_size = drawing_box->size;
s_dest_bitmap = gbitmap_create_blank(bitmap_size, GBITMAP_NATIVE_FORMAT);
s_ctx.dest_bitmap = *s_dest_bitmap;
s_ctx.draw_state.clip_box.size = bitmap_size;
s_ctx.draw_state.drawing_box = *drawing_box;... |
((bus->i2c->SR2 & I2C_SR2_BUSY) != 0) {
bus_reset(bus_idx);
if (!wait_for_busy_clear(bus_idx)) {
// Bus did not recover after reset
bus_unlock(bus);
return false;
}
}
// Take binary semaphore so that next take will block
PBL_ASSERT(semaphore_take(bus), "Could not acquire semaphore ... | do_transfer(device_id, false, i2c_device_address, register_address_start, write_size, (uint8_t*)buffer) | ;
if (!result) {
PBL_LOG(LOG_LEVEL_ERROR, "Write failed on bus %" PRId8, BOARD_CONFIG.i2c_device_map[device_id]);
}
return result;
}
/*------------------------INTERRUPT FUNCTIONS--------------------------*/
//! End a transfer and disable further interrupts
//! Only call from interrupt functions
static por... |
/*
* 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 offset_16 ? sizeof(OffsetTableEntry_4_2) : sizeof(OffsetTableEntry_4_4);
} |
}
static int prv_offset_table_get_id(const FontMetaData *md, Codepoint codepoint) {
if (FONT_VERSION(md->version) == FONT_VERSION_1) {
return (1);
} else {
return prv_font_hash(codepoint, md->hash_table_size);
}
}
static int prv_load_offset_table(Codepoint codepoint, FontCache *font_cache,
... |
d_and_enabled(void) {
return (prv_hw_and_sw_supports_hrm() &&
activity_prefs_heart_rate_is_enabled());
}
static void prv_reset_subscriptions(void);
static bool prv_free_permission_for_each_cb(ListNode *node, void *unused) {
kernel_free(node);
return true; // continue iteration
}
static void prv_free... | prv_copy_sharing_devices(sharing_to_devices,
ARRAY_LENGTH(sharing_to_devices)) | ;
bt_driver_hrm_service_handle_measurement(&measurement, sharing_to_devices, num_devices);
}
static void prv_start_hrm_kernel_main(void *unused) {
PBL_LOG(LOG_LEVEL_INFO, "BLE HRM sharing started");
s_ble_hrm_session.service_info = (EventServiceInfo) {
.type = PEBBLE_HRM_EVENT,
.handler = prv_ble_hrm_han... |
nt duration_b = 200;
const int duration_c = 500;
const int repeat_count = 5;
int duration_total = duration_a + MAX(duration_b, duration_c);
// Create 3 animations
Animation *a = prv_create_test_animation();
animation_set_duration(a, duration_a);
Animation *b = prv_create_test_animation();
animation_se... | cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2) | |
DIALOG_BOOTROM_UART_BAUDRATE);
}
periph_config_release_lock();
}
static void prv_deinit_dialog_bootrom_interface(void) {
periph_config_acquire_lock();
if (prv_platform_uses_two_uart_peripherals()) {
uart_deinit(BT_RX_BOOTROM_UART);
uart_deinit(BT_TX_BOOTROM_UART);
} else {
uart_deinit(BT_RX_BOO... | (LOG_LEVEL_ERROR, "Bootrom did not accept header (0x%x)", c) | |
size_t buffer_size = sizeof("000");
GTextNodeText *number_text_node = health_util_create_text_node(buffer_size, number_font,
TEXT_COLOR, container);
active_window->workout_controller->metric_to_string(metric_type,
... | active_window->workout_controller->metric_to_string(metric_type,
(char *)number_text_node->text, buffer_size, i18n_owner, active_window->workout_data) | |
3PeriphResetCmd(ahb3_periphs, DISABLE);
RCC_APB1PeriphResetCmd(apb1_periphs, ENABLE);
RCC_APB1PeriphResetCmd(apb1_periphs, DISABLE);
RCC_APB2PeriphResetCmd(apb2_periphs, ENABLE);
RCC_APB2PeriphResetCmd(apb2_periphs, DISABLE);
// The Cortex-M user guide states that the reset values for the core registers
//... | ("Failed to start firmware, strike one.") | ;
boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE);
}
return false;
}
static bool prv_prf_button_combination_is_pressed(void) {
return (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK)
&& button_is_pressed(BUTTON_ID_SELECT) && !button_is_pressed(BUTTON_ID_DOWN));
}
static bool chec... |
.start = 0x1,
.end = 0x3000
};
ATTHandleRange range_alt = {
.start = 0x3001,
.end = 0x4000
};
cl_assert_equal_b(fake_gatt_is_service_discovery_running(), false);
// start a discovery job, pretend nothing is found
gatt_client_discovery_discover_range(connection, &range);
cl_assert_equal_b(... | cl_assert_equal_i(service->att_handle, service_handle) | ;
cl_assert_equal_b(uuid_equal(&service->uuid, &bp_service->uuid), true);
cl_assert_equal_i(service->num_att_handles_included_services, bp_service->num_included_services);
cl_assert_equal_i(service->num_characteristics, bp_service->num_characteristics);
const GATTCharacteristic *characteristic_one = service->c... |
Periph_CAN1 | RCC_APB1Periph_CAN2
| RCC_APB1Periph_PWR | RCC_APB1Periph_DAC | RCC_APB1Periph_UART7
| RCC_APB1Periph_UART8;
const uint32_t apb2_periphs =
RCC_APB2Periph_TIM1 | RCC_APB2Periph_TIM8 | RCC_APB2Periph_USART1 |
RCC_APB2Periph_USART6 | RCC_APB2Periph_ADC | RCC_APB2Periph_ADC1 |
RCC_APB2Pe... | {
dbgserial_putstr("Software failure caused a reset");
} |
// Clean up after the last failure.
boot_bit_clear(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED);
// We have a "three strikes" algorithm: if the watch fails three times, return true
// to tell the parent we should load the recovery firmware. A reset for any other reason
// will reset this algorithm.
if (boot_bit_t... |
ength;
uint8_t complete;
} FlashEraseResponse;
typedef struct PACKED {
uint32_t address;
uint8_t data[];
} FlashWriteRequest;
typedef struct PACKED {
uint32_t address;
uint32_t length;
} FlashReadRequest;
typedef struct PACKED {
uint32_t address;
uint32_t length;
} FlashCRCRequest;
typedef struct PACK... | flash_sector_is_erased(sector * SECTOR_SIZE_BYTES + addr) | ) {
return false;
}
}
return true;
}
static void prv_handle_ping_request(const void *payload, uint32_t length) {
// echo it back
prv_send_frame(OPCODE_PING, payload, length);
}
static void prv_handle_disconnect_request(const void *payload, uint32_t length) {
if (length) {
// should be 0
PB... |
672, -808},
{ -104, 680, -768},
{ -104, 888, -792},
{ -208, 504, -712},
{ -64, 632, -1096},
{ -208, 440, -704},
{ -40, 832, -968},
{ -160, 536, -752},
{ -56, 792, -808},
{ -136, 568, -704},
{ -56, 704, -880},
{ -136, 480, -848},
{ -48, 824, -864},
{ -88, 560, -744},
... | { -80, 536, -896},
{ -120, 424, -960},
{ -80, 464, -896},
{ -72, 440, -1016},
{ -64, 368, -896},
{ -64, 624, -992},
{ -176, 432, -800},
{ -80, 560, -1120},
// 73 seconds
{ -160, 560, -864},
{ -88, 640, -880},
{ -160, 256, -960},
{ -128, 504, -936},
{ -184, 448, -8... | |
k(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_across_x_offset_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_nx_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_across_nx_offse... | (gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 2);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
#endif
// AA = true, SW = 3
setup_t... |
ense 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 "accessory_imaging.h"
#include "console/prompt.h"
#include "drivers/accessory.h"
#i... | new_timer_start(s_timeout_timer, TIMEOUT_MS, prv_timeout_timer_cb, NULL, 0 /* flags */) | ;
PBL_LOG(LOG_LEVEL_DEBUG, "Starting accessory imaging");
}
static void prv_stop(void *context) {
if (s_no_buffer_count > 0) {
PBL_LOG(LOG_LEVEL_ERROR, "Ran out of buffers %d times and dropped %d bytes while imaging",
s_no_buffer_count, s_dropped_char_count);
}
flash_prf_set_protection(true);
... |
.draw_box = box,
.box = { gpoint_add(box->origin, node->offset), box->size },
.render = render,
.size_out = &node->cached_size,
};
}
static bool prv_should_draw_text_node(GTextNode *node, GContext *ctx, const GRect *box,
bool render) {
if (!render && node->cach... | prv_init_draw_context(&contexts[0], root_node, gcontext, box, config, render) | ;
for (int level = 0; level >= 0;) {
PBL_ASSERTN(level < MAX_DRAW_DEPTH);
GTextNodeDrawContext *ctx = &contexts[level];
GTextNodeDrawContext *parent_ctx = (level > 0) ? &contexts[level - 1] : NULL;
// We have entered here either by ascending (the continue in the ascent branch below) or by
// movi... |
app name cache
for (int i = 0; i < 4; ++i) {
prv_send_notification((uint8_t *)&s_app_name_title_dict);
prv_cmp_last_received_notification(&s_app_name_title_parsed_item);
}
// Test an unrecognized app with a duplicated title
prv_send_notification((uint8_t *)&s_unknown_app_dict);
prv_cmp_last_received_... | ((uint8_t *)&s_complete_dict) | ;
// The retry fails and we give up on this one
cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 1);
// And make sure we get to a state where we can handle more messages
s_gatt_client_op_write_should_fail_unlimited = false;
prv_send_notification((uint8_t *)&s_complete_dict);
... |
/ Transcription type
0x02, // Sentence count
// Sentence #1
0x02, 0x00, // Word count
// Word #1
85, // Confidence
0x05, 0x00, // Word length
'H', 'e', 'l', 'l', 'o',
// Word #2
74, // Confidence
0x08, 0x00, // Word length
'c', 'o', 'm', '... | generic_attribute_find_attribute(attr_list1, VEAttributeIdAppUuid,
sizeof(data1) - sizeof(Uuid)) | |
/*
* 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... | task_zalloc_check(sizeof(*window)) | ;
Window *result = &window->window;
window_init(result, description.debug_name);
window_set_fullscreen(result, description.full_screen);
window_set_background_color(result, window_color);
text_layer_init(&window->text, &GRect(0, 40, 144, 40));
text_layer_set_text(&window->text, description.debug_name);
l... |
IORITY;
}
*node = (EvictListNode) {
.id = id,
.size = entry.total_size,
.priority = MAX(priority, prv_calculate_priority(&entry)),
};
data->list = (EvictListNode *)list_sorted_add((ListNode *)data->list, (ListNode *)node,
evict_node_comparator, false);
data->bytes_in_list += node->size;
... | {
AppInstallId id;
// examine the SettingsRecordInfo and extract the AppInstallId from it
info->get_key(file, (uint8_t *)&id, info->key_len);
// the context passed in is really a pointer to the resource_list
PFSFileListEntry **resource_list = context;
PFSFileListEntry *iter = *resource_list;
while (iter) ... |
// Delete files from resource_list that don't correspond to entries in the app cache
static void prv_app_cache_find_and_delete_orphans(PFSFileListEntry **resource_list) {
mutex_lock_recursive(s_app_cache_mutex);
SettingsFile file;
status_t rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE)... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (
flash_address + sizeof(FirmwareDescription), &firmware_description) | ) {
dbgserial_putstr("Invalid firmware CRC in SPI flash!");
return UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED;
}
erase_old_firmware(firmware_description.firmware_length);
write_new_firmware(
flash_address + sizeof(FirmwareDescription),
firmware_description.firmware_length);
if (!check_firmware... |
/*
* 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 true; // continue iteration
} |
// Compare timestamps (this should omit most reminders)
ReminderInfo *reminder_info = (ReminderInfo *)context;
SerializedTimelineItemHeader header;
info->get_val(file, (uint8_t *)&header, sizeof(SerializedTimelineItemHeader));
if (reminder_info->timestamp != header.common.timestamp) {
return true; // co... |
{
prv_fill_points(points, points_num);
points_num = 0;
ADD_P(step->pt);
break;
} |
case RockyAPIPathStepType_LineTo: {
ADD_P(step->pt);
break;
}
case RockyAPIPathStepType_Arc: {
rv = rocky_error_argument_invalid("fill() does not support arc()");
goto cleanup;
}
}
}
rv = jerry_create_undefined();
prv_fill_points(points, points_num);
... | |
DEG_TO_TRIGANGLE(180), GSize(2, 4));
cl_assert_equal_grect(resulting_rect3, GRect(3, 4, 2, 4));
}
void test_graphics_circle__grect_centered_internal(void) {
GPointPrecise p1 = GPointPrecise(0, 0);
// GRectZero + standardize
cl_assert_equal_grect(GRect(0, 0, 0, 0), grect_centered_internal(&p1... | GRect(-1, -5, 2, 2) | ;
grect_polar_calc_values(&r, mode, ¢er, &radius);
cl_assert_gpoint_precise(center, -0.5, -4.5);
cl_assert_fixedS16_3(radius, 0.5);
}
void test_graphics_circle__grect_polar_calc_values_standardizes(void) {
GPointPrecise center = {};
Fixed_S16_3 radius = {};
const GOvalScaleMode mode = GOvalScaleModeFit... |
/*
* 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;
} |
kino_layer_deinit(kino_layer);
applib_free(kino_layer);
}
Layer *kino_layer_get_layer(KinoLayer *kino_layer) {
if (kino_layer) {
return &kino_layer->layer;
} else {
return NULL;
}
}
void kino_layer_set_reel(KinoLayer *kino_layer, KinoReel *reel, bool take_ownership) {
kino_player_set_reel(&kino_... |
{
s_debounce_timer_handle = new_timer_create();
periph_config_acquire_lock();
gpio_use(BOARD_CONFIG_POWER.vusb_stat.gpio);
gpio_use(BOARD_CONFIG_POWER.chg_stat.gpio);
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStruc... |
prv_battery_set_charge_enable(true);
gpio_release(BOARD_CONFIG_POWER.chg_en.gpio);
}
}
if (BOARD_CONFIG_POWER.has_vusb_interrupt) {
periph_config_release_lock();
exti_configure_pin(BOARD_CONFIG_POWER.vusb_exti, ExtiTrigger_RisingFalling,
battery_vusb_interrupt_handler);
exti_e... | |
L_HEIGHT 32
// Stubs
////////////////////////////////////
static GRect s_graphics_draw_bitmap_in_rect__rect = GRectZero;
void graphics_draw_bitmap_in_rect(GContext* ctx, const GBitmap *src_bitmap, const GRect *rect) {
s_graphics_draw_bitmap_in_rect__rect = *rect;
}
bool graphics_release_frame_buffer(GContext *ctx, ... | (scroll_layer) | .y));
}
void test_scroll_layer__paging_with_scroll(void) {
ScrollLayer *scroll_layer = scroll_layer_create(GRect(0,0,180,180));
int16_t page_height = 0;
page_height = scroll_layer->layer.frame.size.h;
scroll_layer_set_paging(scroll_layer, true);
cl_assert_equal_i(page_height, prv_scroll_layer_get_paging_hei... |
buted under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "gdraw_command_transforms.h"
#include "applib/applib_malloc.auto... | (point, GPOINT_PRECISE_PRECISION) | ;
}
const uint32_t lookup_length = lookup->values.num_points;
for (uint16_t j = 0; j < lookup_length; j++) {
if (gpoint_equal(&point, &lookup->values.points[j])) {
lookup->iter.lookup->index_lookup[lookup->iter.current_index] = j;
break;
}
}
lookup->iter.current_index++;... |
ed by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "... | framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}) | ;
test_graphics_context_init(&s_ctx, fb);
framebuffer_clear(fb);
// Setup resources
fake_spi_flash_init(0, 0x1000000);
pfs_init(false);
pfs_format(true /* write erase headers */);
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */);
resource_init(... |
/*
* 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_offset_to_address(destination, info->sym_table_addr) | ;
*pbl_jump_table_addr = (uint32_t)&g_pbl_system_tbl;
//
// offset any relative addresses, as indicated by the reloc table
// TODO PBL-1627: insert link to the wiki page I'm about to write about PIC and relocatable
// values
//
// an array of app-relative pointers to addresses needing an ... |
ALID_ARGUMENT);
rv = pfs_write(0, NULL, 0);
cl_assert(rv == E_INVALID_ARGUMENT);
uint8_t buf[10];
int fd = pfs_open("newfile", OP_FLAG_WRITE | OP_FLAG_READ,
FILE_TYPE_STATIC, sizeof(buf));
for (int i = 0; i < sizeof(buf); i++) {
buf[i] = i;
}
rv = pfs_write(fd, NULL, sizeof(buf));
cl_assert(... | (rv == E_INVALID_ARGUMENT) | |
ific language governing permissions and
* limitations under the License.
*/
#include "simple_dialog.h"
#include "applib/applib_malloc.auto.h"
#include "applib/fonts/fonts.h"
#include "applib/ui/bitmap_layer.h"
#include "applib/ui/dialogs/dialog.h"
#include "applib/ui/dialogs/dialog_private.h"
#include "applib/ui/la... | prv_get_text_box(frame.size, icon_size, icon_top_margin_px, &text_box) | ;
const uint16_t text_height = prv_get_rendered_text_height(dialog->buffer, &text_box);
if (text_height <= TEXT_LINE_HEIGHT_PX) {
const int additional_icon_top_offset_for_single_line_text_px = 13;
// Move the icon down by increasing the margin to vertically center things
icon_top_margin_px += addition... |
adius, (TRIG_MAX_ANGLE / 4));
cl_assert_equal_gpoint(result, GPoint(5, 0));
// 270 (90 * 3) degrees should be (-5, 0)
result = gpoint_from_polar_internal(&origin_center, radius, (TRIG_MAX_ANGLE * 3 / 4));
cl_assert_equal_gpoint(result, GPoint(-5, 0));
const GPoint offset_center = GPoint(1, 1);
// 90 degree... | (4, 4, 2, 2) | , grect_centered_internal(&p2, GSize(2, 2)));
p2.x.raw_value += FIXED_S16_3_HALF.raw_value;
cl_assert_equal_grect(GRect(5, 4, 2, 2), grect_centered_internal(&p2, GSize(2, 2)));
// Repeat for a positive offset center point with 0.5 fractions
GPointPrecise p3 = GPointPreciseFromGPoint(GPoint(5, 5));
p3.x.raw_v... |
2_t curr_ticks = rtc_get_ticks();
if (curr_ticks < timeout) {
uint16_t wait_time = (timeout - curr_ticks) / RTC_TICKS_HZ;
*secs_to_wait = MAX(1, wait_time);
} else {
*secs_to_wait = 0;
}
}
return state;
}
/*
* LE connection manager handling for a gateway connection
*/
static void ... | if (curr_ticks >= curr_request->timeout) {
list_remove(&curr_request->list_node, (ListNode **)&conn_mgr_info->requests, NULL);
kernel_free(curr_request);
} |
}
curr_request = next;
}
// Note: As an optimization, we could track how long we have been in a lower
// latency state and subtract that from higher latency requests, but most of
// the time we should be in the maximum latency (low power) state anyway
// get & set the new state
prv_handle_respons... |
/*
* 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... | {
switch (packet->code) {
case ControlCode_ProtocolReject:
prv_on_protocol_reject(this, packet);
return true;
case ControlCode_EchoRequest:
prv_on_echo_request(this, packet);
return true;
case ControlCode_EchoReply:
prv_on_echo_reply(this, packet);
return true;
case... |
static PPPControlProtocolState s_lcp_state = {};
static PPPControlProtocol s_lcp_protocol = {
.protocol_number = LCP_PROTOCOL_NUMBER,
.state = &s_lcp_state,
.on_this_layer_up = prv_on_lcp_up,
.on_this_layer_down = prv_on_lcp_down,
.on_receive_code_reject = prv_on_code_reject,
.on_receive_unrecognized_cod... |
/*
* 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 (charge.is_charging) {
status_led_set(StatusLedState_Charging);
} else {
status_led_set(StatusLedState_FullyCharged);
}
} | else {
status_led_set(StatusLedState_Off);
}
data->was_plugged = charge.is_plugged;
data->last_dialog_state = next_dialog_state;
}
static void prv_handle_init(void) {
struct AppData *data = app_malloc_check(sizeof(struct AppData));
*data = (struct AppData){};
app_state_set_user_data(data);
data->d... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_ASSERTN(config) | ;
return ((config->num_frames_in + config->num_frames_mid + config->num_frames_out) *
ANIMATION_TARGET_FRAME_INTERVAL_MS);
}
static int64_t prv_interpolate_moook(
int32_t normalized, int64_t from, int64_t to, const int32_t *frames_in, int32_t num_frames_in,
const int32_t *frames_out, int32_t num_fr... |
/*
* 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_init() | ;
prv_print_banner(true);
// This registers the power manager callbacks for the SPI adapter.
ad_spi_init();
/* Initialize BLE Adapter */
ad_ble_init();
/* Initialize BLE Manager */
ble_mgr_init();
host_transport_init();
prv_print_banner(false);
/* the work of the SysInit task is done */
tas... |
"util/attributes.h"
#include "util/list.h"
#include <stdlib.h>
// Stubs
///////////////////////////////////////
#include "stubs_logging.h"
#include "stubs_passert.h"
#include "stubs_pbl_malloc.h"
#include "stubs_rand_ptr.h"
// Fakes
///////////////////////////////////////
#include "fake_app_manager.h"
#include "fake... | (CommSessionRunState) | ;
app_run_state_send_update(&s_app_uuid, NOT_RUNNING);
cl_assert_equal_i(s_launcher_deprecated_messages, 1);
cl_assert_equal_i(s_app_run_state_messages, 1);
// Changing the remote should change the flags and use launcher_app_message
// if app_run_state not supported
prv_set_remote_active();
app_run_state... |
/*
* 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... | {
VibeScoreId curr_score = starting_score;
while ((curr_score = vibe_score_info_cycle_next(client, curr_score),
curr_score != starting_score)) {
curr_score_index = (curr_score_index + 1) % scores_size;
cl_assert_equal_i(scores[curr_score_index], curr_score);
}
} |
void test_vibe_score_info__cycle_next_notifications(void) {
const VibeScoreId notification_scores[] = {
VibeScoreId_Disabled,
VibeScoreId_StandardShortPulseLow,
VibeScoreId_StandardShortPulseHigh,
VibeScoreId_Pulse,
VibeScoreId_NudgeNudge,
VibeScoreId_Jackhammer,
VibeScoreId_Mario,
};
... |
uint8_t add_top = (add_on_top)? (FIXED_S16_3_ONE.raw_value / 2) : 0;
uint8_t add_bottom = (!add_on_top)? (FIXED_S16_3_ONE.raw_value / 2) : 0;
const int8_t fraction_mask = 0x7;
if (vertical) {
// Left and right most point helpers for main loop
GPointPrecise lm_p0 = far_top;
GPointPrecise lm_p1 = ... | if (rm_p1.y.raw_value != rm_p0.y.raw_value) {
right_margin.raw_value = rm_p0.x.raw_value + ((rm_p1.x.raw_value - rm_p0.x.raw_value)
* (y - ((rm_p0.y.raw_value + add_bottom) / FIXED_S16_3_ONE.raw_value)))
* FIXED_S16_3_ONE.raw_value / (rm_p1.y.raw_value - rm_p0.y.raw_value);
} e... |
}
// Find edges for both caps
prv_calc_cap_horiz(&p0, radius, y, &left_margin, &right_margin);
prv_calc_cap_horiz(&p1, radius, y, &left_margin, &right_margin);
// Finally draw line
if (left_margin.raw_value <= right_margin.raw_value) {
graphics_private_draw_horizontal_line... |
pushed onto the app stack has regained focus,
// this is also done by checking the last event.
event = fake_event_get_last();
cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT);
cl_assert_equal_i(event.app_focus.in_focus, true);
cl_assert_equal_i(window1->on_screen, true);
window_stack_re... | stub_pebble_tasks_set_current(PebbleTask_App) | ;
window_stack_push(stack, window, true);
cl_assert_equal_i(window->on_screen, 1);
cl_assert_equal_i(window_stack_count(stack), 1);
// Ensure the load handler was called
cl_assert_equal_i(prv_get_load_unload_count(), 1);
// Ensure the appear handler was called
cl_assert_equal_i(prv_get_appear_disappea... |
empt < max_attempts; attempt++) {
if (!gpio_input_read(&dev->int_gpio)) {
break;
}
system_task_watchdog_feed();
psleep(1);
}
return (attempt < max_attempts);
}
// Wait for the INT line to go high. Return true if it went high before timing out
static bool prv_wait_int_high(HRMDevice *dev) {
... | {
PBL_LOG(LOG_LEVEL_DEBUG, "Missing interrupt count: %"PRIu8" ", s_missing_interrupt_count);
} |
}
// Enable the watchdog timer. This gets enabled when we enable the sensor and detects if
// the sensor stops generating interrupts.
static void prv_enable_watchdog(HRMDevice *dev) {
mutex_assert_held_by_curr_task(dev->state->lock, true);
s_as7000_watchdog_timer = (RegularTimerInfo) {
.cb = prv_watchdog_time... |
_net_allocs(), 0);
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture,
1421178000), 0);
cl_assert_equal_i(prv_num_items(iterator), 6);
// Thursday Jan 16 00:00:00 PST 2015
// No items within window
rtc_set_time(1421395200);
head = NULL;
... | (uuid_equal(&state.pin.header.id, &s_items[4].header.id)) | |
ams_util__float_string_parse_not_a_number(void) {
// "hello" * 3
assert_float_parse("hello", 3, false, 0);
// " " * 3
assert_float_parse(" ", 3, false, 0);
}
void test_ams_util__float_string_parse_no_fraction(void) {
// "42" * 3
assert_float_parse("42", 3, true, 42 * 3);
}
void test_ams_util__float_string... | ams_util_csv_parse(multi_values, sizeof(multi_values), NULL,
prv_result_callback) | ;
cl_assert_equal_i(s_results_count, 1);
cl_assert_equal_i(count, 1);
assert_result(0, "A", 1);
}
void test_ams_util__csv_null_in_the_middle(void) {
const char null_middle_value[] = "A\x00 BCD,1234";
cl_assert(sizeof(null_middle_value) > 2);
const uint8_t count = ams_util_csv_parse(null_middle_value, sizeo... |
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 specific l... | {
timeline_item_free_allocated_buffer(reminder);
return true; // continue iteration
} | |
nd store our total duration (used by the scheduler to tell when it's done)
animation->duration_ms = prv_get_total_duration(state, animation, false /*delay*/,
false /*play_count*/);
for (child_idx = 0; child_idx < ANIMATION_MAX_CHILDREN; child_idx++) {
A... | {
if (!child->abs_start_time_ms) {
success = prv_schedule_animation(state, now, child, delay);
}
} |
}
// Set the duration now, after we've possibly adjusted the children delays to compensate
// for already scheduled children.
animation->duration_ms = prv_get_total_duration(state, animation, false /*delay*/,
false /*play_count*/);
} else {
PB... |
1256, 216, -32},
{ 1088, 232, -120},
{ 1296, 176, -120},
{ 1080, 152, -224},
{ 1024, 144, -192},
{ 920, 160, -216},
{ 1064, 168, -184},
{ 1032, 200, -144},
{ 936, 232, -120},
{ 912, 264, -96},
{ 960, 296, -56},
{ 1056, 328, -24},
{ 1056, 352, -64},
{ 992, 352, -96},
... | { 1096, 336, 32},
{ 1176, 288, 0},
{ 1056, 288, -168},
{ 920, 216, -240},
{ 992, 144, -120},
{ 880, 72, -24},
{ 920, 184, -256},
{ 1200, 240, -304},
// 54 seconds
{ 1456, 272, -184},
{ 1184, 288, -72},
{ 1000, 264, -176},
{ 1072, 280, -144},
{ 1184, 312, -80},
... |
{ 1080, 272, -136},
{ 1040, 312, -96},
{ 1104, 328, -32},
{ 1192, 360, -16},
{ 1032, 384, -24},
{ 1136, 408, -48},
{ 1432, 488, 8},
{ 1136, 592, 176},
{ 1024, 752, -72},
{ 1264, 776, -72},
{ 1168, 528, -96},
{ 968, 472, -80},
{ 1120, 584, -48},
{ 1456, 616, -32},... |
/*
* 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... | (&p, 1, s_offset) | ;
s_radius = radius;
s_circle_stroke_count++;
}
void graphics_fill_circle(GContext* ctx, GPoint p, uint16_t radius) {
s_fill_points = prv_copy_points(&p, 1, s_offset);
s_radius = radius;
s_circle_fill_count++;
}
void graphics_context_move_draw_box(GContext* ctx, GPoint offset) {
s_offset = offset;
}
void... |
opy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the... | bmi160_read_reg(reg) | ;
new_val &= ~mask;
new_val |= value;
prv_write_reg(reg, new_val);
}
static void prv_run_command(uint8_t command) {
prv_write_reg(BMI160_REG_CMD, command);
if (command == BMI160_CMD_SOFTRESET) {
s_accel_power_mode = BMI160_Accel_Mode_Suspend;
s_gyro_power_mode = BMI160_Gyro_Mode_Suspend;
}
}
stati... |
/*
* 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_iso8601_base_week(t) | ;
if (week == 0) {
return -1;
} else if (week > prv_year_week_count(year, t, 4, 3)) {
// 53 weeks if the current year started on a Thursday,
// orrrrr Wednesday and this year is a leap year.
return 1;
} else {
return 0;
}
}
static int prv_iso8601_year(const struct tm *t) {
const int year ... |
s_unscheduled_completed = completed;
cl_assert_equal_p(cb_data, s_unscheduled_cb_data);
}
void test_gap_le_advert__initialize(void) {
fake_GAPAPI_init();
s_unscheduled_cb_count = 0;
s_unscheduled_job = NULL;
s_unscheduled_completed = false;
// This bypasses the work-around for the CC2564 advertising bug... | (regular_timer_seconds_count(), 0) | ;
free(ad);
}
void test_gap_le_advert__single_job_multiple_terms_silence_and_loop_around(void) {
BLEAdData *ad = create_ad("yo", NULL);
GAPLEAdvertisingJobTerm advert_terms[] =
{
{
.min_interval_slots = 160,
.max_interval_slots = 240,
.duration_secs = 1,
},
{
.min_interval... |
UUID, but only if the
// BT SIG Base UUID is used.
Uuid service_uuids[2];
size_t num_uuids = 0;
#if CAPABILITY_HAS_BUILTIN_HRM
// NOTE: The HRM service has to be first in the list because otherwise the Pebble won't
// show up as an HRM device in Strava for Android...
if (ble_hrm_is_supported_and_enabled()... | {
prv_schedule_ad_job();
} |
}
bt_unlock();
}
// -----------------------------------------------------------------------------
void gap_le_slave_discovery_init(void) {
bt_lock();
{
PBL_ASSERTN(!s_discovery_advert_job);
}
bt_unlock();
}
// -----------------------------------------------------------------------------
void gap_le_s... |
ash_read_bytes(&flash_hdr, CORE_DUMP_FLASH_START, sizeof(flash_hdr));
if (flash_hdr.magic != CORE_DUMP_FLASH_HDR_MAGIC) {
prv_flash_erase_region(CORE_DUMP_FLASH_START, SUBSECTOR_SIZE_BYTES);
flash_hdr = (CoreDumpFlashHeader) {
.magic = CORE_DUMP_FLASH_HDR_MAGIC,
.unformatted = CORE_DUMP_ALL_UNFOR... | RETURNS_TO_PSP(s_saved_registers.core_reg[portCANONICAL_REG_INDEX_LR]) | ) {
// The core dump handler got invoked from another exception, therefore the
// running task was interrupted by an exception.
// Get R0-R3, R12, R14, PC, xpsr for the task off the process stack used
// by the task.
// The information for this task is going to be incorrect: the values of
... |
*/);
fake_comm_session_cleanup();
}
void test_music_endpoint__ignore_now_playing_while_not_connected(void) {
// Don't connect app, but receive Now Playing info. Should be ignored:
prv_receive_and_assert_all(false /* expect_is_handled */);
}
void test_music_endpoint__ignore_now_playing_while_other_server_conne... | music_needs_user_to_start_playback_on_phone() | , false);
for (MusicCommand cmd = 0; cmd < NumMusicCommand; ++cmd) {
bool expect_supported = true;
if (cmd == MusicCommandAdvanceRepeatMode ||
cmd == MusicCommandAdvanceShuffleMode ||
cmd == MusicCommandSkipForward ||
cmd == MusicCommandSkipBackward ||
cmd == MusicCommandLike |... |
= 0,
.type = TimelineItemActionTypeDismiss,
.attr_list = dismiss_action_attr_list,
},
{
.id = 1,
.type = TimelineItemActionTypeOpenWatchApp,
.attr_list = open_app_action_attr_list,
}
},
};
// Note: it's fine if this returns null, since the parent funct... | {
AttributeList notif_attr_list = {0};
const char *body = i18n_get("Wish you could get daily updates on your "
"activity and sleep progress? You can! "
"Check out your stats with Pebble Health.",
¬if_attr_list);
prv_build... |
LayoutIdNotification, ¬if_attr_list,
&action_group);
i18n_free_all(¬if_attr_list);
attribute_list_destroy_list(¬if_attr_list);
attribute_list_destroy_list(&dismiss_action_attr_list);
... |
0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the Lic... | cl_assert_equal_i(app_data.flags, app_data_out.flags) | |
l_assert_equal_s(dstbuf, "0zero");
// Length modifiers
uint64_t hurf = 0x123456789ABCDEF0ULL;
snprintf(dstbuf, 256, "%hho,%ho,%o,%lo", hurf, hurf, hurf, hurf);
cl_assert_equal_s(dstbuf, "360,157360,23257157360,23257157360");
snprintf(dstbuf, 256, "%llo,%jo", hurf, hurf);
cl_assert_equal_s(dstbuf, "11064254... | {
char dstbuf[256];
// Simple %X
snprintf(dstbuf, 256, "There are %X lights, %X", 16, -4);
cl_assert_equal_s(dstbuf, "There are 10 lights, FFFFFFFC");
// Alternate form (adds 0X prefix)
snprintf(dstbuf, 256, "There are %#X lights, %#X", 16, -4);
cl_assert_equal_s(dstbuf, "There are 0X10 lights, 0XFFFFFF... |
// Minimum digits output (negative digits, acts as zero)
snprintf(dstbuf, 256, "%.-3Xzero%.-3X", 0, 1);
cl_assert_equal_s(dstbuf, "zero1");
// Minimum digits output (non-zero digits outputting zero)
snprintf(dstbuf, 256, "%.1Xzero%.1X", 0, 1);
cl_assert_equal_s(dstbuf, "0zero1");
// Variable length cha... |
id) {
if (s_erase.in_progress && !s_erase.suspended) {
// If an erase is in progress, make sure it gets at least a mininum time slice to progress.
// If not, the successive kicking of the suspend timer could starve it out completely
psleep(100);
task_watchdog_bit_set(s_erase.task);
status_t status... | (s_flash_lock) | ;
PBL_ASSERTN(s_erase.in_progress == false);
s_erase = (struct FlashEraseContext) {
.in_progress = true,
.task = pebble_task_get_current(),
.retries = retries,
// FIXME: We should just assert that the address is already aligned. If
// someone is depending on this behaviour without already knowing th... |
p window results in Unfocused
modal_manager_event_loop_upkeep();
cl_assert_equal_i(modal_manager_get_properties(),
ModalProperty_Exists | ModalProperty_CompositorTransitions |
ModalProperty_RenderRequested | ModalProperty_Unfocused);
// Checks are listed from top to bottom
... | modal_window_push(window1, ModalPriorityGeneric, false) | ;
modal_manager_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_e... |
cher_app_glance_structured_get_data(structured_glance);
PBL_ASSERTN(settings_glance);
// Battery text (if not plugged in), battery icon, and (if plugged in) a lightning bolt icon
const size_t max_horizontal_nodes = 3;
GTextNodeHorizontal *horizontal_container_node =
graphics_text_node_create_horizontal(m... | {
return (alerts_get_mask() == AlertMaskPhoneCalls);
} |
static uint32_t prv_get_resource_id_for_connectivity_status(
LauncherAppGlanceSettings *settings_glance) {
#if CAPABILITY_HAS_BUILTIN_HRM
if (settings_glance->glance_state.is_sharing_hrm) {
return RESOURCE_ID_CONNECTIVITY_SHARING_HRM;
}
#endif
if (settings_glance->glance_state.is_airplane_mode_enabled) ... |
duration_string = "30:00",
.distance_string = "5.0",
.pace_string = "6:00",
};
WorkoutMetricType top_metric = WorkoutMetricType_Duration;
WorkoutMetricType middle_metric = WorkoutMetricType_Distance;
WorkoutMetricType scrollable_metrics[] = {WorkoutMetricType_Pace,
... | gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
|
// look for clipbox
if (!WITHIN(x, clip_box->origin.x, grect_get_max_x(clip_box) - 1)) {
return;
}
const int16_t min_valid_y = clip_box->origin.y;
if (y1.integer < min_valid_y) {
y1 = (Fixed_S16_3){.integer = min_valid_y, .fraction = 0};
}
const int16_t max_valid_y = grect_get_max_y(clip_box) ... | {
// Plots pixel directly to framebuffer
// Pixel position have to be adjusted to drawing_box before calling this!
// Checking for clip box
const GPoint point = GPoint(x, y);
if (!grect_contains_point(clip_box, &point)) {
return;
}
#if PBL_COLOR
// Checking for data row min/max x
const GBitmapData... |
void graphics_private_plot_horizontal_line_prepared(GContext *ctx, GBitmap *framebuffer,
GRect *clip_box, int y, int x0, int x1,
uint16_t opacity, GColor color) {
// Plots pixel directly to framebuffer
// Pixel... |
s/settings/settings_option_menu.h"
#include "kernel/pbl_malloc.h"
#include "popups/health_tracking_ui.h"
#include "resource/resource_ids.auto.h"
#include "services/common/i18n/i18n.h"
#include "services/normal/activity/activity.h"
#include "services/normal/alarms/alarm.h"
#include "system/logging.h"
#include "system/pa... | {
time_selection_window_deinit(&data->time_picker_window);
} |
// Editing recurrence
menu_layer_deinit(&data->day_picker_menu_layer);
prv_remove_windows(data);
i18n_free_all(&data->day_picker_window);
task_free(data);
data = NULL;
}
static void prv_handle_selection(int index, void *callback_context) {
AlarmEditorData *data = (AlarmEditorData *)callback_context;
... |
settings_bluetooth_reconnect_once();
settings_data->toggle_state = ToggleStateIdle;
settings_menu_mark_dirty(SettingsMenuItemBluetooth);
break;
}
default:
break;
}
}
// UI Stuff
/////////////////////////////
// Menu Layer Callbacks
/////////////////////////////
//-- Address
// ..... | (remote->name, BT_DEVICE_NAME_BUFFER_SIZE) | |
en, "TEST_WEIGHT") == 0) {
sscanf(token + strlen(token) + 1, "%f", &state->test_entry.weight);
} else if (strcmp(token, "TEST_NAME") == 0) {
sscanf(token + strlen(token) + 1, "%s", state->test_entry.name);
}
}
// If this is a "static AlgDlsMinuteData samples[] = {" line, skip it
... | {
return false;
} |
}
// Parse next set of samples in the current file
bool success = prv_parse_accel_samples_file(state);
if (success) {
*entry = state->test_entry;
return true;
} else {
// No more in this file
fclose(state->common.file);
state->common.file = NULL;
}
}
}
// ----... |
oxMsgTypeNone: {
PBL_LOG(LOG_LEVEL_WARNING, "Got (N)ACK while not expecting any. %u", reason);
break;
}
default:
WTF;
break;
}
// https://pebbletechnology.atlassian.net/browse/PBL-42468
// Send next, or in case of error reason, delay the retry instead of sending immediately:
if... | {
DBG("After SessionOpen exit");
prv_cleanup_inbound_reassembly_buffer();
if (s_state.out.object_queue) {
// Make sure we'll re-transfer the object from the start when re-opening:
OutgoingObject *head = s_state.out.object_queue;
head->offset_bytes = 0;
prv_start_session_closed_object_queue_timer(... |
static void prv_session_open__exit_and_initiate_reset(void) {
prv_awaiting_reset_complete_local_initiated__enter(true /* should_send_reset_request */);
prv_session_open__after_exit();
}
static void prv_session_open__inbox_received(DictionaryIterator *it, void *context) {
Tuple *tuple = dict_find(it, PostMessag... |
/*
* 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... | (&data->connected_layer, connected ? "connected" : "disconnected") | ;
}
static void handle_deinit(void) {
EventServiceAppData *data = app_state_get_user_data();
app_free(data);
accel_tap_service_unsubscribe();
connection_service_unsubscribe();
}
static void handle_init(void) {
EventServiceAppData *data = app_malloc_check(sizeof(EventServiceAppData));
memset(data, 0, size... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (MAX_KERNEL_EVENTS + MAX_FROM_APP_EVENTS) | ;
s_kernel_event_queue = xQueueCreate(MAX_KERNEL_EVENTS, sizeof(PebbleEvent));
PBL_ASSERTN(s_kernel_event_queue != NULL);
s_from_app_event_queue = xQueueCreate(MAX_FROM_APP_EVENTS , sizeof(PebbleEvent));
PBL_ASSERTN(s_from_app_event_queue != NULL);
s_from_worker_event_queue = xQueueCreate(MAX_FROM_WORKER_E... |
oth/init.h>
#include <string.h>
static bool s_comm_initialized = false;
static bool s_comm_airplane_mode_on = false;
static bool s_comm_enabled = false;
static bool s_comm_is_running = false;
static bool s_comm_state_change_eval_is_scheduled;
static BtCtlModeOverride s_comm_override = BtCtlModeOverrideNone;
static P... | {
if (!s_comm_initialized) {
PBL_LOG(LOG_LEVEL_ERROR, "Error: Bluetooth isn't initialized yet");
return;
}
mutex_lock(s_comm_state_change_mutex);
s_comm_enabled = enabled;
mutex_unlock(s_comm_state_change_mutex);
prv_comm_state_change(NULL);
} |
void bt_ctl_set_override_mode(BtCtlModeOverride override) {
if (!s_comm_initialized) {
PBL_LOG(LOG_LEVEL_ERROR, "Error: Bluetooth isn't initialized yet");
return;
}
mutex_lock(s_comm_state_change_mutex);
s_comm_override = override;
mutex_unlock(s_comm_state_change_mutex);
prv_comm_state_change(NUL... |
of the buses. Since the display
// can handle a max of 2 Mhz, we want to divide by 8
#define DISPLAY_PERIPH_PRESCALER (SPI_BaudRatePrescaler_8)
static void prv_enable_display_spi_clock() {
periph_config_enable(RCC_APB1PeriphClockCmd, DISPLAY_SPI_CLOCK);
}
static void prv_disable_display_spi_clock() {
periph_confi... | GPIO_PinAFConfig(DISP_GPIO, GPIO_PinSource13, GPIO_AF_SPI2) | |
_client_discovery.h"
#include "comm/ble/gatt_client_operations.h"
#include "comm/ble/gatt_client_subscriptions.h"
// -----------------------------------------------------------------------------
// ble_scan.h
DEFINE_SYSCALL(bool, sys_ble_scan_start, void) {
return gap_le_start_scan();
}
DEFINE_SYSCALL(bool, sys_bl... | DEFINE_SYSCALL(bool, sys_ble_client_consume_notification, uintptr_t *object_ref_out,
uint8_t value_out[],
uint16_t *value_length_in_out,
bool *has... | |
32, -136},
{ -56, 592, -128},
{ -40, 488, -48},
{ -64, 664, -32},
{ -48, 584, -40},
{ 32, 680, 208},
{ 64, 528, 72},
// 5 seconds
{ 64, 568, 216},
{ 64, 840, 512},
{ 240, 1408, 648},
{ 256, 1424, 752},
{ 152, 1808, 872},
{ 80, 1456, 664},
{ -64, 1040, 440},
{ ... | { 336, 808, 224},
{ 368, 824, 240},
{ 344, 808, 248},
{ 336, 840, 216},
{ 328, 800, 232},
{ 352, 800, 200},
{ 328, 824, 248},
{ 304, 768, 288},
{ 320, 848, 304},
{ 312, 824, 312},
// 11 seconds
{ 328, 784, 328},
{ 320, 792, 280},
{ 320, 808, 272},
{ 328, 808, ... |
{ -968, 120, 96},
{ -1248, 160, 224},
{ -1424, 128, -120},
{ -1864, 328, -64},
{ -1672, 480, -160},
{ -976, 408, -32},
{ -872, 944, 8},
{ -1104, 576, 152},
{ -1048, 448, 280},
{ -760, 400, 216},
{ -664, 376, 160},
{ -640, 216, 120},
{ -688, 312, 200},
{ -632, 248... |
e currently running app is from the app_db,
// also clear it.
const AppInstallId cur_app_id = app_manager_get_current_app_id();
if (prv_ids_equal(cur_app_id, to_kill) ||
((s_install_callback_data.install_type == APP_DB_CLEARED) &&
(app_install_id_from_app_db(cur_app_id)))) {
... | {
return entry->install_id;
} | |
ES (40 * MINUTES_PER_HOUR)
typedef struct {
SampleDiscoveryState common;
AlgMinuteFileSample samples[ACTIVITY_SAMPLES_DISCOVERY_MAX_SAMPLES];
ActivityFileTestEntry test_entry;
} ActivitySampleDiscoveryState;
static ActivitySampleDiscoveryState s_activity_sample_discovery_state;
// -----------------------------... | (line, " \t\n") | ;
if (!token) {
continue;
}
// If this is a pre-processor directive, skip it
if (token[0] == '#') {
continue;
}
// If this is a comment skip it
if (strcmp(token, "//") == 0) {
continue;
}
// If this is an AlgDlsMinuteData line, get the name
if (strcmp(token, ... |
HE_NUM_ENTRIES);
if (cache_entry_count == LAUNCHER_APP_GLANCE_SERVICE_CACHE_NUM_ENTRIES) {
LauncherAppGlanceCacheEntry *cache_entry_to_destroy =
(LauncherAppGlanceCacheEntry *)list_get_tail(service->glance_cache);
list_remove(&cache_entry_to_destroy->node, &service->glance_cache, NULL);
prv_glance... | prv_find_glance_entry_in_cache(service, uuid) | ;
return NULL_SAFE_FIELD_ACCESS(entry, glance, NULL);
}
//! Request a glance for an icon ID from an "MRU linked list" (list sorted by accesses so that
//! most recent accesses are at the head of the list)
static LauncherAppGlance *prv_fetch_from_cache_or_load_glance_for_node(AppMenuNode *node,
LauncherAppGlanceS... |
nd flushed to analytics on
// reboot) will be lost)
for (int i = 0; i < 4; i++) {
hw_watchdog_set_pos_val(0xFF);
uint16_t wd_start_ticks = prv_timer_get_ticks();
while (prv_timer_check_delta(wd_start_ticks, TIMER0_1_S)) {
}
}
REG_SET_BIT(CRG_TOP, CLK_RADIO_REG, BLE_LP_RESET); /* reset BLE LP ti... | {
s_spi_dma_complete = true;
} |
// Wait for DMA to complete. Note that since we don't have interrupts enabled, we're polling for
// the interrupt and then calling the DMA Interrupt Handler directly. This will cause the
// callback above to be called.
static void prv_wait_for_dma(bool is_tx_only) {
while (!s_spi_dma_complete) {
if (NVIC_GetPen... |
enade_launcher.h"
#include "applib/app.h"
#include "applib/fonts/fonts.h"
#include "applib/ui/ui.h"
#include "applib/ui/window.h"
#include "applib/ui/window_private.h"
#include "drivers/flash.h"
#include "drivers/system_flash.h"
#include "flash_region/flash_region.h"
#include "kernel/pbl_malloc.h"
#include "process_st... | (&window->layer, &text->layer) | ;
}
static void push_window(AppData *data) {
Window *window = &data->window;
window_init(window, WINDOW_NAME("Grenade Launcher"));
window_set_user_data(window, data);
window_set_overrides_back_button(window, true);
window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_window_load,
});
wi... |
witch (update->attribute_id) {
case AMSQueueAttributeIDIndex:
prv_handle_queue_index_update(update, value_length);
return;
case AMSQueueAttributeIDCount:
prv_handle_queue_count_update(update, value_length);
return;
case AMSQueueAttributeIDShuffleMode:
... | PBL_LOG(LOG_LEVEL_INFO, "Hurray! AMS subscribed") | ;
if (!prv_set_connected(true)) {
PBL_LOG(LOG_LEVEL_ERROR, "Another music service was already connected. Aborting AMS setup.");
return;
}
prv_register_next_entity(NULL);
}
void ams_handle_write_response(BLECharacteristic characteristic, BLEGATTError error) {
if (!s_ams_client) {
return;
}
const... |
/*
* 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... | ("R2=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_R2]) | ;
printf("R3=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_R3]);
printf("R12=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_R12]);
printf("LR=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_LR]);
printf("PC=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_PC]);
printf("xPSR=0x%08" PRIx32 "\n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.