self.video_timer = 0
+ self.video_init = 0
+
self.videoInfo_queue = Queue()
_thread.stack_size(10*1024)
_thread.start_new_thread(self.videoInfo_queue_thread, ())
EventMesh.subscribe("clear_video_timer_state",self.clear_video_timer_state)
+ EventMesh.subscribe("set_vedio_init",self.set_vedio_init)
EventMesh.subscribe("set_app_dev_end_state",self.set_app_dev_end_state)#设置是app 设备 还是主动信号不好的挂断当前的视频通话
def call_viode_book_num(self, event, msg):#默认拨打视频通话列表第一个
self.video_led_state = 0
+ EventMesh.publish("set_vedio_init")
EventMesh.publish("clear_video_timer_state")
if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1:#未联网提示关机
if len(self.videobook) != 0:#已联网未添加账号
def get_vedio_tokens_data(self, event, msg):
return self.tokens_data
+ def set_vedio_init(self, event, msg):
+ self.video_init = 0
def open_vedio_infor(self,event,msg):
- call_id = EventMesh.publish("get_vedio_call_id")#对方的账号
- meet_id = EventMesh.publish("get_vedio_meet_id")#共有的会议id
- call_type = EventMesh.publish("get_vedio_call_type")#呼叫类型
- tokens_data = EventMesh.publish("get_vedio_tokens_data")#tookens数据#云米平台不需要tokens
-
- uid = str(call_id)
- ticket = str(meet_id)
-
- # data = ['6951832', '876226002021444', '1', '01lqlyqzQ4Gozdz8OJv1Mij2Y3PBq2y3+rtIA26Ge+m2QHTc/Vk=gufkGNMBiYhPjbq1tLCwtLKysLKws7a2tg==']
- jrtc.init()
- # jrtc.config_server("119.3.54.56:1050")#测试服地址
- tokens = str(tokens_data)
- appkey = "efe9f8800a39d96244234097"#小见
- uid_key = "25v9C652123QL3N8"
-
- # appkey = "249e7d505516af0a7ed44097"
- # uid_key = "qQI4gkB9FxH8J2cb"
- imei = EventMesh.publish(constants.EVENT.GET_IMEI)
- oneself_id = str(imei)#自己的账号默认是imei号
- jrtc.config(appkey,oneself_id,uid_key,tokens)#只初始化一次发起通话
-
-
- print("uid ",uid,ticket,oneself_id)
- if call_type == 0:
- jrtc.open(uid,ticket,[],[])
- pass
- else:
- jrtc.open(uid,ticket,[],[15,120,240,320])
- EventMesh.publish(constants.EVENT.SYSTEM_UP)#唤醒休眠
+ if self.video_init == 0:
+ self.video_init = 1
+ EventMesh.publish(constants.EVENT.SYSTEM_UP)#唤醒休眠
+ call_id = EventMesh.publish("get_vedio_call_id")#对方的账号
+ meet_id = EventMesh.publish("get_vedio_meet_id")#共有的会议id
+ call_type = EventMesh.publish("get_vedio_call_type")#呼叫类型
+ tokens_data = EventMesh.publish("get_vedio_tokens_data")#tookens数据#云米平台不需要tokens
- jrtc.set_rotate(jrtc.CAM_ROTATE_90)
+ uid = str(call_id)
+ ticket = str(meet_id)
+
+ # data = ['6951832', '876226002021444', '1', '01lqlyqzQ4Gozdz8OJv1Mij2Y3PBq2y3+rtIA26Ge+m2QHTc/Vk=gufkGNMBiYhPjbq1tLCwtLKysLKws7a2tg==']
+ jrtc.init()
+ # jrtc.config_server("119.3.54.56:1050")#测试服地址
+ tokens = str(tokens_data)
+ appkey = "efe9f8800a39d96244234097"#小见
+ uid_key = "25v9C652123QL3N8"
+
+ # appkey = "249e7d505516af0a7ed44097"
+ # uid_key = "qQI4gkB9FxH8J2cb"
+ imei = EventMesh.publish(constants.EVENT.GET_IMEI)
+ oneself_id = str(imei)#自己的账号默认是imei号
+ jrtc.config(appkey,oneself_id,uid_key,tokens)#只初始化一次发起通话
- self.video_count = 0
- self.video_state_time = 0
- self.video_led_state = 0
- self.video_answer = 0
- self.video_timer = 0
- self.timer.start(1*1000,1,self.publish_led_event_cb)
+
+ print("uid ",uid,ticket,oneself_id)
+ if call_type == 0:
+ jrtc.open(uid,ticket,[],[])
+ pass
+ else:
+ jrtc.open(uid,ticket,[],[15,120,240,320])
+
+
+ jrtc.set_rotate(jrtc.CAM_ROTATE_90)
+
+ self.video_count = 0
+ self.video_state_time = 0
+ self.video_led_state = 0
+ self.video_answer = 0
+ self.video_timer = 0
+ self.timer.start(1*1000,1,self.publish_led_event_cb)
def video_time_cb(self,data):
video_state = EventMesh.publish("get_video_state")
get_video_state = EventMesh.publish("get_video_in_out_state")
dev_mode = EventMesh.publish("get_dev_app_mode")
+
# print("call_state",call_state,video_state,get_video_state,dev_mode)
- if video_state != 0:
+ if video_state != 0 or call_state != 0:
if get_video_state == 0 and call_state != 0:#双方接通如果是信号不好就开始计算30 30s过后还没有出画面就挂断当前视频通话
self.video_count+=1
if self.video_count > 30:
self.timer.stop()
EventMesh.publish("video_reject_cb",1)
else:
- # if call_state == 0 or call_state == 1:
- # print("no network1")
- self.video_count = 0
- self.video_state_time = 0
- self.timer.stop()
- EventMesh.publish("video_reject_cb",1)
- # print("no network")
+ if self.video_state_time == 0:
+ self.video_state_time = 1
+ self.video_count = 0
+ self.timer.stop()
+ EventMesh.publish("video_reject_cb",1)
def video_waite_event_time_cb(self,*argc):#正在接听中,请稍候
EventMesh.publish("video_answer_mode_timer_cb",1)
self.timer.stop()
pass
def close_jrtc_event(self,event,msg):
- jrtc.close(0)
+
pass
EventMesh.publish("set_video_in_out_state",0)
EventMesh.publish("stop_led_timer")#设置参数
EventMesh.publish("close_timer_all")#
+ EventMesh.publish("set_vedio_init")#
EventMesh.publish("open_vedio_infor")
def clear_video_timer_state(self,event,msg):#清除标识
EventMesh.publish("stop_led_timer")#设置参数
EventMesh.publish("close_timer_all")#
EventMesh.publish("close_video_timer")
- # print("video_reject_cb set_video_state")
EventMesh.publish("set_video_state", 0)
EventMesh.publish("set_dev_app_mode", 0)
EventMesh.publish("set_video_in_out_state",0)
return
self.video_timer = 1
self.video_led_state = 0
- EventMesh.publish(constants.EVENT.SYSTEM_UP)#唤醒休眠
+ EventMesh.publish(constants.EVENT.SYSTEM_UP)#
video_in_out_state = EventMesh.publish("get_video_in_out_state")#设置参数
def jrtc_cb(close_sta):#注册回调
print("jrtc callback:", close_sta)
if close_sta == 0 or close_sta == 1:
- EventMesh.publish("set_video_in_out_state",0)
- EventMesh.publish("set_video_state",0)
- jrtc.close(0)
+ pass
+ # EventMesh.publish("set_video_in_out_state",0)
+ # EventMesh.publish("set_video_state",0)
+ # jrtc.close(0)
jrtc.set_callback(jrtc_cb)
+ import fota
+ class firwDownloadManager(Abstract):#
+ def __init__(self):
+ self.timer = osTimer()
+
+
+ def post_processor_after_instantiation(self):
+ EventMesh.subscribe("firware_download", self.firware_download)#
+
+ def firware_download(self, event, msg):
+ number = str(msg)
+ sms.sendPduMsg(number, 'set ok', 'UCS2')
+ self.timer.start(10*1000,0,self.fun)
+
+ def fun(self,*argc):
+ fota_obj = fota()
+ fota_obj.httpDownload(url1="http://u-oss.thisiot.com/test/dfota_1.bin",url2="http://u-oss.thisiot.com/test/dfota_2.bin")