diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a906329..a2b1d7db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ The git repositories are hosted at the following sites: ### Added +Added [feature#14] EventTimeStamp decoding from ReadPropertyMultiple app + ### Changed ### Fixed diff --git a/src/bacnet/bacapp.c b/src/bacnet/bacapp.c index c5eef123..adecab4e 100644 --- a/src/bacnet/bacapp.c +++ b/src/bacnet/bacapp.c @@ -896,6 +896,27 @@ BACNET_APPLICATION_TAG bacapp_context_tag_type( break; } break; + case PROP_EVENT_TIME_STAMPS: + /* BACnetTimeStamp ::= CHOICE { + time [0] Time, -- deprecated in version 1 revision 21 + sequence-number [1] Unsigned (0..65535), + datetime [2] BACnetDateTime + } + */ + switch (tag_number) { + case TIME_STAMP_TIME: + tag = BACNET_APPLICATION_TAG_TIMESTAMP; + break; + case TIME_STAMP_SEQUENCE: + tag = BACNET_APPLICATION_TAG_UNSIGNED_INT; + break; + case TIME_STAMP_DATETIME: + tag = BACNET_APPLICATION_TAG_DATETIME; + break; + default: + break; + } + break; default: break; } diff --git a/src/bacnet/timestamp.c b/src/bacnet/timestamp.c index 169e53f0..b6b528d3 100644 --- a/src/bacnet/timestamp.c +++ b/src/bacnet/timestamp.c @@ -105,7 +105,14 @@ void bacapp_timestamp_copy(BACNET_TIMESTAMP *dest, BACNET_TIMESTAMP *src) } } -/** Encode a time stamp. +/** + * @brief Encode a time stamp. + * + * BACnetTimeStamp ::= CHOICE { + * time [0] Time, -- deprecated in version 1 revision 21 + * sequence-number [1] Unsigned (0..65535), + * datetime [2] BACnetDateTime + * } * * @param apdu Pointer to the APDU buffer. * @param value Pointer to the variable that holds @@ -179,6 +186,13 @@ int bacapp_encode_context_timestamp( /** * @brief Decode a time stamp from the given buffer. + * + * BACnetTimeStamp ::= CHOICE { + * time [0] Time, -- deprecated in version 1 revision 21 + * sequence-number [1] Unsigned (0..65535), + * datetime [2] BACnetDateTime + * } + * * @param apdu Pointer to the APDU buffer. * @param apdu_size - the APDU buffer length * @param value Pointer to the variable that shall