mirror of
https://github.com/craigerl/aprsd.git
synced 2024-12-22 01:20:59 -05:00
Some packet cleanup
This commit is contained in:
parent
9e26df26d6
commit
da7b7124d7
@ -78,7 +78,6 @@ def setup_logging(loglevel=None, quiet=False):
|
|||||||
logging.getLogger(name).propagate = True
|
logging.getLogger(name).propagate = True
|
||||||
logging.getLogger(name).setLevel(logging.ERROR)
|
logging.getLogger(name).setLevel(logging.ERROR)
|
||||||
|
|
||||||
|
|
||||||
handlers = [
|
handlers = [
|
||||||
{
|
{
|
||||||
"sink": sys.stdout,
|
"sink": sys.stdout,
|
||||||
|
@ -108,18 +108,6 @@ class Packet:
|
|||||||
path: List[str] = field(default_factory=list, compare=False, hash=False)
|
path: List[str] = field(default_factory=list, compare=False, hash=False)
|
||||||
via: Optional[str] = field(default=None, compare=False, hash=False)
|
via: Optional[str] = field(default=None, compare=False, hash=False)
|
||||||
|
|
||||||
@property
|
|
||||||
def json(self) -> str:
|
|
||||||
"""get the json formated string"""
|
|
||||||
# comes from the DataClassJsonMixin
|
|
||||||
return self.to_json() # type: ignore
|
|
||||||
|
|
||||||
@property
|
|
||||||
def dict(self) -> dict:
|
|
||||||
"""get the dict formated string"""
|
|
||||||
# comes from the DataClassJsonMixin
|
|
||||||
return self.to_dict() # type: ignore
|
|
||||||
|
|
||||||
def get(self, key: str, default: Optional[str] = None):
|
def get(self, key: str, default: Optional[str] = None):
|
||||||
"""Emulate a getter on a dict."""
|
"""Emulate a getter on a dict."""
|
||||||
if hasattr(self, key):
|
if hasattr(self, key):
|
||||||
@ -474,7 +462,7 @@ class BeaconPacket(GPSPacket):
|
|||||||
|
|
||||||
|
|
||||||
@dataclass_json
|
@dataclass_json
|
||||||
@dataclass
|
@dataclass(unsafe_hash=True)
|
||||||
class MicEPacket(GPSPacket):
|
class MicEPacket(GPSPacket):
|
||||||
_type: str = field(default="MicEPacket", hash=False)
|
_type: str = field(default="MicEPacket", hash=False)
|
||||||
messagecapable: bool = False
|
messagecapable: bool = False
|
||||||
@ -493,7 +481,7 @@ class MicEPacket(GPSPacket):
|
|||||||
|
|
||||||
|
|
||||||
@dataclass_json
|
@dataclass_json
|
||||||
@dataclass
|
@dataclass(unsafe_hash=True)
|
||||||
class TelemetryPacket(GPSPacket):
|
class TelemetryPacket(GPSPacket):
|
||||||
_type: str = field(default="TelemetryPacket", hash=False)
|
_type: str = field(default="TelemetryPacket", hash=False)
|
||||||
messagecapable: bool = False
|
messagecapable: bool = False
|
||||||
@ -514,7 +502,7 @@ class TelemetryPacket(GPSPacket):
|
|||||||
|
|
||||||
|
|
||||||
@dataclass_json
|
@dataclass_json
|
||||||
@dataclass
|
@dataclass(unsafe_hash=True)
|
||||||
class ObjectPacket(GPSPacket):
|
class ObjectPacket(GPSPacket):
|
||||||
_type: str = field(default="ObjectPacket", hash=False)
|
_type: str = field(default="ObjectPacket", hash=False)
|
||||||
alive: bool = True
|
alive: bool = True
|
||||||
@ -560,7 +548,7 @@ class ObjectPacket(GPSPacket):
|
|||||||
return f"{h_info} {self.comment}"
|
return f"{h_info} {self.comment}"
|
||||||
|
|
||||||
|
|
||||||
@dataclass()
|
@dataclass(unsafe_hash=True)
|
||||||
class WeatherPacket(GPSPacket, DataClassJsonMixin):
|
class WeatherPacket(GPSPacket, DataClassJsonMixin):
|
||||||
_type: str = field(default="WeatherPacket", hash=False)
|
_type: str = field(default="WeatherPacket", hash=False)
|
||||||
symbol: str = "_"
|
symbol: str = "_"
|
||||||
@ -697,7 +685,7 @@ class WeatherPacket(GPSPacket, DataClassJsonMixin):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@dataclass()
|
@dataclass(unsafe_hash=True)
|
||||||
class ThirdPartyPacket(Packet, DataClassJsonMixin):
|
class ThirdPartyPacket(Packet, DataClassJsonMixin):
|
||||||
_type: str = "ThirdPartyPacket"
|
_type: str = "ThirdPartyPacket"
|
||||||
# Holds the encapsulated packet
|
# Holds the encapsulated packet
|
||||||
@ -727,7 +715,7 @@ class ThirdPartyPacket(Packet, DataClassJsonMixin):
|
|||||||
|
|
||||||
|
|
||||||
@dataclass_json
|
@dataclass_json
|
||||||
@dataclass
|
@dataclass(unsafe_hash=True)
|
||||||
class BulletinPacket(Packet):
|
class BulletinPacket(Packet):
|
||||||
_type: str = "BulletinPacket"
|
_type: str = "BulletinPacket"
|
||||||
# Holds the encapsulated packet
|
# Holds the encapsulated packet
|
||||||
@ -740,7 +728,7 @@ class BulletinPacket(Packet):
|
|||||||
|
|
||||||
|
|
||||||
@dataclass_json(undefined=Undefined.INCLUDE)
|
@dataclass_json(undefined=Undefined.INCLUDE)
|
||||||
@dataclass
|
@dataclass(unsafe_hash=True)
|
||||||
class UnknownPacket:
|
class UnknownPacket:
|
||||||
"""Catchall Packet for things we don't know about.
|
"""Catchall Packet for things we don't know about.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user