首页 > 解决方案 > 从 bacnet 模拟器读取数据时出错:错误:ERR_TIMEOUT 使用 bacstack lib(nodejs)

问题描述

我正在尝试从 bacnet 模拟器中读取数据。但我收到错误

err:  Error: ERR_TIMEOUT
    at Timeout._onTimeout (C:\Users\EpsilonPrime\node_modules\bacstack\lib\client.js:75:16)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)

下面是使用 bacstack 库编写的 nodejs 代码。

const bacnet = require('bacstack');

// Initialize BACStack
const client = new bacnet({apduTimeout: 3000});

console.log(client);

//console.log(client.EventEmitter)


// Discover Devices
client.on('iAm', (device) => {
  console.log('address----------> ', device.address);
  console.log('deviceId---------->  ', device.deviceId);
  console.log('maxApdu---------->  ', device.maxApdu);
  console.log('segmentation---------->  ', device.segmentation);
  console.log('vendorId---------->  ', device.vendorId);
  console.log('object type---------->  ', device.vendorId);
  console.log('vendorId---------->  ', device.vendorId);
});


client.whoIs();

// Read Device Object
client.readProperty('192.168.14.87', {type: 8, instance: 2195695}, 28, (err, value) => {
  console.log('value: ', value);
  console.log('err: ', err);
});

我收到以下回复: 在此处输入图像描述

下面是模拟器快照,我使用的是 Yabe 模拟器: 在此处输入图像描述

在此处输入图像描述

标签: node.jsbacnet

解决方案


我想知道是否 - 首先,如果您应该切换到这个后续项目(?):

https://www.npmjs.com/package/node-bacnet

推荐阅读