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; }
84 const std::string& strControllerId,
85 FeatureMap& features);
87 const std::string& strControllerId,
88 const kodi::addon::JoystickFeature& feature);
89 bool GetIgnoredPrimitives(
const CPeripheral* device, PrimitiveVector& primitives);
90 bool SetIgnoredPrimitives(
const CPeripheral* device,
const PrimitiveVector& primitives);
93 void ResetButtonMap(
const CPeripheral* device,
const std::string& strControllerId);
94 void PowerOffJoystick(
unsigned int index);
100 static bool ProvidesJoysticks(
const ADDON::AddonInfoPtr& addonInfo);
101 static bool ProvidesButtonMaps(
const ADDON::AddonInfoPtr& addonInfo);
107 void TriggerDeviceScan();
108 void RefreshButtonMaps(
const std::string& strDeviceName =
"");
111 const std::string& featureName)
const;
116 static void GetPeripheralInfo(
const CPeripheral* device, kodi::addon::Peripheral& peripheralInfo);
118 static void GetJoystickInfo(
const CPeripheral* device, kodi::addon::Joystick& joystickInfo);
120 const kodi::addon::Joystick& joystickInfo);
125 void ResetProperties(
void);
130 bool GetAddonProperties(
void);
134 static std::string GetDeviceName(PeripheralType type);
135 static std::string GetProvider(PeripheralType type);
141 std::string m_strUserPath;
142 std::string m_strClientPath;
148 static void cb_trigger_scan(
void* kodiInstance);
149 static void cb_refresh_button_maps(
void* kodiInstance,
150 const char* deviceName,
151 const char* controllerId);
152 static unsigned int cb_feature_count(
void* kodiInstance,
153 const char* controllerId,
156 const char* controllerId,
157 const char* featureName);
161 bool m_bProvidesJoysticks;
162 bool m_bSupportsJoystickRumble;
163 bool m_bSupportsJoystickPowerOff;
164 bool m_bProvidesButtonMaps;
167 std::map<unsigned int, PeripheralPtr> m_peripherals;
170 std::vector<std::pair<CPeripheral*, KODI::JOYSTICK::IButtonMap*>> m_buttonMaps;
171 CCriticalSection m_buttonMapMutex;
174 mutable CCriticalSection m_critSection;
Definition: PeripheralTypes.h:348
Definition: RetroPlayerInput.h:15
Represents a list of files.
Definition: FileItem.h:713
PERIPHERAL_ERROR
Definition: peripheral.h:35
Definition: PeripheralAddon.h:42
JOYSTICK_FEATURE_TYPE
Definition: peripheral.h:493
Definition: AddonInstanceHandler.h:33
Definition: PeripheralJoystick.h:40
Controller configuration window.
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:62
Definition: Peripherals.h:49