• Y
    YEJI

    Hello, Thank you for answer.
    so If I want to make a lot of instance number(devices), What should I do?
    Should I get lot of IPs and make transports?
    Is it possible to make one physical device and make multiple IP transports?

    final IpNetwork network = new IpNetworkBuilder().withBroadcast("192.168.1.101", 16).withPort(47808).withLocalBindAddress("192.168.1.255").build();
    final IpNetwork network = new IpNetworkBuilder().withBroadcast("192.168.1.102", 16).withPort(47808).withLocalBindAddress("192.168.1.255").build();
    transport = new DefaultTransport(network);
    transport2 = new DefaultTransport(network2);
    localDevice = new LocalDevice(1234, transport);
    localDevice2 = new LocalDevice(1235, transport2);
    localDevice.initialize();
    localDevice2.initialize();
    

    posted in BACnet4J general discussion read more
  • Y
    YEJI

    Hello,
    I'm making multiple remote device binded into local device, But I still get error.

    final byte[] a = {(byte) 0xc0,(byte) 0xa8,0x01,0x65,(byte) 0xba,(byte) 0xc0};
    final Address macAddress = new Address(a);
    final RemoteDevice rd = new RemoteDevice(localDevice, 1235);
    rd.setAddress(macAddress);
    final ObjectIdentifier ai1 = new ObjectIdentifier(ObjectType.analogInput, 0);
    final ObjectIdentifier ai2 = new ObjectIdentifier(ObjectType.analogInput, 1);
    System.out.println(macAddress);
    WhoIsRequest whr = new WhoIsRequest();
    whr.handle(localDevice, macAddress);
    ai1.write(new ByteQueue(new byte[] { 0 }), 0);
    ai2.write(new ByteQueue(new byte[] { 1 }), 1);
    rd.setDeviceProperty(PropertyIdentifier.objectList, new SequenceOf<>(ai1, ai2));
    final UnconfirmedRequestService service = new IAmRequest(ai1,
    new UnsignedInteger(1024), Segmentation.noSegmentation, new UnsignedInteger(99));
    final APDU pdu = new UnconfirmedRequest(service);
    localDevice.sendGlobalBroadcast(service);
    final SequenceOf<ObjectIdentifier> objectList = rd.getDeviceProperty(PropertyIdentifier.objectList);
    RemoteDeviceFuture rdf1 = localDevice.getRemoteDevice(1235);
    System.out.println(rdf1);
    RemoteDevice rd1 = rdf1.get();  //error occurs on this line.
    System.out.println(rd1);
    RemoteDeviceFuture rdf2 = localDevice.getRemoteDevice(1236);
    System.out.println(rdf2);
    RemoteDevice rd2 = rdf2.get();
    System.out.println(rd2);
    final EventNotifListener listener1 = new EventNotifListener();
    localDevice.getEventHandler().addListener(listener1);
    localDevice.sendGlobalBroadcast(whr);
    

    and my error message is this.

    BROAD: 192.168.1.255
    SUB: 255.255.0.0=
    Address [networkNumber=0, macAddress=[c0,a8,1,65,ba,c0]]
    com.serotonin.bacnet4j.LocalDevice$2@7a0a427b
    1819 [BACnet4J transport for device 1234] WARN com.serotonin.bacnet4j.service.unconfirmed.IAmRequest - Received IAm from an object that is not a device from Address [networkNumber=0, macAddress=[c0,a8,1,65,ba,c0]]
    com.serotonin.bacnet4j.exception.BACnetTimeoutException: No response from instanceId 1235
    

    I added some localdevice.send method, but I get this error.

    localDevice.send(rd, new WritePropertyRequest(new ObjectIdentifier(ObjectType.analogInput, 0),PropertyIdentifier.presentValue, null, new UnsignedInteger(2), new UnsignedInteger(8)))
    					 .get();
    
    1986 [BACnet4J transport for device 1234] ERROR com.serotonin.bacnet4j.transport.DefaultTransport - Error during send: OutgoingConfirmed [maxAPDULengthAccepted=-1, segmentationSupported=null, service=Encodable(com.serotonin.bacnet4j.service.confirmed.WritePropertyRequest), consumer=com.serotonin.bacnet4j.transport.ServiceFutureImpl@7b49796f, address=Address [networkNumber=0, macAddress=[c0,a8,1,65,ba,c0]], linkService=null]
    1986 [BACnet4J transport for device 1234] ERROR com.serotonin.bacnet4j.transport.DefaultTransport - Original send stack
    java.lang.Exception
    	at com.serotonin.bacnet4j.transport.DefaultTransport.send(DefaultTransport.java:290)
    	at com.serotonin.bacnet4j.transport.DefaultTransport.send(DefaultTransport.java:280)
    	at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:983)
    	at bacnetTest.DispFrame.sendRemoteRequest(DispFrame.java:390)
    	at bacnetTest.DispFrame$2.actionPerformed(DispFrame.java:144)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$500(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$4.run(Unknown Source)
    	at java.awt.EventQueue$4.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    

    I want some help, or please give me advice.
    thank you. :)

    posted in BACnet4J general discussion read more
  • Y
    YEJI

    I got error message.

    com.serotonin.bacnet4j.exception.BACnetTimeoutException: Timeout waiting for response.
    	at com.serotonin.bacnet4j.transport.ServiceFutureImpl.get(ServiceFutureImpl.java:69)
    	at bacnetTest.DispFrame$2.actionPerformed(DispFrame.java:120)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$500(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$4.run(Unknown Source)
    	at java.awt.EventQueue$4.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    6312 [BACnet4J transport for device 1234] ERROR com.serotonin.bacnet4j.transport.DefaultTransport - Error during send: OutgoingConfirmed [maxAPDULengthAccepted=-1, segmentationSupported=null, service=Encodable(com.serotonin.bacnet4j.service.confirmed.WritePropertyRequest), consumer=com.serotonin.bacnet4j.transport.ServiceFutureImpl@4bdafb61, address=Address [networkNumber=0, macAddress=[10,26,46,61,2,10,61,3,64,66,10,31,5,10,31,3]], linkService=null]
    6312 [BACnet4J transport for device 1234] ERROR com.serotonin.bacnet4j.transport.DefaultTransport - Original send stack
    java.lang.Exception
    	at com.serotonin.bacnet4j.transport.DefaultTransport.send(DefaultTransport.java:266)
    	at com.serotonin.bacnet4j.transport.DefaultTransport.send(DefaultTransport.java:257)
    	at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:970)
    	at bacnetTest.DispFrame$2.actionPerformed(DispFrame.java:119)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$500(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$4.run(Unknown Source)
    	at java.awt.EventQueue$4.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    com.serotonin.bacnet4j.LocalDevice$2@3cc018c2
    0
    1
    12684 [BACnet4J transport for device 1234] ERROR com.serotonin.bacnet4j.transport.DefaultTransport - Error during expire messages: 
    java.lang.NullPointerException
    	at com.serotonin.bacnet4j.npdu.Network.sendAPDU(Network.java:103)
    	at com.serotonin.bacnet4j.transport.DefaultTransport.sendForResponse(DefaultTransport.java:896)
    	at com.serotonin.bacnet4j.transport.DefaultTransport.expire(DefaultTransport.java:855)
    	at com.serotonin.bacnet4j.transport.DefaultTransport.run(DefaultTransport.java:460)
    	at java.lang.Thread.run(Unknown Source)
    12776 [pool-1-thread-2] WARN com.serotonin.bacnet4j.service.unconfirmed.IAmRequest - Error in device 1234 while discovering extended device information from 1 at Address [networkNumber=0, macAddress=[c0,a8,1,d,ba,c0]]
    18696 [BACnet4J transport for device 1234] ERROR com.serotonin.bacnet4j.transport.DefaultTransport - Error during expire messages: 
    java.lang.NullPointerException
    	at com.serotonin.bacnet4j.npdu.Network.sendAPDU(Network.java:103)
    	at com.serotonin.bacnet4j.transport.DefaultTransport.sendForResponse(DefaultTransport.java:896)
    	at com.serotonin.bacnet4j.transport.DefaultTransport.expire(DefaultTransport.java:855)
    	at com.serotonin.bacnet4j.transport.DefaultTransport.run(DefaultTransport.java:460)
    	at java.lang.Thread.run(Unknown Source)
    
    

    posted in BACnet4J general discussion read more
  • Y
    YEJI

    I think I got more closer to answer (or more messed up) but still not working.

    final IpNetwork network = new IpNetworkBuilder()
    		.withBroadcast(properties.getProperty("bacnetBroadcasting"), 16).withPort(47808)
    		.withLocalBindAddress(properties.getProperty("bacnetBroadcastingIp")).build();
    transport = new DefaultTransport(network);
    localDevice = new LocalDevice(Integer.parseInt(properties.getProperty("deviceId")), transport);
    final byte[] a=hexStringToByteArray("10264661021061036466103105103103");
    final Address macAddress = new Address(a);
    final RemoteDevice rd = new RemoteDevice(localDevice, 1236, macAddress);
    
    final ObjectIdentifier ai1 = new ObjectIdentifier(ObjectType.analogInput, 0);
    final ObjectIdentifier ai2 = new ObjectIdentifier(ObjectType.analogInput, 1);
    final ObjectIdentifier ai3 = new ObjectIdentifier(ObjectType.analogInput, 2);
    final ObjectIdentifier ai4 = new ObjectIdentifier(ObjectType.analogInput, 3);
    final ObjectIdentifier ai5 = new ObjectIdentifier(ObjectType.analogInput, 4);
    
    ai1.write(new ByteQueue(new byte[] { 0 }), 0);
    ai2.write(new ByteQueue(new byte[] { 1 }), 1);
    ai3.write(new ByteQueue(new byte[] { 2 }), 2);
    ai4.write(new ByteQueue(new byte[] { 3 }), 3);
    ai5.write(new ByteQueue(new byte[] { 4 }), 4);
    
     // Verify
     try {
           	// Set the object to something else.
            localDevice.send(rd, new WritePropertyRequest(new ObjectIdentifier(ObjectType.multiStateValue, 0),
            PropertyIdentifier.presentValue, null, new UnsignedInteger(2), new UnsignedInteger(8))).get();
            localDevice.send(rd, new WritePropertyRequest(new ObjectIdentifier(ObjectType.multiStateValue, 0),
            PropertyIdentifier.presentValue, null, new UnsignedInteger(4), new UnsignedInteger(98))).get();
    } catch (BACnetException e2) {
    	e2.printStackTrace();
    }						
    rd.setDeviceProperty(PropertyIdentifier.objectList, UnsignedInteger.ZERO,new UnsignedInteger(5));
    rd.setDeviceProperty(PropertyIdentifier.objectList, new UnsignedInteger(3), ai3);
    final SequenceOf<ObjectIdentifier> objectList = rd.getDeviceProperty(PropertyIdentifier.objectList);
    rd.setDeviceProperty(PropertyIdentifier.objectList, new SequenceOf<>(ai1, ai2, ai3, ai4, ai5));
    rd.setObjectProperty(ai1, PropertyIdentifier.presentValue, new Real(1));
    rd.getObject(ai1);
    
    try {
    	localDevice.initialize();
    	System.out.println(localDevice.getRemoteDevice(1));
    	localDevice.startRemoteDeviceDiscovery((r) -> {
    		System.out.println(r.getInstanceNumber());
    	});
    	localDevice.getRemoteDevice(0).get();
    	localDevice.getRemoteDevice(1).get();
    	localDevice.sendGlobalBroadcast(new WhoIsRequest());
    } catch (Exception e1) {
    	LOGGER.info(e1.toString());
    	localDevice.terminate();
    }
    localDevice.getEventHandler().addListener(new Listener());
    localDevice.sendGlobalBroadcast(new WhoIsRequest());
    LOGGER.info("Initialized");
    

    posted in BACnet4J general discussion read more
  • Y
    YEJI

    Hello, I'm trying to make multiple BACnet devices in my IP, like(192.168.1.101:1234)(192.168.1.101:1235)(192.168.1.101:1236)
    I made one local device in instance number 1234, but I figured out that I can't make multiple local devices in just one IP. (If it can, someone tell me how to do it. I get bind error in initializing.)

    so, I made some remote device(instance number 1235) to bind to my local device(instance number 1234), but i can't just add present value to my remote device or just find the remote device.

    this is my code. I got sample code from "RemoteDeviceTest.java" file. I don't need assert function to check values.

    final IpNetwork network = new IpNetworkBuilder()
    		.withBroadcast(properties.getProperty("bacnetBroadcasting"), 16).withPort(47808)
    		.withLocalBindAddress(properties.getProperty("bacnetBroadcastingIp")).build();
    transport = new DefaultTransport(network);
    localDevice = new LocalDevice(Integer.parseInt(properties.getProperty("deviceId")), transport);
    final RemoteDevice rd = new RemoteDevice(localDevice, 1236);
    final ObjectIdentifier ai1 = new ObjectIdentifier(ObjectType.analogInput, 0);
    final ObjectIdentifier ai2 = new ObjectIdentifier(ObjectType.analogInput, 1);
    final ObjectIdentifier ai3 = new ObjectIdentifier(ObjectType.analogInput, 2);
    final ObjectIdentifier ai4 = new ObjectIdentifier(ObjectType.analogInput, 3);
    final ObjectIdentifier ai5 = new ObjectIdentifier(ObjectType.analogInput, 4);
    
    ai1.write(new ByteQueue(new byte[] { 0 }), 0);
    ai2.write(new ByteQueue(new byte[] { 1 }), 1);
    ai3.write(new ByteQueue(new byte[] { 2 }), 2);
    ai4.write(new ByteQueue(new byte[] { 3 }), 3);
    ai5.write(new ByteQueue(new byte[] { 4 }), 4);
    
    rd.setDeviceProperty(PropertyIdentifier.objectList, UnsignedInteger.ZERO, new UnsignedInteger(5));
    rd.setDeviceProperty(PropertyIdentifier.objectList, new UnsignedInteger(3), ai3);
    final SequenceOf<ObjectIdentifier> objectList = rd.getDeviceProperty(PropertyIdentifier.objectList);
    rd.setDeviceProperty(PropertyIdentifier.objectList, new SequenceOf<>(ai1, ai2, ai3, ai4, ai5));
    
    try {
    	localDevice.initialize();
    	System.out.println(localDevice.getRemoteDevice(1));
    	localDevice.startRemoteDeviceDiscovery((r) -> {
    		System.out.println(r.getInstanceNumber());
    	});
    	localDevice.getRemoteDevice(0).get();
    	localDevice.getRemoteDevice(1).get();
    	localDevice.sendGlobalBroadcast(new WhoIsRequest());
    } catch (Exception e1) {
    	LOGGER.info(e1.toString());
    	localDevice.terminate();
    }
    localDevice.getEventHandler().addListener(new Listener());
    localDevice.sendGlobalBroadcast(new WhoIsRequest());
    LOGGER.info("Initialized");
    

    and I get this console output.
    0_1543901112601_e37a36ed-5a1b-482d-8a62-9c3f89e18a36-image.png

    and If I use YABE, I don't get anything from remote device. I just get local device values.
    0_1543901187148_29ac419c-2b61-4d29-b060-d120a9955016-image.png

    I want to add some multiple devices to my local device, and send some present values from remote devices.
    Can anybody teach me about how to get it?

    Thank you. :)

    posted in BACnet4J general discussion read more