From: azao <821478748@qq.com> Date: Fri, 14 Nov 2025 04:51:03 +0000 (+0800) Subject: 添加小程序控制会议部分 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=67abb8965a23a494134386845b8adacf27d13696;p=mirrors%2FASR1603_G5.git 添加小程序控制会议部分 --- 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 65c60223..6d70edb9 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 @@ -3186,18 +3186,18 @@ class AI_VC(Abstract): pass def come_trans_mode(self, event=None, msg = None): if self.trans_flag == 0: #还是为0就提示进入AI翻译模式 - EventMesh.publish("send_trans_come_flag_to_iot")#退出翻译 + EventMesh.publish("send_trans_come_flag_to_iot")#进入翻译 self.trans_flag=1 exit_tts ="已进入AI翻译模式" EventMesh.publish("play_tts",[exit_tts,1]) pass def exit_trans_mode(self, event=None, msg = None): - if self.trans_flag == 1: #还是为1就提示已退出AI翻译模式 - EventMesh.publish("send_trans_end_flag_to_iot")#退出翻译 - self.trans_flag=0 + if self.trans_flag == 1: #还是为1就提示已退出AI翻译模式 EventMesh.publish("stop_voice_record") #关闭语音录音 exit_tts ="已退出AI翻译模式" EventMesh.publish("play_tts",[exit_tts,1]) + self.trans_flag=0 + EventMesh.publish("send_trans_end_flag_to_iot")#退出翻译 pass def exit_voice_message_mode(self, event=None, msg = None): if self.voice_flag == 1: #还是为1就提示已退出会议纪要模式 @@ -5549,12 +5549,12 @@ class AI_VC(Abstract): battery = EventMesh.publish("get_battery") print("电量查询:{}".format(battery)) tts_play_str = "电量剩余百分之{}".format(battery) - EventMesh.publish("play_tts",[tts_play_str,0]) + EventMesh.publish("play_tts",[tts_play_str,1]) # print("电量!!!!!!!!!!!") elif "信号" in msg: signal = net.csqQueryPoll() tts_play_str = "当前信号{}".format(signal) - EventMesh.publish("play_tts",[tts_play_str,0]) + EventMesh.publish("play_tts",[tts_play_str,1]) # print("信号!!!!!!!!!!!") elif "卡号" in msg: # print("卡号!!!!!!!!!!!") @@ -5565,7 +5565,7 @@ class AI_VC(Abstract): tts_play_str = "当前卡号为:{}".format(iccid) else: tts_play_str = "卡号查询失败" - EventMesh.publish("play_tts",[tts_play_str,0]) + EventMesh.publish("play_tts",[tts_play_str,1]) #改变音色判断 def change_voice(self,event ,msg): voice = msg @@ -6005,8 +6005,11 @@ def num_str_to_chinese(num_str): chinese = '' # 逐位转换,拼接单位 for char in num_str: - digit = num_map[char] - chinese += digit + if char in num_map: + digit = num_map[char] + chinese += digit + else: + chinese += char return chinese diff --git a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/main_init.py b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/main_init.py index 913747bb..65e85053 100644 --- a/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/main_init.py +++ b/2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/main_init.py @@ -253,6 +253,7 @@ def main_init(): pcr.add_support(pro.IOTWeb_Nlp_ConfigProtoCol()) pcr.add_support(pro.IOTWeb_play_trans_TTSProtoCol())#播放下发翻译音频 pcr.add_support(pro.IOTWeb_come_transProtoCol())#接收小程序控制进入翻译 + pcr.add_support(pro.IOTWeb_appcontrol_meetProtoCol())#接收小程序控制进入会议 sm = pro.SockMangager() sm.add_support_resolver(pcr) 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 6de2da8e..599d901d 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 @@ -2673,6 +2673,8 @@ def ai_cmd_handle(cmd): EventMesh.publish("change_volume",volume) tts_play_str = "音量已经改为" + find EventMesh.publish("play_tts",[tts_play_str,0]) + elif "查看历史留言" in cmd :#当指令中有查看历史留言时,调用历史留言接口 + pass #NLP指令 class IOTWeb_Nlp_ConfigProtoCol(ProtoCol): @@ -2729,12 +2731,44 @@ class IOTWeb_come_transProtoCol(ProtoCol): def recv(self, event, msg): """ - @param event:上行下发push_music + @param event:上行下发translate_app_enter @param msg: 接收到的下行数据 """ - EventMesh.publish("come_trans_mode")#进入AI翻译纪要 + EventMesh.publish("come_trans_mode")#进入AI翻译 print("recv tts_audio_url{}".format(msg)) +#接收小程序控制进入会议 +class IOTWeb_appcontrol_meetProtoCol(ProtoCol): + """meet_control""" + TYPE = "meet_control" + def send(self, event, msg): + # print("translate_app_enter{}".format(msg)) + # 通过websocket发送到服务器端 + date_tmp = utime.localtime() + time_tmp = utime.mktime(date_tmp) + come_trans = { + "msg": "开始会议", + "data": None, + "cmd": "meet_begin", + "ts": 1761121597 + } + send_data = b'' + send_data = protocol_send_total_data(come_trans) + print("send_data translate_app_enter{}".format(send_data)) + EventMesh.publish("CHANNEL_IOT_WEB_SEND", send_data) + + def recv(self, event, msg): + """ + @param event:上行下发meeting_app_enter + @param msg: 接收到的下行数据 + """ + data = msg["data"]#判断是开启还是关闭 + if data == "begin": + EventMesh.publish("come_meet_mode")#进入会议纪要 + elif data == "end": + EventMesh.publish("exit_meet_mode")#退出会议纪要 + print("APP Meeting Control") + #翻译播放TTS class IOTWeb_play_trans_TTSProtoCol(ProtoCol): """tts_audio_url""" @@ -3571,16 +3605,17 @@ class IOTWeb_new_voice_msg_listProtoCol(ProtoCol): @param event:new_voice_msg_list @param msg: 接收到的下行数据 """ - new_voice_list = [] + new_voice = "" if "data" in msg: data = msg["data"] + print("data = {},data_type = {}".format(data,type(data))) for da in data: - new_voice_list.append(da) - - if len(new_voice_list) > 0: + new_voice = da + print("new_voice = {},new_voice_type = {}".format(new_voice,type(new_voice))) + if len(new_voice) > 0: pass - EventMesh.publish("set_play_new_voice_list",new_voice_list) + EventMesh.publish("set_play_new_voice_list",new_voice) EventMesh.publish("play_new_voice_list") EventMesh.publish(WEB_CMD_ENUM.NEW_VOICE_MSG_LIST_S)