Added routing support for virtual network so that source addresses are transmitted when required and the correct object ID is used.

This commit is contained in:
petermcs
2010-11-17 23:16:24 +00:00
parent a1eaffccff
commit 3bb228edf2
26 changed files with 210 additions and 9 deletions
+18
View File
@@ -54,7 +54,11 @@ void Send_TimeSync(
BACNET_ADDRESS dest;
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;
@@ -62,8 +66,13 @@ void Send_TimeSync(
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
/* encode the APDU portion of the packet */
len =
timesync_encode_apdu(&Handler_Transmit_Buffer[pdu_len], bdate, btime);
@@ -87,7 +96,11 @@ void Send_TimeSyncUTC(
BACNET_ADDRESS dest;
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;
@@ -95,8 +108,13 @@ void Send_TimeSyncUTC(
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
/* encode the APDU portion of the packet */
pdu_len =
timesync_utc_encode_apdu(&Handler_Transmit_Buffer[0], bdate, btime);