EventMesh.publish("stop_AI_record")
if self.sos_flag == 0:
self.sos_flag = 1
+ tts_str = "正在启动sos呼叫中"
+ EventMesh.publish("stop_voice_record") #电话优先级最高
+ EventMesh.publish("stop_AI_record")
+ EventMesh.publish("play_tts",[tts_str,1]) #播放tts闹钟文本内容
+ self.sos_timer1.start(5000, 0, self.call_sos_cb)
+
+ def call_sos_cb(self,*argc):
sos_flag = self.sos_flag
EventMesh.debug_log('voicecall sos_flag',sos_flag)
if sos_flag == 0 :
EventMesh.debug_log('voicecall disconnect end !!!')
self.close_call_timer()
self.call_state = 0
- self.set_sos_info_call(1,1)
+ EventMesh.publish("set_sos_info_call")
pass
self.call_state = 0
#再次拨打下一个电话号码
self.voice_id = "0"
self.bt_connect_list = []
self.new_voice_list = []
+ self.locate_duration_c = 0
+ self.locate_duration_c = EventMesh.publish("get_storage_config","locate_duration_time") #获取定位频率
+ if self.locate_duration_c == None:
+ self.locate_duration_c=0
EventMesh.subscribe("REPORT_ALARM_TO_IOT",self.report_alarm_to_iot)
def report_alarm_to_iot(self,event,msg):
EventMesh.subscribe("get_play_new_voice_state",self.get_play_new_voice_state)
EventMesh.subscribe("send_bt_connect_state_to_iot",self.send_bt_connect_state_to_iot)
EventMesh.subscribe("send_unbind_dev_to_iot",self.send_unbind_dev_to_iot)
+ EventMesh.subscribe("set_location_timer",self.set_location_timer)
# count = 0
# while True:
# count += 1
self.new_voice_list = []
self.connect_web_timer.start(2000,0,self.iot_web_connect_timerCb)
+ def set_location_timer(self,event,msg):
+ self.locate_duration_c=msg
def save_bt_connect_list(self,event,msg):
print("msg:{}".format(msg))
bat_total_value = bat_total_value//curr_count#一分钟更新一次电量 10个平均值
# EventMesh.publish("AI_schedule_open")#读取闹钟数组
# print("AI_schedule_open!!!")
+ 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.reconnect_count = 0
EventMesh.publish("publish_AI_btnInfo",{"func":self.hr_report_publish_event,"data":0})
- locate_duration_c = EventMesh.publish("get_storage_config","locate_duration_time") #获取定位频率
- if locate_duration_c == None:
+
+ if self.locate_duration_c == None:
self.timerLocation = 0
else:
- if locate_duration_c != 0:
+ if self.locate_duration_c != 0:
self.timerLocation+=DEFINE_TIME_COUNT
- if self.timerLocation >= locate_duration_c:
+ if self.timerLocation >= self.locate_duration_c:
self.timerLocation= 0
print("timerLocation")
EventMesh.publish(constants.EVENT.START_LOCATION,WEB_CMD_ENUM.POST_LOCATION_S_CMD) #定位上报
# "data":300,0表示关
# }
if "data" in msg:
- locate_duration_time = msg["data"]
- EventMesh.publish("set_storage_config",["locate_duration_time",int(locate_duration_time)])
+ locate_duration_time = int(msg["data"])
+ EventMesh.publish("set_storage_config",["locate_duration_time",locate_duration_time])
+ EventMesh.publish("set_location_timer",locate_duration_time)
locate_duration_c = EventMesh.publish("get_storage_config","locate_duration_time")
print("locate_duration_c:{}".format(locate_duration_c))
# "voiceId":"音色ID,火山音色或者科大讯飞音色ID"
# }
# }
- # {'msg': '.', 'data': {'vadDuration': 600, 'provider': None, '': None, 'speed': '1.0', 'voiceId': ''}, 'ts': 1755593006265, 'cmd': 'chat_config'}
+ # {'msg': '测试聊天配置.', 'data': {'botName': '柒乐乐', 'vadDuration': 600, 'speed': '1.0', 'provider': 'iflytek', 'voiceId': 'x3_linlin'},
+ # 'ts': 1755600807553, 'cmd': 'chat_config'}
+
if "data" in msg:
data = msg["data"]
speed = data["speed"]
vadDuration = data["vadDuration"]
voiceId = data["voiceId"]
+ provider = data["provider"]
if speed != None:
if len(speed) != 0:
EventMesh.publish("SET_SPEECH_RATE",speed)
- if voiceId != None:
- if len(voiceId) != 0:
- EventMesh.publish("set_vad_silence",voiceId)
+ if vadDuration != None:
+ if len(vadDuration) != 0:
+ EventMesh.publish("set_vad_silence",vadDuration)
+ if provider != None:
+ if len(provider) != 0:
+ pass
+ # EventMesh.publish("set_vad_silence",vadDuration)
EventMesh.publish(WEB_CMD_ENUM.CHAT_CONFIG_S)
#获取AI对话音色配置
class IOTWeb_get_chat_configProtoCol(ProtoCol):