From cd5f1560765ff5c3b99d00ca377b001da1ab485d Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Thu, 7 Jan 2021 01:30:52 +0100 Subject: [PATCH] 2nd Module update --- protocol | 2 +- socket_protocol | 2 +- stringtools | 2 +- tcp_client.py | 27 ++++++++++++++------------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/protocol b/protocol index 70c458d..551e3e5 160000 --- a/protocol +++ b/protocol @@ -1 +1 @@ -Subproject commit 70c458d34951cfbf1bddcf4a35fe7112797b106b +Subproject commit 551e3e558dd54933e10b4e4806ee3f8c02dbfe19 diff --git a/socket_protocol b/socket_protocol index b1a3f75..35d9f68 160000 --- a/socket_protocol +++ b/socket_protocol @@ -1 +1 @@ -Subproject commit b1a3f75e6135929acab149028df3d4bbe7fdb28c +Subproject commit 35d9f688a4f080a8cae70a18e27036b55399edde diff --git a/stringtools b/stringtools index 76d8ae9..5ac92e2 160000 --- a/stringtools +++ b/stringtools @@ -1 +1 @@ -Subproject commit 76d8ae9b1bfd894bc5f4b830394ce0552120a508 +Subproject commit 5ac92e2b864cd27bd4026352ba9149f4d23ca019 diff --git a/tcp_client.py b/tcp_client.py index fb9c9c1..5e9a986 100644 --- a/tcp_client.py +++ b/tcp_client.py @@ -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()