Use the throttle as the heartbeat message.

This commit is contained in:
Piv
2019-09-22 19:45:49 +09:30
parent d14bae53f6
commit 37622b58f8
4 changed files with 11 additions and 126 deletions

View File

@@ -14,7 +14,7 @@ class CarControlStub(object):
Args:
channel: A grpc.Channel.
"""
self.SetThrottle = channel.unary_unary(
self.SetThrottle = channel.stream_unary(
'/MotorControl.CarControl/SetThrottle',
request_serializer=motorService__pb2.ThrottleRequest.SerializeToString,
response_deserializer=motorService__pb2.ThrottleResponse.FromString,
@@ -24,18 +24,13 @@ class CarControlStub(object):
request_serializer=motorService__pb2.SteeringRequest.SerializeToString,
response_deserializer=motorService__pb2.SteeringResponse.FromString,
)
self.Heartbeat = channel.stream_unary(
'/MotorControl.CarControl/Heartbeat',
request_serializer=motorService__pb2.HeartbeatCheck.SerializeToString,
response_deserializer=motorService__pb2.HeartbeatCheckResponse.FromString,
)
class CarControlServicer(object):
# missing associated documentation comment in .proto file
pass
def SetThrottle(self, request, context):
def SetThrottle(self, request_iterator, context):
# missing associated documentation comment in .proto file
pass
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
@@ -49,17 +44,10 @@ class CarControlServicer(object):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Heartbeat(self, request_iterator, context):
# missing associated documentation comment in .proto file
pass
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_CarControlServicer_to_server(servicer, server):
rpc_method_handlers = {
'SetThrottle': grpc.unary_unary_rpc_method_handler(
'SetThrottle': grpc.stream_unary_rpc_method_handler(
servicer.SetThrottle,
request_deserializer=motorService__pb2.ThrottleRequest.FromString,
response_serializer=motorService__pb2.ThrottleResponse.SerializeToString,
@@ -69,11 +57,6 @@ def add_CarControlServicer_to_server(servicer, server):
request_deserializer=motorService__pb2.SteeringRequest.FromString,
response_serializer=motorService__pb2.SteeringResponse.SerializeToString,
),
'Heartbeat': grpc.stream_unary_rpc_method_handler(
servicer.Heartbeat,
request_deserializer=motorService__pb2.HeartbeatCheck.FromString,
response_serializer=motorService__pb2.HeartbeatCheckResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'MotorControl.CarControl', rpc_method_handlers)