datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp
changeset 0 dfb7c4ff071f
child 12 8b5d60ce1e94
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2005-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 //
       
    15 
       
    16 /**
       
    17  @file SS_NODE.CPP
       
    18 */
       
    19 
       
    20 #include "ss_mmcommsprov.h"
       
    21 #include <elements/nm_messages_child.h>
       
    22 
       
    23 
       
    24 #ifdef _DEBUG
       
    25 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
       
    26 // (if it could happen through user error then you should give it an explicit, documented, category + code)
       
    27 _LIT(KSpecAssert_ESockSSocksmcmsp, "ESockSSocksmcmsp");
       
    28 #endif
       
    29 
       
    30 using namespace ESock;
       
    31 using namespace Messages;
       
    32 
       
    33 CMMCommsProviderBase::CMMCommsProviderBase(CCommsFactoryBase& aFactory,
       
    34                                     const MeshMachine::TNodeActivityMap& aActivityMap)
       
    35 :	ACommsFactoryNodeId(aFactory),
       
    36 	ACFMMNodeBase(aActivityMap, ANodeId::Id()),
       
    37 	TIfStaticFetcherNearestInHierarchy(this)
       
    38     {
       
    39     }
       
    40 
       
    41 CMMCommsProviderBase::~CMMCommsProviderBase()
       
    42     {
       
    43 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
    44 	if(!iParameterBundle.IsNull())
       
    45 		{
       
    46 		iParameterBundle.Close();
       
    47 		}
       
    48 #endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
    49     }
       
    50 
       
    51 
       
    52 EXPORT_C void CMMCommsProviderBase::SetParametersL(const RCFParameterFamilyBundleC& aParameterBundle)
       
    53 /** Request from a control client to set the parameters of this mm-comms provider
       
    54 
       
    55 @param aParameterBundle Bundle of parameters to be applied to this mm-comms node
       
    56 @exception Leaves with System Error Code dependant on the implementation of the mm-comms provider */
       
    57 	{
       
    58 	if (! iParameterBundle.IsNull())
       
    59 		{
       
    60 		iParameterBundle.Close();
       
    61 		}
       
    62 	iParameterBundle.Open(aParameterBundle);
       
    63 	}
       
    64 
       
    65 EXPORT_C RCFParameterFamilyBundleC& CMMCommsProviderBase::GetOrCreateParameterBundleL()
       
    66 	{
       
    67 	if( ! iParameterBundle.IsNull())
       
    68 		{
       
    69 		return iParameterBundle;
       
    70 		}
       
    71 	return CreateParameterBundleL();
       
    72 	}
       
    73 	
       
    74 EXPORT_C RCFParameterFamilyBundleC& CMMCommsProviderBase::CreateParameterBundleL()
       
    75 {
       
    76 	__ASSERT_DEBUG(iParameterBundle.IsNull(), User::Panic(KSpecAssert_ESockSSocksmcmsp, 1));
       
    77 
       
    78 	RCFParameterFamilyBundle newBundle;
       
    79 	newBundle.CreateL();
       
    80 	iParameterBundle.Open(newBundle);
       
    81 
       
    82 	return iParameterBundle;
       
    83 }
       
    84 
       
    85 /*
       
    86 void CMMCommsProviderBase::AddCtrlProviderNJoinAsDataClientL( const Messages::TSignatureBase& aCFMessage, TInt aJoinFlags )
       
    87     {
       
    88    	AddClientL(aCFMessage.iSender, TClientType(TCFClientType::ECtrlProvider));
       
    89 #ifndef __GCCXML__
       
    90 	EJoined(Factory().ParentContainer()(),
       
    91 			aCFMessage.ActivityId(),
       
    92 	    	(*this)(),
       
    93 	    	CFNODE_SET_CLIENT_TYPENFLAGS(RNodeInterface::EData, aJoinFlags)
       
    94 		).PostTo(aCFMessage.iSender);
       
    95 #endif
       
    96     }
       
    97 */
       
    98 EXPORT_C NetInterfaces::TInterfaceControl* CMMCommsProviderBase::FetchNodeInterfaceControlL(TInt aInterfaceId)
       
    99 	{
       
   100 	return ACFMMNodeBase::FetchNodeInterfaceControlL(aInterfaceId);
       
   101 	}
       
   102 
       
   103 EXPORT_C const RMetaExtensionContainerC& CMMCommsProviderBase::GetAccessPointConfig() const
       
   104 	{
       
   105 	return AccessPointConfig();
       
   106 	}
       
   107 
       
   108 EXPORT_C void CMMCommsProviderBase::ReturnInterfacePtrL(MAccessPointConfigApi*& aInterface)
       
   109 	{
       
   110 	aInterface = this;
       
   111 	}
       
   112 
       
   113 void CMMCommsProviderBase::DestroyOrphanedDataClients()
       
   114 	{
       
   115 	//Destroy orphaned data clients
       
   116 	RNodeInterface* dc;
       
   117 	TClientIter<TDefaultClientMatchPolicy> iter = GetClientIter<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EData));
       
   118 	while ((dc = iter++) != NULL)
       
   119 		{
       
   120 		if (!(dc->Flags()&(TCFClientType::EActive|TCFClientType::EActivating|TCFClientType::ELeaving|TCFClientType::EStarted|TCFClientType::EStarting)))
       
   121 			{
       
   122 			//AbortActivitiesOriginatedBy(dc->RecipientId(),aContext);
       
   123 			dc->PostMessage(Id(), TEChild::TDestroy().CRef());
       
   124 			dc->SetFlags(TClientType::ELeaving);
       
   125 			}
       
   126 		}
       
   127 	}
       
   128 
       
   129