Reputation: 1806
Maybe I don't understand exactly how works the UUID in a bluetooth connection, but as I have understand, the server has to open a BluetoothSocket with a specific UUID and listen to a connection request on this socket with the same UUID.
My question is, when you don't have access to the client to hard code the UUID, how can you send to the client the UUID he musts use to connect the BluetoothSocket ?
Please tell me if I have not correctly understood the bluetooth connection process !
Best regards
Upvotes: 1
Views: 1334
Reputation: 191
A bluetooth 'server' can expose one or several services (also called profiles): for example, a server can expose a SPP profile (through the SPP or RFCOMM GUID). Now, when a client wants to connect and talk a server (which is 'another' BT device around...) 1) the client do an 'Inquiry', that is, list all nearby BT devices, and collect informations about them (Name, MacAddress aso.) 2) the client then select the 'server' device (by name or MacAddress...) 3) if found, the client can then issue a 'Discovery' on this particular device, and collect its list of exposed profiles/services. 4) if the client found the wanted service (same GUID, as wanted), it can connect to it and then 'talk'
tl;dr : the server doesn't 'send' the GUID or whatever. Client and Server both agree to 'talk' with a common 'language', ie same GUID-same profile (if available on both sides ofc)
Upvotes: 0
Reputation: 11896
Bluetooth provides a Service Discover Protocol (SDP), which is a standard way of discovering services and UUIDs. When building an app, you can either hard code UUIDs on both server or client, or you use SDP to look up the UUID at runtime.
Upvotes: 1