policy: reevaluate all linkables if one linkable was removed

Allows relinking client nodes to other devices if the current device has been
removed. This allows audio to keep playing in a different device if a bluetooth
device is disconnected.
This commit is contained in:
Julian Bouzas 2021-05-19 11:43:53 -04:00
parent 7bc59afd81
commit 0ff0ef77f2
2 changed files with 8 additions and 0 deletions

View file

@ -207,6 +207,12 @@ function unhandleSiLinkable (si)
end
end
function reevaluateSiLinkables ()
for si in silinkables_om:iterate() do
handleSiLinkable (si)
end
end
siendpoints_om = ObjectManager { Interest { type = "SiEndpoint" }}
silinkables_om = ObjectManager { Interest { type = "SiLinkable",
-- only handle si-audio-adapter and si-node
@ -225,6 +231,7 @@ end)
silinkables_om:connect("object-removed", function (om, si)
unhandleSiLinkable (si)
reevaluateSiLinkables ()
end)
siendpoints_om:activate()

View file

@ -292,6 +292,7 @@ end)
silinkables_om:connect("object-removed", function (om, si)
unhandleSiLinkable (si)
reevaluateSiLinkables ()
end)
metadatas_om:activate()