11 #include "Peripheral.h" 12 #include "XBDateTime.h" 13 #include "games/controllers/ControllerTypes.h" 14 #include "input/joysticks/JoystickTypes.h" 15 #include "input/joysticks/interfaces/IDriverReceiver.h" 16 #include "threads/CriticalSection.h" 28 class CDeadzoneFilter;
29 class CRumbleGenerator;
37 class CKeymapHandling;
59 bool InitialiseFeature(
const PeripheralFeature feature)
override;
60 void OnUserNotification()
override;
61 bool TestFeature(PeripheralFeature feature)
override;
63 bool bPromiscuous)
override;
71 bool OnButtonMotion(
unsigned int buttonIndex,
bool bPressed);
72 bool OnHatMotion(
unsigned int hatIndex, KODI::JOYSTICK::HAT_STATE state);
73 bool OnAxisMotion(
unsigned int axisIndex,
float position);
74 void OnInputFrame(
void);
77 bool SetMotorState(
unsigned int motorIndex,
float magnitude)
override;
82 const std::string&
Provider(
void)
const {
return m_strProvider; }
98 unsigned int ButtonCount(
void)
const {
return m_buttonCount; }
99 unsigned int HatCount(
void)
const {
return m_hatCount; }
100 unsigned int AxisCount(
void)
const {
return m_axisCount; }
101 unsigned int MotorCount(
void)
const {
return m_motorCount; }
102 bool SupportsPowerOff(
void)
const {
return m_supportsPowerOff; }
107 void SetProvider(
const std::string& provider) { m_strProvider = provider; }
108 void SetRequestedPort(
int port) { m_requestedPort = port; }
109 void SetButtonCount(
unsigned int buttonCount) { m_buttonCount = buttonCount; }
110 void SetHatCount(
unsigned int hatCount) { m_hatCount = hatCount; }
111 void SetAxisCount(
unsigned int axisCount) { m_axisCount = axisCount; }
112 void SetMotorCount(
unsigned int motorCount);
113 void SetSupportsPowerOff(
bool bSupportsPowerOff);
123 static bool InstallSync(
const std::string& controllerId);
132 std::string m_strProvider;
133 int m_requestedPort{JOYSTICK_NO_PORT_REQUESTED};
134 unsigned int m_buttonCount = 0;
135 unsigned int m_hatCount = 0;
136 unsigned int m_axisCount = 0;
137 unsigned int m_motorCount = 0;
138 bool m_supportsPowerOff =
false;
140 std::queue<std::string> m_controllersToInstall;
141 std::vector<std::future<void>> m_installTasks;
144 std::unique_ptr<KODI::KEYMAP::CKeymapHandling> m_appInput;
145 std::unique_ptr<KODI::JOYSTICK::CRumbleGenerator> m_rumbleGenerator;
146 std::unique_ptr<KODI::JOYSTICK::IInputHandler> m_joystickMonitor;
147 std::unique_ptr<KODI::JOYSTICK::IButtonMap> m_buttonMap;
148 std::unique_ptr<KODI::JOYSTICK::CDeadzoneFilter> m_deadzoneFilter;
149 std::vector<DriverHandler> m_driverHandlers;
152 CCriticalSection m_handlerMutex;
153 CCriticalSection m_controllerInstallMutex;
Definition: PeripheralTypes.h:326
const std::string & Provider(void) const
Get the name of the driver or API providing this joystick.
Definition: PeripheralJoystick.h:82
unsigned int ButtonCount(void) const
Get the number of elements reported by the driver.
Definition: PeripheralJoystick.h:98
int RequestedPort(void) const
Get the specific port number requested by this joystick.
Definition: PeripheralJoystick.h:93
Definition: RetroPlayerInput.h:15
Interface defining methods to handle joystick events for raw driver elements (buttons, hats, axes)
Definition: IDriverHandler.h:23
void SetProvider(const std::string &provider)
Set joystick properties.
Definition: PeripheralJoystick.h:107
Definition: PeripheralJoystick.h:48
Definition: PeripheralJoystick.h:125
Definition: AudioDecoder.h:18
std::shared_ptr< CController > ControllerPtr
Smart pointer to a game controller (CController)
Definition: ControllerTypes.h:25
DateTime class, which uses FileTime as it's base.
Definition: XBDateTime.h:63
Definition: PeripheralBus.h:36
CDateTime LastActive() const override
Return the last time this peripheral was active.
Definition: PeripheralJoystick.h:67
Definition: Peripheral.h:71
Interface for sending input events to joystick drivers.
Definition: IDriverReceiver.h:20
Definition: Peripherals.h:56
Interface for mapping buttons to Kodi actions.
Definition: IKeymap.h:28