Added routing support for virtual network to more of the handlers and fixed up a couple of typos from the previous changes.
Added ReadRange service handler so that trendlogs can be read.
This commit is contained in:
@@ -69,7 +69,11 @@ void handler_alarm_ack(
|
||||
BACNET_ADDRESS my_address;
|
||||
|
||||
/* encode the NPDU portion of the packet */
|
||||
#if BAC_ROUTING
|
||||
my_address = *Get_Routed_Device_Address(-1);
|
||||
#else
|
||||
datalink_get_my_address(&my_address);
|
||||
#endif
|
||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len =
|
||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||
|
||||
@@ -339,7 +339,7 @@ static bool cov_send_request(
|
||||
cov_data.subscriberProcessIdentifier =
|
||||
cov_subscription->subscriberProcessIdentifier;
|
||||
#if BAC_ROUTING
|
||||
cov_data.initiatingDeviceIdentifier = Device_Object_Instance_Number();
|
||||
cov_data.initiatingDeviceIdentifier = Routed_Device_Object_Instance_Number();
|
||||
#else
|
||||
cov_data.initiatingDeviceIdentifier = Device_Object_Instance_Number();
|
||||
#endif
|
||||
|
||||
@@ -72,7 +72,11 @@ void handler_get_event_information(
|
||||
int valid_event = 0;
|
||||
|
||||
/* encode the NPDU portion of the packet */
|
||||
#if BAC_ROUTING
|
||||
my_address = *Get_Routed_Device_Address(-1);
|
||||
#else
|
||||
datalink_get_my_address(&my_address);
|
||||
#endif
|
||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len =
|
||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||
|
||||
@@ -231,7 +231,11 @@ void handler_conf_private_trans(
|
||||
/* encode the NPDU portion of the response packet as it will be needed */
|
||||
/* no matter what the outcome. */
|
||||
|
||||
#if BAC_ROUTING
|
||||
my_address = *Get_Routed_Device_Address(-1);
|
||||
#else
|
||||
datalink_get_my_address(&my_address);
|
||||
#endif
|
||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len =
|
||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||
|
||||
@@ -104,7 +104,11 @@ void handler_read_range(
|
||||
data.error_class = ERROR_CLASS_OBJECT;
|
||||
data.error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
||||
/* encode the NPDU portion of the packet */
|
||||
#if BAC_ROUTING
|
||||
my_address = *Get_Routed_Device_Address(-1);
|
||||
#else
|
||||
datalink_get_my_address(&my_address);
|
||||
#endif
|
||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len =
|
||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||
|
||||
@@ -73,7 +73,11 @@ uint8_t Send_Alarm_Acknowledgement(
|
||||
invoke_id = tsm_next_free_invokeID();
|
||||
if (invoke_id) {
|
||||
/* encode the NPDU portion of the packet */
|
||||
#if BAC_ROUTING
|
||||
my_address = *Get_Routed_Device_Address(-1);
|
||||
#else
|
||||
datalink_get_my_address(&my_address);
|
||||
#endif
|
||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len =
|
||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||
|
||||
@@ -69,7 +69,11 @@ uint8_t Send_CEvent_Notify(
|
||||
invoke_id = tsm_next_free_invokeID();
|
||||
if (invoke_id) {
|
||||
/* encode the NPDU portion of the packet */
|
||||
datalink_get_my_address(&my_address);
|
||||
#if BAC_ROUTING
|
||||
my_address = *Get_Routed_Device_Address(-1);
|
||||
#else
|
||||
datalink_get_my_address(&my_address);
|
||||
#endif
|
||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len =
|
||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||
|
||||
@@ -77,14 +77,11 @@ void Send_I_Have(
|
||||
datalink_get_broadcast_address(&dest);
|
||||
/* encode the NPDU portion of the packet */
|
||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||
|
||||
#if BAC_ROUTING
|
||||
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address, &npdu_data);
|
||||
#else
|
||||
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, NULL, &npdu_data);
|
||||
#endif
|
||||
|
||||
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, NULL, &npdu_data);
|
||||
/* encode the APDU portion of the packet */
|
||||
data.device_id.type = OBJECT_DEVICE;
|
||||
data.device_id.instance = device_id;
|
||||
|
||||
@@ -73,7 +73,11 @@ uint8_t Send_Life_Safety_Operation_Data(
|
||||
invoke_id = tsm_next_free_invokeID();
|
||||
if (invoke_id) {
|
||||
/* encode the NPDU portion of the packet */
|
||||
#if BAC_ROUTING
|
||||
my_address = *Get_Routed_Device_Address(-1);
|
||||
#else
|
||||
datalink_get_my_address(&my_address);
|
||||
#endif
|
||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len =
|
||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||
|
||||
@@ -78,7 +78,11 @@ uint8_t Send_Private_Transfer_Request(
|
||||
invoke_id = tsm_next_free_invokeID();
|
||||
if (invoke_id) {
|
||||
/* encode the NPDU portion of the packet */
|
||||
#if BAC_ROUTING
|
||||
my_address = *Get_Routed_Device_Address(-1);
|
||||
#else
|
||||
datalink_get_my_address(&my_address);
|
||||
#endif
|
||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len =
|
||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||
|
||||
@@ -72,7 +72,11 @@ uint8_t Send_ReadRange_Request(
|
||||
|
||||
if (invoke_id) {
|
||||
/* encode the NPDU portion of the packet */
|
||||
#if BAC_ROUTING
|
||||
my_address = *Get_Routed_Device_Address(-1);
|
||||
#else
|
||||
datalink_get_my_address(&my_address);
|
||||
#endif
|
||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len =
|
||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||
|
||||
@@ -53,14 +53,22 @@ void Send_UnconfirmedPrivateTransfer(
|
||||
int pdu_len = 0;
|
||||
int bytes_sent = 0;
|
||||
BACNET_NPDU_DATA npdu_data;
|
||||
#if BAC_ROUTING
|
||||
BACNET_ADDRESS my_address;
|
||||
|
||||
my_address = *Get_Routed_Device_Address(-1);
|
||||
#endif
|
||||
|
||||
if (!dcc_communication_enabled())
|
||||
return;
|
||||
|
||||
/* encode the NPDU portion of the packet */
|
||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||
pdu_len =
|
||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], dest, NULL, &npdu_data);
|
||||
#if BAC_ROUTING
|
||||
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], dest, &my_address, &npdu_data);
|
||||
#else
|
||||
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], dest, NULL, &npdu_data);
|
||||
#endif
|
||||
/* encode the APDU portion of the packet */
|
||||
len =
|
||||
uptransfer_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
|
||||
Reference in New Issue
Block a user