ubxtool.in 332 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573
  1. #!@PYSHEBANG@
  2. # -*- coding: UTF-8
  3. # @GENERATED@
  4. '''
  5. ubxtool -- u-blox configurator and packet decoder
  6. usage: ubxtool [OPTIONS] [server[:port[:device]]]
  7. '''
  8. # This file is Copyright 2018 by the GPSD project
  9. # SPDX-License-Identifier: BSD-2-clause
  10. #
  11. # This code runs compatibly under Python 2 and 3.x for x >= 2.
  12. # Preserve this property!
  13. #
  14. # ENVIRONMENT:
  15. # Options in the UBXOPTS environment variable will be parsed before
  16. # the CLI options. A handy place to put your '-f /dev/ttyXX -s SPEED'
  17. #
  18. # To see what constellations are enabled:
  19. # ubxtool -p CFG-GNSS -f /dev/ttyXX
  20. #
  21. # To disable GLONASS and enable GALILEO:
  22. # ubxtool -d GLONASS -f /dev/ttyXX
  23. # ubxtool -e GALILEO -f /dev/ttyXX
  24. #
  25. # To read GPS messages a log file:
  26. # ubxtool -v 2 -f test/daemon/ublox-neo-m8n.log
  27. #
  28. # References:
  29. # [1] IS-GPS-200K
  30. from __future__ import absolute_import, print_function, division
  31. import binascii # for binascii.hexlify()
  32. from functools import reduce # pylint: disable=redefined-builtin
  33. import getopt # for getopt.getopt(), to parse CLI options
  34. import operator # for or_
  35. import os # for os.environ
  36. import re # for regular expressions
  37. import socket # for socket.error
  38. import stat # for stat.S_ISBLK()
  39. import string # for string.printable
  40. import struct # for pack()
  41. import sys
  42. import time
  43. PROG_NAME = 'ubxtool'
  44. try:
  45. import serial
  46. except ImportError:
  47. serial = None # Defer complaining until we know we need it.
  48. try:
  49. import gps
  50. except ImportError:
  51. # PEP8 says local imports last
  52. sys.stderr.write("%s: failed to import gps, check PYTHONPATH\n" %
  53. PROG_NAME)
  54. sys.exit(2)
  55. gps_version = '@VERSION@'
  56. if gps.__version__ != gps_version:
  57. sys.stderr.write("%s: ERROR: need gps module version %s, got %s\n" %
  58. (PROG_NAME, gps_version, gps.__version__))
  59. sys.exit(1)
  60. # Some old versions of Python fail to accept a bytearray as an input to
  61. # struct.unpack_from, though it can be worked around by wrapping it with
  62. # buffer(). Since the fix is only needed in rare cases, this monkey-patches
  63. # struct.unpack_from() when needed, and otherwise changes nothing. If
  64. # struct.unpack() were used, it would need similar treatment, as would
  65. # methods from struct.Struct if that were used.
  66. try:
  67. struct.unpack_from('B', bytearray(1))
  68. except TypeError:
  69. unpack_from_orig = struct.unpack_from
  70. def unpack_from_fixed(fmt, buf, offset=0):
  71. return unpack_from_orig(fmt, buffer(buf), offset=offset)
  72. struct.unpack_from = unpack_from_fixed
  73. VERB_QUIET = 0 # quiet
  74. VERB_NONE = 1 # just output requested data and some info
  75. VERB_DECODE = 2 # decode all messages
  76. VERB_INFO = 3 # more info
  77. VERB_RAW = 4 # raw info
  78. VERB_PROG = 5 # program trace
  79. # dictionary to hold all user options
  80. opts = {
  81. # command to send to GPS, -c
  82. 'command': None,
  83. # default -x items, up to 64 per call
  84. 'del_item': [],
  85. # command for -d disable
  86. 'disable': [],
  87. # command for -e enable
  88. 'enable': [],
  89. # help requested
  90. 'help': None,
  91. # default input -f file
  92. 'input_file_name': None,
  93. # default -g items, up to 64 per call
  94. 'get_item': [],
  95. # default forced wait? -W
  96. 'input_forced_wait': False,
  97. # default port speed -s
  98. 'input_speed': 9600,
  99. # default input wait time -w in seconds
  100. 'input_wait': 2.0,
  101. # the name of an OAF file, extension .jpo
  102. 'oaf_name': None,
  103. # poll command -p
  104. 'poll': [],
  105. # port ID # for -S set speed
  106. 'port': None,
  107. # protocol version for sent commands
  108. # u-blox 5, firmware 4 to 6 is protver 10 to 12
  109. # u-blox 6, firmware 6 to 7 is protver 12 to 13
  110. # u-blox 6, firmware 1 is protver 14
  111. # u-blox 7, firmware 1 is protver 14
  112. # u-blox 8, is protver 15 to 23
  113. # u-blox 9, firmware 1 is protver 27
  114. # u-blox F9T, firmware 2 is protver 29
  115. # u-blox F9N, firmware 4 is protver 32
  116. 'protver': 10.0,
  117. # raw log file name
  118. 'raw_file': None,
  119. # open port read only -r
  120. 'read_only': False,
  121. # default -z item
  122. 'set_item': [],
  123. # speed to set GPS -S
  124. 'set_speed': None,
  125. # target gpsd (server:port:device) to connect to
  126. 'target': {"server": None, "port": gps.GPSD_PORT, "device": None},
  127. # timestamp logs. 0 == None, 1 = unix time in seconds, 2 = 1 + gmtime()
  128. 'timestamp': 0,
  129. # verbosity level, -v
  130. 'verbosity': VERB_NONE,
  131. # contents of environment variable UBXOPTS
  132. 'progopts': '',
  133. }
  134. def erd_s(erd):
  135. """convert 6 bits of subframe 4, page 13 (NMCT) ERD to string"""
  136. if erd & 0x20:
  137. if erd == 0x20:
  138. return "n/a"
  139. # else
  140. erd = 1 - erd
  141. # else
  142. return "%3s" % erd
  143. # I'd like to use pypy module bitstring or bitarray, but
  144. # people complain when non stock python modules are used here.
  145. def unpack_s11(word, pos):
  146. """Grab a signed 11 bits from offset pos of word"""
  147. ubytes = bytearray(2)
  148. ubytes[0] = (word >> pos) & 0xff
  149. ubytes[1] = (word >> (pos + 8)) & 0x07
  150. if 0x04 & ubytes[1]:
  151. # extend the sign
  152. ubytes[1] |= 0xf8
  153. u = struct.unpack_from('<h', ubytes, 0)
  154. return u[0]
  155. def unpack_s11s(word):
  156. """Grab the weird split signed 11 bits from word"""
  157. newword = (word >> 22) & 0xff
  158. newword <<= 3
  159. newword |= (word >> 8) & 0x07
  160. return unpack_s11(newword, 0)
  161. def unpack_s14(word, pos):
  162. """Grab a signed 14 bits from offset pos of word"""
  163. ubytes = bytearray(2)
  164. ubytes[0] = (word >> pos) & 0xff
  165. ubytes[1] = (word >> (pos + 8)) & 0x3f
  166. if 0x20 & ubytes[1]:
  167. # extend the sign
  168. ubytes[1] |= 0xc0
  169. u = struct.unpack_from('<h', ubytes, 0)
  170. return u[0]
  171. def unpack_s16(word, pos):
  172. """Grab a signed two bytes from offset pos of word"""
  173. ubytes = bytearray(2)
  174. ubytes[0] = (word >> pos) & 0xff
  175. ubytes[1] = (word >> (pos + 8)) & 0xff
  176. u = struct.unpack_from('<h', ubytes, 0)
  177. return u[0]
  178. def unpack_u16(word, pos):
  179. """Grab a unsigned two bytes from offset pos of word"""
  180. ubytes = bytearray(2)
  181. ubytes[0] = (word >> pos) & 0xff
  182. ubytes[1] = (word >> (pos + 8)) & 0xff
  183. u = struct.unpack_from('<H', ubytes, 0)
  184. return u[0]
  185. def unpack_s22(word, pos):
  186. """Grab a signed 22 bits from offset pos of word"""
  187. ubytes = bytearray(4)
  188. ubytes[0] = (word >> pos) & 0xff
  189. ubytes[1] = (word >> (pos + 8)) & 0xff
  190. ubytes[2] = (word >> (pos + 16)) & 0x3f
  191. ubytes[3] = 0
  192. if 0x20 & ubytes[2]:
  193. # extend the sign
  194. ubytes[2] |= 0xc0
  195. ubytes[3] = 0xff
  196. u = struct.unpack_from('<l', ubytes, 0)
  197. return u[0]
  198. def unpack_s24(word, pos):
  199. """Grab a signed 24 bits from offset pos of word"""
  200. ubytes = bytearray(4)
  201. ubytes[0] = (word >> pos) & 0xff
  202. ubytes[1] = (word >> (pos + 8)) & 0xff
  203. ubytes[2] = (word >> (pos + 16)) & 0xff
  204. ubytes[3] = 0
  205. if 0x80 & ubytes[2]:
  206. # extend the sign
  207. ubytes[3] = 0xff
  208. u = struct.unpack_from('<l', ubytes, 0)
  209. return u[0]
  210. def unpack_u24(word, pos):
  211. """Grab an unsigned 24 bits from offset pos of word"""
  212. ubytes = bytearray(4)
  213. ubytes[0] = (word >> pos) & 0xff
  214. ubytes[1] = (word >> (pos + 8)) & 0xff
  215. ubytes[2] = (word >> (pos + 16)) & 0xff
  216. ubytes[3] = 0
  217. u = struct.unpack_from('<L', ubytes, 0)
  218. return u[0]
  219. def unpack_s32s(word, word1):
  220. """Grab an signed 32 bits from weird split word, word1"""
  221. ubytes = bytearray(4)
  222. ubytes[0] = (word >> 6) & 0xff
  223. ubytes[1] = (word >> 14) & 0xff
  224. ubytes[2] = (word >> 22) & 0xff
  225. ubytes[3] = (word1 >> 6) & 0xff
  226. u = struct.unpack_from('<l', ubytes, 0)
  227. return u[0]
  228. def unpack_u32s(word, word1):
  229. """Grab an unsigned 32 bits from weird split word, word1"""
  230. ubytes = bytearray(4)
  231. ubytes[0] = (word >> 6) & 0xff
  232. ubytes[1] = (word >> 14) & 0xff
  233. ubytes[2] = (word >> 22) & 0xff
  234. ubytes[3] = (word1 >> 6) & 0xff
  235. u = struct.unpack_from('<L', ubytes, 0)
  236. return u[0]
  237. def unpack_s8(word, pos):
  238. """Grab a signed byte from offset pos of word"""
  239. ubytes = bytearray(1)
  240. ubytes[0] = (word >> pos) & 0xff
  241. u = struct.unpack_from('<b', ubytes, 0)
  242. return u[0]
  243. def unpack_u8(word, pos):
  244. """Grab an unsigned byte from offset pos of word"""
  245. ubytes = bytearray(1)
  246. ubytes[0] = (word >> pos) & 0xff
  247. u = struct.unpack_from('<B', ubytes, 0)
  248. return u[0]
  249. def flag_s(flag, descs):
  250. """Decode flag using descs, return a string. Ignores unknown bits."""
  251. s = ''
  252. for key, value in sorted(descs.items()):
  253. if key == (key & flag):
  254. s += value
  255. s += ' '
  256. return s.strip()
  257. def index_s(index, descs, nf="Unk"):
  258. """Decode flag using descs, return a string. Otherwise Unk"""
  259. if index in descs:
  260. s = descs[index]
  261. else:
  262. s = nf
  263. return s
  264. def timestamp():
  265. """ print current time as a timestamp"""
  266. now = time.time()
  267. if 1 == opts['timestamp']:
  268. print("%.4f" % now)
  269. elif 2 == opts['timestamp']:
  270. print("%.4f %s" % (now, time.asctime(time.gmtime(now))))
  271. class ubx(object):
  272. """class to hold u-blox stuff"""
  273. # when a statement identifier is received, it is stored here
  274. last_statement_identifier = None
  275. # expected statement identifier.
  276. expect_statement_identifier = False
  277. def __init__(self):
  278. pass
  279. # allowable speeds
  280. speeds = (460800, 230400, 153600, 115200, 57600, 38400, 19200, 9600,
  281. 4800, 2400, 1200, 600, 300)
  282. # UBX Satellite Numbering
  283. gnss_id = {0: 'GPS',
  284. 1: 'SBAS',
  285. 2: 'Galileo',
  286. 3: 'BeiDou',
  287. 4: 'IMES',
  288. 5: 'QZSS',
  289. 6: 'GLONASS'}
  290. # Names for portID values in UBX-CFG-PRT, UBX-MON-IO, etc.
  291. port_ids = {0: 'DDC', # The license free name for i2c used in the spec
  292. 1: 'UART1',
  293. 2: 'UART2',
  294. 3: 'USB',
  295. 4: 'SPI',
  296. }
  297. port_id_map = {v: k for (k, v) in port_ids.items()}
  298. port_id_map['UART'] = port_id_map['UART1'] # Accept synonym
  299. port_ids[5] = 'Reserved' # Don't include this in port_id_map
  300. # Names for portID values in UBX-CFG-COMMS
  301. # the doc does not match what is seen
  302. port_ids1 = {0: 'DDC',
  303. 0x001: 'UART1', # as documented on ZED-M9
  304. 0x003: 'USB', # as documented on ZED-M9
  305. 0x004: 'SPI', # as documented on ZED-M9
  306. 0x100: 'UART1', # seen on ZED-M9, documented
  307. 0x101: 'UNKa', # seen on ZED-M9T, undocumented
  308. 0x102: 'UART2', # as documented on ZED-M9
  309. 0x200: 'UNKb', # seen on ZED-M9T, undocumented
  310. 0x201: 'UART2',
  311. 0x300: 'USB', # seen on ZED-M9, undocumented
  312. 0x400: 'SPI',
  313. }
  314. # u-blox 9 cfg items as a 5-tuple
  315. # 1 - Name
  316. # 2 - key id
  317. # 3 - value type
  318. # 4 - scale
  319. # 5 - Unit
  320. # 6 - Description
  321. cfgs = (
  322. # CFG--
  323. ("CFG", 0x1FFFFFFF, "", 0, "",
  324. "get all CFG"),
  325. # CFG-ANA-
  326. ("CFG-ANA", 0x1023FFFF, "", 0, "",
  327. "get all CFG-ANA"),
  328. ("CFG-ANA-USE_ANA", 0x10230001, "L", 1, "",
  329. "Use AssistNow Autonomous"),
  330. ("CFG-ANA-ORBMAXERR", 0x30230002, "U2", 1, "m",
  331. "Maximum acceptable (modeled) orbit error"),
  332. # CFG-BATCH-
  333. ("CFG-BATCH", 0x1026FFFF, "", 0, "",
  334. "get all CFG-BATCH"),
  335. ("CFG-BATCH-ENABLE", 0x10260013, "L", 1, "",
  336. "Enable the feature. Needs further configuration."),
  337. ("CFG-BATCH-PIOENABLE", 0x10260014, "L", 1, "",
  338. "Enable PIO notification when buffer fill level exceeds WARNTHRS."),
  339. ("CFG-BATCH-MAXENTRIES", 0x30260015, "U2", 1, "",
  340. "Size of buffer in number of epochs to store."),
  341. ("CFG-BATCH-WARNTHRS", 0x30260016, "U2", 1, "",
  342. "Fill level to trigger PIO notification, number of epochs stored."),
  343. ("CFG-BATCH-PIOACTIVELOW", 0x10260018, "L", 1, "",
  344. "Drive CFG-BATCH-PIOID low when buffer fill level reaches WARNTHRS"),
  345. ("CFG-BATCH-PIOPID", 0x20260019, "U1", 1, "",
  346. "PIO that is used for buffer fill level notification"),
  347. ("CFG-BATCH-EXTRAPVT", 0x1026001a, "L", 1, "",
  348. "Include additional PVT information in UBX-LOG-BATCH messages"),
  349. ("CFG-BATCH-EXTRAODO", 0x1026001b, "L", 1, "",
  350. "Include additional ODO information in UBX-LOG-BATCH messages"),
  351. # CFG-GEOFENCE-
  352. ("CFG-GEOFENCE", 0x2024FFFF, "", 0, "",
  353. "get all CFG-GEOFENCE"),
  354. ("CFG-GEOFENCE-CONFLVL", 0x20240011, "E1", 1, "",
  355. "Required confidence level for state evaluation"),
  356. ("CFG-GEOFENCE-USE_PIO", 0x10240012, "L", 1, "",
  357. "Use PIO combined fence state output"),
  358. ("CFG-GEOFENCE-PINPOL", 0x20240013, "E1", 1, "",
  359. "PIO pin polarity"),
  360. ("CFG-GEOFENCE-PIN", 0x20240014, "U1", 1, "",
  361. "PIO pin number"),
  362. ("CFG-GEOFENCE-USE_FENCE1", 0x10240020, "L", 1, "",
  363. "Use first geofence"),
  364. ("CFG-GEOFENCE-FENCE1_LAT", 0x40240021, "I4", 1e-7, "deg",
  365. "Latitude of the first geofence circle center"),
  366. ("CFG-GEOFENCE-FENCE1_LON", 0x40240022, "I4", 1e-7, "deg",
  367. "Longitude of the first geofence circle center"),
  368. ("CFG-GEOFENCE-FENCE1_RAD", 0x40240023, "U4", 0.01, "m",
  369. "Radius of the first geofence circle"),
  370. ("CFG-GEOFENCE-USE_FENCE2", 0x10240030, "L", 1, "",
  371. "Use second geofence"),
  372. ("CFG-GEOFENCE-FENCE2_LAT", 0x40240031, "I4", 1e-7, "deg",
  373. "Latitude of the second geofence circle center"),
  374. ("CFG-GEOFENCE-FENCE2_LON", 0x40240032, "I4", 1e-7, "deg",
  375. "Longitude of the second geofence circle center"),
  376. ("CFG-GEOFENCE-FENCE2_RAD", 0x40240033, "U4", 0.01, "m",
  377. "Radius of the second geofence circle"),
  378. ("CFG-GEOFENCE-USE_FENCE3", 0x10240040, "L", 1, "",
  379. "Use third geofence"),
  380. ("CFG-GEOFENCE-FENCE3_LAT", 0x40240041, "I4", 1e-7, "deg",
  381. "Latitude of the third geofence circle center"),
  382. ("CFG-GEOFENCE-FENCE3_LON", 0x40240042, "I4", 1e-7, "deg",
  383. "Longitude of the third geofence circle center"),
  384. ("CFG-GEOFENCE-FENCE3_RAD", 0x40240043, "U4", 0.01, "m",
  385. "Radius of the third geofence circle"),
  386. ("CFG-GEOFENCE-USE_FENCE4", 0x10240050, "L", 1, "",
  387. "Use fourth geofence"),
  388. ("CFG-GEOFENCE-FENCE4_LAT", 0x40240051, "I4", 1e-7, "deg",
  389. "Latitude of the fourth geofence circle center"),
  390. ("CFG-GEOFENCE-FENCE4_LON", 0x40240052, "I4", 1e-7, "deg",
  391. "Longitude of the fourth geofence circle center"),
  392. ("CFG-GEOFENCE-FENCE4_RAD", 0x40240053, "U4", 0.01, "m",
  393. "Radius of the fourth geofence circle"),
  394. # CFG-HW
  395. ("CFG-HW", 0x10a3FFFF, "", 0, "",
  396. "get all CFG-HW"),
  397. ("CFG-HW-ANT_CFG_VOLTCTRL", 0x10a3002e, "L", 1, "",
  398. "Active antenna voltage control flag"),
  399. ("CFG-HW-ANT_CFG_SHORTDET", 0x10a3002f, "L", 1, "",
  400. "Short antenna detection flag"),
  401. ("CFG-HW-ANT_CFG_SHORTDET_POL", 0x10a30030, "L", 1, "",
  402. "Short antenna detection polarity"),
  403. ("CFG-HW-ANT_CFG_OPENDET", 0x10a30031, "L", 1, "",
  404. "Open antenna detection flag"),
  405. ("CFG-HW-ANT_CFG_OPENDET_POL", 0x10a30032, "L", 1, "",
  406. "Open antenna detection polarity"),
  407. ("CFG-HW-ANT_CFG_PWRDOWN", 0x10a30033, "L", 1, "",
  408. "Power down antenna flag"),
  409. ("CFG-HW-ANT_CFG_PWRDOWN_POL", 0x10a30034, "L", 1, "",
  410. "Power down antenna logic polarity"),
  411. ("CFG-HW-ANT_CFG_RECOVER", 0x10a30035, "L", 1, "",
  412. "Automatic recovery from short state flag"),
  413. ("CFG-HW-ANT_SUP_SWITCH_PIN", 0x20a30036, "U1", 1, "",
  414. "ANT1 PIO number"),
  415. ("CFG-HW-ANT_SUP_SHORT_PIN", 0x20a30037, "U1", 1, "",
  416. "ANT0 PIO number"),
  417. ("CFG-HW-ANT_SUP_OPEN_PIN", 0x20a30038, "U1", 1, "",
  418. "ANT2 PIO number"),
  419. # CFG-I2C
  420. ("CFG-I2C", 0x2051ffff, "", 0, "",
  421. "get all CFG-I2C"),
  422. ("CFG-I2C-ADDRESS", 0x20510001, "U1", 1, "",
  423. "I2C slave address of the receiver"),
  424. ("CFG-I2C-EXTENDEDTIMEOUT", 0x10510002, "L", 1, "",
  425. "Flag to disable timeouting the interface after 1.5 s"),
  426. ("CFG-I2C-ENABLED", 0x10510003, "L", 1, "",
  427. "Flag to indicate if the I2C interface should be enabled"),
  428. # CFG-I2CINPROT
  429. ("CFG-I2CINPROT", 0x1071ffff, "", 0, "",
  430. "get all CFG-I2CINPROT"),
  431. ("CFG-I2CINPROT-UBX", 0x10710001, "L", 1, "",
  432. "Flag to indicate if UBX should be an input on I2C"),
  433. ("CFG-I2CINPROT-NMEA", 0x10710002, "L", 1, "",
  434. "Flag to indicate if NMEA should be an input on I2C"),
  435. ("CFG-I2CINPROT-RTCM2X", 0x10710003, "L", 1, "",
  436. "Flag to indicate if RTCM2X should be an input on I2C"),
  437. ("CFG-I2CINPROT-RTCM3X", 0x10710004, "L", 1, "",
  438. "Flag to indicate if RTCM3X should be input on I2C"),
  439. # CFG-I2COUTPROT
  440. ("CFG-I2COUTPROT", 0x1072ffff, "", 0, "",
  441. "get all CFG-I2COUTPROT"),
  442. ("CFG-I2COUTPROT-UBX", 0x10720001, "L", 1, "",
  443. "Flag to indicate if UBX should be an output on I2C"),
  444. ("CFG-I2COUTPROT-NMEA", 0x10720002, "L", 1, "",
  445. "Flag to indicate if NMEA should be an output on I2C"),
  446. ("CFG-I2COUTPROT-RTCM3X", 0x10720004, "L", 1, "",
  447. "Flag to indicate if RTCM3X should be an output on I2C"),
  448. # CFG-INFMSG-
  449. ("CFG-INFMSG", 0x2092ffff, "", 0, "",
  450. "get all CFG-INFMSG"),
  451. ("CFG-INFMSG-UBX_I2C", 0x20920001, "X1", 1, "",
  452. "Information message enable flags for UBX protocol on I2C"),
  453. ("CFG-INFMSG-UBX_UART1", 0x20920002, "X1", 1, "",
  454. "Information message enable flags for UBX protocol on UART1"),
  455. ("CFG-INFMSG-UBX_UART2", 0x20920003, "X1", 1, "",
  456. "Information message enable flags for UBX protocol on UART2"),
  457. ("CFG-INFMSG-UBX_USB", 0x20920004, "X1", 1, "",
  458. "Information message enable flags for UBX protocol on USB"),
  459. ("CFG-INFMSG-UBX_SPI", 0x20920005, "X1", 1, "",
  460. "Information message enable flags for UBX protocol on SPI"),
  461. ("CFG-INFMSG-NMEA_I2C", 0x20920006, "X1", 1, "",
  462. "Information message enable flags for NMEA protocol on I2C"),
  463. ("CFG-INFMSG-NMEA_UART1", 0x20920007, "X1", 1, "",
  464. "Information message enable flags for NMEA protocol on UART1"),
  465. ("CFG-INFMSG-NMEA_UART2", 0x20920008, "X1", 1, "",
  466. "Information message enable flags for NMEA protocol on UART2"),
  467. ("CFG-INFMSG-NMEA_USB", 0x20920009, "X1", 1, "",
  468. "Information message enable flags for NMEA protocol on USB"),
  469. ("CFG-INFMSG-NMEA_SPI", 0x2092000a, "X1", 1, "",
  470. "Information message enable flags for NMEA protocol on SPI"),
  471. # CFG-ITFM-
  472. ("CFG-ITFM", 0x2041ffff, "", 0, "",
  473. "get all CFG-ITFM"),
  474. ("CFG-ITFM-BBTHRESHOLD", 0x20410001, "U1", 1, "",
  475. "Broadband jamming detection threshold"),
  476. ("CFG-ITFM-CWTHRESHOLD", 0x20410002, "U1", 1, "",
  477. "CW jamming detection threshold"),
  478. ("CFG-ITFM-ENABLE", 0x1041000d, "L", 1, "",
  479. "Enable interference detection"),
  480. ("CFG-ITFM-ANTSETTING", 0x20410010, "E1", 1, "",
  481. "Antenna setting"),
  482. ("CFG-ITFM-ENABLE_AUX", 0x10410013, "L", 1, "",
  483. "Set to true to scan auxiliary bands"),
  484. # CFG-LOGFILTER-
  485. ("CFG-LOGFILTER", 0x10deffff, "", 0, "",
  486. "get all CFG-LOGFILTER"),
  487. ("CFG-LOGFILTER-RECORD_ENA", 0x10de0002, "L", 1, "",
  488. "Recording enabled"),
  489. ("CFG-LOGFILTER-ONCE_PER_WAKE_UP_ENA", 0x10de0003, "L", 1, "",
  490. "Once per wakeup"),
  491. ("CFG-LOGFILTER-APPLY_ALL_FILTERS", 0x10de0004, "L", 1, "",
  492. "Apply all filter settings"),
  493. ("CFG-LOGFILTER-MIN_INTERVAL", 0x30de0005, "U2", 1, "s",
  494. "Minimum time interval between logged positions"),
  495. ("CFG-LOGFILTER-TIME_THRS", 0x30de0006, "U2", 1, "s",
  496. "Time threshold"),
  497. ("CFG-LOGFILTER-SPEED_THRS", 0x30de0007, "U2", 1, "m/s",
  498. "Speed threshold"),
  499. ("CFG-LOGFILTER-POSITION_THRS", 0x40de0008, "U4", 1, "m",
  500. "Position threshold"),
  501. # CFG-MOT-
  502. ("CFG-MOT", 0x3025ffff, "", 0, "",
  503. "get all CFG-MOT"),
  504. ("CFG-MOT-GNSSSPEED_THRS", 0x20250038, "U1", 0.01, "m/s",
  505. "GNSS speed threshold below which platform is considered "
  506. "as stationary"),
  507. ("CFG-MOT-GNSSDIST_THRS", 0x3025003b, "U2", 1, "",
  508. "Distance above which GNSS-based stationary motion is exit"),
  509. # CFG-MSGOUT-NMEA
  510. ("CFG-MSGOUT", 0x2091ffff, "", 0, "",
  511. "get all CFG-MSGOUT"),
  512. ("CFG-MSGOUT-NMEA_ID_DTM_I2C", 0x209100a6, "U1", 1, "",
  513. "Output rate of the NMEA-GX-DTM message on port I2C"),
  514. ("CFG-MSGOUT-NMEA_ID_DTM_SPI", 0x209100aa, "U1", 1, "",
  515. "Output rate of the NMEA-GX-DTM message on port SPI"),
  516. ("CFG-MSGOUT-NMEA_ID_DTM_UART1", 0x209100a7, "U1", 1, "",
  517. "Output rate of the NMEA-GX-DTM message on port UART1"),
  518. ("CFG-MSGOUT-NMEA_ID_DTM_UART2", 0x209100a8, "U1", 1, "",
  519. "Output rate of the NMEA-GX-DTM message on port UART2"),
  520. ("CFG-MSGOUT-NMEA_ID_DTM_USB", 0x209100a9, "U1", 1, "",
  521. "Output rate of the NMEA-GX-DTM message on port USB"),
  522. ("CFG-MSGOUT-NMEA_ID_GBS_I2C", 0x209100dd, "U1", 1, "",
  523. "Output rate of the NMEA-GX-GBS message on port I2C"),
  524. ("CFG-MSGOUT-NMEA_ID_GBS_SPI", 0x209100e1, "U1", 1, "",
  525. "Output rate of the NMEA-GX-GBS message on port SPI"),
  526. ("CFG-MSGOUT-NMEA_ID_GBS_UART1", 0x209100de, "U1", 1, "",
  527. "Output rate of the NMEA-GX-GBS message on port UART1"),
  528. ("CFG-MSGOUT-NMEA_ID_GBS_UART2", 0x209100df, "U1", 1, "",
  529. "Output rate of the NMEA-GX-GBS message on port UART2"),
  530. ("CFG-MSGOUT-NMEA_ID_GBS_USB", 0x209100e0, "U1", 1, "",
  531. "Output rate of the NMEA-GX-GBS message on port USB"),
  532. ("CFG-MSGOUT-NMEA_ID_GGA_I2C", 0x209100ba, "U1", 1, "",
  533. "Output rate of the NMEA-GX-GGA message on port I2C"),
  534. ("CFG-MSGOUT-NMEA_ID_GGA_SPI", 0x209100be, "U1", 1, "",
  535. "Output rate of the NMEA-GX-GGA message on port SPI"),
  536. ("CFG-MSGOUT-NMEA_ID_GGA_UART1", 0x209100bb, "U1", 1, "",
  537. "Output rate of the NMEA-GX-GGA message on port UART1"),
  538. ("CFG-MSGOUT-NMEA_ID_GGA_UART2", 0x209100bc, "U1", 1, "",
  539. "Output rate of the NMEA-GX-GGA message on port UART2"),
  540. ("CFG-MSGOUT-NMEA_ID_GGA_USB", 0x209100bd, "U1", 1, "",
  541. "Output rate of the NMEA-GX-GGA message on port USB"),
  542. ("CFG-MSGOUT-NMEA_ID_GLL_I2C", 0x209100c9, "U1", 1, "",
  543. "Output rate of the NMEA-GX-GLL message on port I2C"),
  544. ("CFG-MSGOUT-NMEA_ID_GLL_SPI", 0x209100cd, "U1", 1, "",
  545. "Output rate of the NMEA-GX-GLL message on port SPI"),
  546. ("CFG-MSGOUT-NMEA_ID_GLL_UART1", 0x209100ca, "U1", 1, "",
  547. "Output rate of the NMEA-GX-GLL message on port UART1"),
  548. ("CFG-MSGOUT-NMEA_ID_GLL_UART2", 0x209100cb, "U1", 1, "",
  549. "Output rate of the NMEA-GX-GLL message on port UART2"),
  550. ("CFG-MSGOUT-NMEA_ID_GLL_USB", 0x209100cc, "U1", 1, "",
  551. "Output rate of the NMEA-GX-GLL message on port USB"),
  552. ("CFG-MSGOUT-NMEA_ID_GNS_I2C", 0x209100b5, "U1", 1, "",
  553. "Output rate of the NMEA-GX-GNS message on port I2C"),
  554. ("CFG-MSGOUT-NMEA_ID_GNS_SPI", 0x209100b9, "U1", 1, "",
  555. "Output rate of the NMEA-GX-GNS message on port SPI"),
  556. ("CFG-MSGOUT-NMEA_ID_GNS_UART1", 0x209100b6, "U1", 1, "",
  557. "Output rate of the NMEA-GX-GNS message on port UART1"),
  558. ("CFG-MSGOUT-NMEA_ID_GNS_UART2", 0x209100b7, "U1", 1, "",
  559. "Output rate of the NMEA-GX-GNS message on port UART2"),
  560. ("CFG-MSGOUT-NMEA_ID_GNS_USB", 0x209100b8, "U1", 1, "",
  561. "Output rate of the NMEA-GX-GNS message on port USB"),
  562. ("CFG-MSGOUT-NMEA_ID_GRS_I2C", 0x209100ce, "U1", 1, "",
  563. "Output rate of the NMEA-GX-GRS message on port I2C"),
  564. ("CFG-MSGOUT-NMEA_ID_GRS_SPI", 0x209100d2, "U1", 1, "",
  565. "Output rate of the NMEA-GX-GRS message on port SPI"),
  566. ("CFG-MSGOUT-NMEA_ID_GRS_UART1", 0x209100cf, "U1", 1, "",
  567. "Output rate of the NMEA-GX-GRS message on port UART1"),
  568. ("CFG-MSGOUT-NMEA_ID_GRS_UART2", 0x209100d0, "U1", 1, "",
  569. "Output rate of the NMEA-GX-GRS message on port UART2"),
  570. ("CFG-MSGOUT-NMEA_ID_GRS_USB", 0x209100d1, "U1", 1, "",
  571. "Output rate of the NMEA-GX-GRS message on port USB"),
  572. ("CFG-MSGOUT-NMEA_ID_GSA_I2C", 0x209100bf, "U1", 1, "",
  573. "Output rate of the NMEA-GX-GSA message on port I2C"),
  574. ("CFG-MSGOUT-NMEA_ID_GSA_SPI", 0x209100c3, "U1", 1, "",
  575. "Output rate of the NMEA-GX-GSA message on port SPI"),
  576. ("CFG-MSGOUT-NMEA_ID_GSA_UART1", 0x209100c0, "U1", 1, "",
  577. "Output rate of the NMEA-GX-GSA message on port UART1"),
  578. ("CFG-MSGOUT-NMEA_ID_GSA_UART2", 0x209100c1, "U1", 1, "",
  579. "Output rate of the NMEA-GX-GSA message on port UART2"),
  580. ("CFG-MSGOUT-NMEA_ID_GSA_USB", 0x209100c2, "U1", 1, "",
  581. "Output rate of the NMEA-GX-GSA message on port USB"),
  582. ("CFG-MSGOUT-NMEA_ID_GST_I2C", 0x209100d3, "U1", 1, "",
  583. "Output rate of the NMEA-GX-GST message on port I2C"),
  584. ("CFG-MSGOUT-NMEA_ID_GST_SPI", 0x209100d7, "U1", 1, "",
  585. "Output rate of the NMEA-GX-GST message on port SPI"),
  586. ("CFG-MSGOUT-NMEA_ID_GST_UART1", 0x209100d4, "U1", 1, "",
  587. "Output rate of the NMEA-GX-GST message on port UART1"),
  588. ("CFG-MSGOUT-NMEA_ID_GST_UART2", 0x209100d5, "U1", 1, "",
  589. "Output rate of the NMEA-GX-GST message on port UART2"),
  590. ("CFG-MSGOUT-NMEA_ID_GST_USB", 0x209100d6, "U1", 1, "",
  591. "Output rate of the NMEA-GX-GST message on port USB"),
  592. ("CFG-MSGOUT-NMEA_ID_GSV_I2C", 0x209100c4, "U1", 1, "",
  593. "Output rate of the NMEA-GX-GSV message on port I2C"),
  594. ("CFG-MSGOUT-NMEA_ID_GSV_SPI", 0x209100c8, "U1", 1, "",
  595. "Output rate of the NMEA-GX-GSV message on port SPI"),
  596. ("CFG-MSGOUT-NMEA_ID_GSV_UART1", 0x209100c5, "U1", 1, "",
  597. "Output rate of the NMEA-GX-GSV message on port UART1"),
  598. ("CFG-MSGOUT-NMEA_ID_GSV_UART2", 0x209100c6, "U1", 1, "",
  599. "Output rate of the NMEA-GX-GSV message on port UART"),
  600. ("CFG-MSGOUT-NMEA_ID_GSV_USB", 0x209100c7, "U1", 1, "",
  601. "Output rate of the NMEA-GX-GSV message on port USB"),
  602. ("CFG-MSGOUT-NMEA_ID_RLM_I2C", 0x20910400, "U1", 1, "",
  603. "Output rate of the NMEA-GX-RLM message on port I2C"),
  604. ("CFG-MSGOUT-NMEA_ID_RLM_SPI", 0x20910404, "U1", 1, "",
  605. "Output rate of the NMEA-GX-RLM message on port SPI"),
  606. ("CFG-MSGOUT-NMEA_ID_RLM_UART1", 0x20910401, "U1", 1, "",
  607. "Output rate of the NMEA-GX-RLM message on port UART1"),
  608. ("CFG-MSGOUT-NMEA_ID_RLM_UART2", 0x20910402, "U1", 1, "",
  609. "Output rate of the NMEA-GX-RLM message on port UART2"),
  610. ("CFG-MSGOUT-NMEA_ID_RLM_USB", 0x20910403, "U1", 1, "",
  611. "Output rate of the NMEA-GX-RLM message on port USB"),
  612. ("CFG-MSGOUT-NMEA_ID_RMC_I2C", 0x209100ab, "U1", 1, "",
  613. "Output rate of the NMEA-GX-RMC message on port I2C"),
  614. ("CFG-MSGOUT-NMEA_ID_RMC_SPI", 0x209100af, "U1", 1, "",
  615. "Output rate of the NMEA-GX-RMC message on port SPI"),
  616. ("CFG-MSGOUT-NMEA_ID_RMC_UART1", 0x209100ac, "U1", 1, "",
  617. "Output rate of the NMEA-GX-RMC message on port UART1"),
  618. ("CFG-MSGOUT-NMEA_ID_RMC_UART2", 0x209100ad, "U1", 1, "",
  619. "Output rate of the NMEA-GX-RMC message on port UART2"),
  620. ("CFG-MSGOUT-NMEA_ID_RMC_USB", 0x209100ae, "U1", 1, "",
  621. "Output rate of the NMEA-GX-RMC message on port USB"),
  622. ("CFG-MSGOUT-NMEA_ID_VLW_I2C", 0x209100e7, "U1", 1, "",
  623. "Output rate of the NMEA-GX-VLW message on port I2C"),
  624. ("CFG-MSGOUT-NMEA_ID_VLW_SPI", 0x209100eb, "U1", 1, "",
  625. "Output rate of the NMEA-GX-VLW message on port SPI"),
  626. ("CFG-MSGOUT-NMEA_ID_VLW_UART1", 0x209100e8, "U1", 1, "",
  627. "Output rate of the NMEA-GX-VLW message on port UART1"),
  628. ("CFG-MSGOUT-NMEA_ID_VLW_UART2", 0x209100e9, "U1", 1, "",
  629. "Output rate of the NMEA-GX-VLW message on port UART2"),
  630. ("CFG-MSGOUT-NMEA_ID_VLW_USB", 0x209100ea, "U1", 1, "",
  631. "Output rate of the NMEA-GX-VLW message on port USB"),
  632. ("CFG-MSGOUT-NMEA_ID_VTG_I2C", 0x209100b0, "U1", 1, "",
  633. "Output rate of the NMEA-GX-VTG message on port I2C"),
  634. ("CFG-MSGOUT-NMEA_ID_VTG_SPI", 0x209100b4, "U1", 1, "",
  635. "Output rate of the NMEA-GX-VTG message on port SPI"),
  636. ("CFG-MSGOUT-NMEA_ID_VTG_UART1", 0x209100b1, "U1", 1, "",
  637. "Output rate of the NMEA-GX-VTG message on port UART1"),
  638. ("CFG-MSGOUT-NMEA_ID_VTG_UART2", 0x209100b2, "U1", 1, "",
  639. "Output rate of the NMEA-GX-VTG message on port UART2"),
  640. ("CFG-MSGOUT-NMEA_ID_VTG_USB", 0x209100b3, "U1", 1, "",
  641. "Output rate of the NMEA-GX-VTG message on port USB"),
  642. ("CFG-MSGOUT-NMEA_ID_ZDA_I2C", 0x209100d8, "U1", 1, "",
  643. "Output rate of the NMEA-GX-ZDA message on port I2C"),
  644. ("CFG-MSGOUT-NMEA_ID_ZDA_SPI", 0x209100dc, "U1", 1, "",
  645. "Output rate of the NMEA-GX-ZDA message on port SPI"),
  646. ("CFG-MSGOUT-NMEA_ID_ZDA_UART1", 0x209100d9, "U1", 1, "",
  647. "Output rate of the NMEA-GX-ZDA message on port UART1"),
  648. ("CFG-MSGOUT-NMEA_ID_ZDA_UART2", 0x209100da, "U1", 1, "",
  649. "Output rate of the NMEA-GX-ZDA message on port UART2"),
  650. ("CFG-MSGOUT-NMEA_ID_ZDA_USB", 0x209100db, "U1", 1, "",
  651. "Output rate of the NMEA-GX-ZDA message on port USB"),
  652. # CFG-MSGOUT-PUBX
  653. ("CFG-MSGOUT-PUBX_ID_POLYP_I2C", 0x209100ec, "U1", 1, "",
  654. "Output rate of the NMEA-GX-PUBX00 message on port I2C"),
  655. ("CFG-MSGOUT-PUBX_ID_POLYP_SPI", 0x209100f0, "U1", 1, "",
  656. "Output rate of the NMEA-GX-PUBX00 message on port SPI"),
  657. ("CFG-MSGOUT-PUBX_ID_POLYP_UART1", 0x209100ed, "U1", 1, "",
  658. "Output rate of the NMEA-GX-PUBX00 message on port UART1"),
  659. ("CFG-MSGOUT-PUBX_ID_POLYP_UART2", 0x209100ee, "U1", 1, "",
  660. "Output rate of the NMEA-GX-PUBX00 message on port UART2"),
  661. ("CFG-MSGOUT-PUBX_ID_POLYP_USB", 0x209100ef, "U1", 1, "",
  662. "Output rate of the NMEA-GX-PUBX00 message on port USB"),
  663. ("CFG-MSGOUT-PUBX_ID_POLYS_I2C", 0x209100f1, "U1", 1, "",
  664. "Output rate of the NMEA-GX-PUBX03 message on port I2C"),
  665. ("CFG-MSGOUT-PUBX_ID_POLYS_SPI", 0x209100f5, "U1", 1, "",
  666. "Output rate of the NMEA-GX-PUBX03 message on port SPI"),
  667. ("CFG-MSGOUT-PUBX_ID_POLYS_UART1", 0x209100f2, "U1", 1, "",
  668. "Output rate of the NMEA-GX-PUBX03 message on port UART1"),
  669. ("CFG-MSGOUT-PUBX_ID_POLYS_UART2", 0x209100f3, "U1", 1, "",
  670. "Output rate of the NMEA-GX-PUBX03 message on port UART2"),
  671. ("CFG-MSGOUT-PUBX_ID_POLYS_USB", 0x209100f4, "U1", 1, "",
  672. "Output rate of the NMEA-GX-PUBX03 message on port USB"),
  673. ("CFG-MSGOUT-PUBX_ID_POLYT_I2C", 0x209100f6, "U1", 1, "",
  674. "Output rate of the NMEA-GX-PUBX04 message on port I2C"),
  675. ("CFG-MSGOUT-PUBX_ID_POLYT_SPI", 0x209100fa, "U1", 1, "",
  676. "Output rate of the NMEA-GX-PUBX04 message on port SPI"),
  677. ("CFG-MSGOUT-PUBX_ID_POLYT_UART1", 0x209100f7, "U1", 1, "",
  678. "Output rate of the NMEA-GX-PUBX04 message on port UART1"),
  679. ("CFG-MSGOUT-PUBX_ID_POLYT_UART2", 0x209100f8, "U1", 1, "",
  680. "Output rate of the NMEA-GX-PUBX04 message on port UART2"),
  681. ("CFG-MSGOUT-PUBX_ID_POLYT_USB", 0x209100f9, "U1", 1, "",
  682. "Output rate of the NMEA-GX-PUBX04 message on port USB"),
  683. # CFG-MSGOUT-RTCM_3X
  684. ("CFG-MSGOUT-RTCM_3X_TYPE1005_I2C", 0x209102bd, "U1", 1, "",
  685. "Output rate of the RTCM-3X-TYPE1005 message on port I2C"),
  686. ("CFG-MSGOUT-RTCM_3X_TYPE1005_SPI", 0x209102c1, "U1", 1, "",
  687. "Output rate of the RTCM-3X-TYPE1005 message on port SPI"),
  688. ("CFG-MSGOUT-RTCM_3X_TYPE1005_UART1", 0x209102be, "U1", 1, "",
  689. "Output rate of the RTCM-3X-TYPE1005 message on port UART1"),
  690. ("CFG-MSGOUT-RTCM_3X_TYPE1005_UART2", 0x209102bf, "U1", 1, "",
  691. "Output rate of the RTCM-3X-TYPE1005 message on port UART2"),
  692. ("CFG-MSGOUT-RTCM_3X_TYPE1005_USB", 0x209102c0, "U1", 1, "",
  693. "Output rate of the RTCM-3X-TYPE1005 message on port USB"),
  694. ("CFG-MSGOUT-RTCM_3X_TYPE1074_I2C", 0x2091035e, "U1", 1, "",
  695. "Output rate of the RTCM-3X-TYPE1074 message on port I2C"),
  696. ("CFG-MSGOUT-RTCM_3X_TYPE1074_SPI", 0x20910362, "U1", 1, "",
  697. "Output rate of the RTCM-3X-TYPE1074 message on port SPI"),
  698. ("CFG-MSGOUT-RTCM_3X_TYPE1074_UART1", 0x2091035f, "U1", 1, "",
  699. "Output rate of the RTCM-3X-TYPE1074 message on port UART1"),
  700. ("CFG-MSGOUT-RTCM_3X_TYPE1074_UART2", 0x20910360, "U1", 1, "",
  701. "Output rate of the RTCM-3X-TYPE1074 message on port UART2"),
  702. ("CFG-MSGOUT-RTCM_3X_TYPE1074_USB", 0x20910361, "U1", 1, "",
  703. "Output rate of the RTCM-3X-TYPE1074 message on port USB"),
  704. ("CFG-MSGOUT-RTCM_3X_TYPE1077_I2C", 0x209102cc, "U1", 1, "",
  705. "Output rate of the RTCM-3X-TYPE1077 message on port I2"),
  706. ("CFG-MSGOUT-RTCM_3X_TYPE1077_SPI", 0x209102d0, "U1", 1, "",
  707. "Output rate of the RTCM-3X-TYPE1077 message on port SPI"),
  708. ("CFG-MSGOUT-RTCM_3X_TYPE1077_UART1", 0x209102cd, "U1", 1, "",
  709. "Output rate of the RTCM-3X-TYPE1077 message on port UART1"),
  710. ("CFG-MSGOUT-RTCM_3X_TYPE1077_UART2", 0x209102ce, "U1", 1, "",
  711. "Output rate of the RTCM-3X-TYPE1077 message on port UART2"),
  712. ("CFG-MSGOUT-RTCM_3X_TYPE1077_USB", 0x209102cf, "U1", 1, "",
  713. "Output rate of the RTCM-3X-TYPE1077 message on port USB"),
  714. ("CFG-MSGOUT-RTCM_3X_TYPE1087_I2C", 0x209102d1, "U1", 1, "",
  715. "Output rate of the RTCM-3X-TYPE1087 message on port I2C"),
  716. ("CFG-MSGOUT-RTCM_3X_TYPE1084_SPI", 0x20910367, "U1", 1, "",
  717. "Output rate of the RTCM-3X-TYPE1084 message on port SPI"),
  718. ("CFG-MSGOUT-RTCM_3X_TYPE1084_UART1", 0x20910364, "U1", 1, "",
  719. "Output rate of the RTCM-3X-TYPE1084 message on port UART1"),
  720. ("CFG-MSGOUT-RTCM_3X_TYPE1084_UART2", 0x20910365, "U1", 1, "",
  721. "Output rate of the RTCM-3X-TYPE1084 message on port UART2"),
  722. ("CFG-MSGOUT-RTCM_3X_TYPE1084_USB", 0x20910366, "U1", 1, "",
  723. "Output rate of the RTCM-3X-TYPE1084 message on port USB"),
  724. ("CFG-MSGOUT-RTCM_3X_TYPE1087_SPI", 0x209102d5, "U1", 1, "",
  725. "Output rate of the RTCM-3X-TYPE1087 message on port SPI"),
  726. ("CFG-MSGOUT-RTCM_3X_TYPE1087_UART1", 0x209102d2, "U1", 1, "",
  727. "Output rate of the RTCM-3X-TYPE1087 message on port UART1"),
  728. ("CFG-MSGOUT-RTCM_3X_TYPE1087_UART2", 0x209102d3, "U1", 1, "",
  729. "Output rate of the RTCM-3X-TYPE1087 message on port UART2"),
  730. ("CFG-MSGOUT-RTCM_3X_TYPE1087_USB", 0x209102d4, "U1", 1, "",
  731. "Output rate of the RTCM-3X-TYPE1087 message on port USB"),
  732. ("CFG-MSGOUT-RTCM_3X_TYPE1094_I2C", 0x20910368, "U1", 1, "",
  733. "Output rate of the RTCM-3X-TYPE1094 message on port I2C"),
  734. ("CFG-MSGOUT-RTCM_3X_TYPE1094_SPI", 0x2091036c, "U1", 1, "",
  735. "Output rate of the RTCM-3X-TYPE1094 message on port SPI"),
  736. ("CFG-MSGOUT-RTCM_3X_TYPE1094_UART1", 0x20910369, "U1", 1, "",
  737. "Output rate of the RTCM-3X-TYPE1094 message on port UART1"),
  738. ("CFG-MSGOUT-RTCM_3X_TYPE1094_UART2", 0x2091036a, "U1", 1, "",
  739. "Output rate of the RTCM-3X-TYPE1094 message on port UART2"),
  740. ("CFG-MSGOUT-RTCM_3X_TYPE1094_USB", 0x2091036b, "U1", 1, "",
  741. "Output rate of the RTCM-3X-TYPE1094 message on port USB"),
  742. ("CFG-MSGOUT-RTCM_3X_TYPE1097_I2C", 0x20910318, "U1", 1, "",
  743. "Output rate of the RTCM-3X-TYPE1097 message on port I2C"),
  744. ("CFG-MSGOUT-RTCM_3X_TYPE1097_SPI", 0x2091031c, "U1", 1, "",
  745. "Output rate of the RTCM-3X-TYPE1097 message on port SPI"),
  746. ("CFG-MSGOUT-RTCM_3X_TYPE1097_UART1", 0x20910319, "U1", 1, "",
  747. "Output rate of the RTCM-3X-TYPE1097 message on port UART1"),
  748. ("CFG-MSGOUT-RTCM_3X_TYPE1097_UART2", 0x2091031a, "U1", 1, "",
  749. "Output rate of the RTCM-3X-TYPE1097 message on port UART2"),
  750. ("CFG-MSGOUT-RTCM_3X_TYPE1097_USB", 0x2091031b, "U1", 1, "",
  751. "Output rate of the RTCM-3X-TYPE1097 message on port USB"),
  752. ("CFG-MSGOUT-RTCM_3X_TYPE1124_I2C", 0x2091036d, "U1", 1, "",
  753. "Output rate of the RTCM-3X-TYPE1124 message on port I2C"),
  754. ("CFG-MSGOUT-RTCM_3X_TYPE1124_SPI", 0x20910371, "U1", 1, "",
  755. "Output rate of the RTCM-3X-TYPE1124 message on port SPI"),
  756. ("CFG-MSGOUT-RTCM_3X_TYPE1124_UART1", 0x2091036e, "U1", 1, "",
  757. "Output rate of the RTCM-3X-TYPE1124 message on port UART1"),
  758. ("CFG-MSGOUT-RTCM_3X_TYPE1124_UART2", 0x2091036f, "U1", 1, "",
  759. "Output rate of the RTCM-3X-TYPE1124 message on port UART2"),
  760. ("CFG-MSGOUT-RTCM_3X_TYPE1124_USB", 0x20910370, "U1", 1, "",
  761. "Output rate of the RTCM-3X-TYPE1124 message on port USB"),
  762. ("CFG-MSGOUT-RTCM_3X_TYPE1127_I2C", 0x209102d6, "U1", 1, "",
  763. "Output rate of the RTCM-3X-TYPE1127 message on port I2C"),
  764. ("CFG-MSGOUT-RTCM_3X_TYPE1127_SPI", 0x209102da, "U1", 1, "",
  765. "Output rate of the RTCM-3X-TYPE1127 message on port SPI"),
  766. ("CFG-MSGOUT-RTCM_3X_TYPE1127_UART1", 0x209102d7, "U1", 1, "",
  767. "Output rate of the RTCM-3X-TYPE1127 message on port UART1"),
  768. ("CFG-MSGOUT-RTCM_3X_TYPE1127_UART2", 0x209102d8, "U1", 1, "",
  769. "Output rate of the RTCM-3X-TYPE1127 message on port UART2"),
  770. ("CFG-MSGOUT-RTCM_3X_TYPE1127_USB", 0x209102d9, "U1", 1, "",
  771. "Output rate of the RTCM-3X-TYPE1127 message on port USB"),
  772. ("CFG-MSGOUT-RTCM_3X_TYPE1230_I2C", 0x20910303, "U1", 1, "",
  773. "Output rate of the RTCM-3X-TYPE1230 message on port I2C"),
  774. ("CFG-MSGOUT-RTCM_3X_TYPE1230_SPI", 0x20910307, "U1", 1, "",
  775. "Output rate of the RTCM-3X-TYPE1230 message on port SPI"),
  776. ("CFG-MSGOUT-RTCM_3X_TYPE1230_UART1", 0x20910304, "U1", 1, "",
  777. "Output rate of the RTCM-3X-TYPE1230 message on port UART1"),
  778. ("CFG-MSGOUT-RTCM_3X_TYPE1230_UART2", 0x20910305, "U1", 1, "",
  779. "Output rate of the RTCM-3X-TYPE1230 message on port UART2"),
  780. ("CFG-MSGOUT-RTCM_3X_TYPE1230_USB", 0x20910306, "U1", 1, "",
  781. "Output rate of the RTCM-3X-TYPE1230 message on port USB"),
  782. ("CFG-MSGOUT-RTCM_3X_TYPE4072_0_I2C", 0x209102fe, "U1", 1, "",
  783. "Output rate of the RTCM-3X-TYPE4072, sub-type 0 message "
  784. "on port I2C"),
  785. ("CFG-MSGOUT-RTCM_3X_TYPE4072_0_SPI", 0x20910302, "U1", 1, "",
  786. "Output rate of the RTCM-3X-TYPE4072, sub-type 0 message "
  787. "on port SPI"),
  788. ("CFG-MSGOUT-RTCM_3X_TYPE4072_0_UART1", 0x209102ff, "U1", 1, "",
  789. "Output rate of the RTCM-3X-TYPE4072, sub-type 0 message "
  790. "on port UART1"),
  791. ("CFG-MSGOUT-RTCM_3X_TYPE4072_0_UART2", 0x20910300, "U1", 1, "",
  792. "Output rate of the RTCM-3X-TYPE4072, sub-type 0 message "
  793. "on port UART2"),
  794. ("CFG-MSGOUT-RTCM_3X_TYPE4072_0_USB", 0x20910301, "U1", 1, "",
  795. "Output rate of the RTCM-3X-TYPE4072, sub-type 0 message "
  796. "on port USB"),
  797. ("CFG-MSGOUT-RTCM_3X_TYPE4072_1_I2C", 0x20910381, "U1", 1, "",
  798. "Output rate of the RTCM-3X-TYPE4072, sub-type 1 message on "
  799. "port I2C"),
  800. ("CFG-MSGOUT-RTCM_3X_TYPE4072_1_SPI", 0x20910385, "U1", 1, "",
  801. "Output rate of the RTCM-3X-TYPE4072, sub-type 1 message on "
  802. "port SPI"),
  803. ("CFG-MSGOUT-RTCM_3X_TYPE4072_1_UART1", 0x20910382, "U1", 1, "",
  804. "Output rate of the RTCM-3X-TYPE4072, sub-type 1 message on "
  805. "port UART1"),
  806. ("CFG-MSGOUT-RTCM_3X_TYPE4072_1_UART2", 0x20910383, "U1", 1, "",
  807. "Output rate of the RTCM-3X-TYPE4072, sub-type 1 message on "
  808. " port UART2"),
  809. ("CFG-MSGOUT-RTCM_3X_TYPE4072_1_USB", 0x20910384, "U1", 1, "",
  810. "Output rate of the RTCM-3X-TYPE4072, sub-type 1 message "
  811. "on port USB"),
  812. # CFG-MSGOUT-UBX_LOG
  813. ("CFG-MSGOUT-UBX_LOG_INFO_I2C", 0x20910259, "U1", 1, "",
  814. "Output rate of the UBX-LOG-INFO message on port I2C"),
  815. ("CFG-MSGOUT-UBX_LOG_INFO_SPI", 0x2091025d, "U1", 1, "",
  816. "Output rate of the UBX-LOG-INFO message on port SPI"),
  817. ("CFG-MSGOUT-UBX_LOG_INFO_UART1", 0x2091025a, "U1", 1, "",
  818. "Output rate of the UBX-LOG-INFO message on port UART1"),
  819. ("CFG-MSGOUT-UBX_LOG_INFO_UART2", 0x2091025b, "U1", 1, "",
  820. "Output rate of the UBX-LOG-INFO message on port UART2"),
  821. ("CFG-MSGOUT-UBX_LOG_INFO_USB", 0x2091025c, "U1", 1, "",
  822. "Output rate of the UBX-LOG-INFO message on port USB"),
  823. # CFG-MSGOUT-UBX_MON
  824. ("CFG-MSGOUT-UBX_MON_COMMS_I2C", 0x2091034f, "U1", 1, "",
  825. "Output rate of the UBX-MON-COMMS message on port I2C"),
  826. ("CFG-MSGOUT-UBX_MON_COMMS_SPI", 0x20910353, "U1", 1, "",
  827. "Output rate of the UBX-MON-COMMS message on port SPI"),
  828. ("CFG-MSGOUT-UBX_MON_COMMS_UART1", 0x20910350, "U1", 1, "",
  829. "Output rate of the UBX-MON-COMMS message on port UART1"),
  830. ("CFG-MSGOUT-UBX_MON_COMMS_UART2", 0x20910351, "U1", 1, "",
  831. "Output rate of the UBX-MON-COMMS message on port UART2"),
  832. ("CFG-MSGOUT-UBX_MON_COMMS_USB", 0x20910352, "U1", 1, "",
  833. "Output rate of the UBX-MON-COMMS message on port USB"),
  834. ("CFG-MSGOUT-UBX_MON_HW2_I2C", 0x209101b9, "U1", 1, "",
  835. "Output rate of the UBX-MON-HW2 message on port I2C"),
  836. ("CFG-MSGOUT-UBX_MON_HW2_SPI", 0x209101bd, "U1", 1, "",
  837. "Output rate of the UBX-MON-HW2 message on port SPI"),
  838. ("CFG-MSGOUT-UBX_MON_HW2_UART1", 0x209101ba, "U1", 1, "",
  839. "Output rate of the UBX-MON-HW2 message on port UART1"),
  840. ("CFG-MSGOUT-UBX_MON_HW2_UART2", 0x209101bb, "U1", 1, "",
  841. "Output rate of the UBX-MON-HW2 message on port UART2"),
  842. ("CFG-MSGOUT-UBX_MON_HW2_USB", 0x209101bc, "U1", 1, "",
  843. "Output rate of the UBX-MON-HW2 message on port USB"),
  844. ("CFG-MSGOUT-UBX_MON_HW3_I2C", 0x20910354, "U1", 1, "",
  845. "Output rate of the UBX-MON-HW3 message on port I2C"),
  846. ("CFG-MSGOUT-UBX_MON_HW3_SPI", 0x20910358, "U1", 1, "",
  847. "Output rate of the UBX-MON-HW3 message on port SPI"),
  848. ("CFG-MSGOUT-UBX_MON_HW3_UART1", 0x20910355, "U1", 1, "",
  849. "Output rate of the UBX-MON-HW3 message on port UART1"),
  850. ("CFG-MSGOUT-UBX_MON_HW3_UART2", 0x20910356, "U1", 1, "",
  851. "Output rate of the UBX-MON-HW3 message on port UART2"),
  852. ("CFG-MSGOUT-UBX_MON_HW3_USB", 0x20910357, "U1", 1, "",
  853. "Output rate of the UBX-MON-HW3 message on port USB"),
  854. ("CFG-MSGOUT-UBX_MON_HW_I2C", 0x209101b4, "U1", 1, "",
  855. "Output rate of the UBX-MON-HW message on port I2C"),
  856. ("CFG-MSGOUT-UBX_MON_HW_SPI", 0x209101b8, "U1", 1, "",
  857. "Output rate of the UBX-MON-HW message on port SPI"),
  858. ("CFG-MSGOUT-UBX_MON_HW_UART1", 0x209101b5, "U1", 1, "",
  859. "Output rate of the UBX-MON-HW message on port UART1"),
  860. ("CFG-MSGOUT-UBX_MON_HW_UART2", 0x209101b6, "U1", 1, "",
  861. "Output rate of the UBX-MON-HW message on port UART2"),
  862. ("CFG-MSGOUT-UBX_MON_HW_USB", 0x209101b7, "U1", 1, "",
  863. "Output rate of the UBX-MON-HW message on port USB"),
  864. ("CFG-MSGOUT-UBX_MON_IO_I2C", 0x209101a5, "U1", 1, "",
  865. "Output rate of the UBX-MON-IO message on port I2C"),
  866. ("CFG-MSGOUT-UBX_MON_IO_SPI", 0x209101a9, "U1", 1, "",
  867. "Output rate of the UBX-MON-IO message on port SPI"),
  868. ("CFG-MSGOUT-UBX_MON_IO_UART1", 0x209101a6, "U1", 1, "",
  869. "Output rate of the UBX-MON-IO message on port UART1"),
  870. ("CFG-MSGOUT-UBX_MON_IO_UART2", 0x209101a7, "U1", 1, "",
  871. "Output rate of the UBX-MON-IO message on port UART2"),
  872. ("CFG-MSGOUT-UBX_MON_IO_USB", 0x209101a8, "U1", 1, "",
  873. "Output rate of the UBX-MON-IO message on port USB"),
  874. ("CFG-MSGOUT-UBX_MON_MSGPP_I2C", 0x20910196, "U1", 1, "",
  875. "Output rate of the UBX-MON-MSGPP message on port I2C"),
  876. ("CFG-MSGOUT-UBX_MON_MSGPP_SPI", 0x2091019a, "U1", 1, "",
  877. "Output rate of the UBX-MON-MSGPP message on port SPI"),
  878. ("CFG-MSGOUT-UBX_MON_MSGPP_UART1", 0x20910197, "U1", 1, "",
  879. "Output rate of the UBX-MON-MSGPP message on port UART1"),
  880. ("CFG-MSGOUT-UBX_MON_MSGPP_UART2", 0x20910198, "U1", 1, "",
  881. "Output rate of the UBX-MON-MSGPP message on port UART2"),
  882. ("CFG-MSGOUT-UBX_MON_MSGPP_USB", 0x20910199, "U1", 1, "",
  883. "Output rate of the UBX-MON-MSGPP message on port USB"),
  884. ("CFG-MSGOUT-UBX_MON_RF_I2C", 0x20910359, "U1", 1, "",
  885. "Output rate of the UBX-MON-RF message on port I2C"),
  886. ("CFG-MSGOUT-UBX_MON_RF_SPI", 0x2091035d, "U1", 1, "",
  887. "Output rate of the UBX-MON-RF message on port SPI"),
  888. ("CFG-MSGOUT-UBX_MON_RF_UART1", 0x2091035a, "U1", 1, "",
  889. "Output rate of the UBX-MON-RF message on port UART1"),
  890. ("CFG-MSGOUT-UBX_MON_RF_UART2", 0x2091035b, "U1", 1, "",
  891. "Output rate of the UBX-MON-RF message on port UART2"),
  892. ("CFG-MSGOUT-UBX_MON_RF_USB", 0x2091035c, "U1", 1, "",
  893. "Output rate of the UBX-MON-RF message on port USB"),
  894. ("CFG-MSGOUT-UBX_NAV_TIMEQZSS_I2C", 0x20910386, "U1", 1, "",
  895. "Output rate of the UBX-NAV-TIMEQZSS message on port I2C"),
  896. ("CFG-MSGOUT-UBX_NAV_TIMEQZSS_SPI", 0x2091038a, "U1", 1, "",
  897. "Output rate of the UBX-NAV-TIMEQZSS message on port SPI"),
  898. ("CFG-MSGOUT-UBX_NAV_TIMEQZSS_USB", 0x20910387, "U1", 1, "",
  899. "Output rate of the UBX-NAV-TIMEQZSS message on port USB"),
  900. ("CFG-MSGOUT-UBX_NAV_TIMEQZSS_UART1", 0x20910388, "U1", 1, "",
  901. "Output rate of the UBX-NAV-TIMEQZSS message on port UART1"),
  902. ("CFG-MSGOUT-UBX_NAV_TIMEQZSS_UART2", 0x20910389, "U1", 1, "",
  903. "Output rate of the UBX-NAV-TIMEQZSS message on port UART2"),
  904. ("CFG-MSGOUT-UBX_MON_RXBUF_I2C", 0x209101a0, "U1", 1, "",
  905. "Output rate of the UBX-MON-RXBUF message on port I2C"),
  906. ("CFG-MSGOUT-UBX_MON_RXBUF_SPI", 0x209101a4, "U1", 1, "",
  907. "Output rate of the UBX-MON-RXBUF message on port SPI"),
  908. ("CFG-MSGOUT-UBX_MON_RXBUF_UART1", 0x209101a1, "U1", 1, "",
  909. "Output rate of the UBX-MON-RXBUF message on port UART1"),
  910. ("CFG-MSGOUT-UBX_MON_RXBUF_UART2", 0x209101a2, "U1", 1, "",
  911. "Output rate of the UBX-MON-RXBUF message on port UART2"),
  912. ("CFG-MSGOUT-UBX_MON_RXBUF_USB", 0x209101a3, "U1", 1, "",
  913. "Output rate of the UBX-MON-RXBUF message on port USB"),
  914. ("CFG-MSGOUT-UBX_MON_RXR_I2C", 0x20910187, "U1", 1, "",
  915. "Output rate of the UBX-MON-RXR message on port I2C"),
  916. ("CFG-MSGOUT-UBX_MON_RXR_SPI", 0x2091018b, "U1", 1, "",
  917. "Output rate of the UBX-MON-RXR message on port SPI"),
  918. ("CFG-MSGOUT-UBX_MON_RXR_UART1", 0x20910188, "U1", 1, "",
  919. "Output rate of the UBX-MON-RXR message on port UART1"),
  920. ("CFG-MSGOUT-UBX_MON_RXR_UART2", 0x20910189, "U1", 1, "",
  921. "Output rate of the UBX-MON-RXR message on port UART2"),
  922. ("CFG-MSGOUT-UBX_MON_RXR_USB", 0x2091018a, "U1", 1, "",
  923. "Output rate of the UBX-MON-RXR message on port USB"),
  924. ("CFG-MSGOUT-UBX_MON_SPAN_I2C", 0x2091038b, "U1", 1, "",
  925. "Output rate of the UBX-MON-SPAN message on port I2C"),
  926. ("CFG-MSGOUT-UBX_MON_SPAN_SPI", 0x2091038f, "U1", 1, "",
  927. "Output rate of the UBX-MON-SPAN message on port SPI"),
  928. ("CFG-MSGOUT-UBX_MON_SPAN_UART1", 0x2091038c, "U1", 1, "",
  929. "Output rate of the UBX-MON-SPAN message on port UART1"),
  930. ("CFG-MSGOUT-UBX_MON_SPAN_UART2", 0x2091038d, "U1", 1, "",
  931. "Output rate of the UBX-MON-SPAN message on port UART2"),
  932. ("CFG-MSGOUT-UBX_MON_SPAN_USB", 0x2091038e, "U1", 1, "",
  933. "Output rate of the UBX-MON-SPAN message on port USB"),
  934. ("CFG-MSGOUT-UBX_MON_TXBUF_I2C", 0x2091019b, "U1", 1, "",
  935. "Output rate of the UBX-MON-TXBUF message on port I2C"),
  936. ("CFG-MSGOUT-UBX_MON_TXBUF_SPI", 0x2091019f, "U1", 1, "",
  937. "Output rate of the UBX-MON-TXBUF message on port SPI"),
  938. ("CFG-MSGOUT-UBX_MON_TXBUF_UART1", 0x2091019c, "U1", 1, "",
  939. "Output rate of the UBX-MON-TXBUF message on port UART1"),
  940. ("CFG-MSGOUT-UBX_MON_TXBUF_UART2", 0x2091019d, "U1", 1, "",
  941. "Output rate of the UBX-MON-TXBUF message on port UART2"),
  942. ("CFG-MSGOUT-UBX_MON_TXBUF_USB", 0x2091019e, "U1", 1, "",
  943. "Output rate of the UBX-MON-TXBUF message on port USB"),
  944. ("CFG-MSGOUT-UBX_NAV_AOPSTATUS_I2C", 0x20910079, "U1", 1, "",
  945. "Output rate of the UBX-MON-AOPSTATUS message on port I2C"),
  946. ("CFG-MSGOUT-UBX_NAV_AOPSTATUS_SPI", 0x2091007d, "U1", 1, "",
  947. "Output rate of the UBX-MON-AOPSTATUS message on port SPI"),
  948. ("CFG-MSGOUT-UBX_NAV_AOPSTATUS_UART1", 0x2091007a, "U1", 1, "",
  949. "Output rate of the UBX-MON-AOPSTATUS message on port UART1"),
  950. ("CFG-MSGOUT-UBX_NAV_AOPSTATUS_UART2", 0x2091007b, "U1", 1, "",
  951. "Output rate of the UBX-MON-AOPSTATUS message on port UART2"),
  952. ("CFG-MSGOUT-UBX_NAV_AOPSTATUS_USB", 0x2091007c, "U1", 1, "",
  953. "Output rate of the UBX-MON-AOPSTATUS message on port USB"),
  954. ("CFG-MSGOUT-UBX_MON_TXBUF_I2C", 0x2091019b, "U1", 1, "",
  955. "Output rate of the UBX-MON-TXBUF message on port I2C"),
  956. ("CFG-MSGOUT-UBX_MON_TXBUF_SPI", 0x2091019f, "U1", 1, "",
  957. "Output rate of the UBX-MON-TXBUF message on port SPI"),
  958. ("CFG-MSGOUT-UBX_MON_TXBUF_UART1", 0x2091019c, "U1", 1, "",
  959. "Output rate of the UBX-MON-TXBUF message on port UART1"),
  960. ("CFG-MSGOUT-UBX_MON_TXBUF_UART2", 0x2091019d, "U1", 1, "",
  961. "Output rate of the UBX-MON-TXBUF message on port UART2"),
  962. ("CFG-MSGOUT-UBX_MON_TXBUF_USB", 0x2091019e, "U1", 1, "",
  963. "Output rate of the UBX-MON-TXBUF message on port USB"),
  964. # CFG-MSGOUT-UBX_NAV
  965. ("CFG-MSGOUT-UBX_NAV_CLOCK_I2C", 0x20910065, "U1", 1, "",
  966. "Output rate of the UBX-NAV-CLOCK message on port I2C"),
  967. ("CFG-MSGOUT-UBX_NAV_CLOCK_SPI", 0x20910069, "U1", 1, "",
  968. "Output rate of the UBX-NAV-CLOCK message on port SPI"),
  969. ("CFG-MSGOUT-UBX_NAV_CLOCK_UART1", 0x20910066, "U1", 1, "",
  970. "Output rate of the UBX-NAV-CLOCK message on port UART1"),
  971. ("CFG-MSGOUT-UBX_NAV_CLOCK_UART2", 0x20910067, "U1", 1, "",
  972. "Output rate of the UBX-NAV-CLOCK message on port UART2"),
  973. ("CFG-MSGOUT-UBX_NAV_CLOCK_USB", 0x20910068, "U1", 1, "",
  974. "Output rate of the UBX-NAV- CLOCK message on port USB"),
  975. ("CFG-MSGOUT-UBX_NAV_DOP_I2C", 0x20910038, "U1", 1, "",
  976. "Output rate of the UBX-NAV-DOP message on port I2C"),
  977. ("CFG-MSGOUT-UBX_NAV_DOP_SPI", 0x2091003c, "U1", 1, "",
  978. "Output rate of the UBX-NAV-DOP message on port SPI"),
  979. ("CFG-MSGOUT-UBX_NAV_DOP_UART1", 0x20910039, "U1", 1, "",
  980. "Output rate of the UBX-NAV-DOP message on port UART1"),
  981. ("CFG-MSGOUT-UBX_NAV_DOP_UART2", 0x2091003a, "U1", 1, "",
  982. "Output rate of the UBX-NAV-DOP message on port UART2"),
  983. ("CFG-MSGOUT-UBX_NAV_DOP_USB", 0x2091003b, "U1", 1, "",
  984. "Output rate of the UBX-NAV-DOP message on port USB"),
  985. ("CFG-MSGOUT-UBX_NAV_EOE_I2C", 0x2091015f, "U1", 1, "",
  986. "Output rate of the UBX-NAV-EOE message on port I2C"),
  987. ("CFG-MSGOUT-UBX_NAV_EOE_SPI", 0x20910163, "U1", 1, "",
  988. "Output rate of the UBX-NAV-EOE message on port SPI"),
  989. ("CFG-MSGOUT-UBX_NAV_EOE_UART1", 0x20910160, "U1", 1, "",
  990. "Output rate of the UBX-NAV-EOE message on port UART1"),
  991. ("CFG-MSGOUT-UBX_NAV_EOE_UART2", 0x20910161, "U1", 1, "",
  992. "Output rate of the UBX-NAV-EOE message on port UART2"),
  993. ("CFG-MSGOUT-UBX_NAV_EOE_USB", 0x20910162, "U1", 1, "",
  994. "Output rate of the UBX-NAV-EOE message on port USB"),
  995. ("CFG-MSGOUT-UBX_NAV_GEOFENCE_I2C", 0x209100a1, "U1", 1, "",
  996. "Output rate of the UBX-NAV-GEOFENCE message on port I2C"),
  997. ("CFG-MSGOUT-UBX_NAV_GEOFENCE_SPI", 0x209100a5, "U1", 1, "",
  998. "Output rate of the UBX-NAV-GEOFENCE message on port SPI"),
  999. ("CFG-MSGOUT-UBX_NAV_GEOFENCE_UART1", 0x209100a2, "U1", 1, "",
  1000. "Output rate of the UBX-NAV-GEOFENCE message on port UART1"),
  1001. ("CFG-MSGOUT-UBX_NAV_GEOFENCE_UART2", 0x209100a3, "U1", 1, "",
  1002. "Output rate of the UBX-NAV-GEOFENCE message on port UART2"),
  1003. ("CFG-MSGOUT-UBX_NAV_GEOFENCE_USB", 0x209100a4, "U1", 1, "",
  1004. "Output rate of the UBX-NAV- GEOFENCE message on port USB"),
  1005. ("CFG-MSGOUT-UBX_NAV_HPPOSECEF_I2C", 0x2091002e, "U1", 1, "",
  1006. "Output rate of the UBX-NAV-HPPOSECEF message on port I2C"),
  1007. ("CFG-MSGOUT-UBX_NAV_HPPOSECEF_SPI", 0x20910032, "U1", 1, "",
  1008. "Output rate of the UBX-NAV-HPPOSECEF message on port SPI"),
  1009. ("CFG-MSGOUT-UBX_NAV_HPPOSECEF_UART1", 0x2091002f, "U1", 1, "",
  1010. "Output rate of the UBX-NAV-HPPOSECEF message on port UART1"),
  1011. ("CFG-MSGOUT-UBX_NAV_HPPOSECEF_UART2", 0x20910030, "U1", 1, "",
  1012. "Output rate of the UBX-NAV-HPPOSECEF message on port UART2"),
  1013. ("CFG-MSGOUT-UBX_NAV_HPPOSECEF_USB", 0x20910031, "U1", 1, "",
  1014. "Output rate of the UBX-NAV-HPPOSECEF message on port USB"),
  1015. ("CFG-MSGOUT-UBX_NAV_HPPOSLLH_I2C", 0x20910033, "U1", 1, "",
  1016. "Output rate of the UBX-NAV-HPPOSLLH message on port I2C"),
  1017. ("CFG-MSGOUT-UBX_NAV_HPPOSLLH_SPI", 0x20910037, "U1", 1, "",
  1018. "Output rate of the UBX-NAV-HPPOSLLH message on port SPI"),
  1019. ("CFG-MSGOUT-UBX_NAV_HPPOSLLH_UART1", 0x20910034, "U1", 1, "",
  1020. "Output rate of the UBX-NAV-HPPOSLLH message on port UART1"),
  1021. ("CFG-MSGOUT-UBX_NAV_HPPOSLLH_UART2", 0x20910035, "U1", 1, "",
  1022. "Output rate of the UBX-NAV-HPPOSLLH message on port UART2"),
  1023. ("CFG-MSGOUT-UBX_NAV_HPPOSLLH_USB", 0x20910036, "U1", 1, "",
  1024. "Output rate of the UBX-NAV-HPPOSLLH message on port USB"),
  1025. ("CFG-MSGOUT-UBX_NAV_ODO_I2C", 0x2091007e, "U1", 1, "",
  1026. "Output rate of the UBX-NAV-ODO message on port I2C"),
  1027. ("CFG-MSGOUT-UBX_NAV_ODO_SPI", 0x20910082, "U1", 1, "",
  1028. "Output rate of the UBX-NAV-ODO message on port SPI"),
  1029. ("CFG-MSGOUT-UBX_NAV_ODO_UART1", 0x2091007f, "U1", 1, "",
  1030. "Output rate of the UBX-NAV-ODO message on port UART1"),
  1031. ("CFG-MSGOUT-UBX_NAV_ODO_UART2", 0x20910080, "U1", 1, "",
  1032. "Output rate of the UBX-NAV-ODO message on port UART2"),
  1033. ("CFG-MSGOUT-UBX_NAV_ODO_USB", 0x20910081, "U1", 1, "",
  1034. "Output rate of the UBX-NAV-ODO message on port USB"),
  1035. ("CFG-MSGOUT-UBX_NAV_ORB_I2C", 0x20910010, "U1", 1, "",
  1036. "Output rate of the UBX-NAV-ORB message on port I2C"),
  1037. ("CFG-MSGOUT-UBX_NAV_ORB_SPI", 0x20910014, "U1", 1, "",
  1038. "Output rate of the UBX-NAV-ORB message on port SPI"),
  1039. ("CFG-MSGOUT-UBX_NAV_ORB_UART1", 0x20910011, "U1", 1, "",
  1040. "Output rate of the UBX-NAV-ORB message on port UART1"),
  1041. ("CFG-MSGOUT-UBX_NAV_ORB_UART2", 0x20910012, "U1", 1, "",
  1042. "Output rate of the UBX-NAV-ORB message on port UART2"),
  1043. ("CFG-MSGOUT-UBX_NAV_ORB_USB", 0x20910013, "U1", 1, "",
  1044. "Output rate of the UBX-NAV-ORB message on port USB"),
  1045. ("CFG-MSGOUT-UBX_NAV_POSECEF_I2C", 0x20910024, "U1", 1, "",
  1046. "Output rate of the UBX-NAV-POSECEF message on port I2C"),
  1047. ("CFG-MSGOUT-UBX_NAV_POSECEF_SPI", 0x20910028, "U1", 1, "",
  1048. "Output rate of the UBX-NAV-POSECEF message on port SPI"),
  1049. ("CFG-MSGOUT-UBX_NAV_POSECEF_UART1", 0x20910025, "U1", 1, "",
  1050. "Output rate of the UBX-NAV-POSECEF message on port UART1"),
  1051. ("CFG-MSGOUT-UBX_NAV_POSECEF_UART2", 0x20910026, "U1", 1, "",
  1052. "Output rate of the UBX-NAV-POSECEF message on port UART2"),
  1053. ("CFG-MSGOUT-UBX_NAV_POSECEF_USB", 0x20910027, "U1", 1, "",
  1054. "Output rate of the UBX-NAV-POSECEF message on port USB"),
  1055. ("CFG-MSGOUT-UBX_NAV_POSLLH_I2C", 0x20910029, "U1", 1, "",
  1056. "Output rate of the UBX-NAV-POSLLH message on port I2C"),
  1057. ("CFG-MSGOUT-UBX_NAV_POSLLH_SPI", 0x2091002d, "U1", 1, "",
  1058. "Output rate of the UBX-NAV-POSLLH message on port SPI"),
  1059. ("CFG-MSGOUT-UBX_NAV_POSLLH_UART1", 0x2091002a, "U1", 1, "",
  1060. "Output rate of the UBX-NAV-POSLLH message on port UART1"),
  1061. ("CFG-MSGOUT-UBX_NAV_POSLLH_UART2", 0x2091002b, "U1", 1, "",
  1062. "Output rate of the UBX-NAV-POSLLH message on port UART2"),
  1063. ("CFG-MSGOUT-UBX_NAV_POSLLH_USB", 0x2091002c, "U1", 1, "",
  1064. "Output rate of the UBX-NAV-POSLLH message on port USB"),
  1065. ("CFG-MSGOUT-UBX_NAV_PVT_I2C", 0x20910006, "U1", 1, "",
  1066. "Output rate of the UBX-NAV-PVT message on port I2C"),
  1067. ("CFG-MSGOUT-UBX_NAV_PVT_SPI", 0x2091000a, "U1", 1, "",
  1068. "Output rate of the UBX-NAV-PVT message on port SPI"),
  1069. ("CFG-MSGOUT-UBX_NAV_PVT_UART1", 0x20910007, "U1", 1, "",
  1070. "Output rate of the UBX-NAV-PVT message on port UART1"),
  1071. ("CFG-MSGOUT-UBX_NAV_PVT_UART2", 0x20910008, "U1", 1, "",
  1072. "Output rate of the UBX-NAV-PVT message on port UART2"),
  1073. ("CFG-MSGOUT-UBX_NAV_PVT_USB", 0x20910009, "U1", 1, "",
  1074. "Output rate of the UBX-NAV-PVT message on port USB"),
  1075. ("CFG-MSGOUT-UBX_NAV_RELPOSNED_I2C", 0x2091008d, "U1", 1, "",
  1076. "Output rate of the UBX-NAV-RELPOSNED message on port I2C"),
  1077. ("CFG-MSGOUT-UBX_NAV_RELPOSNED_SPI", 0x20910091, "U1", 1, "",
  1078. "Output rate of the UBX-NAV-RELPOSNED message on port SPI"),
  1079. ("CFG-MSGOUT-UBX_NAV_RELPOSNED_UART1", 0x2091008e, "U1", 1, "",
  1080. "Output rate of the UBX-NAV-RELPOSNED message on port UART1"),
  1081. ("CFG-MSGOUT-UBX_NAV_RELPOSNED_UART2", 0x2091008f, "U1", 1, "",
  1082. "Output rate of the UBX-NAV-RELPOSNED message on port UART2"),
  1083. ("CFG-MSGOUT-UBX_NAV_RELPOSNED_USB", 0x20910090, "U1", 1, "",
  1084. "Output rate of the UBX-NAV-RELPOSNED message on port USB"),
  1085. ("CFG-MSGOUT-UBX_NAV_SAT_I2C", 0x20910015, "U1", 1, "",
  1086. "Output rate of the UBX-NAV-SAT message on port I2C"),
  1087. ("CFG-MSGOUT-UBX_NAV_SAT_SPI", 0x20910019, "U1", 1, "",
  1088. "Output rate of the UBX-NAV-SAT message on port SPI"),
  1089. ("CFG-MSGOUT-UBX_NAV_SAT_UART1", 0x20910016, "U1", 1, "",
  1090. "Output rate of the UBX-NAV-SAT message on port UART1"),
  1091. ("CFG-MSGOUT-UBX_NAV_SAT_UART2", 0x20910017, "U1", 1, "",
  1092. "Output rate of the UBX-NAV-SAT message on port UART2"),
  1093. ("CFG-MSGOUT-UBX_NAV_SAT_USB", 0x20910018, "U1", 1, "",
  1094. "Output rate of the UBX-NAV-SAT message on port USB"),
  1095. ("CFG-MSGOUT-UBX_NAV_SBAS_I2C", 0x2091006a, "U1", 1, "",
  1096. "Output rate of the UBX-NAV-SBAS message on port I2C"),
  1097. ("CFG-MSGOUT-UBX_NAV_SBAS_SPI", 0x2091006e, "U1", 1, "",
  1098. "Output rate of the UBX-NAV-SBAS message on port SPI"),
  1099. ("CFG-MSGOUT-UBX_NAV_SBAS_UART1", 0x2091006b, "U1", 1, "",
  1100. "Output rate of the UBX-NAV-SBAS message on port UART1"),
  1101. ("CFG-MSGOUT-UBX_NAV_SBAS_UART2", 0x2091006c, "U1", 1, "",
  1102. "Output rate of the UBX-NAV-SBAS message on port UART2"),
  1103. ("CFG-MSGOUT-UBX_NAV_SBAS_USB", 0x2091006d, "U1", 1, "",
  1104. "Output rate of the UBX-NAV-SBAS message on port USB"),
  1105. ("CFG-MSGOUT-UBX_NAV_SIG_I2C", 0x20910345, "U1", 1, "",
  1106. "Output rate of the UBX-NAV-SIG message on port I2C"),
  1107. ("CFG-MSGOUT-UBX_NAV_SIG_SPI", 0x20910349, "U1", 1, "",
  1108. "Output rate of the UBX-NAV-SIG message on port SPI"),
  1109. ("CFG-MSGOUT-UBX_NAV_SIG_UART1", 0x20910346, "U1", 1, "",
  1110. "Output rate of the UBX-NAV-SIG message on port UART1"),
  1111. ("CFG-MSGOUT-UBX_NAV_SIG_UART2", 0x20910347, "U1", 1, "",
  1112. "Output rate of the UBX-NAV-SIG message on port UART2"),
  1113. ("CFG-MSGOUT-UBX_NAV_SIG_USB", 0x20910348, "U1", 1, "",
  1114. "Output rate of the UBX-NAV-SIG message on port USB"),
  1115. ("CFG-MSGOUT-UBX_NAV_SLAS_I2C", 0x20910336, "U1", 1, "",
  1116. "Output rate of the UBX-NAV-SLAS message on port I2C"),
  1117. ("CFG-MSGOUT-UBX_NAV_SLAS_SPI", 0x2091033a, "U1", 1, "",
  1118. "Output rate of the UBX-NAV-SLAS message on port SPI"),
  1119. ("CFG-MSGOUT-UBX_NAV_SLAS_UART1", 0x20910338, "U1", 1, "",
  1120. "Output rate of the UBX-NAV-SLAS message on port UART1"),
  1121. ("CFG-MSGOUT-UBX_NAV_SLAS_UART2", 0x20910339, "U1", 1, "",
  1122. "Output rate of the UBX-NAV-SLAS message on port UART2"),
  1123. ("CFG-MSGOUT-UBX_NAV_SLAS_USB", 0x20910348, "U1", 1, "",
  1124. "Output rate of the UBX-NAV-SLAS message on port USB"),
  1125. ("CFG-MSGOUT-UBX_NAV_STATUS_I2C", 0x2091001a, "U1", 1, "",
  1126. "Output rate of the UBX-NAV-STATUS message on port I2C"),
  1127. ("CFG-MSGOUT-UBX_NAV_STATUS_SPI", 0x2091001e, "U1", 1, "",
  1128. "Output rate of the UBX-NAV-STATUS message on port SPI"),
  1129. ("CFG-MSGOUT-UBX_NAV_STATUS_UART1", 0x2091001b, "U1", 1, "",
  1130. "Output rate of the UBX-NAV-STATUS message on port UART1"),
  1131. ("CFG-MSGOUT-UBX_NAV_STATUS_UART2", 0x2091001c, "U1", 1, "",
  1132. "Output rate of the UBX-NAV-STATUS message on port UART2"),
  1133. ("CFG-MSGOUT-UBX_NAV_STATUS_USB", 0x2091001d, "U1", 1, "",
  1134. "Output rate of the UBX-NAV-STATUS message on port USB"),
  1135. ("CFG-MSGOUT-UBX_NAV_SVIN_I2C", 0x20910088, "U1", 1, "",
  1136. "Output rate of the UBX-NAV-SVIN message on port I2C"),
  1137. ("CFG-MSGOUT-UBX_NAV_SVIN_SPI", 0x2091008c, "U1", 1, "",
  1138. "Output rate of the UBX-NAV-SVIN message on port SPI"),
  1139. ("CFG-MSGOUT-UBX_NAV_SVIN_UART1", 0x20910089, "U1", 1, "",
  1140. "Output rate of the UBX-NAV-SVIN message on port UART1"),
  1141. ("CFG-MSGOUT-UBX_NAV_SVIN_UART2", 0x2091008a, "U1", 1, "",
  1142. "Output rate of the UBX-NAV-SVIN message on port UART2"),
  1143. ("CFG-MSGOUT-UBX_NAV_SVIN_USB", 0x2091008b, "U1", 1, "",
  1144. "Output rate of the UBX-NAV-SVIN message on port USB"),
  1145. ("CFG-MSGOUT-UBX_NAV_TIMEBDS_I2C", 0x20910051, "U1", 1, "",
  1146. "Output rate of the UBX-NAV-TIMEBDS message on port I2C"),
  1147. ("CFG-MSGOUT-UBX_NAV_TIMEBDS_SPI", 0x20910055, "U1", 1, "",
  1148. "Output rate of the UBX-NAV-TIMEBDS message on port SPI"),
  1149. ("CFG-MSGOUT-UBX_NAV_TIMEBDS_UART1", 0x20910052, "U1", 1, "",
  1150. "Output rate of the UBX-NAV-TIMEBDS message on port UART1"),
  1151. ("CFG-MSGOUT-UBX_NAV_TIMEBDS_UART2", 0x20910053, "U1", 1, "",
  1152. "Output rate of the UBX-NAV-TIMEBDS message on port UART2"),
  1153. ("CFG-MSGOUT-UBX_NAV_TIMEBDS_USB", 0x20910054, "U1", 1, "",
  1154. "Output rate of the UBX-NAV-TIMEBDS message on port USB"),
  1155. ("CFG-MSGOUT-UBX_NAV_TIMEGAL_I2C", 0x20910056, "U1", 1, "",
  1156. "Output rate of the UBX-NAV-TIMEGAL message on port I2C"),
  1157. ("CFG-MSGOUT-UBX_NAV_TIMEGAL_SPI", 0x2091005a, "U1", 1, "",
  1158. "Output rate of the UBX-NAV-TIMEGAL message on port SPI"),
  1159. ("CFG-MSGOUT-UBX_NAV_TIMEGAL_UART1", 0x20910057, "U1", 1, "",
  1160. "Output rate of the UBX-NAV-TIMEGAL message on port UART1"),
  1161. ("CFG-MSGOUT-UBX_NAV_TIMEGAL_UART2", 0x20910058, "U1", 1, "",
  1162. "Output rate of the UBX-NAV-TIMEGAL message on port UART2"),
  1163. ("CFG-MSGOUT-UBX_NAV_TIMEGAL_USB", 0x20910059, "U1", 1, "",
  1164. "Output rate of the UBX-NAV-TIMEGAL message on port USB"),
  1165. ("CFG-MSGOUT-UBX_NAV_TIMEGLO_I2C", 0x2091004c, "U1", 1, "",
  1166. "Output rate of the UBX-NAV-TIMEGLO message on port I2C"),
  1167. ("CFG-MSGOUT-UBX_NAV_TIMEGLO_SPI", 0x20910050, "U1", 1, "",
  1168. "Output rate of the UBX-NAV-TIMEGLO message on port SPI"),
  1169. ("CFG-MSGOUT-UBX_NAV_TIMEGLO_UART1", 0x2091004d, "U1", 1, "",
  1170. "Output rate of the UBX-NAV-TIMEGLO message on port UART1"),
  1171. ("CFG-MSGOUT-UBX_NAV_TIMEGLO_UART2", 0x2091004e, "U1", 1, "",
  1172. "Output rate of the UBX-NAV-TIMEGLO message on port UART2"),
  1173. ("CFG-MSGOUT-UBX_NAV_TIMEGLO_USB", 0x2091004f, "U1", 1, "",
  1174. "Output rate of the UBX-NAV-TIMEGLO message on port USB"),
  1175. ("CFG-MSGOUT-UBX_NAV_TIMEGPS_I2C", 0x20910047, "U1", 1, "",
  1176. "Output rate of the UBX-NAV-TIMEGPS message on port I2C"),
  1177. ("CFG-MSGOUT-UBX_NAV_TIMEGPS_SPI", 0x2091004b, "U1", 1, "",
  1178. "Output rate of the UBX-NAV-TIMEGPS message on port SPI"),
  1179. ("CFG-MSGOUT-UBX_NAV_TIMEGPS_UART1", 0x20910048, "U1", 1, "",
  1180. "Output rate of the UBX-NAV-TIMEGPS message on port UART1"),
  1181. ("CFG-MSGOUT-UBX_NAV_TIMEGPS_UART2", 0x20910049, "U1", 1, "",
  1182. "Output rate of the UBX-NAV-TIMEGPS message on port UART2"),
  1183. ("CFG-MSGOUT-UBX_NAV_TIMEGPS_USB", 0x2091004a, "U1", 1, "",
  1184. "Output rate of the UBX-NAV-TIMEGPS message on port USB"),
  1185. ("CFG-MSGOUT-UBX_NAV_TIMELS_I2C", 0x20910060, "U1", 1, "",
  1186. "Output rate of the UBX-NAV-TIMELS message on port I2C"),
  1187. ("CFG-MSGOUT-UBX_NAV_TIMELS_SPI", 0x20910064, "U1", 1, "",
  1188. "Output rate of the UBX-NAV-TIMELS message on port SPI"),
  1189. ("CFG-MSGOUT-UBX_NAV_TIMELS_UART1", 0x20910061, "U1", 1, "",
  1190. "Output rate of the UBX-NAV-TIMELS message on port UART1"),
  1191. ("CFG-MSGOUT-UBX_NAV_TIMELS_UART2", 0x20910062, "U1", 1, "",
  1192. "Output rate of the UBX-NAV-TIMELS message on port UART2"),
  1193. ("CFG-MSGOUT-UBX_NAV_TIMELS_USB", 0x20910063, "U1", 1, "",
  1194. "Output rate of the UBX-NAV-TIMELS message on port USB"),
  1195. ("CFG-MSGOUT-UBX_NAV_TIMEUTC_I2C", 0x2091005b, "U1", 1, "",
  1196. "Output rate of the UBX-NAV-TIMEUTC message on port I2C"),
  1197. ("CFG-MSGOUT-UBX_NAV_TIMEUTC_SPI", 0x2091005f, "U1", 1, "",
  1198. "Output rate of the UBX-NAV-TIMEUTC message on port S"),
  1199. ("CFG-MSGOUT-UBX_NAV_TIMEUTC_UART1", 0x2091005c, "U1", 1, "",
  1200. "Output rate of the UBX-NAV-TIMEUTC message on port UART1"),
  1201. ("CFG-MSGOUT-UBX_NAV_TIMEUTC_UART2", 0x2091005d, "U1", 1, "",
  1202. "Output rate of the UBX-NAV-TIMEUTC message on port UART2"),
  1203. ("CFG-MSGOUT-UBX_NAV_TIMEUTC_USB", 0x2091005e, "U1", 1, "",
  1204. "Output rate of the UBX-NAV- TIMEUTC message on port USB"),
  1205. ("CFG-MSGOUT-UBX_NAV_VELECEF_I2C", 0x2091003d, "U1", 1, "",
  1206. "Output rate of the UBX-NAV-VELECEF message on port I2C"),
  1207. ("CFG-MSGOUT-UBX_NAV_VELECEF_SPI", 0x20910041, "U1", 1, "",
  1208. "Output rate of the UBX-NAV-VELECEF message on port SPI"),
  1209. ("CFG-MSGOUT-UBX_NAV_VELECEF_UART1", 0x2091003e, "U1", 1, "",
  1210. "Output rate of the UBX-NAV-VELECEF message on port UART1"),
  1211. ("CFG-MSGOUT-UBX_NAV_VELECEF_UART2", 0x2091003f, "U1", 1, "",
  1212. "Output rate of the UBX-NAV-VELECEF message on port UART2"),
  1213. ("CFG-MSGOUT-UBX_NAV_VELECEF_USB", 0x20910040, "U1", 1, "",
  1214. "Output rate of the UBX-NAV-VELECEF message on port USB"),
  1215. ("CFG-MSGOUT-UBX_NAV_VELNED_I2C", 0x20910042, "U1", 1, "",
  1216. "Output rate of the UBX-NAV-VELNED message on port I2C"),
  1217. ("CFG-MSGOUT-UBX_NAV_VELNED_SPI", 0x20910046, "U1", 1, "",
  1218. "Output rate of the UBX-NAV-VELNED message on port SPI"),
  1219. ("CFG-MSGOUT-UBX_NAV_VELNED_UART1", 0x20910043, "U1", 1, "",
  1220. "Output rate of the UBX-NAV-VELNED message on port UART1"),
  1221. ("CFG-MSGOUT-UBX_NAV_VELNED_UART2", 0x20910044, "U1", 1, "",
  1222. "Output rate of the UBX-NAV-VELNED message on port UART2"),
  1223. ("CFG-MSGOUT-UBX_NAV_VELNED_USB", 0x20910045, "U1", 1, "",
  1224. "Output rate of the UBX-NAV-VELNED message on port USB"),
  1225. # CFG-MSGOUT-UBX_RXM
  1226. ("CFG-MSGOUT-UBX_RXM_MEASX_I2C", 0x20910204, "U1", 1, "",
  1227. "Output rate of the UBX-RXM-MEASX message on port I2C"),
  1228. ("CFG-MSGOUT-UBX_RXM_MEASX_SPI", 0x20910208, "U1", 1, "",
  1229. "Output rate of the UBX-RXM-MEASX message on port SPI"),
  1230. ("CFG-MSGOUT-UBX_RXM_MEASX_UART1", 0x20910205, "U1", 1, "",
  1231. "Output rate of the UBX-RXM-MEASX message on port UART1"),
  1232. ("CFG-MSGOUT-UBX_RXM_MEASX_UART2", 0x20910206, "U1", 1, "",
  1233. "Output rate of the UBX-RXM-MEASX message on port UART2"),
  1234. ("CFG-MSGOUT-UBX_RXM_MEASX_USB", 0x20910207, "U1", 1, "",
  1235. "Output rate of the UBX-RXM-MEASX message on port USB"),
  1236. ("CFG-MSGOUT-UBX_RXM_RAWX_I2C", 0x209102a4, "U1", 1, "",
  1237. "Output rate of the UBX-RXM-RAWX message on port I2C"),
  1238. ("CFG-MSGOUT-UBX_RXM_RAWX_SPI", 0x209102a8, "U1", 1, "",
  1239. "Output rate of the UBX-RXM-RAWX message on port SPI"),
  1240. ("CFG-MSGOUT-UBX_RXM_RAWX_UART1", 0x209102a5, "U1", 1, "",
  1241. "Output rate of the UBX-RXM-RAWX message on port UART1"),
  1242. ("CFG-MSGOUT-UBX_RXM_RAWX_UART2", 0x209102a6, "U1", 1, "",
  1243. "Output rate of the UBX-RXM-RAWX message on port UART2"),
  1244. ("CFG-MSGOUT-UBX_RXM_RAWX_USB", 0x209102a7, "U1", 1, "",
  1245. "Output rate of the UBX-RXM-RAWX message on port USB"),
  1246. ("CFG-MSGOUT-UBX_RXM_RLM_I2C", 0x2091025e, "U1", 1, "",
  1247. "Output rate of the UBX-RXM-RLM message on port I2C"),
  1248. ("CFG-MSGOUT-UBX_RXM_RLM_SPI", 0x20910262, "U1", 1, "",
  1249. "Output rate of the UBX-RXM-RLM message on port SPI"),
  1250. ("CFG-MSGOUT-UBX_RXM_RLM_UART1", 0x2091025f, "U1", 1, "",
  1251. "Output rate of the UBX-RXM-RLM message on port UART1"),
  1252. ("CFG-MSGOUT-UBX_RXM_RLM_UART2", 0x20910260, "U1", 1, "",
  1253. "Output rate of the UBX-RXM-RLM message on port UART2"),
  1254. ("CFG-MSGOUT-UBX_RXM_RLM_USB", 0x20910261, "U1", 1, "",
  1255. "Output rate of the UBX-RXM-RLM message on port USB"),
  1256. ("CFG-MSGOUT-UBX_RXM_RTCM_I2C", 0x20910268, "U1", 1, "",
  1257. "Output rate of the UBX-RXM-RTCM message on port I2C"),
  1258. ("CFG-MSGOUT-UBX_RXM_RTCM_SPI", 0x2091026c, "U1", 1, "",
  1259. "Output rate of the UBX-RXM-RTCM message on port SPI"),
  1260. ("CFG-MSGOUT-UBX_RXM_RTCM_UART1", 0x20910269, "U1", 1, "",
  1261. "Output rate of the UBX-RXM-RTCM message on port UART1"),
  1262. ("CFG-MSGOUT-UBX_RXM_RTCM_UART2", 0x2091026a, "U1", 1, "",
  1263. "Output rate of the UBX-RXM-RTCM message on port UART2"),
  1264. ("CFG-MSGOUT-UBX_RXM_RTCM_USB", 0x2091026b, "U1", 1, "",
  1265. "Output rate of the UBX-RXM-RTCM message on port USB"),
  1266. ("CFG-MSGOUT-UBX_RXM_SFRBX_I2C", 0x20910231, "U1", 1, "",
  1267. "Output rate of the UBX-RXM-SFRBX message on port I2C"),
  1268. ("CFG-MSGOUT-UBX_RXM_SFRBX_SPI", 0x20910235, "U1", 1, "",
  1269. "Output rate of the UBX-RXM-SFRBX message on port SPI"),
  1270. ("CFG-MSGOUT-UBX_RXM_SFRBX_UART1", 0x20910232, "U1", 1, "",
  1271. "Output rate of the UBX-RXM-SFRBX message on port UART1"),
  1272. ("CFG-MSGOUT-UBX_RXM_SFRBX_UART2", 0x20910233, "U1", 1, "",
  1273. "Output rate of the UBX-RXM-SFRBX message on port UART2"),
  1274. ("CFG-MSGOUT-UBX_RXM_SFRBX_USB", 0x20910234, "U1", 1, "",
  1275. "Output rate of the UBX-RXM-SFRBX message on port USB"),
  1276. # CFG-MSGOUT-UBX_TIM
  1277. ("CFG-MSGOUT-UBX_TIM_SVIN_I2C", 0x20910097, "U1", 1, "",
  1278. "Output rate of the UBX-TIM-SVIN message on port I2C"),
  1279. ("CFG-MSGOUT-UBX_TIM_SVIN_SPI", 0x2091009b, "U1", 1, "",
  1280. "Output rate of the UBX-TIM-SVIN message on port SPI"),
  1281. ("CFG-MSGOUT-UBX_TIM_SVIN_UART1", 0x20910098, "U1", 1, "",
  1282. "Output rate of the UBX-TIM-SVIN message on port UART1"),
  1283. ("CFG-MSGOUT-UBX_TIM_SVIN_UART2", 0x20910099, "U1", 1, "",
  1284. "Output rate of the UBX-TIM-SVIN message on port UART2"),
  1285. ("CFG-MSGOUT-UBX_TIM_SVIN_USB", 0x2091009a, "U1", 1, "",
  1286. "Output rate of the UBX-TIM-SVIN message on port USB"),
  1287. ("CFG-MSGOUT-UBX_TIM_TM2_I2C", 0x20910178, "U1", 1, "",
  1288. "Output rate of the UBX-TIM-TM2 message on port I2C"),
  1289. ("CFG-MSGOUT-UBX_TIM_TM2_SPI", 0x2091017c, "U1", 1, "",
  1290. "Output rate of the UBX-TIM-TM2 message on port SPI"),
  1291. ("CFG-MSGOUT-UBX_TIM_TM2_UART1", 0x20910179, "U1", 1, "",
  1292. "Output rate of the UBX-TIM-TM2 message on port UART1"),
  1293. ("CFG-MSGOUT-UBX_TIM_TM2_UART2", 0x2091017a, "U1", 1, "",
  1294. "Output rate of the UBX-TIM-TM2 message on port UART2"),
  1295. ("CFG-MSGOUT-UBX_TIM_TM2_USB", 0x2091017b, "U1", 1, "",
  1296. "Output rate of the UBX-TIM-TM2 message on port USB"),
  1297. ("CFG-MSGOUT-UBX_TIM_TP_I2C", 0x2091017d, "U1", 1, "",
  1298. "Output rate of the UBX-TIM-TP message on port I2C"),
  1299. ("CFG-MSGOUT-UBX_TIM_TP_SPI", 0x20910181, "U1", 1, "",
  1300. "Output rate of the UBX-TIM-TP message on port SPI"),
  1301. ("CFG-MSGOUT-UBX_TIM_TP_UART1", 0x2091017e, "U1", 1, "",
  1302. "Output rate of the UBX-TIM-TP message on port UART1"),
  1303. ("CFG-MSGOUT-UBX_TIM_TP_UART2", 0x2091017f, "U1", 1, "",
  1304. "Output rate of the UBX-TIM-TP message on port UART2"),
  1305. ("CFG-MSGOUT-UBX_TIM_TP_USB", 0x20910180, "U1", 1, "",
  1306. "Output rate of the UBX-TIM-TP message on port USB"),
  1307. ("CFG-MSGOUT-UBX_TIM_VRFY_I2C", 0x20910092, "U1", 1, "",
  1308. "Output rate of the UBX-TIM-VRFY message on port I2C"),
  1309. ("CFG-MSGOUT-UBX_TIM_VRFY_SPI", 0x20910096, "U1", 1, "",
  1310. "Output rate of the UBX-TIM-VRFY message on port SPI"),
  1311. ("CFG-MSGOUT-UBX_TIM_VRFY_UART1", 0x20910093, "U1", 1, "",
  1312. "Output rate of the UBX-TIM-VRFY message on port UART1"),
  1313. ("CFG-MSGOUT-UBX_TIM_VRFY_UART2", 0x20910094, "U1", 1, "",
  1314. "Output rate of the UBX-TIM-VRFY message on port UART2"),
  1315. ("CFG-MSGOUT-UBX_TIM_VRFY_USB", 0x20910095, "U1", 1, "",
  1316. "Output rate of the UBX-TIM-VRFY message on port USB"),
  1317. # CFG-NAVHPG-
  1318. ("CFG-NAVHPG", 0x2014ffff, "", 0, "",
  1319. "get all CFG-NAVHPG"),
  1320. ("CFG-NAVHPG-DGNSSMODE", 0x20140011, "E1", 1, "",
  1321. "Differential corrections mode"),
  1322. # CFG-NAVSPG-
  1323. ("CFG-NAVSPG", 0x2011ffff, "", 0, "",
  1324. "get all CFG-NAVSPG"),
  1325. ("CFG-NAVSPG-FIXMODE", 0x20110011, "E1", 1, "",
  1326. "Position fix mode"),
  1327. ("CFG-NAVSPG-INIFIX3D", 0x10110013, "L", 1, "",
  1328. "Initial fix must be a 3d fix"),
  1329. ("CFG-NAVSPG-WKNROLLOVER", 0x30110017, "U2", 1, "",
  1330. "GPS week rollover number"),
  1331. ("CFG-NAVSPG-USE_PPP", 0x10110019, "L", 1, "",
  1332. "Use Precise Point Positioning"),
  1333. ("CFG-NAVSPG-UTCSTANDARD", 0x2011001c, "E1", 1, "",
  1334. "UTC standard to be used"),
  1335. ("CFG-NAVSPG-DYNMODEL", 0x20110021, "E1", 1, "",
  1336. "Dynamic platform model"),
  1337. ("CFG-NAVSPG-ACKAIDING", 0x10110025, "L", 1, "",
  1338. "Acknowledge assistance input messages"),
  1339. ("CFG-NAVSPG-USE_USRDAT", 0x10110061, "L", 1, "",
  1340. "Use user geodetic datum"),
  1341. ("CFG-NAVSPG-USRDAT_MAJA", 0x50110062, "R8", 1, "m",
  1342. "Geodetic datum semi-major axis"),
  1343. ("CFG-NAVSPG-USRDAT_FLAT", 0x50110063, "R8", 1, "",
  1344. "Geodetic datum 1.0 / flattening"),
  1345. ("CFG-NAVSPG-USRDAT_DX", 0x40110064, "R4", 1, "m",
  1346. "Geodetic datum X axis shift at the origin"),
  1347. ("CFG-NAVSPG-USRDAT_DY", 0x40110065, "R4", 1, "m",
  1348. "Geodetic datum Y axis shift at the origin"),
  1349. ("CFG-NAVSPG-USRDAT_DZ", 0x40110066, "R4", 1, "m",
  1350. "Geodetic datum Z axis shift at the origin"),
  1351. ("CFG-NAVSPG-USRDAT_ROTX", 0x40110067, "R4", 1, "arcsec",
  1352. "Geodetic datum rotation about the X axis"),
  1353. ("CFG-NAVSPG-USRDAT_ROTY", 0x40110068, "R4", 1, "arcsec",
  1354. "Geodetic datum rotation about the Y axis ()"),
  1355. ("CFG-NAVSPG-USRDAT_ROTZ", 0x40110069, "R4", 1, "arcsec",
  1356. "Geodetic datum rotation about the Z axis"),
  1357. ("CFG-NAVSPG-USRDAT_SCALE", 0x4011006a, "R4", 1, "ppm",
  1358. "Geodetic datum scale factor"),
  1359. ("CFG-NAVSPG-INFIL_MINSVS", 0x201100a1, "U1", 1, "",
  1360. "Minimum number of satellites for navigation"),
  1361. ("CFG-NAVSPG-INFIL_MAXSVS", 0x201100a2, "U1", 1, "",
  1362. "Maximum number of satellites for navigation"),
  1363. ("CFG-NAVSPG-INFIL_MINCNO", 0x201100a3, "U1", 1, "dBHz",
  1364. "Minimum satellite signal level for navigation"),
  1365. ("CFG-NAVSPG-INFIL_MINELEV", 0x201100a4, "I1", 1, "deg",
  1366. "Minimum elevation for a GNSS satellite to be used in navigation"),
  1367. ("CFG-NAVSPG-INFIL_NCNOTHRS", 0x201100aa, "U1", 1, "",
  1368. "Number of satellites required to have C/N0 above "
  1369. "CFG-NAVSPG-INFIL_CNOTHRS for a fix to be attempted"),
  1370. ("CFG-NAVSPG-INFIL_CNOTHRS", 0x201100ab, "U1", 1, "",
  1371. "C/N0 threshold for deciding whether to attempt a fix"),
  1372. ("CFG-NAVSPG-OUTFIL_PDOP", 0x301100b1, "U2", 0.1, "",
  1373. "Output filter position DOP mask (threshold)"),
  1374. ("CFG-NAVSPG-OUTFIL_TDOP", 0x301100b2, "U2", 0.11, "",
  1375. "Output filter time DOP mask (threshold)"),
  1376. ("CFG-NAVSPG-OUTFIL_PACC", 0x301100b3, "U2", 1, "m",
  1377. "Output filter position accuracy mask (threshold)"),
  1378. ("CFG-NAVSPG-OUTFIL_TACC", 0x301100b4, "U2", 1, "m",
  1379. "Output filter time accuracy mask (threshold)"),
  1380. ("CFG-NAVSPG-OUTFIL_FACC", 0x301100b5, "U2", 0.01, "m/s",
  1381. "Output filter frequency accuracy mask (threshold)"),
  1382. ("CFG-NAVSPG-CONSTR_ALT", 0x401100c1, "I4", 0.01, "m",
  1383. "Fixed altitude (mean sea level) for 2D fix mode"),
  1384. ("CFG-NAVSPG-CONSTR_ALTVAR", 0x401100c2, "U4", 0.0001, "M^2",
  1385. "Fixed altitude variance for 2D mode"),
  1386. ("CFG-NAVSPG-CONSTR_DGNSSTO", 0x201100c4, "U1", 1, "s",
  1387. "DGNSS timeout"),
  1388. ("CFG-NAVSPG-SIGATTCOMP", 0x201100d6, "E1", 1, "",
  1389. "Permanently attenuated signal compensation mode"),
  1390. # CFG-NMEA-
  1391. ("CFG-NMEA", 0x2093ffff, "", 0, "",
  1392. "get all CFG-NMEA"),
  1393. ("CFG-NMEA-PROTVER", 0x20930001, "E1", 1, "",
  1394. "NMEA protocol version"),
  1395. ("CFG-NMEA-MAXSVS", 0x20930002, "E1", 1, "",
  1396. "Maximum number of SVs to report per Talker ID"),
  1397. ("CFG-NMEA-COMPAT", 0x10930003, "L", 1, "",
  1398. "Enable compatibility mode"),
  1399. ("CFG-NMEA-CONSIDER", 0x10930004, "L", 1, "",
  1400. "Enable considering mode"),
  1401. ("CFG-NMEA-LIMIT82", 0x10930005, "L", 1, "",
  1402. "Enable strict limit to 82 characters maximum NMEA message length"),
  1403. ("CFG-NMEA-HIGHPREC", 0x10930006, "L", 1, "",
  1404. "Enable high precision mode"),
  1405. ("CFG-NMEA-SVNUMBERING", 0x20930007, "E1", 1, "",
  1406. "Display configuration for SVs that have no value defined in NMEA"),
  1407. ("CFG-NMEA-FILT_GPS", 0x10930011, "L", 1, "",
  1408. "Disable reporting of GPS satellites"),
  1409. ("CFG-NMEA-FILT_SBAS", 0x10930012, "L", 1, "",
  1410. "Disable reporting of SBAS satellites"),
  1411. ("CFG-NMEA-FILT_GAL", 0x10930013, "L", 1, "",
  1412. "Disable reporting of GALILEO satellites"),
  1413. ("CFG-NMEA-FILT_QZSS", 0x10930015, "L", 1, "",
  1414. "Disable reporting of QZSS satellites"),
  1415. ("CFG-NMEA-FILT_GLO", 0x10930016, "L", 1, "",
  1416. "Disable reporting of GLONASS satellites"),
  1417. ("CFG-NMEA-FILT_BDS", 0x10930017, "L", 1, "",
  1418. "Disable reporting of BeiDou satellites"),
  1419. ("CFG-NMEA-OUT_INVFIX", 0x10930021, "L", 1, "",
  1420. "Enable position output for failed or invalid fixes"),
  1421. ("CFG-NMEA-OUT_MSKFIX", 0x10930022, "L", 1, "",
  1422. "Enable position output for invalid fixes"),
  1423. ("CFG-NMEA-OUT_INVTIME", 0x10930023, "L", 1, "",
  1424. "Enable time output for invalid times"),
  1425. ("CFG-NMEA-OUT_INVDATE", 0x10930024, "L", 1, "",
  1426. "Enable date output for invalid dates"),
  1427. ("CFG-NMEA-OUT_ONLYGPS", 0x10930025, "L", 1, "",
  1428. "Restrict output to GPS satellites only"),
  1429. ("CFG-NMEA-OUT_FROZENCOG", 0x10930026, "L", 1, "",
  1430. "Enable course over ground output even if it is frozen"),
  1431. ("CFG-NMEA-MAINTALKERID", 0x20930031, "E1", 1, "",
  1432. "Main Talker ID"),
  1433. ("CFG-NMEA-GSVTALKERID", 0x20930032, "E1", 1, "",
  1434. "Talker ID for GSV NMEA messages"),
  1435. ("CFG-NMEA-BDSTALKERID", 0x30930033, "U2", 1, "",
  1436. "BeiDou Talker ID"),
  1437. # CFG-ODO-
  1438. ("CFG-ODO", 0x1022ffff, "", 0, "",
  1439. "get all CFG-ODO"),
  1440. ("CFG-ODO-USE_ODO", 0x10220001, "L", 1, "",
  1441. "Use odometer"),
  1442. ("CFG-ODO-USE_COG", 0x10220002, "L", 1, "",
  1443. "Use low-speed course over ground filter"),
  1444. ("CFG-ODO-OUTLPVEL", 0x10220003, "L", 1, "",
  1445. "Output low-pass filtered velocity"),
  1446. ("CFG-ODO-OUTLPCOG", 0x10220004, "L", 1, "",
  1447. "Output low-pass filtered course over ground (heading)"),
  1448. ("CFG-ODO-PROFILE", 0x20220005, "E1", 1, "",
  1449. "Odometer profile configuration"),
  1450. ("CFG-ODO-COGMAXSPEED", 0x20220021, "U1", 1, "m/s",
  1451. "Upper speed limit for low-speed course over ground filter"),
  1452. ("CFG-ODO-COGMAXPOSACC", 0x20220022, "U1", 1, "",
  1453. "Maximum acceptable position accuracy for computing low-speed "
  1454. "filtered course over ground"),
  1455. ("CFG-ODO-COGLPGAIN", 0x20220032, "", 1, "",
  1456. "Course over ground low-pass filter level (at speed < 8 m/s)"),
  1457. ("CFG-ODO-VELLPGAIN", 0x20220031, "U1", 1, "",
  1458. "Velocity low-pass filter level"),
  1459. # CFG-PM-
  1460. ("CFG-PM", 0x20d0ffff, "", 0, "",
  1461. "get all CFG-PM, reciver power management"),
  1462. ("CFG-PM-OPERATEMODE", 0x20d00001, "L", 1, "",
  1463. "set PSMOO or PSMCT mode"),
  1464. ("CFG-PM-POSUPDATEPERIOD", 0x40d00002, "U4", 1, "",
  1465. "Position update period for PSMOO."),
  1466. ("CFG-PM-ACQPERIOD", 0x40d00003, "U4", 1, "s",
  1467. "Acquisition period if receiver fails to achieve a position fix"),
  1468. ("CFG-PM-GRIDOFFSET", 0x40d00004, "U4", 1, "s",
  1469. "Position update period grid offset relative to GPS start of week."),
  1470. ("CFG-PM-ONTIME", 0x30d00005, "U2", 1, "s",
  1471. "Time to stay in Tracking state."),
  1472. ("CFG-PM-MINACQTIME", 0x20d00006, "U1", 1, "s",
  1473. "Minimum time to spend in Acquisition state"),
  1474. ("CFG-PM-MAXACQTIME", 0x20d00007, "U1", 1, "s",
  1475. "Maximum time to spend in Acquisition state"),
  1476. ("CFG-PM-DONOTENTEROFF", 0x10d00008, "L", 1, "",
  1477. "Behavior when failure to achieve a position during update period."),
  1478. ("CFG-PM-WAITTIMEFIX", 0x10d00009, "L", 1, "",
  1479. "wait for time fix"),
  1480. ("CFG-PM-UPDATEEPH", 0x10d0000a, "L", 1, "",
  1481. "Update ephemeris regularly."),
  1482. ("CFG-PM-EXTINTSEL", 0x20d0000b, "E1", 1, "",
  1483. "EXTINT pin select."),
  1484. ("CFG-PM-EXTINTWAKE", 0x10d0000c, "L", 1, "",
  1485. "EXTINT pin control (Wake)"),
  1486. ("CFG-PM-EXTINTBACKUP", 0x10d0000d, "L", 1, "",
  1487. "EXTINT pin control (Backup)"),
  1488. ("CFG-PM-EXTINTINACTIVE", 0x10d0000e, "L", 1, "",
  1489. "EXTINT pin control (Inactive)"),
  1490. ("CFG-PM-UPDATEEPH", 0x10d0000d, "U4", 0.001, "s",
  1491. "Inactivity time out on EXTINT pin if enabled"),
  1492. ("CFG-PM-LIMITPEAKCURR", 0x10d00010, "L", 1, "",
  1493. "Limit peak current"),
  1494. # CFG-QZSS-
  1495. ("CFG-QZSS", 0x3037ffff, "", 0, "s",
  1496. "get all CFG-QZSS"),
  1497. ("CFG-QZSS-USE_SLAS_DGNSS", 0x10370005, "L", 0.001, "",
  1498. "Apply QZSS SLAS DGNSS corrections"),
  1499. ("CFG-QZSS-USE_TESTMODE", 0x10370006, "L", 0.001, "",
  1500. "Use QZSS SLAS data when it is in test mode"),
  1501. ("CFG-QZSS-USE_SLAS_RAIM_UNCORR", 0x10370007, "L", 0.001, "",
  1502. "Raim out measurements that are not corrected by QZSS SLAS"),
  1503. # CFG-RATE-
  1504. ("CFG-RATE", 0x3021ffff, "", 0, "s",
  1505. "get all CFG-RATE"),
  1506. ("CFG-RATE-MEAS", 0x30210001, "U2", 0.001, "s",
  1507. "Nominal time between GNSS measurements"),
  1508. ("CFG-RATE-NAV", 0x30210002, "U2", 1, "",
  1509. "Ratio of number of measurements to number of navigation solutions"),
  1510. ("CFG-RATE-TIMEREF", 0x20210003, "E1", 1, "",
  1511. "Time system to which measurements are aligned"),
  1512. # CFG-RINV-
  1513. ("CFG-RINV", 0x10c7ffff, "", 0, "",
  1514. "get all CFG-RINV"),
  1515. ("CFG-RINV-DUMP", 0x10c70001, "L", 1, "",
  1516. "Dump data at startup"),
  1517. ("CFG-RINV-BINARY", 0x10c70002, "L", 1, "",
  1518. "Data is binary"),
  1519. ("CFG-RINV-DATA_SIZE", 0x20c70003, "U1", 1, "",
  1520. "Size of data"),
  1521. ("CFG-RINV-CHUNK0", 0x50c70004, "X8", 1, "",
  1522. "Data bytes 1-8 (LSB)"),
  1523. ("CFG-RINV-CHUNK1", 0x50c70005, "X8", 1, "",
  1524. "Data bytes 9-16"),
  1525. ("CFG-RINV-CHUNK2", 0x50c70006, "X8", 1, "",
  1526. "Data bytes 17-24"),
  1527. ("CFG-RINV-CHUNK3", 0x50c70007, "X8", 1, "",
  1528. "Data bytes 25-30 (MSB)"),
  1529. # CFG-SBAS-
  1530. ("CFG-SBAS", 0x1036ffff, "", 0, "",
  1531. "get all CFG-SBAS"),
  1532. ("CFG-SBAS-USE_TESTMODE", 0x10360002, "L", 1, "",
  1533. "Use SBAS data when it is in test mode"),
  1534. ("CFG-SBAS-USE_RANGING", 0x10360003, "L", 1, "",
  1535. "Use SBAS GEOs as a ranging source (for navigation)"),
  1536. ("CFG-SBAS-USE_DIFFCORR", 0x10360004, "L", 1, "",
  1537. "Use SBAS differential corrections"),
  1538. ("CFG-SBAS-USE_INTEGRITY", 0x10360005, "L", 1, "",
  1539. "Use SBAS integrity information"),
  1540. ("CFG-SBAS-PRNSCANMASK", 0x50360006, "X8", 1, "",
  1541. "SBAS PRN search configuration"),
  1542. # CFG-SIGNAL-
  1543. ("CFG-SIGNAL", 0x1031ffff, "", 0, "",
  1544. "get all CFG-SIGNAL"),
  1545. ("CFG-SIGNAL-GPS_ENA", 0x1031001f, "L", 1, "",
  1546. "GPS enable"),
  1547. ("CFG-SIGNAL-GPS_L1CA_ENA", 0x10310001, "L", 1, "",
  1548. "GPS L1C/A"),
  1549. ("CFG-SIGNAL-GPS_L2C_ENA", 0x10310003, "L", 1, "",
  1550. "GPS L2C"),
  1551. ("CFG-SIGNAL-SBAS_ENA", 0x10310020, "L", 1, "",
  1552. "SBAS enable"),
  1553. ("CFG-SIGNAL-SBAS_L1CA_ENA", 0x10310005, "L", 1, "",
  1554. "SBAS L1C/A"),
  1555. ("CFG-SIGNAL-GAL_ENA", 0x10310021, "L", 1, "",
  1556. "Galileo enable"),
  1557. ("CFG-SIGNAL-GAL_E1_ENA", 0x10310007, "L", 1, "",
  1558. "Galileo E1"),
  1559. ("CFG-SIGNAL-GAL_E5B_ENA", 0x1031000a, "L", 1, "",
  1560. "Galileo E5b"),
  1561. ("CFG-SIGNAL-BDS_ENA", 0x10310022, "L", 1, "",
  1562. "BeiDou Enable"),
  1563. ("CFG-SIGNAL-BDS_B1_ENA", 0x1031000d, "L", 1, "",
  1564. "BeiDou B1I"),
  1565. ("CFG-SIGNAL-BDS_B2_ENA", 0x1031000e, "L", 1, "",
  1566. "BeiDou B2I"),
  1567. ("CFG-SIGNAL-QZSS_ENA", 0x10310024, "L", 1, "",
  1568. "QZSS enable"),
  1569. ("CFG-SIGNAL-QZSS_L1CA_ENA", 0x10310012, "L", 1, "",
  1570. "QZSS L1C/A"),
  1571. ("CFG-SIGNAL-QZSS_L1S_ENA", 0x10310014, "L", 1, "",
  1572. "QZSS L1S"),
  1573. ("CFG-SIGNAL-QZSS_L2C_ENA", 0x10310015, "L", 1, "",
  1574. "QZSS L2C"),
  1575. ("CFG-SIGNAL-GLO_ENA", 0x10310025, "L", 1, "",
  1576. "GLONASS enable"),
  1577. ("CFG-SIGNAL-GLO_L1_ENA", 0x10310018, "L", 1, "",
  1578. "GLONASS L1"),
  1579. ("CFG-SIGNAL-GLO_L2_ENA", 0x1031001a, "L", 1, "",
  1580. "GLONASS L2"),
  1581. # CFG-SPI-
  1582. ("CFG-SPI", 0x1064ffff, "", 0, "",
  1583. "get all CFG-SPI"),
  1584. ("CFG-SPI-MAXFF", 0x20640001, "U1", 1, "",
  1585. "Number of bytes containing 0xFF to receive before "
  1586. "switching off reception."),
  1587. ("CFG-SPI-CPOLARITY", 0x10640002, "L", 1, "",
  1588. "Clock polarity select"),
  1589. ("CFG-SPI-CPHASE", 0x10640003, "L", 1, "",
  1590. "Clock phase select"),
  1591. ("CFG-SPI-EXTENDEDTIMEOUT", 0x10640005, "L", 1, "",
  1592. "Flag to disable timeouting the interface after 1.5s"),
  1593. ("CFG-SPI-ENABLED", 0x10640006, "L", 1, "",
  1594. "Flag to indicate if the SPI interface should be enabled"),
  1595. # CFG-SPIINPROT-
  1596. ("CFG-SPIINPROT", 0x1079ffff, "", 0, "",
  1597. "get all CFG-SPIINPROT"),
  1598. ("CFG-SPIINPROT-UBX", 0x10790001, "L", 1, "",
  1599. "Flag to indicate if UBX should be an input protocol on SPI"),
  1600. ("CFG-SPIINPROT-NMEA", 0x10790002, "L", 1, "",
  1601. "Flag to indicate if NMEA should be an input protocol on SPI"),
  1602. ("CFG-SPIINPROT-RTCM2X", 0x10790003, "L", 1, "",
  1603. "Flag to indicate if RTCM2X should be an input protocol on SPI"),
  1604. ("CFG-SPIINPROT-RTCM3X", 0x10790004, "L", 1, "",
  1605. "Flag to indicate if RTCM3X should be an input protocol on SPI"),
  1606. # CFG-SPIOUTPROT-
  1607. ("CFG-SPIOUTPROT", 0x107affff, "", 0, "",
  1608. "get all CFG-SPIOUTPROT"),
  1609. ("CFG-SPIOUTPROT-UBX", 0x107a0001, "L", 1, "",
  1610. "Flag to indicate if UBX should be an output protocol on SPI"),
  1611. ("CFG-SPIOUTPROT-NMEA", 0x107a0002, "L", 1, "",
  1612. "Flag to indicate if NMEA should be an output protocol on SPI"),
  1613. ("CFG-SPIOUTPROT-RTCM3X", 0x107a0004, "L", 1, "",
  1614. "Flag to indicate if RTCM3X should be an output protocol on SPI"),
  1615. # CFG-TMODE-
  1616. ("CFG-TMODE", 0x2003ffff, "", 0, "",
  1617. "get all CFG-TMODE"),
  1618. ("CFG-TMODE-MODE", 0x20030001, "E1", 1, "",
  1619. "Receiver mode"),
  1620. ("CFG-TMODE-POS_TYPE", 0x20030002, "E1", 1, "",
  1621. "Determines whether the ARP position is given in ECEF or "
  1622. "LAT/LON/HEIGHT?"),
  1623. ("CFG-TMODE-ECEF_X", 0x40030003, "I4", 1, "cm",
  1624. "ECEF X coordinate of the ARP position."),
  1625. ("CFG-TMODE-ECEF_Y", 0x40030004, "I4", 1, "cm",
  1626. "ECEF Y coordinate of the ARP position."),
  1627. ("CFG-TMODE-ECEF_Z", 0x40030005, "I4", 1, "cm",
  1628. "ECEF Z coordinate of the ARP position."),
  1629. ("CFG-TMODE-ECEF_X_HP", 0x20030006, "I1", 0.1, "mm",
  1630. "High-precision ECEF X coordinate of the ARP position."),
  1631. ("CFG-TMODE-ECEF_Y_HP", 0x20030007, "I1", 0.1, "mm",
  1632. "High-precision ECEF Y coordinate of the ARP position."),
  1633. ("CFG-TMODE-ECEF_Z_HP", 0x20030008, "I1", 0.1, "mm",
  1634. "High-precision ECEF Z coordinate of the ARP position."),
  1635. ("CFG-TMODE-LAT", 0x40030009, "I4", 1e-7, "deg",
  1636. "Latitude of the ARP position."),
  1637. ("CFG-TMODE-LON", 0x4003000a, "I4", 1e-7, "deg",
  1638. "Longitude of the ARP position."),
  1639. ("CFG-TMODE-HEIGHT", 0x4003000b, "I4", 1, "cm",
  1640. "Height of the ARP position."),
  1641. ("CFG-TMODE-LAT_HP", 0x2003000c, "I1", 1e-9, "deg",
  1642. "High-precision latitude of the ARP position"),
  1643. ("CFG-TMODE-LON_HP", 0x2003000d, "I1", 1e-9, "deg",
  1644. "High-precision longitude of the ARP position."),
  1645. ("CFG-TMODE-HEIGHT_HP", 0x2003000e, "I1", 0.1, "mm",
  1646. "High-precision height of the ARP position."),
  1647. ("CFG-TMODE-FIXED_POS_ACC", 0x4003000f, "U4", 0.1, "mm",
  1648. "Fixed position 3D accuracy"),
  1649. ("CFG-TMODE-SVIN_MIN_DUR", 0x40030010, "U4", 1, "s",
  1650. "Survey-in minimum duration"),
  1651. ("CFG-TMODE-SVIN_ACC_LIMIT", 0x40030011, "U4", 0.1, "mm",
  1652. "Survey-in position accuracy limit"),
  1653. # CFG-TP-
  1654. ("CFG-TP", 0x3005ffff, "", 0, "",
  1655. "get all CFG-TP"),
  1656. ("CFG-TP-PULSE_DEF", 0x20050023, "E1", 1, "",
  1657. "Determines whether the time pulse is interpreted as frequency "
  1658. "or period?"),
  1659. ("CFG-TP-PULSE_LENGTH_DEF", 0x20050030, "E1", 1, "",
  1660. "Determines whether the time pulse length is interpreted as "
  1661. "length[us] or pulse ratio[%]?"),
  1662. ("CFG-TP-ANT_CABLEDELAY", 0x30050001, "I2", 0.000000001, "s",
  1663. "Antenna cable delay"),
  1664. ("CFG-TP-PERIOD_TP1", 0x40050002, "U4", 0.000001, "s",
  1665. "Time pulse period (TP1)"),
  1666. ("CFG-TP-PERIOD_LOCK_TP1", 0x40050003, "U4", 0.000001, "s",
  1667. "Time pulse period when locked to GNSS time (TP1)"),
  1668. ("CFG-TP-FREQ_TP1", 0x40050024, "U4", 1, "Hz",
  1669. "Time pulse frequency (TP1)"),
  1670. ("CFG-TP-FREQ_LOCK_TP1", 0x40050025, "U4", 1, "Hz",
  1671. "Time pulse frequency when locked to GNSS time (TP1)"),
  1672. ("CFG-TP-LEN_TP1", 0x40050004, "U4", 0.000001, "s",
  1673. "Time pulse length (TP1)"),
  1674. ("CFG-TP-LEN_LOCK_TP1", 0x40050005, "U4", 0.000001, "s",
  1675. "Time pulse length when locked to GNSS time (TP1)"),
  1676. ("CFG-TP-DUTY_TP1", 0x5005002a, "R8", 1, "%",
  1677. "Time pulse duty cycle (TP1)"),
  1678. ("CFG-TP-DUTY_LOCK_TP1", 0x5005002b, "R8", 1, "%",
  1679. "Time pulse duty cycle when locked to GNSS time (TP1)"),
  1680. ("CFG-TP-USER_DELAY_TP1", 0x40050006, "I4", 0.000000001, "s",
  1681. "User configurable time pulse delay (TP1)"),
  1682. ("CFG-TP-TP1_ENA", 0x10050007, "L", 1, "",
  1683. "Enable the first timepulse"),
  1684. ("CFG-TP-SYNC_GNSS_TP1", 0x10050008, "L", 1, "",
  1685. "Sync time pulse to GNSS time or local clock (TP1)"),
  1686. ("CFG-TP-USE_LOCKED_TP1", 0x10050009, "L", 1, "",
  1687. "Use locked parameters when possible (TP1)"),
  1688. ("CFG-TP-ALIGN_TO_TOW_TP1", 0x1005000a, "L", 1, "",
  1689. "Align time pulse to top of second (TP1)"),
  1690. ("CFG-TP-POL_TP1", 0x1005000b, "L", 1, "",
  1691. "Set time pulse polarity (TP1)"),
  1692. ("CFG-TP-TIMEGRID_TP1", 0x2005000c, "E1", 1, "",
  1693. "Time grid to use (TP1)"),
  1694. ("CFG-TP-PERIOD_TP2", 0x4005000d, "U4", 0.000001, "s",
  1695. "Time pulse period (TP2)"),
  1696. ("CFG-TP-PERIOD_LOCK_TP2", 0x4005000e, "U4", 0.000001, "s",
  1697. "Time pulse period when locked to GNSS time (TP2)"),
  1698. ("CFG-TP-FREQ_TP2", 0x40050026, "U4", 1, "Hz",
  1699. "Time pulse frequency (TP2)"),
  1700. ("CFG-TP-FREQ_LOCK_TP2", 0x40050027, "U4", 1, "Hz",
  1701. "Time pulse frequency when locked to GNSS time (TP2)"),
  1702. ("CFG-TP-LEN_TP2", 0x4005000f, "U4", 0.000001, "s",
  1703. "Time pulse length (TP2)"),
  1704. ("CFG-TP-LEN_LOCK_TP2", 0x40050010, "U4", 0.000001, "s",
  1705. "Time pulse length when locked to GNSS time (TP2)"),
  1706. ("CFG-TP-DUTY_TP2", 0x5005002c, "R8", 1, "%",
  1707. "Time pulse duty cycle (TP2)"),
  1708. ("CFG-TP-DUTY_LOCK_TP2", 0x5005002d, "R8", 1, "%",
  1709. "Time pulse duty cycle when locked to GNSS time (TP2)"),
  1710. ("CFG-TP-USER_DELAY_TP2", 0x40050011, "I4", 0.000000001, "s",
  1711. "User configurable time pulse delay (TP2)"),
  1712. ("CFG-TP-TP2_ENA", 0x10050012, "L", 1, "",
  1713. "Enable the second timepulse"),
  1714. ("CFG-TP-SYNC_GNSS_TP2", 0x10050013, "L", 1, "",
  1715. "Sync time pulse to GNSS time or local clock (TP2)"),
  1716. ("CFG-TP-USE_LOCKED_TP2", 0x10050014, "L", 1, "",
  1717. "Use locked parameters when possible (TP2)"),
  1718. ("CFG-TP-ALIGN_TO_TOW_TP2", 0x10050015, "L", 1, "",
  1719. "Align time pulse to top of second (TP2)"),
  1720. ("CFG-TP-POL_TP2", 0x10050016, "L", 1, "",
  1721. "Set time pulse polarity (TP2)"),
  1722. ("CFG-TP-TIMEGRID_TP2", 0x20050017, "E1", 1, "",
  1723. "Time grid to use (TP2)"),
  1724. # CFG-TXREADY-
  1725. ("CFG-TXREADY", 0x10a2ffff, "", 0, "",
  1726. "get all CFG-TXREADY"),
  1727. ("CFG-TXREADY-ENABLED", 0x10a20001, "L", 1, "",
  1728. "Flag to indicate if tx ready pin mechanism should be enabled"),
  1729. ("CFG-TXREADY-POLARITY", 0x10a20002, "L", 1, "",
  1730. "Polarity of the tx ready pin:false:high-active, true:low-active"),
  1731. ("CFG-TXREADY-PIN", 0x20a20003, "U1", 1, "",
  1732. "Pin number to use for the tx ready functionality"),
  1733. ("CFG-TXREADY-THRESHOLD", 0x30a20004, "U2", 1, "",
  1734. "Amount of data ready on interface before triggering tx ready pin"),
  1735. ("CFG-TXREADY-INTERFACE", 0x20a20005, "E1", 1, "",
  1736. "Interface where the tx ready feature should be linked to"),
  1737. # CFG-UART1-
  1738. ("CFG-UART1", 0x4052ffff, "", 0, "",
  1739. "get all CFG-UART1"),
  1740. ("CFG-UART1-BAUDRATE", 0x40520001, "U4", 1, "",
  1741. "The baud rate that should be configured on the UART1"),
  1742. ("CFG-UART1-STOPBITS", 0x20520002, "E1", 1, "",
  1743. "Number of stopbits that should be used on UART1"),
  1744. ("CFG-UART1-DATABITS", 0x20520003, "E1", 1, "",
  1745. "Number of databits that should be used on UART1"),
  1746. ("CFG-UART1-PARITY", 0x20520004, "E1", 1, "",
  1747. "Parity mode that should be used on UART1"),
  1748. ("CFG-UART1-ENABLED", 0x10520005, "L", 1, "",
  1749. "Flag to indicate if the UART1 should be enabled"),
  1750. # CFG-UART1INPROT
  1751. ("CFG-UART1INPROT", 0x1073ffff, "", 0, "",
  1752. "get all CFG-UART1INPROT"),
  1753. ("CFG-UART1INPROT-UBX", 0x10730001, "L", 1, "",
  1754. "Flag to indicate if UBX should be an input protocol on UART1"),
  1755. ("CFG-UART1INPROT-NMEA", 0x10730002, "L", 1, "",
  1756. "Flag to indicate if NMEA should be an input protocol on UART1"),
  1757. ("CFG-UART1INPROT-RTCM2X", 0x10730003, "L", 1, "",
  1758. "Flag to indicate if RTCM2X should be an input protocol on UART1"),
  1759. ("CFG-UART1INPROT-RTCM3X", 0x10730004, "L", 1, "",
  1760. "Flag to indicate if RTCM3X should be an input protocol on UART1"),
  1761. # CFG-UART1OUTPROT
  1762. ("CFG-UART1OUTPROT", 0x1074ffff, "", 0, "",
  1763. "get all CFG-UART1OUTPROT"),
  1764. ("CFG-UART1OUTPROT-UBX", 0x10740001, "L", 1, "",
  1765. "Flag to indicate if UBX should be an output protocol on UART1"),
  1766. ("CFG-UART1OUTPROT-NMEA", 0x10740002, "L", 1, "",
  1767. "Flag to indicate if NMEA should be an output protocol on UART1"),
  1768. ("CFG-UART1OUTPROT-RTCM3X", 0x10740004, "L", 1, "",
  1769. "Flag to indicate if RTCM3X should be an output protocol on UART1"),
  1770. # CFG-UART2-
  1771. ("CFG-UART2", 0x4053FFFF, "", 0, "",
  1772. "get all CFG-UART2"),
  1773. ("CFG-UART2-BAUDRATE", 0x40530001, "U4", 1, "",
  1774. "The baud rate that should be configured on the UART2"),
  1775. ("CFG-UART2-STOPBITS", 0x20530002, "E1", 1, "",
  1776. "Number of stopbits that should be used on UART2"),
  1777. ("CFG-UART2-DATABITS", 0x20530003, "E1", "1", "",
  1778. "Number of databits that should be used on UART2"),
  1779. ("CFG-UART2-PARITY", 0x20530004, "E1", "1", "",
  1780. "Parity mode that should be used on UART2"),
  1781. ("CFG-UART2-ENABLED", 0x10530005, "L", "1", "",
  1782. "Flag to indicate if the UART2 should be enabled"),
  1783. ("CFG-UART2-REMAP", 0x10530006, "L", "1", "",
  1784. "UART2 Remapping"),
  1785. # CFG-UART1INPROT
  1786. ("CFG-UART2INPROT", 0x1075ffff, "", 0, "",
  1787. "get all CFG-UART2INPROT"),
  1788. ("CFG-UART2INPROT-UBX", 0x10750001, "L", 1, "",
  1789. "Flag to indicate if UBX should be an input protocol on UART2"),
  1790. ("CFG-UART2INPROT-NMEA", 0x10750002, "L", 1, "",
  1791. "Flag to indicate if NMEA should be an input protocol on UART2"),
  1792. ("CFG-UART2INPROT-RTCM2X", 0x10750003, "L", 1, "",
  1793. "Flag to indicate if RTCM2X should be an input protocol on UART2"),
  1794. ("CFG-UART2INPROT-RTCM3X", 0x10750004, "L", 1, "",
  1795. "Flag to indicate if RTCM3X should be an input protocol on UART2"),
  1796. # CFG-UART2OUTPROT
  1797. ("CFG-UART2OUTPROT", 0x1076ffff, "", 0, "",
  1798. "get all CFG-UART2OUTPROT"),
  1799. ("CFG-UART2OUTPROT-UBX", 0x10760001, "L", 1, "",
  1800. "Flag to indicate if UBX should be an output protocol on UART2"),
  1801. ("CFG-UART2OUTPROT-NMEA", 0x10760002, "L", 1, "",
  1802. "Flag to indicate if NMEA should be an output protocol on UART2"),
  1803. ("CFG-UART2OUTPROT-RTCM3X", 0x10760004, "L", 1, "",
  1804. "Flag to indicate if RTCM3X should be an output protocol on UART2"),
  1805. # CFG-USB-
  1806. ("CFG-USB", 0x1065ffff, "", 0, "",
  1807. "get all CFG-USB"),
  1808. ("CFG-USB-ENABLED", 0x10650001, "L", 1, "",
  1809. "Flag to indicate if the USB interface should be enabled"),
  1810. ("CFG-USB-SELFPOW", 0x10650002, "L", 1, "",
  1811. "Self-Powered device"),
  1812. ("CFG-USB-VENDOR_ID", 0x3065000a, "U2", 1, "",
  1813. "Vendor ID"),
  1814. ("CFG-USB-PRODUCT_ID", 0x3065000b, "U2", 1, "",
  1815. "Product ID"),
  1816. ("CFG-USB-POWER", 0x3065000c, "U2", 1, "mA",
  1817. "Power consumption"),
  1818. ("CFG-USB-VENDOR_STR0", 0x5065000d, "X8", 1, "",
  1819. "Vendor string characters 0-7"),
  1820. ("CFG-USB-VENDOR_STR1", 0x5065000e, "X8", 1, "",
  1821. "Vendor string characters 8-15"),
  1822. ("CFG-USB-VENDOR_STR2", 0x5065000f, "X8", 1, "",
  1823. "Vendor string characters 16-23"),
  1824. ("CFG-USB-VENDOR_STR3", 0x50650010, "X8", 1, "",
  1825. "Vendor string characters 24-31"),
  1826. ("CFG-USB-PRODUCT_STR0", 0x50650011, "X8", 1, "",
  1827. "Product string characters 0-7"),
  1828. ("CFG-USB-PRODUCT_STR1", 0x50650012, "X8", 1, "",
  1829. "Product string characters 8-15"),
  1830. ("CFG-USB-PRODUCT_STR2", 0x50650013, "X8", 1, "",
  1831. "Product string characters 16-23"),
  1832. ("CFG-USB-PRODUCT_STR3", 0x50650014, "X8", 1, "",
  1833. "Product string characters 24-31"),
  1834. ("CFG-USB-SERIAL_NO_STR0", 0x50650015, "X8", 1, "",
  1835. "Serial number string characters 0-7"),
  1836. ("CFG-USB-SERIAL_NO_STR1", 0x50650016, "X8", 1, "",
  1837. "Serial number string characters 8-15"),
  1838. ("CFG-USB-SERIAL_NO_STR2", 0x50650017, "X8", 1, "",
  1839. "Serial number string characters 16-23"),
  1840. ("CFG-USB-SERIAL_NO_STR3", 0x50650018, "X8", 1, "",
  1841. "Serial number string characters 24-31"),
  1842. # CFG-USB-INPROT
  1843. ("CFG-USBINPROT", 0x1077ffff, "", 0, "",
  1844. "get all CFG-USBINPROT"),
  1845. ("CFG-USBINPROT-UBX", 0x10770001, "L", 1, "",
  1846. "Flag to indicate if UBX should be an input protocol on USB"),
  1847. ("CFG-USBINPROT-NMEA", 0x10770002, "L", 1, "",
  1848. "Flag to indicate if NMEA should be an input protocol on USB"),
  1849. ("CFG-USBINPROT-RTCM2X", 0x10770003, "L", 1, "",
  1850. "Flag to indicate if RTCM2X should be an input protocol on USB"),
  1851. ("CFG-USBINPROT-RTCM3X", 0x10770004, "L", 1, "",
  1852. "Flag to indicate if RTCM3X should be an input protocol on USB"),
  1853. # CFG-USB-OUTPROT
  1854. ("CFG-USBOUTPROT", 0x1078ffff, "", 0, "",
  1855. "get all CFG-USBOUTPROT"),
  1856. ("CFG-USBOUTPROT-UBX", 0x10780001, "L", 1, "",
  1857. "Flag to indicate if UBX should be an output protocol on USB"),
  1858. ("CFG-USBOUTPROT-NMEA", 0x10780002, "L", 1, "",
  1859. "Flag to indicate if NMEA should be an output protocol on USB"),
  1860. ("CFG-USBOUTPROT-RTCM3X", 0x10780004, "L", 1, "",
  1861. "Flag to indicate if RTCM3X should be an output protocol on USB"),
  1862. )
  1863. def item_to_type(self, item):
  1864. """Return (size, pack format, i/i/f) for item"""
  1865. # conversion of known types from known key
  1866. cfg_types = {
  1867. "E1": (1, "<B", "u"),
  1868. "E2": (2, "<H", "u"),
  1869. "E4": (4, "<L", "u"),
  1870. "I1": (1, "<b", "i"),
  1871. "I2": (2, "<h", "i"),
  1872. "I4": (4, "<l", "i"),
  1873. "I8": (8, "<q", "i"),
  1874. "L": (1, "<B", "u"),
  1875. "R4": (4, "<f", "f"),
  1876. "R8": (8, "<d", "f"),
  1877. "U1": (1, "<B", "u"),
  1878. "U2": (2, "<H", "u"),
  1879. "U4": (4, "<L", "u"),
  1880. "U8": (8, "<Q", "u"),
  1881. "X1": (1, "<B", "u"),
  1882. "X2": (2, "<H", "u"),
  1883. "X4": (4, "<L", "u"),
  1884. "X8": (8, "<Q", "u"),
  1885. }
  1886. # guess of known types from unknown key
  1887. key_map = {0: (1, "<B", "u"), # illegal
  1888. 1: (1, "<B", "u"), # one bit
  1889. 2: (1, "<B", "u"), # one byte
  1890. 3: (2, "<H", "u"), # two byte
  1891. 4: (4, "<L", "u"), # four byte
  1892. 5: (8, "<B", "u"), # eight byte
  1893. 6: (1, "<B", "u"), # illegal
  1894. 7: (1, "<B", "u"), # illegal
  1895. }
  1896. key = item[1]
  1897. val_type = item[2]
  1898. if val_type in cfg_types:
  1899. cfg_type = cfg_types[val_type]
  1900. else:
  1901. # unknown? get length correct
  1902. key_size = (key >> 28) & 0x07
  1903. cfg_type = key_map[key_size]
  1904. return cfg_type
  1905. cfg_by_key_group = {0x03: "TMODE",
  1906. 0x05: "TP",
  1907. 0x11: "NAVSPG",
  1908. 0x14: "NAVHPG",
  1909. 0x21: "RATE",
  1910. 0x22: "ODO",
  1911. 0x23: "ANA",
  1912. 0x24: "GEOFENCE",
  1913. 0x25: "MOT",
  1914. 0x26: "BATCH",
  1915. 0x31: "SIGNAL",
  1916. 0x37: "QZSS",
  1917. 0x41: "ITFM",
  1918. 0x51: "I2C",
  1919. 0x52: "UART1",
  1920. 0x53: "UART2",
  1921. 0x64: "SPI",
  1922. 0x65: "USB",
  1923. 0x71: "I2CINPROT",
  1924. 0x72: "I2COUTPROT",
  1925. 0x73: "UART1INPROT",
  1926. 0x74: "UART1OUTPROT",
  1927. 0x75: "UART2INPROT",
  1928. 0x76: "UART2OUTPROT",
  1929. 0x77: "USBOUTPROT",
  1930. 0x78: "USBOUTPROT",
  1931. 0x79: "SPIINPROT",
  1932. 0x7a: "SPIOUTPROT",
  1933. 0x91: "MSGOUT",
  1934. 0x92: "INFMSG",
  1935. 0x93: "NMEA",
  1936. 0xa2: "TXREADY",
  1937. 0xa3: "HW",
  1938. 0xc7: "RINV",
  1939. 0xd0: "PM",
  1940. 0xde: "LOGFILTER",
  1941. }
  1942. cfg_by_key_kmap = {0: "Z0",
  1943. 1: "L",
  1944. 2: "U1",
  1945. 3: "U2",
  1946. 4: "U4",
  1947. 5: "U8",
  1948. 6: "Z6",
  1949. 7: "Z7",
  1950. }
  1951. def cfg_by_key(self, key):
  1952. """Find a config item by key"""
  1953. for item in self.cfgs:
  1954. if item[1] == key:
  1955. return item
  1956. # not found, build a fake item, guess on decode
  1957. group = (key >> 16) & 0xff
  1958. group_name = index_s(group, self.cfg_by_key_group)
  1959. if "Unk" == group_name:
  1960. group_name = str(group)
  1961. name = "CFG-%s-%u" % (group_name, key & 0xff)
  1962. size = (key >> 28) & 0x07
  1963. item = (name, key, self.cfg_by_key_kmap[size], 1, "Unk", "Unknown")
  1964. return item
  1965. def cfg_by_name(self, name):
  1966. """Find a config item by name"""
  1967. for item in self.cfgs:
  1968. if item[0] == name:
  1969. return item
  1970. return None
  1971. id_map = {
  1972. 0: {"name": "GPS",
  1973. "sig": {0: "L1C/A", 3: "L2 CL", 4: "L2 CM"}},
  1974. 1: {"name": "SBAS",
  1975. "sig": {0: "L1C/A", 3: "L2 CL", 4: "L2 CM"}},
  1976. 2: {"name": "Galileo",
  1977. "sig": {0: "E1C", 1: "E1 B", 5: "E5 bl", 6: "E5 bQ"}},
  1978. 3: {"name": "BeiDou",
  1979. "sig": {0: "B1I D1", 1: "B1I D2", 2: "B2I D1", 3: "B2I D2"}},
  1980. 4: {"name": "IMES",
  1981. "sig": {0: "L1C/A", 3: "L2 CL", 4: "L2 CM"}},
  1982. 5: {"name": "QZSS",
  1983. "sig": {0: "L1C/A", 4: "L2 CM", 5: "L2 CL"}},
  1984. 6: {"name": "GLONASS",
  1985. "sig": {0: "L1 OF", 2: "L2 OF"}},
  1986. }
  1987. def gnss_s(self, gnssId, svId, sigId):
  1988. """Verbose decode of gnssId, svId and sigId"""
  1989. s = ''
  1990. if gnssId in self.id_map:
  1991. if "name" not in self.id_map[gnssId]:
  1992. s = "%d:%d:%d" % (gnssId, svId, sigId)
  1993. elif sigId not in self.id_map[gnssId]["sig"]:
  1994. s = ("%s:%d:%d" %
  1995. (self.id_map[gnssId]["name"], svId, sigId))
  1996. else:
  1997. s = ("%s:%d:%s" %
  1998. (self.id_map[gnssId]["name"], svId,
  1999. self.id_map[gnssId]["sig"][sigId]))
  2000. else:
  2001. s = "%d:%d:%d" % (gnssId, svId, sigId)
  2002. return s
  2003. def ack_ack(self, buf):
  2004. """UBX-ACK-ACK decode"""
  2005. # NOTE: Not all messages to u-blox GPS are ACKed...
  2006. u = struct.unpack_from('<BB', buf, 0)
  2007. return ' ACK to %s' % self.class_id_s(u[0], u[1])
  2008. def ack_nak(self, buf):
  2009. """UBX-ACK-NAK decode"""
  2010. # NOTE: Not all messages to u-blox GPS are ACKed...
  2011. u = struct.unpack_from('<BB', buf, 0)
  2012. return ' NAK to %s' % self.class_id_s(u[0], u[1])
  2013. # UBX-ACK-
  2014. ack_ids = {0: {'str': 'NAK', 'dec': ack_nak, 'minlen': 2,
  2015. 'name': 'UBX-ACK-NAK'},
  2016. 1: {'str': 'ACK', 'dec': ack_ack, 'minlen': 2,
  2017. 'name': 'UBX-ACK-ACK'}}
  2018. # UBX-AID-
  2019. def aid_alm(self, buf):
  2020. """UBX-AID-ALM decode, GPS Aiding Almanac Data"""
  2021. m_len = len(buf)
  2022. if 1 == m_len:
  2023. return " Poll request svid %u" % buf[0]
  2024. if 8 > m_len:
  2025. return " Bad Length %s" % m_len
  2026. u = struct.unpack_from('<LL', buf, 0)
  2027. s = ' svid %u week %u ' % u
  2028. if 0 != u[1] and 8 < m_len <= 40:
  2029. u = struct.unpack_from('<LLLLLLLL', buf, 8)
  2030. s += ('\n dwrd %08x %08x %08x %08x'
  2031. '\n %08x %08x %08x %08x' % u)
  2032. return s
  2033. def aid_alp(self, buf):
  2034. """UBX-AID-ALP decode, AlmanacPlus"""
  2035. # u-blox 6, protVer 6 to 7
  2036. m_len = len(buf)
  2037. if 1 == m_len(buf):
  2038. # different meaning for in and out
  2039. u = struct.unpack_from('<B', buf, 0)
  2040. return ' dummy/ack %u' % u
  2041. if 24 == m_len(buf):
  2042. # different meaning for in and out
  2043. u = struct.unpack_from('LLlHHLBBH', buf, 0)
  2044. return (' predTow %u predDur %u age %d predWno %u almWno %u\n'
  2045. ' res1 %u svs %u res23 %u %u' % u)
  2046. # else
  2047. s = ' alpData len %u' % u
  2048. # FIXME: partial decode
  2049. return s
  2050. def aid_alpsrv(self, buf):
  2051. """UBX-AID-ALPSRV decode, AlmanacPlus"""
  2052. # u-blox 6, protVer 6 to 7
  2053. u = struct.unpack_from('<BBHHH', buf, 0)
  2054. s = ' idSize %u type %u ofx %u size %u fileId %u' % u
  2055. # FIXME: partial decode
  2056. return s
  2057. def aid_aop(self, buf):
  2058. """UBX-AID-AOP decode, AssistNow Autonomous data"""
  2059. m_len = len(buf)
  2060. if 1 == m_len:
  2061. return " Poll request svid %u" % buf[0]
  2062. # length 2 is undocumented...
  2063. if 2 > m_len:
  2064. return " Bad Length %s" % m_len
  2065. u = struct.unpack_from('<BB', buf, 0)
  2066. s = ' gnssid %u svid %u' % u
  2067. # FIXME: dump the rest...
  2068. return s
  2069. def aid_data(self, buf):
  2070. """UBX-AID-DATA decode, Poll all GPS Initial Aiding Data"""
  2071. # u-blox 6
  2072. # If this poll is received, the messages AID-INI, AID-HUI,
  2073. # AID-EPH and AID-ALM are sent.
  2074. return " Poll all GPS Initial Aiding Data"
  2075. def aid_eph(self, buf):
  2076. """UBX-AID-EPH decode, GPS Aiding Ephemeris Data"""
  2077. m_len = len(buf)
  2078. if 1 == m_len:
  2079. return " Poll request svid %u" % buf[0]
  2080. if 8 > m_len:
  2081. return " Bad Length %s" % m_len
  2082. u = struct.unpack_from('<LL', buf, 0)
  2083. s = ' svid %u how x%x ' % u
  2084. if 0 != u[1] and 8 < m_len <= 104:
  2085. u = struct.unpack_from('<LLLLLLLLLLLLLLLLLLLLLLLL', buf, 8)
  2086. s += ('\n sf1d %08x %08x %08x %08x'
  2087. '\n %08x %08x %08x %08x'
  2088. '\n sf2d %08x %08x %08x %08x'
  2089. '\n %08x %08x %08x %08x'
  2090. '\n sf3d %08x %08x %08x %08x'
  2091. '\n %08x %08x %08x %08x' % u)
  2092. return s
  2093. def aid_hui(self, buf):
  2094. """UBX-AID-HUI decode, GPS Heatlh, UTC, Ionosphere"""
  2095. u = struct.unpack_from('<LddlhhhhhhffffffffL', buf, 0)
  2096. s = (' health x%x utcA0 %e utcA1 %e utcTOW %d'
  2097. '\n utcWNT %d utcLS %d utcWNF %d utcDN %d utcLSF %d utcSpare %d'
  2098. '\n klobA0 %e klobA1 %e klobA2 %e'
  2099. '\n klobA3 %e klobB0 %e klobB1 %e'
  2100. '\n klobB2 %e klobB3 %e flags x%x' % u)
  2101. return s
  2102. def aid_ini(self, buf):
  2103. """UBX-AID-INI decode, Aiding position, time, frequency, clock drift"""
  2104. u = struct.unpack_from('<lllLHHLlLLlLL', buf, 0)
  2105. s = (' ecefXOrLat %d ecefYOrLon %d ecefZOrAlt %d posAcc %u'
  2106. '\n tmCfg x%x wnoOrDate %u towOrTime %u towNs %d'
  2107. '\n tAccMs %u tAccNs %u clkDOrFreq %d clkDAccOrFreqAcc %u'
  2108. '\n flags x%x' % u)
  2109. return s
  2110. def aid_req(self, buf):
  2111. """UBX-AID-REQ decode, Sends a poll for all GPS Aiding Data"""
  2112. return " poll (AID-DATA) for all GPS Aiding Data"
  2113. # All UBX-AID messages are deprecated; use UBX-MGA messages instead
  2114. aid_ids = {
  2115. # u-blox 6
  2116. 0x00: {'str': 'REQ', 'dec': aid_req, 'minlen': 0,
  2117. 'name': 'UBX-AID-REQ'},
  2118. 0x01: {'str': 'INI', 'dec': aid_ini, 'minlen': 48,
  2119. 'name': 'UBX-AID-INI'},
  2120. 0x02: {'str': 'HUI', 'dec': aid_hui, 'minlen': 72,
  2121. 'name': 'UBX-AID-HUI'},
  2122. # u-blox 6
  2123. 0x10: {'str': 'DATA', 'dec': aid_data, 'minlen': 0,
  2124. 'name': 'UBX-AID-DATA'},
  2125. 0x30: {'str': 'ALM', 'dec': aid_alm, 'minlen': 1,
  2126. 'name': 'UBX-AID-ALM'},
  2127. 0x31: {'str': 'EPH', 'dec': aid_eph, 'minlen': 1,
  2128. 'name': 'UBX-AID-EPH'},
  2129. # u-blox 6
  2130. 0x32: {'str': 'ALPSRV', 'dec': aid_alpsrv, 'minlen': 8,
  2131. 'name': 'UBX-AID-ALPSRV'},
  2132. 0x33: {'str': 'AOP', 'dec': aid_aop, 'minlen': 1,
  2133. 'name': 'UBX-AID-AOP'},
  2134. 0x50: {'str': 'ALP', 'dec': aid_alp, 'minlen': 1,
  2135. 'name': 'UBX-AID-ALP'},
  2136. }
  2137. cfg_ant_pins = {
  2138. 1: 'svcs',
  2139. 2: 'scd',
  2140. 4: 'ocd',
  2141. 8: 'pdwnOnSCD',
  2142. 0x10: 'recovery',
  2143. }
  2144. def cfg_ant(self, buf):
  2145. """UBX-CFG-ANT decode"""
  2146. u = struct.unpack_from('<HH', buf, 0)
  2147. s = ' flags x%x pins x%x ' % u
  2148. s += ('pinSwitch %u pinSCD %u pinOCD %u reconfig %u' %
  2149. (u[1] & 0x1f, (u[1] >> 5) & 0x1f, (u[1] >> 10) & 0x1f,
  2150. u[1] >> 15))
  2151. if VERB_DECODE <= opts['verbosity']:
  2152. s += ('\n flags (%s)' % flag_s(u[0], self.cfg_ant_pins))
  2153. return s
  2154. cfg_batch_flags = {
  2155. 1: 'enable',
  2156. 4: 'extraPvt',
  2157. 8: 'extraOdo',
  2158. 0x20: 'pioEnable',
  2159. 0x40: 'pioActiveLow',
  2160. }
  2161. def cfg_batch(self, buf):
  2162. """UBX-CFG-BATCH decode"""
  2163. u = struct.unpack_from('<BBHHBB', buf, 0)
  2164. s = (" version %u flags x%x bufsize %u notifThrs %u\n"
  2165. " pioId %u reserved1 %u" % u)
  2166. if VERB_DECODE <= opts['verbosity']:
  2167. s += ('\n flags (%s)' % flag_s(u[1], self.cfg_batch_flags))
  2168. return s
  2169. cfg_cfg_mask = {
  2170. 0x1: 'ioPort',
  2171. 0x2: 'msgConf',
  2172. 0x4: 'infMsg',
  2173. 0x8: 'navConf',
  2174. 0x10: 'rxmConf',
  2175. 0x100: 'senConf', # not on M8030, sfdrConf in u-blox 5
  2176. 0x200: 'rinvConf',
  2177. 0x400: 'antConf',
  2178. 0x800: 'logConf', # not in u-blox 5
  2179. 0x1000: 'ftsConf', # protVer 16+
  2180. }
  2181. cfg_cfg_dev = {
  2182. 0x1: 'devBBR',
  2183. 0x2: 'devFlash',
  2184. 0x4: 'devEEPROM',
  2185. 0x10: 'devSpiFlash',
  2186. }
  2187. def cfg_cfg(self, buf):
  2188. """UBX-CFG-CFG decode"""
  2189. m_len = len(buf)
  2190. if 12 == m_len:
  2191. u = struct.unpack_from('<LLL', buf, 0)
  2192. else:
  2193. u = struct.unpack_from('<LLLB', buf, 0)
  2194. s = (' clearMask: %#x (%s)\n' %
  2195. (u[0], flag_s(u[0], self.cfg_cfg_mask)))
  2196. s += (' saveMask: %#x (%s)\n' %
  2197. (u[1], flag_s(u[1], self.cfg_cfg_mask)))
  2198. s += (' loadMask: %#x (%s)\n' %
  2199. (u[2], flag_s(u[2], self.cfg_cfg_mask)))
  2200. if 13 <= m_len:
  2201. s += (' deviceMask: %#x (%s)\n' %
  2202. (u[3], flag_s(u[3], self.cfg_cfg_dev)))
  2203. return s
  2204. def cfg_dat(self, buf):
  2205. """UBX-CFG-DAT decode, Standard Datum configuration"""
  2206. # u-blox 5 to 9, protVer 4.00 to 29
  2207. m_len = len(buf)
  2208. if 2 == m_len:
  2209. # standard datum
  2210. u = struct.unpack_from('<H', buf, 0)
  2211. s = " datumNum %u" % u
  2212. elif 44 > m_len:
  2213. s = " Bad Length %d" % m_len
  2214. elif 44 == m_len:
  2215. # set user defined datum
  2216. u = struct.unpack_from('<ddfffffff', buf, 0)
  2217. s = (" majA %.1f flat %.1f dX %.1f dY %.1f dZ %.1f\n"
  2218. " rotX %.1f rotY %.1f rotZ %.1f scale %.1f" % u)
  2219. elif 52 > m_len:
  2220. s = " Bad Length %d" % m_len
  2221. elif 52 <= m_len:
  2222. # get user defined datum
  2223. u = struct.unpack_from('<HBBBBBBddfffffff', buf, 0)
  2224. s = (" datumNum %u datumNam %u %u %u %u %u %u\n"
  2225. " majA %.1f flat %.1f dX %.1f dY %.1f dZ %.1f\n"
  2226. " rotX %.1f rotY %.1f rotZ %.1f scale %.1f" % u)
  2227. if VERB_DECODE <= opts['verbosity']:
  2228. s += ('\n datumName (%s)' %
  2229. gps.polystr(buf[2:8]).rstrip('\0'))
  2230. else:
  2231. s = "I'm confused..."
  2232. return s
  2233. cfg_dgnss_mode = {
  2234. 2: "RTK Float",
  2235. 3: "RTK Fixed",
  2236. }
  2237. def cfg_dgnss(self, buf):
  2238. """UBX-CFG-DGNSS decode, DGNSS configuration"""
  2239. u = struct.unpack_from('<BBBB', buf, 0)
  2240. s = (" dgnssMode %u (%s) reserved1 %u %u %u" % u
  2241. (u[0], index_s(u[0], self.cfg_dgnss_mode), u[1], u[2], u[3]))
  2242. return s
  2243. def cfg_dosc(self, buf):
  2244. """UBX-CFG-DOSC decode, Disciplined oscillator configuration"""
  2245. u = struct.unpack_from('<BBBB', buf, 0)
  2246. s = " version %u numOsc %u reserved1 %u" % u
  2247. # FIXME, partial decode
  2248. return s
  2249. def cfg_dynseed(self, buf):
  2250. """UBX-CFG-DYNSEED decode,
  2251. Programming the dynamic seed for host interface signature"""
  2252. # u-blox 8 only, protVer 18 to 23
  2253. u = struct.unpack_from('<BBHLL', buf, 0)
  2254. s = " version %u reserved1 %u %u seedHi %u seedLo %u" % u
  2255. return s
  2256. def cfg_esrc(self, buf):
  2257. """UBX-CFG-ESRC decode, External synchronization source
  2258. configuration"""
  2259. u = struct.unpack_from('<BBBB', buf, 0)
  2260. s = " version %u numSources %u reserved1 %u" % u
  2261. # FIXME, partial decode
  2262. return s
  2263. def cfg_fixseed(self, buf):
  2264. """UBX-CFG-FIXSEED decode,
  2265. Programming the fixed seed for host interface signature"""
  2266. # u-blox 8 only, protVer 18 to 23
  2267. u = struct.unpack_from('<BBHLL', buf, 0)
  2268. s = " version %u length %u reserved1 %u seedHi %u seedLo %u" % u
  2269. # FIXME, partial decode
  2270. return s
  2271. cfg_fxn_flags = {
  2272. 2: "sleep Float",
  2273. 8: "absAlign",
  2274. 0x10: "onOff",
  2275. }
  2276. def cfg_fxn(self, buf):
  2277. """UBX-CFG-FXN decode, FXN FixNOW configuration"""
  2278. # Antaris 4, u-blox 5, protVer 6.00 to 6.02
  2279. u = struct.unpack_from('<LLLLLLLLL', buf, 0)
  2280. s = (" flags x%x tReacq %u tAcq %u tReacqOff %u\n"
  2281. " tAcqOff %u tOn %u tOff %u res %u baseTow %u\n" % u)
  2282. if VERB_DECODE <= opts['verbosity']:
  2283. s += ("\n flags (%s)" %
  2284. (flag_s(u[0], self.cfg_fxn_flags)))
  2285. return s
  2286. def cfg_geofence(self, buf):
  2287. """UBX-CFG-GEOFENCE decode, Geofencing configuration"""
  2288. u = struct.unpack_from('<BBBBBBBB', buf, 0)
  2289. s = (" version %u numFences %u confLvl %u reserved1 %u\n"
  2290. " pioEnabled %u pinPolarity %u pin %u reserved2 %u" % u)
  2291. for i in range(0, u[1]):
  2292. u = struct.unpack_from('<llL', buf, 8 + (i * 12))
  2293. s = "\n lat %d lon %d radius %d" % u
  2294. return s
  2295. # signals defined in protver 27+
  2296. # signals used in protver 15+
  2297. # top byte used, but not defined
  2298. cfg_gnss_sig = {
  2299. 0: {0x010000: "L1C/A", # GPS
  2300. 0x100000: "L2C"},
  2301. 1: {0x010000: "L1C/A"}, # SBAS
  2302. 2: {0x010000: "E1", # Galileo
  2303. 0x200000: "E5b"},
  2304. 3: {0x010000: "B1I", # BeiDou
  2305. 0x100000: "B2I"},
  2306. 4: {0x010000: "L1"}, # IMES
  2307. 5: {0x010000: "L1C/A", # QZSS
  2308. 0x040000: "L1S",
  2309. 0x100000: "L2C"},
  2310. 6: {0x010000: "L1", # GLONASS
  2311. 0x100000: "L2"},
  2312. }
  2313. def cfg_gnss(self, buf):
  2314. """UBX-CFG-GNSS decode, GNSS system configuration"""
  2315. u = struct.unpack_from('<BBBB', buf, 0)
  2316. s = " msgVer %u numTrkChHw %u numTrkChUse %u numConfigBlocks %u" % u
  2317. for i in range(0, u[3]):
  2318. u = struct.unpack_from('<BBBBL', buf, 4 + (i * 8))
  2319. sat = u[0]
  2320. s += ("\n gnssId %u TrkCh %2u maxTrCh %2u reserved %u "
  2321. "Flags x%08x\n" % u)
  2322. if 7 > sat:
  2323. s += (" %s %s " %
  2324. (index_s(sat, self.gnss_id),
  2325. flag_s(u[4], self.cfg_gnss_sig[sat])))
  2326. else:
  2327. s += "Unk "
  2328. if u[4] & 0x01:
  2329. s += 'enabled'
  2330. return s
  2331. def cfg_hnr(self, buf):
  2332. """UBX-CFG-HNR decode, High Navigation Rate Settings"""
  2333. u = struct.unpack_from('<BBBb', buf, 0)
  2334. s = " highNavRate %u reserved %u %u %u" % u
  2335. return s
  2336. cfg_inf_protid = {
  2337. 0: "UBX",
  2338. 1: "NMEA",
  2339. 3: "Unk3", # undocumented, used by u-center
  2340. 12: "Unk12", # undocumented, used by u-center
  2341. 13: "Unk13", # undocumented, used by u-center
  2342. 14: "Unk14", # undocumented, used by u-center
  2343. 15: "Unk15", # undocumented, used by u-center
  2344. }
  2345. def cfg_inf(self, buf):
  2346. """UBX-CFG-INF decode, Poll configuration for one protocol"""
  2347. m_len = len(buf)
  2348. if 1 == m_len:
  2349. return (" Poll request: %s" %
  2350. index_s(buf[0], self.cfg_inf_protid))
  2351. if 10 < m_len:
  2352. return " Bad Length %d" % m_len
  2353. u = struct.unpack_from('<BBBBBBBBBB', buf, 0)
  2354. s = (" protocolId %u reserved1 %u %u %u\n"
  2355. " infMsgMask %u %u %u %u %u %u" % u)
  2356. if VERB_DECODE <= opts['verbosity']:
  2357. s += ('\n protocolId (%s)' %
  2358. index_s(buf[0], self.cfg_inf_protid))
  2359. return s
  2360. cfg_itfm_config = {
  2361. 0x80000000: "enable",
  2362. }
  2363. cfg_itfm_config2 = {
  2364. 0x4000: "enable2",
  2365. }
  2366. cfg_itfm_ant = {
  2367. 1: "passive",
  2368. 2: "active",
  2369. }
  2370. def cfg_itfm(self, buf):
  2371. """UBX-CFG-ITFM decode, Jamming/Interference Monitor configuration"""
  2372. u = struct.unpack_from('<LL', buf, 0)
  2373. s = " config x%x config2 x%x" % u
  2374. if VERB_DECODE <= opts['verbosity']:
  2375. s += ("\n config (%s) bbThreshold %u cwThreshold %u "
  2376. "algorithmBits x%x"
  2377. "\n config2 (%s) generalBits x%x antSetting (%s)" %
  2378. (flag_s(buf[0], self.cfg_itfm_config),
  2379. u[0] & 0x0f, (u[0] >> 4) & 0x1f, (u[0] >> 9) & 0x1fffff,
  2380. flag_s(buf[1], self.cfg_itfm_config2),
  2381. u[1] & 0x0fff,
  2382. index_s((u[1] >> 12) & 3, self.cfg_itfm_config2)))
  2383. return s
  2384. cfg_logfilter_flags = {
  2385. 1: "recordEnabled",
  2386. 2: "psmOncePerWakupEnabled",
  2387. 4: "applyAllFilterSettings",
  2388. }
  2389. def cfg_logfilter(self, buf):
  2390. """UBX-CFG-LOGFILTER decode, Data Logger Configuration"""
  2391. # u-blox 7+, protVer 14+
  2392. u = struct.unpack_from('<BBHHHL', buf, 0)
  2393. s = (" version %u flags x%x minInterval %u timeThreshold %u\n"
  2394. " speedThreshold %u positionThreshold %u" % u)
  2395. if VERB_DECODE <= opts['verbosity']:
  2396. s += ("\n flags (%s)" %
  2397. (flag_s(buf[1], self.cfg_logfilter_flags)))
  2398. return s
  2399. utc_std = {
  2400. 0: "Default",
  2401. 1: "CRL",
  2402. 2: "NIST",
  2403. 3: "USNO",
  2404. 4: "BIPM",
  2405. 5: "tbd",
  2406. 6: "SU",
  2407. 7: "NTSC",
  2408. }
  2409. cfg_nav5_dyn = {
  2410. 0: "Portable",
  2411. 2: "Stationary",
  2412. 3: "Pedestrian",
  2413. 4: "Automotive",
  2414. 5: "Sea",
  2415. 6: "Airborne with <1g Acceleration",
  2416. 7: "Airborne with <2g Acceleration",
  2417. 8: "Airborne with <4g Acceleration",
  2418. }
  2419. cfg_nav5_fix = {
  2420. 1: "2D only",
  2421. 2: "3D only",
  2422. 3: "Auto 2D/3D",
  2423. }
  2424. cfg_nav5_mask = {
  2425. 1: "dyn",
  2426. 2: "minEl",
  2427. 4: "posFixMode",
  2428. 8: "drLim",
  2429. 0x10: "posMask",
  2430. 0x20: "timeMask",
  2431. 0x40: "staticHoldMask",
  2432. 0x80: "dgpsMask",
  2433. 0x100: "cnoThreshold",
  2434. 0x400: "utc",
  2435. }
  2436. def cfg_nav5(self, buf):
  2437. """UBX-CFG-NAV5 nav Engine Settings"""
  2438. u = struct.unpack_from('<HBBlLbBHHHHbbbbHHbBL', buf, 0)
  2439. s = (' mask %#x dynModel %u fixmode %d fixedAlt %d FixedAltVar %u\n'
  2440. ' minElev %d drLimit %u pDop %u tDop %u pAcc %u tAcc %u\n'
  2441. ' staticHoldThresh %u dgpsTimeOut %u cnoThreshNumSVs %u\n'
  2442. ' cnoThresh %u res %u staticHoldMaxDist %u utcStandard %u\n'
  2443. ' reserved x%x %x' % u)
  2444. if VERB_DECODE <= opts['verbosity']:
  2445. s += ("\n dynModel (%s) fixMode (%s) utcStandard (%s)"
  2446. "\n mask (%s)" %
  2447. (index_s(u[1], self.cfg_nav5_dyn),
  2448. index_s(u[2], self.cfg_nav5_fix),
  2449. index_s(u[17] >> 4, self.utc_std),
  2450. flag_s(u[0] >> 4, self.cfg_nav5_mask)))
  2451. return s
  2452. cfg_navx5_mask1 = {
  2453. 4: "minMax",
  2454. 8: "minCno",
  2455. 0x40: "initial3dfix",
  2456. 0x200: "wknRoll",
  2457. 0x400: "ackAid",
  2458. 0x2000: "ppp",
  2459. 0x4000: "aop",
  2460. }
  2461. cfg_navx5_mask2 = {
  2462. 0x40: "adr",
  2463. 0x80: "sigAttenComp",
  2464. }
  2465. cfg_navx5_aop = {
  2466. 1: "useAOP",
  2467. }
  2468. def cfg_navx5(self, buf):
  2469. """UBX-CFG-NAVX5 decode, Navigation Engine Expert Settings"""
  2470. # deprecated protver 23+
  2471. # length == 20 case seems broken?
  2472. m_len = len(buf)
  2473. u = struct.unpack_from('<HHLHBBBBBHBH', buf, 0)
  2474. s = (" version %u mask1 x%x mask2 x%x reserved1 %u minSVs %u "
  2475. "maxSVs %u minCNO %u\n"
  2476. " reserved2 %u iniFix3D %u reserved3 %u ackAiding %u "
  2477. "wknRollover %u" % u)
  2478. # length == 40 in protver 27
  2479. if 40 <= m_len:
  2480. u1 = struct.unpack_from('<BBHHBBHHLHBB', buf, 20)
  2481. s += ("\n sigAttenCompMode %u reserved456 %u %u %u usePPP %u "
  2482. "aopCfg %u reserved7 %u"
  2483. "\n aopOrbMaxErr %u reserved89 %u %u %u useAdr %u" % u1)
  2484. if VERB_DECODE <= opts['verbosity']:
  2485. s += ("\n mask1 (%s)"
  2486. "\n mask2 (%s) aopCfg (%s)" %
  2487. (flag_s(u[1], self.cfg_navx5_mask1),
  2488. flag_s(u[2], self.cfg_navx5_mask2),
  2489. flag_s(u1[5], self.cfg_navx5_aop)))
  2490. return s
  2491. def cfg_msg(self, buf):
  2492. """UBX-CFG-MSG decode"""
  2493. m_len = len(buf)
  2494. if 2 == m_len:
  2495. u = struct.unpack_from('<BB', buf, 0)
  2496. return ' Rate request %s' % self.class_id_s(u[0], u[1])
  2497. if 3 == m_len:
  2498. u = struct.unpack_from('<BBB', buf, 0)
  2499. return (' Rate set %s Rate %d' %
  2500. (self.class_id_s(u[0], u[1]), u[2]))
  2501. if 8 != m_len:
  2502. return " Bad Length %s" % m_len
  2503. u = struct.unpack_from('<BBBBBBBB', buf, 0)
  2504. s = (' %s Rates %u %u %u %u %u %u' %
  2505. (self.class_id_s(u[0], u[1]), u[2], u[3], u[4], u[5], u[6], u[7]))
  2506. return s
  2507. cfg_nmea_filter = {
  2508. 1: "posFilt",
  2509. 2: "mskPosFilt",
  2510. 4: "timeFilt",
  2511. 8: "dateFilt",
  2512. 0x10: "gpsOnlyFilter",
  2513. 0x20: "trackFilt",
  2514. }
  2515. cfg_nmea_ver = {
  2516. 0x11: "2.1",
  2517. 0x23: "2,3",
  2518. 0x40: "4.0",
  2519. 0x41: "4.10",
  2520. }
  2521. cfg_nmea_flags = {
  2522. 1: "compat",
  2523. 2: "consider",
  2524. 4: "limit82",
  2525. 8: "highPrec",
  2526. }
  2527. cfg_nmea_svn = {
  2528. 0: "Strict",
  2529. 1: "Extended",
  2530. }
  2531. cfg_nmea_mtid = {
  2532. 0: "Default",
  2533. 1: "GP",
  2534. 2: "GL",
  2535. 3: "GN",
  2536. 4: "GA",
  2537. 5: "GB",
  2538. }
  2539. cfg_nmea_gtid = {
  2540. 0: "GNSS Specific",
  2541. 1: "Main",
  2542. }
  2543. cfg_nmea_gnssfilt = {
  2544. 1: "gps",
  2545. 2: "sbas",
  2546. 0x10: "qzss",
  2547. 0x20: "glonass",
  2548. 0x40: "beidou",
  2549. }
  2550. def cfg_nmea(self, buf):
  2551. """UBX-CFG-NMEA decode, Extended NMEA protocol configuration V1"""
  2552. u = struct.unpack_from('<BBBBLBBBBBBBBBBBB', buf, 0)
  2553. s = (" filter x%x nmeaVersion x%x numSv %u flags x%x "
  2554. "gnssToFilter x%x\n"
  2555. " svNumbering %u mainTalkerId %u gsvTalkerId %u version %u\n"
  2556. " bdsTalkerId %u %u reserved1 %u %u %u %u %u %u" % u)
  2557. if VERB_DECODE <= opts['verbosity']:
  2558. s += ("\n filter (%s) NMEA Version (%s) numSv (%s) flags (%s)"
  2559. "\n gnssToFilter (%s) svNumbering (%s) mainTalkerId (%s)"
  2560. "\n gsvTalkerId (%s)" %
  2561. (flag_s(u[0], self.cfg_nmea_filter),
  2562. index_s(u[1], self.cfg_nmea_ver),
  2563. u[2] if 0 != u[2] else "Unlimited",
  2564. flag_s(u[3], self.cfg_nmea_flags),
  2565. flag_s(u[4], self.cfg_nmea_gnssfilt),
  2566. index_s(u[5], self.cfg_nmea_svn),
  2567. index_s(u[6], self.cfg_nmea_mtid),
  2568. index_s(u[7], self.cfg_nmea_gtid)))
  2569. return s
  2570. cfg_nvs_mask = {
  2571. 0x20000: 'alm',
  2572. 0x20000000: 'aop',
  2573. }
  2574. def cfg_nvs(self, buf):
  2575. """UBX-CFG-NVS decode, Clear,
  2576. Save and Load non-volatile storage data"""
  2577. # u-blox 6, protVer 7.03
  2578. u = struct.unpack_from('<LLLB', buf, 0)
  2579. s = (' clearMask: %#x (%s)\n' %
  2580. (u[0], flag_s(u[0], self.cfg_nvs_mask)))
  2581. s += (' saveMask: %#x (%s)\n' %
  2582. (u[1], flag_s(u[1], self.cfg_nvs_mask)))
  2583. s += (' loadMask: %#x (%s)\n' %
  2584. (u[2], flag_s(u[2], self.cfg_nvs_mask)))
  2585. s += (' deviceMask: %#x (%s)\n' %
  2586. (u[3], flag_s(u[3], self.cfg_cfg_dev)))
  2587. return s
  2588. cfg_odo_flags = {
  2589. 1: "useODO",
  2590. 2: "useCOG",
  2591. 4: "useLPVel",
  2592. 8: "useLPCog",
  2593. }
  2594. cfg_odo_profile = {
  2595. 0: "Running",
  2596. 1: "Cycling",
  2597. 2: "Swimming",
  2598. 3: "Car",
  2599. 4: "Custom",
  2600. }
  2601. def cfg_odo(self, buf):
  2602. """UBX-CFG-ODO decode, Odometer, Low-speed COG Engine Settings"""
  2603. u = struct.unpack_from('<BBBBBBBBBBBBBBBBBBBB', buf, 0)
  2604. s = (" version %u reserved1 %u %u %u flags x%x odoCfg x%x\n"
  2605. " reserved2 %u %u %u %u %u %u\n"
  2606. " cagMaxSpeed %u cogMaxPosAcc %u reserved3 %u %u\n"
  2607. " velLpGain %u cogLpGain %u reserved4 %u %u" % u)
  2608. if VERB_DECODE <= opts['verbosity']:
  2609. s += ("\n flags (%s) odoCfg (%s)" %
  2610. (flag_s(u[4], self.cfg_odo_flags),
  2611. index_s(u[5], self.cfg_odo_profile)))
  2612. return s
  2613. cfg_pm_flags = {
  2614. 0x20: "extintWake",
  2615. 0x40: "extintBackup",
  2616. 0x80: "extintInactive",
  2617. 0x400: "waitTimeFix",
  2618. 0x800: "updateRTC",
  2619. 0x1000: "updateEPH",
  2620. 0x10000: "doNotEnterOff",
  2621. }
  2622. cfg_pm_limitPeakCurr = {
  2623. 0: "disabled",
  2624. 1: "enabled",
  2625. 2: "reserved",
  2626. 3: "reserved3",
  2627. }
  2628. def cfg_pm(self, buf):
  2629. """UBX-CFG-PM decode, Poswer Management Configuration"""
  2630. # u-blox 5, protVer 6.00 to 6.02
  2631. u = struct.unpack_from('<BBBBLLLLHH', buf, 0)
  2632. s = (" version %u res1 %u res2 %u res3 %u flags x%x updatePeriod %u\n"
  2633. " searchPeriod %u gridOffset %u onTime %u minAcqTime %u\n" % u)
  2634. if VERB_DECODE <= opts['verbosity']:
  2635. s += ('\n flags (%s) extintSel (EXTINT%u) '
  2636. 'limitPeakCurr (%s)' %
  2637. (flag_s(u[4], self.cfg_pm_flags),
  2638. (u[4] >> 4) & 1,
  2639. index_s((u[4] >> 8) & 3, self.cfg_pm_limitPeakCurr)))
  2640. return s
  2641. cfg_pm2_mode = {
  2642. 0: "ON/OFF operation (PSMOO)",
  2643. 1: "Cyclic tracking operation (PSMCT)",
  2644. 2: "reserved",
  2645. 3: "reserves3",
  2646. }
  2647. cfg_pm2_optTarget = {
  2648. 0: "performance",
  2649. 1: "power save",
  2650. }
  2651. def cfg_pm2(self, buf):
  2652. """UBX-CFG-PM2 decode, Extended Power Mode Configuration"""
  2653. # three versions, two lengths
  2654. # "version" 1 is 44 bytes
  2655. # "version" 2 is 48 bytes,protver <= 22
  2656. # "version" 2 is 48 bytes,protver >= 23
  2657. m_len = len(buf)
  2658. # 48 bytes protver 18+
  2659. u = struct.unpack_from('<BBBBLLLLHHLLLLL', buf, 0)
  2660. s = (" version %u reserved1 %u maxStartupStateDur %u reserved2 %u\n"
  2661. " flags x%x updatePeriod %u searchPeriod %u\n"
  2662. " gridOffset %u ontime %u minAcqTime %u\n"
  2663. " reserved3 %u %u %u %u %u" % u)
  2664. if 48 <= m_len:
  2665. u1 = struct.unpack_from('<L', buf, 44)
  2666. s += "\n extintInactivityMs %u" % u1
  2667. if VERB_DECODE <= opts['verbosity']:
  2668. s += ('\n flags (%s) extintSel (EXTINT%u)'
  2669. '\n limitPeakCurr (%s)'
  2670. '\n optTarget (%s) mode (%s)' %
  2671. (flag_s(u[4], self.cfg_pm_flags),
  2672. (u[4] >> 4) & 1,
  2673. index_s((u[4] >> 8) & 3, self.cfg_pm_limitPeakCurr),
  2674. index_s((u[4] >> 1) & 3, self.cfg_pm2_optTarget,
  2675. nf="reserved"),
  2676. index_s((u[4] >> 17) & 3, self.cfg_pm2_mode)))
  2677. return s
  2678. cfg_pms_values = {0: "Full power",
  2679. 1: "Balanced",
  2680. 2: "Interval",
  2681. 3: "Aggressive with 1Hz",
  2682. 4: "Aggressive with 2Hz",
  2683. 5: "Aggressive with 4Hz",
  2684. 0xff: "Invalid"
  2685. }
  2686. def cfg_pms(self, buf):
  2687. """UBX-CFG-PMS decode, Power Mode Setup"""
  2688. u = struct.unpack_from('<BBHHBB', buf, 0)
  2689. s = (' version %u powerSetupValue %u'
  2690. ' period %u onTime %#x reserved1 %u %u' % u)
  2691. if VERB_DECODE <= opts['verbosity']:
  2692. s += ('\n powerSetupValue (%s)' %
  2693. index_s(u[1], self.cfg_pms_values))
  2694. return s
  2695. cfg_prt_flags = {
  2696. 0x2: 'extendedTxTimeout',
  2697. }
  2698. cfg_prt_proto = {
  2699. 0x1: 'UBX',
  2700. 0x2: 'NMEA',
  2701. 0x4: 'RTCM2', # not in u-blox 5
  2702. 0x20: 'RTCM3', # protVer 20+
  2703. }
  2704. def cfg_prt(self, buf):
  2705. """UBX-CFG-PRT decode, Port Configuration """
  2706. m_len = len(buf)
  2707. portid = buf[0]
  2708. idstr = '%u (%s)' % (portid, self.port_ids.get(portid, '?'))
  2709. if 1 == m_len:
  2710. return " Poll request PortID %s" % idstr
  2711. # Note that this message can contain multiple 20-byte submessages, but
  2712. # only in the send direction, which we don't currently do.
  2713. if 20 > m_len:
  2714. return " Bad Length %s" % m_len
  2715. u = struct.unpack_from('<BBHLLHHHH', buf, 0)
  2716. s = [' PortID %s reserved1 %u txReady %#x' % (idstr, u[1], u[2])]
  2717. s.append({1: ' mode %#x baudRate %u',
  2718. 2: ' mode %#x baudRate %u',
  2719. 3: ' reserved2 [%u %u]',
  2720. 4: ' mode %#x reserved2 %u',
  2721. 0: ' mode %#x reserved2 %u',
  2722. }.get(portid, ' ???: %u,%u') % tuple(u[3:5]))
  2723. s.append(' inProtoMask %#x outProtoMask %#x' % tuple(u[5:7]))
  2724. s.append({1: ' flags %#x reserved2 %u',
  2725. 2: ' flags %#x reserved2 %u',
  2726. 3: ' reserved3 %u reserved4 %u',
  2727. 4: ' flags %#x reserved3 %u',
  2728. 0: ' flags %#x reserved3 %u',
  2729. }.get(portid, ' ??? %u,%u') % tuple(u[7:]))
  2730. if portid == 0:
  2731. s.append(' slaveAddr %#x' % (u[3] >> 1 & 0x7F))
  2732. s.append(' inProtoMask (%s)\n'
  2733. ' outProtoMask (%s)' %
  2734. (flag_s(u[5], self.cfg_prt_proto),
  2735. flag_s(u[6], self.cfg_prt_proto)))
  2736. if portid in set([1, 2, 4, 0]):
  2737. s.append(' flags (%s)' % flag_s(u[7], self.cfg_prt_flags))
  2738. return '\n'.join(s)
  2739. cfg_pwr_state = {
  2740. 0x52554E20: "GNSS running",
  2741. 0x53544F50: "GNSS stopped",
  2742. 0x42434B50: "Software Backup",
  2743. }
  2744. def cfg_pwr(self, buf):
  2745. """UBX-CFG-PWR decode, Put receiver in a defined power state"""
  2746. u = struct.unpack_from('<BBBBL', buf, 0)
  2747. s = (" version %u reserved %u %u %u state %u" %
  2748. (u + (index_s(u[0], self.cfg_pwr_state),)))
  2749. return s
  2750. cfg_rate_system = {
  2751. 0: "UTC",
  2752. 1: "GPS",
  2753. 2: "GLONASS",
  2754. 3: "BeiDou",
  2755. 4: "Galileo",
  2756. }
  2757. def cfg_rate(self, buf):
  2758. """UBX-CFG-RATE decode, Navigation/Measurement Rate Settings"""
  2759. u = struct.unpack_from('<HHH', buf, 0)
  2760. s = (" measRate %u navRate %u timeRef %u (%s)" %
  2761. (u + (index_s(u[2], self.cfg_rate_system),)))
  2762. return s
  2763. cfg_rinv_flags = {
  2764. 1: "dump",
  2765. 2: "binary",
  2766. }
  2767. def cfg_rinv(self, buf):
  2768. """UBX-CFG-RINV decode, Contents of Remote Inventory"""
  2769. # u-blox 5, protVer 6.00 to 6.02
  2770. m_len = len(buf)
  2771. u = struct.unpack_from('<B', buf, 0)
  2772. s = (" flags x%x (%s) data:" %
  2773. (u + (flag_s(u[0], self.cfg_rinv_flags),)))
  2774. for i in range(0, m_len - 1):
  2775. if 0 == (i % 8):
  2776. s += "\n "
  2777. u = struct.unpack_from('<B', buf, i + 1)
  2778. s += " %3u" % u
  2779. return s
  2780. cfg_rst_navBbr = {
  2781. 0: "Hot Start",
  2782. 1: "Warm Start",
  2783. 0xffff: "Cold Start",
  2784. }
  2785. cfg_rst_navBbr1 = {
  2786. 1: "eph",
  2787. 2: "alm",
  2788. 4: "health",
  2789. 8: "klob",
  2790. 0x10: "pos",
  2791. 0x20: "clkd",
  2792. 0x40: "osc",
  2793. 0x80: "utc",
  2794. 0x100: "rtc",
  2795. 0x8000: "aop",
  2796. }
  2797. cfg_rst_resetMode = {
  2798. 0: "Hardware reset",
  2799. 1: "Software reset",
  2800. 2: "Software reset (GNSS only)",
  2801. 4: "Hardware reset, after shutdown",
  2802. 8: "Controlled GNSS stop",
  2803. 9: "Controlled GNSS start",
  2804. }
  2805. def cfg_rst(self, buf):
  2806. """"UBX-CFG-RST decode, Reset Receiver/Clear Backup Data Structures"""
  2807. u = struct.unpack_from('<HBB', buf, 0)
  2808. s = ' navBbrmask x%x resetMode %u reserved %u' % u
  2809. if VERB_DECODE <= opts['verbosity']:
  2810. # fun, two different ways to decode...
  2811. s1 = index_s(u[0], self.cfg_rst_navBbr, nf="")
  2812. if not s1:
  2813. s1 = flag_s(u[0], self.cfg_rst_navBbr1)
  2814. s += ("\n resetMode (%s)"
  2815. "\n navBbrMask (%s)" %
  2816. (index_s(u[1], self.cfg_rst_resetMode),
  2817. s1))
  2818. return s
  2819. cfg_rxm_lpMode = {
  2820. 0: "Continuous Mode",
  2821. 1: "Power Save Mode",
  2822. 4: "Continuous Mode",
  2823. }
  2824. def cfg_rxm(self, buf):
  2825. """UBX-CFG-RXM decode, Navigation/Measurement"""
  2826. u = struct.unpack_from('<BB', buf, 0)
  2827. s = (" reserved1 %u lpMode %u (%s)" %
  2828. (u + (index_s(u[1], self.cfg_rxm_lpMode),)))
  2829. return s
  2830. cfg_sbas_mode = {
  2831. 1: "enabled",
  2832. 2: "test",
  2833. }
  2834. cfg_sbas_usage = {
  2835. 1: "range",
  2836. 2: "diffCorr",
  2837. 3: "integrity",
  2838. }
  2839. cfg_sbas_scanmode1 = {
  2840. 1: "PRN120",
  2841. 2: "PRN121",
  2842. 4: "PRN122",
  2843. 8: "PRN123",
  2844. 0x10: "PRN124",
  2845. 0x20: "PRN125",
  2846. 0x40: "PRN126",
  2847. 0x80: "PRN127",
  2848. 0x100: "PRN128",
  2849. 0x200: "PRN129",
  2850. 0x400: "PRN130",
  2851. 0x800: "PRN131",
  2852. 0x1000: "PRN132",
  2853. 0x2000: "PRN133",
  2854. 0x4000: "PRN134",
  2855. 0x8000: "PRN135",
  2856. 0x10000: "PRN136",
  2857. 0x20000: "PRN137",
  2858. 0x40000: "PRN138",
  2859. 0x80000: "PRN139",
  2860. 0x100000: "PRN140",
  2861. 0x200000: "PRN141",
  2862. 0x400000: "PRN142",
  2863. 0x800000: "PRN143",
  2864. 0x1000000: "PRN144",
  2865. 0x2000000: "PRN145",
  2866. 0x4000000: "PRN146",
  2867. 0x8000000: "PRN147",
  2868. 0x10000000: "PRN148",
  2869. 0x20000000: "PRN149",
  2870. 0x40000000: "PRN150",
  2871. 0x80000000: "PRN151",
  2872. }
  2873. cfg_sbas_scanmode2 = {
  2874. 1: "PRN152",
  2875. 2: "PRN153",
  2876. 4: "PRN154",
  2877. 8: "PRN155",
  2878. 0x10: "PRN156",
  2879. 0x20: "PRN157",
  2880. 0x40: "PRN158",
  2881. }
  2882. def cfg_sbas(self, buf):
  2883. """UBX-CFG-SBAS decode, SBAS Configuration"""
  2884. u = struct.unpack_from('<BBBBL', buf, 0)
  2885. s = (" mode x%x usage x%x maxSBAS %u scanMode2 x%x"
  2886. " scanMode1: x%x" % u)
  2887. if VERB_DECODE <= opts['verbosity']:
  2888. s += ("\n mode (%s) usage (%s) scanmode2 (%s)"
  2889. "\n scanmode1 (%s)" %
  2890. (flag_s(u[0], self.cfg_sbas_mode),
  2891. flag_s(u[1], self.cfg_sbas_usage),
  2892. flag_s(u[3], self.cfg_sbas_scanmode2),
  2893. flag_s(u[4], self.cfg_sbas_scanmode1)))
  2894. return s
  2895. cfg_slas_mode = {
  2896. 1: "enabled",
  2897. 2: "test",
  2898. 4: "raim",
  2899. }
  2900. def cfg_slas(self, buf):
  2901. """UBX-CFG-SLAS decode, SLAS configuration"""
  2902. # protVer 19.2 (ADR, UDR only)
  2903. u = struct.unpack_from('<BBH', buf, 0)
  2904. s = " mode %u reserved1 %u %u" % u
  2905. if VERB_DECODE <= opts['verbosity']:
  2906. s += "\n mode (%s)" % (flag_s(u[0], self.cfg_slas_mode))
  2907. return s
  2908. cfg_smgr_messageCfg = {
  2909. 1: "measInternal",
  2910. 2: "measGNSS",
  2911. 4: "measEXTINT0",
  2912. 8: "measEXTINT1",
  2913. }
  2914. def cfg_smgr(self, buf):
  2915. """UBX-CFG-SMGR decode, Synchronization manager configuration"""
  2916. u = struct.unpack_from('<BBHHBBHHHHL', buf, 0)
  2917. s = (" version %u minGNSSFix %u maxFreqChangeRate %u "
  2918. "maxPhaseCorrR %u\n"
  2919. " reserved1 %u %u freqTolerance %u timeTolerance %u "
  2920. "messageCfg x%x\n"
  2921. " maxSlewRate %u flags x%x" % u)
  2922. if VERB_DECODE <= opts['verbosity']:
  2923. s += ("\n messageCfg (%s)" %
  2924. (flag_s(u[7], self.cfg_smgr_messageCfg)))
  2925. return s
  2926. cfg_tmode_timeMode = {
  2927. 0: "Disabled",
  2928. 1: "Survey In",
  2929. 2: "Fixed Mode",
  2930. }
  2931. def cfg_tmode(self, buf):
  2932. """UBX-CFG-TMODE decode, Time Mode Settings"""
  2933. # u-blox 5, protVer 5.00 to 6.02 (timing feature only)
  2934. u = struct.unpack_from('<BBHlllLLL', buf, 0)
  2935. s = (' timeMode %u fixedPosX %d fixedPosY %d fixedPosZ %d\n'
  2936. ' fixedPosVar %u svinMinDur %u svinAccLimit %u' % u)
  2937. if VERB_DECODE <= opts['verbosity']:
  2938. s += ("\n timeMode (%s)" %
  2939. (index_s(u[0], self.cfg_tmode_timeMode)))
  2940. return s
  2941. cfg_tmode2_flags = {
  2942. 1: "lla",
  2943. 2: "altInv",
  2944. }
  2945. def cfg_tmode2(self, buf):
  2946. """UBX-CFG-TMODE2 decode, Time Mode Settings 2"""
  2947. # u-blox 6, 7 and 8 (timing only)
  2948. # not in u-blox 9
  2949. # protver 13+
  2950. u = struct.unpack_from('<BBHlllLLL', buf, 0)
  2951. s = (' timeMode %u reserved1 %u usage %#x\n'
  2952. ' ecefXOrLat %d ecefYOrLon %d ecefZOrAlt %d\n'
  2953. ' fixedPosAcc %u svinMinDur %u svinAccLimit %u' % u)
  2954. if VERB_DECODE <= opts['verbosity']:
  2955. s += ("\n timeMode (%s) flags (%s)" %
  2956. (index_s(u[0], self.cfg_tmode_timeMode),
  2957. flag_s(u[2], self.cfg_tmode2_flags)))
  2958. return s
  2959. cfg_tmode3_flags = {
  2960. 0x100: "lla",
  2961. }
  2962. def cfg_tmode3(self, buf):
  2963. """UBX-CFG-TMODE3 decode, Time Mode Settings 3"""
  2964. # in M8 HP only, protver 20 to 23
  2965. # Not in u-blox 7-, HP only
  2966. # undocumented, but present in ZED-F9T
  2967. # documented in ZED-F9P, protver 27
  2968. # deprecated in 23.01
  2969. u = struct.unpack_from('<BBHlllbbbBLLLLL', buf, 0)
  2970. s = (' version %u reserved1 %u flags x%x\n'
  2971. ' ecefXOrLat %d ecefYOrLon %d ecefZOrAlt %d\n'
  2972. ' ecefXOrLatHP %d ecefYOrLonHP %d ecefZOrAltHP %d\n'
  2973. ' reserved2 %u fixedPosAcc %u svinMinDur %u svinAccLimit %u\n'
  2974. ' reserved3 %u %u' % u)
  2975. if VERB_DECODE <= opts['verbosity']:
  2976. s += ("\n flags (%s %s)" %
  2977. (index_s(u[2], self.cfg_tmode_timeMode),
  2978. flag_s(u[2] & 0x100, self.cfg_tmode3_flags)))
  2979. return s
  2980. cfg_tp_status = {
  2981. -1: "negative",
  2982. 0: "off",
  2983. 1: "positive",
  2984. }
  2985. cfg_tp_timeRef = {
  2986. 0: "UTC",
  2987. 1: "GPS",
  2988. 2: "Local",
  2989. }
  2990. cfg_tp_flags = {
  2991. 1: "syncMode",
  2992. }
  2993. def cfg_tp(self, buf):
  2994. """UBX-CFG-TP decode, Time Pulse Settings"""
  2995. # protVer 4.00 to 6.02
  2996. u = struct.unpack_from('<HHbBBBhhl', buf, 0)
  2997. s = (' interval %u length %u status %d timeRef %u flags x%x res x%x\n'
  2998. ' antennaCableDelay %u rfGroupDelay %d userDelay %d' % u)
  2999. if VERB_DECODE <= opts['verbosity']:
  3000. s += ("\n flags (%s, %s, %s)" %
  3001. (index_s(u[2], self.cfg_tp_status),
  3002. index_s(u[3], self.cfg_tp_timeRef),
  3003. flag_s(u[4], self.cfg_tp_flags)))
  3004. return s
  3005. cfg_tp5_flags = {
  3006. 1: "Active",
  3007. 2: "lockGnssFreq",
  3008. 4: "lockedOtherSet",
  3009. 8: "isFreq",
  3010. 0x10: "isLength",
  3011. 0x20: "alignToTow",
  3012. 0x40: "RisingEdge",
  3013. }
  3014. cfg_tp5_grid = {
  3015. 0: 'UTC',
  3016. 1: 'GPS',
  3017. 2: 'Glonass',
  3018. 3: 'BeiDou',
  3019. 4: 'Galileo',
  3020. }
  3021. def cfg_tp5(self, buf):
  3022. """UBX-CFG-TP5 decode, Time Pulse Parameters"""
  3023. m_len = len(buf)
  3024. if 1 == m_len:
  3025. return " Poll request tpIdx %d" % buf[0]
  3026. if 32 > m_len:
  3027. return " Bad Length %s" % m_len
  3028. u = struct.unpack_from('<BBHhhLLLLlL', buf, 0)
  3029. s = (" tpIdx %u version %u reserved1 %u\n"
  3030. " antCableDelay %d rfGroupDelay %d freqPeriod %u "
  3031. "freqPeriodLock %u\n"
  3032. " pulseLenRatio %u pulseLenRatioLock %u userConfigDelay %d\n"
  3033. " flags x%x" % u)
  3034. if VERB_DECODE <= opts['verbosity']:
  3035. s += ("\n flags (%s)"
  3036. "\n gridToGps (%s) syncMode %d" %
  3037. (flag_s(u[10] & 0x7f, self.cfg_tp5_flags),
  3038. index_s((u[10] >> 7) & 0x0f, self.cfg_tp5_grid),
  3039. (u[10] >> 11) & 0x03))
  3040. return s
  3041. cfg_usb_flags = {1: "reEnum "}
  3042. cfg_usb_powerMode = {0: "self-powered",
  3043. 2: "bus-powered",
  3044. }
  3045. def cfg_usb(self, buf):
  3046. """UBX-CFG-USB decode, USB Configuration"""
  3047. u = struct.unpack_from('<HHHHHH', buf, 0)
  3048. s = (' vendorID %#x productID %#x reserved1 %u reserved2 %u\n'
  3049. ' powerConsumption %u mA flags %#x' % u)
  3050. if VERB_DECODE <= opts['verbosity']:
  3051. s += ("\n flags (%s%s)" %
  3052. (flag_s(u[5] & 1, self.cfg_usb_flags),
  3053. index_s(u[5] & 2, self.cfg_usb_powerMode)))
  3054. s += ('\n vendorString %s\n'
  3055. ' productString %s\n'
  3056. ' serialNumber %s' %
  3057. (gps.polystr(buf[12:43]).rstrip('\0'),
  3058. gps.polystr(buf[44:75]).rstrip('\0'),
  3059. gps.polystr(buf[76:107]).rstrip('\0')))
  3060. return s
  3061. cfg_valdel_layers = {
  3062. 1: 'ram',
  3063. 2: 'bbr',
  3064. 4: 'flash',
  3065. }
  3066. cfg_valget_layers = {
  3067. 0: 'ram',
  3068. 1: 'bbr',
  3069. 2: 'flash',
  3070. 7: 'default',
  3071. }
  3072. cfg_valxxx_trans = {
  3073. 0: "Transactionless",
  3074. 1: "(Re)start Transaction",
  3075. 2: "Continue Transaction",
  3076. 3: "Apply and end Transaction",
  3077. }
  3078. def cfg_valdel(self, buf):
  3079. """"UBX-CFG-VALDEL decode, Delete configuration items"""
  3080. m_len = len(buf)
  3081. # this is a poll options, so does not set min protver
  3082. u = struct.unpack_from('<BBBB', buf, 0)
  3083. s = ' version %u layer %#x transaction %#x reserved %u\n' % u
  3084. s += (' layers (%s) transaction (%s)' %
  3085. (flag_s(u[1], self.cfg_valdel_layers),
  3086. index_s(u[2], self.cfg_valxxx_trans)))
  3087. m_len -= 4
  3088. i = 0
  3089. while 0 < m_len:
  3090. u = struct.unpack_from('<L', buf, 4 + i * 4)
  3091. item = self.cfg_by_key(u[0])
  3092. s += ('\n item: %s/%#x' % (item[0], u[0]))
  3093. m_len -= 4
  3094. i += 1
  3095. return s
  3096. def cfg_valget(self, buf):
  3097. """"UBX-CFG-VALGET decode, Get configuration items"""
  3098. m_len = len(buf)
  3099. # version zero is a poll
  3100. # version one is the response
  3101. u = struct.unpack_from('<BBH', buf, 0)
  3102. s = ' version %u layer %u position %u\n' % u
  3103. s += ' layers (%s)' % index_s(u[1], self.cfg_valget_layers)
  3104. m_len -= 4
  3105. i = 0
  3106. if 0 == u[0]:
  3107. # this is a poll option, so does not set min protver
  3108. while 0 < m_len:
  3109. u = struct.unpack_from('<L', buf, 4 + i * 4)
  3110. item = self.cfg_by_key(u[0])
  3111. s += ('\n item %s/%#x' % (item[0], u[0]))
  3112. m_len -= 4
  3113. i += 1
  3114. else:
  3115. # answer to poll
  3116. # we are at least protver 27
  3117. if 27 > opts['protver']:
  3118. opts['protver'] = 27
  3119. # sort of duplicated in cfg_valset()
  3120. i += 4
  3121. while 4 < m_len:
  3122. u = struct.unpack_from('<L', buf, i)
  3123. m_len -= 4
  3124. i += 4
  3125. item = self.cfg_by_key(u[0])
  3126. cfg_type = self.item_to_type(item)
  3127. size = cfg_type[0]
  3128. if size > m_len:
  3129. s += "\nWARNING: not enough bytes!"
  3130. break
  3131. frmat = cfg_type[1]
  3132. # flavor = cfg_type[2] UNUSED
  3133. v = struct.unpack_from(frmat, buf, i)
  3134. s += ('\n item %s/%#x val %s' % (item[0], u[0], v[0]))
  3135. m_len -= size
  3136. i += size
  3137. if 0 < m_len:
  3138. s += "\nWARNING: %d extra bytes!" % m_len
  3139. return s
  3140. def cfg_valset(self, buf):
  3141. """"UBX-CFG-VALSET decode, Set configuration items"""
  3142. m_len = len(buf)
  3143. # this is a poll option, so does not set min protver
  3144. u = struct.unpack_from('<BBBB', buf, 0)
  3145. s = ' version %u layer %#x transaction %#x reserved %u\n' % u
  3146. s += (' layers (%s) transaction (%s)' %
  3147. (flag_s(u[1], self.cfg_valdel_layers),
  3148. index_s(u[2], self.cfg_valxxx_trans)))
  3149. # sort of duplicated in cfg_valget()
  3150. m_len -= 4
  3151. i = 4
  3152. while 4 < m_len:
  3153. u = struct.unpack_from('<L', buf, i)
  3154. m_len -= 4
  3155. i += 4
  3156. item = self.cfg_by_key(u[0])
  3157. cfg_type = self.item_to_type(item)
  3158. size = cfg_type[0]
  3159. # FIXME! should check for enough bytes to unpack from
  3160. frmat = cfg_type[1]
  3161. # flavor = cfg_type[2] UNUSED
  3162. v = struct.unpack_from(frmat, buf, i)
  3163. s += ('\n item %s/%#x val %s' % (item[0], u[0], v[0]))
  3164. m_len -= size
  3165. i += size
  3166. if 0 < m_len:
  3167. s += "\nWARNING: %d extra bytes!" % m_len
  3168. return s
  3169. cfg_ids = {
  3170. # in u-blox 5+
  3171. 0x00: {'str': 'PRT', 'dec': cfg_prt, 'minlen': 1,
  3172. 'name': 'UBX-CFG-PRT'},
  3173. # in u-blox 5+
  3174. 0x01: {'str': 'MSG', 'dec': cfg_msg, 'minlen': 2,
  3175. 'name': 'UBX-CFG-MSG'},
  3176. # in u-blox 5+
  3177. 0x02: {'str': 'INF', 'dec': cfg_inf, 'minlen': 1,
  3178. 'name': 'UBX-CFG-INF'},
  3179. # in u-blox 5+
  3180. 0x04: {'str': 'RST', 'dec': cfg_rst, 'minlen': 4,
  3181. 'name': 'UBX-CFG-RST'},
  3182. # in u-blox 5 to 9
  3183. 0x06: {'str': 'DAT', 'dec': cfg_dat, 'minlen': 2,
  3184. 'name': 'UBX-CFG-DAT'},
  3185. # u-blox 5, 6. Not in u-blox 7+
  3186. 0x07: {'str': 'TP', 'dec': cfg_tp, 'minlen': 28,
  3187. 'name': 'UBX-CFG-TP'},
  3188. # in u-blox 5+
  3189. 0x08: {'str': 'RATE', 'dec': cfg_rate, 'minlen': 6,
  3190. 'name': 'UBX-CFG-RATE'},
  3191. # in u-blox 5+
  3192. 0x09: {'str': 'CFG', 'dec': cfg_cfg, 'minlen': 12,
  3193. 'name': 'UBX-CFG-CFG'},
  3194. # Antaris 4, deprecated in u-blox 5/6, gone in 7
  3195. 0x0e: {'str': 'FXM', 'dec': cfg_fxn, 'minlen': 36,
  3196. 'name': 'UBX-CFG-FXM'},
  3197. # u-blox 5, 6, 7, 8
  3198. 0x11: {'str': 'RXM', 'dec': cfg_rxm, 'minlen': 2,
  3199. 'name': 'UBX-CFG-RXM'},
  3200. # in u-blox 6, SFDR only. Not in 5- or 7+
  3201. 0x12: {'str': 'EKF', 'minlen': 16, 'name': 'UBX-CFG-EKF'},
  3202. # in u-blox 5+
  3203. 0x13: {'str': 'ANT', 'dec': cfg_ant, 'minlen': 4,
  3204. 'name': 'UBX-CFG-ANT'},
  3205. # in u-blox 5+
  3206. 0x16: {'str': 'SBAS', 'dec': cfg_sbas, 'minlen': 8,
  3207. 'name': 'UBX-CFG-SBAS'},
  3208. # in u-blox 5+
  3209. 0x17: {'str': 'NMEA', 'dec': cfg_nmea, 'minlen': 20,
  3210. 'name': 'UBX-CFG-NMEA'},
  3211. # in u-blox 6+, Not in u-blox 5-
  3212. 0x1b: {'str': 'USB', 'dec': cfg_usb, 'minlen': 108,
  3213. 'name': 'UBX-CFG-USB'},
  3214. # u-blox 5 and 6. Not in u-blox 7+
  3215. 0x1d: {'str': 'TMODE', 'dec': cfg_tmode, 'minlen': 28,
  3216. 'name': 'UBX-CFG-TMODE'},
  3217. # in u-blox 8+. Not in u-blox 7-
  3218. 0x1e: {'str': 'ODO', 'dec': cfg_odo, 'minlen': 20,
  3219. 'name': 'UBX-CFG-ODO'},
  3220. # in u-blox 6, not in u-blox 7+
  3221. 0x22: {'str': 'NVS', 'dec': cfg_nvs, 'minlen': 13,
  3222. 'name': 'UBX-CFG-NVS'},
  3223. # in u-blox 5+
  3224. 0x23: {'str': 'NAVX5', 'dec': cfg_navx5, 'minlen': 20,
  3225. 'name': 'UBX-CFG-NAVX5'},
  3226. # in u-blox 6+. Not in 5-
  3227. 0x24: {'str': 'NAV5', 'dec': cfg_nav5, 'minlen': 36,
  3228. 'name': 'UBX-CFG-NAV5'},
  3229. # in u-blox 6. SFDR only. Not in u-blox 5- or 7+
  3230. 0x29: {'str': 'ESFGWT', 'minlen': 44, 'name': 'UBX-CFG-ESFGWT'},
  3231. # in u-blox 6+, Not u-blox 5-
  3232. 0x31: {'str': 'TP5', 'dec': cfg_tp5, 'minlen': 1,
  3233. 'name': 'UBX-CFG-TP5'},
  3234. # In u-blox 5, 6. Not in u-blox 7+
  3235. 0x32: {'str': 'PM', 'dec': cfg_pm, 'minlen': 24,
  3236. 'name': 'UBX-CFG-PM'},
  3237. # in u-blox 5+
  3238. 0x34: {'str': 'RINV', 'dec': cfg_rinv, 'minlen': 1,
  3239. 'name': 'UBX-CFG-RINV'},
  3240. # in u-blox 6+. Not in u-blox 5-
  3241. 0x39: {'str': 'ITFM', 'dec': cfg_itfm, 'minlen': 8,
  3242. 'name': 'UBX-CFG-ITFM'},
  3243. # in u-blox 6+. Not in u-blox 5-
  3244. 0x3b: {'str': 'PM2', 'dec': cfg_pm2, 'minlen': 44,
  3245. 'name': 'UBX-CFG-PM2'},
  3246. # in u-blox 6 and 7. Not in u-blox 5- or 8+
  3247. 0x3d: {'str': 'TMODE2', 'dec': cfg_tmode2, 'minlen': 28,
  3248. 'name': 'UBX-CFG-TMODE2'},
  3249. # in u-blox 7+ Not in u-blox 6-
  3250. 0x3e: {'str': 'GNSS', 'dec': cfg_gnss, 'minlen': 4,
  3251. 'name': 'UBX-CFG-GNSS'},
  3252. # in u-blox 7+ Not in u-blox 6-
  3253. 0x47: {'str': 'LOGFILTER', 'dec': cfg_logfilter, 'minlen': 12,
  3254. 'name': 'UBX-CFG-LOGFILTER'},
  3255. # Not in u-blox 7-, FTS only
  3256. 0x53: {'str': 'TXSLOT', 'minlen': 2, 'name': 'UBX-CFG-TXSLOT'},
  3257. # Not in u-blox 7-
  3258. 0x57: {'str': 'PWR', 'dec': cfg_pwr, 'minlen': 8,
  3259. 'name': 'UBX-CFG-PWR'},
  3260. # Not in u-blox 8-
  3261. 0x5c: {'str': 'HNR', 'dec': cfg_hnr, 'minlen': 4,
  3262. 'name': 'UBX-CFG-HNR'},
  3263. # Not in u-blox 7-
  3264. 0x60: {'str': 'ESRC', 'dec': cfg_esrc, 'minlen': 4,
  3265. 'name': 'UBX-CFG-ESRC'},
  3266. # Not in u-blox 8-
  3267. 0x61: {'str': 'DOSC', 'dec': cfg_dosc, 'minlen': 4,
  3268. 'name': 'UBX-CFG-DOSC'},
  3269. # Not in u-blox 8-
  3270. 0x62: {'str': 'SMGR', 'dec': cfg_smgr, 'minlen': 20,
  3271. 'name': 'UBX-CFG-SMGR'},
  3272. # Not in u-blox 8-
  3273. 0x69: {'str': 'GEOFENCE', 'dec': cfg_geofence, 'minlen': 8,
  3274. 'name': 'UBX-CFG-GEOFENCE'},
  3275. # Not in u-blox 8-
  3276. 0x70: {'str': 'DGNSS', 'dec': cfg_dgnss, 'minlen': 4,
  3277. 'name': 'UBX-CFG-DGNSS'},
  3278. # Not in u-blox 7-, HP only
  3279. # undocumented, but present in ZED-F9T
  3280. 0x71: {'str': 'TMODE3', 'dec': cfg_tmode3, 'minlen': 40,
  3281. 'name': 'UBX-CFG-TMODE3'},
  3282. # Not in u-blox 7-
  3283. 0x84: {'str': 'FIXSEED', 'dec': cfg_fixseed, 'minlen': 12,
  3284. 'name': 'UBX-CFG-FIXSEED'},
  3285. # Not in u-blox 7-
  3286. 0x85: {'str': 'DYNSEED', 'dec': cfg_dynseed, 'minlen': 12,
  3287. 'name': 'UBX-CFG-DYNSEED'},
  3288. # Not in u-blox 8-
  3289. 0x86: {'str': 'PMS', 'dec': cfg_pms, 'minlen': 8,
  3290. 'name': 'UBX-CFG-PMS'},
  3291. # in u-blox 9
  3292. 0x8a: {'str': 'VALSET', 'dec': cfg_valset, 'minlen': 4,
  3293. 'name': 'UBX-CFG-VALSET'},
  3294. # in u-blox 9
  3295. 0x8b: {'str': 'VALGET', 'dec': cfg_valget, 'minlen': 4,
  3296. 'name': 'UBX-CFG-VALGET'},
  3297. # in u-blox 9
  3298. 0x8c: {'str': 'VALDEL', 'dec': cfg_valdel, 'minlen': 4,
  3299. 'name': 'UBX-CFG-VALDEL'},
  3300. # u-blox 8
  3301. 0x8d: {'str': 'SLAS', 'dec': cfg_slas, 'minlen': 4,
  3302. 'name': 'UBX-CFG-SLAS'},
  3303. # only in u-blox 8
  3304. 0x93: {'str': 'BATCH', 'dec': cfg_batch, 'minlen': 8,
  3305. 'name': 'UBX-CFG-BATCH'},
  3306. }
  3307. # UBX-ESF-
  3308. # only with ADR or UDR products
  3309. esf_ids = {0x02: {'str': 'MEAS', 'minlen': 8, 'name': "UBX-ESF-MEAS"},
  3310. 0x03: {'str': 'RAW', 'minlen': 4, 'name': "UBX-ESF-RAW"},
  3311. 0x10: {'str': 'STATUS', 'minlen': 16, 'name': "UBX-ESF-STATUS"},
  3312. 0x15: {'str': 'INS', 'minlen': 16, 'name': "UBX-ESF-INS"},
  3313. }
  3314. # UBX-HNR-
  3315. # only with ADR or UDR products
  3316. hnr_ids = {0x00: {'str': 'PVT', 'minlen': 72, 'name': "UBX-HNR-PVT"},
  3317. 0x02: {'str': 'INS', 'minlen': 36, 'name': "UBX-HNR-INS"},
  3318. }
  3319. def inf_debug(self, buf):
  3320. """UBX-INF-DEBUG decode"""
  3321. return ' Debug: ' + gps.polystr(buf)
  3322. def inf_error(self, buf):
  3323. """UBX-INF-ERROR decode"""
  3324. return ' Error: ' + gps.polystr(buf)
  3325. def inf_notice(self, buf):
  3326. """UBX-INF-NOTICE decode"""
  3327. return ' Notice: ' + gps.polystr(buf)
  3328. def inf_test(self, buf):
  3329. """UBX-INF-TET decode"""
  3330. return ' Test: ' + gps.polystr(buf)
  3331. def inf_warning(self, buf):
  3332. """UBX-INF-WARNING decode"""
  3333. return ' Warning: ' + gps.polystr(buf)
  3334. inf_ids = {0x0: {'str': 'ERROR', 'dec': inf_error, 'minlen': 0,
  3335. 'name': 'UBX-INF-ERROR'},
  3336. 0x1: {'str': 'WARNING', 'dec': inf_warning, 'minlen': 0,
  3337. 'name': 'UBX-INF-WARNING'},
  3338. 0x2: {'str': 'NOTICE', 'dec': inf_notice, 'minlen': 0,
  3339. 'name': 'UBX-INF-NOTICE'},
  3340. 0x3: {'str': 'TEST', 'dec': inf_test, 'minlen': 0,
  3341. 'name': 'UBX-INF-TEST'},
  3342. 0x4: {'str': 'DEBUG', 'dec': inf_debug, 'minlen': 0,
  3343. 'name': 'UBX-INF-DEBUG'},
  3344. }
  3345. log_batch_contentValid = {
  3346. 1: 'extraPvt',
  3347. 2: 'extraOdo',
  3348. }
  3349. log_batch_valid = {
  3350. 1: 'validDate',
  3351. 2: 'validTime',
  3352. }
  3353. log_batch_fixType = {
  3354. 0: 'No Fix',
  3355. 2: '2D Fix',
  3356. 3: '3D Fix',
  3357. 4: 'GNSS + DR', # only UBX-LOG-RETRIEVEPOS
  3358. }
  3359. log_batch_flags = {
  3360. 1: 'gnssFixOK',
  3361. 2: 'diffSoln',
  3362. }
  3363. log_batch_psmState = {
  3364. 0: 'Not Active',
  3365. 4: 'Enabled',
  3366. 8: 'Acquisition',
  3367. 9: 'Tracking',
  3368. 0x10: 'Power Optimized Tracking',
  3369. 0x11: 'Inactive',
  3370. }
  3371. def log_batch(self, buf):
  3372. """UBX-LOG-BATCH decode
  3373. Oddly this is polled with UBX-LOG-RETRIEVEBATCH
  3374. """
  3375. # u-blox 8, protVer 23+
  3376. # in NEO-M9N, protVer 32.00
  3377. u = struct.unpack_from('<BBHLHBBBBBBLlBBBBllllLLlllllLLHHLLLL', buf, 0)
  3378. s = (" version %u contentValid x%x msgCnt %u iTow %u\n"
  3379. " year %u month %u day %u hour %u min %u sec %u valid x%x\n"
  3380. " tAcc %u fracSec %d fixType %u flags x%x flags2 x%x numSV %u\n"
  3381. " lon %d lat %d height %d hMSL %d\n"
  3382. " hAcc %u vAcc %u\n"
  3383. " vel N %u E %u D %u gSpeed %d headMot %d sAcc %u headAcc %u\n"
  3384. " pdep %u reserved1 x%x distance %u totalDistance %u\n"
  3385. " distanceStd %u reserved2 x%x" % u)
  3386. if VERB_DECODE <= opts['verbosity']:
  3387. # flags2 undocumented
  3388. s += ("\n contentValid (%s) valid (%s)"
  3389. "\n fixType (%s)"
  3390. "\n flags (%s) psmState (%s)" %
  3391. (flag_s(u[1], self.log_batch_contentValid),
  3392. flag_s(u[10], self.log_batch_valid),
  3393. index_s(u[13], self.log_batch_fixType),
  3394. flag_s(u[14] & 3, self.log_batch_flags),
  3395. index_s(u[14] & 0x1c, self.log_batch_psmState)))
  3396. return s
  3397. log_create_logCfg = {
  3398. 1: 'circular',
  3399. }
  3400. log_create_logSize = {
  3401. 0: 'Maximum safe',
  3402. 1: 'Minimum safe',
  3403. 2: 'user defined',
  3404. }
  3405. def log_create(self, buf):
  3406. """UBX-LOG-CREATE decode"""
  3407. # u-blox 7+, protVer 14+
  3408. u = struct.unpack_from('<BBBBL', buf, 0)
  3409. s = (" version %u logCfg x%x reserved1 x%x logSize %u\n"
  3410. " userDefinedSize %u" % u)
  3411. if VERB_DECODE <= opts['verbosity']:
  3412. s += ("\n logCfg (%s) logSize (%s)" %
  3413. (flag_s(u[1], self.log_create_logCfg),
  3414. index_s(u[3], self.log_create_logSize)))
  3415. return s
  3416. def log_erase(self, buf):
  3417. """UBX-LOG-ERASE decode"""
  3418. # u-blox 7+, protVer 14+
  3419. return " Erase Logged Data"
  3420. log_findtime_type = {
  3421. 0: 'request',
  3422. 1: 'response',
  3423. }
  3424. def log_findtime(self, buf):
  3425. """UBX-LOG-FINDTIME decode"""
  3426. # u-blox 7+, protVer 14+
  3427. m_len = len(buf)
  3428. # length 8 (version 1, type 1) is response.
  3429. # WTF; length 10 (version 0, type 0) is request
  3430. # length 12 (version 0, type 0) is request
  3431. if 8 == m_len:
  3432. # response
  3433. u = struct.unpack_from('<BBHL', buf, 0)
  3434. s = " version %u type %u reserved1 x%x entryNumber %u" % u
  3435. if 1 != u[0] or 1 != u[1]:
  3436. s += "\nWARNING: Unknown version, type (%u, %u)" % (u[0], u[1])
  3437. elif 10 == m_len:
  3438. # request
  3439. u = struct.unpack_from('<BBHBBBBBB', buf, 0)
  3440. s = (" version %u type %u\n"
  3441. " year %u month %u day %u hour %u min %u sec %u "
  3442. "reserved2 x%x" % u)
  3443. if 0 != u[0] or 0 != u[1]:
  3444. s += "\nWARNING: Unknown version, type (%u, %u)" % (u[0], u[1])
  3445. elif 12 == m_len:
  3446. # request
  3447. u = struct.unpack_from('<BBHHBBBBBB', buf, 0)
  3448. s = (" version %u type %u reserved1 x%x\n"
  3449. " year %u month %u day %u hour %u min %u sec %u "
  3450. "reserved2 x%x" % u)
  3451. if 0 != u[0] or 0 != u[1]:
  3452. s += "\nWARNING: Unknown version, type (%u, %u)" % (u[0], u[1])
  3453. else:
  3454. return " Bad Length %s" % m_len
  3455. if VERB_DECODE <= opts['verbosity']:
  3456. s += ("\n type (%s)" %
  3457. (index_s(u[1], self.log_findtime_type)))
  3458. return s
  3459. log_info_status = {
  3460. 8: 'recording',
  3461. 0x10: 'inactive',
  3462. 0x20: 'circular',
  3463. }
  3464. def log_info(self, buf):
  3465. """UBX-LOG-INFO decode"""
  3466. # u-blox 7+, protVer 14+
  3467. u = struct.unpack_from('<BBHLLLLLLHBBBBBBHBBBBBBBBH', buf, 0)
  3468. s = (" version %u reserved1 x%x x%x filestoreCapacity %u "
  3469. "reserved2 x%x x%x\n"
  3470. " currentMaxLogSize %u currentLogSize %u entryCount %u\n"
  3471. " oldestYear %u oldestMonth %u oldestDay %u \n"
  3472. " oldestHour %u oldestMin %u oldestSec %u reserved3 x%x\n"
  3473. " newestYear %u newestMonth %u newestDay %u \n"
  3474. " newestHour %u newestMin %u newestSec %u reserved4 x%x\n"
  3475. " status x%x reserved5 x%x x%x" % u)
  3476. if VERB_DECODE <= opts['verbosity']:
  3477. s += ("\n status (%s)" %
  3478. (flag_s(u[23], self.log_info_status)))
  3479. return s
  3480. log_retrievebatch_flags = {
  3481. 1: 'sendMonFirst',
  3482. }
  3483. def log_retrieve(self, buf):
  3484. """UBX-LOG-RETRIEVE decode"""
  3485. # u-blox 7+, protVer 14+
  3486. u = struct.unpack_from('<LLBBH', buf, 0)
  3487. s = " startNumber %u entryCount %u version %u reserved1 x%x %x" % u
  3488. return s
  3489. def log_retrievebatch(self, buf):
  3490. """UBX-LOG-RETRIEVEBATCH decode
  3491. Oddly this is the poll for UBX-LOG-BATCH
  3492. """
  3493. # u-blox 8, protVer 23.01 to 23.99
  3494. # not in u-blox 7 or 9
  3495. u = struct.unpack_from('<BBH', buf, 0)
  3496. s = (" version %u flags x%x reserved1 x%x" % u)
  3497. if VERB_DECODE <= opts['verbosity']:
  3498. # flags2 undocumented
  3499. s += ("\n flags (%s)" %
  3500. flag_s(u[1], self.log_retrievebatch_flags))
  3501. return s
  3502. def log_retrievepos(self, buf):
  3503. """UBX-LOG-RETRIEVEPOS decode"""
  3504. # u-blox 7+, protVer 14+
  3505. u = struct.unpack_from('<LlllLLLBBHBBBBBBBB', buf, 0)
  3506. s = (" entryIndex %u lon %d lat %d hMSL %d hAcc %u\n"
  3507. " gSpeed %u heading %u version %u fixType %u\n"
  3508. " year %u month %u day %u hour %u min %u sec %u\n"
  3509. " reserved1 x%x numSV %u reserved2 x%x" % u)
  3510. if VERB_DECODE <= opts['verbosity']:
  3511. s += ("\n fixType (%s)" %
  3512. (index_s(u[8], self.log_batch_fixType)))
  3513. return s
  3514. def log_retrieveposextra(self, buf):
  3515. """UBX-LOG-RETRIEVEPOSEXTRA decode"""
  3516. # u-blox 8+, protVer 15+
  3517. u = struct.unpack_from('<LBBHBBBBBBHLLLL', buf, 0)
  3518. s = (" entryIndex %u version %u reserved1 x%x\n"
  3519. " year %u month %u day %u hour %u minute %u seconds %u\n"
  3520. " reserved2 x%x %x distance %u reserved3 x%x %x %x" % u)
  3521. return s
  3522. def log_retrievestring(self, buf):
  3523. """UBX-LOG-RETRIEVESTRING decode"""
  3524. # u-blox 7+, protVer 14+
  3525. u = struct.unpack_from('<LBBHBBBBBBH', buf, 0)
  3526. s = (" entryIndex %u version %u reserved2 x%x\n"
  3527. " year %u month %u day %u hour %u min %u sec %u\n"
  3528. " reserved2 x%x byteCount %u\n"
  3529. " bytes \"" % u)
  3530. if 0 < u[10]:
  3531. for c in buf[16:16 + u[10]]:
  3532. if c < 127 and chr(c) in string.printable:
  3533. s += chr(c)
  3534. else:
  3535. s += "\\x%02x" % c
  3536. s += '"'
  3537. return s
  3538. def log_string(self, buf):
  3539. """UBX-LOG-STRING decode"""
  3540. # u-blox 7+, protVer 14+
  3541. m_len = len(buf)
  3542. if 256 < m_len:
  3543. return " Bad Length %s" % m_len
  3544. s = " bytes "
  3545. if 0 < m_len:
  3546. s += gps.polystr(binascii.hexlify(buf))
  3547. return s
  3548. # UBX-LOG-
  3549. log_ids = {
  3550. 0x03: {'str': 'ERASE', 'dec': log_erase, 'minlen': 0,
  3551. 'name': "UBX-LOG-ERASE"},
  3552. 0x04: {'str': 'STRING', 'dec': log_string, 'minlen': 0,
  3553. 'name': "UBX-LOG-STRING"},
  3554. 0x07: {'str': 'CREATE', 'dec': log_create, 'minlen': 8,
  3555. 'name': "UBX-LOG-CREATE"},
  3556. 0x08: {'str': 'INFO', 'dec': log_info, 'minlen': 48,
  3557. 'name': "UBX-LOG-INFO"},
  3558. 0x09: {'str': 'RETRIEVE', 'dec': log_retrieve, 'minlen': 12,
  3559. 'name': "UBX-LOG-RETRIEVE"},
  3560. 0x0b: {'str': 'RETRIEVEPOS', 'dec': log_retrievepos,
  3561. 'minlen': 40,
  3562. 'name': "UBX-LOG-RETRIEVEPOS"},
  3563. 0x0d: {'str': 'RETRIEVESTRING', 'dec': log_retrievestring,
  3564. 'minlen': 16,
  3565. 'name': "UBX-LOG-RETRIEVESTRING"},
  3566. 0x0e: {'str': 'FINDTIME', 'dec': log_findtime, 'minlen': 8,
  3567. 'name': "UBX-LOG-FINDTIME"},
  3568. 0x0f: {'str': 'RETRIEVEPOSEXTRA', 'dec': log_retrieveposextra,
  3569. 'minlen': 32,
  3570. 'name': "UBX-LOG-RETRIEVEPOSEXTRA"},
  3571. 0x10: {'str': 'RETRIEVEBATCH', 'dec': log_retrievebatch,
  3572. 'minlen': 2,
  3573. 'name': "UBX-LOG-RETRIEVEBATCH"},
  3574. 0x11: {'str': 'BATCH', 'dec': log_batch, 'minlen': 100,
  3575. 'name': "UBX-LOG-BATCH"},
  3576. }
  3577. # UBX-MGA-
  3578. def mga_dbd(self, buf):
  3579. """UBX-MGA-DBD- decode, Navigation Database Dump Entry"""
  3580. # max 172
  3581. u = struct.unpack_from('<LLL', buf, 0)
  3582. s = ' reserved1 %u %u %u' % u
  3583. # plus some anonymous data...
  3584. return s
  3585. mga_ids = {0x00: {'str': 'GPS', 'minlen': 16, 'name': "UBX-MGA-GPS"},
  3586. 0x02: {'str': 'GAL', 'minlen': 12, 'name': "UBX-MGA-GAL"},
  3587. 0x03: {'str': 'BDS', 'minlen': 16, 'name': "UBX-MGA-BDS"},
  3588. 0x05: {'str': 'QZSS', 'minlen': 12, 'name': "UBX-MGA-QZSS"},
  3589. 0x06: {'str': 'GLO', 'minlen': 20, 'name': "UBX-MGA-GLO"},
  3590. 0x20: {'str': 'ANO', 'minlen': 76, 'name': "UBX-MGA-ANO"},
  3591. 0x21: {'str': 'FLASH', 'minlen': 2, 'name': "UBX-MGA-FLASH"},
  3592. 0x40: {'str': 'INI', 'minlen': 12, 'name': "UBX-MGA-INI"},
  3593. 0x60: {'str': 'ACK', 'minlen': 8, 'name': "UBX-MGA-ACK"},
  3594. 0x80: {'str': 'DBD', 'dec': mga_dbd, 'minlen': 12,
  3595. 'name': "UBX-MGA-DBD"},
  3596. }
  3597. def mon_batch(self, buf):
  3598. """UBX-MON-BATCH decode, Data batching buffer status"""
  3599. # in u-blox 8 only, not in 7 or 9.
  3600. # protVer 23.01, gone in 24
  3601. u = struct.unpack_from('<BBBBHHHH', buf, 0)
  3602. s = (" version %u reserved1 %u %u %u fillLevel %u\n"
  3603. " dropsAll %u dropsSinceMon %u nextMsgCnt %u" % u)
  3604. return s
  3605. mon_comms_prot = {
  3606. 0: "UBX",
  3607. 1: "NMEA",
  3608. 2: "RTCM2",
  3609. 5: "RTCM3",
  3610. 255: "None",
  3611. }
  3612. def mon_comms(self, buf):
  3613. """UBX-MON-COMMS decode, Comm port information"""
  3614. # at least protver 27
  3615. if 27 > opts['protver']:
  3616. opts['protver'] = 27
  3617. u = struct.unpack_from('<BBBBBBBB', buf, 0)
  3618. s = ('version %u nPorts %u txErrors x%x reserved1 %u\n'
  3619. 'protIds %#x/%x/%x/%x' % u)
  3620. s += (' (%s/%s/%s/%s)\n' %
  3621. (index_s(u[4], self.mon_comms_prot),
  3622. index_s(u[5], self.mon_comms_prot),
  3623. index_s(u[6], self.mon_comms_prot),
  3624. index_s(u[7], self.mon_comms_prot)))
  3625. if VERB_DECODE <= opts['verbosity']:
  3626. errors = {
  3627. 0x40: "mem",
  3628. 0x80: "alloc",
  3629. }
  3630. s += " txErrors (%s)\n" % (flag_s(u[2], errors))
  3631. for i in range(0, u[1]):
  3632. u = struct.unpack_from('<HHLBBHLBBHHHHHLLL', buf, (8 + (i * 40)))
  3633. name = "%#x (%s)" % (u[0], index_s(u[0], self.port_ids1))
  3634. if 0 < i:
  3635. s += "\n"
  3636. s += ' Port: %s\n' % name
  3637. s += (' txPending %u txBytes %u txUsage %u txPeakUsage %u\n'
  3638. ' rxPending %u rxBytes %u rxUsage %u rxPeakUsage %u\n'
  3639. ' overrunErrs %u msgs %u/%u/%u/%u reserved %x %x '
  3640. 'skipped %u'
  3641. % u[1:])
  3642. return s
  3643. mon_gnss_supported_bits = {
  3644. 1: "GPS",
  3645. 2: "Glonass",
  3646. 4: "Beidou",
  3647. 8: "Galileo",
  3648. }
  3649. def mon_gnss(self, buf):
  3650. """UBX-MON-GNSS decode, Information message major GNSS selection"""
  3651. m_len = len(buf)
  3652. if 8 > m_len:
  3653. return " Bad Length %s" % m_len
  3654. u = struct.unpack_from('<BBBBBBBB', buf, 0)
  3655. s = (' version %u supported %#x defaultGnss %#x enabled %#x\n'
  3656. ' simultaneous %u reserved1 %u %u %u' % u)
  3657. if VERB_DECODE <= opts['verbosity']:
  3658. s += ('\n supported (%s)'
  3659. '\n defaultGnss (%s)'
  3660. '\n enabled (%s)' %
  3661. (flag_s(u[1], self.mon_gnss_supported_bits),
  3662. flag_s(u[2], self.mon_gnss_supported_bits),
  3663. flag_s(u[3], self.mon_gnss_supported_bits)))
  3664. return s
  3665. mon_hw_flags = {
  3666. 1: "rtcCalib",
  3667. 2: "safeBoot",
  3668. }
  3669. mon_hw_aPower = {
  3670. 0: "Off",
  3671. 1: "On",
  3672. }
  3673. jammingState = {
  3674. 0: "Unk",
  3675. 1: "OK",
  3676. 2: "Warning",
  3677. 3: "Critical",
  3678. }
  3679. def mon_hw(self, buf):
  3680. """UBX-MON-HW decode, Hardware Status"""
  3681. u = struct.unpack_from('<LLLLHHBBBBLBBBBBBBBBBBBBBBBBBBBLLL', buf, 0)
  3682. s = (' pinSel %#x pinBank %#x pinDir %#x pinVal %#x noisePerMS %u\n'
  3683. ' agcCnt %u aStatus %u aPower %u flags %#x reserved1 %u\n'
  3684. ' usedMask %#x\n'
  3685. ' VP %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n'
  3686. ' jamInd %u reserved2 %u %u pinIrq %#x pullH %#x pullL %#x' % u)
  3687. if VERB_DECODE <= opts['verbosity']:
  3688. s += ("\n aStatus (%s) aPower (%s) flags (%s) "
  3689. "jammingState (%s)" %
  3690. (index_s(u[6], self.mon_rf_antstat),
  3691. index_s(u[7], self.mon_hw_aPower),
  3692. index_s(u[8], self.mon_hw_flags),
  3693. index_s((u[6] >> 2) & 0x03, self.jammingState)))
  3694. return s
  3695. mon_hw2_cfgSource = {
  3696. 102: "flash image",
  3697. 111: "OTP",
  3698. 112: "config pins",
  3699. 114: "ROM",
  3700. }
  3701. def mon_hw2(self, buf):
  3702. """UBX-MON-HW2 decode, Extended Hardware Status"""
  3703. u = struct.unpack_from('<bBbBBBBBLLLLL', buf, 0)
  3704. s = (' ofsI %d magI %u ofsQ %d magQ %u cfgSource %u\n'
  3705. ' reserved0 %u %u %u lowLevCfg %d reserved1 %u %u\n'
  3706. ' postStatus %u reserved2 %u' % u)
  3707. if VERB_DECODE <= opts['verbosity']:
  3708. s += ('\n cfgSource (%s)' %
  3709. (index_s(u[4], self.mon_hw2_cfgSource)))
  3710. return s
  3711. mon_hw3_flags = {
  3712. 1: "rtcCalib",
  3713. 2: "safeBoot",
  3714. 4: "xtgalAbsent",
  3715. }
  3716. mon_hw3_pio = {
  3717. 0: "peripheral",
  3718. 1: "PIO",
  3719. }
  3720. mon_hw3_bank = {
  3721. 0: "A",
  3722. 1: "B",
  3723. 2: "C",
  3724. 3: "D",
  3725. 4: "E",
  3726. 5: "F",
  3727. 6: "G",
  3728. 7: "H",
  3729. }
  3730. mon_hw3_dir = {
  3731. 0: "In",
  3732. 1: "Out",
  3733. }
  3734. mon_hw3_value = {
  3735. 0: "Lo",
  3736. 1: "Hi",
  3737. }
  3738. mon_hw3_mask = {
  3739. 0x20: "VPM",
  3740. 0x40: "IRQ",
  3741. 0x100: "PUp",
  3742. 0x200: "PDn",
  3743. }
  3744. def mon_hw3(self, buf):
  3745. """UBX-MON-HW3 decode, HW I/O pin information"""
  3746. # at least protver 27
  3747. if 27 > opts['protver']:
  3748. opts['protver'] = 27
  3749. u = struct.unpack_from('<BBB', buf, 0)
  3750. s = ' version %u nPins %u flags x%x' % u
  3751. nPins = u[1]
  3752. substr = buf[3:12]
  3753. substr = substr.split(gps.polybytes('\0'))[0]
  3754. s += ' hwVersion %s\n' % gps.polystr(substr)
  3755. u1 = struct.unpack_from('<BBBBBBBBB', buf, 13)
  3756. s += ' reserved1 %02x %02x %02x %02x %02x %02x %02x %02x %02x' % u1
  3757. if VERB_DECODE <= opts['verbosity']:
  3758. s += ('\n flags (%s)' %
  3759. (index_s(u[2], self.mon_hw3_flags)))
  3760. for i in range(22, 22 + (nPins * 6), 6):
  3761. u = struct.unpack_from('<HHBB', buf, i)
  3762. s += ('\n pinId %4u pinMask %#5x VP %3u reserved2 %u' % u)
  3763. if VERB_DECODE <= opts['verbosity']:
  3764. s += ('\n pinMask (%s %s %s %s %s)' %
  3765. (index_s(u[1] & 1, self.mon_hw3_pio),
  3766. index_s((u[1] >> 1) & 7, self.mon_hw3_bank),
  3767. index_s((u[1] >> 4) & 1, self.mon_hw3_dir),
  3768. index_s((u[1] >> 5) & 1, self.mon_hw3_value),
  3769. flag_s(u[1] & 0xffc0, self.mon_hw3_mask)))
  3770. return s
  3771. def mon_io(self, buf):
  3772. """UBX-MON-IO decode, I/O Subsystem Status"""
  3773. m_len = len(buf)
  3774. s = ''
  3775. for i in range(0, int(m_len / 20)):
  3776. if 0 < i:
  3777. s += "\n"
  3778. u = struct.unpack_from('<LLHHHHL', buf, i * 20)
  3779. s += (' Port: %u (%s)\n' % (i, index_s(i, self.port_ids)))
  3780. s += (' rxBytes %u txBytes %u parityErrs %u framingErrs %u\n'
  3781. ' overrunErrs %u breakCond %u reserved %u' % u)
  3782. return s
  3783. def mon_msgpp(self, buf):
  3784. """UBX-MON-MSGPP decode, Message Parse and Process Status"""
  3785. s = ''
  3786. for i in range(1, 7):
  3787. u = struct.unpack_from('<HHHHHHHH', buf, 0)
  3788. s += " msg%u %u %u %u %u %u %u %u %u\n" % ((i,) + u)
  3789. u = struct.unpack_from('<LLLLLL', buf, 0)
  3790. s += " skipped %u %u %u %u %u %u" % u
  3791. return s
  3792. mon_patch_act = {
  3793. 1: "Active"
  3794. }
  3795. mon_patch_loc = {
  3796. 0: "eFuse",
  3797. 2: "ROM",
  3798. 4: "BBR",
  3799. 6: "File System",
  3800. }
  3801. def mon_patch(self, buf):
  3802. """UBX-MON-PATCH decode, Output information about installed patches."""
  3803. # first seen in protver 15
  3804. # len 0 == Poll requestm handled earlier
  3805. u = struct.unpack_from('<HH', buf, 0)
  3806. s = " version %u nEntries %u" % u
  3807. for i in range(0, u[1]):
  3808. u = struct.unpack_from('<LLLL', buf, 4 + (i * 16))
  3809. s += ("\n patchInfo x%x comparatorNumber %u patchAddress %u "
  3810. "patchData %u" % u)
  3811. if VERB_DECODE <= opts['verbosity']:
  3812. s += ('\n patchInfo (%s, %s)' %
  3813. (flag_s(u[0] & 0x01, self.mon_patch_act),
  3814. index_s(u[0] & 0x06, self.mon_patch_loc)))
  3815. return s
  3816. mon_rf_antstat = {
  3817. 0: "Init",
  3818. 1: "Unk",
  3819. 2: "OK",
  3820. 3: "Short",
  3821. 4: "Open",
  3822. }
  3823. mon_rf_antpwr = {
  3824. 0: "Off",
  3825. 1: "On",
  3826. 2: "Unk",
  3827. }
  3828. def mon_rf(self, buf):
  3829. """UBX-MON-RF decode, RF Information"""
  3830. # first seen in protver 27
  3831. # at least protver 27
  3832. if 27 > opts['protver']:
  3833. opts['protver'] = 27
  3834. u = struct.unpack_from('<BBBB', buf, 0)
  3835. s = ' version %u nBlocks %u reserved1 %u %u' % u
  3836. for i in range(0, u[1]):
  3837. u = struct.unpack_from('<BBBBLBBBBHHBbBbBBBB', buf, 4 + (24 * i))
  3838. s += ("\n blockId %u flags x%x antStatus %u antPower %u "
  3839. "postStatus %u reserved2 %u %u %u %u"
  3840. "\n noisePerMS %u agcCnt %u jamInd %u ofsI %d magI %u "
  3841. "ofsQ %d magQ %u"
  3842. "\n reserved3 %u %u %u" % u)
  3843. if VERB_DECODE <= opts['verbosity']:
  3844. s += ('\n jammingState (%s) antStatus (%s) antPower (%s)' %
  3845. (index_s(u[1] & 0x03, self.jammingState),
  3846. index_s(u[2], self.mon_rf_antstat),
  3847. index_s(u[3], self.mon_rf_antpwr)))
  3848. return s
  3849. def mon_rxbuf(self, buf):
  3850. """UBX-MON-RXBUF decode, Receiver Buffer Status"""
  3851. rxbuf_name = {
  3852. 1: " pending ",
  3853. 2: " usage ",
  3854. 3: " peakUsage ",
  3855. }
  3856. s = ''
  3857. u = struct.unpack_from('<HHHHHH', buf, 0)
  3858. s += rxbuf_name[1] + "%u %u %u %u %u %u\n" % u
  3859. for i in range(2, 4):
  3860. u = struct.unpack_from('<BBBBBB', buf, 6 * i)
  3861. s += rxbuf_name[i] + "%u %u %u %u %u %u\n" % u
  3862. return s
  3863. mon_rxr_flags = {
  3864. 1: "Awake",
  3865. }
  3866. def mon_rxr(self, buf):
  3867. """UBX-MON-RXBUF decode, Receiver Status Information"""
  3868. # No way to poll
  3869. u = struct.unpack_from('<B', buf, 0)
  3870. s = " flags: x%x" % u
  3871. if VERB_DECODE <= opts['verbosity']:
  3872. s += ("\n flags (%s)" %
  3873. index_s(u[0], self.mon_rxr_flags))
  3874. return s
  3875. mon_smgr_OscState = {
  3876. 0: "autonomous operation",
  3877. 1: "calibration ongoing",
  3878. 2: "oscillator steered by host",
  3879. 3: "idle state",
  3880. }
  3881. mon_smgr_Osc = {
  3882. 0x10: "OscCalib",
  3883. 0x20: "OscDisc",
  3884. }
  3885. mon_smgr_discSrc = {
  3886. 0: "internal oscillator",
  3887. 1: "GNSS",
  3888. 2: "EXTINT0",
  3889. 3: "EXTINT1",
  3890. 4: "internal oscillator measured by host",
  3891. 5: "external oscillator measured by host",
  3892. }
  3893. def mon_smgr(self, buf):
  3894. """UBX-MON-SMGR decode, Synchronization manager status"""
  3895. u = struct.unpack_from('<BBBBLHHBBBB', buf, 0)
  3896. s = (" version %u reserved1 %u %u %u iTOW %u intOsc x%x extOsc x%x\n"
  3897. " discOsc %u gnss x%x extInt0 x%x extInt1 x%x" % u)
  3898. if VERB_DECODE <= opts['verbosity']:
  3899. s += ("\n intOsc (%s) intOscState (%s)"
  3900. "\n extOsc(%s) extoscState (%s)"
  3901. "\n flags (%s)" %
  3902. (flag_s(u[3], self.mon_smgr_Osc),
  3903. index_s(u[3] & 0x0f, self.mon_smgr_OscState),
  3904. flag_s(u[4], self.mon_smgr_Osc),
  3905. index_s(u[4] & 0x0f, self.mon_smgr_OscState),
  3906. index_s(u[5], self.mon_smgr_discSrc)))
  3907. return s
  3908. def mon_txbuf(self, buf):
  3909. """UBX-MON-TXBUF decode, Transmitter Buffer Status"""
  3910. txbuf_name = {
  3911. 1: " pending ",
  3912. 2: " usage ",
  3913. 3: " peakUsage ",
  3914. }
  3915. errors = {
  3916. 0x40: "mem",
  3917. 0x80: "alloc",
  3918. }
  3919. s = ''
  3920. u = struct.unpack_from('<HHHHHH', buf, 0)
  3921. s += txbuf_name[1] + "%u %u %u %u %u %u\n" % u
  3922. for i in range(2, 4):
  3923. u = struct.unpack_from('<BBBBBB', buf, 6 * i)
  3924. s += txbuf_name[i] + "%u %u %u %u %u %u\n" % u
  3925. u = struct.unpack_from('<BBBB', buf, 24)
  3926. s += " tUsage %u tPeakUsage %u errors x%x reserved1 %u" % u
  3927. if VERB_DECODE <= opts['verbosity']:
  3928. s += ("\n errors (%s) limit (%u)" %
  3929. (flag_s(u[2], errors), u[2] & 0x3f))
  3930. return s
  3931. def mon_ver(self, buf):
  3932. """UBX-MON-VER decode, Poll Receiver/Software Version"""
  3933. # min len = 40 in u-blox 5/6
  3934. # min len = 70 in u-blox 9
  3935. m_len = len(buf)
  3936. substr = buf.split(gps.polybytes('\0'))[0]
  3937. substr1 = buf[30:39]
  3938. substr1 = substr1.split(gps.polybytes('\0'))[0]
  3939. s = (" swVersion %s\n"
  3940. " hwVersion %s" %
  3941. (gps.polystr(substr), gps.polystr(substr1)))
  3942. # extensions??
  3943. protver = None
  3944. num_ext = int((m_len - 40) / 30)
  3945. for i in range(0, num_ext):
  3946. loc = 40 + (i * 30)
  3947. substr = buf[loc:]
  3948. substr = substr.split(gps.polybytes('\0'))[0]
  3949. polystr = gps.polystr(substr)
  3950. s += '\n extension %s' % polystr
  3951. # is protver? delimiter may be space or equal
  3952. if "PROTVER" == polystr[:7]:
  3953. protver = "%.2f" % float(polystr[8:])
  3954. opts_protver = "%.2f" % opts['protver']
  3955. if protver and protver != opts_protver:
  3956. s += ('\nWARNING: protVer is %s, should be %s.'
  3957. ' Hint: use option "-P %s"' %
  3958. (opts_protver, protver, protver))
  3959. # prolly too late to fix, try anyway.
  3960. opts['protver'] = float(protver)
  3961. return s
  3962. mon_ids = {0x02: {'str': 'IO', 'dec': mon_io, 'minlen': 20,
  3963. 'name': 'UBX-MON-IO'},
  3964. 0x04: {'str': 'VER', 'dec': mon_ver, 'minlen': 40,
  3965. 'name': 'UBX-MON-VER'},
  3966. 0x06: {'str': 'MSGPP', 'dec': mon_msgpp, 'minlen': 120,
  3967. 'name': 'UBX-MON-MSGPP'},
  3968. 0x07: {'str': 'RXBUF', 'dec': mon_rxbuf, 'minlen': 24,
  3969. 'name': 'UBX-MON-RXBUF'},
  3970. 0x08: {'str': 'TXBUF', 'dec': mon_txbuf, 'minlen': 28,
  3971. 'name': 'UBX-MON-TXBUF'},
  3972. 0x09: {'str': 'HW', 'dec': mon_hw, 'minlen': 60,
  3973. 'name': 'UBX-MON-HW'},
  3974. 0x0b: {'str': 'HW2', 'dec': mon_hw2, 'minlen': 28,
  3975. 'name': 'UBX-MON-HW2'},
  3976. 0x21: {'str': 'RXR', 'dec': mon_rxr, 'minlen': 1,
  3977. 'name': 'UBX-MON-RXR'},
  3978. 0x27: {'str': 'PATCH', 'dec': mon_patch, 'minlen': 4,
  3979. 'name': 'UBX-MON-PATCH'},
  3980. 0x28: {'str': 'GNSS', 'dec': mon_gnss, 'minlen': 8,
  3981. 'name': 'UBX-MON-GNSS'},
  3982. 0x2e: {'str': 'SMGR', 'dec': mon_smgr, 'minlen': 16,
  3983. 'name': 'UBX-MON-SMGR'},
  3984. 0x32: {'str': 'BATCH', 'dec': mon_batch, 'minlen': 12,
  3985. 'name': 'UBX-MON-BATCH'},
  3986. 0x36: {'str': 'COMMS', 'dec': mon_comms, 'minlen': 8,
  3987. 'name': 'UBX-MON-COMMS'},
  3988. 0x37: {'str': 'HW3', 'dec': mon_hw3, 'minlen': 22,
  3989. 'name': 'UBX-MON-HW3'},
  3990. 0x38: {'str': 'RF', 'dec': mon_rf, 'minlen': 4,
  3991. 'name': 'UBX-MON-RF'},
  3992. }
  3993. def nav_aopstatus(self, buf):
  3994. """UBX-NAV-AOPSTATUS decode, AssistNow Autonomous Status"""
  3995. u = struct.unpack_from('<LBBLLH', buf, 0)
  3996. s = ' iTOW %u aopCfg %u status %u reserved1 %u %u %u' % u
  3997. if VERB_DECODE <= opts['verbosity']:
  3998. aopCfg = {1: "useAOP"}
  3999. s += "\n aopCfg (%s)" % flag_s(u[1], aopCfg)
  4000. return s
  4001. def nav_att(self, buf):
  4002. """UBX-NAV-ATT decode, Attitude Solution"""
  4003. u = struct.unpack_from('<LBHBlllLLL', buf, 0)
  4004. s = (" iTOW %u version %u reserved1 %u %u\n"
  4005. " roll %d pitch %d heading %d\n"
  4006. " accRoll %d accPitch %d accHeading %d" % u)
  4007. return s
  4008. def nav_clock(self, buf):
  4009. """UBX-NAV-CLOCK decode, Clock Solution"""
  4010. u = struct.unpack_from('<LllLL', buf, 0)
  4011. return ' iTOW %u clkB %d clkD %d tAcc %u fAcc %u' % u
  4012. nav_dgps_status = {
  4013. 0: "None",
  4014. 1: "PR+PRR correction",
  4015. }
  4016. def nav_dgps(self, buf):
  4017. """UBX-NAV-DGPS decode, DGPS Data used for NAV"""
  4018. # not present in protver 27+
  4019. u = struct.unpack_from('<LlhhBBH', buf, 0)
  4020. s = (' iTOW %u age %d baseID %d basehealth %d numCh %u\n'
  4021. ' status x%x reserved1 %u' % u)
  4022. if VERB_DECODE <= opts['verbosity']:
  4023. s += ("\n status (%s)" %
  4024. index_s(u[5], self.nav_dgps_status))
  4025. for i in range(0, u[4]):
  4026. u = struct.unpack_from('<BbHff', buf, 16 + i * 12)
  4027. s += ('\n svid %3u flags x%2x ageC %u prc %f prcc %f' % u)
  4028. if VERB_DECODE <= opts['verbosity']:
  4029. s += ("\n channel %u dgps %u" %
  4030. (u[1] & 0x0f, (u[1] >> 4) & 1))
  4031. return s
  4032. def nav_dop(self, buf):
  4033. """UBX-NAV-DOP decode, Dilution of Precision"""
  4034. u = struct.unpack_from('<Lhhhhhhh', buf, 0)
  4035. s = (' iTOW %u gDOP %u pDOP %u tDOP %u vDOP %u\n'
  4036. ' hDOP %u nDOP %u eDOP %u' % u)
  4037. return s
  4038. def nav_eoe(self, buf):
  4039. """UBX-NAV-EOE decode, End Of Epoch"""
  4040. u = struct.unpack_from('<L', buf, 0)
  4041. return ' iTOW %u' % u
  4042. nav_geofence_state = {
  4043. 1: "Inside",
  4044. 2: "Outside",
  4045. }
  4046. nav_geofence_status = {
  4047. 0: "n/a",
  4048. 1: "Active",
  4049. }
  4050. def nav_geofence(self, buf):
  4051. """UBX-NAV-GEOFENCE decode, Geofencing status"""
  4052. u = struct.unpack_from('<LBBBB', buf, 0)
  4053. s = ' iTOW:%u version %u status %u numFences %u combState %u' % u
  4054. if VERB_DECODE <= opts['verbosity']:
  4055. s += ("\n status (%s) combState (%s)" %
  4056. (index_s(u[2], self.nav_geofence_status),
  4057. index_s(u[4], self.nav_geofence_state)))
  4058. for i in range(0, u[3]):
  4059. u = struct.unpack_from('<BB', buf, 8 + (i * 2))
  4060. s += '\n state %u reserved1 %u' % u
  4061. if VERB_DECODE <= opts['verbosity']:
  4062. s += ("\n state (%s)" %
  4063. (index_s(u[0], self.nav_geofence_state)))
  4064. return s
  4065. def nav_hpposecef(self, buf):
  4066. """UBX-NAV-POSECEF decode, High Precision Position Solution in ECEF"""
  4067. u = struct.unpack_from('<BBBBLlllbbbbL', buf, 0)
  4068. return (' version %u reserved1 %u %u %u iTOW %u\n'
  4069. ' ecef: X %d Y %d Z %d\n'
  4070. ' ecefHP: X %d Y %d Z %d\n'
  4071. ' reserved2 %u pAcc %u' % u)
  4072. def nav_hpposllh(self, buf):
  4073. """UBX-NAV-HPPOSLLH decode, HP Geodetic Position Solution"""
  4074. u = struct.unpack_from('<BBBBLllllbbbbLL', buf, 0)
  4075. return (' version %u reserved1 %u %u %u iTOW %u\n'
  4076. ' lon %d lat %d height %d hMSL %d\n'
  4077. ' lonHp %d latHp %d heightHp %d hMSLHp %d\n'
  4078. ' hAcc %u vAcc %u' % u)
  4079. def nav_odo(self, buf):
  4080. """UBX-NAV-ODO decode, Odometer Solution"""
  4081. u = struct.unpack_from('<BBBBLLLL', buf, 0)
  4082. return (" version %u reserved1 %u %u %u iTOW %u\n"
  4083. " distance %u totalDistance %u distanceStd %u" % u)
  4084. nav_orb_almUsability = {
  4085. 0: "Unusable",
  4086. 30: "> 30 days",
  4087. 31: "Unknown",
  4088. }
  4089. nav_orb_ephUsability = {
  4090. 0: "Unusable",
  4091. 30: "> 450 mins",
  4092. 31: "Unknown",
  4093. }
  4094. nav_orb_ephSource = {
  4095. 0: "not available",
  4096. 1: "GNSS transmission",
  4097. 2: "external aiding",
  4098. }
  4099. nav_orb_type = {
  4100. 0: "not available",
  4101. 1: "Assist now offline data",
  4102. 2: "Assist now autonomous data",
  4103. }
  4104. def nav_orb(self, buf):
  4105. """UBX-NAV-ORB decode, GNSS Orbit Database Info"""
  4106. u = struct.unpack_from('<LBBH', buf, 0)
  4107. s = " iTOW %u version %u numSv %u reserved1 %u" % u
  4108. for i in range(0, u[2]):
  4109. u = struct.unpack_from('<BBBBBB', buf, 8 + (i * 6))
  4110. s += ("\n gnssId %u svId %3u svFlag x%02x eph x%02x alm x%02x "
  4111. "otherOrb x%x" % u)
  4112. if VERB_DECODE <= opts['verbosity']:
  4113. eph = int(u[3] & 0x1f)
  4114. s1 = index_s(eph, self.nav_orb_ephUsability, nf="")
  4115. if not s1:
  4116. s1 = "%d to %d mins" % ((eph - 1) * 15, eph * 15)
  4117. alm = int(u[4] & 0x1f)
  4118. s2 = index_s(alm, self.nav_orb_almUsability, nf="")
  4119. if not s2:
  4120. s2 = "%d to %d days" % (alm - 1, alm)
  4121. other = int(u[5] & 0x1f)
  4122. s3 = index_s(other, self.nav_orb_almUsability, nf="")
  4123. if not s3:
  4124. s3 = "%d to %d days" % (other - 1, other)
  4125. s += ("\n (%s:%u) health (%s) visibility (%s)"
  4126. "\n ephUsability (%s) ephSource (%s)"
  4127. "\n almUsability (%s) almSource (%s)"
  4128. "\n anoAopUsability (%s) type (%s)" %
  4129. (index_s(u[0], self.gnss_id), u[1],
  4130. index_s(u[2] & 3, self.health),
  4131. index_s((u[2] >> 2) & 3, self.visibility),
  4132. s1,
  4133. index_s(u[3] >> 5, self.nav_orb_ephSource, nf="other"),
  4134. s2,
  4135. index_s(u[4] >> 5, self.nav_orb_ephSource, nf="other"),
  4136. s3,
  4137. index_s(u[5] >> 5, self.nav_orb_type, nf="other")))
  4138. return s
  4139. def nav_posecef(self, buf):
  4140. """UBX-NAV-POSECEF decode, Position Solution in ECEF"""
  4141. # protVer 4+
  4142. u = struct.unpack_from('<LlllL', buf, 0)
  4143. return ' iTOW %u ecefX %d Y %d Z %d pAcc %u' % u
  4144. def nav_posllh(self, buf):
  4145. """UBX-NAV-POSLLH decode, Geodetic Position Solution"""
  4146. u = struct.unpack_from('<LllllLL', buf, 0)
  4147. return (' iTOW %u lon %d lat %d height %d\n'
  4148. ' hMSL %d hAcc %u vAcc %u' % u)
  4149. nav_pvt_valid = {
  4150. 1: "validDate",
  4151. 2: "ValidTime",
  4152. 4: "fullyResolved",
  4153. 8: "validMag", # protver 27
  4154. }
  4155. # u-blox TIME ONLY is same as Surveyed
  4156. nav_pvt_fixType = {
  4157. 0: 'None',
  4158. 1: 'Dead Reckoning',
  4159. 2: '2D',
  4160. 3: '3D',
  4161. 4: 'GPS+DR',
  4162. 5: 'Surveyed',
  4163. }
  4164. nav_pvt_flags = {
  4165. 1: "gnssFixOK",
  4166. 2: "diffSoln",
  4167. 0x20: "headVehValid",
  4168. }
  4169. nav_pvt_flags2 = {
  4170. 0x20: "confirmedAvai",
  4171. 0x40: "confirmedDate",
  4172. 0x80: "confirmedTime",
  4173. }
  4174. nav_pvt_psm = {
  4175. 0: "Not Active",
  4176. 1: "Enabled",
  4177. 2: "Acquisition",
  4178. 3: "Tracking",
  4179. 4: "Power Optimized Tracking",
  4180. 5: "Inactive",
  4181. }
  4182. # protver 27+
  4183. carrSoln = {
  4184. 0: "None",
  4185. 1: "Floating",
  4186. 2: "Fixed",
  4187. }
  4188. def nav_pvt(self, buf):
  4189. """UBX-NAV-PVT decode, Navigation Position Velocity Time Solution"""
  4190. m_len = len(buf)
  4191. # 84 bytes long in protver 14.
  4192. # 92 bytes long in protver 15.
  4193. # flags2 is protver 27
  4194. u = struct.unpack_from('<LHBBBBBBLlBBBBllllLLlllllLLHHHH', buf, 0)
  4195. s = (' iTOW %u time %u/%u/%u %02u:%02u:%02u valid x%x\n'
  4196. ' tAcc %u nano %d fixType %u flags x%x flags2 x%x\n'
  4197. ' numSV %u lon %d lat %d height %d\n'
  4198. ' hMSL %d hAcc %u vAcc %u\n'
  4199. ' velN %d velE %d velD %d gSpeed %d headMot %d\n'
  4200. ' sAcc %u headAcc %u pDOP %u reserved1 %u %u %u' % u)
  4201. if 92 <= m_len:
  4202. # version 15
  4203. u1 = struct.unpack_from('<lhH', buf, 81)
  4204. s += ('\n headVeh %d magDec %d magAcc %u' % u1)
  4205. if VERB_DECODE <= opts['verbosity']:
  4206. s += ("\n valid (%s)"
  4207. "\n fixType (%s)"
  4208. "\n flags (%s)"
  4209. "\n flags2 (%s)"
  4210. "\n psmState (%s)"
  4211. "\n carrSoln (%s)" %
  4212. (flag_s(u[7], self.nav_pvt_valid),
  4213. index_s(u[10], self.nav_pvt_fixType),
  4214. flag_s(u[11], self.nav_pvt_flags),
  4215. flag_s(u[12], self.nav_pvt_flags2),
  4216. index_s((u[11] >> 2) & 0x0f, self.nav_pvt_psm),
  4217. index_s((u[11] >> 6) & 0x03, self.carrSoln)))
  4218. return s
  4219. nav_relposned_flags = {
  4220. 1: "gnssFixOK",
  4221. 2: "diffSoln",
  4222. 4: "relPosValid",
  4223. 0x20: "isMoving", # protVer 20.3+
  4224. 0x40: "refPosMiss", # protVer 20.3+
  4225. 0x80: "refObsMiss", # protVer 20.3+
  4226. 0x100: "relPosHeadingValid", # protVer 27.11+
  4227. 0x200: "relPosNormalized", # protVer 27.11+
  4228. }
  4229. def nav_relposned(self, buf):
  4230. """UBX-NAV-RELPOSNED decode
  4231. Relative Positioning Information in NED frame.
  4232. protVer 20+ is 40 bytes
  4233. protVer 27.11+ is 64 bytes, and things reordered, so not upward compatible
  4234. High Precision GNSS products only."""
  4235. m_len = len(buf)
  4236. # common part
  4237. u = struct.unpack_from('<BBHLlll', buf, 0)
  4238. s = (' version %u reserved1 %u refStationId %u iTOW %u\n'
  4239. ' relPosN %d relPosE %d relPosD %d\n' % u)
  4240. if (1 == u[0] and 64 <= m_len):
  4241. # valid version 1 packet, newer u-blox 9
  4242. u1 = struct.unpack_from('<llLbbbbLLLLLLL', buf, 20)
  4243. s += (' relLength %d relHeading %d reserved2 %u\n'
  4244. ' relPosHPN %d relPosHPE %d relPosHPD %d '
  4245. 'relPosHPLength %d\n'
  4246. ' accN %u accE %u accD %u accLength %u accHeading %u\n'
  4247. ' reserved3 %u flags x%x' % u1)
  4248. flags = u1[13]
  4249. elif (0 == u[0] and 40 <= m_len):
  4250. # valid version 0 packet, u-blox 8, and some u-blox 9
  4251. u1 = struct.unpack_from('<bbbbLLLLLLL', buf, 20)
  4252. s += (' relPosHPN %d relPosHPE %d relPosHPD %d reserved2 %u\n'
  4253. ' accN %u accE %u accD %u flags x%x' % u1)
  4254. flags = u1[7]
  4255. else:
  4256. # WTF?
  4257. return " Bad Length %d version %u combination" % (m_len, u[0])
  4258. if VERB_DECODE <= opts['verbosity']:
  4259. s += ("\n flags (%s)\n"
  4260. " carrSoln (%s)" %
  4261. (flag_s(flags, self.nav_relposned_flags),
  4262. index_s((flags >> 3) & 0x03, self.carrSoln)))
  4263. return s
  4264. def nav_resetodo(self, buf):
  4265. """UBX-NAV-RESETODO decode, reset odometer"""
  4266. m_len = len(buf)
  4267. if 0 == m_len:
  4268. s = " reset request"
  4269. else:
  4270. s = " unexpected data"
  4271. return s
  4272. qualityInd = {
  4273. 0: "None",
  4274. 1: "Searching",
  4275. 2: "Acquired",
  4276. 3: "Detected",
  4277. 4: "Code and time locked",
  4278. 5: "Code, carrier and time locked",
  4279. 6: "Code, carrier and time locked",
  4280. 7: "Code, carrier and time locked",
  4281. }
  4282. health = {
  4283. 0: "Unknown",
  4284. 1: "Healthy",
  4285. 2: "Unhealthy",
  4286. }
  4287. visibility = {
  4288. 1: "below horizon",
  4289. 2: "above horizon",
  4290. 3: "above elevation mask",
  4291. }
  4292. nav_sat_orbit = {
  4293. 0: "None",
  4294. 1: "Ephemeris",
  4295. 2: "Almanac",
  4296. 3: "AssistNow Offline",
  4297. 4: "AssistNow Autonomous",
  4298. 5: "Other",
  4299. 6: "Other",
  4300. 7: "Other",
  4301. }
  4302. nav_sat_flags = {
  4303. 8: "svUsed",
  4304. 0x40: "diffCorr",
  4305. 0x80: "smoothed",
  4306. 0x800: "ephAvail",
  4307. 0x1000: "almAvail",
  4308. 0x2000: "anoAvail",
  4309. 0x4000: "aopAvail",
  4310. 0x10000: "sbasCorrUsed",
  4311. 0x20000: "rtcmCorrUsed",
  4312. 0x40000: "slasCorrUsed",
  4313. 0x100000: "prCorrUsed",
  4314. 0x200000: "crCorrUsed",
  4315. 0x400000: "doCorrUsed",
  4316. }
  4317. def nav_sat(self, buf):
  4318. """UBX-NAV-SAT decode"""
  4319. u = struct.unpack_from('<LBBBB', buf, 0)
  4320. s = ' iTOW %u version %u numSvs %u reserved1 %u %u' % u
  4321. for i in range(0, u[2]):
  4322. u = struct.unpack_from('<BBBbhhL', buf, 8 + (i * 12))
  4323. s += ('\n gnssId %u svid %3u cno %2u elev %3d azim %3d prRes %6d'
  4324. ' flags x%x' % u)
  4325. if VERB_DECODE <= opts['verbosity']:
  4326. s += ("\n flags (%s)"
  4327. "\n qualityInd x%x (%s) health (%s)"
  4328. "\n orbitSource (%s)" %
  4329. (flag_s(u[6], self.nav_sat_flags),
  4330. u[6] & 7, index_s(u[6] & 7, self.qualityInd),
  4331. index_s((u[6] >> 4) & 3, self.health),
  4332. index_s((u[6] >> 8) & 7, self.nav_sat_orbit)))
  4333. return s
  4334. nav_sbas_mode = {
  4335. 0: "Disabled",
  4336. 1: "Enabled Integrity",
  4337. 2: "Enabled Testmode",
  4338. }
  4339. # sometimes U1 or I1, 255 or -1 == Unknown
  4340. nav_sbas_sys = {
  4341. 0: "WAAS",
  4342. 1: "EGNOS",
  4343. 2: "MSAS",
  4344. 3: "GAGAN",
  4345. 4: "SDCM", # per ICAO Annex 10, v1, Table B-27
  4346. 16: "GPS",
  4347. }
  4348. nav_sbas_service = {
  4349. 1: "Ranging",
  4350. 2: "Corrections",
  4351. 4: "Integrity",
  4352. 8: "Testmode",
  4353. }
  4354. def nav_sbas(self, buf):
  4355. """UBX-NAV-SBAS decode, SBAS Status Data"""
  4356. # present in protver 10+ (Antaris4 to ZOE-M8B
  4357. # undocumented, but present in protver 27+
  4358. # undocumented, but present in protver 32, NEO-M9N
  4359. u = struct.unpack_from('<LBBbBBBBB', buf, 0)
  4360. s = (" iTOW %d geo %u mode x%x sys %d service x%x cnt %u "
  4361. "reserved0 %u %u %u" % u)
  4362. if VERB_DECODE <= opts['verbosity']:
  4363. s += ("\n mode (%s) sys (%s)"
  4364. "\n service (%s)" %
  4365. (index_s(u[2], self.nav_sbas_mode),
  4366. index_s(u[3], self.nav_sbas_sys),
  4367. flag_s(u[4], self.nav_sbas_service)))
  4368. for i in range(0, u[5]):
  4369. u = struct.unpack_from('<BBBBBBhHh', buf, 12 + (i * 12))
  4370. s += ("\n svid %3d flags x%04x udre x%02x svSys %3d svService %2d"
  4371. " reserved2 %u"
  4372. "\n prc %3d reserved3 %u ic %3d" % u)
  4373. if VERB_DECODE <= opts['verbosity']:
  4374. # where are flags and udre defined??
  4375. s += ("\n svSys (%s) svService (%s)" %
  4376. (index_s(u[3], self.nav_sbas_sys),
  4377. flag_s(u[4], self.nav_sbas_service)))
  4378. return s
  4379. nav_sig_corrSource = {
  4380. 0: "None",
  4381. 1: "SBAS",
  4382. 2: "BeiDou",
  4383. 3: "RTCM2",
  4384. 4: "RTCM3 OSR",
  4385. 5: "RTCM3 SSR",
  4386. 6: "QZSS SLAS",
  4387. }
  4388. nav_sig_ionoModel = {
  4389. 0: "None",
  4390. 1: "Klobuchar over GPS",
  4391. 2: "SBAS",
  4392. 3: "Klobuchar over BeiDou",
  4393. 8: "Dual Frequency obs",
  4394. }
  4395. nav_sig_sigFlags = {
  4396. 4: "prSmoothed",
  4397. 8: "prUsed",
  4398. 0x10: "crUsed",
  4399. 0x20: "doUsed",
  4400. 0x40: "prCorrUsed",
  4401. 0x80: "crCorrUsed",
  4402. 0x100: "doCorrUsed",
  4403. }
  4404. def nav_sig(self, buf):
  4405. """UBX-NAV-SIG decode, Signal Information"""
  4406. u = struct.unpack_from('<LBBH', buf, 0)
  4407. s = ' iTOW %u version %u numSigs %u reserved1 %u' % u
  4408. for i in range(0, u[2]):
  4409. u = struct.unpack_from('<BBBBhBBBBHL', buf, 8 + (i * 16))
  4410. s += ('\n gnssId %u svId %u sigId %u freqId %u prRes %d cno %u '
  4411. 'qualityInd %u\n'
  4412. ' corrSource %u ionoModel %u sigFlags %#x reserved2 %u' %
  4413. u)
  4414. if VERB_DECODE <= opts['verbosity']:
  4415. s += ("\n (%s) corrSource (%s)"
  4416. "\n qualityInd (%s)"
  4417. "\n ionoModel (%s) health (%s)"
  4418. "\n sigFlags (%s)" %
  4419. (self.gnss_s(u[0], u[1], u[2]),
  4420. index_s(u[7], self.nav_sig_corrSource),
  4421. index_s(u[6], self.qualityInd),
  4422. index_s(u[8], self.nav_sig_ionoModel),
  4423. index_s(u[9] & 3, self.health),
  4424. flag_s(u[9], self.nav_sig_sigFlags)))
  4425. return s
  4426. nav_slas_flags = {
  4427. 1: "gmsAvailable",
  4428. 2: "qzssSvAvailable",
  4429. 4: "testMode",
  4430. }
  4431. def nav_slas(self, buf):
  4432. """UBX-NAV-SLAS decode, QZSS L1S SLAS Status Data"""
  4433. u = struct.unpack_from('<LBBBBllBBBB', buf, 0)
  4434. s = (' iTOW %u version %u reserved1 %u %u %u'
  4435. ' gmsLon %d gmsLon %d gmsCode %u qzssSvId %u'
  4436. ' serviceFlags x%x cnt %d' % u)
  4437. for i in range(0, u[8]):
  4438. u = struct.unpack_from('<BBLh', buf, 20 + (i * 8))
  4439. s += '\n gnssId %u svId %u reserved23 %u prc %d ' % u
  4440. if VERB_DECODE <= opts['verbosity']:
  4441. s += ("\n flags (%s)" %
  4442. (flag_s(u[3], self.nav_slas_flags)))
  4443. return s
  4444. nav_sol_flags = {
  4445. 1: "GPSfixOK",
  4446. 2: "DiffSoln",
  4447. 4: "WKNSET",
  4448. 8: "TOWSET",
  4449. }
  4450. def nav_sol(self, buf):
  4451. """UBX-NAV-SOL decode, Navigation Solution Information"""
  4452. # deprecated by u-blox
  4453. u = struct.unpack_from('<LlhBBlllLlllLHBBL', buf, 0)
  4454. s = (' iTOW %u fTOW %d week %d gpsFix %u flags x%x\n'
  4455. ' ECEF X %d Y %d Z %d pAcc %u\n'
  4456. ' VECEF X %d Y %d Z %d sAcc %u\n'
  4457. ' pDOP %u reserved1 %u numSV %u reserved2 %u' % u)
  4458. if VERB_DECODE <= opts['verbosity']:
  4459. s += ("\n gpsfix (%s)"
  4460. "\n flags (%s)" %
  4461. (index_s(u[3], self.nav_pvt_fixType),
  4462. flag_s(u[4], self.nav_sol_flags)))
  4463. return s
  4464. def nav_status(self, buf):
  4465. """UBX-NAV-STATUS decode"""
  4466. u = struct.unpack_from('<LBBBBLL', buf, 0)
  4467. return (' iTOW:%d ms, fix:%d flags:%#x fixstat:%#x flags2:%#x\n'
  4468. ' ttff:%d, msss:%d' % u)
  4469. def nav_svin(self, buf):
  4470. """UBX-NAV-SVIN decode, Survey-in data"""
  4471. # in M8 HPG only
  4472. u = struct.unpack_from('<BBBBLLlllbbbBLLBB', buf, 0)
  4473. return (' version %u reserved1[%u %u %u] iTOW %u dur %u\n'
  4474. ' meanX %d meanY %d meanZ %d\n'
  4475. ' meanXHP %d meanYHP %d meanZHP %d reserved2 %u meanAcc %u\n'
  4476. ' obs %u valid %u active %u' % u)
  4477. def nav_svinfo(self, buf):
  4478. """UBX-NAV-SVINFO decode"""
  4479. # in M8 Timing and FTS only
  4480. m_len = len(buf)
  4481. u = struct.unpack_from('<Lbb', buf, 0)
  4482. s = ' iTOW:%d ms, numCh:%d globalFlags:%d' % u
  4483. m_len -= 8
  4484. i = 0
  4485. while 0 < m_len:
  4486. u = struct.unpack_from('<BBBBBbhl', buf, 8 + i * 12)
  4487. s += ('\n chn %3d svid %3d flags %#0.2x quality %#x cno %2d'
  4488. ' elev %3d azim %3d prRes %6d' % u)
  4489. if 0 < u[2]:
  4490. s += '\n '
  4491. if 1 & u[2]:
  4492. s += 'svUsed '
  4493. if 2 & u[2]:
  4494. s += 'diffCorr '
  4495. if 4 & u[2]:
  4496. s += 'orbitAvail '
  4497. if 8 & u[2]:
  4498. s += 'orbitEph '
  4499. if 0x10 & u[2]:
  4500. s += 'unhealthy '
  4501. if 0x20 & u[2]:
  4502. s += 'orbitAlm '
  4503. if 0x40 & u[2]:
  4504. s += 'orbitAop '
  4505. if 0x80 & u[2]:
  4506. s += 'smoothed '
  4507. m_len -= 12
  4508. i += 1
  4509. return s
  4510. nav_time_valid = {
  4511. 1: "towValid",
  4512. 2: "weekValid",
  4513. 4: "leapValid",
  4514. }
  4515. def nav_timebds(self, buf):
  4516. """UBX-NAV-TIMEBDS decode"""
  4517. u = struct.unpack_from('<LLlhbBL', buf, 0)
  4518. s = (" iTOW %d SOW %d fSOW %d week %d leapS %d\n"
  4519. " Valid %#x tAcc %d" % u)
  4520. if VERB_DECODE <= opts['verbosity']:
  4521. s += ("\n valid (%s)" %
  4522. (flag_s(u[5], self.nav_time_valid)))
  4523. return s
  4524. def nav_timegal(self, buf):
  4525. """UBX-NAV-TIMEGAL decode"""
  4526. u = struct.unpack_from('<LLlhbBL', buf, 0)
  4527. s = (" iTOW %d galTOW %d fGalTow %d galWno %d leapS %d\n"
  4528. " Valid x%x, tAcc %d" % u)
  4529. if VERB_DECODE <= opts['verbosity']:
  4530. s += ("\n valid (%s)" %
  4531. (flag_s(u[5], self.nav_time_valid)))
  4532. return s
  4533. def nav_timeglo(self, buf):
  4534. """UBX-NAV-TIMEGLO decode"""
  4535. u = struct.unpack_from('<LLlhbBL', buf, 0)
  4536. s = (" iTOW %d TOD %d fTOD %d Nt %d N4 %d\n"
  4537. " Valid x%x tAcc %d" % u)
  4538. if VERB_DECODE <= opts['verbosity']:
  4539. s += ("\n valid (%s)" %
  4540. (flag_s(u[5], self.nav_time_valid)))
  4541. return s
  4542. def nav_timegps(self, buf):
  4543. """UBX-NAV-TIMEGPS decode"""
  4544. u = struct.unpack_from('<LlhbBL', buf, 0)
  4545. s = " iTOW %u fTOW %u week %d leapS %d valid x%x tAcc %d" % u
  4546. if VERB_DECODE <= opts['verbosity']:
  4547. s += ("\n valid (%s)" %
  4548. (flag_s(u[4], self.nav_time_valid)))
  4549. return s
  4550. nav_timels_src = {
  4551. 0: "Default",
  4552. 1: "GPS/GLONASS derived",
  4553. 2: "GPS",
  4554. 3: "SBAS",
  4555. 4: "BeiDou",
  4556. 5: "Galileo",
  4557. 6: "Aided data",
  4558. 7: "Configured",
  4559. }
  4560. nav_timels_src1 = {
  4561. 0: "None",
  4562. 2: "GPS",
  4563. 3: "SBAS",
  4564. 4: "BeiDou",
  4565. 5: "Galileo",
  4566. 6: "GLONASS",
  4567. }
  4568. nav_timels_valid = {
  4569. 1: "validCurrLs",
  4570. 2: "validTimeToLsEvent",
  4571. }
  4572. def nav_timels(self, buf):
  4573. """UBX-NAV-TIMELS decode, Leap second event information"""
  4574. u = struct.unpack_from('<LBBBBBbBblHHBBBB', buf, 0)
  4575. s = (' iTOW %u version %u reserved2 %u %u %u srcOfCurrLs %u\n'
  4576. ' currLs %d srcOfLsChange %u lsChange %d timeToLsEvent %d\n'
  4577. ' dateOfLsGpsWn %u dateOfLsGpsDn %u reserved2 %u %u %u\n'
  4578. ' valid x%x' % u)
  4579. if VERB_DECODE <= opts['verbosity']:
  4580. s += ("\n srcOfCurrLs (%s) srcOfLsChange (%s)"
  4581. "\n valid (%s)" %
  4582. (index_s(u[5], self.nav_timels_src),
  4583. index_s(u[7], self.nav_timels_src1),
  4584. flag_s(u[15], self.nav_timels_valid)))
  4585. return s
  4586. nav_timeutc_valid = {
  4587. 1: "validTOW",
  4588. 2: "validWKN",
  4589. 4: "validUTC",
  4590. }
  4591. def nav_timeutc(self, buf):
  4592. """UBX-NAV-TIMEUTC decode"""
  4593. u = struct.unpack_from('<LLlHbbbbbB', buf, 0)
  4594. s = (" iTOW %d tAcc %d nano %d Time %d/%d/%d %d:%d:%d\n"
  4595. " valid x%x" % u)
  4596. if VERB_DECODE <= opts['verbosity']:
  4597. s += ("\n valid (%s) utcStandard (%s)" %
  4598. (flag_s(u[9], self.nav_timeutc_valid),
  4599. index_s(u[9] >> 4, self.utc_std)))
  4600. return s
  4601. def nav_velecef(self, buf):
  4602. """UBX-NAV-VELECEF decode"""
  4603. # protVer 4+
  4604. u = struct.unpack_from('<LlllL', buf, 0)
  4605. return ' iTOW %d ecef: VX %d VY %d VZ %d vAcc:%u' % u
  4606. def nav_velned(self, buf):
  4607. """UBX-NAV-VELNED decode."""
  4608. # protVer 15+
  4609. u = struct.unpack_from('<LlllLLlLL', buf, 0)
  4610. return (' iTOW %u vel: N %d E %d D %d speed %u\n'
  4611. ' gspeed %u heading %d sAcc %u cAcc %u' % u)
  4612. nav_ids = {0x01: {'str': 'POSECEF', 'dec': nav_posecef, 'minlen': 20,
  4613. 'name': 'UBX-NAV-POSECEF'},
  4614. 0x02: {'str': 'POSLLH', 'dec': nav_posllh, 'minlen': 20,
  4615. 'name': 'UBX-NAV-POSLLH'},
  4616. 0x03: {'str': 'STATUS', 'dec': nav_status, 'minlen': 16,
  4617. 'name': 'UBX-NAV-STATUS'},
  4618. 0x04: {'str': 'DOP', 'dec': nav_dop, 'minlen': 18,
  4619. 'name': 'UBX-NAV-DOP'},
  4620. 0x05: {'str': 'ATT', 'dec': nav_att, 'minlen': 32,
  4621. 'name': 'UBX-NAV-ATT'},
  4622. 0x06: {'str': 'SOL', 'dec': nav_sol, 'minlen': 52,
  4623. 'name': 'UBX-NAV-SOL'},
  4624. 0x07: {'str': 'PVT', 'dec': nav_pvt, 'minlen': 84,
  4625. 'name': 'UBX-NAV-PVT'},
  4626. 0x09: {'str': 'ODO', 'dec': nav_odo, 'minlen': 20,
  4627. 'name': 'UBX-NAV-ODO'},
  4628. 0x10: {'str': 'RESETODO', 'dec': nav_resetodo, 'minlen': 0,
  4629. 'name': 'UBX-NAV-RESETODO'},
  4630. 0x11: {'str': 'VELECEF', 'dec': nav_velecef, 'minlen': 20,
  4631. 'name': 'UBX-NAV-VELECEF'},
  4632. 0x12: {'str': 'VELNED', 'dec': nav_velned, 'minlen': 36,
  4633. 'name': 'UBX-NAV-VELNED'},
  4634. 0x13: {'str': 'HPPOSECEF', 'dec': nav_hpposecef, 'minlen': 28,
  4635. 'name': 'UBX-NAV-HPPOSECEF'},
  4636. 0x14: {'str': 'HPPOSLLH', 'dec': nav_hpposllh, 'minlen': 36,
  4637. 'name': 'UBX-NAV-HPPOSLLH'},
  4638. 0x20: {'str': 'TIMEGPS', 'dec': nav_timegps, 'minlen': 16,
  4639. 'name': 'UBX-NAV-TIMEGPS'},
  4640. 0x21: {'str': 'TIMEUTC', 'dec': nav_timeutc, 'minlen': 20,
  4641. 'name': 'UBX-NAV-TIMEUTC'},
  4642. 0x22: {'str': 'CLOCK', 'dec': nav_clock, 'minlen': 20,
  4643. 'name': 'UBX-NAV-CLOCK'},
  4644. 0x23: {'str': 'TIMEGLO', 'dec': nav_timeglo, 'minlen': 20,
  4645. 'name': 'UBX-NAV-TIMEGLO'},
  4646. 0x24: {'str': 'TIMEBDS', 'dec': nav_timebds, 'minlen': 20,
  4647. 'name': 'UBX-NAV-TIMEBDS'},
  4648. 0x25: {'str': 'TIMEGAL', 'dec': nav_timegal, 'minlen': 20,
  4649. 'name': 'UBX-NAV-TIMEGAL'},
  4650. 0x26: {'str': 'TIMELS', 'dec': nav_timels, 'minlen': 24,
  4651. 'name': 'UBX-NAV-TIMELS'},
  4652. 0x30: {'str': 'SVINFO', 'dec': nav_svinfo, 'minlen': 8,
  4653. 'name': 'UBX-NAV-SVINFO'},
  4654. 0x31: {'str': 'DGPS', 'dec': nav_dgps, 'minlen': 16,
  4655. 'name': 'UBX-NAV-DGPS'},
  4656. 0x32: {'str': 'SBAS', 'dec': nav_sbas, 'minlen': 12,
  4657. 'name': 'UBX-NAV-SBAS'},
  4658. 0x34: {'str': 'ORB', 'dec': nav_orb, 'minlen': 8,
  4659. 'name': 'UBX-NAV-ORB'},
  4660. 0x35: {'str': 'SAT', 'dec': nav_sat, 'minlen': 8,
  4661. 'name': 'UBX-NAV-SAT'},
  4662. 0x39: {'str': 'GEOFENCE', 'dec': nav_geofence, 'minlen': 8,
  4663. 'name': 'UBX-NAV-GEOFENCE'},
  4664. 0x3B: {'str': 'SVIN', 'dec': nav_svin, 'minlen': 40,
  4665. 'name': 'UBX-NAV-SVIN'},
  4666. 0x3C: {'str': 'RELPOSNED', 'dec': nav_relposned, 'minlen': 64,
  4667. 'name': 'UBX-NAV-RELPOSNED'},
  4668. # deprecated in u-blox 6, SFDR only
  4669. 0x40: {'str': 'EKFSTATUS', 'minlen': 36,
  4670. 'name': 'UBX-NAV-EKFSTATUS'},
  4671. 0x42: {'str': 'SLAS', 'dec': nav_slas, 'minlen': 20,
  4672. 'name': 'UBX-NAV-SLAS'},
  4673. 0x43: {'str': 'SIG', 'dec': nav_sig, 'minlen': 8,
  4674. 'name': 'UBX-NAV-SIG'},
  4675. 0x60: {'str': 'AOPSTATUS', 'dec': nav_aopstatus, 'minlen': 16,
  4676. 'name': 'UBX-NAV-AOPSTATUS'},
  4677. 0x61: {'str': 'EOE', 'dec': nav_eoe, 'minlen': 4,
  4678. 'name': 'UBX-NAV-EOE'},
  4679. }
  4680. # used for RTCM3 rate config
  4681. rtcm_ids = {5: {'str': '1005'},
  4682. 0x4a: {'str': '1074'},
  4683. 0x4d: {'str': '1077'},
  4684. 0x54: {'str': '1084'},
  4685. 0x57: {'str': '1087'},
  4686. 0x61: {'str': '1097'},
  4687. 0x7c: {'str': '1124'},
  4688. 0x7f: {'str': '1127'},
  4689. 0xe6: {'str': '1230'},
  4690. 0xfd: {'str': '4072-1'},
  4691. 0xfe: {'str': '4072-0'},
  4692. }
  4693. # used for NMEA rate config
  4694. nmea_ids = {0: {'str': 'GGA'},
  4695. 1: {'str': 'GLL'},
  4696. 2: {'str': 'GSA'},
  4697. 3: {'str': 'GSV'},
  4698. 4: {'str': 'RMC'},
  4699. 5: {'str': 'VTG'},
  4700. 6: {'str': 'GRS'},
  4701. 7: {'str': 'GST'},
  4702. 8: {'str': 'ZDA'},
  4703. 9: {'str': 'GBS'},
  4704. 0x0a: {'str': 'DTM'},
  4705. 0x0d: {'str': 'GNS'},
  4706. 0x0f: {'str': 'VLW'},
  4707. 0x40: {'str': 'GPQ'},
  4708. 0x41: {'str': 'TXT'},
  4709. 0x42: {'str': 'GNQ'},
  4710. 0x43: {'str': 'GLQ'},
  4711. 0x44: {'str': 'GBQ'},
  4712. 0x45: {'str': 'GAQ'},
  4713. }
  4714. def rxm_imes(self, buf):
  4715. """UBX-RXM-IMES decode, Indoor Messaging System Information"""
  4716. u = struct.unpack_from('<BBH', buf, 0)
  4717. s = ' numTx %u version %u reserved1 %u' % u
  4718. for i in range(0, u[0]):
  4719. u = struct.unpack_from('<BBHBBHlLLLllLLL', buf, 4 + (i * 44))
  4720. s += ('\n reserved %u txId %u reserved3 %u %u cno %u reserved4 %u'
  4721. '\n doppler %d position1_1 x%x position1_2 x%x'
  4722. '\n position2_1 x%x lat %d lon %d shortIdFrame x%x'
  4723. '\n mediumIdLSB %u mediumId_2 x%x' % u)
  4724. return s
  4725. def rxm_measx(self, buf):
  4726. """UBX-RXM-RAW decode"""
  4727. m_len = len(buf)
  4728. u = struct.unpack_from('<BBBBLLLLLHHHHHBBLL', buf, 0)
  4729. s = (' version %u reserved1 %u %u %u gpsTOW %u gloTOW %u\n'
  4730. ' bdsTOW %u reserved2 %u qzssTOW %u gpsTOWacc %u\n'
  4731. ' gloTOWacc %u bdsTOWacc %u reserved3 %u qzssTOWacc %u\n'
  4732. ' numSV %u flags %#x reserved4 %u %u' % u)
  4733. m_len -= 44
  4734. i = 0
  4735. while 0 < m_len:
  4736. u = struct.unpack_from('<BBBBllHHLBBH', buf, 44 + i * 24)
  4737. s += ('\n gnssId %u svId %u cNo %u mpathIndic %u DopplerMS %d\n'
  4738. ' dopplerHz %d wholeChips %u fracChips %u codephase %u\n'
  4739. ' intCodePhase %u pseudoRangeRMSErr %u reserved5 %u' % u)
  4740. m_len -= 24
  4741. i += 1
  4742. return s
  4743. def rxm_raw(self, buf):
  4744. """UBX-RXM-RAW decode"""
  4745. m_len = len(buf)
  4746. u = struct.unpack_from('<lhBB', buf, 0)
  4747. s = ' iTOW %d weeks %d numSV %u res1 %u' % u
  4748. m_len -= 8
  4749. i = 0
  4750. while 0 < m_len:
  4751. u = struct.unpack_from('<ddfBbbB', buf, 8 + i * 24)
  4752. s += ('\n cpMes %f prMes %f doMes %f sv %d mesQI %d\n'
  4753. ' eno %d lli %d' % u)
  4754. m_len -= 24
  4755. i += 1
  4756. return s
  4757. rxm_rawx_recs = {
  4758. 1: "leapSec",
  4759. 2: "clkReset",
  4760. }
  4761. def rxm_rawx(self, buf):
  4762. """UBX-RXM-RAWX decode"""
  4763. m_len = len(buf)
  4764. # version not here before protver 18, I hope it is zero.
  4765. u = struct.unpack_from('<dHbBBBBB', buf, 0)
  4766. s = (' rcvTow %.3f week %u leapS %d numMeas %u recStat %#x'
  4767. ' version %u\n'
  4768. ' reserved1[2] %#x %#x\n recStat (' % u)
  4769. s += flag_s(u[4], self.rxm_rawx_recs) + ')'
  4770. m_len -= 16
  4771. i = 0
  4772. while 0 < m_len:
  4773. u = struct.unpack_from('<ddfBBBBHBBBBB', buf, 16 + i * 32)
  4774. s += ('\n prmes %.3f cpMes %.3f doMes %f\n'
  4775. ' gnssId %u svId %u sigId %u freqId %u locktime %u '
  4776. 'cno %u\n'
  4777. ' prStdev %u cpStdev %u doStdev %u trkStat %u' % u)
  4778. if VERB_DECODE < opts['verbosity']:
  4779. s += '\n (%s)' % self.gnss_s(u[3], u[4], u[5])
  4780. m_len -= 32
  4781. i += 1
  4782. return s
  4783. def rxm_rlm(self, buf):
  4784. """UBX-RXM-RLM decode, Galileo SAR RLM report"""
  4785. m_len = len(buf)
  4786. # common to Short-RLM and Long-RLM report
  4787. u = struct.unpack_from('<BBBBLLB', buf, 0)
  4788. s = (" version %u type %u svId %u reserved1 %u beacon x%x %x "
  4789. " message %u" % u)
  4790. if 16 == m_len:
  4791. # Short-RLM report
  4792. u = struct.unpack_from('<BBB', buf, 13)
  4793. s += "\n params %u %u reserved2 %u" % u
  4794. elif 28 == m_len:
  4795. # Long-RLM report
  4796. u = struct.unpack_from('<BBBBBBBBBBBBBBB', buf, 13)
  4797. s += ("\n params %u %u %u %u %u %u %u %u %u %u %u %u"
  4798. "\n reserved2 %u %u %u" % u)
  4799. return s
  4800. rxm_rtcm_flags = {
  4801. 1: "crcFailed",
  4802. }
  4803. def rxm_rtcm(self, buf):
  4804. """UBX-RXM-RTCM decode, RTCM Input Status"""
  4805. # present in some u-blox 8 and 9, protVer 20+
  4806. # undocumented, but in NEO-M9N, protVer 32
  4807. u = struct.unpack_from('<BBHHH', buf, 0)
  4808. s = " version %u flags x%x subtype %u refstation %u msgtype %u" % u
  4809. if VERB_DECODE <= opts['verbosity']:
  4810. s += ('\n flags (%s)' % flag_s(u[1], self.rxm_rtcm_flags))
  4811. return s
  4812. def rxm_sfrb(self, buf):
  4813. """UBX-RXM-SFRB decode, Subframe Buffer"""
  4814. u = struct.unpack_from('<BBLLLLLLLLLL', buf, 0)
  4815. s = (' chn %d s svid %3d\n'
  4816. ' dwrd %08x %08x %08x %08x %08x\n'
  4817. ' %08x %08x %08x %08x %08x' % u)
  4818. return s
  4819. # decode GPS subframe 5, pages 1 to 24,
  4820. # and subframe 4, pages 2 to 5, and 7 to 10
  4821. def almanac(self, words):
  4822. """Decode GPS Almanac"""
  4823. # Note: not really tested! What to test against?
  4824. # [1] Section 20.3.3.5, Figure 20-1 Sheet 4, and Table 20-VI.
  4825. # e = Eccentricity
  4826. # toa = Almanac reference time
  4827. # deltai =
  4828. # Omegadot = Rate of Right Ascension
  4829. # SVH = SV Health
  4830. # sqrtA = Square Root of the Semi-Major Axis
  4831. # Omega0 = Longitude of Ascending Node of Orbit Plane at Weekly Epoch
  4832. # omega = Argument of Perigee
  4833. # M0 = Mean Anomaly at Reference Time
  4834. # af0 = SV Clock Bias Correction Coefficient
  4835. # af1 = SV Clock Drift Correction Coefficient
  4836. s = " Almanac"
  4837. s += ("\n e %e toa %u deltai %e Omegadot %e"
  4838. "\n SVH x%x sqrtA %.6f Omega0 %e omega %e"
  4839. "\n M0 %e af0 %e af1 %e" %
  4840. (unpack_u16(words[2], 6) * (2 ** -21),
  4841. unpack_u8(words[3], 22) * (2 ** 12),
  4842. unpack_s16(words[3], 6) * (2 ** -19),
  4843. unpack_s16(words[4], 14) * (2 ** -38),
  4844. unpack_u8(words[4], 6),
  4845. unpack_u24(words[5], 6) * (2 ** -11), # sqrtA
  4846. unpack_s24(words[6], 6) * (2 ** -23),
  4847. unpack_s24(words[7], 6) * (2 ** -23),
  4848. unpack_s24(words[8], 6) * (2 ** -23), # M0
  4849. unpack_s11s(words[9]) * (2 ** -20),
  4850. unpack_s11(words[9], 11) * (2 ** -38)))
  4851. return s
  4852. cnav_msgids = {
  4853. 10: "Ephemeris 1",
  4854. 11: "Ephemeris 2",
  4855. 12: "Reduced Almanac",
  4856. 13: "Clock Differential Correction",
  4857. 14: "Ephemeris Differential Correction",
  4858. 15: "Text",
  4859. 30: "Clock, IONO & Group Delay",
  4860. 31: "Clock & Reduced Almanac",
  4861. 32: "Clock & EOP",
  4862. 33: "Clock & UTC",
  4863. 34: "Clock & Differential Correction",
  4864. 35: "Clock & GGTO",
  4865. 36: "Clock & Text",
  4866. 37: "Clock & Midi Almanac",
  4867. }
  4868. # map subframe 4 SV ID to Page number
  4869. # IS-GPS-200K Table 20-V
  4870. sbfr4_svid_page = {
  4871. 57: 1, # Reserved (Dupe)
  4872. 25: 2,
  4873. 26: 3,
  4874. 27: 4,
  4875. 28: 5,
  4876. # 57: 6, # Reserved (Dupe)
  4877. 29: 7,
  4878. 30: 8,
  4879. 31: 9,
  4880. 32: 10,
  4881. # 57: 11, # Reserved (Dupe)
  4882. 62: 12, # reserved
  4883. 52: 13, # navigation message correction table (NMCT)
  4884. 53: 14, # reserved
  4885. 54: 15, # reserved
  4886. # 57: 16, # Reserved (Dupe)
  4887. 55: 17, # Special messages
  4888. 56: 18, # Ionospheric and UTC data
  4889. 58: 19, # reserved
  4890. 59: 20, # reserved
  4891. # 57: 21, # Reserved (Dupe)
  4892. 60: 22, # reserved
  4893. 61: 23, # reserved
  4894. # 62: 24, # Data ID of transmitting SV. (Dupe)
  4895. 63: 25, # A-S Flags/ SV health
  4896. }
  4897. # map subframe 5 SV ID to Page number
  4898. # FIXME: duplicate keys!
  4899. # IS-GPS-200K Table 20-V
  4900. sbfr5_svid_page = {
  4901. 1: 1,
  4902. 2: 2,
  4903. 3: 3,
  4904. 4: 4,
  4905. 5: 5,
  4906. 6: 6,
  4907. 7: 7,
  4908. 8: 8,
  4909. 9: 9,
  4910. 10: 10,
  4911. 11: 11,
  4912. 12: 12,
  4913. 13: 13,
  4914. 14: 14,
  4915. 15: 15,
  4916. 16: 16,
  4917. 17: 17,
  4918. 18: 18,
  4919. 19: 19,
  4920. 20: 20,
  4921. 21: 21,
  4922. 22: 22,
  4923. 23: 23,
  4924. 24: 24,
  4925. 51: 25, # SV Health, SC 1 to 24
  4926. }
  4927. # URA Index to URA meters
  4928. ura_meters = {
  4929. 0: "2.40 m",
  4930. 1: "3.40 m",
  4931. 2: "4.85 m",
  4932. 3: "6.85 m",
  4933. 4: "9.65 m",
  4934. 5: "13.65 m",
  4935. 6: "24.00 m",
  4936. 7: "48.00 m",
  4937. 8: "96.00 m",
  4938. 9: "192.00 m",
  4939. 10: "384.00 m",
  4940. 11: "768.00 m",
  4941. 12: "1536.00 m",
  4942. 13: "3072.00 m",
  4943. 14: "6144.00 m",
  4944. 15: "Unk",
  4945. }
  4946. codes_on_l2 = {
  4947. 0: "Invalid",
  4948. 1: "P-code ON",
  4949. 2: "C/A-code ON",
  4950. 3: "Invalid",
  4951. }
  4952. nmct_ai = {
  4953. 0: "OK",
  4954. 1: "Encrypted",
  4955. 2: "Unavailable",
  4956. 3: "Reserved",
  4957. }
  4958. def rxm_sfrbx(self, buf):
  4959. """UBX-RXM-SFRBX decode, Broadcast Navigation Data Subframe"""
  4960. # The way u-blox packs the subfram data is perverse, and
  4961. # undocuemnted. Even more perverse than native subframes.
  4962. u = struct.unpack_from('<BBBBBBBB', buf, 0)
  4963. svId = u[1]
  4964. s = (' gnssId %u svId %3u reserved1 %u freqId %u numWords %u\n'
  4965. ' chn %u version %u reserved2 %u\n' % u)
  4966. s += ' dwrd'
  4967. words = ()
  4968. for i in range(0, u[4]):
  4969. u1 = struct.unpack_from('<L', buf, 8 + (i * 4))
  4970. if 6 == (i % 7):
  4971. s += "\n "
  4972. s += " %08x" % u1
  4973. words += (u1[0],)
  4974. if 0 == u[0]:
  4975. # GPS
  4976. preamble = words[0] >> 24
  4977. if 0x8b == preamble:
  4978. # CNAV
  4979. msgid = (words[0] >> 12) & 0x3f
  4980. s += ("\n CNAV: preamble %#x PRN %u msgid %d (%s)\n" %
  4981. (preamble, (words[0] >> 18) & 0x3f,
  4982. msgid, index_s(msgid, self.cnav_msgids)))
  4983. else:
  4984. # LNAV-L, from sat is 10 words of 30 bits
  4985. # from u-blox each of 10 words right aligned into 32 bits
  4986. # plus something in top 2 bits?
  4987. preamble = words[0] >> 22
  4988. subframe = (words[1] >> 8) & 0x07
  4989. s += ("\n LNAV-L: preamble %#x TLM %#x ISF %u" %
  4990. (preamble, (words[0] >> 8) & 0xffff,
  4991. 1 if (words[0] & 0x40) else 0))
  4992. s += ("\n TOW %u AF %u ASF %u Subframe %u" %
  4993. (unpack_u8(words[1], 13) * 6,
  4994. 1 if (words[0] & 0x1000) else 0,
  4995. 1 if (words[0] & 0x800) else 0,
  4996. subframe))
  4997. if 1 == subframe:
  4998. # not well validated decode, possibly wrong...
  4999. # [1] Figure 20-1 Sheet 1, Table 20-I
  5000. # WN = GPS week number
  5001. # TGD = Group Delay Differential
  5002. # tOC = Time of Clock
  5003. # af0 = SV Clock Bias Correction Coefficient
  5004. # af1 = SV Clock Drift Correction Coefficient
  5005. # af2 = Drift Rate Correction Coefficient
  5006. ura = (words[2] >> 14) & 0x0f
  5007. c_on_l2 = (words[2] >> 18) & 0x03
  5008. iodc = ((((words[2] >> 6) & 0x03) << 8) |
  5009. (words[7] >> 24) & 0xff)
  5010. s += ("\n WN %u Codes on L2 %u (%s) URA %u (%s) "
  5011. "SVH %#04x IODC %u" %
  5012. (words[2] >> 20,
  5013. c_on_l2, index_s(c_on_l2, self.codes_on_l2),
  5014. ura, index_s(ura, self.ura_meters),
  5015. (words[2] >> 8) & 0x3f, iodc))
  5016. # tOC = Clock Data Reference Time of Week
  5017. s += ("\n L2 P DF %u TGD %e tOC %u\n"
  5018. " af2 %e af1 %e af0 %e" %
  5019. ((words[2] >> 29) & 0x03,
  5020. unpack_s8(words[6], 6) * (2 ** -31),
  5021. unpack_u16(words[7], 6) * 16,
  5022. unpack_s8(words[8], 22) * (2 ** -55),
  5023. unpack_s16(words[8], 6) * (2 ** -43),
  5024. unpack_s22(words[9], 8) * (2 ** -31)))
  5025. elif 2 == subframe:
  5026. # not well validated decode, possibly wrong...
  5027. # [1] Figure 20-1 Sheet 1, Tables 20-II and 20-III
  5028. # IODE = Issue of Data (Ephemeris)
  5029. # Crs = Amplitude of the Sine Harmonic Correction
  5030. # Term to the Orbit Radius
  5031. # Deltan = Mean Motion Difference From Computed Value
  5032. # M0 = Mean Anomaly at Reference Time
  5033. # Cuc = Amplitude of the Cosine Harmonic Correction
  5034. # Term to the Argument of Latitude
  5035. # e = Eccentricity
  5036. # Cus = Amplitude of the Sine Harmonic Correction Term
  5037. # to the Argument of Latitude
  5038. # sqrtA = Square Root of the Semi-Major Axis
  5039. # tOE = Reference Time Ephemeris
  5040. s += ("\n IODE %u Crs %e Deltan %e M0 %e"
  5041. "\n Cuc %e e %e Cus %e sqrtA %f"
  5042. "\n tOE %u" %
  5043. (unpack_u8(words[2], 22),
  5044. unpack_s16(words[2], 6) * (2 ** -5),
  5045. unpack_s16(words[3], 14) * (2 ** -43),
  5046. # M0
  5047. unpack_s32s(words[4], words[3]) * (2 ** -31),
  5048. unpack_s16(words[5], 14) * (2 ** -29),
  5049. unpack_u32s(words[6], words[5]) * (2 ** -33),
  5050. unpack_s16(words[7], 14) * (2 ** -29),
  5051. unpack_u32s(words[8], words[7]) * (2 ** -19),
  5052. unpack_u16(words[9], 14) * 16))
  5053. elif 3 == subframe:
  5054. # not well validated decode, possibly wrong...
  5055. # [1] Figure 20-1 Sheet 3, Table 20-II, Table 20-III
  5056. # Cic = Amplitude of the Cosine Harmonic Correction
  5057. # Term to the Angle of Inclination
  5058. # Omega0 = Longitude of Ascending Node of Orbit
  5059. # Plane at Weekly Epoch
  5060. # Cis = Amplitude of the Sine Harmonic Correction
  5061. # Term to the Orbit Radius
  5062. # i0 = Inclination Angle at Reference Time
  5063. # Crc = Amplitude of the Cosine Harmonic Correction
  5064. # Term to the Orbit Radius
  5065. # omega = Argument of Perigee
  5066. # Omegadot = Rate of Right Ascension
  5067. # IODE = Issue of Data (Ephemeris)
  5068. # IODT = Rate of Inclination Angle
  5069. s += ("\n Cic %e Omega0 %e Cis %e i0 %e"
  5070. "\n Crc %e omega %e Omegadot %e"
  5071. "\n IDOE %u IDOT %e" %
  5072. (unpack_s16(words[2], 14) * (2 ** -29),
  5073. unpack_s32s(words[3], words[2]) * (2 ** -31),
  5074. unpack_s16(words[4], 14) * (2 ** -29),
  5075. unpack_s32s(words[5], words[4]) * (2 ** -31),
  5076. # Crc
  5077. unpack_s16(words[6], 14) * (2 ** -5),
  5078. unpack_s32s(words[7], words[6]) * (2 ** -31),
  5079. # Omegadot
  5080. unpack_s24(words[8], 6) * (2 ** -43),
  5081. unpack_u8(words[9], 22),
  5082. unpack_s14(words[9], 8) * (2 ** -43)))
  5083. elif 4 == subframe:
  5084. # pages:
  5085. # 2 to 5, 7 to 10 almanac data for SV 25 through 32
  5086. # 13 navigation message correction table (NMCT_
  5087. # 17 Special Messages
  5088. # 18 Ionospheric and UTC data
  5089. # 25 A-S flags/ SV health
  5090. # 1, 6, 11, 16 and 21 reserved
  5091. # 12, 19, 20, 22, 23 and 24 reserved
  5092. # 14 and 15 reserved
  5093. # as of 2018, data ID is always 1.
  5094. svid = (words[2] >> 22) & 0x3f
  5095. if 0 == svid:
  5096. # dummy SV
  5097. page = "0/Dummy"
  5098. else:
  5099. page = index_s(svid, self.sbfr4_svid_page)
  5100. s += ("\n dataid %u svid %u (page %s)\n" %
  5101. (words[2] >> 28, svid, page))
  5102. if 6 == page:
  5103. s += " reserved"
  5104. elif 2 <= page <= 10:
  5105. s += self.almanac(words)
  5106. elif 13 == page:
  5107. # 20.3.3.5.1.9 NMCT.
  5108. # 30 ERDs, but more sats. A sat skips own ERD.
  5109. # no ERD for sat 32
  5110. # erds are signed! 0x20 == NA
  5111. s += (" NMCT AI %u(%s)"
  5112. "\n ERD1: %s %s %s %s %s %s %s %s"
  5113. "\n ERD9: %s %s %s %s %s %s %s %s"
  5114. "\n ERD17: %s %s %s %s %s %s %s %s"
  5115. "\n ERD25: %s %s %s %s %s %s" %
  5116. ((words[2] >> 22) & 0x3, # AI
  5117. index_s((words[2] >> 22) & 0x3, self.nmct_ai),
  5118. erd_s((words[2] >> 16) & 0x3f), # erd1
  5119. erd_s((words[2] >> 8) & 0x3f),
  5120. erd_s((((words[2] >> 2) & 0x30) |
  5121. (words[3] >> 26) & 0x0f)),
  5122. erd_s((words[3] >> 20) & 0x3f),
  5123. erd_s((words[3] >> 14) & 0x3f), # erd5
  5124. erd_s((words[3] >> 8) & 0x3f),
  5125. erd_s((((words[3] >> 2) & 0x30) |
  5126. (words[4] >> 26) & 0x0f)),
  5127. erd_s((words[4] >> 20) & 0x3f),
  5128. erd_s((words[4] >> 14) & 0x3f), # erd9
  5129. erd_s((words[4] >> 8) & 0x3f),
  5130. erd_s((((words[4] >> 2) & 0x30) |
  5131. (words[5] >> 26) & 0x0f)),
  5132. erd_s((words[5] >> 20) & 0x3f),
  5133. erd_s((words[5] >> 14) & 0x3f), # erd 13
  5134. erd_s((words[5] >> 8) & 0x3f),
  5135. erd_s((((words[5] >> 2) & 0x30) |
  5136. (words[6] >> 26) & 0x0f)),
  5137. erd_s((words[6] >> 20) & 0x3f),
  5138. erd_s((words[6] >> 14) & 0x3f), # erd17
  5139. erd_s((words[6] >> 8) & 0x3f),
  5140. erd_s((((words[6] >> 2) & 0x30) |
  5141. (words[7] >> 26) & 0x0f)),
  5142. erd_s((words[7] >> 20) & 0x3f),
  5143. erd_s((words[7] >> 14) & 0x3f), # erd21
  5144. erd_s((words[7] >> 8) & 0x3f),
  5145. erd_s((((words[7] >> 2) & 0x30) |
  5146. (words[8] >> 26) & 0x0f)),
  5147. erd_s((words[8] >> 20) & 0x3f),
  5148. erd_s((words[8] >> 14) & 0x3f), # erd25
  5149. erd_s((words[8] >> 8) & 0x3f),
  5150. erd_s((((words[8] >> 2) & 0x30) |
  5151. (words[9] >> 26) & 0x0f)),
  5152. erd_s((words[9] >> 20) & 0x3f),
  5153. erd_s((words[9] >> 14) & 0x3f), # erd29
  5154. erd_s((words[9] >> 8) & 0x3f), # erd30
  5155. ))
  5156. elif 17 == page:
  5157. s += (" Special messages: " +
  5158. chr((words[2] >> 14) & 0xff) +
  5159. chr((words[2] >> 6) & 0xff) +
  5160. chr((words[3] >> 22) & 0xff) +
  5161. chr((words[3] >> 14) & 0xff) +
  5162. chr((words[3] >> 6) & 0xff) +
  5163. chr((words[4] >> 22) & 0xff) +
  5164. chr((words[4] >> 14) & 0xff) +
  5165. chr((words[4] >> 6) & 0xff) +
  5166. chr((words[5] >> 22) & 0xff) +
  5167. chr((words[5] >> 14) & 0xff) +
  5168. chr((words[5] >> 6) & 0xff) +
  5169. chr((words[6] >> 22) & 0xff) +
  5170. chr((words[6] >> 14) & 0xff) +
  5171. chr((words[6] >> 6) & 0xff) +
  5172. chr((words[7] >> 22) & 0xff) +
  5173. chr((words[7] >> 14) & 0xff) +
  5174. chr((words[7] >> 6) & 0xff) +
  5175. chr((words[8] >> 22) & 0xff) +
  5176. chr((words[8] >> 14) & 0xff) +
  5177. chr((words[8] >> 6) & 0xff) +
  5178. chr((words[9] >> 22) & 0xff) +
  5179. chr((words[9] >> 14) & 0xff))
  5180. elif 18 == page:
  5181. s += " Ionospheric and UTC data"
  5182. elif 25 == page:
  5183. s += " A/S flags"
  5184. else:
  5185. s += " Reserved"
  5186. elif 5 == subframe:
  5187. svid = (words[2] >> 22) & 0x3f
  5188. page = index_s(svid, self.sbfr5_svid_page)
  5189. s += ("\n dataid %u svid %u (page %s)\n" %
  5190. (words[2] >> 28, svid, page))
  5191. if 1 <= page <= 24:
  5192. s += self.almanac(words)
  5193. elif 25 == page:
  5194. s += " A/S flags"
  5195. else:
  5196. s += " Reserved"
  5197. return s
  5198. def rxm_svsi(self, buf):
  5199. """UBX-RXM-SVSI decode, SV Status Info"""
  5200. m_len = len(buf)
  5201. u = struct.unpack_from('<LhBB', buf, 0)
  5202. s = ' iTOW %d week %d numVis %d numSV %d' % u
  5203. m_len -= 8
  5204. i = 0
  5205. while 0 < m_len:
  5206. u = struct.unpack_from('<BBhbB', buf, 8 + i * 6)
  5207. s += '\n svid %3d svFlag %#x azim %3d elev % 3d age %3d' % u
  5208. m_len -= 6
  5209. i += 1
  5210. return s
  5211. rxm_ids = {0x10: {'str': 'RAW', 'dec': rxm_raw, 'minlen': 8,
  5212. 'name': 'UBX-RXM-RAW'}, # obsolete
  5213. 0x11: {'str': 'SFRB', 'dec': rxm_sfrb, 'minlen': 42,
  5214. 'name': 'UBX-RXM-SFRB'},
  5215. 0x13: {'str': 'SFRBX', 'dec': rxm_sfrbx, 'minlen': 8,
  5216. 'name': 'UBX-RXM-SFRBX'},
  5217. 0x14: {'str': 'MEASX', 'dec': rxm_measx, 'minlen': 44,
  5218. 'name': 'UBX-RXM-MEASX'},
  5219. 0x15: {'str': 'RAWX', 'dec': rxm_rawx, 'minlen': 16,
  5220. 'name': 'UBX-RXM-RAWX'},
  5221. 0x20: {'str': 'SVSI', 'dec': rxm_svsi, 'minlen': 8,
  5222. 'name': 'UBX-RXM-SVSI'},
  5223. # deprecated in u-blox 6, 7, raw option only
  5224. 0x30: {'str': 'ALM', 'minlen': 1, 'name': 'UBX-RXM-ALM'},
  5225. # deprecated in u-blox 6, 7, raw option only
  5226. 0x31: {'str': 'EPH', 'minlen': 1, 'name': 'UBX-RXM-EPH'},
  5227. 0x32: {'str': 'RTCM', 'dec': rxm_rtcm, 'minlen': 8,
  5228. 'name': 'UBX-RXM-RTCM'},
  5229. 0x41: {'str': 'PMREQ', 'minlen': 8, 'name': 'UBX-RXM-PMREQ'},
  5230. 0x59: {'str': 'RLM', 'dec': rxm_rlm, 'minlen': 16,
  5231. 'name': 'UBX-RXM-RLM'},
  5232. 0x61: {'str': 'IMES', 'dec': rxm_imes, 'minlen': 4,
  5233. 'name': 'UBX-RXM-IMES'},
  5234. # NEO-D9S, 24 to 528 bytes
  5235. 0x72: {'str': 'PMP', 'minlen': 24, 'name': 'UBX-RXM-PMP'},
  5236. }
  5237. # UBX-SEC-
  5238. def sec_uniqid(self, buf):
  5239. """UBX-SEC_UNIQID decode Unique chip ID"""
  5240. # protVer 18 to 23
  5241. u = struct.unpack_from('<BBHBBBBB', buf, 0)
  5242. s = (" version %u reserved %u %u uniqueId %#02x%02x%02x%02x%02x"
  5243. % u)
  5244. return s
  5245. def sec_sign(self, buf):
  5246. """UBX-SEC_SIGN decode, Signature of a previous message"""
  5247. # protVer 18 to 23
  5248. u = struct.unpack_from('<BBHBBH', buf, 0)
  5249. s = (" version %u reserved %u %u classId x%x messageID x%x "
  5250. " checksum %u\n hash " % u)
  5251. s += gps.polystr(binascii.hexlify(buf[8:39]))
  5252. return s
  5253. sec_ids = {0x01: {'str': 'SIGN', 'minlen': 40, 'dec': sec_sign,
  5254. 'name': 'UBX-SEC-SIGN'},
  5255. 0x03: {'str': 'UNIQID', 'minlen': 9, 'dec': sec_uniqid,
  5256. 'name': 'UBX-SEC-UNIQID'},
  5257. }
  5258. # UBX-TIM-
  5259. def tim_svin(self, buf):
  5260. """UBX-TIM-SVIN decode, Survey-in data"""
  5261. u = struct.unpack_from('<LlllLLBB', buf, 0)
  5262. s = (' dur %u meanX %d meanY %d meanZ %d meanV %u\n'
  5263. ' obs %u valid %u active %u' % u)
  5264. return s
  5265. def tim_tm2(self, buf):
  5266. """UBX-TIM-TM2 decode, Time mark data"""
  5267. u = struct.unpack_from('<BBHHHLLLLL', buf, 0)
  5268. s = (' ch %u flags %#x count %u wnR %u wnF %u\n'
  5269. ' towMsR %u towSubMsR %u towMsF %u towSubMsF %u accEst %u\n' % u)
  5270. return s
  5271. def tim_tp(self, buf):
  5272. """UBX-TIM-TP decode, Time Pulse Timedata"""
  5273. u = struct.unpack_from('<LLlHbb', buf, 0)
  5274. s = (' towMS %u towSubMS %u qErr %d week %d\n'
  5275. ' flags %#x refInfo %#x\n flags ' % u)
  5276. if 0x01 & u[4]:
  5277. s += "timeBase is UTC, "
  5278. else:
  5279. s += "timeBase is GNSS, "
  5280. if 0x02 & u[4]:
  5281. s += "UTC available, "
  5282. else:
  5283. s += "UTC not available, "
  5284. raim = (u[4] >> 2) & 0x03
  5285. if 0 == raim:
  5286. s += "RAIM not available"
  5287. elif 1 == raim:
  5288. s += "RAIM not active"
  5289. elif 2 == raim:
  5290. s += "RAIM active"
  5291. else:
  5292. s += "RAIM ??"
  5293. return s
  5294. tim_vrfy_flags = {
  5295. 0: "no time aiding done",
  5296. 2: "source was RTC",
  5297. 3: "source was AID-IN",
  5298. }
  5299. def tim_vrfy(self, buf):
  5300. """UBX-TIM-VRFY decode, Sourced Time Verification"""
  5301. u = struct.unpack_from('<llllHBB', buf, 0)
  5302. s = (' itow %d frac %d deltaMs %d deltaMs %d\n'
  5303. ' wno %u flags x%x reserved1 %u' % u)
  5304. if VERB_DECODE <= opts['verbosity']:
  5305. s += ('\n flags (%s)' %
  5306. index_s(u[5] & 3, self.tim_vrfy_flags))
  5307. return s
  5308. tim_ids = {0x01: {'str': 'TP', 'dec': tim_tp, 'minlen': 16,
  5309. 'name': 'UBX-TIM-TP'},
  5310. 0x03: {'str': 'TM2', 'dec': tim_tm2, 'minlen': 28,
  5311. 'name': 'UBX-TIM-TM2'},
  5312. 0x04: {'str': 'SVIN', 'dec': tim_svin, 'minlen': 28,
  5313. 'name': 'UBX-TIM-SVIN'},
  5314. 0x06: {'str': 'VRFY', 'dec': tim_vrfy, 'minlen': 20,
  5315. 'name': 'UBX-TIM-VRFY'},
  5316. # u-blox 8, FTS only
  5317. 0x11: {'str': 'DOSC', 'minlen': 8, 'name': 'UBX-TIM-DOSC'},
  5318. # u-blox 8, FTS only
  5319. 0x12: {'str': 'TOS', 'minlen': 56, 'name': 'UBX-TIM-TOS'},
  5320. # u-blox 8, FTS only
  5321. 0x13: {'str': 'SMEAS', 'minlen': 12, 'name': 'UBX-TIM-SMEAS'},
  5322. # u-blox 8, FTS only
  5323. 0x15: {'str': 'VCOCAL', 'minlen': 1, 'name': 'UBX-TIM-VCOCAL'},
  5324. # u-blox 8, FTS only
  5325. 0x16: {'str': 'FCHG', 'minlen': 32, 'name': 'UBX-TIM-FCHG'},
  5326. # u-blox 8, FTS only
  5327. 0x17: {'str': 'HOC', 'minlen': 8, 'name': 'UBX-TIM-HOC'},
  5328. }
  5329. # UBX-UPD-
  5330. upd_sos_cmd = {
  5331. 0: "Create Backup File in Flash",
  5332. 1: "Clear Backup in Flash",
  5333. 2: "Backup File Creation Acknowledge",
  5334. 3: "System Restored from Backup",
  5335. }
  5336. upd_sos_response2 = {
  5337. 0: "Not Acknowledged",
  5338. 1: "Acknowledged",
  5339. }
  5340. upd_sos_response3 = {
  5341. 0: "Unknown",
  5342. 1: "Failed restoring from backup file",
  5343. 2: "Restored from backup file",
  5344. 3: "Not restored (no backup)",
  5345. }
  5346. def upd_sos(self, buf):
  5347. """UBX-UPD-SOS decode, Backup File stuff"""
  5348. m_len = len(buf)
  5349. if 0 == m_len:
  5350. return " Poll Backup File Restore Status"
  5351. if 4 > m_len:
  5352. return " Bad Length %s" % m_len
  5353. u = struct.unpack_from('<BBH', buf, 0)
  5354. s = ' command %u reserved1 x%x %x' % u
  5355. s1 = ""
  5356. if 0 == u[0]:
  5357. # Create Backup in Flash
  5358. pass
  5359. elif 1 == u[0]:
  5360. # Clear Backup in Flash
  5361. pass
  5362. elif 8 > m_len:
  5363. s += " Bad Length %s" % m_len
  5364. elif 2 == u[0]:
  5365. # Backup File Creation Acknowledge
  5366. u1 = struct.unpack_from('<BBH', buf, 4)
  5367. s += '\n response %u reserved2 x%x %x' % u1
  5368. s1 = ' response (%s)' % index_s(u1[0], self.upd_sos_response2)
  5369. elif 3 == u[0]:
  5370. # System Restored from Backup
  5371. u1 = struct.unpack_from('<BBH', buf, 4)
  5372. s += '\n response %u reserved2 x%x %x' % u1
  5373. s1 = ' response (%s)' % index_s(u1[0], self.upd_sos_response3)
  5374. if VERB_DECODE <= opts['verbosity']:
  5375. s += '\n cmd (%s)%s' % (index_s(u[0], self.upd_sos_cmd), s1)
  5376. return s
  5377. upd_ids = {
  5378. # undocumented firmware update message
  5379. 0x0c: {'str': 'undoc1', 'minlen': 13, 'name': "UBX-UPD-undoc1"},
  5380. 0x14: {'str': 'SOS', 'dec': upd_sos, 'name': "UBX-UPD-SOS"},
  5381. # undocumented firmware update message
  5382. 0x25: {'str': 'undoc2', 'minlen': 20, 'name': "UBX-UPD-undoc2"},
  5383. }
  5384. classes = {
  5385. 0x01: {'str': 'NAV', 'ids': nav_ids},
  5386. 0x02: {'str': 'RXM', 'ids': rxm_ids},
  5387. 0x04: {'str': 'INF', 'ids': inf_ids},
  5388. 0x05: {'str': 'ACK', 'ids': ack_ids},
  5389. 0x06: {'str': 'CFG', 'ids': cfg_ids},
  5390. 0x09: {'str': 'UPD', 'ids': upd_ids},
  5391. 0x0A: {'str': 'MON', 'ids': mon_ids},
  5392. 0x0B: {'str': 'AID', 'ids': aid_ids},
  5393. 0x0D: {'str': 'TIM', 'ids': tim_ids},
  5394. 0x10: {'str': 'ESF', 'ids': esf_ids},
  5395. 0x13: {'str': 'MGA', 'ids': mga_ids},
  5396. 0x21: {'str': 'LOG', 'ids': log_ids},
  5397. 0x27: {'str': 'SEC', 'ids': sec_ids},
  5398. 0x28: {'str': 'HNR', 'ids': hnr_ids},
  5399. # Antaris 4
  5400. # 0x4x USR, SCK Customer Messages
  5401. 0xf0: {'str': 'NMEA', 'ids': nmea_ids},
  5402. 0xf5: {'str': 'RTCM', 'ids': rtcm_ids},
  5403. }
  5404. def class_id_s(self, m_class, m_id):
  5405. """Return class and ID numbers as a string."""
  5406. s = 'Class x%02x' % (m_class)
  5407. if (((m_class in self.classes and
  5408. 'str' in self.classes[m_class]))):
  5409. s += ' (%s)' % (self.classes[m_class]['str'])
  5410. s += ' ID x%02x' % (m_id)
  5411. if (((m_class in self.classes and
  5412. 'ids' in self.classes[m_class] and
  5413. m_id in self.classes[m_class]['ids'] and
  5414. 'str' in self.classes[m_class]['ids'][m_id]))):
  5415. s += ' (%s)' % (self.classes[m_class]['ids'][m_id]['str'])
  5416. return s
  5417. def decode_msg(self, out):
  5418. """Decode one message and then return number of chars consumed"""
  5419. state = 'BASE'
  5420. consumed = 0
  5421. # decode state machine
  5422. for this_byte in out:
  5423. consumed += 1
  5424. if isinstance(this_byte, str):
  5425. # a character, probably read from a file
  5426. c = ord(this_byte)
  5427. else:
  5428. # a byte, probably read from a serial port
  5429. c = int(this_byte)
  5430. if VERB_RAW <= opts['verbosity']:
  5431. if ord(' ') <= c <= ord('~'):
  5432. # c is printable
  5433. print("state: %s char %c (%#x)" % (state, chr(c), c))
  5434. else:
  5435. # c is not printable
  5436. print("state: %s char %#x" % (state, c))
  5437. if 'BASE' == state:
  5438. # start fresh
  5439. # place to store 'comments'
  5440. comment = ''
  5441. m_class = 0
  5442. m_id = 0
  5443. m_len = 0
  5444. m_raw = bytearray(0) # class, id, len, payload
  5445. m_payload = bytearray(0) # just the payload
  5446. m_ck_a = 0
  5447. m_ck_b = 0
  5448. if 0xb5 == c:
  5449. # got header 1, mu
  5450. state = 'HEADER1'
  5451. if ord('$') == c:
  5452. # got $, so NMEA?
  5453. state = 'NMEA'
  5454. comment = '$'
  5455. if ord("{") == c:
  5456. # JSON, treat as comment line
  5457. state = 'JSON'
  5458. # start fresh
  5459. comment = "{"
  5460. continue
  5461. if ord("#") == c:
  5462. # comment line
  5463. state = 'COMMENT'
  5464. # start fresh
  5465. comment = "#"
  5466. continue
  5467. if 0xd3 == c:
  5468. # RTCM3 Leader 1
  5469. state = 'RTCM3_1'
  5470. # start fresh
  5471. comment = "#"
  5472. continue
  5473. if (ord('\n') == c) or (ord('\r') == c):
  5474. # CR or LF, leftovers
  5475. return 1
  5476. continue
  5477. if state in ('COMMENT', 'JSON'):
  5478. # inside comment
  5479. if ord('\n') == c or ord('\r') == c:
  5480. # Got newline or linefeed
  5481. # terminate messages on <CR> or <LF>
  5482. # Done, got a full message
  5483. if gps.polystr('{"class":"ERROR"') in comment:
  5484. # always print gpsd errors
  5485. if 0 < opts['timestamp']:
  5486. timestamp()
  5487. print(comment)
  5488. elif VERB_DECODE <= opts['verbosity']:
  5489. if 0 < opts['timestamp']:
  5490. timestamp()
  5491. print(comment)
  5492. return consumed
  5493. # else:
  5494. comment += chr(c)
  5495. continue
  5496. if 'NMEA' == state:
  5497. # getting NMEA payload
  5498. if (ord('\n') == c) or (ord('\r') == c):
  5499. # CR or LF, done, got a full message
  5500. # terminates messages on <CR> or <LF>
  5501. if VERB_DECODE <= opts['verbosity']:
  5502. if 0 < opts['timestamp']:
  5503. timestamp()
  5504. print(comment)
  5505. return consumed
  5506. # else:
  5507. comment += chr(c)
  5508. continue
  5509. if 'RTCM3_1' == state:
  5510. # high 6 bits must be zero,
  5511. if 0 != (c & 0xfc):
  5512. state = 'BASE'
  5513. else:
  5514. # low 2 bits are MSB of a 10-bit length
  5515. m_len = c << 8
  5516. state = 'RTCM3_2'
  5517. m_raw.extend([c])
  5518. continue
  5519. if 'RTCM3_2' == state:
  5520. # 8 bits are LSB of a 10-bit length
  5521. m_len |= 0xff & c
  5522. # add 3 for checksum
  5523. m_len += 3
  5524. state = 'RTCM3_PAYLOAD'
  5525. m_raw.extend([c])
  5526. continue
  5527. if 'RTCM3_PAYLOAD' == state:
  5528. m_len -= 1
  5529. m_raw.extend([c])
  5530. m_payload.extend([c])
  5531. if 0 == m_len:
  5532. state = 'BASE'
  5533. ptype = m_payload[0] << 4
  5534. ptype |= 0x0f & (m_payload[1] >> 4)
  5535. if VERB_DECODE <= opts['verbosity']:
  5536. print("RTCM3 packet: type %d\n" % ptype)
  5537. continue
  5538. if ord('b') == c and 'HEADER1' == state:
  5539. # got header 2
  5540. state = 'HEADER2'
  5541. continue
  5542. if 'HEADER2' == state:
  5543. # got class
  5544. state = 'CLASS'
  5545. m_class = c
  5546. m_raw.extend([c])
  5547. continue
  5548. if 'CLASS' == state:
  5549. # got ID
  5550. state = 'ID'
  5551. m_id = c
  5552. m_raw.extend([c])
  5553. continue
  5554. if 'ID' == state:
  5555. # got first length
  5556. state = 'LEN1'
  5557. m_len = c
  5558. m_raw.extend([c])
  5559. continue
  5560. if 'LEN1' == state:
  5561. # got second length
  5562. m_raw.extend([c])
  5563. m_len += 256 * c
  5564. if 0 == m_len:
  5565. # no payload
  5566. state = 'CSUM1'
  5567. else:
  5568. state = 'PAYLOAD'
  5569. continue
  5570. if 'PAYLOAD' == state:
  5571. # getting payload
  5572. m_raw.extend([c])
  5573. m_payload.extend([c])
  5574. if len(m_payload) == m_len:
  5575. state = 'CSUM1'
  5576. continue
  5577. if 'CSUM1' == state:
  5578. # got ck_a
  5579. state = 'CSUM2'
  5580. m_ck_a = c
  5581. continue
  5582. if 'CSUM2' == state:
  5583. # got a complete, maybe valid, message
  5584. if 0 < opts['timestamp']:
  5585. timestamp()
  5586. # ck_b
  5587. state = 'BASE'
  5588. m_ck_b = c
  5589. # check checksum
  5590. chk = self.checksum(m_raw, len(m_raw))
  5591. if (chk[0] != m_ck_a) or (chk[1] != m_ck_b):
  5592. print("%s: ERROR checksum failed,"
  5593. "was (%d,%d) s/b (%d, %d)\n" %
  5594. (PROG_NAME, m_ck_a, m_ck_b, chk[0], chk[1]))
  5595. s_payload = ''.join('{:02x} '.format(x) for x in m_payload)
  5596. x_payload = ','.join(['%02x' % x for x in m_payload])
  5597. if m_class in self.classes:
  5598. this_class = self.classes[m_class]
  5599. if 'ids' in this_class:
  5600. if m_id in this_class['ids']:
  5601. # got an entry for this message
  5602. # name is mandatory
  5603. s_payload = this_class['ids'][m_id]['name']
  5604. s_payload += ':\n'
  5605. if ((('minlen' in this_class['ids'][m_id]) and
  5606. (0 == m_len) and
  5607. (0 != this_class['ids'][m_id]['minlen']))):
  5608. s_payload += " Poll request"
  5609. elif (('minlen' in this_class['ids'][m_id]) and
  5610. (this_class['ids'][m_id]['minlen'] >
  5611. m_len)):
  5612. # failed minimum length for this message
  5613. s_payload += " Bad Length %s" % m_len
  5614. elif 'dec' in this_class['ids'][m_id]:
  5615. # got a decoder for this message
  5616. dec = this_class['ids'][m_id]['dec']
  5617. s_payload += dec(self, m_payload)
  5618. else:
  5619. s_payload += (" len %#x, raw %s" %
  5620. (m_len, x_payload))
  5621. if not s_payload:
  5622. # huh?
  5623. s_payload = ("%s, len %#x, raw %s" %
  5624. (self.class_id_s(m_class, m_id),
  5625. m_len, x_payload))
  5626. if VERB_INFO <= opts['verbosity']:
  5627. print("%s, len: %#x" %
  5628. (self.class_id_s(m_class, m_id), m_len))
  5629. x_raw = ','.join(['%02x' % x for x in m_raw[0:4]])
  5630. print("header: b5,62,%s" % x_raw)
  5631. print("payload: %s" % x_payload)
  5632. print("chksum: %02x,%02x" % (m_ck_a, m_ck_b))
  5633. print("%s\n" % s_payload)
  5634. return consumed
  5635. # give up
  5636. state = 'BASE'
  5637. # fell out of loop, no more chars to look at
  5638. return 0
  5639. def checksum(self, msg, m_len):
  5640. """Calculate u-blox message checksum"""
  5641. # the checksum is calculated over the Message, starting and including
  5642. # the CLASS field, up until, but excluding, the Checksum Field:
  5643. ck_a = 0
  5644. ck_b = 0
  5645. for c in msg[0:m_len]:
  5646. ck_a += c
  5647. ck_b += ck_a
  5648. return [ck_a & 0xff, ck_b & 0xff]
  5649. def make_pkt(self, m_class, m_id, m_data):
  5650. """Make a message packet"""
  5651. # always little endian, leader, class, id, length
  5652. m_len = len(m_data)
  5653. # build core message
  5654. msg = bytearray(m_len + 6)
  5655. struct.pack_into('<BBH', msg, 0, m_class, m_id, m_len)
  5656. # copy payload into message buffer
  5657. i = 0
  5658. while i < m_len:
  5659. msg[i + 4] = m_data[i]
  5660. i += 1
  5661. # add checksum
  5662. chk = self.checksum(msg, m_len + 4)
  5663. m_chk = bytearray(2)
  5664. struct.pack_into('<BB', m_chk, 0, chk[0], chk[1])
  5665. header = b"\xb5\x62"
  5666. return header + msg[:m_len + 4] + m_chk
  5667. def gps_send(self, m_class, m_id, m_data):
  5668. """Build, and send, a message to GPS"""
  5669. m_all = self.make_pkt(m_class, m_id, m_data)
  5670. self.gps_send_raw(m_all)
  5671. def gps_send_raw(self, m_all):
  5672. """Send a raw message to GPS"""
  5673. if not opts['read_only']:
  5674. io_handle.ser.write(m_all)
  5675. if VERB_QUIET < opts['verbosity']:
  5676. sys.stdout.write("sent:\n")
  5677. if VERB_INFO < opts['verbosity']:
  5678. sys.stdout.write(gps.polystr(binascii.hexlify(m_all)))
  5679. sys.stdout.write("\n")
  5680. self.decode_msg(m_all)
  5681. sys.stdout.flush()
  5682. def send_able_cfg_batch(self, able, args):
  5683. """dis/enable batching, UBX-CFG-BATCH"""
  5684. flags = 0x0d if able else 0x0c
  5685. m_data = []
  5686. struct.pack_into('<BBHHBB', m_data, 0, 0, flags, 128, 0, 0, 0)
  5687. gps_model.gps_send(6, 0x93, m_data)
  5688. def send_able_beidou(self, able, args):
  5689. """dis/enable BeiDou"""
  5690. # Two frequency GNSS receivers use BeiDou or GLONASS
  5691. # disable, then enable
  5692. gps_model.send_cfg_gnss1(3, able, args)
  5693. def send_able_binary(self, able, args):
  5694. """dis/enable basic binary messages. -e/-d BINARY"""
  5695. # FIXME: does not change UBX-CFG-PRT outProtoMask for current port.
  5696. # Workarouund: gpsctl -b
  5697. rate = 1 if able else 0
  5698. # UBX-NAV-DOP
  5699. m_data = bytearray([0x01, 0x04, rate])
  5700. gps_model.gps_send(6, 1, m_data)
  5701. if 15 > opts['protver']:
  5702. # UBX-NAV-SOL is ECEF. deprecated in protver 14, gone in protver 27
  5703. m_data = bytearray([0x01, 0x06, rate])
  5704. gps_model.gps_send(6, 1, m_data)
  5705. else:
  5706. # UBX-NAV-PVT
  5707. m_data = bytearray([0x01, 0x07, rate])
  5708. gps_model.gps_send(6, 1, m_data)
  5709. # UBX-NAV-SOL is deprecated in protver 14, kill it always
  5710. m_data = bytearray([0x01, 0x06, 0])
  5711. gps_model.gps_send(6, 1, m_data)
  5712. # UBX-NAV-POSECEF
  5713. m_data = bytearray([0x01, 0x01, rate])
  5714. gps_model.gps_send(6, 1, m_data)
  5715. # UBX-NAV-VELECEF
  5716. m_data = bytearray([0x01, 0x11, rate])
  5717. gps_model.gps_send(6, 1, m_data)
  5718. # UBX-NAV-TIMEGPS
  5719. # Note: UTC may, or may not be UBX-NAV-TIMEGPS.
  5720. # depending on UBX-CFG-NAV5 utcStandard
  5721. # Note: We use TIMEGPS to get the leapS
  5722. m_data = bytearray([0x01, 0x20, rate])
  5723. gps_model.gps_send(6, 1, m_data)
  5724. # no point doing UBX-NAV-SBAS and UBX-NAV-SVINFO
  5725. # faster than every 10 seconds
  5726. if rate:
  5727. rate_s = 10
  5728. else:
  5729. rate_s = 0
  5730. if 27 > opts['protver']:
  5731. # UBX-NAV-SBAS, gone in protver 27
  5732. m_data = bytearray([0x01, 0x32, rate_s])
  5733. gps_model.gps_send(6, 1, m_data)
  5734. # get Satellite Information
  5735. if 15 > opts['protver']:
  5736. # UBX-NAV-SVINFO - deprecated in protver 15, gone in 27
  5737. m_data = bytearray([0x01, 0x30, rate_s])
  5738. gps_model.gps_send(6, 1, m_data)
  5739. # UBX-NAV-SAT turn it off, if we can
  5740. m_data = bytearray([0x01, 0x35, 0])
  5741. gps_model.gps_send(6, 1, m_data)
  5742. else:
  5743. # use UBX-NAV-SAT for protver 15 and up
  5744. m_data = bytearray([0x01, 0x35, rate_s])
  5745. gps_model.gps_send(6, 1, m_data)
  5746. if 27 > opts['protver']:
  5747. # UBX-NAV-SVINFO turn it off, if we can
  5748. m_data = bytearray([0x01, 0x30, 0])
  5749. gps_model.gps_send(6, 1, m_data)
  5750. if 18 <= opts['protver']:
  5751. # first in u-blox 8
  5752. # UBX-NAV-EOE, end of epoch. Good cycle ender
  5753. m_data = bytearray([0x01, 0x61, rate])
  5754. gps_model.gps_send(6, 1, m_data)
  5755. if not able and 15 <= opts['protver']:
  5756. # if disable, turn off UBX-NAV-VELNED too
  5757. m_data = bytearray([0x01, 0x12, 0])
  5758. gps_model.gps_send(6, 1, m_data)
  5759. def send_able_ecef(self, able, args):
  5760. """Enable ECEF messages"""
  5761. # set NAV-POSECEF rate
  5762. gps_model.send_cfg_msg(1, 1, able)
  5763. # set NAV-VELECEF rate
  5764. gps_model.send_cfg_msg(1, 0x11, able)
  5765. def send_able_gps(self, able, args):
  5766. """dis/enable GPS/QZSS"""
  5767. # GPS and QZSS both on, or both off, together
  5768. # GPS
  5769. gps_model.send_cfg_gnss1(0, able, args)
  5770. # QZSS
  5771. gps_model.send_cfg_gnss1(5, able, args)
  5772. def send_able_galileo(self, able, args):
  5773. """dis/enable GALILEO"""
  5774. gps_model.send_cfg_gnss1(2, able, args)
  5775. def send_able_glonass(self, able, args):
  5776. """dis/enable GLONASS"""
  5777. # Two frequency GPS use BeiDou or GLONASS
  5778. # disable, then enable
  5779. gps_model.send_cfg_gnss1(6, able, args)
  5780. def send_able_logfilter(self, able, args):
  5781. """Enable logging"""
  5782. if able:
  5783. m_data = bytearray([1, # version
  5784. 5, # flags
  5785. # All zeros below == log all
  5786. 0, 0, # minInterval
  5787. 0, 0, # timeThreshold
  5788. 0, 0, # speedThreshold
  5789. 0, 0, 0, 0 # positionThreshold
  5790. ])
  5791. else:
  5792. m_data = bytearray([1, # version
  5793. 0, # flags
  5794. 0, 0, # minInterval
  5795. 0, 0, # timeThreshold
  5796. 0, 0, # speedThreshold
  5797. 0, 0, 0, 0 # positionThreshold
  5798. ])
  5799. # set UBX-CFG-LOGFILTER
  5800. gps_model.gps_send(6, 0x47, m_data)
  5801. def send_able_ned(self, able, args):
  5802. """Enable NAV-RELPOSNED and VELNED messages.
  5803. protver 15+ required for VELNED
  5804. protver 20+, and HP GNSS, required for RELPOSNED"""
  5805. if 15 > opts['protver']:
  5806. sys.stderr.write('%s: WARNING: protver %d too low for NED\n' %
  5807. (PROG_NAME, opts['protver']))
  5808. return
  5809. # set NAV-VELNED rate
  5810. gps_model.send_cfg_msg(1, 0x12, able)
  5811. if 20 > opts['protver']:
  5812. sys.stderr.write('%s: WARNING: protver %d too low for '
  5813. 'RELPOSNED\n' %
  5814. (PROG_NAME, opts['protver']))
  5815. return
  5816. # set NAV-RELPOSNED rate
  5817. gps_model.send_cfg_msg(1, 0x3C, able)
  5818. def send_able_nmea(self, able, args):
  5819. """dis/enable basic NMEA messages"""
  5820. # FIXME: does not change UBX-CFG-PRT outProtoMask for current port.
  5821. # Workarouund: gpsctl -n
  5822. rate = 1 if able else 0
  5823. # xxGBS
  5824. m_data = bytearray([0xf0, 0x09, rate])
  5825. gps_model.gps_send(6, 1, m_data)
  5826. # xxGGA
  5827. m_data = bytearray([0xf0, 0x00, rate])
  5828. gps_model.gps_send(6, 1, m_data)
  5829. # xxGGL
  5830. m_data = bytearray([0xf0, 0x01, rate])
  5831. gps_model.gps_send(6, 1, m_data)
  5832. # xxGSA
  5833. m_data = bytearray([0xf0, 0x02, rate])
  5834. gps_model.gps_send(6, 1, m_data)
  5835. # xxGST
  5836. m_data = bytearray([0xf0, 0x07, rate])
  5837. gps_model.gps_send(6, 1, m_data)
  5838. # xxGSV
  5839. m_data = bytearray([0xf0, 0x03, rate])
  5840. gps_model.gps_send(6, 1, m_data)
  5841. # xxRMC
  5842. m_data = bytearray([0xf0, 0x04, rate])
  5843. gps_model.gps_send(6, 1, m_data)
  5844. # xxVTG
  5845. m_data = bytearray([0xf0, 0x05, rate])
  5846. gps_model.gps_send(6, 1, m_data)
  5847. # xxZDA
  5848. m_data = bytearray([0xf0, 0x08, rate])
  5849. gps_model.gps_send(6, 1, m_data)
  5850. def send_able_rtcm3(self, able, args):
  5851. """dis/enable RTCM3 1005, 1077, 1087, 1230 messages"""
  5852. # protVer 20+, High Precision only
  5853. # No u-blox outputs RTCM2
  5854. # USB ONLY!
  5855. if able:
  5856. rate = 1
  5857. # UBX-CFG-PRT, USB
  5858. # can't really do other portIDs as the messages are different
  5859. # and need data we do not have.
  5860. # does not seem to hurt to enable all in and out, even unsupported
  5861. m_data = bytearray(20)
  5862. m_data[0] = 0x03 # default to USB port
  5863. m_data[12] = 0x27 # in: RTCM3, RTCM2, NMEA and UBX
  5864. # Ensures RTCM3 output (all) are set (outProtoMask)
  5865. # no u-blox has RTCM2 out
  5866. m_data[14] = 0x23 # out: RTCM3, NMEA and UBX
  5867. gps_model.gps_send(0x06, 0x00, m_data)
  5868. else:
  5869. # leave UBX-CFG-PRT alone
  5870. rate = 0
  5871. # 1005, Stationary RTK reference station ARP
  5872. m_data = bytearray([0xf5, 0x05, rate])
  5873. gps_model.gps_send(6, 1, m_data)
  5874. # 1077, GPS MSM7
  5875. m_data = bytearray([0xf5, 0x4d, rate])
  5876. gps_model.gps_send(6, 1, m_data)
  5877. # 1087, GLONASS MSM7
  5878. m_data = bytearray([0xf5, 0x57, rate])
  5879. gps_model.gps_send(6, 1, m_data)
  5880. # 1230, GLONASS code-phase biases
  5881. m_data = bytearray([0xf5, 0xe6, rate])
  5882. gps_model.gps_send(6, 1, m_data)
  5883. # we skip Galileo or BeiDou for now, unsupported by u-blox rover
  5884. # ZED-F9P rover requires MSM7 and 4072,0 or 4072,1
  5885. # 4072,0
  5886. m_data = bytearray([0xf5, 0xfe, rate])
  5887. # 4072,1
  5888. m_data = bytearray([0xf5, 0xfd, rate])
  5889. gps_model.gps_send(6, 1, m_data)
  5890. def send_able_rawx(self, able, args):
  5891. """dis/enable UBX-RXM-RAW/RAWXX"""
  5892. rate = 1 if able else 0
  5893. if 15 > opts['protver']:
  5894. # u-blox 7 or earlier, use RAW
  5895. sid = 0x10
  5896. else:
  5897. # u-blox 8 or later, use RAWX
  5898. sid = 0x15
  5899. m_data = bytearray([0x2, sid, rate])
  5900. gps_model.gps_send(6, 1, m_data)
  5901. def send_able_pps(self, able, args):
  5902. """dis/enable PPS, using UBX-CFG-TP5"""
  5903. m_data = bytearray(32)
  5904. m_data[0] = 0 # tpIdx
  5905. m_data[1] = 1 # version
  5906. m_data[2] = 0 # reserved
  5907. m_data[3] = 0 # reserved
  5908. m_data[4] = 2 # antCableDelay
  5909. m_data[5] = 0 # antCableDelay
  5910. m_data[6] = 0 # rfGroupDelay
  5911. m_data[7] = 0 # rfGroupDelay
  5912. m_data[8] = 0x40 # freqPeriod
  5913. m_data[9] = 0x42 # freqPeriod
  5914. m_data[10] = 0x0f # freqPeriod
  5915. m_data[11] = 0 # freqPeriod
  5916. m_data[12] = 0x40 # freqPeriodLock
  5917. m_data[13] = 0x42 # freqPeriodLock
  5918. m_data[14] = 0x0f # freqPeriodLock
  5919. m_data[15] = 0 # freqPeriodLock
  5920. m_data[16] = 0 # pulseLenRatio
  5921. m_data[17] = 0 # pulseLenRatio
  5922. m_data[18] = 0 # pulseLenRatio
  5923. m_data[19] = 0 # pulseLenRatio
  5924. m_data[20] = 0xa0 # pulseLenRatioLock
  5925. m_data[21] = 0x86 # pulseLenRatioLock
  5926. m_data[22] = 0x1 # pulseLenRatioLock
  5927. m_data[23] = 0 # pulseLenRatioLock
  5928. m_data[24] = 0 # userConfigDelay
  5929. m_data[25] = 0 # userConfigDelay
  5930. m_data[26] = 0 # userConfigDelay
  5931. m_data[27] = 0 # userConfigDelay
  5932. m_data[28] = 0x77 # flags
  5933. m_data[29] = 0 # flags
  5934. m_data[30] = 0 # flags
  5935. m_data[31] = 0 # flags
  5936. if not able:
  5937. m_data[28] &= ~1 # bit 0 is active
  5938. gps_model.gps_send(6, 0x31, m_data)
  5939. def send_able_sbas(self, able, args):
  5940. """dis/enable SBAS"""
  5941. gps_model.send_cfg_gnss1(1, able, args)
  5942. def send_able_sfrbx(self, able, args):
  5943. """dis/enable UBX-RXM-SFRB/SFRBX"""
  5944. rate = 1 if able else 0
  5945. if 15 > opts['protver']:
  5946. # u-blox 7 or earlier, use SFRB
  5947. sid = 0x11
  5948. else:
  5949. # u-blox 8 or later, use SFRBX
  5950. sid = 0x13
  5951. m_data = bytearray([0x2, sid, rate])
  5952. gps_model.gps_send(6, 1, m_data)
  5953. def send_able_tmode2(self, able, args):
  5954. """SURVEYIN, UBX-CFG-TMODE2, set time mode 2 config"""
  5955. m_data = bytearray(28)
  5956. # on a NEO-M8T, with good antenna
  5957. # five minutes, gets about 1 m
  5958. # ten minutes, gets about 0.9 m
  5959. # twenty minutes, gets about 0.7 m
  5960. # one hour, gets about 0.5 m
  5961. # twelve hours, gets about 0.14 m
  5962. # Survey-in minimum duration seconds
  5963. seconds = 300
  5964. # Survey-in position accuracy limit in mm
  5965. # make it big, so the duration decides when to end survey
  5966. mmeters = 50000 # default 50 meters
  5967. if able:
  5968. # enable survey-in
  5969. m_data[0] = 1
  5970. if args and len(args[0]):
  5971. seconds = int(args[0])
  5972. if 1 < len(args) and len(args[1]):
  5973. mmeters = int(args[1])
  5974. struct.pack_into('<LL', m_data, 20, seconds, mmeters)
  5975. gps_model.gps_send(6, 0x3d, m_data)
  5976. def send_able_tmode3(self, able, args):
  5977. """SURVEYIN3, UBX-CFG-TMODE3, set time mode 3 config"""
  5978. m_data = bytearray(40)
  5979. # Survey-in minimum duration seconds
  5980. seconds = 300
  5981. # Survey-in position accuracy limit in 0.1mm
  5982. # make it big, so the duration decides when to end survey
  5983. # mmeters is 5m!
  5984. mmeters = 500000 # default 50 meters
  5985. if able:
  5986. # enable survey-in
  5987. m_data[2] = 1
  5988. if args and len(args[0]):
  5989. seconds = int(args[0])
  5990. if 1 < len(args) and len(args[1]):
  5991. mmeters = int(args[1])
  5992. struct.pack_into('<LL', m_data, 24, seconds, mmeters)
  5993. gps_model.gps_send(6, 0x71, m_data)
  5994. def send_able_tp(self, able, args):
  5995. """dis/enable UBX-TIM-TP Time Pulse"""
  5996. rate = 1 if able else 0
  5997. m_data = bytearray([0xd, 0x1, rate])
  5998. gps_model.gps_send(6, 1, m_data)
  5999. def send_cfg_cfg(self, save_clear, args=[]):
  6000. """UBX-CFG-CFG, save config"""
  6001. # Save: save_clear = 0
  6002. # Clear: save_clear = 1
  6003. # basic configs always available to change:
  6004. # ioPort = 1, msgConf = 2, infMsg = 4, navConf = 8, rxmConf =0x10
  6005. cfg1 = 0x1f
  6006. # senConf = 1, rinvConf = 2, antConf = 4, logConf = 8, ftsConf = 0x10
  6007. cfg2 = 0x0f
  6008. m_data = bytearray(13)
  6009. # clear mask
  6010. # as of protver 27, any bit in clearMask clears all
  6011. if 0 == save_clear:
  6012. # saving, so do not clear
  6013. m_data[0] = 0
  6014. m_data[1] = 0
  6015. else:
  6016. # clearing
  6017. m_data[0] = cfg1
  6018. m_data[1] = cfg2
  6019. m_data[2] = 0 #
  6020. m_data[3] = 0 #
  6021. # save mask
  6022. # as of protver 27, any bit in saveMask saves all
  6023. if 0 == save_clear:
  6024. # saving
  6025. m_data[4] = cfg1
  6026. m_data[5] = cfg2
  6027. else:
  6028. # clearing, so do not save
  6029. m_data[4] = 0
  6030. m_data[5] = 0
  6031. m_data[6] = 0 #
  6032. m_data[7] = 0 #
  6033. # load mask
  6034. # as of protver 27, any bit in loadMask loads all
  6035. if False and 0 == save_clear:
  6036. # saving
  6037. m_data[8] = 0
  6038. m_data[9] = 0
  6039. else:
  6040. # clearing, load it to save a reboot
  6041. m_data[8] = cfg1
  6042. m_data[9] = cfg2
  6043. m_data[10] = 0 #
  6044. m_data[11] = 0 #
  6045. # deviceMask, where to save it, try all options
  6046. # devBBR = 1, devFLASH = 2, devEEPROM = 4, devSpiFlash = 0x10
  6047. m_data[12] = 0x17
  6048. gps_model.gps_send(6, 0x9, m_data)
  6049. def send_cfg_gnss1(self, gnssId, enable, args):
  6050. """UBX-CFG-GNSS, set GNSS config
  6051. WARNING: the receiver will ACK, then ignore, many seemingly valid settings.
  6052. Always double check with "-p CFG-GNSS".
  6053. """
  6054. # FIXME! Add warning if ,2 is requested on single frequency devices
  6055. # Only u-blox 9 supports L2, except for M9N does not.
  6056. m_data = bytearray(12)
  6057. m_data[0] = 0 # version 0, msgVer
  6058. m_data[1] = 0 # read only protVer 23+, numTrkChHw
  6059. m_data[2] = 0xFF # read only protVer 23+, numTrkChUse
  6060. m_data[3] = 1 # 1 block follows
  6061. # block 1
  6062. m_data[4] = gnssId # gnssId
  6063. # m_data[5], resTrkCh, read only protVer 23+
  6064. # m_data[6], maxTrkCh, read only protVer 23+
  6065. m_data[7] = 0 # reserved1
  6066. m_data[8] = enable # flags
  6067. m_data[9] = 0 # flags, unused
  6068. # m_data[10], sigCfgMask, enable all signals
  6069. if args:
  6070. parm1 = args[0]
  6071. else:
  6072. parm1 = ''
  6073. if 0 == gnssId:
  6074. # GPS. disable does not seem to work on NEO-M9N?
  6075. m_data[5] = 8 # resTrkCh
  6076. m_data[6] = 16 # maxTrkCh
  6077. if '2' == parm1 and enable:
  6078. # The NEO-M9N ACKS, then ignores if 0x11 is sent
  6079. m_data[10] = 0x11 # flags L1C/A, L2C
  6080. else:
  6081. m_data[10] = 0x01 # flags L1C/A
  6082. elif 1 == gnssId:
  6083. # SBAS
  6084. m_data[5] = 1 # resTrkCh
  6085. m_data[6] = 3 # maxTrkCh
  6086. m_data[10] = 1 # flags L1C/A
  6087. elif 2 == gnssId:
  6088. # Galileo
  6089. m_data[5] = 4 # resTrkCh
  6090. m_data[6] = 8 # maxTrkCh
  6091. if '2' == parm1 and enable:
  6092. # The NEO-M9N ACKS, then ignores if 0x11 is sent
  6093. m_data[10] = 0x21 # flags E1, E5b
  6094. else:
  6095. m_data[10] = 0x01 # flags E1
  6096. elif 3 == gnssId:
  6097. # BeiDou
  6098. m_data[5] = 2 # resTrkCh
  6099. m_data[6] = 16 # maxTrkCh
  6100. if '2' == parm1 and enable:
  6101. # The NEO-M9N ACKS, then ignores if 0x11 is sent
  6102. m_data[10] = 0x11 # flags B1I, B2I
  6103. else:
  6104. m_data[10] = 0x01 # flags B1I
  6105. elif 4 == gnssId:
  6106. # IMES
  6107. m_data[5] = 0 # resTrkCh
  6108. m_data[6] = 8 # maxTrkCh
  6109. m_data[10] = 1 # flags L1
  6110. elif 5 == gnssId:
  6111. # QZSS
  6112. m_data[5] = 0 # resTrkCh
  6113. m_data[6] = 3 # maxTrkCh
  6114. if '2' == parm1 and enable:
  6115. # The NEO-M9N ACKS, then ignores if 0x11 is sent
  6116. m_data[10] = 0x15 # flags L1C/A, L1S, L2C
  6117. else:
  6118. m_data[10] = 0x05 # flags L1C/A, L1S
  6119. elif 6 == gnssId:
  6120. # GLONASS
  6121. m_data[5] = 8 # resTrkCh
  6122. m_data[6] = 14 # maxTrkCh
  6123. if '2' == parm1 and enable:
  6124. # The NEO-M9N ACKS, then ignores if 0x11 is sent
  6125. m_data[10] = 0x11 # flags L1, L2
  6126. else:
  6127. m_data[10] = 0x01 # flags L1
  6128. else:
  6129. # what else?
  6130. m_data[10] = 1 # flags L1
  6131. m_data[11] = 0 # flags, bits 24:31, unused
  6132. gps_model.gps_send(6, 0x3e, m_data)
  6133. def poll_cfg_inf(self):
  6134. """UBX-CFG-INF, poll"""
  6135. m_data = bytearray(1)
  6136. m_data[0] = 0 # UBX
  6137. gps_model.gps_send(6, 0x02, m_data)
  6138. m_data[0] = 1 # NMEA
  6139. gps_model.gps_send(6, 0x02, m_data)
  6140. def send_poll_cfg_msg(self, args):
  6141. """UBX-CFG-MSG, mandatory args: class, ID, optional rate"""
  6142. if 0 == len(args):
  6143. sys.stderr.write('%s: ERROR: CFG-MSG missing class\n' %
  6144. (PROG_NAME))
  6145. sys.exit(1)
  6146. if 1 == len(args):
  6147. sys.stderr.write('%s: ERROR: CFG-MSG,x%x missing ID\n' %
  6148. (PROG_NAME, args[0]))
  6149. sys.exit(1)
  6150. if 2 < len(args):
  6151. # optional set rate
  6152. m_data = bytearray(3)
  6153. m_data[2] = int(args[2])
  6154. else:
  6155. m_data = bytearray(2)
  6156. m_data[0] = int(args[0])
  6157. m_data[1] = int(args[1])
  6158. gps_model.gps_send(6, 1, m_data)
  6159. def send_cfg_nav5_model(self, args):
  6160. """MODEL, UBX-CFG-NAV5, set dynamic platform model"""
  6161. m_data = bytearray(36)
  6162. if 0 < len(args):
  6163. m_data[0] = 1 # just setting dynamic model
  6164. m_data[1] = 0 # just setting dynamic model
  6165. m_data[2] = int(args[0])
  6166. # else:
  6167. # Just polling deprecated
  6168. gps_model.gps_send(6, 0x24, m_data)
  6169. def send_cfg_msg(self, m_class, m_id, rate=None):
  6170. """UBX-CFG-MSG, poll, or set, message rates decode"""
  6171. m_data = bytearray(2)
  6172. m_data[0] = m_class
  6173. m_data[1] = m_id
  6174. if rate is not None:
  6175. m_data.extend([rate])
  6176. gps_model.gps_send(6, 1, m_data)
  6177. def send_cfg_pms(self, args):
  6178. """UBX-CFG-PMS, poll/set Power Management Settings"""
  6179. if 0 < len(args):
  6180. m_data = bytearray(8)
  6181. # set powerSetupValue to mode
  6182. m_data[1] = int(args[0])
  6183. # leave period and onTime zero, which breaks powerSetupValue = 3
  6184. else:
  6185. # just poll, DEPRECATED
  6186. m_data = []
  6187. gps_model.gps_send(6, 0x86, m_data)
  6188. def send_cfg_prt(self, args=None):
  6189. """UBX-CFG-PRT, get I/O Port settings"""
  6190. if 0 == len(args):
  6191. # get current port
  6192. m_data = []
  6193. else:
  6194. # get specified port
  6195. # seems broken on ZED-F9P
  6196. m_data = bytearray([int(args[0])])
  6197. gps_model.gps_send(6, 0x0, m_data)
  6198. def send_cfg_rate(self, args):
  6199. """UBX-CFG-RATE, poll/set rate settings"""
  6200. if 0 == len(args):
  6201. # poll
  6202. gps_model.gps_send(6, 0x08, [])
  6203. return
  6204. m_data = bytearray(6)
  6205. measRate = int(args[0])
  6206. navRate = 1
  6207. timeRef = 1
  6208. if 1 < len(args):
  6209. navRate = int(args[1])
  6210. if 2 < len(args):
  6211. timeRef = int(args[2])
  6212. struct.pack_into('<HHH', m_data, 0, measRate, navRate, timeRef)
  6213. gps_model.gps_send(6, 0x08, m_data)
  6214. def send_cfg_rst(self, reset_type):
  6215. """UBX-CFG-RST, reset"""
  6216. # Always do a hardware reset
  6217. # If on native USB: both Hardware reset (0) and Software reset (1)
  6218. # will disconnect and reconnect, giving you a new /dev/tty.
  6219. m_data = bytearray(4)
  6220. m_data[0] = reset_type & 0xff
  6221. m_data[1] = (reset_type >> 8) & 0xff
  6222. gps_model.gps_send(6, 0x4, m_data)
  6223. def send_cfg_rxm(self, args):
  6224. """UBX-CFG-RXM, poll/set low power mode"""
  6225. if 0 == len(args):
  6226. # poll
  6227. m_data = []
  6228. else:
  6229. # lpMode
  6230. m_data = bytearray([0, int(args[0])])
  6231. gps_model.gps_send(6, 0x11, m_data)
  6232. def send_cfg_slas(self, args):
  6233. """UBX-CFG-SLAS, poll/set SLAS mode"""
  6234. if 0 == len(args):
  6235. # poll
  6236. m_data = []
  6237. else:
  6238. # mode
  6239. m_data = bytearray(4)
  6240. m_data[0] = int(args[0])
  6241. gps_model.gps_send(6, 0x8d, m_data)
  6242. def send_cfg_tp5(self, args):
  6243. """UBX-CFG-TP5, get time0 decodes"""
  6244. if 0 == len(args):
  6245. # poll default tpIdx 0
  6246. m_data = []
  6247. else:
  6248. # tpIdx
  6249. m_data = bytearray([int(args[0])])
  6250. gps_model.gps_send(6, 0x31, m_data)
  6251. def send_set_speed(self, speed):
  6252. """"UBX-CFG-PRT, set port"""
  6253. port = opts['port']
  6254. # FIXME! Determine and use current port as default
  6255. if port is None:
  6256. port = 1 # Default to port 1 (UART/UART_1)
  6257. if port not in set([1, 2]):
  6258. sys.stderr.write('%s: Invalid UART port - %d\n' %
  6259. (PROG_NAME, port))
  6260. sys.exit(2)
  6261. # FIXME! Poll current masks, then adjust speed
  6262. m_data = bytearray(20)
  6263. m_data[0] = port
  6264. m_data[4] = 0xc0 # 8N1
  6265. m_data[5] = 0x8 # 8N1
  6266. m_data[8] = speed & 0xff
  6267. m_data[9] = (speed >> 8) & 0xff
  6268. m_data[10] = (speed >> 16) & 0xff
  6269. m_data[11] = (speed >> 24) & 0xff
  6270. m_data[12] = 3 # in, ubx and nmea
  6271. m_data[14] = 3 # out, ubx and nmea
  6272. gps_model.gps_send(6, 0, m_data)
  6273. def send_cfg_valdel(self, keys):
  6274. """UBX-CFG-VALDEL, delete config items by key"""
  6275. # present in u-blox NEO-D9S+, protver 24
  6276. # present in 9-series and higher
  6277. m_data = bytearray(4)
  6278. m_data[0] = 0 # version, 0 = transactionless, 1 = transaction
  6279. m_data[1] = 6 # 2 = BBR, 4 = flash
  6280. # can not delete RAM layer!
  6281. # so options stay set until reset!
  6282. for key in keys:
  6283. k_data = bytearray(4)
  6284. k_data[0] = (key) & 0xff
  6285. k_data[1] = (key >> 8) & 0xff
  6286. k_data[2] = (key >> 16) & 0xff
  6287. k_data[3] = (key >> 24) & 0xff
  6288. m_data.extend(k_data)
  6289. gps_model.gps_send(0x06, 0x8c, m_data)
  6290. def send_cfg_valget(self, keys, layer, position):
  6291. """UBX-CFG-VALGET, get config items by key"""
  6292. # present in u-blox NEO-D9S+, protver 24
  6293. # present in 9-series and higher
  6294. m_data = bytearray(4)
  6295. # version, 0 = request, 1 = answer
  6296. # RAM layer
  6297. # position
  6298. struct.pack_into('<BBH', m_data, 0, 0, 0, position)
  6299. k_data = bytearray(4)
  6300. for key in keys:
  6301. struct.pack_into('<L', k_data, 0, key)
  6302. m_data.extend(k_data)
  6303. if layer is None:
  6304. # blast them for now, should do one at a time...
  6305. layers = set([0, 1, 2, 7])
  6306. for layer in layers:
  6307. m_data[1] = layer
  6308. gps_model.gps_send(0x06, 0x8b, m_data)
  6309. else:
  6310. m_data[1] = layer
  6311. gps_model.gps_send(0x06, 0x8b, m_data)
  6312. def send_cfg_valset(self, nvs):
  6313. """UBX-CFG-VALSET, set config items by key/val pairs"""
  6314. # present in u-blox NEO-D9S+, protver 24
  6315. # present in 9-series and higher
  6316. m_data = bytearray(4)
  6317. m_data[0] = 0 # version, 0 = request, 1 = transaction
  6318. m_data[1] = 0x7 # RAM layer, 1=RAM, 2=BBR, 4=Flash
  6319. for nv in nvs:
  6320. size = 4
  6321. nv_split = nv.split(',')
  6322. name = nv_split[0]
  6323. val = nv_split[1]
  6324. if 3 <= len(nv_split):
  6325. m_data[1] = int(nv_split[2])
  6326. item = gps_model.cfg_by_name(name)
  6327. key = item[1]
  6328. val_type = item[2]
  6329. cfg_type = self.item_to_type(item)
  6330. size = 4 + cfg_type[0]
  6331. frmat = cfg_type[1]
  6332. flavor = cfg_type[2]
  6333. if 'u' == flavor:
  6334. val1 = int(val)
  6335. elif 'i' == flavor:
  6336. val1 = int(val)
  6337. elif 'f' == flavor:
  6338. val1 = float(val)
  6339. kv_data = bytearray(size)
  6340. kv_data[0] = (key) & 0xff
  6341. kv_data[1] = (key >> 8) & 0xff
  6342. kv_data[2] = (key >> 16) & 0xff
  6343. kv_data[3] = (key >> 24) & 0xff
  6344. struct.pack_into(frmat, kv_data, 4, val1)
  6345. m_data.extend(kv_data)
  6346. gps_model.gps_send(0x06, 0x8a, m_data)
  6347. def send_log_findtime(self, args):
  6348. """UBX-LOG-FINDTIME, search log for y,m,d,h,m,s"""
  6349. m_data = bytearray(10)
  6350. m_data[0] = 0 # version, 0 = request
  6351. m_data[1] = 0 # type, 0 = request
  6352. # the doc says two reserved bytes here, the doc is wrong
  6353. # searches for before 1 Jan 2004 always fail
  6354. year = 2004
  6355. month = 1
  6356. day = 1
  6357. hour = 0
  6358. minute = 0
  6359. second = 0
  6360. if 0 < len(args):
  6361. year = int(args[0])
  6362. if 1 < len(args):
  6363. month = int(args[1])
  6364. if 2 < len(args):
  6365. day = int(args[2])
  6366. if 3 < len(args):
  6367. hour = int(args[3])
  6368. if 4 < len(args):
  6369. minute = int(args[4])
  6370. if 5 < len(args):
  6371. second = int(args[5])
  6372. m_data[2] = year % 256 # year 1-65635
  6373. m_data[3] = int(year / 256) & 0xff # year
  6374. m_data[4] = month # month 1-12
  6375. m_data[5] = day # day 1-31
  6376. m_data[6] = hour # hour 0-23
  6377. m_data[7] = minute # minute 0-59
  6378. m_data[8] = second # second 0-60
  6379. m_data[9] = 0 # reserved
  6380. gps_model.gps_send(0x21, 0x0e, m_data)
  6381. def send_log_retrieve(self, args):
  6382. """UBX-LOG-RETRIEVE, gets logs from start,count"""
  6383. m_data = bytearray(12)
  6384. # defaults
  6385. startNumber = 0
  6386. entryCount = 256 # max 256
  6387. if 0 < len(args):
  6388. startNumber = int(args[0])
  6389. if 1 < len(args):
  6390. entryCount = int(args[1])
  6391. struct.pack_into('<LLB', m_data, 0, startNumber, entryCount, 0)
  6392. gps_model.gps_send(0x21, 0x09, m_data)
  6393. def send_log_string(self, args):
  6394. """UBX-LOG-STRING, send string to log"""
  6395. if 0 < len(args):
  6396. string = args[0:256]
  6397. else:
  6398. string = "Hi"
  6399. m_data = gps.polybytes(string)
  6400. gps_model.gps_send(0x21, 0x04, m_data)
  6401. def send_poll(self, m_data):
  6402. """generic send pomonthll request"""
  6403. gps_model.gps_send(m_data[0], m_data[1], m_data[2:])
  6404. CFG_ANT = [0x06, 0x13]
  6405. CFG_BATCH = [0x06, 0x93]
  6406. CFG_DAT = [0x06, 0x06]
  6407. CFG_GNSS = [0x06, 0x3e]
  6408. CFG_GEOFENCE = [0x06, 0x69]
  6409. CFG_INF_0 = [0x06, 0x02, 0]
  6410. CFG_INF_1 = [0x06, 0x02, 1]
  6411. CFG_LOGFILTER = [0x06, 0x47]
  6412. CFG_ODO = [0x06, 0x1e]
  6413. CFG_PRT = [0x06, 0x00] # current port only
  6414. CFG_NAV5 = [0x06, 0x24]
  6415. CFG_NAVX5 = [0x06, 0x23]
  6416. CFG_NMEA = [0x06, 0x17]
  6417. CFG_PM2 = [0x06, 0x3b]
  6418. CFG_PMS = [0x06, 0x86]
  6419. CFG_RATE = [0x06, 0x08]
  6420. CFG_RXM = [0x06, 0x11]
  6421. CFG_TMODE3 = [0x06, 0x71]
  6422. CFG_TP5 = [0x06, 0x31]
  6423. CFG_USB = [0x06, 0x1b]
  6424. LOG_INFO = [0x21, 0x08]
  6425. MON_COMMS = [0x0a, 0x36]
  6426. MON_GNSS = [0x0a, 0x28]
  6427. MON_HW = [0x0a, 0x09]
  6428. MON_HW2 = [0x0a, 0x0b]
  6429. MON_HW3 = [0x0a, 0x37]
  6430. MON_IO = [0x0a, 0x02]
  6431. MON_MSGPP = [0x0a, 0x06]
  6432. MON_RF = [0x0a, 0x38]
  6433. MON_RXBUF = [0x0a, 0x0a]
  6434. MON_TXBUF = [0x0a, 0x08]
  6435. MON_VER = [0x0a, 0x04]
  6436. NAV_SVIN = [0x01, 0x3b]
  6437. TIM_SVIN = [0x0d, 0x04]
  6438. def get_config(self):
  6439. """CONFIG. Get a bunch of config messages"""
  6440. cmds = [ubx.MON_VER, # UBX-MON-VER
  6441. ubx.CFG_ANT, # UBX-CFG-ANT
  6442. ubx.CFG_DAT, # UBX-CFG-DAT
  6443. # skip UBX-CFG-DGNSS, HP only
  6444. # skip UBX-CFG-DOSC, FTS only
  6445. # skip UBX-CFG-ESRC, FTS only
  6446. ubx.CFG_GEOFENCE, # UBX-CFG-GEOFENCE
  6447. ubx.CFG_GNSS, # UBX-CFG-GNSS
  6448. # skip UBX-CFG-HNR, ADR, UDR, only
  6449. ubx.CFG_INF_0, # UBX-CFG-INF
  6450. ubx.CFG_INF_1,
  6451. # skip UBX-CFG-ITFM
  6452. ubx.CFG_LOGFILTER, # UBX-CFG-LOGFILTER
  6453. ubx.CFG_NAV5, # UBX-CFG-NAV5
  6454. ubx.CFG_NAVX5, # UBX-CFG-NAVX5
  6455. ubx.CFG_NMEA, # UBX-CFG-NMEA
  6456. ubx.CFG_ODO, # UBX-CFG-ODO
  6457. ubx.CFG_PRT, # UBX-CFG-PRT
  6458. ubx.CFG_PM2, # UBX-CFG-PM2
  6459. ubx.CFG_PMS, # UBX-CFG-PMS
  6460. ubx.CFG_RATE, # UBX-CFG-RATE
  6461. ubx.CFG_RXM, # UBX-CFG-RXM
  6462. ubx.CFG_TP5, # UBX-CFG-TP5
  6463. ubx.CFG_USB, # UBX-CFG-USB
  6464. ]
  6465. if 20 < opts['protver']:
  6466. cmds.append(ubx.CFG_TMODE3) # UBX-CFG-TMODE3, protVer 20+
  6467. if 22 < opts['protver']:
  6468. cmds.append(ubx.CFG_BATCH) # UBX-CFG-BATCH, protVer 23.01+
  6469. # blast them for now, should do one at a time...
  6470. for cmd in cmds:
  6471. gps_model.send_poll(cmd)
  6472. def get_status(self):
  6473. """STATUS. Get a bunch of status messages"""
  6474. cmds = [ubx.MON_VER, # UBX-MON-VER
  6475. ubx.LOG_INFO, # UBX-LOG-INFO
  6476. ubx.MON_GNSS, # UBX-MON-GNSS
  6477. # UBX-MON-PATH, skipping
  6478. ]
  6479. if 27 <= opts['protver']:
  6480. cmds.extend([ubx.MON_COMMS, # UBX-MON-COMMS
  6481. ubx.MON_HW3, # UBX-MON-HW3
  6482. ])
  6483. else:
  6484. # deprecated in 27+
  6485. cmds.extend([ubx.MON_HW, # UBX-MON-HW
  6486. ubx.MON_HW2, # UBX-MON-HW2
  6487. ubx.MON_IO, # UBX-MON-IO
  6488. ubx.MON_MSGPP, # UBX-MON-MSGPP
  6489. ubx.MON_RF, # UBX-MON-RF
  6490. ubx.MON_RXBUF, # UBX-MON-RXBUF
  6491. ubx.MON_TXBUF, # UBX-MON-TXBUF
  6492. ])
  6493. # should only send these for Time or HP products
  6494. cmds.extend([ubx.NAV_SVIN, # UBX-NAV-SVIN
  6495. ubx.TIM_SVIN, # UBX-TIM-SVIN
  6496. ])
  6497. # blast them for now, should do one at a time...
  6498. for cmd in cmds:
  6499. gps_model.send_poll(cmd)
  6500. able_commands = {
  6501. # en/dis able BATCH
  6502. "BATCH": {"command": send_able_cfg_batch,
  6503. "help": "batching, using CFG-BATCH"},
  6504. # en/dis able BeiDou
  6505. "BEIDOU": {"command": send_able_beidou,
  6506. "help": "BeiDou B1. BEIDOU,5 for B1 and B2"},
  6507. # en/dis able basic binary messages
  6508. "BINARY": {"command": send_able_binary,
  6509. "help": "basic binary messages"},
  6510. # en/dis able ECEF
  6511. "ECEF": {"command": send_able_ecef,
  6512. "help": "ECEF"},
  6513. # en/dis able GPS
  6514. "GPS": {"command": send_able_gps,
  6515. "help": "GPS and QZSS L1C/A. GPS,2 for L1C/A and L2C"},
  6516. # en/dis able GALILEO
  6517. "GALILEO": {"command": send_able_galileo,
  6518. "help": "GALILEO E1. GALILEO,2 for E1 and E5b"},
  6519. # en/dis able GLONASS
  6520. "GLONASS": {"command": send_able_glonass,
  6521. "help": "GLONASS L1. GLONASS,2 for L1 and L2"},
  6522. # en/dis able LOG
  6523. "LOG": {"command": send_able_logfilter,
  6524. "help": "Data Logger"},
  6525. # en/dis able NED
  6526. "NED": {"command": send_able_ned,
  6527. "help": "NAV-VELNED and NAV-RELPOSNED"},
  6528. # en/dis able basic NMEA messages
  6529. "NMEA": {"command": send_able_nmea,
  6530. "help": "basic NMEA messages"},
  6531. # en/dis able RAW/RAWX
  6532. "RAWX": {"command": send_able_rawx,
  6533. "help": "RAW/RAWX measurements"},
  6534. # en/dis able PPS
  6535. "PPS": {"command": send_able_pps,
  6536. "help": "PPS on TIMPULSE"},
  6537. # en/dis able SBAS
  6538. "SBAS": {"command": send_able_sbas,
  6539. "help": "SBAS L1C"},
  6540. # en/dis able SFRB/SFRBX
  6541. "SFRBX": {"command": send_able_sfrbx,
  6542. "help": "SFRB/SFRBX subframes"},
  6543. # en/dis able TP time pulse message
  6544. "TP": {"command": send_able_tp,
  6545. "help": "TP Time Pulse message"},
  6546. # en/dis able TMODE2 Survey-in
  6547. "SURVEYIN": {"command": send_able_tmode2,
  6548. "help": "Survey-in mode with TMODE2."
  6549. " SURVEYIN2[,svinMinDur[,svinAccLimit]]\n"
  6550. " "
  6551. "Default svinMinDur 300 seconds\n"
  6552. " "
  6553. "Default svinAccLimit 50000",
  6554. "args": 1},
  6555. # en/dis able TMODE3 Survey-in
  6556. "SURVEYIN3": {"command": send_able_tmode3,
  6557. "help": "Survey-in mode with TMODE3."
  6558. " SURVEYIN3[,svinMinDur[,svinAccLimit]]\n"
  6559. " "
  6560. "Default svinMinDur 300 seconds\n"
  6561. " "
  6562. "Default svinAccLimit 500000",
  6563. "args": 1},
  6564. # en/dis able RTCM3 messages 1005, 1077, 1087, 1230
  6565. "RTCM3": {"command": send_able_rtcm3,
  6566. "help": "required RTCM3 messages. USB port only"},
  6567. }
  6568. commands = {
  6569. # UBX-CFG-RST
  6570. "COLDBOOT": {"command": send_cfg_rst,
  6571. "help": "UBS-CFG-RST coldboot the GPS",
  6572. "opt": 0xffff},
  6573. # CONFIG
  6574. "CONFIG": {"command": get_config,
  6575. "help": "Get a lot of receiver config"},
  6576. # UBX-CFG-RST
  6577. "HOTBOOT": {"command": send_cfg_rst,
  6578. "help": "UBX-CFG-RST hotboot the GPS",
  6579. "opt": 0},
  6580. # UBX-CFG-NAV5
  6581. "MODEL": {"command": send_cfg_nav5_model,
  6582. "help": "set UBX-CFG-NAV5 Dynamic Platform Model. "
  6583. "MODEL,model",
  6584. "args": 1},
  6585. # UBX-CFG-CFG
  6586. "RESET": {"command": send_cfg_cfg,
  6587. "help": "UBX-CFG-CFG reset config to defaults",
  6588. "opt": 1},
  6589. # UBX-CFG-CFG
  6590. "SAVE": {"command": send_cfg_cfg,
  6591. "help": "UBX-CFG-CFG save current config",
  6592. "opt": 0},
  6593. # STATUS
  6594. "STATUS": {"command": get_status,
  6595. "help": "Get a lot of receiver status"},
  6596. # UBX-CFG-RST
  6597. "WARMBOOT": {"command": send_cfg_rst,
  6598. "help": "UBX-CFG-RST warmboot the GPS",
  6599. "opt": 1},
  6600. # UBX-AID-ALM
  6601. "AID-ALM": {"command": send_poll, "opt": [0x0b, 0x30],
  6602. "help": "poll UBX-AID-ALM Poll GPS Aiding Almanac Data"},
  6603. # UBX-AID-AOP
  6604. "AID-AOP": {"command": send_poll, "opt": [0x0b, 0x33],
  6605. "help": "poll UBX-AID-AOP Poll Poll AssistNow "
  6606. "Autonomous data"},
  6607. # UBX-AID-DATA
  6608. "AID-DATA": {"command": send_poll, "opt": [0x0b, 0x10],
  6609. "help": "Poll all GPS Initial Aiding Data"},
  6610. # UBX-AID-EPH
  6611. "AID-EPH": {"command": send_poll, "opt": [0x0b, 0x31],
  6612. "help": "poll UBX-AID-EPH Poll GPS Aiding Ephemeris Data"},
  6613. # UBX-AID-HUI
  6614. "AID-HUI": {"command": send_poll, "opt": [0x0b, 0x02],
  6615. "help": "poll UBX-AID-HUI Poll GPS Health, UTC, Iono"},
  6616. # UBX-AID-INI
  6617. "AID-INI": {"command": send_poll, "opt": [0x0b, 0x01],
  6618. "help": "poll UBX-AID-INI Poll Aiding position, time, "
  6619. "frequency, clock drift"},
  6620. # UBX-CFG-ANT
  6621. "CFG-ANT": {"command": send_poll, "opt": [0x06, 0x13],
  6622. "help": "poll UBX-CFG-ANT antenna config"},
  6623. # UBX-CFG-BATCH
  6624. # Assume 23 is close enough to the proper 23.01
  6625. "CFG-BATCH": {"command": send_poll, "opt": [0x06, 0x93],
  6626. "help": "poll UBX-CFG-BATCH data batching config",
  6627. "minVer": 23},
  6628. # UBX-CFG-DAT
  6629. "CFG-DAT": {"command": send_poll, "opt": [0x06, 0x06],
  6630. "help": "poll UBX-CFG-DAT Datum Setting"},
  6631. # UBX-CFG-DGNSS
  6632. "CFG-DGNSS": {"command": send_poll, "opt": [0x06, 0x70],
  6633. "help": "poll UBX-CFG-DGNSS DGNSS configuration"},
  6634. # UBX-CFG-DOSC
  6635. "CFG-DOSC": {"command": send_poll, "opt": [0x06, 0x61],
  6636. "help": "poll UBX-CFG-DOSC Disciplined oscillator "
  6637. "configuration"},
  6638. # UBX-CFG-ESRC
  6639. "CFG-ESRC": {"command": send_poll, "opt": [0x06, 0x60],
  6640. "help": "poll UBX-CFG-ESRC External synchronization "
  6641. "source config"},
  6642. # UBX-CFG-FXN
  6643. "CFG-FXN": {"command": send_poll, "opt": [0x06, 0x0e],
  6644. "help": "poll UBX-CFG-FXN FXN Configuration"},
  6645. # UBX-CFG-GEOFENCE
  6646. "CFG-GEOFENCE": {"command": send_poll, "opt": [0x06, 0x69],
  6647. "help": "poll UBX-CFG-GEOFENCE Geofencing "
  6648. "configuration"},
  6649. # UBX-CFG-GNSS
  6650. "CFG-GNSS": {"command": send_poll, "opt": [0x06, 0x3e],
  6651. "help": "poll UBX-CFG-GNSS GNSS config"},
  6652. # UBX-CFG-HNR
  6653. "CFG-HNR": {"command": send_poll, "opt": [0x06, 0x5c],
  6654. "help": "poll UBX-CFG-HNR High Navigation Rate Settings"},
  6655. # UBX-CFG-INF
  6656. "CFG-INF": {"command": poll_cfg_inf,
  6657. "help": "poll UBX-CFG-INF Information Message "
  6658. "Configuration"},
  6659. # UBX-CFG-ITFM
  6660. "CFG-ITFM": {"command": send_poll, "opt": [0x06, 0x39],
  6661. "help": "poll UBX-CFG-ITFM Jamming/Interference "
  6662. "Monitor configuration"},
  6663. # UBX-CFG-LOGFILTER
  6664. "CFG-LOGFILTER": {"command": send_poll, "opt": [0x06, 0x47],
  6665. "help": "poll UBX-CFG-LOGFILTER "
  6666. " Data Logger Configuration",
  6667. "minVer": 14},
  6668. # UBX-CFG-MSG
  6669. "CFG-MSG": {"command": send_poll_cfg_msg,
  6670. "help": "poll/set UBX-CFG-MSG,class,ID[,rate]\n"
  6671. " "
  6672. "rate is optional and sets rate.",
  6673. "args": 2},
  6674. # UBX-CFG-NAV5
  6675. "CFG-NAV5": {"command": send_poll, "opt": [0x06, 0x24],
  6676. "help": "poll UBX-CFG-NAV5 Nav Engines settings"},
  6677. # UBX-CFG-NAVX5
  6678. "CFG-NAVX5": {"command": send_poll, "opt": [0x06, 0x23],
  6679. "help": "poll UBX-CFG-NAVX5 Nav Expert Settings"},
  6680. # UBX-CFG-NMEA
  6681. "CFG-NMEA": {"command": send_poll, "opt": [0x06, 0x17],
  6682. "help": "poll UBX-CFG-NMEA Extended NMEA protocol "
  6683. "configuration V1"},
  6684. # UBX-CFG-ODO
  6685. "CFG-ODO": {"command": send_poll, "opt": [0x06, 0x1e],
  6686. "help": "poll UBX-CFG-ODO Odometer, Low-speed COG "
  6687. "Engine Settings"},
  6688. # UBX-CFG-PM
  6689. "CFG-PM": {"command": send_poll, "opt": [0x06, 0x32],
  6690. "help": "poll UBX-CFG-PM Power management settings"},
  6691. # UBX-CFG-PM2
  6692. "CFG-PM2": {"command": send_poll, "opt": [0x06, 0x3b],
  6693. "help": "poll UBX-CFG-PM2 Extended power management "
  6694. "settings"},
  6695. # UBX-CFG-PMS
  6696. "CFG-PMS": {"command": send_cfg_pms,
  6697. "help": "poll/set UBX-CFG-PMS power management settings\n"
  6698. " "
  6699. "CFG-PMS[,powerSetupValue]",
  6700. "args": 1},
  6701. # UBX-CFG-PRT
  6702. "CFG-PRT": {"command": send_cfg_prt,
  6703. "help": "poll UBX-CFG-PRT I/O port settings"
  6704. " "
  6705. "CFG-PRT[,portID] defaults to current port",
  6706. "args": 1},
  6707. # TODO: UBX-CFG-PWR
  6708. # UBX-CFG-RATE
  6709. "CFG-RATE": {"command": send_cfg_rate,
  6710. "help": "poll/set UBX-CFG-RATE measure/nav settings.\n"
  6711. " "
  6712. "CFG-RATE[,measRate,[navRate]]",
  6713. "args": 2},
  6714. # UBX-CFG-RINV
  6715. "CFG-RINV": {"command": send_poll, "opt": [0x06, 0x34],
  6716. "help": "poll UBX-CFG-RINV Contents of Remote Inventory"},
  6717. # UBX-CFG-RST, see COLDBOOT, WARMBOOT, HOTBOOT
  6718. # UBX-CFG-RXM
  6719. "CFG-RXM": {"command": send_cfg_rxm,
  6720. "help": "poll/set UBX-CFG-RXM RXM configuration.\n"
  6721. " "
  6722. "CFG-RXM[,lpMode]",
  6723. "args": 1},
  6724. # UBX-CFG-SBAS
  6725. "CFG-SBAS": {"command": send_poll, "opt": [0x06, 0x16],
  6726. "help": "poll UBX-CFG-SBAS SBAS settings"},
  6727. # UBX-CFG-SLAS
  6728. "CFG-SLAS": {"command": send_cfg_slas,
  6729. "help": "poll/set UBX-CFG-SLAS SLAS configuration.\n"
  6730. " "
  6731. "CFG-SLAS[,mode]",
  6732. "args": 1},
  6733. # UBX-CFG-SMGR
  6734. "CFG-SMGR": {"command": send_poll, "opt": [0x06, 0x62],
  6735. "help": "poll UBX-CFG-SMGR Synchronization manager "
  6736. "configuration"},
  6737. # UBX-CFG-TMODE
  6738. "CFG-TMODE": {"command": send_poll, "opt": [0x06, 0x1d],
  6739. "help": "poll UBX-CFG-TMODE time mode settings",
  6740. "maxVer": 6},
  6741. # UBX-CFG-TMODE2
  6742. "CFG-TMODE2": {"command": send_poll, "opt": [0x06, 0x3d],
  6743. "help": "poll UBX-CFG-TMODE2 time mode 2 config",
  6744. "minVer": 14},
  6745. # UBX-CFG-TMODE3
  6746. "CFG-TMODE3": {"command": send_poll, "opt": [0x06, 0x71],
  6747. "help": "poll UBX-CFG-TMODE3 time mode 3 config",
  6748. "minVer": 20},
  6749. # UBX-CFG-TP
  6750. "CFG-TP": {"command": send_poll, "opt": [0x06, 0x07],
  6751. "help": "poll UBX-CFG-TP TimePulse Parameters."},
  6752. # UBX-CFG-TP5
  6753. "CFG-TP5": {"command": send_cfg_tp5,
  6754. "help": "poll UBX-TIM-TP5 time pulse decodes.\n"
  6755. " "
  6756. "CFG-TP5[,tpIdx] Default tpIdx is 0",
  6757. "args": 1},
  6758. # UBX-CFG-USB
  6759. "CFG-USB": {"command": send_poll, "opt": [0x06, 0x1b],
  6760. "help": "poll UBX-CFG-USB USB config"},
  6761. # UBX-ESF-INS
  6762. "ESF-INS": {"command": send_poll, "opt": [0x10, 0x15],
  6763. "help": "poll UBX-ESF-INS Vehicle dynamics info"},
  6764. # UBX-ESF-MEAS
  6765. "ESF-MEAS": {"command": send_poll, "opt": [0x10, 0x02],
  6766. "help": "poll UBX-ESF-MEAS External sensor fusion "
  6767. "measurements"},
  6768. # UBX-ESF-STATUS
  6769. "ESF-STATUS": {"command": send_poll, "opt": [0x10, 0x10],
  6770. "help": "poll UBX-ESF-STATUS External sensor fusion "
  6771. "status"},
  6772. # UBX-LOG-CREATE
  6773. "LOG-CREATE": {"command": send_poll,
  6774. "opt": [0x21, 0x07, 0, 1, 0, 0, 0, 0, 0, 0],
  6775. "help": "send UBX-LOG-CREATE",
  6776. "minVer": 14},
  6777. # UBX-LOG-ERASE
  6778. "LOG-ERASE": {"command": send_poll, "opt": [0x21, 0x03],
  6779. "help": "send UBX-LOG-ERASE",
  6780. "minVer": 14},
  6781. # UBX-LOG-FINDTIME
  6782. "LOG-FINDTIME": {"command": send_log_findtime,
  6783. "help": "search logs by time. "
  6784. "LOG-FINDTIME,y,m,d,h,m,s\n",
  6785. " "
  6786. "all parameters optional"
  6787. "args": 6},
  6788. # UBX-LOG-INFO
  6789. "LOG-INFO": {"command": send_poll, "opt": [0x21, 0x08],
  6790. "help": "poll UBX-LOG-INFO",
  6791. "minVer": 14},
  6792. # UBX-LOG-RETRIEVE
  6793. "LOG-RETRIEVE": {"command": send_log_retrieve,
  6794. "help": "send UBX-LOG-RETRIEVE. "
  6795. "LOG-RETRIEVE[,start,[count]]",
  6796. "minVer": 14,
  6797. "args": 2},
  6798. # UBX-LOG-RETRIEVEBATCH
  6799. # Assume 23 is close enough to the proper 23.01
  6800. "LOG-RETRIEVEBATCH": {"command": send_poll,
  6801. "opt": [0x21, 0x10, 0, 1, 0, 0],
  6802. "help": "send UBX-LOG-RETRIEVEBATCH",
  6803. "minVer": 23},
  6804. # UBX-LOG-STRING
  6805. "LOG-STRING": {"command": send_log_string,
  6806. "help": "send UBX-LOG-STRING. LOG-STRING[,string]",
  6807. "minVer": 14,
  6808. "args": 1},
  6809. # UBX-MGA-DBD
  6810. "MGA-DBD": {"command": send_poll, "opt": [0x13, 0x80],
  6811. "help": "poll UBX-MGA-DBD Poll the Navigation Database"},
  6812. # UBX-MON-BATCH
  6813. # Assume 23 is close enough to the proper 23.01
  6814. "MON-BATCH": {"command": send_poll, "opt": [0x0a, 0x32],
  6815. "help": "poll UBX-MON-BATCH Data batching "
  6816. "buffer status",
  6817. "maxVer": 23.99,
  6818. "minVer": 23},
  6819. # UBX-MON-COMMS
  6820. "MON-COMMS": {"command": send_poll, "opt": [0x0a, 0x36],
  6821. "help": "poll UBX-MON-COMMS Comm port information"},
  6822. # UBX-MON-GNSS
  6823. "MON-GNSS": {"command": send_poll, "opt": [0x0a, 0x28],
  6824. "help": "poll UBX-MON-GNSS major GNSS selection"},
  6825. # UBX-MON-HW
  6826. "MON-HW": {"command": send_poll, "opt": [0x0a, 0x09],
  6827. "help": "poll UBX-MON-HW Hardware Status"},
  6828. # UBX-MON-HW2
  6829. "MON-HW2": {"command": send_poll, "opt": [0x0a, 0x0b],
  6830. "help": "poll UBX-MON-HW2 Extended Hardware Status"},
  6831. # UBX-MON-HW3
  6832. "MON-HW3": {"command": send_poll, "opt": [0x0a, 0x37],
  6833. "help": "poll UBX-MON-HW3 HW I/O pin information"},
  6834. # UBX-MON-IO
  6835. "MON-IO": {"command": send_poll, "opt": [0x0a, 0x02],
  6836. "help": "poll UBX-MON-IO I/O Subsystem Status"},
  6837. # UBX-MON-MSGPP
  6838. "MON-MSGPP": {"command": send_poll, "opt": [0x0a, 0x06],
  6839. "help": "poll UBX-MON-MSGPP Message Parese and "
  6840. "Process Status"},
  6841. # UBX-MON-PATCH
  6842. "MON-PATCH": {"command": send_poll, "opt": [0x0a, 0x27],
  6843. "help": "poll UBX-MON-PATCH Info on Installed Patches"},
  6844. # UBX-MON-RF
  6845. "MON-RF": {"command": send_poll, "opt": [0x0a, 0x38],
  6846. "help": "poll UBX-MON-RF RF Information"},
  6847. # UBX-MON-RXBUF
  6848. "MON-RXBUF": {"command": send_poll, "opt": [0x0a, 0x07],
  6849. "help": "poll UBX-MON-RXBUF Receiver Buffer Status"},
  6850. # UBX-MON-SMGR
  6851. "MON-SMGR": {"command": send_poll, "opt": [0x0a, 0x2e],
  6852. "help": "poll UBX-MON-SMGR Synchronization manager "
  6853. "configuration"},
  6854. # UBX-MON-TXBUF
  6855. "MON-TXBUF": {"command": send_poll, "opt": [0x0a, 0x08],
  6856. "help": "poll UBX-MON-TXBUF Transmitter Buffer Status"},
  6857. # UBX-MON-VER
  6858. "MON-VER": {"command": send_poll, "opt": [0x0a, 0x04],
  6859. "help": "poll UBX-MON-VER GPS version"},
  6860. # UBX-NAV-AOPSTATUS
  6861. "NAV-AOPSTATUS": {"command": send_poll, "opt": [0x01, 0x60],
  6862. "help": "poll UBX-NAV-AOPSTATUS AssistNow "
  6863. "Autonomous Status"},
  6864. # UBX-NAV-ATT
  6865. "NAV-ATT": {"command": send_poll, "opt": [0x1, 0x5],
  6866. "help": "poll UBX-NAV-ATT Attitude Solution"},
  6867. # UBX-NAV-CLOCK
  6868. "NAV-CLOCK": {"command": send_poll, "opt": [0x01, 0x22],
  6869. "help": "poll UBX-NAV-CLOCK Clock Solution"},
  6870. # UBX-NAV-DGPS
  6871. "NAV-DGPS": {"command": send_poll, "opt": [0x01, 0x31],
  6872. "help": "poll UBX-NAV-DGPS DGPS Data Used for NAV"},
  6873. # UBX-NAV-DOP
  6874. "NAV-DOP": {"command": send_poll, "opt": [0x01, 0x04],
  6875. "help": "poll UBX-NAV-DOP Dilution of Precision"},
  6876. # UBX-NAV-GEOFENCE
  6877. "NAV-GEOFENCE": {"command": send_poll, "opt": [0x01, 0x39],
  6878. "help": "poll UBX-NAV-GEOFENCE Geofence status"},
  6879. # UBX-NAV-HPPOSECEF
  6880. "NAV-HPPOSECEF": {"command": send_poll, "opt": [0x01, 0x13],
  6881. "help": "poll UBX-NAV-HPPOSECEF ECEF position"},
  6882. # UBX-NAV-HPPOSLLH
  6883. "NAV-HPPOSLLH": {"command": send_poll, "opt": [0x01, 0x14],
  6884. "help": "poll UBX-NAV-HPPOSECEF LLH position"},
  6885. # UBX-NAV-ODO
  6886. "NAV-ODO": {"command": send_poll, "opt": [0x01, 0x09],
  6887. "help": "poll UBX-NAV-ODO Odometer Solution"},
  6888. # UBX-NAV-ORB
  6889. "NAV-ORB": {"command": send_poll, "opt": [0x01, 0x34],
  6890. "help": "poll UBX-NAV-ORB GNSS Orbit Database Info"},
  6891. # UBX-NAV-POSECEF
  6892. "NAV-POSECEF": {"command": send_poll, "opt": [0x01, 0x01],
  6893. "help": "poll UBX-NAV-POSECEF ECEF position"},
  6894. # UBX-NAV-POSLLH
  6895. "NAV-POSLLH": {"command": send_poll, "opt": [0x01, 0x02],
  6896. "help": "poll UBX-NAV-POSLLH LLH position"},
  6897. # UBX-NAV-PVT
  6898. "NAV-PVT": {"command": send_poll, "opt": [0x01, 0x07],
  6899. "help": "poll UBX-NAV-PVT Navigation Position Velocity "
  6900. "Time Solution"},
  6901. # UBX-NAV-RELPOSNED
  6902. # HP only, 20+, otherwise not ACKed or NACKed
  6903. "NAV-RELPOSNED": {"command": send_poll, "opt": [0x01, 0x3c],
  6904. "help": "poll UBX-NAV-RELPOSNED Relative "
  6905. "Positioning Info in NED frame"},
  6906. # UBX-NAV-RESETODO
  6907. "NAV-RESETODO": {"command": send_poll, "opt": [0x01, 0x10],
  6908. "help": "UBX-NAV-RESETODO Reset odometer"},
  6909. # UBX-NAV-SAT
  6910. "NAV-SAT": {"command": send_poll, "opt": [0x01, 0x35],
  6911. "help": "poll UBX-NAV-SAT Satellite Information"},
  6912. # UBX-NAV-SBAS
  6913. "NAV-SBAS": {"command": send_poll, "opt": [0x01, 0x32],
  6914. "help": "poll UBX-NAV-SBAS SBAS Status Data"},
  6915. # UBX-NAV-SIG
  6916. "NAV-SIG": {"command": send_poll, "opt": [0x01, 0x43],
  6917. "help": "poll UBX-NAV-SIG Signal Information"},
  6918. # UBX-NAV-SLAS
  6919. "NAV-SLAS": {"command": send_poll, "opt": [0x01, 0x42],
  6920. "help": "poll UBX-NAV-SLAS QZSS L1S SLAS Status Data"},
  6921. # UBX-NAV-SOL
  6922. "NAV-SOL": {"command": send_poll, "opt": [0x01, 0x06],
  6923. "help": "poll UBX-NAV-SOL Navigation Solution "
  6924. "Information"},
  6925. # UBX-NAV-STATUS
  6926. "NAV-STATUS": {"command": send_poll, "opt": [0x01, 0x03],
  6927. "help": "poll UBX-NAV-STATUS Receiver Nav Status"},
  6928. # UBX-NAV-SVIN
  6929. "NAV-SVIN": {"command": send_poll, "opt": [0x01, 0x3b],
  6930. "help": "poll UBX-NAV-SVIN Survey-in data",
  6931. "minver": 20},
  6932. # UBX-NAV-SVINFO
  6933. "NAV-SVINFO": {"command": send_poll, "opt": [0x01, 0x30],
  6934. "help": "poll UBX-NAV-SVINFO Satellite Information"},
  6935. # UBX-NAV-TIMEBDS
  6936. "NAV-TIMEBDS": {"command": send_poll, "opt": [0x01, 0x24],
  6937. "help": "poll UBX-NAV-TIMEBDS BDS Time Solution"},
  6938. # UBX-NAV-TIMEGAL
  6939. "NAV-TIMEGAL": {"command": send_poll, "opt": [0x01, 0x25],
  6940. "help": "poll UBX-NAV-TIMEGAL Galileo Time Solution"},
  6941. # UBX-NAV-TIMEGLO
  6942. "NAV-TIMEGLO": {"command": send_poll, "opt": [0x01, 0x23],
  6943. "help": "poll UBX-NAV-TIMEGLO GLO Time Solution"},
  6944. # UBX-NAV-TIMEGPS
  6945. "NAV-TIMEGPS": {"command": send_poll, "opt": [0x01, 0x20],
  6946. "help": "poll UBX-NAV-TIMEGPS GPS Time Solution"},
  6947. # UBX-NAV-TIMELS
  6948. "NAV-TIMELS": {"command": send_poll, "opt": [0x01, 0x26],
  6949. "help": "poll UBX-NAV-TIMELS Leap Second Info"},
  6950. # UBX-NAV-TIMEUTC
  6951. "NAV-TIMEUTC": {"command": send_poll, "opt": [0x01, 0x21],
  6952. "help": "poll UBX-NAV-TIMEUTC UTC Time Solution"},
  6953. # UBX-NAV-VELECEF
  6954. "NAV-VELECEF": {"command": send_poll, "opt": [0x01, 0x11],
  6955. "help": "poll UBX-NAV-VELECEF ECEF velocity"},
  6956. # UBX-NAV-VELNED
  6957. "NAV-VELNED": {"command": send_poll, "opt": [0x01, 0x12],
  6958. "help": "poll UBX-NAV-VELNED NED velocity"},
  6959. # UBX-RXM-IMES
  6960. "RXM-IMES": {"command": send_poll, "opt": [0x02, 0x61],
  6961. "help": "poll UBX-RXM-IMES Indoor Messaging System "
  6962. "Information"},
  6963. # UBX-RXM-MEASX
  6964. "RXM-MEASX": {"command": send_poll, "opt": [0x02, 0x14],
  6965. "help": "poll UBX-RXM-MEASX Satellite Measurements "
  6966. " for RRLP"},
  6967. # UBX-RXM-RAWX
  6968. "RXM-RAWX": {"command": send_poll, "opt": [0x02, 0x15],
  6969. "help": "poll UBX-RXM-RAWX raw measurement data"},
  6970. # UBX-CFG-SBAS
  6971. "SEC-UNIQID": {"command": send_poll, "opt": [0x27, 0x03],
  6972. "help": "poll UBX-SEC-UNIQID Unique chip ID"},
  6973. # UBX-TIM-SVIN
  6974. "TIM-SVIN": {"command": send_poll, "opt": [0x0d, 0x04],
  6975. "help": "poll UBX-TIM-SVIN survey in data"},
  6976. # UBX-TIM-TM2
  6977. "TIM-TM2": {"command": send_poll, "opt": [0x0d, 0x03],
  6978. "help": "poll UBX-TIM-TM2 time mark data"},
  6979. # UBX-TIM-TP
  6980. "TIM-TP": {"command": send_poll, "opt": [0x0d, 0x01],
  6981. "help": "poll UBX-TIM-TP time pulse timedata"},
  6982. # UBX-TIM-VRFY
  6983. "TIM-VRFY": {"command": send_poll, "opt": [0x0d, 0x06],
  6984. "help": "poll UBX-TIM-VRFY Sourced Time Verification"},
  6985. # UBX-UPD-SOS
  6986. "UPD-SOS": {"command": send_poll, "opt": [0x09, 0x14],
  6987. "help": "poll UBX-UPD-SOS Backup File restore Status"},
  6988. # UBX-UPD-SOS
  6989. "UPD-SOS0": {"command": send_poll, "opt": [0x09, 0x14, 0, 0, 0, 0],
  6990. "help": "UBX-UPD-SOS Create Backup File in Flash"},
  6991. # UBX-UPD-SOS
  6992. "UPD-SOS1": {"command": send_poll, "opt": [0x09, 0x14, 1, 0, 0, 0],
  6993. "help": "UBX-UPD-SOS Create Clear File in Flash"},
  6994. }
  6995. # end class ubx
  6996. class gps_io(object):
  6997. """All the GPS I/O in one place"
  6998. Three types of GPS I/O
  6999. 1. read only from a file
  7000. 2. read/write through a device
  7001. 3. read only from a gpsd instance
  7002. """
  7003. out = b''
  7004. ser = None
  7005. input_is_device = False
  7006. def __init__(self):
  7007. """Initialize class"""
  7008. Serial = serial
  7009. Serial_v3 = Serial and Serial.VERSION.split('.')[0] >= '3'
  7010. # buffer to hold read data
  7011. self.out = b''
  7012. # open the input: device, file, or gpsd
  7013. if opts['input_file_name'] is not None:
  7014. # check if input file is a file or device
  7015. try:
  7016. mode = os.stat(opts['input_file_name']).st_mode
  7017. except OSError:
  7018. sys.stderr.write('%s: failed to open input file %s\n' %
  7019. (PROG_NAME, opts['input_file_name']))
  7020. sys.exit(1)
  7021. if stat.S_ISCHR(mode):
  7022. # character device, need not be read only
  7023. self.input_is_device = True
  7024. if ((opts['disable'] or opts['enable'] or opts['poll'] or
  7025. opts['oaf_name'])):
  7026. # check that we can write
  7027. if opts['read_only']:
  7028. sys.stderr.write('%s: read-only mode, '
  7029. 'can not send commands\n' % PROG_NAME)
  7030. sys.exit(1)
  7031. if self.input_is_device is False:
  7032. sys.stderr.write('%s: input is plain file, '
  7033. 'can not send commands\n' % PROG_NAME)
  7034. sys.exit(1)
  7035. if opts['target']['server'] is not None:
  7036. # try to open local/remote gpsd daemon
  7037. try:
  7038. self.ser = gps.gpscommon(host=opts['target']['server'],
  7039. port=opts['target']['port'],
  7040. verbose=0)
  7041. # alias self.ser.write() to self.write_gpsd()
  7042. self.ser.write = self.write_gpsd
  7043. # ask for raw, not rare, data
  7044. data_out = b'?WATCH={'
  7045. if opts['target']['device'] is not None:
  7046. # add in the requested device
  7047. data_out += (b'"device":"' +
  7048. gps.polybytes(opts['target']['device']) +
  7049. b'",')
  7050. data_out += b'"enable":true,"raw":2}\r\n'
  7051. if VERB_RAW <= opts['verbosity']:
  7052. print("sent: ", data_out)
  7053. self.ser.send(data_out)
  7054. except socket.error as err:
  7055. sys.stderr.write('%s: failed to connect to gpsd %s\n' %
  7056. (PROG_NAME, err))
  7057. sys.exit(1)
  7058. elif self.input_is_device:
  7059. # configure the serial connections (the parameters refer to
  7060. # the device you are connecting to)
  7061. # pyserial Ver 3.0+ changes writeTimeout to write_timeout
  7062. # Using the wrong one causes an error
  7063. write_timeout_arg = ('write_timeout'
  7064. if Serial_v3 else 'writeTimeout')
  7065. try:
  7066. self.ser = Serial.Serial(
  7067. baudrate=opts['input_speed'],
  7068. # 8N1 is UBX default
  7069. bytesize=Serial.EIGHTBITS,
  7070. parity=Serial.PARITY_NONE,
  7071. port=opts['input_file_name'],
  7072. stopbits=Serial.STOPBITS_ONE,
  7073. # read timeout
  7074. timeout=0.05,
  7075. **{write_timeout_arg: 0.5}
  7076. )
  7077. except AttributeError:
  7078. sys.stderr.write('%s: failed to import pyserial\n' % PROG_NAME)
  7079. sys.exit(2)
  7080. except Serial.serialutil.SerialException:
  7081. # this exception happens on bad serial port device name
  7082. sys.stderr.write('%s: failed to open serial port "%s"\n'
  7083. '%s: Your computer has the serial ports:\n' %
  7084. (PROG_NAME, opts['input_file_name'],
  7085. PROG_NAME))
  7086. # print out list of supported ports
  7087. import serial.tools.list_ports as List_Ports
  7088. ports = List_Ports.comports()
  7089. for port in ports:
  7090. sys.stderr.write(" %s: %s\n" %
  7091. (port.device, port.description))
  7092. sys.exit(1)
  7093. # flush input buffer, discarding all its contents
  7094. # pyserial 3.0+ deprecates flushInput() in favor of
  7095. # reset_input_buffer(), but flushInput() is still present.
  7096. self.ser.flushInput()
  7097. else:
  7098. # Read from a plain file of UBX messages
  7099. try:
  7100. self.ser = open(opts['input_file_name'], 'rb')
  7101. except IOError:
  7102. sys.stderr.write('%s: failed to open input %s\n' %
  7103. (PROG_NAME, opts['input_file_name']))
  7104. sys.exit(1)
  7105. def read(self, read_opts):
  7106. """Read from device, until timeout or expected message"""
  7107. # are we expecting a certain message?
  7108. if gps_model.expect_statement_identifier:
  7109. # assume failure, until we see expected message
  7110. ret_code = 1
  7111. else:
  7112. # not expecting anything, so OK if we did not see it.
  7113. ret_code = 0
  7114. try:
  7115. if read_opts['target']['server'] is not None:
  7116. # gpsd input
  7117. start = gps.monotonic()
  7118. while read_opts['input_wait'] > (gps.monotonic() - start):
  7119. # First priority is to be sure the input buffer is read.
  7120. # This is to prevent input buffer overuns
  7121. if 0 < self.ser.waiting():
  7122. # We have serial input waiting, get it
  7123. # No timeout possible
  7124. # RTCM3 JSON can be over 4.4k long, so go big
  7125. new_out = self.ser.sock.recv(8192)
  7126. if raw is not None:
  7127. # save to raw file
  7128. raw.write(new_out)
  7129. self.out += new_out
  7130. consumed = gps_model.decode_msg(self.out)
  7131. self.out = self.out[consumed:]
  7132. if ((gps_model.expect_statement_identifier and
  7133. (gps_model.expect_statement_identifier ==
  7134. gps_model.last_statement_identifier))):
  7135. # Got what we were waiting for. Done?
  7136. ret_code = 0
  7137. if not read_opts['input_forced_wait']:
  7138. # Done
  7139. break
  7140. elif self.input_is_device:
  7141. # input is a serial device
  7142. start = gps.monotonic()
  7143. while read_opts['input_wait'] > (gps.monotonic() - start):
  7144. # First priority is to be sure the input buffer is read.
  7145. # This is to prevent input buffer overuns
  7146. # pyserial 3.0+ deprecates inWaiting() in favor of
  7147. # in_waiting, but inWaiting() is still present.
  7148. if 0 < self.ser.inWaiting():
  7149. # We have serial input waiting, get it
  7150. # 1024 is comfortably large, almost always the
  7151. # Read timeout is what causes ser.read() to return
  7152. new_out = self.ser.read(1024)
  7153. if raw is not None:
  7154. # save to raw file
  7155. raw.write(new_out)
  7156. self.out += new_out
  7157. consumed = gps_model.decode_msg(self.out)
  7158. self.out = self.out[consumed:]
  7159. if ((gps_model.expect_statement_identifier and
  7160. (gps_model.expect_statement_identifier ==
  7161. gps_model.last_statement_identifier))):
  7162. # Got what we were waiting for. Done?
  7163. ret_code = 0
  7164. if not read_opts['input_forced_wait']:
  7165. # Done
  7166. break
  7167. else:
  7168. # ordinary file, so all read at once
  7169. self.out += self.ser.read()
  7170. if raw is not None:
  7171. # save to raw file
  7172. raw.write(self.out)
  7173. while True:
  7174. consumed = gps_model.decode_msg(self.out)
  7175. self.out = self.out[consumed:]
  7176. if 0 >= consumed:
  7177. break
  7178. except IOError:
  7179. # This happens on a good device name, but gpsd already running.
  7180. # or if USB device unplugged
  7181. sys.stderr.write('%s: failed to read %s\n'
  7182. '%s: Is gpsd already holding the port?\n'
  7183. % (PROG_NAME, read_opts['input_file_name'],
  7184. PROG_NAME))
  7185. return 1
  7186. if 0 < ret_code:
  7187. # did not see the message we were expecting to see
  7188. sys.stderr.write('%s: waited %0.2f seconds for, '
  7189. 'but did not get: %%%s%%\n'
  7190. % (PROG_NAME, read_opts['input_wait'],
  7191. gps_model.expect_statement_identifier))
  7192. return ret_code
  7193. def write_gpsd(self, data):
  7194. """write data to gpsd daemon"""
  7195. # HEXDATA_MAX = 512, from gps.h, The max hex digits can write.
  7196. # Input data is binary, converting to hex doubles its size.
  7197. # Limit binary data to length 255, so hex data length less than 510.
  7198. if 255 < len(data):
  7199. sys.stderr.write('%s: trying to send %d bytes, max is 255\n'
  7200. % (PROG_NAME, len(data)))
  7201. return 1
  7202. if opts['target']['device'] is not None:
  7203. # add in the requested device
  7204. data_out = (b'?DEVICE={"path":"' +
  7205. gps.polybytes(opts['target']['device']) + b'",')
  7206. else:
  7207. data_out = b'?DEVICE={'
  7208. # Convert binary data to hex and build the message.
  7209. data_out += b'"hexdata":"' + binascii.hexlify(data) + b'"}\r\n'
  7210. if VERB_RAW <= opts['verbosity']:
  7211. print("sent: ", data_out)
  7212. self.ser.send(data_out)
  7213. return 0
  7214. # instantiate the GPS class
  7215. gps_model = ubx()
  7216. def usage():
  7217. """Output usage information, and exit"""
  7218. print('usage: %s [OPTION] ... [[server[:port[:device]]]]\n\n'
  7219. ' Options:\n'
  7220. ' -? print help, increase -v for extra help\n'
  7221. ' -c C send raw command C (cls,id...) to GPS\n'
  7222. ' -d D disable D\n'
  7223. ' -e E enable E\n'
  7224. ' -f F open F as file/device\n'
  7225. ' default: %s\n'
  7226. ' -g I,l,p get config item I, optional layer l, '
  7227. 'position p\n'
  7228. ' -h print help, increase -v for extra help\n'
  7229. ' -i P port ID # (interface) for -S\n'
  7230. ' -P P Protocol version for sending commands\n'
  7231. ' default: %s\n'
  7232. ' -p P send a preset query P to GPS\n'
  7233. ' -R R save raw data from GPS in file R\n'
  7234. ' default: %s\n'
  7235. ' -r open file/device read only\n'
  7236. ' -S S set GPS speed to S\n'
  7237. ' -s S set port speed to S\n'
  7238. ' default: %s bps\n'
  7239. ' -V print version\n'
  7240. ' -v V Set verbosity level to V, 0 to 4\n'
  7241. ' default: %d\n'
  7242. ' -w W wait time W before exiting\n'
  7243. ' default: %s seconds\n'
  7244. ' -x I delete config item I from BBR and FLASH '
  7245. 'layers\n'
  7246. ' -z I,v,l set config item I to v, in optional layer l\n'
  7247. '\n' %
  7248. (PROG_NAME, opts['input_file_name'],
  7249. opts['protver'], opts['raw_file'],
  7250. opts['input_speed'], opts['input_wait'],
  7251. opts['verbosity'])
  7252. )
  7253. if VERB_DECODE <= opts['verbosity']:
  7254. print('D and E can be one of:')
  7255. for item in sorted(gps_model.able_commands.keys()):
  7256. print(" %-13s %s" %
  7257. (item, gps_model.able_commands[item]["help"]))
  7258. print('\nP can be one of:')
  7259. for item in sorted(gps_model.commands.keys()):
  7260. print(" %-13s %s" % (item, gps_model.commands[item]["help"]))
  7261. print('\n')
  7262. if VERB_DECODE < opts['verbosity']:
  7263. print('\nConfiguration items for -g, -x and -z can be one of:')
  7264. for item in sorted(gps_model.cfgs):
  7265. print(" %s\n"
  7266. " %s" % (item[0], item[5]))
  7267. print('\n')
  7268. print('Options can be placed in the UBXOPTS environment variable.\n'
  7269. 'UBXOPTS is processed before the CLI options.')
  7270. sys.exit(0)
  7271. if 'UBXOPTS' in os.environ:
  7272. # grab the UBXOPTS environment variable for options
  7273. opts['timestamp'] = 0
  7274. opts['progopts'] = os.environ['UBXOPTS']
  7275. options = opts['progopts'].split(' ') + sys.argv[1:]
  7276. else:
  7277. options = sys.argv[1:]
  7278. try:
  7279. (options, arguments) = getopt.getopt(options,
  7280. "?c:d:e:f:g:hi:m:rP:p:"
  7281. "s:w:v:R:S:tVx:z:")
  7282. except getopt.GetoptError as err:
  7283. sys.stderr.write("%s: %s\n"
  7284. "Try '%s -h' for more information.\n" %
  7285. (PROG_NAME, str(err), PROG_NAME))
  7286. sys.exit(2)
  7287. for (opt, val) in options:
  7288. if opt == '-c':
  7289. opts['command'] = val
  7290. elif opt == '-d':
  7291. # don't force the user to upper case
  7292. opts['disable'].append(val.upper())
  7293. elif opt == '-e':
  7294. opts['enable'].append(val.upper())
  7295. elif opt == '-f':
  7296. opts['input_file_name'] = val
  7297. elif opt == '-g':
  7298. opts['get_item'].append(val.upper())
  7299. elif opt in ('-h', '-?'):
  7300. opts['help'] = True
  7301. elif opt == '-i':
  7302. valnum = gps_model.port_id_map.get(val.upper())
  7303. opts['port'] = valnum if valnum is not None else int(val)
  7304. elif opt == '-P':
  7305. # to handle version like 23.01
  7306. opts['protver'] = float(val)
  7307. if 10 > opts['protver']:
  7308. opts['protver'] = 10.0
  7309. # Dunno the max protver, NEO-M9N is 32.00
  7310. elif opt == '-p':
  7311. # don't force the user to upper case
  7312. # allow multiple -p
  7313. opts['poll'].append(val.upper())
  7314. elif opt in '-R':
  7315. # raw log file
  7316. opts['raw_file'] = val
  7317. elif opt == '-r':
  7318. opts['read_only'] = True
  7319. elif opt in '-S':
  7320. opts['set_speed'] = int(val)
  7321. if opts['set_speed'] not in gps_model.speeds:
  7322. sys.stderr.write('%s: -S invalid speed %s\n' %
  7323. (PROG_NAME, opts['set_speed']))
  7324. sys.exit(1)
  7325. elif opt == '-s':
  7326. try:
  7327. opts['input_speed'] = int(val)
  7328. except ValueError:
  7329. sys.stderr.write('%s: -s invalid speed %s\n' %
  7330. (PROG_NAME, val))
  7331. sys.exit(1)
  7332. if opts['input_speed'] not in gps_model.speeds:
  7333. sys.stderr.write('%s: -s invalid speed %s\n' %
  7334. (PROG_NAME, opts['input_speed']))
  7335. sys.exit(1)
  7336. elif opt == '-t':
  7337. opts['timestamp'] += 1
  7338. elif opt == '-V':
  7339. # version
  7340. sys.stderr.write('%s: Version %s\n' % (PROG_NAME, gps_version))
  7341. sys.exit(0)
  7342. elif opt in '-v':
  7343. opts['verbosity'] = int(val)
  7344. elif opt == '-w':
  7345. try:
  7346. opts['input_wait'] = int(val)
  7347. except ValueError:
  7348. sys.stderr.write('%s: -w invalid time %s\n' % (PROG_NAME, val))
  7349. sys.exit(1)
  7350. elif opt == '-x':
  7351. opts['del_item'].append(val)
  7352. elif opt == '-z':
  7353. opts['set_item'].append(val)
  7354. if opts['help']:
  7355. usage()
  7356. if opts['input_file_name'] is None:
  7357. # no input file given
  7358. # default to local gpsd
  7359. opts['target']['server'] = "localhost"
  7360. opts['target']['port'] = gps.GPSD_PORT
  7361. opts['target']['device'] = None
  7362. if arguments:
  7363. # TODO: move to module gps as a function
  7364. # server[:port[:device]]
  7365. # or maybe ::device
  7366. # or maybe \[ipv6\][:port[:device]]
  7367. if '[' == arguments[0][0]:
  7368. # hex IPv6 address
  7369. match = re.match(r'''\[([:a-fA-F0-9]+)\](.*)''', arguments[0])
  7370. opts['target']['server'] = match.group(1)
  7371. parts = match.group(2).split(':')
  7372. else:
  7373. # maybe IPv4 address, maybe hostname
  7374. parts = arguments[0].split(':')
  7375. if parts[0]:
  7376. opts['target']['server'] = parts[0]
  7377. if 1 < len(parts):
  7378. if parts[1]:
  7379. opts['target']['port'] = parts[1]
  7380. if 2 < len(parts) and parts[2]:
  7381. opts['target']['device'] = parts[2]
  7382. elif arguments:
  7383. sys.stderr.write('%s: Both input file and server specified\n' % PROG_NAME)
  7384. sys.exit(1)
  7385. if VERB_PROG <= opts['verbosity']:
  7386. # dump versions and all options
  7387. print('%s: Version %s\n' % (PROG_NAME, gps_version))
  7388. print('Options:')
  7389. for option in sorted(opts):
  7390. print(" %s: %s" % (option, opts[option]))
  7391. # done parsing arguments from environment and CLI
  7392. try:
  7393. # raw log file requested?
  7394. raw = None
  7395. if opts['raw_file']:
  7396. try:
  7397. raw = open(opts['raw_file'], 'w')
  7398. except IOError:
  7399. sys.stderr.write('%s: failed to open raw file %s\n' %
  7400. (PROG_NAME, opts['raw_file']))
  7401. sys.exit(1)
  7402. # create the I/O instance
  7403. io_handle = gps_io()
  7404. sys.stdout.flush()
  7405. if opts['disable']:
  7406. for disable in opts['disable']:
  7407. if VERB_QUIET < opts['verbosity']:
  7408. print('%s: disable %s\n' % (PROG_NAME, disable))
  7409. args = disable.split(',')
  7410. disable = args[0]
  7411. if disable in gps_model.able_commands:
  7412. command = gps_model.able_commands[disable]
  7413. command["command"](gps, 0, disable[1:])
  7414. else:
  7415. sys.stderr.write('%s: disable %s not found\n' %
  7416. (PROG_NAME, disable))
  7417. sys.exit(1)
  7418. if opts['enable']:
  7419. for enable in opts['enable']:
  7420. if VERB_QUIET < opts['verbosity']:
  7421. print('%s: enable %s\n' % (PROG_NAME, enable))
  7422. args = enable.split(',')
  7423. enable = args[0]
  7424. if enable in gps_model.able_commands:
  7425. command = gps_model.able_commands[enable]
  7426. command["command"](gps, 1, args[1:])
  7427. else:
  7428. sys.stderr.write('%s: enable %s not found\n' %
  7429. (PROG_NAME, enable))
  7430. sys.exit(1)
  7431. if opts['poll']:
  7432. for poll in opts['poll']:
  7433. if VERB_QUIET < opts['verbosity']:
  7434. print('%s: poll %s\n' % (PROG_NAME, poll))
  7435. args = poll.split(',')
  7436. poll = args[0]
  7437. if poll in gps_model.commands:
  7438. command = gps_model.commands[poll]
  7439. if (('minVer' in command and
  7440. opts['protver'] < command['minVer'])):
  7441. print('%s: WARNING poll %s requires protVer >= %s '
  7442. 'you have %s\n' %
  7443. (PROG_NAME, poll, command['minVer'],
  7444. opts['protver']))
  7445. if (('maxVer' in command and
  7446. opts['protver'] > command['maxVer'])):
  7447. print('%s: WARNING poll %s requires protVer <= %s '
  7448. 'you have %s\n' %
  7449. (PROG_NAME, poll, command['maxVer'],
  7450. opts['protver']))
  7451. if 'opt' in command:
  7452. command["command"](gps, command["opt"])
  7453. elif 'args' in command:
  7454. # pass on args, except arg[0]
  7455. command["command"](gps, args[1:])
  7456. else:
  7457. command["command"](gps)
  7458. else:
  7459. sys.stderr.write('%s: poll %s not found\n' %
  7460. (PROG_NAME, poll))
  7461. sys.exit(1)
  7462. elif opts['set_speed'] is not None:
  7463. gps_model.send_set_speed(opts['set_speed'])
  7464. elif opts['command'] is not None:
  7465. cmd_list = opts['command'].split(',')
  7466. try:
  7467. cmd_data = [int(v, 16) for v in cmd_list]
  7468. except ValueError:
  7469. badarg = True
  7470. else:
  7471. data_or = reduce(operator.or_, cmd_data)
  7472. badarg = data_or != data_or & 0xFF
  7473. if badarg or len(cmd_list) < 2:
  7474. sys.stderr.write('%s: Argument format (hex bytes) is'
  7475. ' class,id[,payload...]\n' % PROG_NAME)
  7476. sys.exit(1)
  7477. payload = bytearray(cmd_data[2:])
  7478. if VERB_QUIET < opts['verbosity']:
  7479. print('%s: command %s\n' % (PROG_NAME, opts['command']))
  7480. gps_model.gps_send(cmd_data[0], cmd_data[1], payload)
  7481. elif opts['del_item']:
  7482. keys = []
  7483. for name in opts['del_item']:
  7484. item = gps_model.cfg_by_name(name)
  7485. if item:
  7486. keys.append(item[1])
  7487. else:
  7488. sys.stderr.write('%s: ERROR: item %s unknown\n' %
  7489. (PROG_NAME, opts['del_item']))
  7490. sys.exit(1)
  7491. gps_model.send_cfg_valdel(keys)
  7492. elif opts['get_item']:
  7493. keys = []
  7494. layer = None
  7495. position = 0
  7496. end = None
  7497. for item in opts['get_item']:
  7498. parts = item.split(',')
  7499. item = gps_model.cfg_by_name(parts[0])
  7500. if item:
  7501. keys.append(item[1])
  7502. else:
  7503. sys.stderr.write('%s: ERROR: item %s unknown\n' %
  7504. (PROG_NAME, parts[0]))
  7505. sys.exit(1)
  7506. try:
  7507. if 1 < len(parts):
  7508. layer = int(parts[1])
  7509. if 2 < len(parts):
  7510. position = int(parts[2])
  7511. if 3 < len(parts):
  7512. end = int(parts[3])
  7513. except ValueError:
  7514. sys.stderr.write('%s: ERROR: -g %s, non numeric parameter\n' %
  7515. (PROG_NAME, parts[0]))
  7516. sys.exit(1)
  7517. print("layer %s position %d end %s " % (layer, position, end))
  7518. if end:
  7519. for p in range(position, end, 64):
  7520. gps_model.send_cfg_valget(keys, layer, p)
  7521. else:
  7522. gps_model.send_cfg_valget(keys, layer, position)
  7523. elif opts['set_item']:
  7524. nvs = []
  7525. for nv in opts['set_item']:
  7526. parts = nv.split(',')
  7527. if 1 >= len(parts):
  7528. sys.stderr.write('%s: ERROR: item %s missing value to set\n' %
  7529. (PROG_NAME, parts[0]))
  7530. sys.exit(1)
  7531. item = gps_model.cfg_by_name(parts[0])
  7532. if item:
  7533. nvs.append(nv)
  7534. else:
  7535. sys.stderr.write('%s: ERROR: item %s unknown\n' %
  7536. (PROG_NAME, parts[0]))
  7537. sys.exit(1)
  7538. gps_model.send_cfg_valset(nvs)
  7539. exit_code = io_handle.read(opts)
  7540. if ((VERB_RAW <= opts['verbosity']) and io_handle.out):
  7541. # dump raw left overs
  7542. print("Left over data:")
  7543. print(io_handle.out)
  7544. sys.stdout.flush()
  7545. io_handle.ser.close()
  7546. except KeyboardInterrupt:
  7547. print('')
  7548. exit_code = 1
  7549. sys.exit(exit_code)
  7550. # vim: set expandtab shiftwidth=4