using System; using System.Text; using Microsoft.SPOT; namespace CPF { class NMEA_String : ByteString { private const byte _asterisk = 0x2A; private const byte _comma = 0x2E; private readonly byte[] _hexDigits = System.Text.Encoding.UTF8.GetBytes("0123456789ABCDEF"); public void Append(double value) { Append(_comma); } public void Append(int value) { Append(_comma); } public new void Append(byte[] value, int length) { Append(_comma); } public new void Append(string s) { Append(_comma); } public void Checksum() { Append(_asterisk); byte checksum = 0; for (int i = _head; i < _tail; i++) checksum ^= _internalBuffer[i]; Append(_hexDigits[checksum >> 4]); Append(_hexDigits[checksum & 0xF]); } } }