if (!strncmp(data, "1", 1)) {
is_on = 1;
}
- onoff_host_kbd(is_on);
+ do_host_kbd_enable(is_on);
}
} else if (!strncmp(cmd, MSG_TYPE_NFC, 3)) {
if (group == MSG_GROUP_STATUS) {
static void maru_brightness_bh(void *opaque)
{
if (brightness_off == 0) {
- notify_brightness(true);
+ notify_brightness_state(true);
} else {
- notify_brightness(false);
+ notify_brightness_state(false);
}
}
//logger.info("getPixels native function returned " + result);
communicator.sendToQEMU(
- SendCommand.RESPONSE_DRAW_FRAMEBUFFER, null, true);
+ SendCommand.RESPONSE_DRAW_FRAME, null, true);
dataFramebuffer.setPixels(0, 0,
sizeFramebuffer, arrayFramebuffer, 0);
KeyEventData keyEventData = new KeyEventData(
KeyEventType.RELEASED.value(), keyCode, stateMask, keyLocation);
communicator.sendToQEMU(
- SendCommand.SEND_KEY_EVENT, keyEventData, false);
+ SendCommand.SEND_KEYBOARD_KEY_EVENT, keyEventData, false);
removePressedKeyFromList(keyEventData);
}
KeyEventData keyEventData = new KeyEventData(
KeyEventType.PRESSED.value(), keyCode, stateMask, keyLocation);
communicator.sendToQEMU(
- SendCommand.SEND_KEY_EVENT, keyEventData, false);
+ SendCommand.SEND_KEYBOARD_KEY_EVENT, keyEventData, false);
addPressedKeyToList(keyEventData);
}
event.doit = false;
if (null != communicator) {
- communicator.sendToQEMU(SendCommand.CLOSE, null, false);
+ communicator.sendToQEMU(SendCommand.SEND_CLOSE_REQ, null, false);
}
}
}
DisplayStateData lcdStateData = new DisplayStateData(
currentState.getCurrentScale(),
currentState.getCurrentRotationId());
- communicator.sendToQEMU(SendCommand.CHANGE_LCD_STATE,
+ communicator.sendToQEMU(SendCommand.SEND_DISPLAY_STATE,
lcdStateData, false);
}
};
KeyEventType.RELEASED.value(),
disappearKeycode, disappearStateMask,
disappearKeyLocation);
- communicator.sendToQEMU(SendCommand.SEND_KEY_EVENT,
+ communicator.sendToQEMU(SendCommand.SEND_KEYBOARD_KEY_EVENT,
keyEventData, false);
removePressedKeyFromList(keyEventData);
}
if (keyEventData != null) {
- communicator.sendToQEMU(SendCommand.SEND_KEY_EVENT,
+ communicator.sendToQEMU(SendCommand.SEND_KEYBOARD_KEY_EVENT,
keyEventData, false);
removePressedKeyFromList(keyEventData);
}
previousKeyCode, previousStateMask,
previous.keyLocation);
communicator.sendToQEMU(
- SendCommand.SEND_KEY_EVENT,
+ SendCommand.SEND_KEYBOARD_KEY_EVENT,
keyEventData, false);
removePressedKeyFromList(keyEventData);
int keyLocation) {
KeyEventData keyEventData = new KeyEventData(
KeyEventType.RELEASED.value(), keyCode, stateMask, keyLocation);
- communicator
- .sendToQEMU(SendCommand.SEND_KEY_EVENT, keyEventData, false);
+ communicator.sendToQEMU(
+ SendCommand.SEND_KEYBOARD_KEY_EVENT, keyEventData, false);
removePressedKeyFromList(keyEventData);
}
int keyLocation) {
KeyEventData keyEventData = new KeyEventData(
KeyEventType.PRESSED.value(), keyCode, stateMask, keyLocation);
- communicator
- .sendToQEMU(SendCommand.SEND_KEY_EVENT, keyEventData, false);
+ communicator.sendToQEMU(
+ SendCommand.SEND_KEYBOARD_KEY_EVENT, keyEventData, false);
addPressedKeyToList(keyEventData);
}
DisplayStateData lcdStateData = new DisplayStateData(
currentState.getCurrentScale(), rotationId);
- communicator.sendToQEMU(SendCommand.CHANGE_LCD_STATE,
+ communicator.sendToQEMU(SendCommand.SEND_DISPLAY_STATE,
lcdStateData, false);
}
};
DisplayStateData lcdStateData = new DisplayStateData(scale,
currentState.getCurrentRotationId());
- communicator.sendToQEMU(SendCommand.CHANGE_LCD_STATE,
+ communicator.sendToQEMU(SendCommand.SEND_DISPLAY_STATE,
lcdStateData, false);
}
logger.info("Ram dump menu is selected");
communicator.setRamdumpFlag(true);
- communicator.sendToQEMU(SendCommand.RAM_DUMP, null, false);
+ communicator.sendToQEMU(SendCommand.SEND_RAM_DUMP, null, false);
RamdumpDialog ramdumpDialog;
try {
isOnKbd = on;
logger.info("Host Keyboard " + isOnKbd);
- communicator
- .sendToQEMU(SendCommand.HOST_KBD, new BooleanData(
- on, SendCommand.HOST_KBD.toString()), false);
+ communicator.sendToQEMU(SendCommand.SEND_HOST_KBD_STATE,
+ new BooleanData(on, SendCommand.SEND_HOST_KBD_STATE.toString()), false);
}
}
};
SWT.ICON_ERROR, config);
}
- communicator.sendToQEMU(SendCommand.OPEN_SHELL, null, false);
+ communicator.sendToQEMU(SendCommand.SEND_OPEN_SHELL, null, false);
}
};
// TODO: thread
/* get ECS port from Qemu */
DataTranfer dataTranfer = communicator.sendDataToQEMU(
- SendCommand.ECP_PORT_REQ, null, true);
+ SendCommand.SEND_ECP_PORT_REQ, null, true);
byte[] receivedData = communicator.getReceivedData(dataTranfer);
if (null != receivedData) {
public void widgetSelected(SelectionEvent e) {
logger.info("Close Menu is selected");
- communicator.sendToQEMU(SendCommand.CLOSE, null, false);
+ communicator.sendToQEMU(SendCommand.SEND_CLOSE_REQ, null, false);
}
};
KeyEventData keyEventData = new KeyEventData(
KeyEventType.RELEASED.value(), data.keycode,
data.stateMask, data.keyLocation);
- communicator.sendToQEMU(SendCommand.SEND_KEY_EVENT,
+ communicator.sendToQEMU(SendCommand.SEND_KEYBOARD_KEY_EVENT,
keyEventData, false);
logger.info("auto release : keycode=" + keyEventData.keycode
*
*/
public interface ICommunicator extends Runnable {
-
public enum Scale {
SCALE_25(25),
SCALE_50(50),
return this.value;
}
}
-
+
public enum MouseButtonType {
LEFT( (short)1 ),
WHEEL( (short)2 ),
public enum KeyEventType {
PRESSED( (short)1 ),
RELEASED( (short)2 );
-
+
private short value;
KeyEventType( short value ) {
this.value = value;
}
public enum RotationInfo {
-
PORTRAIT( RotationNameType.PORTRAIT.value(), (short)0, 0 ),
LANDSCAPE( RotationNameType.LANDSCAPE.value(), (short)1, -90 ),
REVERSE_PORTRAIT( RotationNameType.REVERSE_PORTRAIT.value(), (short)2, 180 ),
REVERSE_LANDSCAPE( RotationNameType.REVERSE_LANDSCAPE.value(), (short)3, 90 );
-
+
private String value;
private short id;
private int angle;
-
+
RotationInfo( String value, short id, int ratio ) {
this.value = value;
this.id = id;
public short id() {
return this.id;
}
-
+
public static RotationInfo getValue(short id) {
RotationInfo[] values = RotationInfo.values();
for (int i = 0; i < values.length; i++) {
public enum SendCommand {
/* This values must match the QEMU definitions */
- SEND_START((short) 1),
+ SEND_SKIN_OPENED((short) 1),
SEND_MOUSE_EVENT((short) 10),
- SEND_KEY_EVENT((short) 11),
- SEND_HARD_KEY_EVENT((short) 12),
- CHANGE_LCD_STATE((short) 13),
- OPEN_SHELL((short) 14),
- HOST_KBD((short) 15),
- SCREEN_SHOT((short) 16),
- DETAIL_INFO((short) 17),
- RAM_DUMP((short) 18),
- GUEST_DUMP((short) 19),
- ECP_PORT_REQ((short) 20),
-
+ SEND_KEYBOARD_KEY_EVENT((short) 11),
+ SEND_HW_KEY_EVENT((short) 12),
+ SEND_DISPLAY_STATE((short) 13),
+ SEND_OPEN_SHELL((short) 14),
+ SEND_HOST_KBD_STATE((short) 15),
+ SEND_SCREENSHOT_REQ((short) 16),
+ SEND_DETAIL_INFO_REQ((short) 17),
+ SEND_RAM_DUMP((short) 18),
+ SEND_GUEST_DUMP((short) 19),
+ SEND_ECP_PORT_REQ((short) 20),
+
RESPONSE_HEART_BEAT((short) 900),
- RESPONSE_DRAW_FRAMEBUFFER((short) 901),
- CLOSE((short) 998),
+ RESPONSE_DRAW_FRAME((short) 901),
+ SEND_CLOSE_REQ((short) 998),
RESPONSE_SHUTDOWN((short) 999);
private short value;
+
SendCommand(short value) {
this.value = value;
}
public enum ReceiveCommand {
/* 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),
- BRIGHTNESS_VALUE((short) 6),
- ECP_PORT((short) 7),
- SENSOR_DAEMON_START((short) 800),
- SDB_DAEMON_START((short) 801),
- ECS_SERVER_START((short) 802),
- DRAW_FRAME((short) 900),
- DRAW_BLANK_GUIDE((short) 901),
- SHUTDOWN((short) 999);
+ RECV_HEART_BEAT((short) 1),
+ RECV_SCREENSHOT_DATA((short) 2),
+ RECV_DETAIL_INFO_DATA((short) 3),
+ RECV_RAMDUMP_COMPLETED((short) 4),
+ RECV_BOOTING_PROGRESS((short) 5),
+ RECV_BRIGHTNESS_STATE((short) 6),
+ RECV_ECP_PORT_DATA((short) 7),
+
+ RECV_SENSORD_STARTED((short) 800),
+ RECV_SDBD_STARTED((short) 801),
+ RECV_ECS_STARTED((short) 802),
+ RECV_DRAW_FRAME((short) 900),
+ RECV_DRAW_BLANK_GUIDE((short) 901),
+ RECV_SHUTDOWN((short) 999);
private short value;
private DataTranfer progressDataTransfer;
private DataTranfer brightnessDataTransfer;
private DataTranfer ecpTransfer;
-
+
private Thread sendThread;
private LinkedList<SkinSendData> sendQueue;
width, height, scale, rotation, isBlankGuide);
logger.info("" + startData);
- sendToQEMU(SendCommand.SEND_START, startData, false);
+ sendToQEMU(SendCommand.SEND_SKIN_OPENED, startData, false);
boolean ignoreHeartbeat =
config.getArgBoolean(ArgsConstants.HEART_BEAT_IGNORE);
}
switch (command) {
- case HEART_BEAT: {
+ case RECV_HEART_BEAT: {
resetHeartbeatCount();
if (logger.isLoggable(Level.FINE)) {
- logger.fine("received HEAR_BEAT from QEMU.");
+ logger.fine("received HEART_BEAT from QEMU");
}
sendToQEMU(SendCommand.RESPONSE_HEART_BEAT, null, true);
break;
}
- case SCREEN_SHOT_DATA: {
- logger.info("received SCREEN_SHOT_DATA from QEMU.");
+ case RECV_SCREENSHOT_DATA: {
+ logger.info("received SCREENSHOT_DATA from QEMU");
receiveData(screenShotDataTransfer, length );
break;
}
- case DETAIL_INFO_DATA: {
- logger.info("received DETAIL_INFO_DATA from QEMU.");
+ case RECV_DETAIL_INFO_DATA: {
+ logger.info("received DETAIL_INFO_DATA from QEMU");
receiveData( detailInfoTransfer, length);
break;
}
- case RAMDUMP_COMPLETE: {
- logger.info("received RAMDUMP_COMPLETE from QEMU.");
+ case RECV_RAMDUMP_COMPLETED: {
+ logger.info("received RAMDUMP_COMPLETED from QEMU");
setRamdumpFlag(false);
break;
}
- case BOOTING_PROGRESS: {
+ case RECV_BOOTING_PROGRESS: {
//logger.info("received BOOTING_PROGRESS from QEMU.");
resetDataTransfer(progressDataTransfer);
break;
}
- case BRIGHTNESS_VALUE: {
- //logger.info("received BRIGHTNESS_VALUE from QEMU.");
+ case RECV_BRIGHTNESS_STATE: {
+ //logger.info("received BRIGHTNESS_STATE from QEMU");
resetDataTransfer(brightnessDataTransfer);
receiveData(brightnessDataTransfer, length);
break;
}
- case ECP_PORT: {
- logger.info("received ECP_PORT from QEMU.");
+ case RECV_ECP_PORT_DATA: {
+ logger.info("received ECP_PORT_DATA from QEMU");
receiveData(ecpTransfer, length);
-
+
break;
}
- case SENSOR_DAEMON_START: {
- logger.info("received SENSOR_DAEMON_START from QEMU.");
+ case RECV_SENSORD_STARTED: {
+ logger.info("received SENSORD_STARTED from QEMU");
synchronized (this) {
isSensorDaemonStarted = true;
}
break;
}
- case SDB_DAEMON_START: {
- logger.info("received SDB_DAEMON_START from QEMU.");
+ case RECV_SDBD_STARTED: {
+ logger.info("received SDBD_STARTED from QEMU");
synchronized (this) {
isSdbDaemonStarted = true;
}
break;
}
- case ECS_SERVER_START: {
- logger.info("received ECS_SERVER_START from QEMU.");
+ case RECV_ECS_STARTED: {
+ logger.info("received ECS_STARTED from QEMU");
synchronized (this) {
isEcsServerStarted = true;
}
break;
}
- case DRAW_FRAME: {
+ case RECV_DRAW_FRAME: {
//logger.info("received DRAW_FRAME from QEMU.");
skin.updateDisplay();
break;
}
- case DRAW_BLANK_GUIDE: {
+ case RECV_DRAW_BLANK_GUIDE: {
logger.info("received DRAW_BLANK_GUIDE from QEMU.");
Image imageGuide = skin.getImageRegistry().getResourceImage(
break;
}
- case SHUTDOWN: {
- logger.info("received RESPONSE_SHUTDOWN from QEMU.");
+ case RECV_SHUTDOWN: {
+ logger.info("received SHUTDOWN from QEMU");
sendToQEMU(SendCommand.RESPONSE_SHUTDOWN, null, false);
terminate();
DataTranfer dataTranfer = null;
if (useDataTransfer) {
- if (SendCommand.SCREEN_SHOT.equals(command)) {
+ if (SendCommand.SEND_SCREENSHOT_REQ.equals(command)) {
dataTranfer = resetDataTransfer(screenShotDataTransfer);
- } else if (SendCommand.DETAIL_INFO.equals(command)) {
+ } else if (SendCommand.SEND_DETAIL_INFO_REQ.equals(command)) {
dataTranfer = resetDataTransfer(detailInfoTransfer);
- } else if (SendCommand.ECP_PORT_REQ.equals(command)) {
+ } else if (SendCommand.SEND_ECP_PORT_REQ.equals(command)) {
dataTranfer = resetDataTransfer(ecpTransfer);
}
}
KeyEventData keyEventData = new KeyEventData(
KeyEventType.PRESSED.value(), keycode, 0, 0);
skin.communicator.sendToQEMU(
- SendCommand.SEND_HARD_KEY_EVENT, keyEventData, false);
+ SendCommand.SEND_HW_KEY_EVENT, keyEventData, false);
}
@Override
KeyEventData keyEventData = new KeyEventData(
KeyEventType.RELEASED.value(), keycode, 0, 0);
skin.communicator.sendToQEMU(
- SendCommand.SEND_HARD_KEY_EVENT, keyEventData, false);
+ SendCommand.SEND_HW_KEY_EVENT, keyEventData, false);
}
@Override
KeyEventData keyEventData = new KeyEventData(
KeyEventType.RELEASED.value(), pressedHWKey.getKeyCode(), 0, 0);
communicator.sendToQEMU(
- SendCommand.SEND_HARD_KEY_EVENT, keyEventData, false);
+ SendCommand.SEND_HW_KEY_EVENT, keyEventData, false);
}
currentPressedHWKey = null;
KeyEventData keyEventData = new KeyEventData(
KeyEventType.PRESSED.value(), hwKey.getKeyCode(), 0, 0);
communicator.sendToQEMU(
- SendCommand.SEND_HARD_KEY_EVENT, keyEventData, false);
+ SendCommand.SEND_HW_KEY_EVENT, keyEventData, false);
}
currentPressedHWKey = hwKey;
String infoData = null;
DataTranfer dataTranfer =
- communicator.sendDataToQEMU(SendCommand.DETAIL_INFO, null, true);
+ communicator.sendDataToQEMU(SendCommand.SEND_DETAIL_INFO_REQ, null, true);
byte[] receivedData = communicator.getReceivedData(dataTranfer);
if (null != receivedData) {
KeyEventData keyEventData = new KeyEventData(
KeyEventType.RELEASED.value(), pressedHWKey.getKeyCode(), 0, 0);
communicator.sendToQEMU(
- SendCommand.SEND_HARD_KEY_EVENT, keyEventData, false);
+ SendCommand.SEND_HW_KEY_EVENT, keyEventData, false);
currentPressedHWKey = null;
KeyEventData keyEventData = new KeyEventData(
KeyEventType.PRESSED.value(), hwKey.getKeyCode(), 0, 0);
communicator.sendToQEMU(
- SendCommand.SEND_HARD_KEY_EVENT, keyEventData, false);
+ SendCommand.SEND_HW_KEY_EVENT, keyEventData, false);
currentPressedHWKey = hwKey;
logger.info("screenshot capture");
DataTranfer dataTranfer = emulatorSkin.communicator.sendDataToQEMU(
- SendCommand.SCREEN_SHOT, null, true);
+ SendCommand.SEND_SCREENSHOT_REQ, null, true);
byte[] receivedData =
emulatorSkin.communicator.getReceivedData(dataTranfer);
break;
default:
- ERR("undefined mouse event type passed:%d\n", event_type);
+ ERR("undefined mouse event type passed : %d\n", event_type);
break;
}
#endif
}
-void do_key_event(int event_type, int keycode, int state_mask, int key_location)
+void do_keyboard_key_event(int event_type,
+ int keycode, int state_mask, int key_location)
{
int scancode = -1;
- TRACE("key_event event_type:%d, keycode:%d, state_mask:%d, key_location:%d\n",
+ TRACE("Keyboard Key : event_type=%d, keycode=%d,"
+ "state_mask=%d, key_location=%d\n",
event_type, keycode, state_mask, key_location);
#ifndef CONFIG_USE_SHM
}
}
-void do_hardkey_event(int event_type, int keycode)
+void do_hw_key_event(int event_type, int keycode)
{
- INFO("do_hardkey_event event_type:%d, keycode:%d\n",
+ INFO("HW Key : event_type=%d, keycode=%d\n",
event_type, keycode);
if ( is_suspended_state() ) {
/* do nothing */
}
-void onoff_host_kbd(int on)
+void do_host_kbd_enable(bool on)
{
- INFO("host kbd on/off: %d.\n", on);
+ INFO("host kbd enable : %d\n", on);
#if defined(TARGET_ARM)
mloop_evcmd_usbkbd(on);
INFO("request_close\n");
/* FIXME: convert to device emulatoion */
- do_hardkey_event(KEY_PRESSED, HARD_KEY_POWER);
+ do_hw_key_event(KEY_PRESSED, HARD_KEY_POWER);
#ifdef CONFIG_WIN32
Sleep(CLOSE_POWER_KEY_INTERVAL);
usleep(CLOSE_POWER_KEY_INTERVAL * 1000);
#endif
- do_hardkey_event(KEY_RELEASED, HARD_KEY_POWER);
+ do_hw_key_event(KEY_RELEASED, HARD_KEY_POWER);
}
void shutdown_qemu_gracefully(void)
void do_mouse_event(int button_type, int event_type,
int origin_x, int origin_y, int x, int y, int z);
-void do_key_event(int event_type,
+void do_keyboard_key_event(int event_type,
int keycode, int state_mask, int key_location);
-void do_hardkey_event(int event_type, int keycode);
+void do_hw_key_event(int event_type, int keycode);
void do_scale_event(double scale_factor);
void do_rotation_event(int rotation_type);
void free_screenshot_info(QemuSurfaceInfo *);
void do_open_shell(void);
-void onoff_host_kbd(int on);
+void do_host_kbd_enable(bool on);
void do_ram_dump(void);
void do_guestmemory_dump(void);
/* This values must match the Java definitions
in Skin process */
- RECV_START = 1,
+ RECV_SKIN_OPENED = 1,
RECV_MOUSE_EVENT = 10,
- RECV_KEY_EVENT = 11,
- RECV_HARD_KEY_EVENT = 12,
- RECV_CHANGE_LCD_STATE = 13,
+ RECV_KEYBOARD_KEY_EVENT = 11,
+ RECV_HW_KEY_EVENT = 12,
+ RECV_DISPLAY_STATE = 13,
RECV_OPEN_SHELL = 14,
- RECV_HOST_KBD = 15,
- RECV_SCREEN_SHOT = 16,
- RECV_DETAIL_INFO = 17,
+ RECV_HOST_KBD_STATE = 15,
+ RECV_SCREENSHOT_REQ = 16,
+ RECV_DETAIL_INFO_REQ = 17,
RECV_RAM_DUMP = 18,
RECV_GUESTMEMORY_DUMP = 19,
RECV_ECP_PORT_REQ = 20,
RECV_RESPONSE_HEART_BEAT = 900,
RECV_RESPONSE_DRAW_FRAME = 901,
- RECV_CLOSE = 998,
+ RECV_CLOSE_REQ = 998,
RECV_RESPONSE_SHUTDOWN = 999,
};
in Skin process */
SEND_HEART_BEAT = 1,
- SEND_SCREEN_SHOT = 2,
- SEND_DETAIL_INFO = 3,
- SEND_RAMDUMP_COMPLETE = 4,
+ SEND_SCREENSHOT_DATA = 2,
+ SEND_DETAIL_INFO_DATA = 3,
+ SEND_RAMDUMP_COMPLETED = 4,
SEND_BOOTING_PROGRESS = 5,
- SEND_BRIGHTNESS_VALUE = 6,
- SEND_ECP_PORT = 7,
- SEND_SENSOR_DAEMON_START = 800,
- SEND_SDB_DAEMON_START = 801,
- SEND_ECS_SERVER_START = 802,
+ SEND_BRIGHTNESS_STATE = 6,
+ SEND_ECP_PORT_DATA = 7,
+ SEND_HOST_KBD_STATE = 8,
+ SEND_SENSORD_STARTED = 800,
+ SEND_SDBD_STARTED = 801,
+ SEND_ECS_STARTED = 802,
SEND_DRAW_FRAME = 900,
SEND_DRAW_BLANK_GUIDE = 901,
SEND_SHUTDOWN = 999,
if (0 > send_skin_header_only(
client_sock, SEND_DRAW_FRAME, 1)) {
- ERR("fail to send SEND_DRAW_FRAME to skin.\n");
+ ERR("fail to send SEND_DRAW_FRAME to skin\n");
}
} else {
INFO("skin client socket is not connected yet\n");
if (0 > send_skin_header_only(
client_sock, SEND_DRAW_BLANK_GUIDE, 1)) {
- ERR("fail to send SEND_DRAW_BLANK_GUIDE to skin.\n");
+ ERR("fail to send SEND_DRAW_BLANK_GUIDE to skin\n");
}
} else {
INFO("skin client socket is not connected yet\n");
is_ecs_initialized = 1;
if (client_sock) {
if (0 > send_skin_header_only(
- client_sock, SEND_ECS_SERVER_START, 1)) {
+ client_sock, SEND_ECS_STARTED, 1)) {
- ERR("fail to send SEND_ECS_SERVER_START to skin.\n");
+ ERR("fail to send SEND_ECS_STARTED to skin\n");
}
} else {
INFO("skin client socket is not connected yet\n");
is_sdbd_initialized = 1;
if (client_sock) {
if (0 > send_skin_header_only(
- client_sock, SEND_SDB_DAEMON_START, 1)) {
+ client_sock, SEND_SDBD_STARTED, 1)) {
- ERR("fail to send SEND_SDB_DAEMON_START to skin.\n");
+ ERR("fail to send SEND_SDBD_STARTED to skin\n");
}
} else {
INFO("skin client socket is not connected yet\n");
is_sensord_initialized = 1;
if (client_sock) {
if (0 > send_skin_header_only(
- client_sock, SEND_SENSOR_DAEMON_START, 1)) {
+ client_sock, SEND_SENSORD_STARTED, 1)) {
- ERR("fail to send SEND_SENSOR_DAEMON_START to skin.\n");
+ ERR("fail to send SEND_SENSORD_STARTED to skin\n");
}
} else {
INFO("skin client socket is not connected yet\n");
if (client_sock) {
if (0 > send_skin_header_only(
- client_sock, SEND_RAMDUMP_COMPLETE, 1)) {
+ client_sock, SEND_RAMDUMP_COMPLETED, 1)) {
- ERR("fail to send SEND_RAMDUMP_COMPLETE to skin.\n");
+ ERR("fail to send SEND_RAMDUMP_COMPLETED to skin\n");
}
} else {
INFO("skin client socket is not connected yet\n");
SEND_BOOTING_PROGRESS,
(unsigned char *)progress_data, PROGRESS_DATA_LENGTH, 0)) {
- ERR("fail to send SEND_BOOTING_PROGRESS to skin.\n");
+ ERR("fail to send SEND_BOOTING_PROGRESS to skin\n");
}
SLEEP(1); /* 1ms */
}
}
-void notify_brightness(bool on)
+void notify_brightness_state(bool on)
{
#define BRIGHTNESS_DATA_LENGTH 2
char brightness_data[BRIGHTNESS_DATA_LENGTH] = { 0, };
- int brightness_value = 1;
- if (on == FALSE) {
- brightness_value = 0;
+ if (on == false) {
+ snprintf(brightness_data, BRIGHTNESS_DATA_LENGTH, "0");
+ } else {
+ snprintf(brightness_data, BRIGHTNESS_DATA_LENGTH, "1");
}
- snprintf(brightness_data,
- BRIGHTNESS_DATA_LENGTH, "%d", brightness_value);
- TRACE("brightness value = %s\n", brightness_data);
+ TRACE("notify brightness state : %s\n", brightness_data);
if (client_sock) {
if (0 > send_skin_data(client_sock,
- SEND_BRIGHTNESS_VALUE,
+ SEND_BRIGHTNESS_STATE,
(unsigned char *)brightness_data, BRIGHTNESS_DATA_LENGTH, 0)) {
- ERR("fail to send SEND_BRIGHTNESS_VALUE to skin.\n");
+ ERR("fail to send SEND_BRIGHTNESS_STATE to skin\n");
}
} else {
INFO("skin client socket is not connected yet\n");
}
switch (cmd) {
- case RECV_START: {
- log_cnt += sprintf(log_buf + log_cnt, "RECV_START ==\n");
+ case RECV_SKIN_OPENED: {
+ log_cnt += sprintf(log_buf + log_cnt, "RECV_SKIN_OPENED ==\n");
INFO(log_buf);
if (0 >= length) {
host_x, host_y, guest_x, guest_y, z);
break;
}
- case RECV_KEY_EVENT: {
- log_cnt += sprintf( log_buf + log_cnt, "RECV_KEY_EVENT ==\n" );
- TRACE( log_buf );
+ case RECV_KEYBOARD_KEY_EVENT: {
+ log_cnt += sprintf(log_buf + log_cnt, "RECV_KEYBOARD_KEY_EVENT ==\n");
+ TRACE(log_buf);
- if ( 0 >= length ) {
- ERR( "there is no data looking at 0 length." );
+ if (0 >= length) {
+ ERR("there is no data looking at 0 length.");
continue;
}
int key_location = 0;
char* p = recvbuf;
- memcpy( &event_type, p, sizeof( event_type ) );
- p += sizeof( event_type );
- memcpy( &keycode, p, sizeof( keycode ) );
- p += sizeof( keycode );
- memcpy( &state_mask, p, sizeof( state_mask ) );
- p += sizeof( state_mask );
- memcpy( &key_location, p, sizeof( key_location ) );
-
- event_type = ntohl( event_type );
- keycode = ntohl( keycode );
- state_mask = ntohl( state_mask );
- key_location = ntohl( key_location );
-
- do_key_event(event_type, keycode, state_mask, key_location);
+ memcpy(&event_type, p, sizeof(event_type));
+ p += sizeof(event_type);
+ memcpy(&keycode, p, sizeof(keycode));
+ p += sizeof(keycode);
+ memcpy(&state_mask, p, sizeof(state_mask));
+ p += sizeof(state_mask);
+ memcpy(&key_location, p, sizeof(key_location));
+
+ event_type = ntohl(event_type);
+ keycode = ntohl(keycode);
+ state_mask = ntohl(state_mask);
+ key_location = ntohl(key_location);
+
+ do_keyboard_key_event(event_type, keycode, state_mask, key_location);
break;
}
- case RECV_HARD_KEY_EVENT: {
- log_cnt += sprintf( log_buf + log_cnt, "RECV_HARD_KEY_EVENT ==\n" );
- TRACE( log_buf );
+ case RECV_HW_KEY_EVENT: {
+ log_cnt += sprintf(log_buf + log_cnt, "RECV_HW_KEY_EVENT ==\n");
+ TRACE(log_buf);
- if ( 0 >= length ) {
- ERR( "there is no data looking at 0 length." );
+ if (0 >= length) {
+ ERR("there is no data looking at 0 length.");
continue;
}
int keycode = 0;
char* p = recvbuf;
- memcpy( &event_type, p, sizeof( event_type ) );
- p += sizeof( event_type );
- memcpy( &keycode, p, sizeof( keycode ) );
+ memcpy(&event_type, p, sizeof(event_type));
+ p += sizeof(event_type);
+ memcpy(&keycode, p, sizeof(keycode));
- event_type = ntohl( event_type );
- keycode = ntohl( keycode );
+ event_type = ntohl(event_type);
+ keycode = ntohl(keycode);
- do_hardkey_event( event_type, keycode );
+ do_hw_key_event(event_type, keycode);
break;
}
- case RECV_CHANGE_LCD_STATE: {
- log_cnt += sprintf(log_buf + log_cnt, "RECV_CHANGE_LCD_STATE ==\n");
+ case RECV_DISPLAY_STATE: {
+ log_cnt += sprintf(log_buf + log_cnt, "RECV_DISPLAY_STATE ==\n");
TRACE(log_buf);
if (0 >= length) {
break;
}
- case RECV_SCREEN_SHOT: {
- log_cnt += sprintf( log_buf + log_cnt, "RECV_SCREEN_SHOT ==\n" );
- TRACE( log_buf );
+ case RECV_SCREENSHOT_REQ: {
+ log_cnt += sprintf(log_buf + log_cnt, "RECV_SCREENSHOT_REQ ==\n");
+ TRACE(log_buf);
QemuSurfaceInfo* info = get_screenshot_info();
- if ( info ) {
- send_skin_data( client_sock, SEND_SCREEN_SHOT, info->pixel_data, info->pixel_data_length, 1 );
- free_screenshot_info( info );
+ if (info) {
+ send_skin_data(client_sock, SEND_SCREENSHOT_DATA,
+ info->pixel_data, info->pixel_data_length, 1);
+ free_screenshot_info(info);
} else {
- ERR( "Fail to get screenshot data.\n" );
+ ERR("Fail to get screen shot data\n");
}
break;
}
- case RECV_DETAIL_INFO: {
- log_cnt += sprintf( log_buf + log_cnt, "RECV_DETAIL_INFO ==\n" );
- TRACE( log_buf );
+ case RECV_DETAIL_INFO_REQ: {
+ log_cnt += sprintf(log_buf + log_cnt, "RECV_DETAIL_INFO_REQ ==\n");
+ TRACE(log_buf);
- DetailInfo* detail_info = get_detail_info( qmu_argc, qmu_argv );
+ DetailInfo* detail_info = get_detail_info(qmu_argc, qmu_argv);
- if ( detail_info ) {
- send_skin_data( client_sock, SEND_DETAIL_INFO, (unsigned char*) detail_info->data,
- detail_info->data_length, 0 );
- free_detail_info( detail_info );
+ if (detail_info) {
+ send_skin_data(client_sock, SEND_DETAIL_INFO_DATA,
+ (unsigned char*) detail_info->data, detail_info->data_length, 0);
+ free_detail_info(detail_info);
} else {
- ERR( "Fail to get detail info.\n" );
+ ERR("Fail to get detail info\n");
}
break;
do_ram_dump();
break;
}
- case RECV_ECP_PORT_REQ: {
+ case RECV_ECP_PORT_REQ: {
log_cnt += sprintf(log_buf + log_cnt, "RECV_ECP_PORT_REQ ==\n");
TRACE(log_buf);
- int port = get_ecs_port();
- unsigned char port_buf[5];
- memset(port_buf, 0, 5);
- port_buf[0] = (port & 0xFF000000) >> 24;
- port_buf[1] = (port & 0x00FF0000) >> 16;
- port_buf[2] = (port & 0x0000FF00) >> 8;
- port_buf[3] = (port & 0x000000FF);
-
- send_skin_data( client_sock, SEND_ECP_PORT, port_buf, 4, 0);
- break;
- }
+ int port = get_ecs_port();
+ unsigned char port_buf[5];
+ memset(port_buf, 0, 5);
+ port_buf[0] = (port & 0xFF000000) >> 24;
+ port_buf[1] = (port & 0x00FF0000) >> 16;
+ port_buf[2] = (port & 0x0000FF00) >> 8;
+ port_buf[3] = (port & 0x000000FF);
+
+ send_skin_data(client_sock, SEND_ECP_PORT_DATA, port_buf, 4, 0);
+ break;
+ }
case RECV_GUESTMEMORY_DUMP: {
log_cnt += sprintf(log_buf + log_cnt, "RECV_GUESTMEMORY_DUMP ==\n");
TRACE(log_buf);
do_open_shell();
break;
}
- case RECV_HOST_KBD: {
+ case RECV_HOST_KBD_STATE: {
char on = 0;
- log_cnt += sprintf(log_buf + log_cnt, "RECV_HOST_KBD ==\n");
+ log_cnt += sprintf(log_buf + log_cnt, "RECV_HOST_KBD_STATE ==\n");
TRACE(log_buf);
if (length <= 0) {
}
memcpy(&on, recvbuf, sizeof(on));
- onoff_host_kbd(on);
+
+ if (on == 0) {
+ do_host_kbd_enable(false);
+ } else {
+ do_host_kbd_enable(true);
+ }
break;
}
case RECV_RESPONSE_DRAW_FRAME: {
#endif
break;
}
- case RECV_CLOSE: {
+ case RECV_CLOSE_REQ: {
log_cnt += sprintf(log_buf + log_cnt, "RECV_CLOSE ==\n");
TRACE(log_buf);
pthread_mutex_unlock(&mutex_send_data);
- TRACE("send_n result:%d\n", send_cnt);
+ TRACE("send_n result : %d\n", send_cnt);
return send_cnt;
}
pthread_mutex_unlock(&mutex_recv_heartbeat_count);
if (HEART_BEAT_EXPIRE_COUNT < recv_heartbeat_count) {
- ERR("received heartbeat count is expired.\n");
+ ERR("received heart beat count is expired\n");
shutdown = 1;
break;
}
if (shutdown != 0) {
- INFO("[HB] shutdown skin_server by heartbeat thread.\n");
+ INFO("[HB] shutdown skin_server by heart beat thread\n");
is_force_close_client = 1;
return 1;
} else {
if (0 != pthread_create(&thread_id_heartbeat, NULL, do_heart_beat, NULL)) {
- ERR("[HB] fail to create heartbean pthread.\n");
+ ERR("[HB] fail to create heart beat thread\n");
return 0;
} else {
return 1;
#ifndef MARUSKIN_SERVER_H_
#define MARUSKIN_SERVER_H_
-#include <stdbool.h>
-
int start_skin_server(int argc, char** argv, int qemu_argc, char** qemu_argv);
void shutdown_skin_server(void);
void notify_draw_frame(void);
void notify_draw_blank_guide(void);
-void notify_sensor_daemon_start(void);
-void notify_sdb_daemon_start(void);
void notify_ecs_server_start(void);
+void notify_sdb_daemon_start(void);
+void notify_sensor_daemon_start(void);
void notify_ramdump_completed(void);
void notify_booting_progress(unsigned int layer, int progress_value);
-void notify_brightness(bool on);
+void notify_brightness_state(bool on);
int is_ready_skin_server(void);
int get_skin_server_port(void);