self.KeyAI_status = self.extint_AI.read_level()
self.KeyAI_timer_count +=1
if self.KeyAI_timer_count >= 10*1 : #长按1s
- self.KeySOS_timer_count = 0
if self.KeyAI_long_press == 0:
self.KeyAI_long_press = 1
#EventMesh.publish("AI_key_long_press")
EventMesh.publish("publish_AI_btnInfo",{"func":self.AI_key_long_press})
elif self.KeyAI_timer_count >= 10*8:#关机
- self.KeySOS_timer_count=0
if dev_type == 'jswm' or dev_type == 'jswm_BOX':
EventMesh.publish("audio_montage_play",["zhengzaiguanji.mp3"])
#self.aud.play(1,0,'U:/static/zhengzaiguanji.mp3')#关机音频
def AI_key_release(self):
print("AI_key_release")
self.KeySOS_timer_count +=1
- print("self.KeySOS_timer_count:{}".format(self.KeySOS_timer_count))
+ print("self.KeySOS_timer_count:{} {}".format(self.KeySOS_timer_count,self.KeySOS_timer_flag))
if self.KeySOS_timer_flag == 0:
self.KeySOS_timer_flag = 1
- self.KeySOS_timer_count=0
- self.KeySOS_timer.start(3000, 0, self.KeySos_timer_cb)
+ self.KeySOS_timer.start(5000, 0, self.KeySos_timer_cb)
EventMesh.publish("AI_key_release")
return
if self.call_state != 0:
return
- EventMesh.publish("stop_voice_record") #电话优先级最高
- 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)
+ if len(self.sos_list) > 0:
+ EventMesh.publish("stop_voice_record") #电话优先级最高
+ EventMesh.publish("stop_AI_record")
+ if self.sos_flag == 0:
+ self.sos_flag = 1
+ tts_str = "正在呼叫中"
+ 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)
+ else:
+ tts_str = "未设置号码"
+ EventMesh.publish("stop_voice_record") #电话优先级最高
+ EventMesh.publish("stop_AI_record")
+ EventMesh.publish("play_tts",[tts_str,1]) #播放tts闹钟文本内容
+ self.sos_flag = 0
+ self.num = 0
+ self.call_state = 0
+ self.num=0 #不管有没有拨打sos都清除
+ self.num_len = 0
+ self.sos_flag = 0
def call_sos_cb(self,*argc):
sos_flag = self.sos_flag