修改最新服务器地址
authorazao <821478748@qq.com>
Mon, 22 Dec 2025 01:38:51 +0000 (09:38 +0800)
committerazao <821478748@qq.com>
Mon, 22 Dec 2025 01:38:51 +0000 (09:38 +0800)
一代接收二代功能,一二代代码整合

2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ai_VC.py
2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py

index 9836814..0c6e485 100644 (file)
@@ -46,8 +46,8 @@ PRESS_AUDIO_MODE = 0 #是按键音 0 是使用音频文件
 #dev_type = "7PIN_BK_coze"#k扣子小瑞
 #dev_type = "7PIN_BK_EU"#英文小瑞
 #dev_type = "7PIN_coze"#柒牌扣子
-# dev_type = "7PIN"#柒牌
-dev_type = "7PIN_1_5"#柒牌1.5
+dev_type = "7PIN"#柒牌
+# dev_type = "7PIN_1_5"#柒牌1.5
 #dev_type = 'momo'#食梦貘
 #dev_type = 'sjgq'#四季甘泉
 #dev_type = 'szbst'#深圳百事通
@@ -1808,6 +1808,8 @@ class device_res_author(Abstract):
                 url = "http://dmp-global.raisound.com/bz-api/dev/time"
             else:
                 url = "https://qipai-dev.dobell.top/qp-dmp-api/dev/time"
+                url = "https://dmp-api.qipai.com/qp-dmp-api/dev/time"
+                # url = "http://dmp.raisound.com/bz-api/dev/time"
             response = request.get(url,timeout=5)
             data = response.json()
             print("dev_NTP:{}".format(data))
@@ -1938,7 +1940,8 @@ class device_res_author(Abstract):
                     url = "http://dmp-global.raisound.com/bz-api/dev/auth/active"
                 else:
                     url = "https://qipai-dev.dobell.top/qp-dmp-api/dev/auth/active"
-                    # url = "http://dmp-dev.raisound.com/bz-api/dev/auth/active"
+                    url = "https://dmp-api.qipai.com/qp-dmp-api/dev/auth/active"
+                    # url = "http://dmp.raisound.com/bz-api/dev/auth/active"
                 data =ujson.dumps(data)
                 response = None
                 response_result = 0
@@ -2051,7 +2054,8 @@ class device_res_author(Abstract):
                     sign_url = "http://dmp-global.raisound.com/bz-api/dev/auth/sign_in" #登入地址
                 else:
                     sign_url = "https://qipai-dev.dobell.top/qp-dmp-api/dev/auth/sign_in" #登入地址
-                    # sign_url = "http://dmp-dev.raisound.com/bz-api/dev/auth/sign_in" #登入地址
+                    sign_url = "https://dmp-api.qipai.com/qp-dmp-api/dev/auth/sign_in"
+                    # sign_url = "http://dmp.raisound.com/bz-api/dev/auth/sign_in" #登入地址
                 #获取验证码
                 #url = "http://dmp.qipai.com.cn:30461/dev/device/bind-code/860132066060377"
                 # token = EventMesh.publish("get_dev_token")
@@ -2124,6 +2128,8 @@ class device_res_author(Abstract):
                     url = "http://dmp-global.raisound.com/bz-api/dev/iccid?deviceId={}&iccid={}".format(modem.getDevImei(),iccid)
                 else:
                     url = "https://qipai-dev.dobell.top/qp-dmp-api/dev/iccid?deviceId={}&iccid={}".format(modem.getDevImei(),iccid)
+                    url = "https://dmp-api.qipai.com/qp-dmp-api/dev/iccid?deviceId={}&iccid={}".format(modem.getDevImei(),iccid)
+                    # url = "http://dmp.raisound.com/bz-api/dev/iccid?deviceId={}&iccid={}".format(modem.getDevImei(),iccid) #北科地址
                 print("{} H:{}".format(url,headers_T))
                 response = request.post(url,headers = headers_T)
                 if response.status_code == 200:
@@ -2161,9 +2167,10 @@ class device_res_author(Abstract):
             if dev_type == "7PIN_BK_EU":#英文小瑞
                 dev_tokenip = "http://dmp-global.raisound.com/bz-api/dev/auth/token" #设备新令牌更新地址
             else:
-                dev_tokenip = "http://dmp-dev.raisound.com/bz-api/dev/auth/token" #设备新令牌更新地址
                 dev_tokenip = "https://qipai-dev.dobell.top/qp-dmp-api/dev/auth/token" #设备新令牌更新地址
-                
+                dev_tokenip = "https://dmp-api.qipai.com/qp-dmp-api/dev/auth/token"
+                # dev_tokenip = "http://dmp.raisound.com/bz-api/dev/auth/token" #设备新令牌更新地址
+                     
             token = self.dev_token
             if token == None:
                 token = ""
@@ -2238,7 +2245,7 @@ class OTA():
             #     url = "http://ota.qipai.com/bz-cmp-api/api/task?deviceId={}&sourceVersion={}".format(modem.getDevImei(),sourceVersion)
             # else:
             url = "https://qipai-dev.dobell.top/qp-dmp-api/ota/task?deviceId={}&sourceVersion={}".format(modem.getDevImei(),sourceVersion)
-
+            url = "https://dmp-api.qipai.com/qp-dmp-api/ota/task?deviceId={}&sourceVersion={}".format(modem.getDevImei(),sourceVersion)
             print(url)
             response = request.get(url,timeout=5)
             if response.status_code == 200:
@@ -2308,7 +2315,7 @@ class OTA():
             #     url = "http://ota.qipai.com/bz-cmp-api/api/task?deviceId={}&sourceVersion={}".format(modem.getDevImei(),sourceVersion)
             # else:
             url = "https://qipai-dev.dobell.top/qp-dmp-api/ota/task?deviceId={}&sourceVersion={}".format(modem.getDevImei(),sourceVersion)
-
+            url = "https://dmp-api.qipai.com/qp-dmp-api/ota/task?deviceId={}&sourceVersion={}".format(modem.getDevImei(),sourceVersion)
             print(url)
             response = request.get(url,timeout=5)
             if response.status_code == 200:
@@ -2402,10 +2409,11 @@ class OTA():
             url =None
             if dev_type == "7PIN_BK_EU":#英文小瑞
                 url = "http://dmp-global.raisound.com/bz-api/ota/result?deviceId={}&currentVersion={}".format(modem.getDevImei(),currentVersion)
-            if dev_type == "7PIN" or dev_type == "7PIN_1_5" or dev_type == "7PIN_coze":#柒牌
-                url = "http://ota.qipai.com/bz-cmp-api/api/result?deviceId={}&currentVersion={}".format(modem.getDevImei(),currentVersion)
-            else:
-                url = "https://qipai-dev.dobell.top/qp-dmp-api/ota/result?deviceId={}&currentVersion={}".format(modem.getDevImei(),currentVersion)
+            # if dev_type == "7PIN" or dev_type == "7PIN_1_5" or dev_type == "7PIN_coze":#柒牌
+            #     url = "http://ota.qipai.com/bz-cmp-api/api/result?deviceId={}&currentVersion={}".format(modem.getDevImei(),currentVersion)
+            # else:
+            url = "https://qipai-dev.dobell.top/qp-dmp-api/ota/result?deviceId={}&currentVersion={}".format(modem.getDevImei(),currentVersion)
+            url = "https://dmp-api.qipai.com/qp-dmp-api/ota/result?deviceId={}&currentVersion={}".format(modem.getDevImei(),currentVersion)
             print(url)
             response = request.post(url,timeout=5)
             if response.status_code == 200:
@@ -2438,6 +2446,8 @@ class OTA():
                     url = "http://dmp-global.raisound.com/bz-api/dev/iccid?deviceId={}&iccid={}".format(modem.getDevImei(),iccid)
                 else:
                     url = "https://qipai-dev.dobell.top/qp-dmp-api/dev/iccid?deviceId={}&iccid={}".format(modem.getDevImei(),iccid)
+                    url = "https://dmp-api.qipai.com/qp-dmp-api/dev/iccid?deviceId={}&iccid={}".format(modem.getDevImei(),iccid)
+                    # url = "http://dmp.raisound.com/bz-api/dev/iccid?deviceId={}&iccid={}".format(modem.getDevImei(),iccid) #北科地址
                 print("{} H:{}".format(url,headers_T))
                 response = request.post(url,headers = headers_T,timeout=5)
                 if response.status_code == 200:
@@ -2520,6 +2530,8 @@ class AI_VC(Abstract):
         self.wait_first_flag = 0#是否进入未读判定(只播报一次)
         self.wait_first_timer = osTimer()#如果播放未读留言的时候未读则不要播放了
         self.wait_first_cnt = 0
+
+        self.wait_sort = 0#未读留言正在播第几条
         EventMesh.subscribe("play_tts",self.play_tts)
         EventMesh.subscribe("play_new_voice",self.play_new_voice)
         EventMesh.subscribe("play_his_voice",self.play_his_voice)
@@ -2603,7 +2615,7 @@ class AI_VC(Abstract):
                 # self.server_ip="118.145.158.207:22082"
                 # self.server_ip="118.145.158.207:22080/22087"
                 #self.server_ip="ai.qipai.com"
-                self.server_ip="115.190.35.37:22082"
+                self.server_ip="dmp-api.qipai.com/qp-amp-api"
                 #self.server_ip="sevenpin1.qipai.com.cn:22082"
             elif dev_type == "G10":
                 self.server_ip="115.190.94.208:22080"
@@ -2846,6 +2858,13 @@ class AI_VC(Abstract):
         self.commands = []
         if self.VC_TTS_volume == None:
             self.VC_TTS_volume = 100
+        #可ota配置的参数变量
+        self.emotion = EventMesh.publish("get_storage_config","emotion")#情绪
+        if self.emotion == None:
+            self.emotion = ""
+        self.ota_update_notice = EventMesh.publish("get_storage_config","ota_update_notice")#OTA升级提示语
+        if self.ota_update_notice == None:
+            self.ota_update_notice = "" 
         self.AI_audio_queue_thread_id = 0
         self.AI_audio_queue_thread_lock = 0
         self.AI_VC_send_data_queue_thread_id = 0
@@ -3006,7 +3025,10 @@ class AI_VC(Abstract):
             cat1_ota_flag = self.ai_OTA.min_sys_ota()
             if bt_ota_flag==1 or cat1_ota_flag == 1:
             #if 0:    
-                self.AI_TTS_str = "检测到有新版本需要升级啦!升级时可千万别断电或乱按哦,升级完成后设备会自动重启,重启就代表升级成功"
+                if self.ota_update_notice != "":
+                    self.AI_TTS_str = self.ota_update_notice
+                else:
+                    self.AI_TTS_str = "检测到有新版本需要升级啦!升级时可千万别断电或乱按哦,升级完成后设备会自动重启,重启就代表升级成功"
                 EventMesh.publish("publish_AI_btnInfo",{"func":self.AI_VC_start}) 
                 self.Close_flag = 1
             # if self.ai_OTA.min_sys_ota()==2:
@@ -3179,13 +3201,23 @@ class AI_VC(Abstract):
                                         if "outbound_attributess_provider" in data["data"]:
                                             self.outbound_attributess_provider = data["data"]["outbound_attributess_provider"]
                                             EventMesh.publish("set_storage_config",["outbound_attributess_provider",self.outbound_attributess_provider])
+                                            print("配置outbound_attributess_provider成功")
                                         if "inbound_attributess_provider" in data["data"]:
                                             self.inbound_attributess_provider = data["data"]["inbound_attributess_provider"]
                                             EventMesh.publish("set_storage_config",["inbound_attributess_provider",self.inbound_attributess_provider])
+                                            print("配置inbound_attributess_provider成功")
                                         if "speech_rate" in data["data"]:
                                             self.speech_rate = int(data["data"]["speech_rate"])
                                             EventMesh.publish("set_storage_config",["speech_rate",self.speech_rate])
                                             print("配置speech_rate成功")
+                                        if "emotion" in data["data"]:
+                                            self.emotion = data["data"]["emotion"]
+                                            EventMesh.publish("set_storage_config",["emotion",self.emotion])
+                                            print("配置emotion成功")
+                                        if "ota_update_notice" in data["data"]:
+                                            self.ota_update_notice =data["data"]["ota_update_notice"]
+                                            EventMesh.publish("set_storage_config",["ota_update_notice",self.ota_update_notice])
+                                            print("配置ota_update_notice成功")
                     except Exception as e:
                             usys.print_exception(e)
             else:
@@ -4332,6 +4364,7 @@ class AI_VC(Abstract):
                                     print("未读列表为空")
                             if self.pwk_cnt_voice == 0:#积累的留言已经全部播完
                                 self.pwk_notice_flag = 0
+                                self.wait_sort = 0
                                 self.wait_first_flag = 0#让下次未读播放提示恢复
                                 self.voice_notice = 1#开启回复
                                 EventMesh.publish("set_storage_config",["is_noread_voice",0])
@@ -5407,6 +5440,7 @@ class AI_VC(Abstract):
                         "bit_rate": 16,
                         "channel": 1,
                         "volume": self.VC_TTS_volume,
+                        "emotion": self.emotion,
                         #"voice": "7426720361732980745",
                         "voice": voice,#音色
                         "speech_rate": self.speech_rate,#语速
@@ -5793,7 +5827,7 @@ class AI_VC(Abstract):
         elif "内蒙古话" in msg:
             self.VC_TTS_voice_key = "内蒙古话" 
         EventMesh.publish("set_storage_config",["VC_TTS_voice_key",self.VC_TTS_voice_key])
-        tts_play_str = "声音改为{}".format(voice)
+        tts_play_str = "声音已改为{}".format(voice)
         EventMesh.publish("play_tts",[tts_play_str,0])
 
     #闹钟的url播放接口
@@ -5844,10 +5878,13 @@ class AI_VC(Abstract):
                     EventMesh.publish("set_app_new_voice_flag",0)
                     print("voice_add_to = {}".format(self.pwk_cnt_voice))
                 print("self.pwk_notice_flag = {}".format(self.pwk_notice_flag))
-                if self.pwk_cnt_voice >0:
+                if self.pwk_cnt_voice >1:
                     if self.pwk_notice_flag == 0:
-                        tts_str = "您有" + str(self.pwk_cnt_voice) + "条语音留言,10秒内按下中间键可以收听"
+                        tts_str = "您有" + str(self.pwk_cnt_voice) + "条未读语音留言,10秒内按下中间键可以收听"
                         EventMesh.publish("play_tts",[tts_str,1])
+                elif self.pwk_cnt_voice == 1:
+                    tts_str = "您有1条语音留言,10秒内按下中间键可以收听"
+                    EventMesh.publish("play_tts",[tts_str,1])
             if is_close_VC != None:
                 self.Close_flag = is_close_VC
             if self.AI_VC_send_data_queue.empty()!=True:
@@ -5914,6 +5951,9 @@ class AI_VC(Abstract):
                 EventMesh.publish("play_tts",[tts_play_str,1])  
                 # self.wait_first_timer.start(1000,1,self.noread_wait_vocie)
                 self.wait_first_flag = 1
+            self.wait_sort += 1
+            tts_play_str = "第"+str(self.wait_sort)+"条" 
+            EventMesh.publish("play_tts",[tts_play_str,1])
             if new_voice_url != "":
                 self.recv_voice = 1#收到留言
                 print("未读留言查看")
index 6dfbd83..d2a7ac0 100644 (file)
@@ -1452,12 +1452,13 @@ class SockMangager(Abstract):
         try:
             if token != None:
                 self.connect_web_timer_count = 0
-                url_t = "wss://qipai-dev.dobell.top/qp-iot-api/ws-hub/dev/v1?qp-dt={}".format(token)
+                url_t = "wss://dmp-api.qipai.com/qp-iot-api/ws-hub/dev/v1?qp-dt={}".format(token)
                 try:
                     self.iot_protocol_client=uwebsocket.Client.connect(url_t, debug=True)
                     self.reconnect_count=0
                 except Exception as e:
-                    print("再次连接")
+                    print("再次连接,iot连接报错是")
+                    print(e)
                     self.reconnect_count+=1
                     EventMesh.publish("publish_AI_btnInfo",{"func":self.connect_iot_websocket}) #self.connect_iot_websocket()
                     return