2 #define cmd_Query 0x80000001
3 #define cmd_Show 0x80000002
4 #define cmd_Update 0x00000003
5 #define cmd_Scroll 0x00000004
6 #define cmd_Mouse 0x00000005
7 #define cmd_Touch 0x00000006
8 #define cmd_Key 0x00000007
9 #define cmd_Flush 0x00000008
10 #define cmd_Hello 0x80000009
12 #define CMD_NEED_REPLY 0x80000000
17 #define PROTOCOL_VERSION 2 /* Current protocol version */
20 * Display server data packets consist of ULONGs. This makes it simpler to parse them in Java code.
22 * Yes, this is not 64-bit-safe. But:
23 * a) Android isn't going to move to 64-bit machines for now.
24 * b) Java doesn't have "pointer-sized" data type, it has either 32 bits (int)
25 * or 64 bits (long). And we don't want to cope with UQUADs here.
26 * If support for 64 bits is ever needed, perhaps the best way is to make 64-bit
27 * versions of some commands (which require a pointer), which use two ULONGs for it.
28 * For this purpose we store addresses at the end of packets. It will be possible to determine
29 * 64-bit versions just by increased length.
31 * The general conventions are:
32 * - We send commands and get responses and event notifications from the server.
33 * - Some of commands need responses from the server. We (and server) just know what commands these are.
34 * CMD_NEED_REPLY flag exists just for simplicity. We can't just add it to some command.
35 * - We never respond somehow on event notifications.
36 * - If the server doesn't recognize some command, it will always send back NAK reply. It's up to us to
37 * ignore this NAK if we don't wait for any response.
38 * - The first command sent to server must be cmd_Hello. This way we verify protocol version. The server
39 * will respond with NAK if it doesn't understand us.
43 * This is raw packet header.
44 * It is used for both requests and responses.
48 ULONG cmd
; /* Command code */
49 ULONG len
; /* Number of parameters */
50 /* ULONG parameters follow */
53 /* This structure is used to query a request which needs a response.*/
58 ULONG signal
; /* Reply signal */
59 ULONG status
; /* Delivery status */
60 /* Encapsulated packet header */
65 /* Partucilar forms of command requests */
67 /* Query display size (v2) */
70 struct WaitRequest req
; /* cmd_Query, 1 */
71 /* Request parameters */
72 ULONG id
; /* Display ID, currently always zero */
73 /* Response data (16 bytes) */
74 ULONG width
; /* Full display size */
76 ULONG titlebar
; /* Android screenbar size */
77 ULONG orientation
; /* Orientation in which size was taken */
80 /* Show a single bitmap on display (v2) */
83 struct WaitRequest req
; /* cmd_Show, 8 */
85 ULONG displayid
; /* DisplayID, currently always zero */
86 ULONG left
; /* Offset */
88 ULONG width
; /* Size */
90 ULONG mod
; /* Bytes per line */
91 ULONG orientation
; /* Orientation */
92 ULONG addr
; /* Start address */
93 /* Response has no data, only echo */
97 * The following requests don't use WaitRequest because they don't need to be replied.
98 * They are used with SendRequest() function.
101 /* Update screen region */
104 struct Request req
; /* cmd_Update, 5 */
106 ULONG id
; /* Bitmap ID, reserved */
107 ULONG left
; /* Rectangle to update */
113 /* Scroll a bitmap */
116 struct Request req
; /* cmd_Scroll, 3 */
118 ULONG id
; /* Bitmap ID, reserved */
119 ULONG left
; /* New offset */
123 /* Initial handshake and protocol version verification */
126 struct WaitRequest req
; /* cmd_Hello, 1 */
127 ULONG version
; /* Protocol version */
130 /* Mouse/touchscreen event data */
144 void agfxInt(int pipe
, int mode
, void *data
);
145 void SendRequest(struct Request
*req
, struct agfx_staticdata
*xsd
);
146 void DoRequest(struct WaitRequest
*req
, struct agfx_staticdata
*xsd
);