日程提醒bug修改
authorazao <821478748@qq.com>
Tue, 11 Nov 2025 03:34:29 +0000 (11:34 +0800)
committerazao <821478748@qq.com>
Tue, 11 Nov 2025 06:37:42 +0000 (14:37 +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/ai_alarm.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

index ed331df..65c6022 100644 (file)
@@ -4810,13 +4810,13 @@ class AI_VC(Abstract):
                         
                     #     self.AI_TTS_str = "当前信号{}".format(signal)
                     #     return 0
-                    if text.find("电量") != -1 :
-                        battery = EventMesh.publish("get_battery")
-                        print("电量查询:{}".format(battery))
-                        #EventMesh.publish("audio_montage_play",["dianliangshengyu{}.mp3".format(battery)])
-                        #self.aud.play(1,0,'U:/static/dianliangshengyu{}.mp3'.format(battery))#电量剩余
-                        self.AI_TTS_str = "电量剩余百分之{}".format(battery)
-                        return 0
+                    # if text.find("电量") != -1 :
+                    #     battery = EventMesh.publish("get_battery")
+                    #     print("电量查询:{}".format(battery))
+                    #     #EventMesh.publish("audio_montage_play",["dianliangshengyu{}.mp3".format(battery)])
+                    #     #self.aud.play(1,0,'U:/static/dianliangshengyu{}.mp3'.format(battery))#电量剩余
+                    #     self.AI_TTS_str = "电量剩余百分之{}".format(battery)
+                    #     return 0
                     if text.find("电压") != -1 :
                         Vbatt = Power.getVbatt()
                         #EventMesh.publish("audio_montage_play",["dianliangshengyu{}.mp3".format(battery)])
@@ -4834,6 +4834,7 @@ class AI_VC(Abstract):
                     #     return 0
                     if text.find("设备号") != -1 :
                         imei = modem.getDevImei()
+                        imei = num_str_to_chinese(imei)#转为中文
                         if imei != -1 and len(imei) > 5:
                             print("IMEI:{}".format(imei))
                             self.AI_TTS_str = "当前设备号为:{}".format(imei)
@@ -5541,26 +5542,30 @@ class AI_VC(Abstract):
                 EventMesh.publish("post_device_state")
                 EventMesh.publish("adjust_volume_toBle",self.VC_TTS_volume)
                 self.AI_TTS_str = "好嘞,音量已经调节了,当前音量是{}".format(self.VC_TTS_volume)
+
     #查询指令判断
     def find_cmd(self,event ,msg):
         if "电量" in msg:
             battery = EventMesh.publish("get_battery")
             print("电量查询:{}".format(battery))
             tts_play_str = "电量剩余百分之{}".format(battery)
+            EventMesh.publish("play_tts",[tts_play_str,0])
             # print("电量!!!!!!!!!!!")
         elif "信号" in msg:
             signal = net.csqQueryPoll()
             tts_play_str = "当前信号{}".format(signal)
+            EventMesh.publish("play_tts",[tts_play_str,0])
             # print("信号!!!!!!!!!!!")
         elif "卡号" in msg:
             # print("卡号!!!!!!!!!!!")
             iccid = sim.getIccid()
+            iccid = num_str_to_chinese(iccid)#转为中文
             if iccid != -1 and len(iccid) > 5:
                 print("iccid{}".format(iccid))
                 tts_play_str = "当前卡号为:{}".format(iccid)
             else:
                 tts_play_str = "卡号查询失败"
-        EventMesh.publish("play_tts",[tts_play_str,0])
+            EventMesh.publish("play_tts",[tts_play_str,0])
     #改变音色判断
     def change_voice(self,event ,msg):
         voice = msg
@@ -5991,4 +5996,17 @@ class AI_VC(Abstract):
         #     num = 8
         # self.aud.setVolume(num)#恢复原始音量
         
+def num_str_to_chinese(num_str):
+    # 数字与中文映射(含零)
+    num_map = {
+        '0': '零', '1': '一', '2': '二', '3': '三', '4': '四',
+        '5': '五', '6': '六', '7': '七', '8': '八', '9': '九'
+    }
+    chinese = ''
+    # 逐位转换,拼接单位
+    for char in num_str:
+        digit = num_map[char]
+        chinese += digit
+    
+    return chinese
 
index 54360d2..af7176a 100644 (file)
@@ -933,7 +933,6 @@ class schedule(Abstract):
                     print("当前年份大于设置的年份")
                     self.schedule_array.pop(i)
                     EventMesh.publish("set_storage_config",["schedule",self.schedule_array])#读取日程数组
-                    EventMesh.publish("GET_NEED_SCHEDULE_REPORT_INFO")
                     continue
                 
                 if (year_now == date_year and month_now == date_month and date_day == day_now):
@@ -941,7 +940,6 @@ class schedule(Abstract):
                         print("时间过了")
                         self.schedule_array.pop(i)
                         EventMesh.publish("set_storage_config",["schedule",self.schedule_array])#读取日程数组
-                        EventMesh.publish("GET_NEED_SCHEDULE_REPORT_INFO")
                         continue
 
                 if year_now == date_year and month_now == date_month and date_day == day_now and set_hour == hour_now and set_min == minute_now: #该提醒了
@@ -1019,16 +1017,14 @@ class schedule(Abstract):
         if len(self.schedule_array) > 0:
             for _schedule in self.schedule_array:
                 schedule_info = {}
-                if len(_schedule["name"]) == 0:
-                    _schedule["name"] = "闹钟"
+                # if len(_schedule["title"]) == 0:
+                #     _schedule["title"] = "闹钟"
 
-                schedule_info["name"] = _schedule["name"]
-                schedule_info["loop"] = _schedule["loop"]
-                schedule_info["state"] = _schedule["state"]
+                schedule_info["title"] = _schedule["title"]
+                schedule_info["repeat"] = _schedule["repeat"]
                 schedule_info["time"] = _schedule["time"]
-                schedule_info["ringTimes"] = _schedule["ringTimes"]
-                schedule_info["scheduleMode"] = _schedule["scheduleMode"]
-                schedule_info["shakeType"] = _schedule["shakeType"]
+                schedule_info["date"] = _schedule["date"]
+                schedule_info["index"] = _schedule["index"]
                 schedule_list.append(schedule_info)
         schedule_send = {
             "cmd":"post_schedule",
@@ -1057,15 +1053,14 @@ class schedule(Abstract):
             if "interval" in _schedule :#间隔提醒日程
                 continue
 
-            state = schedule["state"]
-            loop = _schedule["loop"]
-            descrp = _schedule["name"]
+            repeat = _schedule["repeat"]
+            descrp = _schedule["title"]
             set_hour = int((_schedule["time"]).split(":")[0])
             set_min = int((_schedule["time"]).split(":")[1])
             
             week = ""
             final_sentence = ""
-            for n,we in enumerate(loop):
+            for n,we in enumerate(repeat):
                 week_t = n
                 if we == "1":
                     if n == 0:
index 4c0c1dc..913747b 100644 (file)
@@ -220,7 +220,6 @@ def main_init():
             pcr.add_support(pro.IOTWeb_FindDeviceProtoCol())
             # pcr.add_support(pro.IOTWeb_alarm_configProtoCol())
             pcr.add_support(pro.IOTWeb_alarm_listProtoCol())
-            pcr.add_support(pro.IOTWeb_schedule_listProtoCol())
             pcr.add_support(pro.IOTWeb_sos_listProtoCol())
             pcr.add_support(pro.IOTWeb_volumeProtoCol())
             pcr.add_support(pro.IOTWeb_sos_configProtoCol())
index fbf598a..6de2da8 100644 (file)
@@ -2633,9 +2633,7 @@ class IOTWeb_sos_listProtoCol(ProtoCol):
 def ai_cmd_handle(cmd):
     # print("")
     if "查询" in cmd:#当指令中有查询时,截取查询操作
-        voice_start_index = cmd.index("查询") + len("查询")#动态判断截取部分
-        find = cmd[:voice_start_index]#查询截取
-        EventMesh.publish("find_cmd",find)
+        EventMesh.publish("find_cmd",cmd)
     elif "讲话" in cmd:#当指令中有讲话时,截取语速操作
         voice_start_index = cmd.index("讲话") + len("讲话")#动态判断截取部分
         find = cmd[voice_start_index:]#查询截取
@@ -3327,79 +3325,6 @@ class IOTWeb_post_scheduleProtoCol(ProtoCol):
         """
         print("recv post_schedule{}".format(msg))
 
-#日程列表(NLP识别下发)
-class IOTWeb_schedule_listProtoCol(ProtoCol):
-    """schedule_list"""
-    TYPE = "schedule_list"
-
-    def send(self, event, msg):
-        print("send schedule_list {}".format(msg))
-        # 通过websocket发送到服务器端
-        date_tmp = utime.localtime()
-        time_tmp = utime.mktime(date_tmp)
-        rest = "error"
-        if msg == 1:
-            rest = "success"
-        schedule_list ={
-            "cmd":"dispatch_rest",
-            "ts":time_tmp,
-            "msg":"消息收到响应",
-            "data":{
-                "cmd":"schedule_list",
-                "rest":rest,
-                "msg":"日程配置成功."
-            }
-        }
-        send_data = b''
-        send_data = protocol_send_total_data(schedule_list)
-        print("send_data schedule_list {}".format(msg))
-        EventMesh.publish("CHANNEL_IOT_WEB_SEND", send_data)
-
-    def recv(self, event, msg):
-        """
-
-        @param event:上行下发闹钟配置
-        @param msg: 接收到的下行数据
-        """
-        # 定义要添加的新元素
-        # new_item = {'time': '11:30','index': 1}
-        # data = [{"index":1,"name":"hihihi1"},{"index":2,"name":"hihihi2"},{"index":0,"name":"hihihi0"}]
-        # len_t = len(data)
-        # j = 0
-        # for i in range(len_t):
-        #     if data[j]['index'] == 1:
-        #         removed_item = data.pop(j)
-        #         print(data)
-        #         j=0
-        #         continue
-        #     j+=1
-        #     len_t = len(data)
-        #     print(len_t)
-        # for i in range(len(data)):
-        #     data[i]["index"] = i
-   
-        # url = http://220.160.104.34:30800/ws-bus/test/voice-record/876226211472149?state=1
-            # url = http://220.160.104.34:30800/ws-bus/test/876226211472149?testType = alarmList
-
-        schedule_list=[]
-        ret = 1
-        if "data" in msg:
-            data = msg["data"]
-            if isinstance(data,list) == True:
-                for i in range(len(data)):
-                    data_list = data[i]
-                    data_list["index"] = i
-                    print("schedule_list:{}".format(data_list))
-                    schedule_list.append(data_list)
-                schedule_list.sort(key=lambda x: x['index'])
-                EventMesh.publish("set_storage_config",["schedule_list",schedule_list])
-                EventMesh.publish("set_schedule_info",schedule_list)
-                schedule_list = EventMesh.publish("get_storage_config","alarm_list")
-                print("schedule_list:{}".format(schedule_list))
-            else:
-                ret = 0
-            
-        EventMesh.publish(WEB_CMD_ENUM.SCHEDULE_LIST_S_CMD,ret)
 
 #下发日程    
 class IOTWeb_scheduleProtoCol(ProtoCol):