SEND_RAM_DUMP((short) 18),
SEND_GUEST_DUMP((short) 19),
SEND_INTERPOLATION_STATE((short) 21),
+ SEND_ROTARY_EVENT((short) 30),
RESPONSE_HEART_BEAT((short) 900),
RESPONSE_DRAW_FRAME((short) 901),
--- /dev/null
+/**
+ * Rotary Event Data
+ *
+ * Copyright (C) 2011 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * SangHo Park <sangho1206.park@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.comm.sock.data;
+
+import java.io.IOException;
+
+/**
+ *
+ *
+ */
+public class RotaryEventData extends AbstractSendData {
+ int eventType;
+ int delta;
+
+ public RotaryEventData(int eventType, int delta) {
+ this.eventType = eventType;
+ this.delta = delta;
+ }
+
+ @Override
+ protected void write() throws IOException {
+ writeInt(eventType);
+ writeInt(delta);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("RotaryEventData [eventType=");
+ builder.append(eventType);
+ builder.append(", delta=");
+ builder.append(delta);
+ builder.append("]");
+
+ return builder.toString();
+ }
+}
EmulatorConfig config, EmulatorSkin skin) {
super(config, skin);
- rotary = new Rotary(shell, SWT.DOUBLE_BUFFERED, imageRegistry);
+ rotary = new Rotary(shell, SWT.DOUBLE_BUFFERED,
+ imageRegistry, communicator);
}
@Override
import org.eclipse.swt.graphics.Transform;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.skin.comm.ICommunicator.SendCommand;
+import org.tizen.emulator.skin.comm.sock.SocketCommunicator;
+import org.tizen.emulator.skin.comm.sock.data.RotaryEventData;
import org.tizen.emulator.skin.image.ProfileSkinImageRegistry;
import org.tizen.emulator.skin.image.ProfileSkinImageRegistry.SkinImageType;
import org.tizen.emulator.skin.log.SkinLogger;
private Shell parent;
private ProfileSkinImageRegistry imageRegistry;
+ private SocketCommunicator communicator;
+
private Image image;
private int degrees; /* absolute */
private int angleDelta;
/**
* Constructor
*/
- Rotary(final Shell parent, int style, ProfileSkinImageRegistry imageRegistry) {
+ Rotary(final Shell parent, int style,
+ ProfileSkinImageRegistry imageRegistry, SocketCommunicator communicator) {
super(parent, style);
this.parent = parent;
this.imageRegistry = imageRegistry;
+ this.communicator = communicator;
this.image = null;
this.degrees = 0;
this.angleDelta = 0;
delta -= 360;
}
- // TODO: send to qemu
- logger.info("rotary : " + delta);
+ /* send to qemu */
+ communicator.sendToQEMU(SendCommand.SEND_ROTARY_EVENT,
+ new RotaryEventData(0, delta), false);
redraw();
}
RECV_RAM_DUMP = 18,
RECV_GUESTMEMORY_DUMP = 19,
RECV_INTERPOLATION_STATE = 21,
+ RECV_ROTARY_EVENT = 30,
RECV_RESPONSE_HEART_BEAT = 900,
RECV_RESPONSE_DRAW_FRAME = 901,
break;
}
+ case RECV_ROTARY_EVENT: {
+ log_cnt += sprintf(log_buf + log_cnt, "RECV_ROTARY_EVENT ==\n");
+ TRACE(log_buf);
+
+ if (0 >= length) {
+ ERR("there is no data looking at 0 length.");
+ continue;
+ }
+
+ /* keep it consistent with emulator-skin definition */
+ int event_type = 0;
+ int delta = 0;
+
+ char* p = recvbuf;
+ memcpy(&event_type, p, sizeof(event_type));
+ p += sizeof(event_type);
+ memcpy(&delta, p, sizeof(delta));
+
+ event_type = ntohl(event_type);
+ delta = ntohl(delta);
+
+ // TODO:
+ INFO("rotary event : %d\n", delta);
+
+ break;
+ }
case RECV_RESPONSE_DRAW_FRAME: {
qemu_mutex_lock(&mutex_draw_display);
draw_display_state = 0; /* framebuffer has been drawn */