prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
ax_width_px = text_box->box.size.w, .height_px = fonts_get_font_height(text_box->font) }; Iterator line_iter; line_iter_init(&line_iter, &ctx->text_draw_state.line_iter_state, ctx); prv_walk_lines_down(&line_iter, layout, callbacks); } static void prv_graphics_text_layout_update(GContext* ctx, const char...
(ctx, text, font, box, overflow_mode, alignment, text_layout)
; return text_layout->max_used_size; } void graphics_draw_text(GContext* ctx, const char* text, GFont const font, GRect box, const GTextOverflowMode overflow_mode, const GTextAlignment alignment, GTextLayoutCacheRef const layout) { if (ctx->lock) { return; } ...
entry_offset, num_bytes); if (!num_bytes) { return 0xFFFFFFFF; } return entry->impl->get_crc(entry, num_bytes, entry_offset); } T_STATIC uint32_t prv_get_store_length(ResourceStoreEntry *entry, ResourceManifest *manifest) { // Get the resource entry for the last entry ResTableEntry res_entry = {0}; if...
prv_get_store_entry(app_num, 0, &entry)
; if (entry.impl) { entry.impl->clear(&entry); } } static bool prv_get_manifest_by_id(ResAppNum app_num, uint32_t resource_id, ResourceManifest *manifest) { ResourceStoreEntry entry; prv_get_store_entry(app_num, resource_id, &entry); if (!entry.impl) { return false;...
/* * 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...
{ Uuid *removed_id = kernel_malloc(sizeof(Uuid)); if (!removed_id) { return; } *removed_id = *reminder_id; PebbleEvent event = { .type = PEBBLE_REMINDER_EVENT, .reminder = { .type = type, .reminder_id = removed_id, } }; event_put(&event); }
void reminders_handle_reminder_updated(const Uuid *reminder_id) { prv_put_reminder_event((ReminderId *)reminder_id, ReminderUpdated); } void reminders_handle_reminder_removed(const Uuid *reminder_id) { prv_put_reminder_event((ReminderId *)reminder_id, ReminderRemoved); } static void prv_trigger_reminder_system_...
* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distribut...
cl_assert(!alerts_should_notify_for_type(AlertReminder))
; } void test_alerts__migration(void) { cl_assert(alerts_get_mask() == AlertMaskAllOn); alerts_set_mask(AlertMaskAllOnLegacy); cl_assert(alerts_get_mask() == AlertMaskAllOn); } void test_alerts__dnd_interruptions(void) { s_dnd_active = true; alerts_set_dnd_mask(AlertMaskAllOff); alerts_set_mask(AlertMas...
pbl_malloc.h" #include "comm/bt_lock.h" #include "gap_le_scan.h" #include "kernel/events.h" #include "system/hexdump.h" #include "system/logging.h" #include "system/passert.h" #include "util/circular_buffer.h" #include "util/likely.h" #include <btutil/bt_device.h> #include <string.h> // -----------------------------...
(&s_circular_buffer)
; // While there are reports to read and there is enough space for at least // the GAPLERawAdReport header: while (read_space && write_space >= sizeof(GAPLERawAdReport)) { // First copy the header. We know for sure this will fit into buffer, // because it was tested in the while() condition: ...
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[Fetche...
(missed_call_pin)
; } cleanup: ios_notif_pref_db_free_prefs(app_notif_prefs); } void ancs_notifications_handle_notification_removed(uint32_t ancs_uid, ANCSProperty properties) { // Dismissal from phone is only properly supported on iOS 9 and up // The presence of the DIS service tells us we have at least iOS 9 const bool ios...
timeline_init(&head)
, S_SUCCESS); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1430236800 - 60 * 60), S_SUCCESS); const time_t midnight_apr_28_pst = 1430208000; cl_assert_equal_i(state.node->timestamp, midnight_apr_28_pst); } void test_timeline__all_day_ios_bug_2(void) { Timel...
/* * 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...
grect_align(&rect, &bounds, GAlignRight, false)
; // Offset the button halfway off-screen rect.origin.x += radius; // Further offset the button on a per-default-content-size basis // Note that this will need to be updated if we ever want ActionButton to adapt to the user's // preferred content size rect.origin.x += PREFERRED_CONTENT_SIZE_SWITCH(Preferr...
if (!prv_matches_system_locale(locale)) { if (error) { *error = rocky_error_argument_invalid("Unsupported locale"); } return 0; }
bool is_24h_style = clock_is_24h_style(); const ToStringFormat format = prv_parse_to_string_format(options, default_format, mask, &is_24h_style); if (format == ToStringFormatUnsupported) { if (error) { *error = rocky_error_argument_invalid("Uns...
e rail to stabilize before continuing to use the device. // It takes 2.6ms for the LDO rails to ramp. delay_ms(3); return true; } return false; } } else { if (*ref_count <= 1) { // Set the register byte to XXXXX00X to disable the rail, just mask register_value ...
if (BOARD_CONFIG_POWER.rail_6V6_ctrl.gpio) { gpio_output_set(&BOARD_CONFIG_POWER.rail_6V6_ctrl, enabled); }
}
we reload the layout .fallback_id = fallback_icon_id, }; peek_layer_set_icon(data->peek_layer, &data->peek_icon_info); peek_layer_set_background_color(data->peek_layer, colors->bg_color); // This is so that only the banner of the swap_layer is sticking out from the bottom GRect swap_frame = ((Layer *)&d...
{ data->notification_app_id = pin.header.parent_id; }
const LayoutId layout_id = (type == NotificationMobile) ? LayoutIdNotification : LayoutIdReminder; NotificationLayoutInfo layout_info = (NotificationLayoutInfo) { .item = item, .show_notification_timestamp = !prv_should_pop_due_to_inactivity() }; const LayoutLayerConfig config = { .frame = &data->...
*out_ms) { return 0; } void workout_push_summary_window(void) { return; } static WorkoutData s_workout_data; static WorkoutController s_workout_controller = { .is_paused = workout_service_is_paused, .pause = workout_service_pause_workout, .stop = workout_service_stop_workout, .update_data = workout_data_...
(window, &s_ctx)
; } // Workout Tests ////////////////////// void test_workout_active__workout_render_no_data(void) { s_workout_data = (WorkoutData) {}; WorkoutActiveWindow *active_window = workout_active_create_for_activity_type( ActivitySessionType_Run, &s_workout_data, &s_workout_controller); prv_create_window_and_rend...
(quality_tl, "Loading...")
; layer_add_child(&window->layer, &quality_tl->layer); const uint32_t inbox_size = 64; const uint32_t outbox_size = 256; AppMessageResult result = app_message_open(inbox_size, outbox_size); if (result != APP_MSG_OK) { PBL_LOG(LOG_LEVEL_ERROR, "Unable to open app message! %i %s", result, prv_t...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_LOG(LOG_LEVEL_INFO, "Core Dump connect response received"); return true; }
} PBL_LOG(LOG_LEVEL_ERROR, "Failed to connect with BLE chip to collect coredump"); return false; } static void prv_int_exti_cb(bool *should_context_switch) { xSemaphoreGiveFromISR(s_spi_int_semph, NULL); } static void prv_dma_cb(bool *should_context_switch) { portBASE_TYPE was_higher_task_woken = false; ...
x_size.h = fixed_lines ? (fixed_lines * (fonts_get_font_height(text_node->font) + line_spacing_delta) - line_spacing_delta) : 0; text_node->overflow = GTextOverflowModeTrailingEllipsis; text_node->alignment = PBL_IF_RECT_E...
{ GTextNodeText *text_node = prv_create_text_node_buffer(NULL); prv_set_text_node_text_parameters_from_config(text_node, layout, config); return text_node; }
static void prv_setup_container_node_from_config( GTextNodeContainer *container_node, const LayoutLayer *layout, const LayoutNodeContainerConfig *config) { const uint16_t num_nodes = config->num_nodes; for (int i = 0; i < num_nodes; i++) { GTextNode *node = layout_create_text_node_from_config(layout, ...
= NULL, }, .allocated_buffer = NULL, }, { .header = { // [2] .id = {0x6b, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb3}, .parent_id = {0}, .timestamp = 1421183642, // Tue Jan 13 13:14:02 2015 PST .duration = 2, ...
cl_assert(uuid_equal(&s_items[s_correct_order[1]].header.id, &timeline_model_get_iter_state(0)->pin.header.id))
; cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(1)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(...
NUM_FETCHED_APP_ATTRIBUTES, app_attrs, &error); if (!complete || error) { PBL_LOG(LOG_LEVEL_WARNING, "Error parsing app attributes"); goto fail; } // cache the app name ANCSAttribute *app_id = ...
(request_buffer)
; bool retrying = (s_ancs_client->state == ANCSClientStateRetrying); prv_set_state(ANCSClientStateRequestedNotification); bool success = prv_write_control_point_request((const CPDSMessage *) request_buffer->data, request_buffer->bytes_written); kernel_free(req...
tSBoxValue(tempa[3]); } } RoundKey[i * 4 + 0] = RoundKey[(i - Nk) * 4 + 0] ^ tempa[0]; RoundKey[i * 4 + 1] = RoundKey[(i - Nk) * 4 + 1] ^ tempa[1]; RoundKey[i * 4 + 2] = RoundKey[(i - Nk) * 4 + 2] ^ tempa[2]; RoundKey[i * 4 + 3] = RoundKey[(i - Nk) * 4 + 3] ^ tempa[3]; } } // This function ...
{ for(j=0;j<4;++j) { (*state)[j][i] = getSBoxInvert((*state)[j][i]); } }
} static void InvShiftRows(void) { uint8_t temp; // Rotate first row 1 columns to right temp=(*state)[3][1]; (*state)[3][1]=(*state)[2][1]; (*state)[2][1]=(*state)[1][1]; (*state)[1][1]=(*state)[0][1]; (*state)[0][1]=temp; // Rotate second row 2 columns to right temp=(*state)[0][2]; (*state)[0][...
ionForecast) { .is_current_location = entry->is_current_location, .current_temp = entry->current_temp, .today_high = entry->today_high_temp, .today_low = entry->today_low_temp, .current_weather_type = entry->current_weather_type, .tomorrow_high = entry->tomorrow_high_temp, .tomorrow_low = en...
task_zalloc_check(sizeof(WeatherLocationForecast))
; if (prv_fill_forecast_from_entry(entry, forecast_out)) { s_default_forecast = forecast_out; } else { task_free(forecast_out); } free_entry: task_free(entry); cleanup: mutex_unlock(s_mutex); } WeatherLocationForecast *weather_service_create_default_forecast(void) { mutex_lock(s_mutex); WeatherL...
fg_text_buffer[5]; TextLayer *fg_color_text; char fg_color_text_buffer[20]; uint8_t fg_color_index; TextLayer *bg_text; char bg_text_buffer[5]; TextLayer *bg_color_text; char bg_color_text_buffer[20]; uint8_t bg_color_index; } AppData; static void set_text_element(TextLayer *text_layer, char *text_bu...
(ctx, point)
; graphics_context_set_stroke_color(ctx, bg_color); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y)); graphics_draw_pixel(ctx, GPoint(point.x, point.y + 1)); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y + 1)); } else if (alpha == ALPHA_0) { graphics_context_set_stroke_color(ctx, bg_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...
{ bmi160_init(); bmi160_set_accel_power_mode(BMI160_Accel_Mode_Normal); mag3110_init(); }
void imu_power_up(void) { // Unused in snowy as PMIC turns on everything } void imu_power_down(void) { // Unused in snowy as PMIC turns off everything }
/* * 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...
{ syscall_assert_userspace_buffer(handler, sizeof(*handler)); syscall_assert_userspace_buffer(state, sizeof(*state)); }
// Remove from handlers list list_remove(&handler->list_node, NULL, NULL); if (list_find(&state->list_node, event_service_filter, (void *) handler->type)) { // there are other handlers for this task, don't unsubscribe it return; } // Get info PebbleTask task = pebble_task_get_current(); // Unsu...
lls.num_calls < 2) { prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("rescheduled count: %d\n", s_stopped_handler_calls.num_calls); DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start_ms, layer.frame.origin.x, layer.frame.origin.y, layer.frame.size.w, laye...
(&s_stopped_handler_calls, animation, finished, context)
; animation_unschedule(animation); } // -------------------------------------------------------------------------------------- // Test that animation_unschedule can be called from the stopped handler void test_animation__unschedule_from_stopped_handler(void) { Animation *h; const int duration = 100; const An...
_system_capabilities); } static void prv_delete_all_pairings_itr(SettingsFile *old_file, SettingsFile *new_file, SettingsRecordInfo *info, void *context) { if (info->key_len == sizeof(BTBondingID)) { // Skip pairing entries return; } // Re-write non-pairing entrie...
("key or val of 0 length")
stack_pop(stack, false); cl_assert_equal_i(window_stack_count(stack), 0); // Ensure the disappear handler was called cl_assert_equal_i(prv_get_appear_disappear_count(), 0); // Ensure the unload handler was called cl_assert_equal_i(prv_get_load_unload_count(), 0); } void test_window_stack__dump(void) { W...
prv_get_load_unload_count()
, 1); } // Description: // In this test we push two windows that push windows during their unload handlers. // We want to verify that those two windows stay on the stack after calling // `window_stack_pop_all`. void test_window_stack__push_during_window_unload_multiple(void) { Window *window1 = window_create(); Wi...
yer) {} ContentIndicator s_content_indicator; ContentIndicator *content_indicator_get_for_scroll_layer(ScrollLayer *scroll_layer) { return &s_content_indicator; } ContentIndicator *content_indicator_get_or_create_for_scroll_layer(ScrollLayer *scroll_layer) { return &s_content_indicator; } static bool s_content_av...
menu_layer_set_selected_index(&l, MenuIndex(0, 0), MenuRowAlignTop, true)
; cl_assert_equal_i(0, menu_layer_get_selected_index(&l).row); cl_assert(l.animation.animation); } int16_t prv_get_row_height_depending_on_selection_state(struct MenuLayer *menu_layer, MenuIndex *cell_index, ...
true; app_manager_close_current_app(true /* gracefully */); // The second app should now be running. cl_assert(app_manager_get_current_app_md() == (PebbleProcessMd*) &s_third_party_app); app_manager_get_task_context()->safe_to_kill = false; } void test_app_manager__start_third_party_and_crash_back_to_root(voi...
app_manager_close_current_app(true /* gracefully */)
; cl_assert_equal_b(app_manager_is_watchface_running(), true); // Check that launching a new app resets the exit reason to the default reason cl_assert_equal_b( app_manager_launch_new_app(&(AppLaunchConfig) { .md = &s_third_party_app.common, }), true); cl_assert_equal_i(app_exit_reaso...
)); #endif } // Tests APNG file with 8-bit color, 88 frames of delay 100ms each and loop = 2 // Tests gbitmap_sequence_update_bitmap_by_elapsed // Result: // - gbitmaps matches platform decoded APNG void test_gbitmap_sequence__color_8bit_fight(void) { #if PLATFORM_SPALDING bool status = false; uint32_t resource...
cl_assert(resource_id != UINT32_MAX)
; GBitmapSequence *bitmap_sequence = gbitmap_sequence_create_with_resource(resource_id); cl_assert(bitmap_sequence); GBitmap *bitmap = gbitmap_create_blank(GSize(180, 180), GBitmapFormat8BitCircular); cl_assert(bitmap); // Since frame 1 has 0 delay, it renders then immediately we render frame 2 gbitmap_s...
HOST_TRANSPORT_HOST_TX_BUFFER_SIZE]; static SPITransportMsgFooter DMA_READ_BSS s_spi_tx_footer; static SPITransportMsgStatus DMA_READ_BSS s_spi_status_local; static SPITransport DMA_BSS s_spi_transport; static bool s_is_host_transport_initialized; static void prv_give_semamphore_from_isr(bool *should_context_switch);...
prv_give_semamphore_from_isr(should_context_switch)
next(cursor))) { response_len_chars++; } } AnalyticsEvent event_type; if (!data->show_confirmation_dialog) { event_type = AnalyticsEvent_VoiceTranscriptionAutomaticallyAccepted; } else if (success) { event_type = AnalyticsEvent_VoiceTranscriptionAccepted; } else { event_type = Analytics...
prv_push_error_dialog(data, i18n_noop("Dictation is not available."), RESOURCE_ID_GENERIC_WARNING_LARGE, GColorRed)
; } static void prv_show_error_dialog(VoiceUiData *data, const char *msg) { if (data->show_error_dialog) { if (data->error_count == MAX_ERROR_COUNT) { data->error_exit_status = DictationSessionStatusFailureSystemAborted; prv_push_final_error_dialog(data); } else { const GColor dialog_bg...
X(0x4682b4)}, {"tan", GColorARGB8FromHEX(0xd2b48c)}, {"thistle", GColorARGB8FromHEX(0xd8bfd8)}, {"tomato", GColorARGB8FromHEX(0xff6347)}, {"turquoise", GColorARGB8FromHEX(0x40e0d0)}, {"violet", GColorARGB8FromHEX(0xee82ee)}, {"wheat", GColorARGB8FromHEX(0xf5deb3)}, {"whitesmoke", GColorARGB8FromHEX(0xf5f5...
if (ch >= 'a' && ch <= 'f') { ch = ch - 'a' + 10; } else { // This will also catch '\0' return false; }
0x01}, .parent_id = {0xff, 0xf6, 0x21, 0x5b, 0xc9, 0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0x01}, .timestamp = 3, .duration = 0, .type = TimelineItemTypeReminder, .layout = LayoutIdTest, }, }; static TimelineItem item3 = { .header = { .id = {0x7c, 0x65, 0x2...
cl_assert(memcmp(&item1, &temp, sizeof(TimelineItem)) == 0)
; cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */)); cl_assert(reminder_db_get_len((uint8_t *)&item1.header.id, sizeof(Uuid)) == 0); // check item 2 memset(&temp, 0, sizeof(TimelineItem)); cl_assert(S_SUCCESS == reminder_db_next_item_header(&temp)); cl_assert(uuid_equa...
/* * 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...
list_contains(buffer->clients, &client->list_node)
); buffer->clients = list_prepend(buffer->clients, &client->list_node); client->read_index = buffer->write_index; return true; } // ------------------------------------------------------------------------------------------------- void shared_circular_buffer_remove_client(SharedCircularBuffer* buffer, SharedCirc...
ta->app_uuid); if (existing_client) { PBL_LOG(LOG_LEVEL_ERROR, "Found PPoGATT server with same UUID. Keeping only the last one."); prv_delete_client(existing_client, true /* is_disconnected */, DeleteReason_DuplicateServer); } client->state = StateDisconnectedSubscribingData; c...
{ bt_lock(); bool can_handle = (prv_find_client_with_characteristic(characteristic, NULL) != NULL); bt_unlock(); return can_handle; }
ppId_ValidApp, TimelineResourceTestAppIdInvalid, TimelineResourceTestAppIdCount = TimelineResourceTestAppIdInvalid - 1 } TimelineResourceTestAppId; static const TimelineResourceTestAppData s_test_apps[TimelineResourceTestAppIdCount] = { { .install_entry = { .install_id = TimelineResourceTestAppId_AppW...
{ return entry->install_id; }
} // Setup ///////////////////////// void test_timeline_resources__initialize(void) { s_is_app_published_resource_invalid = false; } // Tests ///////////////////////// void test_timeline_resources__get_id_system(void) { AppResourceInfo res_info; // Calling the function with an invalid TimelineResourceId sho...
rage_set_getting_started_complete(GETTING_STARTED_COMPLETE); shared_prf_storage_set_local_device_name(DEVICE_NAME); for (uint32_t i = 0; i < 50; i++) { GETTING_STARTED_COMPLETE = !GETTING_STARTED_COMPLETE; cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), i % SPRF_NUM_PAGES); shared_prf_st...
cl_assert_equal_i(shared_prf_storage_get_valid_page_number(), 0)
; SharedPRFData data; flash_read_bytes((uint8_t *)&data, SPRF_PAGE_FLASH_OFFSET(shared_prf_storage_get_valid_page_number()), sizeof(data)); cl_assert(data.getting_started.crc != 0xFFFFFFFF); uint32_t new_crc = 0; flash_write_bytes((uint8_t *)&new_crc, ...
veKCalories, Wednesday, 33); activity_get_metric(ActivityMetricActiveKCalories, 2, metric_values); cl_assert_equal_i(metric_values[0], 22); cl_assert_equal_i(metric_values[1], 33); cl_assert_equal_i(activity_metrics_prv_get_active_calories(), 22 * ACTIVITY_CALORIES_PER_KCAL); activity_metrics_prv_set_metric(...
fake_system_task_callbacks_invoke_pending()
; // No sessions active, ensure that asking if a sleep session is ongoing returns false cl_assert_equal_b(false, activity_sessions_is_session_type_ongoing(ActivitySessionType_Sleep)); cl_assert_equal_i(0, health_service_peek_current_activities()); // Start on known boundary struct tm start_tm = { // Jan...
client->handle_read_or_notification(header.characteristic, buffer, header.value_length, BLEGATTErrorSuccess); } else { PBL_LOG(LOG_LEVEL_DEBUG, "No client to handle GATT notification from characteristic %p", (void*) header.characteristic); } ...
(LOG_LEVEL_DEBUG, "PEBBLE_BLE_SCAN_EVENT")
; return; case PEBBLE_BLE_CONNECTION_EVENT: prv_handle_connection_event(&e->bluetooth.le.connection); return; case PEBBLE_BLE_GATT_CLIENT_EVENT: if (e->bluetooth.le.gatt_client.subtype == PebbleBLEGATTClientEventTypeServiceChange) { prv_handle_gatt_service_discovery_event(&e->b...
}; #include "profiler_list.h" #undef PROFILER_NODE #if PROFILE_INTERRUPTS #define IRQ_DEF(idx, irq) ProfilerNode g_profiler_node_##irq##_IRQ = {.module_name = #irq"_IRQ"}; #include "irq_stm32.def" #undef IRQ_DEF #endif static ProfilerNode *s_profiler_nodes[] = { #define PROFILER_NODE(name) &g_profiler_node_##name, #in...
while (sorted != NULL) { ListNode *new_head = list_pop_head(sorted); list_append(g_profiler.nodes, sorted); sorted = new_head; }
} void command_profiler_stop(void) { PROFILER_STOP; PROFILER_PRINT_STATS; } void command_profiler_start(void) { PROFILER_INIT; PROFILER_START; } void command_profiler_stats(void) { PROFILER_PRINT_STATS; }
will always be at least sizeof(s_log_buffer_ram). uint32_t start_addr = (uint32_t)s_log_buffer_ram; uint32_t end_addr = (uint32_t)&__ble_vars_start__; uint32_t available_ram = end_addr - start_addr; uint16_t circular_buffer_size = sizeof(s_log_buffer_ram); if (circular_buffer_size < available_ram) { cir...
if (str1_len) { // length + strlen(string) + padding (round up to nearest uint32_t). msg_size += 1 + str1_len + (3 - (1 + str1_len + 3) % 4); }
if (str2_len) { // length + strlen(string) + padding (round up to nearest uint32_t). msg_size += 1 + str2_len + (3 - (1 + str2_len + 3) % 4); } } // Buffer for UART ASCII log output char expanded_fmt_buffer[64]; memset(expanded_fmt_buffer, 0, sizeof(expanded_fmt_buffer)); // Craft a buf...
{ 640, -312, -552}, { 600, 480, 312}, { 1040, 944, -288}, { 144, 2528, -536}, { 744, 1160, 872}, { 112, -2464, 1400}, { -96, -1688, -872}, { 272, 1344, -1432}, { -88, -1376, -136}, { 24, -288, -1064}, { -64, -888, -680}, { -64, -688, -672}, { -96, -776, -680}, { -...
{ 568, 64, -760}, { 576, 56, -752}, { 576, 56, -752}, { 568, 56, -752}, { 576, 80, -752}, { 576, 48, -752}, { 576, 56, -752}, // 32 seconds { 576, 56, -760}, { 568, 24, -752}, { 576, 40, -776}, { 576, 72, -752}, { 568, 88, -768}, { 560, 64, -760}, { 560, 72, -...
{ 568, 96, -752}, { 568, 88, -760}, { 576, 88, -752}, { 568, 96, -760}, { 576, 80, -744}, { 576, 88, -752}, { 568, 104, -760}, { 576, 104, -752}, { 568, 96, -752}, { 568, 88, -760}, { 560, 64, -752}, { 560, 72, -752}, // 35 seconds { 568, 88, -752}, { 568, 96...
void test_timeline_peek_event__calendar_event_all_day(void) { ADD_EVENT( .item = &s_all_day_item ); CHECK_NO_EVENTS( .count = 2, .is_future_empty = true ); } void test_timeline_peek_event__weather_event(void) { ADD_EVENT( .item = &s_weather_item ); CHECK_EVENT( .count = 2, .item_id = s_weather_item.header.id...
(10 * SECONDS_PER_MINUTE)
; ADD_EVENT( .item = &s_item3 ); CHECK_EVENT( .count = 2, .item_id = s_item3.header.id, .num_concurrent = 0, .timeout_ms = 4 * SECONDS_PER_MINUTE * MS_PER_SECOND, .time_type = TimelinePeekTimeType_ShowStarted, .is_first_event = true ); } void test_timeline_peek_event__after_event_pass...
ndler(device.opaque, BLEClientServicesAdded, services, num_services, status); } } // TODO (PBL-22086): We should really make this easier to do ... // We can't directly dereference the service discovery info pointer from third // party apps because it was malloc'ed from the kernel heap. Instead copy the // info that ...
if (!value) { gatt_error = BLEGATTErrorLocalInsufficientResources; value_length = 0; }
= (ScrollLayer){}; layer_init(&scroll_layer->layer, frame); const GRect *bounds = &scroll_layer->layer.bounds; scroll_layer->layer.property_changed_proc = scroll_layer_property_changed_proc; layer_init(&scroll_layer->content_sublayer, bounds); layer_add_child(&scroll_layer->layer, &scroll_layer->content_sub...
{ property_animation_init(scroll_layer->animation, &implementation, scroll_layer, NULL, &offset); if (was_running && !scroll_layer_get_paging(scroll_layer)) { animation_set_curve(animation, AnimationCurveEaseOut); } }
else { scroll_layer->animation = property_animation_create(&implementation, scroll_layer, NULL, &offset); animation = property_animation_get_animation(scroll_layer->animation); if (scroll_layer_get_paging(scroll_layer)) { animation_set...
/* * 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(PWR, RCC_APB1Periph_PWR)
; }
= 0x7f)) { // Backspace if (s_dbgserial_prompt_context.write_index != 0) { s_dbgserial_prompt_context.write_index--; dbgserial_putchar(0x8); // move cursor back one character dbgserial_putchar(0x20); // replace that character with a space, advancing the cursor dbgserial_putchar(0x8); // move...
pulse_send_message(PROMPT_RESP_ACK, NULL)
; s_latest_cookie = command->cookie; s_executing_command = ExecutingCommandPulse; // Discount the size of the cookie size_t command_length = length - sizeof(PromptCommand); strncpy(s_dbgserial_prompt_context.buffer, command->command, command_length); s_dbgserial_prompt_context.buffer[command_length] = 0; ...
===================================================== // Timeline stubs static Uuid s_last_timeline_id; bool timeline_add(TimelineItem *item) { s_last_timeline_id = item->header.id; s_data.pins_added++; return true; } bool timeline_remove(Uuid *id) { s_data.pins_removed++; return true; } bool timeline_exist...
(rtc_get_time())
; cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); // Make sure we don't trigger as soon as we're awake s_data.metric_history[ActivityMetricSleepState][0] = ActivitySleepStateAwake; s_data.metric_history[ActivityMetricSleepStateSeconds][0] = 1 * SECONDS_PER_HOUR; activity_...
timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(4)); cl_assert(timeline_model_i...
(!timeline_model_iter_next(NULL, NULL))
; cl_assert(!timeline_model_iter_prev(NULL, NULL)); } void test_timeline_model__is_empty(void) { TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; time_t first_time = 1421178000; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 timeline_model_init(first_time, &model); cl_assert...
#if PBL_COLOR if (ctx->draw_state.antialiased) { if (ctx->draw_state.stroke_width > 1) { // Antialiased and Stroke Width > 1 // Note: stroke width == 2 is rounded down to stroke width of 1 prv_draw_round_rect_aa_stroked(ctx, rect, radius, ctx->draw_state.stroke_width); return;...
PBL_ASSERTN(ctx)
; if (ctx->lock) { return; } #if PBL_BW color = gcolor_get_bw(color); #else color = gcolor_closest_opaque(color); #endif ctx->draw_state.text_color = color; } void graphics_context_set_text_color_2bit(GContext* ctx, GColor2 color) { graphics_context_set_text_color(ctx, get_native_color(color...
/* * 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...
(GColorBlack.g == 0b00)
; cl_assert(GColorBlack.b == 0b00); cl_assert(GColorBlack.a == 0b11); } void test_graphics_colors__white(void) { cl_assert(GColorWhite.r == 0b11); cl_assert(GColorWhite.g == 0b11); cl_assert(GColorWhite.b == 0b11); cl_assert(GColorWhite.a == 0b11); } void test_graphics_colors__red(void) { cl_assert(GCol...
(ProcessStorageBuiltin, music_md->process_storage); app_install_release_md(music_md); const PebbleProcessMd *sports_md = app_install_get_md(sports_id, false); cl_assert(sports_md != NULL); cl_assert_equal_b(false, sports_md->has_worker); cl_assert_equal_i(ProcessTypeApp, sports_md->process_type); cl_assert...
fake_rtc_increment_time(10 * SECONDS_PER_MINUTE)
; // Ensure it hasn't expired cl_assert_equal_b(true, app_install_is_prioritized(music_id)); // Manually expire app_install_unmark_prioritized(music_id); cl_assert_equal_b(false, app_install_is_prioritized(music_id)); }
cl_assert_equal_m(data_out, TEST_DATA + (offset % sizeof(TEST_DATA)), sizeof(data_out))
; } void test_session_send_queue__copy_overlapping_multiple_jobs_with_offset(void) { int num_jobs = 3; prv_add_jobs(num_jobs); uint8_t data_out[2 * sizeof(TEST_DATA)]; memset(data_out, 0, sizeof(data_out)); int offset = 1; cl_assert_equal_i(sizeof(data_out), comm_session_send_queue_cop...
/* * 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_create_undefined()
; } JERRY_FUNCTION(prv_console_log) { return prv_log(APP_LOG_LEVEL_INFO, argc, argv); } JERRY_FUNCTION(prv_console_warn) { return prv_log(APP_LOG_LEVEL_WARNING, argc, argv); } JERRY_FUNCTION(prv_console_error) { return prv_log(APP_LOG_LEVEL_ERROR, argc, argv); } static void prv_init(void) { bool was_created...
w(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 3); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 3); graphics_d...
setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, false, 2)
; graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, false, 2); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_...
ng_confirm_handle_request(const PairingUserConfirmationCtx *ctx, const char *device_name, const char *confirmation_token) { } void bt_driver_cb_pairing_confirm_handle_completed(const PairingUserConfirmationCtx *ctx, ...
(&device_out, &pairing_1.identity, sizeof(device_out))
; // Re-pair device 1 again: // In case the device is the same as the existing pairing, make sure the operation is "change" // and not "delete" to avoid disconnecting just because the existing pairing is deleted. // For bug details see https://pebbletechnology.atlassian.net/browse/PBL-24690 prv_reset_change...
Helper Functions //////////////////////////////////// #include "test_graphics.h" #include "${BIT_DEPTH_NAME}/test_framebuffer.h" // Stubs //////////////////////////////////// #include "graphics_common_stubs.h" #include "stubs_applib_resource.h" static FrameBuffer *fb = NULL; // Setup void test_graphics_stroke_circle...
(&ctx.dest_bitmap, "stroke_circle_origin_aa_r3_no_clip.${BIT_DEPTH_NAME}.pbi")
/* * 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...
(&BOARD_CONFIG_POWER.pmic_int_gpio, GPIO_PuPd_UP)
handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, d), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_...
(animation_get_duration(a, false, false), duration_a)
; cl_assert_equal_i(animation_get_duration(a, false, true), play_count_a * duration_a); cl_assert_equal_i(animation_get_duration(a, true, false), delay_a + duration_a); cl_assert_equal_i(animation_get_duration(a, true, true), total_duration_a); cl_assert_equal_i(animation_get_duration(b, false, false), duratio...
in = pin_config.gpio_pin; gpio_init_struct.GPIO_Mode = GPIO_Mode_AF; gpio_init_struct.GPIO_Speed = GPIO_Speed_50MHz; gpio_init_struct.GPIO_OType = GPIO_OType_OD; gpio_init_struct.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(pin_config.gpio, &gpio_init_struct); GPIO_PinAFConfig(pin_config.gpio, pin_config.gpio_p...
(i2c_buses[bus_idx].i2c)
; periph_config_disable(RCC_APB1PeriphClockCmd, BOARD_CONFIG.i2c_bus_configs[bus_idx].clock_ctrl); // Do not de-power rail if there are still devices using bus (just reset peripheral and pin configuration during a bus reset) if (i2c_buses[bus_idx].user_count == 0) { bus_rail_power_down(bus_idx); } else ...
/* * 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(parent.first_child == &child_c)
); animation_set_duration(b, duration_b); // Create a sequence Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); animation_set_play_count(seq, play_count_seq); // Check the duration cl_assert_equal_i(animation_get_duration(seq, true, true), 0); prv_clear_handler_historie...
(&s_teardown_handler_calls, b)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a),...
xtNodeCustom *heart_node; if (active_window->workout_controller->get_metric_value( metric_type, active_window->workout_data) > 0) { const size_t buffer_size = sizeof("000"); GTextNodeText *number_text_node = health_util_create_text_node(buffer_size, number_font, ...
health_util_create_text_node(buffer_size, number_font, TEXT_COLOR, container)
; active_window->workout_controller->metric_to_string(metric_type, (char *)number_text_node->text, buffer_size, i18n_owner, active_window->workout_data); if (strlen(number_text_node->text) > 5) { // text is long so use smaller font number_text_node->font = prv_get_number_font(fals...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return prv_format_time(buffer, buffer_size, i18n_noop("%p"), timestamp); }
} size_t clock_format_time(char *buffer, uint8_t size, int16_t hours, int16_t minutes, bool add_space) { if (size == 0 || buffer == NULL) { return 0; } bool is24h = clock_is_24h_style(); const char *format; // [INTL] you want to have layout resources that specify time formatti...
in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "reminder_db.h" #include "sync.h" #...
(&header, context)
) { timeline_item_free_allocated_buffer(reminder); return true; // continue iteration } reminder_info->match = true; return false; // stop iteration } bool reminder_db_find_by_timestamp_title(time_t timestamp, const char *title, TimelineItemStorageFilterCallback ...
iph_HASH | RCC_AHB2Periph_RNG | RCC_AHB2Periph_OTGFS; const uint32_t ahb3_periphs = RCC_AHB3Periph_FMC | RCC_AHB3Periph_QSPI; const uint32_t apb1_periphs = RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM4| RCC_APB1Periph_TIM5 | RCC_APB1Periph_TIM6 | RCC_APB1Periph_TIM7 | RCC_APB1Periph_TI...
boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE)
; break; case 6: boot_bit_clear(BOOT_BIT_RESET_LOOP_DETECT_ONE); boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_TWO); break; case 7: boot_bit_set(BOOT_BIT_RESET_LOOP_DETECT_ONE); break; default: PBL_CROAK("reset loop boot bits overrun"); break; } return false; } static bool prv_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...
attribute_list_destroy_list(&list)
; } static void prv_add_weather_pin_with_params(int32_t delta_time_s, bool has_timestamp, bool has_short_title, bool has_short_subtitle) { const time_t now = rtc_get_time(); AttributeList list = {}; prv_set_timeline_icon(&list, TIMELINE_RESOURCE_TIMELINE_WEATHER, 0); ...
verflow [task: %s]", name); RebootReason reason = { .code = RebootReasonCode_StackOverflow, .data8[0] = task }; reboot_reason_set(&reason); reset_due_to_software_failure(); } } bool xApplicationIsAllowedToRaisePrivilege(uint32_t caller_pc) { // This function is called by portSVCHandler...
(s_analytics_device_sleep_cpu_cycles)
d) uint8_t percent = 0; if (s_fetch_state.app) { percent += 30; } if (s_fetch_state.worker) { percent += 10; } if (s_fetch_state.resources) { percent += 60; } // add in the progress for the currently transferring piece. percent += (type_percent / 3); // store value return MIN(100, pe...
(AppFetchResultGeneralFailure)
; } prv_cleanup(AppFetchResultSuccess); } else if (pb_event->type == PebblePutBytesEventTypeCleanup) { // Start the timeout watchdog again so we can tell if things get hung up // before the phone starts sending the next putbytes object. // This will only trigger if we've completed a piece and are...
laces \n's with spaces, so we will always fill the full horizontal width ("JR Whop" wraps to "JR\nWhop") cl_assert_equal_i(layout.max_used_size.h, 2 * FONT_HEIGHT); // Same behaviour as TrailingEllipsis in this regard } void test_text_layout__pathological_1(void) { GContext gcontext; FrameBuffer *fb = malloc(...
(l.flow_data.perimeter.impl, NULL)
; } // just a fake value to have something to compare against const GPerimeter * const g_perimeter_for_display = (const GPerimeter *) &g_perimeter_for_display; void test_text_layout__enable_text_flow(void) { TextLayoutExtended l = {}; graphics_text_attributes_enable_screen_text_flow((GTextLayoutCacheRef) &l, 123)...
224, 80}, { 784, 248, -168}, { 792, 72, -344}, { 840, -168, -384}, { 816, -80, -568}, { 920, 72, -616}, { 768, 120, -592}, { 800, 232, -680}, { 904, 272, -696}, { 840, 264, -736}, { 856, 216, -672}, { 824, 184, -712}, // 54 seconds { 824, 72, -616}, { 872, 160, -...
{ -368, -120, -920}, { -384, -120, -912}, { -360, -80, -960}, // 59 seconds { -384, -96, -936}, { -344, -96, -968}, { -328, -120, -952}, { -304, -104, -968}, { -296, -152, -960}, { -264, -88, -968}, { -280, -168, -984}, { -280, -128, -944}, { -240, -144, -976}, { ...
{ -296, 24, -960}, { -296, 40, -968}, { -312, 72, -984}, { -296, 72, -968}, { -304, 64, -960}, { -296, 32, -920}, { -296, 56, -952}, { -296, 40, -912}, { -288, 64, -936}, { -288, 64, -952}, { -280, 48, -944}, { -280, 64, -952}, { -272, 48, -976}, { -288, 24, -952...
&pairing_info_out.remote_encryption_info.ltk, sizeof(SMLongTermKey)), 0); cl_assert_equal_i(memcmp(&pairing_info->irk, &pairing_info_out.irk, sizeof(SMIdentityResolvingKey)), 0); cl_assert_equal_i(memcmp(&pairing_info->csrk, &pairing_info_out.csrk, ...
(&s_pairing_info, device_name, false /* requires_address_pinning */, 0 /* flags */)
; prv_fire_writeback_timer(); prv_validate_ble_pairing_info(&s_pairing_info, device_name); shared_prf_storage_erase_ble_pairing_data(); cl_assert_equal_b(shared_prf_storage_get_ble_pairing_data(NULL, NULL, NULL, NULL), false); } void test_shared_prf_storage_v2__root_keys(void) { shared_prf_storage_wipe_all...
KEY = 0x2, // TUPLE_CSTRING SPORTS_UNITS_KEY = 0x3, // TUPLE_UINT(8) SPORTS_ACTIVITY_STATE_KEY = 0x4, // TUPLE_UINT(8) SPORTS_LABEL_KEY = 0x5, // TUPLE_UINT(8) SPORTS_HRM_KEY = 0x6, // TUPLE_UINT(8) SPORTS_CUSTOM_LABEL_KEY = 0x7, // TUPLE_CSTRING SPORTS_CUSTOM_VALUE_...
(new_tuple->value->cstring, data->custom_label_string, sizeof(data->custom_label_string))
!= 0) { strncpy(data->custom_label_string, new_tuple->value->cstring, sizeof(data->custom_label_string)); prv_update_scrollable_metrics(data); } break; } case SPORTS_CUSTOM_VALUE_KEY: { if (strncmp(new_tuple->value->cstring, ...
}; SM128BitKey link_key_2 = {{0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}}; char name_2[BT_DEVICE_NAME_BUFFER_SIZE] = "Device 2"; uint8_t platform_bits_2 = 0x22; BTBondingID id_2 = bt_persistent_storage_store_bt_classic_pairing(&ad...
ret = bt_persistent_storage_get_bt_classic_pairing_by_id(id_1, &addr_out, &link_key_out, name_out, &platform_bits_out); cl_assert(ret); cl_assert_equal_m(&addr_1, &addr_out, sizeof(addr_out)); cl_assert_equal_m(&link_key_1, &link_key_out, sizeof(link_key_out))...
// Don't add the platform bits BTBondingID id_4 = bt_persistent_storage_store_bt_classic_pairing(&addr_4, &link_key_4, name_4, NULL); cl_assert(id_4 != BT_BONDING_ID_INVALID); cl_assert_equal_i(fake_shared_prf_storage_get_bt_classic_store_count(), 4); // Update with platform bits id_4 = bt_persistent_stor...
>timeline_layout); return size.h; } else { return 0; } } static void prv_update_item(GContext *ctx, TimelineItemLayer *item_layer) { if (item_layer->timeline_layout) { GRect bounds = item_layer->timeline_layout->layout_layer.layer.bounds; bounds.origin.y = 0 - item_layer->scroll_offset_pixels; ...
ROUND_TO_MOD_CEIL(current_scroll, SCROLL_AMOUNT)
; #endif if (max_scroll >= first_scroll && current_scroll < first_scroll) { prv_update_scroll_offset(item_layer, first_scroll, true); } else if (current_scroll + SCROLL_AMOUNT + SCROLL_FUDGE_AMOUNT >= max_scroll) { #if PBL_ROUND // scroll down to page aligned end of content max_scroll = ROUND_TO_MOD_CE...
th the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o...
(node, new_node)
; if (node == head) { return new_node; } else { return head; } } ListNode *next = node->next; if (next == NULL) { list_insert_after(node, new_node); return head; } node = next; } } bool list_contains(const ListNode *node, const ListNode *node_to_searc...
/* * 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(result) <= sizeof(data), "AppMessageResult expected to fit in void *")
; AppMessageCtxOutbox *outbox = &app_state_get_app_message_ctx()->outbox; if (outbox->phase != OUT_AWAITING_REPLY_AND_OUTBOX_CALLBACK) { APP_LOG(LOG_LEVEL_ERROR, "Outbox failure, but unexpected state: %u", outbox->phase); return; } // If app_message_outbox_handle_app_outbox_message_sent() has been calle...
{ 560, 208, -736}, { 568, 216, -728}, { 560, 224, -744}, { 560, 200, -736}, { 560, 216, -736}, { 560, 208, -736}, { 560, 208, -736}, // 5 seconds { 568, 224, -728}, { 560, 224, -744}, { 560, 208, -736}, { 568, 200, -736}, { 560, 200, -736}, { 560, 224, -736}, { 56...
{ 560, 168, -752}, { 552, 160, -744}, { 560, 192, -736}, { 552, 192, -760}, { 536, 224, -752}, { 536, 176, -760}, { 552, 152, -784}, { 552, 184, -752}, { 552, 192, -736}, { 552, 176, -736}, { 552, 184, -744}, { 560, 184, -744}, { 552, 168, -744}, { 560, 184, -744}...
aphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_TEXT_0_0, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(framebuffer_is_empty("draw_text_null_null", fb, GColorWhite)); setup_test_aa_sw(&ctx, fb, RECT_NULL_W, RECT_NU...
GRect(10, 70, 100, 30)
, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); ctx.draw_state.text_color.a = 0; graphics_draw_text(&ctx, "blue0", &s_font_info, GRect(10, 100, 100, 30), GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap...
r, 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 *animation, const AnimationProgress normalized) { KinoP...
animation_set_immutable(animation)
; player->animation = animation; } void kino_player_play(KinoPlayer *player) { Animation *animation = (Animation *)kino_player_create_play_animation(player); if (animation) { animation_schedule(animation); } } void kino_player_play_section(KinoPlayer *player, uint32_t from_elapsed_ms, ...
/* * 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 (!bt_persistent_storage_get_local_device_name(s_local_device_name, sizeof(s_local_device_name))) { prv_set_default_device_name(); } }
prv_configure_device_name(); } void bt_local_id_set_device_name(const char *device_name) { strncpy(s_local_device_name, device_name, sizeof(s_local_device_name)); s_local_device_name[sizeof(s_local_device_name) - 1] = '\0'; prv_configure_device_name(); } void bt_local_id_copy_device_name(char name_out[BT_DE...
to the beginning of the storage. uint8_t *storage; } buffer; } AppInboxNode; typedef struct AppInboxConsumerInfo { AppInboxServiceTag tag; AppInboxMessageHandler message_handler; AppInboxDroppedHandler dropped_handler; uint32_t num_failed; uint32_t num_success; uint8_t *it; uint8_t *end; } AppInbo...
if (info_out) { syscall_assert_userspace_buffer(info_out, sizeof(*info_out)); }
/* * 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...
(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(&device, NULL, true /* local_is_master */); GAPLEConnection *connection = gap_le_connection_by_device(&device); connection->g...
e_number test_reel_data->duration_ms = 300; kino_player_play(test_player); animation_set_elapsed(test_player->animation, 20); animation_set_duration(test_player->animation, ANIMATION_DURATION_INFINITE); prv_play_animation_update(test_player->animation, 0); // intentionally bad value cl_assert_equal_i(kin...
(test_player->animation, 0)
; // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(test_reel), ANIMATION_DURATION_INFINITE); } void test_kino_player__create_finite_animation_infinite_reel_reverse(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number...
ttom_right_rect_color = GColorYellow; bottom_right_rect_color.a = 2; const GRect top_right_rect = (GRect) { .origin = GPoint(right_rects_x, (bitmap_bounds_size->h / 2) + right_rects_y_offset), .size = right_rects_size }; prv_draw_vlines_in_rect(ctx, draw_func, &top_right_rect, bottom_right_rect_color); ...
(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_core_assign_horizontal_line_delta_raw")))
; }; // VERTICAL LINE TESTS // These tests use a pattern of two skinny 66% opacity rectangles drawn at the right of the // screen (green on top and yellow on bottom) and one tall 66% opacity blue rectangle drawn at the // left of the screen when drawing vertical lines. Due to the fake GBitmap data row handling, the //...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
strcmp(arg, "list")
== 0) { prv_list_runlevels(); return; } int runlevel = atoi(arg); if (runlevel < 0 || runlevel >= RunLevel_COUNT) { prompt_send_response("Unknown runlevel"); return; } else if (runlevel == 0 && arg[0] != '0') { prompt_send_response("Invalid runlevel number. Choices:"); prv_list_runleve...
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 License is distrib...
{ { int32_t dist = serial_distance(0, 1, 3); cl_assert_equal_i(dist, 1); } { int32_t dist = serial_distance(1, 0, 3); cl_assert_equal_i(dist, -1); } { int32_t dist = serial_distance(0, 7, 3); cl_assert_equal_i(dist, -1); } { int32_t dist = serial_distance(7, 0, 3); cl_asser...
void test_math__is_signed_macro(void) { cl_assert(IS_SIGNED((int)-1) == true); cl_assert(IS_SIGNED((unsigned int)1) == false); } void test_math__test_within_macro(void) { int16_t min; int16_t max; // Min and max are both positive //////////////////////////////// min = 5; max = 10; // Min and max ...
segment's direction going backwards through the path // we must go backwards because we find intersections going forwards for (int i = path->num_points - 1; i > 0; --i) { rot_points[i] = rot_start = rotate_offset_point(&path->points[i], path->rotation, &path->offset); if (min_x > rot_points[i].x) { min_x = ...
applib_free(intersections_up); applib_free(intersections_down); }
void gpath_fill_precise_internal(GContext *ctx, GPointPrecise *points, size_t num_points) { if (!points) { return; } // Convert precise points to normal points and draw filled path with converted points // (no real support for filled paths with GPointPrecise, yet) GPoint *imprecise_points = applib_mall...
no negative offset setup_test_aa_sw(&ctx, fb, RECT_TEXT_2_0, RECT_TEXT_2_0, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "aaa", &s_font_info, RECT_TEXT_2_0, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, NULL); cl_check(gbitmap_pbi_eq(&ctx....
("draw_text_null_null", fb, GColorWhite)
); // Test negative context boxes - ensure nothing is rendered setup_test_aa_sw(&ctx, fb, RECT_NEG, RECT_NEG, false, 1); graphics_context_set_text_color(&ctx, GColorBlack); graphics_draw_text(&ctx, "jja", &s_font_info, RECT_TEXT_0_0, GTextOverflowModeTrailingEllipsis, GTextAlignmentLeft, N...
/* * 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...
{ ADCVoltageMonitorReading reading = { .vref_total = prv_convert_millivolts_to_12bit_reading(VREF_VOLTAGE), .vmon_total = prv_convert_millivolts_to_12bit_reading(1800) }; uint32_t result = battery_convert_reading_to_millivolts(reading, 1, 1); cl_assert_equal_i(result, 1800); reading.vmon_total = prv...
tionGroup action_group = { .num_actions = 0, }; // Store them in the DB char *key = "key1"; int key_len = strlen(key); ios_notif_pref_db_store_prefs((uint8_t *)key, key_len, &attr_list, &action_group); // Make sure we can get the data back iOSNotifPrefs *notif_prefs = ios_notif_pref_db_get_prefs((ui...
(is_dirty)
; dirty_list = ios_notif_pref_db_get_dirty_list(); cl_assert(dirty_list); cl_assert_equal_i(list_count((ListNode *)dirty_list), 2); // Mark the final 2 items as synced ios_notif_pref_db_mark_synced((uint8_t *)keys[3], key_len); ios_notif_pref_db_mark_synced((uint8_t *)keys[4], key_len); // And nothing ...
ue so that a half-way point exists as an edge between an equal number of //! clock cycles on either side. #define PWM_TIMER_UPDATE_PERIOD (100) // Operating frequency of DRV2603 is in the [10, 250] kHz range. #define PWM_OUTPUT_FREQUENCY_HZ (22 * 1000) // Count clock needs to run at least as fast as the (update perio...
{ if (!s_initialized) { return; } prv_vibe_raw_ctl(false); }
int8_t vibe_get_braking_strength(void) { if (BOARD_CONFIG_VIBE.options & ActuatorOptions_HBridge) { // We support the full -100..100 range, send it all the way backwards return VIBE_STRENGTH_MIN; } else { // We only support the 0..100 range, just ask it to turn off return VIBE_STRENGTH_OFF; } } ...
pdate, .buffer_size = TIME_STRING_REQUIRED_LENGTH, .text.style = LayoutContentSizeDefault, .text.style_font = TextStyleFont_TimeHeaderWords, .text.fixed_lines = 1, .text.alignment = LayoutTextAlignment_Left, .text.extent.offset.y = TIME_WORDS_OFFSET_Y, }; static const LayoutNodeConfig * cons...
{ time_text_node->margin.h += hour_title_margin; }
0x7f, 0x40, 0x9e, 0x8c, 0x31, 0x4f, 0x55, 0x65, 0x72, 0x22, 0xb4}, .app_version = { .major = 1, .minor = 1, }, .sdk_version = { .major = 1, .minor = 1, }, .info_flags = 0, .icon_resource_id = 0, }; static const AppDBEntry app2 = { .name = "Application 2", .uuid = {0x55, 0xcb, ...
cl_assert_equal_b(true, uuid_equal(&app2.uuid, &temp.uuid))
; // check app_db_get_install_id_for_uuid for app 3 memset(&temp, 0, sizeof(AppDBEntry)); AppInstallId app_three_id = app_db_get_install_id_for_uuid(&app3.uuid); cl_assert(app_one_id > 0); cl_assert_equal_i(S_SUCCESS, app_db_get_app_entry_for_install_id(app_three_id, &temp)); cl_assert_equal_b(true, uuid_e...
61, 0x74, 0x65, 0x72, 0x00, 0x54, 0x68, 0x61, 0x6e, 0x6b, 0x20, 0x79, 0x6f, 0x75, 0x00, 0x53, 0x65, 0x65, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x73, 0x6f, 0x6f, 0x6e, 0x00, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x6c, 0x61, 0x74, 0x65, 0x00, 0x4f, 0x6e, 0x20, 0x6d, 0x79, 0x20, 0x77, 0x61, 0x79, 0x00, 0x42, 0x75...
ios_notif_pref_db_free_prefs(notif_prefs)
; } void test_ios_notif_pref_db__store_empty_prefs(void) { // Store empty prefs char *key = "key1"; int key_len = strlen(key); ios_notif_pref_db_store_prefs((uint8_t *)key, key_len, NULL, NULL); // Read them back iOSNotifPrefs *notif_prefs = ios_notif_pref_db_get_prefs((uint8_t *)key, key_len); cl_asser...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&app_data->window, &(WindowHandlers) { .load = prv_window_load })
; const bool animated = true; app_window_stack_push(&app_data->window, animated); app_data->test = 0xA5A5A5A5; launcher_task_add_callback(prv_verify_modify_on_kernel_task, app_data); } static void prv_main(void) { prv_handle_init(); app_event_loop(); } const PebbleProcessMd* test_mpu_cache_get_info() { ...
6, 0, 248}, { 792, 64, 152}, { 736, 88, 104}, { 752, 0, 160}, { 832, -16, 144}, { 968, -32, 72}, { 1064, 32, 0}, { 1584, -176, 160}, { 1520, -64, 184}, { 1072, 304, -128}, { 984, 304, -304}, { 936, 104, 16}, // 8 seconds { 936, 16, 192}, { 952, 280, 88}, { 920...
{ 1584, -216, 152}, { 1632, -32, 224}, { 1400, 392, -200}, { 1392, 432, -272}, { 1216, 288, 144}, { 1088, 240, 208}, { 1056, 280, 240}, { 968, 352, 200}, { 848, 344, 120}, { 808, 368, 8}, { 824, 336, -24}, { 1016, 424, -120}, { 1264, 392, -104}, { 1648, 384, -24},...
{ 1720, 424, 136}, { 1520, 440, 168}, { 1096, 272, 64}, { 1360, 120, 144}, { 1560, -8, 352}, { 1368, 56, 272}, { 1104, 24, 208}, { 896, -24, 160}, { 760, -8, 104}, { 664, -16, 104}, { 600, -40, 96}, { 560, -80, 8}, { 880, 80, -160}, { 1104, 8, -112}, { 1568, ...
Setup graphics context framebuffer_init(&s_fb, &(GSize) {DISP_COLS, DISP_ROWS}); framebuffer_clear(&s_fb); graphics_context_init(&s_ctx, &s_fb, GContextInitializationMode_App); s_app_state_get_graphics_context = &s_ctx; // Setup resources fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */); pfs_...
prv_create_window_and_render(active_window, 0)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_active__workout_render_open_workout_no_hrm(void) { s_hrm_is_present = false; s_workout_data = (WorkoutData) { .steps = 0, .duration_s = 84, .distance_m = 0, .avg_pace = health_util_get_pace(84, 0), .bpm = 92, ...
graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r16_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, STROKE_BIG); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIU...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL)
; graphics_circle_quadrant_draw_stroked_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornersTop); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quads_top.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, STROKE_SMALL); ...
.scs_pin); gpio_cfg.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(FLASH_CONFIG.spi_gpio, &gpio_cfg); // Set up a SPI bus on SPI1 SPI_InitTypeDef spi_cfg; SPI_I2S_DeInit(FLASH_CONFIG.spi); spi_cfg.SPI_Direction = SPI_Direction_2Lines_FullDuplex; spi_cfg.SPI_Mode = SPI_Mode_Master; spi_cfg.SPI_DataSize = SPI_DataS...
prv_disable_flash_spi_clock()
; prv_flash_whoami(); } bool flash_sanity_check(void) { return prv_is_whoami_correct(); } void flash_read_bytes(uint8_t* buffer, uint32_t start_addr, uint32_t buffer_size) { if (!buffer_size) { return; } prv_enable_flash_spi_clock(); prv_flash_wait_for_write(); prv_flash_start_cmd(); prv_flash...
result = transcription_validate(validate_test, test_size); cl_assert_equal_p(result, false); s_test_transcription_example[26] = 4; // restore word length of first word in second sentence s_test_transcription_example[8] = '\n'; // insert special character into the middle of a word result = transcription_val...
cl_assert_equal_p(result, sentence_test)
; s_count = 0; result = transcription_iterate_sentences((TranscriptionSentence *) sentence_test, 2, (TranscriptionSentenceIterateCb)prv_cb_return_false, (void *) 1); cl_assert_equal_p(result, &sentence_test[21]); result = transcription_iterate_sentences((TranscriptionSentence *) sentence_test, 0, ...