⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 btservicesearcher.h

📁 S60培训教材代码(连载)
💻 H
字号:
/* Copyright (c) 2002, Nokia Mobile Phones. All rights reserved */

#ifndef __BTSERVICESEARCHER_H__
#define __BTSERVICESEARCHER_H__

#include <e32base.h>
#include <bttypes.h>
#include <btextnotifiers.h>
#include <btsdp.h>

#include "Log.h"

/*! 
  @class CBTServiceSearcher
  
  @discussion Searches for a service on a remote machine
  */

class CBTServiceSearcher : public CBase,
                           public MSdpAgentNotifier,
                           public MSdpAttributeValueVisitor

    {
public:

/*!
  @function CBTServiceSearcher
  
  @param aLog the log to send output to
  @discussion Constructs this object
  */
    CBTServiceSearcher(TInt aServiceClassID, TUint32 aAppUID, MLog& aLog);

/*!
  @function ~CBTServiceSearcher
  
  @discussion Destroy the object and release all memory objects
  */
    ~CBTServiceSearcher();

/*!
  @function FindServiceL
  
  @discussion Find a service on the specified device
  @param aObserverRequestStatus the observer that is to be notified when the service search is complete
  */    
    void FindServiceL(TRequestStatus& iObserverRequestStatus);

/*!
  @function BTDevAddr
  
  @result the bluetooth device address
  */    
    const TBTDevAddr& BTDevAddr();

/*!
  @function Port
  
  @result the RFComm port no to connect to host on
  */    
    TInt Port() const;

protected:

/*!
  @function SelectDeviceByDiscoveryL
  
  @discussion Select a device
  */
    void SelectDeviceByDiscoveryL();

/*!
  @function Finished
  
  @discussion The search has finished. Notify the observer that the process is complete.
  */
    virtual void Finished(TInt aError = KErrNone);


private: // from MSdpAgentNotifier
/*!
  @function NextRecordRequestComplete
  
  @discussion Process the result of the next record request
  @param aError the error code
  @param aHandle the handle of the service record
  @param aTotalRecordsCount the total number of matching service records
  */
    void NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount);

/*!
  @function AttributeRequestResult
  
  @discussion Process the next attribute requested
  @param aHandle the handle of the service record
  @param aAttrID the id of the attribute
  @parma aAttrValue the value of the attribute
  */
    void AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue);

/*!
  @function AttributeRequestComplete
  
  @discussion Process the arrtibute request completion
  @param aHandle the handle of the service record
  @param aError the error code
  */
    void AttributeRequestComplete(TSdpServRecordHandle aHandle, TInt aError);

private: // from MSdpAttributeValueVisitor

/*!
  @function VisitAttributeValueL
  
  @discussion Process a data element
  @param aValue the data element 
  @param aType the type of the data element
  */
    void VisitAttributeValueL(CSdpAttrValue& aValue, TSdpElementType aType);

/*!
  @function StartListL
  
  @discussion Process the start of a data element list
  @param aList the data element list 
  */
    void StartListL(CSdpAttrValueList& aList);

/*!
  @function EndListL
  
  @discussion Process the end of a data element list
  */
    void EndListL();


private:
    /*! @var iStatusObserver pointer to the request status observer */
    TRequestStatus* iStatusObserver;

    
    /*! @var iDeviceInfo stores the address, etc, of the selected device */
    TBTDeviceResponseParams  iDeviceInfo;

    /*! @var iAgent a connetction to the SDP client */
    CSdpAgent* iAgent;

    /*! @var iServiceClassID service class ID to search for */
    TUUID iServiceClassID;

    /*! @var iPort the port number that the remote service is installed */
    TInt iPort;

    /*! @var iAppUID the application UID of the game we want to play (i.e. this game) */
    TUint32 iAppUID;

    /*! @var iHostAppUID the host's game application UID */
    TUint32 iHostAppUID; 

    /*! @var iVisitAppUID are we doing an SDP "visit" the app uid of the host game */
    TBool iVisitAppUID; 

    /*! @var iLog the log to send output to */
    MLog& iLog;
    };

#endif // __BTSERVICESEARCHER_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -