summaryrefslogtreecommitdiffstats
path: root/signal-composer-binding
diff options
context:
space:
mode:
Diffstat (limited to 'signal-composer-binding')
-rw-r--r--signal-composer-binding/CMakeLists.txt6
-rw-r--r--signal-composer-binding/clientApp.cpp4
-rw-r--r--signal-composer-binding/clientApp.hpp6
-rw-r--r--signal-composer-binding/signal-composer-binding.cpp22
-rw-r--r--signal-composer-binding/signal-composer.cpp16
-rw-r--r--signal-composer-binding/signal-composer.hpp16
-rw-r--r--signal-composer-binding/source.cpp6
-rw-r--r--signal-composer-binding/source.hpp6
8 files changed, 38 insertions, 44 deletions
diff --git a/signal-composer-binding/CMakeLists.txt b/signal-composer-binding/CMakeLists.txt
index 2f99203..bbb6330 100644
--- a/signal-composer-binding/CMakeLists.txt
+++ b/signal-composer-binding/CMakeLists.txt
@@ -34,9 +34,3 @@ PROJECT_TARGET_ADD(signal-composer)
TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
-
- # Library dependencies (include updates automatically)
- TARGET_LINK_LIBRARIES(${TARGET_NAME}
- ctl-utilities
- ${link_libraries}
- )
diff --git a/signal-composer-binding/clientApp.cpp b/signal-composer-binding/clientApp.cpp
index 7ead993..f41086c 100644
--- a/signal-composer-binding/clientApp.cpp
+++ b/signal-composer-binding/clientApp.cpp
@@ -79,14 +79,14 @@ void clientAppCtx::subtractSignals(std::vector<std::shared_ptr<Signal>>& sigV)
}
}
-int clientAppCtx::makeSubscription(AFB_ReqT request)
+int clientAppCtx::makeSubscription(afb_req_t request)
{
event_ = afb_event_is_valid(event_) ?
event_ : afb_daemon_make_event(uuid_.c_str());
return afb_req_subscribe(request, event_);
}
-int clientAppCtx::makeUnsubscription(AFB_ReqT request)
+int clientAppCtx::makeUnsubscription(afb_req_t request)
{
if(subscribedSignals_.empty())
{
diff --git a/signal-composer-binding/clientApp.hpp b/signal-composer-binding/clientApp.hpp
index 84746fa..a9c9636 100644
--- a/signal-composer-binding/clientApp.hpp
+++ b/signal-composer-binding/clientApp.hpp
@@ -23,13 +23,13 @@ class clientAppCtx: public Observer<Signal>
private:
std::string uuid_;
std::vector<std::shared_ptr<Signal>> subscribedSignals_;
- AFB_EventT event_;
+ afb_event_t event_;
public:
explicit clientAppCtx(const char* uuid);
void update(Signal* sig);
void appendSignals(std::vector<std::shared_ptr<Signal>>& sigV);
void subtractSignals(std::vector<std::shared_ptr<Signal>>& sigV);
- int makeSubscription(AFB_ReqT request);
- int makeUnsubscription(AFB_ReqT request);
+ int makeSubscription(afb_req_t request);
+ int makeUnsubscription(afb_req_t request);
};
diff --git a/signal-composer-binding/signal-composer-binding.cpp b/signal-composer-binding/signal-composer-binding.cpp
index 15b9c93..fb97c71 100644
--- a/signal-composer-binding/signal-composer-binding.cpp
+++ b/signal-composer-binding/signal-composer-binding.cpp
@@ -25,7 +25,7 @@
#include "signal-composer-apidef.h"
#include "clientApp.hpp"
-static int one_subscribe_unsubscribe(AFB_ReqT request,
+static int one_subscribe_unsubscribe(afb_req_t request,
bool subscribe,
const std::string& event,
json_object* args,
@@ -55,7 +55,7 @@ static int one_subscribe_unsubscribe(AFB_ReqT request,
return err;
}
-static int subscribe_unsubscribe(AFB_ReqT request,
+static int subscribe_unsubscribe(afb_req_t request,
bool subscribe,
json_object* args,
clientAppCtx* cContext)
@@ -84,7 +84,7 @@ static int subscribe_unsubscribe(AFB_ReqT request,
}
/// @brief entry point for client subscription request.
-static void do_subscribe_unsubscribe(AFB_ReqT request, bool subscribe, clientAppCtx* cContext)
+static void do_subscribe_unsubscribe(afb_req_t request, bool subscribe, clientAppCtx* cContext)
{
int rc = 0;
json_object *oneArg = nullptr, *args = afb_req_json(request);
@@ -108,7 +108,7 @@ static void do_subscribe_unsubscribe(AFB_ReqT request, bool subscribe, clientApp
}
/// @brief entry point for client un-subscription request.
-void subscribe(AFB_ReqT request)
+void subscribe(afb_req_t request)
{
clientAppCtx *cContext = reinterpret_cast<clientAppCtx*>(afb_req_context(request, 0, Composer::createContext, Composer::destroyContext, nullptr));
@@ -116,7 +116,7 @@ void subscribe(AFB_ReqT request)
}
/// @brief entry point for client un-subscription request.
-void unsubscribe(AFB_ReqT request)
+void unsubscribe(afb_req_t request)
{
clientAppCtx *cContext = reinterpret_cast<clientAppCtx*>(afb_req_context(request, 0, Composer::createContext, Composer::destroyContext, nullptr));
@@ -125,7 +125,7 @@ void unsubscribe(AFB_ReqT request)
/// @brief verb that loads JSON configuration (old SigComp.json file now)
-void addObjects(AFB_ReqT request)
+void addObjects(afb_req_t request)
{
Composer& composer = Composer::instance();
json_object *sourcesJ = nullptr,
@@ -195,7 +195,7 @@ void addObjects(AFB_ReqT request)
}
/// @brief entry point to list available signals
-void list(AFB_ReqT request)
+void list(afb_req_t request)
{
struct json_object *allSignalsJ = json_object_new_array();
@@ -210,7 +210,7 @@ void list(AFB_ReqT request)
}
/// @brief entry point for get requests.
-void get(AFB_ReqT request)
+void get(afb_req_t request)
{
int err = 0, i = 0;
size_t l = 0;
@@ -246,10 +246,10 @@ void get(AFB_ReqT request)
}
-int loadConf(AFB_ApiT api)
+int loadConf(afb_api_t api)
{
int err = 0;
- std::string bindingDirPath = GetBindingDirPath();
+ std::string bindingDirPath = GetBindingDirPath(api);
std::string rootdir = bindingDirPath + "/etc";
err = Composer::instance().loadConfig(api, rootdir);
@@ -257,7 +257,7 @@ int loadConf(AFB_ApiT api)
return err;
}
-int execConf(AFB_ApiT api)
+int execConf(afb_api_t api)
{
Composer& composer = Composer::instance();
int err = 0;
diff --git a/signal-composer-binding/signal-composer.cpp b/signal-composer-binding/signal-composer.cpp
index 324d96e..9abe54e 100644
--- a/signal-composer-binding/signal-composer.cpp
+++ b/signal-composer-binding/signal-composer.cpp
@@ -84,7 +84,7 @@ Composer::~Composer()
free(ctlConfig_);
}
-CtlActionT* Composer::convert2Action(AFB_ApiT apihandle, const std::string& name, json_object* actionJ)
+CtlActionT* Composer::convert2Action(afb_api_t apihandle, const std::string& name, json_object* actionJ)
{
CtlActionT *ctlAction = new CtlActionT;
@@ -96,7 +96,7 @@ CtlActionT* Composer::convert2Action(AFB_ApiT apihandle, const std::string& name
return nullptr;
}
-int Composer::loadOneSourceAPI(AFB_ApiT apihandle, json_object* sourceJ)
+int Composer::loadOneSourceAPI(afb_api_t apihandle, json_object* sourceJ)
{
json_object *initJ = nullptr,
*getSignalsJ = nullptr,
@@ -158,7 +158,7 @@ int Composer::loadOneSourceAPI(AFB_ApiT apihandle, json_object* sourceJ)
return err;
}
-int Composer::loadSourcesAPI(AFB_ApiT apihandle, CtlSectionT* section, json_object *sourcesJ)
+int Composer::loadSourcesAPI(afb_api_t apihandle, CtlSectionT* section, json_object *sourcesJ)
{
int err = 0;
Composer& composer = instance();
@@ -209,7 +209,7 @@ int Composer::loadSourcesAPI(AFB_ApiT apihandle, CtlSectionT* section, json_obje
return err;
}
-int Composer::loadOneSignal(AFB_ApiT apihandle, json_object* signalJ)
+int Composer::loadOneSignal(afb_api_t apihandle, json_object* signalJ)
{
json_object *onReceivedJ = nullptr,
*dependsJ = nullptr,
@@ -334,7 +334,7 @@ int Composer::loadOneSignal(AFB_ApiT apihandle, json_object* signalJ)
return err;
}
-int Composer::loadSignals(AFB_ApiT apihandle, CtlSectionT* section, json_object *signalsJ)
+int Composer::loadSignals(afb_api_t apihandle, CtlSectionT* section, json_object *signalsJ)
{
int err = 0;
Composer& composer = instance();
@@ -421,7 +421,7 @@ void Composer::destroyContext(void* ctx)
delete(reinterpret_cast<clientAppCtx*>(ctx));
}
-int Composer::loadConfig(AFB_ApiT api, std::string& filepath)
+int Composer::loadConfig(afb_api_t api, std::string& filepath)
{
const char *dirList= getenv("CONTROL_CONFIG_PATH");
if (!dirList) dirList=CONTROL_CONFIG_PATH;
@@ -482,7 +482,7 @@ void Composer::initSourcesAPI()
}
}
-int Composer::initSignals(AFB_ReqT request)
+int Composer::initSignals(afb_req_t request)
{
for(int i=0; i < sourcesListV_.size(); i++)
{
@@ -581,7 +581,7 @@ json_object* Composer::getsignalValue(const std::string& sig, json_object* optio
return finalResponse;
}
-int Composer::execSignalsSubscription(AFB_ReqT request)
+int Composer::execSignalsSubscription(afb_req_t request)
{
int err = 0;;
for(std::shared_ptr<SourceAPI> srcAPI: sourcesListV_)
diff --git a/signal-composer-binding/signal-composer.hpp b/signal-composer-binding/signal-composer.hpp
index f70e9ac..bef75ff 100644
--- a/signal-composer-binding/signal-composer.hpp
+++ b/signal-composer-binding/signal-composer.hpp
@@ -34,25 +34,25 @@ private:
Composer();
~Composer();
- CtlActionT* convert2Action(AFB_ApiT apihandle, const std::string& name, json_object* action);
+ CtlActionT* convert2Action(afb_api_t apihandle, const std::string& name, json_object* action);
- int loadOneSourceAPI(AFB_ApiT apihandle, json_object* sourcesJ);
- static int loadSourcesAPI(AFB_ApiT apihandle, CtlSectionT* section, json_object *signalsJ);
+ int loadOneSourceAPI(afb_api_t apihandle, json_object* sourcesJ);
+ static int loadSourcesAPI(afb_api_t apihandle, CtlSectionT* section, json_object *signalsJ);
- int loadOneSignal(AFB_ApiT apihandle, json_object* signalsJ);
- static int loadSignals(AFB_ApiT apihandle, CtlSectionT* section, json_object *signalsJ);
+ int loadOneSignal(afb_api_t apihandle, json_object* signalsJ);
+ static int loadSignals(afb_api_t apihandle, CtlSectionT* section, json_object *signalsJ);
- int execSignalsSubscription(AFB_ReqT request = nullptr);
+ int execSignalsSubscription(afb_req_t request = nullptr);
std::shared_ptr<SourceAPI> getSourceAPI(const std::string& api);
void processOptions(const std::map<std::string, int>& opts, std::shared_ptr<Signal> sig, json_object* response) const;
public:
static Composer& instance();
static void* createContext(void* ctx);
static void destroyContext(void* ctx);
- int loadConfig(AFB_ApiT api, std::string& filepath);
+ int loadConfig(afb_api_t api, std::string& filepath);
int loadSources(json_object* sourcesJ);
int loadSignals(json_object* signalsJ);
- int initSignals(AFB_ReqT request = nullptr);
+ int initSignals(afb_req_t request = nullptr);
void initSourcesAPI();
CtlConfigT* ctlConfig();
diff --git a/signal-composer-binding/source.cpp b/signal-composer-binding/source.cpp
index 17bcbb4..4b21443 100644
--- a/signal-composer-binding/source.cpp
+++ b/signal-composer-binding/source.cpp
@@ -75,7 +75,7 @@ std::string SourceAPI::api() const
/// @param[in] object - eventual data that comes with the event
/// @param[in] object - the api that subscribed the event
///
-void SourceAPI::onSourceEvents(void *closure, const char *event_name, json_object *event_obj, AFB_ApiT api)
+void SourceAPI::onSourceEvents(void *closure, const char *event_name, json_object *event_obj, afb_api_t api)
{
std::vector<std::shared_ptr<Signal>> signals { Composer::instance().searchSignals(event_name) };
@@ -132,7 +132,7 @@ void SourceAPI::onSourceEvents(void *closure, const char *event_name, json_objec
/// @param[in] object - eventual data that comes with the event
/// @param[in] object - the api that subscribed the event
///
-void SourceAPI::onSignalEvents(void *closure, const char *event_name, json_object *event_obj, AFB_ApiT api)
+void SourceAPI::onSignalEvents(void *closure, const char *event_name, json_object *event_obj, afb_api_t api)
{
Signal *sig = (Signal*) closure;
sig->onReceivedCB(event_obj);
@@ -237,7 +237,7 @@ int SourceAPI::cleanNotSubscribedSignals() {
return erased;
}
-int SourceAPI::makeSubscription(AFB_ReqT request)
+int SourceAPI::makeSubscription(afb_req_t request)
{
int err = 0;
if(getSignals_)
diff --git a/signal-composer-binding/source.hpp b/signal-composer-binding/source.hpp
index bc28b54..a14e925 100644
--- a/signal-composer-binding/source.hpp
+++ b/signal-composer-binding/source.hpp
@@ -47,8 +47,8 @@ public:
void init();
std::string api() const;
- static void onSourceEvents(void *closure, const char *event_name, json_object *event_obj, AFB_ApiT api);
- static void onSignalEvents(void *closure, const char *event_name, json_object *event_obj, AFB_ApiT api);
+ static void onSourceEvents(void *closure, const char *event_name, json_object *event_obj, afb_api_t api);
+ static void onSignalEvents(void *closure, const char *event_name, json_object *event_obj, afb_api_t api);
const struct signalsDefault& signalsDefault() const;
void addSignal(const std::string& id, const std::string& event, std::vector<std::string>& sources, int retention, const std::string& unit, json_object *metadata, double frequency, CtlActionT* onReceived, json_object* getSignalsArgs);
@@ -57,5 +57,5 @@ public:
std::vector<std::shared_ptr<Signal>> searchSignals(const std::string& name);
int cleanNotSubscribedSignals();
- int makeSubscription(AFB_ReqT request = nullptr);
+ int makeSubscription(afb_req_t request = nullptr);
};