2017-10-05 08:36:53 +00:00
|
|
|
class BaseParser():
|
|
|
|
def __init__(self):
|
|
|
|
self.beacon_type = 'unknown'
|
|
|
|
|
|
|
|
def parse(self, aprs_comment, aprs_type):
|
2020-10-13 18:42:53 +00:00
|
|
|
if aprs_type.startswith('position'):
|
2017-10-05 08:36:53 +00:00
|
|
|
data = self.parse_position(aprs_comment)
|
2020-10-13 18:42:53 +00:00
|
|
|
elif aprs_type.startswith('status'):
|
2017-10-05 08:36:53 +00:00
|
|
|
data = self.parse_status(aprs_comment)
|
|
|
|
else:
|
2025-04-23 10:20:30 +00:00
|
|
|
raise ValueError(f"aprs_type '{aprs_type}' unknown")
|
2017-10-05 08:36:53 +00:00
|
|
|
data.update({'beacon_type': self.beacon_type})
|
|
|
|
return data
|
|
|
|
|
|
|
|
def parse_position(self, aprs_comment):
|
2025-04-23 10:20:30 +00:00
|
|
|
raise NotImplementedError(f"Position parser for parser '{self.beacon_type}' not yet implemented")
|
2017-10-05 08:36:53 +00:00
|
|
|
|
|
|
|
def parse_status(self, aprs_comment):
|
2025-04-23 10:20:30 +00:00
|
|
|
raise NotImplementedError(f"Status parser for parser '{self.beacon_type}' not yet implemented")
|