use of im.tny.segvault.s2ls.wifi.WiFiLocator in project underlx by underlx.
the class MainService method putNetwork.
private void putNetwork(final Network net) {
synchronized (lock) {
// create Realm stations for the network if they don't exist already
Realm realm = Application.getDefaultRealmInstance(this);
realm.executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
for (Station s : net.getStations()) {
if (realm.where(RStation.class).equalTo("id", s.getId()).count() == 0) {
RStation rs = new RStation();
rs.setStop(s);
rs.setNetwork(net.getId());
realm.copyToRealm(rs);
}
}
}
});
realm.close();
net.setEdgeWeighter(cweighter);
networks.put(net.getId(), net);
S2LS loc = new S2LS(net, new S2LSChangeListener());
locServices.put(net.getId(), loc);
WiFiLocator wl = new WiFiLocator(net);
wfc.setLocatorForNetwork(net, wl);
loc.addNetworkDetector(wl);
loc.addProximityDetector(wl);
loc.addLocator(wl);
}
}
Aggregations