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... | {
find_info->children_ids[find_info->num_children++] = hdr.common.id;
} | |
just always try removing from the list:
const bool is_removed = remove_app_with_install_id(install_id, source);
if (is_removed) {
prv_alert_data_source_changed(source);
}
}
//! Called when an application is uninstalled
static void prv_app_removed_callback(const AppInstallId install_id, void *data) {
AppMe... | {
prv_unload_list_item_icon(source, node);
list_remove((ListNode*)node, (ListNode**)&source->list, NULL);
app_free(node->name);
app_free(node);
} |
static void add_app_with_install_id(const AppInstallEntry *entry, AppMenuDataSource *source) {
if (source->is_list_loaded == false) {
return;
}
AppMenuNode *node = app_malloc_check(sizeof(AppMenuNode));
*node = (AppMenuNode) {
.install_id = entry->install_id,
.app_num = app_install_get_app_icon_b... |
"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 <bluetooth/pebble_pairing_service.h>
#include "comm/ble/gap_le_connect_params.h"
#include "comm/ble/gap_le_co... | {
goto unlock;
} |
const size_t length = (conn_params_length - offsetof(PebblePairingServiceConnParamsWrite,
remote_desired_state));
switch (conn_params->cmd) {
case PebblePairingServiceConnParamsWriteCmd_SetRemoteParamMgmtSettings:
prv_handle_set_remote_para... |
/*
* 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_fu_app_data && s_fu_app_data->spinner_should_close) {
app_window_stack_pop(false /* animated */);
s_fu_app_data->spinner_is_visible = false;
s_fu_app_data->spinner_should_close = false;
} |
}
static void prv_show_spinner(RecoveryFUAppData *data) {
if (!data->spinner_is_visible) {
Window *spinner_window = spinner_ui_window_get(PBL_IF_COLOR_ELSE(GColorRed, GColorDarkGray));
app_window_stack_push(spinner_window, false /* animated */);
}
data->spinner_is_visible = true;
data->spinner_should_... |
prompt_send_response("Starting BT sleep check test") | ;
s_sleep_test_timer = new_timer_create();
new_timer_start(s_sleep_test_timer , 10, prv_sleep_timer_test_cb, (void *)(uintptr_t)0, 0);
prompt_command_continues_after_returning();
}
void command_btle_unmod_tx_start(char *tx_channel) {
bt_driver_start_unmodulated_tx(atoi(tx_channel));
}
void command_btle_unmod... | |
/*
* 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... | { abort(); } | );
while (1);
}
void pbl_log(uint8_t log_level, const char* src_filename,
int src_line_number, const char* fmt, ...) {
printf("%s:%d ", src_filename, src_line_number);
va_list args;
va_start(args, fmt);
vprintf(fmt, args);
va_end(args);
printf("\n");
}
bool process_manager_compiled_with_leg... |
/*
* 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... | kino_reel_custom_get_data(reel) | |
top_margin_px;
h = bounds->size.h - y;
// Set up the text.
TextLayer *text_layer = &dialog->text_layer;
text_layer_init_with_parameters(text_layer, &GRect(x, y, w, h),
dialog->buffer, dialog_text_font,
dialog->text_color, GColorClear, text_ali... | (actionable_dialog) | ;
}
}
Dialog *actionable_dialog_get_dialog(ActionableDialog *actionable_dialog) {
return &actionable_dialog->dialog;
}
void actionable_dialog_push(ActionableDialog *actionable_dialog, WindowStack *window_stack) {
dialog_push(&actionable_dialog->dialog, window_stack);
}
void app_actionable_dialog_push(Actionabl... |
xt_set_fill_color(ctx, color);
graphics_context_set_stroke_color(ctx, color);
if (data->fill) {
if (shape == POINT) {
graphics_draw_pixel(ctx, data->point_p0);
} else if (shape == LINE) {
graphics_draw_line(ctx, data->line_p0, data->line_p1);
} else if (shape == SQUARE) {
graphics_fill... | window_set_click_config_provider(window, click_config_provider) | ;
const bool animated = true;
app_window_stack_push(window, animated);
// Initialize shapes
// Point properties
data->point_p0 = GPoint(1, 1);
data->point_velocity_x = 1;
data->point_velocity_y = 1;
// Line properties
data->line_p0 = GPoint(0, 0);
data->line_p1 = GPoint(10, 10);
data->line_vel... |
/*
* 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... | (GPointZero, image_bounds_offset) | ;
}
static void prv_offset_layer_test(GPoint image_bounds_offset) {
prv_layer_test(TEST_LAYER_OFFSET_ORIGIN, image_bounds_offset);
}
static void prv_bitmap_layer_test(GPoint frame_origin, GPoint bounds_origin) {
BitmapLayer bitmap_layer;
const GRect bitmap_layer_frame = (GRect) {
.origin = frame_origin,
... |
icense for the specific language governing permissions and
* limitations under the License.
*/
#include "services/normal/notifications/alerts.h"
#include "services/normal/notifications/alerts_private.h"
#include "clar.h"
#include "stdbool.h"
// Stubs
/////////////////////////////////
#include "stubs_analytics.h"
... | (AlertMobile) | );
alerts_set_notification_vibe_timestamp();
fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS);
cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile));
cl_assert(alerts_should_notify_for_type(AlertReminder));
cl_assert(!alerts_should_vibrate_for_type(AlertReminder));
alerts_se... |
/*
* 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... | (NULL, NULL, NULL, NULL) | , false);
}
void test_shared_prf_storage_v2__getting_started_complete(void) {
shared_prf_storage_wipe_all();
cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), false);
shared_prf_storage_set_getting_started_complete(true);
cl_assert_equal_b(shared_prf_storage_get_getting_started_complete(), t... |
{ -144, -88, -1000},
{ -152, -96, -976},
{ -144, -80, -984},
{ -152, -80, -1016},
{ -152, -112, -992},
{ -152, -72, -968},
{ -144, -80, -1000},
{ -160, -128, -1040},
{ -136, -96, -1000},
{ -136, -72, -968},
{ -152, -64, -984},
{ -144, -112, -1064},
{ -136, -80, -1000},
... | { -152, -152, -984},
{ -160, -152, -992},
{ -168, -152, -992},
{ -152, -144, -992},
{ -152, -144, -992},
{ -160, -152, -1000},
{ -160, -168, -960},
{ -176, -128, -1000},
{ -160, -144, -992},
{ -160, -136, -1008},
{ -152, -112, -1000},
{ -136, -88, -1008},
{ -144, -104... |
{ -168, -144, -992},
{ -160, -144, -1000},
{ -168, -144, -992},
// 129 seconds
{ -184, -144, -984},
{ -184, -136, -1008},
{ -176, -136, -984},
{ -160, -144, -992},
{ -184, -160, -992},
{ -192, -152, -1000},
{ -168, -144, -976},
{ -168, -144, -1000},
{ -176, -136, -10... |
// Stubs
//////////////////////////////////////////////////////////
#include "stubs_heap.h"
#include "stubs_hexdump.h"
#include "stubs_logging.h"
#include "stubs_mutex.h"
#include "stubs_passert.h"
#include "stubs_pbl_malloc.h"
#include "stubs_pebble_tasks.h"
#include "stubs_print.h"
#include "stubs_prompt.h"
#include ... | cl_assert_equal_s(str, "abc 42b") | ;
//----------------------------------------------------
pbl_snprintf(str, STR_SIZE, "abc %hf%s", "a", 1.0, "b");
cl_assert_equal_s(str, fp_msg);
pbl_snprintf(str, STR_SIZE, "abc %hd%s", 42, "b");
cl_assert_equal_s(str, "abc 42b");
//----------------------------------------------------
pbl_snprintf(str,... |
/*
* 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 (highlighted) {
action_bar->is_highlighted |= bit;
} else {
action_bar->is_highlighted &= ~bit;
prv_register_redraw_timer(action_bar);
} |
action_bar->state_change_times[index] = prv_get_precise_time();
layer_mark_dirty(&action_bar->layer);
}
void action_bar_changed_proc(ActionBarLayer *action_bar, GContext* ctx) {
if (action_bar->layer.window && action_bar->layer.window->on_screen == false) {
// clear first, fixes issue of returning from othe... |
prv_count_handler_entries(&s_stopped_handler_calls, b1) | , 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b2), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b3), 1);
// Make sure the all the spawn a stopped handlers got called before any of the spawn b
// started handlers
uint32_t last_fire_a = 0;
last_fire... | |
GTextAlignmentRight : GTextAlignmentCenter));
uint16_t right_aligned_box_reduction = PBL_IF_RECT_ELSE(0, show_action_bar ? 10 : 0);
if (has_header) {
const uint16_t HEADER_OFFSET = 6;
#if PBL_RECT
x = left_margin_px;
w = frame.size.w - right_margin_px - left_margin_px - ac... | action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_SELECT,
expandable_dialog->select_icon, expandable_dialog->show_action_icon_animated) | ;
}
action_bar_layer_set_context(action_bar, expandable_dialog);
action_bar_layer_set_click_config_provider(action_bar, prv_config_provider);
action_bar_layer_add_to_window(action_bar, window);
} else {
window_set_click_config_provider_with_context(window, prv_config_provider, expandable_dialog);
... |
/*
* 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... | WEATHER_TYPE_TUPLE(id, numeric_id, bg_color, text_color, timeline_resource_id) | text_color,
#include "services/normal/weather/weather_type_tuples.def"
};
static TimelineResourceId s_weather_type_timeline_resource_ids[] = {
#define WEATHER_TYPE_TUPLE(id, numeric_id, bg_color, text_color, timeline_resource_id) \
timeline_resource_id,
#include "services/normal/weather/weather_type_tuples.def"
}... |
if (data->property == PROPERTY_BG_COLOR) {
data->bg_color_index = (data->bg_color_index - 1) & 0x3F;
data->bg_color.argb = (s_color_table[data->bg_color_index] | ALPHA_100);
} else if (data->property == PROPERTY_ALPHA) {
data->alpha = (data->alpha - 0x40) & ALPHA_100;
set_text_layers(data);
} else i... | task_malloc(sizeof(AppData)) | ;
if (!data) {
return;
}
memset(data, 0x00, sizeof(AppData));
s_window = window_create();
window_set_user_data(s_window, data);
window_set_fullscreen(s_window, true);
window_set_window_handlers(s_window, &(WindowHandlers) {
.load = main_window_load,
.unload = main_window_unload,
});
wind... |
void test_graphics_gtransform_${BIT_DEPTH_NAME}__types_gtransformnumber(void) {
GTransform t_c; // matrix to compare against
GTransformNumber tn;
int32_t test_num;
tn = GTransformNumberFromNumber(1);
test_num = (int32_t)((float)1 * (1 << FIXED_S32_16_PRECISION));
cl_assert((memcmp(&tn, &test_num, sizeof(GT... | (&t, &t_c) | );
// Test Rotation Matrix
int32_t angle = DEG_TO_TRIGANGLE(45);
t = GTransformRotation(angle);
int32_t cosine = cos_lookup(angle);
int32_t sine = sin_lookup(angle);
t_c = GTransform(GTransformNumberFromNumber((float)cosine / TRIG_MAX_RATIO),
GTransformNumberFromNumber(-(float)sine / T... |
C_CTRL_0_REG, DCDC_FW_ENABLE, 0x1);
REG_SETF(DCDC, DCDC_CTRL_0_REG, DCDC_MODE, 0);
REG_SETF(DCDC, DCDC_CTRL_1_REG, DCDC_STARTUP_DELAY, 0xA);
REG_SETF(DCDC, DCDC_CTRL_1_REG, DCDC_GLOBAL_MAX_IDLE_TIME, 0x20);
REG_SETF(DCDC, DCDC_CTRL_1_REG, DCDC_TIMEOUT, 0x10);
REG_SETF(DCDC, DCDC_CTRL_2_REG, DCDC_TIMEOUT_IRQ... | (DCDC, DCDC_TEST_0_REG, DCDC_FORCE_NSW, 0x0) | ;
REG_SETF(DCDC, DCDC_TEST_0_REG, DCDC_FORCE_PSW, 0x0);
REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_COMP_CLK, 0x0);
REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_TEST_CURRENT, 0x0);
REG_SETF(DCDC, DCDC_TEST_1_REG, DCDC_TEST_REG, 0x0);
REG_SETF(DCDC, DCDC_IRQ_CLEAR_REG, DCDC_BROWN_OUT_IRQ_CLEAR, 0x0);
REG_SETF(DCDC, DCDC_... |
_due_to_bonding_change();
}
static BTBondingID prv_bt_persistent_storage_store_ble_pairing(
const SMPairingInfo *new_pairing_info, bool is_gateway, bool requires_address_pinning,
uint8_t flags, const char *device_name, BtPersistBondingOp op) {
if (new_pairing_info && is_gateway) {
shared_prf_storage_stor... | (&bonding) | ;
}
void bt_persistent_storage_delete_ble_pairing_by_id(BTBondingID bonding) {
prv_remove_ble_bonding_from_bt_driver();
shared_prf_storage_erase_ble_pairing_data();
prv_call_ble_bonding_change_handlers(bonding, BtPersistBondingOpWillDelete);
}
bool bt_persistent_storage_get_ble_pairing_by_id(BTBondingID bonding... |
Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed und... | {
analytics_event_bt_connection_or_disconnection(type, reason);
} | |
(num.integer == -1) | ;
cl_assert(num.fraction == 2);
test_num = (int32_t)((float)-0.625 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_value = test_num };
cl_assert(num.integer == -1);
cl_assert(num.fraction == 3);
test_num = (int32_t)((float)-0.500 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_valu... | |
);
// We reset all data logging here, including data logging for applications,
// because an inability to allocate a new session means all 200+ session
// IDs are exhausted, likely caused by a misbehaving app_hb. See discussion at:
// https://github.com/pebble/tintin/pull/1967#discussion-diff-11746345
... | analytics_heartbeat_set(app_hb, ANALYTICS_APP_METRIC_TIME_INTERVAL, dt_ms) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
prv_draw_round_border(layer, ctx, 0);
} |
prv_draw_round_border(layer, ctx, radial_padding_size);
// Draw letter to identify screen
if (radial_padding_size >= 2) {
GRect identifier_area = GRect(40, 40, 20, 20);
char identifier[] = {'A' + radial_padding_size - 2, 0};
graphics_context_set_text_color(ctx, GColorWhite);
graphics_draw_text(c... |
OUR), rtc_get_time());
cl_assert_equal_i(steps, 2500);
// If we ask for the sum from latter half of yesterday till half of today, we should get 1500
time_t elapsed_today = rtc_get_time() - time_start_of_today();
steps = health_service_sum(
HealthMetricStepCount, time_start_of_today() - (12 * SECONDS_PER_HO... | health_service_sum_today(HealthMetricWalkedDistanceMeters) | );
activity_stop_tracking();
fake_system_task_callbacks_invoke_pending();
}
// Print summary of results
printf("\ntest height steps seconds cadence exp_dist exp_dist_2min act_dist_2min %%err");
printf("\n------------------------------------------------------------------------------------");
... |
t);
}
}
void event_service_system_init(void) {
s_plugin_list_mutex = mutex_create();
}
void event_service_init(PebbleEventType type, EventServiceAddSubscriberCallback add_subscriber_callback,
EventServiceRemoveSubscriberCallback remove_subscriber_callback) {
if(s_event_services[type] != NULL) {
// an ev... | if (buf_ptr && *buf_ptr) {
esb = (EventServiceBuffer *)list_find((ListNode *)s_event_service_buffers,
prv_buffer_find,
*buf_ptr);
} |
return esb;
}
void* event_service_claim_buffer(PebbleEvent *e) {
EventServiceBuffer *esb = prv_get_esb_for_event(e);
if (esb) {
if (esb->intents_pending & CLAIMED_BIT) {
// For now only 1 claim at a time is needed, so lets keep things simple and just support that
PBL_LOG(LOG_LEVEL_WARNING, "Buff... |
(uint8_t *)d->data, d->num_samples * sizeof(d->data[0]));
}
PBL_LOG(LOG_LEVEL_DEBUG,
"Sending message - bpm:%u quality:%u current:%u "
"ppg_readings:%u accel_readings %"PRIu32,
bpm,
bpm_quality,
led_current,
hrm->debug->ppg... | (&window->layer, &quality_tl->layer) | ;
const uint32_t inbox_size = 64;
const uint32_t outbox_size = 256;
AppMessageResult result = app_message_open(inbox_size, outbox_size);
if (result != APP_MSG_OK) {
PBL_LOG(LOG_LEVEL_ERROR, "Unable to open app message! %i %s",
result, prv_translate_error(result));
} else {
PBL_LOG(LOG_LEV... |
&bpm, &hr_zone));
cl_assert_equal_i(steps, 10);
cl_assert_equal_i(duration_s, 10);
cl_assert_equal_i(bpm, 100);
cl_assert(workout_service_pause_workout(true));
// Get some new data but out stats shouldn't change (except HR)
prv_inc_time(10);
prv_inc_steps_and_put_eve... | workout_service_start_workout(ActivitySessionType_Run) | |
/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 permissio... | (horiz_advance != 0) | ;
cl_assert_equal_i(horiz_advance,
text_resources_get_glyph_horiz_advance(&s_font_cache, 'c', &s_font_info));
}
void test_text_resources__get_glyph_multiple(void) {
const uint8_t a_glyph_data_bytes[] = {0x2e, 0x42, 0x2e, 0x63, 0xb6};
const uint8_t b_glyph_data_bytes[] = {0x21, 0x84, 0x36, 0x63, 0x8c, 0x71, ... |
prv_compare_points(points, s_fill_points, s_path_num_points) | );
prv_reset();
// restore stroke color and change both points
gdraw_command_set_stroke_color(command, GColorPurple);
GPoint points2[] = { { 23, 45 }, { 67, 13} };
gdraw_command_set_point(command, 0, points2[0]);
gdraw_command_set_point(command, 1, points2[1]);
gdraw_command_draw(NULL, command);
cl_as... | |
_animation_create_bounds_origin(&data->cassette_container, &GPoint(-4, 0),
&GPointZero));
animation_set_duration(cassette_left, 4 * ANIMATION_FRAME_MS);
animation_set_curve(cassette_left, AnimationCurveEaseIn);
animation_set_duration(cassette_right, config->cassette_a... | {
prv_trigger_cassette_icon_switch(&data->image_cassette, animated);
} |
}
static void prv_update_ui_state_skipping(MusicAppData *data, bool animated) {
action_bar_layer_set_click_config_provider(&data->action_bar,
prv_skipping_click_config_provider);
action_bar_layer_set_icon_animated(&data->action_bar, BUTTON_FORWARD,
... |
void timeline_action_endpoint_invoke_action(const 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* phon... | (pin_db_get(&id, &item_temp), 0) | ;
cl_assert(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(!tim... |
e {
rect.origin.y += prefer_larger_font ? 12 : 15;
}
if (draw_hr_zones) {
prv_render_hr_zones(ctx, &rect, active_window);
// update rect y for the zones height
rect.origin.y += PBL_IF_RECT_ELSE(18, 15);
}
// adjust rect for drawing the text node
rect.origin.x -= PBL_IF_RECT_ELSE(1, 46);
re... | (dialog, TEXT_COLOR) | ;
dialog_set_icon(dialog, RESOURCE_ID_WORKOUT_APP_END);
dialog_set_icon_animate_direction(dialog, DialogIconAnimateNone);
dialog_set_destroy_on_pop(dialog, false);
i18n_free_all(workout_dialog);
workout_dialog_set_click_config_provider(workout_dialog, prv_end_workout_click_config_provider);
workout_dialog... |
http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing... | PBL_CROAK("Touch controller didn't respond!") | ;
}
}
}
// Status Register Operations
////////////////////////////////////////////////////////////////////////////////
#if 0
// TODO: this will be used to get FW information from the controller
static void prv_status_register_read(uint8_t address, void *result, StatusReadType type) {
const StatusRegisterRequ... |
er, &word_iter_state, &s_ctx, &text_box_params, utf8_bounds.start);
// Tests
cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.current, &text_box_params));
cl_assert(line.height_px == 10);
cl_assert(line.width_px == 2 * HORIZ_ADVANCE_PX);
cl_assert(iter_next(&word_iter));
cl_assert(line_add_word(&s... | cl_assert(line.width_px == HORIZ_ADVANCE_PX * 1) | ;
cl_assert(line.origin.x == 0);
cl_assert(line.suffix_codepoint == 0);
cl_assert(*line.start == 'b');
// \n
cl_assert(*word_iter_state.current.start == '\n');
cl_assert(*word_iter_state.current.end == '\n');
cl_assert(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 0);
line_reset(&line, utf8_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... | layer_add_child(window_layer, text_layer_get_layer(s_text_layer)) | ;
}
static void prv_window_unload(Window *window) {
text_layer_destroy(s_text_layer);
}
static void prv_init(void) {
s_window = window_create();
window_set_click_config_provider(s_window, prv_click_config_provider);
window_set_window_handlers(s_window, (WindowHandlers) {
.load = prv_window_load,
.unlo... |
THRESHOLD(notification_layout_frame->size.h),
TEXT_VISIBLE_UPPER_THRESHOLD));
#else
const bool text_visible = render;
#endif
static const GRect box = {
.origin = { CARD_MARGIN, LAYOUT_TOP_BANNER_HEIGHT },
.size = { DISP_COLS - 2 * CARD_MARGIN, LAYOUT_MAX_HEIGHT },
};
static const... | {
NotificationLayout *layout = (NotificationLayout *)layout_ref;
if (layout->view_size.h == 0) {
prv_card_render(layout, graphics_context_get_current_context(), false);
}
return layout->view_size;
} |
static void prv_layout_destroy(LayoutLayer *layout) {
NotificationLayout *notification_layout = (NotificationLayout *)layout;
prv_destroy_view(notification_layout);
kino_layer_deinit(¬ification_layout->icon_layer);
task_free(notification_layout);
}
static void prv_layout_init(NotificationLayout *layout, c... |
ction = 0;
fixed_center.y.fraction = 0;
Fixed_S16_3 fixed_radius = (Fixed_S16_3){.integer = radius, .fraction = 0};
graphics_draw_arc_precise_internal(ctx, fixed_center, fixed_radius, angle_start, angle_end);
}
void graphics_draw_arc(GContext *ctx, GRect rect, GOvalScaleMode scale_mode,
i... | ABS(rect.size.w) | );
// Fill radial doesn't mind overlarge inset thickness
graphics_fill_radial(ctx, rect, scale_mode, inset_thickness, 0, TRIG_MAX_ANGLE);
}
void graphics_fill_circle(GContext* ctx, GPoint p, uint16_t radius) {
PBL_ASSERTN(ctx);
if (ctx->lock) {
return;
}
if (radius == 0) {
// Filling a circle of r... |
/*
* 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... | battery_convert_reading_to_millivolts(reading, 1, 1) | ;
cl_assert_equal_i(result, 0);
}
void test_battery__reading_conversion_40_samples(void) {
ADCVoltageMonitorReading reading = {
.vref_total = prv_convert_millivolts_to_12bit_reading(VREF_VOLTAGE) * 40,
.vmon_total = prv_convert_millivolts_to_12bit_reading(1800) * 40
};
uint32_t result = battery_conver... |
016, -256, -328},
{ 1304, 32, -272},
{ 1584, 96, -160},
{ 1952, 160, -32},
{ -1944, 384, -128},
{ 1936, 528, -152},
{ 1648, 648, -104},
{ 1472, 664, -128},
{ 1688, 368, -136},
{ 1488, 584, -8},
{ 1320, 1272, -208},
{ 1024, 1576, -224},
{ 936, 960, -216},
{ 1168, 1016,... | { 1384, 400, -88},
{ 1512, 904, -104},
{ 1080, 1392, -216},
{ 1000, 968, -168},
{ 936, 864, -216},
{ 832, 608, -224},
{ 1176, 592, -144},
{ 1600, 656, 0},
{ 1888, 600, 16},
{ 1760, 416, -8},
{ 1736, 272, 48},
{ 1696, 240, 40},
{ 1560, 328, -64},
{ 1320, 264, -224}... | |
logic parameters.
if (reminders_snooze((Reminder *) item) == S_SUCCESS) {
prv_push_snooze_dialog();
}
// Dismiss reminder
const TimelineItemAction *action = timeline_item_find_dismiss_action(item);
if (action) {
timeline_invoke_action(item, action, NULL);
}
}
static void prv_push_muted_dialog(voi... | timeline_item_action_is_dismiss(action) | ) {
dismiss_action = action;
}
}
}
// Snooze is not needed for Reminders App items
Uuid items_originator_id;
timeline_get_originator_id(item, &items_originator_id);
const bool has_snooze_action = ((item->header.type == TimelineItemTypeReminder) &&
!uuid_equal(&(Uuid)UU... |
er,
}, health_card_view);
animation_set_implementation(bg_anim, &prv_bg_animation_implementation);
health_card_view->slide_animation = animation_spawn_create(curr_out, next_in, bg_anim, NULL);
animation_schedule(health_card_view->slide_animation);
health_card_view->current_card_index = next_card_index;
}
... | content_indicator_init(&health_card_view->down_indicator) | ;
const GRect up_arrow_layer_frame = grect_inset(window_root->frame,
GEdgeInsets(0, 0, window_root->frame.size.h - content_indicator_height));
layer_init(&health_card_view->up_arrow_layer, &up_arrow_layer_frame);
layer_add_child(window_root, &health_card_view->up_arrow_layer);
content_indicator_init(&hea... |
//////
void test_timeline_peek__peek(void) {
prv_render_timeline_peek(&(TimelinePeekItemConfig) {
.title = "CoreUX Design x Eng",
.subtitle = "ConfRM-Missile Command",
.icon = TIMELINE_RESOURCE_TIMELINE_CALENDAR,
.num_concurrent = 0,
});
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
}
... | cl_assert(layer->frame.origin.y >= DISP_ROWS) | ;
}
void test_timeline_peek__peek_visible_to_hidden_outside_of_watchface(void) {
TimelineItem *item = prv_set_timeline_item(&(TimelinePeekItemConfig) {
.title = "CoreUX Design x Eng",
.subtitle = "ConfRM-Missile Command",
.icon = TIMELINE_RESOURCE_TIMELINE_CALENDAR,
.num_concurrent = 0,
}, false /*... |
onnection = {
.bt_device_bits = device->opaque.opaque_64,
.hci_reason = hci_reason,
.connected = connected,
.bonding_id = bonding_id,
},
},
},
};
event_put(&pebble_event);
}
// --------------------------------------------------------------------------------... | prv_is_intent_used(intent) | ) {
prv_intent_remove_and_free(intent);
return false;
}
return true;
}
void bt_driver_handle_le_connection_handle_update_address_and_irk(const BleAddressAndIRKChange *e) {
bt_lock();
{
GAPLEConnection *connection = gap_le_connection_by_device(&e->device);
if (!connection) {
PBL_LOG(LOG_LE... |
rn false;
}
static void prv_sad_watch(uint32_t error_code) {
dbgserial_print("SAD WATCH: ");
dbgserial_print_hex(error_code);
dbgserial_newline();
display_error_code(error_code);
static uint8_t prev_button_state = 0;
prev_button_state = button_get_state_bits() & ~SELECT_BUTTON_MASK;
while (1) {
// ... | (0x8badf00d) | ;
delay_us(200000);
display_error_code(0xbad1ce40);
delay_us(200000);
display_error_code(0xbeefcace);
delay_us(200000);
display_error_code(0x0defaced);
delay_us(200000);
display_error_code(0xd15ea5e5);
delay_us(200000);
display_error_code(0xdeadbeef);
delay_us(200000);
}
#e... |
/*
* 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... | hdlc_streaming_decode_reset(&ctx) | ;
data = HDLC_ESCAPE;
is_complete = hdlc_streaming_decode(&ctx, &data, &should_store, &is_invalid);
cl_assert(is_complete == false);
cl_assert(should_store == false);
cl_assert(is_invalid == false);
data = HDLC_FLAG;
is_complete = hdlc_streaming_decode(&ctx, &data, &should_store, &is_invalid);
cl_assert... |
/*
* 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... | (result, GPoint(0, -5)) | ;
}
void test_graphics_circle__gpoint_from_polar_correct_scale(void) {
// edge cases are covered above, this test only verifies that
// the internal implementation correctly scales
GPoint result = gpoint_from_polar(GRect(0, 0, 10, 10), GOvalScaleModeFillCircle, 0);
cl_assert_equal_gpoint(result, GPoint(4, 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... | (m, MBUF_FLAG_IS_FREE) | );
m->data = data;
m->length = length;
}
void *mbuf_get_data(MBuf *m) {
PBL_ASSERTN(m);
return m->data;
}
bool mbuf_is_flag_set(MBuf *m, uint32_t flag) {
PBL_ASSERTN(m);
return m->flags & flag;
}
void mbuf_set_flag(MBuf *m, uint32_t flag, bool is_set) {
PBL_ASSERTN(m);
if (is_set) {
m->flags |= f... |
const uint8_t *attributes_per_actions) {
attribute_group_init(GROUP_TYPE,
attr_list,
action_group,
buffer,
num_attributes,
num_actions,
attributes_per_action... | PBL_LOG(LOG_LEVEL_ERROR, "Error deep-copying pin attribute list") | |
bool prv_update_clients(GAPLEConnectionIntent *intent,
uint8_t hci_reason,
GAPLEConnectionEvent event) {
const BTDeviceInternal *device = &intent->device;
const bool connected = (event == GAPLEConnectionEventConnectedNotEncrypted ||
... | (event->peer_address.address) | ,
event->peer_address.is_random_address);
PBL_LOG(LOG_LEVEL_INFO,
" hdl=%u, status=0x%02x, master=%u, %u, slave lat=%u, "
"supervision timeout=%u, is_resolved=%c",
event->handle, event->status, event->is_master, params->conn_interval_1_25ms,
params->slav... |
played * (parent->duration_ms + parent->delay_ms);
// Loop through animation and all of it's children until the "virtual now" catches up to
// the desired elapsed
const uint32_t now = prv_get_ms_since_system_start();
uint32_t virtual_now = now;
const uint32_t target_now = start_ms + elapsed_ms;
while (se... | prv_animation_clone(state, animation) | |
/*
* 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... | (&msg->attr_list,
VEAttributeIdTranscription, attr_list_size) | ;
if (!transcription_attr || transcription_attr->length == 0) {
PBL_LOG(LOG_LEVEL_WARNING, "No transcription attribute found");
voice_handle_dictation_result(VoiceEndpointResultFailInvalidMessage, msg->session_id, NULL,
app_initiated, app_uuid);
return;
}
Transcript... |
{ 48, 584, 280},
{ 104, 544, 208},
{ 120, 680, 272},
{ 80, 832, 328},
{ 72, 872, 328},
{ 88, 984, 368},
{ -16, 1088, 472},
{ -40, 1248, 472},
// 5 seconds
{ -208, 1312, 576},
{ -168, 1088, 176},
{ -152, 984, 176},
{ -152, 752, 304},
{ -8, 728, 176},
{ 144, 504,... | { -96, 856, 328},
{ -304, 1360, 96},
{ -200, 1456, 344},
{ -448, 1176, 664},
{ -168, 1312, 464},
{ -512, 1504, 552},
{ -432, 1328, 416},
{ -440, 984, 488},
{ -272, 640, 376},
{ -248, 672, 240},
{ -104, 464, 160},
{ -88, 584, 232},
{ -120, 632, 208},
{ -176, 864, 2... |
{ -440, 984, 96},
{ -320, 512, 56},
{ -88, 864, 64},
{ 192, 568, 64},
{ 264, 832, -192},
{ 360, 560, 16},
{ 248, 880, 40},
{ 120, 840, -88},
{ 0, 1072, 80},
{ -336, 1112, 216},
{ -360, 1576, 488},
{ -600, 1568, 392},
{ -192, 1352, 336},
{ -136, 952, 368},
{ -... |
rt_extra_case_items();
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture,
s_feb_5_midnight + 8 * SECONDS_PER_HOUR + 16 * SECONDS_PER_MINUTE), 0);
#if CAPABILI... | cl_assert(iter_next(&iterator)) | ;
cl_assert(uuid_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)... |
= (data->bg_color_index - 1) & 0x3F;
data->bg_color.argb = (s_color_table[data->bg_color_index] | ALPHA_100);
} else if (data->property == PROPERTY_ALPHA) {
data->alpha = (data->alpha - 0x40) & ALPHA_100;
set_text_layers(data);
} else if (data->property == PROPERTY_COLOR_TABLE) {
if (s_color_table ... | memset(data, 0x00, sizeof(AppData)) | |
nd);
cl_assert_equal_i(s_stroke_color.argb, GColorRedARGB8);
cl_assert_equal_i(s_fill_color.argb, GColorClearARGB8);
cl_assert_equal_i(s_stroke_width, 2);
cl_assert_equal_i(s_path_num_points, 2);
cl_assert_equal_b(s_path_open, false);
cl_assert_equal_i(s_path_fill_count, 0);
cl_assert_equal_i(s_path_strok... | (prv_compare_points((GPoint*)points, s_stroke_points, s_path_num_points)) | ;
prv_reset();
// change to open path and ensure that only draws 2 lines
command->path_open = true;
gdraw_command_draw(NULL, command);
cl_assert_equal_i(1, s_path_stroke_precise_count);
cl_assert_equal_b(true, s_path_open);
cl_assert(prv_compare_points((GPoint*)points, s_stroke_points, s_path_num_points)... |
/*
* 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... | {
__asm volatile (
// load all the registers
"ldmia %r0!, {%r4-%r9, %sl, %fp, %ip, %lr}\n"
// load SP from a register we could load to and don't need to restore
"mov %sp, %ip\n"
// using real FPU
#if defined(__VFP_FP__) && !defined(__SOFTFP__)
// load FP registers
"vldmia %r0!, {%s16-%s31}\n"
// load ... |
#else
// Undefined implementations, don't implement!
// That way we get a link-time error.
#endif
|
///////////////////////////////////////////////////////////
static void check_atan2(int16_t x, int16_t y) {
int32_t ours = atan2_lookup(y, x) * 180 / TRIG_PI;
double theirs = atan2(y, x) / 3.14159 * 180;
// atan2 returns in range [-pi, +pi], but we have [0,2pi].
if (theirs < 0) theirs += 360;
cl_assert(abs(... | (7, min, max) | , true);
// Just out of bounds
cl_assert_equal_b(WITHIN(4, min, max), false);
cl_assert_equal_b(WITHIN(11, min, max), false);
// Negative out of bounds
cl_assert_equal_i(WITHIN(-5, min, max), false);
// Positive out of bounds
cl_assert_equal_i(WITHIN(0, min, max), false);
// Min negative, max positi... |
rds_read];
}
}
// Currently this implementation reads halfwords at a time (16-bits). Burst
// length is currently 1 for synchronous reads. This can be optimized in future
// to do larger burst sizes and/or unrolling larger transfer sizes into 32-bit
// reads.
status_t flash_impl_read_sync(void *buffer_ptr, FlashAddr... | flash_impl_release() | ;
return error;
}
}
prv_allow_write_if_sector_is_not_protected(false, sector_addr);
prv_issue_command(sector_addr, S29VSCommand_WriteBufferLoad);
prv_issue_command_argument(sector_addr, num_shorts - 1);
// We're now ready to write the words. Subsequent writes to the sector will
// actually write... |
prv_insert_artificial_activity_session(minute_raw_data, k_minute_data_len, &exp_session);
prv_feed_activity_minutes(minute_raw_data, k_minute_data_len);
cl_assert_equal_i(s_num_captured_activity_sessions, 1);
ASSERT_ACTIVITY_SESSION_PRESENT(s_captured_activity_sessions, s_num_captured_activity_sessions,... | (s_captured_activity_sessions, s_num_captured_activity_sessions,
&exp_session_run) | ;
}
kernel_free(s_kalg_state);
s_kalg_state = NULL;
}
// ---------------------------------------------------------------------------------------
void test_kraepelin_algorithm__sleep_stats(void) {
// Init algorithm state
s_kalg_state = kernel_zalloc(kalg_state_size());
// It's easier to understand the al... |
*connection) {
return prv_get_flag(connection, ConnectionFlag_IsSubscribedToConnParamNotifications);
}
//
// Setters
//
void connection_set_gateway(Connection *connection, bool is_gateway) {
prv_lock();
{
if (connection_is_valid(connection)) {
connection->is_gateway = is_gateway;
}
}
prv_unloc... | ((ListNode *)connection->gatt_op_list, (ListNode *)node) | );
}
prv_unlock();
}
bool connection_dequeue_gatt_op(Connection *connection, uintptr_t *context_ref,
GattRespDest *resp_dest, GattOpType expected_op_type) {
bool rv = true;
prv_lock();
{
GattOperation *tmp = connection->gatt_op_list;
if (!tmp) {
rv = false;
... |
calls, b), 0);
// Just before A completes
prv_advance_to_ms_with_timers(start_ms + delay_seq + delay_a + duration_a - 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0);
cl_assert_equal_i(prv_count_han... | (prv_count_handler_entries(&s_started_handler_calls, a), 1) | ;
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
// Complete A and start B
prv_advance_to_ms_with_timers(start_ms + delay_... |
der the License.
*/
#include "board/board.h"
#include "drivers/gpio.h"
#include "drivers/periph_config.h"
#include "drivers/rtc.h"
#include "drivers/spi.h"
#include "kernel/util/sleep.h"
#include "util/units.h"
#define STM32F2_COMPATIBLE
#define STM32F4_COMPATIBLE
#include <mcu.h>
#include "bma255_private.h"
#incl... | bma255_send_and_receive_byte(0) | ;
bma255_end_txn();
return data;
}
void bma255_write_register(uint8_t address, uint8_t data) {
const uint8_t reg = address | BMA255_WRITE_FLAG;
bma255_prepare_txn(reg);
bma255_send_and_receive_byte(data);
bma255_end_txn();
s_last_write_ticks = rtc_get_ticks();
}
void bma255_read_modify_write(uint8_t ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (!app_install_get_entry_for_install_id(id, &entry)) {
prompt_send_response("failed to get entry");
return;
} |
// should delete from blob db and fire off an event to AppInstallManager that does the rest
app_db_delete((uint8_t *)&entry.uuid, sizeof(Uuid));
prompt_send_response("OK");
}
bool prv_print_app_info(AppInstallEntry *entry, void *data) {
if (app_install_id_from_system(entry->install_id)) {
return true;
... |
e
// "wait 90 seconds between erases of the same sector" spec.
prompt_send_response("Stress flash");
system_task_add_callback(prv_flash_stress_callback, NULL);
}
*/
void command_reset() {
prompt_command_finish();
RebootReason reason = { RebootReasonCode_Serial, 0 };
reboot_reason_set(&reason);
system_r... | kernel_free(context) | ;
}
}
static bool prv_convert_and_validate_timeout_value(const char *timeout_string,
uint32_t default_value,
uint32_t *result) {
if (!result) {
return false;
}
if (!timeout_string) {
*result = default... |
/*
* 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(prv_byte_reverse(0b11110000) == 0b00001111);
cl_assert(prv_byte_reverse(0b10100101) == 0b10100101);
} |
// Each of the following tests depend on a PNG being converted into 1-bit PBI,
// as well as loading in a b&w PNG, which internally will be converted to a
// 1-bit palettized image.
// The palettized PNG loaded in is to be used as the expected value
#define TEST_1BIT_FILE TEST_PBI_FILE_FMT(1bit)
#define TEST_PALETTI... |
or a null pointer
TimelineItem *item = timeline_item_create_with_attributes(notif_time, 0,
TimelineItemTypeNotification,
LayoutIdNotification, ¬if_attr_list,
... | prv_validate_history_stats(&s_activity_stats, &s_activity_reward_settings) | ;
s_activity_reward_state.active_minutes = 0;
// Reset summary pin data
s_activity_pin_state = (ActivityPinState) {
.uuid = UUID_INVALID
};
}
static ActivitySleepState prv_get_sleep_state(void) {
int32_t sleep_state;
activity_get_metric(ActivityMetricSleepState, 1, &sleep_state);
return sleep_state... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ancs_app_storage_load(app_data.bundle_id, &app_data_out) | ;
cl_assert_equal_s(app_data.bundle_id, app_data_out.bundle_id);
cl_assert_equal_i(app_data.flags, app_data_out.flags);
cl_assert_equal_s(app_data.display_name, app_data_out.display_name);
ancs_app_destroy_buffer(&app_data_out);
}
static uint32_t get_key(const char* bundle_id) {
return legacy_defective_che... |
/*
* 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(prefs_db_get_len((uint8_t *)key, key_len), sizeof(set_value)) | ;
// Read it back
uint32_t get_value;
cl_assert_equal_i(prefs_db_read((uint8_t *)key, key_len, (uint8_t *)&get_value,
sizeof(get_value)), 0);
cl_assert_equal_i(set_value, get_value);
// If we get the pref setting now, it should still be the old value because we haven't
... |
talized) {
str_fmt = i18n_noop("%lu MIN AGO");
} else if (num_minutes == 1) {
str_fmt = i18n_noop("%lu minute ago");
} else {
str_fmt = i18n_noop("%lu minutes ago");
}
snprintf(buffer, buf_size, i18n_get(str_fmt, buffer), num_minutes);
} else if (difference >= 0) {
strncpy(buffe... | if (PRIVILEGE_WAS_ELEVATED) {
syscall_assert_userspace_buffer(timezone, TIMEZONE_NAME_LENGTH);
} |
clock_get_timezone_region(timezone, buffer_size);
}
typedef struct daypart_message {
const uint32_t hour_offset; // hours from 12am of current day
const char* const message; // text containing daypart
} daypart_message;
static const daypart_message daypart_messages[] = {
{0, i18n_noop("this morning")}, /... |
/*
* 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... | timezone_database_load_dst_rule(tz_info.dst_id, &start, &end) | |
eturn "Worst";
case HRMQuality_Poor:
return "Poor";
case HRMQuality_Acceptable:
return "Acceptable";
case HRMQuality_Good:
return "Good";
case HRMQuality_Excellent:
return "Excellent";
}
WTF;
}
static char *prv_translate_error(AppMessageResult result) {
switch (result) {
... | text_layer_set_text(&app_data->quality_text_layer, prv_get_quality_string(hrm->bpm.quality)) | ;
layer_mark_dirty(&app_data->window.layer);
bpm = hrm->bpm.bpm;
bpm_quality = hrm->bpm.quality;
} else if (hrm->event_type == HRMEvent_LEDCurrent) {
led_current = hrm->led.current_ua;
} else if (hrm->event_type == HRMEvent_Diagnostics) {
if (!app_data->ready_to_send) {
re... |
? selection_layer->callbacks.increment
: selection_layer->callbacks.decrement;
if (func) {
func(selection_layer->selected_cell_idx, selection_layer->callback_context);
}
layer_mark_dirty(&selection_layer->layer);
}
static void prv_bu... | layer_mark_dirty(&selection_layer->layer) | |
ath = NULL;
static GPath *s_current_path = NULL;
static GPath *s_aa_clipping_path = NULL;
static void prv_filled_update_proc(Layer *layer, GContext *ctx) {
graphics_context_set_stroke_color(ctx, GColorBlack);
#if 0 // Guidelines
int num_segments = 4;
int segment_width = SCREEN_WIDTH / num_segments;
int segmen... | GRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) | ;
prv_filled_update_proc(NULL, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled.${BIT_DEPTH_NAME}.pbi"));
printf("-- bottom\n");
prv_reset();
test_graphics_context_init(&ctx, fb);
s_current_path = s_house_path;
gpath_move_to(s_house_path, GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT));
ctx.draw... |
840, 328},
{ 184, 880, 312},
{ 200, 872, 232},
{ 248, 840, 136},
{ 352, 824, 56},
{ 320, 800, 184},
{ 248, 856, 344},
{ 200, 872, 304},
{ 184, 888, 248},
{ 232, 872, 144},
{ 328, 808, 56},
{ 360, 816, 144},
{ 272, 856, 312},
{ 192, 872, 320},
{ 184, 912, 208},
... | { -296, 800, -312},
{ -448, 1032, 0},
{ -456, 616, 208},
{ -384, 776, -240},
{ -416, 752, -352},
{ -440, 936, -376},
{ -312, 920, -440},
{ -232, 1008, -360},
{ -232, 1016, -328},
{ -312, 856, -152},
{ -304, 880, -168},
{ -344, 904, -24},
{ -368, 888, 48},
{ -400, ... |
{ -312, 936, 184},
{ -384, 1120, 136},
{ -416, 1096, 0},
{ -456, 1056, -216},
{ -424, 744, -456},
// 229 seconds
{ -336, 552, -560},
{ -352, 384, -616},
{ -320, 112, -728},
{ -376, 8, -808},
{ -376, -32, -904},
{ -400, -80, -888},
{ -392, 24, -912},
{ -416, 64, -... |
/*
* 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... | (uuid, uuid_string) | |
flash_read_bytes((uint8_t *)®ion_hdr, base_address, sizeof(region_hdr));
if (region_hdr.last_used > max_last_used) {
max_last_used = region_hdr.last_used;
last_used_idx = i;
}
}
if (max_last_used == 0) {
return false;
}
*addr = core_dump_get_slot_address(last_used_idx);
if (core... | if (buffer[i + 1] != same_byte) {
is_all_same = false;
break;
} |
}
// As an optimization, if all the bytes are the same, we set a flag and just send a single byte.
buffer[0] = is_all_same ? FLASH_READ_FLAG_ALL_SAME : 0; // flags
const uint32_t frame_length = is_all_same ? 2 : request->length + 1;
prv_send_frame(OPCODE_FLASH_READ, buffer, frame_length);
}
static void prv_... |
{
GContext ctx;
Layer layer;
test_graphics_context_init(&ctx, fb);
layer_init(&layer, &GRect(0, 0, 10, 10));
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_inside_origin_layer.${BIT_DEPTH_NAME}.pbi"));
... | (&layer, &ctx) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_inside_origin_layer.${BIT_DEPTH_NAME}.pbi"));
layer_set_update_proc(&layer, &clear_layer_update_callback);
layer_render_tree(&layer, &ctx);
#if SCREEN_COLOR_DEPTH_BITS == 8
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_pixel_clear.8bit.pbi"));
#else
cl... |
/*
* 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... | {
const size_t bytes_to_copy = MIN(bytes_remaining, temp_buffer_size);
comm_session_send_queue_copy(session, 0 /* start_offset */, bytes_to_copy, temp_buffer);
qemu_serial_send(QemuProtocol_SPP, temp_buffer, bytes_to_copy);
comm_session_send_queue_consume(session, bytes_to_copy);
bytes_remaining -= ... |
kernel_free(temp_buffer);
}
// -----------------------------------------------------------------------------------------
// bt_lock() is held by caller
static void prv_reset(Transport *transport) {
PBL_LOG(LOG_LEVEL_INFO, "Unimplemented");
}
static void prv_granted_kernel_main_cb(void *ctx) {
ResponsivenessGra... |
{ -208, -16, -984},
{ -200, -32, -1000},
{ -200, -32, -984},
{ -200, -32, -992},
{ -208, -24, -992},
{ -200, -24, -992},
{ -200, -32, -992},
{ -200, -16, -992},
{ -200, -32, -984},
{ -208, -24, -992},
{ -208, -24, -984},
// 95 seconds
{ -200, -16, -992},
{ -192, -... | { -184, -40, -1000},
// 100 seconds
{ -184, -40, -976},
{ -200, -16, -1000},
{ -184, -32, -1008},
{ -184, -8, -992},
{ -184, -48, -976},
{ -192, -32, -992},
{ -168, -24, -1016},
{ -176, -32, -992},
{ -192, -40, -984},
{ -192, -32, -976},
{ -200, -32, -1000},
{ -19... | |
// the system while a frame is being pushed out to the
// display with the cpu clock at 64MHz
#define GFX_TEST(name) extern GfxTest g_gfx_test_##name;
#include "gfx_test_list.h"
#undef GFX_TEST
#define GFX_TEST(name) &g_gfx_test_##name,
stati... | app_malloc_check(sizeof(AppData)) | ;
// Menu window
Window *window = &app_data->menu_window;
window_init(window, WINDOW_NAME("GFX Test Framework"));
window_set_user_data(window, app_data);
window_set_fullscreen(window, false);
MenuLayer *menu = &app_data->test_menu;
menu_layer_init(menu, &window->layer.bounds);
menu_layer_set_callbacks... |
oth_edges_in_same_block) {
left_edge_block = (0xffffffff << left_edge_bits_count);
right_edge_block = right_edge_bits_count ? (0xffffffff >> (32 - right_edge_bits_count)) : 0;
mask = (left_edge_block & right_edge_block);
*(block) = (*(block) & ~mask) | (pattern & mask);
} else {
if (left_edge_bits... | (x, data_row_info.min_x, data_row_info.max_x) | |
ARRAY_LENGTH(types) | ,
.types = types,
.num_samples = ARRAY_LENGTH(offset_sec_b),
.offset_sec = offset_sec_b,
.num_values = ARRAY_LENGTH(values_b),
.values = values_b,
}
};
prv_common_payload_initialize(&input);
for (unsigned i = 0; i < input.msrmt.num_samples; i++) {
rtc_set_time(input.msrmt.ti... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | (&ctx, &data, &should_store, &is_invalid) | ;
cl_assert(is_complete == false);
cl_assert(should_store == false);
cl_assert(is_invalid == false);
data = HDLC_ESCAPE ^ HDLC_ESCAPE_MASK;
is_complete = hdlc_streaming_decode(&ctx, &data, &should_store, &is_invalid);
cl_assert(is_complete == false);
cl_assert(should_store == true);
cl_assert(is_invalid... |
strtol(s_base_test_data[i].str, NULL, s_base_test_data[i].base) | ,
s_base_test_data[i].value);
}
}
void test_strtol__zerobase(void) {
cl_assert_equal_i(strtol("573bb", NULL, 0), 573);
cl_assert_equal_i(strtol("0x573", NULL, 0), 0x573);
cl_assert_equal_i(strtol("0573", NULL, 0), 0573);
cl_assert_equal_i(strtol(" +573bb", NULL, 0), 573);
cl_assert_... | |
ied amount
return (GPoint) {
.x = MAX(inset_amount - 1, MIN(outer_point.x, frame->size.w - inset_amount)),
.y = MAX(inset_amount - 1, MIN(outer_point.y, frame->size.h - inset_amount))
};
}
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////
// UI Draw... | (ctx, GColorDarkGray) | ;
graphics_fill_circle(ctx, pos, dot_radius);
}
}
#endif
static void prv_draw_goal_line(GContext *ctx, int32_t current_progress, int32_t total_progress,
int32_t line_length, int32_t line_width, GRect frame, GColor color) {
const GPoint line_outer_point = prv_steps_to_point(curren... |
/*
* 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 (!text_layer) {
return;
} |
text_layer_legacy2_deinit(text_layer);
task_free(text_layer);
}
void text_layer_legacy2_deinit(TextLayerLegacy2 *text_layer) {
if (text_layer == NULL) {
return;
}
layer_deinit(&text_layer->layer);
graphics_text_layout_cache_deinit(&text_layer->layout_cache);
text_layer->layout_cache = NULL;
}
Layer... |
all();
prv_invalidate_page_flags_cache_all();
if (write_erase_headers) {
prv_write_erased_header_on_page_range(0, s_pfs_page_count, 1);
}
mutex_unlock_recursive(s_pfs_mutex);
PBL_LOG(LOG_LEVEL_INFO, "FS-Format Done");
}
int pfs_sector_optimal_size(int min_size, int namelen) {
min_size += sizeof(File... | read_header(pg, &pg_hdr, &file_hdr) | |
ed_outside(void) {
GContext ctx;
Layer layer;
printf("-- top\n");
prv_reset();
test_graphics_context_init(&ctx, fb);
s_current_path = s_house_path;
gpath_move_to(s_house_path, GPoint(SCREEN_WIDTH / 2, 0));
ctx.draw_state.drawing_box = GRect(0, SCREEN_HEIGHT / 2, SCREEN_WIDTH, SCREEN_HEIGHT);
ctx.draw... | (SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT) | ;
graphics_context_set_antialiased(&ctx, true);
prv_filled_update_proc(NULL, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
"gpath_filled_right_clipped_aa.${BIT_DEPTH_NAME}.pbi"));
}
// Additional test to check AA on edges - works only on 8bit
void test_graphics_gpath_8bit__filled_bolt_aa(void) {
// ... |
ss or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "services/common/regular_timer.h"
#include "os/mutex.h"
#include "services/common/new_timer/new_timer.h"
#include "system/logging.h"
#include "system/passert.h"
#include "FreeRTOS.h"
#... | new_timer_start(s_timer_id, 1000-milliseconds, timer_callback_initializing, NULL, 0 /*flags*/) | ;
PBL_ASSERTN(success);
}
// -------------------------------------------------------------------------------------------
void regular_timer_add_multisecond_callback(RegularTimerInfo* cb, uint16_t seconds) {
PBL_ASSERTN(s_callback_list_semaphore);
mutex_lock(s_callback_list_semaphore);
cb->private_reset_count... |
/*
* 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... | memcmp(s_expected_data.buf, data, len) | == 0);
}
static void prv_assert_no_handler_calls(void) {
for (int i = 0; i < NumHandlers; i++) {
cl_assert_equal_i(s_handler_call_count[i], 0);
}
}
static void prv_endpoint_handler_a(
CommSession *session, const uint8_t *data, size_t length) {
s_handler_call_count[HandlerA]++;
prv_assert_data_matches... |
= test_num };
cl_assert(num.integer == -1);
cl_assert(num.fraction == 4);
test_num = (int32_t)((float)-0.375 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_value = test_num };
cl_assert(num.integer == -1);
cl_assert(num.fraction == 5);
test_num = (int32_t)((float)-0.250 * (1 << FIXED_S16_3_P... | (1, Fixed_S16_3_rounded_int(Fixed_S16_3(4))) | ;
cl_assert_equal_i(1, Fixed_S16_3_rounded_int(Fixed_S16_3(8)));
cl_assert_equal_i(2, Fixed_S16_3_rounded_int(Fixed_S16_3(12)));
cl_assert_equal_i(0, Fixed_S16_3_rounded_int(Fixed_S16_3(-3)));
cl_assert_equal_i(-1, Fixed_S16_3_rounded_int(Fixed_S16_3(-4)));
cl_assert_equal_i(-1, Fixed_S16_3_rounded_int(Fixed_... |
_circle_quadrant_full_override_aa(GContext* ctx, GPoint p, uint16_t radius,
uint8_t stroke_width, GCornerMask quadrant,
bool anti_aliased) {
#if PBL_COLOR
// Force antialiasing setting
bool temp_anti_alia... | if (ctx->lock) {
return;
} |
if (radius == 0) {
// Special case radius 0 to fill a circle with radius eqaul to half the stroke width
// Backup the fill color and set that to the current stroke color since the fill color
// is what is used for fill circle. Restore the fill color afterwards.
GColor backup_fill_color = ctx->draw_s... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ALIAS("Default_Handler") | |
error.status, test->expect_status);
cl_assert_equal_i(err_index, test->expect_index);
}
cl_assert_equal_s(s_output, test->expect_str);
cl_assert_equal_i(s_cond.eval_time, test->expect_eval_time);
#if DEBUG_PRINTING
printf("\n");
#endif
}
}
/////////////////////////////////////////////////////... | printf("next_eval: %ld\n", cond.eval_time) | |
*addr_buf = connection->initial_addr;
}
}
prv_unlock();
}
void connection_get_local_address(Connection *connection, BTDeviceAddress *addr_buf) {
prv_lock();
{
*addr_buf = connection->local_addr;
}
prv_unlock();
}
void connection_get_conn_params(const Connection *connection,
... | {
prv_set_flag(connection, is_subscribed,
ConnectionFlag_IsSubscribedToGattMtuNotifications);
} | |
app_inbox_service_has_inbox_for_tag(AppInboxServiceTagUnitTest));
}
void test_app_inbox__app_inbox_create_and_register_kernel_oom(void) {
fake_kernel_malloc_set_largest_free_block(0);
void *result = app_inbox_create_and_register(BUFFER_SIZE, 1,
test_message_handler... | app_inbox_service_is_being_written_for_tag(AppInboxServiceTagUnitTest) | |
ION_SIZE + 1];
char uptime_string[16]; // "xxd xxh xxm xxs"
char const * subtitle_text[SystemInformationItem_Count];
char language_string[16];
} SystemInformationData;
typedef struct SettingsSystemData {
SettingsCallbacks callbacks;
SystemInformationData information_data;
SystemCertificationData certifica... | (s_information_titles[cell_index->row], data) | ;
menu_cell_basic_draw(ctx, cell_layer, title, info->subtitle_text[cell_index->row], NULL);
}
int16_t prv_information_get_cell_height_callback(MenuLayer *menu_layer,
MenuIndex *cell_index, void *context) {
return PBL_IF_RECT_ELSE(menu_cell_basic_cell_height(),
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.