From eb6a78be524aaee70fca55b86a7b065763591178 Mon Sep 17 00:00:00 2001 From: fulup Date: Thu, 10 Aug 2017 17:37:24 +0200 Subject: Work in Progress --- Controler-afb/ctl-binding.h | 80 +++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 47 deletions(-) (limited to 'Controler-afb/ctl-binding.h') diff --git a/Controler-afb/ctl-binding.h b/Controler-afb/ctl-binding.h index e53d2ca..77d1b6e 100644 --- a/Controler-afb/ctl-binding.h +++ b/Controler-afb/ctl-binding.h @@ -14,33 +14,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include "audio-common.h" #ifndef CONTROLER_BINDING_INCLUDE #define CONTROLER_BINDING_INCLUDE +#define AFB_BINDING_VERSION 2 +#include +#include + +#ifndef PUBLIC + #define PUBLIC +#endif +#define STATIC static + // polctl-binding.c PUBLIC int CtlBindingInit (); // ctl-timerevt.c // ---------------------- -#define DEFAULT_PAUSE_DELAY 3000 -#define DEFAULT_TEST_COUNT 1 -typedef int (*timerCallbackT)(void *context); -typedef struct { - int value; - const char *label; -} AutoTestCtxT; - -typedef struct TimerHandleS { - int count; - int delay; - AutoTestCtxT *context; - timerCallbackT callback; - sd_event_source *evtSource; -} TimerHandleT; + PUBLIC int TimerEvtInit (void); PUBLIC afb_event TimerEvtGet(void); @@ -49,46 +42,39 @@ PUBLIC void ctlapi_event_test (afb_req request); // ctl-policy // ----------- -typedef struct PolicyActionS{ - const char* label; - const char* api; - const char* verb; - json_object *argsJ; - const char *info; - int timeout; - json_object* (*actionCB)(struct PolicyActionS *action,json_object *response, void *context); -} PolicyActionT; - -typedef struct { - const char* label; - const char *info; - const char *version; - void *context; -} PolicyHandleT; - -typedef struct { - char *sharelib; - void *dlHandle; - PolicyHandleT **handle; - PolicyActionT **onload; - PolicyActionT **events; - PolicyActionT **controls; -} PolicyCtlConfigT; - typedef enum { CTLAPI_NAVIGATION, CTLAPI_MULTIMEDIA, CTLAPI_EMERGENCY, CTL_NONE=-1 -} PolicyCtlEnumT; +} DispatchCtlEnumT; -PUBLIC int PolicyInit(void); -PUBLIC json_object* ScanForConfig (char* searchPath, char * pre, char *ext); -PUBLIC void ctlapi_authorize (PolicyCtlEnumT control, afb_req request); + +typedef enum { + CTL_MODE_NONE=0, + CTL_MODE_API, + CTL_MODE_CB, + CTL_MODE_LUA, +} CtlRequestModeT; + +typedef struct DispatchActionS{ + const char *info; + const char* label; + CtlRequestModeT mode; + const char* api; + const char* call; + json_object *argsJ; + int timeout; + json_object* (*actionCB)(struct DispatchActionS *action,json_object *response, void *context); +} DispatchActionT; + +PUBLIC int DispatchInit(void); +PUBLIC void ctlapi_dispatch (DispatchCtlEnumT control, afb_req request); // ctl-lua.c PUBLIC int LuaLibInit (); +PUBLIC json_object* ScanForConfig (char* searchPath, char * pre, char *ext); PUBLIC void ctlapi_lua_docall (afb_req request); PUBLIC void ctlapi_lua_dostring (afb_req request); PUBLIC void ctlapi_lua_doscript (afb_req request); -- cgit 1.2.3-korg