Fix broadcast discovery in Android

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. To solve this
  problem On such platforms provide methods to handle low level multicast
  listening so we can receive advertisement from same broadcast domain nodes.
This commit is contained in:
Gioacchino Mazzurco 2019-10-19 10:53:04 +02:00
parent 48267eb659
commit 7f2bfae104
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
4 changed files with 180 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();
};