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
|
20
|
17 public NegotiateVNCServer(){
|
|
18 info.setKey("host");
|
|
19 info1.setKey("AliceVNCConfig");
|
7
|
20 }
|
22
|
21
|
20
|
22 @Override
|
7
|
23 public void run() {
|
20
|
24 AliceVNCConfig conf = info1.asClass(AliceVNCConfig.class);
|
|
25 String hostname = info.asString();
|
22
|
26
|
31
|
27 // root node connect to vnc Server first time.
|
|
28 String[] args = {"localhost"};
|
|
29 // negotiate VNCServer by Viewer
|
|
30 Viewer.main(args);
|
24
|
31
|
31
|
32 // currentServer Info
|
32
|
33 AliceVNCMessage currentServerInfo = new AliceVNCMessage(MessageType.CurrentVNCInfo);
|
31
|
34 currentServerInfo.name = hostname;
|
|
35 currentServerInfo.allowChange = conf.getAllowChange();
|
|
36 ArrayList<String> list = new ArrayList<String>();
|
|
37 currentServerInfo.route = list;
|
34
|
38 ods.put("AliceVNCMessage", currentServerInfo);
|
30
|
39
|
7
|
40 }
|
|
41
|
|
42 }
|