annotate src/main/java/jp/ac/u_ryukyu/treevnc/SendSingleDisplayWidth.java @ 281:16d3584ae7a0

fix SEND_SINGLE_DISPLAY_WIDTH
author oc
date Sun, 11 Jan 2015 03:55:03 +0900
parents dce00f9ac98c
children c10e0dee7bbb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
279
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
1 package jp.ac.u_ryukyu.treevnc;
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
2
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
3 import java.io.UnsupportedEncodingException;
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
4 import java.nio.ByteBuffer;
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
5 import java.nio.ByteOrder;
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
6 import java.util.LinkedList;
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
7 import com.glavsoft.rfb.encoding.EncodingType;
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
8
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
9 /**
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
10 * Created by OcBookPro on 15/01/10.
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
11 */
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
12 public class SendSingleDisplayWidth {
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
13
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
14 private ByteBuffer msg;
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
15 private TreeRFBProto rfb;
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
16 private int singleDisplayWidth;
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
17
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
18 public SendSingleDisplayWidth(TreeRFBProto rfb, int singleWidth) {
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
19 this.rfb = rfb;
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
20 this.singleDisplayWidth = singleWidth;
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
21 }
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
22
281
16d3584ae7a0 fix SEND_SINGLE_DISPLAY_WIDTH
oc
parents: 279
diff changeset
23 public SendSingleDisplayWidth() {
16d3584ae7a0 fix SEND_SINGLE_DISPLAY_WIDTH
oc
parents: 279
diff changeset
24 }
16d3584ae7a0 fix SEND_SINGLE_DISPLAY_WIDTH
oc
parents: 279
diff changeset
25
279
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
26 public void sendSingleDisplayWidth() throws UnsupportedEncodingException {
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
27 LinkedList<ByteBuffer> linkedListSendSingleDisplayWidth = new LinkedList<ByteBuffer>();
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
28 linkedListSendSingleDisplayWidth.add(singleDisplayWidth(0, 0, this.singleDisplayWidth, 0));
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
29 this.rfb.addSerialNumber(linkedListSendSingleDisplayWidth);
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
30 this.rfb.multicastqueue.put(linkedListSendSingleDisplayWidth);
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
31 System.out.println(this.singleDisplayWidth + " : send single display width");
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
32 }
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
33
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
34 public ByteBuffer singleDisplayWidth(int i, int j, int singleDisplayWidth, int height) throws UnsupportedEncodingException {
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
35 msg = ByteBuffer.allocate(24).order(ByteOrder.BIG_ENDIAN);
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
36 msg.put((byte) 0); // FrameBufferUpdate
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
37 msg.put((byte) 0); // padding
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
38 msg.putShort((short) 1); // number of rectangle
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
39 msg.putShort((short) i);
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
40 msg.putShort((short) j);
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
41 msg.putShort((short) singleDisplayWidth);
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
42 msg.putShort((short) height);
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
43 msg.putInt(EncodingType.SEND_SINGLE_DISPLAY_WIDTH.getId());
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
44 msg.flip();
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
45 return msg;
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
46 }
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
47
dce00f9ac98c add encodingType SEND_SINGLE_DISPLAY_WIDTH.
oc
parents:
diff changeset
48 }