diff --git a/bacnet-stack/demo/object/ai.c b/bacnet-stack/demo/object/ai.c index 135da111..d9089150 100644 --- a/bacnet-stack/demo/object/ai.c +++ b/bacnet-stack/demo/object/ai.c @@ -895,10 +895,8 @@ int Analog_Input_Event_Information(unsigned index, bitstring_set_bit(&getevent_data->eventEnable, TRANSITION_TO_NORMAL, (AI_Descr[index].Event_Enable & EVENT_ENABLE_TO_NORMAL ) ? true : false ); /* Event Priorities */ - /* FIXME: finish it */ - getevent_data->eventPriorities[0] = 255; - getevent_data->eventPriorities[1] = 255; - getevent_data->eventPriorities[2] = 255; + Notification_Class_Get_Priorities(AI_Descr[index].Notification_Class, + getevent_data->eventPriorities); return 1; /* active event */ } diff --git a/bacnet-stack/demo/object/av.c b/bacnet-stack/demo/object/av.c index 71a7fe46..ba353904 100644 --- a/bacnet-stack/demo/object/av.c +++ b/bacnet-stack/demo/object/av.c @@ -1006,10 +1006,8 @@ int Analog_Value_Event_Information(unsigned index, bitstring_set_bit(&getevent_data->eventEnable, TRANSITION_TO_NORMAL, (AV_Descr[index].Event_Enable & EVENT_ENABLE_TO_NORMAL ) ? true : false ); /* Event Priorities */ - /* FIXME: finish it */ - getevent_data->eventPriorities[0] = 255; - getevent_data->eventPriorities[1] = 255; - getevent_data->eventPriorities[2] = 255; + Notification_Class_Get_Priorities(AV_Descr[index].Notification_Class, + getevent_data->eventPriorities); return 1; /* active event */ } diff --git a/bacnet-stack/demo/object/nc.c b/bacnet-stack/demo/object/nc.c index e6dcdfae..ab474349 100644 --- a/bacnet-stack/demo/object/nc.c +++ b/bacnet-stack/demo/object/nc.c @@ -684,6 +684,28 @@ bool Notification_Class_Write_Property( } +void Notification_Class_Get_Priorities( + uint32_t Object_Instance, uint32_t *pPriorityArray) +{ + NOTIFICATION_CLASS_INFO *CurrentNotify; + uint32_t object_index; + int i; + + object_index = Notification_Class_Instance_To_Index(Object_Instance); + + if (object_index < MAX_NOTIFICATION_CLASSES) + CurrentNotify = &NC_Info[object_index]; + else { + for(i = 0; i < 3; i++) + pPriorityArray[i] = 255; + return; /* unknown object */ + } + + for(i = 0; i < 3; i++) + pPriorityArray[i] = CurrentNotify->Priority[i]; +} + + static bool IsRecipientActive(BACNET_DESTINATION * pBacDest, uint8_t EventToState) { BACNET_DATE_TIME DateTime; diff --git a/bacnet-stack/demo/object/nc.h b/bacnet-stack/demo/object/nc.h index 6ad6f86b..b7c09746 100644 --- a/bacnet-stack/demo/object/nc.h +++ b/bacnet-stack/demo/object/nc.h @@ -102,7 +102,10 @@ typedef struct Notification_Class_info { BACNET_READ_PROPERTY_DATA * rpdata); bool Notification_Class_Write_Property( - BACNET_WRITE_PROPERTY_DATA * wp_data); + BACNET_WRITE_PROPERTY_DATA * wp_data); + + void Notification_Class_Get_Priorities( + uint32_t Object_Instance, uint32_t *pPriorityArray); void Notification_Class_common_reporting_function( BACNET_EVENT_NOTIFICATION_DATA * event_data);