Changed the API to pass the NPDU data down through the datalink layer in order to make the dlmstp work since it needs data-expecting-reply information. Of course, this affected all the demos, all the unit tests, and most of the demo handlers. Corrected some TSM leaks in confirmed messages. Refactored the AtomicReadFile and AtomicWriteFile demos by moving the Send_ functions to the demo/handlers directory and using the s_whois common handler. Added some common defines for the BACnet version and revision since several modules were using the info. Hopefully I didn't break too many things.
This commit is contained in:
+31
-41
@@ -42,20 +42,20 @@
|
||||
|
||||
/* returns number of bytes sent on success, negative on failure */
|
||||
int datalink_send_pdu(BACNET_ADDRESS * dest, /* destination address */
|
||||
BACNET_NPDU_DATA * npdu_data, /* network information */
|
||||
uint8_t * pdu, /* any data to be sent - may be null */
|
||||
unsigned pdu_len)
|
||||
{ /* number of bytes of data */
|
||||
#ifdef BACDL_ARCNET
|
||||
return arcnet_send_pdu(dest, pdu, pdu_len);
|
||||
#endif
|
||||
#ifdef BACDL_MSTP
|
||||
return dlmstp_send_pdu(dest, pdu, pdu_len);
|
||||
#endif
|
||||
#ifdef BACDL_ETHERNET
|
||||
return ethernet_send_pdu(dest, pdu, pdu_len);
|
||||
#endif
|
||||
#ifdef BACDL_BIP
|
||||
return bip_send_pdu(dest, pdu, pdu_len);
|
||||
#if defined(BACDL_ARCNET)
|
||||
return arcnet_send_pdu(dest, npdu_data, pdu, pdu_len);
|
||||
#elif defined(BACDL_MSTP)
|
||||
return dlmstp_send_pdu(dest, npdu_data, pdu, pdu_len);
|
||||
#elif defined(BACDL_ETHERNET)
|
||||
return ethernet_send_pdu(dest, npdu_data, pdu, pdu_len);
|
||||
#elif defined(BACDL_BIP)
|
||||
return bip_send_pdu(dest, npdu_data, pdu, pdu_len);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -65,64 +65,54 @@ uint16_t datalink_receive(BACNET_ADDRESS * src, /* source address */
|
||||
uint16_t max_pdu, /* amount of space available in the PDU */
|
||||
unsigned timeout)
|
||||
{ /* number of milliseconds to wait for a packet */
|
||||
#ifdef BACDL_ARCNET
|
||||
#if defined(BACDL_ARCNET)
|
||||
return arcnet_receive(src, pdu, max_pdu, timeout);
|
||||
#endif
|
||||
#ifdef BACDL_MSTP
|
||||
#elif defined(BACDL_MSTP)
|
||||
return dlmstp_receive(src, pdu, max_pdu, timeout);
|
||||
#endif
|
||||
#ifdef BACDL_ETHERNET
|
||||
#elif defined(BACDL_ETHERNET)
|
||||
return ethernet_receive(src, pdu, max_pdu, timeout);
|
||||
#endif
|
||||
#ifdef BACDL_BIP
|
||||
#elif defined(BACDL_BIP)
|
||||
return bip_receive(src, pdu, max_pdu, timeout);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void datalink_cleanup(void)
|
||||
{
|
||||
#ifdef BACDL_ETHERNET
|
||||
ethernet_cleanup();
|
||||
#endif
|
||||
#ifdef BACDL_BIP
|
||||
bip_cleanup();
|
||||
#endif
|
||||
#ifdef BACDL_ARCNET
|
||||
#if defined(BACDL_ARCNET)
|
||||
arcnet_cleanup();
|
||||
#endif
|
||||
#ifdef BACDL_MSTP
|
||||
#elif defined(BACDL_MSTP)
|
||||
dlmstp_cleanup();
|
||||
#elif defined(BACDL_ETHERNET)
|
||||
ethernet_cleanup();
|
||||
#elif defined(BACDL_BIP)
|
||||
bip_cleanup();
|
||||
#endif
|
||||
}
|
||||
|
||||
void datalink_get_broadcast_address(BACNET_ADDRESS * dest)
|
||||
{ /* destination address */
|
||||
#ifdef BACDL_ARCNET
|
||||
#if defined(BACDL_ARCNET)
|
||||
arcnet_get_broadcast_address(dest);
|
||||
#endif
|
||||
#ifdef BACDL_MSTP
|
||||
#elif defined(BACDL_MSTP)
|
||||
dlmstp_get_broadcast_address(dest);
|
||||
#endif
|
||||
#ifdef BACDL_ETHERNET
|
||||
#elif defined(BACDL_ETHERNET)
|
||||
ethernet_get_broadcast_address(dest);
|
||||
#endif
|
||||
#ifdef BACDL_BIP
|
||||
#elif defined(BACDL_BIP)
|
||||
bip_get_broadcast_address(dest);
|
||||
#endif
|
||||
}
|
||||
|
||||
void datalink_get_my_address(BACNET_ADDRESS * my_address)
|
||||
{
|
||||
#ifdef BACDL_ARCNET
|
||||
#if defined(BACDL_ARCNET)
|
||||
arcnet_get_my_address(my_address);
|
||||
#endif
|
||||
#ifdef BACDL_MSTP
|
||||
#elif defined(BACDL_MSTP)
|
||||
dlmstp_get_my_address(my_address);
|
||||
#endif
|
||||
#ifdef BACDL_ETHERNET
|
||||
#elif defined(BACDL_ETHERNET)
|
||||
ethernet_get_my_address(my_address);
|
||||
#endif
|
||||
#ifdef BACDL_BIP
|
||||
#elif defined(BACDL_BIP)
|
||||
bip_get_my_address(my_address);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user