wu_xinjun
2022-03-04 6d4be793db7bfe31ad12b10c9468d4ef1a5e8f52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import signal
import os, sys
 
batfile_dir = os.path.join(__file__, "..", "protos/compile.bat" )
batfile_path = os.path.abspath(batfile_dir)
os.system(batfile_path)
 
from engine.AcquisitionMain import AcquisitionMain
from engine.AcquisitionMain import Config
 
def quit(signum, frame):
    print('You choose to stop me.')
    sys.exit()
 
if __name__ == '__main__':
    def help():
        print("Usage: Client.py [MQhost] [MQuser] [MQpassword] [QUEUEname] [DEVICEname] [SERVERhost] [MICROWAVEhost]")
        print("EXAMPLE: Client.py 172.17.17.206 chai password123 aerial_rpc pod1 http://172.17.17.206/api 192.168.2.65")
        exit(1)
 
    if len(sys.argv) != 8:
        help()
    try:
        MQhost = str(sys.argv[1])
        MQuser = str(sys.argv[2])
        MQpassword = str(sys.argv[3])
        QUEUEname = str(sys.argv[4])
        DEVICEname = str(sys.argv[5])
        SERVERhost = str(sys.argv[6])
        MICROWAVEhost = str(sys.argv[7])
 
    except Exception as e:
        print(e)
        help()
 
    print("Start AcquisitionMain")
    signal.signal(signal.SIGINT, quit)
    signal.signal(signal.SIGTERM, quit)
    # client = AcquisitionMain('192.168.3.54', 'chai',
    #                       'password123', 'aerial_rpc', 'pod1', 'http://192.168.3.54:5000/api', 10)
    config_dir = os.path.join(__file__, "..", "config.json" )
    config_path = os.path.abspath(config_dir)
    config = Config(config_path)
    client = AcquisitionMain(MQhost,
                             MQuser,
                             MQpassword, 
                             DEVICEname,
                             MICROWAVEhost, # udp server host, 192.168.2.65 for production
    )
    client.start()