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

alfred-data
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']: if options['mesh']:
for mesh_interface in options['mesh']: for mesh_interface in options['mesh']:
bm = batman(mesh_interface) 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(): for gw in bm.gateway_list():
db.mark_gateways(gw.mac) db.mark_gateways(gw.mac)
else: else:
bm = batman() bm = batman()
db.parse_vis_data(bm.vis_data()) db.parse_vis_data(bm.vis_data(options['alfred']))
for gw in bm.gateway_list(): for gw in bm.gateway_list():
db.mark_gateways([gw['mac']]) db.mark_gateways([gw['mac']])

View File

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