Indented.

This commit is contained in:
skarg
2010-08-18 00:11:35 +00:00
parent 1165f94cf5
commit b769dcbe1d
40 changed files with 286 additions and 302 deletions
+3 -4
View File
@@ -1062,9 +1062,8 @@ int main(
(invoke_id ==
Read_Property_Multiple_Data.service_data.invoke_id)) {
Read_Property_Multiple_Data.new_data = false;
PrintReadPropertyData
(Read_Property_Multiple_Data.rpm_data->
listOfProperties);
PrintReadPropertyData(Read_Property_Multiple_Data.
rpm_data->listOfProperties);
if (tsm_invoke_id_free(invoke_id)) {
invoke_id = 0;
} else {
@@ -1188,4 +1187,4 @@ int main(
return 0;
}
/*@} *//* End group BACEPICS */
/*@} *//* End group BACEPICS */
+4 -5
View File
@@ -345,9 +345,8 @@ static bool cov_send_request(
value_list[1].next = NULL;
switch (cov_subscription->monitoredObjectIdentifier.type) {
case OBJECT_BINARY_INPUT:
Binary_Input_Encode_Value_List
(cov_subscription->monitoredObjectIdentifier.instance,
&value_list[0]);
Binary_Input_Encode_Value_List(cov_subscription->
monitoredObjectIdentifier.instance, &value_list[0]);
break;
default:
goto COV_FAILED;
@@ -464,8 +463,8 @@ static bool cov_subscribe(
switch (cov_data->monitoredObjectIdentifier.type) {
case OBJECT_BINARY_INPUT:
if (Binary_Input_Valid_Instance
(cov_data->monitoredObjectIdentifier.instance)) {
if (Binary_Input_Valid_Instance(cov_data->
monitoredObjectIdentifier.instance)) {
status =
cov_list_subscribe(src, cov_data, error_class, error_code);
} else {
+6 -6
View File
@@ -218,8 +218,8 @@ void rpm_ack_print_data(
#if PRINT_ENABLED
if (listOfProperties->propertyIdentifier < 512) {
fprintf(stdout, " %s: ",
bactext_property_name(listOfProperties->
propertyIdentifier));
bactext_property_name
(listOfProperties->propertyIdentifier));
} else {
fprintf(stdout, " proprietary %u: ",
(unsigned) listOfProperties->propertyIdentifier);
@@ -260,10 +260,10 @@ void rpm_ack_print_data(
#if PRINT_ENABLED
/* AccessError */
fprintf(stdout, "BACnet Error: %s: %s\r\n",
bactext_error_class_name((int) listOfProperties->
error.error_class),
bactext_error_code_name((int) listOfProperties->
error.error_code));
bactext_error_class_name((int) listOfProperties->error.
error_class),
bactext_error_code_name((int) listOfProperties->error.
error_code));
#endif
}
listOfProperties = listOfProperties->next;
+2 -2
View File
@@ -104,8 +104,8 @@ void handler_ucov_notification(
fprintf(stderr, "UCOV: ");
if (pProperty_value->propertyIdentifier < 512) {
fprintf(stderr, "%s ",
bactext_property_name
(pProperty_value->propertyIdentifier));
bactext_property_name(pProperty_value->
propertyIdentifier));
} else {
fprintf(stderr, "proprietary %u ",
pProperty_value->propertyIdentifier);
+3 -3
View File
@@ -79,8 +79,8 @@ void handler_who_has(
&object_instance);
if (found)
Send_I_Have(Device_Object_Instance_Number(),
(BACNET_OBJECT_TYPE)object_type,
object_instance, object_name);
(BACNET_OBJECT_TYPE) object_type, object_instance,
object_name);
} else {
/* valid object in my device? */
object_name =
@@ -88,7 +88,7 @@ void handler_who_has(
data.object.identifier.instance);
if (object_name)
Send_I_Have(Device_Object_Instance_Number(),
(BACNET_OBJECT_TYPE)data.object.identifier.type,
(BACNET_OBJECT_TYPE) data.object.identifier.type,
data.object.identifier.instance, object_name);
}
}
+2 -2
View File
@@ -174,8 +174,8 @@ bool WPValidateString(
(characterstring_length(&pValue->type.Character_String) ==
0)) {
*pErrorCode = ERROR_CODE_VALUE_OUT_OF_RANGE;
} else if (characterstring_length(&pValue->
type.Character_String) >= iMaxLen) {
} else if (characterstring_length(&pValue->type.
Character_String) >= iMaxLen) {
*pErrorClass = ERROR_CLASS_RESOURCES;
*pErrorCode = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
} else
+7 -8
View File
@@ -69,15 +69,16 @@ void Send_WhoIs_To_Network(
/* 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],target_address, NULL, &npdu_data);
npdu_encode_pdu(&Handler_Transmit_Buffer[0], target_address, NULL,
&npdu_data);
/* encode the APDU portion of the packet */
len =
whois_encode_apdu(&Handler_Transmit_Buffer[pdu_len], low_limit,
high_limit);
pdu_len += len;
bytes_sent =
datalink_send_pdu(target_address, &npdu_data, &Handler_Transmit_Buffer[0],
pdu_len);
datalink_send_pdu(target_address, &npdu_data,
&Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr, "Failed to Send Who-Is Request (%s)!\n",
@@ -145,9 +146,8 @@ void Send_WhoIs_Local(
int loop;
for(loop = 0; loop < 6; loop++)
{
dest.mac[loop] = temp[loop];
for (loop = 0; loop < 6; loop++) {
dest.mac[loop] = temp[loop];
}
Send_WhoIs_To_Network(&dest, low_limit, high_limit);
@@ -171,7 +171,7 @@ void Send_WhoIs_Remote(
if (!dcc_communication_enabled())
return;
Send_WhoIs_To_Network(target_address, low_limit, high_limit);
Send_WhoIs_To_Network(target_address, low_limit, high_limit);
}
/** Send a global Who-Is request for a specific device, a range, or any device.
@@ -191,4 +191,3 @@ void Send_WhoIs(
{
Send_WhoIs_Global(low_limit, high_limit);
}
+2 -3
View File
@@ -155,9 +155,8 @@ uint8_t Send_Write_Property_Request(
#if PRINT_ENABLED_DEBUG
fprintf(stderr, "WriteProperty service: " "%s tag=%d\n",
(object_value->context_specific ? "context" : "application"),
(int) (object_value->
context_specific ? object_value->context_tag : object_value->
tag));
(int) (object_value->context_specific ? object_value->
context_tag : object_value->tag));
#endif
len = bacapp_encode_data(&application_data[apdu_len], object_value);
if ((len + apdu_len) < MAX_APDU) {
+5 -6
View File
@@ -366,8 +366,7 @@ int Analog_Output_Read_Property(
1] == AO_LEVEL_NULL)
apdu_len = encode_application_null(&apdu[0]);
else {
real_value =
Analog_Output_Level[object_index]
real_value = Analog_Output_Level[object_index]
[rpdata->array_index - 1];
apdu_len =
encode_application_real(&apdu[0], real_value);
@@ -442,11 +441,11 @@ bool Analog_Output_Write_Property(
if (status) {
level = AO_LEVEL_NULL;
object_index =
Analog_Output_Instance_To_Index
(wp_data->object_instance);
Analog_Output_Instance_To_Index(wp_data->
object_instance);
status =
Analog_Output_Present_Value_Relinquish
(wp_data->object_instance, wp_data->priority);
Analog_Output_Present_Value_Relinquish(wp_data->
object_instance, wp_data->priority);
if (!status) {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
+3 -4
View File
@@ -315,8 +315,7 @@ int Analog_Value_Read_Property(
1] == ANALOG_LEVEL_NULL)
apdu_len = encode_application_null(&apdu[0]);
else {
real_value =
Analog_Value_Level[object_index]
real_value = Analog_Value_Level[object_index]
[rpdata->array_index - 1];
apdu_len =
encode_application_real(&apdu[0], real_value);
@@ -392,8 +391,8 @@ bool Analog_Value_Write_Property(
if (status) {
level = ANALOG_LEVEL_NULL;
object_index =
Analog_Value_Instance_To_Index
(wp_data->object_instance);
Analog_Value_Instance_To_Index(wp_data->
object_instance);
priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--;
+5 -6
View File
@@ -296,8 +296,7 @@ int Binary_Output_Read_Property(
1] == BINARY_NULL)
apdu_len = encode_application_null(&apdu[apdu_len]);
else {
present_value =
Binary_Output_Level[object_index]
present_value = Binary_Output_Level[object_index]
[rpdata->array_index - 1];
apdu_len =
encode_application_enumerated(&apdu[apdu_len],
@@ -371,8 +370,8 @@ bool Binary_Output_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) {
level = (BACNET_BINARY_PV) value.type.Enumerated;
object_index =
Binary_Output_Instance_To_Index
(wp_data->object_instance);
Binary_Output_Instance_To_Index(wp_data->
object_instance);
priority--;
Binary_Output_Level[object_index][priority] = level;
/* Note: you could set the physical output here if we
@@ -398,8 +397,8 @@ bool Binary_Output_Write_Property(
if (status) {
level = BINARY_NULL;
object_index =
Binary_Output_Instance_To_Index
(wp_data->object_instance);
Binary_Output_Instance_To_Index(wp_data->
object_instance);
priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--;
+5 -6
View File
@@ -289,8 +289,7 @@ int Binary_Value_Read_Property(
== BINARY_NULL)
apdu_len = encode_application_null(&apdu[apdu_len]);
else {
present_value =
Binary_Value_Level[object_index]
present_value = Binary_Value_Level[object_index]
[rpdata->array_index];
apdu_len =
encode_application_enumerated(&apdu[apdu_len],
@@ -354,8 +353,8 @@ bool Binary_Value_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) {
level = (BACNET_BINARY_PV) value.type.Enumerated;
object_index =
Binary_Value_Instance_To_Index
(wp_data->object_instance);
Binary_Value_Instance_To_Index(wp_data->
object_instance);
priority--;
Binary_Value_Level[object_index][priority] = level;
/* Note: you could set the physical output here if we
@@ -381,8 +380,8 @@ bool Binary_Value_Write_Property(
if (status) {
level = BINARY_NULL;
object_index =
Binary_Value_Instance_To_Index
(wp_data->object_instance);
Binary_Value_Instance_To_Index(wp_data->
object_instance);
priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--;
+14 -14
View File
@@ -1241,8 +1241,8 @@ static bool Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code);
if (status) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type.
Object_Id.instance))) {
(Device_Set_Object_Instance_Number(value.type.Object_Id.
instance))) {
/* FIXME: we could send an I-Am broadcast to let the world know */
} else {
status = false;
@@ -1275,8 +1275,8 @@ static bool Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code);
if (status) {
/* FIXME: bounds check? */
Device_Set_Vendor_Identifier((uint16_t) value.
type.Unsigned_Int);
Device_Set_Vendor_Identifier((uint16_t) value.type.
Unsigned_Int);
}
break;
case PROP_SYSTEM_STATUS:
@@ -1303,8 +1303,8 @@ static bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_NAME_LEN, false,
&wp_data->error_class, &wp_data->error_code);
if (status) {
Device_Set_Object_Name(characterstring_value(&value.
type.Character_String),
Device_Set_Object_Name(characterstring_value(&value.type.
Character_String),
characterstring_length(&value.type.Character_String));
}
break;
@@ -1313,8 +1313,8 @@ static bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_LOC_LEN, true,
&wp_data->error_class, &wp_data->error_code);
if (status) {
Device_Set_Location(characterstring_value(&value.
type.Character_String),
Device_Set_Location(characterstring_value(&value.type.
Character_String),
characterstring_length(&value.type.Character_String));
}
break;
@@ -1324,8 +1324,8 @@ static bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_DESC_LEN, true,
&wp_data->error_class, &wp_data->error_code);
if (status) {
Device_Set_Description(characterstring_value(&value.
type.Character_String),
Device_Set_Description(characterstring_value(&value.type.
Character_String),
characterstring_length(&value.type.Character_String));
}
break;
@@ -1334,8 +1334,8 @@ static bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_MOD_LEN, true,
&wp_data->error_class, &wp_data->error_code);
if (status) {
Device_Set_Model_Name(characterstring_value(&value.
type.Character_String),
Device_Set_Model_Name(characterstring_value(&value.type.
Character_String),
characterstring_length(&value.type.Character_String));
}
break;
@@ -1347,8 +1347,8 @@ static bool Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code);
if (status) {
if (value.type.Unsigned_Int <= 255) {
dlmstp_set_max_info_frames((uint8_t) value.
type.Unsigned_Int);
dlmstp_set_max_info_frames((uint8_t) value.type.
Unsigned_Int);
} else {
status = false;
wp_data->error_class = ERROR_CLASS_PROPERTY;
+9 -10
View File
@@ -469,12 +469,11 @@ int Lighting_Output_Read_Property(
object_index =
Lighting_Output_Instance_To_Index(rpdata->object_instance);
if (rpdata->array_index <= BACNET_MAX_PRIORITY) {
if (Lighting_Output_Level[object_index][rpdata->array_index
- 1] == LIGHTING_LEVEL_NULL)
if (Lighting_Output_Level[object_index][rpdata->
array_index - 1] == LIGHTING_LEVEL_NULL)
apdu_len = encode_application_null(&apdu[0]);
else {
real_value =
Lighting_Output_Level[object_index]
real_value = Lighting_Output_Level[object_index]
[rpdata->array_index - 1];
apdu_len =
encode_application_real(&apdu[0], real_value);
@@ -550,11 +549,11 @@ bool Lighting_Output_Write_Property(
if (status) {
level = LIGHTING_LEVEL_NULL;
object_index =
Lighting_Output_Instance_To_Index
(wp_data->object_instance);
Lighting_Output_Instance_To_Index(wp_data->
object_instance);
status =
Lighting_Output_Present_Value_Relinquish
(wp_data->object_instance, wp_data->priority);
Lighting_Output_Present_Value_Relinquish(wp_data->
object_instance, wp_data->priority);
if (wp_data->priority == 6) {
/* Command priority 6 is reserved for use by Minimum On/Off
algorithm and may not be used for other purposes in any
@@ -581,8 +580,8 @@ bool Lighting_Output_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
object_index =
Lighting_Output_Instance_To_Index
(wp_data->object_instance);
Lighting_Output_Instance_To_Index(wp_data->
object_instance);
Lighting_Output_Out_Of_Service[object_index] =
value.type.Boolean;
}
+4 -4
View File
@@ -318,8 +318,8 @@ bool Life_Safety_Point_Write_Property(
if (status) {
if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) {
object_index =
Life_Safety_Point_Instance_To_Index
(wp_data->object_instance);
Life_Safety_Point_Instance_To_Index(wp_data->
object_instance);
Life_Safety_Point_Mode[object_index] =
value.type.Enumerated;
} else {
@@ -335,8 +335,8 @@ bool Life_Safety_Point_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
object_index =
Life_Safety_Point_Instance_To_Index
(wp_data->object_instance);
Life_Safety_Point_Instance_To_Index(wp_data->
object_instance);
Life_Safety_Point_Out_Of_Service[object_index] =
value.type.Boolean;
}
+8 -8
View File
@@ -400,8 +400,8 @@ int Multistate_Input_Read_Property(
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
object_index =
Multistate_Input_Instance_To_Index
(rpdata->object_instance);
Multistate_Input_Instance_To_Index(rpdata->
object_instance);
for (i = 0; i < MULTISTATE_NUMBER_OF_STATES; i++) {
characterstring_init_ansi(&char_string,
Multistate_Input_State_Text(rpdata->object_instance,
@@ -422,8 +422,8 @@ int Multistate_Input_Read_Property(
}
} else {
object_index =
Multistate_Input_Instance_To_Index
(rpdata->object_instance);
Multistate_Input_Instance_To_Index(rpdata->
object_instance);
if (rpdata->array_index <= MULTISTATE_NUMBER_OF_STATES) {
characterstring_init_ansi(&char_string,
Multistate_Input_State_Text(rpdata->object_instance,
@@ -478,8 +478,8 @@ bool Multistate_Input_Write_Property(
if (status) {
if (Out_Of_Service[object_index]) {
status =
Multistate_Input_Present_Value_Set
(wp_data->object_instance, value.type.Unsigned_Int);
Multistate_Input_Present_Value_Set(wp_data->
object_instance, value.type.Unsigned_Int);
if (!status) {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
@@ -497,8 +497,8 @@ bool Multistate_Input_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
object_index =
Multistate_Input_Instance_To_Index
(wp_data->object_instance);
Multistate_Input_Instance_To_Index(wp_data->
object_instance);
Out_Of_Service[object_index] = value.type.Boolean;
}
break;
+11 -12
View File
@@ -266,8 +266,8 @@ int Multistate_Output_Read_Property(
/* into one packet. */
else if (rpdata->array_index == BACNET_ARRAY_ALL) {
object_index =
Multistate_Output_Instance_To_Index
(rpdata->object_instance);
Multistate_Output_Instance_To_Index(rpdata->
object_instance);
for (i = 0; i < BACNET_MAX_PRIORITY; i++) {
/* FIXME: check if we have room before adding it to APDU */
if (Multistate_Output_Level[object_index][i] ==
@@ -292,15 +292,14 @@ int Multistate_Output_Read_Property(
}
} else {
object_index =
Multistate_Output_Instance_To_Index
(rpdata->object_instance);
Multistate_Output_Instance_To_Index(rpdata->
object_instance);
if (rpdata->array_index <= BACNET_MAX_PRIORITY) {
if (Multistate_Output_Level[object_index]
[rpdata->array_index - 1] == MULTISTATE_NULL)
apdu_len = encode_application_null(&apdu[0]);
else {
present_value =
Multistate_Output_Level[object_index]
present_value = Multistate_Output_Level[object_index]
[rpdata->array_index - 1];
apdu_len =
encode_application_unsigned(&apdu[0],
@@ -370,8 +369,8 @@ bool Multistate_Output_Write_Property(
(value.type.Unsigned_Int <= MULTISTATE_NUMBER_OF_STATES)) {
level = value.type.Unsigned_Int;
object_index =
Multistate_Output_Instance_To_Index
(wp_data->object_instance);
Multistate_Output_Instance_To_Index(wp_data->
object_instance);
priority--;
Multistate_Output_Level[object_index][priority] =
(uint8_t) level;
@@ -398,8 +397,8 @@ bool Multistate_Output_Write_Property(
if (status) {
level = MULTISTATE_NULL;
object_index =
Multistate_Output_Instance_To_Index
(wp_data->object_instance);
Multistate_Output_Instance_To_Index(wp_data->
object_instance);
priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--;
@@ -425,8 +424,8 @@ bool Multistate_Output_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
object_index =
Multistate_Output_Instance_To_Index
(wp_data->object_instance);
Multistate_Output_Instance_To_Index(wp_data->
object_instance);
Multistate_Output_Out_Of_Service[object_index] =
value.type.Boolean;
}
+7 -7
View File
@@ -731,9 +731,9 @@ bool Trend_Log_Write_Property(
if (wp_data->application_data_len != 0) {
iOffset += len;
len =
bacapp_decode_context_data(&wp_data->application_data
[iOffset], wp_data->application_data_len, &value,
PROP_LOG_DEVICE_OBJECT_PROPERTY);
bacapp_decode_context_data(&wp_data->
application_data[iOffset], wp_data->application_data_len,
&value, PROP_LOG_DEVICE_OBJECT_PROPERTY);
if ((len == 0) || ((value.context_tag != 2) &&
(value.context_tag != 3))) {
/* Bad decode or wrong tag */
@@ -750,8 +750,8 @@ bool Trend_Log_Write_Property(
if (wp_data->application_data_len != 0) {
iOffset += len;
len =
bacapp_decode_context_data
(&wp_data->application_data[iOffset],
bacapp_decode_context_data(&wp_data->
application_data[iOffset],
wp_data->application_data_len, &value,
PROP_LOG_DEVICE_OBJECT_PROPERTY);
if ((len == 0) || (value.context_tag != 3)) {
@@ -1093,8 +1093,8 @@ int rr_trend_log_encode(
pRequest->ItemCount = 0; /* Start out with nothing */
/* Bail out now if nowt - should never happen for a Trend Log but ... */
if (LogInfo[Trend_Log_Instance_To_Index(pRequest->
object_instance)].ulRecordCount == 0)
if (LogInfo[Trend_Log_Instance_To_Index(pRequest->object_instance)].
ulRecordCount == 0)
return (0);
if ((pRequest->RequestType == RR_BY_POSITION) ||
+1 -1
View File
@@ -185,4 +185,4 @@ int main(
}
}
/* @} *//* End group ServerDemo */
/* @} *//* End group ServerDemo */