def getGNGGA(): gngga = '' with pyxa1110.GPS(debug=True) as gps: for n in range(10): gps.receiveData() data = gps.ascii() if data.startswith("$GNGGA"): gngga = data return gngga
def getVersion(): with pyxa1110.GPS() as gps: #Send command, request version packet = gps.createMTKPacket(605, "") gps.sendData(packet) #Measaure time and check if data was present start_time = time.time() fetched = False elapsed_time = 0 while fetched is False and elapsed_time < 5: gps.receiveData() line = gps.ascii() if "PMTK" in line: print(line) fetched = True elapsed_time = time.time() - start_time
def setNMEAAll(): with pyxa1110.GPS() as gps: packet = gps.createMTKPacket(314, ",-1") gps.sendData(packet)
def setNMEAOnlyGAA(): with pyxa1110.GPS() as gps: packet = gps.createMTKPacket( 314, ",0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0") gps.sendData(packet)
def set10hz(): with pyxa1110.GPS() as gps: packet = gps.createMTKPacket(220, ",100") gps.sendData(packet)
import pyxa1110 #This code gets NMEA frames one by one with pyxa1110.GPS(debug=True) as gps: for n in range(10): gps.receiveData() print(gps.ascii())
def fetchData(): with pyxa1110.GPS() as gps: while runEvent.is_set(): gps.receiveData() framesQueue.put(gps.ascii())