mirror of
https://github.com/openharmony/drivers_peripheral.git
synced 2026-08-24 07:45:51 -04:00
e6ee5a3f47
Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: w00604589 <wanghan76@huawei.com>
NearLink
Introduction
The NearLink driver module provides APIs for accessing and using the NearLink short-range communication protocol, including DLI initialization, data sending and receiving, and closing the NearLink DLI.
Directory Structure
/foundation/drivers/peripheral/nearlink
├── bundle.json # Component description and dependency configuration
├── drivers_peripheral_nearlink.gni # Build feature parameter configuration
├── dli # DLI module
│ └── test # DLI test cases
└── LICENSE # Copyright statement
└── bundle.json # Component description file
Constraints
The NearLink driver module is written in C++ and based on the DLI framework. It supports the standard system only.
Usage
NearLink DLI APIs are provided. The DLI APIs include initialization, sending and receiving DLI packets, and close.
DLI APIs
- Initialize the NearLink HAL:
/* Initialize the NearLink HAL and register the callback. */
int32_t SleHalInit(const sptr<ISleHciCallback>& callbackObj);
- Send a packet:
/* Send a packet to the chip. */
int32_t SleSendHciPacket(const std::vector<uint8_t>& data);
- Receive a packet:
/* Receive a packet from the chip. */
int32_t hciPacketReceived(uint32_t type, const std::vector<uint8_t> &data);
- Close the NearLink DLI:
/* Close the NearLink DLI and release resources. */
int32_t Close();
Repositories Involved
drivers_peripheral_nearlink