跟新
authorp15692025051 <846603105@qq.com>
Mon, 18 Aug 2025 01:34:55 +0000 (09:34 +0800)
committerp15692025051 <846603105@qq.com>
Mon, 18 Aug 2025 01:34:55 +0000 (09:34 +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/main_init.py
2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py
2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ui.py

index 9c5f2e0..9d8b9dd 100644 (file)
@@ -538,7 +538,8 @@ class AI_UART():
         print("end_ota count:{}!!!".format(count))
 
     def bt_ota_run(self,event=None,msg=None):#通过串口给蓝牙升级
-        EventMesh.publish("wakeup_BT") 
+        # EventMesh.publish("wakeup_BT") 
+        EventMesh.publish(constants.EVENT.SYSTEM_UP)#唤醒休眠
         print("bt_ota_run!!!:url:{}".format(msg))
         print("bt_ota_run!!!")
         print("bt_ota_run!!!")
@@ -697,9 +698,12 @@ class AI_dev(Abstract):
         EventMesh.subscribe("Power_off",self.pwk_key_Long_Press)
         EventMesh.subscribe("wakeup_BT",self.wakeup_BT)
         EventMesh.subscribe("sleep_BT",self.sleep_BT)
-        EventMesh.subscribe("sys_sleep_cb",self.sys_sleep_cb)
+        EventMesh.subscribe("sys_sleep_cb",self.sys_sleep_cb)#系统休眠前回调
+        EventMesh.subscribe("sys_up_cb",self.sys_up_cb)#系统唤醒后回调
+        
         EventMesh.subscribe("GET_USB_STATE",self.get_usb_state)
         EventMesh.subscribe("SET_TTS_VOLUME",self.set_tts_volume)
+        EventMesh.subscribe("SET_SPEECH_RATE",self.set_speech_rate)
         
         print("AI_dev:2")
         self.pk = PowerKey()
@@ -782,6 +786,9 @@ class AI_dev(Abstract):
         self.VC_TTS_volume = msg
         self.aud.setVolume(self.VC_TTS_volume //10)
         pass
+    def set_speech_rate(self,event,msg):
+        self.speech_rate = msg
+        EventMesh.publish("set_storage_config",["speech_rate",self.speech_rate])
     def btnInfo_queue_thread(self):
         while True:
             data = self.btnInfo_queue.get()
@@ -826,8 +833,14 @@ class AI_dev(Abstract):
         print("sys_sleep_cb!!!!!!!!!!!!!!!")
         print("sys_sleep_cb!!!!!!!!!!!!!!!")
         self.PIN_wakeup_bt.write(0)
+    def sys_up_cb(self,event=None,msg=None):#休眠前回调
+        print("sys_up_cb!!!!!!!!!!!!!!!")
+        print("sys_up_cb!!!!!!!!!!!!!!!")
+        print("sys_up_cb!!!!!!!!!!!!!!!")
+        self.wakeup_BT()
+    
     def wakeup_BT(self,event=None,msg=None):#4G唤醒蓝牙
-        self.PIN_wakeup_bt.write(0)
+        
         count = 150
         while(True):
             count-=1
@@ -2585,6 +2598,7 @@ class AI_VC(Abstract):
             #if 0:    
                 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:
             #     self.AI_TTS_str = "检测到有新版本需要升级啦!电量低于40%,无法保证升级正常执行,请充满电后重启设备再次升级!"
             #     EventMesh.publish("publish_AI_btnInfo",{"func":self.AI_VC_start}) 
@@ -4392,6 +4406,7 @@ class AI_VC(Abstract):
     #VC开始
     def AI_VC_start(self):
         print("AI_VC_start1")
+        EventMesh.publish(constants.EVENT.SYSTEM_UP)#唤醒休眠
         self.VC_satrt_flag = 1
         if self.VC_Thinking_timerout < 100:
             self.VC_Thinking_timerout = 0
@@ -4402,7 +4417,7 @@ class AI_VC(Abstract):
         #self.aud.aud_tone_play(16,200)#播放按键音
         self.LocalRespondingEnded_timerout = 0
         self.close_timerout = 0
-
+        EventMesh.publish("system_sleep_rest")#防止黑屏
         
         #
         if self.AI_client_VC_isconnect == 0:#没连接的时候请求开始
@@ -4411,7 +4426,7 @@ class AI_VC(Abstract):
             #utime.sleep_ms(50)
         else:
             print("self.VC_state :{}".format(self.VC_state ))
-            
+        EventMesh.publish("system_sleep_rest")#防止黑屏
         if self.AI_client_VC_isconnect == 0:
             return
         self.AI_client_VC_start_requset()
index 1994073..f275a74 100644 (file)
@@ -243,6 +243,8 @@ def main_init():
             pcr.add_support(pro.IOTWeb_bt_connect_record_listProtoCol())
             pcr.add_support(pro.IOTWeb_fence_sosProtoCol())
             pcr.add_support(pro.IOTWeb_player_controlProtoCol())
+            pcr.add_support(pro.IOTWeb_chat_configProtoCol())
+            pcr.add_support(pro.IOTWeb_get_chat_configProtoCol())
             sm = pro.SockMangager()
 
             sm.add_support_resolver(pcr)
@@ -256,6 +258,10 @@ def main_init():
             app.append_manager(_ai.AI_VC())
         except Exception as e:
             usys.print_exception(e) 
+        try:
+            EventMesh.publish("connect_iot_websocket_cb")
+        except Exception as e:
+            usys.print_exception(e) 
     except Exception as e:
         usys.print_exception(e)   
         
index 2c34952..0ce7676 100644 (file)
@@ -665,6 +665,9 @@ class WEB_CMD_ENUM:
     PLAY_CONTROL_R="player_control_R"
     PLAY_CONTROL_S="player_control_S"
 
+    CHAT_CONFIG_R ="chat_config_R"
+    CHAT_CONFIG_S="chat_config_S"
+
 class IOTSendCmdManager(Abstract):
     #
     def __init__(self):
@@ -1146,7 +1149,8 @@ except Exception as e:
     usys.print_exception(e)
     import ai_alarm as _schedule
 DEFIEN_HR_REPORT_TIME = 5*60
-DEFIEN_LOCATION_REPORT_TIME = 30
+DEFINE_TIME_COUNT = 5
+DEFIEN_LOCATION_REPORT_TIME = 5
 WEB_CONNECT_MAX_COUNT = 10 #默认重连次数
 class SockMangager(Abstract):
     def __init__(self):
@@ -1159,7 +1163,7 @@ class SockMangager(Abstract):
         self.resolver = None
         self.timerHr = 0
         self.timerLocation = 0
-        self.timerSOS = 0
+        self.send_device_time = 0
         self.vbat_buf = []
         self.network_state = 0
         self.curr_battery_level = 0
@@ -1175,6 +1179,10 @@ class SockMangager(Abstract):
         self.start_voice_flag = 0
         self.init_send_default=0
         self.play_new_voice_state = 0
+        self.get_voice_new_msginit = 0
+        self.voice_id = "0"
+        self.bt_connect_list = []
+        self.new_voice_list = []
         EventMesh.subscribe("REPORT_ALARM_TO_IOT",self.report_alarm_to_iot)
 
     def report_alarm_to_iot(self,event,msg):
@@ -1224,7 +1232,7 @@ class SockMangager(Abstract):
         self.get_voice_new_msginit = 0
         self.bt_connect_list = []
         self.new_voice_list = []
-        self.connect_web_timer.start(5*1000,0,self.iot_web_connect_timerCb)
+        self.connect_web_timer.start(2000,0,self.iot_web_connect_timerCb)
         
 
     def save_bt_connect_list(self,event,msg):
@@ -1286,10 +1294,10 @@ class SockMangager(Abstract):
         if len(self.new_voice_list) != 0:
             
             for i,data in enumerate(self.new_voice_list):
-                print("play_new_voice_list:{}".format(data))
+                print("data:{}".format(data))
                 self.voice_index = i
-                self.voice_id = data["id"]
-                url = data["url"]
+                self.voice_id = str(data["id"])
+                url = str(data["url"])
                 # url = "http://qipaiai-oss1.tos-cn-beijing.volces.com/qi_pai_ringtone/2025_08_11/742659759219544064test.mp3"
                 self.play_new_voice_state = 1
                 EventMesh.publish("play_new_voice",[url,1])
@@ -1425,8 +1433,9 @@ class SockMangager(Abstract):
         self.connect_iot_websocket()
     def add_support_resolver(self, resolver):
         self.resolver = resolver
-
-    def hr_report_event_cb(self, *args, **kwargs):
+    def hr_report_event(self, *args, **kwargs):
+        EventMesh.publish("publish_AI_btnInfo",{"func":self.hr_report_event_cb}) #self.connect_iot_websocket()
+    def hr_report_event_cb(self):
         """电池平均值"""
         temp = Power.getVbatt()
         if self.bat_count < 10:
@@ -1447,7 +1456,7 @@ class SockMangager(Abstract):
         # self.alarm_test()
         EventMesh.publish("set_curr_battery_level",bat_total_value)
         # EventMesh.publish("publish_AI_btnInfo",{"func":self.hr_report_publish_event,"data":0})  
-        self.timerHr+=10
+        self.timerHr+=DEFINE_TIME_COUNT
         if self.timerHr >= DEFIEN_HR_REPORT_TIME:
             self.timerHr= 0
             self.reconnect_count = 0
@@ -1458,7 +1467,7 @@ class SockMangager(Abstract):
             self.timerLocation = 0
         else:
             if locate_duration_c != 0:
-                self.timerLocation+=10
+                self.timerLocation+=DEFINE_TIME_COUNT
                 if self.timerLocation >= locate_duration_c:
                     self.timerLocation= 0
                     print("timerLocation")
@@ -1467,12 +1476,17 @@ class SockMangager(Abstract):
                 self.timerLocation= 0
 
        
-        if self.timerSOS <= DEFIEN_LOCATION_REPORT_TIME :
-            self.timerSOS+=10
+        if self.send_device_time < DEFIEN_LOCATION_REPORT_TIME :
+            self.send_device_time+=DEFINE_TIME_COUNT
         else:
             if self.get_voice_new_msginit == 0: #开机获取一次语音未读消息
                 self.get_voice_new_msginit=1
-                EventMesh.publish(WEB_CMD_ENUM.GET_NEW_VOICE_MSG_S,None)
+                EventMesh.publish("publish_AI_btnInfo",{"func":self.hr_report_publish_event,"data":0}) 
+                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) #上报设备状态
+
+                EventMesh.publish(WEB_CMD_ENUM.GET_NEW_VOICE_MSG_S)
             
         
         # http://220.160.104.34:30800/ws-bus/test/voice-record/876226211472149?state=1,
@@ -1539,11 +1553,7 @@ class SockMangager(Abstract):
                 print("self.iot_protocol_client %d self.start_voice_flag:%d",self.iot_protocol_client,self.start_voice_flag)
                 if self.iot_protocol_client != None:
                     if self.timer_id == 0:
-                        self.hr_report_timer.start(10000, 1, self.hr_report_event_cb)
-                        EventMesh.publish("publish_AI_btnInfo",{"func":self.hr_report_publish_event,"data":0}) 
-                        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) #上报设备状态
+                        self.hr_report_timer.start(DEFINE_TIME_COUNT*1000, 1, self.hr_report_event)
                         self.timer_id=1
                 
         except Exception as e:   
@@ -1788,7 +1798,7 @@ class IOTWeb_fence_sosProtoCol(ProtoCol):
     TYPE = "fence_sos"
 
     def send(self, event, msg):
-        print("send fence_sos{}".format(msg))
+        # print("send fence_sos{}".format(msg))
         date_tmp = utime.localtime()
         time_tmp = utime.mktime(date_tmp)
         # 通过websocket发送到服务器端
@@ -1813,7 +1823,7 @@ class IOTWeb_fence_sosProtoCol(ProtoCol):
         @param event: 心跳成功
         @param msg: 接收到的下行数据
         """
-        EventMesh.publish(WEB_CMD_ENUM.FENCE_SOS_S,None)
+        EventMesh.publish(WEB_CMD_ENUM.FENCE_SOS_S)
         sos_list = EventMesh.publish("get_storage_config","sos_list")
         if sos_list != None:
             if len(sos_list) > 0:
@@ -1966,7 +1976,7 @@ class IOTWeb_FindDeviceProtoCol(ProtoCol):
     TYPE = "find_device"
 
     def send(self, event, msg):
-        print("send locafind_devicetion{}".format(msg))
+        # print("send locafind_devicetion{}".format(msg))
         # 通过websocket发送到服务器端
         date_tmp = utime.localtime()
         time_tmp = utime.mktime(date_tmp)
@@ -1982,7 +1992,7 @@ class IOTWeb_FindDeviceProtoCol(ProtoCol):
         }
         send_data = b''
         send_data = protocol_send_total_data(find_device)
-        print("send_data find_device{}".format(msg))
+        print("send_data find_device{}".format(send_data))
         EventMesh.publish("CHANNEL_IOT_WEB_SEND", send_data)
 
     def recv(self, event, msg):
@@ -1993,7 +2003,7 @@ class IOTWeb_FindDeviceProtoCol(ProtoCol):
         """
         EventMesh.publish("set_sos_info_call")
         print("recv find_device{}".format(msg))
-        EventMesh.publish(WEB_CMD_ENUM.FIND_DEVCE_S_CMD,None)
+        EventMesh.publish(WEB_CMD_ENUM.FIND_DEVCE_S_CMD)
 
 #立即定位
 class IOTWeb_LocateNowProtoCol(ProtoCol):
@@ -2025,7 +2035,7 @@ class IOTWeb_LocateNowProtoCol(ProtoCol):
         @param msg: 接收到的下行数据
         """
         
-        EventMesh.publish(WEB_CMD_ENUM.LOCATION_NOW_S_CMD,None)
+        EventMesh.publish(WEB_CMD_ENUM.LOCATION_NOW_S_CMD)
         print("recv locate_now{}".format(msg))
         EventMesh.publish(constants.EVENT.START_LOCATION,WEB_CMD_ENUM.POST_LOCATION_S_CMD) #开始定位 定位完之后上报定位数据
 
@@ -2130,7 +2140,7 @@ class IOTWeb_alarm_configProtoCol(ProtoCol):
     TYPE = "alarm_config"
 
     def send(self, event, msg):
-        print("send locafind_devicetion{}".format(msg))
+        # print("send alarm_config{}".format(msg))
         # 通过websocket发送到服务器端
         date_tmp = utime.localtime()
         time_tmp = utime.mktime(date_tmp)
@@ -2146,7 +2156,7 @@ class IOTWeb_alarm_configProtoCol(ProtoCol):
         }
         send_data = b''
         send_data = protocol_send_total_data(alarm_config)
-        print("send_data alarm_config{}".format(msg))
+        print("send_data alarm_config{}".format(send_data))
         EventMesh.publish("CHANNEL_IOT_WEB_SEND", send_data)
 
     def recv(self, event, msg):
@@ -2156,7 +2166,7 @@ class IOTWeb_alarm_configProtoCol(ProtoCol):
         @param msg: 接收到的下行数据
         """
         print("recv alarm_config{}".format(msg))
-        EventMesh.publish(WEB_CMD_ENUM.ALARM_CONFIG_S_CMD,None)
+        EventMesh.publish(WEB_CMD_ENUM.ALARM_CONFIG_S_CMD)
 
 #SOS联系人下发
 class IOTWeb_sos_listProtoCol(ProtoCol):
@@ -2215,7 +2225,7 @@ class IOTWeb_sos_listProtoCol(ProtoCol):
             EventMesh.publish("set_storage_config",["sos_list",sos_list])
             read_soslist = EventMesh.publish("get_storage_config","sos_list")
             print(read_soslist)
-            EventMesh.publish(WEB_CMD_ENUM.SOS_LIST_S_CMD,None)
+            EventMesh.publish(WEB_CMD_ENUM.SOS_LIST_S_CMD)
 
 #闹钟铃声下发
 class IOTWeb_volumeProtoCol(ProtoCol):
@@ -2252,7 +2262,7 @@ class IOTWeb_volumeProtoCol(ProtoCol):
             r_volume = msg["data"]
             print("recv volume{} type:{}".format(r_volume,type(msg)))
             EventMesh.publish("SET_TTS_VOLUME",int(r_volume))
-        EventMesh.publish(WEB_CMD_ENUM.VOLUME_S_CMD,None)
+        EventMesh.publish(WEB_CMD_ENUM.VOLUME_S_CMD)
 #下发SOS配置
 class IOTWeb_sos_configProtoCol(ProtoCol):
     """sos_config"""
@@ -2291,7 +2301,7 @@ class IOTWeb_sos_configProtoCol(ProtoCol):
             EventMesh.publish("set_storage_config",["sos_config",sos_config])
         sos_config = EventMesh.publish("get_storage_config","sos_config")
         print("sos_config:{} type:{}".format(sos_config,sos_config["enable110"]))
-        EventMesh.publish(WEB_CMD_ENUM.SOS_CONFIG_S_CMD,None)
+        EventMesh.publish(WEB_CMD_ENUM.SOS_CONFIG_S_CMD)
 #闹钟铃声获取
 
 class IOTWeb_get_ringtoneProtoCol(ProtoCol):
@@ -2474,7 +2484,83 @@ class IOTWeb_text_msgProtoCol(ProtoCol):
                 print("下发文字留言出错了")
         EventMesh.publish(WEB_CMD_ENUM.TEXT_MSG_S_CMD,recv_state)
         
+#AI对话音色配置
+class IOTWeb_chat_configProtoCol(ProtoCol):
+    """chat_config"""
+    TYPE = "chat_config"
 
+    def send(self, event, msg):
+        # print("send chat_config{}".format(msg))
+        # 通过websocket发送到服务器端
+        date_tmp = utime.localtime()
+        time_tmp = utime.mktime(date_tmp)
+        chat_config = {
+            "cmd":"dispatch_rest",
+            "ts":time_tmp,
+            "msg":"消息收到响应",
+            "data":{
+                "cmd":"chat_config",
+                "rest":"success",
+                "msg":"收到AI对话配置"
+            }
+        }
+        send_data = b''
+        send_data = protocol_send_total_data(chat_config)
+        print("send_data chat_config{}".format(send_data))
+        EventMesh.publish("CHANNEL_IOT_WEB_SEND", send_data)
+
+    def recv(self, event, msg):
+        """
+
+        @param event:上行下发chat_config
+        @param msg: 接收到的下行数据
+        """
+        print("recv chat_config{}".format(msg))
+        # {
+        #     "cmd":"chat_config",
+        #     "ts":1738283829,
+        #     "msg":"下发AI对话配置",
+        #     "data":{
+        #         "speed":1.5,
+        #         "vadDuration":600,
+        #         "voiceId":"音色ID,火山音色或者科大讯飞音色ID"
+        #     }
+        # }
+        if "data" in msg:
+            data = msg["data"]
+            speed = data["speed"]
+            vadDuration = data["vadDuration"]
+            voiceId = data["voiceId"]
+            EventMesh.publish("SET_SPEECH_RATE",speed)
+        EventMesh.publish(WEB_CMD_ENUM.CHAT_CONFIG_S)
+#获取AI对话音色配置
+class IOTWeb_get_chat_configProtoCol(ProtoCol):
+    """get_chat_config"""
+    TYPE = "get_chat_config"
+
+    def send(self, event, msg):
+        # print("send chat_config{}".format(msg))
+        # 通过websocket发送到服务器端
+        date_tmp = utime.localtime()
+        time_tmp = utime.mktime(date_tmp)
+        get_chat_config = {
+            "cmd":"get_chat_config",
+            "ts":time_tmp,
+            "msg":"获取AI对话配置",
+            "data":None
+        }
+        send_data = b''
+        send_data = protocol_send_total_data(get_chat_config)
+        print("send_data chat_config{}".format(send_data))
+        EventMesh.publish("CHANNEL_IOT_WEB_SEND", send_data)
+
+    def recv(self, event, msg):
+        """
+
+        @param event:上行下发get_chat_config
+        @param msg: 接收到的下行数据
+        """
+        print("recv get_chat_config{}".format(msg))
 #下发日程    
 class IOTWeb_scheduleProtoCol(ProtoCol):
     """schedule"""
@@ -2536,14 +2622,14 @@ class IOTWeb_scheduleProtoCol(ProtoCol):
             EventMesh.publish("set_storage_config",["schedule",schedule])
             schedule = EventMesh.publish("get_storage_config","schedule")
             print(schedule)
-        EventMesh.publish(WEB_CMD_ENUM.SCHEDULE_S_CMD,None)
+        EventMesh.publish(WEB_CMD_ENUM.SCHEDULE_S_CMD)
 #     
 class IOTWeb_new_voice_msgProtoCol(ProtoCol):
     """new_voice_msg"""
     TYPE = "new_voice_msg"
 
     def send(self, event, msg):
-        print("send new_voice_msg{}".format(msg))
+        # print("send new_voice_msg{}".format(msg))
         # 通过websocket发送到服务器端
         date_tmp = utime.localtime()
         time_tmp = utime.mktime(date_tmp)
@@ -2561,14 +2647,14 @@ class IOTWeb_new_voice_msgProtoCol(ProtoCol):
         send_data = protocol_send_total_data(new_voice_msg)
         print("send send_data{}".format(send_data))
         EventMesh.publish("CHANNEL_IOT_WEB_SEND",send_data)
-        EventMesh.publish(WEB_CMD_ENUM.GET_NEW_VOICE_MSG_S,None)
+        EventMesh.publish(WEB_CMD_ENUM.GET_NEW_VOICE_MSG_S)
     def recv(self, event, msg):
         """
 
         @param event:new_voice_msg
         @param msg: 接收到的下行数据
         """
-        EventMesh.publish(WEB_CMD_ENUM.NEW_VOICE_MSG_S,None)
+        EventMesh.publish(WEB_CMD_ENUM.NEW_VOICE_MSG_S)
 
         print("recv new_voice_msg{}".format(msg))
 
@@ -2719,30 +2805,10 @@ class IOTWeb_new_voice_msg_listProtoCol(ProtoCol):
         @param event:new_voice_msg_list
         @param msg: 接收到的下行数据
         """
-        # new_voice_msg_list = {
-        #     "cmd":"new_voice_msg_list",
-        #     "ts":1738283829,
-        #     "msg":"请求未读的语音消息列表",
-        #     "data":[
-        #         {
-        #         "id":"语音ID",
-        #         "url": "音频地址",
-        #         "size": 0,
-        #         "from": "user/dev",
-        #         "duration": 12,
-        #         "deviceId": "设备ID",
-        #         "userId": "用户ID",
-        #         "userReadState": "1",
-        #         "deviceReadState": "1",
-        #         "md5": "md5",
-        #         "fileName": "文件名"
-        #         }
-        #     ]
-        # }
         new_voice_list = []
         if "data" in msg:
             data = msg["data"]
-            for da in enumerate(data):
+            for da in data:
                 new_voice_list.append(da)
 
         if len(new_voice_list) > 0:
@@ -2751,7 +2817,7 @@ class IOTWeb_new_voice_msg_listProtoCol(ProtoCol):
         EventMesh.publish("set_play_new_voice_list",new_voice_list)
         EventMesh.publish("play_new_voice_list")
 
-        EventMesh.publish(WEB_CMD_ENUM.NEW_VOICE_MSG_LIST_S,None)
+        EventMesh.publish(WEB_CMD_ENUM.NEW_VOICE_MSG_LIST_S)
         print("recv new_voice_msg_list{}".format(msg))
 class IOTWeb_put_voice_msg_stateProtoCol(ProtoCol):
     """put_voice_msg_state"""
@@ -2811,7 +2877,7 @@ class IOTWeb_get_bt_connect_record_listProtoCol(ProtoCol):
         #     "data": None
         # }
         EventMesh.publish("send_get_connect_bt_state")
-        EventMesh.publish(WEB_CMD_ENUM.GET_BT_CONNECT_RECORD_LIST_S,None)
+        EventMesh.publish(WEB_CMD_ENUM.GET_BT_CONNECT_RECORD_LIST_S)
         print("recv get_bt_connect_record_list{}".format(msg))
 
 #蓝牙开关
@@ -2820,7 +2886,7 @@ class IOTWeb_switch_bt_stateProtoCol(ProtoCol):
     TYPE = "switch_bt_state"
 
     def send(self, event, msg):
-        print("send schedule{}".format(msg))
+        # print("send switch_bt_state{}".format(msg))
         # 通过websocket发送到服务器端
         date_tmp = utime.localtime()
         time_tmp = utime.mktime(date_tmp)
@@ -2857,7 +2923,7 @@ class IOTWeb_switch_bt_stateProtoCol(ProtoCol):
                 pass
         print("recv switch_bt_state{}".format(msg))
         
-        EventMesh.publish(WEB_CMD_ENUM.SWITCH_BT_STATE_S_CMD,None)
+        EventMesh.publish(WEB_CMD_ENUM.SWITCH_BT_STATE_S_CMD)
 
 #蓝牙扫描
 class IOTWeb_bt_scanProtoCol(ProtoCol):
@@ -3064,7 +3130,7 @@ class IOTWeb_disconnect_btProtoCol(ProtoCol):
     TYPE = "disconnect_bt"
 
     def send(self, event, msg):
-        print("send schedule{}".format(msg))
+        # print("send sc/hedule{}".format(msg))
         # 通过websocket发送到服务器端
         date_tmp = utime.localtime()
         time_tmp = utime.mktime(date_tmp)
@@ -3098,7 +3164,7 @@ class IOTWeb_disconnect_btProtoCol(ProtoCol):
             mac = msg["data"]
             EventMesh.publish("send_disconnect_bt_mac",mac)
         print("recv disconnect_bt{}".format(msg))
-        EventMesh.publish(WEB_CMD_ENUM.DISCONNECT_BT_S,None)
+        EventMesh.publish(WEB_CMD_ENUM.DISCONNECT_BT_S)
 
 class LK_ProtoCol(ProtoCol):
     """链路保持"""
index 4bbbfc1..d65b4e1 100644 (file)
@@ -221,6 +221,7 @@ class UI(object):
 
     def __lcd_on(self):
         self.system_sleep_timeout_rest()
+        EventMesh.publish("sys_up_cb")#唤醒前回调
         if self.sleep_flag == 0 :
             EventMesh.debug_log("__lcd_on")
             if self.sleep_lock == 1: