Parcourir la source

2nd Module update

master
Dirk Alders il y a 4 ans
Parent
révision
cd5f156076
4 fichiers modifiés avec 17 ajouts et 16 suppressions
  1. 1
    1
      protocol
  2. 1
    1
      socket_protocol
  3. 1
    1
      stringtools
  4. 14
    13
      tcp_client.py

+ 1
- 1
protocol

@@ -1 +1 @@
1
-Subproject commit 70c458d34951cfbf1bddcf4a35fe7112797b106b
1
+Subproject commit 551e3e558dd54933e10b4e4806ee3f8c02dbfe19

+ 1
- 1
socket_protocol

@@ -1 +1 @@
1
-Subproject commit b1a3f75e6135929acab149028df3d4bbe7fdb28c
1
+Subproject commit 35d9f688a4f080a8cae70a18e27036b55399edde

+ 1
- 1
stringtools

@@ -1 +1 @@
1
-Subproject commit 76d8ae9b1bfd894bc5f4b830394ce0552120a508
1
+Subproject commit 5ac92e2b864cd27bd4026352ba9149f4d23ca019

+ 14
- 13
tcp_client.py Voir le fichier

@@ -5,6 +5,7 @@ import config
5 5
 import os
6 6
 import protocol
7 7
 import report
8
+import socket_protocol
8 9
 import sys
9 10
 import tcp_socket
10 11
 
@@ -22,16 +23,16 @@ def help_msg():
22 23
 
23 24
 
24 25
 if __name__ == '__main__':
25
-    report.appLoggingConfigure(os.path.dirname(__file__), config.LOGTARGET, ((config.APP_NAME, 'DEBUG'), ), fmt=config.formatter, host=config.LOGHOST, port=config.LOGPORT)
26
+    report.appLoggingConfigure(os.path.dirname(__file__), config.LOGTARGET, ((config.APP_NAME, config.LOGLVL), ), fmt=config.formatter, host=config.LOGHOST, port=config.LOGPORT)
26 27
     c = tcp_socket.tcp_client_stp(config.server_ip, config.server_port)
27 28
     prot = protocol.my_client_protocol(c, secret=config.secret, channel_name='leyk')
28 29
     target_dict = {
29
-        'bakehouse': [prot.DID_BAKE_HOUSE, ],
30
-        'bakery': [prot.DID_BAKERY, ],
31
-        'mill': [prot.DID_MILL, ],
32
-        'ploenlein': [prot.DID_PLOENLEIN, ],
33
-        'reesehouse': [prot.DID_REESE_HOUSE, ],
34
-        'all': [prot.DID_BAKE_HOUSE, prot.DID_BAKERY, prot.DID_MILL, prot.DID_PLOENLEIN, prot.DID_REESE_HOUSE]
30
+        'bakehouse': [protocol.DID_BAKE_HOUSE, ],
31
+        'bakery': [protocol.DID_BAKERY, ],
32
+        'mill': [protocol.DID_MILL, ],
33
+        'ploenlein': [protocol.DID_PLOENLEIN, ],
34
+        'reesehouse': [protocol.DID_REESE_HOUSE, ],
35
+        'all': [protocol.DID_BAKE_HOUSE, protocol.DID_BAKERY, protocol.DID_MILL, protocol.DID_PLOENLEIN, protocol.DID_REESE_HOUSE]
35 36
     }
36 37
     if prot.authentificate():
37 38
         help_msg()
@@ -42,18 +43,18 @@ if __name__ == '__main__':
42 43
             if cmd == 'help':
43 44
                 help_msg()
44 45
             elif cmd in ["auto", "automatic"]:
45
-                prot.send(prot.SID_EXECUTE_REQUEST, prot.DID_MODE, 'automatic')
46
+                prot.send(socket_protocol.SID_EXECUTE_REQUEST, protocol.DID_MODE, 'automatic')
46 47
             elif cmd in ["man", "manual"]:
47
-                prot.send(prot.SID_EXECUTE_REQUEST, prot.DID_MODE, 'manual')
48
+                prot.send(socket_protocol.SID_EXECUTE_REQUEST, protocol.DID_MODE, 'manual')
48 49
             elif cmd == "mode":
49
-                prot.send(prot.SID_READ_REQUEST, prot.DID_MODE, None)
50
+                prot.send(socket_protocol.SID_READ_REQUEST, protocol.DID_MODE, None)
50 51
             elif cmd == "state":
51
-                prot.send(prot.SID_READ_REQUEST, prot.DID_STATE, None)
52
+                prot.send(socket_protocol.SID_READ_REQUEST, protocol.DID_STATE, None)
52 53
             elif cmd.startswith('get '):
53 54
                 target = target_dict.get(cmd.split(' ')[1])
54 55
                 if target is not None:
55 56
                     for t in target:
56
-                        prot.send(prot.SID_READ_REQUEST, t, None)
57
+                        prot.send(socket_protocol.SID_READ_REQUEST, t, None)
57 58
             elif cmd.startswith('set '):
58 59
                 target = target_dict.get(cmd.split(' ')[1])
59 60
                 try:
@@ -62,5 +63,5 @@ if __name__ == '__main__':
62 63
                     state = None
63 64
                 if target is not None and state is not None:
64 65
                     for t in target:
65
-                        prot.send(prot.SID_EXECUTE_REQUEST, t, state)
66
+                        prot.send(socket_protocol.SID_EXECUTE_REQUEST, t, state)
66 67
     c.close()

Chargement…
Annuler
Enregistrer