Browse Source

Report shipTypeMeta

front-experiment
squeaky otter 1 year ago
parent
commit
a5d18cbecc
Signed by: dashie GPG Key ID: C2D57B325840B755
3 changed files with 124 additions and 0 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +103
    -0
      libPyAirwaves/datas_ais.py
  3. +20
    -0
      libPyAirwaves/structs.py

+ 1
- 0
CHANGELOG.md View File

@ -17,3 +17,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Debug/console.log cleanups
- lastClientName and lastSrc report properly
- shipTypeMeta now reported

+ 103
- 0
libPyAirwaves/datas_ais.py View File

@ -521,3 +521,106 @@ isoCC2country = {
"ZM": {"country": "Zambia (Republic of)"},
"ZW": {"country": "Zimbabwe (Republic of)"},
}
shipTypes = [
"Not available",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Wing in ground",
"Wing in ground, Hazardous cat A",
"Wing in ground, Hazardous cat B",
"Wing in ground, Hazardous cat C",
"Wing in ground, Hazardous cat D",
"Wing in ground, Reserved",
"Wing in ground, Reserved",
"Wing in ground, Reserved",
"Wing in ground, Reserved",
"Wing in ground, Reserved",
"Fishing",
"Towing",
"Towing: len > 200m / breadth > 25m",
"Dredging/underwater ops",
"Diving ops",
"Military ops",
"Sailing",
"Pleasure Craft",
"Reserved",
"Reserved",
"High speed craft",
"High speed craft, Hazardous cat A",
"High speed craft, Hazardous cat B",
"High speed craft, Hazardous cat C",
"High speed craft, Hazardous cat D",
"High speed craft, Reserved",
"High speed craft, Reserved",
"High speed craft, Reserved",
"High speed craft, Reserved",
"High speed craft",
"Pilot Vessel",
"Search and Rescue vessel",
"Tug",
"Port Tender",
"Anti-pollution equipment",
"Law Enforcement",
"Spare - Local Vessel",
"Spare - Local Vessel",
"Medical Transport",
"Noncombatant ship (RR Res #18)",
"Passenger",
"Passenger, Hazardous cat A",
"Passenger, Hazardous cat B",
"Passenger, Hazardous cat C",
"Passenger, Hazardous cat D",
"Passenger, Reserved",
"Passenger, Reserved",
"Passenger, Reserved",
"Passenger, Reserved",
"Passenger",
"Cargo",
"Cargo, Hazardous cat A",
"Cargo, Hazardous cat B",
"Cargo, Hazardous cat C",
"Cargo, Hazardous cat D",
"Cargo, Reserved",
"Cargo, Reserved",
"Cargo, Reserved",
"Cargo, Reserved",
"Cargo",
"Tanker",
"Tanker, Hazardous cat A",
"Tanker, Hazardous cat B",
"Tanker, Hazardous cat C",
"Tanker, Hazardous cat D",
"Tanker, Reserved",
"Tanker, Reserved",
"Tanker, Reserved",
"Tanker, Reserved",
"Tanker",
"Other",
"Other, Hazardous cat A",
"Other, Hazardous cat B",
"Other, Hazardous cat C",
"Other, Hazardous cat D",
"Other, Reserved",
"Other, Reserved",
"Other, Reserved",
"Other, Reserved",
"Other",
]

+ 20
- 0
libPyAirwaves/structs.py View File

@ -433,9 +433,29 @@ class AisType(DefaultType):
self.mmsiCC = mmsiMeta["mmsiCC"]
if "mmsiType" in mmsiMeta:
self.mmsiType = mmsiMeta["mmsiType"]
# Extract Ship Type
self.shipTypeMeta = self.__getAISShipType(decoded["type"])
return True
def __getAISShipType(self, shipType):
"""
Get the text description of a given AIS ship type
:param shipType: int, ship type
:return: str, ship type name
"""
retVal = ""
try:
retVal = datas_ais.shipTypes[shipType]
except (IndexError, TypeError):
pass
except Exception as e:
raise e
return retVal
def has_location(self):
if self.lat and self.lon:
return True


Loading…
Cancel
Save