Mercurial > hg > Members > riono > TreeVNC_ja_comment
annotate src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java @ 427:ed15f0bd8dfa
Remove shareScrrenNumber for ScreenChangeRequest Message
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 01 Feb 2016 04:39:53 +0900 |
parents | c225c7963778 |
children |
rev | line source |
---|---|
107 | 1 package jp.ac.u_ryukyu.treevnc; |
2 | |
112 | 3 import java.nio.ByteBuffer; |
4 import java.nio.ByteOrder; | |
5 | |
107 | 6 import com.glavsoft.exceptions.TransportException; |
7 import com.glavsoft.rfb.client.ClientToServerMessage; | |
8 import com.glavsoft.transport.Writer; | |
9 | |
10 /** | |
339
4713559f5838
if have a parent, send serverChangeRequest and whereToConnect
oc
parents:
280
diff
changeset
|
11 * ServerChangeRequest |
4713559f5838
if have a parent, send serverChangeRequest and whereToConnect
oc
parents:
280
diff
changeset
|
12 * Change VNCServer |
4713559f5838
if have a parent, send serverChangeRequest and whereToConnect
oc
parents:
280
diff
changeset
|
13 * 1 - U8 - 240 |
107 | 14 * 3 - - padding |
339
4713559f5838
if have a parent, send serverChangeRequest and whereToConnect
oc
parents:
280
diff
changeset
|
15 * 4 - - id |
107 | 16 * 4 - U32 - length |
17 * length - U8 array - text | |
18 */ | |
19 public class ScreenChangeRequest implements ClientToServerMessage { | |
113
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
20 final String bytes; |
410 | 21 private final int scale; |
417
c225c7963778
Send screen position
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
410
diff
changeset
|
22 private final int x; |
c225c7963778
Send screen position
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
410
diff
changeset
|
23 private final int y; |
410 | 24 private short id; |
257 | 25 private int frameSizeWidth; |
26 private int frameSizeHeight; | |
340 | 27 private int port; |
107 | 28 |
427
ed15f0bd8dfa
Remove shareScrrenNumber for ScreenChangeRequest Message
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
417
diff
changeset
|
29 public ScreenChangeRequest(String adr, int port, short id, int x, int y, int width, int height, int scale) { |
112 | 30 this.bytes = adr; |
340 | 31 this.port = port; |
170 | 32 this.id = id; |
417
c225c7963778
Send screen position
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
410
diff
changeset
|
33 this.x = x; |
c225c7963778
Send screen position
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
410
diff
changeset
|
34 this.y = y; |
257 | 35 this.frameSizeWidth = width; |
36 this.frameSizeHeight = height; | |
410 | 37 this.scale = scale; |
112 | 38 System.out.println("Client send change screen server request :" + adr); |
107 | 39 } |
40 | |
280
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
41 @Override |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
42 public void send(Writer writer) throws TransportException { |
417
c225c7963778
Send screen position
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
410
diff
changeset
|
43 ByteBuffer out = ByteBuffer.allocate(bytes.length()+37); |
280
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
44 out.order(ByteOrder.BIG_ENDIAN); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
45 out.put(SERVER_CHANGE_REQUEST); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
46 out.put((byte)0); // padding |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
47 out.putShort(id); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
48 out.putInt(bytes.length()); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
49 out.put(bytes.getBytes()); |
417
c225c7963778
Send screen position
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
410
diff
changeset
|
50 out.putInt(x); |
c225c7963778
Send screen position
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
410
diff
changeset
|
51 out.putInt(y); |
257 | 52 out.putInt(frameSizeWidth); |
53 out.putInt(frameSizeHeight); | |
340 | 54 out.putInt(port); |
410 | 55 out.putInt(scale); |
280
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
56 writer.write(out.array(), 0, out.position()); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
57 writer.flush(); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
58 } |
107 | 59 |
60 @Override | |
61 public String toString() { | |
340 | 62 return "Screen change request: [length: " + bytes.length() +", text: ...]" + new String (bytes) + " : " + port; |
107 | 63 } |
64 } |