public Searvice(IHubContext <Hubs.LedHub> hub) { Console.WriteLine($"{DateTime.Now} : Searvice._ctr"); _hubContext = hub; var pin = new PinConfigration(14, true) { AutoClose = false }; controller = new GpioController(pin); watcher = new GpioWatcher(pin); watcher.ValueChanged += async() => { Console.WriteLine($"{DateTime.Now} : ValueChanged"); var value = await Task.Run(() => { return(controller.Value); }); var status = new LedStatus() { Value = value }; await _hubContext.Clients.All.SendAsync("ChangeLedStatus", status); }; }
public LedHub() { //Console.WriteLine($"{DateTime.Now} : LedHub._ctr"); var pin = new PinConfigration(14, true) { AutoClose = false }; controller = new GpioController(pin); }