Skip to content

Commit

Permalink
[mock_uss/riddp] Expose aircraft_type through observation interface
Browse files Browse the repository at this point in the history
  • Loading branch information
mickmis committed Dec 11, 2024
1 parent 89c3b38 commit 18697e7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions monitoring/mock_uss/riddp/routes_observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def _make_flight_observation(
h.distance = limit_resolution(h.distance, MinHeightResolution)
return observation_api.Flight(
id=flight.id,
aircraft_type=flight.aircraft_type,
most_recent_position=observation_api.Position(
lat=p.lat,
lng=p.lng,
Expand Down
17 changes: 17 additions & 0 deletions monitoring/monitorlib/fetch/rid.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,23 @@ def timestamp_accuracy(self) -> Optional[float]:
f"Cannot retrieve speed using RID version {self.rid_version}"
)

@property
def aircraft_type(
self,
) -> Optional[Union[v19.api.RIDAircraftType, v22a.api.UAType]]:
if self.rid_version == RIDVersion.f3411_19:
if not self.v19_value.has_field_with_value("aircraft_type"):
return None
return self.v19_value.aircraft_type
elif self.rid_version == RIDVersion.f3411_22a:
if not self.v22a_value.has_field_with_value("aircraft_type"):
return None
return self.v22a_value.aircraft_type
else:
raise NotImplementedError(
f"Cannot retrieve aircraft_type using RID version {self.rid_version}"
)

def errors(self) -> List[str]:
try:
rid_version = self.rid_version
Expand Down

0 comments on commit 18697e7

Please sign in to comment.