2 * Copyright © 2021 Samsung Electronics co., Ltd. All Rights Reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
27 #include <tzplatform_config.h>
30 #include <rpc-port-internal.h>
32 static rpc_port_proxy_mmi_h _rpc_h;
33 static const char* _stub_appid = "mmi-manager";
34 static int _connected = 0;
35 static mmi_state_e _state = MMI_STATE_NONE;
38 mmi_ipc_get_rpc_h(void)
43 mmi_state_e mmi_ipc_get_state(void)
49 mmi_ipc_is_connected(void)
51 return _connected ? true : false;
55 mmi_ipc_get_stub_appid(void)
60 static void _on_connected(rpc_port_proxy_mmi_h h, void *user_data)
69 static void _on_disconnected(rpc_port_proxy_mmi_h h, void *user_data)
75 static void _on_rejected(rpc_port_proxy_mmi_h h, void *user_data)
84 /* initialize handles */
88 rpc_port_proxy_mmi_callback_s callback = {
89 .connected = _on_connected,
90 .disconnected = _on_disconnected,
91 .rejected = _on_rejected
94 r = rpc_port_proxy_mmi_create(_stub_appid, &callback, NULL, &_rpc_h);
95 if (r != RPC_PORT_ERROR_NONE)
97 LOGE("Failed to create mmi proxy handle ! (error:%d)\n", r);
101 r = rpc_port_proxy_mmi_connect(_rpc_h);
102 if (r != RPC_PORT_ERROR_NONE)
104 LOGE("Failed to connect to %s ! (error:%d)\n", _stub_appid, r);
111 rpc_port_proxy_mmi_destroy(_rpc_h);
113 rpc_port_deregister_proc_info();
120 mmi_ipc_shutdown(void)
125 rpc_port_proxy_mmi_destroy(_rpc_h);
126 rpc_port_deregister_proc_info();
129 _state = MMI_STATE_NONE;