# if self.KeySOS_timer_flag == 0:
# self.KeySOS_timer_flag = 1
# self.KeySOS_timer.start(5000, 0, self.KeySos_timer_cb)
-
EventMesh.publish("AI_key_release")
def pwk_key_Long_Press(self,event=None,msg=None):
def come_meet_mode(self, event=None, msg = None):
if self.meet_flag == 0: #还是为0就提示进入语音留言模式
+ EventMesh.publish("send_meet_open_flag_to_iot")#创建会议
self.meet_flag=1
exit_tts ="开启会议纪要,正在录音"
EventMesh.publish("play_tts",[exit_tts,1])
pass
def exit_meet_mode(self, event=None, msg = None):
if self.meet_flag == 1: #还是为1就提示已退出会议纪要模式
+ EventMesh.publish("send_meet_end_flag_to_iot")#结束会议
self.meet_flag=0
EventMesh.publish("stop_voice_record") #关闭语音录音
exit_tts ="已退出会议纪要模式"
EventMesh.publish("start_voice_record",3)#开始会议录音
return
elif self.trans_flag == 1:#AI翻译模式
- self.Close()
- EventMesh.publish("open_led_green")
- EventMesh.publish("start_voice_record",4)#开始翻译录音
return
EventMesh.publish("stop_voice_record") #关闭语音录音
def AI_key_release(self, event=None, msg=None):#按键弹起
print("AI_key_release123")
self.key_state = 0
+ if self.trans_flag == 1:#AI翻译模式
+ EventMesh.publish("stop_voice_record") #关闭语音录音
+ return
if self.voice_flag == 1:
self.stop_voice_timer.stop()
self.voice_flag=0
if dev_type == 'jswm' or dev_type == 'jswm_BOX' :
self.Close()
else:
+ if self.trans_flag == 1:#AI翻译模式
+ self.Close()
+ EventMesh.publish("open_led_green")
+ EventMesh.publish("start_voice_record",4)#开始翻译录音
self.AI_key_long_press_flag = 1
def pwk_key_release(self, event, msg):#电源键短按,关闭
print("pwk_key_release")
+ # EventMesh.publish("set_temp")
+ # return
EventMesh.publish("exit_meet_mode")#退出会议纪要
EventMesh.publish("exit_trans_mode")#退出AI翻译
EventMesh.publish("publish_AI_btnInfo",{"func":self.Close})
self.locate_duration = 0
self.locate_duration_state = 0
self.location_info = EventMesh.publish("get_storage_config","locate_duration_time") #获取定位频率信息
+
+ self.temp = 0
if self.location_info == None:
self.location_info = {}
else:
EventMesh.subscribe("get_curr_battery_level",self.get_curr_battery_level)
EventMesh.subscribe("screen_get_battery",self.get_battery)
EventMesh.subscribe("CHANNEL_IOT_WEB_SEND",self.user_send)
+ EventMesh.subscribe("set_temp",self.set_temp)
EventMesh.subscribe("GET_IOT_PROTOCOL_CILENT",self.get_iot_protoclo_client)
EventMesh.subscribe("SEND_JINMOAUDIO_TO_IOT",self.send_jm_audio_to_iot)
EventMesh.subscribe("SEND_YUYINAUDIO_TO_IOT",self.send_yuyin_audio_to_iot)
EventMesh.subscribe("close_websocket_timer",self.close_websocket_timer)
EventMesh.subscribe("connect_iot_websocket_cb",self.connect_iot_websocket_cb)
EventMesh.subscribe("set_play_new_voice_list",self.set_play_new_voice_list)
+
+ EventMesh.subscribe("send_meet_open_flag_to_iot",self.send_meet_open_flag_to_iot)#会议创建
+ EventMesh.subscribe("send_meet_end_flag_to_iot",self.send_meet_end_flag_to_iot)#会议结束
+
+ EventMesh.subscribe("send_trans_come_flag_to_iot",self.send_trans_come_flag_to_iot)#进入翻译
+ EventMesh.subscribe("send_trans_ok_flag_to_iot",self.send_trans_ok_flag_to_iot)#向APP发送进入翻译成功
# import EventMesh
# EventMesh.publish("play_new_voice_list")
EventMesh.subscribe("play_new_voice_list",self.play_new_voice_list) #播放语音未读信息
usys.print_exception(e)
pass
+ def send_meet_open_flag_to_iot(self,event,msg): #创建会议纪要上报到IOT平台
+ time_tmp = utime.mktime(date_tmp)
+ meet_open = {
+ "msg": "开始会议",
+ "data": None,
+ "cmd": "meet_begin",
+ "ts": time_tmp
+ }
+ send_data = protocol_send_total_data(meet_open)
+ EventMesh.publish("CHANNEL_IOT_WEB_SEND",send_data)
+ pass
+
+ def send_meet_end_flag_to_iot(self,event,msg): #结束会议纪要上报到IOT平台
+ time_tmp = utime.mktime(date_tmp)
+ meet_end = {
+ "msg": "结束会议",
+ "data": None,
+ "cmd": "meet_end",
+ "ts": time_tmp
+ }
+ send_data = protocol_send_total_data(meet_end)
+ EventMesh.publish("CHANNEL_IOT_WEB_SEND",send_data)
+ pass
+
+ def send_trans_come_flag_to_iot(self,event,msg): #进入翻译上报到IOT平台
+ time_tmp = utime.mktime(date_tmp)
+ trans_open = {
+ "msg": "进入翻译模式",
+ "data": None,
+ "cmd": "translate_device_enter",
+ "ts": time_tmp
+ }
+ send_data = protocol_send_total_data(trans_open)
+ EventMesh.publish("CHANNEL_IOT_WEB_SEND",send_data)
+ pass
+
+ def send_trans_ok_flag_to_iot(self,event,msg): #成功进入翻译发给APP
+ time_tmp = utime.mktime(date_tmp)
+ trans_ok = {
+ "msg": "进入成功",
+ "data": None,
+ "cmd": "translate_device_complete",
+ "ts": time_tmp
+ }
+ send_data = protocol_send_total_data(trans_ok)
+ EventMesh.publish("CHANNEL_IOT_WEB_SEND",send_data)
+ pass
+
def send_jm_audio_to_iot(self,event,msg): #静默录音音频数据上报到IOT平台
send_data = b''
send_data = protocol_audio_ji_playload_data(msg[0],msg[1],msg[2])
def get_iot_protoclo_client(self,event,msg):
return self.iot_protocol_client
+ def set_temp(self,event,data):
+ if self.temp == 0:
+ self.temp = 1
+ else:
+ self.temp = 0
def user_send(self,event,data):
# EventMesh.debug_log("TCP:send data:{}".format(msg))
# EventMesh.debug_log("TCP:send data:{}".format(msg))
- sim_state = sim.getStatus()
+ # sim_state = sim.getStatus()
if sim.getStatus() != 1:#网络不正常
print("无 sim卡")
return
+ # if self.temp == 1:
+ # print("没信号")
else :
try:
if self.start_voice_flag == 0: #如果关闭了就需要重新再
print("提取到的音乐名称为{},路径为{}".format(musicName,musicUrl))
EventMesh.publish("play_music",[musicName,musicUrl,1])
print("recv push_music{}".format(msg))
+
#音量下发
class IOTWeb_volumeProtoCol(ProtoCol):
"""volume"""