Drivers Libraries Help > BM71 Bluetooth Driver Library > Library Interface > a) System Functions > DRV_BM71_Open Function
MPLAB Harmony Bluetooth Help
DRV_BM71_Open Function

Open the specified BM71 driver instance and returns a handle to it

Description

Function DRV_BM71_Open: 

DRV_HANDLE DRV_BM71_Open(const DRV_IO_INTENT ioIntent, const DRV_BM71_PROTOCOL protocol); 

This routine opens the specified BM71 Bluetooth driver instance and provides a handle that must be provided to all other client-level operations to identify the caller and the instance of the driver. The ioIntent parameter defines how the client interacts with this driver instance. 

Only DRV_IO_INTENT_READ is a valid ioIntent option as the BM71 Bluetooth driver audio stream is read-only. 

Specifying a DRV_IO_INTENT_EXCLUSIVE will cause the driver to provide exclusive access to this client. The driver cannot be opened by any other client.

Preconditions

DRV_BM71_Initialize must have been called to initialize the driver instance.

Parameters
Parameters 
Description 
ioIntent 
valid handle to an opened BM71 device driver unique to client 
protocol 
specifies which protocol(s) the client intends to use with this driver. One of the various DRV_BM71_PROTOCOL enum values, including DRV_BM71_PROTOCOL_ALL. 
Returns

valid handle to an opened BM71 device driver unique to client

Example
case APP_STATE_OPEN:
{
    if (SYS_STATUS_READY == DRV_BT_Status())
    { 
        // open BT module, including RX audio stream
        // note generic version of call (DRV_BT instead of DRV_BM71) is used
        appData.bt.handle = DRV_BT_Open(DRV_IO_INTENT_READ, DRV_BT_PROTOCOL_ALL);

        if(appData.bt.handle != DRV_HANDLE_INVALID)
        {
            appData.state = APP_STATE_SET_BT_BUFFER_HANDLER;
        }
        else
        {
            // Got an Invalid Handle.  Wait for BT module to Initialize
        }
    }
}
break;
C
DRV_HANDLE DRV_BM71_Open(
    const DRV_IO_INTENT ioIntent, 
    const DRV_BM71_PROTOCOL protocol
);