prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
_timer_callback(void *data) { if (!dls_initialized()) { // We need to wait until data logging is initialized before we can log heartbeats prv_schedule_retry(); return; } if (!s_event_session) { // If the event session has not been created yet, create that. The only time we may have to do // th...
system_task_watchdog_feed()
ss_window, max_fake_percent); progress_window_set_callbacks(data->progress_window, (ProgressWindowCallbacks) { .finished = prv_progress_window_finished, }, data); progress_window_set_back_disabled(data->progress_window, true); progress_window_push(data->progress_window, prv_get_window_stack(data)); const...
PBL_LOG(LOG_LEVEL_WARNING, "No notification in chaining data")
; prv_cleanup_action_result(data, false /* succeeded */); return; } TimelineItemAction *reply_action = timeline_item_find_action_by_type( item, TimelineItemActionTypeAncsResponse); // Update the type of the action to be of type TimelineItemActionTypeResponse. This will cause // us to send a sligh...
ta data; // These are the pages that this test will place a valid header. It will write invalid pages // before the valid one. uint8_t page_idx[] = {0, 1, SPRF_NUM_PAGES / 2, SPRF_NUM_PAGES - 1}; for (uint32_t i = 0; i < ARRAY_LENGTH(page_idx); i++) { fake_spi_flash_erase(); // Invalidate all entries...
cl_assert_equal_b(PAIRING_INFO.is_remote_encryption_info_valid, pairing_info_out.is_remote_encryption_info_valid)
; cl_assert_equal_b(PAIRING_INFO.is_local_encryption_info_valid, pairing_info_out.is_local_encryption_info_valid); cl_assert_equal_i(PAIRING_INFO.local_encryption_info.ediv, pairing_info_out.local_encryption_info.ediv); cl_assert_equal_i(PAIRING_INFO.local_encryption_info.d...
d(&ctx, GPoint(0, 3), 148); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 5), 0); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 7), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 9), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 11), 3); graphics_draw_horizontal_line_dotted(...
graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 1), MAX_NUM_COLS)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 3), MAX_NUM_COLS + 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 5), 0); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 7), 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 9), 2); graphics_draw_horizontal_line_dotted(&ctx, GPoint...
keep(); cl_assert_equal_i(window2->on_screen, false); cl_assert_equal_i(window1->on_screen, true); window_stack_remove(window1, true); cl_assert_equal_i(window1->on_screen, false); window_destroy(window1); window_destroy(window2); } // Description: // This test ensures that we are able to work with bot...
(PebbleTask_KernelMain)
/* * 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...
ADC_CommonInit(&ADC_CommonInitStruct)
; ADC_InitTypeDef ADC_InitStruct; ADC_StructInit(&ADC_InitStruct); ADC_InitStruct.ADC_Resolution = ADC_Resolution_12b; ADC_InitStruct.ADC_ScanConvMode = same_adc ? ENABLE : DISABLE; ADC_InitStruct.ADC_ContinuousConvMode = DISABLE; ADC_InitStruct.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; A...
de "applib/graphics/graphics_line.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/framebuffer.h" #include "applib/ui/animation.h" #include "applib/ui/animation_timing.h" #include "applib/ui/animation_interpolate.h" #include "applib/graphics/gdraw_command_transforms.h" #include "util.h" #include "test...
cl_assert_equal_i(y, -255 + -255)
on Spalding, these defines are always 180x180 // oh dear... *size = GSize(LEGACY_3X_DISP_COLS, LEGACY_3X_DISP_ROWS); return; case PlatformTypeDiorite: case PlatformTypeEmery: *size = GSize(DISP_COLS, DISP_ROWS); return; } WTF; } bool app_manager_is_app_supported(const PebbleP...
DEFINE_SYSCALL(bool, sys_app_is_watchface, void)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
mutex_lock(s_data.order_mutex)
; int storage_size = sizeof(AppMenuOrderStorage) + (storage->list_length * sizeof(AppInstallId)); int fd = pfs_open(ORDER_FILE, OP_FLAG_OVERWRITE, FILE_TYPE_STATIC, storage_size); if (fd == E_DOES_NOT_EXIST) { // File doesn't exist, need to create a new file. fd = pfs_open(ORDER_FILE, OP_FLAG_WRITE, FIL...
S OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "window_stack.h" #include "animation_private.h" #include "app_window_click_glue.h" #include "window_manager.h" #include "window_private.h" #incl...
if (context->animation) { // If we currently have an animation, run it to completion immediately before starting // another transition. // For 2.x apps, just unschedule the animation because there is no equivalent call for // animation_set_elapsed (which is not available to 2.x apps) if (process_man...
*context = (WindowTransitioningContext) { .window_to = window_to, .window_to_last_x = INT16_MAX, .window_from = window_from, .window_from_last_x = INT16_MAX, .implementation = transition, }; // TODO: PBL-17806 in future, store frames and config values as well if (transition->create_animat...
/* * 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...
(&ICE40LP->creset, false)
; // CRESET LOW delay_ms(1); if (gpio_input_read(&creset_input)) { dbgserial_putstr("CRESET not low during reset"); return false; } gpio_output_set(&ICE40LP->creset, true); // CRESET -> HIGH delay_ms(1); if (gpio_input_read(&ICE40LP->cdone)) { dbgserial_putstr("CDONE not low after reset"); ...
/* * 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_private_raw_mask_apply(dst_color, mask, data_row_offset, x, width, src_color)
; #else memset(dst_color, src_color.argb, (size_t)width); #endif // CAPABILITY_HAS_MASKING } // Plots row at given starting position and width, dithers grayscale colors static void prv_assign_row_with_pattern_1bit(GBitmap *framebuffer, int16_t y, int16_t x, int32_t width,...
/* * 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, &GRect(-10, 2, 18, 4), 4, GCornersAll)
; } void across_y_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_antialiased(ctx, false); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_round_rect(ctx, &GRect(4, 5, 18, 10), 4, GCornersAll); } void across_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_...
6}, { 1208, 608, -208}, { 1304, 696, -312}, { 1504, 680, -280}, { 1600, 520, -80}, { 1648, 480, -112}, { 1488, 392, -136}, { 1152, 304, -56}, { 1000, 232, -56}, { 816, 128, -40}, { 792, 104, -24}, { 656, 56, 16}, { 672, 56, -8}, { 728, 96, 16}, { 912, 192, -16}, ...
{ 1768, 552, -128}, // 51 seconds { 1736, 520, -88}, { 1352, 384, -80}, { 1112, 296, -88}, { 960, 200, -32}, { 808, 144, 24}, { 736, 120, -32}, { 664, 32, -112}, { 808, 40, -232}, { 856, -40, -160}, { 1080, -80, -8}, { 1232, 184, 16}, { 1504, 408, -80}, { 1704...
{ 1536, 472, 16}, { 1232, 848, -384}, { 832, 704, -360}, { 736, 320, -352}, { 696, 384, -424}, { 720, 440, -480}, { 864, 336, -520}, { 888, 392, -488}, // 54 seconds { 960, 464, -496}, { 984, 480, -432}, { 1392, 600, -400}, { 1152, 672, -416}, { 1416, 616, -312},...
set to English. if (!pstring_equal_cstring(&app_id->pstr, IOS_MAIL_APP_ID)) { return false; } static const char loading_str[] = "Loading\xe2\x80\xa6"; if (pstring_equal_cstring(&message->pstr, loading_str)) { return true; } static const char no_content_str[] = "This message has no content."; if (p...
{ PBL_LOG(LOG_LEVEL_ERROR, "Can't handle notifications without an app id"); return; }
const ANCSAttribute *title = notif_attributes[FetchedNotifAttributeIndexTitle]; const ANCSAttribute *subtitle = notif_attributes[FetchedNotifAttributeIndexSubtitle]; const ANCSAttribute *display_name = app_attributes[FetchedAppAttributeIndexDisplayName]; const ANCSAttribute *date = notif_attributes[FetchedNot...
sing 4-bytes: EXECUTE_SCRIPT("var pileOfPooUTF8 = '\xF0\x9F\x92\xA9';"); // Expect a pair of surrogate code points: EXECUTE_SCRIPT_AND_ASSERT_RV_EQUALS_S("pileOfPooUTF8.charCodeAt(0).toString(16)", "d83d"); EXECUTE_SCRIPT_AND_ASSERT_RV_EQUALS_S("pileOfPooUTF8.charCodeAt(1).toString(16)", "dca9"); } void test_r...
cl_assert_equal_i(copied_size, cases[i].expected_utf_size)
; if (cases[i].expected_utf_size) { cl_assert_equal_m(utf8_buffer, cases[i].expected_utf_data, cases[i].expected_utf_size); } } else { // When buffer is too small, expect 0 bytes copied: cl_assert_equal_i(copied_size, 0); } jerry_release_value(s); free(...
tate(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(0)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(1)); int new_idx; bool has_next; cl_assert(timeline_model_iter_next(&new_idx, &has_next));...
cl_assert(timeline_model_iter_next(NULL, NULL))
; cl_assert(timeline_model_iter_next(NULL, NULL)); cl_assert(!timeline_model_iter_next(NULL, NULL)); int new_idx; cl_assert(timeline_model_iter_prev(&new_idx, NULL)); 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[4]].hea...
/* * 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...
(LOG_LEVEL_DEBUG, (uint8_t *)erk, sizeof(SM128BitKey))
static void prv_show_unfold_animation(VoiceUiData *data, bool is_reversed) { KinoReel *reel = kino_layer_get_reel(&data->mic_window.icon_layer); // reel can be null if the image was not found in the init function. if (!reel) { return; } layer_set_hidden((Layer *) &data->mic_window.icon_layer, false); k...
(dot_layer, &from, &to)
; if (!anim) { return; } layer_set_frame(dot_layer, &from); layer_set_hidden(dot_layer, false); animation_set_custom_interpolation((Animation *)anim, prv_interpolate_moook_soft); animation_set_duration((Animation *)anim, interpolate_moook_soft_duration(NUM_MOOOK_FRAMES_MID)); animation_set_handlers...
ay && (status == GapBondingFileSetUpdated)) { prv_update_bondings(bonding, BtPersistBondingTypeBLE); } return (status != GapBondingFileSetFail); } static void prv_init_and_assign_ble_bonding(BleBonding *bonding, const BtPersistBondingData *stored_data) { *bonding ...
((unsigned)info->val_len, sizeof(stored_data))
); if (stored_data.type == BtPersistBondingTypeBLE && bt_device_equal(&itr_data->device.opaque, &stored_data.ble_data.pairing_info.identity.opaque)) { itr_data->irk_out = stored_data.ble_data.pairing_info.irk; strncpy(itr_data->name_out, stored_data.ble_data.name, BT_DEVICE_NAME_B...
er_get_separator_height(menu_layer, 0) }, }, .cache_set = false, }; if (prv_menu_layer_get_header_height(menu_layer, 0) != 0) { // We have to add the separator height, as when drawing down -> up, we render the separator // for the row above before proceeding down. We only render this separato...
(a1, AnimationCurveEaseOut)
; animation_set_auto_destroy(a1, true); // Step 2. Skip the top of the highlight down to the top of the newly selected cell, // and have the selection BOTTOM_DOWN_PX below the selected cell. from.origin.y = menu_layer->selection.y - ((up) ? BOTTOM_DOWN_PX : 0); from.size.h = size.h + BOTTOM_DOWN_PX; // St...
"applib/ui/dialogs/actionable_dialog.h" #include "applib/ui/dialogs/dialog.h" #include "applib/ui/dialogs/expandable_dialog.h" #include "applib/ui/dialogs/simple_dialog.h" #include "applib/ui/vibes.h" #include "applib/ui/window_manager.h" #include "applib/ui/window_stack.h" #include "drivers/rtc.h" #include "kernel/ev...
(msg, prv_toggle_manual_dnd_from_settings_menu)
ordings s_graphics_text_layout_get_max_used_size; static GSize s_graphics_text_layout_get_max_used_size__result; GSize graphics_text_layout_get_max_used_size(GContext *ctx, const char *text, GFont const font, const GRect box, cons...
jerry_value_is_null(event_null)
); jerry_release_value(event_null); Layer *l = &app_window_stack_get_top_window()->layer; l->update_proc(l, NULL); const jerry_value_t event = prv_js_global_get_value("event"); cl_assert_equal_b(true, jerry_value_is_object(event)); const jerry_value_t context_2d = jerry_get_object_field(event, "context");...
/* * 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(bus->hal->i2c, bus->hal->clock_ctrl)
; prv_i2c_deinit(bus); } bool i2c_hal_is_busy(I2CBus *bus) { return ((bus->hal->i2c->ISR & I2C_ISR_BUSY) != 0); } static void prv_disable_all_interrupts(I2CBus *bus) { bus->hal->i2c->CR1 &= ~(I2C_CR1_TXIE | I2C_CR1_RXIE | I2C_CR1_TCIE | ...
BUFFER_SIZE, s_writer)); } void test_app_inbox__app_inbox_service_write_inbox_closed_in_mean_time(void) { prv_create_test_inbox_and_begin_write(); app_inbox_destroy_and_deregister(s_inbox); cl_assert_equal_b(false, app_inbox_service_write(AppInboxServiceTagUnitTest, ...
cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, 1))
/* * 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...
strlen(s2)
remote_bt_version, uint16_t remote_bt_company_id, uint16_t remote_bt_subversion) { AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_BtLeDisconnect, .ble_disconnection = { .reason = reason, .remote_bt_version...
ANALYTICS_LOG_DEBUG("Event %d - BT Disconnect: Handle:%"PRIu16" LR: %"PRIu32, event_blob.event, conn_handle, lr)
; analytics_logging_log_event(&event_blob); } // ------------------------------------------------------------------------------------------ // Log an Apple Media Service event. void analytics_event_ams(uint8_t type, int32_t aux_info) { AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_BtLeAMS, .ams...
s(&s_stopped_handler_calls, NULL), 0); // Execute to the start of B and C prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 3); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NULL...
(&s_stopped_handler_calls, b1)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b2), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b3), 0); // Let it finish completely prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_h...
static int samples_collected = 0; // read magnetometer sample MagData mag_data; MagReadStatus rv = 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...
syscall_assert_userspace_buffer(data, sizeof(*data))
; } *data = (CompassHeadingData) { .magnetic_heading = s_last_heading, .true_heading = s_last_heading, .compass_status = s_current_cal_status, .is_declination_valid = false }; } ////////////////////////////////////////////////////////////////////////////////// // Recovery firmware commands #ifd...
atus = BTErrnoOK }; info->services_removed_data.num_services_removed = 1; PebbleBLEGATTClientServiceHandles *remove_hdl = &info->services_removed_data.handles[0]; remove_hdl->service = service; remove_hdl->uuid = service_node->service->uuid; remove_hdl->num_characteristics = service_node->service->num_ch...
{ list_append(*head, &node->node); }
else { *head = &node->node; } } bt_unlock(); } bool bt_driver_cb_gatt_client_discovery_complete(GAPLEConnection *connection, BTErrno errno) { bool finalize_discovery = true; bt_lock(); { if (errno == BTErrnoServiceDiscoveryTimeout) { if (prv_discovery_handle_timeout(connection, &errno)) ...
(error_str)
; } if (name) { APP_LOG(LOG_LEVEL_ERROR, "Unhandled %s", name); } else { APP_LOG(LOG_LEVEL_ERROR, "Unhandled exception"); } if (msg) { APP_LOG(LOG_LEVEL_ERROR, " %s", msg); } task_free(name); task_free(msg); }
%f0uS %0faT = %f0aH %0aM %0aS %f0aM %0aS %f0aS */ /* 0 flag adds 0 flag to all sub-specs f flag adds f flag to first sub-spec ua. are unique */ static void prv_append_string_i18n(TemplateStringState *state, const char *str) { size_t len = sys_i18n_get_length(str); if (state->output_remaini...
("TmplStringPlur", "")
}, /// Singular suffix for months with abbreviated units { i18n_ctx_noop("TmplStringSing", " mo"), /// Plural suffix for months with abbreviated units i18n_ctx_noop("TmplStringPlur", " mo")}, /// Singular suffix for months with full units { i18n_ctx_noop("TmplStringSing", " month"), /// Plural suffix fo...
16, -1008}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -992}, { 48, 24, -1008}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1000}, ...
{ 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1008}, { 48, 24, -992}, { 56, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -992}, { 48, 24, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 32, ...
{ 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 16, -1008}, { 48, 24, -1000}, { 48, 16, -1008}, { 48, 40, -1000}, { 48, 16, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 48, 24, -1000}, { 56, 24, -1000}, { 48, 2...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ jerry_char_t *msg = (jerry_char_t *)"Not enough arguments"; return jerry_create_error(JERRY_ERROR_TYPE, msg); }
y); const int flags = 0; const int num_attributes = 0; const int num_actions = 1; const int action_id = 12; const int reply_action_attrs = 2; // Title + Emoji uint8_t val[] = {0, 0, 0, 0, // Flags (unused for now) num_attributes, num_actions, action_id, TimelineItemAct...
(response_action->attr_list.attributes[1].uint8, 1)
/* * 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_ctx.dest_bitmap, TEST_PBI_FILE)
"d.toLocaleString(undefined);\n" ); EXECUTE_SCRIPT_EXPECT_ERROR( "d.toLocaleString('de');", "TypeError: Unsupported locale" ); } void test_rocky_api_datetime__locale_time_string_options(void) { rocky_global_init(s_api); EXECUTE_SCRIPT("var d = new Date();"); EXECUTE_SCRIPT("s = d.toLocaleTimeStr...
("s", "Jul")
; EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: 'long'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "July"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {year: 'numeric'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "2005"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {year: '2-digit'});"); ASS...
// Turn power off accessory_set_baudrate(DEFAULT_BAUD); periph_config_release_lock(); prv_initialize_exti(); } static void prv_set_baudrate(uint32_t baudrate, bool force_update) { if ((baudrate != s_baudrate) || force_update) { PBL_LOG(LOG_LEVEL_DEBUG, "Changing accessory connector baud rate to %"PRIu...
{ // wait for any in-progress write to finish PBL_ASSERTN(xSemaphoreTake(s_send_semaphore, portMAX_DELAY) == pdPASS); xSemaphoreGive(s_send_semaphore); }
under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the L...
timer_callback(data)
; } // -------------------------------------------------------------------------------------------- void regular_timer_init(void) { PBL_ASSERTN(s_callback_list_semaphore == 0); s_callback_list_semaphore = mutex_create(); time_t seconds; uint16_t milliseconds; rtc_get_time_ms(&seconds, &milliseconds); s_t...
OARD // Since bigboards are usually plugged in, don't react to a battery connection event const PebbleBatteryStateChangeEvent *evt = &e->battery_state; mutex_lock_recursive(s_activity_state.mutex); { s_activity_state.enabled_charging_state = !evt->new_state.is_plugged; } mutex_unlock_recursive(s_activit...
int minute_of_day = time_util_get_minute_of_day(utc_now); s_activity_state.resting_calories = activity_private_compute_resting_calories(minute_of_day); key = ActivitySettingsKeyLastSleepActivityUTC; settings_file_get(file, &key, sizeof(key), &s_activity_state.logged_sleep_activity_exit_at_u...
// ------------------------------------------------------------------------------------------------ bool activity_start_tracking(bool test_mode) { return system_task_add_callback(prv_start_tracking_cb, (void *)test_mode); } // --------------------------------------------------------------------------------------...
APP_LOG(APP_LOG_LEVEL_DEBUG, "Got significant update event"); steps_update_text(data); } else if (event == HealthEventSleepUpdate) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Got sleep update event"); } else if (event == HealthEventHeartRateUpdate) { prv_hr_update_text(data); } else if (event == HealthEventMe...
(data->steps_card.msg_layer, GTextAlignmentCenter)
; text_layer_set_font(data->steps_card.msg_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); text_layer_set_background_color(data->steps_card.msg_layer, GColorClear); text_layer_set_text_color(data->steps_card.msg_layer, GColorWhite); layer_add_child(window_layer, text_layer_get_laye...
_watchdog_timer_id); } /////////////////////// // Clicks /////////////////////// static bool prv_should_show_action_in_action_menu(NotificationWindowData *data, const TimelineItem *item, const TimelineItemAction *actio...
(&item->attr_list, AttributeIdiOSAppIdentifier, "")
; if (!*app_id) { PBL_LOG(LOG_LEVEL_ERROR, "Could not mute notification. Unknown app_id"); return; } const int app_id_len = strlen(app_id); iOSNotifPrefs *notif_prefs = ios_notif_pref_db_get_prefs((uint8_t *)app_id, app_id_len); if (notif_prefs && attribute_find(&notif_prefs->attr_list, AttributeIdMu...
NULL_KEY = 0x0; static const uint32_t SOME_EMPTY_STRING_KEY = 0x1; static const char *SOME_EMPTY_STRING = ""; static const uint32_t SOME_UINT8_KEY = 0x88888888; static const uint32_t SOME_UINT16_KEY = 0x16161616; static const uint32_t SOME_UINT32_KEY = 0x32323232; static const uint32_t SOME_INT8_KEY = 0x11888888; sta...
cl_assert(final_size == size)
(false == text_layer_calc_text_flow_paging_values(NULL, NULL, NULL))
; cl_assert_equal_gpoint(origin, text_layer.layer.frame.origin); cl_assert_equal_gpoint(page.origin, origin); cl_assert_equal_gsize(page.size, GSize(text_layer.layer.frame.size.w, TEXT_LAYER_FLOW_DEFAULT_PAGING_HEIGHT)); } void test_text_layer_flow__paging_container(void)...
free_up_space(uint32_t bytes_needed) { if (bytes_needed == 0) { return E_INVALID_ARGUMENT; } status_t rv; mutex_lock_recursive(s_app_cache_mutex); { SettingsFile file; rv = settings_file_open(&file, APP_CACHE_FILE_NAME, APP_CACHE_MAX_SIZE); if (rv != S_SUCCESS) { goto unlock; } ...
(iter->name)
round up to the // next one. return (addr + SUBSECTOR_SIZE_BYTES - 1) & SUBSECTOR_ADDR_MASK; } static bool is_cursor_at_active_registry(uint32_t cursor) { uint8_t header[REGISTRY_HEADER_SIZE_BYTES]; flash_read_bytes(header, cursor, REGISTRY_HEADER_SIZE_BYTES); return memcmp(header, s_active_header, REGISTRY...
("Description is:\n\t%#.2hx\n", r->description)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const int read_result = persist_read_data(key, buffer, buffer_size); if (PASSED(read_result)) { buffer[read_result - 1] = '\0'; } return read_result; }
// Legacy version to prevent previous app breakage, __deprecated preserves order int persist_read_string__deprecated(const uint32_t key, const size_t buffer_size, char *buffer) { return persist_read_string(key, buffer, buffer_size); } DEFINE_SYSCALL(status_t, persist_write_bool,...
on_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 0); s_current_day = s_saturday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 0); s_current_day = s_sunday; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 1); s_current_day = s_monday; cron_service_wakeup(); c...
alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 })
; prv_assert_alarm_config(id1, 10, 30, false, ALARM_KIND_CUSTOM, schedule_1); cl_assert_equal_i(s_alarm_timer_timeout_ms, 0); } void test_alarm__custom_alarm_multiple(void) { AlarmId id1, id2; // Alarm set for Tuesday and Saturday bool schedule_1[7] = {false, false, true, false, false, false, true}; id1 ...
permitted_device; --ctx->slots_left; } } static size_t prv_copy_sharing_devices(BTDeviceInternal *devices_out, size_t max_devices) { bt_lock(); CopySharingDevicesCtx ctx = { .next_permitted_device = devices_out, .slots_left = max_devices, }; gap_le_connectio...
regular_timer_is_scheduled(&s_ble_hrm_timer)
, [4] = octet, [5] = octet, }, }; BTDevice device = bt_device_init_with_address(address, true /* is_random */); return *(BTDeviceInternal *)(&device); } static BTDeviceInternal prv_connected_dummy_device(uint8_t octet) { BTDeviceInternal device = prv_dummy_device(octet); gap_le_connection_add...
cl_assert_equal_b(fake_gatt_is_service_discovery_running(), false)
; // Expect event: prv_assert_event(&device, BTErrnoOK); } void test_gatt_client_discovery__disconnected_during_discovery(void) { BTDeviceInternal device = prv_connected_dummy_device(1); // Start discovery: cl_assert_equal_i(gatt_client_discovery_discover_all(&device), BTErrnoOK); // Simulate disconnecti...
_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true,...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r3_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); 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_rect_origin_rmax_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not d...
{ -424, 784, 416}, }; *len = ARRAY_LENGTH(samples); return samples; }
// ---------------------------------------------------------------- // Sample captured: 2015-09-28 17:10:23 local AccelRawData *activity_sample_100_steps_heather_18(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_heather_18 //> TEST_EXPECTED 100 //> TE...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(message, sizeof(PCMPPacket) + sizeof(port))
; } #endif
/* * 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...
(false /* do not create a timer */)
; #endif }
/* * 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_prv_api_remove__callcount++; }
int s_prv_listener_a1__callcount; JERRY_FUNCTION(prv_listener_a1) { s_prv_listener_a1__callcount++; return jerry_create_undefined(); } int s_prv_listener_a2__callcount; JERRY_FUNCTION(prv_listener_a2) { s_prv_listener_a2__callcount++; return jerry_create_undefined(); } int s_prv_listener_b__callcount; JERRY...
This timer watches to see if we have stopped receiving // sensor interrupts and will trigger logic to reset the sensor if necessary. static RegularTimerInfo s_as7000_watchdog_timer; // Incremented by s_as7000_watchdog_timer. Reset to 0 by our interrupt handler. static uint8_t s_missing_interrupt_count; //! Interval ...
{ struct PACKED { uint8_t sample_idx; net16 accel_x; net16 accel_y; net16 accel_z; } sample_data = { .sample_idx = sample_idx, .accel_x = hton16(data->x * 2), // Accel service supplies mGs, AS7000 expects lsb = 0.5 mG .accel_y = hton16(data->y * 2), .accel_z = hton16(data->z * 2) }...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
check_atan2(10, 14)
; check_atan2(3, 5); check_atan2(5, 3); check_atan2(10, 10); check_atan2(-153, 217); check_atan2(-28, -133); check_atan2(323, -229); check_atan2(245, 196); check_atan2(65, -3); check_atan2(331, -320); check_atan2(-151, 284); check_atan2(111, -98); check_atan2(-44, -17); check_atan2(269, -356);...
// These are just placeholders to allocate the needed space. // They will be set to the proper values during the animation. {0, 0}, {0, 0}, {0, 0}, {0, 0}, }, }; typedef struct PathInterpDefinition { GPoint start, end; } PathInterpDefinition; typedef struct PathDefinition { PathInterpDefinition wedge_...
gpath_draw_outline(ctx, &s_data.path)
; gpath_draw_filled(ctx, &s_data.path); } // Moves the current framebuffer around static int16_t prv_move_in(GContext *ctx, int move_size, uint32_t distance, bool vertical) { const int16_t current_offset_px = prv_interpolate_two_ways(distance, move_size); const int16_t diff = s_data.animation_offset_px - current...
/* * 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(pwm->timer.peripheral, pwm->timer.config_clock)
; } void pwm_set_duty_cycle(const PwmConfig *pwm, uint32_t duty_cycle) { TIM_OCInitTypeDef tim_oc_init; TIM_OCStructInit(&tim_oc_init); tim_oc_init.TIM_OCMode = TIM_OCMode_PWM1; tim_oc_init.TIM_OutputState = TIM_OutputState_Enable; tim_oc_init.TIM_Pulse = duty_cycle; tim_oc_init.TIM_OCPolarity = TIM_OCPol...
/* * 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_Service_Discovery_Complete_Data_t data = (GATT_Service_Discovery_Complete_Data_t) { .ConnectionID = connection_id, .Status = status, }; GATT_Service_Discovery_Event_Data_t event = (GATT_Service_Discovery_Event_Data_t) { .Event_Data_Type = etGATT_Service_Discovery_Complete, .Event_Data_...
void fake_gatt_put_discovery_indication_health_thermometer_service(unsigned int connection_id) { GATT_Characteristic_Descriptor_Information_t cccd1 = { .Characteristic_Descriptor_Handle = 0x15, .Characteristic_Descriptor_UUID = { .UUID_Type = guUUID_16, .UUID = { .UUID_16 = { ....
For timing out requests Attribute attribute; //!< used to persist the response value while waiting for result bool ignore_failures; } response; struct { Window *action_chaining_window; TimelineItem *notif; } chaining_data; struct { char *message; TimelineResourceId icon; bool succe...
("Action Result")
spi_ll_slave_scs_assert(BMI160_SPI)
; spi_ll_slave_read_write(BMI160_SPI, addr); } void bmi160_end_burst(void) { spi_ll_slave_scs_deassert(BMI160_SPI); spi_ll_slave_release(BMI160_SPI); } uint8_t bmi160_read_reg(uint8_t reg) { uint8_t value; // Registers are read when the address MSB=1 reg |= BMI160_READ_FLAG; SPIScatterGather sg_info[2] ...
, &initial_stack_pointer); dbgserial_print("Booting firmware @ "); dbgserial_print_hex((uintptr_t)reset_handler); dbgserial_print("...\r\n\r\n"); prv_hw_reset(); // The Cortex-M user guide states that the reset values for the core registers // are as follows: // R0-R12 = Unknown // MSP = VECTOR_T...
boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE)
; } return false; } static bool prv_prf_button_combination_is_pressed(void) { return (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK) && button_is_pressed(BUTTON_ID_SELECT) && !button_is_pressed(BUTTON_ID_DOWN)); } static bool prv_check_force_boot_recovery(void) { if (boot_bit_test...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (read_iter + sizeof(uint32_t) <= msg + length) { uint32_t track_duration_ms = *(uint32_t *)read_iter; music_update_track_duration(track_duration_ms); }
// TODO: Do something with this info // read_iter += 4; // if (read_iter + sizeof(uint16_t) <= msg + length) { // uint16_t num_tracks = *(uint16_t *)read_iter; // } // TODO: Do something with this info // read_iter += 2; // if (read_iter + sizeof(uint16_t) <= msg + length) { // ...
h_FMC); // FIXME prv_flash_idle_gpios(true); } s_num_flash_uses++; } void flash_impl_release_many(uint32_t num_locks) { PBL_ASSERTN(s_num_flash_uses >= num_locks); s_num_flash_uses -= num_locks; if (s_num_flash_uses == 0) { periph_config_disable(FMC_Bank1, RCC_AHB3Periph_FMC); // FIXME } } void fl...
{ prv_issue_command(0, S29VSCommand_ConfigureRegisterEntry); uint16_t result = flash_s29vs_read_short(0x0); prv_software_reset(); return result; }
static void prv_write_configuration_register(uint16_t data) { // See section 5.8.1 of data sheet for command sequence prv_issue_command(0, S29VSCommand_ConfigureRegisterEntry); // Cycle 1: SA+Address 555h & Data 25h // Cycle 2: SA+Address 2AAh & Data 00h // Cycle 3: SA+Address X00h & PD // Cycle 4: SA+ 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...
prv_update_plugged_change()
; // Amount in mV to drop the "Full" voltage by to briefly stay at 100% once unplugged const uint16_t BATTERY_FULL_FUDGE_AMOUNT = 10; PBL_LOG(LOG_LEVEL_DEBUG, "Done charging - Updating curve"); battery_curve_set_full_voltage(s_last_battery_state.voltage - BATTERY_FULL_FUDGE_AMOUNT); } static void battery_stat...
ted(&ctx, GPoint(0, 12), 4); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 14), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 16), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 18), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 20), 143); graphics_draw_horizontal_lin...
(&ctx, GPoint(0, 10), 3)
top-level animation_unschedule(clone); // Keep going, nothing new should happen except stop handlers for each component prv_advance_to_ms_with_timers(start_ms + 5 * (duration_total + 3 * MIN_FRAME_INTERVAL_MS)); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 7); cl_assert_equa...
prv_last_handler_entry(&s_stopped_handler_calls, a1)
->fire_order); last_fire_a = MAX(last_fire_a, prv_last_handler_entry(&s_stopped_handler_calls, a2)->fire_order); last_fire_a = MAX(last_fire_a, prv_last_handler_entry(&s_stopped_handler_calls, a3)->fire_order); last_fire_a = MAX(last_fire_a, prv_last_han...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (board_has_chg_en()) { gpio_use(BOARD_CONFIG_POWER.chg_en.gpio); GPIO_WriteBit(BOARD_CONFIG_POWER.chg_en.gpio, BOARD_CONFIG_POWER.chg_en.gpio_pin, charging_enabled?Bit_SET:Bit_RESET); gpio_release(BOARD_CONFIG_POWER.chg_en.gpio); PBL_LOG(LOG_LEVEL_DEBUG, "Charging:%s", charging_enabled?"enabled":"d...
} // These are the guts of battery_set_fast_charge(), called when we already have periph_config_acquire_lock static void prv_battery_set_fast_charge(bool fast_charge_enabled) { if (board_has_chg_fast()) { gpio_use(BOARD_CONFIG_POWER.chg_fast.gpio); GPIO_WriteBit(BOARD_CONFIG_POWER.chg_fast.gpio, BOARD_CONF...
(void) { } void fake_kernel_malloc_mark_assert_equal(void) { } // Helpers /////////////////////////////////////////////////////////// #define TEST_GATT_CONNECTION_ID (1234) #define TEST_BT_STACK_ID (1) typedef enum { Unknown, Handled, Unhandled, } HandleResult; static HandleResult s_last_handle_discovery_resu...
fake_kernel_malloc_mark()
/* * 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...
{ entry->flags &= ~RamStorageFlagDirty; return S_SUCCESS; }
return E_DOES_NOT_EXIST; } status_t ram_storage_each(RamStorage *storage, RamStorageEachCb cb, void *context) { RamStorageEntry *cur = storage->entries; while (cur) { if (!cb(cur, context)) { break; } cur = (RamStorageEntry *)cur->node.next; } return S_SUCCESS; }
rgin.h = icon_margin_h, }; const LayoutNodeIconConfig icon_config = { .extent.node.type = LayoutNodeType_Icon, .res_info = context->icon_info, .icon_layer = &context->icon_layer, .align = PBL_IF_ROUND_ELSE(GAlignCenter, GAlignLeft), .extent.offset.x = icon_offset_x, .extent.offset.y = icon_o...
attribute_get_uint32_list(attributes, AttributeIdMetricIcons)
; if (!icons) { return NULL; } // String list access is out-of-bounds safe, so use the Uint32List num_values const size_t num_metrics = icons->num_values; if (!num_metrics) { return NULL; } if (num_metrics > 1) { layout->num_metric_icon_layers = num_metrics - 1; layout->metric_icon_layer...
_outbox_sent_handler, s_expected_cb_ctx)); assert_syscall_failed(); } // Disallowed, because it's not white-listed in app_outbox_service.c static void prv_disallowed_sent_handler(AppOutboxStatus status, void *cb_ctx) { } void test_app_outbox__send_disallowed_sent_handler(void) { prv_register(); cl_assert_passer...
app_outbox_service_consume_message(s_last_message, AppOutboxStatusSuccess)
ue_custom_pattern(pattern); } #endif ///////////// CREATE DOT ANIMATIONS static void prv_dot_layer_update_proc(Layer *layer, GContext *ctx) { VoiceUiData *data = window_get_user_data(layer_get_window(layer)); // get frame to place dot in middle of layer graphics_context_set_fill_color(ctx, GColorBlack); graphi...
kino_layer_get_reel(&data->mic_window.icon_layer)
; // reel can be null if the image was not found in the init function. if (!reel) { return; } layer_set_hidden((Layer *) &data->mic_window.icon_layer, false); kino_layer_rewind(&data->mic_window.icon_layer); GRect from = kino_reel_transform_get_from_frame(reel); GRect to = kino_reel_transform_get_to...
ve_state->acquired); const uint8_t *cptr = out; while (len--) { prv_spi_send_data(slave->spi_bus, *(cptr++)); prv_spi_transmit_flush_blocking(slave->spi_bus); } } void spi_ll_slave_burst_read_write(const SPISlavePort *slave, const void *out, ...
{ return; }
dma_request_stop(slave->tx_dma); PBL_ASSERTN(slave->slave_state->initialized); PBL_ASSERTN(slave->slave_state->acquired); prv_spi_dma_cmd(slave->spi_bus, SpiI2sDma_ReqTx, false); slave->slave_state->dma_complete_handler = NULL; slave->slave_state->dma_complete_context = NULL; } void spi_ll_slave_read_writ...
/* * 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...
(num_intervals, 2)
; cl_assert_equal_i(average_ms, 1010); // valid interval fake_rtc_increment_time_ms(1010); interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 3); cl_assert_equal_i(average_ms, 1010); } // Make sure we don't run into any issues w...
system_task_add_callback(prv_update_hrm_enable_system_cb, NULL); } //! The system task needs its own handler for HRM data since we can't queue up generic events. static void prv_system_task_hrm_handler(void *context) { time_t utc_now = rtc_get_time(); mutex_lock_recursive(s_manager_state.lock); PebbleHRMEvent e...
system_task_add_callback(prv_system_task_hrm_handler, NULL)
; } return success; } T_STATIC void prv_charger_event_cb(PebbleEvent *e, void *context) { const PebbleBatteryStateChangeEvent *evt = &e->battery_state; mutex_lock_recursive(s_manager_state.lock); { s_manager_state.enabled_charging_state = !evt->new_state.is_plugged; } mutex_unlock_recursive(s_man...
x, &GRect(35, 47, 32, 22), 4, GCornersAll); } // Draw background color GColor bg_color = (GColor){ .argb = (data->bg_color.argb | ALPHA_100) }; graphics_context_set_fill_color(ctx, bg_color); graphics_fill_round_rect(ctx, &GRect(36, 48, 30, 20), 4, GCornersAll); } #define COLOR_BAR_WIDTH 4 #define COLOR_BAR_...
(BUTTON_ID_DOWN, 100, down_handler)
; } static void layer_update_proc(Layer *layer, GContext* ctx) { AppData *data = window_get_user_data(s_window); graphics_context_set_fill_color(ctx, GColorBlack); graphics_fill_rect(ctx, &layer->bounds); draw_boxes(ctx, data); set_text_layers(data); GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_14_...
/* * 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...
alarm_service_enable_alarms(true)
; } void test_alarm__cleanup(void) { cron_service_deinit(); } /////////////////////////////////////////////////////////////////////////////////////////////////// //! Basic Store / Get Tests void test_alarm__alarm_create_recurring_daily(void) { AlarmId id; id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 1...
---------------- // Setup the system services required for this process. Called by app_manager and worker_manager // right before we launch the task for the new process. void process_manager_process_setup(PebbleTask task) { ProcessContext *context = prv_get_context_for_task(task); persist_service_client_open(&conte...
PBL_LOG(LOG_LEVEL_WARNING, "no event queue")
; return 0; } return uxQueueMessagesWaiting(context->to_process_event_queue); } // ---------------------------------------------------------------------------------------------- void process_manager_send_callback_event_to_process(PebbleTask task, void (*callback)(void *data), void *data) { PBL_ASSERTN(cal...
} } ///////////////////// // Dismiss All ///////////////////// static void prv_handle_dismiss_all_complete(bool succeeded, void *cb_data) { NotificationWindowData *window_data = (NotificationWindowData*) cb_data; window_data->window_frozen = false; if (s_in_use && succeeded) { prv_pop_notification_window(w...
((Layer *)&data->swap_layer, swap_frame_animation_dy, true /* scroll */)
; Animation *spawn = animation_spawn_create(peek_up, swap_up, NULL); AnimationHandlers anim_handlers = { .started = NULL, .stopped = prv_peek_anim_stopped, }; animation_set_handlers(spawn, anim_handlers, data); // move the icon to where it should be in the swap_layer's notification_layout PeekLayer...
" and starting a new one", s_valid_page_idx); prv_invalidate_current_page(); return false; } uint32_t written_crc = FIELD_CRC_FROM_FIELD(field_out); if (written_crc == SPRF_UNWRITTEN_CRC) { // If empty field, return that we have invalid data too return false; } return true; } #define S...
prv_lock()
; { SprfBlePairingData data; rv = SPRF_FETCH_FIELD(data, ble_pairing_data); if (!rv) { goto unlock; } if (!data.fields) { // The pairing stored is empty rv = false; goto unlock; } if (pairing_info_out) { *pairing_info_out = (SMPairingInfo) { .local_e...
elineItemAction s_basic_action_list[] = { { .id = 0, .type = TimelineItemActionTypeGeneric }, { .id = 1, .type = TimelineItemActionTypeHttp }, { .id = 2, .type = TimelineItemActionTypeOpenPin }, }; void test_timeline_item__find_action_with_id(void) { // Make sure we're resilient to NULL items cl_assert_eq...
memcpy(action_list, s_basic_action_list, sizeof(s_basic_action_list))
; item.action_group.num_actions = ARRAY_LENGTH(s_basic_action_list); item.action_group.actions = action_list; // Make sure we don't return anything if the action doesn't exist cl_assert_equal_p(timeline_item_find_reply_action(&item), NULL); // Make sure we find both response and ancs response actions acti...
/* * 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...
{ progress_layer->foreground_color = color; }
void progress_layer_set_background_color(ProgressLayer* progress_layer, GColor color) { progress_layer->background_color = color; } void progress_layer_set_corner_radius(ProgressLayer* progress_layer, uint16_t corner_radius) { progress_layer->corner_radius = corner_radius; }
read_file_into_ram(iter); PBL_LOG(LOG_LEVEL_INFO, "Removing affected file %s...", iter->file_name); // Remove the file that caused us to get into this state before we reboot, // that way we should be able to avoid getting into a reboot loop. pfs_close_and_remove(iter->fd); PBL_LOG(LOG_LEVEL_INFO, "Data at ad...
if (iter->hdr.val_len == 0) return;
sfs_seek(iter, iter->hdr_pos + sizeof(SettingsRecordHeader) + iter->hdr.key_len, FSeekSet); sfs_read(iter, val_out, val_len); } void settings_raw_iter_write_header(SettingsRawIter *iter, SettingsRecordHeader *hdr) { PBL_ASSERTN(hdr->key_len <= SETTINGS_KEY_MAX_LEN); PBL_ASSERTN(hdr->val_len <= SETTINGS_...
R( "d.toLocaleDateString('de');", "TypeError: Unsupported locale" ); EXECUTE_SCRIPT( "var d = new Date();\n" "d.toLocaleString(undefined);\n" ); EXECUTE_SCRIPT_EXPECT_ERROR( "d.toLocaleString('de');", "TypeError: Unsupported locale" ); } void test_rocky_api_datetime__locale_time_stri...
ASSERT_JS_GLOBAL_EQUALS_S("s", "07")
; EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: 'short'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "Jul"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {month: 'long'});"); ASSERT_JS_GLOBAL_EQUALS_S("s", "July"); EXECUTE_SCRIPT("s = d.toLocaleDateString(undefined, {year: 'numeric'});"); ASSER...
cl_assert_equal_i(s_conn_mgr_states[BtConsumerMusicServiceIndefinite].state, ResponseTimeMax); } void test_ams__music_request_low_latency_for_period(void) { prv_connect_ams(); const uint32_t period_s = 1234; music_request_low_latency_for_period(period_s * 1000); cl_assert_equal_i(s_conn_mg...
music_get_playback_rate_percent()
, 0); } void test_ams__receive_non_numeric_player_playback_info_update(void) { prv_connect_ams(); // Receive: 'A', 'B.0' playback rate, elapsed time 184.755s // 0000 00 01 00 41 2c 42 2e 30 2c 31 38 34 2e 37 35 35 ...A,B.0 ,184.755 uint8_t nan_playback_info_update[] = { 0x00, 0x01, 0x00, 0x41, 0x2c, 0...
uint8_t connection_get_last_pairing_result(uint16_t conn_idx) { uint8_t rv = 0; prv_lock(); { Connection *connection = connection_by_idx(conn_idx); if (connection) { rv = connection->last_pairing_result; } } prv_unlock(); return rv; } PPoGATTWorkAroundState *connection_get_ppogatt_wa_st...
(connection, should_auto_accept_re_pairing, ConnectionFlag_ShouldAutoAcceptRePairing)
; } void connection_set_reversed_ppogatt_enabled(Connection *connection, bool is_reversed_ppogatt_enabled) { prv_set_flag(connection, is_reversed_ppogatt_enabled, ConnectionFlag_IsReversedPPoGATTEnabled); } void connection_set_last_pairing_result(uint16_t ...
ngth ? 160 : 32; for (int i = 0; i < num_terms; i++) { // Loop-around term: const bool is_loop_around = (terms[i].duration_secs == GAPLE_ADVERTISING_DURATION_LOOP_AROUND); if (is_loop_around) { if (i == 0) { // First term cannot be loop-around return NULL; } continue; ...
("Removing advertisement of type %s", prv_string_for_debug_tag(job->tag))
; gap_le_advert_unschedule(job); } } 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)...
/* * 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_ASSERTN((uintptr_t)buffer % 8 == 0)
; rv = jerry_exec_snapshot(buffer, buffer_size, false); } else { PBL_LOG(LOG_LEVEL_INFO, "Not a snapshot, interpreting buffer as JS source code"); rv = jerry_eval((jerry_char_t *) buffer, buffer_size, false); } bool error_occurred = jerry_value_has_error_flag(rv); if (error_occurred) { jerry_va...
/* * 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...
sys_wakeup_schedule(sys_get_time() + 10, 0, false)
; cl_assert_equal_i(sys_wakeup_query(wakeup_id), sys_get_time() + 10); // Cancel all wakeup events sys_wakeup_cancel_all_for_app(); cl_assert_equal_i(sys_wakeup_query(wakeup_id), E_DOES_NOT_EXIST); } void test_wakeup__max_events(void) { WakeupId wakeup_id = 0; sys_wakeup_cancel_all_for_app(); // Schedu...
bar); ActionBarLayer *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_i...
prv_set_pos_update_timer(data, music_get_playback_state())
; } static void prv_handle_deinit(void) { music_request_reduced_latency(false); MusicAppData *data = app_state_get_user_data(); i18n_free_all(data); // we'll be cleaned up properly by the system } static void prv_main(void) { prv_handle_init(); app_event_loop(); prv_handle_deinit(); } const PebbleP...
FLASH_REGION_SHARED_PRF_STORAGE_END - \ FLASH_REGION_SHARED_PRF_STORAGE_BEGIN) #define SPRF_NUM_PAGES (SPRF_REGION_SIZE / sizeof(SharedPRFData)) #define SPRF_PAGE_FLASH_ADDR(idx) (FLASH_REGION_SHARED_PRF_STORAGE_BEGIN + \ (idx * sizeof(SharedPRFData))) // ...
flash_write_bytes((uint8_t *)data, prv_current_page_flash_addr(), sizeof(*data))
; } } static void prv_erase_region_and_save(SharedPRFData *data) { flash_region_erase_optimal_range_no_watchdog(FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, FLASH_REGION_SHARED_PRF_STORAGE_BEGIN, FLASH_REGION_SHARED_PRF_STORAGE...
ext_out_animation = property_animation_create_layer_frame(&data->info_text_layer.layer, &pair_text_area, &below_pair_text); PBL_ASSERTN(data->info_text_out_animation); animation = property_animation_get_animation(data->info_text_out_animation); animation_set_a...
prv_has_device_name(data)
tes_available = circular_buffer_write_prepare(&s_rx_buffer, &rx_buffer_ptr); prv_unlock(); // OK to use the stack for these variables, // because ad_spi_complex_transact blocks until transfer is completed: SPITransportMsgStatus remote_status_in = {}; SPITransportMsgStatus local_status_out = { .msg_id = S...
if (has_more_rx_data && !should_continue_to_rx_data) { HOST_TRANSPORT_DEBUG_LOG("Host Transport Receive Buffer Full, exiting from rx'ing to process"); }
prv_lock(); circular_buffer_write_finish(&s_rx_buffer, rx_len); // Check if more data is available in the circular buffer. // If not, flip s_is_transacting back while the lock is taken. Otherwise, a concurrent call to // host_transport_tx_enqueue() would be prevented to unblock the transaction loop again. ...
rviceTagUnitTest)); cl_assert_equal_i(1, app_inbox_service_num_failed_for_tag(AppInboxServiceTagUnitTest)); } void test_app_inbox__app_inbox_service_begin_not_enough_storage_space(void) { prv_create_test_inbox(); cl_assert_equal_b(false, app_inbox_service_begin(AppInboxServiceTagUnitTest, ...
{ prv_create_test_inbox_and_begin_write(); // Start writing a message that occupies the complete buffer, then cancel it: cl_assert_equal_b(true, app_inbox_service_write(AppInboxServiceTagUnitTest, s_test_data, BUFFER_SIZE)); app_inbox_service_cancel(AppInboxSer...
void test_app_inbox__app_inbox_service_cancel_non_existing_inbox(void) { app_inbox_service_cancel(AppInboxServiceTagUnitTest); // No events expected: assert_num_callback_events(0); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Consuming writes void ...
gging.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_sleep.h" #include "stubs_syscall_internal.h" #include "stubs_system_reset.h" #include "stubs_task_watchd...
(tmbuf, sizeof(tmbuf), "%R %t %T", &jan_2_2015__13_00_00)
; cl_assert_equal_s(tmbuf, "13:00 \t 13:00:00"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%u %V", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "5 01"); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%z", &jan_2_2015__13_00_00); cl_assert_equal_s(tmbuf, "+0000"); #endif tmbuf[0] = '\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...
(gfx_test_update_proc)
; } PROFILER_STOP; PROFILER_PRINT_STATS; if (test->teardown) { test->teardown(layer->window); } app_timer_register(0, prv_pop_test_window, app_data); } static void prv_start_test(GfxTest *test, AppData *app_data) { app_data->current_test = test; Window *window = &app_data->test_window; window_i...
uuid_meta(void) { PPoGATTMetaV0 meta_invalid_uuid = s_meta_v0_system; meta_invalid_uuid.app_uuid = UUID_INVALID; prv_notify_services_discovered(1); ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], (const uint8_t *) &meta_invalid_uuid, ...
prv_notify_services_discovered(1)
; ppogatt_handle_read_or_notification(s_characteristics[0][PPoGATTCharacteristicMeta], (const uint8_t *) &s_meta_v0_system, sizeof(s_meta_v0_system), BLEGATTErrorSuccess); // Expect subscribe request w...
ill_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 support for non-antialiased rounded rect #if SCREEN_COLOR_DEPTH_BITS == 8 set...
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); cl_assert_equal_i(prv_clamp_corner_radius(GSize(10, 10), GCornersAll, 4), 4); }...