Bluetooth LE (BLE) changed the way devices interact with each other in a significant way. It is not only battery-conserving, it also breaks down platform limitations that were introduced by Apple and its Made for iOS program to the Bluetooth Standard that forced manufacturers to build products for Apple’s platforms and for other platforms separately. Being an optional extension of the Bluetooth 4.x standard, it’s available to millions of smartphone users worldwide on both Android and iOS and is used to communicate with fitness trackers, medical devices, beacons and small sensor devices. But besides these features the BLE standard describes a tremendous amount of profiles allowing for standardized communication between different platforms (both hardware- and software-wise). In contrast to earlier Bluetooth profiles that could easily cost more than 1000 US-$ just to get all the standard documents needed for their implementation, these profiles are available for free, allowing independent developers and small companies to use them.
This talk explains how BLE differs from more stream-oriented protocols and how these profiles can be used to connect to various devices in a standardized way. While giving short examples on how to implement these profiles on Android, the focus is more on enabling the audience to dig into the profile descriptions on their own and be able to implement them in their own projects.
2. Agenda
• How differs Bluetooth Smart from BT Classic?
• The power of the Services
• Example: Using Battery Level and Current Time service
3. • Steven Mohr, Android developer since Android 1.5
• Started working on device integration with Bluetooth
(BT) in 2010 at the German Aerospace Center
• Continued to work with Bluetooth Classic and Smart
for clients in Healthcare
• Since 2014 with my own company Smart As Apps
Who’s that guy?
5. Bluetooth Classic has been around forever
• mainly used for Headsets and Car connectivity
• only very generic profiles (serial port profile (SPP),
audio transmission)
• standards for specific use cases can be expensive (IEEE 11073 for
health care > 1000€)
Why are we talking about BT again?
6. Why are we talking about BT again?
Interoperability problems (devices had problems with different
phones and OS)
• Nightmare with increasing amount of smartphones available
• No direct access on iOS / devices need to comply with Made for iOS
specification (includes also communication protocol changes)
7. • Direct accessibility in iOS: One device for all platforms -> cheaper
for device manufacturers to support it
• While BT Classic is stream-oriented, Bluetooth LE works event-
based
• Allowing to be more energy-efficient as devices can sleep as long
as no notifications are received -> makes it great for wearables and
IoT devices
How differs Bluetooth LE from BT Classic?
10. • GATT profile (General Attribute profile)
• Via this profile GATT services can the
accessed in a defined way.
★ identified by UUID
• These services contain characteristics
★ identified by UUID
★ contains the actual data to interact with
★ Meta data is stored in the descriptor
How is Bluetooth LE structured?
11. The power of the services
What to do with this services?
• Health:
★ Blood pressure or heart rate
• General:
★ Automation IO (e.g. GPIO ports from various boards)
★ Indoor Positioning (Beacons)
12. The power of the services
• Specifications for services are available for free at bluetooth.org
★ Access to drafts is available with a free membership
(just postage to send license agreement)
• BUT: Manufacturers can define their own services and mix standard
services with custom devices or use no standard services at all
14. Battery Service
• Read battery level
• Get (optionally) updates about level changes
Link: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml
How to actually do something?
15. • Read is mandatory
• Notify is optional
Battery Level Service
16. How to actually do something?!
• Current Time Service
★ Read / get updated about the time
★ Optionally set current time
Link: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.current_time.xml
17. Current Time Service
• Current Time
★ Read and Notify mandatory, Write optional
• Local Time
★ itself optional
★ Read Mandatory, Write Optional
• Reference Time
★ optional
★ Read mandatory
18. What’s the process in a nutshell?
1. Check for BLE standard services you can use
2. Investigate whether you can realize you app idea with that standard
service
3. Do you have to work around optional parts or can you even benefit
from them?
4. Create a great app and get happy users!
19. What to take away?
• You don’t need to test every device as long as you use standard
services
• Make sure to handle optional capabilities properly
• Try to provide value for your users using the mandatory parts of the
specification and add extended values for devices that support
optional parts you want to use
20. Chaos! by Robert Scoble: CC-BY 2.0 (https://www.flickr.com/photos/scobleizer/5628705627/)
Zombie! by Daniel Hollister: CC-BY 2.0 (https://www.flickr.com/photos/dhollister/2596483147/)
DSC_0210 by SergioDelgado: CC-BY 2.0 (https://www.flickr.com/photos/sdelgado/3433299832/)
Source