indented to standard from script
This commit is contained in:
@@ -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,
|
||||
@@ -504,7 +504,7 @@ bool Analog_Input_Write_Property(
|
||||
else
|
||||
return false;
|
||||
|
||||
switch ((int)wp_data->object_property) {
|
||||
switch ((int) wp_data->object_property) {
|
||||
case PROP_PRESENT_VALUE:
|
||||
status =
|
||||
WPValidateArgType(&value, BACNET_APPLICATION_TAG_REAL,
|
||||
@@ -909,17 +909,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 =
|
||||
@@ -939,24 +939,30 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -983,12 +989,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 */
|
||||
|
||||
@@ -1003,8 +1009,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);
|
||||
@@ -1022,14 +1028,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);
|
||||
@@ -1049,8 +1055,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];
|
||||
@@ -1063,22 +1069,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;
|
||||
@@ -1092,8 +1098,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;
|
||||
@@ -1115,8 +1121,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;
|
||||
@@ -1147,31 +1153,32 @@ int Analog_Input_Alarm_Summary(
|
||||
if (index < MAX_ANALOG_INPUTS) {
|
||||
/* Event_State is not equal to NORMAL and
|
||||
Notify_Type property value is ALARM */
|
||||
if((AI_Descr[index].Event_State != EVENT_STATE_NORMAL) &&
|
||||
(AI_Descr[index].Notify_Type == NOTIFY_ALARM)){
|
||||
if ((AI_Descr[index].Event_State != EVENT_STATE_NORMAL) &&
|
||||
(AI_Descr[index].Notify_Type == NOTIFY_ALARM)) {
|
||||
/* Object Identifier */
|
||||
getalarm_data->objectIdentifier.type = OBJECT_ANALOG_INPUT;
|
||||
getalarm_data->objectIdentifier.instance =
|
||||
Analog_Input_Index_To_Instance(index);
|
||||
Analog_Input_Index_To_Instance(index);
|
||||
/* Alarm State */
|
||||
getalarm_data->alarmState = AI_Descr[index].Event_State;
|
||||
/* Acknowledged Transitions */
|
||||
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
|
||||
return 0; /* no active alarm at this index */
|
||||
return 1; /* active alarm */
|
||||
} else
|
||||
return 0; /* no active alarm at this index */
|
||||
} else
|
||||
return -1; /* end of list */
|
||||
}
|
||||
|
||||
@@ -149,5 +149,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -447,11 +447,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;
|
||||
|
||||
@@ -100,5 +100,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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,
|
||||
@@ -1004,17 +1004,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 =
|
||||
@@ -1034,24 +1034,30 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -1078,12 +1084,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 */
|
||||
|
||||
@@ -1098,8 +1104,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);
|
||||
@@ -1117,14 +1123,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);
|
||||
@@ -1143,8 +1149,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];
|
||||
@@ -1157,22 +1163,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;
|
||||
@@ -1186,8 +1192,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;
|
||||
@@ -1209,8 +1215,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;
|
||||
@@ -1246,31 +1252,32 @@ int Analog_Value_Alarm_Summary(
|
||||
if (index < MAX_ANALOG_VALUES) {
|
||||
/* Event_State is not equal to NORMAL and
|
||||
Notify_Type property value is ALARM */
|
||||
if((AV_Descr[index].Event_State != EVENT_STATE_NORMAL) &&
|
||||
(AV_Descr[index].Notify_Type == NOTIFY_ALARM)){
|
||||
if ((AV_Descr[index].Event_State != EVENT_STATE_NORMAL) &&
|
||||
(AV_Descr[index].Notify_Type == NOTIFY_ALARM)) {
|
||||
/* Object Identifier */
|
||||
getalarm_data->objectIdentifier.type = OBJECT_ANALOG_VALUE;
|
||||
getalarm_data->objectIdentifier.instance =
|
||||
Analog_Value_Index_To_Instance(index);
|
||||
Analog_Value_Index_To_Instance(index);
|
||||
/* Alarm State */
|
||||
getalarm_data->alarmState = AV_Descr[index].Event_State;
|
||||
/* Acknowledged Transitions */
|
||||
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
|
||||
return 0; /* no active alarm at this index */
|
||||
return 1; /* active alarm */
|
||||
} else
|
||||
return 0; /* no active alarm at this index */
|
||||
} else
|
||||
return -1; /* end of list */
|
||||
}
|
||||
|
||||
@@ -116,8 +116,8 @@ extern "C" {
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
int Analog_Value_Alarm_Summary(
|
||||
unsigned index,
|
||||
BACNET_GET_ALARM_SUMMARY_DATA * getalarm_data);
|
||||
unsigned index,
|
||||
BACNET_GET_ALARM_SUMMARY_DATA * getalarm_data);
|
||||
#endif
|
||||
|
||||
void Analog_Value_Init(
|
||||
@@ -132,5 +132,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -474,7 +474,8 @@ bool bacfile_write_stream_data(
|
||||
}
|
||||
if (pFile) {
|
||||
if (data->type.stream.fileStartPosition != -1) {
|
||||
(void) fseek(pFile, data->type.stream.fileStartPosition, SEEK_SET);
|
||||
(void) fseek(pFile, data->type.stream.fileStartPosition,
|
||||
SEEK_SET);
|
||||
}
|
||||
if (fwrite(octetstring_value(&data->fileData),
|
||||
octetstring_length(&data->fileData), 1, pFile) != 1) {
|
||||
|
||||
@@ -98,5 +98,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -114,5 +114,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -376,8 +376,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
|
||||
@@ -403,8 +403,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--;
|
||||
|
||||
@@ -116,5 +116,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -359,8 +359,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
|
||||
@@ -386,8 +386,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--;
|
||||
|
||||
@@ -71,5 +71,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -152,9 +152,7 @@ bool CharacterString_Value_Present_Value(
|
||||
|
||||
index = CharacterString_Value_Instance_To_Index(object_instance);
|
||||
if (object_name && (index < MAX_CHARACTERSTRING_VALUES)) {
|
||||
status = characterstring_copy(
|
||||
object_name,
|
||||
&Present_Value[index]);
|
||||
status = characterstring_copy(object_name, &Present_Value[index]);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -169,9 +167,7 @@ bool CharacterString_Value_Present_Value_Set(
|
||||
|
||||
index = CharacterString_Value_Instance_To_Index(object_instance);
|
||||
if (index < MAX_CHARACTERSTRING_VALUES) {
|
||||
status = characterstring_copy(
|
||||
&Present_Value[index],
|
||||
object_name);
|
||||
status = characterstring_copy(&Present_Value[index], object_name);
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -361,7 +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;
|
||||
@@ -405,13 +402,12 @@ bool CharacterString_Value_Write_Property(
|
||||
case PROP_PRESENT_VALUE:
|
||||
status =
|
||||
WPValidateArgType(&value,
|
||||
BACNET_APPLICATION_TAG_CHARACTER_STRING,
|
||||
&wp_data->error_class, &wp_data->error_code);
|
||||
BACNET_APPLICATION_TAG_CHARACTER_STRING, &wp_data->error_class,
|
||||
&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;
|
||||
@@ -423,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;
|
||||
default:
|
||||
|
||||
@@ -92,5 +92,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -104,35 +104,35 @@ extern bool Routed_Device_Write_Property_Local(
|
||||
/* All included BACnet objects */
|
||||
static object_functions_t Object_Table[] = {
|
||||
{OBJECT_DEVICE,
|
||||
NULL /* Init - don't init Device or it will recourse! */,
|
||||
Device_Count,
|
||||
Device_Index_To_Instance,
|
||||
Device_Valid_Object_Instance_Number,
|
||||
Device_Object_Name,
|
||||
Device_Read_Property_Local,
|
||||
NULL /* Write_Property */,
|
||||
NULL /* Property_Lists */,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
NULL /* Init - don't init Device or it will recourse! */ ,
|
||||
Device_Count,
|
||||
Device_Index_To_Instance,
|
||||
Device_Valid_Object_Instance_Number,
|
||||
Device_Object_Name,
|
||||
Device_Read_Property_Local,
|
||||
NULL /* Write_Property */ ,
|
||||
NULL /* Property_Lists */ ,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
{MAX_BACNET_OBJECT_TYPE,
|
||||
NULL /* Init */,
|
||||
NULL /* Count */,
|
||||
NULL /* Index_To_Instance */,
|
||||
NULL /* Valid_Instance */,
|
||||
NULL /* Object_Name */,
|
||||
NULL /* Read_Property */,
|
||||
NULL /* Write_Property */,
|
||||
NULL /* Property_Lists */,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */}
|
||||
NULL /* Init */ ,
|
||||
NULL /* Count */ ,
|
||||
NULL /* Index_To_Instance */ ,
|
||||
NULL /* Valid_Instance */ ,
|
||||
NULL /* Object_Name */ ,
|
||||
NULL /* Read_Property */ ,
|
||||
NULL /* Write_Property */ ,
|
||||
NULL /* Property_Lists */ ,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ }
|
||||
};
|
||||
|
||||
/** Glue function to let the Device object, when called by a handler,
|
||||
@@ -906,6 +906,7 @@ bool Device_Write_Property(
|
||||
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
|
||||
return (status);
|
||||
}
|
||||
|
||||
/* Ditto for the local version; always returns false */
|
||||
bool Device_Write_Property_Local(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data)
|
||||
@@ -941,5 +942,3 @@ void Device_Init(
|
||||
pObject++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+225
-226
@@ -90,234 +90,234 @@ static object_functions_t *Object_Table;
|
||||
|
||||
static object_functions_t My_Object_Table[] = {
|
||||
{OBJECT_DEVICE,
|
||||
NULL /* Init - don't init Device or it will recourse! */,
|
||||
Device_Count,
|
||||
Device_Index_To_Instance,
|
||||
Device_Valid_Object_Instance_Number,
|
||||
Device_Object_Name,
|
||||
Device_Read_Property_Local,
|
||||
Device_Write_Property_Local,
|
||||
Device_Property_Lists,
|
||||
DeviceGetRRInfo,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
NULL /* Init - don't init Device or it will recourse! */ ,
|
||||
Device_Count,
|
||||
Device_Index_To_Instance,
|
||||
Device_Valid_Object_Instance_Number,
|
||||
Device_Object_Name,
|
||||
Device_Read_Property_Local,
|
||||
Device_Write_Property_Local,
|
||||
Device_Property_Lists,
|
||||
DeviceGetRRInfo,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
{OBJECT_ANALOG_INPUT,
|
||||
Analog_Input_Init,
|
||||
Analog_Input_Count,
|
||||
Analog_Input_Index_To_Instance,
|
||||
Analog_Input_Valid_Instance,
|
||||
Analog_Input_Object_Name,
|
||||
Analog_Input_Read_Property,
|
||||
Analog_Input_Write_Property,
|
||||
Analog_Input_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
Analog_Input_Init,
|
||||
Analog_Input_Count,
|
||||
Analog_Input_Index_To_Instance,
|
||||
Analog_Input_Valid_Instance,
|
||||
Analog_Input_Object_Name,
|
||||
Analog_Input_Read_Property,
|
||||
Analog_Input_Write_Property,
|
||||
Analog_Input_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
Analog_Input_Intrinsic_Reporting},
|
||||
{OBJECT_ANALOG_VALUE,
|
||||
Analog_Value_Init,
|
||||
Analog_Value_Count,
|
||||
Analog_Value_Index_To_Instance,
|
||||
Analog_Value_Valid_Instance,
|
||||
Analog_Value_Object_Name,
|
||||
Analog_Value_Read_Property,
|
||||
Analog_Value_Write_Property,
|
||||
Analog_Value_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
Analog_Value_Init,
|
||||
Analog_Value_Count,
|
||||
Analog_Value_Index_To_Instance,
|
||||
Analog_Value_Valid_Instance,
|
||||
Analog_Value_Object_Name,
|
||||
Analog_Value_Read_Property,
|
||||
Analog_Value_Write_Property,
|
||||
Analog_Value_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
Analog_Value_Intrinsic_Reporting},
|
||||
{OBJECT_BINARY_INPUT,
|
||||
Binary_Input_Init,
|
||||
Binary_Input_Count,
|
||||
Binary_Input_Index_To_Instance,
|
||||
Binary_Input_Valid_Instance,
|
||||
Binary_Input_Object_Name,
|
||||
Binary_Input_Read_Property,
|
||||
NULL /* Write Property */,
|
||||
Binary_Input_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
Binary_Input_Encode_Value_List,
|
||||
Binary_Input_Change_Of_Value,
|
||||
Binary_Input_Change_Of_Value_Clear,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
Binary_Input_Init,
|
||||
Binary_Input_Count,
|
||||
Binary_Input_Index_To_Instance,
|
||||
Binary_Input_Valid_Instance,
|
||||
Binary_Input_Object_Name,
|
||||
Binary_Input_Read_Property,
|
||||
NULL /* Write Property */ ,
|
||||
Binary_Input_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
Binary_Input_Encode_Value_List,
|
||||
Binary_Input_Change_Of_Value,
|
||||
Binary_Input_Change_Of_Value_Clear,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
{OBJECT_BINARY_VALUE,
|
||||
Binary_Value_Init,
|
||||
Binary_Value_Count,
|
||||
Binary_Value_Index_To_Instance,
|
||||
Binary_Value_Valid_Instance,
|
||||
Binary_Value_Object_Name,
|
||||
Binary_Value_Read_Property,
|
||||
Binary_Value_Write_Property,
|
||||
Binary_Value_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
Binary_Value_Init,
|
||||
Binary_Value_Count,
|
||||
Binary_Value_Index_To_Instance,
|
||||
Binary_Value_Valid_Instance,
|
||||
Binary_Value_Object_Name,
|
||||
Binary_Value_Read_Property,
|
||||
Binary_Value_Write_Property,
|
||||
Binary_Value_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
{OBJECT_CHARACTERSTRING_VALUE,
|
||||
CharacterString_Value_Init,
|
||||
CharacterString_Value_Count,
|
||||
CharacterString_Value_Index_To_Instance,
|
||||
CharacterString_Value_Valid_Instance,
|
||||
CharacterString_Value_Object_Name,
|
||||
CharacterString_Value_Read_Property,
|
||||
CharacterString_Value_Write_Property,
|
||||
CharacterString_Value_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
CharacterString_Value_Init,
|
||||
CharacterString_Value_Count,
|
||||
CharacterString_Value_Index_To_Instance,
|
||||
CharacterString_Value_Valid_Instance,
|
||||
CharacterString_Value_Object_Name,
|
||||
CharacterString_Value_Read_Property,
|
||||
CharacterString_Value_Write_Property,
|
||||
CharacterString_Value_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
{OBJECT_NOTIFICATION_CLASS,
|
||||
Notification_Class_Init,
|
||||
Notification_Class_Count,
|
||||
Notification_Class_Index_To_Instance,
|
||||
Notification_Class_Valid_Instance,
|
||||
Notification_Class_Object_Name,
|
||||
Notification_Class_Read_Property,
|
||||
Notification_Class_Write_Property,
|
||||
Notification_Class_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
Notification_Class_Init,
|
||||
Notification_Class_Count,
|
||||
Notification_Class_Index_To_Instance,
|
||||
Notification_Class_Valid_Instance,
|
||||
Notification_Class_Object_Name,
|
||||
Notification_Class_Read_Property,
|
||||
Notification_Class_Write_Property,
|
||||
Notification_Class_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#endif
|
||||
{OBJECT_LIFE_SAFETY_POINT,
|
||||
Life_Safety_Point_Init,
|
||||
Life_Safety_Point_Count,
|
||||
Life_Safety_Point_Index_To_Instance,
|
||||
Life_Safety_Point_Valid_Instance,
|
||||
Life_Safety_Point_Object_Name,
|
||||
Life_Safety_Point_Read_Property,
|
||||
Life_Safety_Point_Write_Property,
|
||||
Life_Safety_Point_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
Life_Safety_Point_Init,
|
||||
Life_Safety_Point_Count,
|
||||
Life_Safety_Point_Index_To_Instance,
|
||||
Life_Safety_Point_Valid_Instance,
|
||||
Life_Safety_Point_Object_Name,
|
||||
Life_Safety_Point_Read_Property,
|
||||
Life_Safety_Point_Write_Property,
|
||||
Life_Safety_Point_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
{OBJECT_LOAD_CONTROL,
|
||||
Load_Control_Init,
|
||||
Load_Control_Count,
|
||||
Load_Control_Index_To_Instance,
|
||||
Load_Control_Valid_Instance,
|
||||
Load_Control_Object_Name,
|
||||
Load_Control_Read_Property,
|
||||
Load_Control_Write_Property,
|
||||
Load_Control_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
Load_Control_Init,
|
||||
Load_Control_Count,
|
||||
Load_Control_Index_To_Instance,
|
||||
Load_Control_Valid_Instance,
|
||||
Load_Control_Object_Name,
|
||||
Load_Control_Read_Property,
|
||||
Load_Control_Write_Property,
|
||||
Load_Control_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
{OBJECT_MULTI_STATE_INPUT,
|
||||
Multistate_Input_Init,
|
||||
Multistate_Input_Count,
|
||||
Multistate_Input_Index_To_Instance,
|
||||
Multistate_Input_Valid_Instance,
|
||||
Multistate_Input_Object_Name,
|
||||
Multistate_Input_Read_Property,
|
||||
Multistate_Input_Write_Property,
|
||||
Multistate_Input_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
Multistate_Input_Init,
|
||||
Multistate_Input_Count,
|
||||
Multistate_Input_Index_To_Instance,
|
||||
Multistate_Input_Valid_Instance,
|
||||
Multistate_Input_Object_Name,
|
||||
Multistate_Input_Read_Property,
|
||||
Multistate_Input_Write_Property,
|
||||
Multistate_Input_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
{OBJECT_MULTI_STATE_OUTPUT,
|
||||
Multistate_Output_Init,
|
||||
Multistate_Output_Count,
|
||||
Multistate_Output_Index_To_Instance,
|
||||
Multistate_Output_Valid_Instance,
|
||||
Multistate_Output_Object_Name,
|
||||
Multistate_Output_Read_Property,
|
||||
Multistate_Output_Write_Property,
|
||||
Multistate_Output_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
Multistate_Output_Init,
|
||||
Multistate_Output_Count,
|
||||
Multistate_Output_Index_To_Instance,
|
||||
Multistate_Output_Valid_Instance,
|
||||
Multistate_Output_Object_Name,
|
||||
Multistate_Output_Read_Property,
|
||||
Multistate_Output_Write_Property,
|
||||
Multistate_Output_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
{OBJECT_MULTI_STATE_VALUE,
|
||||
Multistate_Value_Init,
|
||||
Multistate_Value_Count,
|
||||
Multistate_Value_Index_To_Instance,
|
||||
Multistate_Value_Valid_Instance,
|
||||
Multistate_Value_Object_Name,
|
||||
Multistate_Value_Read_Property,
|
||||
Multistate_Value_Write_Property,
|
||||
Multistate_Value_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
Multistate_Value_Init,
|
||||
Multistate_Value_Count,
|
||||
Multistate_Value_Index_To_Instance,
|
||||
Multistate_Value_Valid_Instance,
|
||||
Multistate_Value_Object_Name,
|
||||
Multistate_Value_Read_Property,
|
||||
Multistate_Value_Write_Property,
|
||||
Multistate_Value_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
{OBJECT_TRENDLOG,
|
||||
Trend_Log_Init,
|
||||
Trend_Log_Count,
|
||||
Trend_Log_Index_To_Instance,
|
||||
Trend_Log_Valid_Instance,
|
||||
Trend_Log_Object_Name,
|
||||
Trend_Log_Read_Property,
|
||||
Trend_Log_Write_Property,
|
||||
Trend_Log_Property_Lists,
|
||||
TrendLogGetRRInfo,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
Trend_Log_Init,
|
||||
Trend_Log_Count,
|
||||
Trend_Log_Index_To_Instance,
|
||||
Trend_Log_Valid_Instance,
|
||||
Trend_Log_Object_Name,
|
||||
Trend_Log_Read_Property,
|
||||
Trend_Log_Write_Property,
|
||||
Trend_Log_Property_Lists,
|
||||
TrendLogGetRRInfo,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#if defined(BACFILE)
|
||||
{OBJECT_FILE,
|
||||
bacfile_init,
|
||||
bacfile_count,
|
||||
bacfile_index_to_instance,
|
||||
bacfile_valid_instance,
|
||||
bacfile_object_name,
|
||||
bacfile_read_property,
|
||||
bacfile_write_property,
|
||||
BACfile_Property_Lists,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */},
|
||||
bacfile_init,
|
||||
bacfile_count,
|
||||
bacfile_index_to_instance,
|
||||
bacfile_valid_instance,
|
||||
bacfile_object_name,
|
||||
bacfile_read_property,
|
||||
bacfile_write_property,
|
||||
BACfile_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#endif
|
||||
{MAX_BACNET_OBJECT_TYPE,
|
||||
NULL /* Init */,
|
||||
NULL /* Count */,
|
||||
NULL /* Index_To_Instance */,
|
||||
NULL /* Valid_Instance */,
|
||||
NULL /* Object_Name */,
|
||||
NULL /* Read_Property */,
|
||||
NULL /* Write_Property */,
|
||||
NULL /* Property_Lists */,
|
||||
NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */,
|
||||
NULL /* Value_Lists */,
|
||||
NULL /* COV */,
|
||||
NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */}
|
||||
NULL /* Init */ ,
|
||||
NULL /* Count */ ,
|
||||
NULL /* Index_To_Instance */ ,
|
||||
NULL /* Valid_Instance */ ,
|
||||
NULL /* Object_Name */ ,
|
||||
NULL /* Read_Property */ ,
|
||||
NULL /* Write_Property */ ,
|
||||
NULL /* Property_Lists */ ,
|
||||
NULL /* ReadRangeInfo */ ,
|
||||
NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ ,
|
||||
NULL /* COV */ ,
|
||||
NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ }
|
||||
};
|
||||
|
||||
/** Glue function to let the Device object, when called by a handler,
|
||||
@@ -1419,8 +1419,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;
|
||||
@@ -1453,8 +1453,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:
|
||||
@@ -1500,8 +1500,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;
|
||||
@@ -1511,8 +1511,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;
|
||||
@@ -1521,8 +1521,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;
|
||||
@@ -1534,8 +1534,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;
|
||||
@@ -1639,8 +1639,8 @@ bool Device_Encode_Value_List(
|
||||
}
|
||||
|
||||
bool Device_COV(
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance)
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance)
|
||||
{
|
||||
bool status = false; /* Ever the pessamist! */
|
||||
struct object_functions *pObject = NULL;
|
||||
@@ -1650,8 +1650,7 @@ bool Device_COV(
|
||||
if (pObject->Object_Valid_Instance &&
|
||||
pObject->Object_Valid_Instance(object_instance)) {
|
||||
if (pObject->Object_COV) {
|
||||
status = pObject->Object_COV(
|
||||
object_instance);
|
||||
status = pObject->Object_COV(object_instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1660,8 +1659,8 @@ bool Device_COV(
|
||||
}
|
||||
|
||||
void Device_COV_Clear(
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance)
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance)
|
||||
{
|
||||
struct object_functions *pObject = NULL;
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ typedef bool(
|
||||
* @ingroup ObjHelpers
|
||||
* @param [in] The object instance number to be looked up.
|
||||
*/
|
||||
typedef void(
|
||||
typedef void (
|
||||
*object_cov_clear_function) (
|
||||
uint32_t object_instance);
|
||||
|
||||
@@ -282,7 +282,7 @@ extern "C" {
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
/* Copy a child object name, given its ID. */
|
||||
bool Device_Object_Name_Copy(
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
|
||||
@@ -378,7 +378,7 @@ extern "C" {
|
||||
|
||||
uint16_t Add_Routed_Device(
|
||||
uint32_t Object_Instance,
|
||||
BACNET_CHARACTER_STRING *Object_Name,
|
||||
BACNET_CHARACTER_STRING * Object_Name,
|
||||
const char *Description);
|
||||
DEVICE_OBJECT_DATA *Get_Routed_Device_Object(
|
||||
int idx);
|
||||
@@ -421,17 +421,16 @@ extern "C" {
|
||||
void Routed_Device_Inc_Database_Revision(
|
||||
void);
|
||||
int Routed_Device_Service_Approval(
|
||||
BACNET_CONFIRMED_SERVICE service,
|
||||
int service_argument,
|
||||
uint8_t *apdu_buff,
|
||||
uint8_t invoke_id );
|
||||
BACNET_CONFIRMED_SERVICE service,
|
||||
int service_argument,
|
||||
uint8_t * apdu_buff,
|
||||
uint8_t invoke_id);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** @defgroup ObjFrmwk Object Framework
|
||||
* The modules in this section describe the BACnet-stack's framework for
|
||||
* BACnet-defined Objects (Device, Analog Input, etc). There are two submodules
|
||||
@@ -441,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
|
||||
|
||||
@@ -116,7 +116,7 @@ uint16_t iCurrent_Device_Idx = 0;
|
||||
*/
|
||||
uint16_t Add_Routed_Device(
|
||||
uint32_t Object_Instance,
|
||||
BACNET_CHARACTER_STRING *sObject_Name,
|
||||
BACNET_CHARACTER_STRING * sObject_Name,
|
||||
const char *sDescription)
|
||||
{
|
||||
int i = Num_Managed_Devices;
|
||||
@@ -127,8 +127,8 @@ uint16_t Add_Routed_Device(
|
||||
pDev->bacObj.mObject_Type = OBJECT_DEVICE;
|
||||
pDev->bacObj.Object_Instance_Number = Object_Instance;
|
||||
if (sObject_Name != NULL)
|
||||
Routed_Device_Set_Object_Name(sObject_Name->encoding,
|
||||
sObject_Name->value, sObject_Name->length);
|
||||
Routed_Device_Set_Object_Name(sObject_Name->encoding,
|
||||
sObject_Name->value, sObject_Name->length);
|
||||
else
|
||||
Routed_Device_Set_Object_Name(CHARACTER_UTF8, "No Name",
|
||||
strlen("No Name"));
|
||||
@@ -402,12 +402,13 @@ bool Routed_Device_Valid_Object_Instance_Number(
|
||||
}
|
||||
|
||||
bool Routed_Device_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name)
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name)
|
||||
{
|
||||
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
|
||||
if (object_instance == pDev->bacObj.Object_Instance_Number) {
|
||||
return characterstring_init_ansi(object_name, pDev->bacObj.Object_Name);
|
||||
return characterstring_init_ansi(object_name,
|
||||
pDev->bacObj.Object_Name);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -485,8 +486,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;
|
||||
@@ -500,8 +501,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));
|
||||
}
|
||||
@@ -611,32 +612,33 @@ void Routed_Device_Inc_Database_Revision(
|
||||
* else 0 if service is approved for the current device.
|
||||
*/
|
||||
int Routed_Device_Service_Approval(
|
||||
BACNET_CONFIRMED_SERVICE service,
|
||||
int service_argument,
|
||||
uint8_t *apdu_buff,
|
||||
uint8_t invoke_id )
|
||||
BACNET_CONFIRMED_SERVICE service,
|
||||
int service_argument,
|
||||
uint8_t * apdu_buff,
|
||||
uint8_t invoke_id)
|
||||
{
|
||||
int len = 0;
|
||||
switch(service)
|
||||
{
|
||||
switch (service) {
|
||||
case SERVICE_CONFIRMED_REINITIALIZE_DEVICE:
|
||||
/* If not the gateway device, we don't support RD */
|
||||
if ( iCurrent_Device_Idx > 0 ) {
|
||||
if (iCurrent_Device_Idx > 0) {
|
||||
if (apdu_buff != NULL)
|
||||
len = reject_encode_apdu(apdu_buff,
|
||||
invoke_id, REJECT_REASON_UNRECOGNIZED_SERVICE);
|
||||
len =
|
||||
reject_encode_apdu(apdu_buff, invoke_id,
|
||||
REJECT_REASON_UNRECOGNIZED_SERVICE);
|
||||
else
|
||||
len = 1; /* Non-zero return */
|
||||
len = 1; /* Non-zero return */
|
||||
}
|
||||
break;
|
||||
case SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL:
|
||||
/* If not the gateway device, we don't support DCC */
|
||||
if ( iCurrent_Device_Idx > 0 ) {
|
||||
if (iCurrent_Device_Idx > 0) {
|
||||
if (apdu_buff != NULL)
|
||||
len = reject_encode_apdu(apdu_buff,
|
||||
invoke_id, REJECT_REASON_UNRECOGNIZED_SERVICE);
|
||||
len =
|
||||
reject_encode_apdu(apdu_buff, invoke_id,
|
||||
REJECT_REASON_UNRECOGNIZED_SERVICE);
|
||||
else
|
||||
len = 1; /* Non-zero return */
|
||||
len = 1; /* Non-zero return */
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -76,5 +76,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -469,8 +469,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]
|
||||
@@ -554,11 +554,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
|
||||
@@ -585,8 +585,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;
|
||||
}
|
||||
|
||||
@@ -332,8 +332,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 {
|
||||
@@ -349,8 +349,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;
|
||||
}
|
||||
|
||||
@@ -69,5 +69,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -436,8 +436,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 = 1; i <= MULTISTATE_NUMBER_OF_STATES; i++) {
|
||||
characterstring_init_ansi(&char_string,
|
||||
Multistate_Input_State_Text(rpdata->object_instance,
|
||||
@@ -458,8 +458,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,
|
||||
@@ -517,8 +517,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;
|
||||
|
||||
@@ -103,5 +103,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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)
|
||||
@@ -377,8 +377,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;
|
||||
@@ -405,8 +405,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--;
|
||||
@@ -432,8 +432,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;
|
||||
}
|
||||
|
||||
@@ -71,5 +71,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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,
|
||||
@@ -519,8 +519,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;
|
||||
|
||||
@@ -103,5 +103,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -95,9 +95,9 @@ void Notification_Class_Init(
|
||||
memset(&NC_Info[NotifyIdx], 0x00, sizeof(NOTIFICATION_CLASS_INFO));
|
||||
/* set the basic parameters */
|
||||
NC_Info[NotifyIdx].Ack_Required = 0;
|
||||
NC_Info[NotifyIdx].Priority[TRANSITION_TO_OFFNORMAL] = 255; /* The lowest priority for Normal message. */
|
||||
NC_Info[NotifyIdx].Priority[TRANSITION_TO_FAULT] = 255; /* The lowest priority for Normal message. */
|
||||
NC_Info[NotifyIdx].Priority[TRANSITION_TO_NORMAL] = 255; /* The lowest priority for Normal message. */
|
||||
NC_Info[NotifyIdx].Priority[TRANSITION_TO_OFFNORMAL] = 255; /* The lowest priority for Normal message. */
|
||||
NC_Info[NotifyIdx].Priority[TRANSITION_TO_FAULT] = 255; /* The lowest priority for Normal message. */
|
||||
NC_Info[NotifyIdx].Priority[TRANSITION_TO_NORMAL] = 255; /* The lowest priority for Normal message. */
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -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
|
||||
*/
|
||||
@@ -455,9 +455,8 @@ 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)) {
|
||||
@@ -480,9 +479,8 @@ 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 */
|
||||
@@ -496,9 +494,8 @@ 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 */
|
||||
@@ -517,9 +514,8 @@ 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) ||
|
||||
@@ -530,21 +526,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) ||
|
||||
@@ -561,8 +557,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) ||
|
||||
@@ -573,16 +569,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;
|
||||
@@ -590,8 +586,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 */
|
||||
@@ -608,9 +604,8 @@ 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)) {
|
||||
@@ -626,9 +621,8 @@ 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)) {
|
||||
@@ -644,9 +638,8 @@ 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)) {
|
||||
@@ -687,16 +680,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); */
|
||||
@@ -816,17 +809,19 @@ void Notification_Class_common_reporting_function(
|
||||
/* Priority and AckRequired */
|
||||
switch (event_data->toState) {
|
||||
case EVENT_STATE_NORMAL:
|
||||
event_data->priority = CurrentNotify->Priority[TRANSITION_TO_NORMAL];
|
||||
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->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:
|
||||
@@ -835,8 +830,8 @@ void Notification_Class_common_reporting_function(
|
||||
event_data->priority =
|
||||
CurrentNotify->Priority[TRANSITION_TO_OFFNORMAL];
|
||||
event_data->ackRequired =
|
||||
(CurrentNotify->
|
||||
Ack_Required & TRANSITION_TO_OFFNORMAL_MASKED) ? true : false;
|
||||
(CurrentNotify->Ack_Required & TRANSITION_TO_OFFNORMAL_MASKED)
|
||||
? true : false;
|
||||
break;
|
||||
|
||||
default: /* shouldn't happen */
|
||||
@@ -911,13 +906,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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ BACnetRecipient ::= CHOICE {
|
||||
|
||||
/* Structure containing configuration for a Notification Class */
|
||||
typedef struct Notification_Class_info {
|
||||
uint8_t Priority[MAX_BACNET_EVENT_TRANSITION]; /* BACnetARRAY[3] of Unsigned */
|
||||
uint8_t Priority[MAX_BACNET_EVENT_TRANSITION]; /* BACnetARRAY[3] of Unsigned */
|
||||
uint8_t Ack_Required; /* BACnetEventTransitionBits */
|
||||
BACNET_DESTINATION Recipient_List[NC_MAX_RECIPIENTS]; /* List of BACnetDestination */
|
||||
} NOTIFICATION_CLASS_INFO;
|
||||
@@ -138,5 +138,4 @@ BACnetRecipient ::= CHOICE {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* NC_H */
|
||||
|
||||
@@ -736,9 +736,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 */
|
||||
@@ -755,8 +755,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)) {
|
||||
@@ -1098,8 +1098,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) ||
|
||||
|
||||
@@ -197,5 +197,4 @@ extern "C" {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user