public static Message1007 Parse(string binStr) { StringSequence sequence = new StringSequence(); sequence.EnQuence(binStr); Message1007 msg = new Message1007(); msg.MessageNumber = BitConvertUtil.GetUInt(sequence.DeQueue(12)); //uint12 msg.ReferenceStationID = BitConvertUtil.GetUInt(sequence.DeQueue(12)); //uint12 msg.DescriptorCounterN = BitConvertUtil.GetUInt(sequence.DeQueue(8)); //uint8 StringBuilder sb = new StringBuilder(); for (int i = 0; i < (int)msg.DescriptorCounterN; i++) { var ch = BitConvertUtil.GetChar(sequence.DeQueue(8));//char8 sb.Append(ch); }//char8(N) msg.AntennaDescriptor = sb.ToString(); msg.AntennaSetupID = BitConvertUtil.GetUInt(sequence.DeQueue(8));//uint8 msg.Length = 40 + (int)msg.DescriptorCounterN * 8; return(msg); }
private static string GetString(StringSequence sequence, int count) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < count; i++) { var ch = BitConvertUtil.GetChar(sequence.DeQueue(8));//uint12 sb.Append(ch); } var str = sb.ToString(); return(str); }