According to the BLE patent, the size of data in a BLE packet is 47 bytes. However, Android exposes only 20 bytes of data.
For ease of use, Bluetooth defines a single packet format for both advertising and data transmissions. This packet consist of four components: preamble (1 octet), access address (4 octets), Protocol Data Unit – PDU (2-257 octets), and Cyclic Redundancy Check – CRC (3 octets); see Figure 1A.
Bluetooth® Low Energy Packet Types. The Bluetooth® Low Energy (BLE) Link Layer has only one packet format used for both advertising channel packets and data channel packets: BLE packet Protocol Data Unit (PDU) size in specification v4. 0 and v4. 1 is 2-39 bytes.
Android provides built-in platform support for Bluetooth Low Energy (BLE) in the central role and provides APIs that apps can use to discover devices, query for services, and transmit information. Common use cases include the following: Transferring small amounts of data between nearby devices.
The standard format for the BLE packet in data transmission protocol is:
Command Byte (1 byte) + Device Identification ID (2 bytes) + Data (12-16 bytes) + CheckSum(1 byte)
Command section: These will be hex values that you have to specify according to the type of command (eg. Device Name, Factory Information, Temperature and Humidity data etc.)
Device Identification ID: This will consist of the UUID of the receiving device (it can be 16 bit if its a SIG Group Generated UUID or 128 bit if you are testing)
Data Section: This part will contain all the data that you want to send (it can be between 12 and 16 bytes, although it is recommended that you fix the length of the data packet)
CheckSum: For error correction. You can use a different mechanism but then you will have to adjust your data part accordingly)
You have to define a custom gatt profile and server if you are planning to implement something that doesn't already have an existing profile on the SIG Bluetooth Site.
P.S. Read up more on the device specifications of your external device and also check out the core specs on the bluetooth website. Everything you do must conform to their standards
Alright, Hope this helped.. Cheers!
Basically the BLE packet (delivered as scan record to android APIs) is as far as I know just standard BLE, just as with any other platform.
i.e. it consists of items, and each item consist of 3 items in following order:
With my tests on BLE I actually see that the scan record that I get is actually longer than I can advertise. So I would assume that you can see beacons & BLE devices advertising with more than 31 bytes even with android devices.
But the BluetoothLeAdvertiser API will only allow you to have 31 bytes in the advertisement scan record you are advertising from android device.
I would not have any good reasoning why the limit is 31 bytes, I just have tested that it is enforced that way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With