bluetoothcommsprofiles/btpan/panproviders/src/panethflow.cpp
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // PAN Ethernet Flow
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #include <bluetooth/logger.h>
       
    24 #include "paneth802.h"
       
    25 #include "panprovisioninfo.h"
       
    26 #include "CBnepBridge.h"
       
    27 
       
    28 #ifdef __FLOG_ACTIVE
       
    29 _LIT8(KLogComponent, LOG_COMPONENT_PAN_PROVIDERS);
       
    30 #endif
       
    31 
       
    32 #ifdef _DEBUG
       
    33 PANICCATEGORY("panethfl");
       
    34 #endif
       
    35 
       
    36 #ifdef ESOCK_EXTLOG_ACTIVE
       
    37 _LIT8(KBnepSubTag, "panflow");
       
    38 #endif
       
    39 
       
    40 CPanEthFlowFactory* CPanEthFlowFactory::NewL(TAny* aConstructionParameters)
       
    41     {
       
    42 	CPanEthFlowFactory* ptr = new (ELeave) CPanEthFlowFactory(TUid::Uid(CPanEthFlowFactory::iUid), *(reinterpret_cast<ESock::CSubConnectionFlowFactoryContainer*>(aConstructionParameters)));
       
    43 	return ptr;
       
    44     }
       
    45 
       
    46 ESock::CSubConnectionFlowBase* CPanEthFlowFactory::DoCreateFlowL(ESock::CProtocolIntfBase* aProtocolIntf, ESock::TFactoryQueryBase& aQuery)
       
    47     {
       
    48     const ESock::TDefaultFlowFactoryQuery& query = static_cast<const ESock::TDefaultFlowFactoryQuery&>(aQuery);	
       
    49     return CPanEtherFlow::NewL(*this, query.iSCprId, aProtocolIntf);
       
    50     }
       
    51 
       
    52 CPanEthFlowFactory::CPanEthFlowFactory(TUid aFactoryId, ESock::CSubConnectionFlowFactoryContainer& aParentContainer)
       
    53     : ESock::CSubConnectionFlowFactoryBase(aFactoryId, aParentContainer)
       
    54     {
       
    55     }
       
    56     
       
    57 CPanEtherFlow* CPanEtherFlow::NewL(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf)
       
    58     {
       
    59 	CPanEtherFlow* s=new (ELeave) CPanEtherFlow(aFactory, aSubConnId, aProtocolIntf);
       
    60 	CleanupStack::PushL(s);
       
    61 	s->ConstructL();
       
    62 	CleanupStack::Pop();
       
    63 	return s;    
       
    64     }
       
    65 
       
    66 CPanEtherFlow::CPanEtherFlow(ESock::CSubConnectionFlowFactoryBase& aFactory, const Messages::TNodeId& aSubConnId, ESock::CProtocolIntfBase* aProtocolIntf)
       
    67     : CLANLinkCommon(aFactory, aSubConnId, aProtocolIntf)
       
    68     {
       
    69     NM_LOG_NODE_CREATE(KBnepSubTag, CPanEtherFlow);
       
    70     }
       
    71 	
       
    72 CPanEtherFlow::~CPanEtherFlow()
       
    73     {
       
    74     // Reset the provisioned Bnep Connection Manager
       
    75     CPanProvisionInfo* panInfo = const_cast<CPanProvisionInfo*>(static_cast<const CPanProvisionInfo*>(AccessPointConfig().FindExtension(CPanProvisionInfo::TypeId())));
       
    76     ASSERT_DEBUG(panInfo);
       
    77     panInfo->Reset();
       
    78 
       
    79     NM_LOG_NODE_DESTROY(KBnepSubTag, CPanEtherFlow);
       
    80     }
       
    81 
       
    82 ESock::MLowerDataSender* CPanEtherFlow::BindL(const TDesC8& aProtocol, ESock::MUpperDataReceiver* aReceiver, ESock::MUpperControl* aControl)
       
    83     {
       
    84     CPanProvisionInfo* panInfo = const_cast<CPanProvisionInfo*>(static_cast<const CPanProvisionInfo*>(AccessPointConfig().FindExtension(CPanProvisionInfo::TypeId())));
       
    85     ASSERT_DEBUG(panInfo);
       
    86 
       
    87     if (panInfo->BnepConnectionMgr() == Messages::TNodeId::NullId())
       
    88         {
       
    89         ASSERT_DEBUG(iPktDrv);
       
    90         // Passing the packet driver owner to BNEP and getting the
       
    91         // BnepConnectionManager set into the provision info for PAN
       
    92         panInfo->SetPacketDriverOwner(*iPktDrvOwner);
       
    93     	iPktDrv->Notification((TAgentToNifEventType)EPanAgentToNifGetPanProvisionInfo, static_cast<TAny*>(panInfo));
       
    94         ASSERT_DEBUG(panInfo->BnepConnectionMgr() != Messages::TNodeId::NullId());
       
    95         }
       
    96     return CLANLinkCommon::BindL(aProtocol, aReceiver, aControl);
       
    97     }
       
    98 
       
    99