prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
for (int count = 0; count < 100; ++count) {
psleep(10);
dialog_spi_transmit_data_no_wait((uint8_t *)core_dump_connect_ping,
sizeof(core_dump_connect_ping));
psleep(10);
dialog_spi_receive_data_no_wait(buffer, sizeof(buffer));
if (memcmp(buffer, core_dump_connec... |
PBL_LOG(LOG_LEVEL_ERROR, "Failed to connect with BLE chip to collect coredump");
return false;
}
static void prv_int_exti_cb(bool *should_context_switch) {
xSemaphoreGiveFromISR(s_spi_int_semph, NULL);
}
static void prv_dma_cb(bool *should_context_switch) {
portBASE_TYPE was_higher_task_woken = false;
xSem... | |
// ----------------------------------------------------------------------------------------------
void accel_tap_service_subscribe(AccelTapHandler handler) {
AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown);
accel_session_shake_subscribe(session, handler);
}
// ---------------... | {
prv_assert_session_task();
// we better have unsubscribed at this point
PBL_ASSERTN(session->manager_state == NULL);
// A deferred free means one lingering event was posted. We will free the session once the event
// gets drained in 'prv_do_data_handle'
if (!session->deferred_free) {
kernel_free(ses... |
// ----------------------------------------------------------------------------------------------
void accel_session_shake_subscribe(AccelServiceState * session, AccelTapHandler handler) {
AccelServiceState *state = (AccelServiceState *)session;
state->shake_handler = handler;
event_service_client_subscribe(&s... |
/*
* 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... | (&BOARD_CONFIG_VIBE.ctl, GPIO_OType_PP, GPIO_Speed_2MHz) | ;
gpio_output_set(&BOARD_CONFIG_VIBE.ctl, false);
s_initialized = true;
}
if (BOARD_CONFIG_VIBE.options & ActuatorOptions_Pwm) {
pwm_init(&BOARD_CONFIG_VIBE.pwm, PWM_TIMER_UPDATE_PERIOD, PWM_TIMER_FREQUENCY_HZ);
s_initialized = true;
}
if (BOARD_CONFIG_VIBE.options & ActuatorOptions_HBridge) {... |
olors,
};
gdraw_command_image_draw_processed(ctx, image, offset, &processor);
}
//////////////
// MenuLayer callbacks
static const uint8_t BAR_PX = 9;
static const uint8_t BAR_SELECTED_PX = 12;
static void prv_draw_notification_cell_rect(GContext *ctx, const Layer *cell_layer,
... | {
prv_draw_centered_text_line_in(ctx, title_font, box, title, GAlignCenter);
} | |
{
// Always log regardless of CROAKing on unprivileged apps. We don't send the
// croak message out over APP_LOG correctly so if we didn't do this developers
// wouldn't see the croak reason.
APP_LOG(APP_LOG_LEVEL_ERROR, "Double free detected on pointer <%p>", ptr);
PBL_CROAK("Double free detected on pointer ... |
static void prv_warn_on_heap_corruption(void *ptr) {
// They're using 3.2 SDK or older, just let them off with a log message.
APP_LOG(APP_LOG_LEVEL_ERROR, "Error: Heap corrupt around <%p>", ptr);
}
static void prv_croak_on_heap_corruption(void *ptr) {
APP_LOG(APP_LOG_LEVEL_ERROR, "Error: Heap corrupt around <%... | |
,
* 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 "clar.h"
#include "test_jerry_port_common.h"
#include "test_rocky_common.h"
#include "applib/rockyjs/api/rocky_api_global.... | ("minutechange") | );
cl_assert_equal_b(true, rocky_global_has_event_handlers("hourchange"));
cl_assert_equal_b(true, rocky_global_has_event_handlers("daychange"));
cl_assert_equal_i(4, s_tick_timer_service_subscribe.call_count);
cl_assert_equal_i(MINUTE_UNIT | HOUR_UNIT | DAY_UNIT | MONTH_UNIT | YEAR_UNIT,
s_... |
.type = PebbleServicesAdded,
.device = connection->device,
.status = status
};
info->services_added_data.num_services_added =
gatt_client_copy_service_refs_by_discovery_generation(
&connection->device, &info->services_added_data.services[0],
BLE_GATT_MAX_SERVICES_CHANGED, connec... | prv_free_service_nodes(connection) | ;
prv_send_services_invalidate_all_event(
connection, BTErrnoServiceDiscoveryDatabaseChanged);
} else { // we are rediscovering one service
gatt_client_discovery_handle_service_range_change(connection, &new_job->hdl);
}
}
void gatt_client_cleanup_discovery_jobs(GAPLEConnection *connection) {
bt_l... |
ve chosen for roles "
"in one of the most crucial parts in Operation Impending Doom II! "
"[mockingly] You in the audience just get to sit and watch.",
.time_offset = -MINUTES(5)
},
{
.type = TimelineItemTypeNotification,
.layout_id = LayoutIdNotification,
.icon_id = TIMELINE_RESOURCE_GE... | {
SwapLayerDemoData *data = app_state_get_user_data();
Layer *root = window_get_root_layer(window);
data->idx = 0;
// configure scroll layer
SwapLayer *swap_layer = &data->swap_layer;
GRect swap_layer_frame = root->frame;
swap_layer_frame.origin.y += STATUS_BAR_LAYER_HEIGHT;
swap_layer_frame.size.h -=... |
static void handle_init(void) {
SwapLayerDemoData *data = app_malloc_check(sizeof(SwapLayerDemoData));
memset(data, 0, sizeof(SwapLayerDemoData));
app_state_set_user_data(data);
Window *window = &data->window;
window_init(window, WINDOW_NAME("Swap Layer"));
window_set_user_data(window, data);
window_s... |
y",
.callback = prv_debug_cmd_step_history,
}, {
.title = "Active Minutes History",
.callback = prv_debug_cmd_active_time_history,
}, {
.title = "Distance(m) History",
.callback = prv_debug_cmd_distance_history,
}, {
.title = "Sleep History",
.callback = prv_debug_c... | (data->hr_window, data) | ;
window_set_click_config_provider_with_context(data->hr_window, prv_hr_click_config_provider,
data);
window_set_window_handlers(data->hr_window, (WindowHandlers) {
.load = prv_hr_window_load,
.unload = prv_hr_window_unload,
});
window_stack_push(data->st... |
end_frame(OPCODE_FLASH_ERASE, &response, sizeof(response));
// start the erase after sending the response
if (start_erase) {
uint32_t end_address = request->address + request->length;
s_flash_erase_in_progress = true;
flash_erase_optimal_range(
request->address, request->address, end_address,
... | prv_reset_buffer(buf) | ;
return;
}
// reset the timeout timer
new_timer_start(s_timeout_timer, TIMEOUT_MS, prv_timeout_timer_cb, NULL, 0 /* flags */);
// look at the opcode and handle this message
if (header->opcode == OPCODE_PING) {
prv_handle_ping_request(payload, payload_length);
} else if (header->opcode == OPCODE_D... |
) {
GRect bounds = scroll_layer->content_sublayer.bounds;
bounds.size = size;
layer_set_bounds(&scroll_layer->content_sublayer, &bounds);
// Ensure our content offset is clipped to the new size.
// We call prv_scroll_layer_set_content_offset_internal() directly and
// keep potential animations running – sin... | (&scroll_layer->shadow_sublayer) | |
by the event_service
static void prv_tap_add_subscriber_cb(PebbleTask task) {
mutex_lock_recursive(s_mutex);
{
if (++s_tap_subscribers_count == 1 && !s_data_subscribers) {
PBL_LOG(LOG_LEVEL_DEBUG, "Starting accel service");
accel_set_sampling_rate(ACCEL_SAMPLING_25HZ);
if (!accel_start()) {
... | PBL_LOG(LOG_LEVEL_INFO, "Received tap event for KernelMain, axis: %d, direction: %d", axis,
direction) | ;
}
#endif
// -------------------------------------------------------------------------------------------
void accel_manager_init(void) {
s_mutex = mutex_create_recursive();
s_timer_id = new_timer_create();
event_service_init(PEBBLE_ACCEL_SHAKE_EVENT, &prv_tap_add_subscriber_cb,
&prv_tap_r... |
NVCM.
// NVCM configuration is initiated by pulling CRESET high while SCS is high.
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET);
// CRESET needs to be low for at least 200 ns
GPIO_WriteBit(DISP_GPIO, DISP_PIN_CRESET, Bit_RESET);
delay_ms(1);
GPIO_WriteBit(DISP_GPIO, DISP_PIN_CRESET, Bit_SET);
return p... | prv_start_command(CMD_RESET_RELEASE) | ;
prv_end_command();
prv_draw_scene(SCENE_BLACK);
ASSERT_BUSY_IS(Bit_SET);
dbgserial_print("Does the draw-scene command complete? ");
dbgserial_putstr(prv_wait_busy()? "Yes" : "No");
#endif
// Work around an issue which some boards exhibit where the FPGA ring
// oscillator can start up with higher harmo... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}) | ;
framebuffer_clear(&s_fb);
graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App);
s_app_state_get_graphics_context = &s_ctx;
// Setup resources
fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */);
pfs_init(false /* run filesystem check */);
pfs_format(true /* write erase headers *... |
name = __jerryRefs.get($13 /* prop_name_val */);
var desc = {};
if ($0 /* is_value_defined */) {
desc.value = __jerryRefs.get($9);
}
if ($1 /* is_get_defined */) {
desc.get = __jerryRefs.get($10);
}
if ($2 /* is_set_defined */) {
desc.set = __jerryRefs.get($11... | __jerryRefs.get($0) | |
e, value_length);
return;
default:
break;
}
break;
case AMSEntityIDQueue:
switch (update->attribute_id) {
case AMSQueueAttributeIDIndex:
prv_handle_queue_index_update(update, value_length);
return;
case AMSQueueAttributeIDCount:
... | {
AMSCharacteristic characteristic_id = prv_get_id_for_characteristic(subscribed_characteristic);
if (characteristic_id != AMSCharacteristicEntityUpdate) {
// Only Entity Update characteristic is expected to be subscribed to
WTF;
}
if (error != BLEGATTErrorSuccess) {
prv_analytics_log_event_with_in... | |
to kill us.
prv_return_to_landing_zone(stacked_pc, stacked_lr, stacked_args); // We can't get LR or PC, so just set to 0's.
}
// Hardware Fault Handlers
///////////////////////////////////////////////////////////
extern void fault_handler_dump(char buffer[80], unsigned int* stacked_args);
extern void fault_handl... | (stacked_args) | ;
}
void UsageFault_Handler(void) {
__asm("tst lr, #4\n"
"ite eq\n"
"mrseq r0, msp\n"
"mrsne r0, psp\n"
"b %0\n" :: "i" (usagefault_handler_c));
}
|
n, val, val_len);
}
RtcTicks rtc_get_ticks(void) {
return 0;
}
// Fakes
////////////////////////////////////////////////////////////////
static const time_t NOW = 1471269600; // Mon, 15 Aug 2016 14:00:00 GMT
time_t rtc_get_time(void) {
return NOW;
}
bool activity_get_metric(ActivityMetric metric, uint32_t histor... | health_db_insert((uint8_t *)key, strlen(key),
(uint8_t *)s_sleep_data, sizeof(s_sleep_data)) | ,
S_SUCCESS);
// check
int32_t val_out;
cl_assert(health_db_get_typical_value(ActivityMetricSleepTotalSeconds, Monday, &val_out));
cl_assert_equal_i(val_out, s_sleep_data[SD_TypicalSleepDuration]);
// delete
cl_assert_equal_i(health_db_delete((uint8_t *)key, strlen(key)),
... |
/*
* 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... | (InhibitorCompositor) | ;
dma_request_start_direct(COMPOSITOR_DMA, to, from, size, prv_dma_complete_handler, NULL);
if (xSemaphoreTake(s_dma_in_progress, 10) != pdTRUE) {
PBL_LOG_SYNC(LOG_LEVEL_ERROR, "DMA Compositing never completed.");
// TODO: This should never be hit, but do we want to queue up a new render
// event so th... |
assic_pairing_by_id(id_2, &addr_out, &link_key_out,
name_out, &platform_bits_out);
cl_assert(ret);
cl_assert_equal_m(&addr_2, &addr_out, sizeof(addr_out));
cl_assert_equal_m(&link_key_2, &link_key_out, sizeof(link_key_out));
cl_assert_equal_s(name_2, name_out)... | fake_shared_prf_storage_get_bt_classic_delete_count() | , 2);
// Try to read it back
ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id, &addr_out, &link_key_out,
name_out, &platform_bits_out);
cl_assert(!ret);
// Add the pairing again
id = bt_persistent_storage_store_bt_classic_pairing(&addr_in, &link... |
te_evaluate_filter(TemplateStringState *state, const char *filter_name,
const char *parameters_start) {
for (size_t i = 0; i < ARRAY_LENGTH(s_filter_impls); i++) {
if (strcmp(s_filter_impls[i].name, filter_name) == 0) {
state->position = parameters_start;
s_f... | {
// get the position index.
state.error->index_in_string = state.position - input_template_string;
} | |
{ 72, 1216, -296},
{ 112, 872, -320},
{ -8, 760, -240},
{ -88, 680, -232},
{ -176, 624, -200},
{ -336, 624, -176},
{ -408, 680, -216},
{ -456, 752, -224},
{ -496, 888, -256},
{ -584, 1184, -256},
{ -352, 1424, -376},
{ -544, 1464, -456},
{ -224, 1528, -208},
// 13... | { -472, 1256, -408},
{ -488, 1216, -464},
{ -352, 1808, -336},
{ 32, 1256, -312},
// 18 seconds
{ -168, 936, -224},
{ -112, 976, -264},
{ -56, 688, -200},
{ -96, 440, -216},
{ -152, 504, -240},
{ -192, 720, -248},
{ -232, 928, -296},
{ -232, 1272, -472},
{ -232, 1... | |
/*
* 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... | delay_us(10) | ; // only needs to be 50ns according to data sheet
GPIO_WriteBit(GPIOD, GPIO_Pin_2, Bit_SET);
delay_us(30); // need 200ns + 10us before CE can be pulled low
RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FMC, ENABLE);
// Setup default config for async
// Configure the FMC peripheral itself
FMC_NORSRAMTimingInitTyp... |
care about the rest
}
};
static TimelineItem item2 = {
.header = {
.id = {0x55, 0xcb, 0x7c, 0x75, 0x8a, 0x35, 0x44, 0x87,
0x90, 0xa4, 0x91, 0x3f, 0x1f, 0xa6, 0x76, 0x01},
.parent_id = {0xff, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e,
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0x01},... | pin_db_read_item_header(&item, &item1.header.id) | );
cl_assert_equal_i(item.header.status, TimelineItemStatusDismissed);
}
|
ssert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0xff5500)).argb);
cl_assert_equal_i(GColorBlackARGB8, fun(GColorFromHEX(0xaaaaaa)).argb);
// // expectation as derived from Appfaces_generic_colors.psd
cl_assert_equal_i(GColorWhiteARGB8, fun(GColorFromHEX(0x0000aa)).argb);
cl_assert_equal_i(GColorWhiteARGB8, fu... | (gcolor_equal(lookup_table_out[2], GColorBrass)) | ;
cl_assert(gcolor_equal(lookup_table_out[3], GColorYellow));
// lookup_table_out's entries should all preserve the alpha of tint_color
tint_color = GColorBlack;
tint_color.a = 1;
gcolor_tint_luminance_lookup_table_init(tint_color, lookup_table_out);
for (GColor8Component i = 0; i < GCOLOR8_COMPONENT_NUM_V... |
(APP_LOG_LEVEL_INFO, " steps: %"PRIu8", orient: 0x%"PRIx8", vmc: %"PRIu16", "
"light: %d, valid: %d", minute_data[i].steps, minute_data[i].orientation,
minute_data[i].vmc, (int)minute_data[i].light, (int)(!minute_data[i].is_invalid)) | ;
}
} else if (event == HealthEventSleepUpdate) {
HealthValue total_sleep = health_service_sum_today(HealthMetricSleepSeconds);
HealthValue restful_sleep = health_service_sum_today(HealthMetricSleepRestfulSeconds);
APP_LOG(APP_LOG_LEVEL_INFO, "app: New sleep event: total: %"PRIu32", restful: %"PRIu3... | |
// Copy data in chunks from the old file to the new one. Things go faster with a bigger buffer.
success = false;
// We have to make sure we have at least 1 delineated item within each DLS_ENDPOINT_MAX_PAYLOAD
// bytes and clipping max_chunk_size to DLS_ENDPOINT_MAX_PAYLOAD insures that. If we didn't clip
// ... | {
PBL_LOG(LOG_LEVEL_ERROR, "Nuking storage for session %d", session->comm.session_id);
dls_storage_delete_logging_storage(session);
} |
return success;
}
// -----------------------------------------------------------------------------------------
// Copy data out of a session's circular buffer and write it to flash. Called from a KernelBG
// system task callback triggered by dls_log() after data is added to a buffered session.
bool dls_storage_wri... |
call(argc, argv, prv_draw_rect_impl);
}
JERRY_FUNCTION(prv_clear_rect) {
GContext *const ctx = rocky_api_graphics_get_gcontext();
const GColor prev_color = ctx->draw_state.fill_color;
ctx->draw_state.fill_color = GColorBlack;
JS_VAR result = prv_rect_call(argc, argv, graphics_fill_rect);
ctx->draw_state.fill... | list_remove(&head->node, (ListNode **)&s_canvas_context_2d_stored_states, NULL) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | while (node) {
if (!iterator_func(node, ctx)) {
return false;
};
if (!layer_process_tree_level(node->first_child, ctx, iterator_func)) {
return false;
};
node = node->next_sibling;
} | |
/*
* 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, "Dialog: Rebooted due to Shutdown.") | ;
break;
// Error occurred
case RebootReasonCode_Watchdog:
PBL_LOG(LOG_LEVEL_ALWAYS, "Dialog: Rebooted due to watchdog, stuck task mask: 0x%"PRIx32,
reason.extra);
break;
case RebootReasonCode_Assert:
PBL_LOG(LOG_LEVEL_ALWAYS, "Dialog: Rebooted due to Assert: LR 0x%"PRI... |
/*
* 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... | (freertos_mutex != NULL) | ;
PebbleRecursiveMutex * mutex = (PebbleRecursiveMutex *)create_pebble_mutex(freertos_mutex);
return mutex;
}
void mutex_lock_recursive(PebbleRecursiveMutex * handle) {
uintptr_t myLR = (uintptr_t) __builtin_return_address(0);
OS_ASSERT(!mcu_state_is_isr());
xLightMutexLockRecursive(handle->common.freertos_... |
/*
* 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_deinit(&path_layer->layer);
} |
void path_layer_set_stroke_color(PathLayer *path_layer, GColor color) {
if (gcolor_equal(color, path_layer->stroke_color)) {
return;
}
path_layer->stroke_color = color;
layer_mark_dirty(&(path_layer->layer));
}
void path_layer_set_fill_color(PathLayer *path_layer, GColor color) {
if (gcolor_equal(color... |
sert_equal_b(bonding_sync_contains_pairing_info(&pairing_3, true), true);
}
void test_bluetooth_persistent_storage__get_ble_by_addr(void) {
bool ret;
// Output variables
SMIdentityResolvingKey irk_out;
// Store a pairing
SMPairingInfo pairing = (SMPairingInfo) {
.irk = (SMIdentityResolvingKey) {... | (fake_shared_prf_storage_get_ble_delete_count(), 4) | ;
// Try to read it back
ret = bt_persistent_storage_get_ble_pairing_by_id(id, &irk_out, &device_out, NULL);
cl_assert(!ret);
}
void test_bluetooth_persistent_storage__analytics_external_collect_ble_pairing_info(void) {
// No pairings yet
analytics_external_collect_ble_pairing_info();
cl_assert_equal_i(s... |
tor_height(struct MenuLayer *menu_layer, MenuIndex *cell_index,
void *callback_context) {
return 0;
}
static void prv_window_update_proc(struct Layer *layer, GContext *ctx) {
Window *window = layer_get_window(layer);
AppData *data = window_get_user_data(window);
if (data->rendered_frames == 0) {
data->... | window_set_window_handlers(window, (WindowHandlers){
.load = prv_window_load,
}) | ;
window_stack_push(window, true);
__profiler_init();
__profiler_start();
app_event_loop();
prv_deinit(data);
}
|
_transport->sent_cb(pp_header.endpoint_id, buffer, pp_header.length);
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Sending Data to PP endpoint %u (0x%x):",
pp_header.endpoint_id, pp_header.endpoint_id);
PBL_HEXDUMP(LOG_LEVEL_DEBUG, buffer, pp_header.length);
DataNode *data_node = kernel_mallo... | cl_assert(transport) | ;
cl_assert_equal_b(list_contains((const ListNode *)s_fake_transport_head,
(const ListNode *)fake_transport), true);
if (fake_transport->session) {
// Causes clean up of CommSession:
fake_transport_set_connected((Transport *)fake_transport, false /* connected */);
}
lis... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | mutex_create() | ;
}
// Return true on success
static bool write_buffer_locking(char* buffer, int length, bool async) {
bool success = false;
do {
mutex_lock(s_buffer_mutex);
if (shared_circular_buffer_get_write_space_remaining(&s_buffer) >= length + 1) {
// Ideally we could figure out a way to skip out on this copy... |
/*
* 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(fake_app_timer_get_timeout(timer), 1000) | ;
cl_assert(fake_app_timer_is_scheduled(timer));
cl_assert(app_timer_trigger(timer));
ASSERT_JS_GLOBAL_EQUALS_I("num_times", 1.0);
// Verified timer will not trigger again
cl_assert(fake_app_timer_is_scheduled(timer) == false);
}
void test_rocky_api_timers__bogus_clearInterval(void) {
EXECUTE_SCRIPT_EXPE... |
pplib_resource.h"
#include "stubs_app_state.h"
#include "stubs_logging.h"
#include "stubs_heap.h"
#include "stubs_passert.h"
#include "stubs_pbl_malloc.h"
#include "stubs_pebble_tasks.h"
#include "stubs_print.h"
#include "stubs_queue.h"
#include "stubs_resources.h"
#include "stubs_serial.h"
#include "stubs_ui_window.h"... | (status, true) | ;
cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(60)));
// Since we have loop count 2 and 88 frames, see if we can go to elapsed at 2nd loop correctly
status = gbitmap_sequence_update_bitmap_by_elapsed(bitmap_sequence, bitmap,
88 * 100 + (49 - 1) * 100);
cl_... |
r cassette_layer;
GBitmap *cassette_current_icon;
EventServiceInfo event_info;
ProgressLayer track_pos_bar;
uint32_t track_length;
uint32_t track_pos;
bool pause_track_pos_updates;
enum ActionBarState action_bar_state;
AppTimer *action_bar_revert_timer;
AppTimer *volume_repeat_timer;
bool volume_... | (&data->length_text_layer.layer, time_rect) | ,
NULL);
}
static void prv_update_track_progress(MusicAppData *data);
static void prv_flip_animated_text(Animation *animation, bool finished, void *context) {
MusicAppData *data = context;
data->pause_track_pos_updates = false;
prv_update_track_progress(data);
music_get_now_playing(data->title_buffer, d... |
ta);
}
static GSize prv_size_getter(KinoReel *reel) {
KinoReelTransformData *data = kino_reel_custom_get_data(reel);
return interpolate_gsize(data->normalized, data->from.size, data->to.size);
}
static void prv_transform_list(KinoReelTransformData *data) {
KinoReel *reel = prv_get_current_reel(data);
GDrawCom... | {
prv_draw_processed_at_rect(data, ctx, offset, data->to, processor);
return;
} |
prv_transform_list(data);
if (data->global) {
prv_draw_processed_in_global(data, ctx, offset, processor);
} else {
prv_draw_processed_in_local(data, ctx, offset, processor);
}
}
static GDrawCommandList *prv_get_gdraw_command_list(KinoReel *reel) {
KinoReelTransformData *data = kino_reel_custom_get... |
job->cb_data = (void*)((uintptr_t)++s_counter);
}
#define CRON_JOB(min, hr, day, mo, callback) \
{ \
.cb = callback, \
.cb_data = (void*)0, \
.minute = min, \
.hour = hr, \
.mday = day, \
.month = mo, \
.may_be_instant = true, \
},
void test_cron__scheduled_after(void) {
CronJob j... | prv_basic_test(&s_timezone_gmt, &test_cron, s_2015_nov12_123456_gmt, 0, 0, 0) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&s_connections->node,
prv_list_filter_by_gatt_id,
(void *) connection_id) | |
(attr, SmartstrapAttributeStateIdle) | ;
}
}
// List searching functions
////////////////////////////////////////////////////////////////////////////////
//! NOTE: the caller must hold s_attr_list_lock
static SmartstrapAttributeInternal *prv_find_by_ids(uint16_t service_id, uint16_t attribute_id) {
mutex_assert_held_by_curr_task(s_attr_list_lock, tru... | |
dle_subscribe,
.handle_read_or_notification = ancs_handle_read_or_notification,
},
[KernelLEClientAMS] = {
.debug_name = "AMS",
.service_uuid = &s_ams_service_uuid,
.characteristic_uuids = s_ams_characteristic_uuids,
.num_characteristics = NumAMSCharacteristic,
.handle_service_discovered = a... | client->invalidate_all_references() | ;
}
}
static void prv_handle_services_added(
PebbleBLEGATTClientServicesAdded *added_services, BTDeviceInternal *device) {
// loop through the new services
for (int s = 0; s < added_services->num_services_added; s++) {
// get the uuid for the service
Uuid service_uuid = gatt_client_service_get_uuid(a... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
void *ptr = malloc(size);
OS_ASSERT(ptr);
return ptr;
} |
WEAK void os_free(void *ptr) {
free(ptr);
}
|
(fake_event_get_last().type, PEBBLE_ANCS_DISCONNECTED_EVENT) | ;
// Make sure that losing BT altogether sends the event
ancs_destroy();
cl_assert_equal_i(fake_event_get_last().type, PEBBLE_ANCS_DISCONNECTED_EVENT);
fake_event_clear_last();
}
void test_ancs__unrequested_notifications(void) {
prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_complete_dict), (uint8_t*) s_... | |
;
}
if (s_precise_lines) {
free(s_precise_lines);
s_precise_lines = NULL;
}
}
// tests
void test_gdraw_command__draw_command_stroke(void) {
GDrawCommand *command = malloc(sizeof(GDrawCommand) + (sizeof(GPoint) * 2));
*command = (GDrawCommand){
.type = GDrawCommandTypePath,
.hidden = false,
... | gdraw_command_draw(NULL, command) | ;
cl_assert_equal_i(s_stroke_color.argb, GColorPurpleARGB8);
cl_assert_equal_i(s_fill_color.argb, GColorGreenARGB8);
cl_assert_equal_i(s_stroke_width, 2);
cl_assert_equal_i(s_path_num_points, 2);
cl_assert_equal_b(s_path_open, false);
cl_assert_equal_i(s_path_fill_count, 1);
cl_assert_equal_i(s_path_strok... |
/*
* 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... | system_resource_is_valid() | ) {
return false;
}
// Do stuff that needs to happen when stack starts, i.e. bootstrap, load FW, ...
if (!dialog_bootrom_load_second_stage_bootloader()) {
// Failed to load BT bootloader. Shutdown if we haven't tried this already.
PBL_LOG(LOG_LEVEL_ERROR, "Failed to load BLE Second Stage Bootloader -... |
= 0;
static const char* ALL_CODEPOINTS =
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿıŁłŒœŠšŸŽžƒˆˇ˘˙˚˛˜˝π–—‘’‚“”„†‡•…‰‹›⁄€™Ω∂∆∏∑−√∞∫≈≠≤≥◊fifl";
static void select_click_ha... | (FONT_KEY_GOTHIC_28) | ;
s_fonts[7] = fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD);
s_system_font = s_fonts[0];
struct AppState* data = app_malloc_check(sizeof(struct AppState));
app_state_set_user_data(data);
push_window(data);
}
static void handle_deinit(void) {
struct AppState* data = app_state_get_user_data();
app_free(... |
->found = true;
return false; // stop iterating
}
return true; // continue iterating
}
bool bt_persistent_storage_get_ble_pairing_by_addr(const BTDeviceInternal *device,
SMIdentityResolvingKey *irk_out,
char ... | (key, &stored_data, internal_itr_data->cb_data) | ;
}
return true;
}
void bt_persistent_storage_for_each_ble_pairing(BtPersistBondingDBEachBLE cb, void *context) {
ForEachBLEPairingData itr_data = {
.cb = cb,
.cb_data = context,
};
ForEachBLEPairingInternalData internal_itr_data = {
.cb = prv_public_for_each_ble_cb,
.cb_data = &itr_data,
... |
prv_draw_scanline_collision_points(ctx, center.y.integer - i - special_line_offset_top,
left, right, top_starting_edge, top_ending_edge,
ignore_close_angles);
}
if (draw_bottom) {
prv_draw_scanline_collisi... | {
angle_end = ((i + 1) % 4) * (TRIG_MAX_ANGLE / 4);
break;
} |
}
} else {
for (int i=1; i <= QUADRANTS_NUM; i++) {
if (!(quadrant & radius_quadrants[i % 4])) {
angle_end = i * (TRIG_MAX_ANGLE / 4);
break;
}
}
}
}
if (angle_end <= angle_start) {
angle_end += TRIG_MAX_ANGLE;
}
prv_fill_oval_precise(ctx, poi... |
ue = 2 };
IntNode bar3 = { .value = 3 };
ListNode* head = 0;
head = list_sorted_add(head, &bar2.list_node, (Comparator) sorting_comparator, true);
cl_assert(head == &bar2.list_node);
head = list_sorted_add(head, &bar3.list_node, (Comparator) sorting_comparator, true);
cl_assert(head == &bar2.list_node);
... | (list_concatenate(NULL, &d), &d) | ;
cl_assert_equal_p(list_concatenate(NULL, &f), &d);
cl_assert_equal_p(list_concatenate(&f, NULL), &d);
cl_assert_equal_p(list_concatenate(&d, NULL), &d);
cl_assert_equal_p(list_concatenate(&a, &d), &a);
cl_assert_equal_p(list_get_head(&e), &a);
cl_assert_equal_p(list_get_tail(&b), &f);
c.next = NULL;
... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
if (timer_id == EVENTED_TIMER_INVALID_ID) {
return NULL;
}
// Look for this timer in our linked list
ListNode* node = list_find(s_timer_list_head, prv_id_list_filter, (void*)(intptr_t)timer_id);
return (EventedTimer *)node;
} |
//! Retrieves details for a given timer handle and copies them out to user supplied memory.
//! This gets executed on the client's task and is called directly from the callback we put onto the
//! client task's event queue.
//! It accesses the privileged contents of the timer from the client's unprivileged task.
//!... |
_to_ms_with_timers(start_ms + 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&... | prv_count_handler_entries(&s_started_handler_calls, a) | , 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b),... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | APP_LOG(APP_LOG_LEVEL_INFO, "Draw Text") | ;
__profiler_print_stats();
}
static void window_load(Window *window) {
Layer *window_layer = window_get_root_layer(window);
layer_set_update_proc(window_layer, prv_update_proc);
}
static void init(void) {
__profiler_init();
window = window_create();
window_set_window_handlers(window, (WindowHandlers) {
... |
// Ignore expired subscriptions
continue;
}
int64_t subscriber_age_ticks;
if (state->last_valid_ticks) {
subscriber_age_ticks = cur_ticks - state->last_valid_ticks;
} else {
// Never got an update yet
subscriber_age_ticks = milliseconds_... | if (!(state->features & HRMFeature_BPM)) {
continue;
} |
break;
case HRMEvent_LEDCurrent:
if (!(state->features & HRMFeature_LEDCurrent)) {
continue;
}
break;
case HRMEvent_HRV:
if (!(state->features & HRMFeature_HRV)) {
continue;
}
break;
case HRMEvent_Diagnostics:
if (!(s... |
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_layer);
layer_add_child(&window->layer, &peek_layer->layer);
// give it a chance to animate... | (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) {
ConfirmUIData *data = window_get_user_data(window);
gbitmap_destroy(data->action_bar_icon_check);... |
needed on the value of `storage `, we're not going to derefence it.
return app_inbox_service_unregister_by_storage(storage);
}
static bool prv_get_consumer_info(AppInboxServiceTag tag, AppInboxConsumerInfo *info_in_out);
DEFINE_SYSCALL(bool, sys_app_inbox_service_get_consumer_info,
AppInboxServiceTag... | prv_lock() | ;
{
AppInboxNode *inbox = prv_find_inbox_by_tag_and_log_if_not_found(tag);
if (!inbox) {
goto unlock;
}
*info_out = (const AppInboxConsumerInfo) {
.tag = tag,
.message_handler = inbox->message_handler,
.dropped_handler = inbox->dropped_handler,
.num_failed = inbox->num_f... |
==============================================================================
// Functions used for collecting stats and writing them out to a csv
static const int k_stats_max_columns = 32;
typedef struct {
ListNode node;
uint32_t values[k_stats_max_columns];
} StatsRow;
typedef enum {
StatsEpochTypeNonStepping ... | for (int i = 0; i < s_stats_num_columns; i++) {
fprintf(file, " ,%d", row->values[i]);
} |
fprintf(file, "\n");
}
cl_assert_equal_i(0, fclose(file));
printf("Stats written to file: %s", filename);
}
// ---------------------------------------------------------------------------------------
// Run samples through the algorithm integrated into the firmware
// @param[in] data array of samples
// @p... |
if (s_state.out.failure_count >= CONTROL_MESSAGE_MAX_FAILURES) {
MessageNode *node = s_state.out.control_msg_queue;
PBL_LOG(LOG_LEVEL_ERROR, "Failed to send msg with key %"PRIu32, node ? node->key : 0);
prv_control_message_queue_pop_head();
} else {
// Retry happens below... |
}
break;
}
case OutboxMsgTypeChunk: {
if (is_sent_successfully) {
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_... | |
/*
* 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 (!header->payload_length) {
return result;
} |
uint8_t *write_buffer = kernel_malloc_check(header->payload_length);
timeline_item_serialize_payload(notification, write_buffer, header->payload_length);
result = pfs_write(fd, write_buffer, header->payload_length);
if (result < 0) {
PBL_LOG(LOG_LEVEL_ERROR, "Error writing notification payload %d", resul... |
-------------
// Starts/restarts a measurement session.
static bool prv_session_measurement_encode_start(PLogSession *session) {
const ProtobufLogConfig *config = &session->config;
// Set the types pointer to the space allocated right after the PLogSession
ProtobufLogMeasurementType *types_copy = (ProtobufLogMea... | kernel_zalloc(max_data_size) | ;
if (!data_buffer) {
kernel_free(msg_buffer);
return NULL;
}
// Extra space needed for each config to store some variables and information.
// e.g. Measurement needs to store an array of types.
const size_t extra_size = prv_session_extra_space_needed(config);
PLogSession *session = kernel_zalloc(s... |
{
prv_append_certification_menu(cd, &(SystemCertificationMenuItem) {
.draw_cell_fn = prv_draw_regulatory_marks_cell,
.arg1 = (void *)(uintptr_t)cd->current_regulatory_marks_cell_start_idx,
.arg2 = (void *)(uintptr_t)cd->num_regulatory_marks_in_current_cell,
});
} |
}
static void prv_draw_regulatory_id_cell(
GContext *ctx, const Layer *cell_layer, SystemCertificationData *cd,
bool is_selected, const void *arg1, const void *arg2) {
const char *title = arg1;
const char *subtitle = arg2;
menu_cell_basic_draw(ctx, cell_layer, title, subtitle, NULL);
}
static void prv_... | |
ebbleTask_NewTimers);
cl_assert(stub_new_timer_fire(get_reminder_timer_id()));
stub_pebble_tasks_set_current(PebbleTask_KernelBackground);
fake_system_task_callbacks_invoke(1);
cl_assert_equal_i(num_events_put, 2);
cl_assert_equal_m(&item2.header.id, stub_new_timer_callback_data(get_reminder_timer_id()), siz... | stub_pebble_tasks_set_current(PebbleTask_NewTimers) | ;
cl_assert(stub_new_timer_fire(get_reminder_timer_id()));
stub_pebble_tasks_set_current(PebbleTask_KernelBackground);
fake_system_task_callbacks_invoke(1);
cl_assert_equal_i(stub_new_timer_timeout(get_reminder_timer_id()), (2 * 60 + 30) * 60 * 1000);
cl_assert(uuid_equal(&s_all_day_reminder.header.id,
(... |
, frame);
layer_set_frame((Layer *)&peek_layer->kino_layer,
&(GRect) { { 0, peek_layer->icon_offset_y }, frame->size });
}
void peek_layer_set_background_color(PeekLayer *peek_layer, GColor color) {
peek_layer->bg_color = color;
}
static bool prv_is_dot_size(GSize size) {
return (size.w <= UNF... | if (!from_reel) {
return;
} |
KinoReel *to_reel = NULL;
if (timeline_res) {
AppResourceInfo res_info;
timeline_resources_get_id(timeline_res, res_size, &res_info);
to_reel = kino_reel_create_with_resource_system(res_info.res_app_num,
res_info.res_id);
}
GSize size;
if (pee... |
const char scan_resp_data[]) {
const size_t ad_data_length = ad_data ? strlen(ad_data) + 1 : 0;
const size_t scan_resp_data_length =
scan_resp_data ? strlen(scan_resp_data) + 1 : 0;
BLEAdData *ad = (BLEAdData *) malloc(sizeof(BLEAdData) +
ad_data_length +
... | (advert_terms[1].min_interval_slots,
advert_terms[1].max_interval_slots) | ;
regular_timer_fire_seconds(1);
// Silent term:
cl_assert(!gap_le_is_advertising_enabled());
regular_timer_fire_seconds(1);
// Looped around to second term (index==1):
cl_assert(gap_le_is_advertising_enabled());
assert_ad_data("yo");
gap_le_assert_advertising_interval(advert_terms[1].min_interval_s... |
g.h"
#include "applib/fonts/fonts.h"
#include "applib/persist.h"
#include "applib/ui/ui.h"
#include "applib/ui/dialogs/expandable_dialog.h"
#include "apps/system_app_ids.h"
#include "kernel/pbl_malloc.h"
#include "process_state/app_state/app_state.h"
#include "services/normal/activity/activity_algorithm.h"
#include "se... | (metric, ARRAY_LENGTH(values), values) | ;
for (int i = 0; i < 7; i++) {
char elapsed[8];
prv_convert_seconds_to_time(values[i], elapsed, sizeof(elapsed));
char temp[32];
snprintf(temp, sizeof(temp), "\n%d: %s", i, elapsed);
strcat(data->debug_card.dialog_text, temp);
}
prv_display_alert(data->debug_card.dialog_text);
}
// --------... |
.extent.node.type = LayoutNodeType_Text,
.font_key = prv_get_font_key_for_size(config->paragraph_style_font, config->size),
.line_spacing_delta = -2,
.extent.margin.h = 17,
};
GTextNodeVertical *vertical_node = graphics_text_node_create_vertical(num_headings * 2);
for (unsigned int i = 0; i < num_h... | &value_config.text.extent.node,
};
const LayoutNodeVerticalConfig vertical_config = {
.container.extent.node.type = LayoutNodeType_Vertical,
.container.num_nodes = ARRAY_LENGTH(vertical_config_nodes),
.container.nodes = (LayoutNodeConfig **)&vertical_config_nodes,
};
#if PBL_RECT
const LayoutNod... |
metric_margin_h_round_page);
metric_node->offset.y += metric_margin_h;
metric_node->margin.h += metric_margin_h;
}
return metric_node;
}
//! Adds a metric node to a vertically and automatically adds a page break on round
static void prv_add_me... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
if (angle_change % TRIG_MAX_ANGLE == 0) {
return;
}
image->rotation = (image->rotation + angle_change) % TRIG_MAX_ANGLE;
layer_mark_dirty(&(image->layer));
} |
void rot_bitmap_set_src_ic(RotBitmapLayer *image, GPoint ic) {
image->src_ic = ic;
// adjust the frame so the whole image will still be visible
const int32_t right = abs(image->bitmap->bounds.size.w - ic.x);
const int32_t horiz = MAX(ic.x, right);
const int32_t bottom = abs(image->bitmap->bounds.size.h - i... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ("Music", buffer, sizeof(buffer)) | ;
cl_assert_equal_s(buffer, "Musique");
i18n_get_with_buffer("abcd abcd abcd abcd", buffer, sizeof(buffer));
cl_assert_equal_s(buffer, "abcd abcd abcd abcd");
cl_assert_equal_i(buffer[LEN - 1], '\0');
// copied LEN to buffer, i18n should forcibly NULL terminate the buffer
i18n_get_with_buffer("abcd abcd a... |
FF) {
prv_vibe_history_end_event();
}
}
s_vibe_strength = new_strength;
}
void vibe_service_set_enabled(bool enable) {
mutex_lock(s_vibe_pattern_mutex);
if (enable != s_vibe_service_enabled) {
// ensure that the vibe is off before disabling it. No op if enabling it
prv_vibes_set_vibe_strength... | (s_vibe_pattern_mutex) | ;
}
|
const char *emoji_str = PBL_IF_RECT_ELSE(" " MULTIMEDIA_EMOJI, "\n" MULTIMEDIA_EMOJI);
#endif
return snprintf(buffer, length, "%s%s", i18n_get("sent an attachment", __FILE__),
emoji_str);
}
//! @param buffer Pointer to a buffer large enough to hold all attribute strings required by
//! the actio... | prv_add_pstring_to_attribute(*buffer, title, TITLE_MAX_LENGTH,
&item->attr_list.attributes[attr_idx],
AttributeIdSender) | ;
attr_idx++;
}
// The sender is in the title for iMessage
const ANCSAttribute *sender = title;
if (has_multimedia) {
// Move the title (sender) to the body for MMS
if (ancs_notifications_util_is_group_sms(app_id, subtitle)) {
// Promote the subtitle (group name) for Group MMS
title = s... |
if (type == AttributeGroupType_Action) {
((TimelineItemActionGroup *) group_ptr)->num_actions = num_group_type_elements;
((TimelineItemActionGroup *) group_ptr)->actions = (TimelineItemAction *)*buffer;
*buffer += num_group_type_elements * sizeof(TimelineItemAction);
} else {
((AddressList *... |
for (int i = 0; i < num_group_type_elements; i++) {
AttributeList *attr_list;
if (type == AttributeGroupType_Action) {
attr_list = &((TimelineItemActionGroup *) group_ptr)->actions[i].attr_list;
} else {
attr_list = &((AddressList *) group_ptr)->addresses[i].attr_list;
}
... | |
nes are on y axis)
int draw_min = 0;
int draw_max = radius_outer_y.integer;
// Adjust to drawing_box offset
int adjusted_center = center.y.integer + ctx->draw_state.drawing_box.origin.y;
// We add one to compenaste in case of odd line needs to be drawn
int adjusted_top = adjusted_center - radius_outer_y.in... | prv_get_angles_mask_edge(y_middle, center, config.end_quadrant.quadrant,
&ending_edge, &starting_edge, end_top, end_bottom) | ;
}
}
int16_t outer_edge = prv_get_ellipsis_border(y, radius_outer_y_sq, radius_outer_x_sq).raw_value;
int16_t left = center.x.raw_value - outer_edge;
int16_t right = center.x.raw_value + outer_edge;
if (!no_innner_ellipsis && radius_inner_y.integer != 0) {
// This complicates the situ... |
/*
* 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... | {
new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_CONNECTED;
// probably need an All Muted icon here
} |
// replace the image if the connectivity ResourceId has changed
if (data->connectivity_icon_id != new_connectivity_icon_id) {
data->connectivity_icon_id = new_connectivity_icon_id;
kino_layer_set_reel_with_resource(&data->connectivity_icon, data->connectivity_icon_id);
}
// Get the connectivity Resou... |
return (rv);
}
pg_hdr.next_page_crc = crc8_next_page(next_page);
pg_hdr.next_page = next_page;
write_pg_header(&pg_hdr, curr_page);
curr_page = next_page;
// continuation page header settings
memset(&pg_hdr, 0xff, sizeof(PageHeader));
pg_hdr.version = PFS_CUR_VERSION;
... | (PFS_FD(fd).fd_status != FD_STATUS_FREE) | ;
*fdp = fd;
return ((PFS_FD(fd).fd_status == FD_STATUS_IN_USE) ? FDBusy : FDAlreadyLoaded);
}
}
}
// a simple least-recently-accessed cache scheme
int unref = -1;
uint16_t curr_time_closed = 0;
for (int fd = FD_INDEX_OFFSET; fd < FD_INDEX_OFFSET+PFS_FD_SET_SIZE; fd++) {
if (PF... |
assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check third
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[5].header.id));
// check second again
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.heade... | iter_next(&iterator) | );
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[1].header.id));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_extra_case_items[2].header.id));
cl_assert(!iter_next(&iterator));
}
// 5am, no events passed
void test_timeline__extra_case_none_backwards(void) {
... |
if (connected) {
if (data->state == StateError) {
// We got here after a dictation result timeout, so restart the dictation
prv_start_dictation(data);
} else {
prv_voice_window_push(data);
}
} else {
VOICE_LOG("Bluetooth not restored! Exiting...");
prv_exit_and_send_result_even... | VOICE_LOG("New sentence: %s", data->message) | ;
return true;
}
static void prv_handle_dictation_error(VoiceUiData *data, VoiceStatus error_status) {
uint64_t elapsed = prv_get_time_ms() - data->start_ms;
const bool speech_detected = (data->speech_detected) || (elapsed < MIN_ELAPSED_DURATION);
data->error_count++;
if (data->show_error_dialog) {
if ... |
/*
* 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... | vibes_enqueue_custom_pattern(pat) | ;
}
void vibes_double_pulse(void) {
VibePattern pat;
PATTERN_FROM_DURATIONS(pat, DOUBLE_PULSE_DURATIONS);
vibes_enqueue_custom_pattern(pat);
}
void vibes_cancel(void) {
sys_vibe_pattern_clear();
}
void vibes_enqueue_custom_pattern(VibePattern pattern) {
if (pattern.durations == NULL) {
PBL_LOG(LOG_LEVE... |
be as this function waits for the bus to report a non-idle state
// before exiting) reset the bus and wait for it to become not-busy
// Exit if bus remains busy. User module should reset the I2C module at this point
if((bus->i2c->SR2 & I2C_SR2_BUSY) != 0) {
bus_reset(bus_idx);
if (!wait_for_busy_clear(bu... | (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... |
he actual time instead of "In X hours"
const int MAX_RELATIVE_HRS = 1;
// June 10th 2015, 12:00:00 (T-02:00:00)
rtc_set_time(jun10th_noon_2015);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s(" 2:00 PM", time_buf);
// June 8th 2015, 14:00:00 (... | (time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS) | ;
cl_assert_equal_s("IN 30 MIN", time_buf);
// June 10th 2015, 13:30:30 (T-00:29:30)
rtc_set_time(event_time - (30 * SECONDS_PER_MINUTE) + 30);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("IN 30 MIN", time_buf);
// June 10th 2015, 13:30:59 ... |
imer(PPPControlProtocol *this) {
new_timer_stop(this->state->restart_timer);
}
static void prv_transition_to(PPPControlProtocol *this,
enum LinkState nextstate) {
if (nextstate == LinkState_Initial ||
nextstate == LinkState_Starting ||
nextstate == LinkState_Closed ||
... | {
struct LCPPacket *packet = pulse_link_send_begin(this->protocol_number);
packet->code = ControlCode_CodeReject;
packet->identifier = this->state->next_code_reject_id++;
size_t body_len = MIN(ntoh16(bad_packet->length),
pulse_link_max_send_size() - LCP_HEADER_LEN);
memcpy(packet->data... |
static void prv_on_timeout(void *context) {
PPPControlProtocol *this = context;
mutex_lock(this->state->lock);
if (this->state->restart_count > 0) { // TO+
switch (this->state->link_state) {
case LinkState_Closing:
case LinkState_Stopping:
prv_send_terminate_request(this);
break... |
prv_factory_reset_post(false /* should_shutdown */) | ;
}
#endif // !RECOVERY_FW
//! Used by the mfg flow to kick us out the MFG firmware and into the conumer PRF that's stored
//! on the external flash.
void command_enter_consumer_mode(void) {
boot_bit_set(BOOT_BIT_FORCE_PRF);
factory_reset(true /* should_shutdown */);
}
bool factory_reset_ongoing(void) {
return ... | |
{ 112, 720, 408},
{ 112, 744, 240},
{ 184, 696, 264},
{ 176, 648, 312},
{ 160, 720, 280},
{ 208, 744, 216},
{ 224, 1152, 480},
{ 144, 1152, 680},
{ 32, 1272, 816},
{ 80, 1392, 776},
{ 8, 1032, 552},
{ 96, 800, 568},
{ 48, 648, 384},
{ 80, 560, 432},
{ 88, 664,... | { 216, 608, -24},
{ 232, 616, 64},
{ 304, 760, 112},
{ 288, 880, 48},
// 8 seconds
{ 400, 880, 176},
{ 376, 1160, 216},
{ 120, 1240, 240},
{ 256, 1384, 760},
{ -88, 1608, 536},
{ 24, 1256, 496},
{ -56, 936, 488},
{ 104, 688, 240},
{ 144, 592, 240},
{ 184, 512,... | |
/*
* 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... | {
ActionMenuLayer *aml = callback_context;
return (uint16_t)(aml->num_items +
(aml->num_short_items + SHORT_COL_COUNT - 1) / SHORT_COL_COUNT);
} |
static void prv_cell_column_draw(GContext *ctx, struct Layer const *cell_layer,
ActionMenuLayer *aml, ActionMenuItem *items,
int num_items, int sel_idx) {
const GFont font = aml->layout_cache.font;
const int16_t font_height = fonts_get_font_height(... |
/*
* 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 0;
} |
return MAX(prv_get_frame_size(item_layer).h, 0);
}
static int16_t prv_get_min_scroll_offset(TimelineItemLayer *item_layer) {
return 0;
}
static int16_t prv_get_max_scroll_offset(TimelineItemLayer *item_layer) {
int16_t max_scroll = prv_get_height(item_layer) - prv_get_frame_size(item_layer).h;
if (max_scroll... |
/*
* 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... | (animation, context) | |
E_INVALID_ARGUMENT);
int fd[NUM_ENTRIES];
char *fname[NUM_ENTRIES] = {"a", "b", "c" };
// create several files
for (int i = 0; i < NUM_ENTRIES; i++) {
fd[i] = pfs_open(fname[i], OP_FLAG_WRITE, FILE_TYPE_STATIC, 3 * 4096);
cl_assert(fd[i] >= 0);
}
// test close and remove
for (int i = (NUM_ENTRI... | (pfs_active_in_region(0, pfs_get_size())) | ;
// continuation page on region and make sure pfs is active
pfs_format(true);
int fd = pfs_open("testfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, 68000);
cl_assert(fd >= 0);
cl_assert(pfs_close(fd) == S_SUCCESS);
cl_assert(pfs_active_in_region(32000, 68000));
}
int run_full_flash_region_test(void) {
char n... |
haracteristics[0][AMSCharacteristicEntityUpdate];
fake_gatt_client_subscriptions_assert_subscribe(entity_update,
BLESubscriptionNotifications, GAPLEClientKernel);
}
void test_ams__connect_to_music_service_upon_subscribing_entity_update_characteristic(void) {
prv_di... | ams_handle_write_response(entity_update, BLEGATTErrorSuccess) | ;
cl_assert_equal_b(ams_is_registered_for_all_entity_updates(), true);
// After GATT re-discovery, the registration needs to happen again
ams_invalidate_all_references();
prv_discover_ams(1 /* num_instances */);
cl_assert_equal_b(ams_is_registered_for_all_entity_updates(), false);
}
void test_ams__register... |
false /* is_pairing_required */,
GAPLEClientKernel);
cl_assert_equal_i(e, BTErrnoOK);
// Simulate getting a Connection Complete event for the device from Bluetopia:
prv_fake_connect(&device, false /* is_master*/);
// Verify the kernel task got a (vir... | cl_assert_equal_b(gap_le_connect_has_connection_intent(&device, GAPLEClientKernel), true) | ;
cl_assert_equal_b(gap_le_connect_has_connection_intent(&device, GAPLEClientApp), false);
cl_assert_equal_b(gap_le_connect_has_pending_create_connection(), true);
}
// -----------------------------------------------------------------------------
// Cancel Connect (as Master)
void __disabled_test_gap_le_connect__... |
NULL, NULL), true);
cl_assert_equal_i(strcmp(device_name, name_out), 0);
cl_assert_equal_b(pairing_info->is_remote_signing_info_valid,
pairing_info_out.is_remote_signing_info_valid);
cl_assert_equal_b(pairing_info->is_remote_identity_info_valid,
... | shared_prf_storage_store_bt_classic_pairing_data(&addr, device_name, &link_key, 0x00) | |
{ 1056, -96, -384},
{ 1056, -104, -352},
{ 1128, -120, -288},
{ 1328, -64, -328},
{ 1296, -56, -336},
{ 1048, -120, -272},
{ 816, -104, -224},
{ 848, -24, -224},
{ 1072, 24, -216},
// 75 seconds
{ 1144, 64, -168},
{ 1080, 96, -184},
{ 1008, 96, -240},
{ 976, 96, ... | { 1008, -184, 112},
{ 1064, -160, 184},
{ 1072, -248, 280},
{ 1056, -216, 320},
{ 1000, -216, 336},
{ 960, -208, 328},
{ 1248, -192, 360},
{ 1424, -152, 336},
{ 1200, -232, 368},
{ 1056, -344, 384},
{ 960, -360, 416},
{ 912, -416, 344},
{ 1000, -456, 336},
{ 1032,... |
{ 1216, -128, -208},
// 83 seconds
{ 1128, -224, -80},
{ 1032, -216, -96},
{ 1048, -128, -104},
{ 1032, -16, -152},
{ 968, -32, -160},
{ 984, -32, -128},
{ 1000, -48, -112},
{ 984, -48, -72},
{ 1008, -48, -64},
{ 1056, -40, -56},
{ 1040, -48, -48},
{ 1032, -40, -... |
/*
* 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... | (ctx, text, font, (GRect) { .origin = text_center, .size = text_size },
GTextOverflowModeFill, GTextAlignmentCenter, NULL) | ;
}
static void prv_draw_watch_hand_rounded(GContext *ctx, ClockHand *hand, GPointPrecise center) {
GPointPrecise watch_hand_end = prv_gpoint_from_polar(¢er, hand->length, hand->angle);
if (hand->style == CLOCK_HAND_STYLE_ROUNDED_WITH_HIGHLIGHT) {
graphics_context_set_stroke_color(ctx, GColorWhite);
gr... |
/*
* 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(horiz_advance,
text_resources_get_glyph_horiz_advance(&s_font_cache, 'a', &s_font_info)) | ;
horiz_advance = text_resources_get_glyph_horiz_advance(&s_font_cache, 'b', &s_font_info);
cl_assert(horiz_advance != 0);
cl_assert_equal_i(horiz_advance,
text_resources_get_glyph_horiz_advance(&s_font_cache, 'b', &s_font_info));
horiz_advance = text_resources_get_glyph_horiz_advance(&s_font_cache, 'c',... |
ecific language governing permissions and
* limitations under the License.
*/
#include "services/common/put_bytes/put_bytes.h"
#include "services/common/comm_session/session_receive_router.h"
#include "os/tick.h"
#include "system/bootbits.h"
#include "system/firmware_storage.h"
#include "system/logging.h"
#include ... | (LOG_LEVEL_ERROR, "No receiver returned!") | |
----------------------------------------------------
bool animation_set_reverse(Animation *animation_h, bool reverse) {
AnimationState *state = prv_animation_state_get(PebbleTask_Current);
if (animation_private_using_legacy_2(state)) {
// We need to enable other applib modules like scroll_layer, menu_layer, etc... | {
break;
} |
virtual_now += MIN(ANIMATION_TARGET_FRAME_INTERVAL_MS, remaining);
}
// Now, go and backup the abs_start_time_ms of the animations we skipped ahead on
prv_backup_start_time(state, parent, virtual_now - now);
return true;
}
// ------------------------------------------------------------------------------... |
ns/do_not_disturb.h"
#include "services/normal/settings/settings_file.h"
#include "services/normal/vibes/vibe_intensity.h"
#include "system/passert.h"
#include "os/mutex.h"
#include "util/bitset.h"
#include <string.h>
#define FILE_NAME "notifpref"
#define FILE_LEN (1024)
static PebbleMutex *s_mutex;
///////////////... | SET_PREF_ALREADY_OPEN(s_dnd_schedule_keys[WeekendSchedule].schedule_pref_key,
&s_dnd_schedule[WeekendSchedule].schedule) | |
accessory_set_baudrate(AccessoryBaud460800) | ;
} else if ((!s_is_8_bit) || (!s_is_8khz)) {
accessory_set_baudrate(AccessoryBaud230400);
}
// Start timer after a short delay to allow receiving end to switch baud rate
s_start_timer = new_timer_create();
new_timer_start(s_start_timer, 500, &prv_mic_start, NULL, 0);
}
void command_mic_read() {
comma... | |
/*
* 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... | stub_new_timer_timeout(get_reminder_timer_id()) | |
applib/ui/progress_window.h"
#include "applib/ui/ui.h"
#include "drivers/battery.h"
#include "kernel/pbl_malloc.h"
#include "process_management/app_install_manager.h"
#include "process_management/app_manager.h"
#include "process_management/worker_manager.h"
#include "process_state/app_state/app_state.h"
#include "servi... | {
uint32_t icon;
const char *message;
switch (data->result) {
case AppFetchResultNoBluetooth:
icon = TIMELINE_RESOURCE_WATCH_DISCONNECTED;
message = i18n_get("Not connected", data);
// Subscribe to the BT remote app connect event
data->connect_event_info = (EventServiceInfo) {
... |
static void prv_progress_window_finished(ProgressWindow *window, bool success, void *context) {
AppFetchUIData *data = context;
if (success) {
prv_app_fetch_launch_app(data);
}
}
////////////////////////////
// Internal Helper Functions
////////////////////////////
//! Used to clean up the application's d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.