# communication_bluetooth **Repository Path**: ximeibaba/communication_bluetooth ## Basic Information - **Project Name**: communication_bluetooth - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 518 - **Created**: 2021-04-27 - **Last Updated**: 2021-04-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 蓝牙组件 - [简介](#section11660541593) - [目录](#section161941989596) - [约束](#section119744591305) - [说明](#section1312121216216) - [使用说明](#section129654513264) - [相关仓](#section1371113476307) ## 简介 蓝牙服务组件为设备提供接入与使用Bluetooth的相关接口,包括BLE设备gatt相关的操作,以及BLE广播、扫描等功能。 ## 目录 ``` /foundation/communication/bluetooth ├── interfaces # 对外接口存放目录 ├── LICENSE # 版权声明文件 ``` ## 约束 蓝牙服务组件使用C语言编写。 ## 说明 现在提供的是BLE相关接口,其它A2DP,AVRCP,HFP等相关接口在后续增量发布。 ### 使用说明 - 设备需要完成以下接口的开发步骤,以使能Gatt server功能并开启服务: ``` /* 初始化蓝牙协议栈 */ int InitBtStack(void); int EnableBtStack(void); /* 注册应用,appUuid由应用提供 */ int BleGattsRegister(BtUuid appUuid); /* 添加服务 */ int BleGattsAddService(int serverId, BtUuid srvcUuid, bool isPrimary, int number); /* 添加特征值 */ int BleGattsAddCharacteristic(int serverId, int srvcHandle, BtUuid characUuid, int properties, int permissions); /* 添加描述符 */ int BleGattsAddDescriptor(int serverId, int srvcHandle, BtUuid descUuid, int permissions); /* 开始服务 */ int BleGattsStartService(int serverId, int srvcHandle); ``` - 设备需要完成以下接口的开发步骤,以使能BLE广播的发送: ``` /* 设置广播数据 */ int BleSetAdvData(int advId, const BleConfigAdvData *data); /* 开始发送广播 */ int BleStartAdv(int advId, const BleAdvParams *param); ``` - 若需要扫描功能,设备需要完成以下接口的开发步骤,以使能BLE扫描功能: ``` /* 设置扫描参数 */ int BleSetScanParameters(int clientId, BleScanParams *param); /* 开始扫描 */ int BleStartScan(void); ``` ## 相关仓 communication\_bluetooth