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

📄 messageservicesearcher.cpp

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


// INCLUDE FILES
#include <bt_sock.h>

#include "MessageServiceSearcher.h"
#include "BTServiceSearcher.pan"


// ============================ MEMBER FUNCTIONS ===============================

// -----------------------------------------------------------------------------
// TSdpAttributeParser::SSdpAttributeNode[]
// Construct a TSdpAttributeParser.
// -----------------------------------------------------------------------------
//
static const TSdpAttributeParser::SSdpAttributeNode gSerialPortProtocolArray[] =
    {
        { TSdpAttributeParser::ECheckType, ETypeDES },
        { TSdpAttributeParser::ECheckType, ETypeDES },
        { TSdpAttributeParser::ECheckValue, ETypeUUID, KL2CAP },
        { TSdpAttributeParser::ECheckEnd },
        { TSdpAttributeParser::ECheckType, ETypeDES },
        { TSdpAttributeParser::ECheckValue, ETypeUUID, KRFCOMM },
        { TSdpAttributeParser::EReadValue, ETypeUint, KRfcommChannel },
        { TSdpAttributeParser::ECheckEnd },
        { TSdpAttributeParser::ECheckEnd },
        { TSdpAttributeParser::EFinished }
    };

// ----------------------------------------------------------------------------
// TStaticArrayC
// Provides a type and size, safe method of using static arrays.
// ----------------------------------------------------------------------------
//
static const TStaticArrayC<TSdpAttributeParser
::SSdpAttributeNode> gSerialPortProtocolList = CONSTRUCT_STATIC_ARRAY_C( 
                                               gSerialPortProtocolArray );

// ----------------------------------------------------------------------------
// CMessageServiceSearcher::NewL()
// Two-phased constructor.
// ----------------------------------------------------------------------------
//
CMessageServiceSearcher* CMessageServiceSearcher::NewL( MLog& aLog )
    {
    CMessageServiceSearcher* self = CMessageServiceSearcher::NewLC( aLog );
    CleanupStack::Pop( self );
    return self;
    }
    
// ----------------------------------------------------------------------------
// CMessageServiceSearcher::NewLC()
// Two-phased constructor.
// ----------------------------------------------------------------------------
//
CMessageServiceSearcher* CMessageServiceSearcher::NewLC( MLog& aLog )
    {
    CMessageServiceSearcher* self = new ( 
									ELeave ) CMessageServiceSearcher( aLog );
    CleanupStack::PushL( self );
    self->ConstructL();
    return self;
    }

// ----------------------------------------------------------------------------
// CMessageServiceSearcher::CMessageServiceSearcher()
// Construcor.
// ----------------------------------------------------------------------------
//
CMessageServiceSearcher::CMessageServiceSearcher( MLog& aLog )
: CBTServiceSearcher( aLog ),
  iServiceClass( KServiceClass ),
  iPort( -1 )
    {
    }

// ----------------------------------------------------------------------------
// CMessageServiceSearcher::~CMessageServiceSearcher()
// Destructor.
// ----------------------------------------------------------------------------
//
CMessageServiceSearcher::~CMessageServiceSearcher()
    {
    // no implementation required
    }

// ----------------------------------------------------------------------------
// CMessageServiceSearcher::ConstructL()
// Symbian 2nd phase constructor can leave.
// ----------------------------------------------------------------------------
//
void CMessageServiceSearcher::ConstructL()
    {
    // no implementation required
    }

// ----------------------------------------------------------------------------
// CMessageServiceSearcher::ServiceClass()
// The service class to search.
// ----------------------------------------------------------------------------
//
const TUUID& CMessageServiceSearcher::ServiceClass() const
    {
    return iServiceClass;
    }

// ----------------------------------------------------------------------------
// CMessageServiceSearcher::ProtocolList()
// The list of Protocols required by the service.
// ----------------------------------------------------------------------------
//
const TSdpAttributeParser::TSdpAttributeList& CMessageServiceSearcher
::ProtocolList() const
    {
    return gSerialPortProtocolList;
    }

// ----------------------------------------------------------------------------
// CMessageServiceSearcher::FoundElementL()
// Read the data element.
// ----------------------------------------------------------------------------
//
void CMessageServiceSearcher::FoundElementL( TInt aKey, CSdpAttrValue& aValue )
    {
    __ASSERT_ALWAYS( aKey == static_cast<TInt>( KRfcommChannel ), 
        Panic( EBTServiceSearcherProtocolRead ) );
    iPort = aValue.Uint();
    }

// ----------------------------------------------------------------------------
// CMessageServiceSearcher::Port()
// Port connection on the remote machine.
// ----------------------------------------------------------------------------
//
TInt CMessageServiceSearcher::Port()
    {
    return iPort;
    }

// End of File

⌨️ 快捷键说明

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