2 changed files with 18 additions and 10 deletions
@ -1,10 +1,18 @@ |
|||||
__slots__ = ["num", "snr", "hops_away", "ts", "long_name", "short_name"] |
__slots__ = ["num", "snr", "hops_away", "ts", "long_name", "short_name", "is_unmessagable"] |
||||
|
|
||||
class NodeDTO: |
class NodeDTO: |
||||
def __init__(self, data): |
def __init__(self, data, grabPosition = False, grabMetrics = False): |
||||
for slot in __slots__: |
for slot in __slots__: |
||||
setattr(self, slot, data.get(slot, None)) |
setattr(self, slot, data.get(slot, None)) |
||||
|
|
||||
|
self.havePosition = True if data.get("position", {}) else False |
||||
|
if grabPosition and data.get("position", {}): |
||||
|
setattr(self, "position", data.get("position")) |
||||
|
|
||||
|
self.haveMetrics = True if data.get("device_metrics", {}) else False |
||||
|
if grabMetrics and data.get("device_metrics", {}): |
||||
|
setattr(self, "device_metrics", data.get("device_metrics")) |
||||
|
|
||||
class NodeShortDTO: |
class NodeShortDTO: |
||||
def __init__(self, data): |
def __init__(self, data): |
||||
for slot in ["num", "long_name", "short_name"]: |
for slot in ["num", "long_name", "short_name"]: |
||||
|
|||||
Loading…
Reference in new issue