Notification Class had wrong array indexes when assigning priorities. Thank you, Dmitry Korobkov! Bug ID 3495994.
This commit is contained in:
@@ -95,9 +95,9 @@ void Notification_Class_Init(
|
|||||||
memset(&NC_Info[NotifyIdx], 0x00, sizeof(NOTIFICATION_CLASS_INFO));
|
memset(&NC_Info[NotifyIdx], 0x00, sizeof(NOTIFICATION_CLASS_INFO));
|
||||||
/* set the basic parameters */
|
/* set the basic parameters */
|
||||||
NC_Info[NotifyIdx].Ack_Required = 0;
|
NC_Info[NotifyIdx].Ack_Required = 0;
|
||||||
NC_Info[NotifyIdx].Priority[0] = 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[1] = 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[2] = 255; /* The lowest priority for Normal message. */
|
NC_Info[NotifyIdx].Priority[TRANSITION_TO_NORMAL] = 255; /* The lowest priority for Normal message. */
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -223,19 +223,16 @@ int Notification_Class_Read_Property(
|
|||||||
apdu_len += encode_application_unsigned(&apdu[0], 3);
|
apdu_len += encode_application_unsigned(&apdu[0], 3);
|
||||||
else {
|
else {
|
||||||
if (rpdata->array_index == BACNET_ARRAY_ALL) {
|
if (rpdata->array_index == BACNET_ARRAY_ALL) {
|
||||||
/* TO-OFFNORMAL */
|
|
||||||
apdu_len +=
|
apdu_len +=
|
||||||
encode_application_unsigned(&apdu[apdu_len],
|
encode_application_unsigned(&apdu[apdu_len],
|
||||||
CurrentNotify->Priority[0]);
|
CurrentNotify->Priority[TRANSITION_TO_OFFNORMAL]);
|
||||||
/* TO-FAULT */
|
|
||||||
apdu_len +=
|
apdu_len +=
|
||||||
encode_application_unsigned(&apdu[apdu_len],
|
encode_application_unsigned(&apdu[apdu_len],
|
||||||
CurrentNotify->Priority[1]);
|
CurrentNotify->Priority[TRANSITION_TO_FAULT]);
|
||||||
/* TO-NORMAL */
|
|
||||||
apdu_len +=
|
apdu_len +=
|
||||||
encode_application_unsigned(&apdu[apdu_len],
|
encode_application_unsigned(&apdu[apdu_len],
|
||||||
CurrentNotify->Priority[2]);
|
CurrentNotify->Priority[TRANSITION_TO_NORMAL]);
|
||||||
} else if (rpdata->array_index <= 3) {
|
} else if (rpdata->array_index <= MAX_BACNET_EVENT_TRANSITION) {
|
||||||
apdu_len +=
|
apdu_len +=
|
||||||
encode_application_unsigned(&apdu[apdu_len],
|
encode_application_unsigned(&apdu[apdu_len],
|
||||||
CurrentNotify->Priority[rpdata->array_index - 1]);
|
CurrentNotify->Priority[rpdata->array_index - 1]);
|
||||||
@@ -819,14 +816,14 @@ void Notification_Class_common_reporting_function(
|
|||||||
/* Priority and AckRequired */
|
/* Priority and AckRequired */
|
||||||
switch (event_data->toState) {
|
switch (event_data->toState) {
|
||||||
case EVENT_STATE_NORMAL:
|
case EVENT_STATE_NORMAL:
|
||||||
event_data->priority = CurrentNotify->Priority[EVENT_STATE_NORMAL];
|
event_data->priority = CurrentNotify->Priority[TRANSITION_TO_NORMAL];
|
||||||
event_data->ackRequired =
|
event_data->ackRequired =
|
||||||
(CurrentNotify->
|
(CurrentNotify->
|
||||||
Ack_Required & TRANSITION_TO_NORMAL_MASKED) ? true : false;
|
Ack_Required & TRANSITION_TO_NORMAL_MASKED) ? true : false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_STATE_FAULT:
|
case EVENT_STATE_FAULT:
|
||||||
event_data->priority = CurrentNotify->Priority[EVENT_STATE_FAULT];
|
event_data->priority = CurrentNotify->Priority[TRANSITION_TO_FAULT];
|
||||||
event_data->ackRequired =
|
event_data->ackRequired =
|
||||||
(CurrentNotify->
|
(CurrentNotify->
|
||||||
Ack_Required & TRANSITION_TO_FAULT_MASKED) ? true : false;
|
Ack_Required & TRANSITION_TO_FAULT_MASKED) ? true : false;
|
||||||
@@ -836,7 +833,7 @@ void Notification_Class_common_reporting_function(
|
|||||||
case EVENT_STATE_HIGH_LIMIT:
|
case EVENT_STATE_HIGH_LIMIT:
|
||||||
case EVENT_STATE_LOW_LIMIT:
|
case EVENT_STATE_LOW_LIMIT:
|
||||||
event_data->priority =
|
event_data->priority =
|
||||||
CurrentNotify->Priority[EVENT_STATE_OFFNORMAL];
|
CurrentNotify->Priority[TRANSITION_TO_OFFNORMAL];
|
||||||
event_data->ackRequired =
|
event_data->ackRequired =
|
||||||
(CurrentNotify->
|
(CurrentNotify->
|
||||||
Ack_Required & TRANSITION_TO_OFFNORMAL_MASKED) ? true : false;
|
Ack_Required & TRANSITION_TO_OFFNORMAL_MASKED) ? true : false;
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ BACnetRecipient ::= CHOICE {
|
|||||||
|
|
||||||
/* Structure containing configuration for a Notification Class */
|
/* Structure containing configuration for a Notification Class */
|
||||||
typedef struct Notification_Class_info {
|
typedef struct Notification_Class_info {
|
||||||
uint8_t Priority[3]; /* BACnetARRAY[3] of Unsigned */
|
uint8_t Priority[MAX_BACNET_EVENT_TRANSITION]; /* BACnetARRAY[3] of Unsigned */
|
||||||
uint8_t Ack_Required; /* BACnetEventTransitionBits */
|
uint8_t Ack_Required; /* BACnetEventTransitionBits */
|
||||||
BACNET_DESTINATION Recipient_List[NC_MAX_RECIPIENTS]; /* List of BACnetDestination */
|
BACNET_DESTINATION Recipient_List[NC_MAX_RECIPIENTS]; /* List of BACnetDestination */
|
||||||
} NOTIFICATION_CLASS_INFO;
|
} NOTIFICATION_CLASS_INFO;
|
||||||
|
|||||||
Reference in New Issue
Block a user