4 * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
7 * GiWoong Kim <giwoong.kim@samsung.com>
8 * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30 package org.tizen.emulator.skin.comm;
32 import org.tizen.emulator.skin.comm.sock.data.ISendData;
33 import org.tizen.emulator.skin.dbi.RotationNameType;
39 public interface ICommunicator extends Runnable {
58 public enum MouseButtonType {
64 MouseButtonType( short value ) {
68 public short value() {
72 public static MouseButtonType getValue( String val ) {
73 MouseButtonType[] values = MouseButtonType.values();
74 for (int i = 0; i < values.length; i++) {
75 if( values[i].value == Integer.parseInt( val ) ) {
79 throw new IllegalArgumentException( val );
82 public static MouseButtonType getValue( short val ) {
83 MouseButtonType[] values = MouseButtonType.values();
84 for (int i = 0; i < values.length; i++) {
85 if( values[i].value == val ) {
89 throw new IllegalArgumentException( Integer.toString(val) );
94 public enum MouseEventType {
99 WHEELDOWN( (short)5 );
102 MouseEventType( short value ) {
106 public short value() {
110 public static MouseEventType getValue( String val ) {
111 MouseEventType[] values = MouseEventType.values();
112 for (int i = 0; i < values.length; i++) {
113 if( values[i].value == Integer.parseInt( val ) ) {
117 throw new IllegalArgumentException( val );
120 public static MouseEventType getValue( short val ) {
121 MouseEventType[] values = MouseEventType.values();
122 for (int i = 0; i < values.length; i++) {
123 if( values[i].value == val ) {
127 throw new IllegalArgumentException( Integer.toString(val) );
132 public enum KeyEventType {
134 RELEASED( (short)2 );
137 KeyEventType( short value ) {
141 public short value() {
145 public static KeyEventType getValue( String val ) {
146 KeyEventType[] values = KeyEventType.values();
147 for (int i = 0; i < values.length; i++) {
148 if( values[i].value == Integer.parseInt( val ) ) {
152 throw new IllegalArgumentException( val );
155 public static KeyEventType getValue( short val ) {
156 KeyEventType[] values = KeyEventType.values();
157 for (int i = 0; i < values.length; i++) {
158 if( values[i].value == val ) {
162 throw new IllegalArgumentException( Integer.toString(val) );
167 public enum RotationInfo {
169 PORTRAIT( RotationNameType.PORTRAIT.value(), (short)0, 0 ),
170 LANDSCAPE( RotationNameType.LANDSCAPE.value(), (short)1, -90 ),
171 REVERSE_PORTRAIT( RotationNameType.REVERSE_PORTRAIT.value(), (short)2, 180 ),
172 REVERSE_LANDSCAPE( RotationNameType.REVERSE_LANDSCAPE.value(), (short)3, 90 );
174 private String value;
178 RotationInfo( String value, short id, int ratio ) {
184 public String value() {
196 public static RotationInfo getValue( short id ) {
197 RotationInfo[] values = RotationInfo.values();
198 for (int i = 0; i < values.length; i++) {
199 if( values[i].id == id ) {
203 throw new IllegalArgumentException( Integer.toString(id) );
208 public enum SendCommand {
209 /* This values must match the QEMU definitions */
211 SEND_START( (short)1 ),
213 SEND_MOUSE_EVENT( (short)10 ),
214 SEND_KEY_EVENT( (short)11 ),
215 SEND_HARD_KEY_EVENT( (short)12 ),
216 CHANGE_LCD_STATE( (short)13 ),
217 OPEN_SHELL( (short)14 ),
218 HOST_KBD( (short)15 ),
219 SCREEN_SHOT( (short)16 ),
220 DETAIL_INFO( (short)17 ),
221 RAM_DUMP( (short)18 ),
222 GUEST_DUMP( (short)19 ),
224 RESPONSE_HEART_BEAT( (short)900 ),
226 RESPONSE_SHUTDOWN( (short)999 );
229 SendCommand( short value ) {
233 public short value() {
237 public static SendCommand getValue( String val ) {
238 SendCommand[] values = SendCommand.values();
239 for (int i = 0; i < values.length; i++) {
240 if( values[i].value == Short.parseShort( val ) ) {
244 throw new IllegalArgumentException( val );
247 public static SendCommand getValue( short val ) {
248 SendCommand[] values = SendCommand.values();
249 for (int i = 0; i < values.length; i++) {
250 if( values[i].value == val ) {
254 throw new IllegalArgumentException( Integer.toString(val) );
258 public enum ReceiveCommand {
259 /* This values must match the QEMU definitions */
261 HEART_BEAT((short) 1),
262 SCREEN_SHOT_DATA((short) 2),
263 DETAIL_INFO_DATA((short) 3),
264 RAMDUMP_COMPLETE((short) 4),
265 BOOTING_PROGRESS((short) 5),
266 BRIGHTNESS_VALUE((short) 6),
267 SENSOR_DAEMON_START((short) 800),
268 SHUTDOWN((short) 999);
271 ReceiveCommand( short value ) {
275 public short value() {
279 public static ReceiveCommand getValue( String val ) {
280 ReceiveCommand[] values = ReceiveCommand.values();
281 for (int i = 0; i < values.length; i++) {
282 if( values[i].value == Short.parseShort( val ) ) {
286 throw new IllegalArgumentException( val );
289 public static ReceiveCommand getValue( short val ) {
290 ReceiveCommand[] values = ReceiveCommand.values();
291 for (int i = 0; i < values.length; i++) {
292 if( values[i].value == val ) {
296 throw new IllegalArgumentException( Integer.toString(val) );
300 public void sendToQEMU( SendCommand command, ISendData data );
302 public void terminate();