grpc: updated node events to contain geo data when present
This commit is contained in:
parent
8fed201fd8
commit
4ab415e37d
2 changed files with 9 additions and 0 deletions
|
@ -23,11 +23,13 @@ def handle_node_event(event: NodeData) -> core_pb2.NodeEvent:
|
|||
:return: node event that contains node id, name, model, position, and services
|
||||
"""
|
||||
position = core_pb2.Position(x=event.x_position, y=event.y_position)
|
||||
geo = core_pb2.Geo(lat=event.latitude, lon=event.longitude, alt=event.altitude)
|
||||
node_proto = core_pb2.Node(
|
||||
id=event.id,
|
||||
name=event.name,
|
||||
model=event.model,
|
||||
position=position,
|
||||
geo=geo,
|
||||
services=event.services,
|
||||
)
|
||||
return core_pb2.NodeEvent(node=node_proto, source=event.source)
|
||||
|
|
|
@ -1002,11 +1002,18 @@ class TestGrpc:
|
|||
client = CoreGrpcClient()
|
||||
session = grpc_server.coreemu.create_session()
|
||||
node = session.add_node(CoreNode)
|
||||
node.position.lat = 10.0
|
||||
node.position.lon = 20.0
|
||||
node.position.alt = 5.0
|
||||
queue = Queue()
|
||||
|
||||
def handle_event(event_data):
|
||||
assert event_data.session_id == session.id
|
||||
assert event_data.HasField("node_event")
|
||||
event_node = event_data.node_event.node
|
||||
assert event_node.geo.lat == node.position.lat
|
||||
assert event_node.geo.lon == node.position.lon
|
||||
assert event_node.geo.alt == node.position.alt
|
||||
queue.put(event_data)
|
||||
|
||||
# then
|
||||
|
|
Loading…
Reference in a new issue