Wio Terminal 蓝牙 BLE 服务器
本示例将 Wio terminal 作为 BLE 服务器,连接其他 BLE 设备(可以是另一个 Wio Terminal),并通过蓝牙接收来自客户端的请求。
功能实现
首先,我们可以为该 BLE 设备设置一个名称,如下:
BLEDevice::init("Wio Terminal");
You need to define the UUID for the server device on the Wio terminal.
接着,我们 需要定义该 BLE 服务器上的服务、特征、描述符等 UUID:
#define SERVICE_UUID "180f"
#define CHARACTERISTIC_UUID "2a19"
#define DESCRIPTOR_UUID "4545"
然后创建一个 BLE 服务器:
BLEServer *pServer = BLEDevice::createServer();
通过指定服务 UUID 创建 BLE 服务:
BLEService *pService = pServer->createService(SERVICE_UUID);