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:
+8
-8
@@ -139,21 +139,20 @@ int iam_send(uint8_t * buffer)
|
||||
int pdu_len = 0;
|
||||
BACNET_ADDRESS dest;
|
||||
int bytes_sent = 0;
|
||||
BACNET_NPDU_DATA npdu_data;
|
||||
|
||||
/* I-Am is a global broadcast */
|
||||
datalink_get_broadcast_address(&dest);
|
||||
|
||||
/* encode the NPDU portion of the packet */
|
||||
pdu_len = npdu_encode_apdu(&buffer[0], &dest, NULL, false, /* true for confirmed messages */
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
|
||||
/* encode the APDU portion of the packet */
|
||||
pdu_len += iam_encode_apdu(&buffer[pdu_len],
|
||||
pdu_len = iam_encode_apdu(&buffer[0],
|
||||
Device_Object_Instance_Number(),
|
||||
MAX_APDU, SEGMENTATION_NONE, Device_Vendor_Identifier());
|
||||
|
||||
bytes_sent = datalink_send_pdu(&dest, /* destination address */
|
||||
&buffer[0], pdu_len); /* number of bytes of data */
|
||||
/* encode the NPDU portion of the packet */
|
||||
npdu_encode_unconfirmed_apdu(&npdu_data, MESSAGE_PRIORITY_NORMAL);
|
||||
/* send data */
|
||||
bytes_sent = datalink_send_pdu(&dest, &npdu_data,
|
||||
&buffer[0], pdu_len);
|
||||
|
||||
return bytes_sent;
|
||||
}
|
||||
@@ -219,6 +218,7 @@ void datalink_get_broadcast_address(BACNET_ADDRESS * dest)
|
||||
}
|
||||
|
||||
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 */
|
||||
|
||||
Reference in New Issue
Block a user