@@ -55,18 +55,22 @@ public class NetworkDiscovery
55
55
private class bonour {
56
56
public String address ;
57
57
public String name ;
58
-
59
58
public String board ;
60
59
public String distroversion ;
61
-
62
60
public String port ;
61
+ public boolean ssh_upload ;
62
+ public boolean tcp_check ;
63
+ public boolean auth_upload ;
63
64
64
65
public bonour () {
65
66
this .address = "" ; //$NON-NLS-1$
66
67
this .name = "" ; //$NON-NLS-1$
67
68
this .board = "" ; //$NON-NLS-1$
68
69
this .distroversion = "" ; //$NON-NLS-1$
69
70
this .port = "" ; //$NON-NLS-1$
71
+ this .ssh_upload = true ;
72
+ this .tcp_check = true ;
73
+ this .auth_upload = false ;
70
74
}
71
75
72
76
public String getLabel () {
@@ -97,30 +101,6 @@ public String[] getList() {
97
101
return ret ;
98
102
}
99
103
100
- // @Override
101
- // public List<BoardPort> discovery() {
102
- // List<BoardPort> ports = clonePortsList();
103
- // Iterator<BoardPort> iterator = ports.iterator();
104
- // while (iterator.hasNext()) {
105
- // try {
106
- // BoardPort board = iterator.next();
107
- // if (!NetUtils.isReachable(InetAddress.getByName(board.getAddress()),
108
- // Integer.parseInt(board.getPrefs().get("port")))) {
109
- // iterator.remove();
110
- // }
111
- // } catch (UnknownHostException e) {
112
- // iterator.remove();
113
- // }
114
- // }
115
- // return ports;
116
- // }
117
-
118
- // private List<BoardPort> clonePortsList() {
119
- // synchronized (this) {
120
- // return new ArrayList<BoardPort>(this.ports);
121
- // }
122
- // }
123
-
124
104
public void start () {
125
105
this .timer = new Timer (this .getClass ().getName () + " timer" ); //$NON-NLS-1$
126
106
new NetworkChecker (this , NetworkTopologyDiscovery .Factory .getInstance ()).start (this .timer );
@@ -166,6 +146,15 @@ public void serviceResolved(ServiceEvent serviceEvent) {
166
146
newItem .board = info .getPropertyString ("board" ); //$NON-NLS-1$
167
147
newItem .distroversion = info .getPropertyString ("distro_version" ); //$NON-NLS-1$
168
148
newItem .name = info .getServer ();
149
+ String useSSH = info .getPropertyString ("ssh_upload" ); //$NON-NLS-1$
150
+ String checkTCP = info .getPropertyString ("tcp_check" ); //$NON-NLS-1$
151
+ String useAuth = info .getPropertyString ("auth_upload" ); //$NON-NLS-1$
152
+ if (useSSH != null && useSSH .contentEquals ("no" )) //$NON-NLS-1$
153
+ newItem .ssh_upload = false ;
154
+ if (checkTCP != null && checkTCP .contentEquals ("no" )) //$NON-NLS-1$
155
+ newItem .tcp_check = false ;
156
+ if (useAuth != null && useAuth .contentEquals ("yes" )) //$NON-NLS-1$
157
+ newItem .auth_upload = true ;
169
158
}
170
159
while (newItem .name .endsWith ("." )) { //$NON-NLS-1$
171
160
newItem .name = newItem .name .substring (0 , newItem .name .length () - 1 );
@@ -226,4 +215,50 @@ public void inetAddressRemoved(InetAddress address) {
226
215
}
227
216
}
228
217
}
218
+
219
+ private bonour getBoardByName (String name ) {
220
+ Iterator <bonour > iterator = this .myComPorts .iterator ();
221
+ while (iterator .hasNext ()) {
222
+ bonour board = iterator .next ();
223
+ if (name .equals (board .name )) {
224
+ return board ;
225
+ }
226
+ }
227
+ return null ;
228
+ }
229
+
230
+ public String getAddress (String name ) {
231
+ bonour board = getBoardByName (name );
232
+ if (board == null )
233
+ return null ;
234
+ return board .address ;
235
+ }
236
+
237
+ public String getPort (String name ) {
238
+ bonour board = getBoardByName (name );
239
+ if (board == null )
240
+ return null ;
241
+ return board .port ;
242
+ }
243
+
244
+ public boolean hasAuth (String name ) {
245
+ bonour board = getBoardByName (name );
246
+ if (board == null )
247
+ return false ;
248
+ return board .auth_upload ;
249
+ }
250
+
251
+ public boolean isSSH (String name ) {
252
+ bonour board = getBoardByName (name );
253
+ if (board == null )
254
+ return false ;
255
+ return board .ssh_upload ;
256
+ }
257
+
258
+ public boolean needstcpCheck (String name ) {
259
+ bonour board = getBoardByName (name );
260
+ if (board == null )
261
+ return false ;
262
+ return board .tcp_check ;
263
+ }
229
264
}
0 commit comments