2nd Module update
This commit is contained in:
parent
6a560c7760
commit
cd5f156076
2
protocol
2
protocol
@ -1 +1 @@
|
||||
Subproject commit 70c458d34951cfbf1bddcf4a35fe7112797b106b
|
||||
Subproject commit 551e3e558dd54933e10b4e4806ee3f8c02dbfe19
|
@ -1 +1 @@
|
||||
Subproject commit b1a3f75e6135929acab149028df3d4bbe7fdb28c
|
||||
Subproject commit 35d9f688a4f080a8cae70a18e27036b55399edde
|
@ -1 +1 @@
|
||||
Subproject commit 76d8ae9b1bfd894bc5f4b830394ce0552120a508
|
||||
Subproject commit 5ac92e2b864cd27bd4026352ba9149f4d23ca019
|
@ -5,6 +5,7 @@ import config
|
||||
import os
|
||||
import protocol
|
||||
import report
|
||||
import socket_protocol
|
||||
import sys
|
||||
import tcp_socket
|
||||
|
||||
@ -22,16 +23,16 @@ def help_msg():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
report.appLoggingConfigure(os.path.dirname(__file__), config.LOGTARGET, ((config.APP_NAME, 'DEBUG'), ), fmt=config.formatter, host=config.LOGHOST, port=config.LOGPORT)
|
||||
report.appLoggingConfigure(os.path.dirname(__file__), config.LOGTARGET, ((config.APP_NAME, config.LOGLVL), ), fmt=config.formatter, host=config.LOGHOST, port=config.LOGPORT)
|
||||
c = tcp_socket.tcp_client_stp(config.server_ip, config.server_port)
|
||||
prot = protocol.my_client_protocol(c, secret=config.secret, channel_name='leyk')
|
||||
target_dict = {
|
||||
'bakehouse': [prot.DID_BAKE_HOUSE, ],
|
||||
'bakery': [prot.DID_BAKERY, ],
|
||||
'mill': [prot.DID_MILL, ],
|
||||
'ploenlein': [prot.DID_PLOENLEIN, ],
|
||||
'reesehouse': [prot.DID_REESE_HOUSE, ],
|
||||
'all': [prot.DID_BAKE_HOUSE, prot.DID_BAKERY, prot.DID_MILL, prot.DID_PLOENLEIN, prot.DID_REESE_HOUSE]
|
||||
'bakehouse': [protocol.DID_BAKE_HOUSE, ],
|
||||
'bakery': [protocol.DID_BAKERY, ],
|
||||
'mill': [protocol.DID_MILL, ],
|
||||
'ploenlein': [protocol.DID_PLOENLEIN, ],
|
||||
'reesehouse': [protocol.DID_REESE_HOUSE, ],
|
||||
'all': [protocol.DID_BAKE_HOUSE, protocol.DID_BAKERY, protocol.DID_MILL, protocol.DID_PLOENLEIN, protocol.DID_REESE_HOUSE]
|
||||
}
|
||||
if prot.authentificate():
|
||||
help_msg()
|
||||
@ -42,18 +43,18 @@ if __name__ == '__main__':
|
||||
if cmd == 'help':
|
||||
help_msg()
|
||||
elif cmd in ["auto", "automatic"]:
|
||||
prot.send(prot.SID_EXECUTE_REQUEST, prot.DID_MODE, 'automatic')
|
||||
prot.send(socket_protocol.SID_EXECUTE_REQUEST, protocol.DID_MODE, 'automatic')
|
||||
elif cmd in ["man", "manual"]:
|
||||
prot.send(prot.SID_EXECUTE_REQUEST, prot.DID_MODE, 'manual')
|
||||
prot.send(socket_protocol.SID_EXECUTE_REQUEST, protocol.DID_MODE, 'manual')
|
||||
elif cmd == "mode":
|
||||
prot.send(prot.SID_READ_REQUEST, prot.DID_MODE, None)
|
||||
prot.send(socket_protocol.SID_READ_REQUEST, protocol.DID_MODE, None)
|
||||
elif cmd == "state":
|
||||
prot.send(prot.SID_READ_REQUEST, prot.DID_STATE, None)
|
||||
prot.send(socket_protocol.SID_READ_REQUEST, protocol.DID_STATE, None)
|
||||
elif cmd.startswith('get '):
|
||||
target = target_dict.get(cmd.split(' ')[1])
|
||||
if target is not None:
|
||||
for t in target:
|
||||
prot.send(prot.SID_READ_REQUEST, t, None)
|
||||
prot.send(socket_protocol.SID_READ_REQUEST, t, None)
|
||||
elif cmd.startswith('set '):
|
||||
target = target_dict.get(cmd.split(' ')[1])
|
||||
try:
|
||||
@ -62,5 +63,5 @@ if __name__ == '__main__':
|
||||
state = None
|
||||
if target is not None and state is not None:
|
||||
for t in target:
|
||||
prot.send(prot.SID_EXECUTE_REQUEST, t, state)
|
||||
prot.send(socket_protocol.SID_EXECUTE_REQUEST, t, state)
|
||||
c.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user