Exemplo n.º 1
0
 protected override void VerifyAdditionalLengthInfo(byte length)
 {
     if (length != 0)
     {
         throw BufferFieldException.WrongValue("AdditionalInfoLength", 0, length);
     }
     _additionalInfoFields = new AdditionalInformationField[0];
 }
Exemplo n.º 2
0
 protected override void VerifyMessageCode(CemiMessageCode messageCode)
 {
     if (messageCode != CemiMessageCode.LDATA_REQ &&
         messageCode != CemiMessageCode.LDATA_CON &&
         messageCode != CemiMessageCode.LDATA_IND)
     {
         throw BufferFieldException.WrongValue("MessageCode", "LDATA*", messageCode.ToString());
     }
 }
Exemplo n.º 3
0
 private void SetInfo(byte[] data)
 {
     _infoLength = data[0];
     if (_infoLength != data.Length - 1)
     {
         throw BufferFieldException.WrongValue("AdditionalInfo - Data", data.Length - 1, _infoLength);
     }
     VerifyLength(_infoType, _infoLength);
     _information = new byte[_infoLength];
     Array.Copy(data, 1, _information, 0, _infoLength);
 }
Exemplo n.º 4
0
        private void ParseType(IndividualEndianessBinaryReader br)
        {
            var infotype = br.ReadByte();

            if (Enum.IsDefined(typeof(AdditionalInfoType), infotype))
            {
                _infoType = (AdditionalInfoType)infotype;
            }
            else
            {
                throw BufferFieldException.TypeUnknown("AdditionalInfoType", infotype);
            }
        }
Exemplo n.º 5
0
 private void VerifyLength(AdditionalInfoType type, int length)
 {
     if (type == AdditionalInfoType.RFFASTACK || type == AdditionalInfoType.MANUFACTURER)
     {
         // TODO: Add checking of correct length
         // requires some calcs
     }
     else
     {
         if (length != TypeSizes[type])
         {
             throw BufferFieldException.WrongValue($"AdditionalInfo ({type}) length", TypeSizes[type], length);
         }
     }
 }