Internet of Things with Bluetooth - Developer Skill Sprint with David I
1. EEMMBBAARRCCAADDEERROO T TEECCHHNNOOLLOOGGIEIESS
Internet of Things
with Bluetooth
David Intersimone “David I”
davidi@embarcadero.com
Blog: http://embt.co/SipFromTheFirehose
Twitter: @davidi99
Thursday, 18th of September, 2014
Download a free trial – NOW!
http://embt.co/trialdownloads
2. EMBARCADERO TECHNOLOGIES
This Skill Sprint Works with . . .
• Windows
• OS X
• Android
• iOS
• RAD Studio
• Appmethod
• Object Pascal
• C++
• RAD Studio XE7 DocWiki
– http://embt.co/latestdocwiki
• Appmethod September 2014 Release DocWiki
– http://embt.co/AppmethodTopics
• Appmethod supports the FireMonkey framework on
all 4 platforms while RAD Studio, Delphi and
C++Builder also supports VCL on Windows. Contact
sales with any questions!
3. EMBARCADERO TECHNOLOGIES
How Skill Sprints Work. - Agenda
• READY
– Tips tricks & short URLS
• SET
– 20 minutes, 1 topic
• GO
– Demo and discussion
Download a free trial – NOW! – Live Q&A
http://embt.co/trialdownloads
4. EMBARCADERO TECHNOLOGIES
Bluetooth support in XE7
• RTL new unit: System.Bluetooth, System::Bluetooth
• Multi-device API for Classic Bluetooth & Bluetooth LE
• TBluetoothLE component
• Classic Bluetooth classes
– TBluetoothManager
– TBluetoothAdapter
– TBluetoothDevice
5. EMBARCADERO TECHNOLOGIES
Bluetooth and App Tethering
• To implement Classic Bluetooth support in your VCL
and FMX apps:
– Obtain an instance of TBluetoothManager.
– Discover remote devices and pair with them.
– Connect to the paired devices.
– Exchange data with the connected devices.
6. EMBARCADERO TECHNOLOGIES
BluetoothLE and Devices
• Use an instance of TBluetoothLEDevice to:
– Discover services that the remote device provides
– Obtain detailed info including the characteristics
• Read and Write a characteristic value
• Ask to be notified of changes in a Characteristic value
– SetCharacteristicNotification method
– OnCharacteristicRead event handler
• Get the received signal strength indicator (RSSI)
• To obtain an instance of TBluetoothLEDevice
– Use the StartDiscovery method or LastDiscoveredDevices property
8. EMBARCADERO TECHNOLOGIES
BluetoothLE GATT-based Profile Hierarchy
• Generic Attribute Profile (GATT)
– Services are collections of characteristics
and relationships to other services that
encapsulate the behavior of part of a
device
– https://developer.bluetooth.org/gatt/Pages
/GATT-Specification-Documents.aspx
• If device is not GATT
– Try using discovery
– Contact the device manufacturer
10. EMBARCADERO TECHNOLOGIES
Bluetooth Resources
• Bluetooth samples that are included in XE7
– C++
• C:UsersPublicDocumentsEmbarcaderoStudio15.0SamplesCPPMobile SamplesDevice Sensors and ServicesBluetooth
• C:UsersPublicDocumentsEmbarcaderoStudio15.0SamplesCPPRTLTethering
– Object Pascal
• C:UsersPublicDocumentsEmbarcaderoStudio15.0SamplesObject PascalMobile SamplesDevice Sensors and ServicesBluetooth
• C:UsersPublicDocumentsEmbarcaderoStudio15.0SamplesObject PascalRTLTethering
• Bluetooth and App Tethering
– http://docwiki.embarcadero.com/RADStudio/XE7/en/Using_Bluetooth
– http://docwiki.embarcadero.com/RADStudio/XE7/en/Using_Classic_Bluetooth
– http://docwiki.embarcadero.com/RADStudio/XE7/en/Using_App_Tethering
• Bluetooth.org
– https://developer.bluetooth.org/
– https://developer.bluetooth.org/TechnologyOverview/Pages/BLE.aspx
– https://developer.bluetooth.org/TechnologyOverview/Pages/GATT.aspx
– https://developer.bluetooth.org/gatt/Pages/GATT-Specification-Documents.aspx
Download a free trial – NOW!
http://embt.co/trialdownloads
11. EMBARCADERO TECHNOLOGIES
Next Time….
• Aspect-oriented Programming using DSharp
with Nick Hodges
• “Coding in Delphi” - https://leanpub.com/codingindelphi
• Tuesday the 23rd of September
– 6AM San Francisco / 9AM New York / 2PM London / 3PM Milan
– 11AM San Francisco / 2PM New York / 7PM London / 8PM Milan
– 5PM San Francisco / Fri 9AM Tokyo / Fri 10AM Sydney
See the full schedule - http://embt.co/Sprints14
Download your free trial now! - http://embt.co/trialdownloads