I am developing an Android app which connects to device. Here, I have few very basic questions about UUID which I need better understanding.
1). Is UUID specific to each device(.i.e provided by the manufacture of that device) or is it something of a Unique String for each device( when connecting multiple devices) which can be assumed randomly or ?
2). Is there a category of UUID's for different category types of devices like a set for mobiles,laptops,etc and a different set of UUID's ranges for printer, scanner,etc?
3) And how many UUID's are required for connecting each device. I mean for example, All-in-one printer has both printer and scanner in it and if we need to use both of them, do we need 2 UUIDs for the same device or the number services running on that device(device) and also?
4) How do we find number of services running, which can be connected through Bluetooth, on the remote device( like printer here)(For this Q, I guess providing link is appropriate)
And also, any additional info I need to know about UUIDs, please add that too.
(Please explain little before posting links)
Thank You Guys
1.UUID is specific for each device .Refer 1,2,3,4 for details.
Related
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:
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
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.
I knew how to get the mac address of a BLE device in Android by calling address from BleDevice
bleDevice.address
But I didn't find a way to get the UUID of the device
On the other hand in iOS I can get the UUID of a device by calling identifier from CBPeripheral peripheral.identifier
But I didn't find a way to get the mac address.
Note that the mac address is not advertised in the advertisement data in iOS those are only the fields in advertisement data
kCBAdvDataIsConnectable
kCBAdvDataServiceUUIDs
kCBAdvDataTxPowerLevel
kCBAdvDataRxPrimaryPHY
kCBAdvDataLocalName
kCBAdvDataRxSecondaryPHY
kCBAdvDataTimestamp
My problem is I need an identifier that I can use in both Android and iOS to identify my ble device
In Android, BLE devices are distinguished by their hardware address. CBPeripheral.identifier property seems to be for iOS only and how their peripheral manager identifies and assigns the devices. Probably your implementation should use String as common denominator, for iOS should return identifier and for Android bleDevice.address.
Indeed the iOS MAC-> UUID Issue is a long standing one (and with search you'll see a number of threads on the issue).
Unfortunately there's no simple good news for a solution, and only some potential solutions... here's a summary and hope one of the paths may work for you:
iOS hides the MAC address and randomly generates a UUID for you. You can store the UUID on the phone, but it will be unique to that phone. If we both have iPhones and scan the same peripheral, we'll see different UUIDs. iOS generates the UUID on the device and hides the MAC address.
Indeed the iOS MAC-> UUID Issue is a long standing one (and with search you'll see a number of threads on the issue).
To make life easier, some devices add the some or all of the MAC address in their secondary advertising packet or in a unique device identifier in the Manufacturer data of the device and read this from the advertisement in iOS.... If you're in control of the devices firmware then I'd add this... of course if this is another party's device then you're at the mercy of their implementation.
Another possible route is using the GATT Device Information Service (Service UUID: 0x180a). Under this service there is a Serial Number String (Assigned UUID: 0x2A25) characteristic which can hold a serial number specific to the Bluetooth low energy device. But note, This is optional though and not all BLE profiles will have it, and you have to connect to the device first to retrieve this information which may not fit your usage pattern.
There may be other unique proprietary identifers for a specific device that are exposed either in advertising data or characteristics
If you're talking about an iBeacon then the advertised ibeacon guid and bluetooth address are effectively the same value.
In cases where I'm implementing the firmware for a custom BLE device I always add the 6 byte MAC address to the advertising manufacturer data. Some devices do this (or some other identifier that's not as unique like "Thermometer1020" with the 1020 hopefully being unique). But again you're at the mercy of what the device is advertising.
If you're looking for a solution that works across a wide variety of BLE devices and vendors, then unfortunatly Apple has made life difficult, if not impossible for you in their quest for security, privacy and limiting use cases of connected device applications.
i have a blood pressure device which is a blue tooth supported device. before buying i asked the seller to provide the protocol etc so i can use it in my android application. I am very new to both android and bluetooth connectivity. Any how i have searched around, and in my app i can see the paired devices and the one available devices, in available devices when i search for bluetooth devices i can see the BP monitor along with the mac address which i got from the device.xxx
now i dont exactly know two things which is really confusing to me, first is the RS 232 as shown below and second is the uuid provided, however i am also confused in sending uuid coz its 16bit and android supports 128 bits.
1. RS232 Transmit agreement [9600 baud rate] [none party][ 8 bit data][1 bit stop]
BLE uuid:
Receive: service uuid:0xFFF0, characteristic UUID:0xFFF1
Send: service uuid:0xFFF0, characteristic UUID:0xFFF2
i assume it has something to get connected, however when i try to pair with the device from the android bluetooth sectoin, it prompt that cannot pair because of pin or pass etc. However they also ask me to install one application which i tested once and it can remotely activate the machine for measurement.
can any one guide me in the proper direction, i will be really thankful. Full instructions are provided below
instruction set provided by vendor
So far what I know that its possible to communicate to multiple devices from your android phone. But my case is that I want to connect two 'similar' devices.
My understanding is that, I need to use different UUID if I need to connect 2 devices, the bluetooth chat application suggest to hardcoding the UUID.
Now scenario is that, I m programing for a game, where physical gun will be connected to phone via bluetooth (to track shots etc). Ok here I can ask gun vendor to hard-code a UUID for all guns and phone can connect to 1 gun at a time.. its easy.
The requirement is that, user may have more then 1 gun! Can somebody tell me how to manage this, if I m hardcoding a single UUID for all guns then I m not sure how to connect multiple guns. And if I m not hardcoding the UUID in gun chip, how I can find the UUID to connect?
A UUID is not a unique device identifier; UUIDs are unique identifiers used by the Bluetooth Service Discover Protocol to identify the protocol a Bluetooth device is using. Bluetooth.org has a list of common UUIDs.
Assuming you know or can control the UUID in the guns (it sounds like you can), then you can set up the phone as the Bluetooth server (using the same UUID that the guns use). The guns would then connect as the clients using the same UUID (I know the guns are probably not using Android, but there's some example code there that might be helpful).
Of course, you may need to flip the client/server model around to fit your specific needs. You should be able to make as many of those server and client threads as you need (within the limits of the number of connected devices that your hardware imposes).
Can any one describe what is wrong with this code. It didn't search devices, and it showed some paired devices.
Project hosted here in Github.
think of the UUID as one identifier for a particular kind of service your device is advertising or accepting. It could have many such identifiers for many different services it can offer or use. It's not an identifier for the actual device.
The UUID you are quoting is the same one I found here and use too. it seems to be the UUID for generic bluetooth SPP service. (but haven't found much actual proof like an official published document quot8ing this number, just posts on here with no refrence) This UUID will allow your android device to connect to things like bluetooth serial port adapters, or anything expecting a generic serial port device... so it's a good one to start with.
If you plan to create a special service that's not the same as bluetooth SPP or has a different reason to exist, like android chat does, then it's a good idea to create your own UUID. Of course all devices to connect your service will have to understand this same special number.