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

📄 btconnectionhost.h

📁 S60培训教材代码(连载)
💻 H
字号:

/* Copyright (c) 2002, Nokia Mobile Phones. All rights reserved */

#ifndef __BTCONNECTIONHOST_H__
#define __BTCONNECTIONHOST_H__

#include "BTConnectionBase.h"
#include <btsdp.h>
#include <btmanclient.h>

class CBTServiceAdvertiser;
class MLog;
class MBTHostNotify;

/*! 
  @class CBTConnectionHost
  
  @discussion Provides a simple messaging service.
  */
class CBTConnectionHost : public CBTConnectionBase
    {
public:

/*!
  @function NewL
  
  @discussion Construct a CBTConnectionHost
  @param aLog the log to send output to
  @result a pointer to the created instance of CBTConnectionHost
  */
    static CBTConnectionHost* NewL(MBTHostNotify& aNotify, MLog& aLog);

/*!
  @function ~CBTConnectionHost
  
  @discussion Destroy the object and release all memory objects. Close any open sockets
  */
    ~CBTConnectionHost();

/*!
  @function StartL
  
  @discussion Start the server
  */
    void StartL();

/*!
  @function StopL
  
  @discussion Stop the server
  */
    void StopL();

protected:    // from CActive
/*!
  @function DoCancel
  
  @discussion Cancel any outstanding requests
  */
    void DoCancel();

/*!
  @function RunL
  
  @discussion Respond to an event
  */
    void RunL();


private:
/*!
  @function CBTConnectionHost

  @discussion Constructs this object
  */
    CBTConnectionHost(MBTHostNotify& aNotify, MLog& aLog);

/*! 
  @function ConstructL

  @discussion 2nd phase construction of this object
  */
    void ConstructL();

/*!
  @function SetSecurityOnChannelL

  @disussion Sets the security on the channel port
  */
    static void SetSecurityOnChannelL(TBool aAuthentication,
                                      TBool aEncryption, 
                                      TBool aAuthorisation,
                                      TInt aChannel);

/*!
  @function SetSecurityOnChannelL

  @disussion Removes security previously set by SetSecurityOnChannelL
  */
    static void RemoveSecurityL(TInt aChannel);


private:
    /*! @var iAdvertiser used to advertise this service */
    CBTServiceAdvertiser* iAdvertiser;

    /*! @var iListeningSocket the listening socket */
    RSocket iListeningSocket;

    /*! @var iSecManager a connection to the security manager */
    RBTMan iSecManager;

    MBTHostNotify& iNotify;

    TInt iPort;

/*!
  @enum TReceiverState
  
  @discussion The current state of the receiver
  @value EDisconnected server not connected
  @value EConnecting not fully constructed
  @value EConnected connected to a client and waiting for data
  */
    enum TState
        {
        EDisconnected,
        EConnecting,
        EConnected
        };

    /*! @var iReceiverState the state of the server */
    TState iState;

    };

#endif // __BTCONNECTIONHOST_H__

⌨️ 快捷键说明

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