prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
S_DEVICE_METRIC_APP_CRASHED_COUNT, AnalyticsClient_System); } if (task == PebbleTask_App) { analytics_stopwatch_stop(ANALYTICS_APP_METRIC_FRONT_MOST_TIME); } analytics_external_collect_app_cpu_stats(); analytics_external_collect_app_flash_read_stats(); } // ----------------------------------------------...
{ PBL_LOG(LOG_LEVEL_DEBUG, "Check if we can force stop the %s task", pebble_task_get_name(task)); if (prv_force_stop_task_if_unprivileged(context)) { PBL_LOG(LOG_LEVEL_DEBUG, "Got it"); prv_handle_app_stop_analytics(context, task, gracefully); return true; } // Non-graceful close ...
return false; } // ----------------------------------------------------------------------------------------------------------- // This is designed to be called from the task itself, in privilege mode, after it exits. It is called from // app_task_exit for app tasks and worker_task_exit from worker tasks NORETURN 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...
{ // zone c - d return GPoint(frame.origin.x + DIV_X(frame.size.w * (1000 - MULT_X((cur - limit_c), (limit_d - limit_c)))), frame.origin.y + frame.size.h); }
else if (cur <= limit_e) { // zone d - e return GPoint(frame.origin.x, frame.origin.y + DIV_X(frame.size.h * (1000 - MULT_X((cur - limit_d), (limit_e - limit_d))))); } else { // zone e - 0 return GPoint(frame.origin.x + DIV_X(frame.size.w ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (fd < 0) { return fd; }
*resp = (void*)(uintptr_t)fd; return S_SUCCESS; } static status_t pfs_domain_close(void *context) { int fd = prv_fd_from_context(context); return pfs_close(fd); } #if !RECOVERY_FW PulseBulkIODomainHandler pulse_bulkio_domain_pfs = { .id = PulseBulkIODomainType_PFS, .open_proc = pfs_domain_open, .read_...
/* * 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...
{ PLogPackedVarintsEncoderArg *encoder_arg = *(PLogPackedVarintsEncoderArg **)arg; // We need to figure out the size of the packed array of varints first pb_ostream_t substream = PB_OSTREAM_SIZING; for (unsigned i = 0; i < encoder_arg->num_values; i++) { if (!pb_encode_varint(&substream, encoder_arg->value...
bool protobuf_log_util_encode_measurement_types(pb_ostream_t *stream, const pb_field_t *field, void * const *arg) { PLogTypesEncoderArg *encoder_arg = *(PLogTypesEncoderArg **)arg; for (unsigned i = 0; i < encoder_arg->num_types; i++) { if (!pb_encode_tag_for_fie...
en the event is over return item->header.timestamp + MAX(10, item->header.duration) * SECONDS_PER_MINUTE; } static void prv_clear_if_stale_reminder(Uuid *id, NotificationType type, void *cb_data) { NotificationWindowData *window_data = cb_data; if (type != NotificationReminder) { return; } TimelineItem...
("Snoozed", dialog)
; dialog_set_text(dialog, msg); dialog_set_icon(dialog, RESOURCE_ID_REMINDER_SNOOZE); i18n_free(msg, dialog); dialog_set_text_color(dialog, GColorWhite); dialog_set_fullscreen(dialog, true); dialog_set_background_color(dialog, GColorBlueMoon); dialog_set_timeout(dialog, 1700); simple_dialog_push(simple_...
&bpm, &hr_zone)); cl_assert_equal_i(steps, 10); // Increment a lot so we can make sure that the wrap around of midnight works. prv_inc_steps_and_put_event(1000); cl_assert(workout_service_get_current_workout_info(&steps, &duration_s, &distance_m, &bpm, &hr...
(s_hrm_subscribed, true)
; cl_assert_equal_i(s_hrm_expiration, 8 * SECONDS_PER_MINUTE); } // --------------------------------------------------------------------------------------- // Open the app, start a workout, 120s, stop the workout, 20 min, close app. // Make sure the HR turns off right after we leave the app. void test_workout_servic...
/* * 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...
{ LauncherAppGlanceAlarms *alarms_glance = launcher_app_glance_structured_get_data(structured_glance); return NULL_SAFE_FIELD_ACCESS(alarms_glance, title, NULL); }
static void prv_alarms_glance_subtitle_dynamic_text_node_update( UNUSED GContext *ctx, UNUSED GTextNode *node, UNUSED const GRect *box, UNUSED const GTextNodeDrawConfig *config, UNUSED bool render, char *buffer, size_t buffer_size, void *user_data) { LauncherAppGlanceStructured *structured_glance = user...
//////////////////////////////////////////////// // App Message Handling //////////////////////////////////////////////////////////////////////////////// static const struct { AppMessageInboxReceived inbox_received; } s_app_message_handlers[] = { [PostMessageStateDisconnected] = { .inbox_received = NULL, }, ...
rocky_global_call_event_handlers(event)
; } //////////////////////////////////////////////////////////////////////////////// // API: postMessage() //////////////////////////////////////////////////////////////////////////////// static void prv_start_session_closed_object_queue_timer(void); static void prv_stop_session_closed_object_queue_timer(void) { 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...
(process_name, sizeof(process_name), id, PebbleTask_Worker)
; pfs_remove(process_name); // remove app too app_storage_get_file_name(process_name, sizeof(process_name), id, PebbleTask_App); pfs_remove(process_name); // remove resources resource_storage_clear(id); } bool app_storage_app_exists(AppInstallId id) { PBL_ASSERTN(id > 0); char process_name[APP_FILENAME...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(third, f(third, 0, ANIMATION_NORMALIZED_MAX))
; cl_assert_equal_i(two_third, f(two_third, 0, ANIMATION_NORMALIZED_MAX)); cl_assert_equal_i(four_third, f(four_third, 0, ANIMATION_NORMALIZED_MAX)); cl_assert_equal_i(-65535, f(-half, 0, half)); cl_assert_equal_i(0, f(0, 0, half)); cl_assert_equal_i(43690, f(third, 0, half)); cl_assert_equal_i(8738...
list is valid const bool success = prv_is_slice_attribute_list_valid(serialized_slice->type, &attr_list); if (!success) { goto cleanup; } AppGlance *glance_out = deserialization_context->glance_out; // Copy the common serialized slice fields to the output glance's slice const unsigned int current_sli...
(LOG_LEVEL_WARNING, "Tried to serialize a glance containing a slice with invalid type: %d", current_slice->type)
; rv = E_INVALID_ARGUMENT; goto cleanup; } serialized_glance_size += sizeof(SerializedAppGlanceSliceHeader); AttributeList *attr_list = &current_attr_list_data->attr_list; // Initialize the attributes common to all slice types in the attribute list attribute_list_add_uint32(attr_list, ...
pProfileGetInfoFunc s_profile_info_functions[] = { #define REGISTER_SMARTSTRAP_PROFILE(f) f, #include "services/normal/accessory/smartstrap_profile_registry.def" #undef REGISTER_SMARTSTRAP_PROFILE }; // every profile except for SmartstrapProfileInvalid should be registered _Static_assert(NUM_PROFILES() == (NumSmartstra...
{ PBL_LOG(LOG_LEVEL_WARNING, "Dropped notification due to not being connected."); return; }
0, 60); GRect from_rect_b = GRect(84, 0, 60, 60); GRect to_rect_b = GRect(0, 92, 60, 60); GRect tmp; if (toggle) { tmp = to_rect_b; to_rect_b = from_rect_b; from_rect_b = tmp; } toggle = !toggle; animation_destroy(s_animation); s_animation = NULL; PropertyAnimation *a = property_animat...
((Animation*)a_rev, DURATION)
; animation_set_reverse((Animation*) a_rev, true); Animation *seq = animation_sequence_create((Animation *)a, (Animation *)a_rev, NULL); // Animate text layer b from top-right to bottom-left PropertyAnimation *c = property_animation_create_layer_frame( text_layer_get_layer(s_text_l...
flags are set, and to stop all apps whose flags are unset. Depending //! on the firmware loaded onto the HRM, multiple apps can be run //! concurrently by setting the logical OR of the App IDs. static bool prv_set_running_apps(HRMDevice *dev, AS7000AppId apps) { return prv_write_register(dev, ADDR_APP_IDS, apps); } ...
prv_enable(dev)
; } exit: mutex_unlock(dev->state->lock); } // This regular timer callback executes once a second. It is part of the watchdog logic used to // detect if the sensor becomes unresponsive. static void prv_watchdog_timer_cb(void *data) { HRMDevice *dev = (HRMDevice *)data; if (++s_missing_interrupt_count >= AS7000...
{ -88, -248, -952}, { -88, -232, -952}, { -96, -208, -936}, { -88, -200, -944}, { -80, -192, -952}, { -88, -192, -968}, { -128, -200, -952}, { -112, -232, -936}, { -136, -168, -952}, { -136, 0, -968}, // 62 seconds { -72, 248, -880}, { -32, 552, -776}, { 56, 888, ...
{ 352, 808, -48}, { 344, 824, -56}, { 368, 808, -48}, { 344, 784, -104}, { 352, 792, -16}, { 360, 768, -24}, { 352, 808, -40}, { 368, 880, -80}, { 368, 800, -96}, { 360, 832, -32}, { 360, 840, -72}, { 368, 784, -16}, { 352, 808, -48}, { 352, 776, -56}, { 368,...
("Simple Vibe Dialog")
; Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dialog_set_text(dialog, "A Simple Dialog For Flow Testing!\nHello!"); dialog_set_background_color(dialog, GColorLavenderIndigo); dialog_set_icon(dialog, data->resource_id_80); dialog_set_vibe(dialog, true); dialog_show_status_bar_layer(dialog, true...
int counter; uint32_t crc; DataLoggingSessionRef logging_session; uint8_t item_size; }; static struct { Window window; struct DataLoggingInfo info[3]; TextLayer log_layer; } s_data; static const int s_chunk_size = 80; static void log_moar_data(struct DataLoggingInfo *info) { uint8_t buf[s_chunk_size]...
{ static const PebbleProcessMdSystem s_app_info = { // UUID: 01020304-0506-0708-0910-111213141516 .common.uuid = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16}, .common.main_func = &s_main, .name = "Data Logging Test" }; return (const PebbleProcessMd*) &s_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...
if (player->callbacks.frame_did_change && frame_changed) { player->callbacks.frame_did_change(player, player->context); }
} static void prv_announce_did_stop(KinoPlayer *player, bool finished) { if (player->callbacks.did_stop) { player->callbacks.did_stop(player, finished, player->context); } } /////////////////////////////// // Play Animation /////////////////////////////// T_STATIC void prv_play_animation_update(Animation *a...
s work-around is causing more trouble than the problem it was solving... if (timestamp < (now - MAXIMUM_NOTIFY_TIME) && timestamp != INVALID_TIME) { PBL_LOG(LOG_LEVEL_INFO, "Not presenting stale notif (ts=%ld)", timestamp); return true; } return false; } static bool prv_should_ignore_because_muted(const...
{ goto cleanup; }
// If this is an incoming call, let the phone service handle it // It would be nice to handle facetime calls with the phone service but it doesn't look like we // can: https://pebbletechnology.atlassian.net/browse/PBL-16955 const bool is_notification_from_phone_app = ancs_notifications_util_is_phone(app_id); ...
iteBit(GPIOD, GPIO_Pin_2, Bit_SET); // Configure pins relating to the FMC peripheral (30 pins!) // B7 - FMC AVD - FMC Address Valid aka Latch // D0-D1, D8-D15, E2-15 - FMC A, AD - FMC Address and Address/Data lines // D2 - Reset - GPIO Reset line // D3 - FMC CLK // D4 - FMC OE - FMC Output Enable // D5 ...
(sector_addr, S29VSCommandEraseAguments_SectorErase)
; prv_allow_write_if_sector_is_not_protected(true, sector_addr); // Check the status register to make sure that the erase has started. const uint8_t sr = prv_read_status_register(sector_addr); if ((sr & S29VSStatusBit_DeviceReady) == 0) { // Program or erase operation in progress. Is it in the current bank...
/* * 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...
(number_buffer, number_buffer_size, (clock_is_24h_style() ? i18n_noop("%R") : i18n_noop("%l:%M")), timestamp)
t); // Draw the two variations of the test image at GPointZero prv_composite_test_draw_bitmap(&s_ctx, bitmap, GPointZero, compositing_mode); // Then redraw the two variations offset so the bottom right edge of the right variation // is aligned with the bottom right edge of the framebuffer const GP...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_graphics_draw_bitmap__offset_bitmap_layer_across_x(void) { prv_offset_bitmap_layer_test(GPoint(25, 0)); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_graphics_draw_bitmap__offset_bitmap_layer_across_nx(void) { prv_offset_bitmap_layer_test(GPoint(-25, 0)); cl_check(gbi...
s_invalid_section ? 1 : menu_index_compare(&index, &menu_layer->selection.index); MenuSelectIndexIterator it = { .it = { .menu_layer = menu_layer, .row_callback_after_geometry = prv_menu_layer_iterator_selection_index_callback, .section_callback = prv_menu_layer_iterator_n...
{ menu_layer->normal_colors[MenuLayerColorBackground] = background; menu_layer->normal_colors[MenuLayerColorForeground] = foreground; }
void menu_layer_set_highlight_colors(MenuLayer *menu_layer, GColor background, GColor foreground) { menu_layer->highlight_colors[MenuLayerColorBackground] = background; menu_layer->highlight_colors[MenuLayerColorForeground] = foreground; } bool menu_layer_get_center_focused(MenuLayer *menu_layer) { return menu...
/* * 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...
MAX(x0, x1)
, framebuffer->bounds.origin.x + framebuffer->bounds.size.w); for (int i=x_min; i < x_max; i++) { #if SCREEN_COLOR_DEPTH_BITS == 8 GColor *output = (GColor*)framebuffer->addr + y * framebuffer->row_size_bytes + i; // src_col, dest_col output->argb = gcolor_alpha_blend(...
long the container's axis after drawing each child. GRect box; //! GRect of the clip box saved before apply a text node's draw box as its clip box. Only used //! if the text node specifically requested clipping. GRect cached_clip_box; //! GSize representing the size of the container. Used by containers only. ...
prv_create_container(GTextNodeType_Horizontal, sizeof(GTextNodeHorizontal), max_nodes)
; } GTextNodeVertical *graphics_text_node_create_vertical(size_t max_nodes) { return (GTextNodeVertical *)prv_create_container(GTextNodeType_Vertical, sizeof(GTextNodeVertical), max_nodes); } GTextNodeCustom *graphics_text_node_create_custom(GTextNodeDrawCallback c...
{ 1312, 304, 16}, { 1864, 352, 120}, { 1448, 360, 168}, { 792, 296, 80}, { 1096, 224, 216}, { 1168, 32, 312}, { 952, 64, 272}, { 808, 72, 240}, { 728, 64, 200}, { 720, 64, 136}, { 776, 32, 104}, // 28 seconds { 808, -16, 120}, { 920, -88, 104}, { 1136, -40, 40...
{ 1440, 224, -176}, { 1480, 344, -112}, { 1056, 280, 88}, { 856, 1136, -336}, { 808, 136, 56}, { 768, 152, 184}, { 848, 232, 128}, { 728, 200, 120}, { 856, 336, -72}, { 952, 336, -32}, { 1216, 360, -80}, { 1392, 304, 8}, { 1944, 360, 56}, { 1240, 392, 56}, { ...
_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(5, 15)); } void outside_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_pixel(ctx, GPoint(5, -5)); } void outside_x...
layer_set_update_proc(&layer, &outside_nx_y_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_nx_y_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_x_ny_layer_update_callback); l...
void test_graphics_draw_pixel_${BIT_DEPTH_NAME}__clear(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.dest_bitma...
lly only used from within the gatt_service_changed module extern void gatt_client_discovery_discover_range( GAPLEConnection *connection, ATTHandleRange *hdl_range); void command_bt_disc_start(char *start_handle, char *end_handle) { bt_lock(); { ATTHandleRange range = { .start = atoi(start_handle), ...
{ log_level = 0; }
else if (log_level > 255) { log_level = 255; } hc_endpoint_logging_set_level(log_level); prompt_send_response_fmt(buffer, 32, "Ble Log level set to: %i", log_level); } extern bool hc_endpoint_logging_get_level(uint8_t *level); void command_ble_logging_get_level(void) { uint8_t log_level; char buffer[32]...
ure_service(TEST_GATT_CONNECTION_ID); // ... then a failure: fake_gatt_put_discovery_complete_event(GATT_SERVICE_DISCOVERY_STATUS_RESPONSE_TIMEOUT, TEST_GATT_CONNECTION_ID); // Expect event with error status and 0 services: prv_assert_event(&device, BT...
fake_gatt_set_start_return_value(BTGATT_ERROR_INVALID_PARAMETER)
; // Fire the watchdog timer: const TimerID watchdog_timer = bt_driver_gatt_get_watchdog_timer_id(); stub_new_timer_fire(watchdog_timer); // Stopping did not fail, but restarting did. In this case we need to generate an event that // the discovery process failed. The error from GATT_Start_Service_Discovery ...
; prv_compare_recognizers_processed((int[]) {4, 0, 3, 1}, 4, &s_recognizers_handled); cl_assert_equal_p(manager.active_layer, &layer_c); cl_assert_equal_i(manager.state, RecognizerManagerState_RecognizersActive); cl_assert_equal_i(recognizers[0]->state, RecognizerState_Possible); cl_assert_equal_i(recognizers...
(&e, &manager)
; prv_compare_recognizers_processed(NULL, 0, &s_recognizers_handled); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_reset); cl_assert_equal_i(manager.state, RecognizerManagerState_WaitForTouchdown); // Layer A's recognizer's gesture completes immediately. All recognizers receive the touch event /...
/* * 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_p(memchr(testbuf, 0x9A, 4), NULL)
; } void test_memchr__big_value(void) { uint8_t testbuf[8] = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0x78, 0xDE, 0xF0, }; cl_assert_equal_p(memchr(testbuf, 0xF78, 8), testbuf+3); }
prefix indicates that it is in SettingsFile format. int pid = persist_map_auto_id(uuid); if (FAILED(pid)) { // Attempting to debug persist map failure PBL_LOG(LOG_LEVEL_WARNING, "Failed to get pid! %d", pid); persist_map_dump(); return pid; } return snprintf(name, buf_len, "ps%06d", pid); } st...
{ if (store->file_open) { settings_file_close(&store->file); } list_remove(&store->list_node, &s_client_stores /* &head */, NULL /* &tail */); kernel_free(store); }
} prv_unlock(); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, cell_layer, title, "of beer on the wall", (GBitmap*)&s_music_launcher_icon_bitmap)
tmbuf, sizeof(tmbuf), "%V", &wrk); cl_assert_equal_s(tmbuf, s_iso8601_data[i].str_V); printf("%s, ", tmbuf); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%g", &wrk); cl_assert_equal_s(tmbuf, s_iso8601_data[i].str_g); printf("%s\n", tmbuf); } } #endif #if EXTENSION_SU void test_strftime__f...
(tmbuf, "00")
; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%U", &jan_1_2016__13_00_00); cl_assert_equal_s(tmbuf, "00"); } // Test the zero flag void test_strftime__zeroflag(void) { char tmbuf[512]; struct tm jan_2_10015__13_00_00 = { .tm_hour = 13, .tm_min = 0, .tm_sec = 0, // 13:00:00 .tm_year = 10015 - 1...
, -376}, { 1448, 568, -392}, { 1504, 752, -368}, { 1352, 728, -392}, { 968, 920, -496}, { 840, 984, -520}, { 1184, 1248, -392}, { 1144, 816, -320}, // 31 seconds { 1056, 752, -360}, { 1200, 568, -304}, { 1352, 432, -272}, { 1336, 448, -208}, { 1344, -56, -120}, { ...
{ 1120, 232, -152}, { 1224, 288, -144}, { 1424, 232, -200}, { 1520, 144, -104}, { 1184, 48, -144}, { 976, -352, -144}, { 712, -512, 72}, { 760, -120, -112}, { 1216, -304, -368}, { 1424, 408, -272}, { 1312, 128, -200}, { 1240, 192, -192}, { 1304, 464, -280}, { 1560...
{ 1048, 832, -328}, { 800, 1016, -336}, { 976, 1136, -128}, { 1128, 808, -216}, { 1112, 744, -192}, { 1232, 648, -136}, { 1384, 536, -128}, { 1208, 312, -120}, // 39 seconds { 1152, 56, -184}, { 1104, 280, -48}, { 1296, 320, -144}, { 1360, 192, -152}, { 1336, 168...
ic void prv_volume_long_click_end_handler(ClickRecognizerRef recognizer, void *context) { MusicAppData *data = context; prv_set_action_bar_state(data, ActionBarStateSkip); app_timer_cancel(data->volume_repeat_timer); data->volume_repeat_timer = NULL; } static void prv_play_pause_long_click_start_handler(ClickR...
GRect(0, config->no_music_text_field.origin_y, DISP_COLS, config->no_music_text_field.size_h)
; text_layer_init_with_parameters(&window->text_layer, &NO_MUSIC_TEXT_RECT, i18n_get("START PLAYBACK\nON YOUR PHONE", window), fonts_get_system_font(config->no_music_font_key), GCol...
RTISING_DURATION_LOOP_AROUND); if (is_loop_around) { if (i == 0) { // First term cannot be loop-around return NULL; } continue; } // Silent term: const bool is_silent = (terms[i].min_interval_slots == GAPLE_ADVERTISING_SILENCE_INTERVAL_SLOTS && ter...
if (curr_node == first_node) { break; // we have cycled through all the jobs }
curr_node = prev_node; } bt_unlock(); } // ----------------------------------------------------------------------------- int8_t gap_le_advert_get_tx_power(void) { int8_t tx_power; bt_lock(); { // In case this API call fails, (e.g. Airplane Mode), // the s_tx_power_cached is untouched: if (...
eck(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); #endif } // Draws circles in a grid pattern while increasing the stroke width for each circle static void prv_draw_circles(GContext *ctx) { GPoint pt = CENTER_OF_ORIGIN_RECT; for (int sw = 0; sw <= 10; sw++) { ctx->draw_state.s...
graphics_draw_arc_internal(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG, angle_start, angle_end)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_arc_origin_aa_stroke_bigger_than_radius.${BIT_DEPTH_NAME}.pbi")); // Negative angle letter C angle_end -= TRIG_MAX_ANGLE; angle_start -= TRIG_MAX_ANGLE; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 4); graphics_draw_arc_interna...
mutex_lock(s_list_mutex); while (s_scheduled_jobs != NULL && ((CronJob*)s_scheduled_jobs)->cached_execute_time <= rtc_get_time()) { CronJob *job = (CronJob*)s_scheduled_jobs; // Remove the job from the list, it's done. s_scheduled_jobs = list_pop_head(s_scheduled_jobs); // Release the mut...
prv_is_scheduled(job)
) { list_remove(&job->list_node, &s_scheduled_jobs, NULL); removed = true; } mutex_unlock(s_list_mutex); return removed; } // --------------------------------------------------------------------------------------- // For Testing: void cron_clear_all_jobs(void) { mutex_lock(s_list_mutex); // Itera...
/* * 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...
pfs_init(false /* run filesystem check */)
/* * 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...
system_flash_erase(FLASH_BASE + 25 KiB, 871 KiB, NULL, NULL)
); cl_assert_equal_i(BITS_BETWEEN(1, 10), erased_sector); cl_assert(flash_locked); } void callback_is_called_cb(uint32_t num, uint32_t den, void *context) { callback_called = true; cl_assert_equal_i(8675309, (uintptr_t)context); } void test_system_flash__callback_is_called(void) { cl_assert(system_flash_era...
/* * 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...
(GColorWhite.b == 0b11)
; cl_assert(GColorWhite.a == 0b11); } void test_graphics_colors__red(void) { cl_assert(GColorRed.r == 0b11); cl_assert(GColorRed.g == 0b00); cl_assert(GColorRed.b == 0b00); cl_assert(GColorRed.a == 0b11); } void test_graphics_colors__green(void) { cl_assert(GColorGreen.r == 0b00); cl_assert(GColorGreen....
uint8_t key[4]; int key_len = sizeof(key) - 1; memcpy(key, "key", sizeof(key)); uint8_t val[7]; int val_len = 6; printf("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, va...
cl_assert_equal_i(file.used_space, file_copy.used_space)
; cl_assert_equal_i(file.dead_space, file_copy.dead_space); } void test_settings_file__max_storage(void) { printf("\nTesting what happens when we hit the storage limits...\n"); SettingsFile file; cl_must_pass(settings_file_open(&file, "test_file_max_storage", 4096)); uint8_t key[5]; int key_len = 4; uint...
/* * 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...
(PebbleTask_BTRX)
, AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_STACK_FREE_BLUETOPIA_SMALL, prv_task_get_stack_free(PebbleTask_BTTimer), AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_STACK_FREE_NEWTIMERS, prv_task_get_stack_free(PebbleTask_NewTimers), AnalyticsClient_System); } QueueHand...
////////////////////////////////////// static int round_up_to_nearest_subsector(uint32_t addr) { // - 1 because if we're currently on a subsector border we don't want to round up to the // next one. return (addr + SUBSECTOR_SIZE_BYTES - 1) & SUBSECTOR_ADDR_MASK; } static bool is_cursor_at_active_registry(uint32_...
("UUID is:\n\t")
TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_assign_center_45.Xbit.pbi")); // Test transparency setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign); graphics_context_set_fill_color(&ctx, GColorBlue)...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_offset_bottomedge_2.Xbit.pbi"))
20, -856}, { -488, 368, -824}, { -560, 288, -680}, { -456, 336, -720}, { -480, 352, -656}, { -496, 488, -600}, { -536, 480, -600}, { -552, 504, -568}, { -616, 432, -584}, // 155 seconds { -680, 352, -536}, { -640, 328, -544}, { -616, 304, -520}, { -608, 336, -536}, ...
// 160 seconds { -840, 240, -360}, { -824, 248, -384}, { -824, 248, -392}, { -824, 256, -384}, { -808, 256, -416}, { -784, 272, -440}, { -768, 280, -464}, { -752, 320, -496}, { -712, 336, -544}, { -664, 344, -608}, { -672, 504, -704}, { -624, 392, -664}, { -624, 3...
{ 192, -376, -872}, { 232, -384, -944}, { 200, -344, -912}, { 192, -360, -904}, { 184, -368, -880}, { 200, -368, -888}, { 200, -336, -912}, { 200, -328, -912}, { 184, -352, -912}, { 176, -336, -912}, { 184, -360, -920}, // 163 seconds { 184, -368, -936}, { 192, -...
oints(path->points, path->num_points, s_offset); s_path_open = open; s_path_stroke_count++; } void gpath_fill_precise_internal(GContext *ctx, GPointPrecise *points, size_t num_points) { s_fill_points = prv_copy_points((GPoint*)points, num_points, s_offset); s_path_fill_precise_count++; } void gpath_draw_fille...
cl_assert_equal_p(s_stroke_points, NULL)
c, 0, 206}, { 0, 0x8c, 0, 206}, { 0, 0x8c, 0, 207}, { 0, 0x8c, 0, 208}, { 0, 0x8c, 0, 206}, // 75: Local time: 12:21:00 PM { 0, 0x8c, 0, 205}, { 0, 0x8c, 0, 205}, { 0, 0x8c, 0, 205}, { 0, 0x8c, 0, 205}, { 0, 0x8c, 0, 205}, { 0, 0x8c, 0, 205}, { 0, 0x8c, 0, 205}, { 0, ...
ARRAY_LENGTH(samples)
; return samples; } // ---------------------------------------------------------------- // Sample captured at: 2015-09-16 20:02:00 local, 2015-09-17 03:02:00 GMT // According to Fitbit: // sleep entry 9:06pn (offset 65) // sleep exit 6:03am (offset 602) // Fitbit was wrong here, the real wake time is close...
/* * 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...
test_graphics_context_reset(&ctx, fb)
; layer_set_update_proc(&layer, &across_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_nx_origin_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_y_layer_update_callback); ...
l_assert(state.node->all_day); cl_assert(!iter_next(&iterator)); cl_assert(iter_prev(&iterator)); cl_assert(!iter_prev(&iterator)); } void test_timeline__all_day_middle_past(void) { prv_insert_all_day_items(); // 1421183640 is 13:14 on Jan 13, 2015 // after first timed event of the day but not all of the...
uuid_equal(&state.pin.header.id, &s_extra_case_items[0].header.id)
); cl_assert(!iter_next(&iterator)); } // 11 am, all events passed void test_timeline__extra_case_backwards(void) { prv_insert_extra_case_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &s...
ta; PulseTransferFD *pulse_fd = &s_transfer_fds[fd_num]; const size_t max_read_len = (PULSE_MAX_SEND_SIZE - sizeof(ReadResponse)); size_t read_len = MIN(pulse_fd->transfer_state.bytes_left, max_read_len); ReadResponse *resp = pulse_reliable_send_begin(PULSE2_BULKIO_PROTOCOL); resp->opcode = BULKIO_RESP_DOMA...
prv_get_fd(cmd, length)
s, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); #endif } // -------------------------------------------------------------------------------------- // Test a sequence animation with a play count of 0 void test_animation__sequence_with_0_play_count(void) { #ifdef TEST_INCLUDE_CO...
(&s_started_handler_calls, inner_seq)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, inner_seq), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_...
rt(uuid_equal(&state.node->id, &all_day_item.header.id)); cl_assert(!state.node->all_day); cl_assert_equal_i(state.node->timestamp, midnight_march_3_utc + SECONDS_PER_DAY); cl_assert_equal_i(state.node->duration, 0); cl_assert_equal_i(state.current_day, midnight_march_2_pst + SECONDS_PER_DAY); // no more c...
timeline_iter_remove_node_with_id(&head, &multiday_item.header.id)
/* * 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...
(&notif_attr_list)
; attribute_list_destroy_list(&notif_attr_list); attribute_list_destroy_list(&end_workout_attr_list); attribute_list_destroy_list(&open_workout_attr_list); return item; } void workout_utils_send_abandoned_workout_notification(void) { TimelineItem *item = prv_create_abandoned_workout_notification(); if (it...
cense 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/graphics/graphics.h" #include "applib/graphics/graphics_private.h" #include...
for (int16_t x = 0; x < rect->size.w; x++) { draw_func(ctx, rect->origin.x + x, rect->origin.y, grect_get_max_y(rect) - 1, color); }
rsion 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 an "...
dialog_set_background_color(dialog, GColorRed)
; dialog_set_icon(dialog, data->resource_id_80); actionable_dialog_set_action_bar_type(actionable_dialog, DialogActionBarDecline, NULL); actionable_dialog_set_click_config_provider(actionable_dialog, prv_decline_config_provider); app_actionable_dialog_push(actionable_dialog); } /////////////////////////...
ndow *window; BitmapLayer *background_layer; BitmapLayer *topleft_layer; MenuLayer *action_list1; MenuLayer *action_list2; int64_t time_started; uint32_t rendered_frames; } AppData; static int64_t prv_time_64(void) { time_t s; uint16_t ms; time_ms(&s, &ms); return (int64_t)s * 1000 + ms; } static...
graphics_draw_text(ctx, title, title_font, box, GTextOverflowModeFill, GTextAlignmentLeft, NULL)
; } } void prv_draw_row_1(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *callback_context) { const char *title = prv_row_texts[cell_index->row]; GRect frame = layer_get_frame(cell_layer); prv_draw_row(ctx, cell_layer, title, -frame.origin.y/4); } static void prv_draw_row_2(GContext* ...
= (void *)PLOG_PAYLOAD_SENDER_TYPE, }, .id = { .funcs.encode = protobuf_log_util_encode_string, .arg = (void *)watch_serial, }, .has_version = true, .version = { .major = v_major, .minor = v_minor, .patch = { .funcs.encode = protobuf_log_ut...
rtc_get_time()
; // Create a new stream, reserving space for the header in front session->data_stream = pb_ostream_from_buffer(session->data_buffer, session->max_data_size); switch (config->type) { case ProtobufLogType_Measurements: { return prv_session_measurement_encode_start(session); } case ProtobufLogTy...
f fraction dev->periph->BRR = (mantissa << 3) | (fraction & 0x7); } else { // 4 bits of fraction dev->periph->BRR = (mantissa << 4) | (fraction & 0xF); } } // Read / Write APIs //////////////////////////////////////////////////////////////////////////////// void uart_write_byte(UARTDevice *dev, uint8...
dev->state->rx_irq_handler(dev, data, &err_flags)
) { should_context_switch = true; } if (++dev->state->rx_dma_index == dma_length) { dev->state->rx_dma_index = 0; } } // explicitly clear error flags since we're not reading from the data register uart_clear_all_interrupt_flags(dev); } else { const...
/* * 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_p(circular_cache_get(&s_test_cache, &s_test_item[0]), &s_cache_buffer[0])
eiver *receiver) { cl_assert_equal_p(receiver, s_kernel_receiver); s_kernel_receiver_is_receiving = false; s_kernel_receiver_finish_called = true; } static void prv_default_kernel_receiver_cleanup(Receiver *receiver) { cl_assert_equal_p(receiver, s_kernel_receiver); s_kernel_receiver_is_receiving = false; ...
(s_session, &s_app_message_endpoint, sizeof(AppMessagePush))
; cl_assert_equal_p(r, NULL); cl_assert_equal_b(false, s_kernel_receiver_is_receiving); } void test_app_message_receiver__receive_push_but_inbox_not_opened_no_kernel_receiver(void) { fake_kernel_malloc_mark(); s_kernel_receiver_available = false; Receiver *r = s_rcv_imp->prepare(s_session, &s_app_message_end...
rtc_set_time(100 * 60)
; cl_assert(stub_new_timer_fire(timer_id)); cl_assert_equal_i(fake_event_get_count(), 5); cl_assert(prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000); rtc_set_time(110 * 60); cl_assert(stub_new_timer_fire(timer...
_state != QemuRecvState_WaitingHdrSignatureMSB && cur_time > state->start_recv_packet_time + QEMU_RECV_PACKET_TIMEOUT_SEC) { state->recv_state = QemuRecvState_WaitingHdrSignatureMSB; PBL_LOG(LOG_LEVEL_WARNING, "Resetting receive state - max packet time expired"); } state->callback_pending = false; ...
{ shared_circular_buffer_read_consume(&state->isr_buffer, &state->isr_buffer_client, sizeof(footer), (uint8_t *)&footer, &bytes_read); bytes_avail -= bytes_read; footer.signature = ntohs(footer.signature); if (footer.signature != QEMU_FOOTER_SIGNATURE) { ...
} break; } // switch() } // while (!exit && bytes_avail) // Return pointer if we got a complete message if (got_msg) { *msg_bytes= state->msg_buffer_bytes; *protocol = state->hdr.protocol; return state->msg_buffer; } else { return NULL; } } // -----------------------------...
a sequence out of a and b Animation *a = prv_create_test_animation(); Animation *b = prv_create_test_animation(); Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); // Try to create a spawn out of b and c Animation *c = prv_create_test_animation(); Animation *spawn = animatio...
animation_get_elapsed(h, &elapsed_ms)
); cl_assert_equal_i(elapsed_ms, 0); cl_must_pass(animation_get_progress(h, &progress)); cl_assert_equal_i(progress, 0); animation_set_elapsed(h, duration / 2); cl_must_pass(animation_get_elapsed(h, &elapsed_ms)); cl_assert_equal_i(elapsed_ms, duration / 2); cl_must_pass(animation_get_progress(h, &progres...
http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governin...
((start_addr & 0x0000FF))
; } uint8_t flash_read_next_byte(void) { uint8_t result = flash_send_and_receive_byte(FLASH_CMD_DUMMY); return result; } void flash_wait_for_write_bounded(volatile int cycles_to_wait) { flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_READ_STATUS_REG); uint8_t status_register = 0; do { if (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...
shared_circular_buffer_read(buffer, client, num_bytes, &read_ptr, &chunk)
//!< Reset for holding down on key PmicResetReason_StandbyInterrupt = 0x0b, //!< Reset for interrupt in standby PmicResetReason_StandbyOnPulledHigh = 0x0c, //!< Reset for ON pulled high in standby PmicResetReason_Unknown, } PmicResetReason; static void prv_start_120hz_clock(void); static bool prv_init_gpio(vo...
(PmicRegisters_RESET_CNTL, &val)
) { return PmicResetReason_Unknown; } return (val & 0xf0) >> 4; } // If the pmic indicates that we were reset due to a charger interrupt, but the // charger is currently disconnected, then we know we were woken by a disconnect event. bool pmic_boot_due_to_charger_disconnect(void) { if (prv_reset_reason() != ...
l(&device), BTErrnoOK); prv_mock_put_service_discovery_events(); const Service *bp_service = fake_gatt_get_blood_pressure_service(); const Service *thermo_service = fake_gatt_get_health_thermometer_service(); const Service *random_128bit_service = fake_gatt_get_random_128bit_uuid_service(); const Service *se...
(num_inc_services, num_found_included_services)
; for (uint8_t i = 0; i < num_inc_services; ++i) { const Service *expected_inc_service = expected_service->included_services[i]; BLEService inc_service = inc_service_refs[i]; // Only check the Service UUID: const Uuid uuid = gatt_client_service_get_uuid(inc_service); cl_assert(uuid_e...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
hw_watchdog_set_pos_val(0xFF)
; printf("R0=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_R0]); printf("R1=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_R1]); printf("R2=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_R2]); printf("R3=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_R3]); printf("R12=0x%08" PRIx32 "\n",...
ACK: uuid = &s_quick_launch_back.uuid; break; case NUM_BUTTONS: break; } PBL_ASSERTN(uuid); return app_install_get_id_for_uuid(uuid); } void quick_launch_set_app(ButtonId button, AppInstallId app_id) { QuickLaunchPreference pref = (QuickLaunchPreference) { .enabled = true, }; app_...
shell_prefs_get_language_english()
ults_window; MfgResultsUI results_ui; #endif } AppData; static void prv_draw_solid(Layer *layer, GContext *ctx, GColor color) { graphics_context_set_fill_color(ctx, color); graphics_fill_rect(ctx, &layer->bounds); } static void prv_fill_cols(GContext *ctx, uint8_t color, int16_t *row, int16_t column, ...
(layer, ctx, 0)
; break; #if PBL_COLOR case TestPattern_Red: prv_draw_solid(layer, ctx, GColorRed); break; case TestPattern_Green: prv_draw_solid(layer, ctx, GColorGreen); break; case TestPattern_Blue: prv_draw_solid(layer, ctx, GColorBlue); break; #endif #if PBL_ROUND case TestPattern_Border1: ...
) / 2) - 1, GCornerBottomRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_rmax_bottomright.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_fill_rect_${BIT_DEPTH_NAME}__origin_aa_corners(void) { GContext ctx; test_graphics_context_init(&ctx, fb); // TODO: Remove these #ifdefs in PBL-15916 when ...
cl_assert_equal_i(prv_clamp_corner_radius(GSize(5, 10), GCornersAll, 4), 2)
; cl_assert_equal_i(prv_clamp_corner_radius(GSize(6, 10), GCornersAll, 4), 3); cl_assert_equal_i(prv_clamp_corner_radius(GSize(7, 10), GCornersAll, 4), 3); cl_assert_equal_i(prv_clamp_corner_radius(GSize(8, 10), GCornersAll, 4), 4); cl_assert_equal_i(prv_clamp_corner_radius(GSize(9, 10), GCornersAll, 4), 4); ...
-775}, { -108, 646, -677}, { -91, 647, -637}, { -119, 676, -621}, { -166, 732, -539}, { -179, 840, -588}, { -218, 742, -564}, { -219, 900, -527}, { -186, 868, -521}, { -189, 889, -475}, { -210, 890, -355}, { -205, 889, -428}, { -199, 909, -410}, { -207, 904, -398}, ...
{ -60, 354, -922}, { -69, 361, -891}, { -75, 367, -926}, { -66, 356, -943}, { -71, 356, -932}, { -75, 368, -914}, { -81, 381, -924}, { -96, 362, -915}, { -89, 344, -892}, { -103, 369, -917}, { -95, 362, -900}, { -100, 361, -908}, { -101, 352, -917}, { -95, 353, -9...
{ 163, 634, -678}, { 113, 608, -666}, { 141, 673, -686}, { 195, 744, -716}, { 186, 759, -683}, { 163, 675, -691}, { 144, 589, -724}, { 150, 609, -725}, { 160, 666, -683}, { 186, 831, -716}, { 220, 810, -701}, { 207, 744, -658}, { 129, 491, -735}, { 134, 681, -701...
/* * 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_putstr("Starting LSE oscillator")
/* * 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...
(sizeof(AppMessagePush), length)
) { return false; } bool success = false; // Scan the dictionary: const size_t dict_size = length - sizeof(AppMessagePush) + sizeof(Dictionary); DictionaryIterator iter; const Tuple *tuple = dict_read_begin_from_buffer(&iter, (const uint8_t *) &push_m...
ight_aligned_box_reduction; #else x = 0; w = frame.size.w - right_margin_px - action_bar_offset - right_aligned_box_reduction; #endif y = icon ? icon_offset + icon_size.h : -HEADER_OFFSET; TextLayer *header_layer = &expandable_dialog->header_layer; text_layer_init_with_parameters(header_layer, &GRe...
{ window_set_click_config_provider_with_context(window, prv_config_provider, expandable_dialog); }
x = PBL_IF_RECT_ELSE(left_margin_px, (show_action_bar) ? (frame.size.w - right_margin_px - left_margin_px - action_bar_offset - right_aligned_box_reduction - icon_size.h) : (90 - icon_size.h / 2)); y = icon_offset + PBL_IF_RECT_ELSE(0, 5); if (dialog_init_icon_layer(dialog, icon, GPoint(x, y)...
= round(d * FIXED_S16_3_FACTOR)}; } static bool prv_assign_number(const RockyArgBinding *binding, const jerry_value_t argv[], RockyArgValueCheckError *value_error_out) { double val = jerry_get_number_value(argv[0]); if (!prv_check_value_number_within_bounds(binding->type, &val, valu...
if (!prv_check_value_number_within_bounds(RockyArgTypeFixedS16_3, &d, value_error_out)) { value_error_out->arg_offset = i; return false; }
144}, // 195: Local time: 10:13:00 PM { 0, 0x6f, 34, 145}, { 0, 0x6f, 0, 144}, { 0, 0x6f, 0, 144}, { 0, 0x6f, 0, 144}, { 0, 0x6f, 17, 144}, { 0, 0x6f, 0, 149}, { 0, 0x6f, 17, 144}, { 0, 0x6f, 11, 144}, { 0, 0x6f, 0, 143}, { 0, 0x6f, 0, 144}, { 0, 0x6f, 0, 145}, { 0, 0...
{ 0, 0x3b, 0, 143}, { 0, 0x3b, 0, 142}, { 0, 0x3b, 0, 148}, { 0, 0x3b, 0, 142}, { 0, 0x3b, 0, 142}, { 0, 0x2b, 11, 142}, { 0, 0x2b, 0, 143}, { 0, 0x2b, 0, 143}, { 0, 0x2b, 0, 142}, { 0, 0x2b, 13, 143}, { 0, 0x2b, 0, 142}, { 0, 0x2b, 0, 144}, // 330: Local time: 12:29:...
ite = false }; // ISR stack guard static const MpuRegion s_isr_stack_guard_region = { .region_num = MemoryRegion_IsrStackGuard, .enabled = true, .base_address = (uint32_t) __isr_stack_start__, .size = (uint32_t) __stack_guard_size__, .cache_policy = MpuCachePolicy_NotCacheable, .priv_read = false, .priv_...
{ return &s_kernel_bg_stack_guard_region; }
/* * 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...
(&storage->entries, entry)
; return S_SUCCESS; } return E_DOES_NOT_EXIST; } status_t ram_storage_flush(RamStorage *storage) { while (storage->entries) { prv_delete(&storage->entries, storage->entries); } return S_SUCCESS; } RamStorage ram_storage_create(void) { RamStorage storage; storage.entries = NULL; return storag...
----------------------- // Fakes // ----------------------------------------------------------------------------- bool mfg_info_is_hrm_present(void) { return true; } static bool s_activity_prefs_heart_rate_is_enabled = true; bool activity_prefs_heart_rate_is_enabled(void) { return s_activity_prefs_heart_rate_is_en...
(PebbleTask_App)
; AppInstallId app_id = 1; const uint32_t update_interval_s = 1; uint16_t expire_s = 0; HRMFeature features = HRMFeature_BPM; // If we subscribe with no expiration, we should get 0 back HRMSessionRef session_ref = sys_hrm_manager_app_subscribe(app_id, update_interval_s, expire_s, ...
the basic glance blob insert test to insert the basic glance blob test_app_glance_db__basic_glance_blob_insert_and_read(); const size_t glance_size = sizeof(s_app_glance_basic); uint8_t glance_out[glance_size]; // Trying to read the basic glance blob back with an invalid key length should fail const size_t...
cl_assert_equal_i(app_glance_db_insert((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE, (uint8_t *)&s_app_glance_with_too_many_slices, original_glance_size), S_SUCCESS)
; // But the length we read back should be trimmed of the excess slices cl_assert_equal_i(app_glance_db_get_len((uint8_t *)&APP_GLANCE_TEST_UUID, UUID_SIZE), trimmed_glance_size); // The glance blob read back from the database should match everything up to where we trimmed uint8_t glance_ou...
NDPOINT_ID, max_length /* required_free_length */, TIMEOUT_MS); uint8_t fake_data[max_length]; memset(fake_data, 0, max_length); cl_assert_equal_b(comm_session_send_buffer_write(write_sb, fa...
(read_space >= sizeof(PebbleProtocolHeader))
; cl_assert_equal_i(header->length, htons(max_payload_length)); cl_assert_equal_i(header->endpoint_id, htons(ENDPOINT_ID)); cl_assert_equal_i(memcmp(data_out + sizeof(PebbleProtocolHeader), fake_data_payload, read_space - sizeof(PebbleProto...
{ return "FAIL"; }
} //! Runs all the test cases //! @return a bitset of tests that passed or failed uint32_t mfg_selftest(void) { uint32_t result = 0; for (uint32_t i = 0; i < ARRAY_LENGTH(s_test_cases); i++) { const struct SelfTestCase* test = s_test_cases + i; bool test_passed = false; if (test->func != 0) { te...
test_ppogatt__open_session_when_found_pebble_app(); fake_gatt_client_op_set_write_return_value(BTErrnoNotEnoughResources); Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, ...
{ prv_assert_sent_data(s_characteristics[0][PPoGATTCharacteristicData], sn /* sn */, s_short_data_fragment, sizeof(s_short_data_fragment) - sn); }
} void test_ppogatt__retransmit_timed_out_data_packets_race_everything_acked_at_once(void) { test_ppogatt__open_session_when_found_pebble_app(); Transport *transport = ppogatt_client_for_uuid(&s_meta_v0_system.app_uuid); // Get s_tx_window_size packets in flight: uint8_t sn = 0; for (; sn < s_tx_window_siz...
-296}, { -632, 704, -280}, { -632, 720, -272}, { -624, 712, -272}, { -632, 712, -264}, { -624, 728, -264}, { -632, 704, -264}, { -624, 720, -280}, { -632, 728, -256}, { -624, 664, -232}, { -640, 736, -232}, { -624, 728, -240}, { -632, 728, -272}, { -632, 712, -264}, ...
{ -616, 720, -296}, { -632, 704, -312}, { -608, 736, -288}, { -624, 720, -304}, { -616, 712, -304}, { -624, 712, -304}, { -624, 712, -296}, { -616, 720, -336}, { -608, 704, -376}, { -576, 736, -352}, { -608, 720, -280}, { -648, 688, -216}, { -664, 720, -152}, { -6...
{ -624, 712, -320}, // 126 seconds { -624, 704, -320}, { -616, 728, -336}, { -600, 712, -336}, { -624, 720, -296}, { -616, 704, -328}, { -616, 712, -360}, { -600, 656, -384}, { -608, 736, -384}, { -616, 704, -336}, { -616, 688, -352}, { -624, 688, -344}, { -600, ...
push_success_dialog(void) { SimpleDialog *simple_dialog = simple_dialog_create("Reminder Added"); Dialog *dialog = simple_dialog_get_dialog(simple_dialog); dialog_set_text(dialog, i18n_get("Added", dialog)); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_REMINDER_LARGE); dialog_set_background_color(dialog, GColo...
(&local_tm)
; } // If the user doesn't accept the transcription, try again. data->ui_state = ReminderAppUIState_Start; prv_build_transcription_dialog_text(data); prv_push_transcription_dialog(data); } else { // Exit immediately because this event may or may not be handled before the main window appears...
/* * 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...
(packet->length)
) { // Packet truncated; discard return; } size_t info_length = ntoh16(packet->length) - sizeof(BestEffortPacket); // This variable is read in the macro-expansion below, but linters // have a hard time figuring that out. (void)info_length; switch (ntoh16(packet->protocol)) { case PULSE_CONTROL_...
/* * 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...
(SOME_STRING_KEY, SOME_STRING)
, TupletInteger(SOME_UINT32_KEY, (uint32_t) 32), }; const uint32_t size = dict_calc_buffer_size_from_tuplets(tuplets, 3); cl_assert(size == sizeof(Dictionary) + (3 * sizeof(Tuple)) + sizeof(SOME_DATA) + strlen(SOME_STRING) + 1 + sizeof(uint32_t)); struct SerializeTestResult context = { .okay = false, .expe...
1064, 104, 104}, { -968, 0, 64}, { -800, -40, -128}, { -1176, -48, -40}, { -1216, 24, -280}, { -1080, -8, -360}, { -1264, -112, -184}, { -1336, -168, 40}, { -1232, 40, 8}, { -1112, 232, 72}, { -1096, 376, 120}, { -1176, 416, 80}, { -1248, 416, -40}, { -1184, 424, -32}...
{ -888, -192, 64}, { -1152, 0, -56}, { -1144, 200, -208}, { -1200, 296, -336}, { -1320, 24, -208}, { -1424, -232, 0}, { -1440, -56, -24}, { -1248, 264, 96}, { -1080, 440, 64}, { -1104, 464, -16}, { -1016, 392, -16}, { -816, 328, -72}, { -960, 384, -120}, // 34 sec...
{ -1192, 504, -192}, { -1000, 688, -224}, { -1080, 616, -160}, { -1064, 512, -128}, { -1496, 616, -112}, { -1288, 552, -176}, { -1064, 440, -304}, { -1304, 416, -216}, { -1528, 424, -16}, { -1440, 296, 0}, { -1240, 304, 0}, { -1192, 272, 72}, { -1128, 232, 112}, ...
awn = animation_spawn_create(b, c, NULL); cl_assert(spawn != NULL); // Create a sequence by putting a in front // We now have a -> (b | c) Animation *seq = animation_sequence_create(a, spawn, NULL); // Make it repeat animation_set_play_count(seq, repeat_count); prv_clear_handler_histories(); uint64_t...
prv_count_handler_entries(&s_teardown_handler_calls, c)
, 1); #endif } // -------------------------------------------------------------------------------------- // Test using clone and reverse in a complex animation void test_animation__complex_reverse(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_total = 2 * duration_a; const in...
lorWhite, NULL, RESOURCE_ID_ACTION_BAR_ICON_CHECK, prv_alarms_app_opened_click_handler); expandable_dialog_set_action_bar_background_color(expandable_dialog, ALARMS_APP_HIGHLIGHT_COLOR); expandable_dialog_set_header(expandable_dialog, header); #if defined(PBL_ROUND) expandable_dialog_set_header_font(expand...
app_event_loop()
; prv_handle_deinit(); } const PebbleProcessMd* alarms_app_get_info() { static const PebbleProcessMdSystem s_alarms_app_info = { .common = { .main_func = s_main, .uuid = UUID_ALARMS_DATA_SOURCE, }, .name = i18n_noop("Alarms"), #if CAPABILITY_HAS_APP_GLANCES .icon_resource_id = RESOURCE...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(text_node->text, text)
; cl_assert_equal_p(text_node->font, font); cl_assert_equal_p(text_node->overflow, overflow_mode); cl_assert_equal_p(text_node->alignment, alignment); TextLayoutExtended *layout = (TextLayoutExtended *)layout_ref; cl_assert_equal_p(text_node->line_spacing_delta, layout->line_spacing_delta); layout->max_us...
include "drivers/dbgserial.h" #include "drivers/display.h" #include "drivers/flash.h" #include "drivers/system_flash.h" #include "firmware.h" #include "flash_region.h" #include "system/bootbits.h" #include "system/firmware_storage.h" #include "system/reset.h" #include "util/crc32.h" #include "util/misc.h" #include "uti...
boot_bit_test(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS)
) { dbgserial_putstr("Our previous firmware update failed, aborting update."); // Pretend like the new firmware bit wasn't set afterall. We'll just run the // previous code, whether that was normal firmware or the recovery firmware. boot_bit_clear(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS); boot_bit_clear...
_start_playback_on_phone = prv_music_needs_user_to_start_playback_on_phone, .get_capability_bitset = prv_music_get_capability_bitset, .request_reduced_latency = prv_music_request_reduced_latency, .request_low_latency_for_period = prv_music_request_low_latency_for_period, }; // -----------------------------------...
gatt_client_op_write(entity_update_characteristic, cmd_value, cmd_length, GAPLEClientKernel)
; if (e != BTErrnoOK) { if (e == BTErrnoNotEnoughResources) { // Need to wait for space to become available launcher_task_add_callback(&prv_register_next_entity, NULL); } else { // Most likely the LE connection got busted, don't think retrying will help. PBL_LOG(LOG_LEVEL_ERROR, "Write...
------------------------------------------------------------------------------------------ //! Adds or removes a device to/from the Bluetooth controller's whitelist. //! Stops and (re)starts the LE Create Connection operation as necessary. static void prv_mutate_whitelist_safely(const BTDeviceInternal *device, ...
if (!is_already_connected) { return BTErrnoOK; }
if (is_pairing_required && !is_already_encrypted) { if (local_is_master) { // TODO: // - Check if pairing process is on-going, if so, do nothing // - If not on-going, kick it off (we're the master) // See https://pebbletechnology.atlassian.net/browse/PBL-6850 } else { // Pebble...
_lookup(roll); my_rot /= TRIG_MAX_RATIO; int32_t heading = (atan2_lookup(-my_rot, mx_rot) + corr) % TRIG_MAX_ANGLE; return (heading); } ////////////////////////////////////////////////////////////////////////////////// // Private handlers for compass service static void prv_calibration_time_expired_cb(void* d...
mag_read_data(&mag_data)
; if (rv != MagReadSuccess) { if (rv == MagReadCommunicationFail) { // heavy hammer fix for now // FIXME: move the restart logic to driver PBL_LOG(LOG_LEVEL_WARNING, "Read after %d samples failed, " "restarting compass", samples_collected); mag_release(); mag_start_samp...
* 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 "services/common/bluetooth/bluetooth_persistent_storage.h" #include "services/common/bluetooth/local_addr.h" #include <blue...
(true, s_last_driver_allow_cycling)
; } void test_local_addr__init_loads_stored_pinned_address(void) { cl_will_return(bt_persistent_storage_has_pinned_ble_pairings, true); cl_will_return(bt_persistent_storage_set_ble_pinned_address, true); cl_will_return(bt_driver_set_local_address, 0); s_last_bt_persist_pinned_addr_is_null = false; s_last_bt_...
_draw_precise_stroked_aa(&ctx, START_ON_ORIGIN_RECT_NXNY, END_ON_ORIGIN_RECT_NXNY, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_across_nxny_offset_layer_aa.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLI...
(&ctx.dest_bitmap, "draw_stroke_precise_close_points_less_than_1px_aa.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 10); graphics_line_draw_precise_stroked_aa(&ctx, CLOSE_POINTS_AROUND_1PX_START, CLOSE_POINTS_AROUND_1PX_END, 10); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_close_points_around_1px_aa.${BIT_DEPTH_NAME}.pbi")); #endi...