Mercurial > hg > Applications > tvnjviewer
annotate src/main/java/com/glavsoft/rfb/encoding/decoder/AliceVNCMessage.java @ 8:136ee08cb788
use AliceVNCMessage for sending information with MessagePack
author | YU |
---|---|
date | Thu, 18 Sep 2014 21:11:51 +0900 |
parents | |
children | f9e319a08111 |
rev | line source |
---|---|
8
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
1 package com.glavsoft.rfb.encoding.decoder; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
2 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
3 import org.msgpack.annotation.Message; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
4 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
5 import com.glavsoft.rfb.encoding.EncodingType; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
6 import com.glavsoft.rfb.encoding.PixelFormat; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
7 import com.glavsoft.rfb.encoding.ServerInitMessage; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
8 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
9 @Message |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
10 public class AliceVNCMessage { |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
11 public int x; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
12 public int y; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
13 public int width; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
14 public int height; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
15 public int encodingTypeId; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
16 public byte[] unzip; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
17 public int offset; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
18 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
19 public String name; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
20 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
21 // pixel format info |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
22 public byte bitsPerPixel; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
23 public byte depth; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
24 public byte bigEndianFlag; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
25 public byte trueColourFlag; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
26 public short redMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
27 public short greenMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
28 public short blueMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
29 public byte redShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
30 public byte greenShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
31 public byte blueShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
32 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
33 public AliceVNCMessage(){ |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
34 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
35 } |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
36 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
37 public void setRectangle(FramebufferUpdateRectangle rect){ |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
38 x = rect.x; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
39 y = rect.y; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
40 width = rect.width; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
41 height = rect.height; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
42 encodingTypeId = rect.getEncodingType().getId(); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
43 } |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
44 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
45 public EncodingType getEncodingType() { |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
46 return EncodingType.byId(encodingTypeId); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
47 } |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
48 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
49 public void setPixelFormat(PixelFormat pixelFormat) { |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
50 bitsPerPixel = pixelFormat.bitsPerPixel; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
51 depth = pixelFormat.depth; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
52 bigEndianFlag = pixelFormat.bigEndianFlag; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
53 trueColourFlag = pixelFormat.trueColourFlag; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
54 redMax = pixelFormat.redMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
55 greenMax = pixelFormat.greenMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
56 blueMax = pixelFormat.blueMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
57 redShift = pixelFormat.redShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
58 greenShift = pixelFormat.greenShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
59 blueShift = pixelFormat.blueShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
60 } |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
61 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
62 public PixelFormat getPixelFormat(){ |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
63 PixelFormat pixelFormat = new PixelFormat(); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
64 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
65 pixelFormat.bitsPerPixel = bitsPerPixel; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
66 pixelFormat.depth = depth; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
67 pixelFormat.bigEndianFlag = bigEndianFlag; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
68 pixelFormat.trueColourFlag = trueColourFlag; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
69 pixelFormat.redMax = redMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
70 pixelFormat.greenMax = greenMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
71 pixelFormat.blueMax = blueMax; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
72 pixelFormat.redShift = redShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
73 pixelFormat.greenShift = greenShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
74 pixelFormat.blueShift = blueShift; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
75 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
76 return pixelFormat; |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
77 } |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
78 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
79 public void setServerInitMessage(ServerInitMessage serverInitMessage) { |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
80 setPixelFormat(serverInitMessage.getPixelFormat()); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
81 width = serverInitMessage.getFrameBufferWidth(); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
82 height = serverInitMessage.getFrameBufferHeight(); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
83 name = serverInitMessage.getName(); |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
84 |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
85 } |
136ee08cb788
use AliceVNCMessage for sending information with MessagePack
YU
parents:
diff
changeset
|
86 } |