Beispiel #1
0
 private void setupFakeDevices() {
   mDevices = new Devices(mContext);
   mDevices.removeFakeDevices(getRouterId());
   mTimestamp = System.currentTimeMillis();
   getNetworkIds();
   int total_devices = rnd.nextInt(40) + 3;
   Log.d(TAG, "Generating " + total_devices + " fake devices");
   for (int i = 0; i < total_devices; i++) {
     Device device = new Device(getRouterId(), randomMACAddress(), randomDeviceName());
     device.setCurrentIP("192.168.1." + (rnd.nextInt(253) + 1));
     device.setCurrentNetwork(mNetworkIds[rnd.nextInt(mNetworkIds.length)]);
     device.setActive(rnd.nextInt(100) < 25);
     device.setTrafficStats(0, 0, mTimestamp - 60000); // 1 min ago
     mDevices.insertOrUpdate(device);
   }
 }