Fixed network priority reponses for test 10.1.2 (#687)
This commit is contained in:
@@ -41,6 +41,26 @@
|
|||||||
#include "bacnet/bacdcode.h"
|
#include "bacnet/bacdcode.h"
|
||||||
#include "bacnet/basic/services.h"
|
#include "bacnet/basic/services.h"
|
||||||
|
|
||||||
|
static uint8_t Local_Network_Priority; /* Fixing test 10.1.2 Network priority */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief get the local network priority
|
||||||
|
* @return local network priority
|
||||||
|
*/
|
||||||
|
uint8_t apdu_network_priority(void)
|
||||||
|
{
|
||||||
|
return Local_Network_Priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief set the local network priority
|
||||||
|
* @param net - local network priority
|
||||||
|
*/
|
||||||
|
void apdu_network_priority_set(uint8_t pri)
|
||||||
|
{
|
||||||
|
Local_Network_Priority = pri & 0x03;
|
||||||
|
}
|
||||||
|
|
||||||
bool apdu_service_supported(BACNET_SERVICES_SUPPORTED service_supported)
|
bool apdu_service_supported(BACNET_SERVICES_SUPPORTED service_supported)
|
||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
@@ -76,6 +96,7 @@ uint16_t apdu_decode_confirmed_service_request(uint8_t *apdu, /* APDU data */
|
|||||||
service_data->max_segs = decode_max_segs(apdu[1]);
|
service_data->max_segs = decode_max_segs(apdu[1]);
|
||||||
service_data->max_resp = decode_max_apdu(apdu[1]);
|
service_data->max_resp = decode_max_apdu(apdu[1]);
|
||||||
service_data->invoke_id = apdu[2];
|
service_data->invoke_id = apdu[2];
|
||||||
|
service_data->priority = apdu_network_priority();
|
||||||
len = 3;
|
len = 3;
|
||||||
if (service_data->segmented_message) {
|
if (service_data->segmented_message) {
|
||||||
service_data->sequence_number = apdu[len++];
|
service_data->sequence_number = apdu[len++];
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ typedef struct _confirmed_service_data {
|
|||||||
uint8_t invoke_id;
|
uint8_t invoke_id;
|
||||||
uint8_t sequence_number;
|
uint8_t sequence_number;
|
||||||
uint8_t proposed_window_number;
|
uint8_t proposed_window_number;
|
||||||
|
uint8_t priority;
|
||||||
} BACNET_CONFIRMED_SERVICE_DATA;
|
} BACNET_CONFIRMED_SERVICE_DATA;
|
||||||
|
|
||||||
typedef struct _confirmed_service_ack_data {
|
typedef struct _confirmed_service_ack_data {
|
||||||
@@ -48,4 +49,7 @@ typedef struct _confirmed_service_ack_data {
|
|||||||
uint8_t proposed_window_number;
|
uint8_t proposed_window_number;
|
||||||
} BACNET_CONFIRMED_SERVICE_ACK_DATA;
|
} BACNET_CONFIRMED_SERVICE_ACK_DATA;
|
||||||
|
|
||||||
|
uint8_t apdu_network_priority(void);
|
||||||
|
void apdu_network_priority_set(uint8_t pri);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -252,6 +252,11 @@ void npdu_handler(BACNET_ADDRESS *src, uint8_t *pdu, uint16_t pdu_len)
|
|||||||
/* ConfirmedBroadcastReceived */
|
/* ConfirmedBroadcastReceived */
|
||||||
/* then enter IDLE - ignore the PDU */
|
/* then enter IDLE - ignore the PDU */
|
||||||
} else {
|
} else {
|
||||||
|
if (npdu_data.data_expecting_reply ) {
|
||||||
|
apdu_network_priority_set(npdu_data.priority);
|
||||||
|
} else {
|
||||||
|
apdu_network_priority_set(MESSAGE_PRIORITY_NORMAL);
|
||||||
|
}
|
||||||
apdu_handler(src, &pdu[apdu_offset],
|
apdu_handler(src, &pdu[apdu_offset],
|
||||||
(uint16_t)(pdu_len - apdu_offset));
|
(uint16_t)(pdu_len - apdu_offset));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
static uint16_t Timeout_Milliseconds = 3000;
|
static uint16_t Timeout_Milliseconds = 3000;
|
||||||
/* Number of APDU Retries */
|
/* Number of APDU Retries */
|
||||||
static uint8_t Number_Of_Retries = 3;
|
static uint8_t Number_Of_Retries = 3;
|
||||||
|
static uint8_t Local_Network_Priority; /* Fixing test 10.1.2 Network priority */
|
||||||
|
|
||||||
/* a simple table for crossing the services supported */
|
/* a simple table for crossing the services supported */
|
||||||
static BACNET_SERVICES_SUPPORTED
|
static BACNET_SERVICES_SUPPORTED
|
||||||
@@ -83,6 +84,24 @@ static BACNET_SERVICES_SUPPORTED
|
|||||||
SERVICE_SUPPORTED_AUDIT_LOG_QUERY
|
SERVICE_SUPPORTED_AUDIT_LOG_QUERY
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief get the local network priority
|
||||||
|
* @return local network priority
|
||||||
|
*/
|
||||||
|
uint8_t apdu_network_priority(void)
|
||||||
|
{
|
||||||
|
return Local_Network_Priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief set the local network priority
|
||||||
|
* @param net - local network priority
|
||||||
|
*/
|
||||||
|
void apdu_network_priority_set(uint8_t pri)
|
||||||
|
{
|
||||||
|
Local_Network_Priority = pri & 0x03;
|
||||||
|
}
|
||||||
|
|
||||||
/* a simple table for crossing the services supported */
|
/* a simple table for crossing the services supported */
|
||||||
static BACNET_SERVICES_SUPPORTED
|
static BACNET_SERVICES_SUPPORTED
|
||||||
unconfirmed_service_supported[MAX_BACNET_UNCONFIRMED_SERVICE] = {
|
unconfirmed_service_supported[MAX_BACNET_UNCONFIRMED_SERVICE] = {
|
||||||
@@ -439,6 +458,7 @@ uint16_t apdu_decode_confirmed_service_request(uint8_t *apdu, /* APDU data */
|
|||||||
service_data->max_segs = decode_max_segs(apdu[1]);
|
service_data->max_segs = decode_max_segs(apdu[1]);
|
||||||
service_data->max_resp = decode_max_apdu(apdu[1]);
|
service_data->max_resp = decode_max_apdu(apdu[1]);
|
||||||
service_data->invoke_id = apdu[2];
|
service_data->invoke_id = apdu[2];
|
||||||
|
service_data->priority = apdu_network_priority();
|
||||||
len = 3;
|
len = 3;
|
||||||
if (service_data->segmented_message) {
|
if (service_data->segmented_message) {
|
||||||
if (apdu_len >= (len + 2)) {
|
if (apdu_len >= (len + 2)) {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void handler_read_property(uint8_t *service_request,
|
|||||||
rpdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
rpdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, service_data->priority);
|
||||||
npdu_len = npdu_encode_pdu(
|
npdu_len = npdu_encode_pdu(
|
||||||
&Handler_Transmit_Buffer[0], src, &my_address, &npdu_data);
|
&Handler_Transmit_Buffer[0], src, &my_address, &npdu_data);
|
||||||
if (npdu_len <= 0) {
|
if (npdu_len <= 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user