public bool readRecordDataPage(int index) { ushort length = 256; if (parent.traqpaq.readRecordData(dataPage, length, (ushort)index)) { // extract the data from the dataPage byte array this.utc = BetterBitConverter.ToUInt32(dataPage, Constants.RECORD_DATA_UTC) / Constants.UTC_FACTOR; this.hdop = BetterBitConverter.ToUInt16(dataPage, Constants.RECORD_DATA_HDOP) / Constants.HDOP_FACTOR; this.GPSmode = dataPage[Constants.RECORD_DATA_MODE]; this.Satellites = dataPage[Constants.RECORD_DATA_SATELLITES]; // set the array of tRecordData structs this.RecordData = new tRecordData[Constants.RECORD_DATA_PER_PAGE]; for (int i = 0; i < Constants.RECORD_DATA_PER_PAGE; i++) { this.RecordData[i].Latitude = BetterBitConverter.ToInt32(dataPage, Constants.RECORD_DATA_LATITUDE + (i * Constants.RECORD_DATA_SIZE) + 16) / Constants.LATITUDE_LONGITUDE_COORD; this.RecordData[i].Longitude = BetterBitConverter.ToInt32(dataPage, Constants.RECORD_DATA_LONGITUDE + (i * Constants.RECORD_DATA_SIZE) + 16) / Constants.LATITUDE_LONGITUDE_COORD; this.RecordData[i].lapDetected = dataPage[Constants.RECORD_DATA_LAP_DETECTED + (i * Constants.RECORD_DATA_SIZE) + 16] == 0x01; // 0x00 means lap not detected. True if lap is detected this.RecordData[i].Altitude = BetterBitConverter.ToUInt16(dataPage, Constants.RECORD_DATA_ALTITUDE + (i * Constants.RECORD_DATA_SIZE) + 16) / Constants.ALTITUDE_FACTOR; this.RecordData[i].Speed = BetterBitConverter.ToUInt16(dataPage, Constants.RECORD_DATA_SPEED + (i * Constants.RECORD_DATA_SIZE) + 16) * Constants.SPEED_FACTOR; this.RecordData[i].Heading = BetterBitConverter.ToUInt16(dataPage, Constants.RECORD_DATA_COURSE + (i * Constants.RECORD_DATA_SIZE) + 16) / Constants.COURSE_FACTOR; } return(true); } else { return(false); } }
public bool readRecordTable(byte index) { if (parent.traqpaq.sendCommand(USBcommand.USB_CMD_READ_RECORDTABLE, readBuffer, (byte)Constants.RECORD_TABLE_SIZE, index)) { this.RecordEmpty = readBuffer[Constants.RECORD_EMPTY] == 0xFF; // true if empty this.TrackID = readBuffer[Constants.RECORD_TRACK_ID]; this.DateStamp = BetterBitConverter.ToUInt32(readBuffer, Constants.RECORD_DATESTAMP); this.StartAddress = BetterBitConverter.ToUInt32(readBuffer, Constants.RECORD_START_ADDRESS); this.EndAddress = BetterBitConverter.ToUInt32(readBuffer, Constants.RECORD_END_ADDRESS); this.StartPage = (StartAddress - Constants.ADDR_RECORD_DATA_START) / Constants.MEMORY_PAGE_SIZE; this.EndPage = (EndAddress - Constants.ADDR_RECORD_DATA_START) / Constants.MEMORY_PAGE_SIZE; return(true); } else { return(false); } }
/// <summary> /// Gets the GPS Serial Number /// </summary> /// <returns>The SN as an unsigned int, 0 if the command fails or if the SN is invalid</returns> public uint getGPS_SerialNo() { byte[] readBuff = new byte[5]; if (sendCommand(USBcommand.USB_DBG_GPS_INFO_SN, readBuff)) { // check if SN is valid if (readBuff[0] > 0) { return(BetterBitConverter.ToUInt32(readBuff, 1)); } else { return(0); } } else { return(0); } }