Esempio n. 1
0
 internal void ProcessParameters(BaseHeader header, byte[] data)
 {
     if (header.Param == null || header.Param.Count == 0)
     {
         return;
     }
     foreach (var item in header.Param)
     {
         ParamValues.Add(ProcessParameter(data, ref IndexInData, item, null));
     }
 }
Esempio n. 2
0
 private void ProcessHeader(BaseHeader header)
 {
     if (header != null && !_isFound)
     {
         foreach (var item in header.Param)
         {
             if (item.Bits % 8 == 0)
             {
                 _bytesCount = (byte)(item.Bits / 8);
                 if (item.Size > 0)
                 {
                     _bytesCount = (byte)(_bytesCount * item.Size);
                 }
                 DataIndex.OffsetInData = 0x00;
                 DataIndex.MaskInData   = 0xFF;
                 DataIndex.IndexInData  = (byte)(DataIndex.IndexInData + _bytesCount);
                 if (item.Param1 != null && item.Param1.Count > 0)
                 {
                     foreach (var prm1 in item.Param1)
                     {
                         DataIndex.MaskInData = Tools.GetMaskFromBits(prm1.Bits, DataIndex.OffsetInData);
                         string[] tokens = ParamName.Split('.');
                         if (tokens.Length == 2)
                         {
                             if (tokens[0] == item.Name && tokens[1] == prm1.Name)
                             {
                                 _isFound = true;
                                 return;
                             }
                         }
                         DataIndex.OffsetInData += prm1.Bits;
                     }
                 }
             }
             if (item.Name == ParamName)
             {
                 _isFound = true;
                 return;
             }
         }
     }
 }
Esempio n. 3
0
 private void InitFrameDefinition()
 {
     _frameHeaderRules.Clear();
     FrequencyHeaders.Clear();
     foreach (var item in BaseHeader)
     {
         if (RadioFrequency != null)
         {
             foreach (var f in RadioFrequency)
             {
                 if (f.BaseHeader == item.Key)
                 {
                     FrequencyHeaders.Add(f.Code, item.Key);
                 }
             }
         }
         //foreach (var f in item.Frequencies)
         //{
         //    mFrequencyHeaders.Add(f, item.Key);
         //}
         _frameHeaderRules.Add(item.Key, new List <ValidationLeaf>());
         item.Initialize();
     }
     foreach (var item in Header)
     {
         if (item.Validation != null && item.Validation.Count > 0)
         {
             item.Initialize(BaseHeader.FirstOrDefault(x => x.Key == item.BaseHeaderKey));
             foreach (var val in item.Validation)
             {
                 val.Initialize(item);
             }
             InsertRules(item.Validation, item);
         }
     }
 }
Esempio n. 4
0
 internal void Initialize(BaseHeader baseHeader)
 {
     BaseHeaderDefinition = baseHeader;
     ProcessDataIndexes();
     FillDataIndexes();
 }