static void Main(string[] args) { var sm = new StackManager(); sm.AddLogHandler(new PrintingLogAdapter()); //this is optional sm.AddTCPClient("client", FilterLevel.LEV_INFO, 5000, "127.0.0.1", 20000); var config = new MasterStackConfig(); config.link.useConfirms = true; //setup your stack configuration here. var commandAcceptor = sm.AddMaster("client", "master", FilterLevel.LEV_INFO, new PrintingDataObserver(), config); Console.WriteLine("Enter an index to send a command"); while (true) { System.UInt32 index = System.UInt32.Parse(Console.ReadLine()); DateTime start = DateTime.Now; var future = commandAcceptor.AcceptCommand(new BinaryOutput(ControlCode.CC_PULSE, 1, 100, 100), index); CommandStatus result = future.Await(); DateTime end = DateTime.Now; TimeSpan duration = end - start; Console.WriteLine("Result: " + result + " and took " + duration.Ticks + " Ticks"); } }
private void stackBrowser1_OnAddMaster(string name, string port, FilterLevel level, MasterStackConfig config) { var observer = new EventedDataObserver(this); var control = this.stackDisplayControl.AddMaster(name, observer.MeasurementSource); control.CommandAcceptor = sm.AddMaster(port, name, level, observer, config); }
static void Main(string[] args) { var sm = new StackManager(); sm.AddLogHandler(new PrintingLogAdapter()); //this is optional sm.AddTCPv4Client("client", FilterLevel.LEV_INFO, 5000, "127.0.0.1", 20000); var config = new MasterStackConfig(); config.link.useConfirms = true; //setup your stack configuration here. var commandAcceptor = sm.AddMaster("client", "master", FilterLevel.LEV_INFO, new PrintingDataObserver(), config); Console.WriteLine("Enter an index to send a command"); while (true) { System.UInt32 index = System.UInt32.Parse(Console.ReadLine()); DateTime start = DateTime.Now; var future = commandAcceptor.AcceptCommand(new BinaryOutput(ControlCode.CC_PULSE, 1, 100, 100), index); CommandStatus result = future.Await(); DateTime end = DateTime.Now; TimeSpan duration = end - start; Console.WriteLine("Result: " + result + " and took " + duration.Ticks + " Ticks"); } }