alfred: Make the alfred based batadv-vis data source optional.

This commit is contained in:
Daniel Ehlers 2014-01-30 22:21:15 +01:00
parent 4c4e8d846b
commit 319b071fd8
2 changed files with 7 additions and 4 deletions

View file

@ -47,12 +47,12 @@ db = NodeDB()
if options['mesh']:
for mesh_interface in options['mesh']:
bm = batman(mesh_interface)
db.parse_vis_data(bm.vis_data())
db.parse_vis_data(bm.vis_data(options['alfred']))
for gw in bm.gateway_list():
db.mark_gateways(gw.mac)
else:
bm = batman()
db.parse_vis_data(bm.vis_data())
db.parse_vis_data(bm.vis_data(options['alfred']))
for gw in bm.gateway_list():
db.mark_gateways([gw['mac']])

View file

@ -9,8 +9,11 @@ class batman:
def __init__(self, mesh_interface = "bat0"):
self.mesh_interface = mesh_interface
def vis_data(self):
return self.vis_data_batadv_vis() + self.vis_data_batctl_legacy()
def vis_data(self,batadv_vis=False):
vds = self.vis_data_batctl_legacy()
if batadv_vis:
vds += self.vis_data_batadv_vis()
return vds
def vis_data_helper(self,lines):
vd = []