summaryrefslogtreecommitdiffstats
path: root/4a-hal-utilities
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-01-21 17:07:36 +0100
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-01-28 15:38:58 +0100
commit756f8d02b445631df44243d528165fb1fe414487 (patch)
tree1ef835068d6cf24f33eeb0a0a136865a23a1884e /4a-hal-utilities
parent524ad81cd52d52555d0e6cbaf865f6bb6cfecb25 (diff)
Move from controller functions to afb functions
Move from controller 'afb-definitions.h' functions to application framework 'afb/afb-binding.h' functions. Change-Id: I4cd62af881ef8ac949b082ede9dfcc4736d1e12c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal-utilities')
-rw-r--r--4a-hal-utilities/4a-hal-utilities-alsa-data.c2
-rw-r--r--4a-hal-utilities/4a-hal-utilities-alsa-data.h4
-rw-r--r--4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c75
-rw-r--r--4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.h6
-rw-r--r--4a-hal-utilities/4a-hal-utilities-data.c4
-rw-r--r--4a-hal-utilities/4a-hal-utilities-data.h12
-rw-r--r--4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c133
-rw-r--r--4a-hal-utilities/4a-hal-utilities-hal-streams-handler.h14
-rw-r--r--4a-hal-utilities/4a-hal-utilities-verbs-loader.c20
-rw-r--r--4a-hal-utilities/4a-hal-utilities-verbs-loader.h4
10 files changed, 137 insertions, 137 deletions
diff --git a/4a-hal-utilities/4a-hal-utilities-alsa-data.c b/4a-hal-utilities/4a-hal-utilities-alsa-data.c
index ef2967a..79cc8eb 100644
--- a/4a-hal-utilities/4a-hal-utilities-alsa-data.c
+++ b/4a-hal-utilities/4a-hal-utilities-alsa-data.c
@@ -19,7 +19,7 @@
#include <stdio.h>
-#include <afb-definitions.h>
+#include <afb/afb-binding.h>
#include "4a-hal-utilities-alsa-data.h"
diff --git a/4a-hal-utilities/4a-hal-utilities-alsa-data.h b/4a-hal-utilities/4a-hal-utilities-alsa-data.h
index 5a998ae..ef0aba1 100644
--- a/4a-hal-utilities/4a-hal-utilities-alsa-data.h
+++ b/4a-hal-utilities/4a-hal-utilities-alsa-data.h
@@ -24,6 +24,8 @@
#include <alsa/asoundlib.h>
+#include <afb/afb-binding.h>
+
#include <ctl-config.h>
struct CtlHalAlsaDBScale {
@@ -55,7 +57,7 @@ struct CtlHalAlsaCtl {
struct CtlHalAlsaMap {
const char *uid;
char *info;
- AFB_EventT alsaControlEvent;
+ afb_event_t alsaControlEvent;
struct CtlHalAlsaCtl ctl;
json_object *actionJ;
CtlActionT *action;
diff --git a/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c b/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c
index 40581ef..bf88571 100644
--- a/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c
+++ b/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.c
@@ -20,13 +20,15 @@
#include <stdio.h>
#include <string.h>
+#include <afb/afb-binding.h>
+
#include "4a-hal-utilities-appfw-responses-handler.h"
/*******************************************************************************
* Handle application framework response function *
******************************************************************************/
-enum CallError HalUtlHandleAppFwCallError(AFB_ApiT apiHandle, char *apiCalled, char *verbCalled, json_object *callReturnJ, char **returnedStatus, char **returnedInfo)
+enum CallError HalUtlHandleAppFwCallError(afb_api_t apiHandle, char *apiCalled, char *verbCalled, json_object *callReturnJ, char **returnedStatus, char **returnedInfo)
{
json_object *returnedRequestJ, *returnedStatusJ, *returnedInfoJ;
@@ -34,73 +36,72 @@ enum CallError HalUtlHandleAppFwCallError(AFB_ApiT apiHandle, char *apiCalled, c
return CALL_ERROR_INVALID_ARGS;
if(! json_object_object_get_ex(callReturnJ, "request", &returnedRequestJ)) {
- AFB_ApiWarning(apiHandle, "Couldn't get response request object");
+ AFB_API_WARNING(apiHandle, "Couldn't get response request object");
return CALL_ERROR_REQUEST_UNAVAILABLE;
}
if(! json_object_is_type(returnedRequestJ, json_type_object)) {
- AFB_ApiWarning(apiHandle, "Response request object is not valid");
+ AFB_API_WARNING(apiHandle, "Response request object is not valid");
return CALL_ERROR_REQUEST_NOT_VALID;
}
if(! json_object_object_get_ex(returnedRequestJ, "status", &returnedStatusJ)) {
- AFB_ApiWarning(apiHandle, "Couldn't get response status object");
+ AFB_API_WARNING(apiHandle, "Couldn't get response status object");
return CALL_ERROR_REQUEST_STATUS_UNAVAILABLE;
}
if(! json_object_is_type(returnedStatusJ, json_type_string)) {
- AFB_ApiWarning(apiHandle, "Response status object is not valid");
+ AFB_API_WARNING(apiHandle, "Response status object is not valid");
return CALL_ERROR_REQUEST_STATUS_NOT_VALID;
}
*returnedStatus = (char *) json_object_get_string(returnedStatusJ);
if(! strcmp(*returnedStatus, "unknown-api")) {
- AFB_ApiWarning(apiHandle, "Api %s not found", apiCalled);
+ AFB_API_WARNING(apiHandle, "Api %s not found", apiCalled);
return CALL_ERROR_API_UNAVAILABLE;
}
if(! strcmp(*returnedStatus, "unknown-verb")) {
- AFB_ApiWarning(apiHandle, "Verb %s of api %s not found", verbCalled, apiCalled);
+ AFB_API_WARNING(apiHandle, "Verb %s of api %s not found", verbCalled, apiCalled);
return CALL_ERROR_VERB_UNAVAILABLE;
}
if(! json_object_object_get_ex(returnedRequestJ, "info", &returnedInfoJ)) {
- AFB_ApiWarning(apiHandle, "Couldn't get response info object");
+ AFB_API_WARNING(apiHandle, "Couldn't get response info object");
return CALL_ERROR_REQUEST_INFO_UNAVAILABLE;
}
if(! json_object_is_type(returnedInfoJ, json_type_string)) {
- AFB_ApiWarning(apiHandle, "Response info object is not valid");
+ AFB_API_WARNING(apiHandle, "Response info object is not valid");
return CALL_ERROR_REQUEST_INFO_NOT_VALID;
}
*returnedInfo = (char *) json_object_get_string(returnedInfoJ);
- AFB_ApiWarning(apiHandle,
- "Api %s and verb %s found, but this error was raised : '%s' with this info : '%s'",
- apiCalled,
- verbCalled,
- *returnedStatus,
- *returnedInfo);
+ AFB_API_WARNING(apiHandle,
+ "Api %s and verb %s found, but this error was raised : '%s' with this info : '%s'",
+ apiCalled,
+ verbCalled,
+ *returnedStatus,
+ *returnedInfo);
return CALL_ERROR_RETURNED;
}
-void HalUtlHandleAppFwCallErrorInRequest(AFB_ReqT request, char *apiCalled, char *verbCalled, json_object *callReturnJ, char *errorStatusToSend)
+void HalUtlHandleAppFwCallErrorInRequest(afb_req_t request, char *apiCalled, char *verbCalled, json_object *callReturnJ, char *errorStatusToSend)
{
char *returnedStatus = NULL, *returnedInfo = NULL;
- AFB_ApiT apiHandle;
+ afb_api_t apiHandle;
if(! request || ! apiCalled || ! verbCalled || ! callReturnJ) {
- AFB_ReqFailF(request, "invalid_args", "Invalid arguments");
+ afb_req_fail_f(request, "invalid_args", "Invalid arguments");
return;
}
- apiHandle = (AFB_ApiT) AFB_ReqGetApi(request);
- if(! apiHandle) {
- AFB_ReqFailF(request, "api_handle", "Can't get hal manager api handle");
+ if(! (apiHandle = afb_req_get_api(request))) {
+ afb_req_fail_f(request, "api_handle", "Can't get hal manager api handle");
return;
}
@@ -111,37 +112,37 @@ void HalUtlHandleAppFwCallErrorInRequest(AFB_ReqT request, char *apiCalled, char
case CALL_ERROR_REQUEST_STATUS_NOT_VALID:
case CALL_ERROR_REQUEST_INFO_UNAVAILABLE:
case CALL_ERROR_REQUEST_INFO_NOT_VALID:
- AFB_ReqFail(request, errorStatusToSend, "Error with response object");
+ afb_req_fail(request, errorStatusToSend, "Error with response object");
return;
case CALL_ERROR_API_UNAVAILABLE:
- AFB_ReqFailF(request, errorStatusToSend, "Api %s not found", apiCalled);
+ afb_req_fail_f(request, errorStatusToSend, "Api %s not found", apiCalled);
return;
case CALL_ERROR_VERB_UNAVAILABLE:
- AFB_ReqFailF(request, errorStatusToSend, "Verb %s of api %s not found", verbCalled, apiCalled);
+ afb_req_fail_f(request, errorStatusToSend, "Verb %s of api %s not found", verbCalled, apiCalled);
return;
case CALL_ERROR_RETURNED:
- AFB_ReqFailF(request,
- errorStatusToSend,
- "Api %s and verb %s found, but this error was raised : '%s' with this info : '%s'",
- apiCalled,
- verbCalled,
- returnedStatus ? returnedStatus : "not returned",
- returnedInfo ? returnedInfo : "not returned");
+ afb_req_fail_f(request,
+ errorStatusToSend,
+ "Api %s and verb %s found, but this error was raised : '%s' with this info : '%s'",
+ apiCalled,
+ verbCalled,
+ returnedStatus ? returnedStatus : "not returned",
+ returnedInfo ? returnedInfo : "not returned");
return;
case CALL_ERROR_INVALID_ARGS:
- AFB_ReqFailF(request,
- errorStatusToSend,
- "Api %s and verb %s found, but the arguments are invalid",
- apiCalled,
- verbCalled);
+ afb_req_fail_f(request,
+ errorStatusToSend,
+ "Api %s and verb %s found, but the arguments are invalid",
+ apiCalled,
+ verbCalled);
return;
default:
- AFB_ReqFailF(request, errorStatusToSend, "Unknown error happened during call to verb %s of api %s", verbCalled, apiCalled);
+ afb_req_fail_f(request, errorStatusToSend, "Unknown error happened during call to verb %s of api %s", verbCalled, apiCalled);
return;
}
} \ No newline at end of file
diff --git a/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.h b/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.h
index 923ca6b..2bdbaab 100644
--- a/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.h
+++ b/4a-hal-utilities/4a-hal-utilities-appfw-responses-handler.h
@@ -22,7 +22,7 @@
#include <wrap-json.h>
-#include <afb-definitions.h>
+#include <afb/afb-binding.h>
// Enum for the type of error detected
enum CallError {
@@ -39,7 +39,7 @@ enum CallError {
};
// Handle application framework response function
-extern enum CallError HalUtlHandleAppFwCallError(AFB_ApiT apiHandle, char *apiCalled, char *verbCalled, json_object *callReturnJ, char **returnedStatus, char **returnedInfo);
-void HalUtlHandleAppFwCallErrorInRequest(AFB_ReqT request, char *apiCalled, char *verbCalled, json_object *callReturnJ, char *errorStatusToSend);
+extern enum CallError HalUtlHandleAppFwCallError(afb_api_t apiHandle, char *apiCalled, char *verbCalled, json_object *callReturnJ, char **returnedStatus, char **returnedInfo);
+void HalUtlHandleAppFwCallErrorInRequest(afb_req_t request, char *apiCalled, char *verbCalled, json_object *callReturnJ, char *errorStatusToSend);
#endif /* _HAL_UTILITIES_APPFW_RESP_HANDLER_INCLUDE_ */ \ No newline at end of file
diff --git a/4a-hal-utilities/4a-hal-utilities-data.c b/4a-hal-utilities/4a-hal-utilities-data.c
index b5d0293..420354e 100644
--- a/4a-hal-utilities/4a-hal-utilities-data.c
+++ b/4a-hal-utilities/4a-hal-utilities-data.c
@@ -22,6 +22,8 @@
#include <wrap-json.h>
+#include <afb/afb-binding.h>
+
#include "4a-hal-utilities-data.h"
#include "4a-hal-utilities-alsa-data.h"
@@ -307,7 +309,7 @@ struct SpecificHalData *HalUtlSearchReadyHalDataByCarId(struct SpecificHalData *
* Hal Manager data handling functions *
******************************************************************************/
-uint8_t HalUtlInitializeHalMgrData(AFB_ApiT apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info)
+uint8_t HalUtlInitializeHalMgrData(afb_api_t apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info)
{
if(! apiHandle || ! HalMgrGlobalData || ! apiName || ! info)
return -1;
diff --git a/4a-hal-utilities/4a-hal-utilities-data.h b/4a-hal-utilities/4a-hal-utilities-data.h
index 62beac8..dda88ba 100644
--- a/4a-hal-utilities/4a-hal-utilities-data.h
+++ b/4a-hal-utilities/4a-hal-utilities-data.h
@@ -22,7 +22,7 @@
#include <wrap-json.h>
-#include <afb-definitions.h>
+#include <afb/afb-binding.h>
#include <ctl-config.h>
@@ -42,7 +42,7 @@ struct CtlHalMixerData {
char *verb;
char *verbToCall;
char *streamCardId;
- AFB_EventT event;
+ afb_event_t event;
struct CtlHalMixerData *next;
};
@@ -54,14 +54,14 @@ struct CtlHalSpecificData {
json_object *halMixerJ;
struct CtlHalMixerData *ctlHalStreamsData;
- AFB_EventT streamUpdates;
+ afb_event_t streamUpdates;
struct CtlHalMixerData *ctlHalPlaybacksData;
struct CtlHalMixerData *ctlHalCapturesData;
struct CtlHalAlsaMapT *ctlHalAlsaMapT;
- AFB_ApiT apiHandle;
+ afb_api_t apiHandle;
CtlConfigT *ctrlConfig;
};
@@ -89,7 +89,7 @@ struct HalMgrData {
char *apiName;
char *info;
- AFB_ApiT apiHandle;
+ afb_api_t apiHandle;
struct SpecificHalData *first;
};
@@ -110,7 +110,7 @@ struct SpecificHalData *HalUtlSearchHalDataByApiName(struct SpecificHalData **fi
struct SpecificHalData *HalUtlSearchReadyHalDataByCarId(struct SpecificHalData **firstHalData, int cardId);
// Exported verbs for 'struct HalMgrData' handling
-uint8_t HalUtlInitializeHalMgrData(AFB_ApiT apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info);
+uint8_t HalUtlInitializeHalMgrData(afb_api_t apiHandle, struct HalMgrData *HalMgrGlobalData, char *apiName, char *info);
void HalUtlRemoveHalMgrData(struct HalMgrData *HalMgrGlobalData);
#endif /* _HAL_UTILITIES_DATA_INCLUDE_ */ \ No newline at end of file
diff --git a/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c b/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c
index 4d42b01..9f23787 100644
--- a/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c
+++ b/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <json-c/json.h>
-#include <afb-definitions.h>
+#include <afb/afb-binding.h>
#include <ctl-config.h>
@@ -32,13 +32,13 @@
* Actions to be call when a stream verb is called *
******************************************************************************/
-void HalUtlActionOnMixer(AFB_ReqT request, enum ActionOnMixerType actionType)
+void HalUtlActionOnMixer(afb_req_t request, enum ActionOnMixerType actionType)
{
int idx, count;
char *apiToCall;
- AFB_ApiT apiHandle;
+ afb_api_t apiHandle;
CtlConfigT *ctrlConfig;
struct SpecificHalData *currentCtlHalData;
@@ -46,27 +46,23 @@ void HalUtlActionOnMixer(AFB_ReqT request, enum ActionOnMixerType actionType)
json_object *requestJson, *returnJ = NULL, *responseJ, *toReturnJ = NULL;
- apiHandle = (AFB_ApiT) AFB_ReqGetApi(request);
- if(! apiHandle) {
- AFB_ReqFail(request, "api_handle", "Can't get current hal controller api handle");
+ if(! (apiHandle = afb_req_get_api(request))) {
+ afb_req_fail(request, "api_handle", "Can't get current hal controller api handle");
return;
}
- ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle);
- if(! ctrlConfig) {
- AFB_ReqFail(request, "hal_controller_config", "Can't get current hal controller config");
+ if(! (ctrlConfig = (CtlConfigT *) afb_api_get_userdata(apiHandle))) {
+ afb_req_fail(request, "hal_controller_config", "Can't get current hal controller config");
return;
}
- currentCtlHalData = (struct SpecificHalData *) getExternalData(ctrlConfig);
- if(! currentCtlHalData) {
- AFB_ReqFail(request, "hal_controller_data", "Can't get current hal controller data");
+ if(! (currentCtlHalData = (struct SpecificHalData *) getExternalData(ctrlConfig))) {
+ afb_req_fail(request, "hal_controller_data", "Can't get current hal controller data");
return;
}
- requestJson = AFB_ReqJson(request);
- if(! requestJson) {
- AFB_ReqFail(request, "request_json", "Can't get request json");
+ if(! (requestJson = afb_req_json(request))) {
+ afb_req_fail(request, "request_json", "Can't get request json");
return;
}
@@ -75,17 +71,17 @@ void HalUtlActionOnMixer(AFB_ReqT request, enum ActionOnMixerType actionType)
apiToCall = currentCtlHalData->ctlHalSpecificData->mixerApiName;
if(! apiToCall) {
- AFB_ReqFail(request, "mixer_api", "Can't get mixer api");
+ afb_req_fail(request, "mixer_api", "Can't get mixer api");
return;
}
if(currentCtlHalData->status != HAL_STATUS_READY) {
- AFB_ReqFail(request, "hal_not_ready", "Seems that hal is not ready");
+ afb_req_fail(request, "hal_not_ready", "Seems that hal is not ready");
return;
}
- if(! (currentMixerData = (struct CtlHalMixerData *) AFB_ReqVCBData(request))) {
- AFB_ReqFail(request, "hal_call_data", "Can't get current call data");
+ if(! (currentMixerData = (struct CtlHalMixerData *) afb_req_get_vcbdata(request))) {
+ afb_req_fail(request, "hal_call_data", "Can't get current call data");
return;
}
@@ -102,16 +98,16 @@ void HalUtlActionOnMixer(AFB_ReqT request, enum ActionOnMixerType actionType)
break;
default:
- AFB_ReqFail(request, "hal_call_data", "Can't get current call data");
+ afb_req_fail(request, "hal_call_data", "Can't get current call data");
return;
}
for(idx = 0; idx < count; idx++) {
- if(AFB_ServiceSync(apiHandle,
- apiToCall,
- currentMixerData->verbToCall,
- json_object_get(requestJson),
- &returnJ)) {
+ if(afb_api_call_sync_legacy(apiHandle,
+ apiToCall,
+ currentMixerData->verbToCall,
+ json_object_get(requestJson),
+ &returnJ)) {
HalUtlHandleAppFwCallErrorInRequest(request, apiToCall, currentMixerData->verbToCall, returnJ, "call_action");
json_object_put(returnJ);
if(toReturnJ)
@@ -120,11 +116,11 @@ void HalUtlActionOnMixer(AFB_ReqT request, enum ActionOnMixerType actionType)
}
if(wrap_json_unpack(returnJ, "{s:o}", "response", &responseJ)) {
- AFB_ReqFailF(request,
- "Seems that %s call to api %s succeed, but no response was found in : '%s'",
- currentMixerData->verbToCall,
- apiToCall,
- json_object_get_string(returnJ));
+ afb_req_fail_f(request,
+ "Seems that %s call to api %s succeed, but no response was found in : '%s'",
+ currentMixerData->verbToCall,
+ apiToCall,
+ json_object_get_string(returnJ));
json_object_put(returnJ);
if(toReturnJ)
json_object_put(toReturnJ);
@@ -135,8 +131,8 @@ void HalUtlActionOnMixer(AFB_ReqT request, enum ActionOnMixerType actionType)
if((actionType == ACTION_ON_MIXER_STREAM ||
actionType == ACTION_ON_MIXER_ALL_STREAM) &&
((! currentMixerData->event) ||
- (AFB_EventPush(currentMixerData->event, json_object_get(responseJ)) < 0))) {
- AFB_ApiError(apiHandle, "Couldn't generate an event for stream %s", currentMixerData->verb);
+ (afb_event_push(currentMixerData->event, json_object_get(responseJ)) < 0))) {
+ AFB_API_ERROR(apiHandle, "Could not generate an event for stream %s", currentMixerData->verb);
}
switch(actionType) {
@@ -173,29 +169,29 @@ void HalUtlActionOnMixer(AFB_ReqT request, enum ActionOnMixerType actionType)
switch(actionType) {
case ACTION_ON_MIXER_STREAM:
- AFB_ReqSuccessF(request,
- toReturnJ,
- "Action %s correctly transferred to %s without any error raised",
- currentMixerData->verbToCall,
- apiToCall);
+ afb_req_success_f(request,
+ toReturnJ,
+ "Action %s correctly transferred to %s without any error raised",
+ currentMixerData->verbToCall,
+ apiToCall);
break;
case ACTION_ON_MIXER_PLAYBACK:
- AFB_ReqSuccess(request,
- toReturnJ,
- "Actions correctly transferred to all playbacks without any error raised");
+ afb_req_success(request,
+ toReturnJ,
+ "Actions correctly transferred to all playbacks without any error raised");
break;
case ACTION_ON_MIXER_CAPTURE:
- AFB_ReqSuccess(request,
- toReturnJ,
- "Actions correctly transferred to all captures without any error raised");
+ afb_req_success(request,
+ toReturnJ,
+ "Actions correctly transferred to all captures without any error raised");
break;
case ACTION_ON_MIXER_ALL_STREAM:
- AFB_ReqSuccess(request,
- toReturnJ,
- "Actions correctly transferred to all streams without any error raised");
+ afb_req_success(request,
+ toReturnJ,
+ "Actions correctly transferred to all streams without any error raised");
break;
default:
@@ -203,22 +199,22 @@ void HalUtlActionOnMixer(AFB_ReqT request, enum ActionOnMixerType actionType)
}
}
-void HalUtlActionOnStream(AFB_ReqT request)
+void HalUtlActionOnStream(afb_req_t request)
{
HalUtlActionOnMixer(request, ACTION_ON_MIXER_STREAM);
}
-void HalUtlActionOnPlayback(AFB_ReqT request)
+void HalUtlActionOnPlayback(afb_req_t request)
{
HalUtlActionOnMixer(request, ACTION_ON_MIXER_PLAYBACK);
}
-void HalUtlActionOnCapture(AFB_ReqT request)
+void HalUtlActionOnCapture(afb_req_t request)
{
HalUtlActionOnMixer(request, ACTION_ON_MIXER_CAPTURE);
}
-void HalUtlActionOnAllStream(AFB_ReqT request)
+void HalUtlActionOnAllStream(afb_req_t request)
{
HalUtlActionOnMixer(request, ACTION_ON_MIXER_ALL_STREAM);
}
@@ -227,7 +223,7 @@ void HalUtlActionOnAllStream(AFB_ReqT request)
* Add stream data and verb function *
******************************************************************************/
-struct CtlHalMixerData *HalUtlAddStreamDataAndCreateStreamVerb(AFB_ApiT apiHandle,
+struct CtlHalMixerData *HalUtlAddStreamDataAndCreateStreamVerb(afb_api_t apiHandle,
char *verb,
char *verbToCall,
char *streamCardId)
@@ -242,7 +238,7 @@ struct CtlHalMixerData *HalUtlAddStreamDataAndCreateStreamVerb(AFB_ApiT apiHandl
if(! apiHandle || ! verb || ! verbToCall || ! streamCardId)
return NULL;
- if((! (ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle))) ||
+ if((! (ctrlConfig = (CtlConfigT *) afb_api_get_userdata(apiHandle))) ||
(! (currentSpecificHalData = (struct SpecificHalData *) getExternalData(ctrlConfig))) ||
(! currentSpecificHalData->ctlHalSpecificData))
return NULL;
@@ -261,21 +257,20 @@ struct CtlHalMixerData *HalUtlAddStreamDataAndCreateStreamVerb(AFB_ApiT apiHandl
return NULL;
}
- createdStreamData->event = AFB_EventMake(apiHandle, createdStreamData->verb);
- if(! AFB_EventIsValid(createdStreamData->event)) {
+ if(! (createdStreamData->event = afb_api_make_event(apiHandle, createdStreamData->verb))) {
HalUtlRemoveSelectedMixerData(&currentSpecificHalData->ctlHalSpecificData->ctlHalStreamsData, createdStreamData);
return NULL;
}
- if(AFB_ApiAddVerb(apiHandle,
- createdStreamData->verb,
- "Stream action transferred to mixer",
- HalUtlActionOnStream,
- (void *) createdStreamData,
- NULL,
- 0,
- 0)) {
- AFB_ApiError(apiHandle,"Error while creating verb for stream : '%s'", createdStreamData->verb);
+ if(afb_api_add_verb(apiHandle,
+ createdStreamData->verb,
+ "Stream action transferred to mixer",
+ HalUtlActionOnStream,
+ (void *) createdStreamData,
+ NULL,
+ 0,
+ 0)) {
+ AFB_API_ERROR(apiHandle,"Error while creating verb for stream : '%s'", createdStreamData->verb);
HalUtlRemoveSelectedMixerData(&currentSpecificHalData->ctlHalSpecificData->ctlHalStreamsData, createdStreamData);
return NULL;
}
@@ -286,12 +281,12 @@ struct CtlHalMixerData *HalUtlAddStreamDataAndCreateStreamVerb(AFB_ApiT apiHandl
"name", createdStreamData->verb,
"cardId", createdStreamData->streamCardId);
- AFB_EventPush(currentSpecificHalData->ctlHalSpecificData->streamUpdates, streamAddedEventJ);
+ afb_event_push(currentSpecificHalData->ctlHalSpecificData->streamUpdates, streamAddedEventJ);
return createdStreamData;
}
-int8_t HalUtlRemoveStreamDataAndDeleteStreamVerb(AFB_ApiT apiHandle,
+int8_t HalUtlRemoveStreamDataAndDeleteStreamVerb(afb_api_t apiHandle,
char *verb,
char *verbToCall,
char *streamCardId)
@@ -308,7 +303,7 @@ int8_t HalUtlRemoveStreamDataAndDeleteStreamVerb(AFB_ApiT apiHandle,
if(! apiHandle || ! verb || ! verbToCall || ! streamCardId)
return -1;
- if((! (ctrlConfig = (CtlConfigT *) AFB_ApiGetUserData(apiHandle))) ||
+ if((! (ctrlConfig = (CtlConfigT *) afb_api_get_userdata(apiHandle))) ||
(! (currentSpecificHalData = (struct SpecificHalData *) getExternalData(ctrlConfig))) ||
(! currentSpecificHalData->ctlHalSpecificData))
return -2;
@@ -326,18 +321,18 @@ int8_t HalUtlRemoveStreamDataAndDeleteStreamVerb(AFB_ApiT apiHandle,
"cardId", toRemoveStreamData->streamCardId);
if(afb_api_del_verb(apiHandle, verb, NULL)) {
- AFB_ApiError(apiHandle,"Error while deleting verb for stream : '%s'", verb);
+ AFB_API_ERROR(apiHandle,"Error while deleting verb for stream : '%s'", verb);
json_object_put(streamRemovedEventJ);
return -4;
}
if((returnedErr = HalUtlRemoveSelectedMixerData(&currentSpecificHalData->ctlHalSpecificData->ctlHalStreamsData, toRemoveStreamData))) {
- AFB_ApiError(apiHandle,"Error %i while removing data for stream : '%s'", returnedErr, verb);
+ AFB_API_ERROR(apiHandle,"Error %i while removing data for stream : '%s'", returnedErr, verb);
json_object_put(streamRemovedEventJ);
return -5;
}
- AFB_EventPush(currentSpecificHalData->ctlHalSpecificData->streamUpdates, streamRemovedEventJ);
+ afb_event_push(currentSpecificHalData->ctlHalSpecificData->streamUpdates, streamRemovedEventJ);
return 0;
} \ No newline at end of file
diff --git a/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.h b/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.h
index b77006d..ca065e7 100644
--- a/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.h
+++ b/4a-hal-utilities/4a-hal-utilities-hal-streams-handler.h
@@ -20,7 +20,7 @@
#include <stdio.h>
-#include <afb-definitions.h>
+#include <afb/afb-binding.h>
#include <ctl-config.h>
@@ -33,17 +33,17 @@ enum ActionOnMixerType {
};
// Actions to be call when a stream verb is called
-void HalUtlActionOnStream(AFB_ReqT request);
-void HalUtlActionOnPlayback(AFB_ReqT request);
-void HalUtlActionOnCapture(AFB_ReqT request);
-void HalUtlActionOnAllStream(AFB_ReqT request);
+void HalUtlActionOnStream(afb_req_t request);
+void HalUtlActionOnPlayback(afb_req_t request);
+void HalUtlActionOnCapture(afb_req_t request);
+void HalUtlActionOnAllStream(afb_req_t request);
// Add/Remove stream data and verb functions
-struct CtlHalMixerData *HalUtlAddStreamDataAndCreateStreamVerb(AFB_ApiT apiHandle,
+struct CtlHalMixerData *HalUtlAddStreamDataAndCreateStreamVerb(afb_api_t apiHandle,
char *verb,
char *verbToCall,
char *streamCardId);
-int8_t HalUtlRemoveStreamDataAndDeleteStreamVerb(AFB_ApiT apiHandle,
+int8_t HalUtlRemoveStreamDataAndDeleteStreamVerb(afb_api_t apiHandle,
char *verb,
char *verbToCall,
char *streamCardId);
diff --git a/4a-hal-utilities/4a-hal-utilities-verbs-loader.c b/4a-hal-utilities/4a-hal-utilities-verbs-loader.c
index f557f4c..16c28c4 100644
--- a/4a-hal-utilities/4a-hal-utilities-verbs-loader.c
+++ b/4a-hal-utilities/4a-hal-utilities-verbs-loader.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <string.h>
-#include <afb-definitions.h>
+#include <afb/afb-binding.h>
#include "4a-hal-utilities-verbs-loader.h"
@@ -28,7 +28,7 @@
* Dynamic API common functions *
******************************************************************************/
-int HalUtlLoadVerbs(AFB_ApiT apiHandle, AFB_ApiVerbs *verbs)
+int HalUtlLoadVerbs(afb_api_t apiHandle, afb_verb_t *verbs)
{
int idx, errCount = 0;
@@ -36,14 +36,14 @@ int HalUtlLoadVerbs(AFB_ApiT apiHandle, AFB_ApiVerbs *verbs)
return -1;
for (idx = 0; verbs[idx].verb; idx++) {
- errCount+= AFB_ApiAddVerb(apiHandle,
- verbs[idx].verb,
- NULL,
- verbs[idx].callback,
- (void *) &verbs[idx],
- verbs[idx].auth,
- 0,
- 0);
+ errCount+= afb_api_add_verb(apiHandle,
+ verbs[idx].verb,
+ NULL,
+ verbs[idx].callback,
+ (void *) &verbs[idx],
+ verbs[idx].auth,
+ 0,
+ 0);
}
return errCount;
diff --git a/4a-hal-utilities/4a-hal-utilities-verbs-loader.h b/4a-hal-utilities/4a-hal-utilities-verbs-loader.h
index 2bfa1cd..9084595 100644
--- a/4a-hal-utilities/4a-hal-utilities-verbs-loader.h
+++ b/4a-hal-utilities/4a-hal-utilities-verbs-loader.h
@@ -20,9 +20,9 @@
#include <stdio.h>
-#include <afb-definitions.h>
+#include <afb/afb-binding.h>
// Verb that allows to add verb to a dynamic api
-int HalUtlLoadVerbs(AFB_ApiT apiHandle, AFB_ApiVerbs *verbs);
+int HalUtlLoadVerbs(afb_api_t apiHandle, afb_verb_t *verbs);
#endif /* _HAL_UTILITIES_VERBS_LOADER_INCLUDE_ */ \ No newline at end of file