W9:
authordxy15521469561 <1731678236@qq.com>
Wed, 17 Jul 2024 06:15:21 +0000 (14:15 +0800)
committerdxy15521469561 <1731678236@qq.com>
Wed, 17 Jul 2024 06:15:21 +0000 (14:15 +0800)
修改喇叭IO

2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/protocol.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/ui.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/ui_setting.py
2.sdk-ZY/project/W9/sdk/services/microPython/ports/quectel/core/ui_video.py

index ea00b68..544e9fa 100644 (file)
@@ -234,60 +234,74 @@ class SockManager(Abstract):
                 url = "http://app.api.thisiot.com/dev/device/check?imei={}&bid={}&sonce={}&sign={}".format(imei,pid_data,sonce_data,sign_data)
 
                 # print("url:{}".format(url))
-                response = request.get(url)
-                data_tmp ={}
+                data_tmp = {}
+                connect_flag = 0
+                try:
+                    response = request.get(url)
+                    connect_flag = 1
+                except Exception as e:
+                    usys.print_exception(e)
+                
                 # d_server_addr = "device.miwitracker.com"
                 # d_server_port = 8505
                 # d_md5_key = ""
                 # d_PID = "3G"
                 # response.content = {'protocolType': '', 'host': 'device.miwitracker.com', 'secretKey': '', 'port': 8505, 'bid': '3G', 'extJsonStr': ''}
                 # response.status_code=200
-                print("test-{}".format(response.status_code))
-                if response.status_code == 200:
-                    content = response.content
-                    c = next(content)
-                    # "api.xcloudtech.com"
-                    # d_server_port = 9000
-                    jsload_data =  ujson.loads(c)
-                    print("jsload_data-{}".format(jsload_data))
-                    # jsload_data = {'data':'111','protocolType':'', 'host':'device.miwitracker.com', 'secretKey': 'bZld0ALsZTt15tKEZhOlLPgbsO75BLTP', 'port':8505, 'bid': '3G', 'extJsonStr': ''}
-                    # ujson.loads(c)
-                    
-                    if "success" in jsload_data:
-                        success = jsload_data["success"]
-                        if success == True:#合法设备
-                            if "data" in jsload_data:
-                                data_tmp = jsload_data["data"]#返回的数据 
-                                print("data_tmp:{}".format(data_tmp))
-                                code = jsload_data["code"]
-                                if code == 20000:#合法的设备
-                                    protocloType = data_tmp["protocolType"]#协议类型
-                                    host = data_tmp["host"]#服务骑地址
-                                    secretKey = data_tmp["secretKey"]#
-                                    pid = data_tmp["bid"]#产品型号
-                                    port = data_tmp["port"]#端口号
-
-                                   
-
-                                    if host != '' and (port != '' and port != -1):
-                                        if host != '':
-                                            self.server_addr = host
-                                            EventMesh.publish("set_ip",str(self.server_addr))
-                                        
-                                        if port != '' and port != -1:
-                                            self.server_port = port
-                                            EventMesh.publish("set_com",self.server_port)
-                                        EventMesh.publish("set_new_key", str(secretKey))#获取pid和key
-                                        EventMesh.publish("set_new_pid",str(pid))#获取pid和key
-                                        # self.reconnect_timer_cb()#重连设备
-                                        print("self.reconnect_flag",self.reconnect_flag)
-                                        self.reconnect_flag = 0
-                                        self.reconnect()#重连设备
+                print("connect_flag:{}\r\n".format(connect_flag))
+                if connect_flag == 1:
+                    print("response.status_code:{} connect_flag:{}\r\n".format(response.status_code,connect_flag))
+                    if response.status_code == 200:
+                        content = response.content
+                        c = next(content)
+                        # "api.xcloudtech.com"
+                        # d_server_port = 9000
+                        jsload_data =  ujson.loads(c)
+                        print("jsload_data-{}".format(jsload_data))
+                        # jsload_data = {'data':'111','protocolType':'', 'host':'device.miwitracker.com', 'secretKey': 'bZld0ALsZTt15tKEZhOlLPgbsO75BLTP', 'port':8505, 'bid': '3G', 'extJsonStr': ''}
+                        # ujson.loads(c)
+                        
+                        if "success" in jsload_data:
+                            success = jsload_data["success"]
+                            if success == True:#合法设备
+                                if "data" in jsload_data:
+                                    data_tmp = jsload_data["data"]#返回的数据 
+                                    print("data_tmp:{}".format(data_tmp))
+                                    code = jsload_data["code"]
+                                    if code == 20000:#合法的设备
+                                        protocloType = data_tmp["protocolType"]#协议类型
+                                        host = data_tmp["host"]#服务骑地址
+                                        secretKey = data_tmp["secretKey"]#
+                                        pid = data_tmp["bid"]#产品型号
+                                        port = data_tmp["port"]#端口号
+
+                                        if secretKey != '' and secretKey != -1:
+                                            EventMesh.publish("set_new_key", str(secretKey))#获取pid和key
+                                        if pid != '' and pid != -1:
+                                            EventMesh.publish("set_new_pid",str(pid))#获取pid和key
+
+                                        if host != '' and (port != '' and port != -1):
+                                            if host != '':
+                                                self.server_addr = host
+                                                EventMesh.publish("set_ip",str(self.server_addr))
+                                            
+                                            if port != '' and port != -1:
+                                                self.server_port = port
+                                                EventMesh.publish("set_com",self.server_port)
+                                           
+                                            # self.reconnect_timer_cb()#重连设备
+                                            print("self.reconnect_flag",self.reconnect_flag)
+                                            self.reconnect_flag = 0
+                                            self.reconnect()#重连设备
+                        self.publish_timer.stop()
+                        EventMesh.publish("set_server_state",1)#获取修改服务器状态
+                else:
                     self.publish_timer.stop()
-                    EventMesh.publish("set_server_state",1)#获取修改服务器状态
             else:
                 self.publish_timer.stop()
 
+
+
     def check(self, *args):
         if (not self.run_flag) or (self.connect_tmp == 0) : #7分钟无数据读取,则认为是掉线了
             print("tcp reconnect!!!!!!!!!!!!!!!!!!")
index 489ef26..6e16807 100644 (file)
@@ -3489,7 +3489,7 @@ class IncomingCallScreen(Screen):
     def call_timer_cb(self,e):
        EventMesh.publish("system_sleep_rest")#防止黑屏
        self.time_count+=1
-       if self.time_count % 6 == 0:
+       if self.time_count % 4 == 0:
             self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #播放来电铃声
 
     def answer_cb(self,e):
index cb072e1..29826af 100644 (file)
@@ -1284,7 +1284,7 @@ class PowerOnScreen(Screen):
         self.timer1 = osTimer()
         self.timer2 = osTimer()
         self.aud = audio.Audio(0)
-        self.aud.set_pa(Pin.GPIO29)
+        self.aud.set_pa(Pin.GPIO43)
         self.volum_size = 8
         check_volum = EventMesh.publish("get_storage_config","volum")
         if check_volum != None:
index feb0ae6..3f1ae9f 100644 (file)
@@ -1098,7 +1098,7 @@ class VedioShowScreen(Screen):#正在视频通话中
         # print("video call_state",call_state)
         if call_state != 5:
             self.time_out+=1
-            if self.time_out >= 60 or (call_state == 0 and self.time_out >= 2 and self.statu_open != 1):
+            if self.time_out >= 60 or (call_state == 0 and self.time_out >= 5 and self.statu_open != 1):
                 self.time_out = 0
                 self.timer.stop()
                 # print("video call_state",call_state)
@@ -1224,7 +1224,7 @@ class voiceInCallScreen(Screen):#语音通话打入中
 
     def post_processor_after_initialization(self):
         global voice_call_screen,voice_call_img,voice_call_name_label,voice_call_answer,voice_call_hangup  
-        self.call_timer.start(6000, 1, self.call_timer_cb)
+        self.call_timer.start(4000, 1, self.call_timer_cb)
         self.timeout = 0
         self.call_timer1.start(1*1000, 1, self.get_video_state)
         self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #播放来电铃声
@@ -1235,6 +1235,7 @@ class voiceInCallScreen(Screen):#语音通话打入中
         EventMesh.publish("publish_message_event_ui",{"func":self.get_video_state_cb,"data":0})
 
     def get_video_state_cb(self,data):
+        EventMesh.publish("system_sleep_rest")#防止黑屏
         call_state = jrtc.get_state()
         # print("vedio_incall",call_state)
         self.timeout+=1
@@ -1382,7 +1383,7 @@ class vedioCallingCallScreen(Screen):#视频通话打入中
 
     def post_processor_after_initialization(self):
         global vedio_call_screen,vedio_call_img,vedio_call_name_label,vedio_call_answer,vedio_call_hangup  
-        self.call_timer.start(6000, 1, self.call_timer_cb)
+        self.call_timer.start(4000, 1, self.call_timer_cb)
         self.timeout = 0
         self.call_timer1.start(1*1000, 1, self.get_video_state)
         self.aud.play(1, 1, 'U:/static/audio_audio_haixiu.mp3')  #播放来电铃声
@@ -1394,6 +1395,7 @@ class vedioCallingCallScreen(Screen):#视频通话打入中
         EventMesh.publish("publish_message_event_ui",{"func":self.get_video_state_cb,"data":0})
 
     def get_video_state_cb(self,data):
+        EventMesh.publish("system_sleep_rest")#防止黑屏
         call_state = jrtc.get_state()
         # print("vedio_incall",call_state)
         self.timeout+=1
@@ -1590,7 +1592,7 @@ class videoOutCallScreen(Screen):#正在拨号中...未打出
             self.second_count += 1
             self.show_time()
 
-        if call_state != 5:#未接通 1分钟未接通挂断或者 接通后app 网络不好也主动手表挂断
+        if call_state != 5 :#未接通 1分钟未接通挂断或者 接通后app 网络不好也主动手表挂断
             self.time_count+=1
             if self.time_count >= 1*60 or (call_state == 0 and self.time_count >= 5 and self.answer != 1):
                 self.time_count = 0