12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- import pymysql
- class db_config:
- def __init__(self):
- self.db_ip = "192.168.1.200" # 数据库IP地址
- self.db_port = 3306 # 端口号
- self.db_name = "xm_project" # 数据库名
- self.db_user = "zx" # 用户名
- self.db_password = "123456" # 用户密码
- self.db_charset = "utf8" # 数据库连接编码
- self.db_mincached = 20 # mincached : 启动时开启的闲置连接数量(缺省值 0 开始时不创建连接)
- self.db_maxcached = 20 # maxcached : 连接池中允许的闲置的最多连接数量(缺省值 0 代表不闲置连接池大小)
- self.db_maxshared = 30 # maxshared : 共享连接数允许的最大数量(缺省值 0 代表所有连接都是专用的)如果达到了最大数量,被请求为共享的连接将会被共享使用
- self.db_maxconnecyions = 100 # maxconnecyions : 创建连接池的最大数量(缺省值 0 代表不限制)
- self.db_blocking = True # blocking : 设置在连接池达到最大数量时的行为(缺省值 0 或 False 代表返回一个错误<toMany......> 其他代表阻塞直到连接数减少,连接被分配)
- self.db_maxusage = 0 # maxusage : 单个连接的最大允许复用次数(缺省值 0 或 False 代表不限制的复用).当达到最大数时,连接会自动重新连接(关闭和重新打开)
- self.db_setsession = None # setsession : 一个可选的SQL命令列表用于准备每个会话,如["set datestyle to german", ...]
- self.db_creator = pymysql # creator : 使用连接数据库的模块
- DB_CONFIG = db_config()
- class mq_config:
- def __init__(self):
- self.mq_ip = "192.168.1.200" # rabbitmq服务器ip地址
- self.mq_port = 5672 # 端口
- self.mq_user = "zx" # 用户名
- self.mq_password = "123456" # 用户密码
- self.mq_command_exchange_name = "command_ex" # 指令交换机名
- self.mq_statu_exchange_name = "statu_ex" # 状态交换机名
- self.mq_statu_exchange_keys = [[self.mq_statu_exchange_name, "dispatch_11_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_12_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_13_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_14_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_21_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_22_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_23_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_24_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_25_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_31_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_32_statu_port"]] # 状态交换机需要订阅的端口列表
- MQ_CONFIG = mq_config()
- class led_config:
- def __init__(self):
- self.led_list_all = {11: [{'ip': "192.168.1.169", 'port': 5005}],
- 12: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
- 13: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
- 14: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
- 21: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
- 22: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
- 23: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
- 24: [{'ip': "192.168.1.169", 'port': 5005}, {'ip': "192.168.1.169", 'port': 5005}],
- 25: [{'ip': "192.168.1.169", 'port': 5005}],
- 31: [{'ip': "192.168.1.164", 'port': 5005}, {'ip': "192.168.1.249", 'port': 5005}],
- 32: [{'ip': "192.168.1.169", 'port': 5005}]
- }
- # 区域编号,区域左上角X坐标,区域左上角Y坐标,区域宽度,区域高度
- self.area_list_all = {11: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
- 12: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
- {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
- 13: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
- {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
- 14: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
- {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
- 21: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
- {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
- 22: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
- {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
- 23: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
- {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
- 24: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
- {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
- 25: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
- 31: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]},
- {0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}],
- 32: [{0: [0, 0, 170, 64], 1: [0, 0, 170, 64], 2: [0, 0, 170, 64]}]
- }
- self.unit = 31
- self.channel = 2
- # self.led_communication = self.led_list_all[self.unit]
- # self.area_list = self.area_list_all[self.unit]
- LED_CONFIG = led_config()
|