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


API Reference


Brew Release
Brew MP 1.0.2
See Also

Bluetooth connection factory interface
This interface serves as the factory interface to get IBTConnection1 objects. Whenever a Bluetooth connection is established or disconnected this interface shall notify the registered users. User of the interface can then call GetConnectionObject() API to get the IBTConnection1 interface object associated with that connection.

Usage example:

   ===== To create an IBTConnectionFactory object, see instruction in class header file
   ===== To register signal for the connections status change
   // first create the signals;
   // for example, use ISignalCBFactory_CreateSignal()
   // then register the signals:
   IBTConnectionFactory_OnConnectionsChange (piBTConnFactory, piSignal);
   ===== To get the currently connected device BDAddress when
         the signal is triggered, 
   // Intialize the BD address array with a 7.
   // (Theoritical max ACL connections that can exisit in a Bluetooth piconet)
   int actualLen = 0;
   BDAddress *pBDAddr = NULL;
   IEnv_ErrMalloc (pIEnv, 7* sizeof(BDAddress), (void**)&pBDAddr);// pIEnv is 
                                                                 // ptr to client 
                                                                 // IEnv object

  ISignalCtl_Enable (piSignalCtl); // re-enable signal
   ===== To get a referance to a connection 
   IBTConnection1* pBTConnection;
   BDAddress bdAddr;   
   IBTConnectionFactory_GetConnectionObject (piBTConnFactory,
                                             &bdAddr,    // BD Address of connected device.

   ===== When done with IBTConnectionFactory object:
   IBTConnectionFactory_Release (piBTConnFactory);