<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"> 在BACnet协议栈中,发送方使用WHO-IS服务确定在同一个互联网上其它的BACnet设备的设备对象标识符和网络地址,Who-Is服务是一个无证实服务,这个服务有两种使用情况(1)、确定在网络上的所有设备的对象标识符和网络地址;(2)、确定某个设备标识符但是不知其网络地址的设备的网络地址。</span>
在bacnet的协议栈中,whois.c是 用于编码(encode)/ 解码(decode) WHO-IS 服务请求的文件,这其中有两个主要函数:
1)、int whois_encode_apdu(uint8_t * apdu, int32_t low_limit, int32_t high_limit)
2)、int whois_decode_service_request(uint8_t * apdu, unsigned apdu_len, int32_t * pLow_limit, int32_t * pHigh_limit)
参数说明:apdu:服务请求;low_limit:设备实例低阈值范围;high_limit:设备实例高阈值范围
int whois_encode_apdu(uint8_t * apdu, int32_t low_limit, int32_t high_limit)
{
int len = 0; /* length of each encoding */
int apdu_len = 0; /* total length of the apdu, return value */
if (apdu) {
apdu[0] = PDU_TYPE_UNCONFIRMED_SERVICE_REQUEST; //定义非证实服务请求
apdu[1] = SERVICE_UNCONFIRMED_WHO_IS; /* service choice */ //定义WHO-IS服务
apdu_len = 2;
/* optional limits - must be used as a pair */
if ((low_limit >= 0)