sampled values: add support for sample rate attribute

pull/33/head
Steffen Vogel 8 years ago
parent c291db5d95
commit 628641cabb

@ -59,6 +59,7 @@ struct sSV_ASDU {
uint64_t refrTm;
uint8_t smpMod;
uint16_t smpRate;
uint8_t* smpCntBuf;
@ -369,7 +370,8 @@ SV_ASDU_encodeToBuffer(SV_ASDU self, uint8_t* buffer, int bufPos)
buffer[bufPos++] = self->smpSynch;
/* SmpRate */
//TODO implement me
bufPos = BerEncoder_encodeTL(0x86, 2, buffer, bufPos);
bufPos = encodeUInt16FixedSize(self->smpRate, buffer, bufPos);
/* Sample */
bufPos = BerEncoder_encodeTL(0x87, self->dataSize, buffer, bufPos);
@ -596,3 +598,9 @@ SV_ASDU_setSmpMod(SV_ASDU self, uint8_t smpMod)
self->smpMod = smpMod;
}
void
SV_ASDU_setSmpRate(SV_ASDU self, uint8_t smpRate)
{
self->hasSmpRate = true;
self->smpRate = smpRate;
}

@ -121,6 +121,18 @@ SV_ASDU_setRefrTm(SV_ASDU self, uint64_t refrTm);
void
SV_ASDU_setSmpMod(SV_ASDU self, uint8_t smpMod);
/**
* \brief Set the sample rate of the ASDU.
*
* If not set the transmitted ASDU will not contain an smpRate value.
*
* \param self the SV_ASDU
*
* \param smpRate Amount of samples (default per nominal period, see SmpMod).
*/
void
SV_ASDU_setSmpMod(SV_ASDU self, uint8_t smpMod);
#ifdef __cplusplus
}
#endif

Loading…
Cancel
Save