Mercurial > hg > Applications > AliceVNC
annotate src/main/java/jp/ac/u_ryukyu/alicevnc/ReceiveUpdateRectangle.java @ 41:1cb529b46876
change measurement method
author | sugi |
---|---|
date | Tue, 09 Dec 2014 15:24:54 +0900 |
parents | 47d6f7a76b86 |
children | 9027795a22f0 |
rev | line source |
---|---|
2 | 1 package jp.ac.u_ryukyu.alicevnc; |
2 | |
5
c05d3b89b446
Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents:
4
diff
changeset
|
3 import java.util.ArrayList; |
c05d3b89b446
Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents:
4
diff
changeset
|
4 |
32 | 5 import jp.ac.u_ryukyu.ie.cr.DecodeInfomation; |
6 | |
2 | 7 import com.glavsoft.exceptions.TransportException; |
4 | 8 import com.glavsoft.rfb.encoding.EncodingType; |
2 | 9 import com.glavsoft.rfb.encoding.decoder.FramebufferUpdateRectangle; |
12 | 10 import com.glavsoft.rfb.encoding.decoder.RichCursorDecoder; |
2 | 11 import com.glavsoft.rfb.encoding.decoder.ZRLEDecoder; |
12 | |
13 import alice.codesegment.CodeSegment; | |
14 import alice.datasegment.CommandType; | |
40 | 15 import alice.datasegment.ReceiveData; |
2 | 16 import alice.datasegment.Receiver; |
17 | |
18 public class ReceiveUpdateRectangle extends CodeSegment{ | |
19 | |
20 private Receiver info = ids.create(CommandType.PEEK); | |
17 | 21 private Receiver info1 = ids.create(CommandType.TAKE); // AliceVNC Message |
22 private Receiver info2 = ids.create(CommandType.TAKE); | |
23 private Receiver info3 = ids.create(CommandType.PEEK); | |
5
c05d3b89b446
Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents:
4
diff
changeset
|
24 |
2 | 25 public ReceiveUpdateRectangle(){ |
31 | 26 info.setKey("holder"); |
32 | 27 info1.setKey("updateRectangle"); |
28 info2.setKey("pixelData"); | |
17 | 29 info3.setKey("_CLIST"); |
2 | 30 } |
5
c05d3b89b446
Send DecodeInfo to Children Nodes. but occur ArrayIndexOutOfBoundsException.
YU
parents:
4
diff
changeset
|
31 |
41 | 32 @SuppressWarnings("unchecked") |
10 | 33 @Override |
2 | 34 public void run() { |
41 | 35 |
17 | 36 // send other node |
37 ArrayList<String> clist = info3.asClass(ArrayList.class); | |
38 for (String node : clist){ | |
31 | 39 if (!info1.from.equals(node)) { |
17 | 40 // not need send data comes from |
31 | 41 // Data Segment from other node is already serialized |
35 | 42 ods.put(node, "updateRectangle", info1.getReceiveData()); //TODO need timeout counter |
20 | 43 //ods.setCompressFlag(true); |
40 | 44 |
45 // for measurement | |
46 ReceiveData r = info2.getReceiveData(); | |
47 if (!r.setTime) { | |
48 r.setTime = true; | |
49 r.time = System.currentTimeMillis(); | |
50 } | |
32 | 51 ods.put(node, "pixelData", info2.getReceiveData()); |
19 | 52 ods.setCompressFlag(false); |
17 | 53 } |
40 | 54 } |
31 | 55 |
2 | 56 try { |
10 | 57 RenderAndControllerHolder holder = info.asClass(RenderAndControllerHolder.class); |
32 | 58 DecodeInfomation message = info1.asClass(DecodeInfomation.class); |
10 | 59 |
35 | 60 if (message.getEncodingType() == EncodingType.ZRLEE){ //TODO |
10 | 61 ZRLEDecoder decoder = new ZRLEDecoder(); |
62 FramebufferUpdateRectangle rect = new FramebufferUpdateRectangle( | |
63 message.x, message.y, message.width, message.height); | |
12 | 64 rect.encodingType = message.getEncodingType(); |
17 | 65 byte[] buf = info2.asClass(byte[].class); |
31 | 66 |
17 | 67 // this method name is wrong. |
19 | 68 decoder.decode(holder.getRenderer(), rect, buf, 0); |
10 | 69 holder.getRepaintController().repaintBitmap(rect); |
70 | |
31 | 71 } else if (message.getEncodingType() == EncodingType.DESKTOP_SIZE) { |
10 | 72 holder.setRenderer( |
31 | 73 holder.getRepaintController().createRenderer(null, message.width, |
11 | 74 message.height, message.getPixelFormat()) |
10 | 75 ); |
33 | 76 boolean visible = true; |
77 if ("local".equals(info2.from)) { | |
78 visible = false; | |
79 } | |
80 holder.getViewerWindow().setVisible(visible); | |
12 | 81 } else if (message.getEncodingType() == EncodingType.RICH_CURSOR) { |
17 | 82 byte[] buf = info2.asClass(byte[].class); |
83 RichCursorDecoder.getInstance().decode(holder.getRenderer(), message, buf); | |
12 | 84 holder.getRepaintController().repaintCursor(); |
31 | 85 |
12 | 86 } |
40 | 87 // for measurement |
41 | 88 if (info2.getReceiveData().setTime) { |
89 ods.put("manager", "measurement", info2.getReceiveData()); | |
90 } | |
91 | |
40 | 92 |
35 | 93 this.recycle(); //TODO |
10 | 94 |
2 | 95 } catch (TransportException e) { |
96 e.printStackTrace(); | |
97 } | |
98 } | |
99 | |
100 } |