diff options
Diffstat (limited to 'src/input_common/helpers/joycon_driver.h')
| -rw-r--r-- | src/input_common/helpers/joycon_driver.h | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/input_common/helpers/joycon_driver.h b/src/input_common/helpers/joycon_driver.h index 275c97b91..48ba859f4 100644 --- a/src/input_common/helpers/joycon_driver.h +++ b/src/input_common/helpers/joycon_driver.h | |||
| @@ -11,6 +11,8 @@ | |||
| 11 | #include "input_common/helpers/joycon_protocol/calibration.h" | 11 | #include "input_common/helpers/joycon_protocol/calibration.h" |
| 12 | #include "input_common/helpers/joycon_protocol/generic_functions.h" | 12 | #include "input_common/helpers/joycon_protocol/generic_functions.h" |
| 13 | #include "input_common/helpers/joycon_protocol/joycon_types.h" | 13 | #include "input_common/helpers/joycon_protocol/joycon_types.h" |
| 14 | #include "input_common/helpers/joycon_protocol/poller.h" | ||
| 15 | #include "input_common/helpers/joycon_protocol/rumble.h" | ||
| 14 | 16 | ||
| 15 | namespace InputCommon::Joycon { | 17 | namespace InputCommon::Joycon { |
| 16 | 18 | ||
| @@ -42,6 +44,8 @@ public: | |||
| 42 | DriverResult SetNfcMode(); | 44 | DriverResult SetNfcMode(); |
| 43 | DriverResult SetRingConMode(); | 45 | DriverResult SetRingConMode(); |
| 44 | 46 | ||
| 47 | void SetCallbacks(const Joycon::JoyconCallbacks& callbacks); | ||
| 48 | |||
| 45 | // Returns device type from hidapi handle | 49 | // Returns device type from hidapi handle |
| 46 | static Joycon::DriverResult GetDeviceType(SDL_hid_device_info* device_info, | 50 | static Joycon::DriverResult GetDeviceType(SDL_hid_device_info* device_info, |
| 47 | Joycon::ControllerType& controller_type); | 51 | Joycon::ControllerType& controller_type); |
| @@ -50,14 +54,6 @@ public: | |||
| 50 | static Joycon::DriverResult GetSerialNumber(SDL_hid_device_info* device_info, | 54 | static Joycon::DriverResult GetSerialNumber(SDL_hid_device_info* device_info, |
| 51 | Joycon::SerialNumber& serial_number); | 55 | Joycon::SerialNumber& serial_number); |
| 52 | 56 | ||
| 53 | std::function<void(Battery)> on_battery_data; | ||
| 54 | std::function<void(Color)> on_color_data; | ||
| 55 | std::function<void(int, bool)> on_button_data; | ||
| 56 | std::function<void(int, f32)> on_stick_data; | ||
| 57 | std::function<void(int, MotionData)> on_motion_data; | ||
| 58 | std::function<void(f32)> on_ring_data; | ||
| 59 | std::function<void(const std::vector<u8>&)> on_amiibo_data; | ||
| 60 | |||
| 61 | private: | 57 | private: |
| 62 | struct SupportedFeatures { | 58 | struct SupportedFeatures { |
| 63 | bool passive{}; | 59 | bool passive{}; |
| @@ -86,18 +82,11 @@ private: | |||
| 86 | /// Returns a list of supported features that can be enabled on this device | 82 | /// Returns a list of supported features that can be enabled on this device |
| 87 | SupportedFeatures GetSupportedFeatures(); | 83 | SupportedFeatures GetSupportedFeatures(); |
| 88 | 84 | ||
| 89 | /// Handles data from passive packages | ||
| 90 | void ReadPassiveMode(std::span<u8> buffer); | ||
| 91 | |||
| 92 | /// Handles data from active packages | ||
| 93 | void ReadActiveMode(std::span<u8> buffer); | ||
| 94 | |||
| 95 | /// Handles data from nfc or ir packages | ||
| 96 | void ReadNfcIRMode(std::span<u8> buffer); | ||
| 97 | |||
| 98 | // Protocol Features | 85 | // Protocol Features |
| 99 | std::unique_ptr<CalibrationProtocol> calibration_protocol = nullptr; | 86 | std::unique_ptr<CalibrationProtocol> calibration_protocol = nullptr; |
| 100 | std::unique_ptr<GenericProtocol> generic_protocol = nullptr; | 87 | std::unique_ptr<GenericProtocol> generic_protocol = nullptr; |
| 88 | std::unique_ptr<JoyconPoller> joycon_poller = nullptr; | ||
| 89 | std::unique_ptr<RumbleProtocol> rumble_protocol = nullptr; | ||
| 101 | 90 | ||
| 102 | // Connection status | 91 | // Connection status |
| 103 | bool is_connected{}; | 92 | bool is_connected{}; |