#include "mmi-provider-iface.h"
#include "mmi-manager-dbg.h"
+#include "mmi-common.h"
#include <Ecore.h>
#include <dirent.h>
#define PROVIDER_PATH "/lib/provider/"
Eina_List *_provider_list = NULL;
+Ecore_Event_Handler *_provider_event_handlers[4];
+
+static Eina_Bool
+_key_provider_event_cb(void *data EINA_UNUSED, int type, void *event)
+{
+ mmi_provider_event_key *ev = (mmi_provider_event_key *)event;
+
+ LOGI("[MMI_PROVIDER_EVENT_KEY] type:%d, timestamp:%d, duration:%d, confidence=%.2f\n",
+ ev->type, ev->timestamp, ev->duration, ev->confidence);
+ LOGI("... keycode:%d, key_down:%d, keyname=%s, source=%s\n",
+ ev->keycode, ev->key_down, ev->keyname, ev->source);
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_gesture_provider_event_cb(void *data EINA_UNUSED, int type, void *event)
+{
+ mmi_provider_event_gesture *ev = (mmi_provider_event_gesture *)event;
+
+ LOGI("[MMI_PROVIDER_EVENT_GESTURE] type:%d, timestamp:%d, duration:%d, confidence=%.2f\n",
+ ev->type, ev->timestamp, ev->duration, ev->confidence);
+ LOGI("... source=%s\n", ev->source);
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_voice_provider_event_cb(void *data EINA_UNUSED, int type, void *event)
+{
+ mmi_provider_event_voice *ev = (mmi_provider_event_voice *)event;
+
+ LOGI("[MMI_PROVIDER_EVENT_VOICE] type:%d, timestamp:%d, duration:%d, confidence=%.2f\n",
+ ev->type, ev->timestamp, ev->duration, ev->confidence);
+ LOGI("... cmd:%s, nargs:%d, source:%s\n", ev->cmd, ev->nargs, ev->source);
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_vision_provider_event_cb(void *data EINA_UNUSED, int type, void *event)
+{
+ mmi_provider_event_vision *ev = (mmi_provider_event_vision *)event;
+
+ LOGI("[MMI_PROVIDER_EVENT_VISION] type:%d, timestamp:%d, duration:%d, confidence=%.2f\n",
+ ev->type, ev->timestamp, ev->duration, ev->confidence);
+ LOGI("... cmd:%s, nargs:%d, source:%s\n", ev->cmd, ev->nargs, ev->source);
+
+ return ECORE_CALLBACK_PASS_ON;
+}
int
mmi_provider_set_op_mode_on_caps(unsigned long long caps, mmi_provider_op_mode mode)
closedir(dir);
}
+static void
+_event_handler_init()
+{
+ MMI_PROVIDER_EVENT_KEY = ecore_event_type_new();
+ MMI_PROVIDER_EVENT_GESTURE = ecore_event_type_new();
+ MMI_PROVIDER_EVENT_VOICE = ecore_event_type_new();
+ MMI_PROVIDER_EVENT_VISION = ecore_event_type_new();
+
+ LOGD("MMI_PROVIDER_EVENT_KEY=%d\n", MMI_PROVIDER_EVENT_KEY);
+ LOGD("MMI_PROVIDER_EVENT_GESTURE=%d\n", MMI_PROVIDER_EVENT_GESTURE);
+ LOGD("MMI_PROVIDER_EVENT_VOICE=%d\n", MMI_PROVIDER_EVENT_VOICE);
+ LOGD("MMI_PROVIDER_EVENT_VISION=%d\n", MMI_PROVIDER_EVENT_VISION);
+
+ //For debugging
+ _provider_event_handlers[0] = ecore_event_handler_add(MMI_PROVIDER_EVENT_KEY,
+ _key_provider_event_cb, NULL);
+ _provider_event_handlers[0] = ecore_event_handler_add(MMI_PROVIDER_EVENT_GESTURE,
+ _gesture_provider_event_cb, NULL);
+ _provider_event_handlers[0] = ecore_event_handler_add(MMI_PROVIDER_EVENT_VOICE,
+ _voice_provider_event_cb, NULL);
+ _provider_event_handlers[0] = ecore_event_handler_add(MMI_PROVIDER_EVENT_VISION,
+ _vision_provider_event_cb, NULL);
+}
+
+static void
+_event_handler_shutdown()
+{
+ //For debugging
+ ecore_event_handler_del(_provider_event_handlers[0]);
+ ecore_event_handler_del(_provider_event_handlers[1]);
+ ecore_event_handler_del(_provider_event_handlers[2]);
+ ecore_event_handler_del(_provider_event_handlers[3]);
+
+ MMI_PROVIDER_EVENT_KEY = -1;
+ MMI_PROVIDER_EVENT_GESTURE = -1;
+ MMI_PROVIDER_EVENT_VOICE = -1;
+ MMI_PROVIDER_EVENT_VISION = -1;
+
+ LOGD("MMI_PROVIDER_EVENT_KEY=%d\n", MMI_PROVIDER_EVENT_KEY);
+ LOGD("MMI_PROVIDER_EVENT_GESTURE=%d\n", MMI_PROVIDER_EVENT_GESTURE);
+ LOGD("MMI_PROVIDER_EVENT_VOICE=%d\n", MMI_PROVIDER_EVENT_VOICE);
+ LOGD("MMI_PROVIDER_EVENT_VISION=%d\n", MMI_PROVIDER_EVENT_VISION);
+}
+
void
modality_providers_init(void)
{
//Lookup and init modality providers
+ _event_handler_init();
_modality_providers_lookup();
}
void
modality_providers_shutdown(void)
{
+ _event_handler_shutdown();
+
//Do shutdown for intialized providers
if(!_provider_list)
return;