prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
: When round MenuLayer animations are enabled, we need a "is_selected" function const bool cell_is_selected = menu_cell_layer_is_highlighted(cell_layer); const bool draw_two_columns = (config->value || (config->icon && ((GAlign)config->icon_align == GAlignRight))); // Determine appropriate insets to match ...
{ // Title: if (title) { const bool is_legacy2 = process_manager_compiled_with_legacy2_sdk(); if (is_legacy2) { // Update the text color to Black for legacy apps - this is to maintain existing behavior for // 2.x compiled apps - no need to restore original since original 2.x did not do any resto...
_sync_contains_pairing_info(&pairing_1, true), false); cl_assert_equal_b(bonding_sync_contains_pairing_info(&pairing_2, true), true); cl_assert_equal_b(bonding_sync_contains_pairing_info(&pairing_3, false), false); } void test_bluetooth_persistent_storage_prf__get_ble_by_address(void) { bool ret; // Output va...
bt_persistent_storage_store_bt_classic_pairing(&addr_1, &link_key_1, name_1, &platform_bits_1)
; prv_fire_writeback_timer(); cl_assert(id_1 != BT_BONDING_ID_INVALID); // Read it back 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, &add...
clude "touch.h" #include "touch_event.h" #include "touch_client.h" #include "kernel/events.h" #include "system/logging.h" #include "os/mutex.h" #include "system/passert.h" #include "util/size.h" #define TOUCH_DEBUG(fmt, args...) PBL_LOG_D(LOG_DOMAIN_TOUCH, LOG_LEVEL_DEBUG, fmt, ## args) #define TOUCH_QUEUE_LENGTH (2...
(&last_pos, pos)
; } else { update = true; } if (update) { TOUCH_DEBUG("Touch %"PRIu8": Position Update @ (%"PRId16", %"PRId16")", touch_idx, pos->x, pos->y); prv_touch_queue_add(ctx, touch_idx, TouchEvent_PositionUpdate, pos, pressure, time_ms); } } ctx->state = touch_state; bool ...
buted 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 "dictation_session.h" #include "dictation_session_private.h" #include "voice_window_private.h" #i...
{ #if CAPABILITY_HAS_MICROPHONE if (!session) { return; } if (session->in_progress) { // we can't destroy a session while it is in progress, // so we mark it as destroy pending and we'll destroy it later session->destroy_pending = true; return; } prv_stop_session(session); voice_window...
void dictation_session_enable_confirmation(DictationSession *session, bool is_enabled) { #if CAPABILITY_HAS_MICROPHONE if (!session || session->in_progress) { return; } voice_window_set_confirmation_enabled(session->voice_window, is_enabled); #endif } void dictation_session_enable_error_dialogs(DictationSe...
et_curve(h, AnimationCurveEaseOut); cl_assert(animation_get_curve(h) == AnimationCurveEaseOut); static const PropertyAnimationImplementation implementation2 = { .base = { .setup = prv_setup_handler, .update = (AnimationUpdateImplementation) property_animation_update_gpoint, .teardown = prv_...
(&s_started_handler_calls, a)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); animation_set_elapsed(a, duration_a - leftover_a); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); // --------------...
} PBL_LOG(LOG_LEVEL_DEBUG, "Filesystem: Temporary size - %"PRId32" Kb", (s_ftl_size / 1024)); pfs_set_size(s_ftl_size, false /* don't erase regions */); } //! return a layout version that associates with the labels from above static uint8_t prv_ftl_get_layout_version(void) { // add all regions so PFS can kno...
{ PBL_ASSERTN(size == SECTOR_SIZE_BYTES); flash_erase_sector_blocking( s_region_list[idx].start + offset - curr_virt_offset_begin); }
size -= bytes; offset += bytes; } curr_virt_offset_begin = curr_virt_offset_end; } } void ftl_read(void *buffer, size_t size, uint32_t offset) { prv_ftl_operation(buffer, size, offset, FTLRead); } void ftl_write(const void *buffer, size_t size, uint32_t offset) { prv_ftl_operation((void *)...
ol new) { CoreDumpFlashHeader flash_hdr; CoreDumpFlashRegionHeader region_hdr; uint32_t base_address; unsigned int i; // ---------------------------------------------------------------------------------- // First, see if the flash header has been put in place prv_flash_read_bytes(&flash_hdr, CORE_DUMP_...
{ // registers [r0-r12, sp, lr, pc, sr] packed_info.registers[i] = task_info->registers[i]; }
// If this is the current task, adjust the registers based on whether or not we were handling // an exception at the time core_dump_reset() was called. if (packed_info.running) { if (!RETURNS_TO_PSP(s_saved_registers.core_reg[portCANONICAL_REG_INDEX_LR])) { // The core dump handler got invoked from a...
prv_connect_ams()
; // Receive: playing, 200% playback rate // 0000 00 01 00 31 2c 32 2e 30 ...1,2.0 uint8_t incomplete_playback_info_update[] = { 0x00, 0x01, 0x00, 0x31, 0x2c, 0x32, 0x2e, 0x30, }; prv_receive_entity_update(incomplete_playback_info_update, sizeof(incomplete_playback_info_up...
w.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions ...
( PBL_IF_RECT_ELSE(FONT_KEY_GOTHIC_24_BOLD, selected ? FONT_KEY_GOTHIC_24_BOLD : FONT_KEY_GOTHIC_18_BOLD))
; GFont const subtitle_font = fonts_get_system_font(FONT_KEY_GOTHIC_18); menu_cell_basic_draw_custom(ctx, cell_layer, title_font, node->name, NULL, NULL, subtitle_font, subtitle, bitmap, false, GTextOverflowModeTrailingEllipsis); } /////////////////// // Window callbacks static void ...
SE_SMARTSTRAP (CAPABILITY_HAS_ACCESSORY_CONNECTOR && !defined(RECOVERY_FW)) #if USE_SMARTSTRAP // Event handler //////////////////////////////////////////////////////////////////////////////// static void prv_app_smartstrap_event(PebbleEvent *e, void *context) { SmartstrapConnectionState *state = app_state_get_smar...
if (!buffer) { return NULL; }
if (!sys_smartstrap_attribute_register(service_id, attribute_id, buffer, buffer_length)) { applib_free(buffer); return NULL; } SmartstrapConnectionState *state = app_state_get_smartstrap_state(); state->num_attributes++; prv_state_init(); return (SmartstrapAttribute *)buffer; #else return NULL; ...
("CC2564x lockup event")
; analytics_logging_log_event(&event_blob); } // ------------------------------------------------------------------------------------------ // Log a crash event void analytics_event_crash(uint8_t crash_code, uint32_t link_register) { AnalyticsEventBlob event_blob = { .event = AnalyticsEvent_Crash, .crash_...
[i].size, &cond, &vars, &err); cl_assert_equal_s(s_output, s_truncation_tests[i].output); } } //////////////////////////////////////////////////////////////////////////////////////////////////// // Test NULL arguments void test_template_string__null_arguments(void) { { Templa...
{ #if DEBUG_PRINTING printf("current_time: %ld\n", s_time_since_tests[i].current_time); printf("parameter: \"%s\"\n", s_time_since_tests[i].params); printf("result: %jd\n", s_time_since_tests[i].done_state); #endif prv_state_init(); s_vars.current_time = s_time_since_tests[i].current_time; prv_...
} //////////////////////////////////////////////////////////////////////////////////////////////////// // Test `format` filter typedef struct FormatTestData { const char *params; intmax_t filter_state; bool time_was_until; const char *expect_str; time_t expect_eval_time; TemplateStringErrorStatus expect...
assert(recognizer_handle_touch_event(r, NULL)); } void test_recognizer__handle_touch_events_fail_after(void) { RecognizerEvent rec_event = -1; RecognizerState new_state; bool updated = false; TouchEvent last_touch_event = { .type = TouchEvent_Liftoff }; s_test_impl_data.new_state = &new_state; s_test_impl_...
(!list_contains(list.node, &r1->node))
; cl_assert(!r1->is_owned); recognizer_remove_from_list(r1, &list); cl_assert(!r1->is_owned); } static int s_list_idx = 0; static bool prv_list_iterator(Recognizer *recognizer, void *context) { const char *names[] = { "R1", "R2", "R3" }; cl_assert(s_list_idx < ARRAY_LENGTH(names)); char s[20]; snprintf(...
/* * 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...
(data.model, model, sizeof(data.model))
; data.model[MFG_INFO_MODEL_STRING_LENGTH - 1] = '\0'; prv_update_struct(&data); } GPoint mfg_info_get_disp_offsets(void) { // Not implemented. Can just assume no offset return (GPoint) {}; } void mfg_info_set_disp_offsets(GPoint p) { // Not implemented. } void mfg_info_update_constant_data(void) { // No...
con_from); peek_layer_set_icon_with_size(peek_layer, &first_timeline_layout->icon_info, TimelineResourceSizeTiny, icon_from); } else { return NULL; } GRect icon_to; const bool use_pin = true; const bool shift_offscreen = true; prv_get_icon_animation_frame(data, &i...
(animation, TIMELINE_CARD_TRANSITION_MS / 2)
; animation_set_custom_interpolation(animation, interpolate_moook); animation_schedule(animation); return animation; } static void prv_push_pin_window(TimelineAppData *data, TimelineIterState *state, bool animated) { TimelineLayout *timeline_layout = timeline_layer_get_current_layout(&data->timeline_layer); ...
e NUM_MID_FRAMES 1 static void prv_bg_animation_update(Animation *animation, AnimationProgress normalized) { HealthCardView *health_card_view = animation_get_context(animation); const AnimationProgress bounce_back_length = (interpolate_moook_out_duration() * ANIMATION_NORMALIZED_MAX) / interpolate_moo...
app_window_stack_pop_all(true)
; } else if (next_card_index >= CardCount) { // Top of the list (no-op) // TODO: maybe we want an animation? return; } else { // animate the cards' positions prv_schedule_slide_animation(health_card_view, next_card_index, slide_up); } } // Select click handler static void prv_select_click_han...
pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Setup content indicator ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); conte...
gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)
duleConfigKeys s_dnd_schedule_keys[NumDNDSchedules] = { [WeekdaySchedule] = { .schedule_pref_key = "dndWeekdaySchedule", .enabled_pref_key = "dndWeekdayScheduleEnabled", }, [WeekendSchedule] = { .schedule_pref_key = "dndWeekendSchedule", .enabled_pref_key = "dndWeekendScheduleEnabled", } }; sta...
(s_vibe_score_incoming_calls, DEFAULT_VIBE_SCORE_INCOMING_CALLS)
; s_vibe_score_alarms = prv_return_default_if_invalid(s_vibe_score_alarms, DEFAULT_VIBE_SCORE_ALARMS); } static void prv_set_vibe_scores_based_on_legacy_intensity(VibeIntensity intensity) { if (intensity == VibeIntensityHigh) { s_vibe_score_notifications = ...
/* * 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...
I2C_DeInit(bus->hal->i2c)
; } static uint32_t prv_get_apb1_frequency(void) { RCC_ClocksTypeDef rcc_clocks; RCC_GetClocksFreq(&rcc_clocks); return rcc_clocks.PCLK1_Frequency; } static const int DUTY_CYCLE_DIVIDERS[] = { [I2CDutyCycle_16_9] = 25, [I2CDutyCycle_2] = 3 }; static uint32_t prv_prescalar_to_frequency(I2CDutyCycle duty_cyc...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(window, data)
{ case HealthServiceTimeScopeOnce: stats = &yesterday_stats; scope_str = "once"; break; case HealthServiceTimeScopeWeekly: stats = &weekly_stats; scope_str = "weekly"; break; case HealthServiceTimeScopeDailyWeekdayOrWeekend: s...
ROUND(sum, count)
; // Test each aggregation for (HealthAggregation agg = HealthAggregationAvg; agg <= HealthAggregationMax; agg++) { s_sys_activity_get_minute_history_values.stage = 0; if (agg == HealthAggregationMin) { PBL_LOG(LOG_LEVEL_DEBUG, "foo"); } HealthValue result = health_service_aggregate_averaged...
_counters(); const uint8_t chunk[] = { 0xaa, 0xbb, 0xcc }; prv_receive_put(s_last_response_cookie, chunk, sizeof(chunk)); put_bytes_cancel(); assert_cleanup_event(ObjectWatchApp, VALID_OBJECT_SIZE); if (prv_put_bytes_get_max_batched_pb_ops() > 1) { // With pre-acking, the put will have already been ac...
(s_last_response_cookie, EXPECTED_CRC)
; assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__commit_message_crc_mismatch(void) { prv_receive_init_and_put_fw_object(); prv_receive_commit(s_last_response_cookie, ~EXPECTED_CRC); assert_ack_count(0); assert_nack_count(1); } void test_put_bytes__commit_message_fw_description_is_writt...
st uint32_t __unpriv_ro_bss_size__[]; extern const uint32_t __isr_stack_start__[]; extern const uint32_t __stack_guard_size__[]; extern const uint32_t __APP_RAM__[]; extern const uint32_t __WORKER_RAM__[]; extern const uint32_t __FLASH_start__[]; extern const uint32_t __FLASH_size__[]; extern const uint32_t __kernel...
(&s_isr_stack_guard_region)
; mpu_enable(); } const MpuRegion* memory_layout_get_app_region(void) { return &s_app_region; } const MpuRegion* memory_layout_get_readonly_bss_region(void) { return &s_readonly_bss_region; } const MpuRegion* memory_layout_get_app_stack_guard_region(void) { return &s_app_stack_guard_region; } const MpuRegi...
/* * 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; }
rocky_api_graphics_text_reset_state(); rocky_api_graphics_path2d_reset_state(); JS_VAR event = rocky_global_create_event(ROCKY_EVENT_DRAW); JS_VAR context_2d = prv_create_canvas_context_2d_for_layer(layer); jerry_set_object_field(event, ROCKY_EVENT_DRAW_CONTEXT, context_2d); rocky_global_call_event_handler...
/* * 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...
{ // Possible that it was enabled while the watch was vibrating return; }
time_t s; uint16_t ms; rtc_get_time_ms(&s, &ms); mutex_lock(s_vibe_history_mutex); VibeHistory *vibe = (VibeHistory*)list_get_tail((ListNode*)s_vibe_history); if (vibe->time_end == END_NOT_SET) { vibe->time_end = ((uint64_t)s) * 1000 + ms; } mutex_unlock(s_vibe_history_mutex); } typedef struct {...
(&point, &lookup->values.points[j])
) { lookup->iter.lookup->index_lookup[lookup->iter.current_index] = j; break; } } lookup->iter.current_index++; } return true; } GPointIndexLookup *gdraw_command_list_create_index_lookup(GDrawCommandList *list, GPointComparator comparator, void *context, bool reverse) { uint16_t...
state restoration. Therefore, when the app crashes / is // jetsam'd, iOS will unsubscribe from the characteristic. Use this as a trigger to re-launch // the app: PBL_LOG(LOG_LEVEL_INFO, "Characteristic got unsubscribed, triggering app launch!"); hc_endpoint_pebble_pairing_service_send_ios_app_te...
{ PBL_LOG(LOG_LEVEL_DEBUG, "PLE call a no-op"); }
return ATT_ERROR_OK; #endif } extern void power_inhibit_sleep(void); static att_error_t prv_handle_conn_params_write(const ble_evt_gatts_write_req_t *evt) { Connection *connection = connection_by_idx(evt->conn_idx); if (!connection) { return ATT_ERROR_UNLIKELY; } att_error_t rv; if (evt->length ==...
1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not draw anything setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw3_clip_nxny.${BIT_DEPTH_NAME}.pbi")
); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // AA = true, SW = 4 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 4); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_b...
/* * 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...
((uint8_t *)&uuid, UUID_SIZE)
> 0); Contact *contact = contacts_get_contact_by_uuid(&uuid); cl_assert(contact); cl_assert_equal_m(&contact->id, &uuid, UUID_SIZE); cl_assert_equal_i(contact->flags, 0); cl_assert_equal_i(contact->attr_list.num_attributes, 1); cl_assert_equal_i(contact->addr_list.num_addresses, 1); contacts_free_conta...
/* * 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 (prv_read(entry, 0, manifest, sizeof(ResourceManifest)) != sizeof(ResourceManifest)) { *manifest = (ResourceManifest){0}; } }
static bool prv_read_res_table_entry(ResTableEntry *res_entry, ResourceStoreEntry *entry, uint32_t index) { uint32_t addr = MANIFEST_SIZE + index * TABLE_ENTRY_SIZE; return prv_read(entry, addr, res_entry, sizeof(ResTableEntry)) == sizeof(ResTableEntry); } static uint32_t pr...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return list_count((ListNode*)s_presented_notifs); }
void notifications_presented_list_remove(Uuid *id) { NotifList *node = prv_find_listnode_for_notif(id); if (!node) { return; } if (node == s_current_notif) { NotifList *prev_node = (NotifList *)list_get_prev((ListNode *)s_current_notif); NotifList *next_node = (NotifList *)list_get_next((ListNode...
x2, Fixed_S16_3 delta1, Fixed_S16_3 delta2, GColor color) { // Extended sides AA calculations uint8_t left_aa_offset = (delta1.integer > 1) ? ((delta1.raw_value + (FIXED_S16_3_ONE.raw_value ...
{ src_x = new_x; dst_x1 = 0; dst_x2 = src_x - 1; }
*prev_x = new_x; if (dst_x1 > dst_x2) { return; } GBitmap *fb = graphics_capture_frame_buffer(ctx); if (!fb) { return; } prv_replicate_column_row_raw(fb, src_x, dst_x1, dst_x2); graphics_release_frame_buffer(ctx, fb); } void graphics_private_move_pixels_horizontally(GBitmap *bitmap, int16...
/* * 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 (s_read_return_value != BTErrnoOK) { return s_read_return_value; }
Read *read = malloc(sizeof(Read)); *read = (const Read) { .characteristic = characteristic, .client = client, }; if (s_read_head) { list_append((ListNode *)s_read_head, &read->node); } else { s_read_head = read; } return BTErrnoOK; } void gatt_client_consume_read_response(uintptr_t objec...
const TimelineItem *item); static void prv_handle_notification_removed_common(Uuid *, NotificationType); static bool prv_should_pop_due_to_inactivity(void); ///////////////////// // Helpers ///////////////////// static AlertType prv_alert_type_for_notification_type(NotificationType type) { switch (t...
notifications_presented_list_add_sorted(id, type, prv_reminders_on_top_comparator, false)
; } else { notifications_presented_list_add(id, type); } } static void prv_reload_swap_layer(NotificationWindowData *data) { // If the action menu is on the screen, then don't reload the swap layer. // The action menu's context is just a pointer to the swap layer's layout layer's context. // Reloading th...
; const GTextAlignment text_alignment = PBL_IF_RECT_ELSE(GTextAlignmentCenter, show_action_bar ? GTextAlignmentRight : GTextAlignmentCenter); { // do all this in a block so we enforce that nobody uses these variables outside of the block // when dealing with round displays, sizes change depending on l...
gbitmap_deinit(&workout_dialog->confirm_icon)
; gbitmap_deinit(&workout_dialog->decline_icon); if (workout_dialog->subtext_buffer) { applib_free(workout_dialog->subtext_buffer); } if (workout_dialog->dialog.destroy_on_pop) { applib_free(workout_dialog); } } void workout_dialog_init(WorkoutDialog *workout_dialog, const char *dialog_name) { PB...
r_next(&new_idx, &has_next)); cl_assert(has_next); cl_assert_equal_i(new_idx, 4); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[3]].head...
cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(1)->pin.header.id))
; cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(2)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(...
ui.h" #include <stdint.h> #include "applib/ui/vibes.h" #include "apps/system_app_ids.h" #include "apps/system_apps/battery_critical_app.h" #include "kernel/low_power.h" #include "kernel/ui/modals/modal_manager.h" #include "kernel/util/standby.h" #include "process_management/app_manager.h" #include "services/common/ba...
while (s_warning_points_index < num_points && (percent <= battery_curve_get_percent_remaining(s_warning_points[s_warning_points_index + 1]))) { s_warning_points_index++; new_warning = true; }
if (new_warning) { if (!do_not_disturb_is_active()) { vibes_short_pulse(); } battery_ui_display_warning(percent, s_warning_points_index); } } static void prv_dismiss_warning(void) { battery_ui_dismiss_modal(); s_warning_points_index = -1; } static void prv_enter_low_power(void *ignored) { ...
est_bitmap, "stroke_circle_offset_aa_r1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT, RADIUS_SMALL); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r1_clip_xy.${BIT_...
(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerTopLeft)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_aa_r8_quad_top_left.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL); graphics_circle_quadrant_draw_stroked_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, STROKE_SMALL,GCornerTopRig...
e "stubs_passert.h" // Tests /////////////////////////////////////////////////////////// void test_utf8__decode_test_string_valid(void) { static const int NUM_VALID_CODEPOINTS = sizeof(s_valid_test_codepoints) / sizeof(uint32_t); bool is_valid = utf8_is_valid_string(s_valid_test_string); cl_assert(is_valid); ...
(dest, (utf8_t *)"\xf0hi", 5)
; cl_assert_equal_i(copied, 0); cl_assert_equal_s((char *)dest, ""); } void test_utf8__get_size_truncate(void) { cl_assert_equal_i(0, utf8_get_size_truncate("", 1)); cl_assert_equal_i(0, utf8_get_size_truncate("", 100)); cl_assert_equal_i(0, utf8_get_size_truncate(" ", 1)); cl_assert_equal_i(2, utf8_get_s...
e License for the specific language governing permissions and * limitations under the License. */ #include "settings.h" #include "settings_menu.h" #include "settings_window.h" #include "applib/app.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/ui.h" #include "kernel/pbl_malloc.h" #include "resource/...
(window, GColorBlack)
; app_window_stack_push(window, true); } static void handle_deinit(void) { // Window unload deinits everything } static void s_main(void) { handle_init(); app_event_loop(); handle_deinit(); } const PebbleProcessMd *settings_get_app_info() { static const PebbleProcessMdSystem s_settings_app = { .commo...
ww.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions...
GColorARGB8FromHEX(0xdcdcdc)
}, {"ghostwhite", GColorARGB8FromHEX(0xf8f8ff)}, {"gold", GColorARGB8FromHEX(0xffd700)}, {"goldenrod", GColorARGB8FromHEX(0xdaa520)}, {"greenyellow", GColorARGB8FromHEX(0xadff2f)}, {"grey", GColorARGB8FromHEX(0x808080)}, {"honeydew", GColorARGB8FromHEX(0xf0fff0)}, {"hotpink", GColorARGB8FromHEX(0xff69b4)}...
(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(5))
; cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(!has_next); cl_assert_equal_i(timeline_model_get_num_items(), 1); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(-1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[5]].hea...
busy_timeout_us); qspi_release(QSPI); return result ? S_SUCCESS : E_ERROR; } status_t qspi_flash_erase_suspend(QSPIFlash *dev, uint32_t addr) { qspi_use(dev->qspi); uint8_t status_reg; prv_read_register(dev, dev->state->part->instructions.read_status, &status_reg, 1); if (!(stat...
(dev->qspi, dev->state->part->instructions.read_status, dev->state->part->status_bit_masks.busy, false /* !set */, QSPI_NO_TIMEOUT)
p, "draw_rect_across_y_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi")); } void te...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 3); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 3);...
// AA = true, SW = 5 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 5); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN...
/* * 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_message->log_level, log_message->filename, htons(log_message->line_number), log_message->message)
; } else { pulse_logging_log_sync( log_message->log_level, log_message->filename, htons(log_message->line_number), log_message->message); } #else prv_log_serial(log_message->log_level, log_message->filename, htons(log_message->line_number), log_message->message); #endif } voi...
not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR...
test_graphics_context_reset(&ctx, fb)
; layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_across_ny_origin_layer.${BIT_DEPTH_NAME}.pbi")); } #define RADIUS_BIG 15 #define RADIUS_MEDIUM 8 #define RADIUS_MIN_CALCULATED 3 #define RADIUS_MAX_PRECOMPUTE...
r the current chunk. static int s_current_chunk_id; //! The current offset in the chunk in bytes. [0 - CHUNK_SIZE_BYTES) static int s_current_offset; static bool s_enabled; static uint32_t get_current_address(int chunk, int offset) { return debug_db_get_logs_base_address(0) + (chunk * CHUNK_SIZE_BYTES) + offset; }...
{ --retries; if (cb(read_buffer, log_header.log_length)) { break; } else if (retries == 0) { error = true; break; } }
} kernel_free(read_buffer); return !error; } bool flash_dump_log_file(int generation, DumpLineCallback cb, DumpCompletedCallback completed_cb) { if (generation < 0 || generation >= DEBUG_DB_NUM_FILES) { completed_cb(false); return false; } if (!debug_db_is_generation_valid(generation)) { com...
t8_t *tx_bytes = NULL; prv_lock(); uint16_t tx_bytes_available = circular_buffer_get_read_space_remaining(&s_tx_buffer); if (tx_bytes_available) { circular_buffer_read(&s_tx_buffer, tx_bytes_available, &tx_bytes, &tx_bytes_available); } uint8_t *rx_buffer_ptr = NULL; uint16_t rx_bytes_available = circu...
("Nothing to receive.")
; } bool has_more_rx_data = (remote_status_in.bytes_sendable_count > rx_bytes_available); bool should_continue_to_rx_data = (has_more_rx_data && (local_status_out.bytes_receivable_count != 0)); if (has_more_rx_data && !should_continue_to_rx_data) { HOST_TRANSPORT_DEBUG_LOG("Host Transport Receive Buf...
/* * 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_DISPLAY.clk, GPIO_OType_PP, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL)
; gpio_af_init(&BOARD_CONFIG_DISPLAY.mosi, GPIO_OType_PP, GPIO_Speed_50MHz, GPIO_PuPd_NOPULL); gpio_output_init(&BOARD_CONFIG_DISPLAY.cs, GPIO_OType_PP, GPIO_Speed_50MHz); gpio_output_init(&BOARD_CONFIG_DISPLAY.on_ctrl, BOARD_CONFIG_DISPLAY.on_ctrl_otype, GPIO_Speed_50MHz); ...
alse; } // Ask the compass for a 8-bit value that's programmed into the IC at the // factory. Useful as a sanity check to make sure everything came up properly. bool mag3110_check_whoami(void) { static const uint8_t COMPASS_WHOAMI_BYTE = 0xc4; uint8_t whoami = 0; mag_use(); mag3110_read(WHO_AM_I_REG, 1, &who...
(CTRL_REG1, new_sample_rate_value | 0x01)
/* * 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...
setup_pbi_test(TEST_PBI_FILE)
; cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE)); }
ong_click.delay_ms == 0) { return LONG_CLICK_DEFAULT_DELAY_MS; } return recognizer->config.long_click.delay_ms; } inline static bool prv_can_more_clicks_follow(ClickRecognizer *recognizer) { if (recognizer->number_of_clicks_counted >= prv_multi_click_get_max(recognizer)) { return false; } return true...
{ recognizer->is_button_down = true; prv_cancel_timer(&recognizer->multi_click_timer); const bool needs_reset = false; prv_dispatch_event(recognizer, ClickHandlerOffsetRawDown, needs_reset); if (prv_is_long_click_enabled(recognizer)) { const uint32_t long_click_delay = prv_long_click_get_delay(recogniz...
void click_recognizer_handle_button_up(ClickRecognizer *recognizer) { const bool needs_reset = false; prv_dispatch_event(recognizer, ClickHandlerOffsetRawUp, needs_reset); if (recognizer->is_button_down == false) { // Ignore this button up event. Most likely, the recognizer has been // reset while the ...
6}, { 1216, 280, -272}, { 1288, 224, -136}, { 1216, 192, 8}, { 1048, 184, -136}, { 888, 248, -144}, { 848, 288, -56}, { 888, 312, 32}, { 936, 360, 24}, { 1024, 400, -24}, { 1728, 488, 64}, { 1480, 816, -24}, { 1064, 1352, -376}, { 1400, 216, -40}, { 960, 512, -184...
{ 328, -384, -600}, { 528, 88, -136}, { 1072, 336, -128}, { 1592, 248, 56}, { 2120, 736, -40}, // 32 seconds { 1760, 744, 312}, { 1392, 656, 304}, { 1264, 568, -144}, { 1248, 544, 88}, { 1248, 632, -72}, { 1152, 368, 56}, { 1256, 344, 16}, { 1600, 456, 32}, { ...
{ 984, 336, 144}, { 1000, 344, 80}, { 1184, 376, 120}, { 1688, 496, 352}, { 1208, 1024, 224}, { 1328, 1432, -272}, { 992, 400, 24}, { 984, 720, -144}, { 1096, 640, -32}, { 1344, 488, 32}, { 1488, 400, 32}, { 1456, 280, 96}, { 1480, 184, 120}, // 35 seconds { ...
seconds { -416, 456, -784}, { -408, 480, -768}, { -408, 448, -672}, { -376, 552, -632}, { -360, 672, -608}, { -328, 688, -568}, { -376, 768, -488}, { -360, 808, -448}, { -400, 840, -408}, { -368, 768, -384}, { -368, 928, -344}, { -360, 952, -288}, { -320, 864, -272}, ...
{ -160, 1096, -112}, { -232, 848, -32}, { -208, 672, -24}, { -248, 600, -72}, { -320, 568, 8}, { -416, 544, 48}, { -512, 656, 120}, { -632, 872, 32}, { -632, 1016, 176}, { -656, 1280, 208}, { -648, 1352, 360}, // 329 seconds { -480, 1224, 368}, { -400, 1032, 328},...
{ -128, 832, 160}, { -208, 960, 240}, { -200, 984, 328}, { -232, 1032, 216}, { -384, 1144, 376}, { -120, 1136, 120}, { -192, 1008, 48}, { -176, 920, 24}, { -224, 744, 80}, { -272, 680, 184}, { -304, 584, 120}, { -336, 632, 144}, { -408, 680, 264}, { -448, 872, 21...
[1] = jerry_create_number(0.0), [2] = jerry_create_number(0.0), [3] = jerry_create_number(0.0), }, .argc = 4, .expected_output = PP(0, 0, 0, 0), }, { .argv = { [0] = jerry_create_number(-0.5), [1] = jerry_create_number(-0.2), [2] = jerry_c...
cl_assert_equal_i(output.a, cases[i].expected_output.a)
; cl_assert_equal_i(output.r, cases[i].expected_output.r); cl_assert_equal_i(output.g, cases[i].expected_output.g); cl_assert_equal_i(output.b, cases[i].expected_output.b); } jerry_release_value(cases[i].input); cases[i].input = 0; } }
cur_time * 1000.0 + (double)cur_millis); ASSERT_JS_GLOBAL_EQUALS_D("local_day", 4.0); // Thursday ASSERT_JS_GLOBAL_EQUALS_D("local_hour", 14.0); // 1pm } void test_js__log_exception(void) { char *script = "var e1;\n" "var f1 = function(){throw new Error('test')};\n" "var f2 = function(){throw new 'te...
jerry_create_object()
; } } void test_js__get_global_builtin(void) { jerry_value_t date_builtin = jerry_get_global_builtin((const jerry_char_t *)"Date"); cl_assert(!jerry_value_is_undefined(date_builtin)); cl_assert(jerry_value_is_constructor(date_builtin)); jerry_release_value(date_builtin); jerry_value_t json_builtin = jerry...
ext(dialog, "Confirmation"); dialog_set_background_color(dialog, GColorGreen); dialog_set_icon(dialog, data->resource_id_80); dialog_show_status_bar_layer(dialog, true); actionable_dialog_set_action_bar_type(actionable_dialog, DialogActionBarConfirm, NULL); actionable_dialog_set_click_config_provider(actiona...
dialog_set_text(dialog, data->lorem_ipsum)
; dialog_set_background_color(dialog, GColorLightGray); dialog_set_icon(dialog, data->resource_id_25); dialog_show_status_bar_layer(dialog, true); expandable_dialog_set_header(expandable_dialog, "Header"); app_expandable_dialog_push(expandable_dialog); } //////////////////////////////// // Expandable Dialog...
vent_time, MAX_RELATIVE_HRS); cl_assert_equal_s("In 2 hours", time_buf); // June 9th 2015, 15:59:00 (T-00:01:00) rtc_set_time(event_time - (1 * SECONDS_PER_MINUTE)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("In 1 minute", time_buf); // June 9th 2015...
(event_time - (14 * SECONDS_PER_HOUR))
; clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS); cl_assert_equal_s("16:00", time_buf); // June 8th 2015, 16:00:00 (T-48:00:00) rtc_set_time(event_time - SECONDS_PER_DAY - (24 * SECONDS_PER_HOUR)); clock_get_until_time(time_buf, sizeof(time_buf), event_time, MAX_RELATIVE_HRS);...
/* * 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, peek_layer->bg_color)
*heartbeat, AnalyticsMetric metric, uint32_t index, int64_t val) { uint8_t *location = prv_heartbeat_get_array_location(heartbeat, metric, index); prv_location_set_value(location, val, analytics_metric_element_type(metric)); } void analytics_heartbeat_set_entire_array(AnalyticsHeartbeat *heartbeat, AnalyticsMetri...
analytics_metric_num_elements(metric)
ct NapPinState { time_t last_triggered_utc; } NapPinState; static NapPinState s_nap_pin_state; // Sleep and activity metric stats static ActivityInsightMetricHistoryStats s_sleep_stats; static ActivityInsightMetricHistoryStats s_activity_stats; // --------------------------------------------------------------------...
("GREAT DAY TODAY")
e_window; WorkoutController workout_controller; AppSync sync; uint8_t sync_buffer[148]; uint8_t current_bpm; char duration_string[20]; char distance_string[20]; char pace_string[20]; char custom_label_string[20]; char custom_value_string[20]; bool is_paused; bool supports_third_party_hr; Work...
(data->custom_value_string, new_tuple->value->cstring, sizeof(data->custom_value_string))
; prv_update_scrollable_metrics(data); } break; } default: // Unknown key return; } } static bool prv_is_paused(void) { SportsAppData *data = app_state_get_user_data(); return data->is_paused; } static bool prv_pause(bool should_be_paused) { SportsAppData *data = app_st...
/* * 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 !flash_sanity_check(); }
in the same ballpark but cover less distance prv_set_user(Human_ShortMale); int short_guy_distance = activity_private_compute_distance_mm(steps, time_ms) / MM_PER_METER; cl_assert_within(short_guy_distance, 36000, 44000); cl_assert_gt(long_run_distance_m, short_guy_distance); // And finally throw in a specif...
activity_private_compute_resting_calories(short_time_m)
/ ACTIVITY_CALORIES_PER_KCAL); }
/* * 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 false; }
metadata_bytes += PNG_HEADER_SIZE; bitmap_sequence->png_decoder_data.read_cursor = metadata_bytes; bitmap_sequence->current_frame = 0; bitmap_sequence->current_frame_delay_ms = 0; if (reset_elapsed) { bitmap_sequence->elapsed_ms = 0; bitmap_sequence->play_index = 0; } return true; } //! Directl...
TimelineItemTypePin, .layout = LayoutIdTest, .all_day = 1, }, .attr_list = { .num_attributes = 0, .attributes = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, }; cl_assert(timeline_add(&multiday_ite...
timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1430200800 - 60 * 60)
, S_SUCCESS); const time_t midnight_apr_28_msk = 1430168400; cl_assert_equal_i(state.node->timestamp, midnight_apr_28_msk); } void test_timeline__0_duration_all_day(void) { const time_t midnight_march_3_utc = 1425340800; TimelineItem all_day_item = { .header = { .id = { 0x29, 0xac, 0xd8, 0xb5, 0x09,...
----------------- // Sample captured: 2015-10-01 09:37:05 local AccelRawData *activity_sample_walk_100_pbl_25471_9(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25471_9 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 80 //> TEST_EXPECTED_MAX 120 //> T...
{ 880, 744, 360}, { 1032, 888, 336}, { 864, 512, 0}, { 1240, 568, 0}, { 1488, 680, 8}, { 1824, 664, -24}, // 5 seconds { 2024, 512, -168}, { 1960, 248, 320}, { 1984, -120, -8}, { 1440, -296, -152}, { 1216, -280, -248}, { 968, -432, -48}, { 792, -368, -136}, { ...
{ 704, -144, -152}, { 1000, -8, -160}, { 1384, 152, -352}, { 2048, 208, -536}, { 2648, 208, -592}, { 2232, 232, -536}, { 1640, 304, -544}, { 1376, 296, -376}, { 1128, 480, -424}, { 840, 488, -360}, { 696, 712, -256}, { 504, 816, -176}, { 600, 840, -32}, { 1056, 8...
IORITY, true /* animated */); } else if (in_view) { // Only focus the new notification if it becomes the new front of the list. // In DND mode notifications can get inserted into the middle of the list and we don't // want to change focus in this use case if (notifications_presented_list_cur...
{ const bool animated = true; notification_window_focus_notification(id, animated); }
} // This function is only used by the notifications_app. // When it calls this function, it knows it is a valid notification already. void app_notification_window_remove_notification_by_id(Uuid *id) { NotificationWindowData *data = &s_notification_window_data; if (!s_in_use || data->is_modal) { return; } ...
/* * 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...
(1, sizeof(MockListNode))
; cl_assert_(func != NULL, "cl_will_return with invalid function name"); node->func = func; node->value = value; node->count = count; // Add to beginning of list node->next = s_mock_list_head.next; node->prev = &s_mock_list_head; s_mock_list_head.next = node; // Fixup the next entry. // In the case...
+ duration_a + duration_b + 5 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 0); cl_assert_equal_i(p...
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_handler_calls, d), 1); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, d)...
t(); // Try to subscribe for indications to the indicatable characteristic: e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, GAPLEClientKernel); cl_assert_equal_i(e, BTErrnoOK); } void test_gatt_client_subscriptions__subscribe_already_...
(characteristic, BLESubscriptionNone, GAPLEClientKernel)
; cl_assert_equal_i(e, BTErrnoInvalidState); fake_kernel_malloc_mark_assert_equal(); prv_assert_no_event(); } void test_gatt_client_subscriptions__subscribe_first_subscriber(void) { BLECharacteristic characteristic = prv_get_indicatable_characteristic(); BTErrno e = gatt_client_subscriptions_subscribe(charac...
/* * 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...
(circular_buffer_get_write_space_remaining(&buffer), 2)
; cl_assert(circular_buffer_consume(&buffer, 4)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 6); // Now there's just 56 in the buffer. Fill it to the brim cl_assert(circular_buffer_write(&buffer, (uint8_t*) "789", 3)); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&b...
is_hidden); } static void prv_content_indicator_setup_direction(HealthCardView *health_card_view, ContentIndicator *content_indicator, Layer *indicator_layer, ContentIn...
prv_refresh_select_indicator(health_card_view)
; prv_refresh_content_indicators(health_card_view); } } static const AnimationImplementation prv_bg_animation_implementation = { .update = &prv_bg_animation_update }; static int64_t prv_interpolate_moook_soft(int32_t normalized, int64_t from, int64_t to) { return interpolate_moook_soft(normalized, from, t...
ext(&utf8_iter)); } //! Decode multi-byte char void test_utf8_iterator__decode_test_single_codepoint_string_multi_byte(void) { // Mutable types Iterator utf8_iter; Utf8IterState utf8_iter_state; // Immutable types bool success = false; const Utf8Bounds utf8_bounds = utf8_get_bounds(&success, "\xc3\xb0"); ...
{ void *context = &s_context; const char *str = "\xc3\x28"; s_each_count = 0; cl_assert_equal_b(utf8_each_codepoint(str, prv_each_codepoint, context), false); cl_assert_equal_i(s_each_count, 0); }
cl_assert(notification_storage_find_ancs_notification_id(0, &u)); cl_assert(uuid_equal(&u, &e1.header.id)); cl_assert(notification_storage_find_ancs_notification_id(1, &u)); cl_assert(uuid_equal(&u, &e2.header.id)); cl_assert(notification_storage_find_ancs_notification_id(84, &u)); cl_assert(uuid_equal(&u, &...
uuid_generate(&i2)
; e2.header.id = i2; e2.header.status = 0xC0; notification_storage_store(&e2); cl_assert_equal_b(notification_storage_get(&i2, &r), false); TimelineItem e3 = e1; Uuid i3; uuid_generate(&i3); e3.header.id = i3; e3.header.type = TimelineItemTypeOutOfRange; notification_storage_store(&e3); cl_assert...
/* * 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...
{ HcProtocolMessage request = { .message_length = sizeof(request), .endpoint_id = HcEndpointID_Id, .command_id = HcMessageID_Id_ChipInfo, }; HcProtocolMessage *response = hc_protocol_enqueue_and_expect(&request); if (!response) { return false; } if (response->message_length < sizeof(HcProtoc...
if (subscription_type == BLESubscriptionNone || !has_pending_write) { // When unsubscribing or when Pebble was already subscribed, // immediately send unsubscription confirmation event to client: prv_send_subscription_event(characteristic_ref, ~gap_le_pebble_task_bit_for_client(client), ...
} if (next_prevailing_type == BLESubscriptionNone) { // No more subscribers or CCCD write failed, free the node: prv_remove_subscription(connection, subscription); } return ret_val; } BTErrno gatt_client_subscriptions_subscribe(BLECharacteristic characteristic_ref, ...
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE)
; PWR_BackupAccessCmd(ENABLE); // Disable write-protect on RTC_BKP_x registers } void boot_main(void) { prv_configure_system_flash(); prv_enable_backup_access(); dbgserial_init(); prv_print_reset_reason(); boot_bit_init(); if (!rtc_init()) { // Need to initialize the display in this // case s...
{ return; }
const uint32_t actual_num_sessions = MIN(num_sessions, ARRAY_LENGTH(state->cache->sessions)); prv_sessions_sort(state->cache->sessions, actual_num_sessions, direction); for (uint32_t idx = 0; idx < actual_num_sessions; idx++) { const ActivitySession *const session = &state->cache->sessions[idx]; if (pr...
assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, 1425272400), S_SUCCESS); time_t midnight_march_2_pst = 1425283200; // day 1 cl_assert(uuid_equal(&state.pin.header.id, &multiday_item.header.id)); cl_assert(uuid_equal(&state.node->id, &multiday_item.header.id)); cl_...
cl_assert_equal_i(state.node->timestamp, midnight_march_3_utc)
; cl_assert_equal_i(state.node->duration, 8 * MINUTES_PER_HOUR); cl_assert_equal_i(state.current_day, midnight_march_2_pst); // day 2 cl_assert(iter_next(&iterator)); cl_assert(uuid_equal(&state.pin.header.id, &all_day_item.header.id)); cl_assert(uuid_equal(&state.node->id, &all_day_item.header.id)); cl_...
/* * 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...
longjmp(*s_state.jmp_on_failure, 1)
outbox->sent_callback(&outbox->iterator, outbox->user_context); } } else { if (outbox->failed_callback) { outbox->failed_callback(&outbox->iterator, outbox->result, outbox->user_context); } } } static void prv_handle_nack_or_ack_timeout(AppMessageCtxOutbox *outbox, ...
{ return (phase == OUT_AWAITING_REPLY_AND_OUTBOX_CALLBACK || phase == OUT_AWAITING_REPLY || phase == OUT_AWAITING_OUTBOX_CALLBACK); }
static bool prv_is_awaiting_ack(AppMessagePhaseOut phase) { return (phase == OUT_AWAITING_REPLY_AND_OUTBOX_CALLBACK || phase == OUT_AWAITING_REPLY); } AppMessageResult app_message_outbox_begin(DictionaryIterator **iterator) { AppMessageCtxOutbox *outbox = &app_state_get_app_message_ctx()->outbox; if ...
art 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), 1); // Execute to the end of B & C prv_advance_to_ms_w...
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b2), 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...
analytics_metric_element_size(metric)
; if (index > len) { PBL_CROAK("Attempt to use array value at invalid index %" PRId32 " (len %" PRId32 ")", index, len); } return heartbeat->data + analytics_metric_offset(metric) + index*element_size; } static void prv_location_set_value(uint8_t *location, int64_t val, AnalyticsMetricElementTy...
(&SYSTEM_CAPABILITIES_KEY, sizeof(SYSTEM_CAPABILITIES_KEY), capabilities_out, sizeof(PebbleProtocolCapabilities)); // Default to zero capabilities if no entry found if (!read_size) { *capabilities_out = (PebbleProtocolCapabilities) {}; } } void bt_persistent_storage_get_c...
if (data->type == BtPersistBondingTypeBTClassic) { prompt_send_response_fmt(display_buf, DISPLAY_BUF_LEN, "Classic Key %d", (int)bond_id); bluetooth_persistent_storage_debug_dump_classic_pairing_info( display_buf, &data->bt_classic_data.addr, &data->bt_classic_data.name[0], ...
bluetooth_persistent_storage_debug_dump_ble_pairing_info(&display_buf[0], &info); // does this info match the key stored in shared resources SMPairingInfo sprf_info = {}; bool requires_address_pinning; uint8_t flags; shared_prf_storage_get_ble_pairing_data(&sprf_info, NULL, &requires_address_p...
/* * 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 (font_height == s_emoji_fonts[i].height) { return sys_font_get_system_font(s_emoji_fonts[i].key_name); } }
// Didn't find a suitable emoji font return NULL; } #endif uint8_t fonts_get_font_height(GFont font) { FontInfo* fontinfo = (FontInfo*) font; return fontinfo->max_height; } int16_t fonts_get_font_cap_offset(GFont font) { if (!font) { return 0; } // FIXME PBL-25709: Actually use font-specific caps ...
if (remaining_ms) { // Start timer that will periodically check for the erase to complete new_timer_start(s_erase_poll_timer, remaining_ms, prv_flash_erase_timer_cb, NULL, 0); } } static void prv_blocking_erase_complete(void *context, status_t status) { PBL_ASSERT(PASSED(status), "Flash erase failure: %" ...
{ psleep(10); }
mutex_unlock(s_flash_lock); } #endif void flash_sleep_when_idle(bool enable) { // the S29VS flash automatically enters and exits standby } bool flash_get_sleep_when_idle(void) { return false; } bool flash_is_initialized(void) { return (s_flash_lock != NULL); } void flash_stop(void) { if (!flash_is_initia...
/* * 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...
DEFINE_SYSCALL(void, sys_event_service_client_subscribe, EventServiceInfo *handler)
{ if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(handler, sizeof(*handler)); } PebbleTask task = pebble_task_get_current(); // Get info QueueHandle_t *event_queue; if (task == PebbleTask_App) { event_queue = app_manager_get_task_context()->to_process_event_queue; } else if (task ...
ndow_stack); cl_assert_equal_i(window->on_screen, true); cl_assert_equal_i(window->is_loaded, false); window_stack_pop(window->parent_window_stack, true); } static void prv_push_window_unload(Window *window) { WindowStack *stack = window->parent_window_stack; prv_window_unload(window); Window *new_windo...
(window1->on_screen, false)
; app_window_stack_remove(window2, false); cl_assert_equal_i(app_window_stack_count(), 0); cl_assert_equal_i(window2->on_screen, false); cl_assert_equal_i(window1->on_screen, false); window_destroy(window1); window_destroy(window2); } void test_window_stack__pop_all(void) { WindowStack *stack = modal_...
_list_validate(GDrawCommandList *command_list, size_t size) { if (!command_list || (size < sizeof(GDrawCommandList)) || (command_list->num_commands == 0)) { return false; } uint8_t *end = (uint8_t *)command_list + size; GDrawCommand *command = command_list->commands; for (uint32_t i = 0; i < ...
(data.processed_draw_command)
; } } } static bool prv_calc_size(GDrawCommand *command, uint32_t idx, void *ctx) { size_t *size = ctx; *size += gdraw_command_get_data_size(command); return true; } uint32_t gdraw_command_list_get_num_commands(GDrawCommandList *command_list) { if (!command_list) { return 0; } return command_l...
/* * 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...
{ gpio_init = s_default_at_flash_cfg; }
258908 }, // priority rank 36 { .id = 15, .priority = 19, .size = 117885 }, // priority rank 11 { .id = 16, .priority = 42, .size = 167427 }, // priority rank 31 { .id = 17, .priority = 1, .size = 22644 }, // priority rank 2 { .id = 18, .priority = 30, .size = 33202 }, // priority rank 22 { .id = 19, .pri...
app_cache_get_size()
; cl_assert(before_size >= to_free); cl_assert_equal_i(S_SUCCESS, app_cache_free_up_space(to_free)); fake_system_task_callbacks_invoke_pending(); after_size = app_cache_get_size(); cl_assert_equal_i(after_size, (before_size - 207357)); // test two lowest priority's size prv_cleanup(); to_free = (207357...
8 - 1)) / 8; } void test_text_resources__initialize(void) { fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); load_resource_fixture_on_pfs(RESOURCES_FIXTUR...
FONT_VERSION(s_font_info.base.md.version)
, 3); cl_assert_equal_i(s_font_info.base.md.wildcard_codepoint, WILDCARD_CODEPOINT); } void test_text_resources__test_backup_wildcard(void) { const uint8_t wildcard_bytes[] = {0x3f, 0xc6, 0x18, 0x63, 0x8c, 0x31, 0xc6, 0x0f}; uint32_t font_fallback = RESOURCE_ID_FONT_FALLBACK_INTERNAL; cl_assert(text_resources...
/* * 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...
{ do_rail_power(enable, GPIOH, GPIO_Pin_0, true); }
void bb2_rail_cfg_fn(void) { i2c_bus_rail_ctl_config((OutputConfig){ GPIOH, GPIO_Pin_0, true}); } // v1_5 ///////// void v1_5_rail_ctl_fn(bool enable) { do_rail_power(enable, GPIOH, GPIO_Pin_0, true); } void v1_5_rail_cfg_fn(void) { i2c_bus_rail_ctl_config((OutputConfig){ GPIOH, GPIO_Pin_0, true}); } // v2_0...
value, 1 /* one byte */); // Data will be dropped, no event :( prv_assert_no_event(); // Receive another GATT notification. Won't fit until consumed. // Consuming is happening before the timeout hits (in the yield callback): fake_queue_set_yield_callback(ga...
(has_more, false)
; BLECharacteristic characteristic_out = ~0; uint8_t value = 0xff; value_length = sizeof(value); gatt_client_subscriptions_consume_notification(&characteristic_out, &value, &value_length, GAPLEClientKernel, &has_more); // Expect untouched: cl_assert_equal_i(...
s = 0; static void prv_sleep_timer_test_cb(void *data) { uint32_t count = (uint32_t)data; for (int j = 0; j < 10; j++) { bt_driver_send_sleep_test_cmd(true); psleep(9); } if (count >= s_num_sleep_iters) { bt_driver_send_sleep_test_cmd(false); prompt_send_response("100 % - PASS"); new_timer...
prompt_send_response("Invalid BLE core command")
; return; } bt_driver_core_dump(option); } #if PERFORMANCE_TESTS // for task_watchdog_bit_set_all #include "drivers/task_watchdog.h" // For taskYIELD() #include "FreeRTOS.h" #include "task.h" // Average this many iterations of the text test for getting useful perf numbers. #define PERFTEST_TEXT_ITERATIONS 5 ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
time_util_get_day_in_week(timestamp)
; } static void prv_draw_title(HealthGraphCard *graph_card, GContext *ctx) { const GRect *bounds = &graph_card->layer.bounds; graphics_context_set_text_color(ctx, GColorBlack); const int title_height = 60; GRect drawing_box = GRect(0, 0, bounds->size.w, title_height); #if PBL_ROUND // inset the drawing boun...
52, 400}, { 824, -408, 312}, { 720, -400, 216}, { 736, -176, 240}, { 880, 144, 256}, { 960, 288, 152}, { 1080, 328, 272}, // 151 seconds { 928, 352, 0}, { 896, 400, 320}, { 968, 1160, 216}, { 648, 392, 360}, { 832, 288, -192}, { 624, 144, -160}, { 464, 568, -376},...
{ 360, 976, 24}, { 272, 1000, -24}, { 216, 1072, 72}, { 168, 1048, 40}, { 104, 920, 8}, { -8, 960, -16}, { 112, 952, -120}, { 88, 1040, 32}, { 48, 872, 64}, { -128, 968, 152}, { -24, 752, 184}, { -48, 664, 32}, { -8, 560, -64}, { -24, 512, -64}, { 32, 624, 24}...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
strtol("-765", NULL, 10)
, -765); cl_assert_equal_i(strtol(" -573888", NULL, 10), -573888); cl_assert_equal_i(strtol(" +713713", NULL, 10), +713713); } void test_strtol__error(void) { cl_assert_equal_i(strtol("2147483647", NULL, 10), 2147483647); // last valid value cl_assert_equal_i(strtol("-2147483648", NULL, 10), -2147483648); /...
#else const bool result = prv_blank_check_mmap(dev, addr, is_subsector); #endif qspi_release(dev->qspi); return result ? S_TRUE : S_FALSE; } void qspi_flash_ll_set_register_bits(QSPIFlash *dev, uint8_t read_instruction, uint8_t write_instruction, uint8_t value, uint8_t mask) ...
(dev, &instruction, &dummy_cycles, &is_ddr)
; qspi_indirect_read_dma(dev->qspi, instruction, 0, dummy_cycles, buffer_dma, size, is_ddr); profiler_stop(); uint32_t dma_time = profiler_get_total_duration(true); profiler_start(); qspi_indirect_read(dev->qspi, instruction, 0, dummy_cycles, buffer_pol, size, is_ddr); profiler_stop(); uint32_t pol_time ...