Drivers Libraries Help > BM71 Bluetooth Driver Library > Using the Library > How the Library Works
MPLAB Harmony Bluetooth Help
How the Library Works

The library provides interfaces to support:

  • System
  • Client Setup
  • Data Transfer
  • Settings
  • Bluetooth
  • Device Name and Address
  • BLE

The library can be used by programs providing functionality for BLE. 

BLE-only applications are much simpler since they do not have to process any audio. Again typically there will be one simple state machine for the application and a second state machine just for the BLE functionality. After the application initializes, the BLE state machine will open the BM71 Bluetooth driver using a call to its Open function, then it will set up a callback for an event handler. 

The application will call one of the BLE Send functions to send data to the host (smartphone). The event handler will be called whenever data has been received from the BM71, or when the connection status changes. See the BM71 demonstration application, ble_comm, for more information and example code.

        case BLE_STATE_OPEN:
        {
            if (SYS_STATUS_READY == DRV_BT_Status())
            {
                // open BT module
                bleData.bt.handle = DRV_BT_Open(DRV_IO_INTENT_READ, DRV_BT_PROTOCOL_BLE);

                if(bleData.bt.handle != DRV_HANDLE_INVALID)
                {
                        bleData.state = BLE_STATE_SET_BT_EVENT_HANDLER;
                }
                else
                {
                    /* Got an Invalid Handle.  Wait for BT module to Initialize */;
                }
            }
        }
        break;
        case BLE_STATE_SET_BT_EVENT_HANDLER:
        {
            DRV_BT_EventHandlerSet(bleData.bt.handle,
                                          bleData.bt.eventHandler,
                                          (uintptr_t)0);

            bleData.state = BLE_STATE_INIT_DONE;
        }
        break; 
Topics
Name 
Description 
This section describes the BM71 Bluetooth driver functions for initialization, maintaining task state and returning status. 
This section describes the BM71 Bluetooth driver functions for client setup (open, close, and setting up event handlers). 
This section describes the functions specific to Bluetooth Low Energy (BLE) operations, such as sending and receiving data, and BLE connection-related operations.