forked from BateauNautilus/DriveSimulator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
31 lines (24 loc) · 668 Bytes
/
config.py
File metadata and controls
31 lines (24 loc) · 668 Bytes
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
import configparser
config = None
class Config(object):
def __init__(self):
self.create()
@staticmethod
def create():
global config
if config is None:
config = configparser.ConfigParser()
config.read('can.conf')
return config
@staticmethod
def getDeviceId():
return int(Config.create()['CAN']['device_id'])
@staticmethod
def getChannel():
return Config.create()['CAN']['channel']
@staticmethod
def getBusType():
return Config.create()['CAN']['bustype']
@staticmethod
def getInterface():
return Config.create()['CAN']['interface']