[Title] add Detail Info Dialog, adjust size of other dialogs
authorSon Hyunjun <hj79.son@samsung.com>
Thu, 29 Mar 2012 07:53:21 +0000 (16:53 +0900)
committerSon Hyunjun <hj79.son@samsung.com>
Thu, 29 Mar 2012 07:53:21 +0000 (16:53 +0900)
[Type] Feature
[Module]
[Priority] Major
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]

Change-Id: If10691ff107d63952b1aee8e5a7690396a2d1d5b

13 files changed:
tizen/src/emulator.c
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
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/client/src/org/tizen/emulator/skin/dialog/AboutDialog.java
tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/LicenseDialog.java
tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/SkinDialog.java
tizen/src/skin/client/src/org/tizen/emulator/skin/screenshot/ScreenShotDialog.java
tizen/src/skin/maruskin_operation.c
tizen/src/skin/maruskin_operation.h
tizen/src/skin/maruskin_server.c
tizen/src/skin/maruskin_server.h

index f64c686..8d0f521 100644 (file)
@@ -65,6 +65,10 @@ int tizen_base_port = 0;
 char tizen_target_path[MAXLEN] = {0, };
 char logpath[MAXLEN] = { 0, };
 
+static int skin_argc = 0;
+static char** skin_argv = NULL;
+static int qemu_argc = 0;
+static char** qemu_argv = NULL;
 
 void exit_emulator(void)
 {
@@ -77,11 +81,11 @@ void exit_emulator(void)
     SDL_Quit();
 }
 
-static void construct_main_window(int skin_argc, char* skin_argv[])
+static void construct_main_window(int skin_argc, char* skin_argv[], int qemu_argc, char* qemu_argv[] )
 {
     INFO("construct main window\n");
 
-    start_skin_server( skin_argc, skin_argv );
+    start_skin_server( skin_argc, skin_argv, qemu_argc, qemu_argv );
 #if 1
     if ( 0 > start_skin_client(skin_argc, skin_argv) ) {
         exit( -1 );
@@ -190,9 +194,6 @@ void extract_info(int qemu_argc, char** qemu_argv)
     tizen_base_port = get_sdb_base_port();
 }
 
-static int skin_argc = 0;
-static char** skin_argv = NULL;
-
 void prepare_maru(void)
 {
     INFO("Prepare maru specified feature\n");
@@ -201,7 +202,7 @@ void prepare_maru(void)
 
     INFO("call construct_main_window\n");
 
-    construct_main_window(skin_argc, skin_argv);
+    construct_main_window(skin_argc, skin_argv, qemu_argc, qemu_argv );
 
     //TODO get port number by args from emulator manager
     int guest_server_port = tizen_base_port + SDB_UDP_SENSOR_INDEX;
@@ -214,8 +215,6 @@ int qemu_main(int argc, char** argv, char** envp);
 
 int main(int argc, char* argv[])
 {
-    int qemu_argc = 0;
-    char** qemu_argv = NULL;
     
     parse_options(argc, argv, &skin_argc, &skin_argv, &qemu_argc, &qemu_argv);
     socket_init();
index 48962e4..06620fc 100644 (file)
@@ -86,6 +86,7 @@ import org.tizen.emulator.skin.dbi.ColorsType;
 import org.tizen.emulator.skin.dbi.RgbType;
 import org.tizen.emulator.skin.dbi.RotationType;
 import org.tizen.emulator.skin.dialog.AboutDialog;
+import org.tizen.emulator.skin.dialog.DetailInfoDialog;
 import org.tizen.emulator.skin.exception.ScreenShotException;
 import org.tizen.emulator.skin.image.ImageRegistry;
 import org.tizen.emulator.skin.image.ImageRegistry.IconName;
@@ -829,17 +830,20 @@ public class EmulatorSkin {
 
        private void addMenuItems( final Shell shell, final Menu menu ) {
 
-               final MenuItem deviceInfoItem = new MenuItem( menu, SWT.PUSH );
+               final MenuItem detailInfoItem = new MenuItem( menu, SWT.PUSH );
 
                String emulatorName = SkinUtil.makeEmulatorName( config );
-               deviceInfoItem.setText( emulatorName );
-               deviceInfoItem.setData( MENU_ITEM_IMAGE, imageRegistry.getIcon( IconName.DETAIL_INFO ) );
-               deviceInfoItem.addSelectionListener( new SelectionAdapter() {
+               detailInfoItem.setText( emulatorName );
+               detailInfoItem.setData( MENU_ITEM_IMAGE, imageRegistry.getIcon( IconName.DETAIL_INFO ) );
+               detailInfoItem.addSelectionListener( new SelectionAdapter() {
                        @Override
                        public void widgetSelected( SelectionEvent e ) {
                                if ( logger.isLoggable( Level.FINE ) ) {
-                                       logger.fine( "Open device info" );
+                                       logger.fine( "Open detail info" );
                                }
+                               String emulatorName = SkinUtil.makeEmulatorName( config );
+                               DetailInfoDialog detailInfoDialog = new DetailInfoDialog( shell, emulatorName, communicator, config );
+                               detailInfoDialog.open();
                        }
                } );
 
index 4800016..cfe4664 100644 (file)
@@ -152,6 +152,7 @@ public interface ICommunicator extends Runnable {
                OPEN_SHELL( (short)14 ),
                USB_KBD( (short)15 ),
                SCREEN_SHOT( (short)16 ),
+               DETAIL_INFO( (short)17 ),
                
                RESPONSE_HEART_BEAT( (short)900 ),
                CLOSE( (short)998 ),
@@ -188,6 +189,7 @@ public interface ICommunicator extends Runnable {
                
                HEART_BEAT( (short)1 ),
                SCREEN_SHOT_DATA( (short)2 ),
+               DETAIL_INFO_DATA( (short)3 ),
                SENSOR_DAEMON_START( (short)800 ),
                SHUTDOWN( (short)999 );
                
index 7f73707..01bd067 100644 (file)
@@ -237,7 +237,20 @@ public class SocketCommunicator implements ICommunicator {
                                                dataTransfer.notifyAll();
                                        }
 
-                                       logger.info( "finish receiving data from QEMU." );
+                                       logger.info( "finish receiving image data from QEMU." );
+
+                                       break;
+                               }
+                               case DETAIL_INFO_DATA: {
+                                       logger.info( "received DETAIL_INFO_DATA from QEMU." );
+
+                                       synchronized ( dataTransfer ) {
+                                               byte[] infoData = readData( dis, length );
+                                               dataTransfer.setData( infoData );
+                                               dataTransfer.notifyAll();
+                                       }
+
+                                       logger.info( "finish receiving info data from QEMU." );
 
                                        break;
                                }
index d75befb..ea39ac1 100644 (file)
@@ -74,7 +74,7 @@ public class AboutDialog extends SkinDialog {
        private Composite displayInfo( Composite parent ) {
 
                Composite composite = new Composite( parent, SWT.NONE );
-
+               
                composite.setLayout( new GridLayout( 1, false ) );
 
                Label titleLabel = new Label( composite, SWT.NONE );
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java
new file mode 100644 (file)
index 0000000..e36cd77
--- /dev/null
@@ -0,0 +1,322 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.skin.dialog;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map.Entry;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.tizen.emulator.skin.comm.ICommunicator.SendCommand;
+import org.tizen.emulator.skin.comm.sock.SocketCommunicator;
+import org.tizen.emulator.skin.comm.sock.SocketCommunicator.DataTranfer;
+import org.tizen.emulator.skin.config.EmulatorConfig;
+import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
+import org.tizen.emulator.skin.log.SkinLogger;
+import org.tizen.emulator.skin.util.SkinUtil;
+import org.tizen.emulator.skin.util.StringUtil;
+
+/**
+ * 
+ *
+ */
+public class DetailInfoDialog extends SkinDialog {
+
+       public final static int DETAIL_INFO_WAIT_INTERVAL = 1; // milli-seconds
+       public final static int DETAIL_INFO_WAIT_LIMIT = 3000; // milli-seconds
+       public final static String DATA_DELIMITER = "#";
+
+       private Logger logger = SkinLogger.getSkinLogger( DetailInfoDialog.class ).getLogger();
+
+       private SocketCommunicator communicator;
+       private EmulatorConfig config;
+
+       public DetailInfoDialog( Shell parent, String emulatorName, SocketCommunicator communicator, EmulatorConfig config ) {
+               super( parent, "Detail Info" + " - " + emulatorName, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE );
+               this.communicator = communicator;
+               this.config = config;
+       }
+
+       @Override
+       protected Composite createArea( Composite parent ) {
+
+               String infoData = queryData();
+               if ( StringUtil.isEmpty( infoData ) ) {
+                       return null;
+               }
+
+               Composite composite = new Composite( parent, SWT.NONE );
+               composite.setLayout( new FillLayout() );
+
+               Table table = new Table( composite, SWT.BORDER | SWT.MULTI );
+               table.setHeaderVisible( true );
+               table.setLinesVisible( true );
+
+               TableColumn[] column = new TableColumn[2];
+
+               column[0] = new TableColumn( table, SWT.LEFT );
+               column[0].setText( "Name" );
+
+               column[1] = new TableColumn( table, SWT.LEFT );
+               column[1].setText( "Value" );
+
+               int index = 0;
+
+               LinkedHashMap<String, String> refinedData = composeAndParseData( infoData );
+               Iterator<Entry<String, String>> iterator = refinedData.entrySet().iterator();
+
+               while ( iterator.hasNext() ) {
+
+                       Entry<String, String> entry = iterator.next();
+
+                       TableItem tableItem = new TableItem( table, SWT.NONE, index );
+                       tableItem.setText( new String[] { entry.getKey(), entry.getValue() } );
+                       index++;
+
+               }
+
+               column[0].pack();
+               column[1].pack();
+
+               table.pack();
+
+               return composite;
+
+       }
+
+       @Override
+       protected void setShellSize() {
+               shell.setSize( (int) ( 350 * 1.618 ), 350 );
+       }
+
+       private String queryData() {
+
+               String infoData = null;
+
+               communicator.sendToQEMU( SendCommand.DETAIL_INFO, null, true );
+               DataTranfer dataTranfer = communicator.getDataTranfer();
+
+               int count = 0;
+               boolean isFail = false;
+               byte[] receivedData = null;
+               int limitCount = DETAIL_INFO_WAIT_LIMIT / DETAIL_INFO_WAIT_INTERVAL;
+
+               synchronized ( dataTranfer ) {
+
+                       while ( dataTranfer.isTransferState() ) {
+
+                               if ( limitCount < count ) {
+                                       isFail = true;
+                                       break;
+                               }
+
+                               try {
+                                       dataTranfer.wait( DETAIL_INFO_WAIT_INTERVAL );
+                               } catch ( InterruptedException e ) {
+                                       logger.log( Level.SEVERE, e.getMessage(), e );
+                               }
+
+                               count++;
+                               logger.info( "wait detail info data... count:" + count );
+
+                       }
+
+                       receivedData = dataTranfer.getReceivedData();
+
+               }
+
+               if ( isFail ) {
+
+                       logger.severe( "Fail to get detail info from server." );
+                       SkinUtil.openMessage( shell, null, "Internal error.", SWT.ICON_ERROR, config );
+
+               } else {
+
+                       if ( null != receivedData ) {
+                               try {
+                                       infoData = new String( receivedData, "UTF-8" );
+                               } catch ( UnsupportedEncodingException e ) {
+                                       e.printStackTrace();
+                               }
+                       } else {
+                               logger.severe( "Received detail info is null" );
+                               SkinUtil.openMessage( shell, null, "Internal error.", SWT.ICON_ERROR, config );
+                       }
+
+               }
+
+               return infoData;
+
+       }
+
+       private LinkedHashMap<String, String> composeAndParseData( String infoData ) {
+
+               logger.info( "Received infoData:" + infoData );
+
+               String cpu = "";
+               String ram = "";
+               String sdPath = "";
+               String imagePath = "";
+               boolean isFirstDrive = true;
+               String sharedPath = "";
+
+               String[] split = infoData.split( DATA_DELIMITER );
+
+               for ( int i = 0; i < split.length; i++ ) {
+
+                       if ( 0 == i ) {
+
+                               String exec = split[i].trim().toLowerCase();
+                               logger.info( "exec:" + exec );
+                               if ( exec.endsWith( "x86" ) ) {
+                                       cpu = "X86";
+                               } else if ( exec.endsWith( "arm" ) ) {
+                                       cpu = "ARM";
+                               }
+
+                       } else {
+
+                               if ( i + 1 <= split.length ) {
+
+                                       String arg = split[i].trim();
+
+                                       if ( "-m".equals( arg ) ) {
+
+                                               ram = split[i + 1].trim();
+                                               logger.info( "ram:" + ram );
+
+                                       } else if ( "-drive".equals( arg ) ) {
+
+                                               // arg : file=/home/xxx/.tizen_vms/x86/xxx/emulimg-emulator.x86
+                                               arg = split[i + 1].trim();
+
+                                               if ( arg.startsWith( "file=" ) ) {
+
+                                                       String[] sp = arg.split( "," );
+                                                       String[] sp2 = sp[0].split( "=" );
+                                                       String drivePath = sp2[sp2.length - 1];
+
+                                                       if ( isFirstDrive ) {
+                                                               imagePath = drivePath;
+                                                               isFirstDrive = false;
+                                                       } else {
+                                                               sdPath = drivePath;
+                                                       }
+
+                                               }
+
+                                       } else if ( "-virtfs".equals( arg ) ) {
+
+                                               // arg : local,path=/home/xxx/xxx/xxx,security_model=none,mount_tag=fileshare
+                                               arg = split[i + 1].trim();
+                                               String[] sp = arg.split( "," );
+
+                                               if ( 1 < sp.length ) {
+                                                       int spIndex = sp[1].indexOf( "=" );
+                                                       sharedPath = sp[1].substring( spIndex + 1, sp[1].length() );
+                                               }
+
+                                       }
+
+                               }
+
+                       }
+
+               }
+
+               LinkedHashMap<String, String> result = new LinkedHashMap<String, String>();
+
+               result.put( "Name", SkinUtil.getVmName( config ) );
+               result.put( "CPU", cpu );
+
+               String width = config.getArg( ArgsConstants.RESOLUTION_WIDTH );
+               String height = config.getArg( ArgsConstants.RESOLUTION_HEIGHT );
+               result.put( "Resolution", width + "x" + height );
+               result.put( "RAM", ram );
+
+               if ( StringUtil.isEmpty( sdPath ) ) {
+                       result.put( "SD Card", "Not Supported" );
+                       result.put( "SD Path", "None" );
+               } else {
+                       result.put( "SD Card", "Supported" );
+                       result.put( "SD Path", sdPath );
+               }
+
+               if ( StringUtil.isEmpty( imagePath ) ) {
+                       result.put( "Image Path", "Not identified" );                   
+               }else {
+                       result.put( "Image Path", imagePath );                  
+               }
+
+               if ( StringUtil.isEmpty( sharedPath ) ) {
+                       result.put( "Shared Path", "None" );
+               }else {
+                       result.put( "Shared Path", sharedPath );
+               }
+
+               return result;
+
+       }
+
+       protected void createButtons( Composite parent ) {
+               super.createButtons( parent );
+
+               Button closeButton = createButton( parent, "Close" );
+
+               GridData gd = new GridData();
+               gd.grabExcessHorizontalSpace = true;
+               gd.horizontalAlignment = SWT.RIGHT;
+               closeButton.setLayoutData( gd );
+
+               closeButton.setFocus();
+
+               closeButton.addSelectionListener( new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected( SelectionEvent e ) {
+                               DetailInfoDialog.this.shell.close();
+                       }
+               } );
+
+       };
+
+}
index 7080f9a..3cf06a8 100644 (file)
@@ -55,32 +55,25 @@ import org.tizen.emulator.skin.util.StringUtil;
 public class LicenseDialog extends SkinDialog {
 
        public static final String LICENSE_FILE_PATH = "../license/Open_Source_Announcement.txt";
-       
+
        private Logger logger = SkinLogger.getSkinLogger( LicenseDialog.class ).getLogger();
 
        public LicenseDialog( Shell parent, String title ) {
-               // FIXME resizable
-               // super( parent, title, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.MAX | SWT.RESIZE );
-               super( parent, title, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+               super( parent, title, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE );
        }
 
        @Override
        protected Composite createArea( Composite parent ) {
 
-               shell.setSize( 400, 300 );
-
                Composite composite = new Composite( parent, SWT.NONE );
                composite.setLayout( new GridLayout() );
 
                final Text text = new Text( composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI );
-               GridData gridData = new GridData( GridData.FILL_BOTH );
-               gridData.widthHint = (int) ( 400 * 1.618 );
-               gridData.heightHint = 400;
+               GridData gridData = new GridData( SWT.FILL, SWT.FILL, true, true );
                text.setLayoutData( gridData );
 
                text.setEditable( false );
                text.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
-
                String license = StringUtil.nvl( getLicense() );
                text.setText( license );
 
@@ -89,6 +82,11 @@ public class LicenseDialog extends SkinDialog {
        }
 
        @Override
+       protected void setShellSize() {
+               shell.setSize( (int) ( 400 * 1.618 ), 400 );
+       }
+
+       @Override
        protected void createButtons( Composite parent ) {
                super.createButtons( parent );
 
index 0cb6fd2..9833da0 100644 (file)
@@ -53,14 +53,14 @@ public abstract class SkinDialog extends Dialog {
        private Shell parent;
        private String title;
        private int style;
-
+       
        public SkinDialog( Shell parent, String title, int style ) {
                super( parent, style );
                this.parent = parent;
                this.title = title;
                this.style = style;
        }
-
+       
        public void open() {
 
                shell = new Shell( parent, style );
@@ -71,13 +71,14 @@ public abstract class SkinDialog extends Dialog {
                shell.setLayout( new GridLayout( 1, true ) );
 
                Composite parent = new Composite( shell, SWT.NONE );
+               parent.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
                GridLayout gridLayout = new GridLayout( 1, true );
                gridLayout.marginWidth = 20;
                parent.setLayout( gridLayout );
 
                Composite composite = new Composite( parent, SWT.NONE );
-               composite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
-               composite.setLayout( new GridLayout( 1, true ) );
+               composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+               composite.setLayout( new FillLayout( SWT.VERTICAL ) );
 
                Composite area = createArea( composite );
                if ( null == area ) {
@@ -87,13 +88,15 @@ public abstract class SkinDialog extends Dialog {
                isReady = true;
 
                buttonComposite = new Composite( parent, SWT.NONE );
-               buttonComposite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+               buttonComposite.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
                buttonComposite.setLayout( new FillLayout( SWT.HORIZONTAL ) );
 
                createButtons( buttonComposite );
                
                shell.pack();
 
+               setShellSize();
+               
                if ( !isReady ) {
                        return;
                }
@@ -108,6 +111,9 @@ public abstract class SkinDialog extends Dialog {
 
        }
 
+       protected void setShellSize() {
+       }
+       
        protected abstract Composite createArea( Composite parent );
 
        protected void createButtons( Composite parent ) {
index c205ad0..2b7270d 100644 (file)
@@ -348,7 +348,7 @@ public class ScreenShotDialog {
        private void makeMenuBar( final Shell shell ) {
 
                ToolBar toolBar = new ToolBar( shell, SWT.HORIZONTAL );
-               GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
+               GridData gridData = new GridData( GridData.FILL_HORIZONTAL, GridData.CENTER, true, false );
                toolBar.setLayoutData( gridData );
                
                ToolItem saveItem = new ToolItem( toolBar, SWT.FLAT );
index 68b18cb..826baa2 100644 (file)
@@ -48,6 +48,8 @@ MULTI_DEBUG_CHANNEL(qemu, skin_operation);
 #define RESUME_KEY_SEND_INTERVAL 500 // milli-seconds
 #define CLOSE_POWER_KEY_INTERVAL 1200 // milli-seconds
 
+#define DATA_DELIMITER "#"
+
 void start_display( int handle_id, int lcd_size_width, int lcd_size_height, double scale_factor, short rotation_type )
 {
     INFO( "start_display handle_id:%d, lcd size:%dx%d, scale_factor:%lf, rotation_type:%d\n",
@@ -259,9 +261,45 @@ void free_screenshot_info( QemuSurfaceInfo* info ) {
     }
 }
 
-void open_shell(void)
-{
-    //TODO
+char* get_detail_info( int qemu_argc, char** qemu_argv ) {
+
+    int i;
+    int total_len = 0;
+
+    int delimiter_len = strlen( DATA_DELIMITER );
+
+    for ( i = 0; i < qemu_argc; i++ ) {
+        total_len += strlen( qemu_argv[i] );
+        total_len += delimiter_len;
+    }
+
+    char* info_data = g_malloc0( total_len );
+
+    int len = 0;
+    total_len = 0;
+
+    for ( i = 0; i < qemu_argc; ++i ) {
+
+        len = strlen( qemu_argv[i] );
+        sprintf( info_data + total_len, "%s", qemu_argv[i] );
+        sprintf( info_data + total_len + len, "%s", DATA_DELIMITER );
+
+        total_len += len;
+        total_len += delimiter_len;
+
+    }
+
+    return info_data;
+
+}
+
+void free_detail_info( char* detail_info ) {
+    if ( detail_info ) {
+        g_free( detail_info );
+    }
+}
+
+void open_shell( void ) {
 }
 
 void onoff_usb_kbd( int on )
index dc01472..b9c771a 100644 (file)
@@ -50,6 +50,10 @@ void do_rotation_event( int rotation_type );
 
 QemuSurfaceInfo* get_screenshot_info( void );
 
+char* get_detail_info( int qemu_argc, char** qemu_argv );
+
+void free_detail_info( char* detail_info );
+
 void free_screenshot_info( QemuSurfaceInfo* );
 
 void open_shell(void);
index cdc44dd..1d841c5 100644 (file)
@@ -76,6 +76,7 @@ enum {
     RECV_OPEN_SHELL = 14,
     RECV_USB_KBD = 15,
     RECV_SCREEN_SHOT = 16,
+    RECV_DETAIL_INFO = 17,
     RECV_RESPONSE_HEART_BEAT = 900,
     RECV_CLOSE = 998,
     RECV_RESPONSE_SHUTDOWN = 999,
@@ -84,6 +85,7 @@ enum {
 enum {
     SEND_HEART_BEAT = 1,
     SEND_SCREEN_SHOT = 2,
+    SEND_DETAIL_INFO = 3,
     SEND_SENSOR_DAEMON_START = 800,
     SEND_SHUTDOWN = 999,
 };
@@ -103,6 +105,9 @@ static pthread_mutex_t mutex_heartbeat = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t cond_heartbeat = PTHREAD_COND_INITIALIZER;
 static pthread_mutex_t mutex_recv_heartbeat_count = PTHREAD_MUTEX_INITIALIZER;
 
+static int qmu_argc = 0;
+static char** qmu_argv = NULL;
+
 static void* run_skin_server( void* args );
 static int recv_n( int client_sock, char* read_buf, int recv_len );
 static int send_skin_header_only( int client_sock, short send_cmd );
@@ -113,7 +118,7 @@ static void* do_heart_beat( void* args );
 static int start_heart_beat( int client_sock );
 static void stop_heart_beat( void );
 
-int start_skin_server( int argc, char** argv ) {
+int start_skin_server( int argc, char** argv, int qemu_argc, char** qemu_argv ) {
 
     int i;
     for( i = 0; i < argc; i++ ) {
@@ -145,6 +150,9 @@ int start_skin_server( int argc, char** argv ) {
 
     INFO( "ignore_heartbeat:%d\n", ignore_heartbeat );
 
+    qmu_argc = qemu_argc;
+    qmu_argv = qemu_argv;
+
     QemuThread qemu_thread;
 
     qemu_thread_create( &qemu_thread, run_skin_server, NULL );
@@ -531,6 +539,16 @@ static void* run_skin_server( void* args ) {
 
                     break;
                 }
+                case RECV_DETAIL_INFO: {
+                    log_cnt += sprintf( log_buf + log_cnt, "RECV_DETAIL_INFO ==\n" );
+                    TRACE( log_buf );
+
+                    char* info_data = get_detail_info( qmu_argc, qmu_argv );
+                    int len = strlen( info_data );
+                    send_skin_data( client_sock, SEND_DETAIL_INFO, (unsigned char*)info_data, len, 0 );
+                    free_detail_info( info_data );
+                    break;
+                }
                 case RECV_RESPONSE_HEART_BEAT: {
                     log_cnt += sprintf( log_buf + log_cnt, "RECV_RESPONSE_HEART_BEAT ==\n" );
                     TRACE( log_buf );
index 4443d2d..aa31e95 100644 (file)
@@ -30,7 +30,7 @@
 #ifndef MARUSKIN_SERVER_H_
 #define MARUSKIN_SERVER_H_
 
-int start_skin_server( int argc, char** argv );
+int start_skin_server( int argc, char** argv, int qemu_argc, char** qemu_argv );
 void shutdown_skin_server( void );
 void notify_sensor_daemon_start( void );
 int is_ready_skin_server( void );