diff options
Diffstat (limited to 'src/input_common/helpers/joycon_driver.h')
| -rw-r--r-- | src/input_common/helpers/joycon_driver.h | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/src/input_common/helpers/joycon_driver.h b/src/input_common/helpers/joycon_driver.h index 45b32d2f8..335e12cc3 100644 --- a/src/input_common/helpers/joycon_driver.h +++ b/src/input_common/helpers/joycon_driver.h | |||
| @@ -11,6 +11,10 @@ | |||
| 11 | 11 | ||
| 12 | #include "input_common/helpers/joycon_protocol/joycon_types.h" | 12 | #include "input_common/helpers/joycon_protocol/joycon_types.h" |
| 13 | 13 | ||
| 14 | namespace Common::Input { | ||
| 15 | enum class DriverResult; | ||
| 16 | } | ||
| 17 | |||
| 14 | namespace InputCommon::Joycon { | 18 | namespace InputCommon::Joycon { |
| 15 | class CalibrationProtocol; | 19 | class CalibrationProtocol; |
| 16 | class GenericProtocol; | 20 | class GenericProtocol; |
| @@ -26,8 +30,8 @@ public: | |||
| 26 | 30 | ||
| 27 | ~JoyconDriver(); | 31 | ~JoyconDriver(); |
| 28 | 32 | ||
| 29 | DriverResult RequestDeviceAccess(SDL_hid_device_info* device_info); | 33 | Common::Input::DriverResult RequestDeviceAccess(SDL_hid_device_info* device_info); |
| 30 | DriverResult InitializeDevice(); | 34 | Common::Input::DriverResult InitializeDevice(); |
| 31 | void Stop(); | 35 | void Stop(); |
| 32 | 36 | ||
| 33 | bool IsConnected() const; | 37 | bool IsConnected() const; |
| @@ -41,31 +45,31 @@ public: | |||
| 41 | SerialNumber GetSerialNumber() const; | 45 | SerialNumber GetSerialNumber() const; |
| 42 | SerialNumber GetHandleSerialNumber() const; | 46 | SerialNumber GetHandleSerialNumber() const; |
| 43 | 47 | ||
| 44 | DriverResult SetVibration(const VibrationValue& vibration); | 48 | Common::Input::DriverResult SetVibration(const VibrationValue& vibration); |
| 45 | DriverResult SetLedConfig(u8 led_pattern); | 49 | Common::Input::DriverResult SetLedConfig(u8 led_pattern); |
| 46 | DriverResult SetIrsConfig(IrsMode mode_, IrsResolution format_); | 50 | Common::Input::DriverResult SetIrsConfig(IrsMode mode_, IrsResolution format_); |
| 47 | DriverResult SetPassiveMode(); | 51 | Common::Input::DriverResult SetPassiveMode(); |
| 48 | DriverResult SetActiveMode(); | 52 | Common::Input::DriverResult SetActiveMode(); |
| 49 | DriverResult SetIrMode(); | 53 | Common::Input::DriverResult SetIrMode(); |
| 50 | DriverResult SetNfcMode(); | 54 | Common::Input::DriverResult SetNfcMode(); |
| 51 | DriverResult SetRingConMode(); | 55 | Common::Input::DriverResult SetRingConMode(); |
| 52 | DriverResult StartNfcPolling(); | 56 | Common::Input::DriverResult StartNfcPolling(); |
| 53 | DriverResult StopNfcPolling(); | 57 | Common::Input::DriverResult StopNfcPolling(); |
| 54 | DriverResult ReadAmiiboData(std::vector<u8>& out_data); | 58 | Common::Input::DriverResult ReadAmiiboData(std::vector<u8>& out_data); |
| 55 | DriverResult WriteNfcData(std::span<const u8> data); | 59 | Common::Input::DriverResult WriteNfcData(std::span<const u8> data); |
| 56 | DriverResult ReadMifareData(std::span<const MifareReadChunk> request, | 60 | Common::Input::DriverResult ReadMifareData(std::span<const MifareReadChunk> request, |
| 57 | std::span<MifareReadData> out_data); | 61 | std::span<MifareReadData> out_data); |
| 58 | DriverResult WriteMifareData(std::span<const MifareWriteChunk> request); | 62 | Common::Input::DriverResult WriteMifareData(std::span<const MifareWriteChunk> request); |
| 59 | 63 | ||
| 60 | void SetCallbacks(const JoyconCallbacks& callbacks); | 64 | void SetCallbacks(const JoyconCallbacks& callbacks); |
| 61 | 65 | ||
| 62 | // Returns device type from hidapi handle | 66 | // Returns device type from hidapi handle |
| 63 | static DriverResult GetDeviceType(SDL_hid_device_info* device_info, | 67 | static Common::Input::DriverResult GetDeviceType(SDL_hid_device_info* device_info, |
| 64 | ControllerType& controller_type); | 68 | ControllerType& controller_type); |
| 65 | 69 | ||
| 66 | // Returns serial number from hidapi handle | 70 | // Returns serial number from hidapi handle |
| 67 | static DriverResult GetSerialNumber(SDL_hid_device_info* device_info, | 71 | static Common::Input::DriverResult GetSerialNumber(SDL_hid_device_info* device_info, |
| 68 | SerialNumber& serial_number); | 72 | SerialNumber& serial_number); |
| 69 | 73 | ||
| 70 | private: | 74 | private: |
| 71 | struct SupportedFeatures { | 75 | struct SupportedFeatures { |
| @@ -84,7 +88,7 @@ private: | |||
| 84 | void OnNewData(std::span<u8> buffer); | 88 | void OnNewData(std::span<u8> buffer); |
| 85 | 89 | ||
| 86 | /// Updates device configuration to enable or disable features | 90 | /// Updates device configuration to enable or disable features |
| 87 | DriverResult SetPollingMode(); | 91 | Common::Input::DriverResult SetPollingMode(); |
| 88 | 92 | ||
| 89 | /// Returns true if input thread is valid and doesn't need to be stopped | 93 | /// Returns true if input thread is valid and doesn't need to be stopped |
| 90 | bool IsInputThreadValid() const; | 94 | bool IsInputThreadValid() const; |