Merge pull request #1691 from G10h4ck/fixup_brodcastdiscovery

Fix some bugs in broadcast discovery
This commit is contained in:
G10h4ck 2019-10-25 23:06:13 +02:00 committed by GitHub
commit 584918388c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 181 additions and 3 deletions

View file

@ -107,5 +107,45 @@ public:
*/
virtual std::vector<RsBroadcastDiscoveryResult> getDiscoveredPeers() = 0;
/**
* @brief Check if multicast listening is enabled
* @jsonapi{development}
* On some platforms such as Android multicast listening, which is needed
* for broadcast discovery, is not enabled by default at WiFi driver level
* @see enableMulticastListening, so this method check if it is enabled.
* On platforms that are not expected to have such a limitation this method
* always return true.
* @return true if enabled, false otherwise.
*/
virtual bool isMulticastListeningEnabled() = 0;
/**
* @brief On platforms that need it enable low level multicast listening
* @jsonapi{development}
* On Android and potencially other mobile platforms, WiFi drivers are
* configured by default to discard any packet that is not directed to the
* unicast mac address of the interface, this way they could save some
* battery but breaks anything that is not unicast, such as broadcast
* discovery. On such platforms this method enable low level multicast
* listening so we can receive advertisement from same broadcast domain
* nodes.
* On platforms without such limitation does nothing and always return
* false.
* It is exposed as a public API so the UI can decide the right equilibrium
* between discoverability and battery saving.
* @return true if multicast listening has been enabled due to this call,
* false otherwise.
*/
virtual bool enableMulticastListening() = 0;
/**
* @brief Disable multicast listening
* @jsonapi{development}
* The opposite of @see enableMulticastListening.
* @return true if multicast listening has been disabled due to this call,
* false otherwise.
*/
virtual bool disableMulticastListening() = 0;
virtual ~RsBroadcastDiscovery();
};