From: dxy <1731678236qq.com> Date: Thu, 21 Aug 2025 06:08:13 +0000 (+0800) Subject: AI对话的音量调整同步到iot X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=2cb703771345ccabb55e078debeba0f6d492a483;p=mirrors%2FASR1603_G5.git AI对话的音量调整同步到iot --- diff --git a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ai_VC.py b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ai_VC.py index 7e555757..552993ef 100644 --- a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ai_VC.py +++ b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ai_VC.py @@ -993,7 +993,9 @@ class AI_dev(Abstract): 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 @@ -3654,8 +3656,10 @@ class AI_VC(Abstract): 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: @@ -3664,11 +3668,12 @@ class AI_VC(Abstract): 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 @@ -3678,7 +3683,7 @@ class AI_VC(Abstract): 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 @@ -3932,6 +3937,7 @@ class AI_VC(Abstract): 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) @@ -3947,6 +3953,7 @@ class AI_VC(Abstract): 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) diff --git a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py index 66387134..9b91104a 100644 --- a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py +++ b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py @@ -973,18 +973,16 @@ class sosInfoCallManager(Abstract): 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: @@ -1279,6 +1277,7 @@ class SockMangager(Abstract): 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 @@ -1300,7 +1299,10 @@ class SockMangager(Abstract): 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