11 #include "Peripheral.h" 12 #include "XBDateTime.h" 13 #include "games/controllers/ControllerTypes.h" 15 #include "input/joysticks/interfaces/IDriverReceiver.h" 16 #include "threads/CriticalSection.h" 24 #define JOYSTICK_PORT_UNKNOWN (-1) 30 class CDeadzoneFilter;
31 class CKeymapHandling;
32 class CRumbleGenerator;
54 bool InitialiseFeature(
const PeripheralFeature feature)
override;
55 void OnUserNotification()
override;
56 bool TestFeature(PeripheralFeature feature)
override;
58 bool bPromiscuous)
override;
61 IKeymap* GetKeymap(
const std::string& controllerId)
override;
66 bool OnButtonMotion(
unsigned int buttonIndex,
bool bPressed);
67 bool OnHatMotion(
unsigned int hatIndex, KODI::JOYSTICK::HAT_STATE state);
68 bool OnAxisMotion(
unsigned int axisIndex,
float position);
69 void OnInputFrame(
void);
72 bool SetMotorState(
unsigned int motorIndex,
float magnitude)
override;
77 const std::string&
Provider(
void)
const {
return m_strProvider; }
93 unsigned int ButtonCount(
void)
const {
return m_buttonCount; }
94 unsigned int HatCount(
void)
const {
return m_hatCount; }
95 unsigned int AxisCount(
void)
const {
return m_axisCount; }
96 unsigned int MotorCount(
void)
const {
return m_motorCount; }
97 bool SupportsPowerOff(
void)
const {
return m_supportsPowerOff; }
102 void SetProvider(
const std::string& provider) { m_strProvider = provider; }
103 void SetRequestedPort(
int port) { m_requestedPort = port; }
104 void SetButtonCount(
unsigned int buttonCount) { m_buttonCount = buttonCount; }
105 void SetHatCount(
unsigned int hatCount) { m_hatCount = hatCount; }
106 void SetAxisCount(
unsigned int axisCount) { m_axisCount = axisCount; }
107 void SetMotorCount(
unsigned int motorCount);
108 void SetSupportsPowerOff(
bool bSupportsPowerOff);
118 static bool InstallSync(
const std::string& controllerId);
127 std::string m_strProvider;
128 int m_requestedPort = JOYSTICK_PORT_UNKNOWN;
129 unsigned int m_buttonCount = 0;
130 unsigned int m_hatCount = 0;
131 unsigned int m_axisCount = 0;
132 unsigned int m_motorCount = 0;
133 bool m_supportsPowerOff =
false;
135 std::queue<std::string> m_controllersToInstall;
136 std::vector<std::future<void>> m_installTasks;
139 std::unique_ptr<KODI::JOYSTICK::CKeymapHandling> m_appInput;
140 std::unique_ptr<KODI::JOYSTICK::CRumbleGenerator> m_rumbleGenerator;
141 std::unique_ptr<KODI::JOYSTICK::IInputHandler> m_joystickMonitor;
142 std::unique_ptr<KODI::JOYSTICK::IButtonMap> m_buttonMap;
143 std::unique_ptr<KODI::JOYSTICK::CDeadzoneFilter> m_deadzoneFilter;
144 std::vector<DriverHandler> m_driverHandlers;
147 CCriticalSection m_handlerMutex;
148 CCriticalSection m_controllerInstallMutex;
Definition: PeripheralTypes.h:318
const std::string & Provider(void) const
Get the name of the driver or API providing this joystick.
Definition: PeripheralJoystick.h:77
unsigned int ButtonCount(void) const
Get the number of elements reported by the driver.
Definition: PeripheralJoystick.h:93
int RequestedPort(void) const
Get the specific port number requested by this joystick.
Definition: PeripheralJoystick.h:88
Definition: RetroPlayerInput.h:15
Interface defining methods to handle joystick events for raw driver elements (buttons, hats, axes)
Definition: IDriverHandler.h:21
Interface for mapping buttons to Kodi actions.
Definition: IKeymap.h:22
void SetProvider(const std::string &provider)
Set joystick properties.
Definition: PeripheralJoystick.h:102
Definition: PeripheralJoystick.h:43
Definition: PeripheralJoystick.h:120
Definition: AudioDecoder.h:18
CDateTime LastActive() override
Return the last time this peripheral was active.
Definition: PeripheralJoystick.h:62
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:34
Definition: Peripheral.h:61
Interface for sending input events to joystick drivers.
Definition: IDriverReceiver.h:19
Definition: Peripherals.h:53