Use binding version to handle dynapi 67/15167/2
authorJonathan Aillet <jonathan.aillet@iot.bzh>
Tue, 10 Jul 2018 08:29:11 +0000 (10:29 +0200)
committerJonathan Aillet <jonathan.aillet@iot.bzh>
Tue, 10 Jul 2018 09:01:29 +0000 (09:01 +0000)
Use binding version to define dynamic api debug messages function.
It is also cleaner to define binding version directly into
repository cmake than into a header like before this commit.

Change-Id: Ia14f635a7a2cec05c29f27ee4ce645711a8574a4
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
filescan-utils.c
filescan-utils.h

index a6111c1..6b3cf65 100644 (file)
@@ -152,7 +152,7 @@ char* GetBindingDirPath(struct afb_dynapi* dynapi)
     char retdir[CONTROL_MAXPATH_LEN];
     ssize_t len;
 
-#ifdef USE_API_DYN
+#if((AFB_BINDING_VERSION == 0 || AFB_BINDING_VERSION == 3) && defined(AFB_BINDING_WANT_DYNAPI))
     if (!dynapi)
         return NULL;
     sprintf(fd_link, "/proc/self/fd/%d", afb_dynapi_rootdir_get_fd(dynapi));
index 906d92c..3e1dba6 100644 (file)
     extern "C" {
 #endif
 
-// hack waiting for official V3 API
-#ifdef USE_API_DYN
-    #define AFB_BINDING_VERSION 0
-    #define AFB_BINDING_WANT_DYNAPI
-    #include <afb/afb-binding.h>
+#include <afb/afb-binding.h>
+
+#if((AFB_BINDING_VERSION == 0 || AFB_BINDING_VERSION == 3) && defined(AFB_BINDING_WANT_DYNAPI))
     extern  afb_dynapi *AFB_default;
     #define AFB_DEBUG(...) AFB_DYNAPI_DEBUG(AFB_default, __VA_ARGS__)
-#else
-    #define AFB_BINDING_VERSION 2
-    #include <afb/afb-binding.h>
 #endif
 
 #include <json-c/json.h>