Esempio n. 1
0
 def test_position_without_timestamp_without_messaging(self):
     self.__check_parsed(
         'N6ZX-3>APN391:!3726.16NS12219.21W#PHG2436/A=002080',
         facts=[
             Messaging(False),
             Position((37 + 26.16 / 60), -(122 + 19.21 / 60)),
             Symbol('S#'),
             Altitude(2080, True)],
         errors=['PHG parsing not implemented'],
         comment='')
Esempio n. 2
0
 def test_compressed_position_live(self):
     self.__check_parsed(
         'W6KWF-1>APOT30,WIDE2-1,qAR,W6YX-5:!/;ZI^/]m/k7UG 13.8V W6KWF',
         facts=[
             Messaging(supported=False),
             Position(37.316371158702744, -121.96361498033738),
             Symbol(id=u'/k'),
             Velocity(speed_knots=53.70604083543306, course_degrees=88)
         ],
         errors=[],
         comment=' 13.8V W6KWF')
Esempio n. 3
0
 def test_compressed_position_radio_range(self):
     self.__check_parsed(
         'W6SJC-1>APX201,TCPIP*,qAC,T2SOCAL:=/;XuS/_3{o{LCXASTIR-Linux',
         facts=[
             Messaging(supported=True),
             Position(latitude=37.34936706866951, longitude=-121.90397084998136),
             Symbol(id=u'/o'),
             RadioRange(27.3666404237768),
         ],
         errors=[],
         comment='XASTIR-Linux')
Esempio n. 4
0
 def test_position_with_timestamp_zero_error(self):
     # TODO this message looks to have other stuff we should parse
     self.__check_parsed(
         'N6TVE-11>APTW01,TCPIP*,qAC,T2BWI:@000000z3429.95N/11949.07W_087/004g006t068r000p000XTvEJeeWx',
         facts=[
             Messaging(True),
             Position((34 + 29.95 / 60), -(119 + 49.07 / 60)),
             Symbol(u'/_'),
             Velocity(speed_knots=4, course_degrees=87),
         ],
         errors=['DHM/HMS timestamp invalid: day is out of range for month'],
         comment='g006t068r000p000XTvEJeeWx')
Esempio n. 5
0
 def test_mic_e(self):
     self.__check_parsed(
         'KQ1N-7>SV2RYV,W6BXN-3*,N6ZX-3*,WIDE2*:`00krA4[/`"5U}_',
         facts=[
             # TODO: Check pos and vel against results from some other parser, in more cases
             Position(latitude=36.382666666666665, longitude=-120.3465),
             Velocity(speed_knots=63, course_degrees=31),
             Symbol('/['),
         ],
         errors=[],
         # TODO: The _ is actually a manufacturer/version code or something but we don't support that yet
         comment='_')
Esempio n. 6
0
 def test_compressed_position_example_altitude(self):
     """example from APRS 1.0.1 page 40"""
     # due to exponentiation being involved there is some FP error. TODO: Arrange to be able to assert the range, or duplicate the computation, instead of using exact constants
     self.__check_parsed('FOO>BAR:!/!!!!!!!!>S]S',
                         facts=[
                             Messaging(supported=False),
                             Position(90, -180),
                             Symbol(id=u'/>'),
                             Altitude(value=10004.52005070133,
                                      feet_not_meters=True)
                         ],
                         errors=[],
                         comment='')
Esempio n. 7
0
 def test_compressed_position_example_1(self):
     """example from APRS 1.0.1 page 40"""
     # due to exponentiation being involved there is some FP error. TODO: Arrange to be able to assert the range, or duplicate the computation, instead of using exact constants
     self.__check_parsed('FOO>BAR:!/5L!!<*e7>7P[',
                         facts=[
                             Messaging(supported=False),
                             Position((49 + 30 / 60), -72.75000393777269),
                             Symbol(id=u'/>'),
                             Velocity(speed_knots=36.23201216883807,
                                      course_degrees=88)
                         ],
                         errors=[],
                         comment='')
Esempio n. 8
0
 def test_position_ambiguity(self):
     # TODO the position ambiguity should be put in the facts
     # Note: This message was captured but has its ambiguity increased to test the left-of-the-dot ambiguity parsing.
     self.__check_parsed(
         'AG6WF-5>APDR13,TCPIP*,qAC,T2CSNGRAD:=341 .  N/1182 .  W$/A=000853',
         facts=[
             Messaging(supported=True),
             Position((34 + 10 / 60), -(118 + 20 / 60)),
             Symbol(id=u'/$'),
             Altitude(853, True),
         ],
         errors=[],
         comment='')
Esempio n. 9
0
 def test_position_with_timestamp_without_messaging(self):
     self.__check_parsed(
         'KMEP1>APT311,N6ZX-3*,WIDE1*,WIDE2-1:/160257z3726.79N\\12220.18Wv077/000/A=001955/N6ZX, Kings Mt. Eme',
         facts=[
             Messaging(False),
             Timestamp(_dummy_receive_datetime.replace(day=16, hour=2, minute=57, second=0, microsecond=0)),
             Position((37 + 26.79 / 60), -(122 + 20.18 / 60)),
             Symbol(u'\\v'),
             Velocity(speed_knots=0, course_degrees=77),
             Altitude(1955, True),
         ],
         errors=[],
         comment='/N6ZX, Kings Mt. Eme')
Esempio n. 10
0
 def test_position_with_timestamp_with_messaging(self):
     # TODO this message looks to have other stuff we should parse
     self.__check_parsed(
         'KA6UPU-1>APRS,N6ZX-3*,WIDE1*:@160256z3755.50N/12205.43W_204/003g012t059r000p000P000h74b10084.DsVP',
         facts=[
             Messaging(True),
             Timestamp(_dummy_receive_datetime.replace(day=16, hour=2, minute=56, second=0, microsecond=0)),
             Position((37 + 55.50 / 60), -(122 + 05.43 / 60)),
             Symbol('/_'),
             Velocity(speed_knots=3, course_degrees=204),
         ],
         errors=[],
         comment='g012t059r000p000P000h74b10084.DsVP')
Esempio n. 11
0
 def test_object_report_kill(self):
     # Never seen a kill report live, so faked up from the test_object_report sample data
     self.__check_parsed(
         'FOO>BAR:;THEOBJECT_061508z3803.13N/12017.88Wr',
         facts=[ObjectItemReport(
             object=True,
             name='THEOBJECT',
             live=False,
             facts=[
                 Timestamp(_dummy_receive_datetime.replace(day=6, hour=15, minute=8, second=0, microsecond=0)),
                 Position(latitude=38.052166666666665, longitude=-120.298),
                 Symbol('/r'),
             ])],
         errors=[],
         comment='')
Esempio n. 12
0
 def test_parse_and_position_without_timestamp(self):
     """this test case looks at the entire message structure"""
     self.__check(
         'N6WKZ-3>APU25N,WB6TMS-3*,N6ZX-3*,WIDE2*:=3746.42N112226.00W# {UIV32N}',
         APRSMessage(receive_time=_dummy_receive_time,
                     source='N6WKZ-3',
                     destination='APU25N',
                     via=',WB6TMS-3*,N6ZX-3*,WIDE2*',
                     payload='=3746.42N112226.00W# {UIV32N}',
                     facts=[
                         Messaging(True),
                         Position((37 + 46.42 / 60), -(122 + 26.00 / 60)),
                         Symbol('1#'),
                     ],
                     errors=[],
                     comment=' {UIV32N}'))
Esempio n. 13
0
 def test_object_report(self):
     # TODO: test case w/ compressed position
     # TODO: test case w/ data-in-comment-field
     self.__check_parsed(
         'KE6KYI>APU25N,K6TUO-3*,N6ZX-3*,WIDE2*:;FD TCARES*061508z3803.13N/12017.88WrTCARES Field Day Site June 28-29',
         facts=[ObjectItemReport(
             object=True,
             name='FD TCARES',
             live=True,
             facts=[
                 Timestamp(_dummy_receive_datetime.replace(day=6, hour=15, minute=8, second=0, microsecond=0)),
                 Position(latitude=38.052166666666665, longitude=-120.298),
                 Symbol('/r'),
             ])],
         errors=[],
         comment='TCARES Field Day Site June 28-29')
Esempio n. 14
0
 def test_position_with_timestamp_without_messaging(self):
     # TODO this message looks to have other stuff we should parse
     self.__check_parsed(
         'KMEP1>APT311,N6ZX-3*,WIDE1*,WIDE2-1:/160257z3726.79N\\12220.18Wv077/000/A=001955/N6ZX, Kings Mt. Eme',
         facts=[
             Messaging(False),
             Timestamp(
                 _dummy_receive_datetime.replace(day=16,
                                                 hour=2,
                                                 minute=57,
                                                 second=0,
                                                 microsecond=0)),
             Position((37 + 26.79 / 60), -(122 + 20.18 / 60)),
             Symbol('\\v'),
         ],
         errors=[],
         comment='077/000/A=001955/N6ZX, Kings Mt. Eme')
Esempio n. 15
0
 def test_symbol(self):
     self.assertEqual('', self.s.get_symbol())
     self.s.receive(self.__message([Symbol('/=')]))
     self.assertEqual('/=', self.s.get_symbol())