EventMesh.publish("stop_voice_record") #电话优先级最高
EventMesh.publish("stop_AI_record")
EventMesh.publish("play_tts",[tts_str,1]) #播放tts闹钟文本内容
+ self.sos_timer1.stop()
self.sos_timer1.start(2000, 0, self.phone110112_cb)
elif p110 == "1":
self.phone110112 = "112"
EventMesh.publish("stop_voice_record") #电话优先级最高
EventMesh.publish("stop_AI_record")
EventMesh.publish("play_tts",[tts_str,1]) #播放tts闹钟文本内容
+ self.sos_timer1.stop()
self.sos_timer1.start(2000, 0, self.phone110112_cb)
else:
return -1
else:
EventMesh.publish(constants.EVENT.START_LOCATION,WEB_CMD_ENUM.POST_SOS_S_CMD) #开始AL定位
+ self.sos_timer2.stop()
self.sos_timer2.start(30000, 0, self.sos_time_out_phone)
return 1
EventMesh.publish("stop_voice_record") #电话优先级最高
EventMesh.publish("stop_AI_record")
EventMesh.publish("play_tts",[tts_str,1]) #播放tts闹钟文本内容
+ self.sos_timer1.stop()
self.sos_timer1.start(2000, 0, self.sos_call_out_phone)
def sos_time_out_phone(self, msg):#30s超时未打通或者信号不好则重新拨打
if self.sos_flag == 1:
- if self.call_state == 0 or self.call_state == 3 or self.call_state == 4:
+ if self.call_state == 0:
voiceCall.callEnd() #挂断
EventMesh.publish("set_sos_info_call") #电话优先级最高
pass #再次拨打
usys.print_exception(e)
import ai_alarm as _schedule
DEFIEN_HR_REPORT_TIME = 5*60
-DEFINE_TIME_COUNT = 5
-DEFIEN_LOCATION_REPORT_TIME = 5
+DEFINE_TIME_COUNT = 10
+DEFIEN_LOCATION_REPORT_TIME = DEFINE_TIME_COUNT
WEB_CONNECT_MAX_COUNT = 10 #默认重连次数
class SockMangager(Abstract):
def __init__(self):
EventMesh.subscribe("send_unbind_dev_to_iot",self.send_unbind_dev_to_iot)
EventMesh.subscribe("set_location_timer",self.set_location_timer)
EventMesh.subscribe("post_device_state",self.post_device_state)
+ EventMesh.subscribe("send_power_init_data",self.send_power_init_data)
# count = 0
# while True:
# count += 1
self.resolver = resolver
def hr_report_event(self, *args, **kwargs):
EventMesh.publish("publish_AI_btnInfo",{"func":self.hr_report_event_cb}) #self.connect_iot_websocket()
+ def send_power_init_data(self,event=None,msg=None):
+ self.hr_report_event_cb()
+
def hr_report_event_cb(self):
"""电池平均值"""
temp = Power.getVbatt()
if EventMesh.publish("get_sos_flag") != None:
if EventMesh.publish("get_sos_flag") == 1:
EventMesh.publish(constants.EVENT.SYSTEM_UP)#唤醒休眠
+
EventMesh.publish("AI_alarm_start") #检查是否有闹钟需要提醒
EventMesh.publish("AI_schedule_open")#检查日程是否需要提醒
# self.alarm_test()
self.timerLocation+=DEFINE_TIME_COUNT
if self.timerLocation >= self.locate_duration:
self.timerLocation= 0
-
EventMesh.publish(constants.EVENT.START_LOCATION,WEB_CMD_ENUM.POST_LOCATION_S_CMD) #定位上报
else:
self.timerLocation= 0
print("self.iot_protocol_client %d self.start_voice_flag:%d",self.iot_protocol_client,self.start_voice_flag)
if self.iot_protocol_client != None:
if self.timer_id == 0:
- self.hr_report_timer.start(DEFINE_TIME_COUNT*1000, 1, self.hr_report_event)
+ # self.hr_report_timer.start(DEFINE_TIME_COUNT*1000, 1, self.hr_report_event)
self.timer_id=1
else:
print("没有token!!!!!!!!!!")