/////////////////////////////////////////////////////////////////////// private void SendCommand_Async(InsteonCommand command) { _logger.Debug("queueing {0}", command); ThreadPool.QueueUserWorkItem(delegate { SendCommand_Sync(command); }); }
/////////////////////////////////////////////////////////////////////// public void Send(InsteonCommand command) { if (Settings.Default.SendAsync) { SendCommand_Async(command); } else { SendCommand_Sync(command); } }
/////////////////////////////////////////////////////////////////////// private void SendDeviceCommand(InsteonCommand.Command action, int level) { var cmd = new InsteonCommand { Address = Address, Action = action, Level = level }; Controller.Send(cmd); }
/////////////////////////////////////////////////////////////////////// private void SendCommand_Sync(InsteonCommand command) { _logger.Info("send: {0}", command); _swatch.Clock(delegate { SendCommand(command); }); _logger.Debug("{0} sent in {1} ms", command, _swatch.ElapsedMilliseconds); }
/////////////////////////////////////////////////////////////////////// protected abstract void SendCommand(InsteonCommand cmd);