private static boolean isToUpdate(Entry entry) { AbstractDataSource wifiSource = new WifiDataSource(); Wifi existing = (Wifi) wifiSource.query(entry.wifi.bssid); boolean toOld = true; boolean badLevel = true; if (!existing.bssid.equals("")) { toOld = existing.timestamp + 60000 < System.currentTimeMillis(); badLevel = existing.level < entry.wifi.level; } if (toOld || badLevel) { return true; } else { return false; } }
private static void putCompleteWifiEntry(Entry entry) { AbstractDataSource DAO; if (!entry.wps.bssid.equals("")) { DAO = new StandardDataSource(SqlStaticStrings.TABLE_WPS); DAO.createEntry(entry.wps); } if (!entry.wpa2.bssid.equals("")) { DAO = new WPA2DataSource(); DAO.createEntry(entry.wpa2); } if (!entry.wpa.bssid.equals("")) { DAO = new WPADataSource(); DAO.createEntry(entry.wpa); } if (!entry.wep.bssid.equals("")) { DAO = new StandardDataSource(SqlStaticStrings.TABLE_WEP); DAO.createEntry(entry.wep); } if (!entry.ess.bssid.equals("")) { DAO = new StandardDataSource(SqlStaticStrings.TABLE_ESS); DAO.createEntry(entry.ess); } if (!entry.wifi.bssid.equals("")) { DAO = new WifiDataSource(); DAO.createEntry(entry.wifi); } }