PMSIS BSP
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
BLE

Content

 NINA_B112
 
 NINA_B112_OLD
 Deprecated.
 

Data Structures

struct  pi_ble_api_t
 BLE specific API. More...
 

Functions

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...
 

Description

The BLE driver provides support for wireless data transfer between the host and an external peripheral such as a smartphone, using Bluetooth connection.

Function Documentation

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
devicePointer to the BLE device structure.
cmdCommand string to send.
respBuffer to store response.
sizeSize of the response to store, in Bytes.
Return values
0If operation is successful.
ERRNOError 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
devicePointer 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
devicePointer to the BLE structure.
bufferBuffer to store data.
sizeSize 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
devicePointer to the BLE structure.
bufferBuffer to store data.
sizeSize of data.
taskEvent 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
devicePointer to the BLE structure.
bufferBuffer to send.
sizeSize 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
devicePointer to the BLE structure.
bufferBuffer to send.
sizeSize of data to send.
taskEvent 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
devicePointer to the BLE device structure.
cmdIoctl command.
argIoctl 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
devicePointer to the BLE device structure.
Return values
0If the operation is successful.
ERRNOError 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
devicePointer to the BLE device structure.
addrAddress in string format.
Return values
0If operation is successful.
ERRNOError code otherwise.
int32_t pi_ble_peer_disconnect ( struct pi_device *  device,
const char *  addr 
)

This function closes an existing peer connection.

Parameters
devicePointer to the BLE device structure.
addrAddress in string format.
Return values
0If operation is successful.
ERRNOError code otherwise.