Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement #64 : adding say text method #65

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions protos/sound.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ message SoundId {
string id = 1;
}

message TextRequest {
string text = 1;
}

message RecordingAck {
SoundAck ack = 1;
SoundId recording_id = 2;
Expand Down Expand Up @@ -78,4 +82,6 @@ service SoundService {
rpc StopSound (component.ComponentId) returns (google.protobuf.Empty);

rpc GetSoundsList(google.protobuf.Empty) returns (ListOfSound);

rpc SayText (TextRequest) returns (google.protobuf.Empty);
}
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ def __init__(self, channel):
request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
response_deserializer=sound__pb2.ListOfSound.FromString,
)
self.SayText = channel.unary_unary(
'/component.sound.SoundService/SayText',
request_serializer=sound__pb2.TextRequest.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)


class SoundServiceServicer(object):
Expand Down Expand Up @@ -120,6 +125,12 @@ def GetSoundsList(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def SayText(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')


def add_SoundServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
Expand Down Expand Up @@ -168,6 +179,11 @@ def add_SoundServiceServicer_to_server(servicer, server):
request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
response_serializer=sound__pb2.ListOfSound.SerializeToString,
),
'SayText': grpc.unary_unary_rpc_method_handler(
servicer.SayText,
request_deserializer=sound__pb2.TextRequest.FromString,
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'component.sound.SoundService', rpc_method_handlers)
Expand Down Expand Up @@ -330,3 +346,20 @@ def GetSoundsList(request,
sound__pb2.ListOfSound.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def SayText(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/component.sound.SoundService/SayText',
sound__pb2.TextRequest.SerializeToString,
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)