add geo to grpc calls getting node values, updated emane position hook to set lon/lat/alt values

This commit is contained in:
Blake Harnden 2020-05-30 14:24:38 -07:00
parent d31cfedde9
commit c6a06baf29
2 changed files with 5 additions and 0 deletions

View file

@ -235,6 +235,9 @@ def get_node_proto(session: Session, node: NodeBase) -> core_pb2.Node:
position = core_pb2.Position(
x=node.position.x, y=node.position.y, z=node.position.z
)
geo = core_pb2.Geo(
lat=node.position.lat, lon=node.position.lon, alt=node.position.alt
)
services = getattr(node, "services", [])
if services is None:
services = []
@ -255,6 +258,7 @@ def get_node_proto(session: Session, node: NodeBase) -> core_pb2.Node:
model=model,
type=node_type.value,
position=position,
geo=geo,
services=services,
icon=node.icon,
image=image,

View file

@ -202,6 +202,7 @@ class EmaneNet(CoreNetworkBase):
lat, lon, alt = self.session.location.getgeo(x, y, z)
if node.position.alt is not None:
alt = node.position.alt
node.position.set_geo(lon, lat, alt)
# altitude must be an integer or warning is printed
alt = int(round(alt))
return nemid, lon, lat, alt