aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/facemgr/src/api.c
diff options
context:
space:
mode:
Diffstat (limited to 'ctrl/facemgr/src/api.c')
-rw-r--r--ctrl/facemgr/src/api.c56
1 files changed, 35 insertions, 21 deletions
diff --git a/ctrl/facemgr/src/api.c b/ctrl/facemgr/src/api.c
index 13b811288..18a25d6a1 100644
--- a/ctrl/facemgr/src/api.c
+++ b/ctrl/facemgr/src/api.c
@@ -20,6 +20,7 @@
#ifdef __ANDROID__
//#define WITH_ANDROID_UTILITY
+#define WITH_PRIORITY_CONTROLLER
#endif /* __ANDROID__ */
#include <assert.h>
@@ -85,6 +86,9 @@ extern interface_ops_t bonjour_ops;
#ifdef WITH_ANDROID_UTILITY
extern interface_ops_t android_utility_ops;
#endif /* WITH_ANDROID_UTILITY */
+#ifdef WITH_PRIORITY_CONTROLLER
+extern interface_ops_t priority_controller_ops;
+#endif
#ifdef WITH_EXAMPLE_DUMMY
extern interface_ops_t dummy_ops;
#endif
@@ -139,13 +143,16 @@ struct facemgr_s {
interface_t * au; /* android_utility */
#endif /* WITH_ANDROID_UTILITY */
+#ifdef WITH_PRIORITY_CONTROLLER
+ interface_t * pc;
+#endif
+
#ifdef __APPLE__
interface_t * nf; /* network_framework */
#endif /* __APPLE__ */
#ifdef __linux__
interface_t * nl; /* netlink */
-
/*
* We maintain a map of dynamically created bonjour interfaces, one for each
* found netdevice
@@ -542,26 +549,6 @@ facelet_cache_lookup(const facelet_set_t * facelet_cache, facelet_t * facelet,
facelet_t ***cached_facelets)
{
assert(facelet);
- if (!facelet_has_family(facelet))
- return 0;
-#if 0 // key is no more sufficient now that we support multiple faces per interface
- /*
- * If the facelet is uniquely identified by its key, it is used to perform
- * an efficient lookup directly...
- */
- if (facelet_has_key(facelet)) {
- facelet_t * found = NULL;
- if (facelet_set_get(facelet_cache, facelet, &found) < 0) {
- ERROR("[facelet_cache_lookup] Error during cache lookup");
- return -1;
- }
- if (!found)
- return 0;
- *cached_facelets = malloc(sizeof(facelet_t*));
- *cached_facelets[0] = found;
- return 1;
- }
-#endif
/* ...otherwise, we iterate over the facelet
* cache to find matching elements.
@@ -1865,6 +1852,15 @@ facemgr_bootstrap(facemgr_t * facemgr)
}
#endif /* WITH_ANDROID_UTILITY */
+#ifdef WITH_PRIORITY_CONTROLLER
+ INFO("[facemgr_bootstrap] registering priority_controller interface");
+ rc = interface_register(&priority_controller_ops);
+ if (rc < 0) {
+ ERROR("[facemgr_bootstrap] Error registering priority_controller interface");
+ goto ERR_REGISTER;
+ }
+#endif
+
#ifdef WITH_EXAMPLE_DUMMY
rc = interface_register(&dummy_ops);
if (rc < 0) {
@@ -1916,6 +1912,15 @@ facemgr_bootstrap(facemgr_t * facemgr)
}
#endif /* WITH_ANDROID_UTILITY */
+#ifdef WITH_PRIORITY_CONTROLLER
+ INFO("[facemgr_bootstrap] creating priority_controller interface");
+ rc = facemgr_create_interface(facemgr, "pc", "priority_controller", NULL, &facemgr->pc);
+ if (rc < 0) {
+ ERROR("Error creating 'Priority Controller' interface\n");
+ goto ERR_PC_CREATE;
+ }
+#endif
+
#ifdef WITH_EXAMPLE_DUMMY
rc = facemgr_create_interface(facemgr, "dummy0", "dummy", NULL, &facemgr->dummy);
if (rc < 0) {
@@ -1948,6 +1953,10 @@ ERR_DUMMY_CREATE:
facemgr_delete_interface(facemgr, facemgr->au);
ERR_AU_CREATE:
#endif /* WITH_ANDROID_UTILITY */
+#ifdef WITH_PRIORITY_CONTROLLER
+ facemgr_delete_interface(facemgr, facemgr->pc);
+ERR_PC_CREATE:
+#endif
#ifdef __linux__
facemgr_delete_interface(facemgr, facemgr->nl);
ERR_NL_CREATE:
@@ -1997,6 +2006,10 @@ void facemgr_stop(facemgr_t * facemgr)
facemgr_delete_interface(facemgr, facemgr->au);
#endif /* WITH_ANDROID_UTILITY */
+#ifdef WITH_PRIORITY_CONTROLLER
+ facemgr_delete_interface(facemgr, facemgr->pc);
+#endif
+
facemgr_delete_interface(facemgr, facemgr->hl);
#ifdef WITH_EXAMPLE_DUMMY
@@ -2103,3 +2116,4 @@ ERR:
free(facelet_array);
return rc;
}
+