static void _on_connected(rpc_port_proxy_mmifw_h h, void *user_data)
{
int r;
+ mmifw_event_connection *ev = NULL;
- LOGI("...");
- _connected = 1;
+ ev = (mmifw_event_connection *)calloc(1, sizeof(mmifw_event_connection));
+
+ if (!ev)
+ {
+ LOGE("Failed to allocate memory for connection event !\n");
+ return;
+ }
focus_cb_h = rpc_port_mmifw_focus_event_cb_create(_focus_event_cb, false, NULL);
state_change_cb_h = rpc_port_mmifw_state_change_event_cb_create(_state_change_event_cb, false, NULL);
//TODO: Disconnect by destroying rpc_port_proxy_mmifw_h
return;
}
+
+ _connected = 1;
+ ev->connected = true;
+ ecore_event_add(MMI_EVENT_CONNECTION, ev, NULL, user_data);
+
+ LOGI("...");
}
static void _on_disconnected(rpc_port_proxy_mmifw_h h, void *user_data)
{
- LOGI("...");
+ mmifw_event_connection *ev = NULL;
+
+ ev = (mmifw_event_connection *)calloc(1, sizeof(mmifw_event_connection));
+
+ if (!ev)
+ {
+ LOGE("Failed to allocate memory for connection event !\n");
+ return;
+ }
+
_connected = 0;
+ ev->connected = false;
+ ecore_event_add(MMI_EVENT_CONNECTION, ev, NULL, user_data);
+
+ LOGI("...");
}
static void _on_rejected(rpc_port_proxy_mmifw_h h, void *user_data)
{
#include "mmifw.h"
#include "mmifw-ipc.h"
+#include "mmifw-dbg.h"
#define ERR(x)
+int MMI_EVENT_CONNECTION;
int MMI_EVENT_FOCUS;
int MMI_EVENT_STATE_CHANGE;
int MMI_EVENT_WAKE_UP;
listener_list = NULL;
}
+ MMI_EVENT_CONNECTION = ecore_event_type_new();
MMI_EVENT_FOCUS = ecore_event_type_new();
MMI_EVENT_STATE_CHANGE = ecore_event_type_new();
MMI_EVENT_WAKE_UP = ecore_event_type_new();
_mmi_init_count--;
+ MMI_EVENT_CONNECTION = -1;
MMI_EVENT_FOCUS = -1;
MMI_EVENT_STATE_CHANGE = -1;
MMI_EVENT_WAKE_UP = -1;
return MMI_RESULT_FAIL;
}
- rpc_port_proxy_mmifw_invoke_get_focus(h->rpc_h);
+ if (mmi_ipc_is_connected())
+ rpc_port_proxy_mmifw_invoke_get_focus(h->rpc_h);
+ else
+ {
+ ERR("Not connected yet !\n");
+ res = MMI_RESULT_FAIL;
+ }
+
+ LOGI("Get_focus request has been sent !\n");
+
return res;
}
#define MMIFW_API __attribute__ ((visibility("default")))
+MMIFW_API extern int MMI_EVENT_CONNECTION;
MMIFW_API extern int MMI_EVENT_FOCUS;
MMIFW_API extern int MMI_EVENT_STATE_CHANGE;
MMIFW_API extern int MMI_EVENT_WAKE_UP;