Dc analogs event detection enable Co-authored-by: Tomasz Kazimierz Motyl <tomasz.motyl@se.com> Co-authored-by: dcmaverick <150046088+dcmaverick@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
ab74620449
commit
35d49a14ee
@@ -44,6 +44,7 @@ static const int Properties_Optional[] = {
|
|||||||
PROP_TIME_DELAY, PROP_NOTIFICATION_CLASS, PROP_HIGH_LIMIT,
|
PROP_TIME_DELAY, PROP_NOTIFICATION_CLASS, PROP_HIGH_LIMIT,
|
||||||
PROP_LOW_LIMIT, PROP_DEADBAND, PROP_LIMIT_ENABLE, PROP_EVENT_ENABLE,
|
PROP_LOW_LIMIT, PROP_DEADBAND, PROP_LIMIT_ENABLE, PROP_EVENT_ENABLE,
|
||||||
PROP_ACKED_TRANSITIONS, PROP_NOTIFY_TYPE, PROP_EVENT_TIME_STAMPS,
|
PROP_ACKED_TRANSITIONS, PROP_NOTIFY_TYPE, PROP_EVENT_TIME_STAMPS,
|
||||||
|
PROP_EVENT_DETECTION_ENABLE,
|
||||||
#endif
|
#endif
|
||||||
-1
|
-1
|
||||||
};
|
};
|
||||||
@@ -303,10 +304,11 @@ const char *Analog_Input_Name_ASCII(uint32_t object_instance)
|
|||||||
unsigned Analog_Input_Event_State(uint32_t object_instance)
|
unsigned Analog_Input_Event_State(uint32_t object_instance)
|
||||||
{
|
{
|
||||||
unsigned state = EVENT_STATE_NORMAL;
|
unsigned state = EVENT_STATE_NORMAL;
|
||||||
#if defined(INTRINSIC_REPORTING)
|
#if !defined(INTRINSIC_REPORTING)
|
||||||
struct analog_input_descr *pObject;
|
struct analog_input_descr *pObject;
|
||||||
|
|
||||||
pObject = Analog_Input_Object(object_instance);
|
pObject = Analog_Input_Object(object_instance);
|
||||||
|
|
||||||
if (pObject) {
|
if (pObject) {
|
||||||
state = pObject->Event_State;
|
state = pObject->Event_State;
|
||||||
}
|
}
|
||||||
@@ -317,6 +319,52 @@ unsigned Analog_Input_Event_State(uint32_t object_instance)
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(INTRINSIC_REPORTING)
|
||||||
|
/**
|
||||||
|
* For a given object instance-number, gets the event-detection-enable property
|
||||||
|
* value
|
||||||
|
*
|
||||||
|
* @param object_instance - object-instance number of the object
|
||||||
|
*
|
||||||
|
* @return event-detection-enable property value
|
||||||
|
*/
|
||||||
|
bool Analog_Input_Event_Detection_Enable(uint32_t object_instance)
|
||||||
|
{
|
||||||
|
bool retval = false;
|
||||||
|
|
||||||
|
struct analog_input_descr *pObject = Analog_Input_Object(object_instance);
|
||||||
|
|
||||||
|
if (pObject) {
|
||||||
|
retval = pObject->Event_Detection_Enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For a given object instance-number, sets the event-detection-enable property
|
||||||
|
* value
|
||||||
|
*
|
||||||
|
* @param object_instance - object-instance number of the object
|
||||||
|
*
|
||||||
|
* @return event-detection-enable property value
|
||||||
|
*/
|
||||||
|
bool Analog_Input_Event_Detection_Enable_Set(
|
||||||
|
uint32_t object_instance, bool value)
|
||||||
|
{
|
||||||
|
bool retval = false;
|
||||||
|
|
||||||
|
struct analog_input_descr *pObject = Analog_Input_Object(object_instance);
|
||||||
|
|
||||||
|
if (pObject) {
|
||||||
|
pObject->Event_Detection_Enable = value;
|
||||||
|
retval = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief For a given object instance-number, returns the description
|
* @brief For a given object instance-number, returns the description
|
||||||
* @param object_instance - object-instance number of the object
|
* @param object_instance - object-instance number of the object
|
||||||
@@ -760,6 +808,10 @@ int Analog_Input_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
|||||||
: false);
|
: false);
|
||||||
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
|
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
|
||||||
break;
|
break;
|
||||||
|
case PROP_EVENT_DETECTION_ENABLE:
|
||||||
|
apdu_len = encode_application_boolean(
|
||||||
|
&apdu[0], pObject->Event_Detection_Enable);
|
||||||
|
break;
|
||||||
case PROP_ACKED_TRANSITIONS:
|
case PROP_ACKED_TRANSITIONS:
|
||||||
bitstring_init(&bit_string);
|
bitstring_init(&bit_string);
|
||||||
bitstring_set_bit(
|
bitstring_set_bit(
|
||||||
@@ -1014,6 +1066,12 @@ void Analog_Input_Intrinsic_Reporting(uint32_t object_instance)
|
|||||||
if (!CurrentAI) {
|
if (!CurrentAI) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check whether Intrinsic reporting is enabled */
|
||||||
|
if (!CurrentAI->Event_Detection_Enable) {
|
||||||
|
return; /* limits are not configured */
|
||||||
|
}
|
||||||
|
|
||||||
if (CurrentAI->Ack_notify_data.bSendAckNotify) {
|
if (CurrentAI->Ack_notify_data.bSendAckNotify) {
|
||||||
/* clean bSendAckNotify flag */
|
/* clean bSendAckNotify flag */
|
||||||
CurrentAI->Ack_notify_data.bSendAckNotify = false;
|
CurrentAI->Ack_notify_data.bSendAckNotify = false;
|
||||||
@@ -1601,6 +1659,8 @@ uint32_t Analog_Input_Create(uint32_t object_instance)
|
|||||||
pObject->Changed = false;
|
pObject->Changed = false;
|
||||||
pObject->Event_State = EVENT_STATE_NORMAL;
|
pObject->Event_State = EVENT_STATE_NORMAL;
|
||||||
#if defined(INTRINSIC_REPORTING)
|
#if defined(INTRINSIC_REPORTING)
|
||||||
|
pObject->Event_Detection_Enable = true;
|
||||||
|
pObject->Time_Delay = 0;
|
||||||
/* notification class not connected */
|
/* notification class not connected */
|
||||||
pObject->Notification_Class = BACNET_MAX_INSTANCE;
|
pObject->Notification_Class = BACNET_MAX_INSTANCE;
|
||||||
/* initialize Event time stamps using wildcards
|
/* initialize Event time stamps using wildcards
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ typedef struct analog_input_descr {
|
|||||||
float Deadband;
|
float Deadband;
|
||||||
unsigned Limit_Enable : 2;
|
unsigned Limit_Enable : 2;
|
||||||
unsigned Event_Enable : 3;
|
unsigned Event_Enable : 3;
|
||||||
|
unsigned Event_Detection_Enable : 1;
|
||||||
unsigned Notify_Type : 1;
|
unsigned Notify_Type : 1;
|
||||||
ACKED_INFO Acked_Transitions[MAX_BACNET_EVENT_TRANSITION];
|
ACKED_INFO Acked_Transitions[MAX_BACNET_EVENT_TRANSITION];
|
||||||
BACNET_DATE_TIME Event_Time_Stamps[MAX_BACNET_EVENT_TRANSITION];
|
BACNET_DATE_TIME Event_Time_Stamps[MAX_BACNET_EVENT_TRANSITION];
|
||||||
@@ -132,6 +133,65 @@ BACNET_STACK_EXPORT
|
|||||||
void Analog_Input_Intrinsic_Reporting(uint32_t object_instance);
|
void Analog_Input_Intrinsic_Reporting(uint32_t object_instance);
|
||||||
|
|
||||||
#if defined(INTRINSIC_REPORTING)
|
#if defined(INTRINSIC_REPORTING)
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
uint32_t Analog_Input_Time_Delay(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Input_Time_Delay_Set(uint32_t object_instance, uint32_t time_delay);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
uint32_t Analog_Input_Notification_Class(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Input_Notification_Class_Set(
|
||||||
|
uint32_t object_instance, uint32_t notification_class);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
float Analog_Input_High_Limit(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Input_High_Limit_Set(uint32_t object_instance, float high_limit);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
float Analog_Input_Low_Limit(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Input_Low_Limit_Set(uint32_t object_instance, float low_limit);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
float Analog_Input_Deadband(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Input_Deadband_Set(uint32_t object_instance, float deadband);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
BACNET_LIMIT_ENABLE Analog_Input_Limit_Enable(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Input_Limit_Enable_Set(
|
||||||
|
uint32_t object_instance, BACNET_LIMIT_ENABLE limit_enable);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
BACNET_EVENT_ENABLE Analog_Input_Event_Enable(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Input_Event_Detection_Enable(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Input_Event_Detection_Enable_Set(
|
||||||
|
uint32_t object_instance, bool value);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Input_Event_Enable_Set(
|
||||||
|
uint32_t object_instance, BACNET_EVENT_ENABLE event_enable);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
BACNET_NOTIFY_TYPE Analog_Input_Notify_Type(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Input_Notify_Type_Set(
|
||||||
|
uint32_t object_instance, BACNET_NOTIFY_TYPE notify_type);
|
||||||
|
|
||||||
BACNET_STACK_EXPORT
|
BACNET_STACK_EXPORT
|
||||||
int Analog_Input_Event_Information(
|
int Analog_Input_Event_Information(
|
||||||
unsigned index, BACNET_GET_EVENT_INFORMATION_DATA *getevent_data);
|
unsigned index, BACNET_GET_EVENT_INFORMATION_DATA *getevent_data);
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ static const int Analog_Value_Properties_Optional[] = {
|
|||||||
PROP_TIME_DELAY, PROP_NOTIFICATION_CLASS, PROP_HIGH_LIMIT,
|
PROP_TIME_DELAY, PROP_NOTIFICATION_CLASS, PROP_HIGH_LIMIT,
|
||||||
PROP_LOW_LIMIT, PROP_DEADBAND, PROP_LIMIT_ENABLE, PROP_EVENT_ENABLE,
|
PROP_LOW_LIMIT, PROP_DEADBAND, PROP_LIMIT_ENABLE, PROP_EVENT_ENABLE,
|
||||||
PROP_ACKED_TRANSITIONS, PROP_NOTIFY_TYPE, PROP_EVENT_TIME_STAMPS,
|
PROP_ACKED_TRANSITIONS, PROP_NOTIFY_TYPE, PROP_EVENT_TIME_STAMPS,
|
||||||
|
PROP_EVENT_DETECTION_ENABLE,
|
||||||
#endif
|
#endif
|
||||||
-1
|
-1
|
||||||
};
|
};
|
||||||
@@ -325,6 +326,57 @@ unsigned Analog_Value_Event_State(uint32_t object_instance)
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For a given object instance-number, gets the event-detection-enable property
|
||||||
|
* value
|
||||||
|
*
|
||||||
|
* @param object_instance - object-instance number of the object
|
||||||
|
*
|
||||||
|
* @return event-detection-enable property value
|
||||||
|
*/
|
||||||
|
bool Analog_Value_Event_Detection_Enable(uint32_t object_instance)
|
||||||
|
{
|
||||||
|
bool retval = false;
|
||||||
|
#if !defined(INTRINSIC_REPORTING)
|
||||||
|
(void)object_instance;
|
||||||
|
#else
|
||||||
|
struct analog_value_descr *pObject = Analog_Value_Object(object_instance);
|
||||||
|
|
||||||
|
if (pObject) {
|
||||||
|
retval = pObject->Event_Detection_Enable;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For a given object instance-number, sets the event-detection-enable property
|
||||||
|
* value
|
||||||
|
*
|
||||||
|
* @param object_instance - object-instance number of the object
|
||||||
|
*
|
||||||
|
* @return event-detection-enable property value
|
||||||
|
*/
|
||||||
|
bool Analog_Value_Event_Detection_Enable_Set(
|
||||||
|
uint32_t object_instance, bool value)
|
||||||
|
{
|
||||||
|
bool retval = false;
|
||||||
|
#if !defined(INTRINSIC_REPORTING)
|
||||||
|
(void)object_instance;
|
||||||
|
(void)value;
|
||||||
|
#else
|
||||||
|
struct analog_value_descr *pObject = Analog_Value_Object(object_instance);
|
||||||
|
|
||||||
|
if (pObject) {
|
||||||
|
pObject->Event_Detection_Enable = value;
|
||||||
|
retval = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief For a given object instance-number, returns the description
|
* @brief For a given object instance-number, returns the description
|
||||||
* @param object_instance - object-instance number of the object
|
* @param object_instance - object-instance number of the object
|
||||||
@@ -778,6 +830,10 @@ int Analog_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
|||||||
: false);
|
: false);
|
||||||
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
|
apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
|
||||||
break;
|
break;
|
||||||
|
case PROP_EVENT_DETECTION_ENABLE:
|
||||||
|
apdu_len = encode_application_boolean(
|
||||||
|
&apdu[0], CurrentAV->Event_Detection_Enable);
|
||||||
|
break;
|
||||||
case PROP_ACKED_TRANSITIONS:
|
case PROP_ACKED_TRANSITIONS:
|
||||||
bitstring_init(&bit_string);
|
bitstring_init(&bit_string);
|
||||||
bitstring_set_bit(
|
bitstring_set_bit(
|
||||||
@@ -1049,6 +1105,12 @@ void Analog_Value_Intrinsic_Reporting(uint32_t object_instance)
|
|||||||
if (!CurrentAV) {
|
if (!CurrentAV) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check whether Intrinsic reporting is enabled */
|
||||||
|
if (!CurrentAV->Event_Detection_Enable) {
|
||||||
|
return; /* limits are not configured */
|
||||||
|
}
|
||||||
|
|
||||||
if (CurrentAV->Ack_notify_data.bSendAckNotify) {
|
if (CurrentAV->Ack_notify_data.bSendAckNotify) {
|
||||||
/* clean bSendAckNotify flag */
|
/* clean bSendAckNotify flag */
|
||||||
CurrentAV->Ack_notify_data.bSendAckNotify = false;
|
CurrentAV->Ack_notify_data.bSendAckNotify = false;
|
||||||
@@ -1655,6 +1717,7 @@ uint32_t Analog_Value_Create(uint32_t object_instance)
|
|||||||
pObject->Changed = false;
|
pObject->Changed = false;
|
||||||
pObject->Event_State = EVENT_STATE_NORMAL;
|
pObject->Event_State = EVENT_STATE_NORMAL;
|
||||||
#if defined(INTRINSIC_REPORTING)
|
#if defined(INTRINSIC_REPORTING)
|
||||||
|
pObject->Event_Detection_Enable = true;
|
||||||
/* notification class not connected */
|
/* notification class not connected */
|
||||||
pObject->Notification_Class = BACNET_MAX_INSTANCE;
|
pObject->Notification_Class = BACNET_MAX_INSTANCE;
|
||||||
/* initialize Event time stamps using wildcards
|
/* initialize Event time stamps using wildcards
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ typedef struct analog_value_descr {
|
|||||||
float Deadband;
|
float Deadband;
|
||||||
unsigned Limit_Enable : 2;
|
unsigned Limit_Enable : 2;
|
||||||
unsigned Event_Enable : 3;
|
unsigned Event_Enable : 3;
|
||||||
|
unsigned Event_Detection_Enable : 1;
|
||||||
unsigned Notify_Type : 1;
|
unsigned Notify_Type : 1;
|
||||||
ACKED_INFO Acked_Transitions[MAX_BACNET_EVENT_TRANSITION];
|
ACKED_INFO Acked_Transitions[MAX_BACNET_EVENT_TRANSITION];
|
||||||
BACNET_DATE_TIME Event_Time_Stamps[MAX_BACNET_EVENT_TRANSITION];
|
BACNET_DATE_TIME Event_Time_Stamps[MAX_BACNET_EVENT_TRANSITION];
|
||||||
@@ -133,6 +134,65 @@ BACNET_STACK_EXPORT
|
|||||||
void Analog_Value_Intrinsic_Reporting(uint32_t object_instance);
|
void Analog_Value_Intrinsic_Reporting(uint32_t object_instance);
|
||||||
|
|
||||||
#if defined(INTRINSIC_REPORTING)
|
#if defined(INTRINSIC_REPORTING)
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
uint32_t Analog_Value_Time_Delay(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Value_Time_Delay_Set(uint32_t object_instance, uint32_t time_delay);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
uint32_t Analog_Value_Notification_Class(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Value_Notification_Class_Set(
|
||||||
|
uint32_t object_instance, uint32_t notification_class);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
float Analog_Value_High_Limit(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Value_High_Limit_Set(uint32_t object_instance, float high_limit);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
float Analog_Value_Low_Limit(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Value_Low_Limit_Set(uint32_t object_instance, float low_limit);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
float Analog_Value_Deadband(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Value_Deadband_Set(uint32_t object_instance, float deadband);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
BACNET_LIMIT_ENABLE Analog_Value_Limit_Enable(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Value_Limit_Enable_Set(
|
||||||
|
uint32_t object_instance, BACNET_LIMIT_ENABLE limit_enable);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
BACNET_EVENT_ENABLE Analog_Value_Event_Enable(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Value_Event_Enable_Set(
|
||||||
|
uint32_t object_instance, BACNET_EVENT_ENABLE event_enable);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Value_Event_Detection_Enable(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Value_Event_Detection_Enable_Set(
|
||||||
|
uint32_t object_instance, bool value);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
BACNET_NOTIFY_TYPE Analog_Value_Notify_Type(uint32_t object_instance);
|
||||||
|
|
||||||
|
BACNET_STACK_EXPORT
|
||||||
|
bool Analog_Value_Notify_Type_Set(
|
||||||
|
uint32_t object_instance, BACNET_NOTIFY_TYPE notify_type);
|
||||||
|
|
||||||
BACNET_STACK_EXPORT
|
BACNET_STACK_EXPORT
|
||||||
int Analog_Value_Event_Information(
|
int Analog_Value_Event_Information(
|
||||||
unsigned index, BACNET_GET_EVENT_INFORMATION_DATA *getevent_data);
|
unsigned index, BACNET_GET_EVENT_INFORMATION_DATA *getevent_data);
|
||||||
|
|||||||
Reference in New Issue
Block a user