Bluetooth Capability Integration Guide
1. Capability Overview
As an SDK integrator, you can use the Bluetooth interfaces encapsulated by the SDK to achieve interconnection with Bluetooth devices. The core capabilities cover three types of scenarios, adapting to different business needs:
| Capability Type | Core Use | Supported Scope |
|---|---|---|
| Bluetooth Low Energy (BLE) | Point-to-point communication with a single BLE device (e.g., smart wearables, sensors, small appliance control) | Central mode (iOS 6.5.6+/Android 6.5.7+), Peripheral mode (base library 2.10.3+) |
| BLE Mesh | Networking of multiple BLE devices for group control / wide-range coverage (e.g., whole-home smart home control) | Requires integrating the official plugin |
| Bluetooth Beacon | Receiving broadcast packets for indoor positioning and message push (no device connection required) | Base library 1.2.0+, depends on system location permission |
2. Core Concepts to Know Before Integration
1. Basic Roles
- Central device / Host: The phone running the app acts as the center, actively scanning/connecting to peripheral Bluetooth devices (the vast majority of scenarios only need to focus on this mode);
- Peripheral device / Slave: A Bluetooth device (such as a sensor or smart light) broadcasts and waits for a connection (a Beacon is a "non-connectable peripheral device");
- Proxy device: Non-BLE Mesh devices (such as a phone) can access the Mesh network through a proxy device to send and receive messages.
2. Key Protocols / Identifiers
- GATT specification: The core of BLE device communication. Data interaction is based on "Service - Characteristic - Descriptor", and reading/writing the value of a Characteristic is the core of communication;
- UUID: The unique ID identifying a Service/Characteristic, supporting 16/32/128 bits (iOS/Android 8.0.9+ directly supports 16/32 bits, while Android below 8.0.9 requires padding to 128 bits);
- Mesh address: The communication identifier of a Mesh device, including unicast (single device), multicast (group), and virtual address (associated with a UUID);
- Beacon identifier: UUID+major+minor, used to distinguish different Beacon devices.
3. Notes on Device ID (deviceId)
- Android: deviceId is the device MAC address, relatively fixed;
- iOS: deviceId is a UUID generated by the system. It may change when Bluetooth restarts or the device is ignored, and the UUID obtained differs across devices, so hardcoding is forbidden.
