diff options
author | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2019-10-15 17:45:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@automotivelinux.org> | 2019-10-15 17:45:29 +0000 |
commit | 266c9b1cefb3e33c825e6a994b8bb481654d86d1 (patch) | |
tree | afead1d5151d6ba5031740ac24ae129632744ecb /src/plugins | |
parent | c1de719af7bdae425f2e42dd3e0642550a8cd6b6 (diff) | |
parent | 62f552fe640df18320dd3afb1f141e8a1aedf2f4 (diff) |
Merge "Switch to appcontroller library" into halibuthalibut_8.0.3halibut/8.0.38.0.3
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/plugins/VshlCapabilitiesApi.cpp | 16 | ||||
-rw-r--r-- | src/plugins/afb/AFBApiImpl.cpp | 8 | ||||
-rw-r--r-- | src/plugins/afb/AFBApiImpl.h | 6 | ||||
-rw-r--r-- | src/plugins/afb/AFBRequestImpl.cpp | 6 | ||||
-rw-r--r-- | src/plugins/afb/AFBRequestImpl.h | 6 | ||||
-rw-r--r-- | src/plugins/afb/include/AFBEventImpl.h | 6 | ||||
-rw-r--r-- | src/plugins/afb/src/AFBEventImpl.cpp | 8 | ||||
-rw-r--r-- | src/plugins/utilities/logging/Logger.cpp | 14 | ||||
-rw-r--r-- | src/plugins/utilities/logging/Logger.h | 8 |
10 files changed, 39 insertions, 41 deletions
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 20c13e9..dd1cd8e 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -86,7 +86,6 @@ PROJECT_TARGET_ADD(vshl-capabilities-api) TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME} PUBLIC ${GLIB_PKG_INCLUDE_DIRS} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" - PRIVATE "${CMAKE_SOURCE_DIR}/app-controller/ctl-lib" ) # Library dependencies (include updates automatically) @@ -136,7 +135,6 @@ PROJECT_TARGET_ADD(vshl-capabilities-api) TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME}_Test PUBLIC ${GLIB_PKG_INCLUDE_DIRS} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" - PRIVATE "${CMAKE_SOURCE_DIR}/app-controller/ctl-lib" ) TARGET_LINK_LIBRARIES(${TARGET_NAME}_Test diff --git a/src/plugins/VshlCapabilitiesApi.cpp b/src/plugins/VshlCapabilitiesApi.cpp index 066edd5..78c686f 100644 --- a/src/plugins/VshlCapabilitiesApi.cpp +++ b/src/plugins/VshlCapabilitiesApi.cpp @@ -117,7 +117,7 @@ CTLP_CAPI(guiMetadataSubscribe, source, argsJ, eventJ) { } } - AFB_ReqSuccess( + afb_req_success( source->request, json_object_new_string("Subscription to guimetadata events successfully completed."), NULL); return 0; } @@ -165,7 +165,7 @@ CTLP_CAPI(guiMetadataPublish, source, argsJ, eventJ) { return -1; } - AFB_ReqSuccess(source->request, json_object_new_string("Successfully published guimetadata messages."), NULL); + afb_req_success(source->request, json_object_new_string("Successfully published guimetadata messages."), NULL); return 0; } @@ -201,7 +201,7 @@ CTLP_CAPI(phonecontrolSubscribe, source, argsJ, eventJ) { } } - AFB_ReqSuccess( + afb_req_success( source->request, json_object_new_string("Subscription to phone control events successfully completed."), NULL); return 0; } @@ -245,7 +245,7 @@ CTLP_CAPI(phonecontrolPublish, source, argsJ, eventJ) { return -1; } - AFB_ReqSuccess(source->request, json_object_new_string("Successfully published phone control messages."), NULL); + afb_req_success(source->request, json_object_new_string("Successfully published phone control messages."), NULL); return 0; } @@ -281,7 +281,7 @@ CTLP_CAPI(navigationSubscribe, source, argsJ, eventJ) { } } - AFB_ReqSuccess( + afb_req_success( source->request, json_object_new_string("Subscription to navigation events successfully completed."), NULL); return 0; } @@ -325,7 +325,7 @@ CTLP_CAPI(navigationPublish, source, argsJ, eventJ) { return -1; } - AFB_ReqSuccess(source->request, json_object_new_string("Successfully published navigation messages."), NULL); + afb_req_success(source->request, json_object_new_string("Successfully published navigation messages."), NULL); return 0; } @@ -361,7 +361,7 @@ CTLP_CAPI(playbackControllerSubscribe, source, argsJ, eventJ) { } } - AFB_ReqSuccess( + afb_req_success( source->request, json_object_new_string("Subscription to playbackcontroller events successfully completed."), NULL); return 0; } @@ -405,6 +405,6 @@ CTLP_CAPI(playbackControllerPublish, source, argsJ, eventJ) { return -1; } - AFB_ReqSuccess(source->request, json_object_new_string("Successfully published playbackcontroller messages."), NULL); + afb_req_success(source->request, json_object_new_string("Successfully published playbackcontroller messages."), NULL); return 0; } diff --git a/src/plugins/afb/AFBApiImpl.cpp b/src/plugins/afb/AFBApiImpl.cpp index 443a412..aab2ce6 100644 --- a/src/plugins/afb/AFBApiImpl.cpp +++ b/src/plugins/afb/AFBApiImpl.cpp @@ -21,7 +21,7 @@ extern "C" { #define AFB_BINDING_VERSION 3 -#include "afb-definitions.h" +#include <afb/afb-binding.h> } static std::string TAG = "vshlcapabilities::afb::AFBApiImpl"; @@ -36,11 +36,11 @@ using namespace vshlcapabilities::utilities::logging; namespace vshlcapabilities { namespace afb { -std::unique_ptr<AFBApiImpl> AFBApiImpl::create(AFB_ApiT api) { +std::unique_ptr<AFBApiImpl> AFBApiImpl::create(afb_api_t api) { return std::unique_ptr<AFBApiImpl>(new AFBApiImpl(api)); } -AFBApiImpl::AFBApiImpl(AFB_ApiT api) : mApi(api), mLogger(Logger::create(api)) { +AFBApiImpl::AFBApiImpl(afb_api_t api) : mApi(api), mLogger(Logger::create(api)) { } AFBApiImpl::~AFBApiImpl() { @@ -59,7 +59,7 @@ int AFBApiImpl::callSync( std::string& info) { char* errorStr = NULL; char* infoStr = NULL; - int rc = AFB_ApiSync(mApi, api.c_str(), verb.c_str(), request, result, &errorStr, &infoStr); + int rc = afb_api_call_sync(mApi, api.c_str(), verb.c_str(), request, result, &errorStr, &infoStr); if (errorStr) { error = errorStr; diff --git a/src/plugins/afb/AFBApiImpl.h b/src/plugins/afb/AFBApiImpl.h index a8d8e08..70da627 100644 --- a/src/plugins/afb/AFBApiImpl.h +++ b/src/plugins/afb/AFBApiImpl.h @@ -31,7 +31,7 @@ namespace afb { class AFBApiImpl : public vshlcapabilities::common::interfaces::IAFBApi { public: - static std::unique_ptr<AFBApiImpl> create(AFB_ApiT api); + static std::unique_ptr<AFBApiImpl> create(afb_api_t api); ~AFBApiImpl(); @@ -46,10 +46,10 @@ public: std::string& info) override; private: - AFBApiImpl(AFB_ApiT api); + AFBApiImpl(afb_api_t api); // AFB API Binding - AFB_ApiT mApi; + afb_api_t mApi; // Logger std::shared_ptr<vshlcapabilities::common::interfaces::ILogger> mLogger; diff --git a/src/plugins/afb/AFBRequestImpl.cpp b/src/plugins/afb/AFBRequestImpl.cpp index 3e20172..db897d3 100644 --- a/src/plugins/afb/AFBRequestImpl.cpp +++ b/src/plugins/afb/AFBRequestImpl.cpp @@ -16,17 +16,17 @@ #include "afb/AFBRequestImpl.h" extern "C" { -#include "afb-definitions.h" +#include <afb/afb-binding.h> } namespace vshlcapabilities { namespace afb { -std::unique_ptr<AFBRequestImpl> AFBRequestImpl::create(AFB_ReqT afbRequest) { +std::unique_ptr<AFBRequestImpl> AFBRequestImpl::create(afb_req_t afbRequest) { return std::unique_ptr<AFBRequestImpl>(new AFBRequestImpl(afbRequest)); } -AFBRequestImpl::AFBRequestImpl(AFB_ReqT afbRequest) : mAfbRequest(afbRequest) { +AFBRequestImpl::AFBRequestImpl(afb_req_t afbRequest) : mAfbRequest(afbRequest) { } void* AFBRequestImpl::getNativeRequest() { diff --git a/src/plugins/afb/AFBRequestImpl.h b/src/plugins/afb/AFBRequestImpl.h index c155f31..ac8f31f 100644 --- a/src/plugins/afb/AFBRequestImpl.h +++ b/src/plugins/afb/AFBRequestImpl.h @@ -31,16 +31,16 @@ namespace afb { */ class AFBRequestImpl : public vshlcapabilities::common::interfaces::IAFBRequest { public: - static std::unique_ptr<AFBRequestImpl> create(AFB_ReqT afbRequest); + static std::unique_ptr<AFBRequestImpl> create(afb_req_t afbRequest); // {@c IAFBRequest Implementation void *getNativeRequest() override; // @c IAFBRequest Implementation } private: - AFBRequestImpl(AFB_ReqT afbRequest); + AFBRequestImpl(afb_req_t afbRequest); - AFB_ReqT mAfbRequest; + afb_req_t mAfbRequest; }; } // namespace afb diff --git a/src/plugins/afb/include/AFBEventImpl.h b/src/plugins/afb/include/AFBEventImpl.h index 2dda513..2d06dc9 100644 --- a/src/plugins/afb/include/AFBEventImpl.h +++ b/src/plugins/afb/include/AFBEventImpl.h @@ -36,7 +36,7 @@ namespace afb { class AFBEventImpl : public vshlcapabilities::common::interfaces::IAFBApi::IAFBEvent { public: static unique_ptr<AFBEventImpl> - create(shared_ptr<vshlcapabilities::common::interfaces::ILogger> logger, AFB_ApiT api, + create(shared_ptr<vshlcapabilities::common::interfaces::ILogger> logger, afb_api_t api, const string &eventName); // Destructor @@ -52,14 +52,14 @@ public: private: AFBEventImpl(shared_ptr<vshlcapabilities::common::interfaces::ILogger> logger, - AFB_ApiT api, const string &eventName); + afb_api_t api, const string &eventName); // Make the event. This is a lazy make that happens // usually during the subscribe stage. void makeEventIfNeccessary(); // Binding API reference - AFB_ApiT mAfbApi; + afb_api_t mAfbApi; // AFB Event afb_event_t mAfbEvent; diff --git a/src/plugins/afb/src/AFBEventImpl.cpp b/src/plugins/afb/src/AFBEventImpl.cpp index 7ddac36..86cbd4c 100644 --- a/src/plugins/afb/src/AFBEventImpl.cpp +++ b/src/plugins/afb/src/AFBEventImpl.cpp @@ -24,14 +24,14 @@ namespace afb { unique_ptr<AFBEventImpl> AFBEventImpl::create( shared_ptr<vshlcapabilities::common::interfaces::ILogger> logger, - AFB_ApiT api, + afb_api_t api, const string& eventName) { return unique_ptr<AFBEventImpl>(new AFBEventImpl(logger, api, eventName)); } AFBEventImpl::AFBEventImpl( shared_ptr<vshlcapabilities::common::interfaces::ILogger> logger, - AFB_ApiT api, + afb_api_t api, const string& eventName) : mLogger(logger), mAfbApi(api), @@ -53,7 +53,7 @@ bool AFBEventImpl::isValid() { bool AFBEventImpl::subscribe(IAFBRequest& requestInterface) { makeEventIfNeccessary(); - auto request = static_cast<AFB_ReqT>(requestInterface.getNativeRequest()); + auto request = static_cast<afb_req_t>(requestInterface.getNativeRequest()); if (isValid() && afb_req_subscribe(request, mAfbEvent) == 0) { return true; } @@ -63,7 +63,7 @@ bool AFBEventImpl::subscribe(IAFBRequest& requestInterface) { bool AFBEventImpl::unsubscribe(IAFBRequest& requestInterface) { makeEventIfNeccessary(); - auto request = static_cast<AFB_ReqT>(requestInterface.getNativeRequest()); + auto request = static_cast<afb_req_t>(requestInterface.getNativeRequest()); if (isValid() && afb_req_unsubscribe(request, mAfbEvent) == 0) { return true; } diff --git a/src/plugins/utilities/logging/Logger.cpp b/src/plugins/utilities/logging/Logger.cpp index c121556..71c83b6 100644 --- a/src/plugins/utilities/logging/Logger.cpp +++ b/src/plugins/utilities/logging/Logger.cpp @@ -19,11 +19,11 @@ namespace utilities { namespace logging { // Constructor -Logger::Logger(AFB_ApiT api) { +Logger::Logger(afb_api_t api) { mApi = api; } -unique_ptr<Logger> Logger::create(AFB_ApiT api) { +unique_ptr<Logger> Logger::create(afb_api_t api) { auto logger = std::unique_ptr<Logger>(new Logger(api)); return logger; } @@ -32,19 +32,19 @@ void Logger::log(Level level, const std::string& tag, const std::string& message string format_msg = "Tag: " + tag + ", message: " + message; switch (level) { case Level::NOTICE: - AFB_ApiNotice(mApi, format_msg.c_str()); + AFB_API_NOTICE(mApi, format_msg.c_str()); break; case Level::WARNING: - AFB_ApiWarning(mApi, format_msg.c_str()); + AFB_API_WARNING(mApi, format_msg.c_str()); break; case Level::DEBUG: - AFB_ApiDebug(mApi, format_msg.c_str()); + AFB_API_DEBUG(mApi, format_msg.c_str()); break; case Level::ERROR: - AFB_ApiError(mApi, format_msg.c_str()); + AFB_API_ERROR(mApi, format_msg.c_str()); break; case Level::INFO: - AFB_ApiInfo(mApi, format_msg.c_str()); + AFB_API_INFO(mApi, format_msg.c_str()); break; default: break; diff --git a/src/plugins/utilities/logging/Logger.h b/src/plugins/utilities/logging/Logger.h index 56f810d..02acc3e 100644 --- a/src/plugins/utilities/logging/Logger.h +++ b/src/plugins/utilities/logging/Logger.h @@ -19,7 +19,7 @@ extern "C" { #define AFB_BINDING_VERSION 3 -#include "afb-definitions.h" +#include <afb/afb-binding.h> #include "ctl-plugin.h" }; @@ -33,17 +33,17 @@ namespace logging { class Logger : public vshlcapabilities::common::interfaces::ILogger { public: - static std::unique_ptr<Logger> create(AFB_ApiT api); + static std::unique_ptr<Logger> create(afb_api_t api); // ILogger interface void log(Level level, const std::string &tag, const std::string &message) override; private: - Logger(AFB_ApiT api); + Logger(afb_api_t api); // Binding API reference - AFB_ApiT mApi; + afb_api_t mApi; }; } // namespace logging |