Hi,

It took long time to go through the ticket[1] and understands,
still i couldn't find any issue with it, instead its working perfectly for
me. and thanks to the twisted positioning NMEA adapter, it become easy to
me to write a adapter for the device(MVT380  device[2]) which i'm using in
my project[3].

IMHO,

1. isn't it good to use items() rather than iteritems() since python 3.x
has deprecated iteritems(),

2. In nmea._UNIT_CONVERTERS dictionary mapper, can't see any usage of key
'K' which convert Km/h unit to meters/s because it has a FIXER
for speedInKnots but not for speedInKMh, i think in $GPVTG NMEA string type
(it is not defined in _SENTENCE_CONTENTS) string they use text 'K' to
indicates that speed over ground is in kilometers/hour.

other than those suggestions,its works perfectly well. i wonder why this
positioning module didn't merged with the trunk yet,and i'll be happy if i
can help to get it merged.


[1] https://twistedmatrix.com/trac/ticket/3926
[2] http://www.mvt380.com/
[3]
https://github.com/tmkasun/port/blob/kasun/server_Program/server_twisting/syscall/mvt380.py

-- 
~ Kasun Thennakoon <http://me.knnect.com>
diff --git twisted/positioning/nmea.py twisted/positioning/nmea.py
index ce86e13..4cfbd89 100644
--- twisted/positioning/nmea.py
+++ twisted/positioning/nmea.py
@@ -788,6 +788,10 @@ class NMEAAdapter(object):
             lambda self: self._fixHemisphereSign(Angles.VARIATION,
                                             'heading'),
 
+        'speedInKMh':
+            lambda self: self._fixUnits(valueKey='speed',
+                                   sourceKey='speedInKMh',
+                                   unit='K'),
         'speedInKnots':
             lambda self: self._fixUnits(valueKey='speed',
                                    sourceKey='speedInKnots',
diff --git twisted/positioning/test/test_nmea.py twisted/positioning/test/test_nmea.py
index 0c17694..2b75dc7 100644
--- twisted/positioning/test/test_nmea.py
+++ twisted/positioning/test/test_nmea.py
@@ -91,7 +91,7 @@ class CallbackTests(TestCase):
             'GPRMC': ['$GPRMC*4b']
         }
 
-        for sentenceType, sentences in sentencesByType.iteritems():
+        for sentenceType, sentences in sentencesByType.items():
             for sentence in sentences:
                 self.protocol.lineReceived(sentence)
                 self.assertEqual(self.sentenceTypes, set([sentenceType]))
_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to