Indented.

This commit is contained in:
skarg
2007-11-29 15:56:53 +00:00
parent c585241c03
commit 411d6c1b24
236 changed files with 17864 additions and 15724 deletions
+32 -67
View File
@@ -47,7 +47,7 @@
#include "lsp.h"
#include "mso.h"
#if defined(BACFILE)
#include "bacfile.h"
#include "bacfile.h"
#endif
static uint8_t Temp_Buf[MAX_APDU] = { 0 };
@@ -69,115 +69,82 @@ int Encode_Property_APDU(
*error_class = ERROR_CLASS_OBJECT;
*error_code = ERROR_CODE_UNKNOWN_OBJECT;
/* handle each object type */
switch(object_type) {
switch (object_type) {
case OBJECT_DEVICE:
if (Device_Valid_Object_Instance_Number(object_instance)) {
apdu_len = Device_Encode_Property_APDU(
&apdu[0],
property,
array_index,
error_class, error_code);
apdu_len = Device_Encode_Property_APDU(&apdu[0],
property, array_index, error_class, error_code);
}
break;
case OBJECT_ANALOG_INPUT:
if (Analog_Input_Valid_Instance(object_instance)) {
apdu_len = Analog_Input_Encode_Property_APDU(
&apdu[0],
apdu_len = Analog_Input_Encode_Property_APDU(&apdu[0],
object_instance,
property,
array_index,
error_class, error_code);
property, array_index, error_class, error_code);
}
break;
case OBJECT_ANALOG_OUTPUT:
if (Analog_Output_Valid_Instance(object_instance)) {
apdu_len = Analog_Output_Encode_Property_APDU(
&apdu[0],
apdu_len = Analog_Output_Encode_Property_APDU(&apdu[0],
object_instance,
property,
array_index,
error_class, error_code);
property, array_index, error_class, error_code);
}
break;
case OBJECT_ANALOG_VALUE:
if (Analog_Value_Valid_Instance(object_instance)) {
apdu_len = Analog_Value_Encode_Property_APDU(
&apdu[0],
apdu_len = Analog_Value_Encode_Property_APDU(&apdu[0],
object_instance,
property,
array_index,
error_class, error_code);
property, array_index, error_class, error_code);
}
break;
case OBJECT_BINARY_INPUT:
if (Binary_Input_Valid_Instance(object_instance)) {
apdu_len = Binary_Input_Encode_Property_APDU(
&apdu[0],
apdu_len = Binary_Input_Encode_Property_APDU(&apdu[0],
object_instance,
property,
array_index,
error_class, error_code);
property, array_index, error_class, error_code);
}
break;
case OBJECT_BINARY_OUTPUT:
if (Binary_Output_Valid_Instance(object_instance)) {
apdu_len = Binary_Output_Encode_Property_APDU(
&apdu[0],
apdu_len = Binary_Output_Encode_Property_APDU(&apdu[0],
object_instance,
property,
array_index,
error_class, error_code);
property, array_index, error_class, error_code);
}
break;
case OBJECT_BINARY_VALUE:
if (Binary_Value_Valid_Instance(object_instance)) {
apdu_len = Binary_Value_Encode_Property_APDU(
&apdu[0],
apdu_len = Binary_Value_Encode_Property_APDU(&apdu[0],
object_instance,
property,
array_index,
error_class, error_code);
property, array_index, error_class, error_code);
}
break;
case OBJECT_LIFE_SAFETY_POINT:
if (Life_Safety_Point_Valid_Instance(object_instance)) {
apdu_len = Life_Safety_Point_Encode_Property_APDU(
&apdu[0],
apdu_len = Life_Safety_Point_Encode_Property_APDU(&apdu[0],
object_instance,
property,
array_index,
error_class, error_code);
property, array_index, error_class, error_code);
}
break;
case OBJECT_LOAD_CONTROL:
if (Load_Control_Valid_Instance(object_instance)) {
apdu_len = Load_Control_Encode_Property_APDU(
&apdu[0],
apdu_len = Load_Control_Encode_Property_APDU(&apdu[0],
object_instance,
property,
array_index,
error_class, error_code);
property, array_index, error_class, error_code);
}
break;
case OBJECT_MULTI_STATE_OUTPUT:
if (Multistate_Output_Valid_Instance(object_instance)) {
apdu_len = Multistate_Output_Encode_Property_APDU(
&apdu[0],
apdu_len = Multistate_Output_Encode_Property_APDU(&apdu[0],
object_instance,
property,
array_index,
error_class, error_code);
property, array_index, error_class, error_code);
}
break;
#if defined(BACFILE)
case OBJECT_FILE:
if (bacfile_valid_instance(object_instance)) {
apdu_len = bacfile_encode_property_apdu(
&apdu[0],
apdu_len = bacfile_encode_property_apdu(&apdu[0],
object_instance,
property,
array_index,
error_class, error_code);
property, array_index, error_class, error_code);
}
break;
#endif
@@ -190,9 +157,11 @@ int Encode_Property_APDU(
return apdu_len;
}
void handler_read_property(uint8_t * service_request,
void handler_read_property(
uint8_t * service_request,
uint16_t service_len,
BACNET_ADDRESS * src, BACNET_CONFIRMED_SERVICE_DATA * service_data)
BACNET_ADDRESS * src,
BACNET_CONFIRMED_SERVICE_DATA * service_data)
{
BACNET_READ_PROPERTY_DATA data;
int len = 0;
@@ -237,13 +206,10 @@ void handler_read_property(uint8_t * service_request,
/* assume that there is an error */
error = true;
len = Encode_Property_APDU(
&Temp_Buf[0],
len = Encode_Property_APDU(&Temp_Buf[0],
data.object_type,
data.object_instance,
data.object_property,
data.array_index,
&error_class, &error_code);
data.object_property, data.array_index, &error_class, &error_code);
if (len >= 0) {
/* encode the APDU portion of the packet */
data.application_data = &Temp_Buf[0];
@@ -253,8 +219,7 @@ void handler_read_property(uint8_t * service_request,
rp_ack_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
service_data->invoke_id, &data);
#if PRINT_ENABLED
fprintf(stderr,
"RP: Sending Ack!\n");
fprintf(stderr, "RP: Sending Ack!\n");
#endif
error = false;
}
@@ -276,7 +241,7 @@ void handler_read_property(uint8_t * service_request,
#endif
}
}
RP_ABORT:
RP_ABORT:
pdu_len += len;
bytes_sent = datalink_send_pdu(src, &npdu_data,
&Handler_Transmit_Buffer[0], pdu_len);