CBTEngDiscovery Class Reference
class CBTEngDiscovery : public CBase |
Class CBTEngDiscovery
This is a helper class that simplifies the usage of Symbian's BluetoothT SDP interface, for registration of SDP records in the local database and for queries of remote SDP databases. Additionally, functionality for searching for and pairing with remote Bluetooth devices.
btengdiscovery.lib
- Since
- S60 v3.2
Public Member Functions |
---|
| ~CBTEngDiscovery() |
IMPORT_C void | CancelGetEirServiceUUIDs() |
IMPORT_C void | CancelRemoteSdpQuery() |
IMPORT_C void | CancelSearchRemoteDevice() |
IMPORT_C void | CloseRemoteSdpConnection() |
IMPORT_C TInt | DeleteSdpRecord(const TSdpServRecordHandle) |
IMPORT_C TInt | GetEirServiceUUIDs(const TBTDevAddr &, TNameEntry *) |
IMPORT_C CBTEngDiscovery * | NewL(MBTEngSdpResultReceiver *) |
IMPORT_C CBTEngDiscovery * | NewLC(MBTEngSdpResultReceiver *) |
IMPORT_C TInt | ParseNextSdpAttrValueType(RSdpResultArray &, TInt, TSdpElementType &) |
IMPORT_C TInt | ParseRfcommChannel(RSdpResultArray &, TInt &) |
IMPORT_C TInt | RegisterSdpRecord(const TUUID &, const TUint, TSdpServRecordHandle &) |
IMPORT_C TInt | RemoteProtocolChannelQuery(const TBTDevAddr &, const TUUID &) |
IMPORT_C TInt | RemoteSdpQuery(const TBTDevAddr &, const TUUID &) |
IMPORT_C TInt | RemoteSdpQuery(const TBTDevAddr &, const TSdpServRecordHandle, const TSdpAttributeID) |
IMPORT_C TInt | RemoteSdpQuery(const TBTDevAddr &, const TUUID &, const TSdpAttributeID) |
IMPORT_C TInt | SearchRemoteDevice(CBTDevice *, TUint) |
IMPORT_C TInt | SearchRemoteDevice(CBTDevice *, TNameEntry *, TUint) |
IMPORT_C void | SetNotifier(MBTEngSdpResultReceiver *) |
Constructor & Destructor Documentation
CBTEngDiscovery(MBTEngSdpResultReceiver *)
~CBTEngDiscovery()
~CBTEngDiscovery | ( | ) | [virtual] |
Member Functions Documentation
CancelGetEirServiceUUIDs()
IMPORT_C void | CancelGetEirServiceUUIDs | ( | ) | |
Cancels an ongoing device service UUIDs retrieval.
CancelRemoteSdpQuery()
IMPORT_C void | CancelRemoteSdpQuery | ( | ) | |
Cancels an ongoing SDP query.
CancelSearchRemoteDevice()
IMPORT_C void | CancelSearchRemoteDevice | ( | ) | |
CheckSdpDbHandler()
TInt
| CheckSdpDbHandler | ( | ) | [private] |
Helper function to check that a valid session with the local SDP database exists.
CheckSdpQueryHandler()
TInt
| CheckSdpQueryHandler | ( | ) | [private] |
Helper function to check that a valid handler of remote SDP queries exists.
CloseRemoteSdpConnection()
IMPORT_C void | CloseRemoteSdpConnection | ( | ) | |
Closes a remote SDP connection. The method should be called after RemoteSdpQuery and RemoteProtocolChannelQuery methods are completed and the CBTEngDiscovery obejct is still kept alive.
ConstructL()
void | ConstructL | ( | ) | [private] |
Symbian 2nd-phase constructor
DeleteSdpRecord(const TSdpServRecordHandle)
Deletes a service record from the local SDP database that was previously registered by through this instance of CBTEngDiscovery.
Parameters
const TSdpServRecordHandle aHandle | Handle to the SDP record to be deleted. Note that this has to be a valid (existing) SDP record. |
GetEirServiceUUIDs(const TBTDevAddr &, TNameEntry *)
Retieves the information about the service UUIDs in the EIR data of a device specified by a BD address.
The EIR data got through this API is cached data and depends on a previous inquiry that has taken place. Moreover, a lagecy device (pre BT v2.1) doesn't have EIR data at all. Thus to ensure wether a device supports a service or not at present, SDP query would still be the most reliable approach.
When completed, the information are passed back to the client through the callback interface method MBTEngSdpResultReceiver::GetEirServiceUUIDsComplete().
Parameters
const TBTDevAddr & aAddr | The BD address of the device. |
TNameEntry * aNameEntry | The data structure in which the EIR data of the selected device will be stored (passed back thorugh DeviceSearchComplete()). TBluetoothNameRecordWrapper can be constructed from a TNameRecord instance for the purpose of parsing and getting Extended Inquiry Response tags. Ownership of the data structure remains with the caller of this method. |
NewL(MBTEngSdpResultReceiver *)
NewLC(MBTEngSdpResultReceiver *)
ParseNextSdpAttrValueType(RSdpResultArray &, TInt, TSdpElementType &)
Static helper function to return the SDP element type of an indexed element in a list (DES or DEA).
Parameters
RSdpResultArray & aResultArray | The array containing the SDP attribute. |
TInt aIndex | The position of the element to be parsed, relative to zero (i.e. zero is the first element). |
TSdpElementType & aType | On return, contains the element type of the element at position aIndex. |
ParseRfcommChannel(RSdpResultArray &, TInt &)
Static helper function to return the protocol channel number from the result array of a ServiceAttributeSearch. This value can be used to obtain e.g. the remote RFCOMM channel after a RemoteProtocolChannelQuery has completed.
RegisterSdpRecord(const TUUID &, const TUint, TSdpServRecordHandle &)
Registers an service record in the local SDP database, based on a known service as defined in Bluetooth Engine resource file. The instance of CBTEngDiscovery must be kept alive as long as the service record is needed to be stored (deletion of CBTEngDiscovery will remove all the records stored during the same session).
Parameters
const TUUID & aService | UUID of the service to be registered. |
const TUint aChannel | The value of the channel of the ProtocolDescriptorList attribute (e.g. the RFCOMM channel), if applicable. |
TSdpServRecordHandle & aHandle | On return, contains the service record handle identifying the created service record. |
RemoteProtocolChannelQuery(const TBTDevAddr &, const TUUID &)
Starts an SDP query. The remote SDP database is searched for the value of the ProtocolDescriptorList attribute in a service record containing the specified UUID, the equivalent of an SDP ServiceAttributeSearch transaction with ProtocolDescriptorList as attribute. This can e.g. be used to search the remote RFCOMM channel. When completed, the results are passed back to the client through the callback interface method MBTEngSdpResultReceiver::AttributeSearchComplete().
Parameters
const TBTDevAddr & aAddr | Target Bluetooth device address for the SDP query. |
const TUUID & aService | The UUID to search for. |
RemoteSdpQuery(const TBTDevAddr &, const TUUID &)
Starts an SDP query. The remote SDP database is searched for service records containing the specified UUID, the equivalent of an SDP ServiceSearch transaction. When completed, record handles for all matching service records are passed back to the client through the callback interface method MBTEngSdpResultReceiver::ServiceSearchComplete().
Parameters
const TBTDevAddr & aAddr | Target Bluetooth device address for the SDP query. |
const TUUID & aService | The UUID to search for. |
RemoteSdpQuery(const TBTDevAddr &, const TSdpServRecordHandle, const TSdpAttributeID)
Starts an SDP query. A specific service record on the remote SDP database is queried for the value of a specified attribute, the equivalent of an SDP ServiceAttribute transaction. When completed, the result is passed back to the client through the callback interface method MBTEngSdpResultReceiver::AttributeSearchComplete().
Parameters
const TBTDevAddr & aAddr | Target Bluetooth device address for the SDP query. |
const TSdpServRecordHandle aHandle | The service record handle identifying the service record to search the attribute from. |
const TSdpAttributeID aAttrId | The service attribute to search for. |
RemoteSdpQuery(const TBTDevAddr &, const TUUID &, const TSdpAttributeID)
Starts an SDP query. The remote SDP database is searched for the value of a specified attribute in a service record containing the specified UUID, the equivalent of an SDP ServiceAttributeSearch transaction. When completed, the results are passed back to the client through the callback interface method MBTEngSdpResultReceiver::ServiceAttributeSearchComplete().
Parameters
const TBTDevAddr & aAddr | Target Bluetooth device address for the SDP query. |
const TUUID & aService | The UUID to search for. |
const TSdpAttributeID aAttrId | The service attribute to search for. |
SearchRemoteDevice(CBTDevice *, TUint)
Launches to notifier for discovering nearby Bluetooth devices and user selection of one device. When completed, the selected device is passed back to the client through the callback interface method MBTEngSdpResultReceiver::DeviceSearchComplete().
Parameters
CBTDevice * aDevice | The data structure in which the result will be stored (passed back thorugh DeviceSearchComplete()). Ownership of the data structure remains with the caller of this method. |
TUint aServiceClass = 0 | Filter for device search; this will filter the results according to the specified major service class field of the CoD. The default value is zero and will not apply any filter. |
SearchRemoteDevice(CBTDevice *, TNameEntry *, TUint)
Launches to notifier for discovering nearby Bluetooth devices and user selection of one device. Additionally, this method returns service UUIDs in the EIR data of the selected device. When completed, the selected device and its serivice UUID list are passed back to the client through the callback interface method MBTEngSdpResultReceiver::DeviceSearchComplete().
Parameters
CBTDevice * aDevice | The data structure in which the result will be stored (passed back thorugh DeviceSearchComplete()). Ownership of the data structure remains with the caller of this method. |
TNameEntry * aNameEntry | The data structure in which the EIR data of the selected device will be stored (passed back thorugh DeviceSearchComplete()). TBluetoothNameRecordWrapper can be constructed from a TNameRecord instance for the purpose of parsing and getting Extended Inquiry Response tags. Ownership of the data structure remains with the caller of this method. |
TUint aServiceClass = 0 | Filter for device search; this will filter the results according to the specified major service class field of the CoD. The default value is zero and will not apply any filter. |
SetNotifier(MBTEngSdpResultReceiver *)
Sets the callback class for receiving SDP query results. This will replace the current callback interface used to pass back the SDP query results.
Member Data Documentation
CBTEngDeviceSearch * iDevSearchHandler
Reference to handler of remote device searches. Own.
MBTEngSdpResultReceiver * iResultNotifier
Reference to receiver of results. Not own.
CBTEngSdpDbHandler * iSdpDbHandler
Reference to SDP DB handler. Own.
CBTEngSdpQuery * iSdpQueryHandler
Reference to handler of remote SDP queries. Own.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.