prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ASSERT(s_size_4_called == 1) | |
.layout = LayoutIdWeather,
},
.attr_list = {
.num_attributes = 1,
.attributes = &title_attr,
},
};
// ALL DAY PIN
static TimelineItem item6 = {
.header = {
.id = {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
.timestamp = 100*60... | (fake_event_get_count(), 1) | |
riting, 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 <stdint.h>
#include <inttypes.h>
#incl... | (apb1_periphs, DISABLE) | ;
const uint32_t apb2_periphs = 0
| RCC_APB2Periph_TIM1
| RCC_APB2Periph_TIM8
| RCC_APB2Periph_USART1
| RCC_APB2Periph_USART6
| RCC_APB2Periph_ADC
| RCC_APB2Periph_SDIO
| RCC_APB2Periph_SPI1
| RCC_APB2Periph_SYSCFG
| RCC_APB2Periph_TIM9
| RCC_APB2Periph_TIM10
| RCC_APB2Per... |
TWO);
} else {
dbgserial_putstr("Failed to start firmware, strike one.");
boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE);
}
return false;
}
static bool check_force_boot_recovery(void) {
if (boot_bit_test(BOOT_BIT_FORCE_PRF)) {
boot_bit_clear(BOOT_BIT_FORCE_PRF);
return true;
}
if (button... | for (uint32_t j=1; j<=0xf; ++j) {
display_error_code(j << (i*4));
delay_us(200000);
} |
}
display_error_code(0x01234567);
delay_us(200000);
display_error_code(0x89abcdef);
delay_us(200000);
display_error_code(0xcafebabe);
delay_us(200000);
display_error_code(0xfeedface);
delay_us(200000);
display_error_code(0x8badf00d);
delay_us(200000);
display_error_code(... |
ate.receiver.buffer[extra_info_offset];
const uint32_t append_offset_magic = 0xBE4354EF;
if (ntohl(info->init_req_magic) == append_offset_magic) {
append_offset = ntohl(info->append_offset);
PBL_LOG(LOG_LEVEL_INFO, "Restarting FW Update at offset %"PRIu32, append_offset);
}
}
// Setup our s... | prv_mark_pb_jobs_complete(1) | ;
prv_cleanup_and_send_response((commit_succeeded) ? ResponseAck : ResponseNack);
}
static bool prv_is_valid_command_for_current_state(PutBytesCommand command) {
switch (s_pb_state.current_command) {
case PutBytesIdle:
return (command == PutBytesInit || command == PutBytesInstall);
case PutBytesInit:
r... |
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 "dictation_session.h"
#include "dictation_session_private.h"
#include "voice_... | if (session->in_progress) {
// we can't destroy a session while it is in progress,
// so we mark it as destroy pending and we'll destroy it later
session->destroy_pending = true;
return;
} |
prv_stop_session(session);
voice_window_destroy(session->voice_window);
applib_free(session);
#endif
}
void dictation_session_enable_confirmation(DictationSession *session, bool is_enabled) {
#if CAPABILITY_HAS_MICROPHONE
if (!session || session->in_progress) {
return;
}
voice_window_set_confirmation... |
= s_saturday;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 0);
// Only 1 pin should be added (for Saturday)
cl_assert_equal_i(s_num_timeline_adds, 1);
s_current_minute = 30;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 1);
cl_assert_equal_i(s_num_timeline_adds, 3);
}
vo... | cl_assert_equal_i(s_num_timeline_adds, 2) | ;
id2 = alarm_create(&(AlarmInfo) { .hour = 11, .minute = 30, .kind = ALARM_KIND_WEEKDAYS });
prv_assert_alarm_config(id2, 11, 30, false, ALARM_KIND_WEEKDAYS, s_weekday_schedule);
cl_assert_equal_i(s_num_timeline_adds, 4);
// First alarm goes off. Second one should be up
s_current_hour = 10;
s_current_min... |
wap_layer->swap_delay_remaining--;
return;
}
swap_layer->swap_delay_remaining = MESSAGE_SWAP_DELAY;
if ((max_dy - offset - FUDGE_PX) < SCROLL_PX) {
// if we can scroll a little more, let's do that instead.
// negative because we need to scroll down
dy = -(max_dy - offs... | window_multi_click_subscribe(BUTTON_ID_DOWN, 2, 2, 100, false, prv_down_multi_click_handler) | ;
SwapLayer *swap_layer = context;
if (swap_layer->callbacks.click_config_provider) {
swap_layer->callbacks.click_config_provider(swap_layer->context);
}
}
///////////////////////
// MISC FUNCTIONS
///////////////////////
static void prv_swap_layer_update_proc(Layer *layer, GContext* ctx) {
SwapLayer *sw... |
1320, 232, -24},
{ 1920, 272, 56},
{ 1464, 400, -40},
{ 792, 352, -104},
{ 912, 296, 0},
{ 1104, 192, 168},
{ 960, 152, 144},
{ 800, 104, 128},
{ 752, 168, 88},
{ 720, 104, 72},
{ 688, 40, 88},
{ 744, 72, 40},
{ 840, 16, 40},
{ 1040, 40, -24},
// 8 seconds
{ ... | { 704, 40, 96},
{ 720, 48, 80},
{ 816, 32, 56},
{ 968, -8, 0},
{ 1144, 48, 0},
{ 1664, -184, 184},
{ 1632, 88, 208},
{ 1096, 296, -200},
{ 920, 224, -280},
{ 872, 208, -64},
{ 680, 8, 0},
{ 736, 88, 64},
{ 872, 216, 64},
{ 856, 304, -8},
{ 832, 288, -96},
... | |
form*)&test_array));
t_c = GTransformFromNumbers(1, 2, 3, 4, 5, 6);
cl_assert(gtransform_is_equal(&t_c, (const GTransform*)&test_array));
// Test to make sure implemented rotation calculation is correct
int32_t angle = DEG_TO_TRIGANGLE(45);
int32_t cosine = cos_lookup(angle);
GTransformNumber num = GTrans... | gtransform_is_equal(&t_new, &t_c) | |
/*
* 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... | ADC_Cmd(ADC1, ENABLE) | |
art_tracking(false /*test_mode*/);
fake_system_task_callbacks_invoke_pending();
// No sessions active, ensure that asking if a run is ongoing returns false
cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Run));
cl_assert_equal_i(0, health_service_peek_current_activities()... | (false /*test_mode*/) | ;
fake_system_task_callbacks_invoke_pending();
// No sessions active, ensure that asking for run,walk,sleep returns false
cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Run));
cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Walk));
... |
prv_mon_config_unlock() | ;
return result;
}
bool pmic_set_charger_state(bool enable) {
// Defaults to ON
// Default value is 0xF7
const uint8_t register_value = enable ? 0xf7 : 0xf6;
bool result = prv_write_register(PmicRegisters_CHG_CNTL_A, register_value);
return result;
}
bool pmic_is_charging(void) {
uint8_t val;
if (... | |
e_size);
iter = prv_read_ptr(iter, data + length, &value_bytes, value_size);
// If we read too many bytes or didn't read all the bytes (2nd test)
if (!iter || (iter != (data + length))) {
prv_send_response(session, token, BLOB_DB_INVALID_DATA);
return;
}
// perform action on database and return resu... | (session, prv_try_read_token(data, length), BLOB_DB_TRY_LATER) | ;
return;
}
prv_blob_db_msg_decode_and_handle(session, cmd, data, data_length);
}
void blob_db_set_accepting_messages(bool enabled) {
s_bdb_accepting_messages = enabled;
}
|
action_bar_layer_set_background_color(action_bar,
expandable_dialog->action_bar_background_color);
}
if (expandable_dialog->select_icon) {
action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_SELECT,
expandable_dialog->select_icon, expandabl... | dialog_init(&expandable_dialog->dialog, dialog_name) | ;
Window *window = &expandable_dialog->dialog.window;
window_set_window_handlers(window, &(WindowHandlers) {
.load = prv_expandable_dialog_load,
.unload = prv_expandable_dialog_unload,
.appear = prv_expandable_dialog_appear,
});
expandable_dialog->show_action_bar = true;
window_set_user_data(windo... |
/*
* 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... | (radius * radius - y * y) | };
}
static Fixed_S16_3 prv_get_ellipsis_border(Fixed_S16_3 offset, uint32_t offset_radius_sq,
uint32_t opposite_radius_sq) {
if (offset_radius_sq == opposite_radius_sq) {
// We're dealing with a circle
return (Fixed_S16_3){.raw_value = integer_sqrt((offset_radius_s... |
the line height if there is a vertical overflow
const int line_height = fonts_get_font_height(text_box_params->font);
// We used to re-check for vertical overflow here
// but this is protected by a call to prv_line_iter_is_vertical_overflow,
// which will handle the truncation/clipping logic.
PBL_ASSERTN(wo... | (line, word_iter_state->text_box_params) | ;
return is_text_remaining;
}
static bool prv_text_layout_is_fresh(TextLayout* layout, GFont const font, const GRect box,
const GTextOverflowMode overflow_mode,
const GTextAlignment alignment, Codepoint text_hash) {
PBL_ASSERTN(layout);
... |
ring, new_tuple->value->cstring, sizeof(data->duration_string));
break;
case SPORTS_LABEL_KEY:
{
const bool is_pace = MIN(new_tuple->value->uint8, 1);
WorkoutMetricType metric_type = is_pace ? WorkoutMetricType_Pace : WorkoutMetricType_Speed;
if (metric_type != data->pace_speed_metric) {... | {
case WorkoutMetricType_Hr:
return data->current_bpm;
default:
return 0;
} |
}
static const char *prv_get_distance_string(const char *miles_string, const char *km_string) {
SportsAppData *data = app_state_get_user_data();
const Tuple *metric_tuple = app_sync_get(&data->sync, SPORTS_UNITS_KEY);
uint8_t is_metric = 1;
if (metric_tuple != NULL) {
is_metric = MIN(metric_tuple->value-... |
ttp://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing perm... | PBL_LOG(LOG_LEVEL_ERROR, "Invalid version request") | ;
return;
}
struct VersionsPhoneResponseV3 *response = (struct VersionsPhoneResponseV3 *)data;
CommSessionCapability capability_flags = 0;
// If this is an old V1 response, use defaults for new fields introduced since V1
// NOTE: The 1.X Android mobile app has a bug which causes it to send double lengt... |
ce/resource_ids.auto.h"
#include "services/common/clock.h"
#include "services/common/i18n/i18n.h"
#include "services/normal/activity/health_util.h"
#include "services/normal/activity/workout_service.h"
#include "system/logging.h"
#include <stdio.h>
#define BACKGROUND_COLOR PBL_IF_COLOR_ELSE(GColorYellow, GColorWhite)... | (&summary_window->status_layer) | ;
layer_deinit(&summary_window->base_layer);
window_deinit(&summary_window->window);
i18n_free_all(summary_window);
app_free(summary_window);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//! Public API
WorkoutSummaryWindow *workout_summary_... |
/*
* 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... | menu_layer_legacy2_init(layer, &frame) | ;
}
return layer;
}
void menu_layer_legacy2_set_callbacks(MenuLayer *menu_layer,
void *callback_context,
MenuLayerCallbacksLegacy2 callbacks) {
menu_layer_set_callbacks(menu_layer, callback_context, &(MenuLayerCallbacks) {
.get_n... |
nt)-1;
// unsupported values don't change the value
EXECUTE_SCRIPT("ctx.textAlign = 123;\n");
cl_assert_equal_i(-1, s_rocky_text_state.alignment);
EXECUTE_SCRIPT("ctx.textAlign = 'unknown';\n");
cl_assert_equal_i(-1, s_rocky_text_state.alignment);
EXECUTE_SCRIPT("ctx.textAlign = 'left';\nvar a = ctx.textA... | GSize(123, 456) | ;
EXECUTE_SCRIPT(
"var tm = ctx.measureText('foo');\n"
"var tm_w = tm.width;\n"
"var tm_h = tm.height;\n"
);
ASSERT_JS_GLOBAL_EQUALS_I("tm_w", 123);
ASSERT_JS_GLOBAL_EQUALS_I("tm_h", 456);
cl_assert_equal_i(1, s_graphics_text_layout_get_max_used_size.call_count);
const MockCallRecording *lc = &... |
tring, SOME_STRING, strlen(SOME_STRING) + 1) == 0);
// Check zero termination:
cl_assert(tuple->value->cstring[strlen(SOME_STRING)] == 0);
string_found = true;
break;
case SOME_UINT8_KEY:
cl_assert(tuple->length == sizeof(uint8_t));
cl_assert(tuple->value->uint8 == ... | (new_tuple->type == TUPLE_BYTE_ARRAY) | |
pected_min_slots, uint16_t expected_max_slots) {
cl_assert_equal_i(s_min_advertising_interval_slots, expected_min_slots);
cl_assert_equal_i(s_max_advertising_interval_slots, expected_max_slots);
}
bool gap_le_is_advertising_enabled(void) {
return s_is_le_advertising_enabled;
}
static Advertising_Data_t s_ad_dat... | (device->address) | ,
};
GAP_LE_Event_Data_t event = (GAP_LE_Event_Data_t) {
.Event_Data_Type = etLE_Disconnection_Complete,
.Event_Data_Size = sizeof(GAP_LE_Disconnection_Complete_Event_Data_t),
.Event_Data.GAP_LE_Disconnection_Complete_Event_Data = &event_data,
};
if (is_master) {
prv_fake_gap_le_create_connecti... |
_rate_total_weight_x100_out = state->hr.metrics.previous_median_total_weight_x100;
}
}
// --------------------------------------------------------------------------------------------
void activity_metrics_prv_reset_hr_stats(void) {
ActivityState *state = activity_private_state();
mutex_lock_recursive(state->mute... | {
new_history.values[i] = ROUND(full_day_resting_calories, ACTIVITY_CALORIES_PER_KCAL);
} |
}
}
// Copy values from old history into correct slot in new history
for (int i = 0; i < ACTIVITY_HISTORY_DAYS; i++) {
int new_index = i + old_age;
if (new_index >= 0 && new_index < ACTIVITY_HISTORY_DAYS) {
new_history.values[new_index] = old_history.values[i];
... |
ocated || (heap_info_ptr->Size < n_units)) {
/* If the requested size is larger than the limit then*/
/* search backwards for an available buffer, else go */
/* forward. This will hopefully help to reduce */
/* fragmentataion problems. */
if (n_units >= LA... | (ptr, 0, size) | ;
}
return ptr;
}
void* heap_calloc(Heap* const heap, size_t count, size_t size, uintptr_t client_pc) {
return heap_zalloc(heap, count * size, client_pc);
}
uint32_t heap_get_minimum_headroom(Heap *heap) {
return (heap_size(heap) - heap->high_water_mark);
}
// Serial Commands
////////////////////////////////... |
/*
* 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... | {
for (int i = 0; i < (int)num_lines; i++) {
GRect box = {
.origin = gpoint_add(GPoint((spacing + width) * i - width,
offsets_y ? offsets_y[i] : 0), offset),
.size = { width, heights[i] },
};
graphics_fill_rect(ctx, &box);
}
} |
void peek_animations_draw_compositor_foreground_speed_lines(GContext *ctx, GPoint offset) {
static const uint16_t s_upper_heights[] = { 48, 73, 78, 48, 48, 48, 61, 48 };
prv_draw_vertical_lines(ctx, ARRAY_LENGTH(s_upper_heights), NULL /* offsets_y */,
s_upper_heights, LINE_WIDTH, LINE_SP... |
/*
* 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.photo_en.gpio) | ;
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = BOARD_CONFIG.photo_en.gpio_pin;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_Init... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | assert_buffer_not_touched(6) | ;
}
void test_cobs_decode__input_truncated(void) {
const char vector[] = { 0x05, 'a', 'b', 'c' };
decode_start(100);
assert_decode_succeeds(vector, sizeof(vector));
assert_decode_completed(SIZE_MAX);
}
|
-1232, 168, 24},
{ -1400, 464, -264},
{ -1512, 520, -392},
{ -1368, 24, -8},
{ -1160, -24, 152},
{ -1064, 240, 128},
{ -984, 352, 104},
{ -912, 280, 136},
{ -816, 208, 176},
{ -696, 160, 200},
{ -608, 200, 152},
{ -584, 272, 72},
{ -832, 352, 40},
{ -1208, 424, 112},
... | { -1472, 480, 96},
{ -1440, 456, 152},
{ -1296, 200, 248},
{ -1272, 208, 272},
{ -1256, 136, 224},
// 55 seconds
{ -1104, 160, 240},
{ -920, 208, 160},
{ -880, 168, 192},
{ -984, 48, 200},
{ -864, -80, 208},
{ -976, -40, 144},
{ -1000, 264, -88},
{ -1120, 288, -80... | |
is_valid_entry_update_time, location_pstring_length);
return false;
}
if (prv_entry_update_time_too_old_to_be_valid(entry->last_update_time_utc)) {
PBL_LOG(LOG_LEVEL_WARNING, "Weather entry too old to fill forecast");
return false;
}
*forecast_out = (WeatherLocationForecast) {
.is_curren... | task_zalloc_check(entry_len) | ;
status_t rv = weather_db_read((uint8_t *)&default_location_key, sizeof(default_location_key),
(uint8_t *)entry, entry_len);
if (rv != S_SUCCESS) {
goto free_entry;
}
WeatherLocationForecast *forecast_out = task_zalloc_check(sizeof(WeatherLocationForecast));
if (prv_fill_f... |
ers attached to the window pointed to by the manager.
// Note: This is kind of weird because we could just request the top window of the app, but I want
// to keep the decision making of when to cancel recognizers and change the window that the
// manager points to (when windows are pushed and popped) outside thi... | layer_get_recognizer_list(curr) | , iter_cb, manager);
curr = curr->parent;
}
}
static void prv_set_triggered(RecognizerManager *manager, Recognizer *triggered) {
manager->triggered = triggered;
if (triggered) {
manager->state = RecognizerManagerState_RecognizersTriggered;
}
}
static bool prv_cancel_or_fail_recognizer(Recognizer *reco... |
!= NULL) {
bt_driver_gap_le_disconnect(&connection->device);
} else {
PBL_LOG(LOG_LEVEL_ERROR, "PPoGatt: disconnect attempt failed, no connection for char 0x%x",
(int)characteristic);
#if !RELEASE
// Observed this path getting hit in PBL-43336, let's try to collect a core ... | (client, next_sn) | ;
comm_session_send_queue_consume(client->session, num_bytes_acked);
// If next_data_sn is before the Ack'd sn, the packet pending retransmission has just been
// Ack'd. We can determine whether or not a packet is pending retransmission by checking if the
// payload size for next_data_sn is not 0. This... |
/*
* 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... | {
AppWorkerResult result = app_worker_launch();
APP_LOG(APP_LOG_LEVEL_INFO, "launch result: %d", result);
} |
static void select_click_handler(ClickRecognizerRef recognizer, void *context) {
AppWorkerMessage m;
app_worker_send_message('x', &m);
APP_LOG(APP_LOG_LEVEL_INFO, "crashing worker");
}
static void down_click_handler(ClickRecognizerRef recognizer, void *context) {
AppWorkerResult result = app_worker_kill();
... |
/*
* 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 NULL;
} |
// Get the path of the filename before the extension
size_t prv_get_base_path(const char *filename, char *base) {
char *ext = strrchr(filename, '.');
size_t len;
if (ext == NULL) {
len = strlen(filename);
} else {
len = ext - filename;
}
strncpy(base, filename, len);
base[len] = '\0';
return ... |
40, 48, 184},
{ 552, 128, 112},
{ 688, 208, 96},
{ 648, 352, 24},
{ 760, 512, -120},
{ 792, 360, -96},
{ 952, 256, -32},
{ 1304, 400, -120},
{ 1384, 272, 24},
// 5 seconds
{ 1872, 336, 96},
{ 1408, 464, 24},
{ 792, 384, 56},
{ 1296, 336, -392},
{ 1008, -200, 416},... | { 864, 160, 184},
{ 760, 160, 88},
{ 736, 128, 88},
{ 728, 104, 80},
{ 728, 88, 48},
{ 752, 40, 96},
{ 864, 48, 56},
{ 1096, 112, -16},
{ 1248, 8, 88},
{ 1752, 0, 192},
{ 1144, 248, -80},
{ 1024, 272, -56},
// 11 seconds
{ 1056, 232, -40},
{ 696, 224, 88},
... |
{ 864, 312, 40},
{ 896, 392, -72},
{ 944, 384, -128},
{ 1200, 440, -208},
{ 1208, 280, -88},
{ 1960, 240, -16},
{ 1400, 376, 16},
{ 968, 384, -64},
{ 960, 384, 16},
{ 1088, 232, 136},
{ 920, 112, 184},
{ 784, 112, 112},
{ 736, 104, 88},
{ 776, 88, 88},
{ 776,... |
idnight
.tm_mday = 6, // 6st day of the month
.tm_mon = 0, // January
.tm_year = 2014 - 1900,
.tm_isdst = 0,
};
// DST info for US/Canada 2014
TimezoneInfo tz_info = {
.dst_start = 1394330400, // Sun, 09 Mar 2014 02:00
.dst_end = 1414893600// Sun, 02 Nov 2014 02:00
};
time_util_update... | rtc_set_time(event_time - SECONDS_PER_DAY - (14 * SECONDS_PER_HOUR) - 2) | |
prv_end_workout_down_click_handler);
}
static void prv_end_workout(void *context) {
WorkoutActiveWindow *active_window = context;
WorkoutDialog *workout_dialog = &active_window->end_workout_dialog;
workout_dialog_init(workout_dialog, "Workout End");
Dialog *dialog = workout_dialog_get_dialog(workout_dialog);... | (active_window->heart_icon) | ;
gbitmap_destroy(active_window->hr_measuring_icon);
action_bar_layer_deinit(&active_window->action_bar);
status_bar_layer_deinit(&active_window->status_layer);
layer_deinit(&active_window->top_metric_layer);
layer_deinit(&active_window->scrollable_metric_layer);
layer_deinit(&active_window->bas... |
line(ctx, GPoint(5, 35), GPoint(45, 40));
}
void across_x_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_line(ctx, GPoint(50, 40), GPoint(70, 35));
}
void across_nx_layer_update_callback(Layer* me... | ("draw_line_inside_origin_layer") | ));
layer_set_update_proc(&layer, &white_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&... |
/*
* 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 1337;
} |
#include "kernel/memory_layout.h"
const MpuRegion* memory_layout_get_app_region(void) {
return NULL;
}
bool memory_layout_is_buffer_in_region(const MpuRegion *region, const void *buf, size_t length) {
return true;
}
// We can't include all of stubs_process_manager because it conflicts with fake_app_manager.h
boo... |
d_notification(LoadedNotificationNode *loaded_notif) {
timeline_item_free_allocated_buffer(&loaded_notif->notification);
gdraw_command_image_destroy(loaded_notif->icon);
app_free(loaded_notif);
}
static NOINLINE LoadedNotificationNode *prv_loaded_notification_list_load_item(
LoadedNotificationNode **loaded_l... | prv_load_notification_storage(data) | ;
actionable_dialog_pop(data->actionable_dialog);
// Create and display DONE dialog
SimpleDialog *confirmation_dialog = simple_dialog_create("Notifications Cleared");
Dialog *dialog = simple_dialog_get_dialog(confirmation_dialog);
dialog_set_text(dialog, i18n_get("Done", data));
dialog_set_icon(dialog, RES... |
= prv_structured_glance_create_title_text_node(structured_glance);
// We require a valid title node
PBL_ASSERTN(title_node);
// Push the title node a little up or down to match the relevant design spec
#if PLATFORM_ROBERT
title_node->offset.y += 1;
#else
title_node->offset.y -= 1;
#endif
graphics_text_node... | grect_inset_internal(glance_frame, horizontal_inset, 0) | ;
GTextNode *structured_glance_node = prv_create_structured_glance_node(structured_glance,
&glance_frame);
if (structured_glance_node) {
graphics_text_node_draw(structured_glance_node, ctx, &glance_frame, NULL, NULL);
}
graphics_text_n... |
ING, "Le Disconnect but no version info?");
} else {
analytics_event_bt_le_disconnection(reason, vers_info->version_number,
vers_info->company_identifier,
vers_info->subversion_number);
}
}
num_events_logged++;
}
voi... | PBL_LOG(LOG_LEVEL_INFO, "%sBytes Conn Stats: Events: %"PRIu32", Sync Errs: %"PRIu32
", Skipped Events: %"PRIu32" Other Errs: %"PRIu32, is_putbytes ? "Put" : "Get",
stats_buf->num_conn_events, stats_buf->num_sync_errors,
stats_buf->num_conn_events_skipped, prv_calc_other_errors(stats_buf)) | ;
return true;
}
return false;
}
void bluetooth_analytics_handle_put_bytes_stats(bool successful, uint8_t type, uint32_t total_size,
uint32_t elapsed_time_ms,
const SlaveConnEventStats *orig_stats) {
SlaveConnEve... |
/*
* 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(system_flash_erase(FLASH_BASE, 48 KiB, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 2), erased_sector);
cl_assert(flash_locked);
} |
void callback_is_called_cb(uint32_t num, uint32_t den, void *context) {
callback_called = true;
cl_assert_equal_i(8675309, (uintptr_t)context);
}
void test_system_flash__callback_is_called(void) {
cl_assert(system_flash_erase(FLASH_BASE, 16 KiB, callback_is_called_cb,
(void *)8675309));
cl_assert... |
d activity_sessions_prv_get_sleep_bounds_utc(time_t now_utc, time_t *enter_utc, time_t *exit_utc) {
ActivitySession activity_sessions[MAX_ACTIVITY_SESSIONS];
uint32_t num_sessions = MAX_ACTIVITY_SESSIONS;
activity_get_sessions(&num_sessions, activity_sessions);
uint32_t total_seconds = 0;
*enter_utc = 0;
*... | {
if (num_sessions_returned >= *session_entries) {
// No more room
break;
}
time_t session_end = s_data.activity_sessions[i].start_utc
+ s_data.activity_sessions[i].length_min * SECONDS_PER_MINUTE;
if (session_end >= sleep_earliest_end_utc) {
// This session shou... |
*session_entries = num_sessions_returned;
return true;
}
SettingsFile *activity_private_settings_open(void) {
static SettingsFile file = {};
return &file;
}
void activity_private_settings_close(SettingsFile *file) {
return;
}
bool activity_get_step_averages(DayInWeek day_of_week, ActivityMetricAverages *a... |
n 1900;
}
uint8_t activity_prefs_heart_get_elevated_hr(void) {
return 100;
}
uint8_t activity_prefs_heart_get_zone1_threshold(void) {
return 130;
}
uint8_t activity_prefs_heart_get_zone2_threshold(void) {
return 154;
}
uint8_t activity_prefs_heart_get_zone3_threshold(void) {
return 172;
}
AppInstallId app_... | cl_assert_equal_i(5900, s_total_step_count) | ;
cl_assert_equal_i(distance_m, 1201 /* 1.2km in 5 mins is reasonable */);
cl_assert_equal_i(duration_s, 5 * SECONDS_PER_MINUTE);
// Get some HR info
prv_put_bpm_event(100, HRMQuality_Good);
cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m,
... |
/*
* 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... | (message, packet, length) | ;
pulse_best_effort_send(message, length);
return;
case LLC_INMSG_CHANGE_BAUD:
prv_handle_change_baud((char*)packet + 1, length - 1);
return;
default:
prv_bad_packet_response(LLC_OUTMSG_INVALID_LLC_MESSAGE, type,
(char*)packet + 1, length - 1);
... |
;
for (unsigned i = 0; i < input.msrmt.num_samples; i++) {
rtc_set_time(input.msrmt.time_utc + input.msrmt.offset_sec[i]);
success = protobuf_log_session_add_measurements(session_ref, rtc_get_time(),
input.msrmt.num_types,
... | (offset_sec) | ,
.offset_sec = offset_sec,
.num_values = ARRAY_LENGTH(values),
.values = values,
}
};
ProtobufLogRef ref = prv_test_encode_measurements(&input, false /*use_data_logging*/);
prv_test_decode_payload(&input, false /*use_data_logging*/, ref);
}
// ---------------------------------------------... |
d_str, (char *)filename);
if (find_str == NULL) {
node->name = kernel_strdup_check(filename);
} else {
node->name = ((PFSFileChangedCallbackNode *)find_str)->name;
}
s_head_callback_node_list = list_prepend(s_head_callback_node_list, &node->list_node);
mutex_unlock_recursive(s_pfs_mutex);
return n... | PFS_FD(fd) | |
R_SECOND);
rtc_set_time(s_saturday_00_00);
do_not_disturb_handle_clock_change();
active = do_not_disturb_is_active();
cl_assert(active == true);
// Timer will go off at 10:00 on Saturday. (10 hours)
cl_assert_equal_i(stub_new_timer_timeout(get_dnd_timer_id()), 36000 * MS_PER_SECOND);
rtc_set_time(s_satu... | do_not_disturb_is_active() | |
isplayCalibrationData *data = window_get_user_data(layer_get_window(layer));
switch (data->state) {
case DisplayCalibrationState_X_Adjust:
if (data->offset.x > -MAX_OFFSET_MAGNITUDE) {
prv_draw_arrow(layer, ctx, &data->arrow_left, GAlignLeft);
}
if (data->offset.x < MAX_OFFSET_MAGNITUDE... | gbitmap_set_palette(bitmap, palette, true /* free on destroy */) | ;
}
void settings_display_calibration_push(WindowStack *window_stack) {
DisplayCalibrationData *data = task_zalloc_check(sizeof(DisplayCalibrationData));
*data = (DisplayCalibrationData) {
.offset = shell_prefs_get_display_offset()
};
shell_prefs_set_should_prompt_display_calibration(false);
display_set... |
ent_type != HRMEvent_BPM) {
return;
}
const BleHrmServiceMeasurement measurement = {
.bpm = hrm_event->bpm.bpm,
.is_on_wrist = (hrm_event->bpm.quality > HRMQuality_NoSignal),
};
BTDeviceInternal sharing_to_devices[4];
const size_t num_devices = prv_copy_sharing_devices(sharing_to_devices,
... | if (is_sharing) {
if (s_ble_hrm_subscription_count == 0) {
prv_reschedule_popup_timer();
prv_execute_on_kernel_main(prv_start_hrm_kernel_main);
}
++s_ble_hrm_subscription_count;
} else {
--s_ble_hrm_subscription_count;
if (s_ble_hrm_subscription_count == 0) {
prv_stop_popup_timer... | |
2-bit
graphics_context_set_stroke_color_2bit(&context, GColor2Black);
cl_assert(gcolor_equal(context.draw_state.stroke_color, GColorBlack));
// Fill Color
graphics_context_set_fill_color(&context, GColorClear);
cl_assert_equal_i(context.draw_state.fill_color.argb, GColorClear.argb);
color = GColorOrange;
... | (graphics_circle_draw_1px_non_aa(&context, GPoint(50, 50), 10)) | ;
#endif
setup_test(&context, true, 1, GColorBlack, GColorBlack, false);
graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4);
#if PBL_COLOR
ASSERT_CALLED(prv_draw_round_rect_aa(&context, &GRect(20, 80, 40, 10), 4));
#else
ASSERT_CALLED(prv_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4));
#endif... |
kt_data->current_bpm);
wrkt_data->current_bpm_timestamp_ts = time_get_uptime_seconds();
if (!workout_service_is_paused()) {
// TODO: Maybe apply smoothing
wrkt_data->hr_zone_time_s[wrkt_data->current_hr_zone] +=
wrkt_data->current_bpm_timestamp_ts - prev_bpm_timestamp_ts;
wrkt_data-... | prv_lock() | ;
{
#if CAPABILITY_HAS_BUILTIN_HRM
s_workout_data.hrm_session =
sys_hrm_manager_app_subscribe(app_get_app_id(), 1, 0, HRMFeature_BPM);
#endif // CAPABILITY_HAS_BUILTIN_HRM
s_workout_data.frontend_last_opened_ts = time_get_uptime_seconds();
prv_put_event(PebbleWorkoutEvent_FrontendOpened);
}
pr... |
void format_current_chunk(void) {
uint32_t addr = get_current_address(s_current_chunk, 0);
PBL_ASSERT((addr & (SUBSECTOR_SIZE_BYTES - 1)) == 0,
"Sections must be subsector aligned! addr is 0x%" PRIx32, addr);
PBL_ASSERT((CHUNK_SIZE_BYTES & (SUBSECTOR_SIZE_BYTES - 1)) == 0,
"Sections divide into subse... | flash_read_bytes((uint8_t*) &chunk_header, get_generation_address(generation, i, 0), sizeof(chunk_header)) | ;
if (chunk_header.invalid || !chunk_header.valid) {
// No more valid chunks
break;
}
if (i == 0 || serial_distance(lowest_chunk_id, chunk_header.chunk_id, CHUNK_ID_BIT_WIDTH) < 0) {
lowest_chunk_index = i;
lowest_chunk_id = chunk_header.chunk_id;
}
++num_valid_chunks;
}... |
file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS O... | MIN(sector_start, subsector_start) | ;
int32_t end_addr = MAX(sector_end, subsector_end);
if (sector_start >= sector_end) {
// Can't erase any full sectors; just erase subsectors the whole way.
start_addr = subsector_start;
end_addr = subsector_end;
}
if (start_addr == end_addr) {
// Nothing to do!
on_complete(context, S_NO_A... |
ll layed out
graphics_text_layout_get_max_used_size(&gcontext, "JR\n\n\nWhop", font, box, GTextOverflowModeFill, GTextAlignmentLeft, (void*)&layout);
cl_assert_equal_i(layout.box.size.w, box.size.w);
cl_assert_equal_i(layout.max_used_size.w, 4 * HORIZ_ADVANCE_PX); // Fill replaces \n's with spaces, so we will a... | cl_assert_equal_i(l.flow_data.paging.page_on_screen.size_h, 6) | ;
}
void test_text_layout__disable_text_flow(void) {
TextLayoutExtended l = {.flow_data.perimeter.impl = (const GPerimeter *)(1234)};
graphics_text_attributes_restore_default_text_flow((GTextLayoutCacheRef) &l);
cl_assert_equal_p(l.flow_data.perimeter.impl, NULL);
}
// just a fake value to have something to com... |
and_draw_row(ctx, menu_layer, cell_layer, cursor, true);
}
// Restore current drawing state:
graphics_context_set_drawing_state(ctx, prev_state);
}
static inline void prv_menu_layer_draw_section_header(MenuLayer *menu_layer, Layer *cell_layer,
MenuCellSpan *cursor, GContext* ctx) {
cell_layer->bounds.size... | {
// Reached last row
break;
} |
if (it->row_callback_before_geometry) {
it->row_callback_before_geometry(it);
}
it->cursor.h = prv_menu_layer_get_cell_height(it->menu_layer, &it->cursor.index, true);
it->cell_bottom_y = it->cursor.y + it->cursor.h;
// ROW
if (it->row_callback_after_geometry) {
i... |
also marks
// the session inactive and frees the memory used for maintaining the active state. See the
// comments above in dls_lock_session() for a description of the locking strategy.
void dls_unlock_session(DataLoggingSession *session, bool inactivate) {
mutex_lock_recursive(s_list_mutex);
PBL_ASSERTN(session-... | (s_list_mutex) | ;
}
// The newlib headers do not expose this because of the __STRICT_ANSI__ define
extern int rand_r(unsigned *seed);
uint8_t dls_list_add_new_session(DataLoggingSession *logging_session) {
// generate random ID
int loops = 0;
uint8_t session_id;
unsigned seed = rtc_get_time() ^ (uintptr_t)&session_id;
do {... |
h_parameters(info_text_layer2,
&above_pair_text,
data->info_text_layer2_buffer,
fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD),
GColorBlack, GColorClear, GTextAlignmentCenter,
... | {
GAlign alignment;
const int16_t width_of_sidebar = data->action_bar_layer.layer.frame.size.w;
const int16_t window_width = data->window.layer.bounds.size.w;
const int16_t config_width = window_width - width_of_sidebar + 10;
int16_t x_offset, y_offset, width;
switch (data->ui_state) {
case BTPairingUI... |
static void prv_send_response(bool is_confirmed) {
if (!s_data_ptr) {
return;
}
bt_lock();
bt_driver_pairing_confirm(s_data_ptr->ctx, is_confirmed);
bt_unlock();
}
static bool prv_has_device_name(BTPairingUIData *data) {
return (strlen(data->device_name_layer_buffer) != 0);
}
static bool prv_has_co... |
/*
* 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 (value_length >= MAX_VALUE_SIZE_BYTES) {
PBL_LOG(LOG_LEVEL_WARNING, "Length of record value exceeds maximum length.");
return -1;
} | |
/! with `app_db_get_app_entry_for_install_id`
status_t app_db_get_app_entry_for_uuid(const Uuid *uuid, AppDBEntry *entry) {
return app_db_read((uint8_t *)uuid, sizeof(Uuid), (uint8_t *)entry, sizeof(AppDBEntry));
}
status_t app_db_get_app_entry_for_install_id(AppInstallId app_id, AppDBEntry *entry) {
status_t rv =... | {
// app install something
app_install_do_callbacks(new_install ? APP_AVAILABLE : APP_UPGRADED, app_id, NULL, NULL, NULL);
} | |
_HEIGHT 24
#define ROW_LENGTH 32
static void draw_color_wheel_box(GContext* ctx, AppData *data) {
GPoint origin = GPoint(8, 114);
GColor compare_color = GColorClear;
uint8_t color_index_match = 0;
uint16_t height_offset = 0;
bool compare = true;
if (data->property == PROPERTY_FG_COLOR) {
compare_color ... | fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD) | ;
graphics_context_set_stroke_color(ctx, GColorWhite);
graphics_draw_rect(ctx, &GRect(71, 0, 73, 111)); // Border around BG
graphics_context_set_fill_color(ctx, data->bg_color);
graphics_fill_rect(ctx, &GRect(72, 0, 72, 110));
graphics_context_set_text_color(ctx, GColorWhite);
graphics_draw_text(ctx, "... |
.client = client,
.is_response_required = is_response_required,
.value = buffer,
.value_length = value_length,
};
if (s_write_head) {
list_append((ListNode *)s_write_head, &write->node);
} else {
s_write_head = write;
}
return BTErrnoOK;
}
BTErrno gatt_client_op_write(BLECharacteristic... | free(old_write) | ;
}
|
D
Rule US 2007 max - Nov Sun>=1 2:00 0 S
Mar 8th 2015 10:00 UTC ~ Nov 1st 2015 09:00 UTC, GMT-8 */
[31]={ 1425808800, 1446368400,-8 * SECONDS_PER_HOUR },
/* Uruguay (Uruguay) [America/Montevideo]
* Uruguay has abandoned DST */
[32]={ 0, ... | rtc_get_time() | , jan1st_noon_2005);
time_t t = rtc_get_time();
struct tm now;
localtime_r(&t, &now);
time_t timestamp = clock_to_timestamp(TODAY, now.tm_hour, now.tm_min + 1);
cl_assert_equal_i(timestamp, t + 60);
}
}
void test_clock__cross_dst(void) {
struct tm oct_31 = {
.tm_sec = 0,
.tm_min = 59,... |
eader.height_px has been 'borrowed' to mean the number of
// 4-bit RLE units used to encode the glyph. We determine the height by decoding the number of
// bits and then dividing by the width. glyph.height_px must be updated!
if (HAS_FEATURE(font_res->md.version, VERSION_FIELD_FEATURE_RLE4)) {
// Two RLE4 uni... | if (cached) {
if (cached->resource_offset == 0) {
// missing character
return NULL;
}
if (need_bitmap &&
!cached->is_bitmap_loaded &&
!prv_load_glyph_bitmap(codepoint, font_res, cached)) {
return NULL;
}
return &cached->glyph_data;
} |
// We missed the cache, so we need to build a new cache entry.
LineCacheData *data = &font_cache->cache_data_scratch;
data->is_bitmap_loaded = false;
data->resource_offset = prv_get_glyph_data_offset(codepoint, font_cache, font_res);
GlyphData *g = &data->glyph_data;
if (data->resource_offset == 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... | health_service_peek_current_value(HealthMetricHeartRateBPM) | ;;
}
}
static void prv_sync_error_callback(DictionaryResult dict_error, AppMessageResult app_message_error,
void *context) {
PBL_LOG(LOG_LEVEL_DEBUG, "Sports error! dict: %u, app msg: %u", dict_error,
app_message_error);
}
static void prv_update_scrollable_metrics(SportsA... |
/*
* 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... | (0x3, 0x3, NULL, 0) | ;
break;
case 1: {
PBL_LOG(LOG_LEVEL_DEBUG, "===LE Transmit Test===");
uint8_t params[] = {0x00, 0x20, 0x01};
hci_rom_passthrough_send_cmd(0x8, 0x1e, ¶ms[0], sizeof(params));
break;
}
case 2:
PBL_LOG(LOG_LEVEL_DEBUG, "===LE Stop Tx Test===");
hci_rom_passthrough... |
strlen(app_name) + 1;
node->name = app_malloc_check(len);
strncpy(node->name, app_name, len);
prv_sorted_add(source, node);
}
static AppMenuNode * prv_find_node_with_install_id(const AppInstallId install_id,
const AppMenuDataSource * const source) {
AppMenuNode *... | list_get_next((ListNode*)node) | |
yer, no_activities_string, NULL, NULL);
}
static uint16_t prv_get_num_rows_cb(OptionMenu *option_menu, void *context) {
SettingsActivityTrackerData *data = context;
const uint16_t count = prv_num_rows(data);
return count + 1;
}
static void prv_draw_row_cb(OptionMenu *option_menu, GContext *ctx, const Layer *cel... | {
static const SettingsModuleMetadata s_module_info = {
.name = i18n_noop("Background App"),
.init = prv_init,
};
return &s_module_info;
} | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | graphics_draw_bitmap_in_rect_processed(&s_ctx, &bitmap, &rect, NULL) | ;
// And it should try to draw the bitmap
cl_assert_equal_i(s_bitblt_bitmap_into_bitmap_tiled_calls.call_count, 1);
// Passing a processor with NULL functions shouldn't cause any problems
GBitmapProcessor processor = {0};
graphics_draw_bitmap_in_rect_processed(&s_ctx, &bitmap, &rect, &processor);
// And it... |
cket *packet = malloc(sizeof(PPoGATTPacket) + sizeof(s_short_data_fragment));
packet->sn = sn;
packet->type = PPoGATTPacketTypeData;
memcpy(packet->payload, s_short_data_fragment, sizeof(s_short_data_fragment));
ppogatt_handle_read_or_notification(characteristic, (const uint8_t *) packet,
... | free(s_client_reset_complete) | ;
}
void prv_notify_services_discovered(int num_services_to_register) {
for (int i = 0; i < s_num_service_instances && i < num_services_to_register; i++) {
ppogatt_handle_service_discovered(s_characteristics[i]);
}
}
void test_ppogatt__find_pebble_app_and_3rd_party_app(void) {
prv_notify_services_discovered... |
// Attribute ID - AttributeIdTimestamp
0x04, 0x00, // Attribute Length
// Slice expiration time:
0x94, 0x64, 0x4F, 0x57, // 1464820884 (Wed, 1 June 2016 22:41:24 GMT)
0x30, // Attribute ID - AttributeIdIcon
0x04, 0x00, // Attribute Length
// Slice ... | ((uint8_t *)&APP_GLANCE_TEST_UUID, invalid_key_length,
(uint8_t *)&s_app_glance_basic,
sizeof(s_app_glance_basic)) | ,
E_INVALID_ARGUMENT);
// Invalid val length should fail
const size_t invalid_val_size = sizeof(SerializedAppGlanceHeader) - 1;
cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE,
(uint8_t *)&s_app_glance_basic, invalid_... |
/*
* 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... | GPoint(45, 40) | );
}
void across_x_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_context_set_antialiased(ctx, false);
graphics_draw_line(ctx, GPoint(50, 40), GPoint(70, 35));
}
void across_nx_layer_update_callback(Layer* me, GContext* ctx) {
graphics_context_s... |
ll_layer->bounds;
const int16_t horizontal_padding = 10;
const int16_t vertical_padding = is_selected ? 6 : 0;
rt_rect = grect_inset_internal(rt_rect, horizontal_padding, vertical_padding);
// Calculate where the mark should be drawn
const GSize mark_size = mark->bounds.size;
GRect mark_rect = (GRect) { .s... | (&box, &container_rect, GAlignTopRight, true /* clip */) | ;
prv_draw_mark_with_inversion(ctx, fcc_mark_icon, &box, cell_is_highlighted);
}
static void prv_draw_fcc_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;
const bool ... |
[7] = {true, false, false, false, false, true, false};
alarm_set_custom(id, custom_schedule2);
prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_CUSTOM, custom_schedule2);
}
void test_alarm__alarm_get_custom_days(void) {
AlarmId id1, id2;
bool schedule_1[7] = {true, false, false, false, false, false, true}... | (s_num_timeline_adds, 9) | ;
cl_assert_equal_i(s_num_timeline_removes, 3);
alarm_set_enabled(id2, false);
prv_assert_alarm_config(id2, 4, 14, true, ALARM_KIND_EVERYDAY, s_every_day_schedule);
cl_assert_equal_i(s_num_timeline_adds, 12);
cl_assert_equal_i(s_num_timeline_removes, 9);
AlarmId invalid_id = 7;
alarm_set_enabled(invalid... |
ql_down = 25;
s_test_id_watchface = 42;
s_test_id_worker = 47;
// test removing all and more bytes
prv_cleanup();
to_free = SIZE_SUM - after_free;
before_size = app_cache_get_size();
PBL_LOG(LOG_LEVEL_DEBUG, "%d %d %d", to_free, after_free, before_size);
cl_assert(before_size >= to_free);
cl_assert_e... | for (uint32_t i = 0; i < ARRAY_LENGTH(descriptions); ++i) {
prv_check_file_exists(descriptions[i].name);
} | |
/*
* 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 ((action_bar->state_change_times[i] != 0 &&
(now - action_bar->state_change_times[i]) <= PRESS_ANIMATION_DURATION_MS) ||
(action_bar->icon_change_times[i] != 0 &&
(now - action_bar->icon_change_times[i]) <= ICON_CHANGE_ANIMATION_DURATION_MS)) {
prv_register_redraw_timer(action... | |
ze) {
if (s_saved_encoded_msg != NULL) {
free(s_saved_encoded_msg);
s_saved_encoded_msg = NULL;
}
s_saved_encoded_msg = malloc(buf_size);
cl_assert(s_saved_encoded_msg != NULL);
memcpy(s_saved_encoded_msg, buffer, buf_size);
return true;
}
// This structure used to capture the contents of a decode... | (" %"PRIu32" measurements: ", s_parsed_msg.msrmt.num_samples) | ;
for (unsigned i = 0; i < s_parsed_msg.msrmt.num_samples; i++) {
LOG(" offset_sec: %"PRIu32"", s_parsed_msg.msrmt.offset_sec[i]);
for (unsigned j = 0; j < s_parsed_msg.msrmt.num_types; j++) {
LOG(" 0x%"PRIx32"",
s_parsed_msg.msrmt.values[i * s_parsed_msg.msrmt.num_types ... |
e %u",
uuid_string, header.payload_length);
rv = false;
}
}
prv_file_close(fd);
return rv;
}
//! @return is_advanced
static bool prv_iter_next(NotificationIterState *iter_state) {
int result = pfs_read(iter_state->fd, (uint8_t *)&iter_state->header, sizeof(iter_state->header));
// Res... | pfs_seek(fd, header.payload_length, FSeekCur) | < 0) {
break;
}
}
prv_file_close(fd);
return found;
}
static bool prv_compare_ancs_notifications(TimelineItem *notification, const uint8_t *payload,
size_t payload_size, SerializedTimelineItemHeader *header, int fd) {
if ((notification->header.timestamp != header->common.timestamp) ||
(... |
-176, -168},
{ 1416, 56, -408},
{ 1360, -24, -352},
{ 1288, -8, -392},
{ 1104, -48, -328},
{ 960, -32, -568},
{ 720, -344, -744},
{ 800, -168, -168},
{ 872, 144, -24},
{ 960, 448, -152},
{ 1208, 536, -328},
{ 1344, 448, -256},
{ 1416, 368, -80},
{ 1256, 416, 32},
... | { 2192, 192, -520},
{ 1544, 408, -520},
{ 1304, 528, -256},
{ 1392, 312, -424},
{ 1552, 360, -184},
{ 1264, 400, -152},
{ 1528, 504, -104},
{ 1200, 728, 136},
// 40 seconds
{ 1088, 1136, -200},
{ 1056, 944, -224},
{ 1128, 768, -288},
{ 1456, 648, -168},
{ 2040, 59... |
{ 1288, 536, -112},
{ 1720, 408, -80},
{ 1552, 144, -56},
{ 1328, 32, -72},
{ 1168, 24, -72},
{ 1080, 104, -72},
{ 1072, 160, -152},
{ 992, 168, -104},
{ 1144, 128, -72},
{ 1096, 112, -216},
{ 984, 48, -184},
{ 1128, 24, -48},
{ 1272, 152, -240},
{ 1280, 176, -24... |
/*
* 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_get_context(animation) | ;
// We need to artificially limit how frequent we attempt to update the screen. If we update
// it too fast the thing we wanted to do in the background never gets done. This isn't quite
// ideal, as around 60 steps is when things are actually smooth, but 60 is too fast and does
// restrict the speed of our co... |
/*
* 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... | (window_layer, card_layer) | ;
window_set_background_color(&window, health_activity_summary_card_get_bg_color(card_layer));
window_set_on_screen(&window, true, true);
window_render(&window, &s_ctx);
}
// Tests
//////////////////////
void test_health_activity_summary_card__render_no_data(void) {
prv_create_card_and_render(&(HealthData) {}... |
lechg_node = (PFSFileChangedCallbackNode *)node;
return (strcmp(filechg_node->name, (char *)data) == 0);
}
PFSCallbackHandle pfs_watch_file(const char* filename, PFSFileChangedCallback callback,
uint8_t event_flags, void* data) {
mutex_lock_recursive(s_pfs_mutex);
PFSFileChanged... | (file_name, f->name, f->namelen) | ;
if ((res = pfs_close(fd)) >= 0) {
res = pfs_remove(file_name);
}
}
mutex_unlock_recursive(s_pfs_mutex);
return (res);
}
status_t pfs_remove(const char *name) {
if (name == NULL) {
return E_INVALID_ARGUMENT;
}
size_t namelen = strlen(name);
if ((namelen < 1) || (namelen > FILE_MAX_NA... |
otted_line_odd_offset_even_cols_no_clip")));
// Odd cols of different lengths
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_ODD, OFFSET_RECT_ODD, false, 1);
graphics_draw_vertical_line_dotted(&ctx, GPoint(1, 0), MAX_NUM_ROWS);
graphics_draw_vertical_line_dotted(&ctx, GPoint(3, 0), MAX_NUM_ROWS + 4);
graphics_draw_v... | (&ctx, GPoint(45, 75), 5) | |
ORIGIN_RECT_CLIP_NXNY, true, 11);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
}
void test_graphics_draw_round_rect_${BIT_DEPTH_NAME}__origin_sw(void) {
GContext ctx;
... | setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 5) | ;
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 5);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW... |
obal(void) {
char test_object[] = "var t = typeof _rocky";
// global doesn't exist in plain Jerry context
EXECUTE_SCRIPT(test_object);
ASSERT_JS_GLOBAL_EQUALS_S("t", "undefined");
// rocky_global_init() injects global...
static const RockyGlobalAPI *apis[] = {
NULL,
};
rocky_global_init(apis);
... | prv_add_event_listener_to_list("b", jerry_create_external_function(prv_listener_b)) | |
e_perip_wdog_id);
hc_protocol_process_receive_buffer();
extern bool should_log_about_mic_error(uint32_t *max_subsequent_failures);
uint32_t num_subsequent_failures = 0;
if (should_log_about_mic_error(&num_subsequent_failures)) {
hc_endpoint_analytics_log_mic_error_detected(num_subsequent_failure... | hci_rom_passthrough_handle_evt(&((irb_ble_stack_msg_t *)hdr)->msg.hci.evt) | |
cter(dest, (utf8_t *)"hello", 5);
cl_assert_equal_i(copied, 1);
cl_assert_equal_s((char *)dest, "h");
}
void test_utf8__copy_multibyte_char(void) {
utf8_t dest[5];
memset(dest, 0, 5);
size_t copied = utf8_copy_character(dest, (utf8_t *)NIHAO, 5);
cl_assert_equal_i(copied, NIHAO_FIRST_CHARACTER_BYTES);
... | utf8_truncate_with_ellipsis("Hello", output_buffer, 6) | );
free(output_buffer);
}
|
/*
* 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 INSTALL_ID_INVALID;
} |
static PebbleProcessMd s_process_md;
const PebbleProcessMd* app_manager_get_current_app_md(void) {
return &s_process_md;
}
static int s_consumed_count;
static AppOutboxStatus s_last_status_code;
void app_outbox_service_consume_message(AppOutboxMessage *message, AppOutboxStatus status) {
s_last_status_code = stat... |
0 /* flags */);
if (!timer_started) {
kernel_free(new_timer_context);
goto error;
}
prompt_send_response("OK");
return;
error:
prompt_send_response("ERROR");
}
// Perform a button press from the serial console. Three responses are provided
// to users/tools using the i... | (buffer, flash_addr, sizeof(buffer)) | ;
}
(void)data;
}
void command_log_dump_spam(void) {
prompt_send_response("Spam logs!");
for (int i = 0; i < 16; ++i) {
system_task_add_callback(spam_callback, (void *)(uintptr_t) i);
}
}
#ifdef TEST_FLASH_LOCK_PROTECTION
#include "flash_region/flash_region.h"
#include "drivers/task_watchdog.h"
#include... |
for (unsigned i = 0; i < num_samples * num_values_per_sample; i++) {
values[i] = i * 3;
}
// Create a session with an artifically small buffer size which will cause it to flush
// automatically
time_t start_time = rtc_get_time();
ProtobufLogConfig log_config = {
.type = ProtobufLogType_Measurements,... | protobuf_log_hr_create(transport_cb) | ;
cl_assert(session_ref != NULL);
const uint32_t values_per_samples = input.msrmt.num_types;
bool success;
for (unsigned i = 0; i < input.msrmt.num_samples; i++) {
rtc_set_time(input.msrmt.time_utc + input.msrmt.offset_sec[i]);
uint32_t *vals = &input.msrmt.values[i * values_per_samples];
success =... |
// 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 (PFS_FD(fd).fd_status == FD_STATUS_FREE) {
*fdp = fd;
return (FDAvail);
}
if (PFS_FD(fd).fd_status == FD_STATUS... | prv_page_to_flash_offset(file->curr_page) | + AVAIL_BYTES_OFFSET + pg_offset);
bytes_written += bytes_to_write;
file->offset += bytes_to_write;
if (bytes_written == size) {
break;
}
pg_offset = 0; // first usable byte next page
if (get_next_page(file->curr_page, &file->curr_page) != S_SUCCESS) {
PBL_LOG(LOG_LEVEL_WARNING, ... |
/*
* 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;
} |
((AnimationPrivate*)animation)->immutable = true;
return true;
}
bool WEAK animation_is_immutable(Animation *animation) {
if (!animation) {
return false;
}
return ((AnimationPrivate*)animation)->immutable;
}
bool WEAK animation_set_reverse(Animation *animation, bool reverse) {
if (!animation) {
r... |
temsNumItems:
break;
}
return ALARM_KIND_EVERYDAY;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//! Day Picker
static void prv_day_picker_window_unload(Window *window) {
AlarmEditorData *data = (AlarmEditorData*) window_get_user_data(window);
if ... | (cell_index->row, callback_context) | ;
} else {
data->day_picker_was_completed = true;
prv_handle_selection(cell_index->row, callback_context);
}
}
static void prv_setup_day_picker_window(AlarmEditorData *data) {
window_init(&data->day_picker_window, WINDOW_NAME("Alarm Day Picker"));
window_set_user_data(&data->day_picker_window, 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... | (buffer + pos, buffer_size - pos, " "EN_DASH) | ;
}
}
Window *health_activity_detail_card_create(HealthData *health_data) {
HealthActivityDetailCardData *card_data = app_zalloc_check(sizeof(HealthActivityDetailCardData));
card_data->daily_avg = health_data_steps_get_monthly_average(health_data);
const GColor fill_color = PBL_IF_COLOR_ELSE(GColorIslamicGre... |
e;
}
i2c_init_struct.I2C_ClockSpeed = BOARD_CONFIG.i2c_bus_configs[bus_idx].clock_speed;
i2c_init_struct.I2C_Ack = I2C_Ack_Enable;
I2C_Init(i2c_buses[bus_idx].i2c, &i2c_init_struct);
I2C_Cmd(i2c_buses[bus_idx].i2c, ENABLE);
}
//! Configure the bus pins, enable the peripheral clock and initialize the I2C per... | if (bus->user_count == 0) {
bus_disable(bus_idx);
} |
bus_unlock(bus);
}
void i2c_reset(I2cDevice device_id) {
PBL_ASSERTN(s_initialized);
PBL_ASSERTN(device_id < BOARD_CONFIG.i2c_device_count);
uint8_t bus_idx = BOARD_CONFIG.i2c_device_map[device_id];
I2cBus *bus = &i2c_buses[bus_idx];
// Take control of bus; only one task may use bus at a time
bus_loc... |
uncher_task_add_callback(prv_launch_app_cb, (void*) mfg_display_app_get_info());
}
static void prv_select_runin(int index, void *context) {
launcher_task_add_callback(prv_launch_app_cb, (void*) mfg_runin_app_get_info());
}
static void prv_select_vibe(int index, void *context) {
launcher_task_add_callback(prv_laun... | app_malloc(sizeof(s_menu_items)) | ;
memcpy(*out_menu_items, s_menu_items, sizeof(s_menu_items));
// Now we're going to modify the first two elements in the menu to include data available only
// at runtime. If it was available at compile time we could have just shoved it in the
// s_menu_items array but it's not. Note that we allocate a few bu... |
/*
* 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... | q->yield_cb(xQueue) | ;
if (ticks_waited >= xTicksToWait) {
return pdFALSE;
}
}
}
}
}
QueueHandle_t xQueueGenericCreate(unsigned portBASE_TYPE uxQueueLength,
unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType) {
uint16_t item_size;
const bool is_semph = (u... |
turn uxtime;
}
#endif // RECOVERY_FW
T_STATIC void prv_update_dstrule_timestamps_by_dstzone_id(TimezoneInfo *tz_info, time_t utc_time) {
if (tz_info->dst_id == 0) {
tz_info->dst_start = 0;
tz_info->dst_end = 0;
return;
}
#if defined(RECOVERY_FW)
return;
#else
// Load the pair of TimezoneDSTRule o... | {
// If we have a timezone _actually_ set, update our own.
int region_id = clock_get_timezone_region_id();
prv_clock_get_timezone_info_from_region_id(region_id, tz_adjust_time, &tz_adjust_info);
tz_info = &tz_adjust_info; // We need to set timezone info so point to the new info.
} |
}
// Note: update the timezone before setting the utc time. (If we set the utc
// time first we could wind up accidentally applying the timezone correction
// to that value in the case where no timezone data previously existed
// ... such as a migration from legacy firmware or after the RTC backup
// doma... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.