The TruConnect device acts as the Peripheral (GATT server) and a BLE mobile device such as a phone or pad acts as the Central (GATT client).

Once Central can connect to many Peripherals, but each Peripheral may connect to only one Central.

The Central can connect to a TruConnect module via BLE, and place it in remote command mode. This allows the full range of control and monitoring available via TruConnect.

You can also place the TruConnect module in STREAM mode, and send and receive streams of data to and from the device.

Introduction to BLE

This section introduces a few terms necessary for later discussion. These terms have a specific meaning in the BLE context.

BLE devices operate in two broad classifications: Central and Peripheral.

Central - A Central typically uses the information served by a Peripheral, like a client in the client/server communication model.

Peripheral - A Peripheral typically supplies data required by other devices, like a server in the client/server communication model.

Peripherals offer Services, which consist of Characteristics. Services and Characteristics are distinguished by universally unique identifiers, or UUIDs.

Service - A collection of data

Characteristic - An item of data within a service

UUID - the universal unique identifier of a service or characteristic. All TruConnect UUIDs are 128 bit (16 octets).

Peripherals advertise, by broadcasting some services and characteristics. This allows them to be discovered by Centrals.

Advertising - Broadcasting by a Peripheral of a subset of the available Services and Characteristics. See Advertising

Discovery - Scanning by a Central for advertising Peripherals and identifying them by their advertised Services and Characteristics.

After discovering a Peripheral of interest, a Central requests a connection to the Peripheral. After connecting, the Central can discover the Peripheral's Services, and within those Services the Peripheral's Characteristics. The Central can read the value of Characteristics, subscribe to the value of Characteristics, and in some cases write the value of the Characteristic back to the Peripheral.

To subscribe to a Characteristic, the BLE mechanism is to register for notification when that Characteristic is changed, and provide a callback to be called on each notification. Typically the callback reads the Characteristic value and takes any action required.

Subscription - Registering for notification when the value of a Characteristic is changed.

Notification - An event such as a change to the value of a Characteristic registered for notification.

Callback - A function or procedure invoked in response to an event, such as a notification.

Connecting to a Peripheral

The general procedure for using a Central to interact with a Peripheral is as follows:

Scan for a TruConnect Device

Accessing and Subscribing to Characteristics of the TruConnect Service

After obtaining the Peripheral's advertising data by scanning, discover the Peripheral's Characteristics and subscribe to the appropriate Characteristics by registering for notification when the value of a Characteristic changes.