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


API Reference


Brew Release
Brew MP 1.0.2
See Also

This interface allows applications to search for Bluetooth devices in the vicinity. Application can choose to filter devices based on Bluetooth device address and/or the class of device. The filter is set via IBTDiscoverer_SetDiscoveryFilter(). Applications can also request for the the name of the remote device by calling IBTDiscoverer_StartRemoteNameReq().
==H2> Usage example:

===== To create an IBTDiscoverer object, see instruction in .bid file

===== To register signal to be notified of an event

// first create the signal; // for example, use ISignalCBFactory_CreateSignal() // then register the signal: IBTDiscoverer_OnEventNotify (piBTDisc, piSignal);

===== To retrieve event

AEEBTDiscovererEvent evt; while (IBTDiscoverer_GetEvent (piBTDisc, &evt) == AEE_SUCCESS) { switch (evt.evtType) { // handle events case AEEBTDISC_EV_DEV_SEARCH_RESPONSE: // display information // if piBTEIR is not NULL, retrieve EIR data elements // like name, service class id list etc. // see instruction in header file for IBTEIR interface // Release piBTEIR, after retrieving EIR data. break; case AEEBTDISC_EV_DEV_SEARCH_DONE: // completed search. break; case AEEBTDISC_EV_NAME_REQ_DONE: { if (evt.result == SUCCESS) { IBTDiscoverer_RetrieveRemoteName(piDisc, name, // buffer to hold the name nameLen, // length of the buffer &nameLenReq); // find out the actual length of buffer // required to hold the name. } } default: break; } } // re-enable signal ISignalCtl_Enable (piDiscEvSignalCtl);

===== To Set discovery filter. Search for all devices whose ===== address ends in 1234 and whose class of service is AEEBT_COS_TELEPHONY

BDAddress bdAddrValue ={{0,0,0,0,0x12,0x34}}; BDAddress bdAddrMask = {{0,0,0,0,0xFF,0xFF}}; BTClassOfDevice CoD2Srch4Value = {AEEBT_COS_TELEPHONY, AEEBT_DC_PHONE, AEEBT_SDC_PHONE_CELLULAR}; BTClassOfDevice CoD2Srch4Mask = {0xFFFF, 0x0, 0x0}; IBTDiscoverer_SetDiscoveryFilter(piDisc, bdAddrValue, bdAddrMask, CoD2Srch4Value, CoD2Srch4Mask);

===== To start device search

IBTDiscoverer_StartDeviceSearch(piDisc, 10, // search for a max of 10 devices 30, // search should last a max of 30 seconds AEEBTDISC_DISCOVERY_TYPE_GENERAL, TRUE, // if the remote responds with EIR data, send it to app. TRUE); // interested in device ranking

===== To cancel a search that is in progress

// Application found the device it was looking for. // Does not want to find any more devices IBTDiscoverer_CancelDeviceSearch(piBTDisc);

===== To start name request procedure


===== To cancel name request procedure