prefix stringlengths 0 918k | middle stringlengths 0 812k | suffix stringlengths 0 962k |
|---|---|---|
dialog_text_font,
probe_rect,
GTextOverflowModeWordWrap,
text_alignment,
... | (window, &(WindowHandlers) {
.load = prv_workout_dialog_load,
.unload = prv_workout_dialog_unload,
.appear = prv_workout_dialog_appear,
}) | ;
window_set_user_data(window, workout_dialog);
gbitmap_init_with_resource(&workout_dialog->confirm_icon, RESOURCE_ID_ACTION_BAR_ICON_CHECK);
gbitmap_init_with_resource(&workout_dialog->decline_icon, RESOURCE_ID_ACTION_BAR_ICON_X);
ActionBarLayer *action_bar = &workout_dialog->action_bar;
action_bar_layer_i... |
emSerial,
SystemInformationItemUptime,
SystemInformationItemLegal,
SystemInformationItem_Count,
};
typedef struct SystemCertificationData SystemCertificationData;
typedef struct SystemCertificationMenuItem {
void (*draw_cell_fn)(
GContext *ctx, const Layer *cell_layer, SystemCertificationData *cd,
... | dialog_set_icon(dialog, resource_id) | ;
i18n_free_all(confirmation_dialog);
return confirmation_dialog;
}
// Information Window
//////////////////////
static const char* s_information_titles[SystemInformationItem_Count] = {
[SystemInformationItemBtAddress] = i18n_noop("BT Address"),
[SystemInformationItemFirmware] = i18n_noop("Firmware"),
[Sy... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_LOG(LOG_LEVEL_ERROR, "Too short") | ;
return true;
}
return false;
}
//! The new implementation uses up to 72 bytes more stack space than the previous implementation.
//! Might need to do some extra work to get a "thinner" stack, if this causes issues.
//! Executes on App task.
void app_message_app_protocol_msg_callback(CommSession *session,
... |
(app_hb_node) {
AnalyticsHeartbeat *app_hb = app_hb_node->heartbeat;
#ifdef ANALYTICS_DEBUG
analytics_heartbeat_print(app_hb);
#endif
dls_log(s_app_heartbeat_session, app_hb->data, 1);
AnalyticsHeartbeatList *next = (AnalyticsHeartbeatList*)app_hb_node->node.next;
kernel_free(app_hb);
kernel_fr... | {
AnalyticsEventBlob *event_blob = (AnalyticsEventBlob *)data;
prv_handle_log_event(event_blob);
kernel_free(event_blob);
} |
void analytics_logging_log_event(AnalyticsEventBlob *event_blob) {
// Fill in the meta info
event_blob->kind = ANALYTICS_BLOB_KIND_EVENT;
event_blob->version = ANALYTICS_EVENT_BLOB_VERSION;
event_blob->timestamp = time_utc_to_local(rtc_get_time());
// TODO: We should be able to remove this once PBL-23925 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... | {
graphics_context_set_stroke_color(ctx, GColorBlack);
graphics_draw_pixel(ctx, GPoint(-5, -5));
} |
void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__origin_layer(void) {
GContext ctx;
Layer layer;
test_graphics_context_init(&ctx, fb);
layer_init(&layer, &GRect(0, 0, 10, 10));
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.des... |
_animation_by_handle(NULL, animation_h, false /*quiet*/);
if (!animation) {
return 0;
}
return animation->delay_ms;
}
// -------------------------------------------------------------------------------------------
uint32_t animation_get_abs_start_time_ms(Animation *animation_h) {
if (animation_private_usin... | prv_animation_state_get(PebbleTask_Current) | ;
if (animation_private_using_legacy_2(state)) {
if (curve != AnimationCurveCustomFunction) {
// 2.x doesn't support AnimationCurveCustomInterpolationFunction
return false;
}
// We need to enable other applib modules like scroll_layer, menu_layer, etc. which are
// compiled to use the 3.0... |
NY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "app_run_state.h"
#include "launcher_app_message.h"
#include "kernel/event_loop.h"
#include "kernel/pbl_malloc.h"
#include "process_management/app_install_manager.h... | PBL_LOG(LOG_LEVEL_ERROR, "length mismatch, expected %"PRIu32" byte(s), got %"PRIu32" bytes",
(uint32_t) sizeof(AppStateMessage), (uint32_t) length) | |
app_timer.h"
#include "stubs_freertos.h"
#include "stubs_heap.h"
#include "stubs_mutex.h"
#include "stubs_resources.h"
#include "stubs_serial.h"
#include "stubs_syscalls.h"
#include "stubs_unobstructed_area.h"
// Fakes
#include "fake_new_timer.h"
#include "fake_pebble_tasks.h"
#include "fake_pbl_malloc.h"
#include "fa... | {
uint64_t target_ms = prv_now_ms() + ms_delta;
// Comppensate for rounding errors
uint64_t new_ticks = rtc_get_ticks() + (ms_delta * RTC_TICKS_HZ + 500 ) / 1000;
uint64_t new_ms = (new_ticks * 1000 + RTC_TICKS_HZ / 2) / RTC_TICKS_HZ;
if (new_ms == target_ms - 1) {
new_ticks++;
} else if (new_ms == tar... |
// --------------------------------------------------------------------------------------
// Fire the timer used by the animation service. Before doing so, advance the time to when
// the timer would fire next.
static void prv_fire_animation_timer(void) {
TimerID sys_timer_id = animation_service_test_get_timer_id(... |
lear(&fb);
// Reset graphics context
graphics_context_init(ctx, &fb, GContextInitializationMode_System);
const uint16_t row_size_bytes = bounds.w;
ctx->dest_bitmap = (GBitmap){
.addr = malloc(row_size_bytes * bounds.h),
.bounds = (GRect){.size = bounds},
.row_size_bytes = row_size_bytes,
.info.... | malloc(strlen(dir) + 1 + strlen(PBI2PNG_EXE) + 1) | ;
sprintf(s_pbi2png_path, "%s/%s", dir, PBI2PNG_EXE);
// skip first argument (this file path)
for (int i = 1; i < argc; i++) {
// Treat all arguments as filenames and attempt to convert them as PDC into PNG
// This seems to handle invalid arguments ok (it just can't find the files to open, so it fails
... |
cus_event(false /* in_focus */);
}
static void prv_handle_modal_to_app_transition_focus(void) {
// There are no more modal windows, so we need to cleanup the modal window state.
click_manager_clear(modal_manager_get_click_manager());
prv_send_will_focus_event(true /* in_focus */);
}
void modal_manager_event_lo... | {
iter.first_focus_idx = idx;
} |
if (prv_has_opaque_window(context) && (iter.first_opaque_idx == ModalPriorityInvalid)) {
iter.first_opaque_idx = idx;
}
}
if (iter.first_visible_idx != ModalPriorityInvalid) {
for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) {
ModalContext *modal = &s_modal_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... | (fd, buf, length) | ;
}
static int pfs_domain_stat(uint8_t *resp, size_t resp_max_len, void *context) {
int fd = prv_fd_from_context(context);
PFSStatResp *stat_resp = (PFSStatResp*)resp;
*stat_resp = (PFSStatResp) {
.flags = 0,
.size = (uint32_t)pfs_get_file_size(fd)
};
return sizeof(PFSStatResp);
}
static status_t ... |
ib/graphics/gtypes.h"
#include "applib/ui/property_animation.h"
#include "applib/ui/status_bar_layer.h"
#include "applib/ui/shadows.h"
#include "applib/ui/window.h"
#include "resource/resource_ids.auto.h"
#include "services/normal/timeline/layout_layer.h"
#include "services/normal/timeline/notification_layout.h"
#inclu... | MAX(swap_layer->layer.frame.size.h, size.h) | |
PBL_LOG(LOG_LEVEL_DEBUG, "(-) %s=%p <%s>", is_app_window ? "window" : "modal window",
pop_item_window, window_get_debug_name(pop_item_window));
// Only animate if the window was previously at the top of the stack and there's a
// window we can transition to.
if (window_from && window_to) {
prv_transi... | list_remove(&next_item->list_node, &window_stack->list_head, NULL) | ;
window_stack->removed_list_head = list_insert_before(window_stack->removed_list_head,
&next_item->list_node);
window_set_on_screen(next_item->window, false /* not new */, true /* call handlers */);
} while (true);
window_stack_pop(window_stack, a... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | for (uint8_t pin_source = 2; pin_source < 16; ++pin_source) {
GPIO_PinAFConfig(GPIOE, pin_source, GPIO_AF_FMC);
} |
gpio_init.GPIO_Pin = GPIO_Pin_All & (~GPIO_Pin_0) & (~GPIO_Pin_1);
GPIO_Init(GPIOE, &gpio_init);
// We have configured the pins, lets perform a full HW reset to put the chip
// in a good state
GPIO_WriteBit(GPIOD, GPIO_Pin_2, Bit_RESET);
delay_us(10); // only needs to be 50ns according to data sheet
GPI... |
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, DISABLE) | ;
if (!boot_bit_test(BOOT_BIT_INITIALIZED)) {
RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, BOOT_BIT_INITIALIZED);
}
}
void boot_bit_set(BootBitValue bit) {
uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR);
current_value |= bit;
RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value)... | |
const char *font_key_default = FONT_KEY_GOTHIC_24_BOLD;
const char *font_key_japanese = FONT_KEY_MINCHO_20_PAIR;
#endif
const Translation english_translation = { "Pair?", font_key_default };
const Translation translations[] = {
{ "Koppeln?", font_key_default }, // German
{ "Jumeler?", font_key_defa... | (animation, animation_duration_ms) | ;
animation_set_delay(animation, animation_delay_ms);
// We only need a stop handler for one of the animations as they should finish at the same time
AnimationHandlers handlers = {
.stopped = prv_info_text_animation_stopped,
};
animation_set_handlers(animation, handlers, NULL);
}
static void prv_initial... |
CCESS) {
kernel_free(*prefs_out);
return 0;
}
return (prefs_len - sizeof(SerializedNotifPrefs));
}
static void prv_free_serialzed_prefs(SerializedNotifPrefs *prefs) {
kernel_free(prefs);
}
iOSNotifPrefs* ios_notif_pref_db_get_prefs(const uint8_t *app_id, int key_len) {
SettingsFile file;
status_t r... | attributes_actions_serialize_payload(attr_list, action_group, new_prefs->data, payload_size) | ;
// Add the new entry to the DB
rv = prv_save_serialized_prefs(&file, app_id, length, new_prefs, serialized_prefs_size);
prv_file_close_and_unlock(&file);
if (rv == S_SUCCESS) {
char buffer[length + 1];
strncpy(buffer, (const char *)app_id, length);
buffer[length] = '\0';
PBL_LOG(LOG_LEVEL_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... | (val, buffer, sizeof(buffer)) | ;
debug_print_str(buffer);
}
void debug_print_str_and_int(char *str, int value) {
debug_print_str(str);
debug_print_hex(value);
debug_print_str("\n");
}
|
}
#endif
}
void test_graphics_draw_circle_${BIT_DEPTH_NAME}__clear(void) {
GContext ctx;
Layer layer;
test_graphics_context_init(&ctx, fb);
layer_init(&layer, &GRect(0, 0, 60, 60));
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq... | (&ctx, fb) | ;
// Draw clear circles with antialiasing enabled
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 0);
graphics_context_set_stroke_color(&ctx, GColorClear);
prv_draw_circles(&ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_r0_aa_swX_clear.${BIT_DEPTH_NAME}.pbi"));
}
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... | cl_assert_near(1, 5, 10) | ;
cl_assert_near(0, 10, 10);
}
// GRect
/////////////////////////
#define EX_GRECT GRect(5, 6, 7, 8)
static GRect prv_get_grect(void) {
return EX_GRECT;
}
void test_clar__equal_grect(void) {
// test with local variable
GRect a = EX_GRECT;
GRect b = EX_GRECT;
cl_assert_equal_grect(a, b);
// test with ... |
b_bitmap(GBitmap *sub_bitmap, const GBitmap *base_bitmap, GRect sub_rect) {
if (gbitmap_get_version(base_bitmap) == GBITMAP_VERSION_0) {
GBitmapLegacy2 *legacy_bitmap = (GBitmapLegacy2 *) sub_bitmap;
*legacy_bitmap = *(GBitmapLegacy2 *) base_bitmap;
// it's the responsibility of the parent bitmap to free ... | if (bitmap && prv_is_palettized_format(format)) {
bitmap->palette = prv_allocate_palette(format);
if (bitmap->palette) {
bitmap->info.is_palette_heap_allocated = true;
} else {
gbitmap_destroy(bitmap);
bitmap = NULL;
}
} |
return bitmap;
}
GBitmap* gbitmap_create_blank(GSize size, GBitmapFormat format) {
if (process_manager_compiled_with_legacy2_sdk() && format != GBitmapFormat1Bit) {
return NULL;
}
if (!prv_platform_supports_format(size, format)) {
return NULL;
}
return prv_gbitmap_create_blank_internal_no_platf... |
/////
#include "fake_pbl_std.h"
#include "fake_spi_flash.h"
#include "fixtures/load_test_resources.h"
static bool s_clock_is_24h_style = false;
bool clock_is_24h_style(void) {
return s_clock_is_24h_style;
}
// Stubs
/////////////////////
#include "stubs_analytics.h"
#include "stubs_app.h"
#include "stubs_app_inst... | (&s_data.window, &s_ctx) | ;
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE));
#endif
}
void test_kickstart__render_hr_bpm_obstructed(void) {
#if (PLATFORM_SILK || PLATFORM_ROBERT)
prv_set_data(&s_data, 10323, 7500, 13000, 82);
prv_set_unobstructed_area_height(TIMELINE_PEEK_HEIGHT);
window_set_on_screen(&s_data.window, true,... |
def struct AppInboxNode {
ListNode node;
AppInboxServiceTag tag;
AppInboxMessageHandler message_handler;
AppInboxDroppedHandler dropped_handler;
PebbleTask event_handler_task;
//! Indicates whether there is a writer.
//! The writer can set it to anything they want, mostly for debugging purposes.
void *... | PBL_LOG(LOG_LEVEL_ERROR, "AppInbox event handlers not allowed <0x%"PRIx32", 0x%"PRIx32">",
// Ugh.. no more format signature slots free for %p %p...
(uint32_t)(uintptr_t)message_handler, (uint32_t)(uintptr_t)dropped_handler) | |
al_i(s_hrm_manager_subscribe_with_callback_call_count, 0);
ble_hrm_init(); // reinit, __cleanup() will deinit again
}
static void prv_put_and_assert_hrm_event(HRMEventType subtype, uint8_t bpm, HRMQuality quality,
bool expect_bt_driver_cb, bool expected_is_on_wrist) {
int ... | regular_timer_is_scheduled(timer) | |
nse");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WIT... | cl_assert_equal_i(sys_wakeup_query(wakeup_id), sys_get_time() + (i * WAKEUP_EVENT_WINDOW)) | |
lue) * 2;
}
}
if (is_down) {
intersections_down[intersection_down_count].x.raw_value = x.raw_value;
intersections_down[intersection_down_count].delta = delta;
intersection_down_count++;
} else {
intersections_up[intersection_up_c... | MIN(max_y, clip_max_y) | ;
// find all of the horizontal intersections and draw them
for (int16_t i = min_y; i <= max_y; ++i) {
// initialize with 0 intersections
intersection_down_count = 0;
intersection_up_count = 0;
// horizontal path segments don't have a direction and depend upon the last path segment's direction
... |
e);
cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySchedule) == true);
active = do_not_disturb_is_active();
cl_assert(active == true); // ON due to manual only
do_not_disturb_set_manually_enabled(false);
cl_assert(do_not_disturb_is_manually_enabled() == false);
active = do_not_disturb_is_active();
c... | do_not_disturb_set_schedule_enabled(WeekendSchedule, true) | |
atus,
dev->state->part->status_bit_masks.busy, false /* !set */, QSPI_NO_TIMEOUT);
qspi_release(dev->qspi);
return bytes_in_page;
}
status_t qspi_flash_get_write_status(QSPIFlash *dev) {
qspi_use(dev->qspi);
uint8_t status_reg;
prv_read_register(dev, dev->state->part->instructions.read_statu... | prv_write_enable(dev) | ;
const bool already_enabled = prv_protection_is_enabled(dev);
if (already_enabled == false) {
PBL_LOG(LOG_LEVEL_INFO, "Enabling flash protection");
// Enable write protection
prv_write_cmd_no_addr(dev, dev->state->part->instructions.write_protection_enable);
// Poll busy status until done
qspi... |
TLE_MAX_LENGTH,
message, MESSAGE_MAX_LENGTH,
action_msg, &item->attr_list.attributes[attr_idx],
AttributeIdBody);
attr_idx++;
} else if (message && message->length > 0) {
*... | (&display_name->pstr, &title->pstr) | ) {
title = NULL;
}
// Hide display name if we have custom app metadata for this app.
// If the app_metadata, not not have a name, then we have the generic app metadata.
if (app_metadata->app_id) {
display_name = NULL;
}
}
const ANCSAttribute *subtitle = notif_attributes[FetchedNot... |
d (*CallbackEventCallback)(void *data);
void launcher_task_add_callback(CallbackEventCallback callback, void *data) {
callback(data);
}
void event_put(PebbleEvent* event) {
num_events_put++;
}
// Stubs
////////////////////////////////////////////////////////////////
#include "stubs_analytics.h"
#include "stubs_h... | get_reminder_timer_id() | |
EL_OFFSET) & PACKED_LEVEL_MASK;
unsigned hash = (packed_loghash & PACKED_HASH_MASK) |
((CORE_ID_BLE & PACKED_CORE_MASK) << PACKED_CORE_OFFSET);
// Calculate the total message size. This is more complicated if there are strings
// Start with the header and the number of parameters.
unsigned n... | va_start(args, packed_loghash) | ;
int header_length = snprintf((char *)msg_buffer, msg_buffer_size, ":0> NL:%x", hash);
int length = vsnprintf((char *)msg_buffer + header_length, msg_buffer_size - header_length,
expanded_fmt_buffer, args);
length += header_length;
va_end(args);
if ((length + 2) >= msg_buffer_size) ... |
date(animation, 0); // intentionally bad value
cl_assert_equal_i(kino_reel_get_elapsed(test_reel), 300 - 20);
}
void test_kino_player__finite_animation_infinite_reel_reverse(void) {
// Choose duration and elapsed to have clean division for
// ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number
test_... | animation_is_scheduled(animation) | , false);
animation = (Animation *)kino_player_create_play_animation(test_player);
cl_assert_equal_i(animation_is_scheduled(animation), false);
animation_schedule(animation);
// Rewind unschedules the current animation
cl_assert_equal_i(animation_is_scheduled(animation), true);
kino_player_rewind(test_pla... |
.header.id));
// check second
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id));
// check third
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id));
// check fourth
cl_assert(iter_next(&iterator));
cl_ass... | (&iterator, &state, &head, TimelineIterDirectionFuture,
14700) | , 0);
#if CAPABILITY_HAS_CORE_NAVIGATION4
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[2].header.id));
cl_assert(iter_next(&iterator));
#endif
cl_assert(uuid_equal(&state.pin.header.id, &s_long_items[3].header.id));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_l... |
_subscribe(BUTTON_ID_UP, up_click_handler);
window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler);
}
static uint32_t s_seconds_count;
void handle_second_tick(struct tm *tick_time, TimeUnits units_changed) {
bool running = app_worker_is_running();
if (false) {
const char* status = "not";
if ... | (text_layer, "? ? ?") | ;
// Subscribe to mesages published by the worker
app_worker_message_subscribe(steps_event_handler);
// Subscribe to second ticks
tick_timer_service_subscribe(SECOND_UNIT, handle_second_tick);
// Launch the worker
AppWorkerResult result = app_worker_launch();
APP_LOG(APP_LOG_LEVEL_INFO, "launch result:... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | PBL_LOG(LOG_LEVEL_ERROR, "Invalid packet length") | |
) {
*entry = (AppInstallEntry) {
.install_id = id,
.type = AppInstallStorageFlash,
.visibility = process_metadata_flags_visibility(db_entry->info_flags),
// PebbleTask_App because the flag parsing function needs it, and we can assume all
// applications registered with the manager are application... | if (app_db_exists_install_id(install_id)) {
AppDBEntry *db_entry = kernel_malloc_check(sizeof(AppDBEntry));
bool rv = (app_db_get_app_entry_for_install_id(install_id, db_entry) == S_SUCCESS);
if (rv) {
rv = prv_app_install_entry_from_app_db_entry(install_id, db_entry, entry);
}
kernel_free(db_... |
PBL_LOG(LOG_LEVEL_ERROR, "Failed to get entry for id %"PRId32, install_id);
return false;
}
bool app_install_get_uuid_for_install_id(AppInstallId install_id, Uuid *uuid_out) {
PBL_ASSERTN(uuid_out);
AppInstallEntry entry;
if (app_install_get_entry_for_install_id(install_id, &entry)) {
*uuid_out = entry... |
" 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 "data_logging_test.h"
#include "system/logging.h"
#include "services/common/comm_session/session.h"
#include "servi... | (BUTTON_ID_SELECT, select_click_handler) | ;
}
static void handle_deinit(void) {
comm_session_set_responsiveness(comm_session_get_system_session(), BtConsumerApp,
ResponseTimeMax, MAX_PERIOD_RUN_FOREVER);
}
static void handle_init(void) {
dls_clear();
memset(&s_data, 0, sizeof(s_data));
// Init window
window_init(... |
ic void prv_handle_weather(PebbleEvent *unused_event, void *unused_context) {
// Unschedule any ongoing animations that would try to touch the weather data we're about to
// update
animation_unschedule_all();
size_t forecasts_count_out = 0;
WeatherDataListNode *forecasts_list_head =
weather_service_loc... | (window, data) | ;
const GRect *layout_frame = &window->layer.bounds;
WeatherAppLayout *layout = &data->layout;
weather_app_layout_init(layout, layout_frame);
window_set_user_data(window, layout);
// Fetch initial data
prv_handle_weather(NULL, NULL);
if (data->forecasts_count == 0) {
return;
}
const bool anima... |
r.buffer = NULL;
}
static bool prv_take_lock_with_short_timeout(void) {
// This code executes on BT02, so don't stall for too long. If the lock is taken, there is
// probably a Put Bytes session going on already anyway.
const TickType_t SEMAPHORE_TIMEOUT_TICKS = milliseconds_to_ticks(25);
if (xSemaphoreTake(s_... | {
PBL_LOG(LOG_LEVEL_WARNING, "NACK'ing from ..._finish");
prv_add_nack_no_token_system_callback();
prv_receiver_reset();
return;
} |
// We are still processing PB data, keep the BT connection fast
prv_set_responsiveness(ResponseTimeMin, MIN_LATENCY_MODE_TIMEOUT_PUT_BYTES_SECS);
prv_finalize_pb_job();
if (prv_receiver_contains_put_request()) {
// The PutRequest handler has no reliance on the receiver struct so mark processing as done
... |
this->state->last_configure_request_id = id;
struct LCPPacket *request = pulse_link_send_begin(this->protocol_number);
*request = (struct LCPPacket) {
.code = ControlCode_ConfigureRequest,
.identifier = id,
.length = hton16(LCP_HEADER_LEN),
};
pulse_link_send(request, LCP_HEADER_LEN);
}
static v... | prv_transition_to(this, LinkState_Stopped) | ;
break;
case LinkState_Closing:
prv_transition_to(this, LinkState_Closed);
break;
default:
break;
}
}
mutex_unlock(this->state->lock);
}
static bool prv_handle_configure_request(PPPControlProtocol *this,
struct LCPPacket *pac... |
ned it on in the first place
// STM32F4, low power debug on: we want to leave it on
#if (defined(MICRO_FAMILY_STM32F2) || defined(MICRO_FAMILY_STM32F7)) && !defined(LOW_POWER_DEBUG)
disable_mcu_debugging();
#endif
}
#ifdef TEST_SJLJ
static jmp_buf s_sjlj_jmpbuf;
static volatile int s_sjlj_num;
static void prv_sjlj... | new_timer_start(s_uptime_timer, 15 * 60 * 1000, uptime_callback, NULL, 0 /*flags*/) | ;
// Initialize button driver at the last moment to prevent "system on" button press from
// entering the kernel event queue.
debounced_button_init();
#ifdef DUMP_GPIO_CFG_STATE
// at this point everything should be configured!
dump_gpio_configuration_state();
#endif
#ifdef TEST_SJLJ
// Test setjmp/longj... |
tic int s_session_close_call_count;
static int s_session_open_call_count;
bool comm_session_is_valid(const CommSession *session) {
return list_contains((ListNode *) s_session_head, &session->node);
}
static bool prv_find_session_is_system_filter(ListNode *found_node, void *data) {
const CommSessionType requested_... | (data_out) | ;
cl_assert(list_contains((const ListNode *) s_session_head, &session->node));
return circular_buffer_copy_offset(&session->send_buffer, start_off, data_out, length);
}
void comm_session_send_queue_consume(CommSession *session, size_t length) {
circular_buffer_consume(&session->send_buffer, length);
}
static vo... |
usly active or triggered
prv_cancel_layer_tree_recognizers(manager, new_active_layer, manager->active_layer);
bool new_active_layer_is_ancestor =
layer_is_descendant(manager->active_layer, new_active_layer);
manager->active_layer = new_active_layer_is_ancestor ? new_active_layer : NULL;
... | (recognizer) | ;
if (manager->triggered) {
// Set recognizer to failed state so that it is only evaluated after all recognizers are reset
recognizer_set_failed(recognizer);
}
recognizer_set_manager(recognizer, manager);
}
void recognizer_manager_deregister_recognizer(RecognizerManager *manager, Recognizer *recognizer) ... |
hdr.version = PFS_CUR_VERSION;
SET_PAGE_FLAGS(pg_hdr.page_flags,
PAGE_FLAG_START_PAGE | PAGE_FLAG_ERASED_PAGE);
// Note: We have already allocated 1 pg so just subtract 1 to roundup
// We assume all pages are the same size
int pgs_needed = (f->file_size + FILEDATA_LEN + strlen(f->name) - 1) /
free_... | if (PFS_FD(fd).file.name != NULL) {
kernel_free(PFS_FD(fd).file.name);
PFS_FD(fd).file.name = NULL;
} |
if (PFS_FD(fd).file.pg_cache != NULL) {
kernel_free(PFS_FD(fd).file.pg_cache);
PFS_FD(fd).file.pg_cache = NULL;
PFS_FD(fd).file.pg_cache_len = 0;
}
PFS_FD(fd).fd_status = FD_STATUS_FREE;
return (S_SUCCESS);
}
typedef enum {
FDBusy = 2,
FDAlreadyLoaded = 1,
FDAvail = 0,
NoFDAvail = -1
} A... |
PmicRegisters_STATUSB = 0x03,
PmicRegisters_INTA = 0x05,
PmicRegisters_INTB = 0x06,
PmicRegisters_INT_MASK_A = 0x07,
PmicRegisters_INT_MASK_B = 0x08,
PmicRegisters_CHG_CNTL_A = 0x0A,
PmicRegisters_BUCK1_CONFIG = 0x0D,
PmicRegisters_BUCK2_CONFIG = 0x0F,
PmicRegisters_LDO1_CONFIG = 0x12,
PmicRegisters... | (rail_control_reg, register_value) | ;
if (success) {
// We disabled the rail!
*ref_count = 0;
return true;
}
return false;
} else {
(*ref_count)--;
return true;
}
}
}
bool pmic_power_off(void) {
bool ret = prv_write_register(PmicRegisters_PWR_CFG, 0xB2);
if (ret) {
// Goodbye crue... |
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to i... | ALIAS("Default_Handler") | |
e, 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 on... | (&layer, &GRect(10, 15, 20, 10)) | ;
layer_set_update_proc(&layer, &inside_layer_update_callback);
layer_render_tree(&layer, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_inside_offset_layer.${BIT_DEPTH_NAME}.pbi"));
test_graphics_context_reset(&ctx, fb);
layer_set_update_proc(&layer, &across_x_layer_update_callback);
layer_re... |
if (app_data->test_complete) {
app_window_stack_remove(&app_data->window, false /* Animated */);
} |
}
static void prv_config_provider(void *data) {
window_single_click_subscribe(BUTTON_ID_BACK, prv_button_click_handler);
window_single_click_subscribe(BUTTON_ID_UP, prv_button_click_handler);
window_single_click_subscribe(BUTTON_ID_SELECT, prv_button_click_handler);
window_single_click_subscribe(BUTTON_ID_DOW... | |
{ 0, 184, -792},
{ -136, 256, -704},
{ -800, 544, -744},
// 2 seconds
{ -768, 536, -872},
{ -808, 464, -912},
{ -848, 608, -872},
{ -696, 384, -952},
{ -776, 600, -1176},
{ -224, 472, -1184},
{ -168, 328, -1016},
{ -192, 416, -1064},
{ -40, 400, -984},
{ 72, 296, -86... | { 840, 136, -232},
{ 888, 104, -192},
{ 1024, 96, -192},
{ 1128, 88, -184},
{ 1184, 32, -264},
{ 1200, -40, -216},
{ 824, -32, -256},
{ 1048, -8, -280},
{ 824, 0, -360},
{ 776, 152, -560},
{ 1136, 64, -496},
{ 976, -48, -256},
{ 816, 104, -360},
{ 736, 248, -464},... | |
///////////////////////////////////////////////////////////
static void prv_app_smartstrap_event(PebbleEvent *e, void *context) {
SmartstrapConnectionState *state = app_state_get_smartstrap_state();
PebbleSmartstrapEvent event = e->smartstrap;
if (event.type == SmartstrapConnectionEvent) {
// Drop this event... | {
applib_free(buffer);
return NULL;
} |
SmartstrapConnectionState *state = app_state_get_smartstrap_state();
state->num_attributes++;
prv_state_init();
return (SmartstrapAttribute *)buffer;
#else
return NULL;
#endif
}
void app_smartstrap_attribute_destroy(SmartstrapAttribute *attr) {
#if USE_SMARTSTRAP
SmartstrapConnectionState *state = app_sta... |
OG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length);
return;
}
prv_send_frame(OPCODE_DISCONNECT, NULL, 0);
prv_stop(NULL);
}
static void prv_handle_reset_request(const void *payload, uint32_t length) {
if (length) {
// should be 0
PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length... | {
uint32_t end_address = request->address + request->length;
s_flash_erase_in_progress = true;
flash_erase_optimal_range(
request->address, request->address, end_address,
(end_address + SECTOR_SIZE_BYTES - 1) & SECTOR_ADDR_MASK,
prv_erase_complete, NULL);
} |
}
static void prv_handle_flash_write_request(const void *payload, uint32_t length) {
if (length < sizeof(FlashWriteRequest)) {
PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length);
return;
}
const FlashWriteRequest *request = payload;
length -= offsetof(FlashWriteRequest, data);
flash_wr... |
xt, &s_context);
prv_assert_dict_equal(failed, &s_expected_iter);
s_failure_result = reason;
// When the outbox failed callback is called, the outbox should be in the
// ACCEPTING state again.
cl_assert_equal_b(app_message_is_accepting_outbound(), true);
}
static void prv_in_received_callback(DictionaryIter... | {
return 600;
} | |
return bus->spi->DR;
#endif
}
void prv_spi_enable_peripheral_clock(const SPIBus *bus) {
periph_config_enable(bus->spi, bus->state->spi_clock_periph);
}
void prv_spi_disable_peripheral_clock(const SPIBus *bus) {
periph_config_disable(bus->spi, bus->state->spi_clock_periph);
}
static void prv_spi_clear_flags(con... | {
if (bus->state->initialized) {
return;
}
// copy the speed over to the transient state since the slave port can change it
bus->state->spi_clock_speed_hz = bus->spi_clock_speed_hz;
prv_spi_pick_peripheral(bus);
bus->state->initialized = true;
// SCLK
prv_configure_spi_sclk(&bus->spi_sclk, bus->spi_... |
static void prv_spi_slave_init(const SPISlavePort *slave) {
prv_spi_enable_peripheral_clock(slave->spi_bus);
SPIBus *bus = slave->spi_bus;
// Grab existing configuration
uint16_t tmpreg = bus->spi->CR1;
// Clear BIDIMode, BIDIOE, RxONLY, SSM, SSI, LSBFirst, BR, MSTR, CPOL and CPHA bits
tmpreg &= CR1_CLEAR... |
,
{ 56, 1280, 32},
{ 304, 1488, 248},
{ 600, 1768, 400},
{ 752, 1688, 208},
{ 816, 1592, 320},
{ 816, 1376, 336},
{ 656, 1000, 160},
{ 464, 616, 24},
{ 336, 408, 48},
{ 344, 392, 64},
{ 408, 392, 16},
{ 480, 424, -56},
{ 616, 440, -40},
{ 672, 464, -64},
{ 920... | { 432, 800, -32},
{ 488, 1128, -32},
{ 568, 1808, 64},
{ 432, 1608, -216},
{ 160, 1768, -384},
{ -88, 1400, -488},
{ -232, 1200, -432},
{ -296, 808, -248},
{ -328, 600, -240},
{ -352, 560, -160},
{ -376, 616, -64},
{ -392, 776, -88},
{ -400, 520, -72},
{ -448, 592... |
{ 400, 376, -152},
{ 424, 248, -80},
{ 536, 256, -264},
{ 624, 336, -264},
{ 864, 312, -288},
{ 568, 1376, -416},
{ 600, 2104, -768},
{ 120, 2096, -864},
{ -200, 1488, -472},
// 68 seconds
{ -176, 1088, -408},
{ -232, 752, -256},
{ -288, 536, -160},
{ -336, 408, ... |
us_layer, bg_color, GColorBlack);
}
if (active_window->layout == WorkoutLayout_StaticAndScrollable ||
(active_window->layout == WorkoutLayout_TwoStaticAndScrollable &&
layer == &active_window->middle_metric_layer)) {
prv_render_separator(ctx, layer);
}
}
static void prv_scrollable_layer_update_... | if (active_window->pause_button == BUTTON_ID_SELECT) {
prv_handle_pause_button(active_window);
} else {
prv_handle_stop_button(active_window);
} | |
D_HEIGHT),
s_phone_ui_data->caller_id_text_layer.overflow_mode,
GTextAlignmentLeft, NULL);
return (text_size.w > s_phone_ui_data->caller_id_text_layer.layer.bounds.size.w) ||
line_contains_newline;
}
//! Text setters
static void prv_set_caller_id_text(PebblePhoneCaller *caller) {
if (!caller-... | {
vibe_score_destroy(s_phone_ui_data->vibe_score);
s_phone_ui_data->vibe_score = NULL;
} |
#endif
vibes_cancel();
}
//! Call duration related functions
static void prv_show_call_status(void) {
layer_set_hidden(&s_phone_ui_data->call_status_text_layer.layer, false);
#if !PLATFORM_TINTIN
s_phone_ui_data->call_status_text_layer.layer.bounds.origin.y = DURATION_ANIMATION_START_OFFSET;
Animation *upwar... |
void clock_protocol_msg_callback(CommSession *session, const uint8_t* data, unsigned int length) {
char sub_command = *data++;
switch (sub_command) {
// Get time request:
case 0x00: {
time_t t = rtc_get_time();
// Send Get time response (0x01):
const unsigned int response_buffer_length ... | (number_buffer, number_buffer_size,
(clock_is_24h_style() ? i18n_noop("%R") : i18n_noop("%l:%M")), timestamp) | ;
const char *number_buffer_ptr = string_strip_leading_whitespace(number_buffer);
memmove(number_buffer,
number_buffer_ptr,
number_buffer_size - (number_buffer_ptr - number_buffer));
return written - (number_buffer_ptr - number_buffer);
}
size_t clock_get_time_word(char *buffer, size_t buffer... |
ble 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 and
* limitations under the License.
*/
#include "util/stringli... | cl_assert_equal_i(1, string_list_count(list)) | ;
cl_assert_equal_s("hello", string_list_get_at(list, 0));
// add a string to string list with strings
string_list_add_string(list, 20, "world", 10);
cl_assert_equal_i(11, list->serialized_byte_length);
cl_assert_equal_i(2, string_list_count(list));
cl_assert_equal_s("world", string_list_get_at(list, 1));
... |
_compute_progress_percent(PutBytesObjectType type, unsigned int type_percent) {
// Add 33(34) percent for each piece that has finished (or is unneeded)
uint8_t percent = 0;
if (s_fetch_state.app) {
percent += 30;
}
if (s_fetch_state.worker) {
percent += 10;
}
if (s_fetch_state.resources) {
per... | app_install_release_md(md) | ;
} else {
PBL_LOG(LOG_LEVEL_ERROR, "Failed to insert into app cache: %"PRId32, added);
prv_put_event_error(AppFetchResultGeneralFailure);
}
prv_cleanup(AppFetchResultSuccess);
} else if (pb_event->type == PebblePutBytesEventTypeCleanup) {
// Start the timeout watchdog again so we can tel... |
/*
* 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... | attributes_actions_deep_copy(attr_list, &item_out->attr_list, action_group,
&item_out->action_group, item_out->allocated_buffer,
buf_end) | |
ributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "apps/system_apps/health/health_data.h"
#include "apps/system_apps/health/health_data_private.h"... | (&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
void test_health_activity_summary_card__render_current_behind_typical2(void) {
HealthData health_data = {
.step_data = 320,
.step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10... |
ey, hdr->key_len, val, hdr->val_len, context)) {
settings_raw_iter_write_header(&new_file.iter, hdr);
settings_raw_iter_write_key(&new_file.iter, key);
settings_raw_iter_write_val(&new_file.iter, val);
settings_raw_iter_next(&new_file.iter);
}
kernel_free(key);
kernel_free(val);
}
... | settings_raw_iter_write_header(&file->iter, &file->iter.hdr);
} |
return S_SUCCESS;
}
static status_t bootup_check(SettingsFile* file) {
return cleanup_partial_transactions(file);
}
int settings_file_get_len(SettingsFile *file, const void *key, size_t key_len) {
settings_raw_iter_resume(&file->iter);
if (search_forward(&file->iter, key, key_len)) {
return file->iter.hd... |
, 1}, 4, &s_recognizers_handled);
prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset);
cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersTriggered);
cl_assert_equal_i(recognizers[0]->state, RecognizerState_Failed);
cl_assert_equal_i(recognizers[1]->state, RecognizerState_Started);
... | (recognizers[4]->state, RecognizerState_Failed) | ;
// Touchdown occurs, Window recognizer completes, active layer becomes non-null
e.type = TouchEvent_Touchdown;
s_next_state = RecognizerState_Completed;
s_idx_to_change = 0;
s_active_layer = &layer_a;
recognizer_manager_handle_touch_event(&e, &manager);
prv_compare_recognizers_processed((int[]) { 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... | {
periph_config_disable(RCC_APB1PeriphClockCmd, DISPLAY_SPI_CLOCK);
} |
static void prv_enable_chip_select(void) {
gpio_use(DISP_GPIO);
GPIO_WriteBit(DISP_GPIO, DISP_PIN_SCS, Bit_SET);
// required setup time > 3us
delay_us(7);
gpio_release(DISP_GPIO);
}
static void prv_disable_chip_select(void) {
gpio_use(DISP_GPIO);
// delay while last byte is emitted by the SPI periphera... |
and_init();
prv_loaded_notification_list_deinit(data->loaded_notification_list);
data->loaded_notification_list = NULL;
prv_notification_list_deinit(data->notification_list);
data->notification_list = NULL;
prv_load_notification_storage(data);
actionable_dialog_pop(data->actionable_dialog);
// Create and... | (cell_layer) | ) {
draw_func = prv_draw_pdc_bw_inverted;
}
#endif
// Inset the draw box from the left to leave some margin on the icon's left side
GRect box = cell_layer_bounds;
box.origin.x += icon_left_margin;
// Align the icon to the left of the draw box, centered vertically
GRect icon_rect = (GRect... |
--------
// Sample captured: 2015-10-05 15:44:24 local
AccelRawData *activity_sample_walk_100_pbl_25655_3(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME walk_100_pbl_25655_3
//> TEST_EXPECTED 100
//> TEST_EXPECTED_MIN 80
//> TEST_EXPECTED_MAX 120
//> TEST_WEIGH... | { 208, 1024, -200},
{ 112, 1048, -328},
// 5 seconds
{ 200, 944, -296},
{ 200, 856, -304},
{ 144, 960, -232},
{ 184, 976, -216},
{ 168, 840, -280},
{ 208, 952, -200},
{ 160, 800, -224},
{ 232, 1016, -56},
{ 176, 1056, -176},
{ 136, 960, -248},
{ 80, 800, -128},
... |
{ 176, 912, -288},
{ 168, 920, -288},
{ 168, 928, -296},
{ 200, 928, -240},
{ 184, 888, -232},
{ 168, 944, -256},
{ 152, 800, -240},
{ 160, 1000, -288},
{ 176, 952, -288},
{ 168, 880, -240},
// 8 seconds
{ 176, 920, -216},
{ 176, 872, -272},
{ 192, 912, -248},
... |
aySchedule) == true);
active = do_not_disturb_is_active();
cl_assert(active == true); // Both OFF
do_not_disturb_set_manually_enabled(false); // turned Manual OFF, scheduled should be overriden
cl_assert(do_not_disturb_is_manually_enabled() == false);
cl_assert(do_not_disturb_is_schedule_enabled(WeekdaySched... | (active == true) | |
-271, 112, -898},
{ -236, 160, -934},
{ -196, 146, -917},
{ -211, 236, -955},
{ -219, 285, -950},
{ -250, 318, -911},
{ -255, 320, -898},
{ -271, 351, -864},
{ -253, 367, -871},
{ -219, 391, -861},
{ -213, 376, -861},
{ -194, 368, -857},
{ -187, 380, -858},
{ -188, 43... | { 1042, 206, 202},
{ 1011, 165, 242},
{ 936, 143, 252},
{ 899, 173, 229},
{ 907, 178, 234},
{ 1051, 181, 268},
{ 1070, 193, 208},
{ 1200, 200, 201},
{ 1216, 253, 64},
{ 1100, 413, -183},
{ 1126, 410, -120},
{ 1010, 337, 13},
{ 827, 289, 44},
{ 816, 273, 30},
{... |
{ 864, 374, 130},
{ 864, 393, 91},
{ 761, 407, 2},
{ 815, 415, -34},
{ 1132, 447, 0},
{ 1203, 459, -18},
{ 1230, 477, -15},
{ 1310, 563, -13},
{ 1178, 476, 97},
{ 1202, 456, 96},
{ 1182, 429, 97},
{ 1068, 382, 136},
{ 912, 324, 143},
{ 842, 324, 184},
{ 856, ... |
void graphics_context_set_drawing_state(GContext* ctx, GDrawState draw_state) {
PBL_ASSERTN(ctx);
ctx->draw_state = draw_state;
}
void graphics_context_move_draw_box(GContext* ctx, GPoint offset) {
PBL_ASSERTN(ctx);
ctx->draw_state.drawing_box.origin = gpoint_add(ctx->draw_state.drawing_box.origin, offset);
... | if (result) {
prv_graphics_convert_8_bit_to_1_bit(native_framebuffer, result);
} |
}
if (!result) {
ctx->lock = false;
}
return result;
}
GBitmap* graphics_capture_frame_buffer_2bit(GContext *ctx) {
return graphics_capture_frame_buffer_format(ctx, GBitmapFormat1Bit);
}
MOCKABLE GBitmap *graphics_capture_frame_buffer(GContext *ctx) {
PBL_ASSERTN(ctx);
return graphics_capture_fra... |
(offset 730)
// Total sleep: 286 min (according to fitbit)
AlgDlsMinuteData *activity_sample_sleep_10(int *len) {
// The unit tests parse the //> TEST_.* lines below for test values
//> TEST_NAME sleep_10
//> TEST_VERSION 2
//> TEST_TOTAL 286
//> TEST_TOTAL_MIN 270
//> TEST_TOTAL_MAX 300
//> TEST_DEEP -1... | { 0, 0x64, 2424, 183},
{ 0, 0x74, 1638, 183},
{ 29, 0x74, 3174, 188},
{ 20, 0x73, 4937, 187},
{ 13, 0x65, 9044, 187},
{ 0, 0x64, 9158, 190},
{ 0, 0x44, 950, 181},
{ 33, 0x52, 3393, 172},
{ 44, 0x54, 4061, 171},
// 90: Local time: 06:09:00 PM
{ 37, 0x41, 10018, 174},
{ 19,... |
// 135: Local time: 06:54:00 PM
{ 0, 0x75, 2257, 174},
{ 0, 0x35, 2884, 188},
{ 0, 0x55, 2462, 204},
{ 8, 0x75, 1922, 181},
{ 14, 0x74, 2763, 209},
{ 0, 0x75, 500, 192},
{ 0, 0x75, 737, 204},
{ 0, 0x76, 852, 205},
{ 0, 0x75, 867, 208},
{ 0, 0x64, 2995, 209},
{ 13, 0x54, ... |
um_timeline_removes, 9);
cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time());
// Second alarm goes off. First one should be up again, but not until Monday
s_current_hour = 11;
s_current_minute = 30;
cron_service_wakeup();
cl_assert_equal_i(s_num_alarms_fired, 4);
cl_assert_equ... | cron_service_wakeup() | ;
cl_assert_equal_i(s_num_alarms_fired, 6);
}
void test_alarm__custom_alarm_weekends_and_weekday(void) {
AlarmId id1;
bool schedule_1[7] = {true, false, false, true, false, false, true};
id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 });
... |
.h"
#include "stubs_sleep.h"
#include "stubs_task_watchdog.h"
void reminders_handle_reminder_removed(const Uuid *reminder_id) {
}
static TimelineItem item1 = {
.header = {
.id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e,
0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4},
.parent_id = {0xff,... | ((uint8_t*)&item1.header.id, sizeof(Uuid)) | );
cl_assert(reminder_db_get_len((uint8_t *)&item1.header.id, sizeof(Uuid)) == 0);
// add 1 back so it's clean
cl_assert(S_SUCCESS == reminder_db_insert_item(&item1));
TimelineItem temp = {{{0}}};
cl_assert(S_SUCCESS == reminder_db_read((uint8_t*)&item1.header.id, sizeof(Uuid), (uint8_t*)&temp,
sizeof(... |
sh_read_request(const void *payload, uint32_t length) {
if (length < sizeof(FlashReadRequest)) {
PBL_LOG(LOG_LEVEL_ERROR, "Invalid length (%"PRIu32")", length);
return;
}
const FlashReadRequest *request = payload;
if (request->length > MAX_DATA_LENGTH) {
PBL_LOG(LOG_LEVEL_ERROR, "Invalid request le... | prv_handle_flash_write_request(payload, payload_length) | ;
} else if (header->opcode == OPCODE_FLASH_READ) {
prv_handle_flash_read_request(payload, payload_length);
} else if (header->opcode == OPCODE_FLASH_CRC) {
prv_handle_flash_crc_request(payload, payload_length);
} else if (header->opcode == OPCODE_FLASH_FINALIZE) {
prv_handle_flash_finalize_request(pa... |
ONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "applib/bluetooth/ble_ad_parse.h"
#include "system/hexdump.h"
#include "clar.h"
#include <btutil/bt_uuid.h>
// Stubs
//////////////////////////////... | ble_ad_includes_service(s_ad_data, &included_uuid) | );
Uuid missing_uuid = bt_uuid_expand_16bit(0xabcd);
cl_assert(!ble_ad_includes_service(s_ad_data, &missing_uuid));
}
// -----------------------------------------------------------------------------
// Creating BLEAdData:
// -----------------------------------------------------------------------------
void test_b... |
,
{ -1128, 48, 0},
{ -880, 112, -56},
{ -704, 72, -96},
{ -552, -16, -64},
{ -552, 0, -80},
{ -568, 104, -176},
{ -864, 136, -240},
{ -1392, 280, -408},
{ -1992, 608, -312},
// 47 seconds
{ -1784, 344, -48},
{ -1424, 48, 312},
{ -1128, 472, -8},
{ -1088, -8, 136},... | { -408, 680, 392},
{ -576, 536, 480},
{ -904, 488, 432},
{ -1784, 432, 1232},
{ -2008, 1856, 880},
{ -1320, 176, 1144},
{ -744, 976, 480},
{ -872, 560, 600},
{ -1032, 392, 832},
{ -880, 304, 744},
{ -680, 352, 456},
{ -648, 304, 368},
{ -760, 272, 408},
{ -832, 21... | |
_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3));
cl_assert(timeline_model_iter_next(&new_idx, &has_next));
cl_assert(has_next);
cl_assert_equal_i(new_idx, 4);
cl_assert_equal_i(timeline_model_get_num_items(), 2);
cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id,
... | (&s_items[s_correct_order[2]].header.id,
&timeline_model_get_iter_state(0)->pin.header.id) | );
cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id,
&timeline_model_get_iter_state(1)->pin.header.id));
cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id,
&timeline_model_get_iter_state(2)->pin.header.id));
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_sta... |
er_menu_layer__no_icon_app_with_glance(void) {
// Insert a glance with a slice for the app that doesn't have a default icon
const AppGlance glance = (AppGlance) {
.num_slices = 1,
.slices = {
{
.expiration_time = 1464734484, // (Tue, 31 May 2016 22:41:24 GMT)
.type = AppGlanc... | gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE) | );
}
void test_launcher_menu_layer__app_selected_and_apps_above_and_below_with_glances_pdc(void) {
s_use_pdc_icons = true;
prv_insert_glances_for_app_selected_and_apps_above_and_below_with_glances_test();
prv_render_launcher_menu_layer(LauncherMenuLayerTestApp_InteriorApp);
cl_check(gbitmap_pbi_eq(&s_ctx.dest_... |
/*
* 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_mock_type(void);
memcpy(s_stored_keys, keys_in, sizeof(SM128BitKey) * SMRootKeyTypeNum);
} |
static uint32_t s_rng_output;
#define RNG_ROUNDS (sizeof(SM128BitKey) / sizeof(uint32_t))
#define RNG_MAX_RETRIES (20)
bool rng_rand(uint32_t *rand_out) {
bool rv = cl_mock_type(bool);
if (rv) {
*rand_out = s_rng_output;
++s_rng_output;
}
return rv;
}
int rand(void) {
return cl_mock_type(int);
}
... |
&& (addr < (s_user_start + s_user_size)) &&
(end >= s_user_start) && (end < (s_user_start + s_user_size))) {
s_addr_result = UserSpaceBuffer_Valid;
} else {
s_addr_result = UserSpaceBuffer_Invalid;
}
}
// Tests
////////////////////////////////////
void test_cpu_cache__alignment(void) {
cl_will_re... | cl_will_return(dcache_is_enabled, false) | ;
cl_will_return(icache_line_size, 1);
cl_will_return(dcache_line_size, 1);
s_invalidate_addr = s_flush_addr = 0xAA55;
s_invalidate_size = s_flush_size = 0x55AA;
cl_will_return(syscall_internal_check_return_address, true);
s_user_start = 0x00;
s_user_size = 0x20;
memory_cache_flush((void*)0x20, 0x1)... |
/*
* 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... | gatt_client_subscriptions_cleanup_by_client(GAPLEClientApp) | ;
gatt_client_op_cleanup(GAPLEClientApp);
}
|
he License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "applib/app_sync/app_sync.h"
#include "syscall/syscall.h"
#include "system/pas... | dict_find(&s->current_iter, key) | ;
}
|
eak;
}
}
mutex_unlock(this->state->lock);
}
static bool prv_handle_configure_request(PPPControlProtocol *this,
struct LCPPacket *packet) {
if (ntoh16(packet->length) == LCP_HEADER_LEN) { // The request has no options
prv_send_configure_ack(this, packet);
retu... | prv_transition_to(this, LinkState_RequestSent) | |
CommandResponse = 0x01,
} CommSessionVersionCommand;
// The 1.x mobile app response
struct PACKED VersionsPhoneResponseV1 {
uint32_t pebble_library_version;
uint32_t session_capabilities_bitfield;
uint32_t platform_bitfield;
};
// The 2.x mobile apps return a longer response than the 1.x apps do.
struct PACKED ... | comm_session_set_capabilities(session, capability_flags) | |
-----------------------------------------
static void prv_debug_cmd_step_history(int index, void *context) {
HealthAPITestAppData *data = context;
prv_display_scalar_history_alert(data, "Steps", HealthMetricStepCount);
}
// -----------------------------------------------------------------------------------------
... | malloc(k_size * sizeof(HealthMinuteData)) | ;
if (!minute_data) {
snprintf(data->debug_card.dialog_text, sizeof(data->debug_card.dialog_text),
"Out of memory");
prv_display_alert(data->debug_card.dialog_text);
goto exit;
}
time_t now = time(NULL);
char time_now_text[64];
struct tm *local_tm = localtime(&now);
strftime(time_n... |
(s_app_message_pp_received_length, 0) | ;
cl_assert_equal_b(true, s_communication_timestamp_updated);
prv_destroy_inbox();
}
void test_app_message_receiver__receive_push_buffer_overflow(void) {
cl_assert_equal_b(true, app_message_receiver_open(sizeof(AppMessagePush)));
// Write an ACK, we should be able to fit one (N)ACK in addition to the Push me... | |
/*
* 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, "No phone connected or phone app does not support app-initiated "
"dictation sessions") | ;
return NULL;
}
DictationSession *session = applib_type_malloc(DictationSession);
if (!session) {
return NULL;
}
char *buffer = NULL;
if (buffer_size > 0) {
buffer = applib_malloc(buffer_size);
if (!buffer) {
applib_free(session);
return NULL;
}
}
VoiceWindow *voice_w... |
ation = 1,
.type = TimelineItemTypePin,
.flags = 0,
.layout = LayoutIdTest,
}
}
};
// Setup
/////////////////////////
void test_timeline__initialize(void) {
fake_rtc_init(0, 0);
// Note: creating a settings file is going to result in one malloc for the FD name
pin_db_init();
time_util_... | (&iterator) | );
cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id));
// check fifth
cl_assert(iter_next(&iterator));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[4].header.id));
// check sixth
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.head... |
ns(&src->attr_list, &src->action_group, item_out)) {
timeline_item_destroy(item_out);
return NULL;
}
return item_out;
}
size_t timeline_item_get_serialized_payload_size(TimelineItem *item) {
PBL_ASSERTN(item);
return attributes_actions_get_serialized_payload_size(&item->attr_list, &item->action_group)... | {
if (item->allocated_buffer != NULL) {
task_free(item->allocated_buffer);
item->allocated_buffer = NULL;
}
} | |
* SECONDS_PER_MINUTE, 10, ActivitySleepStateAwake);
prv_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 100, ActivitySleepStateAwake);
prv_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 10, ActivitySleepStateAwake);
activity_get_metric(ActivityMetricActiveSeconds, 1, &value);
cl_assert_equal_i(value, SECONDS_P... | (ActivityMetricSleepState, 1, &value) | ;
cl_assert_equal_i(value, ActivitySleepStateRestfulSleep);
prv_feed_cannned_accel_data(10 * SECONDS_PER_MINUTE, 20, ActivitySleepStateAwake);
}
// 30 minute "morning walk" 4 hours later at 2:30am
prv_feed_cannned_accel_data(30 * SECONDS_PER_MINUTE, 50, ActivitySleepStateAwake);
activity_get_metric(Ac... |
BarLayer *action_bar = &data->action_bar;
data->action_bar_state = ActionBarStateSkip;
action_bar_layer_init(action_bar);
action_bar_layer_set_context(action_bar, data);
action_bar_layer_add_to_window(action_bar, window);
StatusBarLayer *status_layer = &data->status_layer;
status_bar_layer_init(status_laye... | music_get_playback_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... | {
s_num_rows = 10;
} |
void test_menu_layer__cleanup(void) {
}
static void prv_draw_row(GContext* ctx,
const Layer *cell_layer,
MenuIndex *cell_index,
void *callback_context) {}
static uint16_t prv_get_num_rows(struct MenuLayer *menu_layer,
... |
...)
#endif
// Use our own macro instead of the abs function to avoid issues with non-int values.
#define 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 proc... | {
DPRINTF("timer not scheduled\n");
return;
} |
if (!stub_new_timer_is_scheduled(sys_timer_id)) {
DPRINTF("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_tim... |
capture framebuffer
return;
}
graphics_private_draw_horizontal_line_prepared(ctx, framebuffer, &ctx->draw_state.clip_box, y,
x1, x2, ctx->draw_state.stroke_color);
graphics_release_frame_buffer(ctx, framebuffer);
return;
}
#endif // PBL_COLOR... | if (opacity > (MAX_PLOT_BRIGHTNESS / 2)) {
// We're not plotting anything, bail
return;
} |
#endif // PBL_COLOR
ctx->draw_state.draw_implementation->blend_horizontal_line(ctx, y, x_min, x_max, color);
}
void graphics_private_plot_vertical_line_prepared(GContext *ctx, GBitmap *framebuffer,
GRect *clip_box, int x, int y0, int y1,
... |
r_cb, client, 0);
}
// We will defer sending the Ack for now, fallthrough and send data instead
}
// Data packets:
if (client->state != StateConnectedOpen) {
return NULL;
};
if (prv_num_packets_in_flight(client) >= client->out.tx_window_size) {
// Max number of data packets in flight, try aga... | prv_finalize_queued_packet(client, payload_size) | ;
}
const uint8_t max_loop_count = 10;
if (loop_count > max_loop_count) {
// If more bytes left to send (but loop_count became >= 10),
// schedule a callback to process them later to avoid blocking the task for too long:
prv_send_next_packets_async(client);
break;
}
}
kerne... |
bool quiet) {
if (!handle) {
return NULL;
}
// Default to state for the current task
if (!state) {
state = prv_animation_state_get(PebbleTask_Current);
}
// Look for this animation by id. It could either be in the unscheduled or scheduled list
ListN... | if (include_delay) {
duration += animation->delay_ms;
} |
if (animation->type == AnimationTypeSequence) {
// For a sequence animation, add duration of each of the components
for (child_idx = 0; child_idx < ANIMATION_MAX_CHILDREN; child_idx++) {
AnimationPrivate *child = prv_find_animation_by_parent_child_idx(state, animation, child_idx);
if (!child) {
... |
);
PBL_ASSERTN(success);
scheduled = new_timer_scheduled(s_app_data->timer[timer_idx_0], &expire_ms);
PBL_ASSERTN(scheduled && expire_ms <= 500);
PBL_LOG(LOG_LEVEL_DEBUG, "STT firing in %d ms", (int)expire_ms);
}
// =================================================================================
void two_t... | (s_app_data->timer[0], 100, stuck_timer_callback, cb_data, zero_flags) | ;
PBL_ASSERTN(success);
}
// =================================================================================
void invaid_timer_id_menu_cb(int index, void *ctx) {
void *cb_data = 0;
uint32_t zero_flags = 0;
menu_callback_prefix(index, ctx);
// invalid timer id
new_timer_start(0x12345678, 100, timer_call... |
s_pbi2png_path;
// Stubs
void passert_failed(const char* filename, int line_number, const char* message, ...) {
exit(EXIT_FAILURE);
}
void passert_failed_no_message(const char* filename, int line_number) {
exit(EXIT_FAILURE);
}
void wtf(void) {
exit(EXIT_FAILURE);
}
bool process_manager_compiled_with_legacy2_... | {
printf("File not found: %s\n", filename);
return;
} | |
n_rmax1_sw1_no_clip.${BIT_DEPTH_NAME}.pbi"));
// Should not draw anything
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1);
graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_re... | cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw2_no_clip.${BIT_DEPTH_NAME}.pbi")) | ;
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 2);
graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi"));
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_... |
r the License.
*/
#include "contacts_db.h"
#include "kernel/pbl_malloc.h"
#include "services/normal/filesystem/pfs.h"
#include "services/normal/settings/settings_file.h"
#include "services/normal/contacts/attributes_address.h"
#include "services/normal/contacts/contacts.h"
#include "os/mutex.h"
#include "system/pass... | {
if (key_len != UUID_SIZE) {
return E_INVALID_ARGUMENT;
}
status_t rv = prv_lock_mutex_and_open_file();
if (rv != S_SUCCESS) {
return rv;
}
rv = settings_file_delete(&s_contacts_db.settings_file, key, key_len);
prv_close_file_and_unlock_mutex();
return rv;
} |
status_t contacts_db_flush(void) {
mutex_lock(s_contacts_db.mutex);
status_t rv = pfs_remove(SETTINGS_FILE_NAME);
mutex_unlock(s_contacts_db.mutex);
return rv;
}
|
/*
* 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... | uart_init_rx_only(BT_RX_BOOTROM_UART) | ;
uart_init_tx_only(BT_TX_BOOTROM_UART);
uart_set_baud_rate(BT_RX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE);
uart_set_baud_rate(BT_TX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE);
} else {
uart_init(BT_RX_BOOTROM_UART);
uart_set_baud_rate(BT_RX_BOOTROM_UART, DIALOG_BOOTROM_UART_BAUDRATE);
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.