34 from struct
import pack, unpack
42 self.
_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
53 self._sock.sendall(json.dumps(data))
63 if (len(recv_data) == 0):
64 raise socket.error(
'recv error')
72 data, index = self._decoder.raw_decode(self.
_recv_buffer)
76 except ValueError
as e:
102 return self._data_sock.recv()
105 control_data = {
'ST00':
'ON',
'ST01': sampling_time,
'ST02': sampling_time}
107 for filter
in filters:
108 control_data[filter] =
'ON' 111 if (res[
'RT00'] !=
'OK'):
120 self._data_sock.connect()
122 except socket.error
as e:
125 raise socket.error(e)
130 control_data = {
'ST00':
'OFF',
'RT01': self.
_data_port}
132 if res[
'RT00'] !=
'OK':
133 print(
'warning: send_control returns {}'.format(res))
137 self._data_sock.close()
877 if __name__ ==
'__main__':
881 c.connect([InfoCatchClient.Label.I000,
882 InfoCatchClient.Label.R200,
883 InfoCatchClient.Label.M000,
884 InfoCatchClient.Label.M001,
885 InfoCatchClient.Label.M100,
886 InfoCatchClient.Label.M102,
887 InfoCatchClient.Label.F000,
888 InfoCatchClient.Label.F200,
889 InfoCatchClient.Label.F300,
def __init__(self, ip_addr, port)
def __init__(self, ip_addr='192.168.0.23')
def send_control(self, msg)
def connect(self, filters, sampling_time=10)