diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h | 246 |
1 files changed, 0 insertions, 246 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h deleted file mode 100644 index b353316..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h +++ /dev/null | |||
| @@ -1,246 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2014-2017 Team Kodi | ||
| 3 | * http://kodi.tv | ||
| 4 | * | ||
| 5 | * This Program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This Program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this Program; see the file COPYING. If not, see | ||
| 17 | * <http://www.gnu.org/licenses/>. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | #ifndef __PERIPHERAL_DLL_H__ | ||
| 21 | #define __PERIPHERAL_DLL_H__ | ||
| 22 | |||
| 23 | #include "kodi_peripheral_types.h" | ||
| 24 | |||
| 25 | #define PERIPHERAL_ADDON_JOYSTICKS //! @todo | ||
| 26 | |||
| 27 | #ifdef __cplusplus | ||
| 28 | extern "C" | ||
| 29 | { | ||
| 30 | #endif | ||
| 31 | |||
| 32 | /// @name Peripheral operations | ||
| 33 | ///{ | ||
| 34 | /*! | ||
| 35 | * @brief Get the list of features that this add-on provides | ||
| 36 | * @param pCapabilities The add-on's capabilities. | ||
| 37 | * @return PERIPHERAL_NO_ERROR if the properties were fetched successfully. | ||
| 38 | * @remarks Valid implementation required. | ||
| 39 | * | ||
| 40 | * Called by the frontend to query the add-on's capabilities and supported | ||
| 41 | * peripherals. All capabilities that the add-on supports should be set to true. | ||
| 42 | * | ||
| 43 | */ | ||
| 44 | PERIPHERAL_ERROR GetAddonCapabilities(PERIPHERAL_CAPABILITIES *pCapabilities); | ||
| 45 | |||
| 46 | /*! | ||
| 47 | * @brief Perform a scan for joysticks | ||
| 48 | * @param peripheral_count Assigned to the number of peripherals allocated | ||
| 49 | * @param scan_results Assigned to allocated memory | ||
| 50 | * @return PERIPHERAL_NO_ERROR if successful; peripherals must be freed using | ||
| 51 | * FreeScanResults() in this case | ||
| 52 | * | ||
| 53 | * The frontend calls this when a hardware change is detected. If an add-on | ||
| 54 | * detects a hardware change, it can trigger this function using the | ||
| 55 | * TriggerScan() callback. | ||
| 56 | */ | ||
| 57 | PERIPHERAL_ERROR PerformDeviceScan(unsigned int* peripheral_count, PERIPHERAL_INFO** scan_results); | ||
| 58 | |||
| 59 | /*! | ||
| 60 | * @brief Free the memory allocated in PerformDeviceScan() | ||
| 61 | * | ||
| 62 | * Must be called if PerformDeviceScan() returns PERIPHERAL_NO_ERROR. | ||
| 63 | * | ||
| 64 | * @param peripheral_count The number of events allocated for the events array | ||
| 65 | * @param scan_results The array of allocated peripherals | ||
| 66 | */ | ||
| 67 | void FreeScanResults(unsigned int peripheral_count, PERIPHERAL_INFO* scan_results); | ||
| 68 | |||
| 69 | /*! | ||
| 70 | * @brief Get all events that have occurred since the last call to GetEvents() | ||
| 71 | * @return PERIPHERAL_NO_ERROR if successful; events must be freed using | ||
| 72 | * FreeEvents() in this case | ||
| 73 | */ | ||
| 74 | PERIPHERAL_ERROR GetEvents(unsigned int* event_count, PERIPHERAL_EVENT** events); | ||
| 75 | |||
| 76 | /*! | ||
| 77 | * @brief Free the memory allocated in GetEvents() | ||
| 78 | * | ||
| 79 | * Must be called if GetEvents() returns PERIPHERAL_NO_ERROR. | ||
| 80 | * | ||
| 81 | * @param event_count The number of events allocated for the events array | ||
| 82 | * @param events The array of allocated events | ||
| 83 | */ | ||
| 84 | void FreeEvents(unsigned int event_count, PERIPHERAL_EVENT* events); | ||
| 85 | |||
| 86 | /*! | ||
| 87 | * @brief Send an input event to the specified peripheral | ||
| 88 | * @param peripheralIndex The index of the device receiving the input event | ||
| 89 | * @param event The input event | ||
| 90 | * @return true if the event was handled, false otherwise | ||
| 91 | */ | ||
| 92 | bool SendEvent(const PERIPHERAL_EVENT* event); | ||
| 93 | ///} | ||
| 94 | |||
| 95 | /// @name Joystick operations | ||
| 96 | /*! | ||
| 97 | * @note #define PERIPHERAL_ADDON_JOYSTICKS before including kodi_peripheral_dll.h | ||
| 98 | * in the add-on if the add-on provides joysticks and add provides_joysticks="true" | ||
| 99 | * to the kodi.peripheral extension point node in addon.xml. | ||
| 100 | */ | ||
| 101 | ///{ | ||
| 102 | #ifdef PERIPHERAL_ADDON_JOYSTICKS | ||
| 103 | /*! | ||
| 104 | * @brief Get extended info about an attached joystick | ||
| 105 | * @param index The joystick's driver index | ||
| 106 | * @param info The container for the allocated joystick info | ||
| 107 | * @return PERIPHERAL_NO_ERROR if successful; array must be freed using | ||
| 108 | * FreeJoystickInfo() in this case | ||
| 109 | */ | ||
| 110 | PERIPHERAL_ERROR GetJoystickInfo(unsigned int index, JOYSTICK_INFO* info); | ||
| 111 | |||
| 112 | /*! | ||
| 113 | * @brief Free the memory allocated in GetJoystickInfo() | ||
| 114 | */ | ||
| 115 | void FreeJoystickInfo(JOYSTICK_INFO* info); | ||
| 116 | |||
| 117 | /*! | ||
| 118 | * @brief Get the features that allow translating the joystick into the controller profile | ||
| 119 | * @param joystick The device's joystick properties; unknown values may be left at their default | ||
| 120 | * @param controller_id The controller profile being requested, e.g. game.controller.default | ||
| 121 | * @param feature_count The number of features allocated for the features array | ||
| 122 | * @param features The array of allocated features | ||
| 123 | * @return PERIPHERAL_NO_ERROR if successful; array must be freed using | ||
| 124 | * FreeButtonMap() in this case | ||
| 125 | */ | ||
| 126 | PERIPHERAL_ERROR GetFeatures(const JOYSTICK_INFO* joystick, const char* controller_id, | ||
| 127 | unsigned int* feature_count, JOYSTICK_FEATURE** features); | ||
| 128 | |||
| 129 | /*! | ||
| 130 | * @brief Free the memory allocated in GetFeatures() | ||
| 131 | * | ||
| 132 | * Must be called if GetFeatures() returns PERIPHERAL_NO_ERROR. | ||
| 133 | * | ||
| 134 | * @param feature_count The number of features allocated for the features array | ||
| 135 | * @param features The array of allocated features | ||
| 136 | */ | ||
| 137 | void FreeFeatures(unsigned int feature_count, JOYSTICK_FEATURE* features); | ||
| 138 | |||
| 139 | /*! | ||
| 140 | * @brief Add or update joystick features | ||
| 141 | * @param joystick The device's joystick properties; unknown values may be left at their default | ||
| 142 | * @param controller_id The game controller profile being updated | ||
| 143 | * @param feature_count The number of features in the features array | ||
| 144 | * @param features The array of features | ||
| 145 | * @return PERIPHERAL_NO_ERROR if successful | ||
| 146 | */ | ||
| 147 | PERIPHERAL_ERROR MapFeatures(const JOYSTICK_INFO* joystick, const char* controller_id, | ||
| 148 | unsigned int feature_count, const JOYSTICK_FEATURE* features); | ||
| 149 | |||
| 150 | /*! | ||
| 151 | * @brief Get the driver primitives that should be ignored while mapping the device | ||
| 152 | * @param joystick The device's joystick properties; unknown values may be left at their default | ||
| 153 | * @param primitive_count The number of features allocated for the primitives array | ||
| 154 | * @param primitives The array of allocated driver primitives to be ignored | ||
| 155 | * @return PERIPHERAL_NO_ERROR if successful; array must be freed using | ||
| 156 | * FreePrimitives() in this case | ||
| 157 | */ | ||
| 158 | PERIPHERAL_ERROR GetIgnoredPrimitives(const JOYSTICK_INFO* joystick, | ||
| 159 | unsigned int* primitive_count, | ||
| 160 | JOYSTICK_DRIVER_PRIMITIVE** primitives); | ||
| 161 | |||
| 162 | /*! | ||
| 163 | * @brief Free the memory allocated in GetIgnoredPrimitives() | ||
| 164 | * | ||
| 165 | * Must be called if GetIgnoredPrimitives() returns PERIPHERAL_NO_ERROR. | ||
| 166 | * | ||
| 167 | * @param primitive_count The number of driver primitives allocated for the primitives array | ||
| 168 | * @param primitives The array of allocated driver primitives | ||
| 169 | */ | ||
| 170 | void FreePrimitives(unsigned int primitive_count, JOYSTICK_DRIVER_PRIMITIVE* primitives); | ||
| 171 | |||
| 172 | /*! | ||
| 173 | * @brief Set the list of driver primitives that are ignored for the device | ||
| 174 | * @param joystick The device's joystick properties; unknown values may be left at their default | ||
| 175 | * @param primitive_count The number of driver features in the primitives array | ||
| 176 | * @param primitives The array of driver primitives to ignore | ||
| 177 | * @return PERIPHERAL_NO_ERROR if successful | ||
| 178 | */ | ||
| 179 | PERIPHERAL_ERROR SetIgnoredPrimitives(const JOYSTICK_INFO* joystick, | ||
| 180 | unsigned int primitive_count, | ||
| 181 | const JOYSTICK_DRIVER_PRIMITIVE* primitives); | ||
| 182 | |||
| 183 | /*! | ||
| 184 | * @brief Save the button map for the given joystick | ||
| 185 | * @param joystick The device's joystick properties | ||
| 186 | */ | ||
| 187 | void SaveButtonMap(const JOYSTICK_INFO* joystick); | ||
| 188 | |||
| 189 | /*! | ||
| 190 | * @brief Revert the button map to the last time it was loaded or committed to disk | ||
| 191 | * @param joystick The device's joystick properties | ||
| 192 | */ | ||
| 193 | void RevertButtonMap(const JOYSTICK_INFO* joystick); | ||
| 194 | |||
| 195 | /*! | ||
| 196 | * @brief Reset the button map for the given joystick and controller profile ID | ||
| 197 | * @param joystick The device's joystick properties | ||
| 198 | * @param controller_id The game controller profile being reset | ||
| 199 | */ | ||
| 200 | void ResetButtonMap(const JOYSTICK_INFO* joystick, const char* controller_id); | ||
| 201 | |||
| 202 | /*! | ||
| 203 | * @brief Powers off the given joystick if supported | ||
| 204 | * @param index The joystick's driver index | ||
| 205 | */ | ||
| 206 | void PowerOffJoystick(unsigned int index); | ||
| 207 | #endif | ||
| 208 | ///} | ||
| 209 | |||
| 210 | /*! | ||
| 211 | * Called by the frontend to assign the function pointers of this add-on to | ||
| 212 | * pClient. Note that get_addon() is defined here, so it will be available in | ||
| 213 | * all compiled peripheral add-ons. | ||
| 214 | */ | ||
| 215 | void __declspec(dllexport) get_addon(void* ptr) | ||
| 216 | { | ||
| 217 | AddonInstance_Peripheral* pClient = static_cast<AddonInstance_Peripheral*>(ptr); | ||
| 218 | |||
| 219 | pClient->toAddon.GetAddonCapabilities = GetAddonCapabilities; | ||
| 220 | pClient->toAddon.PerformDeviceScan = PerformDeviceScan; | ||
| 221 | pClient->toAddon.FreeScanResults = FreeScanResults; | ||
| 222 | pClient->toAddon.GetEvents = GetEvents; | ||
| 223 | pClient->toAddon.FreeEvents = FreeEvents; | ||
| 224 | pClient->toAddon.SendEvent = SendEvent; | ||
| 225 | |||
| 226 | #ifdef PERIPHERAL_ADDON_JOYSTICKS | ||
| 227 | pClient->toAddon.GetJoystickInfo = GetJoystickInfo; | ||
| 228 | pClient->toAddon.FreeJoystickInfo = FreeJoystickInfo; | ||
| 229 | pClient->toAddon.GetFeatures = GetFeatures; | ||
| 230 | pClient->toAddon.FreeFeatures = FreeFeatures; | ||
| 231 | pClient->toAddon.MapFeatures = MapFeatures; | ||
| 232 | pClient->toAddon.GetIgnoredPrimitives = GetIgnoredPrimitives; | ||
| 233 | pClient->toAddon.FreePrimitives = FreePrimitives; | ||
| 234 | pClient->toAddon.SetIgnoredPrimitives = SetIgnoredPrimitives; | ||
| 235 | pClient->toAddon.SaveButtonMap = SaveButtonMap; | ||
| 236 | pClient->toAddon.RevertButtonMap = RevertButtonMap; | ||
| 237 | pClient->toAddon.ResetButtonMap = ResetButtonMap; | ||
| 238 | pClient->toAddon.PowerOffJoystick = PowerOffJoystick; | ||
| 239 | #endif | ||
| 240 | } | ||
| 241 | |||
| 242 | #ifdef __cplusplus | ||
| 243 | } | ||
| 244 | #endif | ||
| 245 | |||
| 246 | #endif // __PERIPHERAL_DLL_H__ | ||
