self.iot_web_protoclo_recv_id=None
self.iot_protocol_client = None
self.connect_web_timer = osTimer()
+ self.connect_web_timer_count = 0
self.hr_report_timer = osTimer()
self.resolver = None
self.timerHr = 0
try:
if token != None:
+ self.connect_web_timer_count = 0
url_t = "ws://220.160.104.34:30800/ws-hub/dev/v1?qp-dt={}".format(token)
try:
self.iot_protocol_client=uwebsocket.Client.connect(url_t, debug=True)
if self.timer_id == 0:
self.hr_report_timer.start(DEFINE_TIME_COUNT*1000, 1, self.hr_report_event)
self.timer_id=1
-
+ else:
+ print("没有token!!!!!!!!!!")
+ self.connect_web_timer_count+=1
+ if self.connect_web_timer_count <= 10:
+ self.connect_web_timer.start(5000,0,self.iot_web_connect_timerCb)
+ pass
except Exception as e:
self.iot_protocol_client = None
print("connect_iot_websocket error")
EventMesh.publish("wakeup_BT")
self.record_len_tmp = 0
self.record_fd_len = 0
+ self.del_datat_len = 0
while True:
try:
Record_read_buf = bytearray(self.Audio_buf_size)
Record_len = 0
Record_len = self.record.stream_read(Record_read_buf, self.Audio_buf_size)
+ if self.del_datat_len <20000:
+ self.del_datat_len+=Record_len
+ continue
if Record_len > 0:
read_buf = bytes(Record_read_buf[:Record_len])