node.py 915 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import queue
  2. import EntranceIO as EIO
  3. rabbitmq_parameter={"ip":"192.168.1.233","port":5672,"user":"zx","password":"zx123456"}
  4. #[单元号,入口号,单片机ip,port]
  5. mcpu_paramters=[
  6. [1,1,"192.168.1.120",40002],
  7. [1,2,"192.168.1.121",40002],
  8. [2,3,"192.168.1.122",40002],
  9. [2,4,"192.168.1.123",40002],
  10. [3,5,"192.168.1.124",40002],
  11. [3,6,"192.168.1.125",40002]
  12. ]
  13. '''
  14. '''
  15. g_entrances={}
  16. g_close_door_cmd_queue=queue.Queue()
  17. if __name__=="__main__":
  18. for parameter in mcpu_paramters:
  19. id=parameter[1]
  20. if not g_entrances.get(id)==None:
  21. raise("单片机id重复")
  22. g_entrances[id]=EIO.EntranceIO(parameter,rabbitmq_parameter)
  23. for _,entrance in g_entrances.items():
  24. entrance.start()
  25. for _,entrance in g_entrances.items():
  26. entrance.join()