prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
tbox_data);
outbox_data->session = session;
outbox_data->endpoint_id = endpoint_id;
memcpy(outbox_data->payload, payload, payload_length);
prv_send_outbox_raw_data((const uint8_t *)outbox_data, outbox_data_size);
return outbox_data;
}
static void prv_process_send_queue(CommSession *session) {
cl_assert(ses... | app_free(outbox_data) | ;
}
void test_app_message_sender__auto_select_not_js_app(void) {
AppMessageAppOutboxData *outbox_data =
prv_create_and_send_outbox_message(NULL /* auto-select */, ALLOWED_ENDPOINT_ID,
TEST_PAYLOAD, sizeof(TEST_PAYLOAD));
prv_process_send_queue(s_system_session_ptr);
... |
/*
* 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... | i18n_ctx_noop("NotifVibe", "Low") | ,
i18n_ctx_noop("NotifVibe", "Medium"),
i18n_ctx_noop("NotifVibe", "High")
};
static void prv_vibe_menu_select(OptionMenu *option_menu, int selection, void *context) {
const bool enable_vibration = (selection != 0);
const VibeIntensity new_vibe_intensity = enable_vibration ? (selection - INTENSITY_ROW_OFFSET) ... |
/*
* 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_monitor_get_standby_timer_id() | |
? 1 : 0;
minute_data[i].heart_rate_bpm = next_heart_rate_bpm++;
minute_data[i].heart_rate_total_weight_x100 = next_heart_rate_heart_rate_total_weight_x100++;
minute_data[i].heart_rate_zone = next_heart_rate_zone++;
}
}
// ----------------------------------------------------------------... | (&s_dls_records[j].samples[i],
&minute_data[(j * ALG_MINUTES_PER_DLS_RECORD) + i],
sizeof(minute_data[i])) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | jerry_value_is_string(value) | ) {
uint32_t sz = jerry_get_utf8_string_size(value);
char buf[sz + 1];
memset(buf, 0, sz + 1);
jerry_string_to_utf8_char_buffer(value, (jerry_char_t *)buf, sz);
rv = strtoul(buf, NULL, 0);
}
return rv;
}
int32_t jerry_get_int32_value(jerry_value_t value) {
return (int32_t)(round(jerry_get_nu... |
nclude "applib/ui/window_private.h"
#include "drivers/flash.h"
#include "drivers/system_flash.h"
#include "flash_region/flash_region.h"
#include "kernel/pbl_malloc.h"
#include "process_state/app_state/app_state.h"
#include "services/common/system_task.h"
#include "services/runlevel.h"
#include "system/bootbits.h"
#incl... | WINDOW_NAME("Grenade Launcher") | |
graphics_context_set_fill_color(ctx, highlighted_color);
GCornerMask corner;
switch (index) {
case 0: corner = GCornerTopLeft; break;
case NUM_ACTION_BAR_LEGACY2_ITEMS - 1: corner = GCornerBottomLeft; break;
default: corner = GCornerNone; break;
}
gr... | if (action_bar->click_config_provider) {
action_bar->click_config_provider(context);
} |
}
inline static void action_bar_legacy2_update_click_config_provider(
ActionBarLayerLegacy2 *action_bar) {
if (action_bar->window) {
window_set_click_config_provider_with_context(
action_bar->window,
(ClickConfigProvider) action_bar_legacy2_click_config_provider,
action_bar);
}
}
... |
}
static void prv_disable_chip_select(void) {
gpio_use(DISP_GPIO);
// delay while last byte is emitted by the SPI peripheral
delay_us(7);
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_RESET);
// hold time > 1us
// produce a delay 4ms
delay_us(4);
gpio_release(DISP_GPIO);
}
//! These functions needed to... | {
// Enable the GPIO{B,C} clocks; this is required before configuring the pins
gpio_use(DISP_GPIO);
gpio_use(PWR_CTL_GPIO);
// Connect PB13 to SPI2_SCK
GPIO_PinAFConfig(DISP_GPIO, GPIO_PinSource13, GPIO_AF_SPI2);
// Connect PB15 to SPI2_MOSI
GPIO_PinAFConfig(DISP_GPIO, GPIO_PinSource15, GPIO_AF_SPI2);
... |
// Clear-all mode is entered by sending 0x04 to the panel
void display_clear(void) {
prv_enable_display_access();
prv_display_write_byte(DISP_MODE_CLEAR);
prv_display_write_byte(0x00);
prv_disable_display_access();
}
//! Static mode is entered by sending 0x00 to the panel
//! This stops any further updates... |
-920},
{ 0, -264, -960},
{ 64, -128, -840},
{ -32, -112, -784},
// 2 seconds
{ -24, -216, -552},
{ -16, -8, -688},
{ 8, 80, -680},
{ 48, 184, -608},
{ 120, 776, -896},
{ 208, 656, -848},
{ 176, 888, -872},
{ 320, 1120, -920},
{ 192, 944, -968},
{ 328, 944, -928},... | { 792, 320, -56},
{ 1024, 168, 104},
{ 1000, 104, 176},
{ 848, 104, 104},
{ 720, 104, 56},
{ 680, 104, 64},
{ 672, 64, 32},
{ 664, 40, 64},
// 8 seconds
{ 760, 24, 80},
{ 960, 32, -16},
{ 1152, 88, -32},
{ 1840, -80, 192},
{ 1640, 72, 144},
{ 1256, 456, -160},... |
{ 840, 272, 64},
{ 816, 264, 136},
{ 800, 336, 88},
{ 744, 328, 64},
{ 704, 328, -8},
{ 880, 352, -24},
{ 1096, 328, 8},
{ 1176, 304, -8},
{ 1656, 208, 128},
{ 1664, 288, 200},
{ 1080, 320, 96},
{ 952, 280, 80},
// 11 seconds
{ 1128, 128, 200},
{ 1048, 80, 20... |
als 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.
// GPIOs are not reset here: resetting them would change their output values,
// which could unintentionally modify periphe... | (BOOT_BIT_RESET_LOOP_DETECT_ONE) | ;
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO);
break;
case 3:
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE);
break;
case 4:
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE);
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO);
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_THREE);
break;
case 5:... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | window_get_root_layer(app_data->window) | ;
GRect bounds = layer_get_bounds(window_layer);
app_data->result_text = text_layer_create((GRect) {
.origin = { .x = 10, .y = 10},
.size = { .w = bounds.size.w - 20, .h = bounds.size.h - 20 }
});
text_layer_set_text(app_data->result_text, "Press SELECT to start");
text_layer_set_overflow_mode(app_d... |
/*
* 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... | dbgserial_print("*** WTF ") | ;
dbgserial_print_hex(saved_lr);
dbgserial_putstr("");
reset_due_to_software_failure();
}
//! Assert function called by the STM peripheral library's
//! 'assert_param' method. See stm32f2xx_conf.h for more information.
void assert_failed(uint8_t* file, uint32_t line) {
register uintptr_t lr __asm("lr");
uint... |
pass_data_service_start,
&prv_compass_data_service_stop);
}
void ecompass_service_handle(void) {
static int samples_collected = 0;
// read magnetometer sample
MagData mag_data;
MagReadStatus rv = mag_read_data(&mag_data);
if (rv != MagReadSuccess) {
if (rv == MagReadCommunicationFail) {
// he... | DEFINE_SYSCALL(void, sys_ecompass_get_last_heading, CompassHeadingData *data) | |
ommon/system_task.h"
#include "services/imu/units.h"
#include "syscall/syscall.h"
#include "syscall/syscall_internal.h"
#include "system/logging.h"
#include "system/passert.h"
#include "util/math.h"
#include "util/shared_circular_buffer.h"
#include "FreeRTOS.h"
#include "queue.h"
#include <inttypes.h>
// We use this... | PBL_LOG(LOG_LEVEL_DEBUG, "Starting accel double tap service") | ;
accel_enable_double_tap_detection(true);
prv_setup_subsampling(accel_get_sampling_interval());
}
mutex_unlock_recursive(s_accel_manager_mutex);
}
static void prv_double_tap_remove_subscriber_cb(PebbleTask task) {
mutex_lock_recursive(s_accel_manager_mutex);
PBL_ASSERTN(s_double_tap_subscribers_coun... |
ialog.message = applib_malloc(message_buffer_size);
if (!data->dialog.message) {
return false;
}
strncpy(data->dialog.message, message, message_buffer_size);
data->dialog.icon = timeline_res_id;
data->dialog.success = success;
return true;
}
static bool prv_show_result_window_with_progress(ActionResult... | {
return;
} |
data->chaining_data.action_chaining_window = chaining_window;
data->chaining_data.notif = timeline_item_copy(cb_data->item);
data->standalone_action = cb_data->standalone_action;
const bool ignore_failures = false;
prv_subscribe_to_action_results_and_timeouts(data, ignore_failures);
timeline_invoke_actio... |
/*
* 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... | (rect, GEdgeInsets(0, 18)) | |
K_INTERVAL_MINUTES 5
static bool prv_sends_enabled(void) {
return (s_sends_enabled_run_level && s_sends_enabled_pp);
}
// ----------------------------------------------------------------------------------------
//! Wrapper for data_logging_send_session that makes it usable in dls_list_for_each_session
//! @param e... | if (inactive && (total_bytes == 0)) {
prv_remove_logging_session(logging_session);
return true;
} else if (!empty && !inactive && (total_bytes < 8000)) {
return true; // nothing to flush yet
} |
bool success = false;
uint8_t *buffer = kernel_malloc_check(DLS_ENDPOINT_MAX_PAYLOAD);
unsigned int num_bytes = DLS_ENDPOINT_MAX_PAYLOAD;
PBL_ASSERTN(logging_session->item_size <= num_bytes);
num_bytes -= (num_bytes % logging_session->item_size);
uint32_t new_read_offset;
int32_t read_bytes = dls_stora... |
ute_data(samples, num_samples, exp_minutes, ARRAY_LENGTH(exp_minutes));
}
// Run the working at desk sample
// The expected results were obtained empirically on a known good commit
{
int num_samples;
AccelRawData *samples = activity_sample_working_at_desk(&num_samples);
TestMinuteData exp_minutes[]... | (s_num_captured_activity_sessions, 1) | ;
ASSERT_ACTIVITY_SESSION_PRESENT(s_captured_activity_sessions, s_num_captured_activity_sessions, &exp_session);
}
// --------------------------------------------------------------------------------------
// Test a run session of 30 minutes long that starts 10 minutes in that has a 2 minute
// gap in the ... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | APP_LOG(APP_LOG_LEVEL_ERROR, msg) | ;
// Force an exception
typedef void (*FuncPtr)(void);
FuncPtr bad_func = NULL;
bad_func();
}
}
// -----------------------------------------------------------------------------------------------
void handle_accel(AccelRawData *accel_data, uint32_t num_samples, uint64_t timestamp) {
// Display dat... |
/*
* 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... | (10, 10, 40, 40) | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | if (inverter_layer == NULL) {
return NULL;
} |
return &inverter_layer->layer;
}
|
interrupts.h"
#include "services/common/regular_timer.h"
#include "system/bootbits.h"
#include "system/logging.h"
#include "system/passert.h"
#include "system/reset.h"
#include "util/time/time.h"
#define STM32F2_COMPATIBLE
#include <mcu.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
typedef uint3... | time_t_to_string(buffer, s_time_base) | );
PBL_LOG_VERBOSE("Restore RTC: s_time_tick_base: %"PRId64, s_time_tick_base);
#endif
}
static time_t ticks_to_time(RtcTicks ticks) {
return s_time_base + ((ticks - s_time_tick_base) / RTC_TICKS_HZ);
}
static RtcIntervalTicks get_last_save_time_ticks(void) {
return RTC_ReadBackupRegister(CURRENT_INTERVAL_TICKS... |
/*
* 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;
} |
state->event_info = (EventServiceInfo) {
.type = PEBBLE_SMARTSTRAP_EVENT,
.handler = prv_app_smartstrap_event
};
event_service_client_subscribe(&state->event_info);
state->timeout_ms = SMARTSTRAP_TIMEOUT_DEFAULT;
sys_smartstrap_subscribe();
state->is_initialized = true;
}
static void prv_state_dei... |
/*
* 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... | (FLASH_REGION_SHARED_PRF_STORAGE_BEGIN) | ;
}
flash_write_bytes((const uint8_t*) data, FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, sizeof(*data));
}
static void prv_apply_patch_to_struct(void *patch, size_t size, size_t offset, bool should_erase) {
SharedPRFData data;
prv_fetch_struct(&data);
uint8_t *unmodified_data_patch_start = ((uint8_t *)&data) + ... |
*node = (NotificationNode*) list_get_at(
(ListNode*) notifications_data->notification_list, notif_idx);
if (!node) {
return;
}
LoadedNotificationNode *loaded_node = prv_loaded_notification_list_load_item(
¬ifications_data->loaded_notification_list, node);
if (!loaded_node) {
return;
}
... | prv_loaded_notification_list_deinit(data->loaded_notification_list) | |
RADED ||
s_install_callback_data.install_type == APP_REMOVED ||
s_install_callback_data.install_type == APP_DB_CLEARED) {
const AppInstallId to_kill = s_install_callback_data.install_id;
// Close the current app if it is the one we are trying to remove/upgrade
// OR
// If we ar... | {
const char *name = app_custom_get_title(install_id);
if (name) {
return name;
}
return NULL;
} |
uint32_t app_install_entry_get_icon_resource_id(const AppInstallEntry *entry) {
return entry->icon_resource_id;
}
ResAppNum app_install_get_app_icon_bank(const AppInstallEntry *entry) {
if (app_install_id_from_system(entry->install_id)) {
return SYSTEM_APP;
} else {
return entry->install_id;
}
}
boo... |
test_entry[k_max_tests];
memset(test_entry, 0, sizeof(test_entry));
while (prv_activity_sample_discovery_next(&test_entry[num_tests])) {
ActivityFileTestEntry *entry = &test_entry[num_tests];
#ifdef ACTIVITY_TEST_ONLY
if (strcmp(entry->name, ACTIVITY_TEST_ONLY)) {
continue;
}
#endif
entry->t... | if (results->all_passed) {
pass_count++;
} else {
fail_count++;
} | |
before we were able to process the PutRequest
prv_send_response(ResponseNack, s_pb_state.token);
}
return;
}
uint32_t token = 0;
for (int job_idx = 0; job_idx < num_put_jobs; job_idx++) {
PutBytesJob *job = &put_jobs->job[(read_idx + job_idx) % put_jobs->num_allocated_pb_jobs];
// Process... | if (s_pb_state.type == ObjectWatchApp ||
s_pb_state.type == ObjectAppResources ||
s_pb_state.type == ObjectWatchWorker) {
PBL_LOG(LOG_LEVEL_INFO, "Forcefully cancelling put_bytes transfer of app binaries");
prv_cleanup();
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Attempted to cancel put... |
xSemaphoreGive(s_pb_semaphore);
}
// Only used by unit test
void put_bytes_deinit(void) {
vSemaphoreDelete(s_pb_semaphore);
if (s_pb_state.timer_id != TIMER_INVALID_ID) {
new_timer_delete(s_pb_state.timer_id);
}
pb_storage_deinit(&s_pb_state.storage, false);
prv_deinit_put_job_queue();
s_pb_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... | cl_assert_equal_b(false, s_close_called) | |
ns under the License.
*/
#include "persist.h"
#include "kernel/memory_layout.h"
#include "process_management/process_manager.h"
#include "services/normal/persist.h"
#include "services/normal/settings/settings_file.h"
#include "syscall/syscall.h"
#include "syscall/syscall_internal.h"
#include "util/math.h"
_Static_... | (buffer_size, PERSIST_DATA_MAX_LENGTH) | ;
LOCK_AND_GET_STORE(store);
int result = settings_file_set(store, &key, sizeof(key),
buffer, restricted_size);
return PASSED(result) ? (int)restricted_size : result;
}
// Legacy version to prevent previous app breakage, __deprecated preserves order
int persist_write_data__deprec... |
/*
* 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_WARNING, "Failed to allocate memory for action result");
return NULL;
} |
uint8_t *buffer = (uint8_t *)action_result + sizeof(PebbleSysNotificationActionResult);
uint8_t *const buf_end = buffer + alloc_size;
action_result->id = header->item_id;
action_result->type = prv_get_action_result_type(header);
attributes_actions_init(&action_result->attr_list, &action_result->action_gro... |
/*
* 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... | ((Recognizer *)recognizer, &s_tap_recognizer_impl) | ;
}
void tap_recognizer_set_num_taps_required(Recognizer *recognizer, int num_taps) {
TapRecognizerData *data = recognizer_get_impl_data(recognizer, &s_tap_recognizer_impl);
if (!data) {
return;
}
data->config.taps_required = num_taps;
}
|
cl_assert_equal_b(true, scroll_layer_get_shadow_hidden(scroll_layer));
}
void test_scroll_layer__paging_vs_shadow_bits(void) {
ScrollLayer *scroll_layer = scroll_layer_create(GRect(0,0,180,180));
// Validate that paging_disabled is same position as shadow clips
scroll_layer->shadow_sublayer.clips = true;
c... | scroll_layer_scroll(scroll_layer, ScrollDirectionDown, false) | |
-----------------------------------------------------------------------------------
AnimationCurveFunction animation_get_custom_curve(Animation *animation_h) {
return prv_animation_get_custom_function(animation_h, AnimationCurveCustomFunction);
}
// -------------------------------------------------------------------... | if (animation->play_count == ANIMATION_PLAY_COUNT_INFINITE_STORED) {
return ANIMATION_PLAY_COUNT_INFINITE;
} else {
return animation->play_count;
} |
}
// -------------------------------------------------------------------------------------------
bool animation_set_elapsed(Animation *parent_h, uint32_t elapsed_ms) {
AnimationState *state = prv_animation_state_get(PebbleTask_Current);
PBL_ASSERTN(!animation_private_using_legacy_2(state));
AnimationPrivate *... |
mplementation s_fake_transport_implementation = {
.send_next = prv_fake_transport_send_next,
.reset = prv_fake_transport_reset,
};
Transport *fake_transport_create(TransportDestination destination,
const Uuid *app_uuid,
FakeTransportSentCallback sen... | prv_find_session_by_transport(transport) | ;
cl_assert(session);
return circular_buffer_write(&session->send_buffer, data, length);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Fake life cycle
void fake_comm_session_init(void) {
cl_assert_(s_fake_transport_head == NULL,
"Didn't cl... |
xcept in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY ... | ("Setting key 10 times and verifying we get the same value back...\n") | ;
for (int i = 0; i < 10; i++) {
snprintf((char *)val, 7, "val%03d", i);
printf("Iteration %d val %s\n", i, val);
set_and_verify(&file, key, key_len, val, val_len);
}
settings_file_close(&file);
cl_must_pass(settings_file_open(&file, "test_file_set_get_one_many_times", 4096));
printf("Making su... |
LEGATTClientEvent *event,
const KernelLEClient *client) {
const uint16_t value_length = event->value_length;
uint8_t *buffer = NULL;
if (value_length) {
// This is ugly and causes double-copying the data...
// TODO: https://pebbletechnology.atlassian.net/browse/PBL-1... | {
goto log_error;
} | |
ap_tiled(dest_bitmap, bitmap_to_draw, rect, src_offset,
ctx->draw_state.compositing_mode, ctx->draw_state.tint_color);
// Mark the region where the bitmap was drawn as dirty
graphics_context_mark_dirty_rect(ctx, rect);
call_processor_post_function_and_return:
// Call the process... | grect_contains_point(&src->bounds, &src_ic) | ) {
// TODO: Optimize further (PBL-15657)
// If src_ic is within the bounds of the source image, do the following performance
// optimization:
// Create a clipping rectangle based on the max distance away from the pivot point
// that the destination image could be located at:
// max distance fro... |
, 1);
for (int16_t row = 0; row < MAX_NUM_ROWS; row++) {
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS);
}
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_odd_offset_checkerboard_no_clip")));
// Clipping on even boundaries - no offset
... | gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_checkerboard_no_clip")) | );
// Clipping on even boundaries - no offset
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_EVEN, ORIGIN_RECT_NO_CLIP, false, 1);
for (int16_t col = 0; col < MAX_NUM_COLS; col++) {
graphics_draw_vertical_line_dotted(&ctx, GPoint(col, 0), MAX_NUM_ROWS);
}
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TE... |
/*
* 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... | {
TimelineLayer *timeline_layer = context;
return timeline_layer->relbar_layer.prev_rel_bar.anim_offset;
} |
static void prv_curr_rel_bar_setter(void *context, int16_t value) {
TimelineLayer *timeline_layer = context;
timeline_layer->relbar_layer.curr_rel_bar.anim_offset = value;
layer_mark_dirty(&timeline_layer->layer);
}
static int16_t prv_curr_rel_bar_getter(void *context) {
TimelineLayer *timeline_layer = conte... |
(source->order_storage == NULL));
// If we're adding the Settings app node to the list and it hasn't received a storage order,
// then give it its default order
if ((menu_node->install_id == APP_ID_SETTINGS) &&
(menu_node->storage_order == AppMenuStorageOrder_NoOrder)) {
menu_node->storage_order = A... | (source, node) | ;
} else {
// Changed and is now included:
if (node == NULL) {
add_app_with_install_id(&entry, source);
}
}
prv_alert_data_source_changed(source);
}
static void prv_app_icon_name_updated_callback(const AppInstallId install_id, void *data) {
AppMenuDataSource *data_source = data;
prv_send_ca... |
/*
* 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... | (info->crc, buf, s_chunk_size) | ;
data_logging_log(info->logging_session, buf, s_chunk_size / info->item_size);
++info->counter;
}
static void handle_timer(void *ck) {
if (s_data.info[0].logging_session == NULL) {
// Sessions closed.
return;
}
struct DataLoggingInfo*info = ck;
log_moar_data(info);
const int num_chunks = 30;
... |
/*
* 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 (hw_version_size > MFG_HW_VERSION_SIZE) {
// same assumption as in mfg_info_get_pcba_serialnumber
hw_version[MFG_HW_VERSION_SIZE] = '\0';
} |
}
|
into its framebuffer again.
PebbleEvent event = {
.type = PEBBLE_RENDER_FINISHED_EVENT,
};
process_manager_send_event_to_process(PebbleTask_App, &event);
}
void compositor_app_render_ready(void) {
if (!prv_should_render()) {
s_deferred_render.app.pending = true;
return;
}
if (s_state == Compo... | PBL_ASSERTN(animation_private && kernel_animation_state && kernel_animation_state->aux) | ;
AnimationPrivate *saved_current_animation = kernel_animation_state->aux->current_animation;
kernel_animation_state->aux->current_animation = animation_private;
compositor_transition_render(s_animation_state.impl->update, animation, distance_normalized);
kernel_animation_state->aux->current_animation = saved_... |
/*
* 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... | (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 uint16_t section = cell_index->section;
PBL_ASSERTN(section < SettingsMenuItem_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... | (state, seed) | ;
}
static int prv_next(tinymt32_t *state) {
if (state->mat1 == 0) { // Not initialized yet
prv_seed(state, 0x9a1431e6); // Just any ol' number
}
return tinymt32_generate_uint32(state);
}
uint32_t rand32(void) {
return prv_next(prv_get_seed_ptr());
}
int rand(void) {
return rand32() & 0x7FFFFFFF;
}
in... |
s_sys_activity_get_sessions_values.out.num_sessions = 7;
health_service_activities_iterate(HealthActivityRun | HealthActivityWalk |
HealthActivityOpenWorkout,
now - (100 * SECONDS_PER_MINUTE),
now, HealthIter... | (0 < prv_session_compare(
&(ActivitySession) {.start_utc = now, .length_min = 10},
&(ActivitySession) {.start_utc = now - (2 * SECONDS_PER_MINUTE), .length_min = 5},
HealthIterationDirectionFuture)) | |
.filename_part = "quads_top",
.mask = GCornersTop,
},
{
.filename_part = "quads_bottom",
.mask = GCornersBottom,
},
{
.filename_part = "quads_right",
.mask = GCornersRight,
},
{
.filename_part = "quads_left",
.... | setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 0) | ;
graphics_context_set_stroke_color(&ctx, GColorRed);
prv_draw_circles(&ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_swX_color.8bit.pbi"));
}
void test_graphics_draw_circle_8bit__zero_aa_swX_color(void) {
GContext ctx;
test_graphics_context_init(&ctx, fb);
// Draw red circles with diffe... |
rvice_start_workout(ActivitySessionType_Run));
workout_service_frontend_closed();
cl_assert_equal_b(s_hrm_subscribed, true);
cl_assert_equal_i(s_hrm_expiration, SECONDS_PER_HOUR);
}
// ---------------------------------------------------------------------------------------
// Open the app, start a workout, 30s, ... | workout_service_get_current_workout_hr_zone_time(hr_zone_time_s) | );
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 0);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone1], 10);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone2], 0);
cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 0);
prv_inc_time(10);
prv_put_bpm_event(ZONE_2_HR, HRMQuality_Good);
cl_assert(workout_service_ge... |
heap->lock_impl = lock_impl;
}
void heap_set_double_free_handler(Heap *heap, DoubleFreeHandler double_free_handler) {
heap->double_free_handler = double_free_handler;
}
void heap_set_corruption_handler(Heap *heap, CorruptionHandler corruption_handler) {
heap->corruption_handler = corruption_handler;
}
void *hea... | /* the entire heap has been allocated to one 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->Pre... |
next_block->PrevSize = heap_info_ptr->Size;
} else {
/* The next segment is free, so merge it with the */
/* current segment. */
heap_info_ptr->Size += next_block->Size;
/* Since we merged the next segment, we have to update*/
... |
/*
* 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... | (attr_list, &item_out->attr_list, action_group,
&item_out->action_group, item_out->allocated_buffer,
buf_end) | ;
if (!rv) {
timeline_item_free_allocated_buffer(item_out);
return false;
}
}
return true;
}
bool timeline_item_create_from_serial_data(TimelineItem *item,
uint8_t num_attributes, uint8_t num_actions, const uint8_t *data, size_t size,
size_t *string_alloc_size, uint8_t **string_buffer)... |
r, &layer_c);
manager.active_layer = &layer_c;
// ensure that this runs without crashing even if all the lists are empty
prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL);
// One recognizer attached to the active layer
recognizer_add_to_list(recognizers[0], &layer_c.recognizer_list);... | (&s_test_impl_data, NULL) | ;
s->state = RecognizerState_Started;
r->state = RecognizerState_Possible;
ctx.triggered = s;
cl_assert(prv_dispatch_touch_event(r, &ctx));
cl_assert(!handled);
recognizer_set_simultaneous_with(r, prv_simultaneous_with_cb);
cl_assert(prv_dispatch_touch_event(r, &ctx));
cl_assert(handled);
cl_assert_e... |
status_t rv;
if ((rv = settings_file_open(&file, SHELL_PREFS_FILE_NAME, SHELL_PREFS_FILE_LEN)) != S_SUCCESS) {
goto cleanup;
}
rv = settings_file_set(&file, key, strnlen(key, SETTINGS_KEY_MAX_LEN) + 1, val, val_len);
settings_file_close(&file);
cleanup:
return (rv == S_SUCCESS);
}
bool shell_prefs_get_c... | {
return 0;
} |
void activity_prefs_set_height_mm(uint16_t height_mm) {
}
uint16_t activity_prefs_get_height_mm(void) {
return 0;
}
void activity_prefs_set_weight_dag(uint16_t weight_dag) {
}
uint16_t activity_prefs_get_weight_dag(void) {
return 0;
}
void activity_prefs_set_gender(ActivityGender gender) {
}
ActivityGender a... |
"AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "clar.h"
#include "applib/graphics/gtypes.h"
#include "applib/graphics/graphics.h"
#include "stubs_applib_re... | graphics_context_set_fill_color(&ctx, (GColor8){.a= 2, .r = 3}) | ;
cl_assert_equal_i(GColorRedARGB8, ctx.draw_state.fill_color.argb);
graphics_context_set_fill_color(&ctx, (GColor8){.a= 1, .r = 3});
cl_assert_equal_i(GColorClearARGB8, ctx.draw_state.fill_color.argb);
graphics_context_set_fill_color(&ctx, (GColor8){.a= 0, .r = 3});
cl_assert_equal_i(GColorClearARGB8, ctx.dr... |
k_ctrl);
prv_i2c_deinit(bus);
}
bool i2c_hal_is_busy(I2CBus *bus) {
return ((bus->hal->i2c->ISR & I2C_ISR_BUSY) != 0);
}
static void prv_disable_all_interrupts(I2CBus *bus) {
bus->hal->i2c->CR1 &= ~(I2C_CR1_TXIE |
I2C_CR1_RXIE |
I2C_CR1_TCIE |
... | {
// done writing the register address for a write request - "reload" the write payload
transfer->state = I2CTransferState_WriteData;
prv_resume_transfer(bus, false /* !generate_start */);
} | |
(s_cron_test_info[i].dest_time == 0) {
break;
}
test_cron.minute = s_cron_test_info[i].minute;
test_cron.hour = s_cron_test_info[i].hour;
test_cron.mday = s_cron_test_info[i].mday;
test_cron.month = s_cron_test_info[i].month;
test_cron.wday = s_cron_test_info[i].wday;
time_t base = s_2... | CRON_JOB(CRON_MINUTE_ANY, CRON_HOUR_ANY, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_cron_callback) |
CRON_JOB(1, CRON_HOUR_ANY, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_cron_callback)
CRON_JOB(3, CRON_HOUR_ANY, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_cron_callback)
CRON_JOB(10, CRON_HOUR_ANY, 1, CRON_MONTH_ANY, prv_cron_callback)
CRON_JOB(25, CRON_HOUR_ANY, CRON_MDAY_ANY, CRON_MONTH_ANY, prv_cron_callback)
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... | prv_get_resource_for_client(client) | ;
if (id == VibeScoreId_Disabled) {
return NULL;
}
VibeScore *score = vibe_score_create_with_resource(vibe_score_info_get_resource_id(id));
if (!score) {
PBL_LOG(LOG_LEVEL_ERROR, "Got a null VibeScore resource!");
}
return score;
}
|
cteristicNum,
.handle_service_discovered = app_launch_handle_service_discovered,
.handle_service_removed = app_launch_handle_service_removed,
.invalidate_all_references = app_launch_invalidate_all_references,
.can_handle_characteristic = app_launch_can_handle_characteristic,
.handle_read_or_notifica... | {
// loop through the new services
for (int s = 0; s < added_services->num_services_added; s++) {
// get the uuid for the service
Uuid service_uuid = gatt_client_service_get_uuid(added_services->services[s]);
// are any clients looking for this uuid?
for (int c = 0; c < KernelLEClientNum; c++) {
... |
// We are trying to track down an issue on iOS where PPoGATT doesn't get opened (PBL-40084)
// This message should help us determine if iOS is publishing the service
PBL_LOG(LOG_LEVEL_INFO, "Found an instance of %s at 0x%"PRIx16"-0x%"PRIx16"!",
client->debug_name, range.start, 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... | (strtol("500hurf", NULL, 10), 500) | ;
cl_assert_equal_i(strtol("765berserker", NULL, 10), 765);
cl_assert_equal_i(strtol("573888 redmage", NULL, 10), 573888);
cl_assert_equal_i(strtol("713713 4 job fiesta111", NULL, 10), 713713);
}
void test_strtol__sign(void) {
cl_assert_equal_i(strtol("+500", NULL, 10), 500);
cl_assert_equal_i(strtol("-765",... |
ction->is_encrypted;
local_is_master = connection->local_is_master;
connected_device = &connection->device;
}
intent = prv_get_intent_by_bonding_id(request->bonding.id);
} else {
is_already_connected = gap_le_connection_is_connected(request->device);
intent = prv_get_intent_by_device(requ... | {
should_remove_and_free = true;
if (is_connected_real) {
// Disconnect the device because no one is using it
const int result = bt_driver_gap_le_disconnect(device);
if (result != 0) {
PBL_LOG(LOG_LEVEL_ERROR, "Ble disconnect failed: %d", result);
}
} else {
if (prv_is... |
if (should_send_disconnection_event) {
// Send virtual disconnection event:
const PebbleTaskBitset task_mask = ~gap_le_pebble_task_bit_for_client(c);
prv_put_connection_event(task_mask, device, hci_reason, false /* connected */, bonding_id);
}
if (should_remove_and_free) {
// Delete the intent:... |
ert(app_glance_add_slice(&bogus_session, slice) & APP_GLANCE_RESULT_INVALID_SESSION);
// Check that adding a slice with APP_GLANCE_SLICE_DEFAULT_ICON as the icon succeeds
slice = (AppGlanceSlice) {
.expiration_time = APP_GLANCE_SLICE_NO_EXPIRATION,
.layout.icon = APP_GLANCE_SLICE_DEFAULT_ICON,
.layout.... | (prv_reload_with_validation_cb, s_test_state.context) | ;
cl_assert_equal_b(s_test_state.reload_callback_was_called, true);
}
static void prv_glance_clear_test(AppGlanceReloadCallback reload_cb) {
// Insert some slices for the glance
const AppGlance glance = (AppGlance) {
.num_slices = 2,
.slices = {
{
.expiration_time = 1464734504, // (Tue, 31 ... |
ig.subtitle = alarm_day_text;
}
menu_cell_layer_draw(ctx, cell_layer, &config);
}
static void prv_alarm_list_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index,
void *callback_context) {
AlarmsAppData *data = (AlarmsAppData *)callback_context;
if (prv_is_add... | (&data->menu_layer, &data->window) | ;
layer_add_child(&data->window.layer, menu_layer_get_layer(&data->menu_layer));
status_bar_layer_init(&data->status_layer);
status_bar_layer_set_colors(&data->status_layer, PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack),
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
status_bar_layer... |
nse, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed ... | (s_times_callback_executed == i + 1) | ;
}
}
void test_evented_timer__cancel_during_freertos_timer_cb(void) {
EventedTimerID timer = evented_timer_register(100, false, stub_evented_timer_callback, 0);
// We've started the timer, but it hasn't fired yet.
TimerID sys_timer_id = timer;
cl_assert(stub_new_timer_is_scheduled(sys_timer_id));
cl_as... |
nnedFat;
case 2:
return LayoutLayerModePinnedThin;
}
}
static void prv_get_size_for(LayoutLayerMode layout_mode, const GRect *bounds, GSize *size) {
const TimelineLayerStyle *style = prv_get_style();
const int16_t width = bounds->size.w - (style->left_margin + style->right_margin);
switch (layout_mod... | {
TimelineItem *item = &state->pin;
TimelineLayoutInfo *info = app_malloc_check(sizeof(TimelineLayoutInfo));
timeline_layout_init_info(info, item, state->current_day);
info->scroll_direction = layer->scroll_direction;
info->app_id = item->header.parent_id;
GRect rect;
prv_get_frame(layer, index, &rect);
... |
static void prv_destroy_layout(TimelineLayer *layer, int index) {
TimelineLayout *timeline_layout = layer->layouts[index];
timeline_layout->is_being_destroyed = true;
layer_remove_from_parent((Layer *)timeline_layout);
layout_destroy((LayoutLayer *)timeline_layout);
layer->layouts[index] = NULL;
app_free... |
tTypeCount
} BTLETestType;
typedef enum {
BTLETestStep_None = 0,
BTLETestStep_BTStart,
BTLETestStep_BTEnd,
BTLETestStep_BTLETransmitStart,
BTLETestStep_BTLEReceiverStart,
BTLETestStep_BTLEStop,
BTLETestStepCount
} BTLETestStep;
typedef enum {
BTLEPayloadType_PRBS9 = 0,
BTLEPayloadType_11110000,
... | bt_test_stop() | ;
break;
case BTLETestStep_BTLETransmitStart:
if (data->is_unmodulated_cw_enabled) {
bt_driver_start_unmodulated_tx(data->channel);
wait_for_result = false;
} else {
bt_driver_le_transmitter_test(data->channel, data->payload_length, data->payload_type);
wait_for_re... |
mp.h"
#include "util/size.h"
#include "util/string.h"
#if !TINTIN_FORCE_FIT
//////////////////////////////////////////
// Card Mode
//////////////////////////////////////////
#define CARD_MARGIN_TOP PBL_IF_RECT_ELSE(3, 10)
static void prv_until_time_update(const LayoutLayer *layout_ref,
... | &s_subtitle_config.text.extent.node,
};
static const LayoutNodeVerticalConfig s_vertical_config = {
.container.extent.node.type = LayoutNodeType_Vertical,
.container.num_nodes = ARRAY_LENGTH(s_vertical_config_nodes),
.container.nodes = (LayoutNodeConfig **)&s_vertical_config_nodes,
.container.ex... |
//////////////////////////////////////////
// LayoutLayer API
//////////////////////////////////////////
bool alarm_layout_verify(bool existing_attributes[]) {
return (existing_attributes[AttributeIdTitle] && existing_attributes[AttributeIdSubtitle]);
}
LayoutLayer *alarm_layout_create(const LayoutLayerConfig *co... |
} else {
// No more in this file
fclose(state->common.file);
state->common.file = NULL;
}
}
}
// ---------------------------------------------------------------------------------------
// Return info on the next set of samples
static bool prv_activity_sample_discovery_next(ActivityFileTestE... | cl_assert(entry_idx < MAX_CAPTURED_SESSIONS) | ;
s_captured_activity_sessions[entry_idx] = (KAlgTestActivitySession) {
.activity = activity_type,
.len_minutes = len_sec / SECONDS_PER_MINUTE,
.start_utc = start_utc,
.ongoing = ongoing,
.steps = steps,
.active_calories = active_calories,
.resting_calories = resting_calories,
.distanc... |
yer_set_frame(&scroll_layer->content_sublayer, &internal_rect);
}
void scroll_layer_init(ScrollLayer *scroll_layer, const GRect *frame) {
*scroll_layer = (ScrollLayer){};
layer_init(&scroll_layer->layer, frame);
const GRect *bounds = &scroll_layer->layer.bounds;
scroll_layer->layer.property_changed_proc = scr... | {
// Note: animation_is_scheduled() returns false and property_animation_destroy does nothing
// if the argument is NULL
Animation *animation = property_animation_get_animation(scroll_layer->animation);
bool was_running = false;
if (animation) {
was_running = animation_is_scheduled(animation);
if (was... |
}
animation_schedule(animation);
} else {
prv_scroll_layer_set_content_offset_internal(scroll_layer, offset);
}
}
void scroll_layer_set_content_size(ScrollLayer *scroll_layer, GSize size) {
GRect bounds = scroll_layer->content_sublayer.bounds;
bounds.size = size;
layer_set_bounds(&scroll_layer->... |
ine ABSOLUTE_VALUE(x) (((x) > 0) ? (x) : -(x))
#define MIN_FRAME_INTERVAL_MS 33
#define TEST_ANIMATION_NORMALIZED_HIGH 50000
#define TEST_ANIMATION_NORMALIZED_LOW 5000
static PebbleEvent s_last_event;
bool process_manager_send_event_to_process(PebbleTask task, PebbleEvent* e) {
s_last_event = *e;
return true;... | ("timer not scheduled\n") | ;
return;
}
// Advance time
uint32_t ms_delta = stub_new_timer_timeout(sys_timer_id);
prv_advance_by_ms_no_timers(ms_delta);
// This posts a callback event to the KernelMain event queue
stub_new_timer_fire(sys_timer_id);
// Get the callback event and process it
PebbleEvent evt = fake_event_get_la... |
recognizer_get_manager(r1) | );
}
void test_recognizer_manager__handle_state_change(void) {
const int k_rec_count = 2;
s_dummy_impl.handle_touch_event = prv_handle_touch_event_test;
s_dummy_impl.reset = prv_reset_test;
Recognizer **r = prv_create_recognizers(k_rec_count);
Window window = {};
layer_init(&window.layer, &GRectZero);
L... | |
time + SECONDS_PER_HOUR + (30 * SECONDS_PER_MINUTE));
clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);
cl_assert_equal_s("2 H AGO", time_buf);
// June 9th 2015, 13:59:59 (T+01:59:59)
rtc_set_time(event_time + SECONDS_PER_HOUR + (59 * SECONDS_PER_MINUTE) + 59);
clock... | clock_get_until_time_capitalized(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS) | ;
cl_assert_equal_s("Yesterday, 12:00 PM", time_buf);
}
void test_clock__time_12h_style(void) {
char time_buf[64];
const int jun10th_noon_2015 = 1433937600;
prv_clock_reset(0);
rtc_set_time(jun10th_noon_2015);
// Our test event is at June 9th 2015, 16:00:00
// Now - one day
const int event_time = ju... |
nclude "applib/ui/time_selection_window.h"
#include "applib/ui/ui.h"
#include "kernel/pbl_malloc.h"
#include "process_management/app_manager.h"
#include "util/date.h"
#include "util/time/time.h"
#include "util/string.h"
#include "services/common/clock.h"
#include "services/common/i18n/i18n.h"
#include "services/normal... | app_window_stack_remove(data->continent_window, continent_animated) | ;
const bool region_animated = true;
app_window_stack_remove(&option_menu->window, region_animated);
}
static void prv_region_menu_push(SettingsTimeData *data) {
const char *title = prv_get_timezone_title();
const OptionMenuCallbacks callbacks = {
.select = prv_region_menu_select,
};
const int start_in... |
/*
* 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... | ams_handle_service_discovered(&s_characteristics[i][0]) | ;
}
} else {
ams_invalidate_all_references();
}
}
void test_ams__cannot_handle_any_characteristic_after_destroy(void) {
prv_discover_ams(1);
ams_destroy();
prv_assert_can_handle_characteristics(0, false /* expect_can_handle */);
}
void test_ams__cannot_handle_unknown_characteristic(void) {
prv_dis... |
ffers); ++i) {
s_receive_buffers[i] = kernel_malloc_check(sizeof(IncomingPulseFrame));
prv_return_receive_buffer(s_receive_buffers[i]);
}
s_current_receive_buffer = prv_take_receive_buffer();
s_drop_rest_of_frame = false;
s_keepalive_timer = new_timer_create();
PBL_ASSERTN(s_keepalive_timer != TIMER_... | (&s_frame_decode_ctx, c) | |
firm_cccd_write(BLEGATTErrorSuccess);
fake_event_clear_last();
gatt_client_subscriptions_handle_server_notification(s_connection, s_handle, NULL, 0);
prv_assert_notification_event(characteristic, NULL, 0, false /* kernel */, true /* app */);
// Nothing to be read after "consuming" it:
bool has_notification... | (s_connection, s_handle,
value, too_big) | ;
prv_assert_no_event();
// Receive a GATT notification that is supposed to fill up the buffer entirely:
const size_t fill_entirely_size = (GATT_CLIENT_SUBSCRIPTIONS_BUFFER_SIZE -
sizeof(GATTBufferedNotificationHeader));
gatt_client_subscriptions_handle_server_notification(... |
&& region_hdr.last_used > max_last_used) {
max_last_used = region_hdr.last_used;
last_used_idx = i;
}
}
// If simply trying to find most recently used image, return that now.
if (!new) {
if (max_last_used > 0) {
CD_ASSERTN(last_used_idx >= 0);
return core_dump_get_slot_address(las... | // properly unwind the full exception stack in a debugger with unwind
// information available. Unfortunately mainline GDB is unable to unwind
// across the MSP/PSP split stack so this incomplete hack is required to
// get useable information.
for (int i = 0; i < portCANONICAL_REG_COUNT; i... |
if (sp[7] & 0x200) {
packed_info.registers[portCANONICAL_REG_INDEX_SP] = (uint32_t)(&sp[9]);
} else {
packed_info.registers[portCANONICAL_REG_INDEX_SP] = (uint32_t)(&sp[8]);
}
} else {
// If current task called core_dump_reset directly, then jam in the
// registers we ... |
Get the rest of the wrapped read
cl_assert(circular_buffer_read(&buffer, 2, &out_buffer, &out_length));
cl_assert_equal_i(out_length, 2);
cl_assert(memcmp(out_buffer, (uint8_t*) "9a", 2) == 0);
cl_assert(circular_buffer_consume(&buffer, 2));
// Consume one without reading it
cl_assert(circular_buffer_consu... | memcpy(data_out, "7", 1) | |
ack_remove(&s_data_ptr->window, true /* animated */);
}
BTPairingUIData *data = kernel_malloc_check(sizeof(BTPairingUIData));
*data = (BTPairingUIData){};
data->ui_state = BTPairingUIStateAwaitingUserConfirmation;
s_data_ptr = data;
}
static void prv_handle_confirmation_request(const PairingUserConfirmation... | (info_len) | |
rv_window_pop();
}
static void prv_window_pop_with_delay(uint32_t delay_ms) {
s_phone_ui_data->window_pop_timer = evented_timer_register(
delay_ms, false /* repeating */, prv_window_pop_cb, NULL);
}
//! Window setup
//! Currently only 1 call window can exist at a time
static void prv_phone_ui_init(void) {
P... | PBL_IF_RECT_ELSE(GTextAlignmentCenter, GTextAlignmentRight) | |
comm_session_send_queue_get_length(session) | ;
if (read_space) {
session->transport_imp->send_next(session->transport);
}
}
void comm_session_send_next(CommSession *session) {
if (session->is_send_next_call_pending) {
return;
}
system_task_add_callback(prv_send_next_kernel_bg_cb, session);
session->is_send_next_call_pending = true;
}
bool pr... | |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ASSERT_JS_GLOBAL_EQUALS_S("platform", "basalt") | ;
}
void test_rocky_api_watchinfo__platform_unknown(void) {
s_current_app_sdk_platform = -1; // Some unknown / invalid
rocky_global_init(s_watchinfo_api);
EXECUTE_SCRIPT("var platform = _rocky.watchInfo.platform");
ASSERT_JS_GLOBAL_EQUALS_S("platform", "unknown");
}
void test_rocky_api_watchinfo__fw_version(... |
ip.${BIT_DEPTH_NAME}.pbi"));
// TODO: Remove these #ifdefs in PBL-15916 when support for non-antialiased rounded rect
#if SCREEN_COLOR_DEPTH_BITS == 8
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 9, GCornersAll);
cl_check... | graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , 1, GCornersAll) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r1_aa_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY , ORIGIN_RECT_CLIP_NXNY , true, 1);
graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY , 2, GCornersAll);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "f... |
(dstbuf, "There are 10 lights, the absolute value of 37777777774") | ;
// Minimum digits output
snprintf(dstbuf, 256, "There are %.3o lights, %.3o", 8, -4);
cl_assert_equal_s(dstbuf, "There are 010 lights, 37777777774");
// Minimum digits output (zero digits)
snprintf(dstbuf, 256, "%.0ozero%.0o", 0, 1);
cl_assert_equal_s(dstbuf, "zero1");
// Minimum digits output (unspe... | |
/*
* 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... | (scroll_layer) | ;
const GSize frame_size = scroll_layer->layer.frame.size;
GBitmap *shadow_top = shadow_get_top();
GBitmap *shadow_bottom = shadow_get_bottom();
graphics_context_set_compositing_mode(ctx, GCompOpClear);
// Draw top shadow, if (partially) visible:
const int16_t layer_w = shadow_sublayer->bounds.size.w;
c... |
RACTERISTIC],
.num_descriptors = type_counts[GATTC_ITEM_TYPE_DESCRIPTOR],
.num_att_handles_included_services = type_counts[GATTC_ITEM_TYPE_INCLUDE],
};
prv_att_uuid_to_uuid(&svc->uuid, &service->uuid);
char uuid_str[UUID_STRING_BUFFER_LENGTH];
uuid_to_string(&service->uuid, uuid_str);
PBL_LOG(LOG_LE... | {
continue;
} |
// Found the Service Changed characteristic!
att_uuid_t cccd_uuid;
ble_uuid_create16(GATT_CCCD_UUID, &cccd_uuid);
bool cccd_found = false;
// Attempt to find the CCCD:
for (uint16_t j = 0; j < evt->num_items; ++j) {
const gattc_item_t *descriptor_info = &evt->items[j];
// Sanity:... |
== BTLETestType_RX) {
if (prv_test_is_running(data) &&
index->row != RXMenuIdx_RunStop) { // Can't change params while running
return;
}
switch (index->row) {
case RXMenuIdx_Channel:
prv_txrx_number_window(39, &data->channel, "Channel", data);
break;
#if CAPABILITY_HAS_BU... | (data->main_menu_layer) | |
{ -216, 520, 440},
{ -128, 424, 264},
{ -168, 432, 248},
{ -232, 488, 288},
{ -384, 752, 472},
{ -136, 808, 776},
{ -224, 1128, 816},
{ -128, 896, 544},
{ -264, 1024, 640},
{ -264, 1008, 920},
{ -80, 1184, 696},
{ 88, 936, 512},
{ -56, 808, 480},
{ -56, 504, 264}... | { -200, 824, -88},
{ -248, 1056, -120},
{ -264, 976, -112},
{ -264, 1056, -144},
{ -312, 1056, -208},
{ -264, 928, -312},
{ -16, 728, -752},
{ -120, 568, -264},
{ -624, 1112, -560},
{ -328, 696, -400},
{ -352, 960, -560},
{ -240, 1000, -728},
// 54 seconds
{ -192,... | |
0, 1328, 216},
{ -184, 936, 208},
{ -72, 728, 144},
{ 56, 576, 88},
{ 136, 504, 120},
{ 120, 632, 96},
{ 152, 816, 168},
{ 136, 1192, 88},
{ -24, 1280, -8},
{ -232, 1192, 184},
{ -288, 1224, 8},
{ -416, 904, 216},
{ -376, 1408, 8},
{ -584, 960, 112},
{ -336, 1112,... | { 80, 608, 80},
{ 128, 688, 120},
{ 176, 792, 184},
{ 240, 1032, -184},
{ 344, 912, 296},
{ 136, 1016, 248},
{ 248, 1512, 448},
{ -104, 1720, 552},
{ 8, 1272, 552},
{ -8, 968, 440},
{ 8, 768, 256},
{ 80, 584, 160},
{ 192, 432, 160},
{ 264, 576, 200},
{ 224, 76... |
{ 56, 1072, 136},
{ 80, 1200, 64},
{ -112, 1240, 264},
// 72 seconds
{ -88, 1176, 96},
{ -32, 1064, 32},
{ -72, 1008, 128},
{ 16, 968, 80},
{ 120, 736, 24},
{ 160, 616, -32},
{ 208, 664, 16},
{ 248, 728, 48},
{ 208, 760, 24},
{ 288, 1008, 40},
{ 224, 1208, 20... |
dy to exit");
return;
}
// Save which worker we are exiting
AppInstallId closing_worker_install_id = s_worker_task_context.install_id;
// Perform generic process cleanup
process_manager_process_cleanup(PebbleTask_Worker);
// Notify the app install manager that we finally exited
app_install_notify_w... | (PebbleTask_Worker, true /*graceful*/) | ;
}
// ------------------------------------------------------------------------------------------------
DEFINE_SYSCALL(AppInstallId, sys_worker_manager_get_current_worker_id, void) {
return worker_manager_get_current_worker_id();
}
|
{ 1200, 352, -40},
{ 1024, 328, -64},
{ 1096, 280, -24},
{ 1248, 288, -112},
{ 896, 256, -144},
{ 1360, 192, -96},
{ 992, 120, 0},
{ 1032, 272, -184},
{ 1080, 272, -224},
{ 1144, 256, -136},
{ 1016, 216, -120},
{ 864, 256, -128},
{ 896, 312, -96},
{ 1088, 360, -64},... | // 56 seconds
{ -528, 224, 72},
{ -632, 200, 0},
{ -672, 136, -48},
{ -696, 704, -208},
{ -872, 368, -120},
{ -976, 336, -8},
{ -1088, 480, -152},
{ -1272, 480, -216},
{ -1184, 584, -16},
{ -952, 496, 280},
{ -664, 352, 144},
{ -688, 400, 32},
{ -672, 416, -120},
... |
{ -96, 176, -1328},
{ 96, 176, -1264},
{ 160, 136, -1104},
{ 224, 64, -912},
{ 320, 8, -784},
{ 352, 16, -576},
{ 368, 136, -328},
{ 344, 192, -80},
{ 384, 296, 104},
{ 448, 352, 336},
// 59 seconds
{ 600, 432, 552},
{ 912, 624, 728},
{ 1464, 1192, 1160},
{ 1... |
ev;
}
if (node->prev) {
node->prev->next = node->next;
}
node->prev = NULL;
node->next = NULL;
}
ListNode* list_append(ListNode* node, ListNode* new_node) {
return list_insert_after(list_get_tail(node), new_node);
}
ListNode* list_prepend(ListNode* node, ListNode* new_node) {
return list_insert_befo... | (cursor, data) | ) {
return cursor;
}
// We're back at where we started and even <node> itself doesn't match the filter
if (cursor == node) {
return NULL;
}
cursor = cursor->prev;
}
UTIL_ASSERT(0);
return NULL;
}
ListNode *list_concatenate(ListNode *restrict list_a, ListNode *restrict list_b) {
... |
essage);
}
//! Serialize a message into contents, returning the number of bytes used.
static size_t prv_serialize_log(MessageContents *contents,
uint8_t log_level, uint64_t timestamp_ms, PebbleTask task,
const char *src_filename, uint16_t src_line_number... | (&s_isr_log_buffer, &required_space, sizeof(required_space)) | ;
const BufferedLogInfo log_info = {
.timestamp_ms = prv_get_timestamp_ms(),
.log_level = log_level
};
circular_buffer_write(&s_isr_log_buffer, &log_info, sizeof(log_info));
circular_buffer_write(&s_isr_log_buffer, message, message_length);
}
if (buffer_was_empty) {
PebbleEvent e ... |
d = new_resource_id;
gbitmap_deinit(&data->checkmark_icon);
gbitmap_init_with_resource(&data->checkmark_icon, data->current_checkmark_icon_resource_id);
}
box.origin = GPoint((((cell_layer->bounds.size.w)/2)-((data->checkmark_icon.bounds.size.w)/2)),
(((cell_layer->bounds.si... | (&data->custom_day_picker_menu_layer, data, &(MenuLayerCallbacks) {
.get_num_sections = prv_custom_day_picker_get_num_sections,
.get_num_rows = prv_custom_day_picker_get_num_rows,
.get_cell_height = prv_custom_day_picker_get_cell_height,
.draw_row = prv_custom_day_picker_draw_row,
.select_click = pr... | |
stic();
e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications,
GAPLEClientKernel);
cl_assert_equal_i(e, BTErrnoOK);
fake_event_clear_last();
fake_kernel_malloc_mark();
// Un-subscribe, while subscribing process is still pending:
e = ga... | cl_assert_equal_i(e, BTErrnoOK) | ;
cl_assert_equal_i(s_last_cccd_value, BLESubscriptionIndications);
// Simulate getting confirmation from remote:
prv_confirm_cccd_write(BLEGATTErrorSuccess);
fake_event_clear_last();
// Subscribe app:
e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications,
... |
/*
* 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... | (&invalid, &invalid) | );
cl_assert(!uuid_equal(&system, &invalid));
const Uuid test_uuid_1 = (Uuid) {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5
};
// Different at the start
Uuid test_uuid_2 = test_uuid_1;
++test_uuid_2.byte0;
// Different at the end
Uuid test_uuid_3 = test_uuid_1;
++test_uuid_3.byte15;
cl_a... |
ionally relies on some state that the
// bootloader leaves behind. This includes disabling the PLL.
// GPIOs are not reset here: resetting them would change their output values,
// which could unintentionally turn of e.g. PMIC power rails.
// The backup domain is not reset; that would be foolish.
const uint32... | {
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE);
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_TWO);
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_THREE);
return true;
} |
switch (++counter) {
case 1:
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE);
break;
case 2:
boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE);
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO);
break;
case 3:
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE);
break;
case 4:
boot_bit_clear(B... |
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 permissions an... | EXECUTE_SCRIPT("_rocky.on('minutechange', function() {});") | ;
cl_assert_equal_b(false, rocky_global_has_event_handlers("secondchange"));
cl_assert_equal_b(true, rocky_global_has_event_handlers("minutechange"));
cl_assert_equal_b(true, rocky_global_has_event_handlers("hourchange"));
cl_assert_equal_b(true, rocky_global_has_event_handlers("daychange"));
cl_assert_equal_... |
te
static void prv_scale_to_timer_callback(void *data) {
PeekLayer *peek_layer = data;
peek_layer->hidden_fields_timer = EVENTED_TIMER_INVALID_ID;
peek_layer_set_fields_hidden(peek_layer, false);
}
void peek_layer_set_scale_to_image(PeekLayer *peek_layer, const TimelineResourceInfo *timeline_res,
... | {
layer_set_hidden((Layer *)&peek_layer->kino_layer, false);
peek_layer->show_dot = false;
} |
ImmutableAnimation *peek_layer_create_play_animation(PeekLayer *peek_layer) {
prv_set_visible(peek_layer);
return kino_layer_create_play_animation(&peek_layer->kino_layer);
}
ImmutableAnimation *peek_layer_create_play_section_animation(PeekLayer *peek_layer,
... |
nstall_callback_data.install_type == APP_REMOVED ||
s_install_callback_data.install_type == APP_DB_CLEARED) {
const AppInstallId to_kill = s_install_callback_data.install_id;
// Close the current app if it is the one we are trying to remove/upgrade
// OR
// If we are doing an APP_DB_CL... | if (name) {
return name;
} |
return NULL;
}
uint32_t app_install_entry_get_icon_resource_id(const AppInstallEntry *entry) {
return entry->icon_resource_id;
}
ResAppNum app_install_get_app_icon_bank(const AppInstallEntry *entry) {
if (app_install_id_from_system(entry->install_id)) {
return SYSTEM_APP;
} else {
return entry->inst... |
e service_refs[num_services];
const Service *bp_service = fake_gatt_get_blood_pressure_service();
uint8_t num_found_services = gatt_client_copy_service_refs_matching_uuid(&device, service_refs,
num_services,
... | (2, refs_out) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.