datacommsserver/esockserver/ssock/ss_connLegacy.cpp
branchRCL_3
changeset 26 b564fb5fd78b
parent 25 9d7ce34704c8
equal deleted inserted replaced
25:9d7ce34704c8 26:b564fb5fd78b
    60 
    60 
    61 
    61 
    62 
    62 
    63 //const TInt KNumberOfEmulatedSubConnections = 2;
    63 //const TInt KNumberOfEmulatedSubConnections = 2;
    64 
    64 
    65 const Factories::TAnyFn AConnectionLegacy::iInterfaceVTableF[] =
       
    66 	{
       
    67 	(Factories::TAnyFn)1,
       
    68 	(Factories::TAnyFn)(TFactoryNotify<AConnectionLegacy>::Notification)
       
    69 	};
       
    70 
       
    71 AConnectionLegacy::~AConnectionLegacy()
    65 AConnectionLegacy::~AConnectionLegacy()
    72     {
    66     {
    73    	TSubConnectionEvent* subConnectionEvent;
    67    	TSubConnectionEvent* subConnectionEvent;
    74 	while (iSubConnectionEventQueue.Deque(subConnectionEvent))
    68 	while (iSubConnectionEventQueue.Deque(subConnectionEvent))
    75 		{
    69 		{
   128 	CConnectionProviderBase* connProv = static_cast<CConnectionProviderBase*>(aConnectionInfo.iInfo.iFactoryObject);
   122 	CConnectionProviderBase* connProv = static_cast<CConnectionProviderBase*>(aConnectionInfo.iInfo.iFactoryObject);
   129 	return connProv->ProviderInfo().APId() == iAp ? MFactoryQuery::EMatch : MFactoryQuery::EContinue;
   123 	return connProv->ProviderInfo().APId() == iAp ? MFactoryQuery::EMatch : MFactoryQuery::EContinue;
   130 	}
   124 	}
   131 
   125 
   132 
   126 
   133 static const TUid K_CIPProtoConnectionProviderFactory_iUid = {0x10281DD3};
   127 //static const TUid K_CIPProtoConnectionProviderFactory_iUid = {0x10281DD3};
   134 
   128 
   135 void AConnectionLegacy::CompleteAttachL(ESock::TSelectionPrefs& aPrefs)
   129 void AConnectionLegacy::CompleteAttachL(ESock::TSelectionPrefs& aPrefs)
   136 	{
   130 	{
   137 	//We have built the new top (legacy) Cpr and now we need to make sure that
   131 	//We have built the new top (legacy) Cpr and now we need to make sure that
   138 	//it is properly joined to the layer directly below it (i.e. IpProto).
   132 	//it is properly joined to the layer directly below it (i.e. IpProto).
   144 	Messages::ANode& connProvNode = sp->RecipientId().Node();
   138 	Messages::ANode& connProvNode = sp->RecipientId().Node();
   145     MeshMachine::AMMNodeBase* cpr = reinterpret_cast<MeshMachine::AMMNodeBase*>(connProvNode.FetchNodeInterfaceL(AMMNodeBase::KInterfaceId));
   139     MeshMachine::AMMNodeBase* cpr = reinterpret_cast<MeshMachine::AMMNodeBase*>(connProvNode.FetchNodeInterfaceL(AMMNodeBase::KInterfaceId));
   146     __ASSERT_DEBUG(cpr->GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider))==NULL, User::Panic(KSpecAssert_ESockSSockscnLgc, 3)); //This is why we are "legacy"
   140     __ASSERT_DEBUG(cpr->GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider))==NULL, User::Panic(KSpecAssert_ESockSSockscnLgc, 3)); //This is why we are "legacy"
   147 
   141 
   148 	CConnectionFactoryContainer& container = *static_cast<CPlayer&>(iConnection.Player()).SockManGlobals()->iConnectionFactories;
   142 	CConnectionFactoryContainer& container = *static_cast<CPlayer&>(iConnection.Player()).SockManGlobals()->iConnectionFactories;
   149 	CCommsFactoryBase* factory = static_cast<CCommsFactoryBase*>(container.FindFactory(K_CIPProtoConnectionProviderFactory_iUid));
   143 	CCommsFactoryBase* factory = static_cast<CCommsFactoryBase*>(container.FindFactory(TUid::Uid(KIPProtoConnectionProviderFactoryUid)));
   150     User::LeaveIfError(factory? KErrNone : KErrArgument);
   144     User::LeaveIfError(factory? KErrNone : KErrArgument);
   151 
   145 
   152     XConnectionFactoryAPQuery query(static_cast<const TCommDbConnPref&>(cp).IapId());
   146     XConnectionFactoryAPQuery query(static_cast<const TCommDbConnPref&>(cp).IapId());
   153     CConnectionProviderBase* ipProtoCpr = static_cast<CConnectionProviderBase*>(factory->Find(query));
   147     CConnectionProviderBase* ipProtoCpr = static_cast<CConnectionProviderBase*>(factory->Find(query));
   154     User::LeaveIfError(ipProtoCpr? KErrNone : KErrArgument);
   148     User::LeaveIfError(ipProtoCpr? KErrNone : KErrArgument);
   898 	TMCprGetConnectionSetting msg(TMCprGetConnectionSetting::ELongDesSetting, aMessage);
   892 	TMCprGetConnectionSetting msg(TMCprGetConnectionSetting::ELongDesSetting, aMessage);
   899 	iConnection.CMMSockSubSession::ReceivedL(aMessage.Function(), msg);
   893 	iConnection.CMMSockSubSession::ReceivedL(aMessage.Function(), msg);
   900 	iConnection.DontCompleteCurrentRequest();
   894 	iConnection.DontCompleteCurrentRequest();
   901 	}
   895 	}
   902 
   896 
   903 
       
   904 
       
   905 void AConnectionLegacy::InterfaceStateChangeNotification(TDesC8& /*aInfo*/)
       
   906 	{
       
   907 	//[399TODO] implement InterfaceStateChangeNotification
       
   908 	LOG(ESockLog::Printf(KESockConnectionTag, _L8("TODO: implement InterfaceStateChangeNotification - KErrNotSupported")));
       
   909 #if TODO_IMPLEMENT_THIS
       
   910 	TInterfaceNotification& interfaceNotification = ((TInterfaceNotificationBuf&)aInfo)();
       
   911 
       
   912 	if(iAllInterfaceNotificationMessage.IsNull())
       
   913 		{
       
   914 		iInterfaceChangeQueue.Enque(interfaceNotification);
       
   915 		return;
       
   916 		}
       
   917 	else // request is outstanding
       
   918 		{
       
   919 		if(!iInterfaceChangeQueue.IsEmpty())
       
   920 			{
       
   921 			// can this situation ever happen?
       
   922 			// - new requests fullfilled from queue before becoming outstanding
       
   923 			// - no queued items when request outstanding
       
   924 
       
   925 			// But in case we do...
       
   926 			// should we get oldest change first in case this new one overwrites it
       
   927 			iInterfaceChangeQueue.Enque(interfaceNotification);
       
   928 			iInterfaceChangeQueue.Deque(interfaceNotification);
       
   929 			}
       
   930 
       
   931 		TInt ret = iAllInterfaceNotificationMessage.Write(0, aInfo);
       
   932 		CompleteMessage(iAllInterfaceNotificationMessage, ret);
       
   933 		}
       
   934 #endif
       
   935 	}
       
   936 
       
   937 void AConnectionLegacy::SubConnectionEvent(const TSubConnectionEvent& aSubConnectionEvent)
   897 void AConnectionLegacy::SubConnectionEvent(const TSubConnectionEvent& aSubConnectionEvent)
   938 	{
   898 	{
   939 	// Pass the message onto the client if possible, or buffer if necessary
   899 	// Pass the message onto the client if possible, or buffer if necessary
   940 	if(!iAllSubConnectionNotificationMessage.IsNull())
   900 	if(!iAllSubConnectionNotificationMessage.IsNull())
   941 		{
   901 		{