summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-10-15 17:45:19 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2019-10-15 17:45:19 +0000
commit66b1e2269eba8d48b1d463054af95b290912f2b6 (patch)
tree67f71f11097c103451533f4f63b5eff682f47e7b /src
parent3c7fdce635ea4fcb37fbee33765c1f2a9a32f6b3 (diff)
parent54be328d031b3d8be799a2563d944e06c41c66ec (diff)
Merge "Switch to appcontroller library" into halibut
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/plugins/CMakeLists.txt2
-rw-r--r--src/plugins/VshlCoreApi.cpp10
-rw-r--r--src/plugins/afb/AFBApiImpl.cpp9
-rw-r--r--src/plugins/afb/AFBApiImpl.h7
-rw-r--r--src/plugins/afb/AFBRequestImpl.cpp7
-rw-r--r--src/plugins/afb/AFBRequestImpl.h7
-rw-r--r--src/plugins/afb/include/AFBEventImpl.h7
-rw-r--r--src/plugins/afb/src/AFBEventImpl.cpp9
-rw-r--r--src/plugins/utilities/logging/Logger.cpp15
-rw-r--r--src/plugins/utilities/logging/Logger.h9
-rw-r--r--src/vshl-core-binding.c49
12 files changed, 69 insertions, 64 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e1d60c3..b5f8d35 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,6 @@
###########################################################################
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+# Copyright 2019 Konsulko Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -37,7 +38,6 @@ PROJECT_TARGET_ADD(vshl-core)
# Library dependencies (include updates automatically)
TARGET_LINK_LIBRARIES(${TARGET_NAME}
- ctl-utilities
${link_libraries})
add_subdirectory("plugins")
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index f833968..64f2c35 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -85,7 +85,6 @@ PROJECT_TARGET_ADD(vshl-core-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)
@@ -138,7 +137,6 @@ PROJECT_TARGET_ADD(vshl-core-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/VshlCoreApi.cpp b/src/plugins/VshlCoreApi.cpp
index a28193c..05c894d 100644
--- a/src/plugins/VshlCoreApi.cpp
+++ b/src/plugins/VshlCoreApi.cpp
@@ -232,9 +232,9 @@ CTLP_CAPI(startListening, source, argsJ, eventJ) {
if (!requestId.empty()) {
json responseJson;
responseJson[STARTLISTENING_JSON_ATTR_REQUEST] = requestId;
- AFB_ReqSuccess(source->request, json_tokener_parse(responseJson.dump().c_str()), NULL);
+ afb_req_success(source->request, json_tokener_parse(responseJson.dump().c_str()), NULL);
} else {
- AFB_ReqFail(source->request, NULL, "Failed to startListening...");
+ afb_req_fail(source->request, NULL, "Failed to startListening...");
}
return 0;
@@ -280,7 +280,7 @@ CTLP_CAPI(enumerateVoiceAgents, source, argsJ, eventJ) {
responseJson[VA_JSON_ATTR_AGENTS] = agentsJson;
responseJson[VA_JSON_ATTR_DEFAULT] = defaultAgentId;
- AFB_ReqSuccess(source->request, json_tokener_parse(responseJson.dump().c_str()), NULL);
+ afb_req_success(source->request, json_tokener_parse(responseJson.dump().c_str()), NULL);
return 0;
}
@@ -317,7 +317,7 @@ CTLP_CAPI(subscribe, source, argsJ, eventJ) {
}
}
- AFB_ReqSuccess(source->request, json_object_new_string("Subscription to events successfully completed."), NULL);
+ afb_req_success(source->request, json_object_new_string("Subscription to events successfully completed."), NULL);
return 0;
}
@@ -344,6 +344,6 @@ CTLP_CAPI(setDefaultVoiceAgent, source, argsJ, eventJ) {
return -1;
}
- AFB_ReqSuccess(source->request, NULL, NULL);
+ afb_req_success(source->request, NULL, NULL);
return 0;
}
diff --git a/src/plugins/afb/AFBApiImpl.cpp b/src/plugins/afb/AFBApiImpl.cpp
index 9af4fbc..c4cc1b1 100644
--- a/src/plugins/afb/AFBApiImpl.cpp
+++ b/src/plugins/afb/AFBApiImpl.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright 2019 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -21,7 +22,7 @@
extern "C" {
#define AFB_BINDING_VERSION 3
-#include "afb-definitions.h"
+#include <afb/afb-binding.h>
}
static std::string TAG = "vshlcore::afb::AFBApiImpl";
@@ -35,11 +36,11 @@ using namespace vshlcore::utilities::logging;
namespace vshlcore {
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() {
@@ -58,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 d6b7b31..c0c7dd5 100644
--- a/src/plugins/afb/AFBApiImpl.h
+++ b/src/plugins/afb/AFBApiImpl.h
@@ -1,5 +1,6 @@
/*
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright 2019 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -30,7 +31,7 @@ namespace afb {
class AFBApiImpl : public vshlcore::common::interfaces::IAFBApi {
public:
- static std::unique_ptr<AFBApiImpl> create(AFB_ApiT api);
+ static std::unique_ptr<AFBApiImpl> create(afb_api_t api);
~AFBApiImpl();
@@ -45,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<vshlcore::common::interfaces::ILogger> mLogger;
diff --git a/src/plugins/afb/AFBRequestImpl.cpp b/src/plugins/afb/AFBRequestImpl.cpp
index 6e0f177..ab47b3f 100644
--- a/src/plugins/afb/AFBRequestImpl.cpp
+++ b/src/plugins/afb/AFBRequestImpl.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright 2019 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -16,16 +17,16 @@
#include "afb/AFBRequestImpl.h"
extern "C" {
-#include "afb-definitions.h"
+#include <afb/afb-binding.h>
}
namespace vshlcore {
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 82772fb..725f081 100644
--- a/src/plugins/afb/AFBRequestImpl.h
+++ b/src/plugins/afb/AFBRequestImpl.h
@@ -1,5 +1,6 @@
/*
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright 2019 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -30,16 +31,16 @@ namespace afb {
*/
class AFBRequestImpl : public vshlcore::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 924c966..28206a4 100644
--- a/src/plugins/afb/include/AFBEventImpl.h
+++ b/src/plugins/afb/include/AFBEventImpl.h
@@ -1,5 +1,6 @@
/*
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright 2019 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -36,7 +37,7 @@ namespace afb {
class AFBEventImpl : public vshlcore::common::interfaces::IAFBApi::IAFBEvent {
public:
static unique_ptr<AFBEventImpl>
- create(shared_ptr<vshlcore::common::interfaces::ILogger> logger, AFB_ApiT api,
+ create(shared_ptr<vshlcore::common::interfaces::ILogger> logger, afb_api_t api,
const string &eventName);
// Destructor
@@ -52,14 +53,14 @@ public:
private:
AFBEventImpl(shared_ptr<vshlcore::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 b7837bb..6e3b106 100644
--- a/src/plugins/afb/src/AFBEventImpl.cpp
+++ b/src/plugins/afb/src/AFBEventImpl.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright 2019 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -23,14 +24,14 @@ namespace afb {
unique_ptr<AFBEventImpl> AFBEventImpl::create(
shared_ptr<vshlcore::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<vshlcore::common::interfaces::ILogger> logger,
- AFB_ApiT api,
+ afb_api_t api,
const string& eventName) :
mLogger(logger),
mAfbApi(api),
@@ -52,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;
}
@@ -62,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 b310695..e09ba9a 100644
--- a/src/plugins/utilities/logging/Logger.cpp
+++ b/src/plugins/utilities/logging/Logger.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright 2019 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -18,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;
}
@@ -31,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 d1d0196..78a4a22 100644
--- a/src/plugins/utilities/logging/Logger.h
+++ b/src/plugins/utilities/logging/Logger.h
@@ -1,5 +1,6 @@
/*
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright 2019 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -19,7 +20,7 @@
extern "C" {
#define AFB_BINDING_VERSION 3
-#include "afb-definitions.h"
+#include <afb/afb-binding.h>
#include "ctl-plugin.h"
};
@@ -32,17 +33,17 @@ namespace logging {
class Logger : public vshlcore::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
diff --git a/src/vshl-core-binding.c b/src/vshl-core-binding.c
index a832f66..9d1000f 100644
--- a/src/vshl-core-binding.c
+++ b/src/vshl-core-binding.c
@@ -1,5 +1,6 @@
/*
* Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * Copyright 2019 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
@@ -15,8 +16,6 @@
#define _GNU_SOURCE
#include "vshl-core-binding.h"
-afb_dynapi* AFB_default;
-
// Config Section definition (note: controls section index should match handle
// retrieval in HalConfigExec)
static CtlSectionT ctrlSections[] = {{.key = "plugins", .loadCB = PluginConfig},
@@ -25,22 +24,23 @@ static CtlSectionT ctrlSections[] = {{.key = "plugins", .loadCB = PluginConfig},
{.key = "onload", .loadCB = OnloadConfig},
{.key = NULL}};
-static AFB_ApiVerbs ctrlApiVerbs[] = {
+static afb_verb_t ctrlApiVerbs[] = {
{.verb = NULL} /* marker for end of the array */
};
-static int ctrlLoadStaticVerbs(afb_dynapi* apiHandle, AFB_ApiVerbs* verbs) {
+static int ctrlLoadStaticVerbs(afb_api_t apiHandle, afb_verb_t* verbs) {
int errcount = 0;
for (int idx = 0; verbs[idx].verb; idx++) {
- errcount += afb_dynapi_add_verb(
+ errcount += afb_api_add_verb(
apiHandle,
ctrlApiVerbs[idx].verb,
NULL,
ctrlApiVerbs[idx].callback,
(void*)&ctrlApiVerbs[idx],
ctrlApiVerbs[idx].auth,
- 0);
+ 0,
+ !!strchr(ctrlApiVerbs[idx].verb, '*'));
}
return errcount;
@@ -49,7 +49,7 @@ static int ctrlLoadStaticVerbs(afb_dynapi* apiHandle, AFB_ApiVerbs* verbs) {
// next generation dynamic API-V3 mode
#include <signal.h>
-static int CtrlInitOneApi(AFB_ApiT apiHandle)
+static int CtrlInitOneApi(afb_api_t apiHandle)
{
CtlConfigT *ctrlConfig;
@@ -57,72 +57,71 @@ static int CtrlInitOneApi(AFB_ApiT apiHandle)
return -1;
// Retrieve section config from api handle
- ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle);
+ ctrlConfig = (CtlConfigT *) afb_api_get_userdata(apiHandle);
if(!ctrlConfig)
return -2;
return CtlConfigExec(apiHandle, ctrlConfig);
}
-static int ctrlLoadOneApi(void* cbdata, AFB_ApiT apiHandle) {
+static int ctrlLoadOneApi(void* cbdata, afb_api_t apiHandle) {
CtlConfigT* ctrlConfig = (CtlConfigT*)cbdata;
// save closure as api's data context
- afb_dynapi_set_userdata(apiHandle, ctrlConfig);
+ afb_api_set_userdata(apiHandle, ctrlConfig);
// add static controls verbs
int err = ctrlLoadStaticVerbs(apiHandle, ctrlApiVerbs);
if (err) {
- AFB_ApiError(apiHandle, "ctrlLoadStaticVerbs fail to register static V2 verbs");
+ AFB_API_ERROR(apiHandle, "ctrlLoadStaticVerbs fail to register static V2 verbs");
return ERROR;
}
// load section for corresponding API
err = CtlLoadSections(apiHandle, ctrlConfig, ctrlSections);
if (err) {
- AFB_ApiError(apiHandle, "CtlLoadSections fail to load the sections");
+ AFB_API_ERROR(apiHandle, "CtlLoadSections fail to load the sections");
return ERROR;
}
// declare an event event manager for this API;
- afb_dynapi_on_event(apiHandle, CtrlDispatchApiEvent);
+ afb_api_on_event(apiHandle, CtrlDispatchApiEvent);
// init API function (does not receive user closure ???
- afb_dynapi_on_init(apiHandle, CtrlInitOneApi);
+ afb_api_on_init(apiHandle, CtrlInitOneApi);
- afb_dynapi_seal(apiHandle);
+ afb_api_seal(apiHandle);
return err;
}
-int afbBindingEntry(afb_dynapi* apiHandle) {
- AFB_default = apiHandle;
- AFB_ApiNotice(apiHandle, "Controller in afbBindingEntry");
+int afbBindingEntry(afb_api_t apiHandle) {
+ AFB_API_NOTICE(apiHandle, "Controller in afbBindingEntry");
const char* dirList = getenv("CONTROL_CONFIG_PATH");
if (!dirList) dirList = CONTROL_CONFIG_PATH;
const char* configPath = CtlConfigSearch(apiHandle, dirList, "");
if (!configPath) {
- AFB_ApiError(apiHandle, "CtlPreInit: No %s* config found in %s ", GetBinderName(), dirList);
+ AFB_API_ERROR(apiHandle, "CtlPreInit: No %s* config found in %s ", GetBinderName(), dirList);
return ERROR;
}
// load config file and create API
CtlConfigT* ctrlConfig = CtlLoadMetaData(apiHandle, configPath);
if (!ctrlConfig) {
- AFB_ApiError(apiHandle, "CtrlBindingDyn No valid control config file in:\n-- %s", configPath);
+ AFB_API_ERROR(apiHandle, "CtrlBindingDyn No valid control config file in:\n-- %s", configPath);
return ERROR;
}
if (!ctrlConfig->api) {
- AFB_ApiError(apiHandle, "CtrlBindingDyn API Missing from metadata in:\n-- %s", configPath);
+ AFB_API_ERROR(apiHandle, "CtrlBindingDyn API Missing from metadata in:\n-- %s", configPath);
return ERROR;
}
- AFB_ApiNotice(apiHandle, "Controller API='%s' info='%s'", ctrlConfig->api, ctrlConfig->info);
+ AFB_API_NOTICE(apiHandle, "Controller API='%s' info='%s'", ctrlConfig->api, ctrlConfig->info);
- // create one API per config file (Pre-V3 return code ToBeChanged)
- int status = afb_dynapi_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, ctrlLoadOneApi, ctrlConfig);
+ // create one API per config file
+ afb_api_t newApi = afb_api_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, ctrlLoadOneApi, ctrlConfig);
- return status;
+ return newApi != NULL ? 0 : -1;
}