using System; using Microsoft.SPOT; namespace CPF { public class NMEA_Integer { private bool _valid; private bool _updated; private long _lastCommitTime; private int _val; private int _newval; public NMEA_Integer() { _valid = false; _updated = false; _val = 0; _lastCommitTime = 0; } public bool IsValid() { return _valid; } public bool IsUpdated() { return _updated; } public long Age() { return _valid ? Utils.MillisecondsSinceLastReboot() - _lastCommitTime : Conversions.MAX_SIGNED; } public void Commit() { _val = _newval; _lastCommitTime = Utils.MillisecondsSinceLastReboot(); _valid = _updated = true; } public void Set(ByteString s) { _newval = (int) Conversions.ByteStringToInteger(s); } } }