diff src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java @ 33:9d3478d11d3b

Add the processing of client
author Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
date Tue, 04 Sep 2012 06:06:17 +0900
parents 758d025ee24b
children 1b81deb0abb3
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java	Mon Sep 03 17:34:52 2012 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java	Tue Sep 04 06:06:17 2012 +0900
@@ -15,6 +15,7 @@
 import com.glavsoft.transport.Writer;
 
 public class MyRfbProto {
+	final static int FramebufferUpdateRequest = 3;
 	final static int CheckDelay = 11;
 	final static int FramebufferUpdate = 0;
 	private ProtocolContext context;
@@ -23,6 +24,10 @@
 	protected MulticastQueue<LinkedList<ByteBuffer>> multicastqueue = new MulticastQueue<LinkedList<ByteBuffer>>();
 	private RequestScreenThread rThread;
 	private boolean proxyFlag = true;
+	
+	public MyRfbProto() {
+		rThread = new RequestScreenThread(this);
+	}
 
 	
 	public void newClient(AcceptThread acceptThread, final Socket newCli,
@@ -284,4 +289,27 @@
 	public void selectPort(int port) {
 		
 	}
+
+
+	public void writeFramebufferUpdateRequest(int x, int y, int w, int h,
+			boolean incremental) throws TransportException {
+		byte[] b = new byte[10];
+
+		b[0] = (byte) FramebufferUpdateRequest; // 3 is FrameBufferUpdateRequest
+		b[1] = (byte) (incremental ? 1 : 0);
+		b[2] = (byte) ((x >> 8) & 0xff);
+		b[3] = (byte) (x & 0xff);
+		b[4] = (byte) ((y >> 8) & 0xff);
+		b[5] = (byte) (y & 0xff);
+		b[6] = (byte) ((w >> 8) & 0xff);
+		b[7] = (byte) (w & 0xff);
+		b[8] = (byte) ((h >> 8) & 0xff);
+		b[9] = (byte) (h & 0xff);
+
+//		os.write(b);
+	}
+	
+	public void notProxy() {
+		proxyFlag = false;
+	}
 }