1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import glog, signal
- from tofManager import *
- import SDK.ZX.async_communication as cm
- import SDK.ZX.async_communication_etc_pb2 as rce
- import SDK.ZX.tool as zx_tool
- if __name__ == '__main__':
- # 加载配置
- rabbitmq_etc = zx_tool.getProtobufJsonConfig(os.path.dirname(os.path.abspath(__file__)) + "/etc/rabbitmq.json", rce.RabbitmqEtc())
- print(rabbitmq_etc)
- g_rabbitmq = cm.RabbitAsyncCommunicator(rabbitmq_etc.ip, rabbitmq_etc.port,
- rabbitmq_etc.user, rabbitmq_etc.password)
- statu_ex_keys = []
- for bind in rabbitmq_etc.binds:
- key = [bind.ex, bind.route_key]
- statu_ex_keys.append(key)
- glog.info(statu_ex_keys)
- # 初始化
- g_rabbitmq.Init(None, statu_ex_keys)
- g_rabbitmq.start()
- tofs = TofManager()
- tofs.searchAllCamera()
- etc = tofs.getAllCameraEtc()
- tofs.openAllCamera()
- tofs.startAllCameraStream()
- # 绑定rabbitmq
- g_rabbitmq.bind_statu_callback(statu_ex_keys[0][0], statu_ex_keys[0][1], tofs.exec)
- while True:
- message = input("input q or Q exit this progress\n")
- if message == "q" or message == "Q":
- break
- # 释放
- tofs.stopAllCameraStream()
- tofs.closeAllCamera()
- # 强制结束进程
- pid = os.getpid()
- os.kill(pid, 1)
|