config.py 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import pymysql
  2. class db_config:
  3. def __init__(self):
  4. self.db_ip = "192.168.1.200" # 数据库IP地址
  5. self.db_port = 3306 # 端口号
  6. self.db_name = "xm_project" # 数据库名
  7. self.db_user = "zx" # 用户名
  8. self.db_password = "123456" # 用户密码
  9. self.db_charset = "utf8" # 数据库连接编码
  10. self.db_mincached = 20 # mincached : 启动时开启的闲置连接数量(缺省值 0 开始时不创建连接)
  11. self.db_maxcached = 20 # maxcached : 连接池中允许的闲置的最多连接数量(缺省值 0 代表不闲置连接池大小)
  12. self.db_maxshared = 30 # maxshared : 共享连接数允许的最大数量(缺省值 0 代表所有连接都是专用的)如果达到了最大数量,被请求为共享的连接将会被共享使用
  13. self.db_maxconnecyions = 100 # maxconnecyions : 创建连接池的最大数量(缺省值 0 代表不限制)
  14. self.db_blocking = True # blocking : 设置在连接池达到最大数量时的行为(缺省值 0 或 False 代表返回一个错误<toMany......> 其他代表阻塞直到连接数减少,连接被分配)
  15. self.db_maxusage = 0 # maxusage : 单个连接的最大允许复用次数(缺省值 0 或 False 代表不限制的复用).当达到最大数时,连接会自动重新连接(关闭和重新打开)
  16. self.db_setsession = None # setsession : 一个可选的SQL命令列表用于准备每个会话,如["set datestyle to german", ...]
  17. self.db_creator = pymysql # creator : 使用连接数据库的模块
  18. DB_CONFIG = db_config()
  19. class led_config:
  20. def __init__(self):
  21. self.led_list_all = {11: [{'ip': "192.168.1.169", 'port': 5005}],
  22. 12: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
  23. 13: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
  24. 14: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
  25. 21: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
  26. 22: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
  27. 23: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
  28. 24: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
  29. 25: [{'ip': "192.168.1.169", 'port': 5005}],
  30. 31: [{'ip': "192.168.1.164", 'port': 5005}, {'ip': "192.168.1.249", 'port': 5005}],
  31. 32: [{'ip': "192.168.1.169", 'port': 5005}]
  32. }
  33. # 区域编号,区域左上角X坐标,区域左上角Y坐标,区域宽度,区域高度
  34. self.area_list_all = {11: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
  35. 12: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
  36. {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
  37. 13: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
  38. {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
  39. 14: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
  40. {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
  41. 21: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
  42. {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
  43. 22: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
  44. {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
  45. 23: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
  46. {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
  47. 24: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
  48. {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
  49. 25: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
  50. 31: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
  51. {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
  52. 32: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}]
  53. }
  54. self.unit = 31
  55. self.channel = 2
  56. # self.led_communication = self.led_list_all[self.unit]
  57. # self.area_list = self.area_list_all[self.unit]
  58. LED_CONFIG = led_config()
  59. class mq_config:
  60. def __init__(self):
  61. self.mq_ip = "192.168.1.200" # rabbitmq服务器ip地址
  62. self.mq_port = 5672 # 端口
  63. self.mq_user = "zx" # 用户名
  64. self.mq_password = "123456" # 用户密码
  65. self.mq_command_exchange_name = "command_ex" # 指令交换机名
  66. self.mq_statu_exchange_name = "statu_ex" # 状态交换机名
  67. self.mq_statu_exchange_keys = [[self.mq_statu_exchange_name, "dispatch_11_statu_port"],
  68. [self.mq_statu_exchange_name, "dispatch_12_statu_port"],
  69. [self.mq_statu_exchange_name, "dispatch_13_statu_port"],
  70. [self.mq_statu_exchange_name, "dispatch_14_statu_port"],
  71. [self.mq_statu_exchange_name, "dispatch_21_statu_port"],
  72. [self.mq_statu_exchange_name, "dispatch_22_statu_port"],
  73. [self.mq_statu_exchange_name, "dispatch_23_statu_port"],
  74. [self.mq_statu_exchange_name, "dispatch_24_statu_port"],
  75. [self.mq_statu_exchange_name, "dispatch_25_statu_port"],
  76. [self.mq_statu_exchange_name, "dispatch_31_statu_port"],
  77. [self.mq_statu_exchange_name, "dispatch_32_statu_port"]] # 状态交换机需要订阅的端口列表
  78. MQ_CONFIG = mq_config()