1234567891011121314151617181920212223242526272829303132333435363738394041 |
- # -*- coding: utf-8 -*-
- from demeter.core import *
- class Core(object):
- def agreement(self):
- return [
- {'id':1,'name':'mqtt'}
- ,{'id':2,'name':'modbus'}]
- def register_type(self):
- return [
- {'id':1,'name':'线圈寄存器'}
- ,{'id':2,'name':'离散输入寄存器'}
- ,{'id':3,'name':'保持寄存器'}
- ,{'id':4,'name':'输入寄存器'}]
- def oper_type(self):
- return [{'id':1,'name':'读取'},{'id':2,'name':'写入'}]
- def data_type(self):
- return [
- {'id':1,'name':'输入框'}
- ,{'id':2,'name':'单选框'}
- ,{'id':3,'name':'多选框'}
- ,{'id':4,'name':'按钮'}]
- def server_type(self):
- return [{'id':1,'name':'mqtt'},{'id':2,'name':'modbus_tcp'},{'id':3,'name':'modbus_rtu'}]
- # 根据oper_type判断是传感器还是控制器
- def hardware_type(self, oper_type):
- if oper_type == 1:
- return 2
- elif oper_type == 2:
- return 3
- elif oper_type == 3:
- return 6
- elif oper_type == 4:
- return 7
|