/// <summary> /// Get the lights. /// </summary> /// <returns></returns> public async Task <IEnumerable <Light> > GetLightsAsync() { return(await locker.Run(async() => { EnsureClient(); return await client.GetLightsAsync(); })); }
/// <summary> /// Set the power relay to the specified settings. /// </summary> /// <param name="settings"></param> /// <returns></returns> public async Task ApplySettings(IEnumerable <RelaySetting> settings) { await locker.Run(async() => { //Run on background thread, hold locker until done await Task.Run(() => { powerStrip.SetSettings(settings); powerStrip.ApplySettings(); }); }); }
//Uses the lirc interface //http://lirc.org/html/lircd.html public async Task <String> SendMessage(String device, String button) { return(await readLock.Run(async() => { var message = ASCIIEncoding.ASCII.GetBytes($"SEND_ONCE {device} {button}\n"); await tcpStream.WriteAsync(message, 0, message.Length); return await GetResult(tcpClient, tcpStream); })); }
public async Task <string> GetName(CecLogicalAddress address) { return(await readLock.Run(() => cecManager.GetName(address))); }