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:
@@ -172,6 +172,8 @@ static void Init_Service_Handlers(
|
|||||||
handler_read_property_multiple);
|
handler_read_property_multiple);
|
||||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
|
apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
|
||||||
handler_write_property);
|
handler_write_property);
|
||||||
|
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
|
||||||
|
handler_read_range);
|
||||||
#if defined(BACFILE)
|
#if defined(BACFILE)
|
||||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
|
apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
|
||||||
handler_atomic_read_file);
|
handler_atomic_read_file);
|
||||||
|
|||||||
@@ -69,7 +69,11 @@ void handler_alarm_ack(
|
|||||||
BACNET_ADDRESS my_address;
|
BACNET_ADDRESS my_address;
|
||||||
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
|
#if BAC_ROUTING
|
||||||
|
my_address = *Get_Routed_Device_Address(-1);
|
||||||
|
#else
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
|
#endif
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ static bool cov_send_request(
|
|||||||
cov_data.subscriberProcessIdentifier =
|
cov_data.subscriberProcessIdentifier =
|
||||||
cov_subscription->subscriberProcessIdentifier;
|
cov_subscription->subscriberProcessIdentifier;
|
||||||
#if BAC_ROUTING
|
#if BAC_ROUTING
|
||||||
cov_data.initiatingDeviceIdentifier = Device_Object_Instance_Number();
|
cov_data.initiatingDeviceIdentifier = Routed_Device_Object_Instance_Number();
|
||||||
#else
|
#else
|
||||||
cov_data.initiatingDeviceIdentifier = Device_Object_Instance_Number();
|
cov_data.initiatingDeviceIdentifier = Device_Object_Instance_Number();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -72,7 +72,11 @@ void handler_get_event_information(
|
|||||||
int valid_event = 0;
|
int valid_event = 0;
|
||||||
|
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
|
#if BAC_ROUTING
|
||||||
|
my_address = *Get_Routed_Device_Address(-1);
|
||||||
|
#else
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
|
#endif
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
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 */
|
/* encode the NPDU portion of the response packet as it will be needed */
|
||||||
/* no matter what the outcome. */
|
/* no matter what the outcome. */
|
||||||
|
|
||||||
|
#if BAC_ROUTING
|
||||||
|
my_address = *Get_Routed_Device_Address(-1);
|
||||||
|
#else
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
|
#endif
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
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_class = ERROR_CLASS_OBJECT;
|
||||||
data.error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
data.error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
|
#if BAC_ROUTING
|
||||||
|
my_address = *Get_Routed_Device_Address(-1);
|
||||||
|
#else
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
|
#endif
|
||||||
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, false, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], src, &my_address,
|
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();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
|
#if BAC_ROUTING
|
||||||
|
my_address = *Get_Routed_Device_Address(-1);
|
||||||
|
#else
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
|
#endif
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
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();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* 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);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -77,14 +77,11 @@ 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
|
#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
|
#else
|
||||||
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, NULL, &npdu_data);
|
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, NULL, &npdu_data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pdu_len = npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, NULL, &npdu_data);
|
|
||||||
/* 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;
|
||||||
|
|||||||
@@ -73,7 +73,11 @@ uint8_t Send_Life_Safety_Operation_Data(
|
|||||||
invoke_id = tsm_next_free_invokeID();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
|
#if BAC_ROUTING
|
||||||
|
my_address = *Get_Routed_Device_Address(-1);
|
||||||
|
#else
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
|
#endif
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
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();
|
invoke_id = tsm_next_free_invokeID();
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
|
#if BAC_ROUTING
|
||||||
|
my_address = *Get_Routed_Device_Address(-1);
|
||||||
|
#else
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
|
#endif
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -72,7 +72,11 @@ uint8_t Send_ReadRange_Request(
|
|||||||
|
|
||||||
if (invoke_id) {
|
if (invoke_id) {
|
||||||
/* encode the NPDU portion of the packet */
|
/* encode the NPDU portion of the packet */
|
||||||
|
#if BAC_ROUTING
|
||||||
|
my_address = *Get_Routed_Device_Address(-1);
|
||||||
|
#else
|
||||||
datalink_get_my_address(&my_address);
|
datalink_get_my_address(&my_address);
|
||||||
|
#endif
|
||||||
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
npdu_encode_npdu_data(&npdu_data, true, MESSAGE_PRIORITY_NORMAL);
|
||||||
pdu_len =
|
pdu_len =
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
npdu_encode_pdu(&Handler_Transmit_Buffer[0], &dest, &my_address,
|
||||||
|
|||||||
@@ -53,14 +53,22 @@ 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;
|
||||||
|
|
||||||
|
my_address = *Get_Routed_Device_Address(-1);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!dcc_communication_enabled())
|
if (!dcc_communication_enabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* 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);
|
||||||
pdu_len =
|
#if BAC_ROUTING
|
||||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], dest, NULL, &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],
|
||||||
|
|||||||
@@ -117,6 +117,8 @@ static void Init_Service_Handlers(
|
|||||||
handler_read_property_multiple);
|
handler_read_property_multiple);
|
||||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
|
apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
|
||||||
handler_write_property);
|
handler_write_property);
|
||||||
|
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
|
||||||
|
handler_read_range);
|
||||||
#if defined(BACFILE)
|
#if defined(BACFILE)
|
||||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
|
apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
|
||||||
handler_atomic_read_file);
|
handler_atomic_read_file);
|
||||||
|
|||||||
+8
@@ -327,6 +327,10 @@
|
|||||||
RelativePath="..\..\..\..\demo\handler\h_rpm_a.c"
|
RelativePath="..\..\..\..\demo\handler\h_rpm_a.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\demo\handler\h_rr.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\demo\handler\h_ts.c"
|
RelativePath="..\..\..\..\demo\handler\h_ts.c"
|
||||||
>
|
>
|
||||||
@@ -403,6 +407,10 @@
|
|||||||
RelativePath="..\..\..\..\src\rd.c"
|
RelativePath="..\..\..\..\src\rd.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\..\src\readrange.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\..\src\reject.c"
|
RelativePath="..\..\..\..\src\reject.c"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user