indented using indent.sh script to get uniform looking code for release

This commit is contained in:
skarg
2013-03-13 22:17:13 +00:00
parent 2de46521b8
commit ba3242aafd
120 changed files with 3382 additions and 3299 deletions
+67 -73
View File
@@ -352,11 +352,11 @@ int Analog_Input_Read_Property(
case PROP_LIMIT_ENABLE:
bitstring_init(&bit_string);
bitstring_set_bit(&bit_string, 0,
(CurrentAI->Limit_Enable & EVENT_LOW_LIMIT_ENABLE) ? true :
false);
(CurrentAI->
Limit_Enable & EVENT_LOW_LIMIT_ENABLE) ? true : false);
bitstring_set_bit(&bit_string, 1,
(CurrentAI->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE) ? true :
false);
(CurrentAI->
Limit_Enable & EVENT_HIGH_LIMIT_ENABLE) ? true : false);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
@@ -364,14 +364,14 @@ int Analog_Input_Read_Property(
case PROP_EVENT_ENABLE:
bitstring_init(&bit_string);
bitstring_set_bit(&bit_string, TRANSITION_TO_OFFNORMAL,
(CurrentAI->Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ? true :
false);
(CurrentAI->
Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ? true : false);
bitstring_set_bit(&bit_string, TRANSITION_TO_FAULT,
(CurrentAI->Event_Enable & EVENT_ENABLE_TO_FAULT) ? true :
false);
(CurrentAI->
Event_Enable & EVENT_ENABLE_TO_FAULT) ? true : false);
bitstring_set_bit(&bit_string, TRANSITION_TO_NORMAL,
(CurrentAI->Event_Enable & EVENT_ENABLE_TO_NORMAL) ? true :
false);
(CurrentAI->
Event_Enable & EVENT_ENABLE_TO_NORMAL) ? true : false);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
@@ -379,8 +379,8 @@ int Analog_Input_Read_Property(
case PROP_ACKED_TRANSITIONS:
bitstring_init(&bit_string);
bitstring_set_bit(&bit_string, TRANSITION_TO_OFFNORMAL,
CurrentAI->
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked);
CurrentAI->Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked);
bitstring_set_bit(&bit_string, TRANSITION_TO_FAULT,
CurrentAI->Acked_Transitions[TRANSITION_TO_FAULT].bIsAcked);
bitstring_set_bit(&bit_string, TRANSITION_TO_NORMAL,
@@ -637,7 +637,7 @@ bool Analog_Input_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
switch ((BACNET_NOTIFY_TYPE)value.type.Enumerated) {
switch ((BACNET_NOTIFY_TYPE) value.type.Enumerated) {
case NOTIFY_EVENT:
CurrentAI->Notify_Type = 1;
break;
@@ -922,17 +922,17 @@ void Analog_Input_Intrinsic_Reporting(
event_data.notificationParams.outOfRange.exceedingValue =
PresentVal;
/* Status_Flags of the referenced object. */
bitstring_init(&event_data.notificationParams.
outOfRange.statusFlags);
bitstring_set_bit(&event_data.notificationParams.
outOfRange.statusFlags, STATUS_FLAG_IN_ALARM,
bitstring_init(&event_data.notificationParams.outOfRange.
statusFlags);
bitstring_set_bit(&event_data.notificationParams.outOfRange.
statusFlags, STATUS_FLAG_IN_ALARM,
CurrentAI->Event_State ? true : false);
bitstring_set_bit(&event_data.notificationParams.
outOfRange.statusFlags, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&event_data.notificationParams.
outOfRange.statusFlags, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&event_data.notificationParams.
outOfRange.statusFlags, STATUS_FLAG_OUT_OF_SERVICE,
bitstring_set_bit(&event_data.notificationParams.outOfRange.
statusFlags, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&event_data.notificationParams.outOfRange.
statusFlags, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&event_data.notificationParams.outOfRange.
statusFlags, STATUS_FLAG_OUT_OF_SERVICE,
CurrentAI->Out_Of_Service);
/* Deadband used for limit checking. */
event_data.notificationParams.outOfRange.deadband =
@@ -952,30 +952,24 @@ void Analog_Input_Intrinsic_Reporting(
case EVENT_STATE_OFFNORMAL:
case EVENT_STATE_HIGH_LIMIT:
case EVENT_STATE_LOW_LIMIT:
CurrentAI->
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked =
false;
CurrentAI->
Acked_Transitions[TRANSITION_TO_OFFNORMAL].Time_Stamp =
event_data.timeStamp.value.dateTime;
CurrentAI->Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked = false;
CurrentAI->Acked_Transitions[TRANSITION_TO_OFFNORMAL].
Time_Stamp = event_data.timeStamp.value.dateTime;
break;
case EVENT_STATE_FAULT:
CurrentAI->
Acked_Transitions[TRANSITION_TO_FAULT].bIsAcked =
false;
CurrentAI->
Acked_Transitions[TRANSITION_TO_FAULT].Time_Stamp =
event_data.timeStamp.value.dateTime;
CurrentAI->Acked_Transitions[TRANSITION_TO_FAULT].
bIsAcked = false;
CurrentAI->Acked_Transitions[TRANSITION_TO_FAULT].
Time_Stamp = event_data.timeStamp.value.dateTime;
break;
case EVENT_STATE_NORMAL:
CurrentAI->
Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked =
false;
CurrentAI->
Acked_Transitions[TRANSITION_TO_NORMAL].Time_Stamp =
event_data.timeStamp.value.dateTime;
CurrentAI->Acked_Transitions[TRANSITION_TO_NORMAL].
bIsAcked = false;
CurrentAI->Acked_Transitions[TRANSITION_TO_NORMAL].
Time_Stamp = event_data.timeStamp.value.dateTime;
break;
}
}
@@ -1002,12 +996,12 @@ int Analog_Input_Event_Information(
/* Acked_Transitions property, which has at least one of the bits
(TO-OFFNORMAL, TO-FAULT, TONORMAL) set to FALSE. */
IsNotAckedTransitions =
(AI_Descr[index].
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked ==
false) | (AI_Descr[index].
Acked_Transitions[TRANSITION_TO_FAULT].bIsAcked ==
false) | (AI_Descr[index].
Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked == false);
(AI_Descr[index].Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked ==
false) | (AI_Descr[index].Acked_Transitions[TRANSITION_TO_FAULT].
bIsAcked ==
false) | (AI_Descr[index].Acked_Transitions[TRANSITION_TO_NORMAL].
bIsAcked == false);
} else
return -1; /* end of list */
@@ -1022,8 +1016,8 @@ int Analog_Input_Event_Information(
bitstring_init(&getevent_data->acknowledgedTransitions);
bitstring_set_bit(&getevent_data->acknowledgedTransitions,
TRANSITION_TO_OFFNORMAL,
AI_Descr[index].
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked);
AI_Descr[index].Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked);
bitstring_set_bit(&getevent_data->acknowledgedTransitions,
TRANSITION_TO_FAULT,
AI_Descr[index].Acked_Transitions[TRANSITION_TO_FAULT].bIsAcked);
@@ -1041,14 +1035,14 @@ int Analog_Input_Event_Information(
/* Event Enable */
bitstring_init(&getevent_data->eventEnable);
bitstring_set_bit(&getevent_data->eventEnable, TRANSITION_TO_OFFNORMAL,
(AI_Descr[index].Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ? true :
false);
(AI_Descr[index].
Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ? true : false);
bitstring_set_bit(&getevent_data->eventEnable, TRANSITION_TO_FAULT,
(AI_Descr[index].Event_Enable & EVENT_ENABLE_TO_FAULT) ? true :
false);
(AI_Descr[index].
Event_Enable & EVENT_ENABLE_TO_FAULT) ? true : false);
bitstring_set_bit(&getevent_data->eventEnable, TRANSITION_TO_NORMAL,
(AI_Descr[index].Event_Enable & EVENT_ENABLE_TO_NORMAL) ? true :
false);
(AI_Descr[index].
Event_Enable & EVENT_ENABLE_TO_NORMAL) ? true : false);
/* Event Priorities */
Notification_Class_Get_Priorities(AI_Descr[index].Notification_Class,
getevent_data->eventPriorities);
@@ -1068,8 +1062,8 @@ int Analog_Input_Alarm_Ack(
object_index =
Analog_Input_Instance_To_Index(alarmack_data->
eventObjectIdentifier.instance);
Analog_Input_Instance_To_Index(alarmack_data->eventObjectIdentifier.
instance);
if (object_index < MAX_ANALOG_INPUTS)
CurrentAI = &AI_Descr[object_index];
@@ -1082,22 +1076,22 @@ int Analog_Input_Alarm_Ack(
case EVENT_STATE_OFFNORMAL:
case EVENT_STATE_HIGH_LIMIT:
case EVENT_STATE_LOW_LIMIT:
if (CurrentAI->
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked == false) {
if (CurrentAI->Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked == false) {
if (alarmack_data->eventTimeStamp.tag != TIME_STAMP_DATETIME) {
*error_code = ERROR_CODE_INVALID_TIME_STAMP;
return -1;
}
if (datetime_compare(&CurrentAI->Acked_Transitions
[TRANSITION_TO_OFFNORMAL].Time_Stamp,
if (datetime_compare(&CurrentAI->
Acked_Transitions[TRANSITION_TO_OFFNORMAL].Time_Stamp,
&alarmack_data->eventTimeStamp.value.dateTime) > 0) {
*error_code = ERROR_CODE_INVALID_TIME_STAMP;
return -1;
}
/* FIXME: Send ack notification */
CurrentAI->
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked = true;
CurrentAI->Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked = true;
} else {
*error_code = ERROR_CODE_INVALID_EVENT_STATE;
return -1;
@@ -1111,8 +1105,8 @@ int Analog_Input_Alarm_Ack(
*error_code = ERROR_CODE_INVALID_TIME_STAMP;
return -1;
}
if (datetime_compare(&CurrentAI->Acked_Transitions
[TRANSITION_TO_FAULT].Time_Stamp,
if (datetime_compare(&CurrentAI->
Acked_Transitions[TRANSITION_TO_FAULT].Time_Stamp,
&alarmack_data->eventTimeStamp.value.dateTime) > 0) {
*error_code = ERROR_CODE_INVALID_TIME_STAMP;
return -1;
@@ -1134,8 +1128,8 @@ int Analog_Input_Alarm_Ack(
*error_code = ERROR_CODE_INVALID_TIME_STAMP;
return -1;
}
if (datetime_compare(&CurrentAI->Acked_Transitions
[TRANSITION_TO_NORMAL].Time_Stamp,
if (datetime_compare(&CurrentAI->
Acked_Transitions[TRANSITION_TO_NORMAL].Time_Stamp,
&alarmack_data->eventTimeStamp.value.dateTime) > 0) {
*error_code = ERROR_CODE_INVALID_TIME_STAMP;
return -1;
@@ -1180,16 +1174,16 @@ int Analog_Input_Alarm_Summary(
bitstring_init(&getalarm_data->acknowledgedTransitions);
bitstring_set_bit(&getalarm_data->acknowledgedTransitions,
TRANSITION_TO_OFFNORMAL,
AI_Descr[index].
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked);
AI_Descr[index].Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked);
bitstring_set_bit(&getalarm_data->acknowledgedTransitions,
TRANSITION_TO_FAULT,
AI_Descr[index].Acked_Transitions[TRANSITION_TO_FAULT].
bIsAcked);
AI_Descr[index].
Acked_Transitions[TRANSITION_TO_FAULT].bIsAcked);
bitstring_set_bit(&getalarm_data->acknowledgedTransitions,
TRANSITION_TO_NORMAL,
AI_Descr[index].Acked_Transitions[TRANSITION_TO_NORMAL].
bIsAcked);
AI_Descr[index].
Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked);
return 1; /* active alarm */
} else
+4 -4
View File
@@ -451,11 +451,11 @@ bool Analog_Output_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
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;
+67 -73
View File
@@ -424,11 +424,11 @@ int Analog_Value_Read_Property(
case PROP_LIMIT_ENABLE:
bitstring_init(&bit_string);
bitstring_set_bit(&bit_string, 0,
(CurrentAV->Limit_Enable & EVENT_LOW_LIMIT_ENABLE) ? true :
false);
(CurrentAV->
Limit_Enable & EVENT_LOW_LIMIT_ENABLE) ? true : false);
bitstring_set_bit(&bit_string, 1,
(CurrentAV->Limit_Enable & EVENT_HIGH_LIMIT_ENABLE) ? true :
false);
(CurrentAV->
Limit_Enable & EVENT_HIGH_LIMIT_ENABLE) ? true : false);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
@@ -436,14 +436,14 @@ int Analog_Value_Read_Property(
case PROP_EVENT_ENABLE:
bitstring_init(&bit_string);
bitstring_set_bit(&bit_string, TRANSITION_TO_OFFNORMAL,
(CurrentAV->Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ? true :
false);
(CurrentAV->
Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ? true : false);
bitstring_set_bit(&bit_string, TRANSITION_TO_FAULT,
(CurrentAV->Event_Enable & EVENT_ENABLE_TO_FAULT) ? true :
false);
(CurrentAV->
Event_Enable & EVENT_ENABLE_TO_FAULT) ? true : false);
bitstring_set_bit(&bit_string, TRANSITION_TO_NORMAL,
(CurrentAV->Event_Enable & EVENT_ENABLE_TO_NORMAL) ? true :
false);
(CurrentAV->
Event_Enable & EVENT_ENABLE_TO_NORMAL) ? true : false);
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break;
@@ -451,8 +451,8 @@ int Analog_Value_Read_Property(
case PROP_ACKED_TRANSITIONS:
bitstring_init(&bit_string);
bitstring_set_bit(&bit_string, TRANSITION_TO_OFFNORMAL,
CurrentAV->
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked);
CurrentAV->Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked);
bitstring_set_bit(&bit_string, TRANSITION_TO_FAULT,
CurrentAV->Acked_Transitions[TRANSITION_TO_FAULT].bIsAcked);
bitstring_set_bit(&bit_string, TRANSITION_TO_NORMAL,
@@ -735,7 +735,7 @@ bool Analog_Value_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
switch ((BACNET_NOTIFY_TYPE)value.type.Enumerated) {
switch ((BACNET_NOTIFY_TYPE) value.type.Enumerated) {
case NOTIFY_EVENT:
CurrentAV->Notify_Type = 1;
break;
@@ -1017,17 +1017,17 @@ void Analog_Value_Intrinsic_Reporting(
event_data.notificationParams.outOfRange.exceedingValue =
PresentVal;
/* Status_Flags of the referenced object. */
bitstring_init(&event_data.notificationParams.
outOfRange.statusFlags);
bitstring_set_bit(&event_data.notificationParams.
outOfRange.statusFlags, STATUS_FLAG_IN_ALARM,
bitstring_init(&event_data.notificationParams.outOfRange.
statusFlags);
bitstring_set_bit(&event_data.notificationParams.outOfRange.
statusFlags, STATUS_FLAG_IN_ALARM,
CurrentAV->Event_State ? true : false);
bitstring_set_bit(&event_data.notificationParams.
outOfRange.statusFlags, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&event_data.notificationParams.
outOfRange.statusFlags, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&event_data.notificationParams.
outOfRange.statusFlags, STATUS_FLAG_OUT_OF_SERVICE,
bitstring_set_bit(&event_data.notificationParams.outOfRange.
statusFlags, STATUS_FLAG_FAULT, false);
bitstring_set_bit(&event_data.notificationParams.outOfRange.
statusFlags, STATUS_FLAG_OVERRIDDEN, false);
bitstring_set_bit(&event_data.notificationParams.outOfRange.
statusFlags, STATUS_FLAG_OUT_OF_SERVICE,
CurrentAV->Out_Of_Service);
/* Deadband used for limit checking. */
event_data.notificationParams.outOfRange.deadband =
@@ -1047,30 +1047,24 @@ void Analog_Value_Intrinsic_Reporting(
case EVENT_STATE_OFFNORMAL:
case EVENT_STATE_HIGH_LIMIT:
case EVENT_STATE_LOW_LIMIT:
CurrentAV->
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked =
false;
CurrentAV->
Acked_Transitions[TRANSITION_TO_OFFNORMAL].Time_Stamp =
event_data.timeStamp.value.dateTime;
CurrentAV->Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked = false;
CurrentAV->Acked_Transitions[TRANSITION_TO_OFFNORMAL].
Time_Stamp = event_data.timeStamp.value.dateTime;
break;
case EVENT_STATE_FAULT:
CurrentAV->
Acked_Transitions[TRANSITION_TO_FAULT].bIsAcked =
false;
CurrentAV->
Acked_Transitions[TRANSITION_TO_FAULT].Time_Stamp =
event_data.timeStamp.value.dateTime;
CurrentAV->Acked_Transitions[TRANSITION_TO_FAULT].
bIsAcked = false;
CurrentAV->Acked_Transitions[TRANSITION_TO_FAULT].
Time_Stamp = event_data.timeStamp.value.dateTime;
break;
case EVENT_STATE_NORMAL:
CurrentAV->
Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked =
false;
CurrentAV->
Acked_Transitions[TRANSITION_TO_NORMAL].Time_Stamp =
event_data.timeStamp.value.dateTime;
CurrentAV->Acked_Transitions[TRANSITION_TO_NORMAL].
bIsAcked = false;
CurrentAV->Acked_Transitions[TRANSITION_TO_NORMAL].
Time_Stamp = event_data.timeStamp.value.dateTime;
break;
}
}
@@ -1097,12 +1091,12 @@ int Analog_Value_Event_Information(
/* Acked_Transitions property, which has at least one of the bits
(TO-OFFNORMAL, TO-FAULT, TONORMAL) set to FALSE. */
IsNotAckedTransitions =
(AV_Descr[index].
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked ==
false) | (AV_Descr[index].
Acked_Transitions[TRANSITION_TO_FAULT].bIsAcked ==
false) | (AV_Descr[index].
Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked == false);
(AV_Descr[index].Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked ==
false) | (AV_Descr[index].Acked_Transitions[TRANSITION_TO_FAULT].
bIsAcked ==
false) | (AV_Descr[index].Acked_Transitions[TRANSITION_TO_NORMAL].
bIsAcked == false);
} else
return -1; /* end of list */
@@ -1117,8 +1111,8 @@ int Analog_Value_Event_Information(
bitstring_init(&getevent_data->acknowledgedTransitions);
bitstring_set_bit(&getevent_data->acknowledgedTransitions,
TRANSITION_TO_OFFNORMAL,
AV_Descr[index].
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked);
AV_Descr[index].Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked);
bitstring_set_bit(&getevent_data->acknowledgedTransitions,
TRANSITION_TO_FAULT,
AV_Descr[index].Acked_Transitions[TRANSITION_TO_FAULT].bIsAcked);
@@ -1136,14 +1130,14 @@ int Analog_Value_Event_Information(
/* Event Enable */
bitstring_init(&getevent_data->eventEnable);
bitstring_set_bit(&getevent_data->eventEnable, TRANSITION_TO_OFFNORMAL,
(AV_Descr[index].Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ? true :
false);
(AV_Descr[index].
Event_Enable & EVENT_ENABLE_TO_OFFNORMAL) ? true : false);
bitstring_set_bit(&getevent_data->eventEnable, TRANSITION_TO_FAULT,
(AV_Descr[index].Event_Enable & EVENT_ENABLE_TO_FAULT) ? true :
false);
(AV_Descr[index].
Event_Enable & EVENT_ENABLE_TO_FAULT) ? true : false);
bitstring_set_bit(&getevent_data->eventEnable, TRANSITION_TO_NORMAL,
(AV_Descr[index].Event_Enable & EVENT_ENABLE_TO_NORMAL) ? true :
false);
(AV_Descr[index].
Event_Enable & EVENT_ENABLE_TO_NORMAL) ? true : false);
/* Event Priorities */
Notification_Class_Get_Priorities(AV_Descr[index].Notification_Class,
getevent_data->eventPriorities);
@@ -1162,8 +1156,8 @@ int Analog_Value_Alarm_Ack(
object_index =
Analog_Value_Instance_To_Index(alarmack_data->
eventObjectIdentifier.instance);
Analog_Value_Instance_To_Index(alarmack_data->eventObjectIdentifier.
instance);
if (object_index < MAX_ANALOG_VALUES)
CurrentAV = &AV_Descr[object_index];
@@ -1176,22 +1170,22 @@ int Analog_Value_Alarm_Ack(
case EVENT_STATE_OFFNORMAL:
case EVENT_STATE_HIGH_LIMIT:
case EVENT_STATE_LOW_LIMIT:
if (CurrentAV->
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked == false) {
if (CurrentAV->Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked == false) {
if (alarmack_data->eventTimeStamp.tag != TIME_STAMP_DATETIME) {
*error_code = ERROR_CODE_INVALID_TIME_STAMP;
return -1;
}
if (datetime_compare(&CurrentAV->Acked_Transitions
[TRANSITION_TO_OFFNORMAL].Time_Stamp,
if (datetime_compare(&CurrentAV->
Acked_Transitions[TRANSITION_TO_OFFNORMAL].Time_Stamp,
&alarmack_data->eventTimeStamp.value.dateTime) > 0) {
*error_code = ERROR_CODE_INVALID_TIME_STAMP;
return -1;
}
/* Clean transitions flag. */
CurrentAV->
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked = true;
CurrentAV->Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked = true;
} else {
*error_code = ERROR_CODE_INVALID_EVENT_STATE;
return -1;
@@ -1205,8 +1199,8 @@ int Analog_Value_Alarm_Ack(
*error_code = ERROR_CODE_INVALID_TIME_STAMP;
return -1;
}
if (datetime_compare(&CurrentAV->Acked_Transitions
[TRANSITION_TO_NORMAL].Time_Stamp,
if (datetime_compare(&CurrentAV->
Acked_Transitions[TRANSITION_TO_NORMAL].Time_Stamp,
&alarmack_data->eventTimeStamp.value.dateTime) > 0) {
*error_code = ERROR_CODE_INVALID_TIME_STAMP;
return -1;
@@ -1228,8 +1222,8 @@ int Analog_Value_Alarm_Ack(
*error_code = ERROR_CODE_INVALID_TIME_STAMP;
return -1;
}
if (datetime_compare(&CurrentAV->Acked_Transitions
[TRANSITION_TO_FAULT].Time_Stamp,
if (datetime_compare(&CurrentAV->
Acked_Transitions[TRANSITION_TO_FAULT].Time_Stamp,
&alarmack_data->eventTimeStamp.value.dateTime) > 0) {
*error_code = ERROR_CODE_INVALID_TIME_STAMP;
return -1;
@@ -1277,16 +1271,16 @@ int Analog_Value_Alarm_Summary(
bitstring_init(&getalarm_data->acknowledgedTransitions);
bitstring_set_bit(&getalarm_data->acknowledgedTransitions,
TRANSITION_TO_OFFNORMAL,
AV_Descr[index].
Acked_Transitions[TRANSITION_TO_OFFNORMAL].bIsAcked);
AV_Descr[index].Acked_Transitions[TRANSITION_TO_OFFNORMAL].
bIsAcked);
bitstring_set_bit(&getalarm_data->acknowledgedTransitions,
TRANSITION_TO_FAULT,
AV_Descr[index].Acked_Transitions[TRANSITION_TO_FAULT].
bIsAcked);
AV_Descr[index].
Acked_Transitions[TRANSITION_TO_FAULT].bIsAcked);
bitstring_set_bit(&getalarm_data->acknowledgedTransitions,
TRANSITION_TO_NORMAL,
AV_Descr[index].Acked_Transitions[TRANSITION_TO_NORMAL].
bIsAcked);
AV_Descr[index].
Acked_Transitions[TRANSITION_TO_NORMAL].bIsAcked);
return 1; /* active alarm */
} else
+4 -4
View File
@@ -383,8 +383,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
@@ -410,8 +410,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--;
+4 -4
View File
@@ -366,8 +366,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
@@ -393,8 +393,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--;
+6 -6
View File
@@ -357,8 +357,8 @@ int CharacterString_Value_Read_Property(
break;
case PROP_OUT_OF_SERVICE:
object_index =
CharacterString_Value_Instance_To_Index(rpdata->
object_instance);
CharacterString_Value_Instance_To_Index
(rpdata->object_instance);
state = Out_Of_Service[object_index];
apdu_len = encode_application_boolean(&apdu[0], state);
break;
@@ -406,8 +406,8 @@ bool CharacterString_Value_Write_Property(
&wp_data->error_code);
if (status) {
status =
CharacterString_Value_Present_Value_Set(wp_data->
object_instance, &value.type.Character_String);
CharacterString_Value_Present_Value_Set
(wp_data->object_instance, &value.type.Character_String);
if (!status) {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
@@ -419,8 +419,8 @@ bool CharacterString_Value_Write_Property(
WPValidateArgType(&value, BACNET_APPLICATION_TAG_BOOLEAN,
&wp_data->error_class, &wp_data->error_code);
if (status) {
CharacterString_Value_Out_Of_Service_Set(wp_data->
object_instance, value.type.Boolean);
CharacterString_Value_Out_Of_Service_Set
(wp_data->object_instance, value.type.Boolean);
}
break;
case PROP_OBJECT_IDENTIFIER:
+15 -15
View File
@@ -1161,8 +1161,8 @@ int Device_Read_Property_Local(
{
int apdu_len = 0; /* return value */
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string = {0};
BACNET_CHARACTER_STRING char_string = {0};
BACNET_BIT_STRING bit_string = { 0 };
BACNET_CHARACTER_STRING char_string = { 0 };
unsigned i = 0;
int object_type = 0;
uint32_t instance = 0;
@@ -1454,8 +1454,8 @@ 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;
@@ -1488,8 +1488,8 @@ 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:
@@ -1519,7 +1519,7 @@ bool Device_Write_Property_Local(
if (status) {
/* All the object names in a device must be unique */
if (Device_Valid_Object_Name(&value.type.Character_String,
&object_type, &object_instance)) {
&object_type, &object_instance)) {
if ((object_type == wp_data->object_type) &&
(object_instance == wp_data->object_instance)) {
/* writing same name to same object */
@@ -1539,8 +1539,8 @@ 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;
@@ -1550,8 +1550,8 @@ 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;
@@ -1560,8 +1560,8 @@ 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;
@@ -1573,8 +1573,8 @@ 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;
+2 -6
View File
@@ -440,15 +440,11 @@ extern "C" {
* - The interface between the implemented Objects and the BAC-stack services,
* specifically the handlers, which are mediated through function calls to
* the Device object.
*/
/** @defgroup ObjHelpers Object Helper Functions
*//** @defgroup ObjHelpers Object Helper Functions
* @ingroup ObjFrmwk
* This section describes the function templates for the helper functions that
* provide common object support.
*/
/** @defgroup ObjIntf Handler-to-Object Interface Functions
*//** @defgroup ObjIntf Handler-to-Object Interface Functions
* @ingroup ObjFrmwk
* This section describes the fairly limited set of functions that link the
* BAC-stack handlers to the BACnet Object instances. All of these calls are
+4 -4
View File
@@ -492,8 +492,8 @@ bool Routed_Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code);
if (status) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Routed_Device_Set_Object_Instance_Number(value.
type.Object_Id.instance))) {
(Routed_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;
@@ -507,8 +507,8 @@ bool Routed_Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_NAME_LEN, false,
&wp_data->error_class, &wp_data->error_code);
if (status) {
Routed_Device_Set_Object_Name(characterstring_encoding
(&value.type.Character_String),
Routed_Device_Set_Object_Name(characterstring_encoding(&value.
type.Character_String),
characterstring_value(&value.type.Character_String),
characterstring_length(&value.type.Character_String));
}
+8 -8
View File
@@ -466,8 +466,8 @@ 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]
@@ -551,11 +551,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
@@ -582,8 +582,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
@@ -338,8 +338,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 {
@@ -355,8 +355,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;
}
+51 -55
View File
@@ -262,9 +262,9 @@ bool Multistate_Input_Description_Set(
static bool Multistate_Input_Description_Write(
uint32_t object_instance,
BACNET_CHARACTER_STRING *char_string,
BACNET_ERROR_CLASS *error_class,
BACNET_ERROR_CODE *error_code)
BACNET_CHARACTER_STRING * char_string,
BACNET_ERROR_CLASS * error_class,
BACNET_ERROR_CODE * error_code)
{
unsigned index = 0; /* offset from instance lookup */
size_t length = 0;
@@ -277,10 +277,9 @@ static bool Multistate_Input_Description_Write(
if (length <= sizeof(Object_Description[index])) {
encoding = characterstring_encoding(char_string);
if (encoding == CHARACTER_UTF8) {
status = characterstring_ansi_copy(
Object_Description[index],
sizeof(Object_Description[index]),
char_string);
status =
characterstring_ansi_copy(Object_Description[index],
sizeof(Object_Description[index]), char_string);
if (!status) {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
@@ -346,9 +345,9 @@ bool Multistate_Input_Name_Set(
static bool Multistate_Input_Object_Name_Write(
uint32_t object_instance,
BACNET_CHARACTER_STRING *char_string,
BACNET_ERROR_CLASS *error_class,
BACNET_ERROR_CODE *error_code)
BACNET_CHARACTER_STRING * char_string,
BACNET_ERROR_CLASS * error_class,
BACNET_ERROR_CODE * error_code)
{
unsigned index = 0; /* offset from instance lookup */
size_t length = 0;
@@ -361,10 +360,9 @@ static bool Multistate_Input_Object_Name_Write(
if (length <= sizeof(Object_Name[index])) {
encoding = characterstring_encoding(char_string);
if (encoding == CHARACTER_UTF8) {
status = characterstring_ansi_copy(
Object_Name[index],
sizeof(Object_Name[index]),
char_string);
status =
characterstring_ansi_copy(Object_Name[index],
sizeof(Object_Name[index]), char_string);
if (!status) {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
@@ -434,9 +432,9 @@ bool Multistate_Input_State_Text_Set(
static bool Multistate_Input_State_Text_Write(
uint32_t object_instance,
uint32_t state_index,
BACNET_CHARACTER_STRING *char_string,
BACNET_ERROR_CLASS *error_class,
BACNET_ERROR_CODE *error_code)
BACNET_CHARACTER_STRING * char_string,
BACNET_ERROR_CLASS * error_class,
BACNET_ERROR_CODE * error_code)
{
unsigned index = 0; /* offset from instance lookup */
size_t length = 0;
@@ -451,10 +449,9 @@ static bool Multistate_Input_State_Text_Write(
if (length <= sizeof(State_Text[index][state_index])) {
encoding = characterstring_encoding(char_string);
if (encoding == CHARACTER_UTF8) {
status = characterstring_ansi_copy(
State_Text[index][state_index],
sizeof(State_Text[index][state_index]),
char_string);
status =
characterstring_ansi_copy(State_Text[index][state_index],
sizeof(State_Text[index][state_index]), char_string);
if (!status) {
*error_class = ERROR_CLASS_PROPERTY;
*error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
@@ -562,7 +559,8 @@ int Multistate_Input_Read_Property(
} else if (rpdata->array_index == BACNET_ARRAY_ALL) {
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
max_states = Multistate_Input_Max_States(rpdata->object_instance);
max_states =
Multistate_Input_Max_States(rpdata->object_instance);
for (i = 1; i <= max_states; i++) {
characterstring_init_ansi(&char_string,
Multistate_Input_State_Text(rpdata->object_instance,
@@ -582,7 +580,8 @@ int Multistate_Input_Read_Property(
}
}
} else {
max_states = Multistate_Input_Max_States(rpdata->object_instance);
max_states =
Multistate_Input_Max_States(rpdata->object_instance);
if (rpdata->array_index <= max_states) {
characterstring_init_ansi(&char_string,
Multistate_Input_State_Text(rpdata->object_instance,
@@ -650,7 +649,7 @@ bool Multistate_Input_Write_Property(
if (value.tag == BACNET_APPLICATION_TAG_CHARACTER_STRING) {
/* All the object names in a device must be unique */
if (Device_Valid_Object_Name(&value.type.Character_String,
&object_type, &object_instance)) {
&object_type, &object_instance)) {
if ((object_type == wp_data->object_type) &&
(object_instance == wp_data->object_instance)) {
/* writing same name to same object */
@@ -661,11 +660,10 @@ bool Multistate_Input_Write_Property(
wp_data->error_code = ERROR_CODE_DUPLICATE_NAME;
}
} else {
status = Multistate_Input_Object_Name_Write(
wp_data->object_instance,
&value.type.Character_String,
&wp_data->error_class,
&wp_data->error_code);
status =
Multistate_Input_Object_Name_Write(wp_data->
object_instance, &value.type.Character_String,
&wp_data->error_class, &wp_data->error_code);
}
} else {
wp_data->error_class = ERROR_CLASS_PROPERTY;
@@ -674,11 +672,10 @@ bool Multistate_Input_Write_Property(
break;
case PROP_DESCRIPTION:
if (value.tag == BACNET_APPLICATION_TAG_CHARACTER_STRING) {
status = Multistate_Input_Description_Write(
wp_data->object_instance,
&value.type.Character_String,
&wp_data->error_class,
&wp_data->error_code);
status =
Multistate_Input_Description_Write(wp_data->
object_instance, &value.type.Character_String,
&wp_data->error_class, &wp_data->error_code);
} else {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_INVALID_DATA_TYPE;
@@ -690,8 +687,8 @@ bool Multistate_Input_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
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;
@@ -716,44 +713,43 @@ bool Multistate_Input_Write_Property(
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
} else if (wp_data->array_index == BACNET_ARRAY_ALL) {
max_states = Multistate_Input_Max_States(
wp_data->object_instance);
max_states =
Multistate_Input_Max_States(wp_data->object_instance);
array_index = 1;
element_len = len;
do {
if (element_len) {
status = Multistate_Input_State_Text_Write(
wp_data->object_instance,
array_index,
status =
Multistate_Input_State_Text_Write(wp_data->
object_instance, array_index,
&value.type.Character_String,
&wp_data->error_class,
&wp_data->error_code);
&wp_data->error_class, &wp_data->error_code);
}
max_states--;
array_index++;
if (max_states) {
element_len = bacapp_decode_application_data(
&wp_data->application_data[len],
wp_data->application_data_len-len,
&value);
element_len =
bacapp_decode_application_data(&wp_data->
application_data[len],
wp_data->application_data_len - len, &value);
if (element_len < 0) {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
wp_data->error_code =
ERROR_CODE_VALUE_OUT_OF_RANGE;
break;
}
len += element_len;
}
} while (max_states);
} else {
max_states = Multistate_Input_Max_States(
wp_data->object_instance);
max_states =
Multistate_Input_Max_States(wp_data->object_instance);
if (wp_data->array_index <= max_states) {
status = Multistate_Input_State_Text_Write(
wp_data->object_instance,
wp_data->array_index,
status =
Multistate_Input_State_Text_Write(wp_data->
object_instance, wp_data->array_index,
&value.type.Character_String,
&wp_data->error_class,
&wp_data->error_code);
&wp_data->error_class, &wp_data->error_code);
} else {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
+10 -10
View File
@@ -268,8 +268,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] ==
@@ -294,8 +294,8 @@ 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)
@@ -386,8 +386,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;
@@ -414,8 +414,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--;
@@ -441,8 +441,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;
}
+6 -6
View File
@@ -438,8 +438,8 @@ int Multistate_Value_Read_Property(
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
object_index =
Multistate_Value_Instance_To_Index(rpdata->
object_instance);
Multistate_Value_Instance_To_Index
(rpdata->object_instance);
for (i = 1; i <= MULTISTATE_NUMBER_OF_STATES; i++) {
characterstring_init_ansi(&char_string,
Multistate_Value_State_Text(rpdata->object_instance,
@@ -460,8 +460,8 @@ int Multistate_Value_Read_Property(
}
} else {
object_index =
Multistate_Value_Instance_To_Index(rpdata->
object_instance);
Multistate_Value_Instance_To_Index
(rpdata->object_instance);
if (rpdata->array_index <= MULTISTATE_NUMBER_OF_STATES) {
characterstring_init_ansi(&char_string,
Multistate_Value_State_Text(rpdata->object_instance,
@@ -528,8 +528,8 @@ bool Multistate_Value_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
status =
Multistate_Value_Present_Value_Set(wp_data->
object_instance, value.type.Unsigned_Int);
Multistate_Value_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;
+57 -50
View File
@@ -189,8 +189,8 @@ int Notification_Class_Read_Property(
apdu = rpdata->application_data;
CurrentNotify =
&NC_Info[Notification_Class_Instance_To_Index
(rpdata->object_instance)];
&NC_Info[Notification_Class_Instance_To_Index(rpdata->
object_instance)];
switch (rpdata->object_property) {
case PROP_OBJECT_IDENTIFIER:
@@ -400,8 +400,8 @@ bool Notification_Class_Write_Property(
CurrentNotify =
&NC_Info[Notification_Class_Instance_To_Index
(wp_data->object_instance)];
&NC_Info[Notification_Class_Instance_To_Index(wp_data->
object_instance)];
/* decode the some of the request
*/
@@ -467,8 +467,9 @@ bool Notification_Class_Write_Property(
while (iOffset < wp_data->application_data_len) {
/* Decode Valid Days */
len =
bacapp_decode_application_data(&wp_data->application_data
[iOffset], wp_data->application_data_len, &value);
bacapp_decode_application_data(&wp_data->
application_data[iOffset], wp_data->application_data_len,
&value);
if ((len == 0) ||
(value.tag != BACNET_APPLICATION_TAG_BIT_STRING)) {
@@ -491,8 +492,9 @@ bool Notification_Class_Write_Property(
iOffset += len;
/* Decode From Time */
len =
bacapp_decode_application_data(&wp_data->application_data
[iOffset], wp_data->application_data_len, &value);
bacapp_decode_application_data(&wp_data->
application_data[iOffset], wp_data->application_data_len,
&value);
if ((len == 0) || (value.tag != BACNET_APPLICATION_TAG_TIME)) {
/* Bad decode, wrong tag or following required parameter missing */
@@ -506,8 +508,9 @@ bool Notification_Class_Write_Property(
iOffset += len;
/* Decode To Time */
len =
bacapp_decode_application_data(&wp_data->application_data
[iOffset], wp_data->application_data_len, &value);
bacapp_decode_application_data(&wp_data->
application_data[iOffset], wp_data->application_data_len,
&value);
if ((len == 0) || (value.tag != BACNET_APPLICATION_TAG_TIME)) {
/* Bad decode, wrong tag or following required parameter missing */
@@ -526,8 +529,9 @@ bool Notification_Class_Write_Property(
RECIPIENT_TYPE_DEVICE;
/* Decode Network Number */
len =
bacapp_decode_context_data(&wp_data->application_data
[iOffset], wp_data->application_data_len, &value,
bacapp_decode_context_data(&wp_data->
application_data[iOffset],
wp_data->application_data_len, &value,
PROP_RECIPIENT_LIST);
if ((len == 0) ||
@@ -538,21 +542,21 @@ bool Notification_Class_Write_Property(
return false;
}
/* store value */
TmpNotify.Recipient_List[idx].Recipient.
_.DeviceIdentifier = value.type.Object_Id.instance;
TmpNotify.Recipient_List[idx].Recipient._.
DeviceIdentifier = value.type.Object_Id.instance;
iOffset += len;
}
/* opening tag [1] - Recipient */
else if (decode_is_opening_tag_number
(&wp_data->application_data[iOffset], 1)) {
else if (decode_is_opening_tag_number(&wp_data->
application_data[iOffset], 1)) {
iOffset++;
TmpNotify.Recipient_List[idx].Recipient.RecipientType =
RECIPIENT_TYPE_ADDRESS;
/* Decode Network Number */
len =
bacapp_decode_application_data
(&wp_data->application_data[iOffset],
bacapp_decode_application_data(&wp_data->
application_data[iOffset],
wp_data->application_data_len, &value);
if ((len == 0) ||
@@ -569,8 +573,8 @@ bool Notification_Class_Write_Property(
iOffset += len;
/* Decode Address */
len =
bacapp_decode_application_data
(&wp_data->application_data[iOffset],
bacapp_decode_application_data(&wp_data->
application_data[iOffset],
wp_data->application_data_len, &value);
if ((len == 0) ||
@@ -581,16 +585,16 @@ bool Notification_Class_Write_Property(
return false;
}
/* store value */
if (TmpNotify.Recipient_List[idx].Recipient._.
Address.net == 0) {
memcpy(TmpNotify.Recipient_List[idx].Recipient.
_.Address.mac, value.type.Octet_String.value,
if (TmpNotify.Recipient_List[idx].Recipient._.Address.
net == 0) {
memcpy(TmpNotify.Recipient_List[idx].Recipient._.
Address.mac, value.type.Octet_String.value,
value.type.Octet_String.length);
TmpNotify.Recipient_List[idx].Recipient._.
Address.mac_len = value.type.Octet_String.length;
TmpNotify.Recipient_List[idx].Recipient._.Address.
mac_len = value.type.Octet_String.length;
} else {
memcpy(TmpNotify.Recipient_List[idx].Recipient.
_.Address.adr, value.type.Octet_String.value,
memcpy(TmpNotify.Recipient_List[idx].Recipient._.
Address.adr, value.type.Octet_String.value,
value.type.Octet_String.length);
TmpNotify.Recipient_List[idx].Recipient._.Address.len =
value.type.Octet_String.length;
@@ -598,8 +602,8 @@ bool Notification_Class_Write_Property(
iOffset += len;
/* closing tag [1] - Recipient */
if (decode_is_closing_tag_number(&wp_data->application_data
[iOffset], 1))
if (decode_is_closing_tag_number(&wp_data->
application_data[iOffset], 1))
iOffset++;
else {
/* Bad decode, wrong tag or following required parameter missing */
@@ -616,8 +620,9 @@ bool Notification_Class_Write_Property(
/* Process Identifier */
len =
bacapp_decode_application_data(&wp_data->application_data
[iOffset], wp_data->application_data_len, &value);
bacapp_decode_application_data(&wp_data->
application_data[iOffset], wp_data->application_data_len,
&value);
if ((len == 0) ||
(value.tag != BACNET_APPLICATION_TAG_UNSIGNED_INT)) {
@@ -633,8 +638,9 @@ bool Notification_Class_Write_Property(
iOffset += len;
/* Issue Confirmed Notifications */
len =
bacapp_decode_application_data(&wp_data->application_data
[iOffset], wp_data->application_data_len, &value);
bacapp_decode_application_data(&wp_data->
application_data[iOffset], wp_data->application_data_len,
&value);
if ((len == 0) ||
(value.tag != BACNET_APPLICATION_TAG_BOOLEAN)) {
@@ -650,8 +656,9 @@ bool Notification_Class_Write_Property(
iOffset += len;
/* Transitions */
len =
bacapp_decode_application_data(&wp_data->application_data
[iOffset], wp_data->application_data_len, &value);
bacapp_decode_application_data(&wp_data->
application_data[iOffset], wp_data->application_data_len,
&value);
if ((len == 0) ||
(value.tag != BACNET_APPLICATION_TAG_BIT_STRING)) {
@@ -692,16 +699,16 @@ bool Notification_Class_Write_Property(
CurrentNotify->Recipient_List[idx] =
TmpNotify.Recipient_List[idx];
if (CurrentNotify->Recipient_List[idx].
Recipient.RecipientType == RECIPIENT_TYPE_DEVICE) {
if (CurrentNotify->Recipient_List[idx].Recipient.
RecipientType == RECIPIENT_TYPE_DEVICE) {
/* copy Device_ID */
DeviceID =
CurrentNotify->Recipient_List[idx].Recipient.
_.DeviceIdentifier;
CurrentNotify->Recipient_List[idx].Recipient._.
DeviceIdentifier;
address_bind_request(DeviceID, &max_apdu, &src);
} else if (CurrentNotify->Recipient_List[idx].
Recipient.RecipientType == RECIPIENT_TYPE_ADDRESS) {
} else if (CurrentNotify->Recipient_List[idx].Recipient.
RecipientType == RECIPIENT_TYPE_ADDRESS) {
/* copy Address */
/* src = CurrentNotify->Recipient_List[idx].Recipient._.Address; */
/* address_bind_request(BACNET_MAX_INSTANCE, &max_apdu, &src); */
@@ -824,16 +831,16 @@ void Notification_Class_common_reporting_function(
event_data->priority =
CurrentNotify->Priority[TRANSITION_TO_NORMAL];
event_data->ackRequired =
(CurrentNotify->Ack_Required & TRANSITION_TO_NORMAL_MASKED) ?
true : false;
(CurrentNotify->
Ack_Required & TRANSITION_TO_NORMAL_MASKED) ? true : false;
break;
case EVENT_STATE_FAULT:
event_data->priority =
CurrentNotify->Priority[TRANSITION_TO_FAULT];
event_data->ackRequired =
(CurrentNotify->Ack_Required & TRANSITION_TO_FAULT_MASKED) ?
true : false;
(CurrentNotify->
Ack_Required & TRANSITION_TO_FAULT_MASKED) ? true : false;
break;
case EVENT_STATE_OFFNORMAL:
@@ -918,13 +925,13 @@ void Notification_Class_find_recipient(
RECIPIENT_TYPE_DEVICE) {
/* Device ID */
DeviceID =
CurrentNotify->Recipient_List[idx].Recipient.
_.DeviceIdentifier;
CurrentNotify->Recipient_List[idx].Recipient._.
DeviceIdentifier;
/* Send who_ is request only when address of device is unknown. */
if (!address_bind_request(DeviceID, &max_apdu, &src))
Send_WhoIs(DeviceID, DeviceID);
} else if (CurrentNotify->Recipient_List[idx].
Recipient.RecipientType == RECIPIENT_TYPE_ADDRESS) {
} else if (CurrentNotify->Recipient_List[idx].Recipient.
RecipientType == RECIPIENT_TYPE_ADDRESS) {
}
}
+7 -7
View File
@@ -743,9 +743,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 */
@@ -762,8 +762,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)) {
@@ -1105,8 +1105,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) ||