prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
); return true; } if (!prv_is_object_allowed(type)) { return true; } if (!prv_has_valid_fw_update_state_for_object_type(type)) { PBL_LOG(LOG_LEVEL_ERROR, "Not in FW update state"); return true; } return false; } static bool prv_parse_init_index(const InitRequest *init_request, uint32_t *ind...
(info->init_req_magic)
prv_draw_cell_backgrounds(selection_layer, ctx); // If the slider is in motion draw it. This is above the backgrounds, but below the text if (selection_layer->slide_amin_progress) { prv_draw_slider_slide(selection_layer, ctx); } if (selection_layer->slide_settle_anim_progress) { prv_draw_slider_settle(...
(animation, anim_handler, selection_layer)
; selection_layer->bump_settle_anim_impl = (AnimationImplementation) { .update = prv_bump_settle_impl, }; animation_set_implementation(animation, &selection_layer->bump_settle_anim_impl); return animation; } static void prv_run_value_change_animation(SelectionLayer *selection_layer) { #if !PLATFORM_TINTI...
/* * 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_t t = sys_get_time(); if (tloc) { *tloc = t; } return (t); }
sticData], BLESubscriptionNotifications, BLEGATTErrorSuccess); // Expect Reset to be initiated ("Reset Request" sent by FW): prv_assert_sent_reset_request(s_characteristics[0][PPoGATTCharacteristicData]); // Receive data: prv_receive_short_data_fragment(s_characteristics[0][PPoGATTC...
cl_assert_equal_b(fake_comm_session_send_buffer_write_raw_by_transport(transport, s_short_data_fragment, sizeof(s_short_data_fragment)), true)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
mutex_unlock(s_mutex)
ctionFlag_IsSubscribedToConnectionStatusNotifications] = 'S', [ConnectionFlag_IsSubscribedToGattMtuNotifications] = 'M', [ConnectionFlag_IsSubscribedToConnParamNotifications] = 'C', [ConnectionFlag_ShouldPinAddress] = 'P', [ConnectionFlag_ShouldAutoAcceptRePairing] = 'A', [ConnectionFlag_IsReversedP...
{ GattOperation *tmp = connection->gatt_op_list; if (!tmp) { rv = false; goto unlock; } *context_ref = tmp->object_ref; *resp_dest = tmp->resp_dest; PBL_ASSERTN(tmp->op_type == expected_op_type); connection->gatt_op_list = (GattOperation *)list_pop_head((ListNode *)connection-...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
PBL_ASSERTN(success)
; } } #endif void app_idle_timeout_start(void) { PBL_ASSERTN(s_timer == TIMER_INVALID_ID); s_app_started = true; #ifndef NO_WATCH_TIMEOUT prv_start_timer(true /* create a timer */); #endif } void app_idle_timeout_stop(void) { if (s_timer != TIMER_INVALID_ID) { new_timer_delete(s_timer); s_timer = T...
pdate_proc(&layer, &draw_text_single_line_wordwrap_clip_across_nx); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wo...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_aaa22.${BIT_DEPTH_NAME}.pbi"))
; } #define RECT_NULL GRect(0, 0, 0, 0) #define RECT_NULL_W GRect(0, 0, 0, 20) #define RECT_NULL_H GRect(0, 0, 20, 0) #define RECT_NEG GRect(0, 0, -20, -20) #define RECT_NEG_W GRect(0, 0, -20, 0) #define RECT_NEG_H GRect(0, 0, 0, -20) void test_graphics_draw_text_${BIT_DEPTH_NAME}__zero(void) { GContext ctx; prv_...
// 1365: Local time: 06:17:00 AM { 0, 0x73, 0, 148}, { 0, 0x73, 0, 149}, { 0, 0x73, 0, 148}, { 0, 0x73, 0, 149}, { 0, 0x73, 0, 144}, { 0, 0x83, 263, 149}, { 0, 0x8f, 0, 149}, { 0, 0x8f, 0, 149}, { 0, 0x8f, 0, 149}, { 0, 0x8f, 0, 146}, { 0, 0x8f, 0, 149}, { 0, 0x8f, 0, ...
{ 0, 0x56, 1445, 198}, { 0, 0x45, 856, 194}, { 7, 0x55, 1620, 191}, { 10, 0x55, 2815, 190}, { 0, 0x46, 1237, 189}, { 0, 0x56, 1885, 195}, { 16, 0x45, 1438, 178}, }; *len = ARRAY_LENGTH(samples); return samples; }
/* * 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_alg_state) { #if RELEASE PBL_LOG(LOG_LEVEL_ERROR, "Trying to use the activity algorithm but it hasn't been initialized"); return false; #else WTF; #endif }
ver! Note this will happen every 2^32 / 1024 (tick rate) seconds, which is about // 49 days. If this function doesn't get called for 49 days we'll miss a rollover but that's // extremely unlikely. TickType_t rollover_amount = -1; s_coarse_ticks += rollover_amount; } s_last_freertos_tick_count = fre...
rtc_set_time(*out_seconds)
assert(num.integer == 0); cl_assert(num.fraction == 7); test_num = (int16_t)((float)1 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_S16_3){ .raw_value = test_num }; cl_assert(num.integer == 1); cl_assert(num.fraction == 0); test_num = (int16_t)((float)1.125 * (1 << FIXED_S16_3_PRECISION)); num = (Fixed_...
Fixed_S16_3_add(num1, num2)
; sum_c = (Fixed_S16_3){ .raw_value = (int16_t)((float)2 * (1 << FIXED_S16_3_PRECISION)) }; cl_assert(sum.raw_value == sum_c.raw_value); // sum = 3.5 + 1 = 4.5 num1 = (Fixed_S16_3){ .raw_value = (int16_t)((float)3.5 * (1 << FIXED_S16_3_PRECISION)) }; num2 = FIXED_S16_3_ONE; sum = Fixed_S16_3_add(num1, num2...
////////////////////////////////////////////////////////////////////////////////// //! Handlers static void prv_handle_pause_button(WorkoutActiveWindow *active_window) { bool is_paused = false; if (active_window->workout_controller) { is_paused = active_window->workout_controller->is_paused(); } if (activ...
window_set_user_data(window, active_window)
; window_set_background_color(window, BACKGROUND_COLOR); window_set_window_handlers(window, &(WindowHandlers){ .unload = prv_window_unload_handler, }); GRect base_layer_bounds = window->layer.bounds; #if PBL_RECT base_layer_bounds.size.w -= ACTION_BAR_WIDTH; #endif base_layer_bounds.origin.y = STATUS_...
{ printf("%s: %d, ", names[i], values[i]); stats->values[i] = values[i]; }
printf("\n"); // Append to the list if (s_stat_rows) { list_append(&s_stat_rows->node, &stats->node); } else { s_stat_rows = stats; } } // --------------------------------------------------------------------------------------- // Set a specific column in the last row by name static void prv_stats_...
/* * 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...
otp_get_lock(index)
; *lock = 0; return OtpWriteSuccess; }
#else ASSERT_CALLED(graphics_line_draw_stroked_non_aa(&context, GPoint(5, 5), GPoint(45, 10), 2)); #endif setup_test(&context, true, 2, GColorBlack, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10))); setup_test(&context, ...
setup_test(&context, false, 5, GColorBlack, GColorBlack, false)
; graphics_fill_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_fill_rect_non_aa(&context, &GRect(10, 20, 40, 10), 0, GCornerNone, GColorBlack)); setup_test(&context, false, 5, GColorBlack, GColorBlack, false); graphics_fill_circle(&context, GPoint(50, 50), 10); ASSERT_CALLED(graphics_circle_fill_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...
attributes_actions_serialize_payload(attr_list, action_group, actual_buf, buf_size)
; cl_assert_equal_m(expected_buf, actual_buf, attributes_actions_get_serialized_payload_size(s_expected_attributes, s_expected_actions)); } return S_SUCCESS; } void ios_notif_pref_db_free_prefs(iOSNotifPrefs *prefs) { return; } static void prv_compare_notif_prefs(iOSNotifPrefs *prefs1, iOSNotifPrefs...
(&list, AttributeIdSecondaryColor, secondary_color.argb); attribute_list_add_cstring(&list, AttributeIdTitle, "Avalanche at Sharks"); attribute_list_add_cstring(&list, AttributeIdSubtitle, "Q4 • 1:25"); attribute_list_add_uint32(&list, AttributeIdSportsGameState, is_ingame ? 1 : 0); attribute_list_add_cstring(&...
("Attendees\0Organizer")
; static StringList paragraphs = StringListLiteral("Ryan Case\nBrad Murray\0Sarah Otten"); attribute_list_add_string_list(&list, AttributeIdHeadings, &headings); attribute_list_add_string_list(&list, AttributeIdParagraphs, &paragraphs); attribute_list_add_cstring(&list, AttributeIdBody, "Body message"); attri...
// Make sure pin is pushed once we have slept some prv_add_sleep_session(0, 7); activity_insights_process_sleep_data(rtc_get_time()); cl_assert_equal_i(s_data.pins_added, 1); } // --------------------------------------------------------------------------------------- // Make sure that if you wake up for a sho...
rtc_set_time(now)
1000, }; prv_insert_artificial_activity_session(minute_raw_data, k_minute_data_len, &exp_session); prv_feed_activity_minutes(minute_raw_data, k_minute_data_len); cl_assert_equal_i(s_num_captured_activity_sessions, 1); ASSERT_ACTIVITY_SESSION_PRESENT(s_captured_activity_sessions, s_num_captured_act...
ASSERT_ACTIVITY_SESSION_PRESENT(s_captured_activity_sessions, s_num_captured_activity_sessions, &exp_session_run)
; } kernel_free(s_kalg_state); s_kalg_state = NULL; } // --------------------------------------------------------------------------------------- void test_kraepelin_algorithm__sleep_stats(void) { // Init algorithm state s_kalg_state = kernel_zalloc(kalg_state_size()); // It's easier to understand the al...
/* * 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...
gdraw_command_list_draw_processed(ctx, &image->command_list, processor)
; // Offset graphics context drawing box back to previous origin graphics_context_move_draw_box(ctx, GPoint(-offset.x, -offset.y)); } size_t gdraw_command_image_get_data_size(GDrawCommandImage *image) { if (!image) { return 0; } return sizeof(GDrawCommandImage) - sizeof(GDrawCommandList) + gdraw_...
/* * 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...
(connection, BtConsumerPebblePairingServiceRemoteDevice, remote_desired_state, max_period_secs)
; } void bt_driver_cb_pebble_pairing_service_handle_connection_parameter_write( const BTDeviceInternal *device, const PebblePairingServiceConnParamsWrite *conn_params, size_t conn_params_length) { bt_lock(); { GAPLEConnection *connection = gap_le_connection_by_device(device); if (!connection) {...
ic uint16_t prv_custom_day_picker_get_num_rows(struct MenuLayer *menu_layer, uint16_t section_index, void *callback_context) { return DAYS_PER_WEEK + 1; } static int16_t prv_custom_day_picker_get_cell_height(struct MenuLayer *menu_layer, ...
{ AlarmEditorData *data = (AlarmEditorData *)callback_context; if (cell_index->row == 0) { // selected the "completed day selection" row if (!prv_is_custom_day_scheduled(data)) { // clicking "complete" when no days are selected data->show_check_something_first_text = true; layer_mark_dirty(menu_lay...
int_luminance_lookup_table_init(tint_color, lookup_table_out); cl_assert(gcolor_equal(lookup_table_out[0], GColorBlue)); cl_assert(gcolor_equal(lookup_table_out[1], GColorLiberty)); cl_assert(gcolor_equal(lookup_table_out[2], GColorBrass)); cl_assert(gcolor_equal(lookup_table_out[3], GColorYellow)); // looku...
gcolor_component_multiply(2, 1)
, 1); }
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ #ifndef RECOVERY_FW // Since all migrations are to UTC time, we are passed the relative offset from UTC notifications_migrate_timezone(utc_diff); wakeup_migrate_timezone(utc_diff); #endif }
static time_t prv_migrate_local_time_to_UTC(time_t local_time) { return time_local_to_utc(local_time); } // Should only called by prv_update_time_info_and_generate_event()! static void prv_handle_timezone_set(TimezoneInfo *tz_info) { // Check if the timezone is set before setting it. This ensures that this //...
ector; static bool flash_locked, flash_flags_set; static FLASH_Status return_status; uint8_t *flash_written_data; bool *flash_written_flag; void *source_buffer; uint32_t flash_data_start, flash_data_length; bool callback_called; void test_system_flash__initialize(void) { erased_sector = 0; flash_locked = true; f...
malloc_flash_data(10)
; flash_data_start = FLASH_BASE; cl_assert(!system_flash_write(FLASH_BASE, "abc", 3, NULL, NULL)); cl_assert(flash_locked); assert_flash_unwritten(0, 10); } extern void FLASH_Lock(void) { flash_locked = true; } extern void FLASH_Unlock(void) { flash_locked = false; } extern void FLASH_ClearFlag(uint32_t ...
; do { num_processed = prv_do_data_handle_chunk(state, time_interval_ms); sys_analytics_add(ANALYTICS_APP_METRIC_ACCEL_SAMPLE_COUNT, num_processed, AnalyticsClient_CurrentTask); } while (num_processed); } // ----------------------------------------------------------------------------------------------- ...
accel_session_double_tap_unsubscribe(session)
; } // ---------------------------------------------------------------------------------------------- int accel_service_peek(AccelData *accel_data) { AccelServiceState *state = accel_service_private_get_session(PebbleTask_Unknown); int rc = sys_accel_manager_peek(accel_data); ACCEL_LOG_DEBUG("peek data x:%d, ...
ice_handle_last(); cl_assert_equal_i(s_data.num_change_calls, 1); cl_assert_equal_i(s_data.last_change_progress, progress); } void test_unobstructed_area_service__change_after_subscribe(void) { const GRect from_area = GRect(0, 0, DISP_COLS, 400); const GRect to_area = GRect(0, 0, DISP_COLS, 200); unobstructe...
(to_area.size.h)
; fake_event_service_handle_last(); cl_assert_equal_i(s_data.num_will_change_calls, 1); cl_assert_equal_i(s_data.num_did_change_calls, 1); } void test_unobstructed_area_service__layer_no_clip(void) { app_state_get_unobstructed_area_state()->area = GRect(0, 0, 400, 400); Layer root_layer = { .bounds = GR...
_start_tracking(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); // All of our tests start at 5pm. Let's enter a sleep cycle where the user has a sleep session // before the cut-off for the new day // Light walking, 50 steps/minute, until 6pm prv_feed_cannned_accel_data(1 * SECONDS_PER_HOUR...
cl_assert(enabled)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ const uint8_t command; FirmwareMetadata running_fw_metadata; FirmwareMetadata recovery_fw_metadata; uint32_t boot_version; char hw_version[MFG_HW_VERSION_SIZE]; char serial_number[MFG_SERIAL_NUMBER_SIZE]; BTDeviceAddress device_address; ResourceVersion system_resources_version; char iso_locale[ISO_L...
ACTIVITY_FIXTURE_PATH "activity" // The expected resting kcalories is determined empirically from a known good commmit and // is based on the current time of day and the user's weight, age etc. const int s_exp_5pm_resting_kcalories = 1031; const int s_exp_full_day_resting_kcalories = 1455; // Stub for health tracking...
{ PBL_ASSERTN(xQueue == QUEUE_HANDLE); s_queue_value++; return true; }
QueueHandle_t xQueueGenericCreate(unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType) { return QUEUE_HANDLE; } // ============================================================================================= // Data logging stubs ty...
header.characteristic; } if (value_length_out) { *value_length_out = header.value_length; } } return has_notification; } DEFINE_SYSCALL(void, sys_ble_client_consume_read, uintptr_t object_ref, uint8_t value_out[], ...
if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(uuid, sizeof(*uuid)); }
); if (memcmp(t, &t_c, sizeof(GTransform)) == 0) { return true; } return false; } bool gtransform_is_only_scale(const GTransform * const t) { if (!t) { return false; } if ((t->b.raw_value == GTransformNumberZero.raw_value) && (t->c.raw_value == GTransformNumberZero.raw_value) && (t->...
{ return false; }
memcpy(t_new, t, sizeof(GTransform)); // FIXME: NYI - copy original into t_new for now return false; } ////////////////////////////////////// /// Applying Transformations ////////////////////////////////////// GPointPrecise gpoint_transform(GPoint point, const GTransform * const t) { GPointPrecise pointP = G...
er_timer_id()), sizeof(TimelineItemId)); cl_assert(stub_new_timer_timeout(get_reminder_timer_id()) == 100 * 1000); // ...until we insert item 1 back cl_assert(S_SUCCESS == reminders_insert(&item1)); cl_assert_equal_m(&item1.header.id, stub_new_timer_callback_data(get_reminder_timer_id()), sizeof(TimelineItemId)...
(reminders_insert(&s_reminder_before_all_day_reminder), S_SUCCESS)
; // set time to 16:00 PST March 4 now = 1425513600; reminders_init(); cl_assert_equal_i(stub_new_timer_timeout(get_reminder_timer_id()), 5 * 60 * 60 * 1000); cl_assert(uuid_equal(&s_reminder_before_all_day_reminder.header.id, (Uuid *)stub_new_timer_callback_data(get_reminder_timer_id()))); // set time...
ue_idx) { return true; } VisibleContext *ctx = data; ctx->visible = (ctx->window == iter->current_top_window); return !ctx->visible; } bool modal_manager_is_window_visible(Window *window) { VisibleContext context = { .window = window }; prv_each_modal_stack(prv_is_window_visible_callback, &context); ...
for (ModalPriority priority = NumModalPriorities - 1; priority > ModalPriorityInvalid; --priority) { prompt_send_response_fmt(buffer, sizeof(buffer), "Priority: %d (%zu)", priority, info.counts[priority]); if (info.counts[priority] > 0 && !info.dumps[priority]) { ...
} void modal_manager_reset(void) { for (ModalPriority idx = ModalPriorityInvalid + 1; idx < NumModalPriorities; idx++) { memset(&s_modal_window_stacks[idx], 0, sizeof(ModalContext)); } s_modal_min_priority = ModalPriorityDiscreet; modal_manager_init(); }
&g_window_transition_none_implementation; const WindowTransitionImplementation *transition_pop = animated ? window_transition_get_default_pop_implementation() : &g_window_transition_none_implementation; window_stack_push_with_transition(window_stack, window, transition_insert...
prv_remove_item(item, transition)
; return window != NULL; } bool window_stack_contains_window(WindowStack *window_stack, Window *window) { return (prv_find_window_stack_item_for_window(window_stack, window) != NULL); } uint32_t window_stack_count(WindowStack *window_stack) { return list_count(window_stack->list_head); } // Stack status //////...
PBL_LOG(LOG_LEVEL_WARNING, "Couldn't resolve last written pg")
; s_last_page_written = s_pfs_page_count - 1; #if UNITTEST if (s_test_last_page_written_override != -1) { s_last_page_written = s_test_last_page_written_override; } #endif } //! @param region - The erase sector we want to scan through //! @param first_free_page - Populated with the first erased page found //...
016, -256, -328}, { 1304, 32, -272}, { 1584, 96, -160}, { 1952, 160, -32}, { -1944, 384, -128}, { 1936, 528, -152}, { 1648, 648, -104}, { 1472, 664, -128}, { 1688, 368, -136}, { 1488, 584, -8}, { 1320, 1272, -208}, { 1024, 1576, -224}, { 936, 960, -216}, { 1168, 1016,...
{ 1384, 400, -88}, { 1512, 904, -104}, { 1080, 1392, -216}, { 1000, 968, -168}, { 936, 864, -216}, { 832, 608, -224}, { 1176, 592, -144}, { 1600, 656, 0}, { 1888, 600, 16}, { 1760, 416, -8}, { 1736, 272, 48}, { 1696, 240, 40}, { 1560, 328, -64}, { 1320, 264, -224}...
{ 928, -344, -72}, { 640, -200, -288}, { 1024, -216, -216}, { 1184, 40, -232}, { 1288, 160, -176}, { 1456, 456, -296}, { 1776, 1248, -544}, { 1408, 1216, -408}, { 904, 976, 24}, { 352, 1080, 64}, { 8, 1368, -512}, { 48, 760, -40}, { 120, 1088, 168}, { 272, 1216, ...
/* * 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 (app_install_get_entry_for_install_id(app_id, &entry)) { strncpy(buffer, entry.name, buf_len); buffer[buf_len - 1] = '\0'; return; }
} // if failed both, set as empty string buffer[0] = '\0'; } // Filter List Callbacks //////////////////////// static void prv_deinit_cb(SettingsCallbacks *context) { QuickLaunchData *data = (QuickLaunchData *) context; i18n_free_all(data); app_free(data); } static void prv_update_app_names(QuickLaunchDa...
duration(player->reel); bool is_reel_infinite = (kino_reel_duration == PLAY_DURATION_INFINITE); bool is_animation_reversed = animation_get_reverse(animation); bool is_animation_infinite = (animation_get_duration(animation, false, false) == PLAY_DURATION_INFINITE); if (!is_animation_infinite && !is_reel_inf...
if (player && player->reel) { kino_reel_set_elapsed(player->reel, from_elapsed_ms); prv_create_play_animation(player, from_elapsed_ms, to_elapsed_ms); animation_schedule(player->animation); }
} ImmutableAnimation *kino_player_create_play_animation(KinoPlayer *player) { if (player && player->reel) { const uint32_t from_value = kino_reel_get_elapsed(player->reel); const uint32_t to_value = kino_reel_get_duration(player->reel); prv_create_play_animation(player, from_value, to_value); return...
GHT; if (dialog->show_status_layer) { dialog_add_status_bar_layer(dialog, &GRect(x, y, w, h)); } x = left_margin_px; w = bounds->size.w - left_margin_px - right_margin_px; GTextAttributes *text_attributes = NULL; #if PBL_ROUND // Create a GTextAttributes for the TextLayer. Note that the matching //...
#if !defined(RECOVERY_FW) actionable_dialog->select_icon = gbitmap_create_with_resource( RESOURCE_ID_ACTION_BAR_ICON_CHECK); #endif action_bar_layer_set_context(action_bar, window); action_bar_layer_set_icon(action_bar, BUTTON_ID_SELECT, actionable_dialog->select_icon); } else if (actionable_dialo...
// text is right aligned to x = grect_get_max_x(bounds) - ACTION_BAR_WIDTH - content_and_action_bar_horizontal_spacing - icon_size.w; #endif y = icon_top_margin_px; if (dialog_init_icon_layer(dialog, icon, GPoint(x, y), true)) { layer_add_child(window_root_layer, &dialog->icon_layer.layer); }...
&bp_service->uuid); cl_assert_equal_i(num_found_services, num_services); // Test that the UUID matches the Blood Pressure UUID: const Uuid uuid = gatt_client_service_get_uuid(service_refs[0]); cl_assert(uuid_equal(&uuid, &bp_service->uuid)); } void test_gatt...
(&uuid2, &thermo_service->uuid)
|| uuid_equal(&uuid2, &random_128bit_service->uuid)); }
g(false /*test_mode*/); fake_system_task_callbacks_invoke_pending(); // All tests start at 5pm, which is 1020 minutes into a 1440 minute day. The BMR for // the above user is 1859 kcalories per day, so we expect to get: // 1859 * 1020/1440 = 1328 kcalories activity_get_metric(ActivityMetricRestingKCalorie...
(ActivityMetricSleepTotalSeconds, 1, &value)
; cl_assert_equal_i(value, 220 * SECONDS_PER_MINUTE); cl_assert_equal_i(health_service_sum_today(HealthMetricSleepSeconds), 220 * SECONDS_PER_MINUTE); activity_get_metric(ActivityMetricSleepRestfulSeconds, 1, &value); cl_assert_equal_i(value, 100 * SECONDS_PER_MINUTE); cl_assert_equal_i(health_service_sum_to...
_ID); cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000); } void test_calendar_handle__future_event_added_and_removed(void) { timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID...
(timer_id != TIMER_INVALID_ID)
; cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000); rtc_set_time(10 * 60); cl_assert(stub_new_timer_fire(timer_id)); cl_assert_equal_i(fake_event_get_count(), 2); cl_assert(prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_schedule...
ld"); goto failed; } // start the HRM app PBL_LOG(LOG_LEVEL_DEBUG, "Starting HRM app"); if (!prv_set_running_apps(dev, AS7000AppId_HRM)) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to start HRM app!"); goto failed; } // Configure the int_gpio pin only when we're going to use it, as this pin is shared w...
// reflashed on every boot. If the HRM is loaded with a broken // firmware which doesn't enter standby when the enable pin is high, // the board will need to be power-cycled (entering standby/shutdown // is sufficient) in order to get force-flashing to succeed. gpio_output_set(&dev->en_gpio, false); psleep(...
// into the loader. Since we're waiting anyway, we might as well // query the version info again to make sure the update took. PBL_LOG(LOG_LEVEL_DEBUG, "Firmware flashed! Waiting for reboot..."); gpio_output_set(&dev->en_gpio, true); psleep(LOADER_REBOOT_DELAY_MS); if (!prv_get_and_log_device_i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
dialog_chip_id_copy(&chip_id)
) { response_payload = (const uint8_t *)&chip_id; } // Send back empty response in case of failure. hc_protocol_enqueue_response(request, response_payload, response_payload ? sizeof(chip_id) : 0); } void hc_endpoint_chip_id_handler(const HcProtocolMessage *msg) { switch (msg->command_id) { case HcMessa...
heap.h" #include "stubs_logging.h" #include "stubs_memory_layout.h" #include "stubs_mutex.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_process_manager.h" #include "stubs_prompt.h" #include "stubs_serial.h" #include "stubs_shell_pref...
prv_create_menu_and_render_long_title(true /* icons_enabled */, "Default Height", false /* special_height */)
; FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE(); } void test_option_menu_window__long_title_special_height(void) { prv_create_menu_and_render_long_title(false /* icons_enabled */, "Special Height", true /* special_height */); FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE()...
8, 0x57, 1534, 0x0}, { 8, 0x64, 3035, 0x0}, { 0, 0x56, 1046, 0x0}, { 0, 0x15, 124, 0x0}, { 0, 0x34, 1515, 0x0}, { 0, 0x44, 618, 0x0}, { 0, 0x44, 287, 0x0}, { 8, 0x35, 1249, 0x0}, { 0, 0x34, 794, 0x0}, { 0, 0x37, 525, 0x0}, { 0, 0x35, 1752, 0x0}, { 0, 0x46, 1318, 0x0}, { 0...
{ 0, 0x74, 1104, 0x0}, { 0, 0x74, 1428, 0x0}, { 6, 0x74, 1506, 0x0}, { 0, 0x73, 919, 0x0}, { 0, 0x74, 945, 0x0}, { 0, 0x86, 899, 0x0}, // 780: Local time: 12:04:00 PM { 17, 0x75, 3056, 0x0}, { 32, 0x62, 3316, 0x0}, { 0, 0x63, 4447, 0x0}, { 54, 0x61, 7210, 0x0}, { 18, 0x54...
{ 0, 0x65, 4632, 0x0}, { 0, 0x45, 2974, 0x0}, { 25, 0x52, 5406, 0x0}, { 56, 0x51, 5298, 0x0}, { 0, 0x64, 4123, 0x0}, { 12, 0x62, 2163, 0x0}, { 6, 0x61, 6879, 0x0}, { 0, 0x8b, 1679, 0x0}, { 6, 0x75, 1511, 0x0}, { 0, 0x74, 2231, 0x0}, { 0, 0x74, 772, 0x0}, { 0, 0x73, 85, 0...
BIsDirtyImpl is_dirty; BlobDBGetDirtyListImpl get_dirty_list; BlobDBMarkSyncedImpl mark_synced; bool disabled; } BlobDB; static const BlobDB s_blob_dbs[NumBlobDBs] = { [BlobDBIdPins] = { .init = pin_db_init, .insert = pin_db_insert, .get_len = pin_db_get_len, .read = pin_db_read, .del = pin...
{ if (db->init) { db->init(); } }
} void blob_db_get_dirty_dbs(uint8_t *ids, uint8_t *num_ids) { const BlobDB *db = s_blob_dbs; *num_ids = 0; for (uint8_t i = 0; i < NumBlobDBs; ++i, ++db) { bool is_dirty = false; if (db->is_dirty && (db->is_dirty(&is_dirty) == S_SUCCESS) && is_dirty) { ids[*num_ids] = i; *num_ids += 1; ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (isnan(x)) { return NAN; }
if (isinf(x)) { return INFINITY; } const int64_t x_int = (int64_t)x; const bool has_no_fraction = (double)x_int == x; return (double)((x >= 0 || has_no_fraction) ? x_int : x_int - 1); }
tted_line_origin_odd_rows_no_clip"))); // Test to make sure drawing on all rows creates checkerboard pattern setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_CO...
GPoint(0, 23)
, MAX_NUM_COLS + 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_even_offset_odd_rows_no_clip"))); // Test to make sure drawing on all rows creates checkerboard pattern setup_test_aa_sw(&ctx, fb, OFFSET_RECT_EVEN, OFFSET_RECT_EVEN, false, 1); for (int16_t row =...
; } return true; // continue iterating } static StatusCode prv_wakeup_settings_add_entry(WakeupId wakeup_id, WakeupEntry entry) { status_t status = S_SUCCESS; mutex_lock(s_mutex); { SettingsFile wakeup_settings; if (settings_file_open(&wakeup_settings, SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE) == S_...
prv_wakeup_timer_next_pending()
; } else if (!enable && s_current_timer_id && new_timer_scheduled(s_current_timer_id, NULL)) { new_timer_stop(s_current_timer_id); } } TimerID wakeup_get_current(void) { return s_current_timer_id; } WakeupId wakeup_get_next_scheduled(void) { return s_wakeup_state.current_wakeup_id; } void wa...
tionIterState; static const char *FILENAME = "notifstr"; //The filename should not be changed static PebbleRecursiveMutex *s_notif_storage_mutex = NULL; static uint32_t s_write_offset; static bool prv_iter_next(NotificationIterState *iter_state); static bool prv_get_notification(TimelineItem *notification, ...
if (pfs_seek(fd, iter_state.header.payload_length, FSeekCur) < 0) { break; }
2_t SHRINK_DURATION = 200; VoiceUiData *data = context; loading_layer_shrink(&data->mic_window.progress_bar, SHRINK_DELAY, SHRINK_DURATION, prv_handle_animation_stop, data); } // shrink the progress bar from the left after animating the progress % to 100% static void prv_shrink_progress_bar(VoiceUiData *data...
transcription_dialog_keep_alive_on_select(transcription_dialog, data->transcription_dialog_keep_alive_on_select)
; Dialog *dialog = expandable_dialog_get_dialog((ExpandableDialog *)transcription_dialog); dialog_set_destroy_on_pop(dialog, false /* free_on_pop */); transcription_dialog_push(transcription_dialog, prv_get_window_stack()); sys_light_reset_to_timed_mode(); } else { prv_exi...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(track_position, 0xAA)
; cl_assert_equal_i(music_get_playback_rate_percent(), 0xAA); } else { cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT); } } static void prv_receive_and_assert_volume_info(bool expect_is_handled) { uint8_t msg[] = { 0x12, 0x33 }; prv_receive_pp_data(msg, sizeof(msg)); PebbleEvent e = fake_event_get_las...
, { 2256, 1072, -320}, { 1856, 952, -104}, { 1552, 800, -80}, { 1200, 568, -144}, { 888, 448, -80}, { 936, 600, 16}, { 808, 832, 40}, { 696, 1096, 112}, { 472, 1168, -64}, { 568, 904, -200}, { 936, 872, -144}, { 1232, 824, -272}, { 1232, 584, -112}, { 1616, 720, -...
{ 1440, 504, -104}, { 1432, 376, -104}, { 1504, 336, -160}, { 1536, 304, -72}, { 1440, 304, 16}, { 1288, 272, 16}, { 976, 224, -24}, { 696, -352, 88}, { 856, -184, 224}, // 53 seconds { 656, -64, -368}, { 920, 96, -480}, { 1112, 240, -440}, { 1456, 168, -64}, ...
{ 1488, 824, -472}, { 1016, 1208, -512}, { 792, 1456, -640}, { 960, 1136, -440}, { 824, 696, -368}, { 1080, 680, -224}, { 1448, 880, -256}, { 1752, 824, -152}, { 1704, 512, -56}, { 1600, 352, -40}, { 1480, 312, -48}, { 1440, 280, -88}, { 1408, 272, -24}, { 1320, ...
ngsContentSize content_size, const ActionMenuLevel *root_level, unsigned int selected_index, unsigned int additional_crumbs) { const int16_t x_offset = GRID_CELL_PADDING + (content_size * (GRID_CELL_PADDING + DISP_COLS)); for (ActionMenuLayerLongLabelScrollingAnimationState animation_state = 0; an...
ARRAY_LENGTH(thin_values)
; i++) { action_menu_level_add_action(root_level, thin_values[i], prv_noop_action_callback, NULL); } const unsigned int selected_index = 4; prv_prepare_canvas_and_render_action_menus_static(root_level, selected_index, 0); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_action_menu_wind...
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 CONDITIONS ...
dialog_set_icon(dialog, data->resource_id_80)
; actionable_dialog_set_action_bar_type(actionable_dialog, DialogActionBarDecline, NULL); actionable_dialog_set_click_config_provider(actionable_dialog, prv_decline_config_provider); app_actionable_dialog_push(actionable_dialog); } ////////////////////////////////////////// // ActionableDialog with custom...
p_name_val)) { return false; } return (bool)EM_ASM_INT({ var obj = __jerryRefs.get($0); var name = __jerryRefs.get($1); return (name in obj); }, obj_val, prop_name_val); } bool jerry_has_own_property(const jerry_value_t obj_val, const jerry_value_t prop_name_val) { if (!jerry_value_is_o...
($13 /* prop_name_val */)
/* * 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...
(0xffffffff, 0x0)
; cl_assert_equal_i(dist, 1); } { int32_t dist = serial_distance32(0x0, 0x7fffffff); cl_assert_equal_i(dist, 0x7fffffff); } } void test_math__serial_distance3(void) { { int32_t dist = serial_distance(0, 1, 3); cl_assert_equal_i(dist, 1); } { int32_t dist = serial_distance(1, 0, 3)...
rame); layer_set_frame((Layer *)&timeline_layer->end_of_timeline, &frame); if (was_hidden) { kino_layer_rewind(&timeline_layer->end_of_timeline); } kino_layer_play(&timeline_layer->end_of_timeline); }; static void prv_up_down_stopped(Animation *animation, bool is_finished, void *context) { TimelineLayer ...
GRect(bounds->size.w - sidebar_width, 0, sidebar_width, bounds->size.h)
; graphics_context_set_fill_color(ctx, timeline_layer->sidebar_color); // On round displays, draw the round flip effect if we're animating the intro or exit and then // return early so we don't draw the arrow notch #if PBL_ROUND if (timeline_layer->animating_intro_or_exit) { prv_draw_round_flip(ctx, bounds...
wn_handler_calls, h), 1); // Make sure the frame reached the "to" state cl_assert_equal_i(prv_last_update_distance(h), ANIMATION_NORMALIZED_MAX); // This should return NULL now if the animation got destroyed cl_assert(animation_private_animation_find(h) == NULL); // Make sure no animations exist cl_asser...
{ #ifdef TEST_INCLUDE_BASIC // A long time, but not so long as to use up our 500 capacity callback history limit const uint32_t test_duration = 10000; const uint32_t duration_a = ANIMATION_DURATION_INFINITE; Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); prv_clear_handle...
// -------------------------------------------------------------------------------------- // Test a simple sequence animation void test_animation__simple_sequence(void) { #ifdef TEST_INCLUDE_COMPLEX const int duration_a = 300; const int duration_b = 500; const int play_count_b = 2; int duration_total = durat...
_num Subsampling numerator //! @param subsample_den Subsampling denominator //! @return The actual number of samples read uint32_t accel_consume_data(AccelRawData *data, SharedCircularBufferClient *client, uint32_t max_samples, uint16_t subsample_num, uint16_t subsample_den) { uint16_t items_read; PBL_A...
{ lis3dh_set_interrupt_threshold( BOARD_CONFIG_ACCEL.accel_config.shake_thresholds[AccelThresholdHigh]); }
}
///////////////////////////////////////////////////////////////////////////////////////////// // Test pipeline parser static const struct { const char *instr; time_t intime; const char *expect_str; time_t expect_time; bool expect_rv; TemplateStringErrorStatus expect_status; size_t expect_index; } s_full_...
if (!rv) { printf("err.status: %X\n", err.status); printf("err.index: %zu\n", err.index_in_string); printf("\"%s\"\n", s_full_tests[i].instr); printf("%*s^\n", (int)err.index_in_string + 1, ""); if (err.status >= TemplateStringErrorStatusCount) { printf("Invalid status code\n"); ...
printf("\n"); #endif cl_assert_equal_s(s_output, s_full_tests[i].expect_str); cl_assert_equal_i(rv, s_full_tests[i].expect_rv); cl_assert_equal_i(cond.eval_time, s_full_tests[i].expect_time); if (cond.eval_time != 0) { cl_assert_equal_b(cond.force_eval_on_time, true); } else { cl_a...
IMUM_ARRAY_LEN; while (required_array_len > len) { len *= 2; } return len; } static jerry_value_t prv_try_allocate_steps(const size_t num_steps_increment) { const size_t required_array_len = (s_rocky_path_steps_num + num_steps_increment); if (required_array_len <= s_rocky_path_steps_array_len) { goto...
{ return GPointPrecise( pt->x.raw_value + v->dx.raw_value, pt->y.raw_value + v->dy.raw_value); }
JERRY_FUNCTION(prv_fill) { GPoint *const points = task_zalloc(sizeof(*points) * s_rocky_path_steps_num); if (!points) { return rocky_error_oom("too many points to fill"); } size_t points_num = 0; jerry_value_t rv; #define ADD_P(pt) \ PBL_ASSERTN(points_num < s_rocky_path_steps_num); \ points...
backlight_set_intensity_percent(uint8_t percent_intensity) { PBL_ASSERTN(percent_intensity > 0 && percent_intensity <= 100); uint16_t intensity = prv_convert_backlight_percent_to_intensity(percent_intensity); PBL_ASSERTN(intensity > BACKLIGHT_BRIGHTNESS_OFF); prv_pref_set(PREF_KEY_BACKLIGHT_INTENSITY, &intensi...
if (s_welcome_version != version) { s_welcome_version = version; prv_pref_set(PREF_KEY_WELCOME_VERSION, &version, sizeof(version)); }
} uint8_t welcome_get_welcome_version(void) { return s_welcome_version; } static bool prv_set_default_any_watchface_enumerate_callback(AppInstallEntry *entry, void *data) { if (!app_install_entry_is_watchface(entry) || app_install_entry_is_hidden(entry)) { return true; // continue search } watchfa...
f our first click caused a swap, then just scroll to the top of the current notification int16_t offset = prv_get_current_notification_offset(swap_layer); const GRect *layer_frame = &swap_layer->layer.frame; const GRect *current_frame = &swap_layer->current->layer.frame; if ((current_frame->size.h - layer_frame...
((Layer *)next, &swap_layer->arrow_layer.layer)
; swap_layer->next = next; } } bool swap_layer_attempt_layer_swap(SwapLayer *swap_layer, ScrollDirection direction) { return prv_attempt_swap(swap_layer, direction, true /* to_top */); } /////////////////////// // ACCESSOR FUNCTIONS /////////////////////// void swap_layer_set_click_config_onto_window(SwapLay...
ng permissions and * limitations under the License. */ #include "comm/ble/kernel_le_client/ancs/ancs.h" #include "comm/ble/kernel_le_client/ancs/ancs_util.h" #include "comm/ble/kernel_le_client/ancs/ancs_definition.h" #include "comm/ble/gap_le_connection.h" #include "comm/ble/gap_le_task.h" #include "services/comm...
{ prv_send_notification_with_event_flags(ancs_notification_dict, 0); }
static uint8_t *prv_serialize_timeline_item(TimelineItem *item, size_t *size_out) { size_t payload_size = timeline_item_get_serialized_payload_size(item); *size_out = sizeof(SerializedTimelineItemHeader) + payload_size; uint8_t *buffer = malloc(*size_out); timeline_item_serialize_header(item, (SerializedTime...
eturn key_matches(iter, key, key_len); } static bool search_forward(SettingsRawIter *iter, const uint8_t *key, int key_len) { const int resumed_pos = settings_raw_iter_get_resumed_record_pos(iter); // Resume searching at the current record for (; !settings_raw_iter_end(iter); settings_raw_iter_next(iter)) { ...
{ return E_DOES_NOT_EXIST; }
PBL_ASSERTN(offset < file->iter.hdr.val_len); settings_raw_iter_write_byte(&file->iter, offset, byte); return S_SUCCESS; } // Note that this operation is designed to be atomic from the perspective of // an outside observer. That is, either the new value will be completely // written and returned for all futur...
acks typedef struct { uint32_t resource_id; ResourceReadCb read; ResourceGetSizeCb get_size; } EmxCustomResource; typedef struct { EmxCustomResource *custom_resources; uint32_t last_id; int array_size; int next_index; } CustomResList; static CustomResList s_custom_res_list = {0}; static int prv_custom...
{ return custom_res->read(offset, buf, num_bytes); }
Resource resource = {}; if (!prv_get_resource(resource_id, &resource)) { return 0; } if (offset + num_bytes > resource.length) { if (offset >= resource.length) { // Can't recover from trying to read from beyond the resource. Read nothing. printf("%s: Reading past the end of the resource!\...
!SHELL_SDK || CAPABILITY_HAS_SDK_SHELL4) watchface_reset_click_manager(); #endif // Let the underlying window know it has lost focus if this is the first modal // window to show up. prv_send_will_focus_event(false /* in_focus */); } static void prv_handle_modal_to_app_transition_focus(void) { // There are n...
for (ModalPriority idx = NumModalPriorities - 1; idx >= ModalPriorityMin; idx--) { ModalContext *context = &s_modal_window_stacks[idx]; if (!prv_has_visible_window(context, NULL)) { continue; } else if (iter.first_visible_idx == ModalPriorityInvalid) { iter.first_visible_idx = idx; } if ...
if (iter.first_visible_idx != ModalPriorityInvalid) { for (ModalPriority idx = ModalPriorityMin; idx < NumModalPriorities; idx++) { ModalContext *modal = &s_modal_window_stacks[idx]; WindowStack *stack = &modal->window_stack; iter.current_idx = idx; iter.current_top_window = window_stack_...
{ char dstbuf[256]; memset(dstbuf, 0xFF, 256); cl_assert_equal_i(snprintf(dstbuf, 17, "Hello!\nI am error"), 17); cl_assert_equal_m(dstbuf, "Hello!\nI am erro\0\xFF", 18); memset(dstbuf, 0xFF, 256); cl_assert_equal_i(snprintf(dstbuf, 15, "Hello!\nI am error"), 17); cl_assert_equal_m(dstbuf, "Hello!\nI a...
cl_assert_equal_s(dstbuf, "There are 04 lights, -4")
; // Space padded minimum character output snprintf(dstbuf, 256, "There are %2i lights, %2i", 4, -4); cl_assert_equal_s(dstbuf, "There are 4 lights, -4"); // Left-align, Space padded minimum character output snprintf(dstbuf, 256, "There are %-2i lights, %-2i", 4, -4); cl_assert_equal_s(dstbuf, "There are...
} AppMessageHeader *message = (AppMessageHeader *) data; switch (message->command) { case CMD_PUSH: // Incoming message: app_message_inbox_receive(session, (AppMessagePush *) message, length, consumer_info); return; case CMD_REQUEST: // Incoming request for an update push: ...
sys_get_current_app_is_js_allowed()
) { return (COMM_PRIVATE_MAX_INBOUND_PAYLOAD_SIZE - APP_MSG_HDR_OVRHD_SIZE); } else { return (COMM_PUBLIC_MAX_INBOUND_PAYLOAD_SIZE - APP_MSG_HDR_OVRHD_SIZE); } } } uint32_t app_message_outbox_size_maximum(void) { if (prv_supports_8k()) { return (APP_MSG_8K_DICT_SIZE); } else { // Lega...
nt_descriptor_get_characteristic(): cl_assert_equal_i(gatt_client_descriptor_get_characteristic(descriptor_ref), characteristic_ref); } } // Test gatt_client_service_get_included_services(): const uint8_t num_inc_services = expected_service->num_included_services; BLEService inc_service_r...
fake_gatt_put_discovery_complete_event(GATT_SERVICE_DISCOVERY_STATUS_SUCCESS, TEST_GATT_CONNECTION_ID)
; ATTHandleRange range = { .start = 0x1, .end = 0xC000, }; gatt_client_discovery_discover_range(gap_le_connection_by_device(&device), &range); fake_gatt_put_discovery_indication_health_thermometer_service(TEST_GATT_CONNECTION_ID); fake_gatt_put_discovery_indication_random_128bit_uuid_service(TEST_GA...
t; return true; } bool WEAK animation_set_duration(Animation *animation, uint32_t duration_ms) { if (!animation) { return false; } ((AnimationPrivate*)animation)->duration_ms = duration_ms; return true; } uint32_t WEAK animation_get_duration(Animation *animation, bool include_delay, bool include_play_co...
if (!property_animation) { return false; }
if (set) { ((PropertyAnimationPrivate *)property_animation)->subject = *subject; } else { *subject = ((PropertyAnimationPrivate *)property_animation)->subject; } return true; } bool WEAK property_animation_to(PropertyAnimation *property_animation, void *to, size_t size, ...
_state(void) {} void graphics_context_set_fill_color(GContext* ctx, GColor color) {} void graphics_context_set_stroke_color(GContext* ctx, GColor color) {} void graphics_context_set_stroke_width(GContext* ctx, uint8_t stroke_width) {} // mocks static MockCallRecordings s_graphics_line_draw_precise_stroked; void gra...
("ctx.lineTo(4096.5, 0);", "TypeError: Value out of bounds")
_private_send_session(entry->session, false)); } else { // Session has disappeared between the time that the reopen list was // created and now. This ideally shouldn't happen, but there's a lot // that's broken about datalogging. See PBL-37078. success = true; } kernel_free(entry); if (success)...
PBL_LOG(LOG_LEVEL_INFO, "Report already in progress")
; } else { s_endpoint_data.report_in_progress = true; prv_handle_report_cmd(&data[1], length); } break; case (DataLoggingEndpointCmdEmptySession): prv_empty_session(data[1]); break; case (DataLoggingEndpointCmdGetSendEnableReq): { bool enabled = dls_...
delay_us(delay); } } #if TARGET_QEMU // While this works with normal hardware, it has a large stack requirment and I can't // see a compelling reason to use it over the mmap blank check variant static bool prv_blank_check_poll(QSPIFlash *dev, uint32_t addr, bool is_subsector) { const uint32_t size_bytes = is_sub...
(dev->qspi, instruction, addr, &dev->state->part->block_lock.lock_data, 1)
; } else { qspi_indirect_write(dev->qspi, instruction, addr, NULL, 0); } // Poll busy status until done qspi_poll_bit(dev->qspi, dev->state->part->instructions.read_status, dev->state->part->status_bit_masks.busy, false /* !set */, QSPI_NO_TIMEOUT); // Read lock status uint8_t status; ...
/* * 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...
(utf8_peek_codepoint(malformed_test_string_utf8, NULL), 0)
; cl_assert_(*malformed_test_string_utf8 == 0xcd, "Failed to invalidate an invalid UTF-8 test string"); } void test_utf8__decode_all_gothic_codepoints(void) { static const int NUM_GOTHIC_CODEPOINTS = sizeof(s_valid_gothic_codepoints) / sizeof(uint32_t); bool is_valid = utf8_is_valid_string(s_valid_gothic_codepo...
/* * 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...
(frame.size.w * (1000 - MULT_X((cur - limit_c), (limit_d - limit_c))))
, frame.origin.y + frame.size.h); } else if (cur <= limit_e) { // zone d - e return GPoint(frame.origin.x, frame.origin.y + DIV_X(frame.size.h * (1000 - MULT_X((cur - limit_d), (limit_e - limit_d))))); } else { // zone e - 0 return GPoint(fra...
memcpy(response_attributes.attributes, pin->attr_list.attributes, sizeof(Attribute) * pin->attr_list.num_attributes)
; int cur_attribute = pin->attr_list.num_attributes; response_attributes.attributes[cur_attribute++] = (Attribute) { .id = AttributeIdTimestamp, .uint32 = pin->header.timestamp, }; timeline_invoke_action(pin, action, &response_attributes); kernel_free(response_attributes....
rse the expected values if (strcmp(token, "//>") == 0) { token = strtok(NULL, " \t\n"); if (strcmp(token, "TEST_VERSION") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.version); } else if (strcmp(token, "TEST_ACTIVITY_TYPE") == 0) { sscanf(token + strlen(token...
sprintf(state->res_path, "%s/%s", CLAR_FIXTURE_PATH, test_files_path)
; state->dp = opendir(state->res_path); if (state->dp == NULL) { printf("\nCould not open directory %s", state->res_path); return false; } state->type = samples_type; return true; } // --------------------------------------------------------------------------------------- // Advance to the next fi...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_offset_to_address(destination, *addr_to_change)
; } // Now fix up the part of RAM where the relocation table overwrote .bss. We don't need the table // anymore so restore the zero values. memset(reloc_array, 0, info->num_reloc_entries * 4); return true; } // ---------------------------------------------------------------------------------------------- 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...
(atoi("+500"), 500)
; cl_assert_equal_i(atoi("-765"), -765); cl_assert_equal_i(atoi(" -573888"), -573888); cl_assert_equal_i(atoi(" +713713"), +713713); } void test_atoi__error(void) { cl_assert_equal_i(atoi("2147483647"), 2147483647); // last valid value cl_assert_equal_i(atoi("4294967287"), (int)4294967287); // signed inte...
prv_count_handler_entries(&s_update_handler_calls, b)
, 0); // Complete A and start B prv_advance_to_ms_with_timers(start_ms + duration_a + delay_seq + delay_a + delay_b + 2 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_sta...
xp_session); } // -------------------------------------------------------------------------------------- // Test a run session of 30 minutes long that starts 10 minutes in that has a 2 minute // gap in the middle { memset(minute_raw_data, 0, k_minute_data_bytes); s_num_captured_activity_sessions = 0...
kernel_zalloc(kalg_state_size())
; // It's easier to understand the algorithm log messages if we start at 0 time rtc_set_time(0); memset(s_kalg_state, 0, kalg_state_size()); kalg_init(s_kalg_state, prv_stats_cb); s_num_captured_sleep_sessions = 0; // Get the samples for this test int num_samples; AlgMinuteFileSampleV5 *samples = acti...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ fake_app_timer_init(); rocky_runtime_context_init(); jerry_init(JERRY_INIT_EMPTY); s_app_window_stack_get_top_window = (Window){}; s_context = (GContext){}; s_app_state_get_graphics_context = &s_context; s_app_event_loop_callback = NULL; s_graphics_context_set_stroke_color = (MockCallRecordings){0};...
void test_rocky_api_graphics_color__cleanup(void) { fake_app_timer_deinit(); // some tests deinitialize the engine, avoid double de-init if (app_state_get_rocky_runtime_context() != NULL) { jerry_cleanup(); rocky_runtime_context_deinit(); } } static const RockyGlobalAPI *s_graphics_api[] = { &GRAP...
/* * 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...
{ GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(2bitpalette)); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(2bitpalette))); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat2BitPalette); }
// Tests 4-bit palettized PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__color_4_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(4bitpalette)); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(4bitpalette))); cl_assert_equal_i(gbitmap_get_format(bi...
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 "applib/graphics/gtypes.h" #include "clar.h" ...
{ GRect rect = GRect(10, 20, 30, 40); cl_assert_equal_grect(GRect(25, 35, 0, 10), grect_crop(rect, 15)); cl_assert_passert(grect_crop(rect, 16)); }
void test_gtypes__pbl_if_rect_else(void) { #if defined(PLATFORM_TINTIN) cl_assert_equal_i(1, PBL_IF_RECT_ELSE(1,2)); #elif defined(PLATFORM_SNOWY) cl_assert_equal_i(1, PBL_IF_RECT_ELSE(1,2)); #elif defined(PLATFORM_SPALDING) cl_assert_equal_i(2, PBL_IF_RECT_ELSE(1,2)); #else #error "unknown platform" #endif } ...
.num_calls == 0) { prv_fire_animation_timer(); time_ms = prv_now_ms(); 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, layer.frame.size.h); cl_assert(max_loops > 0); max_loops--; } // Th...
animation_schedule(h)
; prv_advance_to_ms_with_timers(start_ms + duration + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, h), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, h), 1); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, h), 1...
ested SharedCircularBufferClient *slacker; uint32_t max_data = prv_get_max_data_length(buffer, &slacker); uint32_t avail_space = buffer->buffer_size - 1 - max_data; while (length > avail_space) { if (!advance_slackers) { return false; } // Delete data from the biggest slacker slacker->rea...
(buffer, &client->buffer_client)
); subsampled_shared_circular_buffer_client_set_ratio( client, subsample_numerator, subsample_denominator); } // ------------------------------------------------------------------------------------------------- void shared_circular_buffer_remove_subsampled_client( SharedCircularBuffer *buffer, Subsampl...
(aaa, aaaa)
; layer_add_child(a, ab); a->next_sibling = b; stack[0] = a; // go to child if possible Layer *actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(aa, actual); cl_assert_equal_i(1, current_stack); cl_assert_equal_p(a, stack[0]);...
inance lookup table if necessary GColor8 tint_luminance_lookup_table[GCOLOR8_COMPONENT_NUM_VALUES] = {}; if (compositing_mode == GCompOpTintLuminance) { gcolor_tint_luminance_lookup_table_init(tint_color, tint_luminance_lookup_table); } for (int16_t dest_y = dest_begin_y; dest_y < dest_...
MIN(grect_get_max_x(&dest_rect), dest_row_info.max_x + 1)
; if (dest_end_x < dest_begin_x) { continue; } const int16_t corrected_src_x = src_bitmap->bounds.origin.x + src_origin_offset.x + dest_delta_begin_x; const uint32_t * const src_block_x_begin = ((uint32_t *)src_bitmap->addr) + corrected_src_x / 32; const int src_row_length_words =...
ause tests are single-threaded static uint8_t buffer[sizeof(AppMessagePush) + sizeof(Tuple) + sizeof(uint8_t)]; AppMessagePush *push_message = (AppMessagePush *)buffer; *push_message = (const AppMessagePush) { .header = { .command = 0x01, // Push .transaction_id = TRANSACTION_ID, }, .uuid...
fake_comm_session_process_send_next()
; fake_transport_assert_sent(s_transport, 0, LAUNCHER_MESSAGE_ENDPOINT_ID, buffer, sizeof(buffer)); }
_user_data((Window*) anim_ctx->window); if (!data || !finished) { // We could have gotten cleaned up in the middle of an animation, bail applib_free(anim_ctx); return; } if (data->view_model.cur_level->parent_level == anim_ctx->next_level) { --data->view_model.num_dots; } else { ++data->vie...
animation_set_elapsed(data->level_change_anim, animation_get_duration(data->level_change_anim, true, true))
; } ActionMenuLevel *parent_level = data->view_model.cur_level->parent_level; if (parent_level) { prv_set_level(data, parent_level); } else { prv_action_window_pop(true, &data->action_menu); } } static void prv_click_config_provider(void *context) { ActionMenuData *data = context; action_menu_la...
; layer_set_hidden((Layer *)&data->mic_window.text_layer, true); } static void prv_show_mic_text(VoiceUiData *data, const char *msg) { layer_set_hidden((Layer *)&data->mic_window.text_layer, false); sys_i18n_get_with_buffer(msg, data->mic_window.text_buffer, sizeof(data->mic_window.text_buffer)); text_layer_se...
(normalized, from, to, NUM_MOOOK_FRAMES_MID)
; } // fly dot in or out of the window static void prv_fly_dot(VoiceUiData *data, bool fly_in) { Layer *dot_layer = &data->mic_window.mic_dot_layer; const GRect *root_frame = &window_get_root_layer(layer_get_window(dot_layer))->frame; GRect dot_frame = {.size = MIC_DOT_LAYER_SIZE}; grect_align(&dot_frame, roo...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ storage_acquire(); const SMPairingInfo *info = &bonding->pairing_info; bd_address_t addr; dialog_utils_bt_device_to_bd_address(&bonding->pairing_info.identity, &addr); device_t *dev = find_device_by_addr(&addr, true /* create */); dev->paired = true; dev->bonded = true; dev->is_gateway = bonding->is_...
void bonding_sync_handle_hc_remove(const BleBonding *bonding) { const SMPairingInfo *info = &bonding->pairing_info; uint16_t conn_idx = BLE_CONN_IDX_INVALID; storage_acquire(); bd_address_t addr; dialog_utils_bt_device_to_bd_address(&bonding->pairing_info.identity, &addr); device_t *dev = find_device_by_a...
IC_BURSTCMDB_REG, QSPIC_WRAP_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_INST_MD, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_DMY_NUM, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_EXT_HF_DS, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_REG, QSPIC_EXT_BYTE_EN, 0x0); REG_SETF(QSPIC, QSPIC_BURSTCMDB_R...
(CACHE, CACHE_CTRL3_REG, CACHE_ASSOCIATIVITY_RESET_VALUE, 0x2)
; REG_SETF(CACHE, CACHE_MRM_HITS_REG, MRM_HITS, 0x0); REG_SETF(CACHE, CACHE_MRM_MISSES_REG, MRM_MISSES, 0x0); REG_SETF(CACHE, CACHE_MRM_CTRL_REG, MRM_IRQ_THRES_STATUS, 0x0); REG_SETF(CACHE, CACHE_MRM_CTRL_REG, MRM_IRQ_TINT_STATUS, 0x0); REG_SETF(CACHE, CACHE_MRM_CTRL_REG, MRM_IRQ_MASK, 0x0); REG_SETF(CAC...
the UUID matches a known system glance for (unsigned int i = 0; i < ARRAY_LENGTH(s_system_glance_factories); i++) { const SystemAppGlanceFactory *factory = &s_system_glance_factories[i]; if (uuid_equal(&factory->uuid, &node->uuid)) { glance = factory->constructor(node); break; } } // If ...
prv_should_use_glance_cache_for_app_with_uuid(&node->uuid)
; LauncherAppGlance *glance = use_glance_cache ? prv_fetch_from_cache_or_load_glance_for_node(node, service) : prv_load_glance_for_node(node, service); // Draw the glance in the provided frame launcher_app_glance_draw(ctx, frame, glance, is_highlighted); // If we didn't use the...
{ .event = AnalyticsEvent_PutByteTime, .pb_time = { .ppogatt = is_ppogatt, .conn_intvl_1_25ms = MIN(conn_interval, UINT8_MAX), .crc_good = crc_good, .type = type, .bytes_transferred = bytes_transferred, .elapsed_time_ms = elapsed_time_ms, .conn_events = MIN(conn_events,...
("GetBytesStats event: type: 0x%x, num_bytes: %"PRIu32", elapsed_ms: %"PRIu32, type, bytes_transferred, elapsed_time_ms)
; analytics_logging_log_event(&event_blob); }