API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

IBTCONNECTION

Brew Release
Brew MP 1.0.2
See Also
Description

This interface provides methods to monitor and configure an existing Bluetooth connection.
Applications who register for and receive AEEBT_EV_CONN_UP can create an IBTConnection object for each connection. Applications should release these objects when they receive corresponding AEEBT_EV_CONN_DOWN.
Usage
   To create an IBTConnection object, see the instructions in the class header file.

   To register an event signal:
   1) create pMe->piConnEvSignal
   2) Register: IBTConnection_OnEventNotify (pMe->piBTConn, pMe->piConnEvSignal);

   To retrieve an event:
   BTConnEventType dEv;
   BTResult dR;
   while (IBTConnection_GetEvent (pMe->piBTConn, &dEv, &dR) == AEE_SUCCESS)
   {
      switch (dEv)
      {
         case AEEBTCONN_EV_STATUS_CHANGED:
            if (IBTConnection_GetStatus (pMe->piBTConn, &dWhatsValid, 
                                         &pMe->sConnStat) == AEE_SUCCESS)
            {
               if (dWhatsValid & AEEBT_CONN_STAT_LINK_MODE_B)
               {
                  // make use of new link mode
               }
               // similarly check for other fields of interest
            }
            break;
          // handle other events
      }
   }

   To toggle role switch policy on the connection:
   boolean bSwAllowed = pMe->sConnStat.bRoleSwitchAllowed ? FALSE : TRUE;
   IBTConnection_SetRoleSwitchPolicy (pMe->piBTConn, bSwAllowed);

   To make the local device master of the connection:
   IBTConnection_SetRole (pMe->piBTConn, TRUE);

   To set highest security on the connection:
   IBTConnection_SetMinSecurity (pMe->piBTConn, 
                                 AEEBT_SEC_AUTHENTICATE_AND_ENCRYPT);

   To choose Sniff as the low-power mode for the connection with a 1-second sniff 
   interval and a 5-second idle timeout:
   IBTConnection_SetLowPowerConfig (pMe->piBTConn, AEEBT_LPM_SNIFF, 1000, 5000);

   To release the IBTConnection object:
   IBTConnection_Release (pMe->piBTConn);