File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ def parse_aprs(message, reference_timestamp=None):
8787 result .update ({
8888 'name' : match .group ('callsign' ),
8989 'dstcall' : match .group ('dstcall' ),
90- 'relay' : match .group ('relay' ) if match . group ( 'relay' ) else None ,
90+ 'relay' : match .group ('relay' ),
9191 'receiver_name' : match .group ('receiver' ),
9292 'timestamp' : createTimestamp (match_position .group ('time' ), reference_timestamp ),
9393 'latitude' : parseAngle ('0' + match_position .group ('latitude' ) + (match_position .group ('latitude_enhancement' ) or '0' )) * # noqa: W504
Original file line number Diff line number Diff line change 11import re
22
3- PATTERN_APRS = re .compile (r"^(?P<callsign>.+?)>(?P<dstcall>[A-Z0-9]+),((?P<relay>[A-Za-z0-9]+)\*)?.*,(?P<receiver>.+?):(?P<aprs_type>(.))(?P<aprs_body>.*)$" )
3+ PATTERN_APRS = re .compile (r"^(?P<callsign>.+?)>(?P<dstcall>[A-Z0-9]+)( ,((?P<relay>[A-Za-z0-9]+)\*)?.*,(?P<receiver>.+?))? :(?P<aprs_type>(.))(?P<aprs_body>.*)$" )
44PATTERN_APRS_POSITION = re .compile (r"^(?P<time>(([0-1]\d|2[0-3])[0-5]\d[0-5]\dh|([0-2]\d|3[0-1])([0-1]\d|2[0-3])[0-5]\dz))(?P<latitude>9000\.00|[0-8]\d{3}\.\d{2})(?P<latitude_sign>N|S)(?P<symbol_table>.)(?P<longitude>18000\.00|1[0-7]\d{3}\.\d{2}|0\d{4}\.\d{2})(?P<longitude_sign>E|W)(?P<symbol>.)(?P<course_extension>(?P<course>\d{3})/(?P<ground_speed>\d{3}))?(/A=(?P<altitude>(-\d{5}|\d{6})))?(?P<pos_extension>\s!W((?P<latitude_enhancement>\d)(?P<longitude_enhancement>\d))!)?(?:\s(?P<comment>.*))?$" )
55PATTERN_APRS_POSITION_WEATHER = re .compile (r"^(?P<time>(([0-1]\d|2[0-3])[0-5]\d[0-5]\dh|([0-2]\d|3[0-1])([0-1]\d|2[0-3])[0-5]\dz))(?P<latitude>9000\.00|[0-8]\d{3}\.\d{2})(?P<latitude_sign>N|S)(?P<symbol_table>.)(?P<longitude>18000\.00|1[0-7]\d{3}\.\d{2}|0\d{4}\.\d{2})(?P<longitude_sign>E|W)(?P<symbol>.)(?P<wind_direction>(\d{3}|\.{3}))/(?P<wind_speed>(\d{3}|\.{3}))g(?P<wind_speed_peak>(\d{3}|\.{3}))t(?P<temperature>(\d{3}|\.{3}))(r(?P<rainfall_1h>\d{3}))?(p(?P<rainfall_24h>\d{3}))?(h(?P<humidity>\d{2}))?(b(?P<barometric_pressure>\d{5}))?(?:\s(?P<comment>.*))?$" )
66PATTERN_APRS_STATUS = re .compile (r"^(?P<time>(([0-1]\d|2[0-3])[0-5]\d[0-5]\dh|([0-2]\d|3[0-1])([0-1]\d|2[0-3])[0-5]\dz))\s(?P<comment>.*)$" )
Original file line number Diff line number Diff line change @@ -118,6 +118,15 @@ def test_bad_naviter_format(self):
118118 with self .assertRaises (OgnParseError ):
119119 parse ("FLRA51D93>OGNAVI,qAS,NAVITER2:/204507h4444.98N/09323.34W'000/000/A=000925 !W67! id06A51D93 +000fpm +0.0rot" )
120120
121+ def test_no_receiver (self ):
122+ result = parse ("EDFW>OGNSDR:/102713h4949.02NI00953.88E&/A=000984" )
123+
124+ self .assertEqual (result ['aprs_type' ], 'position' )
125+ self .assertEqual (result ['beacon_type' ], 'receiver' )
126+ self .assertEqual (result ['name' ], 'EDFW' )
127+ self .assertEqual (result ['dstcall' ], 'OGNSDR' )
128+ self .assertEqual (result ['receiver_name' ], None )
129+
121130
122131if __name__ == '__main__' :
123132 unittest .main ()
You can’t perform that action at this time.
0 commit comments