Attempt to load configuration from a module my_ipsc_config.py to allow leaving your systems configured without editing the main Python source file - and as that file is expected to have IPs / keys that may not be intended for the public, tell git to ignore that file.
This commit is contained in:
parent
1253c7f405
commit
3413dee576
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
.DS_Store
|
||||
.dropbox
|
||||
Icon
|
||||
my_ipsc_config.py
|
||||
*.pyc
|
||||
|
151
ipsc.py
151
ipsc.py
@ -62,84 +62,87 @@ logger = logging.getLogger('ipsc')
|
||||
|
||||
|
||||
# Data structure for holding IPSC information
|
||||
NETWORK = {
|
||||
'IPSC1': {
|
||||
'LOCAL': {
|
||||
'DESCRIPTION': 'IPSC Network #1',
|
||||
'MODE': b'\x6A',
|
||||
'FLAGS': b'\x00\x00\x80\xDC',
|
||||
'PORT': 50001,
|
||||
'RADIO_ID': binascii.unhexlify('00000001'),
|
||||
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000000001')
|
||||
try:
|
||||
from my_ipsc_config import NETWORK
|
||||
except ImportError:
|
||||
NETWORK = {
|
||||
'IPSC1': {
|
||||
'LOCAL': {
|
||||
'DESCRIPTION': 'IPSC Network #1',
|
||||
'MODE': b'\x6A',
|
||||
'FLAGS': b'\x00\x00\x80\xDC',
|
||||
'PORT': 50001,
|
||||
'RADIO_ID': binascii.unhexlify('00000001'),
|
||||
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000000001')
|
||||
},
|
||||
'MASTER': {
|
||||
'IP': '1.1.1.1',
|
||||
'MODE': b'\x6A',
|
||||
'PORT': 50000,
|
||||
'RADIO_ID': '',
|
||||
},
|
||||
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
||||
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
||||
]
|
||||
},
|
||||
'MASTER': {
|
||||
'IP': '1.1.1.1',
|
||||
'MODE': b'\x6A',
|
||||
'PORT': 50000,
|
||||
'RADIO_ID': '',
|
||||
'IPSC2': {
|
||||
'LOCAL': {
|
||||
'DESCRIPTION': 'IPSC Network #1',
|
||||
'MODE': b'\x6A',
|
||||
'FLAGS': b'\x00\x00\x80\xDC',
|
||||
'PORT': 50002,
|
||||
'RADIO_ID': binascii.unhexlify('00000002'),
|
||||
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000000022')
|
||||
},
|
||||
'MASTER': {
|
||||
'IP': '2.2.2.2',
|
||||
'MODE': b'\x6A',
|
||||
'PORT': 50000,
|
||||
'RADIO_ID': '',
|
||||
},
|
||||
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
||||
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
||||
]
|
||||
},
|
||||
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
||||
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
||||
]
|
||||
},
|
||||
'IPSC2': {
|
||||
'LOCAL': {
|
||||
'DESCRIPTION': 'IPSC Network #1',
|
||||
'MODE': b'\x6A',
|
||||
'FLAGS': b'\x00\x00\x80\xDC',
|
||||
'PORT': 50002,
|
||||
'RADIO_ID': binascii.unhexlify('00000002'),
|
||||
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000000022')
|
||||
'IPSC3': {
|
||||
'LOCAL': {
|
||||
'DESCRIPTION': 'IPSC Network #1',
|
||||
'MODE': b'\x6A',
|
||||
'FLAGS': b'\x00\x00\x80\xDC',
|
||||
'PORT': 50003,
|
||||
'RADIO_ID': binascii.unhexlify('00000003'),
|
||||
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000000333')
|
||||
},
|
||||
'MASTER': {
|
||||
'IP': '3.3.3.3',
|
||||
'MODE': b'\x6A',
|
||||
'PORT': 50000,
|
||||
'RADIO_ID': '',
|
||||
},
|
||||
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
||||
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
||||
]
|
||||
},
|
||||
'MASTER': {
|
||||
'IP': '2.2.2.2',
|
||||
'MODE': b'\x6A',
|
||||
'PORT': 50000,
|
||||
'RADIO_ID': '',
|
||||
},
|
||||
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
||||
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
||||
]
|
||||
},
|
||||
'IPSC3': {
|
||||
'LOCAL': {
|
||||
'DESCRIPTION': 'IPSC Network #1',
|
||||
'MODE': b'\x6A',
|
||||
'FLAGS': b'\x00\x00\x80\xDC',
|
||||
'PORT': 50003,
|
||||
'RADIO_ID': binascii.unhexlify('00000003'),
|
||||
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000000333')
|
||||
},
|
||||
'MASTER': {
|
||||
'IP': '3.3.3.3',
|
||||
'MODE': b'\x6A',
|
||||
'PORT': 50000,
|
||||
'RADIO_ID': '',
|
||||
},
|
||||
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
||||
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
||||
]
|
||||
},
|
||||
'IPSC4': {
|
||||
'LOCAL': {
|
||||
'DESCRIPTION': 'IPSC Network #1',
|
||||
'MODE': b'\x6A',
|
||||
'FLAGS': b'\x00\x00\x80\xDC',
|
||||
'PORT': 50004,
|
||||
'RADIO_ID': binascii.unhexlify('00000004'),
|
||||
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000004444')
|
||||
},
|
||||
'MASTER': {
|
||||
'IP': '4.4.4.4',
|
||||
'MODE': b'\x6A',
|
||||
'PORT': 50000,
|
||||
'RADIO_ID': '',
|
||||
},
|
||||
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
||||
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
||||
]
|
||||
'IPSC4': {
|
||||
'LOCAL': {
|
||||
'DESCRIPTION': 'IPSC Network #1',
|
||||
'MODE': b'\x6A',
|
||||
'FLAGS': b'\x00\x00\x80\xDC',
|
||||
'PORT': 50004,
|
||||
'RADIO_ID': binascii.unhexlify('00000004'),
|
||||
'AUTH_KEY': binascii.unhexlify('0000000000000000000000000000000000004444')
|
||||
},
|
||||
'MASTER': {
|
||||
'IP': '4.4.4.4',
|
||||
'MODE': b'\x6A',
|
||||
'PORT': 50000,
|
||||
'RADIO_ID': '',
|
||||
},
|
||||
'PEERS': [ # each list entry will be a dictionary for IP, RADIO ID and PORT
|
||||
#{'IP': '100.200.1.1', 'PORT': 50000, 'RADIO_ID': b'\x00\x00\x00\xFF'},
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Known IPSC Message Types
|
||||
|
Loading…
Reference in New Issue
Block a user