Emulator can notify the booting progress to skin.
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
MouseButtonType( short value ) {
this.value = value;
}
+
public short value() {
return this.value;
}
+
public static MouseButtonType getValue( String val ) {
MouseButtonType[] values = MouseButtonType.values();
for (int i = 0; i < values.length; i++) {
}
throw new IllegalArgumentException( val );
}
+
public static MouseButtonType getValue( short val ) {
MouseButtonType[] values = MouseButtonType.values();
for (int i = 0; i < values.length; i++) {
MouseEventType( short value ) {
this.value = value;
}
+
public short value() {
return this.value;
}
+
public static MouseEventType getValue( String val ) {
MouseEventType[] values = MouseEventType.values();
for (int i = 0; i < values.length; i++) {
}
throw new IllegalArgumentException( val );
}
+
public static MouseEventType getValue( short val ) {
MouseEventType[] values = MouseEventType.values();
for (int i = 0; i < values.length; i++) {
KeyEventType( short value ) {
this.value = value;
}
+
public short value() {
return this.value;
}
+
public static KeyEventType getValue( String val ) {
KeyEventType[] values = KeyEventType.values();
for (int i = 0; i < values.length; i++) {
}
throw new IllegalArgumentException( val );
}
+
public static KeyEventType getValue( short val ) {
KeyEventType[] values = KeyEventType.values();
for (int i = 0; i < values.length; i++) {
this.id = id;
this.angle = ratio;
}
+
public String value() {
return this.value;
}
+
public int angle() {
return this.angle;
}
+
public short id() {
return this.id;
}
}
public enum SendCommand {
-
+ /* This values must match the QEMU definitions */
+
SEND_START( (short)1 ),
SEND_MOUSE_EVENT( (short)10 ),
SendCommand( short value ) {
this.value = value;
}
+
public short value() {
return this.value;
}
+
public static SendCommand getValue( String val ) {
SendCommand[] values = SendCommand.values();
for (int i = 0; i < values.length; i++) {
}
throw new IllegalArgumentException( val );
}
+
public static SendCommand getValue( short val ) {
SendCommand[] values = SendCommand.values();
for (int i = 0; i < values.length; i++) {
}
public enum ReceiveCommand {
-
- HEART_BEAT( (short)1 ),
- SCREEN_SHOT_DATA( (short)2 ),
- DETAIL_INFO_DATA( (short)3 ),
- RAMDUMP_COMPLETE( (short)4 ),
- SENSOR_DAEMON_START( (short)800 ),
- SHUTDOWN( (short)999 );
-
+ /* This values must match the QEMU definitions */
+
+ HEART_BEAT((short) 1),
+ SCREEN_SHOT_DATA((short) 2),
+ DETAIL_INFO_DATA((short) 3),
+ RAMDUMP_COMPLETE((short) 4),
+ BOOTING_PROGRESS((short) 5),
+ SENSOR_DAEMON_START((short) 800),
+ SHUTDOWN((short) 999);
+
private short value;
ReceiveCommand( short value ) {
this.value = value;
}
+
public short value() {
return this.value;
}
+
public static ReceiveCommand getValue( String val ) {
ReceiveCommand[] values = ReceiveCommand.values();
for (int i = 0; i < values.length; i++) {
}
throw new IllegalArgumentException( val );
}
+
public static ReceiveCommand getValue( short val ) {
ReceiveCommand[] values = ReceiveCommand.values();
for (int i = 0; i < values.length; i++) {
private DataTranfer screenShotDataTransfer;
private DataTranfer detailInfoTransfer;
+ private DataTranfer progressDataTransfer;
private Thread sendThread;
private LinkedList<SkinSendData> sendQueue;
this.detailInfoTransfer.sleep = DETAIL_INFO_WAIT_INTERVAL;
this.detailInfoTransfer.maxWaitTime = DETAIL_INFO_WAIT_LIMIT;
- this.heartbeatCount = new AtomicInteger( 0 );
+ this.progressDataTransfer = new DataTranfer();
+ this.progressDataTransfer.sleep = DETAIL_INFO_WAIT_INTERVAL;
+ this.progressDataTransfer.maxWaitTime = DETAIL_INFO_WAIT_LIMIT;
+
+ this.heartbeatCount = new AtomicInteger(0);
this.heartbeatExecutor = Executors.newSingleThreadScheduledExecutor();
try {
setRamdumpFlag(false);
break;
}
+ case BOOTING_PROGRESS: {
+ logger.info("received BOOTING_PROGRESS from QEMU.");
+ receiveData(progressDataTransfer, length);
+
+ byte[] receivedData = getReceivedData(progressDataTransfer);
+ if (null != receivedData) {
+ String strValue = new String(receivedData, 0, length - 1);
+
+ int value = 0;
+ try {
+ value = Integer.parseInt(strValue);
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ }
+
+ /* draw progress bar */
+ if (skin.bootingProgress != null) {
+ skin.bootingProgress.setSelection(value);
+ }
+ }
+ //TODO: resetDataTransfer(progressDataTransfer)
+
+ break;
+ }
case SENSOR_DAEMON_START: {
logger.info( "received SENSOR_DAEMON_START from QEMU." );
synchronized ( this ) {
package org.tizen.emulator.skin.window;
+import java.util.logging.Logger;
+
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.skin.dialog.DetailInfoDialog;
+import org.tizen.emulator.skin.log.SkinLogger;
public class CustomProgressBar extends Canvas {
+ private Logger logger =
+ SkinLogger.getSkinLogger(CustomProgressBar.class).getLogger();
+
+ private Composite parent;
private int selection = 0;
public CustomProgressBar(final Composite parent, int style) {
super(parent, style);
+ this.parent = parent;
+
this.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
}
selection = value;
- redraw();
+ logger.info("progress : " + selection);
+
+ parent.getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ redraw();
+ }
+ });
}
public int getSelection() {
{
INFO("dump guest memory!\n");
- //TODO:
+ /* TODO: */
}
void request_close(void)
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
+
+#define socket_error() WSAGetLastError()
+
#else
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
+
+#define socket_error() errno
+
#endif
#include "debug_ch.h"
#define SKIN_CONFIG_PROP ".skinconfig.properties"
enum {
+ /* This values must match the Java definitions
+ in Skin process */
+
RECV_START = 1,
RECV_MOUSE_EVENT = 10,
RECV_KEY_EVENT = 11,
};
enum {
+ /* This values must match the Java definitions
+ in Skin process */
+
SEND_HEART_BEAT = 1,
SEND_SCREEN_SHOT = 2,
SEND_DETAIL_INFO = 3,
SEND_RAMDUMP_COMPLETE = 4,
+ SEND_BOOTING_PROGRESS = 5,
SEND_SENSOR_DAEMON_START = 800,
SEND_SHUTDOWN = 999,
};
}
-void notify_sensor_daemon_start( void ) {
- INFO( "notify_sensor_daemon_start\n" );
+void notify_sensor_daemon_start(void)
+{
+ INFO("notify_sensor_daemon_start\n");
+
is_sensord_initialized = 1;
- if ( client_sock ) {
- if ( 0 > send_skin_header_only( client_sock, SEND_SENSOR_DAEMON_START, 1 ) ) {
- ERR( "fail to send SEND_SENSOR_DAEMON_START to skin.\n" );
+ if (client_sock) {
+ if (0 > send_skin_header_only(
+ client_sock, SEND_SENSOR_DAEMON_START, 1)) {
+
+ ERR("fail to send SEND_SENSOR_DAEMON_START to skin.\n");
}
}
}
INFO("ramdump completed!\n");
if (client_sock) {
- if (0 > send_skin_header_only( client_sock, SEND_RAMDUMP_COMPLETE, 1)) {
+ if (0 > send_skin_header_only(
+ client_sock, SEND_RAMDUMP_COMPLETE, 1)) {
+
ERR("fail to send SEND_RAMDUMP_COMPLETE to skin.\n");
}
}
}
+void notify_booting_progress(int progress_value)
+{
+#define PROGRESS_DATA_LENGTH 4
+
+ char progress_data[PROGRESS_DATA_LENGTH] = { 0, };
+ int len = 1;
+
+ INFO("notify_booting_progress\n");
+
+ /* percentage */
+ if (progress_value < 0) {
+ progress_value = 0;
+ len = 1;
+ } else if (progress_value < 10) {
+ len = 1;
+ } else if (progress_value < 100) {
+ len = 2;
+ } else if (progress_value = 100) {
+ len = 3;
+ } else if (progress_value > 100) {
+ progress_value = 100;
+ len = 3;
+ }
+
+ snprintf(progress_data, len + 1, "%d", progress_value);
+ INFO("booting...%s\%\n", progress_data);
+
+ if (client_sock) {
+ if (0 > send_skin_data(client_sock,
+ SEND_BOOTING_PROGRESS, progress_data, len + 1, 1)) {
+
+ ERR("fail to send SEND_BOOTING_PROGRESS to skin.\n");
+ }
+ }
+}
int is_ready_skin_server(void)
{
INFO( "start accepting socket...\n" );
if ( 0 > ( client_sock = accept( server_sock, (struct sockaddr *) &client_addr, &client_len ) ) ) {
- ERR( "skin_servier accept error\n" );
- perror( "skin_servier accept error : " );
+ ERR("skin_server accept error\n");
+ perror("skin_server accept error : ");
+
continue;
}
int read_cnt = recv_n( client_sock, recvbuf, RECV_HEADER_SIZE );
- if ( 0 > read_cnt ) {
-
- if( is_force_close_client ) {
+ if (0 > read_cnt) {
+ if (is_force_close_client) {
INFO( "force close client socket.\n" );
is_force_close_client = 0;
- }else {
- ERR( "skin_server read error:%d\n", read_cnt );
- perror( "skin_server read error : " );
+ } else {
+ ERR("skin_server read error (%d): %d\n",
+ socket_error(), read_cnt);
+ perror("skin_server read error : ");
}
+
break;
} else {
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);
void notify_ramdump_complete(void);
+void notify_booting_progress(int progress_value);
int is_ready_skin_server(void);
int get_skin_server_port(void);