mershon-enterprises / tournament-manager

GNU Affero General Public License v3.0
0 stars 0 forks source link

Bluetooth Network Mesh #8

Open cpascua opened 8 years ago

cpascua commented 8 years ago

Set up mobile Bluetooth mesh network

cpascua commented 8 years ago

Update: An android device set up as a Bluetooth beacon will have to broadcast beyond the amount of data that it is capable of. Direct connection to other Bluetooth devices can transmit the data no problem but a device is limited to 7 connections according to the Bluetooth spec. This may work for the purpose of the demo but does not prove that we can support a a very large number of players, which is what we are aiming for.

kevinmershon commented 8 years ago

@cpascua Two things: 1) you don't want to use the terminology "beacon" when describing BLE device-to-device communication unless you literally mean using/implementing the iBeacon protocol. Bluetooth peripherals are server devices, and centrals are client devices.

That said, 2) 7 connections at once is the limit. It should be easily possible to create a smart mesh where a device is peripheral to the 7 devices with the weakest signal, and central to those with the strongest signal. This creates the largest possible stable mesh. There are other approaches I'm sure, and we can read up on mesh self-healing algorithms to find the best overall stable network topology.

cpascua commented 8 years ago

@kevinmershon I wasn't sure till now but you are correct that we do need to follow the iBeacon protocol even for android devices. And yes, the smart mesh is the way the go in this case but it is something I'll need to make myself more familiar with.

kevinmershon commented 8 years ago

@cpascua That isn't what I said, actually. iBeacon is too limited in what data can be expressed for this app. It's announce-only, and we need bidirectional data sharing.

kevinmershon commented 8 years ago

See http://stackoverflow.com/questions/21132524/how-to-send-some-data-between-ibeacons for better explanations than I can offer.

cpascua commented 8 years ago

@kevinmershon I understand, the we can't use iBeacon because of the data limitation, although I did find a that 2 way iBeacon communication is possible here but is also very limited.

cpascua commented 8 years ago

Update: Looks like BLE isn't the only mobile phone requirement for creating a bluetooth mesh network using central/peripheral connections. They must also support being a peripheral which can be checked by making sure these 3 lines of code return true.

bluetoothAdapter.isMultipleAdvertisementSupported();
bluetoothAdapter.isOffloadedFilteringSupported();
bluetoothAdapter.isOffloadedScanBatchingSupported();

http://stackoverflow.com/questions/26482611/chipsets-devices-supporting-android-5-ble-peripheral-mode.

kevinmershon commented 8 years ago

@cpascua Something to consider is that just because a phone doesn't support peripheral mode, doesn't mean that it can't be used in a mesh. It can still be a client central.

Ideally, if there's a lot of devices in an environment, a phone that is capable of acting as both peripheral and central would generally "prefer" running in peripheral mode to support as many connected centrals as possible. iPhones are common enough that I doubt we're going to see many situations where there's absolutely no way to create a mesh from the devices in range.