Exemplo n.º 1
0
        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();
                                }
        }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Refreshes information on the panel
 /// </summary>
 /// <param name="client">The client to use for refreshing</param>
 public async virtual Task Refresh(BACnet.Client.Client client)
 {
     // get rid of warning
     await Task.Delay(0);
 }