11
|
1 |
from nodelist import NodeList
|
|
2 |
from nodemanager import NodeManager
|
|
3 |
import config_utils, gen_cfile
|
|
4 |
|
|
5 |
class _Beremiz_CanFestival_Controller(NodeList):
|
|
6 |
def __init__(self, buspath, bus_id):
|
|
7 |
self.bus_id = bus_id
|
|
8 |
manager = NodeManager()
|
|
9 |
NodeList.__init__(self, manager)
|
|
10 |
self.LoadProject(buspath)
|
|
11 |
|
|
12 |
def SaveBus(self):
|
|
13 |
self.SaveProject()
|
|
14 |
|
|
15 |
def Generate_C(self, filepath, locations):
|
|
16 |
"""
|
|
17 |
return C code for network dictionnary
|
|
18 |
"""
|
|
19 |
master = config_utils.GenerateConciseDCF(locations, self)
|
|
20 |
res = gen_cfile.GenerateFile(filepath, master)
|
|
21 |
if not res:
|
|
22 |
s = str(self.bus_id)+"_IN(){}\n"
|
|
23 |
f = file(filepath, 'a')
|
|
24 |
f.write(s)
|
|
25 |
else:
|
|
26 |
pass # error
|
|
27 |
|
|
28 |
def BlockListFactory(bmz_inst):
|
|
29 |
return []
|
|
30 |
|
|
31 |
def ControllerFactory():
|
|
32 |
return _Beremiz_CanFestival_Controller() |