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


API Reference


Brew Release
Brew MP 1.0.2
See Also

This interface provides methods to control the underlying Bluetooth driver. User of this interface must have system privilege.

Usage example:

   ===== To create an IBTMgr object, see instruction in class header file

   ===== To register Event signal
   // first, create pMe->piMgrEvSignal, then register:
   IBTMgr_OnEventNotify (pMe->piBTMgr, pMe->piMgrEvSignal);

   ===== To retrieve event:
   BTResult dResult;
   while (IBTMgr_GetEvent (pMe->piBTMgr, &dEvent, &dResult) == AEE_SUCCESS)
      switch (dEvent)
         // handle events
   ISignalCtl_Enable (pMe->piMgrEvSignalCtl); // re-enable signal

   ===== To retrieve the current state of local device radio:
   IBTMgr_GetRadioState (pMe->piBTMgr, &pdRadioState);

   ===== To retrieve the current settings of local device:
   BTLocalSettingBitmap    dWhatsValid;
   BTLocalSettings         localSetting;
   IBTMgr_GetLocalSettings (pMe->piBTMgr, &dWhatsValid, &localSetting);

   ===== To set Bluetooth name for local device:
   uint8 myBTName[] = "RedTooth";
   IBTMgr_SetName (pMe->piBTMgr, myBTName);

   ===== To set class of device for your phone:
   BTClassOfDevice myCoD = {
   IBTMgr_SetCoD (pMe->piBTMgr, myCoD);

   ===== To set prefer connection role for local device to MASTER:
   IBTMgr_SetPrefConnRole (pMe->piBTMgr, TRUE);

   ===== To allow role switch request from remote devices:
   IBTMgr_SetRoleSwitchPolicy (pMe->piBTMgr, TRUE);

   ===== To set minimum security level in all future connections 
   ===== regardless of services:
   IBTMgr_SetSecurity (pMe->piBTMgr, AEEBT_SEC_AUTHENTICATE);

   ===== To supply underlying Bluetooth driver with a list of devices
   ===== whose connection requests should be automatically rejected:
   IBTMgr_SetBlockedDevList (pMe->piBTMgr, nNumBadGuys, &badGuysAddrList);

   ===== To register for connection request:
   // first, create pMe->piMgrConnSignal, then register:
   IBTMgr_OnConnRequest (pMe->piBTMgr, pMe->piMgrConnSignal);

   ===== To protect local device when providing Dial-Up Networking
   ===== and Serial Port Profile services:
   BTServiceIdentifier  svc2protect;
   svc2protect.dIDMethod  = AEEBT_SEC_BY_SERVICE_CLASS;
   svc2protect.nNumItems  = 2;
   svc2protect.dSvcCls[0] = AEEBT_SCU_DIALUP_NETWORKING;
   svc2protect.dSvcCls[1] = AEEBT_SCU_SERIAL_PORT;

   ===== To get connection request information:
   boolean bAccept = FALSE;
   BTServiceIdentifier  requestedSvc;
   IBTMgr_GetConnRequest (pMe->piBTMgr, &remoteDev, &requestedSvc);
   if (MyBlockedDeviceCheck (remoteDev) == FALSE)
      // show user " is connecting to use . Allow?"
      // set bAccept to user's response
   IBTMgr_AuthorizeConnReq (pMe->piBTMgr, &remoteDev, &requestedSvc, bAccept);
   ISignalCtl_Enable (pMe->piMgrConnSignalCtl); // re-enable signal

   ===== To tune scan performance:
   IBTMgr_TuneScanPerformance (
     AEEBT_AVP_SMALLEST_ACT_MOST_POWER, // faster connection
     AEEBT_AVP_AUTOMATIC); // let Bluetooth driver decide on inquiry scan perf