| 1 | /* |
| 2 | * Copyright 2020 Jan Schmidt |
| 3 | * SPDX-License-Identifier: BSL-1.0 |
| 4 | * |
| 5 | * OpenHMD - Free and Open Source API and drivers for immersive technology. |
| 6 | * |
| 7 | * The Rift S talks to remote devices via HID radio control reports |
| 8 | * the need to be serialised and coordinated to work properly. |
| 9 | * |
| 10 | */ |
| 11 | /*! |
| 12 | * @file |
| 13 | * @brief Oculus Rift S HMD Radio management interface |
| 14 | * |
| 15 | * Functions for serialising requests to communicate with |
| 16 | * Touch controllers over the HMDs wireless radio link, |
| 17 | * collecting responses and delivering them back via callbacks. |
| 18 | * |
| 19 | * Ported from OpenHMD |
| 20 | * |
| 21 | * @author Jan Schmidt <[email protected]> |
| 22 | */ |
| 23 | |
| 24 | #pragma once |
| 25 | |
| 26 | #ifndef RIFT_S_RADIO_H |
| 27 | #define RIFT_S_RADIO_Hcxx . . $ `src/xrt/drivers/rift_s/rift_s_radio.h:27:9`! |
| 28 | |
| 29 | #include "os/os_hid.h"cxx . . $ `<file>/src/xrt/auxiliary/os/os_hid.h`/ |
| 30 | #include "xrt/xrt_defines.h"cxx . . $ `<file>/src/xrt/include/xrt/xrt_defines.h`/ |
| 31 | |
| 32 | typedef struct rift_s_radio_commandcxx . . $ rift_s_radio_command# rift_s_radio_commandcxx . . $ rift_s_radio_command#; |
| 33 | typedef struct rift_s_radio_statecxx . . $ rift_s_radio_state# rift_s_radio_statecxx . . $ rift_s_radio_state#; |
| 34 | |
| 35 | typedef void (*rift_s_radio_completion_fncxx . . $ rift_s_radio_completion_fn#)(boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! success, |
| 36 | uint8_tcxx . . $ uint8_t# *response_bytes, |
| 37 | int response_bytes_len, |
| 38 | void *cb_data); |
| 39 | |
| 40 | struct rift_s_radio_statecxx . . $ rift_s_radio_state# |
| 41 | { |
| 42 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! command_result_pendingcxx . . $ rift_s_radio_state#command_result_pending.; |
| 43 | int last_radio_seqnumcxx . . $ rift_s_radio_state#last_radio_seqnum.; |
| 44 | |
| 45 | rift_s_radio_commandcxx . . $ rift_s_radio_command# *pending_commandscxx . . $ rift_s_radio_state#pending_commands.; |
| 46 | rift_s_radio_commandcxx . . $ rift_s_radio_command# *pending_commands_tailcxx . . $ rift_s_radio_state#pending_commands_tail.; |
| 47 | }; |
| 48 | |
| 49 | void |
| 50 | rift_s_radio_state_initcxx . . $ rift_s_radio_state_init(f1bfd682f7e0b315).(rift_s_radio_statecxx . . $ rift_s_radio_state# *state); |
| 51 | void |
| 52 | rift_s_radio_state_clearcxx . . $ rift_s_radio_state_clear(f1bfd682f7e0b315).(rift_s_radio_statecxx . . $ rift_s_radio_state# *state); |
| 53 | |
| 54 | void |
| 55 | rift_s_radio_updatecxx . . $ rift_s_radio_update(470e9c2ce7f5a561).(rift_s_radio_statecxx . . $ rift_s_radio_state# *state, struct os_hid_devicecxx . . $ os_hid_device# *hid); |
| 56 | void |
| 57 | rift_s_radio_queue_commandcxx . . $ rift_s_radio_queue_command(79c73fdd53fafac7).(rift_s_radio_statecxx . . $ rift_s_radio_state# *state, |
| 58 | const uint64_tcxx . . $ uint64_t# device_id, |
| 59 | const uint8_tcxx . . $ uint8_t# *cmd_bytes, |
| 60 | const int cmd_bytes_len, |
| 61 | rift_s_radio_completion_fncxx . . $ rift_s_radio_completion_fn# cb, |
| 62 | void *cb_data); |
| 63 | void |
| 64 | rift_s_radio_get_json_blockcxx . . $ rift_s_radio_get_json_block(b8a87017a7bda3c4).(rift_s_radio_statecxx . . $ rift_s_radio_state# *state, |
| 65 | const uint64_tcxx . . $ uint64_t# device_id, |
| 66 | rift_s_radio_completion_fncxx . . $ rift_s_radio_completion_fn# cb, |
| 67 | void *cb_data); |
| 68 | #endif |