MangoAutomation / BACnet4J

BACnet/IP stack written in Java. Forked from http://sourceforge.net/projects/bacnet4j/
GNU General Public License v3.0
183 stars 110 forks source link

ErrorAPDU(errorClass=object, errorCode=unknown-object,errorClass=object, errorCode=unknown-object) #61

Closed yaoguaijiao closed 2 years ago

yaoguaijiao commented 3 years ago

The title is my wrong message

Here's my source code:

    IpNetwork ipNetwork = new IpNetworkBuilder()
            .withLocalBindAddress("192.168.120.93")//本机的ip
            .withSubnet("255.255.255.0", 24)
            .withPort(47808) //Yabe默认的UDP端口
            .withReuseAddress(true)
            .build();
    LocalDevice localDevice = new LocalDevice(1, new DefaultTransport(ipNetwork));
    localDevice.initialize();

    localDevice.sendGlobalBroadcast(new WhoIsRequest());
    Thread.sleep(1000);
    RemoteDevice remoteDeviceBlocking = localDevice.getRemoteDeviceBlocking(123);

    System.out.println("modelName=" + remoteDeviceBlocking.getDeviceProperty(PropertyIdentifier.modelName));
    ObjectIdentifier objectIdentifier = new ObjectIdentifier(ObjectType.analogInput, 123);
    Encodable encodable = RequestUtils.readProperty(localDevice, remoteDeviceBlocking, objectIdentifier, PropertyIdentifier.presentValue, null);
    System.out.println(encodable.toString());

The real problem is the beginning of this line: Encodable encodable = RequestUtils.readProperty(localDevice, remoteDeviceBlocking, objectIdentifier, PropertyIdentifier.presentValue, null);

This is my misinformation image

kishorevenki commented 3 years ago

The error message indicates that remoteDeviceBlocking does not have object (AI,123).

domeyyds commented 1 year ago

我也出现了同样的问题,你解决了吗?是否是localDevice.terminate();的问题