Mercurial > hg > Applications > TreeVNC
annotate src/main/java/jp/ac/u_ryukyu/treevnc/ScreenChangeRequest.java @ 405:cdab1354e227
Add multiscreen Share Filtering flag
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 09 Nov 2015 01:06:11 +0900 |
parents | 62a6c779fd7f |
children | da1d6d6b4981 |
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; |
170 | 21 private short id; |
257 | 22 private int frameSizeWidth; |
23 private int frameSizeHeight; | |
340 | 24 private int port; |
405
cdab1354e227
Add multiscreen Share Filtering flag
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
359
diff
changeset
|
25 private int shareScreenNumber; |
107 | 26 |
405
cdab1354e227
Add multiscreen Share Filtering flag
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
359
diff
changeset
|
27 public ScreenChangeRequest(String adr, int port, short id, int width, int height, int shareScreenNumber) { |
112 | 28 this.bytes = adr; |
340 | 29 this.port = port; |
170 | 30 this.id = id; |
257 | 31 this.frameSizeWidth = width; |
32 this.frameSizeHeight = height; | |
405
cdab1354e227
Add multiscreen Share Filtering flag
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
359
diff
changeset
|
33 this.shareScreenNumber = shareScreenNumber; |
112 | 34 System.out.println("Client send change screen server request :" + adr); |
107 | 35 } |
36 | |
280
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
37 @Override |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
38 public void send(Writer writer) throws TransportException { |
359 | 39 ByteBuffer out = ByteBuffer.allocate(bytes.length()+25); |
280
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
40 out.order(ByteOrder.BIG_ENDIAN); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
41 out.put(SERVER_CHANGE_REQUEST); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
42 out.put((byte)0); // padding |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
43 out.putShort(id); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
44 out.putInt(bytes.length()); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
45 out.put(bytes.getBytes()); |
257 | 46 out.putInt(frameSizeWidth); |
47 out.putInt(frameSizeHeight); | |
340 | 48 out.putInt(port); |
405
cdab1354e227
Add multiscreen Share Filtering flag
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
359
diff
changeset
|
49 out.putInt(shareScreenNumber); |
280
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
50 writer.write(out.array(), 0, out.position()); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
51 writer.flush(); |
9c5874d0f37e
fix adjustHdSizeButton button, this button send REQUEST_SINGLE_DISPLAY_WIDTH
oc
parents:
257
diff
changeset
|
52 } |
107 | 53 |
54 @Override | |
55 public String toString() { | |
340 | 56 return "Screen change request: [length: " + bytes.length() +", text: ...]" + new String (bytes) + " : " + port; |
107 | 57 } |
58 } |