# -*- coding: utf-8 -*-
"""
    demeter web
    name:admin.py
    author:rabin
"""
from demeter.core import *

param = {}
param['method'] = 'm'
param['id'] = 'i'
Demeter.getopt(param)


Demeter.echo(Demeter.option['method'])

method = ''
if 'tcp' in Demeter.option['method']:
	method = 'tcp'
else:
	method = 'rtu'

if Demeter.option['method'] == method + '_client' and Demeter.option['id']:
	# 测试某一个客户端
	Demeter.service(method, 'modbus').client(Demeter.option['id'])
elif Demeter.option['method'] == method + '_start':
	# 启动所有客户端
	Demeter.service(method, 'modbus').start()
elif Demeter.option['method'] == method + 'server':
	# 启动服务端
	Demeter.service(method, 'modbus').server()
else:
	# 测试
	Demeter.service('old', 'modbus').server()