11 #include "addons/binary-addons/AddonInstanceHandler.h" 12 #include "addons/kodi-dev-kit/include/kodi/addon-instance/Peripheral.h" 13 #include "input/joysticks/JoystickTypes.h" 14 #include "peripherals/PeripheralTypes.h" 15 #include "threads/CriticalSection.h" 16 #include "threads/SharedSection.h" 36 class CPeripheralJoystick;
39 typedef std::vector<kodi::addon::DriverPrimitive> PrimitiveVector;
40 typedef std::map<KODI::JOYSTICK::FeatureName, kodi::addon::JoystickFeature> FeatureMap;
54 bool CreateAddon(
void);
61 bool Register(
unsigned int peripheralIndex,
const PeripheralPtr& peripheral);
63 PeripheralVector& removedPeripherals);
64 void GetFeatures(std::vector<PeripheralFeature>& features)
const;
65 bool HasFeature(
const PeripheralFeature feature)
const;
66 PeripheralPtr GetPeripheral(
unsigned int index)
const;
67 PeripheralPtr GetByPath(
const std::string& strPath)
const;
68 bool SupportsFeature(PeripheralFeature feature)
const;
69 unsigned int GetPeripheralsWithFeature(PeripheralVector& results,
70 const PeripheralFeature feature)
const;
71 unsigned int GetNumberOfPeripherals(
void)
const;
72 unsigned int GetNumberOfPeripheralsWithId(
const int iVendorId,
const int iProductId)
const;
73 void GetDirectory(
const std::string& strPath,
CFileItemList& items)
const;
78 bool ProcessEvents(
void);
79 bool SendRumbleEvent(
unsigned int index,
unsigned int driverIndex,
float magnitude);
85 bool HasButtonMaps(
void)
const {
return m_bProvidesButtonMaps; }
86 bool GetAppearance(
const CPeripheral* device, std::string& controllerId);
87 bool SetAppearance(
const CPeripheral* device,
const std::string& controllerId);
89 const std::string& strControllerId,
90 FeatureMap& features);
92 const std::string& strControllerId,
93 const kodi::addon::JoystickFeature& feature);
94 bool GetIgnoredPrimitives(
const CPeripheral* device, PrimitiveVector& primitives);
95 bool SetIgnoredPrimitives(
const CPeripheral* device,
const PrimitiveVector& primitives);
98 void ResetButtonMap(
const CPeripheral* device,
const std::string& strControllerId);
99 void PowerOffJoystick(
unsigned int index);
105 static bool ProvidesJoysticks(
const ADDON::AddonInfoPtr& addonInfo);
106 static bool ProvidesButtonMaps(
const ADDON::AddonInfoPtr& addonInfo);
112 void TriggerDeviceScan();
113 void RefreshButtonMaps(
const std::string& strDeviceName =
"");
116 const std::string& featureName)
const;
121 static void GetPeripheralInfo(
const CPeripheral* device, kodi::addon::Peripheral& peripheralInfo);
123 static void GetJoystickInfo(
const CPeripheral* device, kodi::addon::Joystick& joystickInfo);
125 const kodi::addon::Joystick& joystickInfo);
130 void ResetProperties(
void);
135 bool GetAddonProperties(
void);
139 static std::string GetDeviceName(PeripheralType type);
140 static std::string GetProvider(PeripheralType type);
146 std::string m_strUserPath;
147 std::string m_strClientPath;
153 static void cb_trigger_scan(
void* kodiInstance);
154 static void cb_refresh_button_maps(
void* kodiInstance,
155 const char* deviceName,
156 const char* controllerId);
157 static unsigned int cb_feature_count(
void* kodiInstance,
158 const char* controllerId,
161 const char* controllerId,
162 const char* featureName);
166 bool m_bProvidesJoysticks;
167 bool m_bSupportsJoystickRumble =
false;
168 bool m_bSupportsJoystickPowerOff =
false;
169 bool m_bProvidesButtonMaps;
172 std::map<unsigned int, PeripheralPtr> m_peripherals;
175 std::vector<std::pair<CPeripheral*, KODI::JOYSTICK::IButtonMap*>> m_buttonMaps;
176 CCriticalSection m_buttonMapMutex;
179 mutable CCriticalSection m_critSection;
Definition: PeripheralTypes.h:356
Definition: RetroPlayerInput.h:15
Represents a list of files.
Definition: FileItem.h:702
PERIPHERAL_ERROR
Definition: peripheral.h:35
Definition: PeripheralAddon.h:45
JOYSTICK_FEATURE_TYPE
Definition: peripheral.h:496
Definition: AddonInstanceHandler.h:33
Definition: PeripheralJoystick.h:48
Definition: AudioDecoder.h:18
A CSharedSection is a mutex that satisfies the Shared Lockable concept (see Lockables.h).
Definition: SharedSection.h:19
Definition: Peripheral.h:71
Definition: Peripherals.h:56