Clocker
Clocker

Reputation: 1336

Android and Bluetooth: Multiple connections and bi-directional data exchange

I am wondering what is the best approach for a server/client Bluetooth connection with multiple devices where all devices exchange data.

The approach im following is a hub and edge devices, where all edge devices exchange data with a central device (hub) and the hub exchanges data with each device. Each edge device has one connection, the hub has multiple

I'm new to Bluetooth but I want to plan ahead as to reduce headaches, so

Which device is the server, which is the client? Should the hub be the server and everything else connect to it. Or should the hub act as the client and connect to each edge device?

Android Bluetooth Chat sample app - multiple connections

Upvotes: 0

Views: 592

Answers (1)

iheanyi
iheanyi

Reputation: 3113

The hub should be the server.

The hub needs to route messages between edge devices. The server needs to route messages between clients. Each edge device is also just a single client.

So, in what you're proposing, the "hub" and "server" will be performing the same operation over the exact same set of devices, though one addresses physical devices and the other addresses logical clients. That's because there is a 1 to 1 relationship between device and client meaning the hub and server route exactly the same information.

Upvotes: 1

Related Questions