7
|
1 package jp.ac.u_ryukyu.alicevnc;
|
|
2
|
24
|
3 import java.util.ArrayList;
|
|
4
|
32
|
5 import jp.ac.u_ryukyu.alicevnc.AliceVNCMessage.MessageType;
|
24
|
6
|
7
|
7 import com.glavsoft.viewer.Viewer;
|
|
8
|
|
9 import alice.codesegment.CodeSegment;
|
|
10 import alice.datasegment.CommandType;
|
|
11 import alice.datasegment.Receiver;
|
|
12
|
20
|
13 public class NegotiateVNCServer extends CodeSegment {
|
7
|
14 private Receiver info = ids.create(CommandType.PEEK);
|
20
|
15 private Receiver info1 = ids.create(CommandType.PEEK);
|
7
|
16
|
47
|
17 public NegotiateVNCServer(CodeSegment cs){
|
|
18 this.aliceDaemon = cs.aliceDaemon;
|
|
19 info.setKey("host", this);
|
|
20 info1.setKey("AliceVNCConfig", this);
|
7
|
21 }
|
22
|
22
|
20
|
23 @Override
|
7
|
24 public void run() {
|
20
|
25 AliceVNCConfig conf = info1.asClass(AliceVNCConfig.class);
|
|
26 String hostname = info.asString();
|
22
|
27
|
31
|
28 // root node connect to vnc Server first time.
|
|
29 String[] args = {"localhost"};
|
|
30 // negotiate VNCServer by Viewer
|
|
31 Viewer.main(args);
|
24
|
32
|
31
|
33 // currentServer Info
|
32
|
34 AliceVNCMessage currentServerInfo = new AliceVNCMessage(MessageType.CurrentVNCInfo);
|
31
|
35 currentServerInfo.name = hostname;
|
|
36 currentServerInfo.allowChange = conf.getAllowChange();
|
|
37 ArrayList<String> list = new ArrayList<String>();
|
|
38 currentServerInfo.route = list;
|
34
|
39 ods.put("AliceVNCMessage", currentServerInfo);
|
30
|
40
|
7
|
41 }
|
|
42
|
|
43 }
|