public void DecodeMessage(byte[] message, ZigBeeDecoder.ZigBeeHeader header) { foreach (var decoderGroup in DecoderGroups) { if (!decoderGroup.Header.Equals(header)) { continue; } foreach (var decoderInfo in decoderGroup.DecoderInfoList) { DecodeValue(message, decoderInfo); } break; } }
private void UpdateDecodeInfo(ZigBeeDecoder.ZigBeeHeader header) { //something has changed, clear old data _decodeDataTable.Clear(); //No decode info is available, create defaults if (DecoderGroups.Count(x => x.Header == header) == 0) { SetDecodeDefaults(header.Len); } else { var dg = DecoderGroups.First(x => x.Header == header); //No decode info is available, create defaults if (dg.DecoderInfoList.Count == 0) { SetDecodeDefaults(header.Len); } else { foreach (var di in dg.DecoderInfoList) { var dr = _decodeDataTable.NewRow(); dr["Name"] = di.Name; dr["Start Bit"] = di.StartBit; dr["Bit Length"] = di.BitLength; dr["Start Byte"] = di.StartByte; dr["Byte Length"] = di.ByteLength; dr["Signed"] = di.Signed; dr["Factor"] = di.Factor; dr["Unit"] = di.Unit; dr["Notes"] = di.Notes; dr["Raw Data"] = ""; dr["Value"] = ""; _decodeDataTable.Rows.Add(dr); } } } }