diff --git a/src/sampled_values/sv_subscriber.c b/src/sampled_values/sv_subscriber.c index 838fb855..5dbe4283 100644 --- a/src/sampled_values/sv_subscriber.c +++ b/src/sampled_values/sv_subscriber.c @@ -878,6 +878,24 @@ SVSubscriber_ASDU_getDataSize(SVSubscriber_ASDU self) return self->dataBufferLength; } +uint16_t +SVSubscriber_ASDU_getSmpSynch(SVSubscriber_ASDU self) +{ + uint16_t retVal; + uint8_t* valBytes = (uint8_t*) &retVal; + +#if (ORDER_LITTLE_ENDIAN == 1) + valBytes[0] = self->smpSynch[1]; + valBytes[1] = self->smpSynch[0]; +#else + valBytes[0] = self->smpSynch[0]; + valBytes[1] = self->smpSynch[1]; +#endif + + return retVal; + +} + uint16_t SVClientASDU_getSmpCnt(SVSubscriber_ASDU self) { diff --git a/src/sampled_values/sv_subscriber.h b/src/sampled_values/sv_subscriber.h index 2388527e..1ff40d8e 100644 --- a/src/sampled_values/sv_subscriber.h +++ b/src/sampled_values/sv_subscriber.h @@ -528,6 +528,16 @@ SVSubscriber_ASDU_getQuality(SVSubscriber_ASDU self, int index); int SVSubscriber_ASDU_getDataSize(SVSubscriber_ASDU self); +/** + * \brief return the SmpSynch value included in the SV ASDU + * + * The SmpSynch gives information about the clock synchronization. + * + * \param self ASDU object instance + */ +uint16_t +SVSubscriber_ASDU_getSmpSynch(SVSubscriber_ASDU self); + #ifndef DEPRECATED #if defined(__GNUC__) || defined(__clang__) #define DEPRECATED __attribute__((deprecated))