ContentsIndex
PreviousUpNext
Bluetooth
Classes | Macros | Structs, Records, Enums | Types | Variables

 

LinkIt ONE provides built-in Bluetooth Serial Port Profile (SPP) support for one-to-one connections. The Bluetooth API uses this feature to enable connection of two Bluetooth devices and the data exchange between them. 

When acting as a server, LinkIt waits for the Bluetooth SPP client before sending data data and receiving data. 

When acting as a client, LinkIt will do the following:

  • Scan for Bluetooth devices and connect to a designated server device.
  • Send data to and receive data from the connected server device.
 

LinkIt ONE also provides built-in Bluetooth 4.0 Generic Attribute Profile (GATT) to transmit arbitrary data between devices. The GATT profile is a general specification for sending and receiving short pieces of data known as "attributes" over a Bluetooth connection. All Bluetooth 4.0 application profiles are based on GATT. 

 

This module allows you to create a Bluetooth 4.0 central device or a peripheral device. A central device is created with LGATTClient and a peripheral device is created with LGATTServer

 

Typical steps to build a Bluetooth 4.0 peripheral device are as follows: 

1) Inherit and implement one or more LGATTService, which defines attributes of each service 

2) Call LGATTServer.begin() with service objects as input parameter 

3) In the loop() function, call handleEvents() to process incoming Bluetooth 4.0 events and requests 

4) The callback functions in LGATTService is called on corresponding events 

 

Typical steps of call sequence to build a Bluetooth 4.0 peripheral device are as follows: 

1) Create a LGATTClient object 

2) Scan for nearby Bluetooth 4.0 devices and retrieve their addresses and RSSI values 

3) Enumerate each scanned device and their available services 

4) Connect to the desired device once the required services and profiles are found 

5) Read attributes and write attributes according to defined profile behavior 

 

 

 

Classes
Class 
Description 
LBTClient class interface 
LBTServer class interface. 
You can use this class to read and write Bluetooth GATT attributes and receive notifications. This class instantiates an object to scan for nearby Bluetooth 4.0 peripheral devices. It also provides functionality to connect to one Bluetooth 4.0 peripheral device and enumerate all the GATT service the peripheral device provides. 
This class represents a read request from the central device. It also provides method to send the attribute value back to the central device. 
You can use the LGATTServer singleton macro to access its methods instead of instantiating this class directly. 
This class inherits and implements callbacks to define a GATT service. 
This class facilitates handling UUIDs used by LGATTClient, LGATTServerClass and LGATTService classes. 
This class represents a write request from the central device. It also provides method to send the write operation result to the central device. 
Macros
Macro 
Description 
This is the attribute MTU and it is the maximum number of bytes that a single read and write operation can transmit. If the characteristic is more than 23 bytes, then offset must be used in onRead() and onWrite(). 
This is the address size of a Bluetooth 4.0 device. 
The bit position in LGATT_CHAR_PROPERTIES that represents the broadcast. 
The bit position in LGATT_CHAR_PROPERTIES that represents the extension. 
The bit position in LGATT_CHAR_PROPERTIES that represents the Indicate. 
The bit position in LGATT_CHAR_PROPERTIES that represents the Notify. 
The bit position in LGATT_CHAR_PROPERTIES that represents the Read. 
The bit position in LGATT_CHAR_PROPERTIES that represents the Signed Write. 
The bit position in LGATT_CHAR_PROPERTIES that represents the Write. 
The bit position in LGATT_CHAR_PROPERTIES that represents the "Write Without Response". 
The bit 0. 
The bit 2. 
The bit 1. 
The bit 3. 
The bit 5. 
The bit 4. 
The bit 6. 
The bit 7. 
You can use the LGATTServer singleton to access GATT server's functionality. 
This can be enlarged according to your specified profile. 
Structs, Records, Enums
Struct, Record, Enum 
Description 
This represents information about a characteristic or a descriptor. 
This represents address structure for Bluetooth 4.0 devices. 
This represents value of a GATT attribute. 
This represents the information of a remote Bluetooth 4.0 peripheral device. 
This is a structure that defines the Bluetooth GATT service, characteristic and descriptor.
A Bluetooth GATT service is defined by an array of LGATTServiceInfo, the first array elements must be of type TYPE_SERVICE, followed by elements of type TYPE_CHARACTERISTIC or type TYPE_DESCRIPTOR. The last element in the array must be of type TYPE_END.
Please see LGATTServerClass.loadService() for more details. 
Types
Type 
Description 
This represents the characteristic properties or the descriptor. The meaning of each bit in this property is defined by bit-flag, i.e. LGATT_CHAR_PROP_READ, LGATT_CHAR_PROP_EXT, etc. 
This represents the permission of the characteristic or descriptor. 
Variables
Variable 
Description 
The LBTClientClass object. 
The LBTServerClass object. 
Links