summaryrefslogtreecommitdiffstats
path: root/ctrl/facemgr/src/interface.c
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-10-07 09:52:33 +0200
committerJordan Augé <jordan.auge+fdio@cisco.com>2019-10-07 15:55:42 +0200
commit6b84ec54083da9911f5ad4816d0eb4f4745afad4 (patch)
treee4296ebb218fff02dc0bbea73ce1c8d12aba7bcc /ctrl/facemgr/src/interface.c
parent85a791ac2cdd35d79c00141e748b4c68fbdafb0d (diff)
[HICN-298] Release new hICN app for Android
Change-Id: I43adc62fadf00690b687078d739788dffdc5e566 Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'ctrl/facemgr/src/interface.c')
-rw-r--r--ctrl/facemgr/src/interface.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/ctrl/facemgr/src/interface.c b/ctrl/facemgr/src/interface.c
index af9f666a7..3e6bc0854 100644
--- a/ctrl/facemgr/src/interface.c
+++ b/ctrl/facemgr/src/interface.c
@@ -20,12 +20,13 @@
#include <stdlib.h>
#include <string.h>
-#include "event.h"
-#include "face_rules.h"
+#include "facelet.h"
#include "interface.h"
-#include "interface_ops_map.h"
#include "util/map.h"
+TYPEDEF_MAP_H(interface_ops_map, const char *, const interface_ops_t *);
+TYPEDEF_MAP(interface_ops_map, const char *, const interface_ops_t *, strcmp, string_snprintf, generic_snprintf);
+
static interface_ops_map_t * interface_ops_map = NULL;
int
@@ -34,19 +35,19 @@ interface_register(const interface_ops_t * ops)
if (!interface_ops_map) {
interface_ops_map = interface_ops_map_create();
if (!interface_ops_map)
- return FACEMGR_FAILURE;
+ return -1;
}
interface_ops_map_add(interface_ops_map, ops->type, ops);
- return FACEMGR_SUCCESS;
+ return 0;
}
interface_t *
interface_create(const char * name, const char * type)
{
- interface_ops_t * ops;
+ const interface_ops_t * ops = NULL;
int rc = interface_ops_map_get(interface_ops_map, type, &ops);
- if (FACEMGR_IS_ERROR(rc)) {
+ if (rc < 0) {
printf("Interface type not found %s\n", type);
return NULL;
}
@@ -80,25 +81,25 @@ _interface_set_callback(interface_t * interface, callback_t callback, void * cal
}
int
-interface_initialize(interface_t * interface, struct face_rules_s * rules)
+interface_initialize(interface_t * interface, void * cfg)
{
if (!interface->ops->initialize)
- return FACEMGR_FAILURE;
- return interface->ops->initialize(interface, rules, &interface->data);
+ return -1;
+ return interface->ops->initialize(interface, cfg);
}
int
interface_finalize(interface_t * interface)
{
if (!interface->ops->finalize)
- return FACEMGR_FAILURE;
+ return -1;
return interface->ops->finalize(interface);
}
int
-interface_on_event(interface_t * interface, const event_t * event)
+interface_on_event(interface_t * interface, const facelet_t * facelet)
{
if (!interface->ops->on_event)
- return FACEMGR_FAILURE;
- return interface->ops->on_event(interface, event);
+ return -1;
+ return interface->ops->on_event(interface, facelet);
}