Added fixes for Alarms and Events. Thank you Sebastien!

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