/// <summary> /// Creates a process options instance /// </summary> /// <returns>The process options instance</returns> public override IProcessOptions CreateOptions() { var ret = new DeviceFinderOptions() { ProcessId = this.ProcessId }; return(ret); }
public static void Main(string[] args) { /* * ForeignDevicePortOptions options = new ForeignDevicePortOptions() * { * PortId = 1, * BbmdHost = "<bbmd-ip-here>", * BbmdPort = 47808, * LocalHost = "0.0.0.0", * LocalPort = 47808, * RegistrationInterval = TimeSpan.FromSeconds(30) * }; */ EthernetPortOptions ethOptions = new EthernetPortOptions() { PortId = 1 }; PortManagerOptions portMgrOptions = new PortManagerOptions(); RouterOptions routerOpts = new RouterOptions(); routerOpts.PortNetworkMappings.Add(new KeyValuePair <byte, ushort>(1, 0)); HostOptions hostOpts = new HostOptions(); DeviceFinderOptions finderOpts = new DeviceFinderOptions(); //using (ForeignDevicePort port = new ForeignDevicePort(options)) using (EthernetPort port = new EthernetPort(ethOptions)) using (PortManager manager = new PortManager(portMgrOptions)) using (Router router = new Router(routerOpts)) using (Host host = new Host(hostOpts)) using (DeviceFinder finder = new DeviceFinder(finderOpts)) using (Session session = new Session(port, manager, router, host, finder)) { var client = new BACnet.Client.Client(host); // as long as there is at least 1 new devices found every 10 seconds, // for each found device, read that devices name and print it to the console finder.Timeout(TimeSpan.FromSeconds(10)) .Catch(Observable.Empty <DeviceTableEntry>()) .ForEachAsync(entry => { Console.WriteLine(entry.Instance); }) .Wait(); } }