1 // Copyright 2012 Google Inc. All Rights Reserved.
3 package com
.android
.tools
.sdkcontroller
.lib
;
6 * Contains declarations of constants that are tied to emulator implementation.
7 * These constants can be changed only simultaneously in both places.
9 public final class ProtocolConstants
{
11 * Constants related to data transfer.
14 /** Signature of a packet sent via SDK controller socket ('SDKC') */
15 public static final int PACKET_SIGNATURE
= 0x53444B43;
18 * Header sizes for packets sent / received by SDK controller emulator.
22 * 12 bytes (3 ints) for the packet header:
26 * - Total packet size.
30 public static final int PACKET_HEADER_SIZE
= 12;
32 * 16 bytes (4 ints) for the message header:
34 * - Common packet header.
38 public static final int MESSAGE_HEADER_SIZE
= 16;
40 * 20 bytes (5 ints) for the query header:
42 * - Common packet header.
48 public static final int QUERY_HEADER_SIZE
= 20;
50 * 16 bytes (4 ints) for the query response:
52 * - Common packet header.
56 public static final int QUERY_RESP_HEADER_SIZE
= 16;
59 * Types of packets transferred via SDK Controller channel.
62 /** Packet is a message. */
63 public static final int PACKET_TYPE_MESSAGE
= 1;
64 /** Packet is a query. */
65 public static final int PACKET_TYPE_QUERY
= 2;
66 /** Packet is a response to a query. */
67 public static final int PACKET_TYPE_QUERY_RESPONSE
= 3;
70 * Constants related to handshake protocol between the emulator and a channel.
74 * Query type for a special "handshake" query.
76 * When emulator connects to SDK controller, the first thing that goes
77 * through the socket is a special "handshake" query that delivers channel name
80 public static final int QUERY_HANDSHAKE
= -1;
82 * Handshake query response on condition that service-side channel is available
85 public static final int HANDSHAKE_RESP_CONNECTED
= 0;
87 * Handshake query response on condition that service-side channel is not
88 * available (not registered).
90 public static final int HANDSHAKE_RESP_NOPORT
= 1;
92 * Handshake query response on condition that there is already an existing
93 * emulator connection for this channel. Emulator should stop connection
94 * attempts in this case.
96 public static final int HANDSHAKE_RESP_DUP
= -1;
97 /** Response to an unknown handshake query type. */
98 public static final int HANDSHAKE_RESP_QUERY_UNKNOWN
= -2;
101 * Constants related to multi-touch emulation.
104 /** Received frame is JPEG image. */
105 public static final int MT_FRAME_JPEG
= 1;
106 /** Received frame is RGB565 bitmap. */
107 public static final int MT_FRAME_RGB565
= 2;
108 /** Received frame is RGB888 bitmap. */
109 public static final int MT_FRAME_RGB888
= 3;
111 /** Pointer(s) moved. */
112 public static final int MT_MOVE
= 1;
113 /** First pointer down message. */
114 public static final int MT_FISRT_DOWN
= 2;
115 /** Last pointer up message. */
116 public static final int MT_LAST_UP
= 3;
117 /** Pointer down message. */
118 public static final int MT_POINTER_DOWN
= 4;
119 /** Pointer up message. */
120 public static final int MT_POINTER_UP
= 5;
121 /** Sends framebuffer update. */
122 public static final int MT_FB_UPDATE
= 6;
123 /** Frame buffer update has been received. */
124 public static final int MT_FB_ACK
= 7;
125 /** Frame buffer update has been handled. */
126 public static final int MT_FB_HANDLED
= 8;
127 /** Size of an event entry in the touch event message to the emulator. */
128 public static final int MT_EVENT_ENTRY_SIZE
= 16;
131 * Constants related to sensor emulation.
134 /** Query type for a query that should return the list of available sensors. */
135 public static final int SENSORS_QUERY_LIST
= 1;
136 /** Message that starts sensor emulation. */
137 public static final int SENSORS_START
= 1;
138 /** Message that stops sensor emulation. */
139 public static final int SENSORS_STOP
= 2;
140 /** Message that enables emulation of a particular sensor. */
141 public static final int SENSORS_ENABLE
= 3;
142 /** Message that disables emulation of a particular sensor. */
143 public static final int SENSORS_DISABLE
= 4;
144 /** Message that delivers sensor events to emulator. */
145 public static final int SENSORS_SENSOR_EVENT
= 5;