with self.lock:
self.map.update(msg)
ql_fs.touch(self.file_name, self.map)
-def voice_callback(args):
- print('voicecall iinfo:{}'.format(args))
- if args[0] == 10:
- get_UI_high_priority = EventMesh.publish("get_UI_high_priority")#如果在拨出去或者通话中屏蔽来电
- if get_UI_high_priority == 1:
- EventMesh.publish("set_interrup_incall",1)
- return
- print('voicecall incoming call, PhoneNO.: ', args[6])
- size_len = len(str(args[6]))
- tmp = []
- tmp = args[6]
- find_num = tmp[0]
- b = tmp[0].isdigit()#判断是否不是数字开头 暂时不用 因为截取了+判断不了 判断号码是否大于11位数,如果大于11位数 并且第一个字符是数字就按照最后11位做存储
-
- if b == True and size_len > 11:
- tmp = tmp[size_len-11:]
- EventMesh.publish("load_screen", {"screen": "incoming_call","meta":str(tmp)})
-
- elif args[0] == 11:
- EventMesh.publish("set_UI_high_priority",0)
- sos_flag = EventMesh.publish("get_sos_flag")
- if sos_flag == 1:
- sos_flag = 0
- EventMesh.publish("set_sos_flag",0)
-
- print('voicecall connected, PhoneNO.: ', args[6])
- size_len = len(str(args[6]))
- tmp = []
- tmp = args[6]
- find_num = tmp[0]
- b = tmp[0].isdigit()#判断是否不是数字开头 暂时不用 因为截取了+判断不了
- if b == True and size_len > 11:
- tmp = tmp[size_len-11:]
- EventMesh.publish("load_screen", {"screen": "on_call","meta":str(tmp)})
-
- elif args[0] == 12:
- set_interrup_call = EventMesh.publish("get_interrup_incall")#打断这次不需要来电的ui事件 以免通话中退出当前界面进不去了
- if set_interrup_call == 1:
- EventMesh.publish("set_interrup_incall",0)
- return
-
- EventMesh.publish("set_interrup_incall",0)
- EventMesh.publish("set_UI_high_priority",0)
+class sosInfoCallManager(Abstract):
+ # 通讯录
+ def __init__(self):
+ pass
- screen_NAME = EventMesh.publish("get_screen_NAME")
- if screen_NAME != None:
- if screen_NAME != "dialing_noplay_popup":
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
+ def post_processor_after_instantiation(self):
+ EventMesh.subscribe("set_sos_info_call", self.set_sos_info_call)
+
+ def set_sos_info_call(self, event, msg):
hangup_mode = EventMesh.publish("get_hangup_mode")
if hangup_mode == 1:
EventMesh.publish("set_sos_flag",0)
EventMesh.publish("set_callnumer_cb",number[2])
elif num == 3:
print("phone 6")
- EventMesh.publish("set_callnumer_cb",number[0])
+ EventMesh.publish("set_callnumer_cb",number[0])
+
+def voice_callback(args):
+ print('voicecall iinfo:{}'.format(args))
+ if args[0] == 10:
+ get_UI_high_priority = EventMesh.publish("get_UI_high_priority")#如果在拨出去或者通话中屏蔽来电
+ if get_UI_high_priority == 1:
+ EventMesh.publish("set_interrup_incall",1)
+ return
+ print('voicecall incoming call, PhoneNO.: ', args[6])
+ size_len = len(str(args[6]))
+ tmp = []
+ tmp = args[6]
+ find_num = tmp[0]
+ b = tmp[0].isdigit()#判断是否不是数字开头 暂时不用 因为截取了+判断不了 判断号码是否大于11位数,如果大于11位数 并且第一个字符是数字就按照最后11位做存储
+
+ if b == True and size_len > 11:
+ tmp = tmp[size_len-11:]
+ EventMesh.publish("load_screen", {"screen": "incoming_call","meta":str(tmp)})
+
+ elif args[0] == 11:
+ EventMesh.publish("set_UI_high_priority",0)
+ sos_flag = EventMesh.publish("get_sos_flag")
+ if sos_flag == 1:
+ sos_flag = 0
+ EventMesh.publish("set_sos_flag",0)
+
+ print('voicecall connected, PhoneNO.: ', args[6])
+ size_len = len(str(args[6]))
+ tmp = []
+ tmp = args[6]
+ find_num = tmp[0]
+ b = tmp[0].isdigit()#判断是否不是数字开头 暂时不用 因为截取了+判断不了
+ if b == True and size_len > 11:
+ tmp = tmp[size_len-11:]
+ EventMesh.publish("load_screen", {"screen": "on_call","meta":str(tmp)})
+
+ elif args[0] == 12:
+ set_interrup_call = EventMesh.publish("get_interrup_incall")#打断这次不需要来电的ui事件 以免通话中退出当前界面进不去了
+ if set_interrup_call == 1:
+ EventMesh.publish("set_interrup_incall",0)
+ return
+
+ EventMesh.publish("set_interrup_incall",0)
+ EventMesh.publish("set_UI_high_priority",0)
+
+
+ screen_NAME = EventMesh.publish("get_screen_NAME")
+ if screen_NAME != None:
+ if screen_NAME != "dialing_noplay_popup":
+ EventMesh.publish("load_screen", {"screen": "main_menu"})
+
+ EventMesh.publish("set_sos_info_call")
print('voicecall disconnect end')
EventMesh.publish("save_phonename",number[0])
EventMesh.publish("save_phonenum",number[0])
EventMesh.publish("set_sos_num",0)
- voiceCall.callStart(str(number[0]))
+ EventMesh.publish("load_screen", {"screen": "dialing_noplay_popup"})
+ #voiceCall.callStart(str(number[0]))
def set_callnumer_cb(self, event, msg):
self.callnumer = msg
# print("call_timer_cb:{}".format(self.callnumer))
EventMesh.publish("save_phonename",str(self.callnumer))
EventMesh.publish("save_phonenum",str(self.callnumer))
- voiceCall.callStart(str(self.callnumer))
+ EventMesh.publish("load_screen", {"screen": "dialing_noplay_popup"})
def get_sos_flag(self, event, msg):
return self.sos_flag
#voiceCall.callStart(str(phonnum))
EventMesh.publish("load_screen", {"screen": "dialing_noplay_popup"})
else:
- EventMesh.publish("load_screen", {"screen": "no_valied_num_screen"})
+ EventMesh.publish("load_screen", {"screen": "no_valied_num_screen"})#无效的号码 请重新输入
def done_return(self):
dialing_name.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
dialing_call_label = lv.label(dialing_screen)
- dialing_call_label.set_pos(0, 180)
+ dialing_call_label.set_pos(0, 174)
dialing_call_label.set_size(240, 50)
- dialing_call_label.set_text("正在等待对方接听电话")
+ dialing_call_label.set_text("正在等待对方接\n听电话")
dialing_call_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
dialing_call_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
def post_processor_after_initialization(self):
self.time_count = 0
-
self.timer1.start(1000, 1, self.timeout_hangup)
self.timer2.start(2000, 0, self.timeout_call)
def timeout_hangup(self,e):
EventMesh.publish("system_sleep_rest")#防止黑屏
self.time_count+=1
- if self.time_count >= 10:
+ if self.time_count >= 5:#5s内没有打通则不在继续拨打关闭
self.time_count = 0
EventMesh.publish("set_UI_high_priority", 0)
- EventMesh.publish("load_screen", {"screen": "main_menu"})
-
+ sos_flag = EventMesh.publish("get_sos_flag")
+ if sos_flag == 1:
+ EventMesh.publish("set_sos_flag",0)
+ EventMesh.publish("set_sos_num",0)
+ EventMesh.publish("set_hangup_mode",0)
+
+ EventMesh.publish("load_screen", {"screen": "dial_no_connect_popup"})
def hangup(self,e):
EventMesh.publish("set_UI_high_priority", 0)
- EventMesh.publish("load_screen", {"screen": "main_menu"})
voiceCall.callEnd()
+ sos_flag = EventMesh.publish("get_sos_flag")
+ if sos_flag == 1:
+ EventMesh.publish("set_sos_flag",0)
+ EventMesh.publish("set_sos_num",0)
+ EventMesh.publish("set_hangup_mode",0)
+ EventMesh.publish("return_prev_screen") #返回上一级
def Close(self):
self.timer1.stop()
else:
EventMesh.publish(constants.EVENT.SYSTEM_UP)
+dial_no_connect_popup = None
+dialing_connect_call = None
+class DialNoconnectPopupScreen(Screen):#你所拨打的电话暂时无法接通
+ NAME = "dial_no_connect_popup"
+
+ def __init__(self):
+ super().__init__()
+ self.meta = None
+ self.meta_type = "popup"
+ self.timer = osTimer()
+ self.time_count = 0
+
+ def initialization(self):
+ global dial_no_connect_popup,dialing_connect_call
+ if dial_no_connect_popup == None:
+ dial_no_connect_popup = lv.obj()
+ print("dial_no_connect_popup")
+ dial_no_connect_popup.add_style(style_screen, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ dialing_connect_call = lv.label(dial_no_connect_popup)
+ dialing_connect_call.set_pos(0, 110)
+ dialing_connect_call.set_size(240, 150)
+ dialing_connect_call.set_text("你好,你所拨打的\n电话暂时无法接\n通,请稍后再拨")
+ dialing_connect_call.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ dialing_connect_call.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ self.meta = dial_no_connect_popup
+
+ def post_processor_after_initialization(self):
+ self.time_count = 0
+ self.timer.start(1000, 1, self.timeout_hangup)
+
+ def timeout_hangup(self,e):
+ EventMesh.publish("system_sleep_rest")#防止黑屏
+ self.time_count+=1
+ if self.time_count >= 10:
+ self.time_count = 0
+ EventMesh.publish("return_prev_screen")
+
+ def Close(self):
+ self.timer.stop()
+
+ def done_left_to_right(self):
+ EventMesh.publish("return_prev_screen")
+
+ def done_right_to_left(self):
+ EventMesh.publish("return_prev_screen")
+
+ def done_bottom_to_top(self):
+ EventMesh.publish("return_prev_screen")
+
+ def done_top_to_bottom(self):
+ EventMesh.publish("return_prev_screen")
+
+ def done_return(self):
+ EventMesh.publish("return_prev_screen")
+ def done_click(self):
+ EventMesh.publish("return_prev_screen")
+
+ def btn1_release(self):
+ EventMesh.publish("return_prev_screen")
+
+ def btn8_press(self):
+ EventMesh.publish("return_prev_screen")
message_popup_screen = None
message_popup_title = None
#进入图片
sos_screen_label = lv.label(sos_screen)
- sos_screen_label.set_pos(0, 20)
+ sos_screen_label.set_pos(0, 40)
sos_screen_label.set_size(240, 30)
sos_screen_label.set_text("SOS")
sos_screen_label.add_style(style_font_youyuan_20_red, lv.PART.MAIN | lv.STATE.DEFAULT)
sos_screen_label.set_long_mode(lv.label.LONG.WRAP)
sos_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
- sos_screen_label_p = lv.label(sos_screen)
- sos_screen_label_p.set_pos(int(0),int(100))
- sos_screen_label_p.set_size(240,50)
- sos_screen_label_p.set_text("正在紧急呼叫中,请稍等...")
- sos_screen_label_p.set_long_mode(lv.label.LONG.WRAP)
- sos_screen_label_p.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
- sos_screen_label_p.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+
+ sos_screen_label = lv.label(sos_screen)
+ sos_screen_label.set_text("是否拨打紧急\n求助电话?")
+ sos_screen_label.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
+ sos_screen_label.set_size(240, 50)
+ sos_screen_label.set_pos(0,90)
+ sos_screen_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ sos_screen_confirm_img = lv.img(sos_screen)
+ sos_screen_confirm_img.set_size(176, 46)
+ sos_screen_confirm_img.set_pos(32, 160)
+ sos_screen_confirm_img.set_src("E:/static/off_icon.png")
+ sos_screen_confirm_img.add_flag(lv.obj.FLAG.CLICKABLE)
+ sos_screen_confirm_img.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ sos_screen_confirm_label = lv.label(sos_screen_confirm_img)
+ sos_screen_confirm_label.set_text("确定")
+ sos_screen_confirm_label.align(lv.ALIGN.CENTER, 0, 5)
+ sos_screen_confirm_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+
+ sos_screen_return = lv.img(sos_screen)
+ sos_screen_return.set_size(176, 46)
+ sos_screen_return.set_pos(32, 230)
+ sos_screen_return.set_src("E:/static/cancel_icon.png")
+ sos_screen_return.add_flag(lv.obj.FLAG.CLICKABLE)
+ sos_screen_return.add_style(style_img, lv.PART.MAIN | lv.STATE.DEFAULT)
+ sos_screen_return_label = lv.label(sos_screen_return)
+ sos_screen_return_label.set_text("取消")
+ sos_screen_return_label.align(lv.ALIGN.CENTER, 0, 5)
+ sos_screen_return_label.add_style(style_font_youyuan_20, lv.PART.MAIN | lv.STATE.DEFAULT)
+ sos_screen_return_label.set_ext_click_area(20)
self.meta = sos_screen
+ sos_screen_confirm_img.add_event_cb(lambda e: EventMesh.callback_wrapper(self.timer_comfirm_cb(e)),
+ lv.EVENT.CLICKED, None)
+
+ sos_screen_return.add_event_cb(lambda e: EventMesh.callback_wrapper(self.timer_cancel_cb(e)),
+ lv.EVENT.CLICKED, None)
+
+ def timer_comfirm_cb(self,e):
+ EventMesh.publish("set_sos_flag", 1)
+
+ def timer_cancel_cb(self,e):
+ EventMesh.publish("return_prev_screen")
+
def post_processor_before_initialization(self):
self.count = 0
- self.timer1.start(5000,0,self.timer_cb)
- self.timer2.start(1000,1,self.timer_cb_onescond)
-
- def timer_cb(self,e):
- EventMesh.publish("set_sos_flag", 1)
+ self.timer1.start(1000,1,self.timer_cb_onescond)
def timer_cb_onescond(self,e):
EventMesh.publish("system_sleep_rest")#防止黑屏
self.count+=1
if self.count >= 10:
self.count = 0
- EventMesh.publish("return_prev_screen")
+ EventMesh.publish("set_sos_flag", 1)
def Close(self):
- self.timer2.stop()
+ self.timer1.stop()
def done_left_to_right(self):
EventMesh.publish("return_prev_screen")