self.PIN_wakeup_bt.write(1)
def wakeup_BT(self,event=None,msg=None):#4G唤醒蓝牙
-
+ print("wakeup_BT!!!!!!!!!!!!!!!")
+ print("wakeup_BT!!!!!!!!!!!!!!!")
+ print("wakeup_BT!!!!!!!!!!!!!!!")
count = 150
while(True):
count-=1
self.aud.setVolume(self.VC_TTS_volume //10)
EventMesh.publish("set_storage_config",["VC_TTS_volume",self.VC_TTS_volume])
self.AI_TTS_str = "了解,音量已经调整,当前音量是{}".format(self.VC_TTS_volume)
+ EventMesh.publish("post_device_state")
return 0
if text.find("音量增大") != -1:
+ print("self.VC_TTS_volume add:{}".format(self.VC_TTS_volume))
self.VC_TTS_volume += 10
if self.VC_TTS_volume > 100:
else:
self.aud.setVolume(self.VC_TTS_volume //10)
EventMesh.publish("set_storage_config",["VC_TTS_volume",self.VC_TTS_volume])
-
+ EventMesh.publish("post_device_state")
self.AI_TTS_str = "了解,音量已经调大了,当前音量是{}".format(self.VC_TTS_volume)
return 0
if text.find("音量减小") != -1:
+ print("self.VC_TTS_volume end:{}".format(self.VC_TTS_volume))
self.VC_TTS_volume -= 10
if self.VC_TTS_volume < 0:
self.VC_TTS_volume = 0
else:
self.aud.setVolume(self.VC_TTS_volume //10)
EventMesh.publish("set_storage_config",["VC_TTS_volume",self.VC_TTS_volume])
-
+ EventMesh.publish("post_device_state")
self.AI_TTS_str = "好嘞,音量已经调小了,当前音量是{}".format(self.VC_TTS_volume)
return 0
else:
self.aud.setVolume(self.VC_TTS_volume //10)
EventMesh.publish("set_storage_config",["VC_TTS_volume",self.VC_TTS_volume])
+ EventMesh.publish("post_device_state")
#EventMesh.publish("audio_montage_play",["peizhichenggong.mp3"])
#self.aud.play(1,0,'U:/static/peizhichenggong.mp3')#配置成功
self.AI_TTS_str = "配置成功,当前音量 {}".format(self.VC_TTS_volume)
else:
self.aud.setVolume(self.VC_TTS_volume //10)
EventMesh.publish("set_storage_config",["VC_TTS_volume",self.VC_TTS_volume])
+ EventMesh.publish("post_device_state")
#EventMesh.publish("audio_montage_play",["peizhichenggong.mp3"])
#self.aud.play(1,0,'U:/static/peizhichenggong.mp3')#配置成功
self.AI_TTS_str = "配置成功,当前音量 {}".format(self.VC_TTS_volume)
if self.call_state == 0:
if self.sos_config != {}:
if "enableSos" in self.sos_config:
- enableSos = self.sos_config["enableSos"]
- print("enableSos{} {}".format(enableSos,self.sos_config["enable110"]))
- if enableSos == "1":
- if "enable110" in self.sos_config:
- p110 = self.sos_config["enable110"]
- if p110 == "0":
-
- self.phone110112 = "110"
- self.sos_timer1.start(2000, 0, self.phone110112_cb)
- elif p110 == "1":
- self.phone110112 = "112"
- self.sos_timer1.start(2000, 0, self.phone110112_cb)
+ # enableSos = self.sos_config["enableSos"]
+ if "enable110" in self.sos_config:
+ p110 = self.sos_config["enable110"]
+ if p110 == "0":
+
+ self.phone110112 = "110"
+ self.sos_timer1.start(2000, 0, self.phone110112_cb)
+ elif p110 == "1":
+ self.phone110112 = "112"
+ self.sos_timer1.start(2000, 0, self.phone110112_cb)
def sos_call_out_phone(self, msg):#电话拨出去
if self.call_state == 0:
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)
+ EventMesh.subscribe("post_device_state",self.post_device_state)
# count = 0
# while True:
# count += 1
self.bt_connect_list = []
self.new_voice_list = []
self.connect_web_timer.start(2000,0,self.iot_web_connect_timerCb)
-
+ def post_device_state(self,event,msg): #上报设备状态
+ device_state=EventMesh.publish("GET_IOT_WEB_SEND_CMD",WEB_CMD_ENUM.POST_DEVICE_STATE_S_CMD)
+ print("device_state{}".format(device_state))
+ EventMesh.publish(WEB_CMD_ENUM.POST_DEVICE_STATE_S_CMD,device_state) #上报设备状态
def set_location_timer(self,event,msg):
self.locate_duration_c=msg