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