Differentiate between Bluetooth connection to Mac or Windows/Linux device

Viewed 338

Is it possible to check if a connected device is manufactured by Apple / runs macOS?

I saw some info on the UUID might containing that information but I haven't found a way to extract that information from it. https://www.bluetooth.com/specifications/assigned-numbers/

There are assigned numbers but I haven't found out if I can rely on the UUID always having that information and if it even contains a way to check.

In my case I'm developing an Android App, but I guess that and the programming language doesn't matter here. If given a UUID, how do I check if it's manufactured by apple?

So I either need a general way to figure out if a UUID is from apple, or an Android specific way of getting that information, mostly only having access to a BluetoothDevice object (without advertising or other lower level stuff because I don't access the connection directly)

To be more specific, I am using BluetoothHidDevice for the connection https://developer.android.com/reference/android/bluetooth/BluetoothHidDevice


Edit: I am provided with a device.uuids variable, that hold multiple UUIDs

Each one of them has the following methods: UUids

What exactly can I do with the values to check if the manufacturer is apple. The toString method generates a uuid String as expected

So to give an example, a Windows device has multiple UUIDS, one of which looks like this:

toString: 0000111f-0000-1000-8000-00805f9b34fb

leastSignificantBits: -9223371485494954757

mostSignificantBits: 18824841662464

There are around 32 UUIDs provided

3 Answers

I found a hackish way to do this, but the devices must have Bluetooth discovery activated, what you can do using android is to call upon the method startDiscovery() that allows you to scan nearby discoverable devices. This allows you to create a list of Bluetooth names that you can filter using regex to search whatever contains the term mac, macos, osx, macbook, etc., considering that most people don't really change their Bluetooth device name, this could be a good enough solution to your problem.

Here's a very detailed answer from another question that might help you find what you need Find all Bluetooth devices (headsets, phones etc) nearby, without forcing the devices in discoverable mode

I don't think apple would violate the Bluetooth Specifications, so I think it is safe to assume that the company identifier in the UUID is a reliable source of information. You can check the UUID for the Assigned Company Identifiers as provided by Bluetooth SIG. The Apple identifier is 0x004C. I don't see a way you could get hold of information regarding the operating system though. Maybe if you further described your use case, there might be a more convenient way to what you intend.

Please open this 16-bit UUID Numbers Document. Here on 3rd page you can see a table of UUID Allocation with Allocated devices. You can use 16-bit UUID for Members list to know which device is connected i.e. Apple, Samsung, Huawei etc. So we can find Apple based 16-Bit UUIDs as Apple is only platform to use IOS. All others UUIDs will relatively Android, Windows or Ubuntu etc. devices.

Related