Go to the documentation of this file.00001
00002
00003
00004 import abc
00005 import socket
00006
00007
00008 __all__ = ['IClient']
00009
00010
00011 class IClient(object):
00012 """ IClient class """
00013 __metaclass__ = abc.ABCMeta
00014
00015 @abc.abstractmethod
00016 def request(
00017 self,
00018 data,
00019 language='ja',
00020 timeout=socket._GLOBAL_DEFAULT_TIMEOUT
00021 ):
00022 """
00023 send speech recognition request to server
00024 @param data: speech binary data
00025 @type data: str
00026 @param language: speech data language
00027 @type language: str
00028 @param timeout: time out time[ms]
00029 @type timeout: int
00030 """
00031 pass
00032
00033 @abc.abstractmethod
00034 def support_streaming(self):
00035 """
00036 check support streaming
00037 @returns: True for support streaming / False for NOT support streaming
00038 """
00039 pass
00040
00041 @abc.abstractmethod
00042 def set_streaming_config(self, *args, **kwargs):
00043 """
00044 set streaming config
00045 @param argv:
00046 @param kwargs:
00047 """
00048 pass
00049
00050 @abc.abstractmethod
00051 def add_streaming_packet(self, packet_type, packet_data):
00052 """
00053 add streaming packet
00054 @param packet_type:
00055 @type packet_type: int
00056 @param packet_data:
00057 @param packet_data: str
00058 """
00059 pass
00060
00061 @abc.abstractmethod
00062 def register_streaming_cb(self, cb):
00063 """
00064 register streaming result callback
00065 @param cb:
00066 @type cb:
00067 """
00068 pass
00069
00070 @abc.abstractmethod
00071 def unregister_streaming_cb(self, cb):
00072 """
00073 unregister streaming result callback
00074 @param cb:
00075 @type cb:
00076 """
00077 pass
00078
00079 @abc.abstractmethod
00080 def join(self, timeout):
00081 """
00082 join streaming client
00083 @param timeout:
00084 @type timeout:
00085 """
00086 pass