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

Developer

API Reference

IBTSDCLIENT

Brew Release
Brew MP 1.0.2
See Also
None.
Description

This interface provides APIs for applications to locate service records that match a specific search pattern, on the remote device. The search pattern consists of a list of Universally Unique Identifiers (UUIDs). The UUIDs may be 16 bit, 32 bit or 128 bit in length.
The application can also request for attribute values of the service records, by specifying a list of attribute IDs it is interested in. It may also specify an attribte ID range.
At any time during the search, the application may call IBTSDClient_CancelSearch() to cancel the search operation.
Usage

Usage example:



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

===== To register signal

// first create the signals; // for example, use ISignalCBFactory_CreateSignal() // then register the signals: IBTSDClient_OnEventNotify (piBTSDCli, piSignal);

===== To Start a service search request

// To search remote device's service DB for all records having // UUID value of 0x0003 (RFCOMM protocol UUID) BTUUID32 uuid = 0x0003; IBTSDClient_StartServiceSearchRequest(piBTSDCli, bdAddr, // Address of the remote device &uuid, // search pattern; list of uuids 1, // single uuid in the list NULL, // no 128 bit uuid 0, // no 128 bit uuid 6); // max number of handles we are interested in // wait for AEEBTSDCLI_EV_SERVICE_SEARCH_COMPLETE event.

===== To Start a service attribute request

// Retrieve attribute values of Attribute IDs 1 to 8 AEEBTSDAttribute attributeID; attributeID.attributeMin = 0x01. attributeID.attributeMax = 0x08; IBTSDClient_StartServiceAttributeRequest(piBTSDCli, bdAddr, // Bluetooth device address of the remote handle, // record handle that was obtained by calling // IBTSDClient_StartServiceSearchRequest. attributeID, // attribute element list specifying a range of IDs. 1); // single attribute element. // wait for AEEBTSDCLI_EV_SERVICE_ATTR_COMPLETE event

===== To Start a service search attribute request

// To search for service records having FTP uuid, and // to retrieve the protocol descriptor list attribute. BTUUID32 uuid = AEEBT_SCU_OBEX_FILE_TRANSFER; AEEBTSDAttribute attributeID; attributeID.attributeMin = 0x04; attributeID.attributeMax = 0x00; IBTSDClient_StartServiceSearchAttributeRequest(piBTSDCli, bdAddr, // Bluetooth device address of the remote &uuid, // uuid list 1, // single element in the list NULL, // no 128 bit uuid 0, // no 128 bit uuid attributeID, // attribute ID list 1); // single attribute ID element. // wait for AEEBTSDCLI_EV_SERVICE_SEARCH_ATTR_COMPLETE event

===== To Cancel a search request

IBTSDClient_CancelSearch(piBTSDCli, bdaddr);

===== To retrieve and handle events when signal is triggered:

while( IBTSDClient_GetEvent(piBTSDCli, &event, &result, &bda) != AEE_ENOMORE ) { switch( event ) { case AEEBTSDCLI_EV_SERVICE_SEARCH_COMPLETE: // if result == success int numHandles; unsigned int aHandles[5]; IBTSDClient_RetrieveServiceSearchResponse(piBTSDCli, &aHandles[0], // list of handles 5, // number if handles in the array &numHandles); // number if handles received break; case AEEBTSDCLI_EV_SERVICE_ATTR_COMPLETE: // if result == success char buf[100]; int lenReq; IBTSDClient_RetrieveServiceAttributeResponse(piBTSDCli, &buf[0], 100, &lenReq); break; case AEEBTSDCLI_EV_SERVICE_SEARCH_ATTR_COMPLETE; IBTSDClient_RetrieveServiceSearchAttributeResponse(piBTSDCli, &buf[0], 100, &lenReq); break; case AEEBTSDCLI_EV_ERROR: case AEEBTSEC_EV_EVENT_Q_OVERFLOW: // Some error occured break; } } ISignalCtl_Enable (piSignalCtl); // re-enable signal ===== When done with IBTSDClient object: IBTSDClient_Release (piBTSecurity);