最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - connecting to bacnet simulator device but timing out by read properties - Stack Overflow

programmeradmin1浏览0评论

Hi I am connecting to a bacnet simulator device of yabe in my local pc that is 192.168.1.9. the code gets to the listener of WhoIs with my device. from this point any request is timing out.

the same code is used for a serial port mstp bacnet device and it wokes good. my connection code is:

         Network network =network = new IpNetworkBuilder()
                .withLocalBindAddress("0.0.0.0")
                .withBroadcast("192.168.1.9", 24)
                .withPort(47808)
                .withReuseAddress(true)
                .build();

        Transport transport = new DefaultTransport(network);
        transport.setTimeout(Transport.DEFAULT_TIMEOUT);
        transport.setSegTimeout(Transport.DEFAULT_SEG_TIMEOUT);
        transport.setSegWindow(Transport.DEFAULT_SEG_WINDOW);
        transport.setRetries(1);

        localDevice = new LocalDevice(1, transport);

        DeviceEventAdapter listener2 =new DeviceEventAdapter() {
                  
                @Override
                public void iAmReceived(final RemoteDevice d) {
                
                     try {
                         // this line gets a time out
                         DiscoveryUtils.getExtendedDeviceInformation(localDevice, d);
                         // and if I remark this line and run this:

                         List<ObjectIdentifier> oids = ((SequenceOf<ObjectIdentifier>) 
                         RequestUtils.sendReadPropertyAllowNull(
                                localDevice, rd, rd.getObjectIdentifier(), 
                                           PropertyIdentifier.objectList)).getValues();
                        

                    PropertyReferences references = new PropertyReferences();
                    // or
                    ObjectIdentifier my = new ObjectIdentifier(ObjectType.analogInput,1);
                    List<ObjectIdentifier> oids1 = new ArrayList<ObjectIdentifier>(); 
                    oids1.add(my);
                        
                     }catch (Exception es) {
                            es.printStackTrace();
                     }
                }
            };

            localDevice.getEventHandler().addListener(listener2);
            localDevice.initialize();
            localDevice.sendGlobalBroadcast(new WhoIsRequest());
            

any try to take some data from the device is going to timeout any idea ow to fix it?

Thanks for everyone.

发布评论

评论列表(0)

  1. 暂无评论