Table of Contents
1 Version History -- BLE API Doc ____________________________________________________________ 5
2 Introduction to Bluegiga Bluetooth Smart Software -- BLEAPI ____________________________________ 7
2.1 The Bluegiga Bluetooth Smart Stack ___________________________________________________ 7
2.2 The Bluegiga Bluetooth Smart SDK ____________________________________________________ 8
2.3 The BGAPI TM Protocol _____________________________________________________________ 9
2.4 The BGLIB TM Host Library _________________________________________________________ 10
2.5 The BGScript TM Scripting Language _________________________________________________ 11
2.6 The Profile Toolkit TM _____________________________________________________________ 12
3 Introduction to Bluetooth Smart Technology -- BLEAPI ________________________________________ 13
3.1 Physical layer ____________________________________________________________________ 13
3.2 Packet format ____________________________________________________________________ 14
3.2.1 Generic packet format _______________________________________________________ 14
3.2.2 Advertisement packet format __________________________________________________ 14
3.2.3 Data packet format _________________________________________________________ 14
3.3 Link layer state machine ____________________________________________________________ 16
3.4 Link layer operations ______________________________________________________________ 17
3.4.1 Passive scanning __________________________________________________________ 17
3.4.2 Active scanning ____________________________________________________________ 18
3.4.3 Connection establishment ____________________________________________________ 18
3.5 Topologies ______________________________________________________________________ 19
3.6 Connections and packet timings ______________________________________________________ 20
3.7 Encryption _______________________________________________________________________ 22
3.8 L2CAP _________________________________________________________________________ 23
3.9 Security Manager -- BLEAPI ________________________________________________________ 24
3.9.1 I/O capabilities and Man-in-the-Middle (MITM) protection ___________________________ 24
3.10 Attribute Protocol (ATT) ___________________________________________________________ 25
3.11 Generic Attribute Profile (GATT) ____________________________________________________ 28
3.12 Generic Access Profile (GAP) -- BLEAPI ______________________________________________ 31
4 API definition -- BLEAPIs ________________________________________________________________ 32
4.1 The BGAPI protocol definition -- BLEAPI _______________________________________________ 32
4.1.1 Message types ____________________________________________________________ 32
4.1.2 Command Class IDs ________________________________________________________ 34
4.1.3 Packet Exchange __________________________________________________________ 34
4.2 The BGLIB functions definition _______________________________________________________ 38
4.3 The BGScript API definition _________________________________________________________ 39
4.4 Data Types -- BLEAPI _____________________________________________________________ 40
5 API Reference ________________________________________________________________________ 41
5.1 Attribute Client ___________________________________________________________________ 42
5.1.1 Commands--attclient ________________________________________________________ 42
5.1.2 Enumerations--attclient ______________________________________________________ 65
5.1.3 Events--attclient ____________________________________________________________ 66
5.2 Attribute Database ________________________________________________________________ 72
5.2.1 Commands--attributes _______________________________________________________ 72
5.2.2 Enumerations--attributes _____________________________________________________ 80
5.2.3 Events--attributes __________________________________________________________ 82
5.3 Connection ______________________________________________________________________ 85
5.3.1 Commands--connection _____________________________________________________ 85
5.3.2 Enumerations--connection ___________________________________________________ 96
5.3.3 Events--connection _________________________________________________________ 97
5.4 Generic Access Profile ____________________________________________________________ 101
5.4.1 Commands--gap __________________________________________________________ 101
5.4.2 Enumerations--gap ________________________________________________________ 121
5.4.3 Events--gap ______________________________________________________________ 130
5.5 Hardware ______________________________________________________________________ 131
5.5.1 Commands--hardware ______________________________________________________ 131
5.5.2 Events--hardware _________________________________________________________ 160
5.6 Persistent Store _________________________________________________________________ 165
5.6.1 Commands--flash _________________________________________________________ 165