diff options
17 files changed, 57 insertions, 365 deletions
diff --git a/.gitignore b/.gitignore index 79df3bdeda..06e09a5abb 100644 --- a/.gitignore +++ b/.gitignore @@ -149,7 +149,6 @@ cmake_install.cmake /lib/addons/library.kodi.guilib/project/VS2010Express/Debug /lib/addons/library.xbmc.addon/Makefile /lib/addons/library.xbmc.codec/Makefile -/lib/addons/library.kodi.peripheral/Makefile /lib/addons/library.kodi.game/Makefile /lib/addons/library.xbmc.addon/project/VS2010Express/Release /lib/addons/library.xbmc.addon/project/VS2010Express/Debug @@ -158,8 +157,6 @@ cmake_install.cmake /lib/addons/library.kodi.audioengine/Makefile /lib/addons/library.kodi.audioengine/project/VS2010Express/Release/ /lib/addons/library.kodi.audioengine/project/VS2010Express/Debug/ -/lib/addons/library.kodi.peripheral/project/VS2010Express/Release -/lib/addons/library.kodi.peripheral/project/VS2010Express/Debug /lib/addons/library.kodi.game/project/VS2010Express/Release /lib/addons/library.kodi.game/project/VS2010Express/Debug diff --git a/Kodi.xcodeproj/project.pbxproj b/Kodi.xcodeproj/project.pbxproj index afa0586475..904153c03e 100644 --- a/Kodi.xcodeproj/project.pbxproj +++ b/Kodi.xcodeproj/project.pbxproj @@ -2959,7 +2959,6 @@ 68AE5BA01C923E5300C4D527 /* kodi_vfs_utils.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = kodi_vfs_utils.hpp; path = "kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp"; sourceTree = "<group>"; }; 68AE5BA31C92412900C4D527 /* AddonCallbacksPeripheral.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AddonCallbacksPeripheral.cpp; path = addons/binary/interfaces/api1/Peripheral/AddonCallbacksPeripheral.cpp; sourceTree = "<group>"; }; 68AE5BA41C92412900C4D527 /* AddonCallbacksPeripheral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AddonCallbacksPeripheral.h; path = addons/binary/interfaces/api1/Peripheral/AddonCallbacksPeripheral.h; sourceTree = "<group>"; }; - 68AE5BA71C92414B00C4D527 /* kodi_peripheral_callbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = kodi_peripheral_callbacks.h; path = "kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h"; sourceTree = "<group>"; }; 68AE5BA81C92414B00C4D527 /* kodi_peripheral_dll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = kodi_peripheral_dll.h; path = "kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h"; sourceTree = "<group>"; }; 68AE5BA91C92414B00C4D527 /* kodi_peripheral_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = kodi_peripheral_types.h; path = "kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h"; sourceTree = "<group>"; }; 68AE5BAA1C92414B00C4D527 /* kodi_peripheral_utils.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = kodi_peripheral_utils.hpp; path = "kodi-addon-dev-kit/include/kodi/kodi_peripheral_utils.hpp"; sourceTree = "<group>"; }; @@ -9550,7 +9549,6 @@ 6890C22B1DDBDD0900F8F362 /* kodi_game_types.h */, 7CEE107B1C970BB800E0D426 /* kodi_inputstream_dll.h */, 7CEE107C1C970BB800E0D426 /* kodi_inputstream_types.h */, - 68AE5BA71C92414B00C4D527 /* kodi_peripheral_callbacks.h */, 68AE5BA81C92414B00C4D527 /* kodi_peripheral_dll.h */, 68AE5BA91C92414B00C4D527 /* kodi_peripheral_types.h */, 68AE5BAA1C92414B00C4D527 /* kodi_peripheral_utils.hpp */, diff --git a/Makefile.in b/Makefile.in index ccb89f6842..e8343010c4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -240,7 +240,6 @@ LIBADDON_DIRS=\ lib/addons/library.kodi.audioengine \ lib/addons/library.xbmc.codec \ lib/addons/library.kodi.guilib \ - lib/addons/library.kodi.peripheral \ lib/addons/library.kodi.game \ ESTUARY_MEDIA=addons/skin.estuary/media @@ -363,7 +362,6 @@ libaddon: exports $(MAKE) -C lib/addons/library.xbmc.codec $(MAKE) -C lib/addons/library.kodi.game $(MAKE) -C lib/addons/library.kodi.guilib - $(MAKE) -C lib/addons/library.kodi.peripheral dvdpcodecs: dllloader $(MAKE) -C lib/libdvd diff --git a/configure.ac b/configure.ac index 24e3ecb300..248a686b01 100644 --- a/configure.ac +++ b/configure.ac @@ -2196,7 +2196,6 @@ OUTPUT_FILES="Makefile \ lib/addons/library.xbmc.codec/Makefile \ lib/addons/library.kodi.game/Makefile \ lib/addons/library.kodi.guilib/Makefile \ - lib/addons/library.kodi.peripheral/Makefile \ tools/Linux/kodi.sh \ tools/Linux/kodi-standalone.sh \ tools/Linux/kodi-xsession.desktop \ diff --git a/lib/addons/library.kodi.peripheral/CMakeLists.txt b/lib/addons/library.kodi.peripheral/CMakeLists.txt deleted file mode 100644 index dcaa5b4160..0000000000 --- a/lib/addons/library.kodi.peripheral/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(KODI_peripheral) -core_add_addon_library(${PROJECT_NAME}) diff --git a/lib/addons/library.kodi.peripheral/Makefile.in b/lib/addons/library.kodi.peripheral/Makefile.in deleted file mode 100644 index 520ad3a14b..0000000000 --- a/lib/addons/library.kodi.peripheral/Makefile.in +++ /dev/null @@ -1,29 +0,0 @@ -ARCH=@ARCH@ -INCLUDES=-I. -I../../../xbmc/addons/include -I../../../xbmc -DEFINES+= -CXXFLAGS=-fPIC -LIBNAME=libKODI_peripheral -OBJS=$(LIBNAME).o - -ifeq ($(findstring osx,$(ARCH)), osx) -LIB_SHARED=../../../addons/library.kodi.peripheral/$(LIBNAME)-$(ARCH).dylib -else -LIB_SHARED=../../../addons/library.kodi.peripheral/$(LIBNAME)-$(ARCH).so -endif - -all: $(LIB_SHARED) - -$(LIB_SHARED): $(OBJS) -ifeq ($(findstring osx,$(ARCH)), osx) - $(CXX) $(CXXFLAGS) $(LDFLAGS) -dynamiclib -o $@ $(OBJS) -else - $(CXX) $(CFLAGS) $(LDFLAGS) -shared -g -o $(LIB_SHARED) $(OBJS) -endif - -CLEAN_FILES = \ - $(LIB_SHARED) \ - -DISTCLEAN_FILES= \ - Makefile \ - -include ../../../Makefile.include diff --git a/lib/addons/library.kodi.peripheral/libKODI_peripheral.cpp b/lib/addons/library.kodi.peripheral/libKODI_peripheral.cpp deleted file mode 100644 index ca83473cc7..0000000000 --- a/lib/addons/library.kodi.peripheral/libKODI_peripheral.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2014-2016 Team Kodi - * http://kodi.tv - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this Program; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "addons/binary/interfaces/AddonInterfaces.h" -#include "addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h" - -#include <stdio.h> - -#ifdef _WIN32 - #include <windows.h> - #define DLLEXPORT __declspec(dllexport) -#else - #define DLLEXPORT -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -DLLEXPORT CB_PeripheralLib* PERIPHERAL_register_me(AddonCB* frontend) -{ - CB_PeripheralLib* cb = NULL; - if (!frontend) - fprintf(stderr, "ERROR: PERIPHERAL_register_frontend is called with NULL handle!!!\n"); - else - { - cb = static_cast<CB_PeripheralLib*>(frontend->PeripheralLib_RegisterMe(frontend->addonData)); - if (!cb) - fprintf(stderr, "ERROR: PERIPHERAL_register_frontend can't get callback table from frontend!!!\n"); - } - return cb; -} - -DLLEXPORT void PERIPHERAL_unregister_me(AddonCB* frontend, CB_PeripheralLib* cb) -{ - if (frontend == NULL || cb == NULL) - return; - return frontend->PeripheralLib_UnRegisterMe(frontend->addonData, cb); -} - -DLLEXPORT void PERIPHERAL_trigger_scan(AddonCB* frontend, CB_PeripheralLib* cb) -{ - if (frontend == NULL || cb == NULL) - return; - return cb->TriggerScan(frontend->addonData); -} - -DLLEXPORT void PERIPHERAL_refresh_button_maps(AddonCB* frontend, CB_PeripheralLib* cb, const char* deviceName, const char* controllerId) -{ - if (frontend == NULL || cb == NULL) - return; - return cb->RefreshButtonMaps(frontend->addonData, deviceName ? deviceName : "", controllerId ? controllerId : ""); -} - -DLLEXPORT unsigned int PERIPHERAL_feature_count(AddonCB* frontend, CB_PeripheralLib* cb, const char* controllerId, JOYSTICK_FEATURE_TYPE type) -{ - if (frontend == NULL || cb == NULL) - return 0; - return cb->FeatureCount(frontend->addonData, controllerId, type); -} - -#ifdef __cplusplus -} -#endif diff --git a/lib/addons/library.kodi.peripheral/project/VS2010Express/libKODI_peripheral.vcxproj b/lib/addons/library.kodi.peripheral/project/VS2010Express/libKODI_peripheral.vcxproj deleted file mode 100644 index a809f7f564..0000000000 --- a/lib/addons/library.kodi.peripheral/project/VS2010Express/libKODI_peripheral.vcxproj +++ /dev/null @@ -1,84 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{FEA71D39-CB68-486B-A978-246E661A3F89}</ProjectGuid> - <RootNamespace>XBMC_VDR</RootNamespace> - <Keyword>Win32Proj</Keyword> - <WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion> - </PropertyGroup> - <Import Project="$(SolutionDir)\XBMC.core-defaults.props" /> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>DynamicLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets"> - <Import Project="$(SolutionDir)\XBMC.defaults.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\..\addons\library.kodi.peripheral\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\..\addons\library.kodi.peripheral\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir> - <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\..\addons\library.xbmc.addon\;$(IncludePath)</IncludePath> - <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\..\addons\library.xbmc.addon\;$(IncludePath)</IncludePath> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>..\..\..\..\..\xbmc;..\..\..\..\..\xbmc\addons\include;..\..\..\..\..\xbmc\cores\dvdplayer\DVDDemuxers;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>VDR_EXPORTS;_WIN32PC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExceptionHandling>Sync</ExceptionHandling> - <PrecompiledHeader> - </PrecompiledHeader> - </ClCompile> - <Link> - <OutputFile>..\..\..\..\..\addons\library.kodi.peripheral\$(ProjectName).dll</OutputFile> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>..\..\..\..\..\xbmc;..\..\..\..\..\xbmc\addons\include;..\..\..\..\..\xbmc\cores\dvdplayer\DVDDemuxers;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>HAS_SDL_OPENGL;HAS_SDL;_USRDLL;XBMC_VDR_EXPORTS;_WIN32PC;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExceptionHandling>Sync</ExceptionHandling> - <PrecompiledHeader> - </PrecompiledHeader> - </ClCompile> - <Link> - <OutputFile>..\..\..\..\..\addons\library.kodi.peripheral\$(ProjectName).dll</OutputFile> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="..\..\libKODI_peripheral.cpp" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project>
\ No newline at end of file diff --git a/lib/addons/library.kodi.peripheral/project/VS2010Express/libKODI_peripheral.vcxproj.filters b/lib/addons/library.kodi.peripheral/project/VS2010Express/libKODI_peripheral.vcxproj.filters deleted file mode 100644 index 1674269e11..0000000000 --- a/lib/addons/library.kodi.peripheral/project/VS2010Express/libKODI_peripheral.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - <Filter Include="Header Files"> - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\libKODI_peripheral.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/project/cmake/installdata/common/addons.txt b/project/cmake/installdata/common/addons.txt index c6db9c131f..d643765854 100644 --- a/project/cmake/installdata/common/addons.txt +++ b/project/cmake/installdata/common/addons.txt @@ -21,7 +21,6 @@ addons/xbmc.webinterface/* addons/library.kodi.audioengine/* addons/library.kodi.game/* addons/library.kodi.guilib/* -addons/library.kodi.peripheral/* addons/library.xbmc.addon/* addons/library.xbmc.codec/* addons/repository.xbmc.org/* diff --git a/project/cmake/scripts/linux/Install.cmake b/project/cmake/scripts/linux/Install.cmake index 0c1612ed5f..c7c1cfc3cb 100644 --- a/project/cmake/scripts/linux/Install.cmake +++ b/project/cmake/scripts/linux/Install.cmake @@ -307,8 +307,7 @@ install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbm COMPONENT kodi-visualization-dev) # Install kodi-peripheral-dev -install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h - ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h +install(FILES ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_utils.hpp DESTINATION ${includedir}/${APP_NAME_LC} diff --git a/project/cmake/treedata/common/addons.txt b/project/cmake/treedata/common/addons.txt index 41167d8d20..e37a50fe6c 100644 --- a/project/cmake/treedata/common/addons.txt +++ b/project/cmake/treedata/common/addons.txt @@ -1,6 +1,5 @@ lib/addons/library.kodi.audioengine KODI_audioengine lib/addons/library.kodi.game KODI_game lib/addons/library.kodi.guilib KODI_guilib -lib/addons/library.kodi.peripheral KODI_peripheral lib/addons/library.xbmc.addon XBMC_addon lib/addons/library.xbmc.codec XBMC_codec diff --git a/xbmc/addons/addon-bindings.mk b/xbmc/addons/addon-bindings.mk index 788b50eb0e..ca6dc628ab 100644 --- a/xbmc/addons/addon-bindings.mk +++ b/xbmc/addons/addon-bindings.mk @@ -18,7 +18,6 @@ BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_dll.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_game_types.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h -BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h BINDINGS+=xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_utils.hpp diff --git a/xbmc/addons/binary/interfaces/AddonInterfaces.h b/xbmc/addons/binary/interfaces/AddonInterfaces.h index c623cc89ad..34687f2c74 100644 --- a/xbmc/addons/binary/interfaces/AddonInterfaces.h +++ b/xbmc/addons/binary/interfaces/AddonInterfaces.h @@ -21,7 +21,6 @@ */ #include "IAddonInterface.h" -#include "addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h" #include "addons/kodi-addon-dev-kit/include/kodi/kodi_game_callbacks.h" #include "addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h" diff --git a/xbmc/addons/binary/interfaces/api1/Peripheral/AddonCallbacksPeripheral.h b/xbmc/addons/binary/interfaces/api1/Peripheral/AddonCallbacksPeripheral.h index 44a9f7dd0e..e76b083bad 100644 --- a/xbmc/addons/binary/interfaces/api1/Peripheral/AddonCallbacksPeripheral.h +++ b/xbmc/addons/binary/interfaces/api1/Peripheral/AddonCallbacksPeripheral.h @@ -20,6 +20,7 @@ #pragma once #include "addons/binary/interfaces/AddonInterfaces.h" +#include "addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h" namespace PERIPHERALS { class CPeripheralAddon; } diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h deleted file mode 100644 index 2dfc571361..0000000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_callbacks.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2014-2016 Team Kodi - * http://kodi.tv - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this Program; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ -#ifndef __PERIPHERAL_CALLBACKS_H__ -#define __PERIPHERAL_CALLBACKS_H__ - -#include "kodi_peripheral_types.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef struct CB_PeripheralLib -{ - /*! - * @brief Trigger a scan for peripherals - * - * The add-on calls this if a change in hardware is detected. - */ - void (*TriggerScan)(void* addonData); - - /*! - * @brief Notify the frontend that button maps have changed - * - * @param[optional] deviceName The name of the device to refresh, or empty/null for all devices - * @param[optional] controllerId The controller ID to refresh, or empty/null for all controllers - */ - void (*RefreshButtonMaps)(void* addonData, const char* deviceName, const char* controllerId); - - /*! - * @brief Return the number of features belonging to the specified controller - * - * @param controllerId The controller ID to enumerate - * @param type[optional] Type to filter by, or JOYSTICK_FEATURE_TYPE_UNKNOWN for all features - * - * @return The number of features matching the request parameters - */ - unsigned int (*FeatureCount)(void* addonData, const char* controllerId, JOYSTICK_FEATURE_TYPE type); - -} CB_PeripheralLib; - -#ifdef __cplusplus -} -#endif - -#endif // __PERIPHERAL_CALLBACKS_H__ diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h index a28e48dc52..b2a1841924 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h @@ -20,7 +20,7 @@ #pragma once #include "libXBMC_addon.h" -#include "kodi_peripheral_callbacks.h" +#include "kodi_peripheral_types.h" #include <string> #include <stdio.h> @@ -29,15 +29,26 @@ #include <sys/stat.h> #endif -#ifdef _WIN32 - #define PERIPHERAL_HELPER_DLL "\\library.kodi.peripheral\\libKODI_peripheral" ADDON_HELPER_EXT -#else - #define PERIPHERAL_HELPER_DLL_NAME "libKODI_peripheral-" ADDON_HELPER_ARCH ADDON_HELPER_EXT - #define PERIPHERAL_HELPER_DLL "/library.kodi.peripheral/" PERIPHERAL_HELPER_DLL_NAME -#endif +extern "C" +{ +namespace KodiAPI +{ +namespace V1 +{ +namespace Peripheral +{ + +typedef struct CB_PeripheralLib +{ + void (*TriggerScan)(void* addonData); + void (*RefreshButtonMaps)(void* addonData, const char* deviceName, const char* controllerId); + unsigned int (*FeatureCount)(void* addonData, const char* controllerId, JOYSTICK_FEATURE_TYPE type); +} CB_PeripheralLib; -#define PERIPHERAL_REGISTER_SYMBOL(dll, functionPtr) \ - CHelper_libKODI_peripheral::RegisterSymbol(dll, functionPtr, #functionPtr) +} /* namespace Peripheral */ +} /* namespace V1 */ +} /* namespace KodiAPI */ +} /* extern "C" */ namespace ADDON { @@ -47,31 +58,18 @@ class CHelper_libKODI_peripheral public: CHelper_libKODI_peripheral(void) { - m_handle = NULL; - m_callbacks = NULL; - m_libKODI_peripheral = NULL; + m_Handle = nullptr; + m_Callbacks = nullptr; } ~CHelper_libKODI_peripheral(void) { - if (m_libKODI_peripheral) + if (m_Handle && m_Callbacks) { - PERIPHERAL_unregister_me(m_handle, m_callbacks); - dlclose(m_libKODI_peripheral); + m_Handle->PeripheralLib_UnRegisterMe(m_Handle->addonData, m_Callbacks); } } - template <typename T> - static bool RegisterSymbol(void* dll, T& functionPtr, const char* strFunctionPtr) - { - if ((functionPtr = (T)dlsym(dll, strFunctionPtr)) == NULL) - { - fprintf(stderr, "ERROR: Unable to assign function %s: %s\n", strFunctionPtr, dlerror()); - return false; - } - return true; - } - /*! * @brief Resolve all callback methods * @param handle Pointer to the add-on @@ -79,69 +77,52 @@ public: */ bool RegisterMe(void* handle) { - m_handle = handle; - - std::string libBasePath; - libBasePath = ((cb_array*)m_handle)->libPath; - libBasePath += PERIPHERAL_HELPER_DLL; + m_Handle = static_cast<AddonCB*>(handle); + if (m_Handle) + m_Callbacks = (KodiAPI::V1::Peripheral::CB_PeripheralLib*)m_Handle->PeripheralLib_RegisterMe(m_Handle->addonData); + if (!m_Callbacks) + fprintf(stderr, "libXBMC_peripheral-ERROR: PeripheralLib_register_me can't get callback table from Kodi !!!\n"); -#if defined(ANDROID) - struct stat st; - if (stat(libBasePath.c_str(),&st) != 0) - { - std::string tempbin = getenv("XBMC_ANDROID_LIBS"); - libBasePath = tempbin + "/" + PERIPHERAL_HELPER_DLL_NAME; - } -#endif - - m_libKODI_peripheral = dlopen(libBasePath.c_str(), RTLD_LAZY); - if (m_libKODI_peripheral == NULL) - { - fprintf(stderr, "Unable to load %s\n", dlerror()); - return false; - } - - if (!PERIPHERAL_REGISTER_SYMBOL(m_libKODI_peripheral, PERIPHERAL_register_me)) return false; - if (!PERIPHERAL_REGISTER_SYMBOL(m_libKODI_peripheral, PERIPHERAL_unregister_me)) return false; - if (!PERIPHERAL_REGISTER_SYMBOL(m_libKODI_peripheral, PERIPHERAL_trigger_scan)) return false; - if (!PERIPHERAL_REGISTER_SYMBOL(m_libKODI_peripheral, PERIPHERAL_refresh_button_maps)) return false; - if (!PERIPHERAL_REGISTER_SYMBOL(m_libKODI_peripheral, PERIPHERAL_feature_count)) return false; - - m_callbacks = PERIPHERAL_register_me(m_handle); - return m_callbacks != NULL; + return m_Callbacks != nullptr; } + /*! + * @brief Trigger a scan for peripherals + * + * The add-on calls this if a change in hardware is detected. + */ void TriggerScan(void) { - return PERIPHERAL_trigger_scan(m_handle, m_callbacks); + return m_Callbacks->TriggerScan(m_Handle->addonData); } + /*! + * @brief Notify the frontend that button maps have changed + * + * @param[optional] deviceName The name of the device to refresh, or empty/null for all devices + * @param[optional] controllerId The controller ID to refresh, or empty/null for all controllers + */ void RefreshButtonMaps(const std::string& strDeviceName = "", const std::string& strControllerId = "") { - return PERIPHERAL_refresh_button_maps(m_handle, m_callbacks, strDeviceName.c_str(), strControllerId.c_str()); + return m_Callbacks->RefreshButtonMaps(m_Handle->addonData, strDeviceName.c_str(), strControllerId.c_str()); } + /*! + * @brief Return the number of features belonging to the specified controller + * + * @param controllerId The controller ID to enumerate + * @param type[optional] Type to filter by, or JOYSTICK_FEATURE_TYPE_UNKNOWN for all features + * + * @return The number of features matching the request parameters + */ unsigned int FeatureCount(const std::string& strControllerId, JOYSTICK_FEATURE_TYPE type = JOYSTICK_FEATURE_TYPE_UNKNOWN) { - return PERIPHERAL_feature_count(m_handle, m_callbacks, strControllerId.c_str(), type); + return m_Callbacks->FeatureCount(m_Handle->addonData, strControllerId.c_str(), type); } -protected: - CB_PeripheralLib* (*PERIPHERAL_register_me)(void* handle); - void (*PERIPHERAL_unregister_me)(void* handle, CB_PeripheralLib* cb); - void (*PERIPHERAL_trigger_scan)(void* handle, CB_PeripheralLib* cb); - void (*PERIPHERAL_refresh_button_maps)(void* handle, CB_PeripheralLib* cb, const char* deviceName, const char* controllerId); - unsigned int (*PERIPHERAL_feature_count)(void* handle, CB_PeripheralLib* cb, const char* controllerId, JOYSTICK_FEATURE_TYPE type); - private: - void* m_handle; - CB_PeripheralLib* m_callbacks; - void* m_libKODI_peripheral; - - struct cb_array - { - const char* libPath; - }; + AddonCB* m_Handle; + KodiAPI::V1::Peripheral::CB_PeripheralLib* m_Callbacks; }; -} +} /* namespace ADDON */ |