1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
// License: BSD/LGPL
// Copyright (C) 2011-2018 Thomas d'Otreppe
//
using System.Threading;
using WirelessPanda.Readers;
using WirelessPanda;
using System.Collections;
using System.Collections.Generic;
using System;
namespace NewStationNotify
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine(DateTime.Now + " - Program started");
Reader r = new UniversalReader("/home/user/dump-01.csv");
List<Station> stationList = new List<Station>();
// Read the file
r.Read();
// Add existing stations to the list
stationList.AddRange(r.Stations);
while (true) {
// Sleep 5 seconds
Thread.Sleep(5000);
Console.WriteLine(DateTime.Now + " - Checking for updates");
// Update file
r.Read();
// Get station list
foreach(Station sta in r.Stations) {
// If new station, update us
if (!stationList.Contains(sta)) {
stationList.Add(sta);
// Display it on the command line
Console.WriteLine(DateTime.Now + " - New station: " + sta.StationMAC);
// Display it as a notification
Notification.Notify(sta.BSSID, sta.StationMAC);
}
}
}
}
}
}
|