Added write BDT application (#170)

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2021-04-23 13:46:21 -05:00
committed by GitHub
parent 70c1d8bd7a
commit a4fe367ac0
8 changed files with 386 additions and 3 deletions
+38
View File
@@ -2305,6 +2305,44 @@ int bvlc_decode_foreign_device_table_entry(uint8_t *pdu,
return bytes_consumed;
}
/**
* @brief Get a text name for each BVLC result code
* @param result_code - BVLC result code
* @return ASCII text name for each BVLC result code or empty string
*/
const char *bvlc_result_code_name(uint16_t result_code)
{
const char *name = "";
switch (result_code) {
case BVLC_RESULT_SUCCESSFUL_COMPLETION:
name = "Successful Completion";
break;
case BVLC_RESULT_WRITE_BROADCAST_DISTRIBUTION_TABLE_NAK:
name= "Write-Broadcast-Distribution-Table NAK";
break;
case BVLC_RESULT_READ_BROADCAST_DISTRIBUTION_TABLE_NAK:
name = "Read-Broadcast-Distribution-Table NAK";
break;
case BVLC_RESULT_REGISTER_FOREIGN_DEVICE_NAK:
name = "Register-Foreign-Device NAK";
break;
case BVLC_RESULT_READ_FOREIGN_DEVICE_TABLE_NAK:
name = "Read-Foreign-Device-Table NAK";
break;
case BVLC_RESULT_DELETE_FOREIGN_DEVICE_TABLE_ENTRY_NAK:
name = "Delete-Foreign-Device-Table-Entry NAK";
break;
case BVLC_RESULT_DISTRIBUTE_BROADCAST_TO_NETWORK_NAK:
name = "Distribute-Broadcast-To-Network NAK";
break;
default:
break;
}
return name;
}
#ifdef BAC_TEST
#include <assert.h>
#include <string.h>
+5
View File
@@ -54,6 +54,7 @@
#define BVLC_ORIGINAL_UNICAST_NPDU 10
#define BVLC_ORIGINAL_BROADCAST_NPDU 11
#define BVLC_SECURE_BVLL 12
#define BVLC_INVALID 255
/** @} */
@@ -68,6 +69,7 @@
#define BVLC_RESULT_READ_FOREIGN_DEVICE_TABLE_NAK 0x0040
#define BVLC_RESULT_DELETE_FOREIGN_DEVICE_TABLE_ENTRY_NAK 0x0050
#define BVLC_RESULT_DISTRIBUTE_BROADCAST_TO_NETWORK_NAK 0x0060
#define BVLC_RESULT_INVALID 0xFFFF
/* number of bytes in the IPv4 address */
#define IP_ADDRESS_MAX 4
@@ -491,6 +493,9 @@ extern "C" {
uint16_t npdu_size,
uint16_t *npdu_len);
BACNET_STACK_EXPORT
const char *bvlc_result_code_name(uint16_t result_code);
#ifdef BAC_TEST
#include "ctest.h"
BACNET_STACK_EXPORT