Resolved more code where we didn't need to define separate BAC_ROUTING functionality, since the npdu_encode_pdu() will do the right thing if our source address is for the gateway (root device), because src->net and/or src->len will be 0.
For the important Device_Object_Instance_Number(), will redirect to the Routed_Device_Object_Instance_Number() function if this is a routing build. This leaves only the Who-Is and Who-Has handlers to be dealt with.
This commit is contained in:
@@ -334,11 +334,7 @@ static bool cov_send_request(
|
|||||||
/* load the COV data structure for outgoing message */
|
/* load the COV data structure for outgoing message */
|
||||||
cov_data.subscriberProcessIdentifier =
|
cov_data.subscriberProcessIdentifier =
|
||||||
cov_subscription->subscriberProcessIdentifier;
|
cov_subscription->subscriberProcessIdentifier;
|
||||||
#if BAC_ROUTING
|
|
||||||
cov_data.initiatingDeviceIdentifier = Routed_Device_Object_Instance_Number();
|
|
||||||
#else
|
|
||||||
cov_data.initiatingDeviceIdentifier = Device_Object_Instance_Number();
|
cov_data.initiatingDeviceIdentifier = Device_Object_Instance_Number();
|
||||||
#endif
|
|
||||||
cov_data.monitoredObjectIdentifier.type =
|
cov_data.monitoredObjectIdentifier.type =
|
||||||
cov_subscription->monitoredObjectIdentifier.type;
|
cov_subscription->monitoredObjectIdentifier.type;
|
||||||
cov_data.monitoredObjectIdentifier.instance =
|
cov_data.monitoredObjectIdentifier.instance =
|
||||||
|
|||||||
@@ -83,11 +83,7 @@ void handler_who_has(
|
|||||||
Device_Valid_Object_Name(object_name, &object_type,
|
Device_Valid_Object_Name(object_name, &object_type,
|
||||||
&object_instance);
|
&object_instance);
|
||||||
if (found)
|
if (found)
|
||||||
#if BAC_ROUTING
|
|
||||||
Send_I_Have(Routed_Device_Object_Instance_Number(),
|
|
||||||
#else
|
|
||||||
Send_I_Have(Device_Object_Instance_Number(),
|
Send_I_Have(Device_Object_Instance_Number(),
|
||||||
#endif
|
|
||||||
(BACNET_OBJECT_TYPE) object_type, object_instance,
|
(BACNET_OBJECT_TYPE) object_type, object_instance,
|
||||||
object_name);
|
object_name);
|
||||||
} else {
|
} else {
|
||||||
@@ -96,11 +92,7 @@ void handler_who_has(
|
|||||||
Device_Valid_Object_Id(data.object.identifier.type,
|
Device_Valid_Object_Id(data.object.identifier.type,
|
||||||
data.object.identifier.instance);
|
data.object.identifier.instance);
|
||||||
if (object_name)
|
if (object_name)
|
||||||
#if BAC_ROUTING
|
|
||||||
Send_I_Have(Routed_Device_Object_Instance_Number(),
|
|
||||||
#else
|
|
||||||
Send_I_Have(Device_Object_Instance_Number(),
|
Send_I_Have(Device_Object_Instance_Number(),
|
||||||
#endif
|
|
||||||
(BACNET_OBJECT_TYPE) data.object.identifier.type,
|
(BACNET_OBJECT_TYPE) data.object.identifier.type,
|
||||||
data.object.identifier.instance, object_name);
|
data.object.identifier.instance, object_name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,20 +52,15 @@ int ucov_notify_encode_pdu(
|
|||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int pdu_len = 0;
|
int pdu_len = 0;
|
||||||
#if BAC_ROUTING
|
|
||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
datalink_get_my_address(&my_address);
|
||||||
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#endif
|
|
||||||
/* unconfirmed is a broadcast */
|
/* unconfirmed is a broadcast */
|
||||||
datalink_get_broadcast_address(dest);
|
datalink_get_broadcast_address(dest);
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
npdu_encode_npdu_data(npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
#if BAC_ROUTING
|
|
||||||
pdu_len = npdu_encode_pdu(&buffer[0], dest, &my_address, npdu_data);
|
pdu_len = npdu_encode_pdu(&buffer[0], dest, &my_address, npdu_data);
|
||||||
#else
|
|
||||||
pdu_len = npdu_encode_pdu(&buffer[0], dest, NULL, npdu_data);
|
|
||||||
#endif
|
|
||||||
/* encode the APDU portion of the packet */
|
/* encode the APDU portion of the packet */
|
||||||
len = ucov_notify_encode_apdu(&buffer[pdu_len], cov_data);
|
len = ucov_notify_encode_apdu(&buffer[pdu_len], cov_data);
|
||||||
pdu_len += len;
|
pdu_len += len;
|
||||||
|
|||||||
@@ -56,23 +56,16 @@ int iam_encode_pdu(
|
|||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int pdu_len = 0;
|
int pdu_len = 0;
|
||||||
#if BAC_ROUTING
|
|
||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
datalink_get_my_address(&my_address);
|
||||||
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#endif
|
|
||||||
datalink_get_broadcast_address(dest);
|
datalink_get_broadcast_address(dest);
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
npdu_encode_npdu_data(npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
#if BAC_ROUTING
|
|
||||||
pdu_len = npdu_encode_pdu(&buffer[0], dest, &my_address, npdu_data);
|
pdu_len = npdu_encode_pdu(&buffer[0], dest, &my_address, npdu_data);
|
||||||
/* encode the APDU portion of the packet */
|
|
||||||
len = iam_encode_apdu(&buffer[pdu_len], Routed_Device_Object_Instance_Number(),
|
|
||||||
#else
|
|
||||||
pdu_len = npdu_encode_pdu(&buffer[0], dest, NULL, npdu_data);
|
|
||||||
/* encode the APDU portion of the packet */
|
/* encode the APDU portion of the packet */
|
||||||
len = iam_encode_apdu(&buffer[pdu_len], Device_Object_Instance_Number(),
|
len = iam_encode_apdu(&buffer[pdu_len], Device_Object_Instance_Number(),
|
||||||
#endif
|
|
||||||
MAX_APDU, SEGMENTATION_NONE, Device_Vendor_Identifier());
|
MAX_APDU, SEGMENTATION_NONE, Device_Vendor_Identifier());
|
||||||
pdu_len += len;
|
pdu_len += len;
|
||||||
|
|
||||||
@@ -146,12 +139,8 @@ int iam_unicast_encode_pdu(
|
|||||||
npdu_encode_npdu_data(npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
npdu_len = npdu_encode_pdu(&buffer[0], dest, &my_address, npdu_data);
|
npdu_len = npdu_encode_pdu(&buffer[0], dest, &my_address, npdu_data);
|
||||||
/* encode the APDU portion of the packet */
|
/* encode the APDU portion of the packet */
|
||||||
#if BAC_ROUTING
|
|
||||||
apdu_len = iam_encode_apdu(&buffer[npdu_len], Routed_Device_Object_Instance_Number(),
|
|
||||||
#else
|
|
||||||
apdu_len = iam_encode_apdu(&buffer[npdu_len], Device_Object_Instance_Number(),
|
apdu_len = iam_encode_apdu(&buffer[npdu_len], Device_Object_Instance_Number(),
|
||||||
#endif
|
MAX_APDU, SEGMENTATION_NONE, Device_Vendor_Identifier());
|
||||||
MAX_APDU, SEGMENTATION_NONE, Device_Vendor_Identifier());
|
|
||||||
pdu_len = npdu_len + apdu_len;
|
pdu_len = npdu_len + apdu_len;
|
||||||
|
|
||||||
return pdu_len;
|
return pdu_len;
|
||||||
|
|||||||
@@ -65,11 +65,9 @@ void Send_I_Have(
|
|||||||
int bytes_sent = 0;
|
int bytes_sent = 0;
|
||||||
BACNET_I_HAVE_DATA data;
|
BACNET_I_HAVE_DATA data;
|
||||||
BACNET_NPDU_DATA npdu_data;
|
BACNET_NPDU_DATA npdu_data;
|
||||||
#if BAC_ROUTING
|
|
||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
/* if we are forbidden to send, don't send! */
|
/* if we are forbidden to send, don't send! */
|
||||||
if (!dcc_communication_enabled())
|
if (!dcc_communication_enabled())
|
||||||
return;
|
return;
|
||||||
@@ -77,11 +75,8 @@ void Send_I_Have(
|
|||||||
datalink_get_broadcast_address(&dest);
|
datalink_get_broadcast_address(&dest);
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
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);
|
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 */
|
/* encode the APDU portion of the packet */
|
||||||
data.device_id.type = OBJECT_DEVICE;
|
data.device_id.type = OBJECT_DEVICE;
|
||||||
data.device_id.instance = device_id;
|
data.device_id.instance = device_id;
|
||||||
|
|||||||
@@ -54,25 +54,19 @@ void Send_TimeSync(
|
|||||||
BACNET_ADDRESS dest;
|
BACNET_ADDRESS dest;
|
||||||
int bytes_sent = 0;
|
int bytes_sent = 0;
|
||||||
BACNET_NPDU_DATA npdu_data;
|
BACNET_NPDU_DATA npdu_data;
|
||||||
#if BAC_ROUTING
|
|
||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#endif
|
|
||||||
if (!dcc_communication_enabled())
|
if (!dcc_communication_enabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* we could use unicast or broadcast */
|
/* we could use unicast or broadcast */
|
||||||
datalink_get_broadcast_address(&dest);
|
datalink_get_broadcast_address(&dest);
|
||||||
|
datalink_get_my_address(&my_address);
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
#if BAC_ROUTING
|
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address, &npdu_data);
|
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 */
|
/* encode the APDU portion of the packet */
|
||||||
len =
|
len =
|
||||||
timesync_encode_apdu(&Handler_Transmit_Buffer[pdu_len], bdate, btime);
|
timesync_encode_apdu(&Handler_Transmit_Buffer[pdu_len], bdate, btime);
|
||||||
@@ -96,25 +90,19 @@ void Send_TimeSyncUTC(
|
|||||||
BACNET_ADDRESS dest;
|
BACNET_ADDRESS dest;
|
||||||
int bytes_sent = 0;
|
int bytes_sent = 0;
|
||||||
BACNET_NPDU_DATA npdu_data;
|
BACNET_NPDU_DATA npdu_data;
|
||||||
#if BAC_ROUTING
|
|
||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#endif
|
|
||||||
if (!dcc_communication_enabled())
|
if (!dcc_communication_enabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* we could use unicast or broadcast */
|
/* we could use unicast or broadcast */
|
||||||
datalink_get_broadcast_address(&dest);
|
datalink_get_broadcast_address(&dest);
|
||||||
|
datalink_get_my_address(&my_address);
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
#if BAC_ROUTING
|
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address, &npdu_data);
|
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 */
|
/* encode the APDU portion of the packet */
|
||||||
pdu_len =
|
pdu_len =
|
||||||
timesync_utc_encode_apdu(&Handler_Transmit_Buffer[0], bdate, btime);
|
timesync_utc_encode_apdu(&Handler_Transmit_Buffer[0], bdate, btime);
|
||||||
|
|||||||
@@ -49,18 +49,12 @@ int Send_UEvent_Notify(
|
|||||||
int pdu_len = 0;
|
int pdu_len = 0;
|
||||||
int bytes_sent = 0;
|
int bytes_sent = 0;
|
||||||
BACNET_NPDU_DATA npdu_data;
|
BACNET_NPDU_DATA npdu_data;
|
||||||
#if BAC_ROUTING
|
|
||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
#if BAC_ROUTING
|
|
||||||
pdu_len = npdu_encode_pdu(buffer, dest, &my_address, &npdu_data);
|
pdu_len = npdu_encode_pdu(buffer, dest, &my_address, &npdu_data);
|
||||||
#else
|
|
||||||
pdu_len = npdu_encode_pdu(buffer, dest, NULL, &npdu_data);
|
|
||||||
#endif
|
|
||||||
/* encode the APDU portion of the packet */
|
/* encode the APDU portion of the packet */
|
||||||
len = uevent_notify_encode_apdu(&buffer[pdu_len], data);
|
len = uevent_notify_encode_apdu(&buffer[pdu_len], data);
|
||||||
pdu_len += len;
|
pdu_len += len;
|
||||||
|
|||||||
@@ -53,22 +53,16 @@ void Send_UnconfirmedPrivateTransfer(
|
|||||||
int pdu_len = 0;
|
int pdu_len = 0;
|
||||||
int bytes_sent = 0;
|
int bytes_sent = 0;
|
||||||
BACNET_NPDU_DATA npdu_data;
|
BACNET_NPDU_DATA npdu_data;
|
||||||
#if BAC_ROUTING
|
|
||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!dcc_communication_enabled())
|
if (!dcc_communication_enabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
datalink_get_my_address(&my_address);
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
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);
|
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 */
|
/* encode the APDU portion of the packet */
|
||||||
len =
|
len =
|
||||||
uptransfer_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
uptransfer_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||||
|
|||||||
@@ -66,25 +66,19 @@ void Send_WhoHas_Name(
|
|||||||
int bytes_sent = 0;
|
int bytes_sent = 0;
|
||||||
BACNET_WHO_HAS_DATA data;
|
BACNET_WHO_HAS_DATA data;
|
||||||
BACNET_NPDU_DATA npdu_data;
|
BACNET_NPDU_DATA npdu_data;
|
||||||
#if BAC_ROUTING
|
|
||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#endif
|
|
||||||
/* if we are forbidden to send, don't send! */
|
/* if we are forbidden to send, don't send! */
|
||||||
if (!dcc_communication_enabled())
|
if (!dcc_communication_enabled())
|
||||||
return;
|
return;
|
||||||
/* Who-Has is a global broadcast */
|
/* Who-Has is a global broadcast */
|
||||||
datalink_get_broadcast_address(&dest);
|
datalink_get_broadcast_address(&dest);
|
||||||
|
datalink_get_my_address(&my_address);
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
#if BAC_ROUTING
|
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address, &npdu_data);
|
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 */
|
/* encode the APDU portion of the packet */
|
||||||
data.low_limit = low_limit;
|
data.low_limit = low_limit;
|
||||||
data.high_limit = high_limit;
|
data.high_limit = high_limit;
|
||||||
@@ -126,25 +120,19 @@ void Send_WhoHas_Object(
|
|||||||
int bytes_sent = 0;
|
int bytes_sent = 0;
|
||||||
BACNET_WHO_HAS_DATA data;
|
BACNET_WHO_HAS_DATA data;
|
||||||
BACNET_NPDU_DATA npdu_data;
|
BACNET_NPDU_DATA npdu_data;
|
||||||
#if BAC_ROUTING
|
|
||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
|
||||||
#endif
|
|
||||||
/* if we are forbidden to send, don't send! */
|
/* if we are forbidden to send, don't send! */
|
||||||
if (!dcc_communication_enabled())
|
if (!dcc_communication_enabled())
|
||||||
return;
|
return;
|
||||||
/* Who-Has is a global broadcast */
|
/* Who-Has is a global broadcast */
|
||||||
datalink_get_broadcast_address(&dest);
|
datalink_get_broadcast_address(&dest);
|
||||||
|
datalink_get_my_address(&my_address);
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
#if BAC_ROUTING
|
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address, &npdu_data);
|
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 */
|
/* encode the APDU portion of the packet */
|
||||||
data.low_limit = low_limit;
|
data.low_limit = low_limit;
|
||||||
data.high_limit = high_limit;
|
data.high_limit = high_limit;
|
||||||
|
|||||||
@@ -65,21 +65,14 @@ void Send_WhoIs_To_Network(
|
|||||||
int pdu_len = 0;
|
int pdu_len = 0;
|
||||||
int bytes_sent = 0;
|
int bytes_sent = 0;
|
||||||
BACNET_NPDU_DATA npdu_data;
|
BACNET_NPDU_DATA npdu_data;
|
||||||
#if BAC_ROUTING
|
|
||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
my_address = *Get_Routed_Device_Address(-1);
|
datalink_get_my_address(&my_address);
|
||||||
#endif
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
|
|
||||||
#if BAC_ROUTING
|
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], target_address, &my_address, &npdu_data);
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], target_address, &my_address, &npdu_data);
|
||||||
#else
|
|
||||||
pdu_len =
|
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], target_address, NULL, &npdu_data);
|
|
||||||
#endif
|
|
||||||
/* encode the APDU portion of the packet */
|
/* encode the APDU portion of the packet */
|
||||||
len =
|
len =
|
||||||
whois_encode_apdu(&Handler_Transmit_Buffer[pdu_len], low_limit,
|
whois_encode_apdu(&Handler_Transmit_Buffer[pdu_len], low_limit,
|
||||||
|
|||||||
@@ -353,7 +353,11 @@ uint32_t Device_Index_To_Instance(
|
|||||||
uint32_t Device_Object_Instance_Number(
|
uint32_t Device_Object_Instance_Number(
|
||||||
void)
|
void)
|
||||||
{
|
{
|
||||||
|
#if BAC_ROUTING
|
||||||
|
return Routed_Device_Object_Instance_Number();
|
||||||
|
#else
|
||||||
return Object_Instance_Number;
|
return Object_Instance_Number;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Device_Set_Object_Instance_Number(
|
bool Device_Set_Object_Instance_Number(
|
||||||
|
|||||||
@@ -175,6 +175,8 @@ BACNET_ADDRESS * Get_Routed_Device_Address(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Get the currently active BACnet address.
|
/** Get the currently active BACnet address.
|
||||||
* This is an implementation of the datalink_get_my_address() template for
|
* This is an implementation of the datalink_get_my_address() template for
|
||||||
* devices with routing.
|
* devices with routing.
|
||||||
@@ -459,11 +461,11 @@ bool Routed_Device_Write_Property_Local(
|
|||||||
|
|
||||||
/* methods to manipulate the data */
|
/* methods to manipulate the data */
|
||||||
|
|
||||||
/** Return the Object Instance number for our (single) Device Object.
|
/** Return the Object Instance number for the currently active Device Object.
|
||||||
* This is a key function, widely invoked by the handler code, since
|
* This is an overload of the important, widely used
|
||||||
* it provides "our" (ie, local) address.
|
* Device_Object_Instance_Number() function.
|
||||||
* @ingroup ObjIntf
|
*
|
||||||
* @return The Instance number used in the BACNET_OBJECT_ID for the Device.
|
* @return The Instance number of the currently active Device.
|
||||||
*/
|
*/
|
||||||
uint32_t Routed_Device_Object_Instance_Number(
|
uint32_t Routed_Device_Object_Instance_Number(
|
||||||
void)
|
void)
|
||||||
|
|||||||
Reference in New Issue
Block a user