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

📄 btserviceadvertiser.h

📁 Symbian下的p2p工程
💻 H
字号:
/* Copyright (c) 2004, Nokia. All rights reserved */


#ifndef __CBTSERVICE_ADVERTISER__
#define __CBTSERVICE_ADVERTISER__

// INCLUDES
#include <e32base.h>
#include <btsdp.h>
#include <btmanclient.h>
#include <StringLoader.h>
#include <BtPointToPoint.rsg>

#include "BTServiceAdvertiser.h"

// CLASS DECLARATIONS
/**
* CBTServiceAdvertiser
* Advertises a service in the SDP database.
*/
class CBTServiceAdvertiser : public CBase
    {
    public: // Destructor

        /**
        * ~CBTServiceAdvertiser
        * Destroy the object, close all open handles and remove 
        * the advertised service.
        */
        virtual ~CBTServiceAdvertiser();

    public: // New functions
        /**
        * StartAdvertisingL
        * Start the advertising of this service
        * @param aPort the port being used by the service 
        */
        void StartAdvertisingL( TInt aPort );

        /**
        * StopAdvertisingL
        * Stop advertising this service. Remove the record 
        * from the sdp database
        */
        void StopAdvertisingL();

        /**
        * IsAdvertising
        * Does the SDP database contain a record for this service
        * @return ETrue whether the service is being advertised
        */
        TBool IsAdvertising();

        /**
        * UpdateAvailabilityL
        * Update the service availability field of the service record
        * @param aIsAvailable ETrue is the service is not busy.
        */
        void UpdateAvailabilityL( TBool aIsAvailable );

    protected:  // New functions

        /**
        * CBTServiceAdvertiser
        * Construct this object 
        */
        CBTServiceAdvertiser();

        /**
        * BuildProtocolDescriptionL
        * Builds the protocol description
        * @param aProtocolDescriptor the protocol descriptor
        * @param aPort the service port
        */
        virtual void BuildProtocolDescriptionL( 
            CSdpAttrValueDES* aProtocolDescriptor, TInt aPort ) = 0;

        /**
        * ServiceClass
        * @return the service class
        */
        virtual const TInt ServiceClass() = 0;

        /**
        * ServiceName
        * @return the service name
        */
        virtual const TDesC& ServiceName() = 0;

        /**
        * ServiceDescription
        * @return the service description
        */
        virtual const TDesC& ServiceDescription() = 0;
    
    private:    // Function from base classes

        /**
        * ConnectL
        * Connect to the SDP database
        */  
        void ConnectL();

    private:    // data

        /** iSdpSession a handle to the SDP session */
        RSdp iSdpSession;

        /** iSdpDatabase a connection to the SDP database */
        RSdpDatabase iSdpDatabase;

        /** iRecord the record handle of the service record for this server */
        TSdpServRecordHandle iRecord;

        /** iRecordState the current record state - change number */
        TInt iRecordState;

        /** iIsConnected has a connection been made to the SDP Database */
        TBool iIsConnected;
    };

#endif // __CBTSERVICE_ADVERTISER__

// End of File

⌨️ 快捷键说明

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