The Bluetooth module provides APIs for accessing and using Bluetooth services, such as APIs for Generic Attribute Profile (GATT) operations, Bluetooth Low Energy (BLE) advertising, and scan.
/foundation/communication/bluetooth
├── interfaces # API code
│ └── innerkits # System service APIs
│ ├── native_c # C APIs
│ │ └── include # Header files for C APIs
│ └── native_cpp # C++ APIs
├── sa_profile # Service ability profile
└── services # Bluetooth service code
└── LICENSE # License declaration file
The Bluetooth module must be compiled in C language.
Only BLE-related APIs and basic Bluetooth Generic Access Profile (GAP) APIs are provided.
The C API definition as well as the service and protocol stack code are provided for the standard system. Currently, only the BLE-related APIs, including the APIs for GATT operations on BLE devices, BLE advertising, and scan, are provided. Other APIs, such as APIs related to A2DP, AVRCP, and HFP, will be gradually provided later.
The directories for the standard system are as follows:
Only C APIs for BLE, such as APIs for GATT operations, BLE advertising, and scan, are provided for the mini and small systems. Other APIs, such as APIs related to A2DP, AVRCP, and HFP, will be gradually provided later.
The directory for the mini or standard system is as follows:
interfaces/innerkits/native_c/include
/* Enable classic Bluetooth.*/
bool EnableBt(void);
/* Disable classic Bluetooth. */
bool DisableBt(void);
/* Enable BLE. */
bool EnableBle(void);
/* Disable BLE. */
bool DisableBle(void);
/* Obtain the classic Bluetooth status. */
int GetBtState();
/* Check whether BLE is enabled. */
bool IsBleEnabled();
/* Obtain the MAC address. */
bool GetLocalAddr(unsigned char *mac, unsigned int len);
/* Set the name of the local device.*/
bool SetLocalName(unsigned char *localName, unsigned char length);
/* Initialize the Bluetooth protocol stack. */
int InitBtStack(void);
int EnableBtStack(void);
/* Register an application with a specified appUuid. */
int BleGattsRegister(BtUuid appUuid);
/* Add a service. */
int BleGattsAddService(int serverId, BtUuid srvcUuid, bool isPrimary, int number);
/* Add a characteristic. */
int BleGattsAddCharacteristic(int serverId, int srvcHandle, BtUuid characUuid, int properties, int permissions);
/* Add a descriptor. */
int BleGattsAddDescriptor(int serverId, int srvcHandle, BtUuid descUuid, int permissions);
/* Start the GATT service. */
int BleGattsStartService(int serverId, int srvcHandle);
/* Set the data to advertise. */
int BleSetAdvData(int advId, const BleConfigAdvData *data);
/* Start advertising. */
int BleStartAdv(int advId, const BleAdvParams *param);
/* Set scan parameters. */
int BleSetScanParameters(int clientId, BleScanParams *param);
/* Start a scan. */
int BleStartScan(void);
communication_bluetooth
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.