diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2022-12-20 20:27:34 -0600 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2023-01-19 18:05:21 -0600 |
commit | f09a023292e659af46d551b9b134d94d000a57c7 (patch) | |
tree | f34ef390cac9f32f7d807614505601635ac62e28 /src/input_common/helpers/joycon_driver.h | |
parent | 5676c2e17fe895e450e185029991fc20bdf56ec5 (diff) |
input_common: Add support for joycon input reports
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 275c97b913..48ba859f4e 100644 --- a/src/input_common/helpers/joycon_driver.h +++ b/src/input_common/helpers/joycon_driver.h @@ -11,6 +11,8 @@ #include "input_common/helpers/joycon_protocol/calibration.h" #include "input_common/helpers/joycon_protocol/generic_functions.h" #include "input_common/helpers/joycon_protocol/joycon_types.h" +#include "input_common/helpers/joycon_protocol/poller.h" +#include "input_common/helpers/joycon_protocol/rumble.h" namespace InputCommon::Joycon { @@ -42,6 +44,8 @@ public: DriverResult SetNfcMode(); DriverResult SetRingConMode(); + void SetCallbacks(const Joycon::JoyconCallbacks& callbacks); + // Returns device type from hidapi handle static Joycon::DriverResult GetDeviceType(SDL_hid_device_info* device_info, Joycon::ControllerType& controller_type); @@ -50,14 +54,6 @@ public: static Joycon::DriverResult GetSerialNumber(SDL_hid_device_info* device_info, Joycon::SerialNumber& serial_number); - std::function<void(Battery)> on_battery_data; - std::function<void(Color)> on_color_data; - std::function<void(int, bool)> on_button_data; - std::function<void(int, f32)> on_stick_data; - std::function<void(int, MotionData)> on_motion_data; - std::function<void(f32)> on_ring_data; - std::function<void(const std::vector<u8>&)> on_amiibo_data; - private: struct SupportedFeatures { bool passive{}; @@ -86,18 +82,11 @@ private: /// Returns a list of supported features that can be enabled on this device SupportedFeatures GetSupportedFeatures(); - /// Handles data from passive packages - void ReadPassiveMode(std::span<u8> buffer); - - /// Handles data from active packages - void ReadActiveMode(std::span<u8> buffer); - - /// Handles data from nfc or ir packages - void ReadNfcIRMode(std::span<u8> buffer); - // Protocol Features std::unique_ptr<CalibrationProtocol> calibration_protocol = nullptr; std::unique_ptr<GenericProtocol> generic_protocol = nullptr; + std::unique_ptr<JoyconPoller> joycon_poller = nullptr; + std::unique_ptr<RumbleProtocol> rumble_protocol = nullptr; // Connection status bool is_connected{}; |