sampled values: fix encoding of optional smpMod attribute:

- The attribute must be encoded as an 16bit unsigned integer. The existing code encodes it as 32 bit integer.
- The attribute is encoded with the ASN.1 BER encoding Tag number 8. The existing code encodes it with tag number 4 which is used for the refrTm attribute.

See also: IEC 61850-9-2:2011 (page 20)
pull/32/head
Steffen Vogel 8 years ago
parent c291db5d95
commit 60c7d3a75f

@ -380,12 +380,8 @@ SV_ASDU_encodeToBuffer(SV_ASDU self, uint8_t* buffer, int bufPos)
/* SmpMod */
if (self->hasSmpMod) {
bufPos = BerEncoder_encodeTL(0x84, 4, buffer, bufPos);
buffer[bufPos++] = 0;
buffer[bufPos++] = 0;
buffer[bufPos++] = 0;
buffer[bufPos++] = self->smpMod;
bufPos = BerEncoder_encodeTL(0x88, 4, buffer, bufPos);
bufPos = encodeUint16FixedSize(self->smpMod, buffer, bufPos);
}
return bufPos;

Loading…
Cancel
Save