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:
skarg
2006-08-13 00:54:05 +00:00
parent 185d02a9ff
commit 5bb205dc03
46 changed files with 793 additions and 638 deletions
+8 -12
View File
@@ -301,25 +301,21 @@ uint32_t bacfile_instance_from_tsm(uint8_t invokeID)
uint8_t *service_request = NULL;
uint16_t service_request_len = 0;
BACNET_ADDRESS dest; /* where the original packet was destined */
uint8_t pdu[MAX_PDU] = { 0 }; /* original sent packet */
uint16_t pdu_len = 0; /* original packet length */
uint8_t apdu[MAX_PDU] = { 0 }; /* original APDU packet */
uint16_t apdu_len = 0; /* original APDU packet length */
uint16_t len = 0; /* apdu header length */
BACNET_ATOMIC_READ_FILE_DATA data = { 0 };
uint32_t object_instance = BACNET_MAX_INSTANCE + 1; /* return value */
bool found = false;
int apdu_offset = 0;
found = tsm_get_transaction_pdu(invokeID, &dest, &pdu[0], &pdu_len);
found = tsm_get_transaction_pdu(invokeID, &dest, &npdu_data, &apdu[0],
&apdu_len);
if (found) {
apdu_offset = npdu_decode(&pdu[0], /* data to decode */
NULL, /* destination address - get the DNET/DLEN/DADR if in there */
NULL, /* source address - get the SNET/SLEN/SADR if in there */
&npdu_data); /* amount of data to decode */
if (!npdu_data.network_layer_message &&
((pdu[apdu_offset] & 0xF0) ==
PDU_TYPE_CONFIRMED_SERVICE_REQUEST)) {
len = apdu_decode_confirmed_service_request(&pdu[apdu_offset], /* APDU data */
pdu_len - apdu_offset,
if (!npdu_data.network_layer_message && npdu_data.confirmed_message &&
(apdu[0] == PDU_TYPE_CONFIRMED_SERVICE_REQUEST)) {
len = apdu_decode_confirmed_service_request(&apdu[0],
apdu_len - apdu_offset,
&service_data,
&service_choice, &service_request, &service_request_len);
if (service_choice == SERVICE_CONFIRMED_ATOMIC_READ_FILE) {
+2 -2
View File
@@ -269,12 +269,12 @@ bool Device_Set_Location(const char *name, size_t length)
uint8_t Device_Protocol_Version(void)
{
return 1;
return BACNET_PROTOCOL_VERSION;
}
uint8_t Device_Protocol_Revision(void)
{
return 5;
return BACNET_PROTOCOL_REVISION;
}
uint16_t Device_Max_APDU_Length_Accepted(void)