def __init__(self):
self.timer = osTimer()
- self.pwk_timer = osTimer()
+ self.pwk_timer1 = osTimer()
+ self.pwk_timer2 = osTimer()
self.timer1 = osTimer()
+ self.timer1_sos = osTimer()
+ self.sos_timer1 = osTimer()
self.aud = audio.Audio(0)
self.aud.set_pa(Pin.GPIO29)
self.aud.setVolume(11)
self.read_data = {}
self.volum_size = 8
self.phone_num = ''
+ self.sos_phone_num = ''
self.msg_tmp = ""
self.time_count = 0
check_txt = ql_fs.path_exists("/usr/static/storage_file/wechat_record.json")
EventMesh.subscribe("call_test_event", self.call_test_event)#电话拨进响铃测试
EventMesh.subscribe("dial_out_call_center_cb", self.dial_out_call_center_cb)#电话拨出去
+ EventMesh.subscribe("sos_out_call_center_cb", self.sos_out_call_center_cb)#sos拨打
EventMesh.subscribe("close_audio_play", self.close_audio_play)#关闭音频
EventMesh.subscribe("recv_wechat_audio", self.recv_wechat_audio)#
+
+ EventMesh.subscribe("sos_short_press", self.sos_short_press)#sos短按事件
+
+
+ def sos_short_press(self,args,msg):
+ EventMesh.publish("interup_call_event")#如果在电话中强制挂断电话
+ EventMesh.publish("close_audio_play")#强制关闭音频文件播放
+ EventMesh.publish("STOP_FIND_WATCH")#停止查找设备
+ EventMesh.publish("STOP_ALARM_RING")#停止闹钟响铃
+ EventMesh.publish("play_cur_time_event")#播报当前时间
+ #播报当前时间
+
def recv_wechat_audio(self,event,str_data):#接收微聊语音播放
if self.press_btn == 0:
str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_WECHAT_RECV"))
def audio_event_queue_thread(self):
while True:
data = self.audio_event_queue.get()
- #print("interInfo_queue_thread:data = {}".format(data))
+ #print("audio_event_queue:data = {}".format(data))
if data != None:
try:
data["func"](data["data"])
except Exception as e:
- print("interInfo_queue_thread:ERROR:{}".format(e))
+ print("audio_event_queue:ERROR:{}".format(e))
usys.print_exception(e)
def publish_message_event_audio(self,event,msg):
self.audio_event_queue.put(msg)
def play_audio_file_do(self,data):#msg 拼接的路径文件
open_power = EventMesh.publish("get_power_on_state")#获取开机标识
power_off = EventMesh.publish("get_power_off_state")#获取开机标识
+ print("play_audio_file",data[0],data[1],open_power,power_off)#路径 str_data[1] 是否需要被打断
if open_power != None:
if open_power == 0:
return
if power_off != None:
if power_off == 1:
return
- print("play_audio_file",data[0],data[1])#路径 str_data[1] 是否需要被打断
+ print("play_audio_file end",data[0],data[1])#路径 str_data[1] 是否需要被打断
self.aud.montage_play('U:/static/audio.bin',1,data[1],data[0])
EventMesh.publish("publish_message_event_interInfo",{"func":self.Alarm_timer_cb,"data":0})
def powe_resatrt_down_fun(self, *args):
- EventMesh.publish("close_all_led")#关闭所有的灯
+ EventMesh.publish("close_led_pin")
self.aud.stopPlayStream()
Power.powerRestart()
def power_down_fun(self, *args):
- EventMesh.publish("close_all_led")#关闭所有的灯
+ EventMesh.publish("close_led_pin")
self.aud.stopPlayStream()
Power.powerDown()
def close_timer_all(self, event, msg):
- self.timer.stop()
+ print("close_timer_all!!!!!!!!!!!!!!!!!!!")
open_power = EventMesh.publish("get_power_on_state")#获取开机标识
power_off = EventMesh.publish("get_power_off_state")#获取开机标识
if open_power != None:
return
self.aud.stopPlayStream()
+ self.timer.stop()
+
def answer_call_event(self, event, msg): #
self.timer1.start(2000, 0, self.time_out_phone)
str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_SOS_ALERT"))
EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件
+
+ def sos_out_call_center_cb(self, event, msg):#sos电话呼叫中
+ open_power = EventMesh.publish("get_power_on_state")#获取开机标识
+ if open_power != None:
+ if open_power == 0:
+ return
+ power_off = EventMesh.publish("get_power_off_state")#获取开机标识
+ if power_off != None:
+ if power_off == 1:
+ return
+ self.sos_phone_num = ''
+ print("sos_out_call_center_cb",msg)
+ if self.call_state == 0:
+ EventMesh.publish("close_timer_all")#
+ if msg == None:
+ str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_NO_SET_SOS_DIAL"))
+ EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件
+ # EventMesh.publish("play_audio_file",str_data)#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
+ else:
+ self.sos_phone_num = msg
+ self.sos_timer1.start(2000, 0, self.sos_call_out_phone)
+ self.timer1_sos.start(30000, 0, self.sos_time_out_phone)
+ str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_SOS_ALERT"))
+ EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件
+ def sos_time_out_phone(self, msg):#30s超时未打通或者信号不好则重新拨打
+ sos_flag = EventMesh.publish("get_sos_flag")
+ if sos_flag == 1:
+ if self.call_state == 0:
+ EventMesh.publish("set_sos_info_call")
- def time_out_phone(self, msg):#电话拨出去
- voiceCall.callStart(self.phone_num)
+ def sos_call_out_phone(self, msg):#电话拨出去
+ voiceCall.callStart(self.sos_phone_num)
def call_test_event(self, event, msg):
if msg == 1:
self.usbState = msg
-
+ str_buf = [1,1,10,led_mode.LONG_LIGHT_RED,4,2,led_mode.CHARGE_IN_MODE]
+ EventMesh.publish("set_led_time_arg",str_buf)#
if flag == 3 or flag == 1 or flag == 0:#电话通话中 或者呼叫中挂断中断
EventMesh.publish("close_timer_all")#
str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_CHARGE_IN"))
EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
-
- EventMesh.publish("set_led_time_arg",None)#
print("charge R_CHARGE_IN")
elif msg == 2:
self.usbState = msg
+ EventMesh.publish("stop_led_timer")#设置参数
+ # EventMesh.publish("set_led_time_arg",[0,1000,1,led_mode.FLASH_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.CHARGE_OUT_MODE])#測量成功
+ EventMesh.publish("set_led_time_arg",[1,1,0,led_mode.FLASH_LIGHT_GREEN,4,4,led_mode.CHARGE_OUT_MODE])#測量成功
print("charge R_CHARGE_OUT")
if flag == 3 or flag == 1 or flag == 0:#电话通话中 或者呼叫中挂断中断
EventMesh.publish("close_timer_all")#
str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_CHARGE_OUT"))
EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
- EventMesh.publish("stop_led_timer")#设置参数
- # EventMesh.publish("set_led_time_arg",[0,1000,1,led_mode.FLASH_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.CHARGE_OUT_MODE])#測量成功
- EventMesh.publish("set_led_time_arg",[1,1,0,led_mode.FLASH_LIGHT_GREEN,4,4,led_mode.CHARGE_OUT_MODE])#測量成功
+
elif msg == 3:
self.usbState = msg
print("charge full")
-
+ str_buf = [1,1,10,led_mode.LONG_LIGHT_GREEN,4,2,led_mode.CHARGE_FULL_MODE]
+ EventMesh.publish("set_led_time_arg",str_buf)#
if flag == 3 or flag == 1 or flag == 0:#电话通话中 或者呼叫中挂断中断
EventMesh.publish("close_timer_all")#
str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_CHARGE_FULL"))
EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
- EventMesh.publish("set_led_time_arg",None)#
+
def get_usb(self, event, msg):
def open_power_on(self, event, msg): #msg 1 开机 2 关机 3 重启 4恢复出厂设置
EventMesh.publish("close_timer_all")#
if msg == 1:
- self.power_on_flag = 1
- str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_POWER_OFF_1"))
- EventMesh.publish("play_audio_file",[str_data,0])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
- EventMesh.publish("set_led_time_arg",[1,2,4*8,led_mode.FLASH_LIGHT_GREEN,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功
- # EventMesh.publish("set_led_time_arg",[1000,200,10,led_mode.FLASH_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数
- self.power_on_flag = 0
- self.pwk_timer.start(5000,0,self.power_on_cb)
+
+ # str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_POWER_OFF_1"))
+ # EventMesh.publish("play_audio_file",[str_data,0])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
+ self.pwk_timer1.start(3000,0,self.power_on_audio_cb)
+
elif msg == 2:
flag = EventMesh.publish("get_call_state")
if flag != 0:#电话呼叫中
date_tmp = utime.localtime()
time_tmp = utime.mktime(date_tmp)
EventMesh.publish("set_storage_config",["old_time",time_tmp])#关机保存一个是时间
- str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_POWER_OFF_1"))
- EventMesh.publish("play_audio_file",[str_data,0])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
- EventMesh.publish("set_led_time_arg",[1,2,4*8,led_mode.FLASH_LIGHT_RED,4,2,led_mode.OTHER_MEASURE_MODE])#
- self.power_off = 1
- # EventMesh.publish("set_led_time_arg",[1000,200,10,led_mode.FLASH_LIGHT_RED,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#
- self.timer.start(6000,0,self.publish_power_down_event_cb)
+ self.pwk_timer1.start(3000,0,self.power_off_audio_cb)
elif msg == 3:
flag = EventMesh.publish("get_call_state")
if flag != 0:#电话呼叫中
voiceCall.callEnd()
- str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_POWER_OFF_1"))
- EventMesh.publish("play_audio_file",[str_data,0])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
- # EventMesh.publish("stop_led_timer")#设置参数
+ self.aud.play(1,0,'U:/static/R_POWER_OFF_1.mp3')
+ # str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_POWER_OFF_1"))
+ # EventMesh.publish("play_audio_file",[str_data,0])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
+ EventMesh.publish("stop_led_timer")#设置参数
self.power_off = 1
self.timer.start(8000,0,self.publish_resatrt_down_event_cb)
#EventMesh.publish("set_led_time_arg",[3000,4000,1,led_mode.LONG_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE])#
def power_on_cb(self, msg): #msg 开机标识
self.power_on_flag = 1
+ def clear_power_on_cb(self, msg): #msg 开机标识
+ self.power_on_flag = 0
+ def power_on_audio_cb(self, msg):
+ self.power_on_flag = 1
+ print("power_on_audio_cb")
+ self.aud.play(1,0,'U:/static/R_POWER_OFF_1.mp3')
+ # str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_POWER_OFF_1"))
+ # EventMesh.publish("play_audio_file",[str_data,0])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
+ EventMesh.publish("set_led_time_arg",[1,2,4*8,led_mode.FLASH_LIGHT_GREEN,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功
+ # EventMesh.publish("set_led_time_arg",[1000,200,10,led_mode.FLASH_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数
+ self.pwk_timer1.start(2000,0,self.clear_power_on_cb)
+ self.pwk_timer2.start(6000,0,self.power_on_cb)
+
def get_power_on_state(self, event, msg):
return self.power_on_flag
+ def power_off_audio_cb(self, msg):
+ print("power_off_audio_cb")
+ self.aud.play(1,0,'U:/static/R_POWER_OFF_1.mp3')
+ # str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_POWER_OFF_1"))
+ # EventMesh.publish("play_audio_file",[str_data,0])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
+ EventMesh.publish("set_led_time_arg",[1,2,4*8,led_mode.FLASH_LIGHT_RED,4,2,led_mode.POWER_OFF_MODE])#
+
+ self.pwk_timer1.start(2000,0,self.set_power_off_cb)
+ self.pwk_timer2.start(7000,0,self.publish_power_down_event_cb)
+
+ def set_power_off_cb(self, msg):
+ self.power_off = 1
+
def get_power_off_state(self, event, msg):
return self.power_off
- def close_hr_sop2(self, event, msg): #msg 关闭心率血氧测试
+ def close_hr_sop2(self, event, msg): #msg 关闭心率血氧体温测试
get_hr_state = EventMesh.publish("get_hr_state")
get_spo2_state = EventMesh.publish("get_spo2_state")
- if get_hr_state != None and get_spo2_state != None:
+ get_temp_state = EventMesh.publish("get_temp_state")
+ if get_hr_state != None or get_spo2_state != None or get_temp_state != None:
if get_hr_state != 0:
EventMesh.publish("set_hr_state",0)#2代表后台进入测试,定时测心率 1ui界面测试洗心率
print("sstop hr")
print("stop spo2")
EventMesh.publish("set_spo2_state",0)#2代表后台进入测试
EventMesh.publish(constants.EVENT.STOP_BLOOD_OXYGEN)
+ if get_temp_state != 0:
+ print("stop temp")
+ EventMesh.publish("set_temp_state",0)
+ EventMesh.publish(constants.EVENT.STOP_TEMP)#手动体温测试
def set_manual_measure_mode(self, event, msg): #手动测试 1心率 2 血氧 3 体温
get_hr_state = EventMesh.publish("get_hr_state")
flag = EventMesh.publish("get_call_state")
if flag != 2:#电话通话中 或者呼叫中挂断中断
EventMesh.publish("close_timer_all")#
+ # EventMesh.publish("stop_led_timer")#设置参数
mode = 0
signal = EventMesh.publish("screen_get_sig")
if signal != None:
else:#未插卡
mode = 3
if mode == 1:#白色灯
- EventMesh.publish("set_led_time_arg",[1,1,6,led_mode.FLASH_LIGHT_WHITE,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功
+ EventMesh.publish("set_led_time_arg",[1,2,10,led_mode.FLASH_LIGHT_WHITE,10,5,led_mode.OTHER_MEASURE_MODE])#測量成功
# EventMesh.publish("set_led_time_arg",[1000,400,1,led_mode.FLASH_LIGHT_WHITE,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数
str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_SIM_FAILE"))
EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
pass
elif mode == 2:#蓝灯色灯
- EventMesh.publish("set_led_time_arg",[1,1,6,led_mode.FLASH_LIGHT_GREEN,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功
+ EventMesh.publish("set_led_time_arg",[1,2,10,led_mode.FLASH_LIGHT_GREEN,10,5,led_mode.OTHER_MEASURE_MODE])#測量成功
# EventMesh.publish("set_led_time_arg",[1000,400,1,led_mode.FLASH_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数
str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_SIM_CONNECT"))
EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
pass
elif mode == 3:#红灯闪烁
+ EventMesh.publish("set_led_time_arg",[1,2,10,led_mode.FLASH_LIGHT_RED,10,5,led_mode.OTHER_MEASURE_MODE])#測量成功
str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_NO_SIM"))
EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
- EventMesh.publish("set_led_time_arg",[1,1,6,led_mode.FLASH_LIGHT_RED,4,2,led_mode.OTHER_MEASURE_MODE])#測量成功
- # EventMesh.publish("set_led_time_arg",[1000,400,1,led_mode.FLASH_LIGHT_RED,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数
- pass
pass
def dial_sos_phone(self, event, msg): #拨打紧急求助电话
if sos_number != None:
if len(sos_number) != 0:
EventMesh.publish("close_timer_all")#
- EventMesh.publish("save_phonename",sos_number[0])
- EventMesh.publish("save_phonenum",sos_number[0])
- EventMesh.publish("set_sos_num",0)
+ # EventMesh.publish("save_phonename",sos_number[0])
+ # EventMesh.publish("save_phonenum",sos_number[0])
+ # EventMesh.publish("set_sos_num",0)
EventMesh.publish("set_sos_flag",1)
- str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_SOS_ALERT"))
- EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件
- voiceCall.callStart(sos_number[0])
+ # str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_SOS_ALERT"))
+ # EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件
+ # voiceCall.callStart(sos_number[0])
else:#未设置sos紧急求助号码
EventMesh.publish("close_timer_all")#
str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_NO_SET_SOS_DIAL"))
EventMesh.publish("close_timer_all")#
str_data = 'mp3files={}.mp3'.format(audio_buf.index("R_NO_SIM"))
EventMesh.publish("play_audio_file",[str_data,1])#获取播放音频文件('U:/static/audio.bin',1,1,str_data)
-
+
+
+
+
+
def send_find_watch(self, event, msg): #发送查找设备指令
open_power = EventMesh.publish("get_power_on_state")#获取开机标识
if open_power != None:
if self.alarm_state == 1:
self.alarm_state = 0
self.alarm_timer_count = 0
+ # EventMesh.publish("stop_led_timer")#设置参数
self.aud.stopPlayStream() #停止播放
self.timer.stop()
time_tmp = utime.mktime(date_tmp)
if state != None:
if state == 1:
- EventMesh.publish("set_led_time_arg",[1,1,4,led_mode.FLASH_LIGHT_GREEN,2,1,led_mode.OTHER_MEASURE_MODE])#測量成功
+ EventMesh.publish("set_led_time_arg",[1,2,8,led_mode.FLASH_LIGHT_GREEN,8,4,led_mode.OTHER_MEASURE_MODE])#測量成功
# EventMesh.publish("set_led_time_arg",[1000,400,1,led_mode.FLASH_LIGHT_GREEN,led_mode.DEFAULT_LONG_LIGHT_MODE,led_mode.OTHER_MEASURE_MODE])#设置参数
if self.updateTime == 0:
self.updateTime = time_tmp
self.btnInfo_queue = Queue()
_thread.start_new_thread(self.btnInfo_queue_thread, ())
EventMesh.subscribe("publish_message_event_btnInfo",self.publish_message_event_btnInfo)
+
+ EventMesh.subscribe("close_wechat_btn_timer", self.close_wechat_btn_timer)#来电强制关闭微聊语音
+
def btnInfo_queue_thread(self):
while True:
data = self.btnInfo_queue.get()
def post_processor_after_instantiation(self):
# self.keypad.init()
# self.keypad.set_callback(self.key_callback)
- EventMesh.subscribe("sos_short_press", self.sos_short_press)#sos短按事件
- EventMesh.subscribe("close_wechat_btn_timer", self.close_wechat_btn_timer)#来电强制关闭微聊语音
+
self.pk.powerKeyEventRegister(self.powerKey_callback)
self.extint = ExtInt(ExtInt.GPIO26, ExtInt.IRQ_RISING_FALLING, ExtInt.PULL_DISABLE, self.pwk_extint_cb)
key19 = Pin(Pin.GPIO19, Pin.OUT, Pin.PULL_PU, 0)
- def sos_short_press(self,args,msg):
- EventMesh.publish("interup_call_event")#如果在电话中强制挂断电话
- EventMesh.publish("close_audio_play")#强制关闭音频文件播放
- EventMesh.publish("stop_led_timer")#设置参数关闭定时器 同时也关闭所有的灯再开相对应的灯
- EventMesh.publish("STOP_FIND_WATCH")#停止查找设备
- EventMesh.publish("STOP_ALARM_RING")#停止闹钟响铃
- EventMesh.publish("play_cur_time_event")#播报当前时间
- #播报当前时间
-
-
def pwk_extint_cb(self,args):#侧边按键
self.GPIO26_status = self.extint.read_level()
print('### key20_extint_cb {} self.GPIO26_status :{}'.format(args,self.GPIO26_status)) # args[0]:gpio号 args[1]:上升沿或下降沿
EventMesh.publish("publish_message_event_btnInfo",{"func":self.pwKey_timeout_cb,"data":0})
def pwKey_timeout_cb(self, data):#侧边按键
- if self.pwKey_press_count >= 1:
+ if self.pwKey_press_count == 1:
+ EventMesh.publish("stop_led_timer")#设置参数
EventMesh.publish("dialing_out_event")#电话呼叫中voiceCall.callEnd()
self.pwKey_press_count = 0
# EventMesh.publish(constants.EVENT.START_LOCATION) #开始定位
EventMesh.publish("close_hr_sop2")#
flag = EventMesh.publish("get_call_state")
if flag != 1:
- EventMesh.publish("set_sim_mode")#播報imei号
+ EventMesh.publish("set_sim_mode")#
def sosKey_extint_cb(self,args):
power_off = EventMesh.publish("get_power_off_state")#获取关机标识
EventMesh.publish("publish_message_event_btnInfo",{"func":self.sosKey_timeout_cb,"data":0})
def sosKey_timeout_cb(self, data):#
print("sosKey_press_count!!!!!!!!!!!!!! ",self.sosKey_press_count)
- if self.sosKey_press_count >= 10:#
+ if self.sosKey_press_count == 10:#
self.sosKey_press_count = 0
# EventMesh.publish("reset_factor_setiing")#
pass
- elif self.sosKey_press_count >= 6:#
+ elif self.sosKey_press_count == 6:#
self.sosKey_press_count = 0
+ EventMesh.publish("stop_led_timer")#设置参数
EventMesh.publish("set_manual_measure_mode",2)#测量血氧
# EventMesh.publish("play_imei_event")#播報imei号
pass
- elif self.sosKey_press_count >= 5:
- self.sosKey_press_count = 0
- EventMesh.publish("set_manual_measure_mode",3)#测量体温
- pass
- elif self.sosKey_press_count >= 4:#拨打app快捷号码
+ # elif self.sosKey_press_count >= 5:#功能暂时屏蔽
+ # self.sosKey_press_count = 0
+ # # EventMesh.publish("stop_led_timer")#设置参数
+ # # EventMesh.publish("set_manual_measure_mode",3)#测量体温
+ # pass
+ elif self.sosKey_press_count == 4:#拨打app快捷号码
self.sosKey_press_count = 0
+ EventMesh.publish("stop_led_timer")#设置参数
EventMesh.publish("play_center_phone")#拨打快捷号码
# EventMesh.publish("call_phonebook_three_call")
pass
- elif self.sosKey_press_count >= 3:#测试心率
+ elif self.sosKey_press_count == 3:#测试心率
self.sosKey_press_count = 0
+ EventMesh.publish("stop_led_timer")#设置参数
EventMesh.publish("set_manual_measure_mode",1)#
pass
- elif self.sosKey_press_count >= 2:#播报当前步数
+ elif self.sosKey_press_count == 2:#播报当前步数
self.sosKey_press_count = 0
+ EventMesh.publish("stop_led_timer")#设置参数
EventMesh.publish("play_cur_step_event")#
pass
- elif self.sosKey_press_count >= 1:#挂断来电 短语音播报
+ elif self.sosKey_press_count == 1:#挂断来电 短语音播报
self.sosKey_press_count = 0
-
+ EventMesh.publish("stop_led_timer")#设置参数
# EventMesh.publish("call_test_event")
EventMesh.publish("sos_short_press")#sos短按事件
pass
def wechatKey_timeout_cb(self,data):#微聊键
print("wechatKey_timeout_cb!!!!!!!!!!!!!! ",self.wechatKey_press_count)
- if self.wechatKey_press_count >= 10:#短按十次解绑app
+ if self.wechatKey_press_count == 10:#短按十次解绑app
self.wechatKey_press_count = 0
+ EventMesh.publish("stop_led_timer")#设置参数
EventMesh.publish("open_power_on", 4)#恢复出厂
pass
- elif self.wechatKey_press_count >= 6:#短按六次播报imei号
+ elif self.wechatKey_press_count == 6:#短按六次播报imei号
self.wechatKey_press_count = 0
+ EventMesh.publish("stop_led_timer")#设置参数
EventMesh.publish("play_imei_event")#播報imei号
pass
- elif self.wechatKey_press_count >= 4:#拨打通讯录号码三
+ elif self.wechatKey_press_count == 4:#拨打通讯录号码三
self.wechatKey_press_count = 0
+ EventMesh.publish("stop_led_timer")#设置参数
EventMesh.publish("call_phonebook_three_call")
pass
- elif self.wechatKey_press_count >= 3:#拨打通讯录号码二
+ elif self.wechatKey_press_count == 3:#拨打通讯录号码二
self.wechatKey_press_count = 0
+ EventMesh.publish("stop_led_timer")#设置参数
EventMesh.publish("call_phonebook_two_call")
pass
- elif self.wechatKey_press_count >= 2:#拨打通讯录号码一
+ elif self.wechatKey_press_count == 2:#拨打通讯录号码一
+ EventMesh.publish("stop_led_timer")#设置参数
self.wechatKey_press_count = 0
EventMesh.publish("call_phonebook_one_call")
# EventMesh.publish("interup_call_event")#
pass
- elif self.wechatKey_press_count >= 1:#播放最后收到的语音
+ elif self.wechatKey_press_count == 1:#播放最后收到的语音
self.wechatKey_press_count = 0
+ EventMesh.publish("stop_led_timer")#设置参数
call_state = EventMesh.publish("get_call_state")
if call_state == 2:#电话拨进需要接听
EventMesh.publish("answer_call_event")#接听电话