public MainForm() { InitializeComponent(); Self = this; // Works only if there is only one mainform GetObjectsBtn.Enabled = false; ReadPresentValueBtn.Enabled = false; TestBinaryOnBtn.Enabled = false; TestBinaryOffBtn.Enabled = false; ObjectListLabel.Text = ""; // Create the BACNet stack BACStack = new BACnetStack(); }
public override void handle(LocalDevice localDevice, Address from, OctetString linkService) { if (!ObjectType.Device.Equals(iAmDeviceIdentifier.ObjectType)) { //LOGGER.warning("Received IAm from an object that is not a device."); Debug.Print("Received IAm from an object that is not a device."); return; } // Make sure we're not hearing from ourselves. uint myDoi = localDevice.Configuration.InstanceId; uint remoteDoi = iAmDeviceIdentifier.InstanceNumber; if (remoteDoi == myDoi) { // Get my bacnet address and compare the addresses foreach (Address addr in localDevice.AllLocalAddresses) { if (addr.MacAddress.Equals(from.MacAddress)) { // This is a local address, so ignore. return; } //LOGGER.warning("Another instance with my device instance ID found!"); Debug.Print("Another instance with my device instance ID found! Here: " + from.MacAddress.MacAddressDottedString); } } // Register the device in the list of known devices. RemoteDevice d = BACnetStack.CreateRemoteDevice(remoteDoi, from, linkService); d.MaxAPDULengthAccepted = maxAPDULengthAccepted.Value; d.SegmentationSupported = segmentationSupported; d.VendorID = vendorId.Value; // Fire the appropriate event. // TODO localDevice.getEventHandler().fireIAmReceived(d); }
private BACnetDevice() { BACStack = new BACnetStack(); }