Removed the Who-Is wildcard since it is not permitted per BACnet standard. Thank you Michael and Carl!

This commit is contained in:
skarg
2015-10-16 19:29:03 +00:00
parent 73190ed0c4
commit 49c52d5407
3 changed files with 11 additions and 33 deletions
+9 -23
View File
@@ -64,13 +64,8 @@ void handler_who_is(
Send_I_Am(&Handler_Transmit_Buffer[0]); Send_I_Am(&Handler_Transmit_Buffer[0]);
} else if (len != BACNET_STATUS_ERROR) { } else if (len != BACNET_STATUS_ERROR) {
/* is my device id within the limits? */ /* is my device id within the limits? */
/* or */ if ((Device_Object_Instance_Number() >= (uint32_t) low_limit) &&
/* BACnet wildcard is the max instance number - everyone responds */ (Device_Object_Instance_Number() <= (uint32_t) high_limit)) {
if (((Device_Object_Instance_Number() >= (uint32_t) low_limit) &&
(Device_Object_Instance_Number() <= (uint32_t) high_limit))
||
((BACNET_MAX_INSTANCE >= (uint32_t) low_limit) &&
(BACNET_MAX_INSTANCE <= (uint32_t) high_limit))) {
Send_I_Am(&Handler_Transmit_Buffer[0]); Send_I_Am(&Handler_Transmit_Buffer[0]);
} }
} }
@@ -98,17 +93,14 @@ void handler_who_is_unicast(
whois_decode_service_request(service_request, service_len, &low_limit, whois_decode_service_request(service_request, service_len, &low_limit,
&high_limit); &high_limit);
/* If no limits, then always respond */ /* If no limits, then always respond */
if (len == 0) if (len == 0) {
Send_I_Am_Unicast(&Handler_Transmit_Buffer[0], src); Send_I_Am_Unicast(&Handler_Transmit_Buffer[0], src);
else if (len != BACNET_STATUS_ERROR) { } else if (len != BACNET_STATUS_ERROR) {
/* is my device id within the limits? */ /* is my device id within the limits? */
if (((Device_Object_Instance_Number() >= (uint32_t) low_limit) && if ((Device_Object_Instance_Number() >= (uint32_t) low_limit) &&
(Device_Object_Instance_Number() <= (uint32_t) high_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_Unicast(&Handler_Transmit_Buffer[0], src); Send_I_Am_Unicast(&Handler_Transmit_Buffer[0], src);
}
} }
return; return;
@@ -151,20 +143,14 @@ static void check_who_is_for_routing(
/* Invalid; just leave */ /* Invalid; just leave */
return; return;
} }
/* If len == 0, then high_limit is untouched and still == 0 */
/* BACnet wildcard is the max instance number - everyone responds */
if ((BACNET_MAX_INSTANCE >= (uint32_t) low_limit) &&
(BACNET_MAX_INSTANCE <= (uint32_t) high_limit))
high_limit = 0;
/* This is the "always accept" case we will test for below */
/* Go through all devices, starting with the root gateway Device */ /* Go through all devices, starting with the root gateway Device */
memset(&bcast_net, 0, sizeof(BACNET_ADDRESS)); memset(&bcast_net, 0, sizeof(BACNET_ADDRESS));
bcast_net.net = BACNET_BROADCAST_NETWORK; /* That's all we have to set */ bcast_net.net = BACNET_BROADCAST_NETWORK; /* That's all we have to set */
while (Routed_Device_GetNext(&bcast_net, my_list, &cursor)) { while (Routed_Device_GetNext(&bcast_net, my_list, &cursor)) {
dev_instance = Device_Object_Instance_Number(); dev_instance = Device_Object_Instance_Number();
if ((high_limit == 0) || ((dev_instance >= low_limit) && /* If len == 0, no limits and always respond */
if ((len == 0) || ((dev_instance >= low_limit) &&
(dev_instance <= high_limit))) { (dev_instance <= high_limit))) {
if (is_unicast) if (is_unicast)
Send_I_Am_Unicast(&Handler_Transmit_Buffer[0], src); Send_I_Am_Unicast(&Handler_Transmit_Buffer[0], src);
+1 -5
View File
@@ -84,11 +84,7 @@ void handler_who_is(uint8_t * service_request,
} else if (len != -1) { } else if (len != -1) {
/* is my device id within the limits? */ /* is my device id within the limits? */
target_device = Device_Object_Instance_Number(); target_device = Device_Object_Instance_Number();
if (((target_device >= low_limit) && (target_device <= high_limit)) 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))) {
sendIamUnicast(&Handler_Transmit_Buffer[0], src); sendIamUnicast(&Handler_Transmit_Buffer[0], src);
} }
} }
+1 -5
View File
@@ -58,11 +58,7 @@ void handler_who_is(
} else if (len != BACNET_STATUS_ERROR) { } else if (len != BACNET_STATUS_ERROR) {
/* is my device id within the limits? */ /* is my device id within the limits? */
target_device = Device_Object_Instance_Number(); target_device = Device_Object_Instance_Number();
if (((target_device >= low_limit) && (target_device <= high_limit)) 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; Send_I_Am_Flag = true;
} }
} }