Added fixes for Alarms and Events. Thank you Sebastien!
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
typedef struct {
|
||||
uint32_t ackProcessIdentifier;
|
||||
BACNET_OBJECT_ID eventObjectIdentifier;
|
||||
BACNET_EVENT_TYPE eventTypeAcked;
|
||||
BACNET_EVENT_STATE eventStateAcked;
|
||||
BACNET_TIMESTAMP eventTimeStamp;
|
||||
BACNET_CHARACTER_STRING ackSource;
|
||||
BACNET_TIMESTAMP ackTimeStamp;
|
||||
|
||||
@@ -418,7 +418,8 @@ typedef enum {
|
||||
STATUS_DOWNLOAD_REQUIRED = 2,
|
||||
STATUS_DOWNLOAD_IN_PROGRESS = 3,
|
||||
STATUS_NON_OPERATIONAL = 4,
|
||||
MAX_DEVICE_STATUS = 5
|
||||
STATUS_BACKUP_IN_PROGRESS = 5,
|
||||
MAX_DEVICE_STATUS = 6
|
||||
} BACNET_DEVICE_STATUS;
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -88,7 +88,7 @@ int alarm_ack_encode_service_request(
|
||||
|
||||
len =
|
||||
encode_context_enumerated(&apdu[apdu_len], 2,
|
||||
data->eventTypeAcked);
|
||||
data->eventStateAcked);
|
||||
apdu_len += len;
|
||||
|
||||
len =
|
||||
@@ -144,7 +144,7 @@ int alarm_ack_decode_service_request(
|
||||
decode_context_enumerated(&apdu[len], 2, &enumValue))) {
|
||||
return -1;
|
||||
}
|
||||
data->eventTypeAcked = (BACNET_EVENT_TYPE) enumValue;
|
||||
data->eventStateAcked = (BACNET_EVENT_STATE)enumValue;
|
||||
len += section_len;
|
||||
|
||||
if (-1 == (section_len =
|
||||
@@ -199,7 +199,7 @@ void testAlarmAck(
|
||||
testAlarmAckIn.eventTimeStamp.value.time.min = 11;
|
||||
testAlarmAckIn.eventTimeStamp.value.time.sec = 12;
|
||||
testAlarmAckIn.eventTimeStamp.value.time.hundredths = 14;
|
||||
testAlarmAckIn.eventTypeAcked = EVENT_CHANGE_OF_LIFE_SAFETY;
|
||||
testAlarmAckIn.eventStateAcked = EVENT_STATE_OFFNORMAL;
|
||||
|
||||
memset(&testAlarmAckOut, 0, sizeof(testAlarmAckOut));
|
||||
|
||||
@@ -247,7 +247,7 @@ void testAlarmAck(
|
||||
testAlarmAckOut.eventTimeStamp.value.time.hundredths);
|
||||
|
||||
ct_test(pTest,
|
||||
testAlarmAckIn.eventTypeAcked == testAlarmAckOut.eventTypeAcked);
|
||||
testAlarmAckIn.eventStateAcked == testAlarmAckOut.eventStateAcked);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1867,6 +1867,8 @@ INDTEXT_DATA bacnet_device_status_names[] = {
|
||||
,
|
||||
{STATUS_NON_OPERATIONAL, "non-operational"}
|
||||
,
|
||||
{STATUS_BACKUP_IN_PROGRESS, "backup-in-progress"}
|
||||
,
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -557,10 +557,12 @@ int event_notify_decode_service_request(
|
||||
len += section_length;
|
||||
}
|
||||
break;
|
||||
case NOTIFY_ACK_NOTIFICATION:
|
||||
/* FIXME: handle this case */
|
||||
/* In cases other than alarm and event
|
||||
there's no data, so do not return an error
|
||||
but continue normally */
|
||||
case NOTIFY_ACK_NOTIFICATION:
|
||||
default:
|
||||
return -1;
|
||||
break;
|
||||
|
||||
}
|
||||
/* tag 11 - toState */
|
||||
@@ -854,10 +856,12 @@ int event_notify_decode_service_request(
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case NOTIFY_ACK_NOTIFICATION:
|
||||
/* FIXME: handle this case */
|
||||
/* In cases other than alarm and event
|
||||
there's no data, so do not return an error
|
||||
but continue normally */
|
||||
case NOTIFY_ACK_NOTIFICATION:
|
||||
default:
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ int getevent_ack_decode_service_request(
|
||||
decode_tag_number_and_value(&apdu[len], &tag_number,
|
||||
&len_value);
|
||||
len +=
|
||||
decode_enumerated(&apdu[apdu_len], len_value, &enum_value);
|
||||
decode_enumerated(&apdu[len], len_value, &enum_value);
|
||||
event_data->notifyType = enum_value;
|
||||
} else {
|
||||
return -1;
|
||||
@@ -308,7 +308,10 @@ int getevent_ack_decode_service_request(
|
||||
len +=
|
||||
decode_tag_number_and_value(&apdu[len], &tag_number,
|
||||
&len_value);
|
||||
*moreEvents = decode_boolean(len_value);
|
||||
if (len_value == 1)
|
||||
*moreEvents = decode_context_boolean(&apdu[len++]);
|
||||
else
|
||||
*moreEvents = false;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user