private bool CheckIfTritiumDatagram(byte[] data) { string dataString = MyExtensions.ByteArrayToText(data); // Some tritium Can Bridges uses Tritiub rather that Tritium // The latest release seems to just use Tri return(dataString.Contains("Tri")); }
public void SetUint8(int index, uint newUInt) { if (index > 7) { throw new IndexOutOfRangeException("Max index for a setUInt8 operation is 7"); } int pos = 22 + index; RawBytes[pos] = MyExtensions.UInt8ToByte(newUInt); }
public uint GetUint8(int index) { if (index > 7) { throw new IndexOutOfRangeException("Max index for a setUInt8 operation is 7"); } int pos = 22 + index; return(MyExtensions.ByteToUInt8(RawBytes.Skip(pos).Take(1).ToArray())); }
public string GetByteString(int index) { if (index > 7) { throw new IndexOutOfRangeException("Max index for a GetByteString operation is 7"); } int pos = 22 + index; return(MyExtensions.ByteArrayToString(RawBytes.Skip(pos).Take(1).ToArray())); }
public void SetByteString(int index, string byteString) { if (byteString.Length == 1) { byteString = "0" + byteString; } else if (byteString.Length != 2) { throw new IndexOutOfRangeException("Byte" + index.ToString() + " must have a length of 2"); } if (index > 7) { throw new IndexOutOfRangeException("Max index for a SetByteString operation is 7"); } int pos = 22 + index; ReplaceRawBytes(MyExtensions.StringToByteArray(byteString), pos, 1); }