communication: added sdbd_start protocol
authorGiWoong Kim <giwoong.kim@samsung.com>
Wed, 3 Jul 2013 02:22:19 +0000 (11:22 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Wed, 3 Jul 2013 02:22:19 +0000 (11:22 +0900)
added sdbd_start protocol

Change-Id: I0ff029b97fe0f28c9c409d4da4ffe40863d82de7
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/sdb.h
tizen/src/skin/client/src/org/tizen/emulator/skin/comm/ICommunicator.java
tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/SocketCommunicator.java
tizen/src/skin/maruskin_server.c
tizen/src/skin/maruskin_server.h

index e85a69b591472c6028f6e5c2537b234c5867193a..3737cffa809632f0aa700a3b2afecc9dd06b8809 100644 (file)
@@ -38,7 +38,6 @@ int get_sdb_base_port(void);
 int inet_strtoip(const char*  str, uint32_t  *ip);
 int socket_send(int fd, const void*  buf, int  buflen);
 void socket_close(int fd);
-void notify_sdb_daemon_start(void);
 int check_port_bind_listen(uint32_t port);
 int sdb_loopback_client(int port, int type);
 
index 725826d05d168568d4cff13fede90af19d38d843..fa8ca30371a9f019bbbac44e09521494c6191536 100644 (file)
@@ -266,6 +266,7 @@ public interface ICommunicator extends Runnable {
                BOOTING_PROGRESS((short) 5),
                BRIGHTNESS_VALUE((short) 6),
                SENSOR_DAEMON_START((short) 800),
+               SDB_DAEMON_START((short) 801),
                DRAW_FRAME((short) 900),
                SHUTDOWN((short) 999);
 
index 07bb4d4ed5ebacb1a4c1fc965124aa06e3df85df..11bb01b040b1015735fa29684c37e3d3c5a22cf3 100644 (file)
@@ -110,6 +110,7 @@ public class SocketCommunicator implements ICommunicator {
        private AtomicInteger heartbeatCount;
        private boolean isTerminated;
        private boolean isSensorDaemonStarted;
+       private boolean isSdbDaemonStarted;
        private boolean isRamdump;
        private TimerTask heartbeatExecutor;
        private Timer heartbeatTimer;
@@ -228,26 +229,28 @@ public class SocketCommunicator implements ICommunicator {
 
                        sendThread.start();
 
-                       int width = config.getArgInt( ArgsConstants.RESOLUTION_WIDTH );
-                       int height = config.getArgInt( ArgsConstants.RESOLUTION_HEIGHT );
-                       int scale = SkinUtil.getValidScale( config );
+                       int width = config.getArgInt(ArgsConstants.RESOLUTION_WIDTH);
+                       int height = config.getArgInt(ArgsConstants.RESOLUTION_HEIGHT);
+                       int scale = SkinUtil.getValidScale(config);
 //                     short rotation = config.getSkinPropertyShort( SkinPropertiesConstants.WINDOW_ROTATION,
 //                                     EmulatorConfig.DEFAULT_WINDOW_ROTATION );
                        // has to be portrait mode at first booting time
                        short rotation = EmulatorConfig.DEFAULT_WINDOW_ROTATION;
 
-                       StartData startData = new StartData(initialData, width, height, scale, rotation);
+                       StartData startData =
+                                       new StartData(initialData, width, height, scale, rotation);
                        logger.info("StartData" + startData);
 
                        sendToQEMU(SendCommand.SEND_START, startData, false);
 
-               } catch ( IOException e ) {
-                       logger.log( Level.SEVERE, e.getMessage(), e );
+               } catch (IOException e) {
+                       logger.log(Level.SEVERE, e.getMessage(), e);
                        terminate();
                        return;
                }
 
-               boolean ignoreHeartbeat = config.getArgBoolean( ArgsConstants.TEST_HEART_BEAT_IGNORE );
+               boolean ignoreHeartbeat =
+                               config.getArgBoolean(ArgsConstants.TEST_HEART_BEAT_IGNORE);
 
                if (ignoreHeartbeat) {
                        logger.info("Ignore Skin heartbeat.");
@@ -381,11 +384,20 @@ public class SocketCommunicator implements ICommunicator {
                                }
                                case SENSOR_DAEMON_START: {
                                        logger.info("received SENSOR_DAEMON_START from QEMU.");
+
                                        synchronized (this) {
                                                isSensorDaemonStarted = true;
                                        }
                                        break;
                                }
+                               case SDB_DAEMON_START: {
+                                       logger.info("received SDB_DAEMON_START from QEMU.");
+
+                                       synchronized (this) {
+                                               isSdbDaemonStarted = true;
+                                       }
+                                       break;
+                               }
                                case DRAW_FRAME: {
                                        //logger.info("received DRAW_FRAME from QEMU.");
 
@@ -644,6 +656,10 @@ public class SocketCommunicator implements ICommunicator {
                return isSensorDaemonStarted;
        }
 
+       public synchronized boolean isSdbDaemonStarted() {
+               return isSdbDaemonStarted;
+       }
+
        public synchronized void setRamdumpFlag(boolean flag) {
                isRamdump = flag;
        }
index ba1c07006896ccfe38d2e07590e916ec0d748a96..85a89373bfe0c0fbdb97edaecb2374bd70e25e7e 100644 (file)
@@ -126,6 +126,7 @@ enum {
     SEND_BOOTING_PROGRESS = 5,
     SEND_BRIGHTNESS_VALUE = 6,
     SEND_SENSOR_DAEMON_START = 800,
+    SEND_SDB_DAEMON_START = 801,
     SEND_DRAW_FRAME = 900,
     SEND_SHUTDOWN = 999,
 };
@@ -137,6 +138,7 @@ static int server_sock = 0;
 static int client_sock = 0;
 static int stop_server = 0;
 static int is_sensord_initialized = 0;
+static int is_sdbd_initialized = 0;
 static int ready_server = 0;
 static int ignore_heartbeat = 0;
 static int is_force_close_client = 0;
@@ -297,6 +299,20 @@ void notify_draw_frame(void)
     }
 }
 
+void notify_sdb_daemon_start(void)
+{
+    INFO("notify_sensor_daemon_start\n");
+
+    is_sdbd_initialized = 1;
+    if (client_sock) {
+        if (0 > send_skin_header_only(
+            client_sock, SEND_SDB_DAEMON_START, 1)) {
+
+            ERR("fail to send SEND_SDB_DAEMON_START to skin.\n");
+        }
+    }
+}
+
 void notify_sensor_daemon_start(void)
 {
     INFO("notify_sensor_daemon_start\n");
index 6ad2986e72aa10544ae648d1fd59f3d2b045cb6a..d9a202978fcaacd822eb187d63cc267db151dfc8 100644 (file)
@@ -37,6 +37,7 @@ void shutdown_skin_server(void);
 
 void notify_draw_frame(void);
 void notify_sensor_daemon_start(void);
+void notify_sdb_daemon_start(void);
 void notify_ramdump_completed(void);
 void notify_booting_progress(int progress_value);
 void notify_brightness(bool on);