11 #include "addons/binary-addons/AddonInstanceHandler.h" 12 #include "addons/kodi-dev-kit/include/kodi/addon-instance/Peripheral.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;
51 bool CreateAddon(
void);
58 bool Register(
unsigned int peripheralIndex,
const PeripheralPtr& peripheral);
60 PeripheralVector& removedPeripherals);
61 void GetFeatures(std::vector<PeripheralFeature>& features)
const;
62 bool HasFeature(
const PeripheralFeature feature)
const;
63 PeripheralPtr GetPeripheral(
unsigned int index)
const;
64 PeripheralPtr GetByPath(
const std::string& strPath)
const;
65 bool SupportsFeature(PeripheralFeature feature)
const;
66 unsigned int GetPeripheralsWithFeature(PeripheralVector& results,
67 const PeripheralFeature feature)
const;
68 unsigned int GetNumberOfPeripherals(
void)
const;
69 unsigned int GetNumberOfPeripheralsWithId(
const int iVendorId,
const int iProductId)
const;
70 void GetDirectory(
const std::string& strPath,
CFileItemList& items)
const;
75 bool ProcessEvents(
void);
76 bool SendRumbleEvent(
unsigned int index,
unsigned int driverIndex,
float magnitude);
82 bool HasButtonMaps(
void)
const {
return m_bProvidesButtonMaps; }
83 bool GetAppearance(
const CPeripheral* device, std::string& controllerId);
84 bool SetAppearance(
const CPeripheral* device,
const std::string& controllerId);
86 const std::string& strControllerId,
87 FeatureMap& features);
89 const std::string& strControllerId,
90 const kodi::addon::JoystickFeature& feature);
91 bool GetIgnoredPrimitives(
const CPeripheral* device, PrimitiveVector& primitives);
92 bool SetIgnoredPrimitives(
const CPeripheral* device,
const PrimitiveVector& primitives);
95 void ResetButtonMap(
const CPeripheral* device,
const std::string& strControllerId);
96 void PowerOffJoystick(
unsigned int index);
102 static bool ProvidesJoysticks(
const ADDON::AddonInfoPtr& addonInfo);
103 static bool ProvidesButtonMaps(
const ADDON::AddonInfoPtr& addonInfo);
109 void TriggerDeviceScan();
110 void RefreshButtonMaps(
const std::string& strDeviceName =
"");
113 const std::string& featureName)
const;
118 static void GetPeripheralInfo(
const CPeripheral* device, kodi::addon::Peripheral& peripheralInfo);
120 static void GetJoystickInfo(
const CPeripheral* device, kodi::addon::Joystick& joystickInfo);
122 const kodi::addon::Joystick& joystickInfo);
127 void ResetProperties(
void);
132 bool GetAddonProperties(
void);
136 static std::string GetDeviceName(PeripheralType type);
137 static std::string GetProvider(PeripheralType type);
143 std::string m_strUserPath;
144 std::string m_strClientPath;
150 static void cb_trigger_scan(
void* kodiInstance);
151 static void cb_refresh_button_maps(
void* kodiInstance,
152 const char* deviceName,
153 const char* controllerId);
154 static unsigned int cb_feature_count(
void* kodiInstance,
155 const char* controllerId,
158 const char* controllerId,
159 const char* featureName);
163 bool m_bProvidesJoysticks;
164 bool m_bSupportsJoystickRumble =
false;
165 bool m_bSupportsJoystickPowerOff =
false;
166 bool m_bProvidesButtonMaps;
169 std::map<unsigned int, PeripheralPtr> m_peripherals;
172 std::vector<std::pair<CPeripheral*, KODI::JOYSTICK::IButtonMap*>> m_buttonMaps;
173 CCriticalSection m_buttonMapMutex;
176 mutable CCriticalSection m_critSection;
Definition: PeripheralTypes.h:348
Definition: RetroPlayerInput.h:15
Represents a list of files.
Definition: FileItem.h:721
PERIPHERAL_ERROR
Definition: peripheral.h:35
Definition: PeripheralAddon.h:42
JOYSTICK_FEATURE_TYPE
Definition: peripheral.h:496
Definition: AddonInstanceHandler.h:33
Definition: PeripheralJoystick.h:43
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:61
Definition: Peripherals.h:53