📄 bluetoothservicesearcher.h.svn-base
字号:
/*
============================================================================================
Name : BluetoothServiceSearcher.h
Author : BluetoothAPI is a initiative of Embedded LAB - http://www.embedded.ufcg.edu.br/
OpenC/SymbianC++ - http://efforts.embedded.ufcg.edu.br/symbiancpp
Version :
Copyright : This file is part of BluetoothAPI.
Bluetooth is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BluetoothAPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with BluetoothAPI. If not, see <http://www.gnu.org/licenses/>.
Description : BluetoothServiceSearcher.h implementation
===========================================================================================
*/
#ifndef BLUETOOTHSERVICESEARCHER_H
#define BLUETOOTHSERVICESEARCHER_H
// INCLUDES
#include <e32base.h>
#include <bttypes.h>
#include <bt_sock.h>
#include <btsdp.h>
/**
* MBluetoothServiceSearcherObserver
* Interface for notifying service search events
*/
class MBluetoothServiceSearcherObserver
{
public:
/**
* Callback to notify the caller the completion of the service search.
* @param aPort On succesfull return the RFCOMM's port to use
* @param aError KErrNone if succesfull, otherwise one of the system errors
*/
virtual void OnServiceSearchComplete(TInt aPort, TInt aError)=0;
};
// CLASS DECLARATION
/**
* CBluetoothServiceSearcher
* Search for the presence of a specific BT service on a remote BT device
*/
class CBluetoothServiceSearcher : public CBase, public MSdpAgentNotifier, public MSdpAttributeValueVisitor
{
public:
/**
* Constructor
* @param aObs Interface to report to the caller the service search status
*/
CBluetoothServiceSearcher(MBluetoothServiceSearcherObserver* aObs);
/**
* Destructor
*/
~CBluetoothServiceSearcher();
/**
* Retrives from a remote device a SDP's service record. On completion call NextRecordRequestComplete()
* @param aTarget The remote BT device address
* @param aUUID The BT's service UUID (RPS's service UUID)
*/
void FindServiceByUUIDL(const TBTDevAddr& aTarget,const TUUID& aUUID);
private:
// from MSdpAgentNotifier
/**
* Called when a service record request (CSdpAgent::NextRecordRequestComplete()) operation completes
* @param aError KErrNone if successful; KErrEof if there are no more SDP records left to be read; or an SDP error
* @param aHandle Service record for which the query was made
* @param aTotalRecordsCount Total number of matching records
*/
virtual void NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount);
/**
* Called when an attribute request (CSdpAgent::AttributeRequestL()) wants to pass up a result
* @param aHandle Service record for which the query was made
* @param aAttrID ID of the attribute obtained
* @param aAttrValue Attribute value obtained
*/
virtual void AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue);
/**
* Called when an attribute request (CSdpAgent::AttributeRequestL()) wants to signal the completion of an attribute request
* @param aHandle Service record for which the query was made
* @param aError An error
*/
virtual void AttributeRequestComplete(TSdpServRecordHandle aHandle, TInt aError);
//From MSdpAttributeValueVisitor
/**
* Called to pass an attribute value
* @param aValue Attribute value
* @param aType Value type
*/
void VisitAttributeValueL(CSdpAttrValue& aValue, TSdpElementType aType);
/**
* Called to indicate the start of a list of attribute values
* @param aList Attribute value list
*/
void StartListL(CSdpAttrValueList& aList);
/**
* Called to indicate the end of a list of attribute values
*/
void EndListL();
private:
/**
* A reference to the Service Searcher Observer
*/
MBluetoothServiceSearcherObserver* iObserver;
/**
* Makes Bluetooth service discovery protocol (SDP) requests to a remote BT device
*/
CSdpAgent* iAgent;
/**
* Holds a list of Universal Unique Identifiers (UUIDs), to be matched in SDP Service Search Requests
*/
CSdpSearchPattern* iSdpSearchPattern;
/**
* RFCOMM's port
*/
TInt iPort;
/**
* True if the record contains the RFCOMM attribute
*/
TBool iFoundRfcommProtocol;
};
#endif // BLUETOOTHSERVICESEARCHER_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -