prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
s_all_day_items[2].header.id));
cl_assert(!uuid_equal(&first_all_day_event, &state.pin.header.id));
cl_assert(state.node->all_day);
cl_assert_equal_i(state.pin.header.timestamp, 1421136000);
// back to the first
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&first_all_day_event, &state.pin.header.i... | cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionPast,
1421183640), 0) | ;
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[0].header.id));
// check all day events
cl_assert(iter_next(&iterator));
Uuid first_all_day_event = state.pin.header.id;
cl_assert(uuid_equal(&state.pi... |
eriph_config_disable(bus->spi, bus->state->spi_clock_periph);
}
static void prv_spi_clear_flags(const SPIBus *bus) {
prv_spi_receive_data(bus);
prv_spi_get_flag_status(bus, (SpiI2sFlag)0);
}
static void prv_spi_dma_cmd(const SPIBus *bus, SpiI2sDma dma_bits, bool enable) {
if (enable) {
bus->spi->CR2 |= (uin... | if (is_bidirectional) {
gpio_af_init(&bus->spi_miso, GPIO_OType_PP, bus->spi_sclk_speed, GPIO_PuPd_NOPULL);
} |
}
static void prv_spi_slave_init(const SPISlavePort *slave) {
prv_spi_enable_peripheral_clock(slave->spi_bus);
SPIBus *bus = slave->spi_bus;
// Grab existing configuration
uint16_t tmpreg = bus->spi->CR1;
// Clear BIDIMode, BIDIOE, RxONLY, SSM, SSI, LSBFirst, BR, MSTR, CPOL and CPHA bits
tmpreg &= CR1_CLE... |
/*
* 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_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)) | |
ot_disturb_set_schedule(WeekdaySchedule, &schedule_3);
cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true);
cl_assert(do_not_disturb_is_manually_enabled() == false);
active = do_not_disturb_is_active();
cl_assert(active == false); // Scheduled ON
}
void test_do_not_disturb__smart_dnd(void) ... | (stub_new_timer_timeout(get_dnd_timer_id()), 25200 * MS_PER_SECOND) | |
}
}
static void bmi160_IRQ2_handler(bool *should_context_switch) {
if (!s_accel_outstanding_data_work) {
s_accel_outstanding_data_work = true;
accel_offload_work_from_isr(prv_handle_data, should_context_switch);
} else {
BMI160_DBG("%s", "We fell behind on data handling");
}
}
// in order to actu... | (accel_test_axis) | ; ++i) {
accel_test_axis[i].negative_value = bmi160_read_16bit_reg(accel_test_axis[i].register_address);
PBL_LOG(LOG_LEVEL_DEBUG, "- %c: %"PRId16,
accel_test_axis[i].axis_name, accel_test_axis[i].negative_value);
}
PBL_LOG(LOG_LEVEL_DEBUG, "Self Test: Positive offset");
// Flip sign bit from... |
/*
* 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... | {
firmware_update_init();
put_bytes_init();
poll_remote_init();
accel_manager_init();
light_init();
cron_service_init();
shared_prf_storage_init();
bt_persistent_storage_init();
comm_default_kernel_sender_init();
comm_session_app_session_capabilities_init();
comm_session_init();
bt_ctl_init(... |
static struct ServiceRunLevelSetting s_runlevel_settings[] = {
{
.set_enable_fn = accel_manager_enable,
.enable_mask = R_Stationary | R_FirmwareUpdate | R_Normal,
},
{
.set_enable_fn = light_allow,
.enable_mask = R_LowPower | R_FirmwareUpdate | R_Normal,
},
{
.set_enable_fn = vibe_servic... |
equal_s("Fri, 12:00 PM", time_buf);
// June 11th 2015, 23:59:29 (T-12:00:31)
rtc_set_time(event_time - (12 * SECONDS_PER_HOUR) - 31);
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("Fri, 12:00 PM", time_buf);
// June 11th 2015, 23:59:30 (T-12:00... | clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS) | |
/*
* 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 (success) {
res_id = RESOURCE_ID_GENERIC_CONFIRMATION_LARGE;
end_screen_timeout = COMPLETE_SCREEN_VISIBLE_DURATION_MS;
dialog_set_background_color(simple_dialog_get_dialog(&data->finished_dialog), GColorGreen);
simple_dialog_set_buttons_enabled(&data->finished_dialog, false);
} else {
res_id = ... |
dialog_set_icon(&data->finished_dialog.dialog, res_id);
#if !PLATFORM_ROBERT && !PLATFORM_CALCULUS
dialog_set_text(&data->finished_dialog.dialog, prv_get_dialog_text(data, success));
#endif
// Show the status screen for a bit before closing the app
dialog_set_timeout(&data->finished_dialog.dialog, end_screen_... |
SettingsRecordInfo *info, void *context) {
// check entry is valid
if (info->val_len == 0 || info->key_len != sizeof(BTBondingID)) {
return true; // continue iterating
}
FindByAddrItrData *itr_data = (FindByAddrItrData *) context;
BTBondingID key;
BtPersistBondingData stored_data;
info->get_key(f... | (&stored_data->ble_data.pairing_info.identity,
&stored_data->ble_data.pairing_info.irk,
stored_data->ble_data.name, &key, itr_data->cb_data) | |
void test_persist__cleanup(void) {
persist_service_client_close(&test_uuid_a);
}
void test_persist__int(void) {
const uint32_t key = 0;
const uint32_t value = ~0;
cl_assert_equal_i(persist_read_int(key), 0);
cl_assert_equal_i(persist_write_int(key, value), sizeof(int));
cl_assert_equal_i(persist_get_size(... | (persist_read_int(key), 1) | ;
cl_assert_equal_i(persist_write_int(key, 2), sizeof(int));
cl_assert_equal_i(persist_read_int(key), 2);
}
/*
* Confirm that overwriting with a smaller data size does not break tuple finding.
*/
void test_persist__overwrite_shrink(void) {
cl_assert(PASSED(persist_write_int(0, 1)));
cl_assert(PASSED(persist_... |
we are not showing the action bar.
return;
}
if (offset.y < 0) {
// We have scrolled down, so we want to display the up arrow.
prv_show_action_bar_icon(expandable_dialog, BUTTON_ID_UP);
} else if (offset.y == 0) {
// Hide the up arrow as we've reached the top.
action_bar_layer_clear_icon(act... | const GSize icon_size = icon ? kino_reel_get_size(icon) : GSizeZero;
uint16_t icon_offset = (icon ? ICON_TOP_MARGIN_PX - status_layer_offset : 0);
x = 0;
y = status_layer_offset;
w = frame.size.w;
h = frame.size.h - y;
ScrollLayer *scroll_layer = &expandable_dialog->scroll_layer;
scroll_layer_init(sc... |
// layer must be added immediately to scroll layer for perimeter and paging
scroll_layer_add_child(scroll_layer, &header_layer->layer);
#if PBL_ROUND
text_layer_enable_screen_text_flow_and_paging(header_layer, 8);
#endif
// We account for a header that may be larger than the available space
// by... |
/*
* 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... | GPIO_Init(GPIOB, &gpio_init) | ;
for (uint8_t pin_source = 0; pin_source < 16; ++pin_source) {
if (pin_source == 2) {
continue;
}
GPIO_PinAFConfig(GPIOD, pin_source, GPIO_AF_FMC);
}
gpio_init.GPIO_Pin = GPIO_Pin_All & (~GPIO_Pin_2);
GPIO_Init(GPIOD, &gpio_init);
for (uint8_t pin_source = 2; pin_source < 16; ++pin_source... |
zed on the heap to reduce stack usage
char *parent_id_string = kernel_malloc_check(UUID_STRING_BUFFER_LENGTH);
uuid_to_string(&parent_id, parent_id_string);
PBL_LOG(LOG_LEVEL_ERROR,
"Pin insert for a pin with no app installed, parent id: %s",
parent_id_string);
kernel... | ((uint8_t *)id, sizeof(TimelineItemId), (uint8_t *)&hdr,
sizeof(SerializedTimelineItemHeader)) | ;
timeline_item_deserialize_header(item_out, &hdr);
return rv;
}
status_t pin_db_next_item_header(TimelineItem *next_item_out,
TimelineItemStorageFilterCallback filter) {
TimelineItemId id;
status_t rv = timeline_item_storage_next_item(&s_pin_db_storage, &id, filter);
if (rv)... |
om_op(AlarmId id, AlarmConfig *config, void *context);
// Private globals
static bool s_alarms_enabled = false;
static time_t s_next_alarm_time;
//! This is only valid when s_next_alarm_time is not 0.
static Alarm s_next_alarm;
static CronJob s_next_alarm_cron;
static AlarmId s_most_recent_alarm_id = ALARM_INVALID_ID... | for (int i = 0; i < size / UUID_SIZE; i++) {
Uuid *pinid = (Uuid *) &buffer[UUID_SIZE * i];
if (uuid_is_invalid(pinid)) {
continue;
}
alarm_pin_remove(pinid);
settings_file_delete(fd, &key, sizeof(key));
success = true;
} | |
ms += (supervision_to_10ms * 10);
s_le_conn_params.num_samps++;
bt_unlock();
}
static void prv_update_conn_event_timer(uint32_t interval_1_25ms, bool stop) {
bt_lock();
static bool s_analytic_conn_timer_running = false;
if (stop || s_analytic_conn_timer_running) {
analytics_stopwatch_stop(ANALYTICS_DEVIC... | (ANALYTICS_DEVICE_METRIC_BLE_CONNECT_ENCRYPTED_TIME,
AnalyticsClient_System) | ;
}
void bluetooth_analytics_handle_no_intent_for_connection(void) {
analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_CONNECT_NO_INTENT_COUNT, AnalyticsClient_System);
}
void bluetooth_analytics_handle_ble_pairing_request(void) {
analytics_inc(ANALYTICS_DEVICE_METRIC_BLE_PAIRING_COUNT, AnalyticsClient_System);
}
void 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_LEVEL_DEBUG, "Done initializing, pushed window: %p", s_window) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
HcProtocol_GapDeviceNameResponseHeader header;
uint8_t name[evt->length];
} | |
l timeline_item_deserialize_payload(TimelineItem *item, char *string_buffer,
size_t string_buffer_size, const uint8_t *payload,
size_t payload_size) {
PBL_ASSERTN(item != NULL);
PBL_ASSERTN(string_buffer != NULL);
PBL_ASSERTN(payload !=... | prv_item_find_action(item, prv_action_type_compare_func, &type) | |
ig s_broadcaster_header_config = {
.extent.node.type = LayoutNodeType_Constructor,
.constructor = prv_broadcaster_header_constructor,
};
static const LayoutNodeTextAttributeConfig s_broadcaster_config = {
.attr_id = AttributeIdBroadcaster,
.text.font_key = FONT_KEY_GOTHIC_24_BOLD,
.text.line_sp... | (sizeof(SportsLayout)) | ;
static const TimelineLayoutImpl s_timeline_layout_impl = {
.attributes = { AttributeIdTitle, AttributeIdSubtitle },
.default_colors = { { .argb = GColorBlackARGB8 },
{ .argb = GColorWhiteARGB8 },
{ .argb = GColorVividCeruleanARGB8 } },
.default_icon = TIM... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&data->direction_layer, GColorBlack) | ;
text_layer_set_background_color(&data->direction_layer, GColorWhite);
text_layer_set_text_color(&data->word_wrap_layer, GColorBlack);
text_layer_set_background_color(&data->word_wrap_layer, GColorWhite);
if (data->select_index == SelectIndexDirection) {
text_layer_set_text_color(&data->direction_layer, G... |
it is used as the title text frame
GRect rect = (GRect) {
.origin = cell_layer_bounds->origin,
.size = GSize(cell_layer_bounds_size.w, title_text_frame_height),
};
// Update the title text frame's height using the max used size of the title text because we
// might only have one line of text to render... | (cell_layer_bounds_size.w, subtitle_text_frame_height) |
};
graphics_draw_text(ctx, config->subtitle, subtitle_font, rect, config->overflow_mode,
text_alignment, NULL);
}
// Draw the title, which we're guaranteed to have room for because otherwise we would have bailed
// out at the beginning of this function
// Reuse rect as the title... |
/*
* 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_ERROR, "Debug seek failed: %d", status) | ;
kernel_free(contents);
return NULL;
}
int actual_read_size = pfs_read(iter->fd, contents, read_size);
PBL_LOG(LOG_LEVEL_INFO,
"Read %d (expected %d) bytes of file %s (size %d), around offset %d.",
actual_read_size, read_size, iter->file_name, file_size, pos);
return contents;
}
st... |
nt32_t top_level_start_time, bool do_update);
#define PebbleTask_Current PebbleTask_Unknown
// -------------------------------------------------------------------------------------------
static AnimationState *prv_animation_state_get(PebbleTask task) {
if (task == PebbleTask_Current) {
task = pebble_task_get_cur... | {
state->aux->iter_next = list_get_next((ListNode *)animation);
} |
}
// -------------------------------------------------------------------------------------------
// Remove from our list of allocated animations and free the memory
static void prv_unlink_and_free(AnimationState *state, AnimationPrivate *animation) {
// It's an error if it's scheduled
PBL_ASSERTN(list_contains(st... |
/*
* 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... | (gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")) | |
},
};
break;
case HRMFeature_LEDCurrent:
*event = (PebbleHRMEvent) {
.event_type = HRMEvent_LEDCurrent,
.led = {
.current_ua = data->led_current_ua,
.tia = data->ppg_data.tia[0]
},
};
break;
case HRMFeature_Diagnostics:
{
... | (state, utc_now) | ) {
hrm_event = (PebbleHRMEvent) {
.event_type = HRMEvent_SubscriptionExpiring,
.expiring.session_ref = state->session_ref,
};
PBL_ASSERTN(prv_event_put(state, &hrm_event));
state->sent_expiration_event = true;
}
if (state->expire_utc && (utc_now >= state->expire_utc)) {... |
attributes.h"
#include "util/bitset.h"
#include "util/size.h"
#include "util/string.h"
#define CMSIS_COMPATIBLE
#include <mcu.h>
#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>
#include "kernel/pebble_tasks.h"
void fault_handler_dump_stacked_args(char buffer[80], unsigned int* stacked_args) {
unsigne... | print_set_indexes(buffer, &mmfsr, mmfsr_mappings, ARRAY_LENGTH(mmfsr_mappings)) | ;
}
}
void fault_handler_dump(char buffer[80], unsigned int *stacked_args) {
fault_handler_dump_stacked_args(buffer, stacked_args);
fault_handler_dump_cfsr(buffer);
PBL_LOG_FROM_FAULT_HANDLER_FMT(
buffer, 80, "Task: %s", pebble_task_get_name(pebble_task_get_current()));
}
static void hard_fault_handler_... |
_get_content_size(ctx, text_layer).h;
text_content_height += 4; // See PBL-1741
text_layer_set_size(text_layer, GSize(w, text_content_height));
uint16_t scroll_height = icon_offset + icon_size.h +
header_content_height + text_content_height + (icon ? BOTTOM_MARGIN_PX : 0);
scroll_layer_set_content_size(... | dialog_load(dialog) | ;
}
static void prv_expandable_dialog_appear(Window *window) {
ExpandableDialog *expandable_dialog = window_get_user_data(window);
Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog);
scroll_layer_update_content_indicator(&expandable_dialog->scroll_layer);
dialog_appear(dialog);
}
static void prv... |
me passes without a
// successful connection event, the device is to consider the connection lost,
// and return to an unconnected (standby) state.
// Valid values: 100ms to 32,000ms. In addition, the timeout must be larger
// than the effective connection interval (explained below).
// Rule of thumb: the slave should ... | {
const BleConnectionParams *actual_params = &connection->conn_params;
if (actual_conn_interval_ms_out) {
*actual_conn_interval_ms_out = actual_params->conn_interval_1_25ms;
}
const GAPLEConnectRequestParams *desired_params = prv_params_for_state(connection, state);
// When the fastest state is desired,... |
static void prv_request_params_update(GAPLEConnection *connection,
ResponseTimeState state) {
if (connection->is_remote_device_managing_connection_parameters ||
connection->param_update_info.is_request_pending) {
return;
}
// We need to wait at least REQUIRED_INI... |
phone UI up until timeline_actions responds or another call comes in
s_phone_ui_data->window_pop_timer = evented_timer_register(SMS_REPLY_IOS_DELAY_MS,
false /* repeating */, prv_open_reply_action_menu, NULL);
break;
default:
break;
}
}
static void prv_pop_click_handler(ClickRecognize... | {
case PhoneCallSource_PP:
// We require the this to be a valid number when coming from PP
if (prv_is_string_a_phone_number(number)) {
return ANDROID_PHONE_KEY;
}
break;
case PhoneCallSource_ANCS:
case PhoneCallSource_ANCS_Legacy:
return IOS_PHONE_KEY;
break;
} |
return NULL;
}
// Checks for the existance of a call reply action in the notif pref db and loads it into
// a timeline item
static bool prv_load_sms_reply_action(const char *number, PhoneCallSource source) {
const char *app_id = prv_get_app_id(number, source);
if (!app_id) {
return false;
}
// Load 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... | PBL_LOG(LOG_LEVEL_ALWAYS, "Dialog: Rebooted due to Unrecognized Reason") | ;
break;
}
clear:
reboot_reason_clear();
}
|
;
}
token = prv_parse_token(PutBytesPut, (SharedHeader *)job->buffer);
if (!prv_do_put((PutRequest *)job->buffer, job->request_length, token)) {
// consume the jobs, they are all going to fail
prv_mark_pb_jobs_complete(num_put_jobs);
return;
}
}
xSemaphoreTake(s_pb_semaphore, po... | prv_deinit_put_job_queue() | ;
s_pb_state = (PutBytesState){};
memset(&s_ready_to_install, 0, sizeof(s_ready_to_install));
}
static void prv_expect_init_timeout_cb(void *data) {
xSemaphoreTake(s_pb_semaphore, portMAX_DELAY);
if (s_pb_state.timer_id) {
new_timer_delete(s_pb_state.timer_id);
s_pb_state.timer_id = TIMER_INVALID_ID;... |
click_subscribe(BUTTON_ID_UP, 2, 2, 100, false, prv_up_multi_click_handler);
// Use raw clicks to avoid single click delay which results from having multi-click enabled
window_raw_click_subscribe(BUTTON_ID_DOWN, prv_raw_click_handler, NULL, context);
window_single_repeating_click_subscribe(BUTTON_ID_DOWN, SCROLL... | gbitmap_deinit(&swap_layer->arrow_layer.arrow_bitmap) | ;
layer_deinit(&swap_layer->arrow_layer.layer);
prv_swap_layer_reset(swap_layer);
layer_deinit(&swap_layer->layer);
}
SwapLayer* swap_layer_create(GRect frame) {
// Note: Not yet exported for 3rd party apps so no padding is necessary
SwapLayer *layer = applib_malloc(sizeof(SwapLayer));
if (layer) {
swa... |
,
void(*inserter)(WindowStackItem *),
const WindowTransitionImplementation *transition_insert,
const WindowTransitionImplementation *transition_pop) {
PBL_ASSERTN(window_stack_to);
WindowStack *window_stac... | list_insert_before(window_stack->removed_list_head,
&pop_item->list_node) | ;
// Store the window here, as we're potentially free'ing the item later on.
Window *pop_item_window = pop_item->window;
bool is_app_window = window_manager_is_app_window(pop_item_window);
PBL_LOG(LOG_LEVEL_DEBUG, "(-) %s=%p <%s>", is_app_window ? "window" : "modal window",
pop_item_window, window_get_de... |
till needs to start at {0, 16}. We adjust for that by
// moving the GContext's draw_state before we traverse the layer hierarchy to render it.
// Also see window_calc_frame()
DrawingStateOrigins saved_state;
prv_adjust_drawing_state_for_legacy2_apps(&saved_state, ctx, window);
layer_render_tree(&window->laye... | {
PBL_ASSERTN(window);
window->click_config_provider = click_config_provider;
window->click_config_context = context;
if (window->on_screen && !window->is_unfocusable) {
// We're already on screen, make the config provider get called.
prv_call_click_provider(window);
} else {
window->is_waiting_f... |
void window_set_click_config_provider(Window *window, ClickConfigProvider click_config_provider) {
window_set_click_config_provider_with_context(window, click_config_provider, NULL);
}
void window_set_click_context(ButtonId button_id, void *context) {
prv_check_is_in_click_config_provider(window_manager_get_top_... |
/*
* 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... | {
SharedPRFData data;
prv_fetch_struct(&data);
uint8_t *unmodified_data_patch_start = ((uint8_t *)&data) + offset;
// Struct is packed, so it's OK to use memcmp:
if (memcmp(unmodified_data_patch_start, patch, size) != 0) {
// There is new data present, so perform a write!
memcpy(unmodified_data_patch... |
typedef struct {
size_t size;
size_t offset;
uint8_t patch[];
} WriteEraseCBData;
static void prv_perform_flash_erase_write_cb(void *data_in) {
WriteEraseCBData *cb_data = (WriteEraseCBData*) data_in;
prv_apply_patch_to_struct(cb_data->patch, cb_data->size, cb_data->offset, true);
kernel_free(cb_data);
}... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (builder->num_points <= 1) {
return 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... | worker_state_get_heap() | ;
} else {
WTF;
}
return heap;
}
size_t heap_bytes_used(void) {
Heap *heap = get_task_heap();
return heap->current_size;
}
size_t heap_bytes_free(void) {
Heap *heap = get_task_heap();
return heap_size(heap) - heap->current_size;
}
|
e *)s_data_subscribers;
while (state) {
if (!state->raw_buffer) {
state = (AccelManagerState *)state->list_node.next;
continue;
}
// if subscribed but not looking for any samples then just drop the data
if (state->samples_per_update == 0) {
uint16_t len = shared_circular_buffer_get_... | mutex_create_recursive() | |
_delay(seq, delay_seq); // This delay not applicable since a was already scheduled
animation_set_handlers(seq, handlers, seq);
animation_schedule(seq);
// The duration of seq should include all of a and b
uint32_t duration = animation_get_duration(seq, true, true);
cl_assert_equal_i(duration, duration_a + de... | animation_get_duration(seq, true, true) | ;
cl_assert_equal_i(duration, duration_a + delay_a + duration_b + delay_b);
// The position of seq should be the amount we already played of a, including the 'a' delay
// since a is embedded within seq
int32_t position;
animation_get_elapsed(seq, &position);
cl_assert_equal_i(position, 100);
// Now, ad... |
icense.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implie... | malloc(sizeof(BLEAdData) +
ad_data_length +
scan_resp_data_length) | ;
ad->ad_data_length = ad_data_length;
ad->scan_resp_data_length = scan_resp_data_length;
if (ad_data_length) {
strncpy((char *) ad->data,
ad_data, ad_data_length);
}
if (scan_resp_data_length) {
strncpy((char *) ad->data + ad_data_length,
scan_resp_data, scan_resp_data_length);... |
/*
* 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_INFO, "Adding app name to app prefs: <%s>", app_name_buff) | ;
}
}
// Add the mute attribute if we don't have one already
// Default the app to not muted
const bool already_has_mute =
app_notif_prefs && attribute_find(&app_notif_prefs->attr_list, AttributeIdMuteDayOfWeek);
if (!already_has_mute) {
attribute_list_add_uint8(&new_attr_list, AttributeIdMuteD... |
on->app_uuid)) {
PBL_LOG(LOG_LEVEL_WARNING, "Finishing the system data logging session at %p", logging_session);
}
bool is_active = dls_lock_session(logging_session);
if (!is_active) {
PBL_LOG(LOG_LEVEL_WARNING, "Tried to close a non-active data logging session");
return;
}
// Wait for write buf... | dls_send_all_sessions() | ;
#endif
return (result);
}
// ----------------------------------------------------------------------------------------
bool dls_is_session_valid(DataLoggingSession *logging_session) {
return dls_list_is_session_valid(logging_session);
}
// -----------------------------------------------------------------------... |
e register
uint8_t reg_value;
prv_read_register(dev, read_instruction, ®_value, 1);
// set the desired bits
reg_value = (reg_value & ~mask) | value;
// enable writing and write the register value
prv_write_cmd_no_addr(dev, dev->state->part->instructions.write_enable);
qspi_indirect_write_no_addr(dev-... | {
prompt_send_response("FAILURE: buffer_dma != buffer_pol");
success = false;
} |
if (memcmp(buffer_dma, buffer_mmap, size) != 0) {
prompt_send_response("FAILURE: buffer_dma != buffer_mmap");
success = false;
}
const int buf_size = 64;
char buf[buf_size];
prompt_send_response_fmt(buf, buf_size, "Size: %d DMA: %"PRIu32 " POL: %"PRIu32 " MMP: %"PRIu32,
si... |
n;
}
const WindowTransitionImplementation *transition_to = &g_window_transition_none_implementation;
const WindowTransitionImplementation *transition_pop =
window_transition_get_default_pop_implementation();
prv_insert_with_function(window_stack, window, prv_next_inserter, transition_to, transition_pop);... | (context->window_from) | &&
window_has_status_bar(context->window_to);
}
// Transitioning Context Functions
////////////////////////////////////
// @note: This function prototypes exist in window_stack_private.h
bool window_transition_context_has_legacy_window_to(WindowStack *stack, Window *window) {
return (stack->transition_conte... |
");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOU... | graphics_context_set_compositing_mode(ctx, compositing_mode) | ;
#if PBL_ROUND
if (cell_layer->is_highlighted) {
graphics_draw_bitmap_in_rect(ctx, icon, &image_bounds);
}
#else
graphics_draw_bitmap_in_rect(ctx, icon, &image_bounds);
#endif
GRect title_bounds = cell_layer->bounds;
title_bounds.origin.x = title_origin_x;
title_bounds.origin.y = title_top_padding;
... |
/new_timer.h"
#include "services/common/regular_timer.h"
#include "services/common/system_task.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/list.h"
#include "util/math.h"
#include "util/rand.h"
#include <stdlib.h>
//! The Bluetooth Connection Manager is responsible for managing the power
... | (curr_request->granted_handler) | ;
curr_request->granted_handler = NULL;
}
curr_request = (ConnectionStateRequest *)list_get_next(&curr_request->list_node);
}
}
static void prv_handle_response_latency_for_le_conn(GAPLEConnection *hdl) {
uint16_t secs_til_max_latency;
ResponseTimeState state;
BtConsumer responsible_consumer;
#ifd... |
r_manager_close_current_worker(true /*graceful*/);
return true;
}
// Clear the next worker settings
s_next_worker = (NextWorker) {};
// Error if a worker already launched
if (pebble_task_get_handle_for_task(PebbleTask_Worker) != NULL) {
PBL_LOG(LOG_LEVEL_WARNING, "Worker already launched");
retu... | // If no default yet, set as the default so that it can be relaunched upon system reset
if (worker_manager_get_default_install_id() == INSTALL_ID_INVALID) {
worker_manager_set_default_install_id(s_worker_task_context.install_id);
}
return true;
} |
// ------------------------------------------------------------------------------------------------
// Reset the data we're tracking for workers that crash
static void prv_reset_last_worker_crashed_data(void) {
// No need to reset s_last_worker_crash_timestamp because we always check the install id before
// we c... |
t(custom_action_bar, dialog);
action_bar_layer_set_click_config_provider(custom_action_bar,
prv_custom_action_bar_config_provider);
actionable_dialog_set_action_bar_type(actionable_dialog, DialogActionBarCustom,
custom_action_bar);
app_actionable_dialog_push(actionab... | {
ExpandableDialog *expandable_dialog = expandable_dialog_create("Expandable Dialog");
Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog);
dialog_set_text(dialog, data->lorem_ipsum);
dialog_set_background_color(dialog, GColorLightGray);
dialog_show_status_bar_layer(dialog, true);
expandable_d... |
///////////////////////////////////
// Expandable Dialog with no scroll
static void prv_show_expandable_dialog_no_scroll(DialogsData *data) {
ExpandableDialog *expandable_dialog = expandable_dialog_create("Expandable Dialog");
Dialog *dialog = expandable_dialog_get_dialog(expandable_dialog);
dialog_set_text(dia... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
return false;
} |
static bool fake_pb_storage_mem_init(PutBytesStorage *storage, PutBytesObjectType object_type,
uint32_t total_size, PutBytesStorageInfo *info,
uint32_t append_offset) {
// This fake only supports one put bytes storage to be init'd at a time.
... |
mConfig *config, time_t alarm_time, Uuid *uuid_out) {
const AlarmType type = config->is_smart ? AlarmType_Smart : AlarmType_Basic;
alarm_pin_add(alarm_time, id, type, config->kind, uuid_out);
}
// ----------------------------------------------------------------------------------------------
//! Pins alarm in the t... | (fd, alarm, &cron, rtc_get_time()) | |
----------------------------------------------------------------------------------------
// Close the settings file and free the file struct
void activity_private_settings_close(SettingsFile *file) {
settings_file_close(file);
kernel_free(file);
}
// ---------------------------------------------------------------... | {
// If no reason to update storage, we can bail immediately.
s_activity_state.update_settings_counter -= 1;
if (s_activity_state.update_settings_counter > 0) {
return;
}
// The following sections of code can access the settings file and/or update globals,
// so we need to surround it with mutex owners... |
if (s_activity_state.need_activities_saved) {
// Save stored activities
ActivitySettingsKey key = ActivitySettingsKeyStoredActivities;
settings_file_set(file, &key, sizeof(key), s_activity_state.activity_sessions,
sizeof(s_activity_state.activity_sessions));
... |
Rect(4, -40, 72, 32),
GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL);
}
void draw_text_single_line_ellipsis_clip_outside_y(Layer* me, GContext* ctx) {
graphics_context_set_text_color(ctx, GColorBlack);
graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, 40, 72, 32),
... | GRect(39, 39, 82, 42) | );
}
void test_graphics_draw_text_${BIT_DEPTH_NAME}__clipping(void) {
GContext ctx;
Layer canvas;
Layer layer;
prv_setup_resources();
uint32_t gothic_24_handle = RESOURCE_ID_GOTHIC_24_BOLD;
cl_assert(text_resources_init_font(0, gothic_24_handle, 0, &s_font_info));
test_graphics_context_init(&ctx, fb);... |
ease:
storage_release();
return success;
}
static void handle_evt_gap_connected(ble_evt_gap_connected_t *evt) {
PBL_LOG(LOG_LEVEL_DEBUG, "Connected, idx=%d!", (int)evt->conn_idx);
prv_log_conn_params(&evt->conn_params);
if (!evt->is_master) {
// To be compliant with BT Core Spec section 7.8.9, stop adve... | (LOG_LEVEL_ERROR, "No connection for idx=%d", conn_idx) | |
}
}
if (!i2c_read_register_block(I2C_LIS3DH, register_address, read_size, buffer)) {
prv_reset();
return (false);
}
if (!running) {
accel_stop();
}
return (true);
}
bool lis3dh_write(uint8_t address, uint8_t write_size, const uint8_t *buffer) {
bool running = accel_running();
if (!runn... | {
uint8_t click_src;
lis3dh_read(LIS3DH_CLICK_SRC, 1, &click_src);
if (click_src & (1 << BOARD_CONFIG_ACCEL.accel_config.axes_offsets[AXIS_X])) {
axis = AXIS_X;
} else if (click_src & (1 << BOARD_CONFIG_ACCEL.accel_config.axes_offsets[AXIS_Y])) {
axis = AXIS_Y;
} else if (click_src & (1... | else {
// when no-one has subscribed, we only listen to the x axis
axis = AXIS_X;
// no sign info
direction = 0;
}
PebbleEvent e = {
.type = PEBBLE_ACCEL_SHAKE_EVENT,
.accel_tap = {
.axis = axis,
.direction = direction,
},
};
event_put(&e);
}
static void lis3dh_IRQ2_h... |
tstrapAttributeStateWritePending) &&
(new_state == SmartstrapAttributeStateIdle)) {
return pebble_task_get_current() == CONSUMER_TASK;
} else if ((current_state == SmartstrapAttributeStateRequestPending) &&
(new_state == SmartstrapAttributeStateIdle)) {
return pebble_task_get_current... | if (!attr) {
return false;
} | |
/*
* 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... | do_stuff2() | ;
mutex_unlock(global_lock);
}
void stuff2() {
mutex_lock(m_wrapper.m);
do_stuff2();
mutex_unlock(m_wrapper.m);
}
void nest2() {
mutex_lock(global_lock);
printf("blah %p", global_lock);
mutex_unlock(global_lock);
}
void nest() {
nest2();
}
void cond(void *glob_ptr) {
mutex_lock(global_lock);
... |
snprintf(snooze_buf, sizeof(snooze_buf), i18n_get(snooze_text, dialog), alarm_get_snooze_delay());
i18n_free(snooze_text, dialog);
dialog_set_text(dialog, snooze_buf);
dialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE);
dialog_set_background_color(dialog, GColorJaegerGreen);
dialog_set_timeout(di... | {
ActionMenuLevel *root_level = action_menu_get_root_level(action_menu);
AlarmDetailData *data = (AlarmDetailData *) context;
i18n_free_all(data);
task_free((void *)root_level->items[DetailMenuItemIndexSnooze].next_level);
task_free((void *)root_level);
task_free(data);
data = NULL;
} |
void alarm_detail_window_push(AlarmId alarm_id, AlarmInfo *alarm_info,
AlarmEditorCompleteCallback alarm_editor_callback,
void *callback_context) {
AlarmDetailData* data = task_malloc_check(sizeof(AlarmDetailData));
*data = (AlarmDetailData) {
.alarm... |
, int window_height) {
const uint16_t status_layer_offset = has_status_bar ? 6 : 0;
#if PLATFORM_ROBERT || PLATFORM_CALCULUS
const uint16_t icon_top_default_margin_px = 42 + status_layer_offset;
#else
const uint16_t icon_top_default_margin_px = 18 + status_layer_offset;
#endif
const uint16_t frame_height_claime... | dialog_pop(&simple_dialog->dialog) | ;
}
}
static void prv_config_provider(void *context) {
// Simple dialogs are dimissed when any button is pushed.
window_single_click_subscribe(BUTTON_ID_SELECT, prv_click_handler);
window_single_click_subscribe(BUTTON_ID_UP, prv_click_handler);
window_single_click_subscribe(BUTTON_ID_DOWN, prv_click_handler)... |
/*
* 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(prv_convert_content_size_between_platforms(PreferredContentSizeExtraLarge,
PlatformTypeDiorite,
PlatformTypeEmery),
PreferredContentSizeExtraLarge) | ;
// Converting from Emery to Chalk (one size down) with the minimum size should be clipped
cl_assert_equal_i(prv_convert_content_size_between_platforms(PreferredContentSizeSmall,
PlatformTypeEmery,
... |
1, 7, 4, 2, 1,
88, 52, 38, 28, 21, 15, 10, 7, 4, 2, 1,
96, 58, 43, 33, 25, 19, 13, 9, 6, 4, 2, 1,
104, 64, 49, 38, 29, 23, 17, 12, 8, 6, 3, 2, 1
};
MOCKABLE void graphics_line_draw_1px_non_aa(GContext* ctx, GPoint p0, GPoint p1) {
p0.x += ctx->draw_state.drawing_box.origin.x;
p1.x += ctx->draw_state.drawing_... | if (dx == dy) {
// Diagonal line
while (dy-- != 0) {
x1 += xi;
y1++;
graphics_private_plot_pixel(framebuffer, &ctx->draw_state.clip_box, x1, y1, MAX_PLOT_OPACITY,
stroke_color);
}
} else {
// Line is not horizontal, diagonal, or vertical
// Erro... | |
/*
* 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() | ;
mutex_lock(mutex);
cl_assert_equal_b(fake_mutex_all_unlocked(), false);
}
void test_fake_mutex__double_lock(void) {
fake_mutex_set_should_assert(false);
PebbleMutex *mutex = mutex_create();
mutex_lock(mutex);
mutex_lock(mutex);
cl_assert_equal_b(true, fake_mutex_get_assert_triggered());
}
void test_f... |
lientOpResponseHdr *event) {
const GattClientEventContext *data = event->context;
bt_lock();
{
//! Special case: writes to the "Client Characteristic Configuration Descriptor" are handled by
//! the gatt_client_subscriptions.c module.
if (data->client == GAPLEClientKernel
&& data->subtype == P... | {
GAPLEConnection *connection;
const uint16_t att_handle = handle_getter(obj_ref, &connection);
if (!att_handle) {
ret_val = BTErrnoInvalidParameter;
goto unlock;
}
GattClientEventContext *data = prv_create_event_context(client);
if (!data) {
ret_val = BTErrnoNotEnoughResource... |
unlock:
bt_unlock();
return ret_val;
}
BTErrno gatt_client_op_read(BLECharacteristic characteristic,
GAPLEClient client) {
return prv_read(characteristic, client,
gatt_client_characteristic_get_handle_and_connection,
PebbleBLEGATTClientEventTypeCha... |
/*
* 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... | (found, 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... | s_layout_constructors[id](config) | ;
}
bool layout_verify(bool existing_attributes[], LayoutId id) {
if (id == LayoutIdTest) {
return true;
} else if (id == LayoutIdUnknown || id >= NumLayoutIds) {
return false; // out of range
} else if (id == LayoutIdCommNotification) {
return false; // NYI
} else {
return s_layout_verifiers[i... |
again, just skip onto the next record spot
s_curr_state.offset_in_log_page += s_curr_state.bytes_remaining;
uint32_t payload_size = sizeof(LogRecordHeader) + msg_length;
if ((s_curr_state.offset_in_log_page + payload_size) <= LOG_PAGE_SIZE) {
goto done; // there is enough space in the current page
}
//... | state->line_cb(state->msg_buf, rec.length) | ) {
if (++state->retry_count >= DUMP_LOG_MAX_RETRIES) {
goto exit;
}
}
}
// Onto the next record
status = DumpStatus_InProgress;
state->retry_count = 0;
state->page_offset += rec.length + sizeof(rec);
}
// If we're done with this page, onto the next
if (page_... |
/*
* 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... | (2, 2, 28, 20) | , 4, GCornersAll);
}
void white_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_antialiased(ctx, false);
graphics_context_set_fill_color(ctx, GColorWhite);
graphics_fill_round_rect(ctx, &GRect(2, 2, 28, 20), 4, GCornersAll);
}
void clear_layer_update_callback(Layer* me, GContext* ctx) {
... |
o_increment_ticks(0);
// Let the first spawn finish
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, a0), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a0), 1);
cl_assert_equal_i... | animation_set_duration(a, duration_a) | |
blank_check(QSPIFlash *dev, uint32_t addr, bool is_subsector) {
qspi_use(dev->qspi);
#if TARGET_QEMU
// QEMU doesn't support memory-mapping the FLASH
const bool result = prv_blank_check_poll(dev, addr, is_subsector);
#else
const bool result = prv_blank_check_mmap(dev, addr, is_subsector);
#endif
qspi_release(... | (dev, 0, buffer_mmap, size) | ;
profiler_stop();
uint32_t mmap_time = profiler_get_total_duration(true);
profiler_start();
uint8_t instruction;
uint8_t dummy_cycles;
bool is_ddr;
prv_get_fast_read_params(dev, &instruction, &dummy_cycles, &is_ddr);
qspi_indirect_read_dma(dev->qspi, instruction, 0, dummy_cycles, buffer_dma, size, is_... |
&bpm, &hr_zone));
}
// ---------------------------------------------------------------------------------------
void test_workout_service__takeover_activity_session(void) {
int32_t steps, duration_s, distance_m, bpm, active_kcalories;
HRZone hr_zone;
// We have a session that started at ... | (steps, 10) | ;
cl_assert_equal_i(duration_s, 10);
cl_assert_equal_i(bpm, 110);
// Get some more new data and out stats still shouldn't change (except HR)
prv_inc_time(10);
prv_inc_steps_and_put_event(10);
prv_put_bpm_event(190, HRMQuality_Good);
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, ... |
GPoint p1;
GRect r0;
uint16_t radius;
uint8_t quadrant;
GCornerMask corner_mask;
int16_t major_axis_offset;
Fixed_S16_3 offset_start;
Fixed_S16_3 offset_stop;
bool anti_aliased;
uint16_t brightness;
GColor color;
GBitmap fb;
} ArgsForMock;
static ArgsForMock s_last_args_for_mock;
static GContext ... | {
s_last_args_for_mock = (ArgsForMock){
.ctx = *ctx,
.p0 = p,
.radius = radius
};
strncpy(s_last_args_for_mock.func, __func__, sizeof(s_last_args_for_mock.func));
} |
void graphics_internal_circle_quadrant_fill_aa(GContext* ctx, GPoint p,
uint16_t radius, GCornerMask quadrant) {
s_last_args_for_mock = (ArgsForMock){
.ctx = *ctx,
.p0 = p,
.radius = radius,
.corner_mask = quadrant
};
strncpy(s_last_args_for_mock.fu... |
{ 816, 40, -680},
{ 768, 16, -560},
{ 760, -8, -504},
{ 792, 0, -568},
{ 792, -40, -584},
{ 800, -64, -512},
{ 832, -16, -544},
{ 816, -104, -520},
{ 840, -56, -536},
{ 856, -56, -512},
{ 904, -48, -496},
{ 976, -32, -496},
{ 1064, -16, -440},
{ 1224, -32, -352},
... | { 1336, 8, -160},
{ 1240, 24, -112},
{ 1104, 56, -144},
{ 936, 96, -176},
{ 856, 96, -160},
{ 960, 56, -120},
{ 1064, 40, -24},
{ 1160, 56, 8},
// 78 seconds
{ 1072, 88, 0},
{ 904, 112, -72},
{ 840, 112, -216},
{ 896, 80, -192},
{ 936, 48, -240},
{ 960, 32, -2... |
{ 968, -96, -288},
{ 944, -88, -304},
{ 912, -72, -312},
{ 944, -56, -344},
{ 912, -80, -376},
{ 944, -88, -384},
{ 968, -96, -408},
{ 968, -112, -432},
{ 904, -128, -488},
{ 872, -144, -512},
{ 864, -176, -504},
{ 880, -192, -488},
{ 880, -200, -464},
{ 864, -18... |
e "applib/ui/ui.h"
#include "applib/ui/dialogs/dialog.h"
#include "applib/ui/dialogs/expandable_dialog.h"
#include "applib/ui/dialogs/simple_dialog.h"
#include "kernel/pbl_malloc.h"
#include "kernel/ui/system_icons.h"
#include "popups/ble_hrm/ble_hrm_stop_sharing_popup.h"
#include "resource/resource_ids.auto.h"
#includ... | {
SettingsRemoteData *remote_data = (SettingsRemoteData*) context;
StoredRemote *remote = &remote_data->remote;
GAPLEConnection *const connection = prv_le_connection_for_stored_remote(remote);
ble_hrm_revoke_sharing_permission_for_connection(connection);
app_simple_dialog_push(ble_hrm_stop_sharing_popup_cre... | |
/*
* 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... | { 888, 272, -240},
{ 896, 328, -224},
{ 1056, 368, -176},
{ 1312, 288, -96},
{ 1536, 232, -48},
{ 1504, 120, -48},
{ 1368, 56, 8},
{ 1280, 72, 0},
{ 1232, 88, -24},
{ 1176, 144, -48},
{ 1072, 96, -16},
{ 968, 32, -80},
{ 1080, 8, -152},
{ 896, -112, -208},
{ 7... |
{ 864, -224, -144},
{ 704, -304, -32},
{ 992, -192, -152},
{ 984, -112, -208},
// 5 seconds
{ 1216, -48, -240},
{ 1368, -24, -296},
{ 1112, 88, -240},
{ 872, 72, -248},
{ 960, 24, -224},
{ 1080, 72, -216},
{ 1136, 168, -264},
{ 1264, 272, -336},
{ 1456, 584, -472... |
/*
* 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... | fonts_get_font_height(text_node->font) | +
line_spacing_delta) - line_spacing_delta)
: 0;
text_node->overflow = GTextOverflowModeTrailingEllipsis;
text_node->alignment = PBL_IF_RECT_ELSE(GTextAlignmentLeft, GTextAlignmentCenter);
text_node->line_spacing_delta ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (s_reminder_timer) {
new_timer_delete(s_reminder_timer);
} | |
I_StructInit(&spi_cfg);
spi_cfg.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
spi_cfg.SPI_Mode = SPI_Mode_Master;
spi_cfg.SPI_DataSize = SPI_DataSize_8b;
spi_cfg.SPI_CPOL = SPI_CPOL_High;
spi_cfg.SPI_CPHA = SPI_CPHA_2Edge;
spi_cfg.SPI_NSS = SPI_NSS_Soft;
spi_cfg.SPI_BaudRatePrescaler = spi_find_prescal... | (DISP_SPI, SPI_I2S_FLAG_TXE) | |
_log(uint8_t level, const char* src_filename, int src_line_number, const char* fmt, ...) {}
int time_util_get_num_hours(int hours, bool is24h) {return 0;}
bool sys_clock_is_24h_style(void) {return false;}
void event_service_init(PebbleEventType type, EventServiceAddSubscriberCallback start_cb,
... | sys_wakeup_query(early_wakeup_id) | , early_event);
cl_assert_equal_i(early_wakeup_id, wakeup_get_next_scheduled());
// Set time 5 minutes into the future, early_event should fire
rtc_set_time(early_event);
// Force wakeup to check for current wakeup event.
wakeup_enable(false);
wakeup_enable(true);
// Simulate the firing of the early e... |
_nxny.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__offset_sw(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// TODO: Fix offset calculation and reenable this: - PBL-16509
#if SCREEN_COLOR_DEPTH_BITS == 8
// SW = 1
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CL... | (&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 5);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,... |
imingMenuIndex_30Min;
}
return PeekBeforeTimingMenuIndexDefault;
}
static void prv_before_time_menu_select(OptionMenu *option_menu, int selection, void *context) {
timeline_peek_prefs_set_before_time(s_before_time_values[selection]);
app_window_stack_remove(&option_menu->window, true /* animated */);
}
static... | i18n_get("Quick View", i18n_owner) | ;
/// Help text for the Timeline Quick View first use dialog.
const char *text = i18n_get("Appears on your watchface when an event is about to start.",
i18n_owner);
ExpandableDialog *expandable_dialog = expandable_dialog_create_with_params(
WINDOW_NAME("Timeline Quick View Firs... |
portENTER_CRITICAL() | ;
if (animation_private_using_legacy_2(state)) {
AnimationLegacy2Scheduler *legacy_state = (AnimationLegacy2Scheduler *)state;
prv_dump_legacy_animations(legacy_state->head, buffer, buffer_size);
} else {
prv_dump_animations(state->scheduled_head, true, buffer, buffer_size);
prv_dump_animations(stat... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ((uint8_t) (crc >> 16)) | ;
prv_put_byte_hdlc((uint8_t) (crc >> 24));
prv_put_hdlc_frame_delimiter();
}
if (s_timeout == 0) {
mic_stop(MIC);
PROFILER_STOP;
PROFILER_PRINT_STATS;
kernel_free(s_test_buffer);
accessory_enable_input();
#if RECOVERY_FW
const AccessoryInputState input_state = AccessoryInputStat... |
o 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 "clar.h"
#include "applib/graphi... | (&frame->command_list, 0) | ;
points2[0].x++; // increment x value to distinguish draw command from command in previous frame
*command = (GDrawCommand) {
.type = GDrawCommandTypePath,
.hidden = false,
.stroke_color = GColorRed,
.stroke_width = 5,
.fill_color = GColorBlack,
.path_open = false,
.num_points = ARRAY_LE... |
/*
* 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... | {
FirmwareDescription firmware_description;
flash_read_bytes((uint8_t*)&firmware_description, firmware_start_address,
sizeof(FirmwareDescription));
return firmware_description;
} |
bool firmware_storage_check_valid_firmware_description(FirmwareDescription* desc) {
return desc->description_length == sizeof(FirmwareDescription);
}
|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (LOG_LEVEL_INFO, "Consumer %d: requesting change to %d for %" PRIu16 "seconds",
consumer, state, max_period_secs) | |
t. Try reconnecting
// immediately upon disconnecting the charger:
bt_driver_reconnect_reset_interval();
bt_driver_reconnect_try_now(false /*ignore_paused*/);
}
#if STATIONARY_MODE
stationary_handle_battery_connection_change_event();
#endif
return;
}
case PEBBLE_BATTER... | do_not_disturb_handle_clock_change() | |
ed, true);
cl_assert_equal_b(sub_destroyed, true);
}
void test_recognizer__reset(void) {
bool reset = false;
bool cancelled = false;
s_test_impl_data.reset = &reset;
s_test_impl_data.cancelled = &cancelled;
NEW_RECOGNIZER(r) = test_recognizer_create(&s_test_impl_data, NULL);
recognizer_reset(r);
cl_as... | cl_assert_equal_i(last_touch_event.type, TouchEvent_Touchdown) | ;
cl_assert_equal_b(updated, true);
cl_assert_equal_i(rec_event, RecognizerEvent_Started);
updated = false;
new_state = RecognizerState_Updated;
recognizer_handle_touch_event(r, &(TouchEvent) { .type = TouchEvent_PositionUpdate });
cl_assert_equal_i(last_touch_event.type, TouchEvent_PositionUpdate);
cl_a... |
a_size(entry);
}
void resource_storage_clear(ResAppNum app_num) {
ResourceStoreEntry entry;
prv_get_store_entry(app_num, 0, &entry);
if (entry.impl) {
entry.impl->clear(&entry);
}
}
static bool prv_get_manifest_by_id(ResAppNum app_num, uint32_t resource_id,
ResourceManif... | if (resource_id == 0) {
return (prv_validate_store(&manifest, entry, app_num));
} else if (!prv_validate_entry(entry, &manifest, resource_id)) {
PBL_LOG(LOG_LEVEL_WARNING, "Resource %"PRId32" check for App %"PRIu32" failed",
resource_id, app_num);
return false;
} |
return true;
}
uint32_t resource_storage_generic_metadata_size(ResourceStoreEntry *entry) {
return RESOURCE_STORE_METADATA_BYTES;
}
bool resource_storage_generic_get_resource(ResourceStoreEntry *entry) {
ResourceManifest manifest;
prv_get_manifest(entry, &manifest);
if (entry->id > manifest.num_resources)... |
const int k_daily_total = 960;
for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++, day_in_week--) {
s_sys_activity_get_metric_values.out.history[i] = k_daily_total;
}
// ---
// Compute weekday step average from midnight to 9am. This should use the 15-minute
// step averages that we stuffed in.
uint32_t exp... | health_service_get_measurement_system_for_display(HealthMetricWalkedDistanceMeters) | ;
cl_assert_equal_i(actual, MeasurementSystemMetric);
}
void test_health__peek_current_value(void) {
const time_t now_utc = rtc_get_time();
// Set the return value to a valid time (Less than HS_MAX_AGE_HR_SAMPLE from the current time)
prv_override_metric(ActivityMetricHeartRateFilteredUpdatedTimeUTC, now_utc)... |
/*
* 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... | ((impl->curr_pos + length) <= impl->total_payload_size) | ;
memcpy(impl->payload + impl->curr_pos, data, length);
impl->curr_pos += length;
}
static void prv_wipe_receiver_data(DefaultReceiverImpl *receiver) {
*receiver = (DefaultReceiverImpl) { };
}
static void prv_default_kernel_receiver_cb(void *data) {
DefaultReceiverImpl *impl = (DefaultReceiverImpl *)data;
... |
ense, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed... | {
return data;
} | |
_equal(&state.pin.header.id, &s_items[4].header.id));
cl_assert(!iter_prev(&iterator));
timeline_iter_deinit(&iterator, &state, &head);
}
void test_timeline__skip_deleted_item(void) {
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_assert_equa... | cl_assert_equal_i(state.node->duration, MINUTES_PER_DAY) | |
0},
{ 0, 0x59, 0, 180},
{ 0, 0x59, 0, 180},
{ 0, 0x59, 0, 177},
// 1290: Local time: 11:05:00 PM
{ 0, 0x59, 0, 179},
{ 0, 0x59, 0, 180},
{ 0, 0x59, 0, 180},
{ 0, 0x59, 0, 179},
{ 0, 0x59, 0, 176},
{ 0, 0x59, 0, 180},
{ 0, 0x59, 0, 179},
{ 0, 0x59, 0, 179},
{ 0, 0x59, ... | { 0, 0x63, 0, 150},
{ 0, 0x63, 18, 149},
{ 0, 0x63, 803, 149},
{ 0, 0x44, 0, 149},
{ 0, 0x44, 75, 146},
{ 0, 0x44, 0, 149},
{ 0, 0x44, 0, 148},
{ 0, 0x44, 0, 149},
{ 0, 0x44, 0, 149},
{ 0, 0x44, 0, 146},
{ 0, 0x44, 0, 149},
{ 0, 0x44, 0, 149},
{ 0, 0x44, 0, 148},
... |
{ 0, 0x34, 1791, 152},
{ 0, 0x6b, 0, 152},
{ 0, 0x6b, 0, 152},
{ 0, 0x6b, 0, 152},
{ 0, 0x6b, 0, 149},
{ 0, 0x6b, 0, 152},
{ 0, 0x6b, 0, 151},
{ 0, 0x6b, 10, 151},
{ 0, 0x6b, 0, 151},
{ 0, 0x6b, 0, 148},
{ 0, 0x6b, 0, 151},
{ 0, 0x6b, 0, 151},
{ 0, 0x6b, 0, 151},
... |
/*
* 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 (metadata_bytes <= 0) {
return false;
} |
metadata_bytes += PNG_HEADER_SIZE;
bitmap_sequence->png_decoder_data.read_cursor = metadata_bytes;
bitmap_sequence->current_frame = 0;
bitmap_sequence->current_frame_delay_ms = 0;
if (reset_elapsed) {
bitmap_sequence->elapsed_ms = 0;
bitmap_sequence->play_index = 0;
}
return true;
}
//! Directl... |
// TODO: PBL-22075 Refactor Timeline Model
// timeline_model_get_current_state explicitly tries to return NULL when supposedly empty,
// but this does not seem to actually happen
if (!state) {
return;
}
TimelineItem *first_pin = &state->pin;
if (!first_pin) {
return;
}
TimelineLayout *first... | {
return TIMELINE_PAST_COLOR;
} | else {
return TIMELINE_FUTURE_COLOR;
}
}
T_STATIC void prv_init_peek_layer(TimelineAppData *data) {
Window *window = &data->timeline_window;
PeekLayer *peek_layer = &data->peek_layer;
const TimelineAppStyle *style = prv_get_style();
const GRect frame = { .origin.y = style->peek_offset_y, .size = window-... |
const bool did_get_attrs = ancs_util_get_attr_ptrs(data, length,
s_fetched_notif_attributes,
NUM_FETCHED_NOTIF_ATTRIBUTES,
s_ancs_client->attributes,
... | {
BLE_LOG_DEBUG("In ANCS service discovery CB");
PBL_ASSERTN(characteristics); // should only be called if we found something!
analytics_inc(ANALYTICS_DEVICE_METRIC_NOTIFICATION_ANCS_DISCOVERED_COUNT, AnalyticsClient_System);
// Pause while re-subscribing, it will be resumed when re-subscribed:
prv_ancs_is_a... |
bool ancs_can_handle_characteristic(BLECharacteristic characteristic) {
if (!s_ancs_client) {
return false;
}
for (int c = 0; c < NumANCSCharacteristic; ++c) {
if (s_ancs_client->characteristics[c] == characteristic) {
return true;
}
}
return false;
}
// ----------------------------------... |
),
.length_min = 5, // end = -13
};
// oldest to most-recent (looking at each session's start): 3, 2, 1, 0
// most-recent to oldest (looking at each session's end): 1, 0, 3, 2
const int num_sleep_sessions = 4;
const int num_restfulsleep_sessions = 2;
const int num_run_sessions = 1;
const int num_walk... | health_service_peek_current_activities() | |
cmd, size_t length) {
if (length != sizeof(cmd->erase)) {
prv_respond_malformed_command(cmd, length, NULL);
return;
}
if (s_erase_in_progress) {
EraseAndWriteAck *ack = pulse_best_effort_send_begin(
PULSE_PROTOCOL_FLASH_IMAGING);
*ack = (EraseAndWriteAck) {
.opcode = IMAGING_RESP_AC... | {
const SystemResourceBank *bank = resource_storage_flash_get_unused_bank();
region_base = bank->begin;
region_length = bank->end - bank->begin;
break;
} |
default:
region_base = 0;
region_length = 0;
break;
}
typedef struct PACKED RegionGeometry {
uint8_t opcode;
uint8_t region;
uint32_t address;
uint32_t length;
} RegionGeometry;
RegionGeometry *resp = pulse_best_effort_send_begin(
PULSE_PROTOCOL_FLASH_IMAGING);
*... |
ons; i++) {
for (uint32_t j = i + 1; j < num_sessions; j++) {
if (prv_session_compare(&sessions[i], &sessions[j], direction) > 0) {
ActivitySession temp = sessions[i];
sessions[i] = sessions[j];
sessions[j] = temp;
}
}
}
}
// -----------------------------------------------... | if (prv_is_heart_rate_metric(metric) && !sys_activity_prefs_heart_rate_is_enabled()) {
return HealthServiceAccessibilityMaskNoPermission;
} |
if (!prv_metric_aggregation_implemented(metric, time_start, time_end, aggregation, scope)) {
return HealthServiceAccessibilityMaskNotSupported;
}
// Get our state
HealthServiceState *state = prv_get_state(false);
HealthServiceTimeRange time_range = {};
HealthServiceDailyHistory daily_history = {};
... |
t Uuid *id,
uint8_t action_id, AttributeList *attributes) {
}
const PebbleProcessMd *timeline_get_app_info(void) {
return NULL;
}
void launcher_task_add_callback(void *data) {
}
void timeline_pin_window_push_modal(TimelineItem *item) {
}
PebblePhoneCaller* phone_call_util_create_caller(const char *number, con... | uuid_equal(&id, &item_temp.header.id) | );
cl_assert_equal_s(attribute_get_string(&item_temp.attr_list, AttributeIdTitle, "none"),
"title");
cl_assert_equal_s(attribute_get_string(&item_temp.attr_list, AttributeIdSubtitle, "none"),
"subtitle");
cl_assert(timeline_remove(&id));
cl_assert(!timeline_exists(&id));
cl_assert_equal_i(pin_db_get(... |
ntohs(header_big_endian->length) | ;
if (prv_handle_endpoint_error_and_skip_message_if_needed(session, endpoint, endpoint_id)) {
prv_skip_message(rtr, payload_length);
continue; // while (data_size)
}
PBL_LOG_D(LOG_DOMAIN_COMM, LOG_LEVEL_DEBUG,
"Receiving message: endpoint_id 0x%"PRIx16" (%"PRIu16"),... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.