forked from firedog1024/Azure_IoT_Central_MultiTech_Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
35 lines (28 loc) · 836 Bytes
/
main.py
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
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for
# full license information.
import logging
import time
import sys
import config
from devices.master_device import MasterDevice
def main():
logger = logging.getLogger()
logging.basicConfig(format=config.LOGGING_FORMAT)
logger.setLevel(config.GLOBAL_LOG_LEVEL)
master = MasterDevice(
config.CENTRAL_SCOPE_ID,
config.CENTRAL_APP_KEY,
config.MASTER_MODEL_ID,
config.MASTER_DEVICE_ID,
logger)
try:
master.start()
while True:
pass
except (Exception, KeyboardInterrupt) as e:
logger.error('Error in IoT Edge runtime, exiting: %s', e)
master.stop()
raise e
if __name__ == '__main__':
main()