端点=“tcp: / / 127.0.0.1:50020”;
ctx = zmq.core.ctx_new ();
套接字= zmq.core.socket (ctx,“ZMQ_REQ”);
zmq.core.setsockopt(套接字,“ZMQ_RCVTIMEO”,1000);
流(“连接到% s \ n”、端点);
zmq.core。连接(插座、端点);
抽搐;
zmq.core。发送(套接字,uint8 (“t”));
结果= zmq.core.recv(插座);
流(“% s \ n”char(结果));
流(“往返命令延迟:% s \ n”、toc);
zmq.core。发送(套接字,uint8 (“T 0.0”));
结果= zmq.core.recv(插座);
流(“% s \ n”char(结果));
暂停(1.0);
zmq.core。发送(套接字,uint8 (“R”));
结果= zmq.core.recv(插座);
流(“应该开始录音:% s \ n”char(结果));
暂停(5.0);
zmq.core。发送(套接字,uint8 (“r”));
结果= zmq.core.recv(插座);
流(“停止录音:% s \ n”char(结果));
send_notification(套接字,containers.Map ({“主题”},{“calibration.should_start”}))
结果= zmq.core.recv(插座);
流(“通知收到:% s \ n”char(结果));
send_notification(套接字,containers.Map ({“主题”},{“calibration.should_stop”}))
结果= zmq.core.recv(插座);
流(“通知收到:% s \ n”char(结果));
zmq.core。断开(插座、端点);
zmq.core.close(插座);
zmq.core.ctx_shutdown (ctx);
zmq.core.ctx_term (ctx);