of data Very short wake-up/connection time Improved battery life (Lower power consumption) Short range Coin-cell battery (Ideal for sensors and beacons)
Low Energy technology Data payload throughput 2 Mbps ~ 100 kbps Connection set-up speed Weak Strong Range 300m 250m Power consumption High Low Large scale network Weak Good Source: http://www.connectblue.com/technologies/bluetooth-low-energy-technology/
ms ~ 6 seconds Range Up to 10 cm Up to 250 m Usability Human centric easy, intuitive, fast Data centric medium Security High Low Connection Point to Point (P2P) Personal area network (WPAN)
analog communications circuitry (Transmits and receives packets over the physical channel) - Modulating and demodulating analog signal and transforming them into the digital symbols
custom hardware and software - Controls the state of the transceiver, determining whether it’s advertising, scanning, initiating, connected, or standing by
Takes large packets from the upper layers and breaks them into chunks Generic Access Profile (GAP) Security Manager Protocol (SMP) Generic Attribute Profile (GATT) Attribute Protocol (ATT) Logical Link Control and Application Protocol (L2CAP)
enable two devices to communicate securely over a dedicated L2CAP channel. Generic Access Profile (GAP) Security Manager Protocol (SMP) Generic Attribute Profile (GATT) Attribute Protocol (ATT) Logical Link Control and Application Protocol (L2CAP)
certain of its attributes to another device - Each attribute is uniquely identified by a Universally Unique Identifier (UUID) - The ATT block sets up peer-to-peer communication between an attribute server and a client to be able to exchange this information over a dedicated L2CAP channel Generic Access Profile (GAP) Attribute Protocol (ATT) Logical Link Control and Application Protocol (L2CAP) Security Manager Protocol (SMP)
application and Bluetooth profiles and handles device discovery, connection, and services, including security procedures. Generic Access Profile (GAP) Attribute Protocol (ATT) Logical Link Control and Application Protocol (L2CAP) Security Manager Protocol (SMP)
adds a hierarchy and data abstraction model on top of it. - It’s backbone of BLE data transfer because it defines how to exchange all profile and user data over a BLE connection Generic Access Profile (GAP) Attribute Protocol (ATT) Logical Link Control and Application Protocol (L2CAP) Security Manager Protocol (SMP)
that two Bluetooth Low Energy devices transfer data back and forth - Uses concepts of Services and Characteristics - Makes use of Attribute Protocol (ATT)
the ATT lookup data, service and characteristics definitions The phone/tablet, which sends requests to GATT server All transactions are started by the master device, the GATT Client, which receives response from the slave device, the GATT Server.
e.g. Heart Rate Profile A service is a collection of characteristics. For example, you could have a service called "Heart Rate Monitor" that includes characteristics such as "heart rate measurement."
value transferred between the client and the server. For example, in addition to the heart rate measurement, a heart rate monitor can also report its current battery voltage, device name, or serial number.
Since Android 4.3, support for Bluetooth Low Energy (Bluetooth LE) in the central role - Since Android 5.0, an Android device can now act as a Bluetooth LE peripheral device
allows you to perform fundamental Bluetooth tasks, such as initiate device discovery, query a list of connected devices final BluetoothManager bluetoothManager = (BluetoothManager)context.getSystemService (Context.BLUETOOTH_SERVICE); m_BluetoothAdapter = bluetoothManager.getAdapter();
startLeScan() method. This method takes a BluetoothAdapter.LeScanCallback as a parameter. mBluetoothAdapter.startLeScan(mLeScanCallback); mBluetoothAdapter.stopLeScan(mLeScanCallback);
startLeScan() method. This method takes a BluetoothAdapter.LeScanCallback as a parameter. mBluetoothAdapter.startLeScan(mLeScanCallback); mBluetoothAdapter.stopLeScan(mLeScanCallback); Deprecated
you use the startLeScan() method. This method takes a BluetoothAdapter.LeScanCallback as a parameter. public boolean startLeScan (UUID[] serviceUuids, BluetoothAdapter.LeScanCallback callback)
you use the startLeScan() method. This method takes a BluetoothAdapter.LeScanCallback as a parameter. public boolean startLeScan (UUID[] serviceUuids, BluetoothAdapter.LeScanCallback callback) Deprecated
{ @Override public void onScanResult(int callbackType, ScanResult result) { super.onScanResult(callbackType, result); // do whatever you want to do with ScanResult object // result.getDevice() which returns BluetoothDevice // result.getDevice().getAddress(); } @Override public void onBatchScanResults(List<ScanResult> results) { super.onBatchScanResults(results); } @Override public void onScanFailed(int errorCode) { super.onScanFailed(errorCode); }});
this mode when the application is running in the foreground Scan results are returned at a rate that provides a good trade-off between scan frequency and power consumption. Default scan mode as it consumes the least power.
this mode when the application is running in the foreground Scan results are returned at a rate that provides a good trade-off between scan frequency and power consumption. Default scan mode as it consumes the least power. Improved Battery Life
a BLE device - Established by connecting to the GATT server on the device mBluetoothGatt = bluetoothDevice.connectGatt(this, false, mGattCallback); You can use `mBluetoothGatt` object to conduct GATT client operations. (FYI, the caller (the Android app) is the GATT client.)
a BLE device - Established by connecting to the GATT server on the device mBluetoothGatt = bluetoothDevice.connectGatt(this, false, mGattCallback); Context boolean autoconnect BluetoothGattCallback
new BluetoothGattCallback() { @Override public void onCharacteristicChanged(BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic) { // this will get called anytime you perform a read or write characteristic operation } @Override public void onConnectionStateChange(final BluetoothGatt gatt, final int status, final int newState) { // this will get called when a device connects or disconnects } @Override public void onServicesDiscovered(final BluetoothGatt gatt, final int status) { // this will get called after the client initiates a BluetoothGatt.discoverServices() call } }
{ @Override public void onConnectionStateChange(final BluetoothGatt gatt, final int status, final int newState) { // this will get called when a device connects or disconnects if (status == BluetoothGatt.GATT_SUCCESS) { if(newState == BluetoothGatt.STATE_CONNECTED) { boolean isServiceDiscovered = bluetoothGattClient.discoverServices(); if (!isServiceDiscovered) bluetoothGattClient.close(); } } } }
get service if (status == BluetoothGatt.GATT_SUCCESS) { BluetoothGattService service = gatt.getService(MY_PERIPHERAL_SERVICE_UUID); // get references to read and write characteristics if (service != null) { BluetoothGattCharacteristic characteristic = service .getCharacteristic(MY_PERIPHERAL_SERVICE_READ_CHAR_UUID); } }