示例#1
0
                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);
                    }
                }
示例#2
0
 /// <summary>
 /// Read saved track data from the device
 /// </summary>
 /// <returns>True if successful, false if there was an error</returns>
 public bool readTrack()
 {
     byte[] byteIndex = BetterBitConverter.GetBytes(index);
     if (parent.traqpaq.sendCommand(USBcommand.USB_CMD_READ_SAVED_TRACKS, trackReadBuff, byteIndex[0], byteIndex[1]))
     {
         this.trackName = Encoding.ASCII.GetString(trackReadBuff, 0, Constants.TRACKLIST_NAME_STRLEN);
         this.Longitute = BetterBitConverter.ToInt32(trackReadBuff, Constants.TRACKLIST_LONGITUDE) / Constants.LATITUDE_LONGITUDE_COORD;
         this.Latitude  = BetterBitConverter.ToInt32(trackReadBuff, Constants.TRACKLIST_LATITUDE) / Constants.LATITUDE_LONGITUDE_COORD;
         this.Heading   = BetterBitConverter.ToUInt16(trackReadBuff, Constants.TRACKLIST_COURSE);
         this.isEmpty   = (trackReadBuff[Constants.TRACKLIST_ISEMPTY] == 0xFF); // true if empty
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#3
0
 public Position(byte[] readBuff)
 {
     latitude  = BetterBitConverter.ToInt32(readBuff, 0) / Constants.LATITUDE_LONGITUDE_COORD;
     longitude = BetterBitConverter.ToInt32(readBuff, 4) / Constants.LATITUDE_LONGITUDE_COORD;
     heading   = BetterBitConverter.ToInt16(readBuff, 8) / Constants.COURSE_FACTOR;
 }