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:
petermcs
2010-11-18 21:29:11 +00:00
parent 3bb228edf2
commit dbb8997b4d
15 changed files with 60 additions and 7 deletions
+2
View File
@@ -172,6 +172,8 @@ static void Init_Service_Handlers(
handler_read_property_multiple);
apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
handler_write_property);
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
handler_read_range);
#if defined(BACFILE)
apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
handler_atomic_read_file);
+4
View File
@@ -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,
+1 -1
View File
@@ -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
+4
View File
@@ -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,
+4
View File
@@ -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,
+4
View File
@@ -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,
+4
View File
@@ -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,
+5 -1
View File
@@ -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,
-3
View File
@@ -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;
+4
View File
@@ -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,
+4
View File
@@ -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,
+4
View File
@@ -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,
+10 -2
View File
@@ -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],
+2
View File
@@ -117,6 +117,8 @@ static void Init_Service_Handlers(
handler_read_property_multiple);
apdu_set_confirmed_handler(SERVICE_CONFIRMED_WRITE_PROPERTY,
handler_write_property);
apdu_set_confirmed_handler(SERVICE_CONFIRMED_READ_RANGE,
handler_read_range);
#if defined(BACFILE)
apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_READ_FILE,
handler_atomic_read_file);
@@ -327,6 +327,10 @@
RelativePath="..\..\..\..\demo\handler\h_rpm_a.c"
>
</File>
<File
RelativePath="..\..\..\..\demo\handler\h_rr.c"
>
</File>
<File
RelativePath="..\..\..\..\demo\handler\h_ts.c"
>
@@ -403,6 +407,10 @@
RelativePath="..\..\..\..\src\rd.c"
>
</File>
<File
RelativePath="..\..\..\..\src\readrange.c"
>
</File>
<File
RelativePath="..\..\..\..\src\reject.c"
>