From: dxy15521469561 <1731678236@qq.com> Date: Mon, 4 Sep 2023 03:16:50 +0000 (+0800) Subject: k01: X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=36bebefbde5ed90b4690e41f0b403834202e2bb6;p=mirrors%2FASR1603_G5.git k01: 微聊保存最近五条数据 --- diff --git a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/appWechat.py b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/appWechat.py index 3d77c3c3..9b8ccb91 100644 --- a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/appWechat.py +++ b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/appWechat.py @@ -73,10 +73,9 @@ wechat_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) wechat_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) wechat_screen_list_screen = lv.obj(wechat_screen) -wechat_screen_list_screen.set_pos(0, 5) -wechat_screen_list_screen.set_size(LCD_X, 90) +wechat_screen_list_screen.set_pos(0, 0) +wechat_screen_list_screen.set_size(LCD_X, 95) wechat_screen_list_screen.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) -wechat_screen_list_screen.add_flag(lv.obj.FLAG.HIDDEN) wechat_screen_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) @@ -111,33 +110,34 @@ wechat_press_label_countdown.add_style(style_font_youyuan_20, lv.PART.MAIN | lv. wechat_press_label_countdown.set_long_mode(lv.label.LONG.WRAP) wechat_press_label_countdown.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -wechat_show_infor_obj = lv.obj(wechat_screen) -wechat_show_infor_obj.set_pos(0, 5) -wechat_show_infor_obj.set_size(LCD_X, 90) -wechat_show_infor_obj.clear_flag(lv.obj.FLAG.HIDDEN) -wechat_show_infor_obj.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) -wechat_show_infor_obj.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - -wechat_pause_img = lv.img(wechat_show_infor_obj) -wechat_pause_img.set_pos(44, 40) -wechat_pause_img.set_size(40, 40) -wechat_pause_img.set_src("U:/static/pause.png") -wechat_pause_img.add_flag(lv.obj.FLAG.CLICKABLE) -wechat_pause_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) - -wechat_update_one = lv.label(wechat_show_infor_obj) -wechat_update_one.set_pos(0, 5) -wechat_update_one.set_size(LCD_X, 20) -wechat_update_one.set_text("最近一条消息") -wechat_update_one.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -wechat_update_one.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) - -wechat_update_label = lv.label(wechat_show_infor_obj) -wechat_update_label.set_pos(0, 35) -wechat_update_label.set_size(LCD_X, 45) -wechat_update_label.set_text(" ") -wechat_update_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) -wechat_update_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# wechat_show_infor_obj = lv.obj(wechat_screen) +# wechat_show_infor_obj.set_pos(0, 5) +# wechat_show_infor_obj.set_size(LCD_X, 90) +# wechat_show_infor_obj.clear_flag(lv.obj.FLAG.HIDDEN) +# wechat_show_infor_obj.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) +# wechat_show_infor_obj.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + +# wechat_pause_img = lv.img(wechat_show_infor_obj) +# wechat_pause_img.set_pos(44, 40) +# wechat_pause_img.set_size(40, 40) +# wechat_pause_img.set_src("U:/static/pause.png") +# wechat_pause_img.add_flag(lv.obj.FLAG.CLICKABLE) +# wechat_pause_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) + +# wechat_update_one = lv.label(wechat_show_infor_obj) +# wechat_update_one.set_pos(0, 5) +# wechat_update_one.set_size(LCD_X, 20) +# wechat_update_one.set_text("最近一条消息") +# wechat_update_one.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +# wechat_update_one.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + +# wechat_update_label = lv.label(wechat_show_infor_obj) +# wechat_update_label.set_pos(0, 35) +# wechat_update_label.set_size(LCD_X, 45) +# wechat_update_label.set_text(" ") +# wechat_update_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT) +# wechat_update_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) + class WechatScreen(Screen): @@ -145,10 +145,9 @@ class WechatScreen(Screen): def __init__(self): super().__init__() - self.MXA_MSG = 10 + self.MXA_MSG = 5 self.wechat_recode_list = {} self.wechat_num = 0 - self.read_data = {} self.volum_size = 8 self.msg_tmp = "" check_txt = ql_fs.path_exists("/usr/static/storage_file/wechat_record.json") @@ -167,12 +166,16 @@ class WechatScreen(Screen): with open("/usr/static/storage_file/wechat_record.json","w",encoding="utf-8") as fd: ujson.dump(self.wechat_recode_list,fd) # if self.wechat_num != 0: - # with open("/usr/static/storage_file/wechat_record.json","r",encoding="utf-8") as fd:#音频文件记录 + # with open("/ext/static/storage_file/wechat_record.json","r",encoding="utf-8") as fd:#音频文件记录 # self.wechat_recode_list = ujson.load(fd)#读取每一个amr音频文件的时长ui_setting.py self.record_test = audio.Record() self.record_test.gain(4,12) self.aud = audio.Audio(0) + # self.aud.set_pa(Pin.GPIO29) + + + self.meta = wechat_screen @@ -180,36 +183,37 @@ class WechatScreen(Screen): lv.EVENT.LONG_PRESSED, None) wechat_press_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.sending_cb(e)), lv.EVENT.RELEASED, None) - - wechat_pause_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.playing_cb(e)), - lv.EVENT.RELEASED, None) self.timer = osTimer() self.second_timer = osTimer() self.play_timer = osTimer() + + self.startY = 0 self.startWidth = 0 self.check_json = 0 self.wechat_list = lv.obj(wechat_screen_list_screen) self.wechat_list.set_pos(0, 0) - self.wechat_list.set_size(LCD_X, 91) + self.wechat_list.set_size(128, 96) self.wechat_list.set_scrollbar_mode(lv.SCROLLBAR_MODE.OFF) self.wechat_list.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) - + self.wechat_list.set_flex_flow(lv.FLEX_FLOW.COLUMN)#自动排成一列对齐 #建立控件 self.wechat_list_dict = [] for i in range(self.MXA_MSG): - wechat_btn = lv.btn(self.wechat_list) + wechat_obj = lv.obj(self.wechat_list) + wechat_obj.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) + wechat_btn = lv.btn(wechat_obj) wechat_btn.add_style(style_wechat_s_btn, lv.PART.MAIN | lv.STATE.DEFAULT) _btn_label1 = lv.label(wechat_btn) _btn_label1.add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) _btn_label2 = lv.label(wechat_btn) _btn_img = lv.img(wechat_btn) - wechat_btn.add_flag(lv.obj.FLAG.HIDDEN) + wechat_obj.add_flag(lv.obj.FLAG.HIDDEN) wechat_btn.add_flag(lv.obj.FLAG.CLICKABLE) wechat_btn.add_event_cb(lambda e: EventMesh.callback_wrapper(self.play_label_cb(e)), lv.EVENT.CLICKED, None) - self.wechat_list_dict.append({"num":i,"wechat_btn":wechat_btn,"_btn_label1":_btn_label1,"_btn_label2":_btn_label2,"_btn_img":_btn_img}) + self.wechat_list_dict.append({"num":i,"wechat_obj":wechat_obj,"wechat_btn":wechat_btn,"_btn_label1":_btn_label1,"_btn_label2":_btn_label2,"_btn_img":_btn_img}) EventMesh.subscribe("wechat_updata_list_show", self.wechat_updata_list_show) EventMesh.subscribe("get_wechat_data", self.get_wechat_data) @@ -217,9 +221,6 @@ class WechatScreen(Screen): EventMesh.subscribe("get_aduio_state", self.get_aduio_state) EventMesh.subscribe("get_send_state", self.get_send_state) - EventMesh.subscribe("get_wechat_has_state", self.get_wechat_has_state) - - EventMesh.subscribe("update_new_infor", self.update_new_infor) self.countdown = 1 self.count_img = 0 @@ -233,74 +234,8 @@ class WechatScreen(Screen): self.ble_send = 0 self.wechat_show = 0 self.wechat_show_list = 0 - self.wechat_play_state = 0 #self.old_num = self.wechat_num - def update_new_infor(self,event, msg): #更新页面显示 - wechat_show_infor_obj.clear_flag(lv.obj.FLAG.HIDDEN) - wechat_screen_list_screen.add_flag(lv.obj.FLAG.HIDDEN) - - if self.wechat_recode_list["num"] != 0: - wechat_update_one.set_text("最近一条消息") - value = self.wechat_recode_list["01"] - if value.find("T:") != -1: - - conten = value[2:] - wechat_pause_img.add_flag(lv.obj.FLAG.HIDDEN) - wechat_update_label.set_text(str(conten)) - else: - wechat_update_label.set_text(" ") - wechat_pause_img.clear_flag(lv.obj.FLAG.HIDDEN) - wechat_pause_img.set_src("U:/static/pause.png") - pass - else: - wechat_update_one.set_text(" ") - wechat_pause_img.add_flag(lv.obj.FLAG.HIDDEN) - wechat_update_label.set_text("暂无数据") - - - def clear_show_date(self): - wechat_show_infor_obj.add_flag(lv.obj.FLAG.HIDDEN) - wechat_screen_list_screen.clear_flag(lv.obj.FLAG.HIDDEN) - self.wechat_play_state = 0 - self.aud.stop() - self.play_timer.stop() - - def get_wechat_has_state(self,event, msg): - state = 0 - state = wechat_screen_list_screen.has_flag(lv.obj.FLAG.HIDDEN) - print("state:{}".format(state)) - return state - - - - def playing_cb(self,e): - if self.wechat_recode_list["num"] != 0: - value = self.wechat_recode_list["01"] - if value.find("S:") != -1 or value.find("R:") != -1: - if self.wechat_play_state == 0: - self.wechat_play_state = 1 - wechat_pause_img.set_src("U:/static/play.png") - self.play_timer.start(500, 1, self.stop_play_wechat) - self.aud.play(1, 1, '/usr/static/storage_file/wechat.amr') #文件名前面要加上路径 - else: - self.wechat_play_state = 0 - wechat_pause_img.set_src("U:/static/pause.png") - self.aud.stop() - self.play_timer.stop() - - def stop_play_wechat(self,*argc): - - print("stop_play_wechat!!!!!!!!") - play_state = EventMesh.publish("get_audio_state")#音频播放状态 - if play_state != None: - if play_state == 0:#在上一个界面在播放音频时切换界面则关闭 以免一直播放 - self.play_timer.stop() - self.wechat_play_state = 0 - wechat_pause_img.set_src("U:/static/pause.png") - pass - - def initialization(self): Wechat_log("initialization1") @@ -309,8 +244,6 @@ class WechatScreen(Screen): wechat_label.add_flag(lv.obj.FLAG.HIDDEN) wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN) self.wechat_list.clear_flag(lv.obj.FLAG.HIDDEN) - self.wechat_play_state = 0 - EventMesh.publish("update_new_infor") #读取json文件中的字典放到self.phonebook中 #创建btn #self.updata_list_show(1) @@ -368,7 +301,6 @@ class WechatScreen(Screen): def updata_list_show(self,index): Wechat_log("updata_list_show1") global wechat_screen_list_screen - if self.press_state != 1: if self.wechat_num != 0: if index == 0: @@ -390,14 +322,14 @@ class WechatScreen(Screen): j = 1 key = "%02d"%(j) if j > len(self.wechat_recode_list) -1: - self.wechat_list_dict[i]["wechat_btn"].add_flag(lv.obj.FLAG.HIDDEN) + self.wechat_list_dict[i]["wechat_obj"].add_flag(lv.obj.FLAG.HIDDEN) continue j+=1 #Wechat_log("wechat_list_dict:num:{}".format(self.wechat_list_dict[i]["num"])) value = self.wechat_recode_list[key] - self.startY = 37*i + self.startY = 27*i if value.find("S:") != -1 or value.find("R:") != -1: self.msg_tmp = value[2:] @@ -406,23 +338,23 @@ class WechatScreen(Screen): elif value.find("T:") != -1:#文字显示 self.msg_tmp = value[2:] - self.startWidth = 126 + self.startWidth = 118 #wechat_btn = lv.btn(self.wechat_list) # if value.find("R:") != -1:self.wechat_list_dict[i] - + self.wechat_list_dict[i]["wechat_obj"].set_size(128,lv.SIZE.CONTENT) if value.find("R:") != -1 or value.find("T:") != -1 :#显示文字: if value.find("T:") != -1: - self.wechat_list_dict[i]["wechat_btn"].set_size(self.startWidth,35) + self.wechat_list_dict[i]["wechat_btn"].set_size(self.startWidth,lv.SIZE.CONTENT) else: - self.wechat_list_dict[i]["wechat_btn"].set_size(self.startWidth,35) + self.wechat_list_dict[i]["wechat_btn"].set_size(self.startWidth,25) - self.wechat_list_dict[i]["wechat_btn"].set_pos(2,self.startY ) + self.wechat_list_dict[i]["wechat_btn"].set_pos(10,0 ) #self.wechat_list_dict[i]["wechat_btn"].add_style(style_wechat_s_btn, lv.PART.MAIN | lv.STATE.DEFAULT) self.wechat_list_dict[i]["wechat_btn"].set_style_bg_color(lv.color_make(0xff, 0xff, 0xff), lv.PART.MAIN | lv.STATE.DEFAULT) elif value.find("S:") != -1 : - self.wechat_list_dict[i]["wechat_btn"].set_size(self.startWidth,35) - self.wechat_list_dict[i]["wechat_btn"].set_pos(LCD_X-self.startWidth,self.startY ) + self.wechat_list_dict[i]["wechat_btn"].set_size(self.startWidth,25) + self.wechat_list_dict[i]["wechat_btn"].set_pos(118-self.startWidth,0 ) #for k in range(100): #self.wechat_list_dict[i]["wechat_btn"].add_style(style_wechat_r_btn, lv.PART.MAIN | lv.STATE.DEFAULT) self.wechat_list_dict[i]["wechat_btn"].set_style_bg_color(lv.color_make(0x00, 0xff, 0x2a), lv.PART.MAIN | lv.STATE.DEFAULT) @@ -438,10 +370,13 @@ class WechatScreen(Screen): self.wechat_list_dict[i]["_btn_label1"].set_pos(self.startWidth-78, 18) self.wechat_list_dict[i]["_btn_label1"].set_text(str(self.msg_tmp)+'\"') elif value.find("T:") != -1: - self.wechat_list_dict[i]["_btn_label1"].set_size(LCD_X-15, 35) + self.wechat_list_dict[i]["_btn_label1"].set_size(104, lv.SIZE.CONTENT) self.wechat_list_dict[i]["_btn_label1"].set_pos(5, 0) + print("self.msg_tmp:{}".format(self.msg_tmp)) + self.msg_tmp = self.msg_tmp.replace(':',':\n',1) + print("self.msg_tmp:{}".format(self.msg_tmp)) self.wechat_list_dict[i]["_btn_label1"].set_text(str(self.msg_tmp)) - self.wechat_list_dict[i]["_btn_label1"].set_long_mode(lv.label.LONG.DOT) + self.wechat_list_dict[i]["_btn_label1"].set_long_mode(lv.label.LONG.WRAP) #self.wechat_list_dict[i]["_btn_label1"].add_style(style_font_youyuan_20_black, lv.PART.MAIN | lv.STATE.DEFAULT) #_btn_label2 = lv.label(wechat_btn) self.wechat_list_dict[i]["_btn_label2"].set_size(0, 0) @@ -455,19 +390,19 @@ class WechatScreen(Screen): #_btn_img = lv.img(wechat_btn) self.wechat_list_dict[i]["_btn_img"].set_size(15, 15) if value.find("R:") != -1: - self.wechat_list_dict[i]["_btn_img"].set_pos(10, 10) + self.wechat_list_dict[i]["_btn_img"].set_pos(10, 5) self.wechat_list_dict[i]["_btn_img"].set_src("U:/static/R_3.png") elif value.find("S:") != -1: - self.wechat_list_dict[i]["_btn_img"].set_pos(self.startWidth-30, 10) + self.wechat_list_dict[i]["_btn_img"].set_pos(self.startWidth-20, 5) self.wechat_list_dict[i]["_btn_img"].set_src("U:/static/S_3.png") #self.wechat_list_dict[i]["_btn_img"].add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT) self.wechat_list_dict[i]["_btn_img"].clear_flag(lv.obj.FLAG.HIDDEN) else : self.wechat_list_dict[i]["_btn_img"].add_flag(lv.obj.FLAG.HIDDEN) - self.wechat_list_dict[i]["wechat_btn"].clear_flag(lv.obj.FLAG.HIDDEN) + self.wechat_list_dict[i]["wechat_obj"].clear_flag(lv.obj.FLAG.HIDDEN) wechat_btn_end = i - self.wechat_list_dict[wechat_btn_end]["wechat_btn"].scroll_to_view(lv.ANIM.OFF) + self.wechat_list_dict[wechat_btn_end]["wechat_obj"].scroll_to_view(lv.ANIM.OFF) # bottom_btn1 = self.wechat_list.get_child(-1) # bottom_btn1.scroll_to_view(lv.ANIM.ON) @@ -479,11 +414,10 @@ class WechatScreen(Screen): Wechat_log("talking_cb2") #按下录音 def talking(self,e): - if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1: - Wechat_log("talking1") - - self.clear_show_date() - + if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#有卡时触发sos报警 无卡时自动关机 + print("talking1") + self.play_timer.stop() + self.aud.stop() self.wechat_list.add_flag(lv.obj.FLAG.HIDDEN)#隐藏列表选项方框 self.countdown = 1 wechat_label.clear_flag(lv.obj.FLAG.HIDDEN) @@ -491,24 +425,23 @@ class WechatScreen(Screen): wechat_press_label_countdown.clear_flag(lv.obj.FLAG.HIDDEN) wechat_press_label_countdown.set_text("{}S".format(str(self.countdown))) - + #self.updata_list_show(2)#不需要显示语音列表 #按下说话 if self.wechat_num >= self.MXA_MSG: self.wechat_num = 0 self.wechat_num += 1 self.wechat_show = self.wechat_num - self.wechat_recode_list["num"] = 1 - Wechat_log("talking1.0") - self.record_test.start("/usr/static/storage_file/wechat.amr",16) + self.wechat_recode_list["num"] = self.wechat_num + print("talking1.0") + self.record_test.start("/usr/static/storage_file/{}.amr".format(self.wechat_num),16) self.second_timer.start(1000, 1, self.reduce_second) self.press_state = 1 self.ble_send = 1 #松开发送 - Wechat_log("talking2") + print("talking2") else: EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"}) - def sending_cb(self,e): @@ -523,9 +456,7 @@ class WechatScreen(Screen): EventMesh.publish("load_screen", {"screen": "no_sim_popup_screen"}) else: pass - # EventMesh.publish("load_screen", {"screen": "wechat_failed_popup_screen"}) - - + #松手0.2秒后显示 def hide_label(self,*args): Wechat_log("hide_label1") @@ -533,14 +464,14 @@ class WechatScreen(Screen): wechat_label.add_flag(lv.obj.FLAG.HIDDEN) wechat_label.set_text(" ") #self.updata_list_show(0) - EventMesh.publish("update_new_infor") + EventMesh.publish("publish_message_event_ui",{"func":self.updata_list_show,"data":0}) Wechat_log("hide_label2") #松开发送 def sending(self,e): Wechat_log("sending1") if self.press_state == 1: - #wechat_label.clear_flag(lv.obj.FLAG.HIDDEN) - #wechat_label.set_text("发送中") + # wechat_label.clear_flag(lv.obj.FLAG.HIDDEN) + # wechat_label.set_text("发送中") wechat_press_label_countdown.add_flag(lv.obj.FLAG.HIDDEN) wechat_press_label_countdown.set_text(" ") @@ -555,8 +486,8 @@ class WechatScreen(Screen): self.second_timer.stop() #停止计时器 self.countdown_old = self.countdown # Wechat_log("self.countdown :{} self.wechat_num:{} self.wechat_recode_list:{} self.wechat_show:{}".format(self.countdown,self.wechat_num,self.wechat_recode_list,self.wechat_show)) - self.wechat_recode_list["01"] = "S:{}".format(str(self.countdown)) - self.wechat_recode_list["num"] = 1 + self.wechat_recode_list["%02d"%(self.wechat_show)] = "S:{}".format(str(self.countdown)) + self.wechat_recode_list["num"] = self.wechat_show #读音频amr二进制数据 @@ -564,18 +495,17 @@ class WechatScreen(Screen): self.press_state = 0 self.ble_send = 0 ##隐藏显示文本 显示列表显示框 - + EventMesh.publish("publish_message_event_ui",{"func":self.updata_list_show,"data":2}) self.timer.start(200, 0, self.hide_label) with open("/usr/static/storage_file/wechat_record.json","w+",encoding="utf-8") as fd: ujson.dump(self.wechat_recode_list,fd) Wechat_log("send wechat data!!!!!!!!!!!!!!!!!!!!!") - path = "/usr/static/storage_file/wechat.amr".format(self.wechat_show) + path = "/usr/static/storage_file/{}.amr".format(self.wechat_show) with open(path,"rb") as fd: buf = bytearray(ql_fs.path_getsize(path)) fd.readinto(buf) senddata = [self.countdown_old,buf] EventMesh.publish(constants.PROTOCOL.TK_SEND,senddata) - EventMesh.publish("update_new_infor") Wechat_log("sending2") @@ -674,7 +604,7 @@ class WechatScreen(Screen): if self.play_text == "R:" or self.play_text == "S:":#过滤掉文字显示 不需要播放音频文件 self.aud = audio.Audio(0) self.aud.stop()# - self.aud.play(1, 1, '/usr/static/storage_file/wechat.amr') #文件名前面要加上路径 + self.aud.play(1, 1, '/usr/static/storage_file/{}.amr'.format(i)) #文件名前面要加上路径 self.paay_btn_old_count = self.paay_btn_count Wechat_log("play_label2") @@ -703,7 +633,7 @@ class WechatScreen(Screen): self.countdown += 1 else: self.countdown = 15 - self.sending(0) + self.sending_cb(0) if self.countdown >= 15: self.countdown = 15 @@ -718,6 +648,11 @@ class WechatScreen(Screen): def btn8_press(self): EventMesh.publish("watch_top_show") EventMesh.publish("load_screen", {"screen": "main_menu"}) + + + + + #微聊弹窗 wechat_popup_screen = lv.obj() @@ -858,12 +793,18 @@ class TK_ProtoCol(ProtoCol): Wechat_log("num_total:datalen:{} {}".format(MXA_MSG,wechat_recode_list)) - wechat_recode_list["01"] = "R:{}".format(3) - wechat_recode_list['num'] = 1 + wechat_recode_list["%02d"%(wechat_num)] = "R:{}".format(3) + wechat_recode_list['num'] = wechat_num EventMesh.publish("set_wechat_data",[MXA_MSG,wechat_recode_list]) #写语音文件数据 - - path = "/usr/static/storage_file/wechat.amr".format(wechat_num) + screen_NAME = EventMesh.publish("get_screen_NAME") + get_lcd_state = EventMesh.publish("get_lcd_state") + if screen_NAME != "wechat" or get_lcd_state == 0: + EventMesh.publish("load_screen", {"screen": "wechat_popup"}) + else: + EventMesh.publish("wechat_updata_list_show") + # path = "/ext/static/storage_file/audio_amr/amr/{}.amr".format(wechat_num) + path = "/usr/static/storage_file/{}.amr".format(wechat_num) with open(path,"w") as fd: arm = bytearray() j = 0 @@ -889,11 +830,7 @@ class TK_ProtoCol(ProtoCol): if j >= len(arm_data): break fd.write(arm) - EventMesh.publish(constants.PROTOCOL.TK_SEND,1) - state = EventMesh.publish("get_wechat_has_state") - if state == True: - EventMesh.publish("load_screen", {"screen": "wechat_popup"}) @@ -946,14 +883,20 @@ class MESSAGE_ProtoCol(ProtoCol): Wechat_log("wechat_num:init {}".format(wechat_num)) msg_txt = UnicodeHexStr_To_Utf8Str(msg_s) # Wechat_log("msg_txt:{}".format(msg_txt)) - wechat_recode_list["01"] = "T:{}".format(msg_txt) - wechat_recode_list['num'] = 1 + wechat_recode_list["%02d"%(wechat_num)] = "T:{}".format(msg_txt) + wechat_recode_list['num'] = wechat_num EventMesh.publish("set_wechat_data",[MXA_MSG,wechat_recode_list]) # Wechat_log("wechat_recode_list:len data:{}".format(wechat_recode_list)) EventMesh.publish(constants.PROTOCOL.MESSAGE_SEND) - state = EventMesh.publish("get_wechat_has_state") - if state == True: + screen_NAME = EventMesh.publish("get_screen_NAME") + get_lcd_state = EventMesh.publish("get_lcd_state") + if screen_NAME != "wechat" or get_lcd_state == 0: EventMesh.publish("load_screen", {"screen": "wechat_popup"}) + else: + EventMesh.publish("wechat_updata_list_show") + + + diff --git a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/protocol.py b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/protocol.py index 004ec777..624c06be 100644 --- a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/protocol.py +++ b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/protocol.py @@ -258,7 +258,7 @@ class SockManager(Abstract): data = data + r print("TCP recv: data:len:{}".format(len(data))) - print("TCP recv: data:{}".format(data)) + # print("TCP recv: data:{}".format(data)) if data[-1] != 0x5d and len(data)<20*1024: #']': continue self.connect_tmp = 1 #有数据,就认为是连接状态 diff --git a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui.py b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui.py index 399e0f04..e262369a 100644 --- a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui.py +++ b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui.py @@ -761,7 +761,7 @@ class CallLogScreen(Screen): call_log_title = lv.label(call_log_screen) - call_log_title.set_pos(0, 10) + call_log_title.set_pos(0, 5) call_log_title.set_size(LCD_X, 20) call_log_title.set_long_mode(lv.label.LONG.WRAP) call_log_title.set_text("通话记录") @@ -1860,7 +1860,7 @@ class PopupScreen(Screen): msg_top_title = lv.label(msg_list_screen) - msg_top_title.set_pos(0, 10) + msg_top_title.set_pos(0, 5) msg_top_title.set_size(LCD_X, 20) msg_top_title.set_text("信息") msg_top_title.set_long_mode(lv.label.LONG.WRAP) @@ -3932,7 +3932,7 @@ class ContactsScreen(Screen): contacts_screen_list_screen.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT) contacts_top_title = lv.label(contacts_screen) - contacts_top_title.set_pos(0, 10) + contacts_top_title.set_pos(0, 5) contacts_top_title.set_size(LCD_X, 20) contacts_top_title.set_text("联系人") contacts_top_title.set_long_mode(lv.label.LONG.WRAP) diff --git a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_main_menu.py b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_main_menu.py index a5fb8273..04a64870 100644 --- a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_main_menu.py +++ b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/ui_main_menu.py @@ -237,52 +237,52 @@ MainMenu2_img_camera_video_txt.add_style(style_font_youyuan_font_60, lv.PART.MAI MainMenu2_num+=1 MainMenu2x+=1 -#相机 -MainMenu2_camera = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) -label_text = lv.label(MainMenu2_camera) -label_text.set_pos(0, 0) -label_text.set_size(0, 0) -label_text.set_text("{}".format(MainMenu2_num)) -MainMenu2_img_camera = lv.img(MainMenu2_camera) -MainMenu2_img_camera.set_size(80,80) -MainMenu2_img_camera.set_pos(24,10) -MainMenu2_img_camera.set_src("U:/static/IMAGE_ONE_PAGE_CAMERA.png") -MainMenu2_img_camera.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu2_img_camera.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - -MainMenu2_img_camera_txt = lv.label(MainMenu2_camera) -MainMenu2_img_camera_txt.set_pos(int(0),int(100)) -MainMenu2_img_camera_txt.set_size(128,20) -MainMenu2_img_camera_txt.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu2_img_camera_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu2_img_camera_txt.set_text("相机") -MainMenu2_img_camera_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu2_num+=1 -MainMenu2x+=1 +# #相机 +# MainMenu2_camera = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) +# label_text = lv.label(MainMenu2_camera) +# label_text.set_pos(0, 0) +# label_text.set_size(0, 0) +# label_text.set_text("{}".format(MainMenu2_num)) +# MainMenu2_img_camera = lv.img(MainMenu2_camera) +# MainMenu2_img_camera.set_size(80,80) +# MainMenu2_img_camera.set_pos(24,10) +# MainMenu2_img_camera.set_src("U:/static/IMAGE_ONE_PAGE_CAMERA.png") +# MainMenu2_img_camera.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu2_img_camera.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) + +# MainMenu2_img_camera_txt = lv.label(MainMenu2_camera) +# MainMenu2_img_camera_txt.set_pos(int(0),int(100)) +# MainMenu2_img_camera_txt.set_size(128,20) +# MainMenu2_img_camera_txt.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu2_img_camera_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# MainMenu2_img_camera_txt.set_text("相机") +# MainMenu2_img_camera_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) +# MainMenu2_num+=1 +# MainMenu2x+=1 -#相册 -MainMenu2_camera_album = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) -label_text = lv.label(MainMenu2_camera_album) -label_text.set_pos(0, 0) -label_text.set_size(0, 0) -label_text.set_text("{}".format(MainMenu2_num)) -MainMenu2_img_camera_album = lv.img(MainMenu2_camera_album) -MainMenu2_img_camera_album.set_size(80,80) -MainMenu2_img_camera_album.set_pos(24,10) -MainMenu2_img_camera_album.set_src("U:/static/IMAGE_ONE_PAGE_ALBUM.png") -MainMenu2_img_camera_album.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu2_img_camera_album.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) - -MainMenu2_img_camera_album_txt = lv.label(MainMenu2_camera_album) -MainMenu2_img_camera_album_txt.set_pos(int(0),int(100)) -MainMenu2_img_camera_album_txt.set_size(128,20) -MainMenu2_img_camera_album_txt.add_flag(lv.obj.FLAG.CLICKABLE) -MainMenu2_img_camera_album_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) -MainMenu2_img_camera_album_txt.set_text("相册") -MainMenu2_img_camera_album_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) -MainMenu2_num+=1 -MainMenu2x+=1 +# #相册 +# MainMenu2_camera_album = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) +# label_text = lv.label(MainMenu2_camera_album) +# label_text.set_pos(0, 0) +# label_text.set_size(0, 0) +# label_text.set_text("{}".format(MainMenu2_num)) +# MainMenu2_img_camera_album = lv.img(MainMenu2_camera_album) +# MainMenu2_img_camera_album.set_size(80,80) +# MainMenu2_img_camera_album.set_pos(24,10) +# MainMenu2_img_camera_album.set_src("U:/static/IMAGE_ONE_PAGE_ALBUM.png") +# MainMenu2_img_camera_album.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu2_img_camera_album.add_style(style_MainMenu_img_default, lv.PART.MAIN | lv.STATE.DEFAULT) + +# MainMenu2_img_camera_album_txt = lv.label(MainMenu2_camera_album) +# MainMenu2_img_camera_album_txt.set_pos(int(0),int(100)) +# MainMenu2_img_camera_album_txt.set_size(128,20) +# MainMenu2_img_camera_album_txt.add_flag(lv.obj.FLAG.CLICKABLE) +# MainMenu2_img_camera_album_txt.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0) +# MainMenu2_img_camera_album_txt.set_text("相册") +# MainMenu2_img_camera_album_txt.add_style(style_font_youyuan_font_60, lv.PART.MAIN|lv.STATE.DEFAULT) +# MainMenu2_num+=1 +# MainMenu2x+=1 #工具箱 MainMenu2_toolbox = MainMenu2_til.add_tile(MainMenu2x, 0, lv.DIR.LEFT | lv.DIR.RIGHT) @@ -350,8 +350,8 @@ class MainMenuScreen(Screen): MainMenu2_img_toolbox.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "toolbox")), lv.EVENT.CLICKED, None) MainMenu2_img_setting.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "setting")), lv.EVENT.CLICKED, None) MainMenu2_img_camera_video.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera_video")), lv.EVENT.CLICKED, None) - MainMenu2_img_camera.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera")), lv.EVENT.CLICKED, None) - MainMenu2_img_camera_album.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera_album")), lv.EVENT.CLICKED, None) + # MainMenu2_img_camera.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera")), lv.EVENT.CLICKED, None) + # MainMenu2_img_camera_album.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "camera_album")), lv.EVENT.CLICKED, None) MainMenu2_img_contacts.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "contacts")), lv.EVENT.CLICKED, None) MainMenu2_img_wechat.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "wechat")), lv.EVENT.CLICKED, None) # MainMenu2_img_spo2.add_event_cb(lambda e: EventMesh.callback_wrapper(self.img_cb(e, "spo2")), lv.EVENT.CLICKED, None) diff --git a/2.sdk/project/K01/usr/static/R_1.png b/2.sdk/project/K01/usr/static/R_1.png new file mode 100644 index 00000000..4181128b Binary files /dev/null and b/2.sdk/project/K01/usr/static/R_1.png differ diff --git a/2.sdk/project/K01/usr/static/R_2.png b/2.sdk/project/K01/usr/static/R_2.png new file mode 100644 index 00000000..306ee598 Binary files /dev/null and b/2.sdk/project/K01/usr/static/R_2.png differ diff --git a/2.sdk/project/K01/usr/static/R_3.png b/2.sdk/project/K01/usr/static/R_3.png new file mode 100644 index 00000000..50740e14 Binary files /dev/null and b/2.sdk/project/K01/usr/static/R_3.png differ diff --git a/2.sdk/project/K01/usr/static/S_1.png b/2.sdk/project/K01/usr/static/S_1.png new file mode 100644 index 00000000..3e2569fa Binary files /dev/null and b/2.sdk/project/K01/usr/static/S_1.png differ diff --git a/2.sdk/project/K01/usr/static/S_2.png b/2.sdk/project/K01/usr/static/S_2.png new file mode 100644 index 00000000..e9121ab6 Binary files /dev/null and b/2.sdk/project/K01/usr/static/S_2.png differ diff --git a/2.sdk/project/K01/usr/static/S_3.png b/2.sdk/project/K01/usr/static/S_3.png new file mode 100644 index 00000000..c8459595 Binary files /dev/null and b/2.sdk/project/K01/usr/static/S_3.png differ