static void Main(string[] args) { var discovery = new AtemDiscoveryService(10000, true); discovery.OnDeviceSeen += (s, d) => { Console.WriteLine("Seen: " + d.ToString()); }; discovery.OnDeviceLost += (s, d) => { Console.WriteLine("Lost: " + d.ToString()); }; Console.Read(); }
public AtemRepository(IHubContext <DevicesHub> context, TransferJobMonitor transfers) { _db = new LiteDatabase(@"MyData.db"); _dbDevices = _db.GetCollection <AtemDevice>("devices"); _devices = new Dictionary <string, AtemDevice>(); _context = context; _transfers = transfers; // Load up old devices foreach (AtemDevice device in _dbDevices.FindAll()) { device.Subscriptions = new HashSet <string>(); SetupConnection(device); _devices[device.Info.Id()] = device; } SendDevicesDebounce = Util.Util.Debounce(() => _context.Clients.All.SendAsync("devices", ListDevices()), 500); _discovery = new AtemDiscoveryService(5000); _discovery.OnDeviceSeen += OnDeviceSeen; _discovery.OnDeviceLost += OnDeviceLost; }