Drivers Libraries Help > BM64 Bluetooth Driver Library > Library Interface > b) Client Setup Functions > DRV_BM64_Open Function
MPLAB Harmony Bluetooth Help
DRV_BM64_Open Function

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

Description

Function DRV_BM64_Open: 

DRV_HANDLE DRV_BM64_Open(const DRV_IO_INTENT ioIntent, const DRV_BM64_PROTOCOL protocol); 

This routine opens the specified BM64 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 BM64 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_BM64_Initialize must have been called to initialize the driver instance.

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

valid handle to an opened BM64 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_BM64) 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_BM64_Open(
    const DRV_IO_INTENT ioIntent, 
    const DRV_BM64_PROTOCOL protocol
);