twisted.positioning.nmeaView Source (View In Hierarchy)
Implements interfaces: twisted.positioning.ipositioning.INMEAReceiver
An adapter from NMEAProtocol receivers to positioning receivers.
|Instance Variable||yearThreshold||The earliest possible year that data will be interpreted as. For example,
if this value is
|Method||__init__||Initializes a new NMEA adapter.|
|Method||clear||Resets this adapter.|
|Method||sentenceReceived||Called when a sentence is received.|
|Class Variable||_STATEFUL_UPDATE||Information on how to update partial information in the sentence data or
internal adapter state. For more information, see
|Class Variable||_ACCEPTABLE_UNITS||A set of NMEA notations of units that are already acceptable (metric), and
therefore don't need to be converted. (type:
|Class Variable||_UNIT_CONVERTERS||Mapping of NMEA notations of units that are not acceptable (not metric) to
converters that take a quantity in that unit and produce a metric quantity. (type:
|Class Variable||_SPECIFIC_SENTENCE_FIXES||A mapping of sentece types to specific fixes that are required to extract
useful information from data from those sentences. (type:
|Class Variable||_FIXERS||Set of unary callables that take an NMEAAdapter instance and extract useful
data from the sentence data, usually modifying the adapter's sentence data
|Instance Variable||_state||The current internal state of the receiver. (type:
|Instance Variable||_sentenceData||The data present in the sentence currently being processed. Starts empty,
is filled as the sentence is parsed. (type:
|Instance Variable||_receiver||The positioning receiver that will receive parsed data. (type:
|Method||_fixTimestamp||Turns the NMEAProtocol timestamp notation into a datetime.time object. The time in this object is expressed as Zulu time.|
|Method||_fixDatestamp||Turns an NMEA datestamp format into a
|Method||_fixCoordinateFloat||Turns the NMEAProtocol coordinate format into Python float.|
|Method||_fixHemisphereSign||Fixes the sign for a hemisphere.|
|Method||_getHemisphereSign||Returns the hemisphere sign for a given coordinate type.|
|Method||_convert||A simple conversion fix.|
|Method||_statefulUpdate||Does a stateful update of a particular positioning attribute. Specifically, this will mutate an object in the current sentence data.|
|Method||_fixUnits||Fixes the units of a certain value. If the units are already acceptable (metric), does nothing.|
|Method||_fixGSV||Parses partial visible satellite information from a GSV sentence.|
|Method||_fixGSA||Extracts the information regarding which satellites were used in obtaining the GPS fix from a GSA sentence.|
|Method||_sentenceSpecificFix||Executes a fix for a specific type of sentence.|
|Method||_validateCurrentSentence||Tests if a sentence contains a valid fix.|
|Method||_cleanCurrentSentence||Cleans the current sentence.|
|Method||_updateState||Updates the current state with the new information from the sentence.|
|Method||_updateBeaconInformation||Updates existing beacon information state with new data.|
|Method||_updateUsedBeacons||Searches the adapter state and sentence data for information about which beacons where used, then adds it to the provided beacon information object.|
|Method||_mergeBeaconInformation||Merges beacon information in the adapter state (if it exists) into the provided beacon information. Specifically, this merges used and seen beacons.|
|Method||_fireSentenceCallbacks||Fires sentence callbacks for the current sentence.|
_statefulUpdate's docstring. (type: See
dictof bytestrings to unary callables)
dictof sentence types to callables that take self and modify it in-place)
dictof native strings to unary callables)
1990, an NMEA 0183 two-digit year of "96" will be interpreted as 1996, and a two-digit year of "13" will be interpreted as 2013. (type:
Initializes a new NMEA adapter.
|Parameters||receiver||The receiver for positioning sentences. (type: |
Turns the NMEAProtocol timestamp notation into a datetime.time object. The time in this object is expressed as Zulu time.
Turns an NMEA datestamp format into a
|Raises||ValueError||When the day or month value was invalid, e.g. 32nd day, or 13th month, or 0th day or month.|
Fixes the sign for a hemisphere.
This method must be called after the magnitude for the thing it determines the sign of has been set. This is done by the following functions:
|Parameters||coordinateType||Coordinate type. One of |
|sentenceDataKey||The key name of the hemisphere sign being fixed in the sentence data. If
A simple conversion fix.
|Parameters||key||The attribute name of the value to fix. (type: native string (Python identifier))|
|converter||The function that converts the value. (type: unary callable)|
Does a stateful update of a particular positioning attribute. Specifically, this will mutate an object in the current sentence data.
sentenceKey, this will get a tuple containing, in
order, the key name in the current state and sentence data, a factory for
new values, the attribute to update, and a converter from sentence data (in
NMEA notation) to something useful.
If the sentence data doesn't have this data yet, it is grabbed from the state. If that doesn't have anything useful yet either, the factory is called to produce a new, empty object. Either way, the object ends up in the sentence data.
|Parameters||sentenceKey||The name of the key in the sentence attributes,
Fixes the units of a certain value. If the units are already acceptable (metric), does nothing.
None of the keys are allowed to be the empty string.
|Parameters||unit||The unit that is being converted from. If unspecified or |
|unitKey||The name of the key/attribute under which the unit can be found in the
current sentence. If the |
|sourceKey||The name of the key/attribute that contains the current value to be
converted (expressed in units as defined according to the |
|valueKey||The key name in which the data will be stored in the
Parses partial visible satellite information from a GSV sentence.
Extracts the information regarding which satellites were used in obtaining the GPS fix from a GSA sentence.
Precondition: A GSA sentence was fired. Postcondition: The current
sentence data (
self._sentenceData will contain a set of the
currently used PRNs (under the key
Executes a fix for a specific type of sentence.
Resets this adapter.
This will empty the adapter state and the current sentence data.
Called when a sentence is received.
Will clean the received NMEAProtocol sentence up, and then update the adapter's state, followed by firing the callbacks.
If the received sentence was invalid, the state will be cleared.
|Parameters||sentence||The sentence that is received. (type: |
Tests if a sentence contains a valid fix.
Cleans the current sentence.
Updates the current state with the new information from the sentence.
Updates existing beacon information state with new data.
Searches the adapter state and sentence data for information about which beacons where used, then adds it to the provided beacon information object.
If no new beacon usage information is available, does nothing.
|Parameters||beaconInformation||The beacon information object that beacon usage information will be added
to (if necessary). (type: |
Merges beacon information in the adapter state (if it exists) into the provided beacon information. Specifically, this merges used and seen beacons.
If the adapter state has no beacon information, does nothing.
|Parameters||beaconInformation||The beacon information object that beacon information will be merged into
(if necessary). (type: |
datetime.date object and a
datetime.time object, collected from one or more NMEA
sentences, into a single
datetime.datetime object suitable for
sending to the
Fires sentence callbacks for the current sentence.
A callback will only fire if all of the keys it requires are present in the current state and at least one such field was altered in the current sentence.
The callbacks will only be fired with data from