void handler_who_is( uint8_t * service_request, uint16_t service_len, BACNET_ADDRESS * src) { int len = 0; int32_t low_limit = 0; int32_t high_limit = 0; int32_t target_device; (void) src; len = whois_decode_service_request(service_request, service_len, &low_limit, &high_limit); if (len == 0) { Send_I_Am_Flag = true; } else if (len != BACNET_STATUS_ERROR) { /* is my device id within the limits? */ target_device = Device_Object_Instance_Number(); if (((target_device >= low_limit) && (target_device <= high_limit)) || /* BACnet wildcard is the max instance number - everyone responds */ ((BACNET_MAX_INSTANCE >= (uint32_t) low_limit) && (BACNET_MAX_INSTANCE <= (uint32_t) high_limit))) { Send_I_Am_Flag = true; } } return; }
void handler_who_is( uint8_t * service_request, uint16_t service_len, BACNET_ADDRESS * src) { int len = 0; int32_t low_limit = 0; int32_t high_limit = 0; (void) src; len = whois_decode_service_request(service_request, service_len, &low_limit, &high_limit); if (len == 0) Send_I_Am(&Handler_Transmit_Buffer[0]); else if (len != -1) { /* is my device id within the limits? */ if (((Device_Object_Instance_Number() >= (uint32_t) low_limit) && (Device_Object_Instance_Number() <= (uint32_t) high_limit)) || /* BACnet wildcard is the max instance number - everyone responds */ ((BACNET_MAX_INSTANCE >= (uint32_t) low_limit) && (BACNET_MAX_INSTANCE <= (uint32_t) high_limit))) Send_I_Am(&Handler_Transmit_Buffer[0]); } return; }
void handler_who_is( uint8_t * service_request, uint16_t service_len, BACNET_ADDRESS * src) { int len = 0; int32_t low_limit = 0; int32_t high_limit = 0; int32_t target_device; (void) src; len = whois_decode_service_request(service_request, service_len, &low_limit, &high_limit); if (len == 0) { Send_I_Am_Flag = true; } else if (len != BACNET_STATUS_ERROR) { /* is my device id within the limits? */ target_device = Device_Object_Instance_Number(); if ((target_device >= low_limit) && (target_device <= high_limit)) { Send_I_Am_Flag = true; } } return; }
int whois_decode_apdu( uint8_t * apdu, unsigned apdu_len, int32_t * pLow_limit, int32_t * pHigh_limit) { int len = 0; if (!apdu) { return BACNET_STATUS_ERROR; } /* optional limits - must be used as a pair */ if (apdu_len >= 2) { /* optional checking - most likely was already done prior to this call */ if (apdu[0] != PDU_TYPE_UNCONFIRMED_SERVICE_REQUEST) { return BACNET_STATUS_ERROR; } if (apdu[1] != SERVICE_UNCONFIRMED_WHO_IS) { return BACNET_STATUS_ERROR; } len = whois_decode_service_request(&apdu[2], apdu_len - 2, pLow_limit, pHigh_limit); } return len; }