Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/protocols/gps/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/protocols/gps/nmea.pyc


[XMc@sdZddlZddlmZddlmZd\ZZZZ	d\Z
Zd\ZZ
ZdefdYZd
efdYZdejfdYZdS(sNMEA 0183 implementation

Maintainer: Bob Ippolito

The following NMEA 0183 sentences are currently understood::
    GPGGA (fix)
    GPGLL (position)
    GPRMC (position and time)
    GPGSA (active satellites)
 
The following NMEA 0183 sentences require implementation::
    None really, the others aren't generally useful or implemented in most devices anyhow

Other desired features::
    - A NMEA 0183 producer to emulate GPS devices (?)
iN(tbasic(treduceiiiitAtMtInvalidSentencecBseZRS((t__name__t
__module__(((s>/usr/lib/python2.7/dist-packages/twisted/protocols/gps/nmea.pyRstInvalidChecksumcBseZRS((RR(((s>/usr/lib/python2.7/dist-packages/twisted/protocols/gps/nmea.pyR!stNMEAReceivercBseZdZdZidd6dd6dd6dd	6d
d6dd
6dd6dd6dd6dd6dd6ZdZdZdZdZdZ	dZ
dZdZdZ
dZd ZRS(!s`This parses most common NMEA-0183 messages, presumably from a serial GPS device at 4800 bps
    s
tfixtGPGGAtpositiontGPGLLtactivesatellitestGPGSAtpositiontimetGPRMCtviewsatellitestGPGSVtcoursetGPVTGtalmanactGPALMtrangetGPGRStnoisetGPGSTtbeacontGPMSSttimetGPZDAiicCs|jds2|jrdStd|fn|djjd\}}|jd}|d|d}}|jj|d}|r|jrtd|fn|j	s
t
|dttj
tt|}}||kr
td	||fq
nt|d
|d}t|d|d}	|oH|oH|	sOdSy|	|}
Wn,tk
r}td|||fnX||
S(
Nt$s%r does not begin with $it*t,issentencetype %risGiven 0x%02X != 0x%02Xs	handle_%ss	decode_%ss"%r is not a valid %s (%s) sentence(t
startswithtignore_invalid_sentenceRtstriptsplittdispatchtgettNonetignore_unknown_sentencetypestignore_checksum_mismatchtintRtoperatortxortmaptordRtgetattrt	Exception(tselftlinet
strmessagetchecksumtmessagetsentencetypeR&tcalculated_checksumthandlertdecodertdecodedte((s>/usr/lib/python2.7/dist-packages/twisted/protocols/gps/nmea.pytlineReceived>s.		+cCsX|j||||\}}|j|}|dkrBd}nd}||||fS(NRii(t_decode_latlont_decode_utc(R2tlatitudetnst	longitudetewtutctstatus((s>/usr/lib/python2.7/dist-packages/twisted/protocols/gps/nmea.pytdecode_positionZs	cCs4|j|}|j||||\}}|dkrHt|}nd}|dkrit|}nd}dt|	dd!t|	dd!t|	dd!f}	|jr|	ddkr|	dd|	d	|	df}	n|
dkrt|
}
n|d
kr|
}
nd}
||||||	|
fS(NtiiiiiiiditW(R?R>tfloatR(R+tconvert_dates_before_y2k(R2RDRER@RARBRCtspeedRtutcdatetmagvartmagdir((s>/usr/lib/python2.7/dist-packages/twisted/protocols/gps/nmea.pytdecode_positiontimehs.:"
cCsDtt|d |dd!|df\}}}|d|d|S(Niig @gN@(R.RI(R2RDtutc_hhtutc_mmtutc_ss((s>/usr/lib/python2.7/dist-packages/twisted/protocols/gps/nmea.pyR?s0cCszt|d t|dd}|dkr8|}nt|d t|dd}|dkrp|}n||fS(NigN@tSiRH(RI(R2R@RARBRC((s>/usr/lib/python2.7/dist-packages/twisted/protocols/gps/nmea.pyR>s"
"
cGs|d tt|d}\}}}g}x7|D]/}	|	rV|jt|	q4|jdq4W|t|f}
t||
|||fS(Ni(R.RItappendR+R(ttuple(R2tmode1tmode2targst
satellitestpdopthdoptvdoptsatlisttntmode((s>/usr/lib/python2.7/dist-packages/twisted/protocols/gps/nmea.pytdecode_activesatellitess'
	c	Cs|j||||\}}|j|}t|}t|}t|}t|	|
f}	|dkrt||f}nd}|
dkrt|
|f}nd}|||||||	||f	S(NRG(R>R?R+RIR((R2RDR@RARBRCtposfixRYR[taltitudetaltitude_unitstgeoid_separationtgeoid_separation_unitstdgps_agetdgps_station_idtgeoidtdgps((s>/usr/lib/python2.7/dist-packages/twisted/protocols/gps/nmea.pyt
decode_fixs*(RRt__doc__t	delimiterR&R#R*R)RJR=RFROR?R>R`Rj(((s>/usr/lib/python2.7/dist-packages/twisted/protocols/gps/nmea.pyR$s2
			$				(iiii(RR(iii(RkR,ttwisted.protocolsRttwisted.python.compatRtPOSFIX_INVALIDt
POSFIX_SPStPOSFIX_DGPSt
POSFIX_PPSt	MODE_AUTOtMODE_FORCEDt
MODE_NOFIXtMODE_2DtMODE_3DR1RRtLineReceiverR(((s>/usr/lib/python2.7/dist-packages/twisted/protocols/gps/nmea.pyt<module>s