net: Add checking network
authorMunkyu Im <munkyu.im@samsung.com>
Wed, 11 Feb 2015 05:56:23 +0000 (14:56 +0900)
committerMunkyu Im <munkyu.im@samsung.com>
Fri, 13 Mar 2015 07:02:24 +0000 (16:02 +0900)
If Emulator use bridged network,
it is not necessary to use adding port-forwarding of ECP Network tab.
So send message to ECP to recognize it.

Change-Id: I131f854a4ca59f6d6887ddeeeffd591bedcadcec
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
net/tap.c
tizen/src/ecs/ecs.h
tizen/src/ecs/ecs_msg_device.c
tizen/src/ui/menu/contextmenu.cpp

index bde6b58..7bd199c 100644 (file)
--- a/net/tap.c
+++ b/net/tap.c
@@ -43,6 +43,9 @@
 #include "net/tap.h"
 
 #include "net/vhost_net.h"
+#if defined(CONFIG_MARU)
+#include "tizen/src/emul_state.h"
+#endif
 
 typedef struct TAPState {
     NetClientState nc;
@@ -699,7 +702,9 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
     tap = opts->tap;
     queues = tap->has_queues ? tap->queues : 1;
     vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL;
-
+#if defined(CONFIG_MARU)
+    set_emul_tap_enable(true);
+#endif
     /* QEMU vlans does not support multiqueue tap, in this case peer is set.
      * For -netdev, peer is always NULL. */
     if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) {
index ae3e923..17d1393 100644 (file)
@@ -90,7 +90,8 @@ enum message_action {
     MSG_ACT_PRESSURE = 116,
     MSG_ACT_UV = 117,
     MSG_ACT_HRM = 118,
-    MSG_ACT_LOCATION = 120
+    MSG_ACT_LOCATION = 120,
+    MSG_ACT_NETBRIDGE = 123
 };
 
 #define TIMER_ALIVE_S           60
index 338560a..0f4d956 100644 (file)
@@ -400,6 +400,11 @@ bool msgproc_device_req(ECS_Client* ccli, ECS__DeviceReq* msg)
     if (!strcmp(cmd, MSG_TYPE_SENSOR)) {
         msgproc_device_req_sensor(ccli, msg, cmd);
     } else if (!strcmp(cmd, "Network")) {
+        if (msg->action == MSG_ACT_NETBRIDGE) {
+            make_send_device_ntf(cmd, is_emul_tap_enable(), msg->action, NULL);
+        } else {
+            LOG_SEVERE("unsupported action value: %d\n", msg->action);
+        }
         msgproc_device_req_network(ccli, msg);
     } else if (!strcmp(cmd, "TGesture")) {
         msgproc_device_req_tgesture(ccli, msg);
index b1d0bc2..6735cb2 100644 (file)
@@ -500,7 +500,12 @@ void ContextMenu::slotShell()
     }
 
     QString sdbPort = QString::number(get_device_serial_number());
-    QString sdbSerialName = "emulator-" + sdbPort;
+    QString sdbSerialName;
+    if (is_emul_tap_enable()) {
+        sdbSerialName = QString(get_emul_guest_ip());
+    } else {
+        sdbSerialName = "emulator-" + sdbPort;
+    }
 
     QString sdbPath = QCoreApplication::applicationDirPath();
 #ifdef CONFIG_WIN32
@@ -668,7 +673,6 @@ void ContextMenu::slotControlPanel()
     arguments << "-XstartOnFirstThread";
 #endif
     arguments << "-jar" << ecpPath << vmNameOpt << basePortOpt;
-
     qDebug() << command << arguments;
 
     try {