aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-config_v3.h
diff options
context:
space:
mode:
authorClément Bénier <clement.benier@iot.bzh>2018-09-04 10:20:18 +0200
committerClément Bénier <clement.benier@iot.bzh>2018-09-04 10:20:18 +0200
commitc33c8c220fae362a86d747bb5d91d02a9116d2c5 (patch)
tree19525c64cb4c842cd71e4bf9a59f533b6372a22e /ctl-lib/ctl-config_v3.h
parenta185e5cf960ec2083fc45048e93a3a22a02c094f (diff)
controller: compatibility with v2
build it with AFB_BINDING_VERSION=0 Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-config_v3.h')
-rw-r--r--ctl-lib/ctl-config_v3.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/ctl-lib/ctl-config_v3.h b/ctl-lib/ctl-config_v3.h
new file mode 100644
index 0000000..bdddedf
--- /dev/null
+++ b/ctl-lib/ctl-config_v3.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2016 "IoT.bzh"
+ * Author Fulup Ar Foll <fulup@iot.bzh>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, something express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Reference:
+ * Json load using json_unpack https://jansson.readthedocs.io/en/2.9/apiref.html#parsing-and-validating-values
+ */
+
+#ifndef _CTL_CONFIG_V3_INCLUDE_
+#define _CTL_CONFIG_V3_INCLUDE_
+
+#if(AFB_BINDING_VERSION!=2)
+// ctl-action.c
+static inline CtlActionT *ActionConfig(AFB_ApiT apiHandle, json_object *actionsJ, int exportApi)
+{
+ return ActionConfig_V3(apiHandle, actionsJ, exportApi);
+}
+static inline int ActionLoadOne(AFB_ApiT apiHandle, CtlActionT *action, json_object *obj, int exportApi)
+{
+ return ActionLoadOne_V3(apiHandle, action, obj, exportApi);
+}
+
+// ctl-config.c
+static inline char* ConfigSearch(AFB_ApiT apiHandle, json_object *responseJ)
+{
+ return ConfigSearch_V3(apiHandle, responseJ);
+}
+static inline char* CtlConfigSearch(AFB_ApiT apiHandle, const char *dirList, const char *prefix)
+{
+ return CtlConfigSearch_V3(apiHandle, dirList, prefix);
+}
+static inline void DispatchRequireApi(AFB_ApiT apiHandle, json_object * requireJ)
+{
+ DispatchRequireApi_V3(apiHandle, requireJ);
+}
+static inline int CtlConfigExec(AFB_ApiT apiHandle, CtlConfigT *ctlConfig)
+{
+ return CtlConfigExec_V3(apiHandle, ctlConfig);
+}
+static inline CtlConfigT *CtlLoadMetaDataJson(AFB_ApiT apiHandle,json_object *ctlConfigJ, const char *prefix)
+{
+ return CtlLoadMetaDataJson_V3(apiHandle, ctlConfigJ, prefix);
+}
+static inline CtlConfigT *CtlLoadMetaDataUsingPrefix(AFB_ApiT apiHandle,const char* filepath, const char *prefix)
+{
+ return CtlLoadMetaDataUsingPrefix_V3(apiHandle, filepath, prefix);
+}
+static inline int CtlLoadSections(AFB_ApiT apiHandle, CtlConfigT *ctlHandle, CtlSectionT *sections)
+{
+ return CtlLoadSections_V3(apiHandle, ctlHandle, sections);
+}
+
+// ctl-event.c
+static inline int EventConfig(AFB_ApiT apihandle, CtlSectionT *section, json_object *actionsJ)
+{
+ return EventConfig_V3(apihandle, section, actionsJ);
+}
+
+// ctl-control.c
+static inline int ControlConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *actionsJ)
+{
+ return ControlConfig_V3(apiHandle, section, actionsJ);
+}
+
+// ctl-onload.c
+static inline int OnloadConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *actionsJ)
+{
+ return OnloadConfig_V3(apiHandle, section, actionsJ);
+}
+
+// ctl-plugin.c
+static inline int PluginConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *pluginsJ)
+{
+ return PluginConfig_V3(apiHandle, section, pluginsJ);
+}
+static inline int PluginGetCB(AFB_ApiT apiHandle, CtlActionT *action , json_object *callbackJ)
+{
+ return PluginGetCB_V3(apiHandle, action, callbackJ);
+}
+
+#endif
+#endif /* _CTL_CONFIG_INCLUDE_ */