|
int32_t | pi_ble_open (struct pi_device *device) |
| Open a BLE device. More...
|
|
void | pi_ble_close (struct pi_device *device) |
| Close a BLE device. More...
|
|
int32_t | pi_ble_ioctl (struct pi_device *device, uint32_t cmd, void *arg) |
| IOctl commands. More...
|
|
int32_t | pi_ble_at_cmd (struct pi_device *device, const char *cmd, char *resp, uint32_t size) |
| Send AT command to BLE device. More...
|
|
int32_t | pi_ble_peer_connect (struct pi_device *device, const char *addr) |
| Connect to a peer. More...
|
|
int32_t | pi_ble_peer_disconnect (struct pi_device *device, const char *addr) |
| Close a connection to a peer. More...
|
|
void | pi_ble_data_send (struct pi_device *device, uint8_t *buffer, uint32_t size) |
| Send data to BLE device. Blocking API. More...
|
|
void | pi_ble_data_send_async (struct pi_device *device, uint8_t *buffer, uint32_t size, pi_task_t *task) |
| Send data to BLE device. Blocking API. More...
|
|
void | pi_ble_data_get (struct pi_device *device, uint8_t *buffer, uint32_t size) |
| Get data from BLE device. Blocking API. More...
|
|
void | pi_ble_data_get_async (struct pi_device *device, uint8_t *buffer, uint32_t size, pi_task_t *task) |
| Get data from BLE device. Non blocking API. More...
|
|
The BLE driver provides support for wireless data transfer between the host and an external peripheral such as a smartphone, using Bluetooth connection.
int32_t pi_ble_at_cmd |
( |
struct pi_device * |
device, |
|
|
const char * |
cmd, |
|
|
char * |
resp, |
|
|
uint32_t |
size |
|
) |
| |
This function is used to send AT commands to BLE device.
- Parameters
-
device | Pointer to the BLE device structure. |
cmd | Command string to send. |
resp | Buffer to store response. |
size | Size of the response to store, in Bytes. |
- Return values
-
0 | If operation is successful. |
ERRNO | Error code otherwise. |
- Note
- The command string should be plain command, i.e. without the "AT" part.
-
The command may or may not return a response.
void pi_ble_close |
( |
struct pi_device * |
device | ) |
|
This function closes an opened BLE device. It frees all allocated objects and interfaces used.
- Parameters
-
device | Pointer to the BLE device structure. |
void pi_ble_data_get |
( |
struct pi_device * |
device, |
|
|
uint8_t * |
buffer, |
|
|
uint32_t |
size |
|
) |
| |
This function is used to retrieve data from BLE device.
- Parameters
-
device | Pointer to the BLE structure. |
buffer | Buffer to store data. |
size | Size of data. |
- Note
- This function is synchronous, caller is blocked until transfer is finished. The pending asynchronous function is below : pi_ble_data_get_async().
void pi_ble_data_get_async |
( |
struct pi_device * |
device, |
|
|
uint8_t * |
buffer, |
|
|
uint32_t |
size, |
|
|
pi_task_t * |
task |
|
) |
| |
This function is used to retrieve data from BLE device.
- Parameters
-
device | Pointer to the BLE structure. |
buffer | Buffer to store data. |
size | Size of data. |
task | Event task used to check end of transfer. |
- Note
- This function is asynchronous. The pending synchronous function is : pi_ble_data_get().
void pi_ble_data_send |
( |
struct pi_device * |
device, |
|
|
uint8_t * |
buffer, |
|
|
uint32_t |
size |
|
) |
| |
This function is used to send data to BLE device.
- Parameters
-
device | Pointer to the BLE structure. |
buffer | Buffer to send. |
size | Size of data to send. |
- Note
- This function is synchronous, caller is blocked until transfer is finished. The pending asynchronous function is below : pi_ble_data_send_async().
void pi_ble_data_send_async |
( |
struct pi_device * |
device, |
|
|
uint8_t * |
buffer, |
|
|
uint32_t |
size, |
|
|
pi_task_t * |
task |
|
) |
| |
This function is used to send data to BLE device.
- Parameters
-
device | Pointer to the BLE structure. |
buffer | Buffer to send. |
size | Size of data to send. |
task | Event task used to check end of transfer. |
- Note
- This function is asynchronous. The pending synchronous function is : pi_ble_data_send().
int32_t pi_ble_ioctl |
( |
struct pi_device * |
device, |
|
|
uint32_t |
cmd, |
|
|
void * |
arg |
|
) |
| |
This function is used to send special command to BLE device.
- Parameters
-
device | Pointer to the BLE device structure. |
cmd | Ioctl command. |
arg | Ioctl command arg. |
- Returns
- Value Value depends on ioctl command.
int32_t pi_ble_open |
( |
struct pi_device * |
device | ) |
|
This function opens and intializes a BLE device. This function must be called before using device.
- Parameters
-
device | Pointer to the BLE device structure. |
- Return values
-
0 | If the operation is successful. |
ERRNO | Error code otherwise. |
int32_t pi_ble_peer_connect |
( |
struct pi_device * |
device, |
|
|
const char * |
addr |
|
) |
| |
This function should be used to connect to a remote peer.
- Parameters
-
device | Pointer to the BLE device structure. |
addr | Address in string format. |
- Return values
-
0 | If operation is successful. |
ERRNO | Error code otherwise. |
int32_t pi_ble_peer_disconnect |
( |
struct pi_device * |
device, |
|
|
const char * |
addr |
|
) |
| |
This function closes an existing peer connection.
- Parameters
-
device | Pointer to the BLE device structure. |
addr | Address in string format. |
- Return values
-
0 | If operation is successful. |
ERRNO | Error code otherwise. |