prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
// Cancel all connection intents:
for (GAPLEClient c = 0; c < GAPLEClientNum; ++c) {
gap_le_connect_cancel_all(c);
}
gap_le_connect_deinit();
cl_assert_equal_b(gap_le_connect_has_pending_create_connection(), false);
cl_assert_equal_i(gap_le_connect_connection_intents_count(), 0);
gap_le_connection... | cl_assert_equal_b(registered, true) | ;
}
void test_gap_le_connect__register_same_device_and_bonding(void) {
// Test that it is possible to have 2 intents for the same device, when registering one intent
// using the resolvable address and one with a bonding. Pebble will not try to collate these,
// because there are many addresses that resolve to t... |
icense for the specific language governing permissions and
* limitations under the License.
*/
#include "health_sleep_detail_card.h"
#include "health_detail_card.h"
#include "services/normal/activity/health_util.h"
#include "kernel/pbl_malloc.h"
#include "services/common/clock.h"
#include "services/common/i18n/i18n... | (GColorClear, GColorBlack) | ,
};
prv_set_sleep_session(heading->primary_value, buffer_len,
health_data_sleep_get_start_time(health_data),
health_data_sleep_get_end_time(health_data));
heading = &card_data->headings[card_data->num_headings++];
*heading = (HealthDetailHeading) {
.primar... |
if (!bitmap || delta_x == 0) {
return;
}
const int bpp = gbitmap_get_bits_per_pixel(bitmap->info.format);
const int16_t abs_delta = ABS(delta_x);
const bool delta_neg = (delta_x < 0);
const int16_t min_y = bitmap->bounds.origin.y;
const int16_t max_y = grect_get_max_y(&bitmap->bounds) - 1;
for (int... | (to, from, (size_t)pixels_to_move) | |
ALID_ARGUMENT);
rv = pfs_write(0, NULL, 0);
cl_assert(rv == E_INVALID_ARGUMENT);
uint8_t buf[10];
int fd = pfs_open("newfile", OP_FLAG_WRITE | OP_FLAG_READ,
FILE_TYPE_STATIC, sizeof(buf));
for (int i = 0; i < sizeof(buf); i++) {
buf[i] = i;
}
rv = pfs_write(fd, NULL, sizeof(buf));
cl_assert(... | (rv == E_INVALID_ARGUMENT) | ;
int fd = pfs_open("file", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10);
cl_assert(fd >= 0);
rv = pfs_close(fd);
cl_assert(rv == S_SUCCESS);
rv = pfs_close(fd); // should not be able to double close an fd
cl_assert(rv == E_INVALID_ARGUMENT);
}
void test_pfs__remove(void) {
cl_assert(pfs_remove(NULL) == E_INVAL... |
c.auto.h"
#include "kernel/events.h"
#include "kernel/pbl_malloc.h"
#include "process_management/process_manager.h"
#include "services/common/new_timer/new_timer.h"
#include "services/common/system_task.h"
#include "services/normal/accessory/smartstrap_attribute.h"
#include "services/normal/accessory/smartstrap_comms.h... | if ((current_state == SmartstrapAttributeStateIdle) &&
(new_state == SmartstrapAttributeStateWritePending)) {
return pebble_task_get_current() == CONSUMER_TASK;
} else if ((current_state == SmartstrapAttributeStateWritePending) &&
(new_state == SmartstrapAttributeStateRequestPending)) {
... |
}
static void prv_set_attribute_state(SmartstrapAttributeInternal *attr,
SmartstrapAttributeState new_state) {
PBL_ASSERTN(prv_is_valid_fsm_transition(attr, new_state));
attr->state = new_state;
}
//! Note; This should only be called from the consumer task
static bool prv_star... |
i_animation = animation_sequence_create(ui_movement, ui_bounceback, NULL);
Animation *combined = animation_spawn_create(action_bar_animation, ui_animation, NULL);
s_phone_ui_data->action_bar_animation = combined;
animation_schedule(combined);
#if PBL_ROUND
// Extend the bounds to center the call text when the a... | if (s_phone_ui_data->select_action) {
window_single_click_subscribe(BUTTON_ID_SELECT, s_phone_ui_data->select_action);
} |
if (s_phone_ui_data->down_action) {
window_single_click_subscribe(BUTTON_ID_DOWN, s_phone_ui_data->down_action);
}
window_single_click_subscribe(BUTTON_ID_BACK, prv_pop_click_handler);
}
static void prv_action_bar_setup(PhoneCallActions actions) {
s_phone_ui_data->up_action = NULL;
s_phone_ui_data->se... |
s_app_list = &app_list;
Window window = {};
layer_init(&window.layer, &GRectZero);
manager.window = &window;
Layer layer_a, layer_b, layer_c;
layer_init(&layer_a, &GRectZero);
layer_init(&layer_b, &GRectZero);
layer_init(&layer_c, &GRectZero);
layer_add_child(&window.layer, &layer_a);
layer_add_child... | (prv_dispatch_touch_event(r, &ctx)) | |
ect;
origin.origin.y -= BOUNCEBACK_OFFSET;
Animation *bounceback_animation = property_animation_get_animation(
property_animation_create(&s_frame_layer_implementation, &data->cassette_layer.layer,
&origin, &cassette_rect));
animation_set_duration(bounceback_animation, 4 * AN... | {
// no animations on tintin
Animation *animation = prv_create_cassette_animation(context);
animation_schedule(animation);
if (click_recognizer_get_button_id(recognizer) == BUTTON_BACKWARD) {
music_command_send(MusicCommandPreviousTrack);
} else {
music_command_send(MusicCommandNextTrack);
}
} |
static void prv_volume_click_handler(ClickRecognizerRef recognizer, void *context) {
reset_action_bar_revert_timer(context);
// TODO: absolute volume + volume indicator, when that information is available.
bool is_volume_up = (click_recognizer_get_button_id(recognizer) == BUTTON_ID_UP);
prv_change_volume(is_v... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | app_state_get_unobstructed_area_state() | ->handlers.will_change);
cl_assert(!app_state_get_unobstructed_area_state()->handlers.change);
cl_assert(!app_state_get_unobstructed_area_state()->handlers.did_change);
// Unsubscribing again should not crash
app_unobstructed_area_service_unsubscribe();
cl_assert(!app_state_get_unobstructed_area_state()->han... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_LOG(LOG_LEVEL_INFO, "flags: 0x02%x", flags) | ;
}
BTBondingID bonding_id = bt_persistent_storage_store_ble_pairing(&bonding->pairing_info,
bonding->is_gateway, NULL,
should_pin_address,
... |
/*
* 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 (char *)segment->start + offset;
} | |
n this case, walk forward from {0, 0| to avoid a very long loop run
const bool is_invalid_section = menu_layer->selection.index.section == MENU_INDEX_NOT_FOUND;
const int16_t comp = is_invalid_section ? 1 :
menu_index_compare(&index, &menu_layer->selection.index);
MenuSelectIndexIterator it... | {
return cell_layer->is_highlighted;
} | |
/*
* 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... | prefs_db_read((uint8_t *)key, key_len, (uint8_t *)&get_value,
sizeof(get_value)) | |
it");
_Static_assert((ERASE_UNIT_SIZE % LOG_PAGE_SIZE) == 0,
"The log page size must be divisible by the erase unit size");
//! Given the current address and amount to increment it by, handles wrapping
//! and computes the valid flash address
static uint32_t prv_get_page_addr(uint32_t curr_page_addr, uint32_t inc... | {
uint32_t flash_addr = FLASH_REGION_DEBUG_DB_BEGIN + offset;
FlashLoggingHeader hdr;
flash_read_bytes((uint8_t *)&hdr, flash_addr, sizeof(hdr));
bool in_use_and_valid = prv_flash_log_valid(&hdr);
// if the page is not in use or the log id is not for the generation we
// are searching for, co... | |
es for task %d at %ld (%lu ms delta)",
(int)num_samples, (int)pebble_task_get_current(), (uint32_t)timestamp_ms,
time_since_last_sample);
for (unsigned int i=0; i<num_samples; i++) {
ACCEL_LOG_DEBUG(" => x:%d, y:%d, z:%d", state->raw_data[i].x, state->raw_data[i].y, state->ra... | (session, ACCEL_SAMPLING_25HZ, samples_per_update, handler) | ;
}
// ----------------------------------------------------------------------------------------------
void accel_data_service_subscribe__deprecated(uint32_t samples_per_update, AccelRawDataHandler__deprecated handler) {
AccelServiceState * session = accel_service_private_get_session(PebbleTask_Unknown);
AccelServ... |
_arrow_layer_frame = (GRect) {
.size = arrow_layer_frame_size,
};
Layer *up_arrow_layer = &launcher_menu_layer->up_arrow_layer;
layer_init(up_arrow_layer, &up_arrow_layer_frame);
layer_add_child(container_layer, up_arrow_layer);
const int16_t down_arrow_layer_frame_origin_y =
(int16_t)(frame.size.h... | (&launcher_menu_layer->menu_layer.inverter.layer, &selection_global_rect) | ;
*vertical_range_out = (GRangeVertical) {
.origin_y = selection_global_rect.origin.y,
.size_h = selection_global_rect.size.h,
};
}
void launcher_menu_layer_get_selection_state(const LauncherMenuLayer *launcher_menu_layer,
LauncherMenuLayerSelectionState *state... |
t_tx_power_level returns false, when no TX Power Level:
int8_t tx_power_level_out;
cl_assert(!ble_ad_get_tx_power_level(s_ad_data, &tx_power_level_out));
}
void test_ble_ad_parse__128_bit_uuid(void) {
// AD Element, Length: 2, AD Type: Flags
// AD Element, Length: 17, AD Type: More 128-bit UUIDs available,
/... | ble_ad_destroy(ad) | |
turn;
}
AppDBEntry *db_entry = kernel_malloc_check(sizeof(AppDBEntry));
EnumerateData cb_data = {
.cb = cb,
.data = data,
.entry_buf = db_entry,
};
settings_file_each(&s_app_db.settings_file, prv_enumerate_entries, &cb_data);
prv_close_file_and_unlock_mutex();
kernel_free(db_entry);
retur... | {
if (key_len != UUID_SIZE) {
return E_INVALID_ARGUMENT;
}
status_t rv = prv_lock_mutex_and_open_file();
if (rv != S_SUCCESS) {
return rv;
}
PBL_ASSERTN(key_len == 16);
AppInstallId app_id = prv_find_install_id_for_uuid(&s_app_db.settings_file, (Uuid *)key);
if (app_id == INSTALL_ID_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... | (ctx, bounds, GOvalScaleModeFitCircle, radius, 0, TRIG_MAX_ANGLE / 2) | ;
}
__profiler_stop();
APP_LOG(APP_LOG_LEVEL_INFO, "180 filled");
__profiler_print_stats();
// 180 degrees, 1px inset
__profiler_start();
for (int i = 0; i < ITERATIONS; ++i) {
graphics_fill_radial(ctx, bounds, GOvalScaleModeFitCircle, inset_thickness, 0,
TRIG_MAX_ANGLE / 2);... |
d test_pfs__watch_file_callbacks(void) {
const char* file_name = "newfile";
PFSCallbackHandle cb_handle = pfs_watch_file(file_name, prv_file_changed_callback,
FILE_CHANGED_EVENT_ALL, NULL);
// Callback should get invoked if we close with write access
s_watch_file... | (name, "a_", 2) | |
/*
* 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 (total_size == 0) {
// a file of size zero is valid at the moment
return true;
} |
int fd = pfs_open(info->filename, OP_FLAG_READ | OP_FLAG_WRITE, FILE_TYPE_STATIC, total_size);
storage->impl_data = (void*)(uintptr_t) fd;
return fd >= 0;
}
uint32_t pb_storage_file_get_max_size(PutBytesObjectType object_type) {
return get_available_pfs_space();
}
void pb_storage_file_write(PutBytesStorage... |
clude "stubs_sleep.h"
#include "stubs_status_bar_layer.h"
#include "stubs_syscall_internal.h"
#include "stubs_syscalls.h"
#include "stubs_task_watchdog.h"
#include "stubs_text_layer_flow.h"
#include "stubs_window_manager.h"
#include "stubs_window_stack.h"
// Setup and Teardown
////////////////////////////////////
voi... | window_render(&selection_window.window, ctx) | |
y obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Lic... | (PebbleTask_KernelMain) | ;
// Don't launch workers in recovery mode to reduce the chance of crashes
#ifdef RECOVERY_FW
return false;
#endif
// If workers are disabled, don't launch
if (!s_workers_enabled) {
PBL_LOG(LOG_LEVEL_WARNING, "Workers disabled");
return false;
}
// if we are trying to start another worker, then w... |
/*
* 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... | (features, HRMFeature_BPM) | |
#include "graphics_private.h"
#include "graphics_private_raw.h"
#include "gtransform.h"
#include "applib/app_logging.h"
#include "applib/applib_malloc.auto.h"
#include "kernel/ui/kernel_ui.h"
#include "process_management/process_manager.h"
#include "process_state/app_state/app_state.h"
#include "system/passert.h"
#inc... | (clipped_rect.origin.y < bitmap->bounds.size.h) | ;
PBL_ASSERTN(clipped_rect.origin.y >= 0);
const uint16_t y = clipped_rect.origin.y;
const uint16_t x_end = x + width;
graphics_private_draw_horizontal_line_integral(ctx, &ctx->dest_bitmap, y, x, x_end, fill_color);
}
}
//! Return the maximum rounded corner radius allowed for a given rectangle size
... |
db(1000000));
}
void test_app_install_manager__get_md(void) {
const PebbleProcessMd *tictoc_md = app_install_get_md(tictoc_id, false);
cl_assert(tictoc_md != NULL);
cl_assert_equal_b(false, tictoc_md->has_worker);
cl_assert_equal_i(ProcessTypeWatchface, tictoc_md->process_type);
cl_assert_equal_i(ProcessStor... | (music_id) | );
// Clear recent time.
app_install_unmark_prioritized(music_id);
cl_assert_equal_b(false, app_install_is_prioritized(music_id));
// Update most recent time and let it expire
app_install_mark_prioritized(music_id, true /* can_expire */);
cl_assert_equal_b(true, app_install_is_prioritized(music_id));
/... |
text,
TEXT_FONT,
*text_box,
TEXT_OVERFLOW,
TEXT_ALIGNMENT,
... | dialog_appear(dialog) | ;
}
static void prv_simple_dialog_unload(Window *window) {
SimpleDialog *simple_dialog = window_get_user_data(window);
dialog_unload(&simple_dialog->dialog);
if (simple_dialog->dialog.destroy_on_pop) {
applib_free(simple_dialog);
}
}
static void prv_click_handler(ClickRecognizerRef recognizer, void *conte... |
/*
* 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... | swap16(&p0.x, &p1.x) | ;
swap16(&p0.y, &p1.y);
}
int dx = p1.x - p0.x;
int dy = abs(p1.y - p0.y);
int16_t err = dx / 2;
int16_t ystep;
if (p0.y < p1.y) {
ystep = 1;
} else {
ystep = -1;
}
for (; p0.x <= p1.x; p0.x++) {
if (steep) {
graphics_private_set_pixel(ctx, GPoint(p0.y, p0.x));
} else {
... |
vice) != NULL);
bt_unlock();
return connected;
}
// -------------------------------------------------------------------------------------------------
uint16_t gap_le_connection_get_gatt_mtu(const BTDeviceInternal *device) {
bt_lock();
const GAPLEConnection *connection = prv_find_connection(device);
const ui... | {
return connection->is_gateway;
} |
GAPLEConnection *gap_le_connection_get_gateway(void) {
return gap_le_connection_find(prv_find_gateway, NULL);
}
// -------------------------------------------------------------------------------------------------
static bool prv_find_connection_with_bonding_id(GAPLEConnection *connection, void *data) {
BTBondin... |
t size_t payload_length = prv_serialize_log(
contents, log_level, prv_get_timestamp_ms(), pebble_task_get_current(),
src_filename, src_line_number, message);
pulse_push_send(contents, payload_length);
}
static bool prv_isr_buffer_read_and_consume(void *buffer, size_t read_length) {
portENTER_CRITICAL... | if (portIN_CRITICAL() || mcu_state_is_isr() ||
xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED) {
// We're in a state where we can't immediately send the message, save it to an internal buffer
// instead for later sending.
prv_enqueue_log_message(log_level, message);
} else {
// Send the log... |
}
void pulse_logging_log_buffer_flush(void) {
prv_event_cb(NULL);
}
void pulse_logging_log_sync(uint8_t log_level, const char *src_filename,
uint16_t src_line_number, const char *message) {
// Send the log line inline, even if we're in a critical section or ISR
prv_send_pulse_packet... |
ble = health_service_metric_accessible(HealthMetricHeartRateBPM, now + 10, now + 20);
cl_assert_equal_i(accessible, HealthServiceAccessibilityMaskNotAvailable);
// normal value is available
accessible = health_service_metric_accessible(HealthMetricHeartRateBPM, now - 10, now);
cl_assert_equal_i(accessible, Hea... | rtc_get_time() | ;
typedef struct {
const char *desc;
struct {
HealthMetric metric;
time_t time_start;
time_t time_end;
HealthAggregation aggregation;
HealthServiceTimeScope scope;
bool hr_disabled;
} in;
struct {
HealthServiceAccessibilityMask accessible;
} out;
} Test... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | app_manager_get_task_context() | ->closing_state != ProcessRunState_Running) {
// Ignore if the app is not running (such as if it is in the process of closing)
return true;
}
if (low_power_is_active()) {
// If we're in low power mode we dont allow any interaction
return true;
}
return false;
}
static void prv_launch_app_via_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... | prompt_send_response("up") | ;
}
}
|
bool last_click_only, ClickHandler handler) {
Window *window = window_manager_get_top_window();
prv_check_is_in_click_config_provider(window, "subscribe");
ClickManager *mgr = prv_get_current_click_manager();
ClickConfig *cfg = &mgr->recognizers[button_id].config;
cfg->multi_click.... | window_schedule_render(window) | |
{
return;
} |
text_layer_deinit(text_layer);
applib_free(text_layer);
}
void text_layer_deinit(TextLayer *text_layer) {
PBL_ASSERTN(text_layer);
layer_deinit(&text_layer->layer);
graphics_text_layout_cache_deinit(&text_layer->layout_cache);
text_layer->layout_cache = NULL;
}
Layer* text_layer_get_layer(TextLayer *text... | |
/*
* 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... | printf("gack() = %d\n", gack()) | |
BLE_MEDIA_EVENT);
cl_assert_equal_i(e.media.type, PebbleMediaEventTypeVolumeChanged);
cl_assert_equal_i(music_get_volume_percent(), 0x33);
} else {
cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT);
}
}
static void prv_receive_and_assert_player_info(bool expect_is_handled) {
uint8_t msg[] = { 0x13, 17, ... | prv_receive_app_info_event(true /* is_android */) | ;
// Receive Now Playing info. Should be ignored, because other server is connected:
prv_receive_and_assert_all(false /* expect_is_handled*/);
// Disconnect dummy server, to clean up after ourselves:
prv_set_dummy_server_connected(false /* connected */);
}
void test_music_endpoint__ignore_now_playing_from_ios... |
prv_set_user(Human_ShortFemale) | ;
cl_assert_equal_i(1155, activity_private_compute_resting_calories(long_time_m) / ACTIVITY_CALORIES_PER_KCAL);
cl_assert_equal_i(4, activity_private_compute_resting_calories(short_time_m) / ACTIVITY_CALORIES_PER_KCAL);
prv_set_user(Human_TallFemale);
cl_assert_equal_i(1630, activity_private_compute_resting_... | |
v = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE);
if (rv != S_SUCCESS) {
mutex_unlock_recursive(s_app_cache_mutex);
return;
}
// resource_list contains all of the resource files we found. We only
// want to delete orphans so we can remove any entries from the list that correspond
... | mutex_lock_recursive(s_app_cache_mutex) | ;
{
SettingsFile file;
rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE);
if (rv != S_SUCCESS) {
goto unlock;
}
rv = settings_file_delete(&file, (uint8_t *)&app_id, sizeof(AppInstallId));
if (rv == S_SUCCESS) {
// Will delete an app from the filesystem.
... |
t.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_circle_quadrant_draw_1px_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, GCornersTop);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quads_top.${BIT_DEPTH_NAME}.pbi"));
se... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_inside_origin_layer.${BIT_DEPTH_NAME}.pbi")) | ;
layer_set_update_proc(&layer, &clear_layer_update_callback);
layer_render_tree(&layer, &ctx);
#if PBL_COLOR
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_clear.8bit.pbi"));
#else
cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite));
#endif
}
// Draws circles in a g... |
/*
* 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... | ("Version: %"PRIu16"\n", got_version) | |
meter_for_display_round},
.perimeter.inset = 8,
.paging.page_on_screen.size_h = DISP_ROWS, // setting a page height != enables positioning
.paging.origin_on_screen = {0, 0},
},
};
render_steps(&layout, RenderMoveTextBox, DELTA, DISP_ROWS, NULL);
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PB... | GPoint(0, y) | |
plete = (PPoGATTPacket *) malloc(s_client_reset_complete_size);
*s_client_reset_complete = (const PPoGATTPacket) {
.sn = 0,
.type = PPoGATTPacketTypeResetComplete,
};
if (s_ppogatt_version > 0) {
*((PPoGATTResetCompleteClientIDPayloadV1 *)s_client_reset_complete->payload) =
(const PPoGATTRese... | memcpy(packet->payload, data, length) | ;
fake_gatt_client_op_assert_write(characteristic, (const uint8_t *) packet,
sizeof(PPoGATTPacket) + length,
GAPLEClientKernel, false /* is_response_required */);
free(packet);
}
// Tests
/////////////////////////////////////////////////////////... |
/*
* 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 char *existing_name = "";
if (app_notif_prefs) {
existing_name = attribute_get_string(&app_notif_prefs->attr_list, AttributeIdAppName, "");
}
if (!pstring_equal_cstring(&app_name_attr->pstr, existing_name)) {
// If the existing name doesn't match our new name, update the name
... |
// Add the mute attribute if we don't have one already
// Default the app to not muted
const bool already_has_mute =
app_notif_prefs && attribute_find(&app_notif_prefs->attr_list, AttributeIdMuteDayOfWeek);
if (!already_has_mute) {
attribute_list_add_uint8(&new_attr_list, AttributeIdMuteDayOfWeek, M... |
*mask = ctx->draw_state.draw_mask;
graphics_private_raw_mask_apply(dst_color, mask, data_offset, x, 1, blended_color);
#else
*dst_color = blended_color;
#endif // CAPABILITY_HAS_MASKING
#endif // (SCREEN_COLOR_DEPTH_BITS == 8)
}
static ALWAYS_INLINE void prv_set_color(const GContext *ctx, GColor *dst_color,
... | graphics_private_raw_blend_color_factor(ctx, output, data_row_offset, color, x2.integer,
(uint8_t)x2.fraction) | ;
}
#else
// TODO: as part of PBL-30849 make this a first-class function
// also see prv_blend_horizontal_line_raw
const int16_t x1_rounded = (x1.raw_value + FIXED_S16_3_HALF.raw_value) / FIXED_S16_3_FACTOR;
const int16_t x2_rounded = (x2.raw_value + FIXED_S16_3_HALF.raw_value) / FIXED_S16_3_FACTOR;
prv_ass... |
_cb, NULL);
cl_assert_equal_i(num_restfulsleep_sessions, s_prv_activity_cb__call_count);
cl_assert_equal_b(s_prv_activity_cb__args[0].activity, HealthActivityRestfulSleep);
// respect mask for Run/Walk
s_prv_activity_cb__call_count = 0;
s_sys_activity_get_sessions_values.out.num_sessions = 7;
health_servic... | (0 > prv_session_compare(
&(ActivitySession) {.start_utc = now, .length_min = 10},
&(ActivitySession) {.start_utc = now + (2 * SECONDS_PER_MINUTE), .length_min = 5},
HealthIterationDirectionFuture)) | ;
// b starts earlier
cl_assert(0 < prv_session_compare(
&(ActivitySession) {.start_utc = now, .length_min = 10},
&(ActivitySession) {.start_utc = now - (2 * SECONDS_PER_MINUTE), .length_min = 5},
HealthIterationDirectionFuture));
// both end at the same time
cl_assert(0 == prv_session_compare(
... |
segment. */
if(heap_info_ptr != heap->begin) {
/* Calculate the pointer to the previous segment. */
HeapInfo_t *previous_block = get_previous_block(heap, heap_info_ptr);
HEAP_ASSERT_SANE(heap, previous_block->Size == heap_info_ptr->PrevSize, heap_info_ptr);
/* Check to see if... | if (n_units >= LARGE_SIZE) {
heap_info_ptr = (HeapInfo_t *)(((Alignment_t *)heap->end) - heap->begin->PrevSize);
} else {
heap_info_ptr = heap->begin;
} |
/* Loop until we have walked the entire list. */
while (((n_units < LARGE_SIZE) || (heap_info_ptr > heap->begin)) && (heap_info_ptr < heap->end)) {
prv_sanity_check_block(heap, heap_info_ptr);
/* Check to see if the current entry is free and is large*/
/* enough to hold the data being ... |
0);
RCC->AHB3ENR &= ~(0x00000003);
RCC->APB1ENR &= ~(0x17e6c9ff);
RCC->APB2ENR &= ~(0x01177933);
// Reset most peripherals used by the bootloader. We want to minimize the
// chances that the firmware unintentionally relies on some state that the
// bootloader leaves behind. This includes disabling the PLL.... | (BOOT_BIT_RESET_LOOP_DETECT_TWO) | |
els_per_mask_value);
for (int16_t y = 0; y < mask_size.h; y++) {
test_graphics_context_mask_set_value_for_coordinate(ctx, mask, mask_pixel_value,
GPoint(x, y));
}
}
return mask;
}
typedef void (*HorizontalClippingMaskApplyFunc)(GContext *ctx,... | {
int16_t y1 = (int16_t)((dest_color_index * vline_applying_test_row_height) +
(mask_value_index * num_pixels_per_mask_value));
int16_t y2 = (int16_t)(y1 + num_pixels_per_mask_value - 1);
apply_func(ctx, x, y1, y2, src_color);
} | |
-128},
{ 1416, 640, -192},
{ 1536, 528, -248},
// 98 seconds
{ 1240, 328, -272},
{ 864, 232, -416},
{ 568, 104, -416},
{ 208, 16, -384},
{ -32, -128, -288},
{ -152, -40, -328},
{ -160, 40, -408},
{ 32, -24, -328},
{ 240, 16, -160},
{ 544, 264, -216},
{ 728, 160, ... | { 808, 192, 40},
{ 760, 168, 64},
{ 760, 120, 96},
{ 760, 96, 104},
{ 776, 72, 144},
{ 880, 56, 152},
{ 992, 96, 104},
{ 1416, -32, 224},
{ 1560, 320, -32},
{ 1312, 312, -232},
// 104 seconds
{ 1600, 440, -312},
{ 1472, 392, -112},
{ 1072, 200, 80},
{ 912, 224... |
{ 1400, 360, -352},
{ 1536, 480, -296},
{ 1352, 288, 24},
{ 1080, 216, 56},
{ 872, 232, 32},
{ 736, 240, -32},
{ 664, 344, -48},
{ 704, 304, -16},
{ 864, 312, -72},
{ 1040, 352, -32},
{ 1384, 440, -88},
{ 1432, 448, -64},
{ 1648, 336, 48},
{ 1528, 432, -16},
... |
/*
* 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... | status_t (*get_erase_status_fn)(void) | |
/*
* 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_put_byte(HDLC_ESCAPE) | ;
prv_put_byte(datum ^ HDLC_ESCAPE_MASK);
} else {
prv_put_byte(datum);
}
}
static void prv_prompt_output_cb(int16_t *samples, size_t sample_count, void *context) {
const int OUTPUT_SAMPLE_RATE = (s_is_8khz) ? 8000 : 16000;
int to_process = MIN((int)sample_count, s_timeout);
s_timeout -= to_process;... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | app_file_parse_app_id(filename) | ;
}
|
ionaryIterator* orig_iter,
DictionaryIterator* new_iter,
const bool update_existing_keys_only,
const DictionaryKeyUpdatedCallback update_key_callback,
void* context) {
... | (dest_iter) | ;
cleanup:
task_free(orig_buffer);
return result;
}
Tuple *dict_find(const DictionaryIterator *iter, const uint32_t key) {
DictionaryIterator iter_copy = *iter;
Tuple *tuple = dict_read_first(&iter_copy);
while (tuple) {
if (tuple->key == key) {
return tuple;
}
tuple = dict_read_next(&iter... |
found_actl);
}
int32_t png_seek_chunk_in_resource_system(ResAppNum app_num, uint32_t resource_id, uint32_t offset,
bool seek_framedata, bool *found_actl) {
uint32_t current_offset = offset;
bool actl_chunk_found = false; // ACTL chunk indicates PNG is an APNG
str... | {
// bitmap init failed, free palette
APP_LOG(APP_LOG_LEVEL_ERROR, PNG_LOAD_ERROR);
applib_free(palette);
} |
// we are keeping the image data to avoid copying it
upng_destroy(upng, !retval);
return retval;
}
static uint16_t prv_gbitmap_png_create_palette_for_grayscale(upng_t *upng, GColor8 **palette_out) {
uint16_t palette_entries = 0;
uint32_t bpp = upng_get_bpp(upng);
// Convert Luminance format from Grayscal... |
argin;
box.size.w -= left_margin;
GRect value_box = box;
if (config->overflow_mode != GTextOverflowModeWordWrap) {
box.origin.y += vertical_margin;
box.size.h = title_height + 4;
value_box.origin.y = box.origin.y;
} else {
// Value box is centered when drawing with GTextOverflowModeWordWrap.
... | if (config->icon_box_model) {
icon_frame_size = gsize_add(icon_frame_size, config->icon_box_model->margin);
} |
}
const bool can_use_two_lines_for_title = !(render_subtitle || render_icon);
const bool can_use_many_lines_for_title = (config->overflow_mode == GTextOverflowModeWordWrap);
const int16_t intitial_title_text_lines = can_use_two_lines_for_title ? 2 : 1;
int16_t title_text_frame_height = can_use_many_lines_fo... |
pg_header(&pg_hdr, curr_page);
break; // we are done
}
}
// we have succesfully allocated space for the file, so add file specific info
f->start_page = f->curr_page = start_page;
FileHeader file_hdr;
memset(&file_hdr, 0xff, sizeof(file_hdr));
file_hdr.file_namelen = strlen(f->name);
file_hdr.f... | PFS_FD(fd) | .fd_status == FD_STATUS_UNREFERENCED) {
if ((unref == -1) || (PFS_FD(fd).time_closed < curr_time_closed)) {
unref = fd;
curr_time_closed = PFS_FD(fd).time_closed;
}
}
}
*fdp = unref;
if (unref != -1) {
mark_fd_free(unref); // clean up previous file state
}
return ((*fdp !... |
es);
if (!buffer) {
APP_LOG(APP_LOG_LEVEL_ERROR, "Not enough mem to recv postMessage() of %"PRIu32" bytes",
(uint32_t) chunk->total_size_bytes);
// https://pebbletechnology.atlassian.net/browse/PBL-42466
// TODO: AppMessage NACK the message so the other side can retry later. Not doin... | {
list_append((ListNode *)s_state.out.control_msg_queue, (ListNode *)node);
} | else {
s_state.out.control_msg_queue = node;
}
prv_outbox_try_send_next();
}
////////////////////////////////////////////////////////////////////////////////
// Generic outbox handlers
////////////////////////////////////////////////////////////////////////////////
static bool prv_is_outbox_busy(void) {
r... |
assert_equal_i(ProcessStorageBuiltin, tictoc_md->process_storage);
app_install_release_md(tictoc_md);
const PebbleProcessMd *music_md = app_install_get_md(music_id, false);
cl_assert(music_md != NULL);
cl_assert_equal_b(false, music_md->has_worker);
cl_assert_equal_i(ProcessTypeApp, music_md->process_type);
... | {
static const uint32_t INIT_TIME = 1388563200;
fake_rtc_init(0, INIT_TIME);
cl_assert_equal_b(false, app_install_is_prioritized(music_id));
// Update most recent time.
app_install_mark_prioritized(music_id, true /* can_expire */);
cl_assert_equal_b(true, app_install_is_prioritized(music_id));
// Clear... | |
ld remain active
cl_assert_equal_b(s_app_idle, false);
// Assert that the window pushed onto the app stack has lost focus
// We do this by checking the last event, which should have been a focus
// lost event.
PebbleEvent event = fake_event_get_last();
cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_F... | cl_assert_equal_i(window_stack_count(app_stack), 0) | ;
window_destroy(window1);
window_destroy(window2);
}
// Description:
// This test ensures that the flow of adding a window to the window stack is followed
// correctly. That is, we add the window to the window stack, its load handler is
// called, it calls to set the click config, and the click config is set pr... |
_spalding_data_row_infos != bmp->data_row_infos); // union with .palette
bmp = gbitmap_create_blank(s10, GBitmapFormat2BitPalette);
cl_assert(NULL != bmp);
cl_assert(g_gbitmap_spalding_data_row_infos != bmp->data_row_infos); // union with .palette
bmp = gbitmap_create_blank(s10, GBitmapFormat4BitPalette);
c... | gbitmap_create_blank_with_palette(s10, GBitmapFormat2BitPalette, p, true) | ;
cl_assert(NULL != bmp);
cl_assert(p == gbitmap_get_palette(bmp));
bmp = gbitmap_create_blank_with_palette(s10, GBitmapFormat4BitPalette, p, true);
cl_assert(NULL != bmp);
cl_assert(p == gbitmap_get_palette(bmp));
cl_assert(NULL == gbitmap_create_blank_with_palette(s10, GBitmapFormat8BitCircular, p, true... |
2C peripheral.
//! Always lock the bus and peripheral config access before enabling it
static void bus_enable(uint8_t bus_idx) {
// Don't power up rail if the bus is already in use (enable can be called to reset bus)
if (i2c_buses[bus_idx].user_count == 0) {
bus_rail_power_up(bus_idx);
}
bus_pin_cfg_i2c(B... | (LOG_LEVEL_ERROR, "Attempted reset of disabled bus %d by device %d", bus_idx, device_id) | ;
bus_unlock(bus);
return;
}
PBL_LOG(LOG_LEVEL_WARNING, "Resetting I2C bus %" PRId8, bus_idx);
// decrement user count for reset so that if this user is the only user, the
// bus will be powered down during the reset
bus->user_count--;
// Reset and reconfigure bus and pins
bus_reset(bus_idx);
... |
_change) {
callbacks->selection_will_change(callbacks, &new_index->row, old_row);
}
}
static void prv_draw_row_callback(GContext *ctx, const Layer *cell_layer,
MenuIndex *cell_index, void *context) {
SettingsData *data = context;
uint16_t row = cell_index->row;
const uint... | prv_get_current_callbacks(data) | ;
if (callbacks->appear) {
callbacks->appear(data->callbacks);
}
}
static void prv_settings_window_unload(Window *window) {
SettingsData *data = window_get_user_data(window);
// Call the hide callback for the currently open category.
SettingsCallbacks *callbacks = prv_get_current_callbacks(data);
if (c... |
e.pin.header.id, &s_items[5].header.id));
// check second again
cl_assert(iter_prev(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check fourth
cl_assert(iter_next(&iterator));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].head... | (&state.pin.header.id, &s_extra_case_items[2].header.id) | );
cl_assert(!iter_next(&iterator));
}
// 5am, no events passed
void test_timeline__extra_case_none_backwards(void) {
prv_insert_extra_case_items();
Iterator iterator = {0};
TimelineIterState state = {0};
TimelineNode *head = NULL;
timeline_init(&head);
cl_assert_equal_i(timeline_iter_init(&iterator, ... |
1,
.tm_mon = 0,
.tm_year = 115
};
time_t utc_sec = mktime(&start_tm);
rtc_set_time(utc_sec);
const time_t time_elapsed = (20 * SECONDS_PER_MINUTE);
// Add a run session
ActivitySession run_activity = {
.start_utc = utc_sec - time_elapsed,
.length_min = time_elapsed,
.type = ActivitySe... | activity_get_metric(ActivityMetricHeartRateZone1Minutes, 1, &zone1_minutes) | ;
cl_assert_equal_i(zone1_minutes, 2);
activity_get_metric(ActivityMetricHeartRateZone2Minutes, 1, &zone2_minutes);
cl_assert_equal_i(zone2_minutes, 2);
activity_get_metric(ActivityMetricHeartRateZone3Minutes, 1, &zone3_minutes);
cl_assert_equal_i(zone3_minutes, 2);
// Add some more "regular" heart rates.
... |
max, pixel_max),
GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL);
}
}
static void prv_display_serial_number(Layer *layer, GContext *ctx) {
AppData *data = app_state_get_user_data();
const GRect *bounds = &data->window.layer.bounds;
graphics_context_set_text_color(ctx, GColorWhite... | {
AppData *app_data = app_state_get_user_data();
app_data->app_state = (app_data->app_state + 1) % (NumAdjustStates);
layer_mark_dirty(&app_data->window.layer);
} |
static void prv_up_click_handler(ClickRecognizerRef recognizer, void *data) {
AppData *app_data = app_state_get_user_data();
--(app_data->axis_offsets[app_data->app_state]);
layer_mark_dirty(&app_data->window.layer);
}
static void prv_down_click_handler(ClickRecognizerRef recognizer, void *data) {
AppData ... |
8, -120, -992},
{ -168, -120, -992},
{ -184, -128, -984},
{ -168, -128, -1000},
{ -168, -136, -1000},
{ -160, -128, -984},
{ -168, -128, -984},
{ -168, -120, -1000},
{ -168, -128, -1008},
{ -168, -136, -1000},
{ -160, -168, -968},
{ -160, -104, -1008},
{ -168, -144, -1016... | { -168, -104, -1000},
{ -168, -128, -1000},
{ -168, -136, -984},
{ -168, -136, -1000},
{ -168, -144, -992},
{ -176, -128, -1008},
{ -160, -112, -1000},
{ -176, -128, -976},
{ -168, -112, -992},
{ -168, -120, -992},
{ -176, -128, -992},
{ -168, -144, -1000},
{ -176, -1... |
{ -176, -128, -992},
{ -176, -128, -984},
{ -168, -128, -984},
{ -168, -144, -1000},
// 185 seconds
{ -176, -152, -1000},
{ -176, -144, -984},
{ -168, -128, -984},
{ -168, -128, -992},
{ -168, -128, -1000},
{ -168, -136, -1000},
{ -160, -144, -992},
{ -168, -144, -99... |
0, 368, -55},
{ 879, 288, 32},
{ 806, 225, 44},
{ 773, 252, 53},
{ 766, 293, 72},
{ 835, 326, 52},
{ 837, 341, -7},
{ 908, 366, -63},
{ 1095, 380, -64},
{ 1255, 444, -82},
{ 1251, 445, -50},
{ 1428, 497, -26},
{ 1284, 550, -10},
{ 1167, 432, 60},
{ 1146, 407, 90},... | { 889, 333, -29},
{ 1132, 351, -31},
{ 1275, 429, -32},
{ 1222, 462, -17},
{ 1352, 589, -57},
{ 1253, 575, -12},
{ 1327, 465, 73},
{ 1291, 417, 109},
{ 1198, 320, 189},
{ 987, 256, 190},
{ 899, 218, 167},
{ 883, 199, 190},
{ 860, 181, 209},
{ 774, 139, 194},
{... |
{ 838, 150, 195},
{ 968, 155, 238},
{ 1107, 153, 254},
{ 1185, 231, 141},
{ 1346, 272, 105},
{ 1148, 315, -24},
{ 987, 403, -201},
{ 999, 290, -55},
{ 997, 238, 56},
{ 901, 234, 50},
{ 856, 269, 26},
{ 807, 341, 31},
{ 825, 379, 3},
{ 805, 357, -43},
{ 801, 3... |
_install_get_entry_for_install_id(id, &entry)) {
return false;
}
if (app_install_entry_is_SDK_compatible(&entry)) {
return true;
}
PBL_LOG(LOG_LEVEL_WARNING, "App requires support for SDK version (%"PRIu8".%"PRIu8"), "
"we only support version (%"PRIu8".%"PRIu8").",
... | {
// can't retrieve app install entry for id
PBL_LOG(LOG_LEVEL_ERROR, "Failed to get entry for id %"PRId32, id);
} | else if (app_install_entry_is_watchface(&entry)) {
// If the watchface is for an unsupported SDK version, we need to switch the default
// watchface back to tictoc. Otherwise, we will be stuck in the launcher forever.
watchface_set_default_install_id(INSTALL_ID_INVALID);
watchface_launc... |
e_t end_time = sessions[i].start_utc + (sessions[i].length_min * SECONDS_PER_MINUTE);
if ((end_time >= end_utc) && (end_time <= utc_sec)
&& (!remove_ongoing || !sessions[i].ongoing)) {
// Keep it
continue;
}
// This one needs to be removed
uint32_t remaining = *session_entries - i -... | {
state->sleep_sessions_modified = true;
} |
// If this is an existing activity, update it
ActivitySession *stored_session = state->activity_sessions;
for (uint16_t i = 0; i < state->activity_sessions_count; i++, stored_session++) {
if (prv_activity_sessions_equal(session, stored_session, true /*any_sleep*/)) {
state->activity_sessions... |
{ -224, 168, -1144},
// 89 seconds
{ -328, 216, -1168},
{ -304, 176, -1184},
{ -136, 256, -1248},
{ 80, 232, -1224},
{ 88, 248, -1048},
{ 16, 216, -928},
{ -96, 152, -800},
{ -216, 168, -760},
{ -272, 104, -768},
{ -280, 72, -808},
{ -272, 72, -904},
{ -264, 40, -1... | { 952, 48, -40},
{ 896, 64, 8},
{ 880, 24, 32},
{ 1048, 16, 64},
{ 1112, -88, 104},
{ 1072, -232, 192},
{ 1320, 32, 112},
{ 1328, 320, -296},
{ 1336, 288, -400},
{ 1328, 72, -192},
{ 1184, -112, -80},
{ 856, -248, -200},
// 95 seconds
{ 728, -32, -184},
{ 744,... |
{ 824, 128, 32},
{ 1072, 168, 88},
{ 1128, 256, -8},
{ 936, 344, -200},
{ 1096, 296, -128},
{ 1488, 472, -112},
{ 944, 800, 136},
{ 1312, 192, -88},
{ 1176, 184, -96},
{ 1000, 456, -104},
{ 1160, 512, -48},
{ 1432, 528, 48},
{ 1576, 472, 248},
{ 1720, 472, 80},
... |
5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
// 165: Local time: 2016-05-19 11:50:00 PM
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141, 0},
{ 0, 0x5b, 0, 141... | { 0, 0x79, 0, 141, 0},
{ 0, 0x79, 0, 141, 0},
{ 0, 0x7a, 512, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 134, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 0, 141, 0},
{ 0, 0x6a, 244, 141, 0... |
{ 0, 0x6b, 0, 141, 0},
{ 0, 0x6b, 0, 141, 0},
{ 0, 0x6b, 0, 141, 0},
{ 0, 0x6b, 0, 141, 0},
{ 0, 0x6b, 0, 141, 0},
{ 0, 0x6b, 0, 141, 0},
{ 0, 0x6b, 0, 141, 0},
{ 0, 0x6b, 0, 141, 0},
// 315: Local time: 2016-05-20 02:21:00 AM
{ 0, 0x6b, 1650, 141, 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... | {
PBL_LOG(LOG_LEVEL_DEBUG, "Option Menu Demo: selected %d", selection);
} | |
name_out, &platform_bits_out);
cl_assert(ret);
cl_assert_equal_m(&addr_1, &addr_out, sizeof(addr_out));
cl_assert_equal_m(&link_key_1, &link_key_out, sizeof(link_key_out));
cl_assert_equal_s(name_1, name_out);
cl_assert_equal_i(platform_bits_1, platform_bits_out);
// Store ... | (platform_bits_1, platform_bits_out) | |
CLIP(y, MIN_RAW_Y, MAX_RAW_Y-1) | - MIN_RAW_Y;
// scale to our screen size
x = (x * DISP_COLS) / (MAX_RAW_X - MIN_RAW_X);
y = (y * DISP_ROWS) / (MAX_RAW_Y - MIN_RAW_Y);
// fix the fact that Y is inverted
y = DISP_ROWS - 1 - y;
// set the result
*pos = GPoint(x, y);
}
static void prv_process_pending_messages(void *context) {
s_callb... | |
ivitySleep);
s_sys_activity_get_metric_values.out.history[0] = ActivitySleepStateRestfulSleep;
activities = health_service_peek_current_activities();
cl_assert_equal_i(activities, HealthActivitySleep | HealthActivityRestfulSleep);
s_sys_activity_get_metric_values.out.history[0] = ActivitySleepStateAwake;
s_... | ARRAY_LENGTH(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... | (x2->raw_value, current_data_row_info.max_x << FIXED_S16_3_PRECISION) | ;
return x1->integer <= x2->integer;
}
return false;
}
// Clip the provided x values to the values in the provided data row info.
// Return true if clipped values are valid for the row, false otherwise.
static bool prv_clip_x_values_to_data_row_info(const GBitmapDataRowInfo *data_row_info, int16_t *x1,
... |
util_dbgserial_str(format_str) | ;
}
void heap_calc_totals(Heap* const heap, unsigned int *used, unsigned int *free, unsigned int *max_free) {
UTIL_ASSERT(heap);
/* Verify that the parameters that were passed in appear valid. */
if((used) && (free) && (max_free) && (heap->begin)) {
heap_lock(heap);
prv_calc_totals(heap, used, free... | |
d;
int color = strtol(color_num, &end, 10);
if (*end) {
prompt_send_response("Invalid color");
return;
}
mfg_info_set_watch_color(color);
const WatchInfoColor written_color = mfg_info_get_watch_color();
if (written_color == color) {
prompt_send_response("OK");
} else {
prompt_send_respo... | if (as_fw) {
BLTEST_LOG("STAGE 1 -- Copying STAGE 2 to scratch");
prv_bootloader_test_copy(FLASH_REGION_FIRMWARE_SCRATCH_BEGIN,
FLASH_REGION_FIRMWARE_SCRATCH_END);
BLTEST_LOG("STAGE 1 -- Marking new FW boot bit");
boot_bit_set(BOOT_BIT_NEW_FW_AVAILABLE);
} else {
BLTE... |
BLTEST_LOG("STAGE 1 -- Rebooting");
RebootReason reason = { RebootReasonCode_PrfReset, 0 };
reboot_reason_set(&reason);
system_hard_reset();
}
#else
void command_bootloader_test(void) {
prompt_send_response("Not configured for bootloader test");
}
#endif
|
, // 1464820884 (Wed, 1 June 2016 22:41:24 GMT)
// Slice 2
0x0B, 0x00, // Total size
0x00, // AppGlanceSliceType - AppGlanceSliceType_IconAndSubtitle
0x01, // Number of attributes
// Slice Attributes
0x25, // Attribute ID - Attribu... | (glance_out) | |
Y_QUICK_LAUNCH_BACK "qlBack"
static QuickLaunchPreference s_quick_launch_up = {
.enabled = true,
.uuid = UUID_INVALID_INIT,
};
static QuickLaunchPreference s_quick_launch_down = {
.enabled = true,
.uuid = UUID_INVALID_INIT,
};
static QuickLaunchPreference s_quick_launch_select = {
.enabled = true,
.uuid ... | {
s_units_distance = UnitsDistance_Miles;
return false;
} |
s_units_distance = *new_unit;
return true;
};
static bool prv_set_s_backlight_enabled(bool *enabled) {
s_backlight_enabled = *enabled;
return true;
}
static bool prv_set_s_backlight_ambient_sensor_enabled(bool *enabled) {
s_backlight_ambient_sensor_enabled = *enabled;
return true;
}
static bool prv_set_... |
lude <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#define PROMPT_RESP_ACK (100)
#define PROMPT_RESP_DONE (101)
#define PROMPT_RESP_MESSAGE (102)
static void start_prompt(void);
static void pulse_send_message(const int message_type, const char* response);
static void prv_pulse_done_command(vo... | (args.args[0], args.args[1], args.args[2], args.args[3]) | |
egacy_2(state));
AnimationPrivate *animation = prv_find_animation_by_handle(state, animation_h, false /*quiet*/);
if (!animation) {
return false;
}
return animation->reverse;
}
// -------------------------------------------------------------------------------------------
bool animation_set_play_count(Anim... | PBL_ASSERTN(!animation_private_using_legacy_2(NULL)) | ;
Animation *seq = prv_complex_create(animation_array, array_len, AnimationTypeSequence);
return seq;
}
// -------------------------------------------------------------------------------------------
Animation *animation_sequence_init_from_array(Animation *parent, Animation **animation_array,
... |
rc_color;
}
#endif
void graphics_draw_rotated_bitmap(GContext* ctx, GBitmap *src, GPoint src_ic, int rotation,
GPoint dest_ic) {
PBL_ASSERTN(ctx);
if (rotation == 0) {
graphics_draw_bitmap_in_rect(
ctx, src, &(GRect){ .origin = { dest_ic.x - src_ic.x, dest_ic.y - src_ic.... | // only draw if within the dest range
const GBitmapDataRowInfo dest_info = gbitmap_get_data_row_info(dest_bitmap, y);
if (!WITHIN(x, dest_info.min_x, dest_info.max_x)) {
continue;
}
const int32_t cos_value = cos_lookup(-rotation);
const int32_t sin_value = sin_lookup(-rotati... |
src_vector_y.rem < 0 ? (-src_vector_y.rem) >> 3 : 0,
src_vector_y.rem < 0 ? (TRIG_MAX_RATIO + src_vector_y.rem) >> 3 :
(TRIG_MAX_RATIO - src_vector_y.rem) >> 3,
src_vector_y.rem < 0 ? 0 : (src_vector_y.rem) >> 3
};
int32_t thresh = 0;
for (int ... |
/*
* 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_bar);... |
}
}
static void prv_register_redraw_timer(ActionBarLayer *action_bar) {
if (!action_bar->redraw_timer) {
action_bar->redraw_timer = app_timer_register(MILLISECONDS_PER_FRAME, prv_timed_redraw,
action_bar);
}
}
inline static void action_bar_set_highlighted(A... |
raw_arc_internal(&ctx, pt, radius, 0, test_angles[i].angle);
stroke_width += 1;
radius += 3;
pt.x += (radius + stroke_width) * 2;
if (pt.x > 120) {
pt.x = CENTER_OF_ORIGIN_RECT.x;
pt.y += (radius + stroke_width) * 2;
}
}
char filename[100];
snprintf(filename, ... | {
graphics_draw_arc_precise_internal(&ctx, center, radius, angle_start, angle_end);
center.x.integer += (angle_offset % 2 == 0) ? DRAWING_SPACING : -DRAWING_SPACING;
center.y.integer += (angle_offset == 1) ? DRAWING_SPACING : 0;
angle_start += TRIG_MAX_ANGLE / 4;
angle_end += T... |
char filename[100];
snprintf(filename, sizeof(filename),
"draw_arc_origin_aa_precise_%s_%s_.${BIT_DEPTH_NAME}.pbi", precision_modes[precision_mode], mode_names[mode]);
cl_check_(gbitmap_pbi_eq(&ctx.dest_bitmap, filename), filename);
center.y.integer -= DRAWING_SPACING;
an... |
*
* 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
* distribute... | (write_buffer) | ;
return result;
}
bytes_written += result;
kernel_free(write_buffer);
return bytes_written;
}
//! Iterate over notifications space and mark the oldest notifications as deleted until we have
//! enough space available
static void prv_reclaim_space(size_t size_needed, int fd) {
size_needed = ((size_need... |
_value_is_constructor(func_obj_val)) {
return TYPE_ERROR_ARG;
}
return (jerry_value_t)EM_ASM_INT({
var func_obj = __jerryRefs.get($0);
var args = [];
for (var i = 0; i < $2; ++i) {
args.push(__jerryRefs.get(getValue($1 + i*4, 'i32')));
}
// Call the constructor ... | {
EM_ASM_INT({
return __jerryRefs.setError($0, true);
}, *value_p);
} | |
/*
* 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... | (PULSE_CONTROL_MESSAGE_PROTOCOL) | ;
message->code = PCMPCode_PortClosed;
memcpy(message->information, &port, sizeof(port));
this->send_fn(message, sizeof(PCMPPacket) + sizeof(port));
}
#endif
|
ound(GContext *ctx, const ActionMenuLayer *aml,
const GRect *label_text_container) {
const int indicator_height = fonts_get_font_height(aml->layout_cache.font);
const int text_height = aml->layout_cache.item_heights[aml->selected_index];
const int content_height = MIN(label_te... | {
GRect bottom_bounds = label_text_container;
bottom_bounds.size.h = fade_height;
bottom_bounds.origin.y = grect_get_max_y(&label_text_container) -
(fade_height + VERTICAL_PADDING);
graphics_draw_bitmap_in_rect(ctx, &aml->item_animation.fade_bottom, &bottom_bounds);
} |
#endif
}
static void prv_draw_row(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index,
void *callback_context) {
ActionMenuLayer *aml = callback_context;
if (cell_index->row < aml->num_items) {
const ActionMenuItem *item = prv_get_item_for_index(aml, cell_index->row);
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... | text_layer_set_text(data->title_text_layer, "ALS") | ;
text_layer_set_text_alignment(data->title_text_layer, GTextAlignmentCenter);
layer_add_child(window_layer, text_layer_get_layer(data->title_text_layer));
bounds.origin.y += 30;
data->reading_text_layer = text_layer_create(bounds);
prv_update_reading(data);
text_layer_set_font(data->reading_text_layer, ... |
ecognizerRef recognizer, Window *window) {
ClickAppData *data = window_get_user_data(window);
const uint16_t count = click_number_of_clicks_counted(recognizer);
sniprintf(data->text_buffer, TEXT_BUFFER_SIZE, "Multi Click! (%u)\nMin: 2, Max: 10", count);
PBL_LOG(LOG_LEVEL_DEBUG, "Multi Click! (%u)", click_number... | PBL_CROAK("Out of memory") | |
_value_has_error_flag(arg_result)) {
return jerry_acquire_value(arg_result);
}
bool is_relevant = false;
API_REFS_FOREACH(api_ref) {
if ((*api_ref)->add_handler) {
is_relevant = (*api_ref)->add_handler(event_name, func);
if (is_relevant) {
break;
}
}
}
if (!is_relevant)... | (args.this_arg) | ;
}
static void prv_call_event_handlers_async_cb(void *ctx) {
jerry_value_t event = (jerry_value_t)(uintptr_t) ctx;
rocky_global_call_event_handlers(event);
jerry_release_value(event); // was acquired in rocky_global_call_event_handlers_async() call
}
void rocky_global_call_event_handlers_async(jerry_value_t 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... | app_state_set_user_data(vibe_num_window) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | {
app_unobstructed_area_service_unsubscribe();
unobstructed_area_service_deinit(app_state_get_unobstructed_area_state());
} | |
{ -104, 536, -840},
{ -112, 536, -848},
{ -104, 544, -848},
{ -112, 544, -840},
{ -104, 536, -840},
{ -112, 536, -840},
{ -104, 536, -848},
{ -112, 544, -848},
{ -120, 544, -840},
{ -112, 544, -840},
// 129 seconds
{ -112, 544, -848},
{ -112, 536, -840},
{ -112, 5... | { -112, 528, -856},
// 134 seconds
{ -96, 536, -856},
{ -104, 544, -848},
{ -96, 536, -840},
{ -104, 528, -848},
{ -104, 528, -848},
{ -104, 536, -848},
{ -96, 536, -848},
{ -96, 528, -848},
{ -104, 528, -848},
{ -112, 536, -848},
{ -104, 536, -848},
{ -96, 528, -... | |
/*
* 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(&parent, &child_a) | ;
cl_assert(parent.first_child == &child_a);
layer_add_child(&parent, &child_b);
cl_assert(parent.first_child == &child_a);
cl_assert(child_a.next_sibling == &child_b);
cl_assert(child_a.parent == &parent);
cl_assert(child_b.parent == &parent);
layer_add_child(&parent, &child_c);
cl_assert(child_c.paren... |
DEFINE_SYSCALL(void, sys_vibe_history_start_collecting, void) {
s_vibe_history_enabled = true;
}
DEFINE_SYSCALL(void, sys_vibe_history_stop_collecting, void) {
s_vibe_history_enabled = false;
mutex_lock(s_vibe_history_mutex);
prv_vibe_history_clear(HISTORY_CLEAR_ALL);
mutex_unlock(s_vibe_history_mutex);
}
... | {
if (s_vibe_queue_head == NULL) {
PBL_LOG(LOG_LEVEL_ERROR, "Tried to handle a vibe event with a null vibe queue");
return;
}
mutex_lock(s_vibe_pattern_mutex);
// remove the event I've finished
VibePatternStep *removed_node = s_vibe_queue_head;
s_vibe_queue_head = (VibePatternStep*)list_pop_head((... |
int32_t vibes_get_vibe_strength(void) {
return s_vibe_strength;
}
int32_t vibes_get_default_vibe_strength(void) {
return s_vibe_strength_default;
}
void vibes_set_default_vibe_strength(int32_t vibe_strength_default) {
s_vibe_strength_default = vibe_strength_default;
}
DEFINE_SYSCALL(int32_t, sys_vibe_get_vib... |
},
{ -40, 904, -592},
{ -16, 1008, -576},
{ 48, 936, -512},
{ 32, 632, -376},
{ -72, 512, -272},
{ -120, 560, -264},
{ -112, 688, -304},
{ -32, 1032, -376},
{ 72, 968, -376},
{ 16, 888, -384},
{ 0, 744, -336},
{ 0, 672, -344},
{ 8, 688, -376},
{ 16, 704, -400},
... | { -32, 776, -496},
{ -32, 808, -512},
{ 0, 832, -472},
// 42 seconds
{ 24, 856, -400},
{ 8, 1168, -488},
{ 232, 1152, -472},
{ 304, 1072, -440},
{ 248, 736, -320},
{ 144, 632, -264},
{ 216, 768, -304},
{ 352, 856, -304},
{ 328, 784, -312},
{ 216, 728, -312},
{... |
{ 176, 600, -512},
{ 168, 624, -520},
{ 112, 600, -536},
{ 32, 568, -528},
{ 0, 576, -544},
{ -16, 616, -576},
{ 8, 624, -576},
{ 8, 648, -576},
{ -32, 648, -544},
{ -80, 712, -568},
// 45 seconds
{ -72, 784, -616},
{ -72, 1072, -744},
{ 72, 1088, -744},
{ 17... |
i < exp_num_sessions; i++) {
cl_assert_equal_i(sessions[i].type, health_sessions[i].type);
cl_assert_equal_i(sessions[i].start_utc, health_sessions[i].start_utc);
cl_assert_equal_i(sessions[i].length_min, health_sessions[i].length_min);
}
}
// ===========================================================... | (ACTIVITY_SESSION_UPDATE_MIN, ACTIVITY_SETTINGS_UPDATE_MIN) | ;
prv_feed_cannned_accel_data(SECONDS_PER_MINUTE * wait_min, 0, ActivitySleepStateAwake);
ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricStepCount,
((const uint32_t [ACTIVITY_HISTORY_DAYS]){100, 0, 0, 0, 0, 0, 0}));
ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepTotalSeconds,
((cons... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.