*/
#include "mmifw.h"
-#include <rpc-port/rpc-port.h>
-#include "interface/mmifw_proxy.h"
+#include "mmifw-ipc.h"
#define ERR(x)
int MMI_EVENT_ACTION;
int MMI_EVENT_FEEDBACK;
-rpc_port_proxy_mmifw_h rpc_h;
-
static int _mmi_init_count = 0;
MMIFW_API int
MMIFW_API mmi_handle
mmi_instance_create(const char *app_id)
{
- mmi_handle h;
+ mmi_handle h = NULL;
+
+ h = (mmi_handle)calloc(1, sizeof(mmi_struct));
+
+ if (!h)
+ {
+ ERR("Failed to allocate memory for mmi_handle !\n");
+ return NULL;
+ }
+
+ if (mmi_ipc_init(app_id))
+ {
+ ERR("Failed to init mmifw ipc !\n");
+ goto err;
+ }
- (void) app_id;
+ h->rpc_h = mmi_ipc_get_rpc_h();
+ h->app_id = mmi_ipc_get_appid();
+ h->stub_appid = mmi_ipc_get_stub_appid();
+ h->uid = mmi_ipc_get_uid();
+ h->state = mmi_ipc_get_state();
return h;
+err:
+ if (h)
+ free(h);
+ return NULL;
}
MMIFW_API mmi_event_listener *
MMIFW_API mmi_result
mmi_request_send_get_focus(mmi_handle h)
{
- mmi_result res;
+ mmi_result res = MMI_RESULT_SUCCESS;
- (void) h;
+ if (!h)
+ {
+ ERR("Given mmi_handle is invalid !\n");
+ return MMI_RESULT_FAIL;
+ }
+ rpc_port_proxy_mmifw_invoke_get_focus(h->rpc_h, h->app_id);
return res;
}
MMIFW_API mmi_state
mmi_state_get_current_state(mmi_handle h)
{
- mmi_state state;
+ mmi_state state = MMI_STATE_NONE;
- (void) h;
+ if (!h)
+ {
+ ERR("Given mmi_handle is invalid !\n");
+ return state;
+ }
+ state = h->state;
return state;
}
MMIFW_API mmi_result
mmi_request_send_set_state(mmi_handle h, mmi_state state)
{
- mmi_result res;
+ mmi_result res = MMI_RESULT_SUCCESS;
- (void) h;
- (void) state;
+ if (!h)
+ {
+ ERR("Given mmi_handle is invalid !\n");
+ return MMI_RESULT_FAIL;
+ }
+ if (state == h->state)
+ {
+ ERR("Given state equals to the current state. Ignored !\n");
+ return res;
+ }
+
+ rpc_port_proxy_mmifw_invoke_set_state(h->rpc_h, h->app_id, state);
return res;
}
MMIFW_API void
mmi_instance_destroy(mmi_handle h)
{
- (void) h;
+ if (!h)
+ return;
+
+ mmi_ipc_shutdown();
+ free(h);
}
#define __MMIFW_H__
#include <Ecore.h>
-#include <rpc-port/rpc-port.h>
#include <mmifw-event-types.h>
#define MMIFW_API __attribute__ ((visibility("default")))
MMI_STATE_TERMINATION
} mmi_state;
-struct _mmi_struct
+typedef struct
{
mmifw_rpc_h rpc_h;
- const char *sender_id;
- bool connected;
+ const char *app_id;
+ const char *stub_appid;
int uid;
int state;
- const char *stub_appid;
-};
+} mmi_struct;
-typedef struct _mmi_struct* mmi_handle;
+typedef mmi_struct* mmi_handle;
#ifdef __cplusplus
extern "C" {