commsfwsupport/commselements/NetMessages/src/NetMessages.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2004-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
       
    18  @internalTechnology
       
    19 */
       
    20 
       
    21 #include <elements/netmessages.h>
       
    22 #include <elements/idquerynetmsg.h>
       
    23 #include <ecom/implementationproxy.h>
       
    24 
       
    25 using namespace NetMessages;
       
    26 
       
    27 REGISTER_TYPEID( CMessage, NetMessages::KInterfaceUid, EMessageAny )
       
    28 
       
    29 START_ATTRIBUTE_TABLE( CTypeIdQuery, NetMessages::KInterfaceUid, ETypeIdQueryId )
       
    30 	REGISTER_ATTRIBUTE( CTypeIdQuery, iUid, TMeta<TInt32> )
       
    31 	REGISTER_ATTRIBUTE( CTypeIdQuery, iTypeId, TMeta<TInt32> )
       
    32 	REGISTER_ATTRIBUTE( CTypeIdQuery, iHandle, TMetaNumber )
       
    33 	REGISTER_ATTRIBUTE( CTypeIdQuery, iOid, TMeta< TBuf8<KMaxOIDLength> > )
       
    34 END_ATTRIBUTE_TABLE_BASE( CMessage, 0 )
       
    35 
       
    36 START_ATTRIBUTE_TABLE( CTypeIdDataQuery, NetMessages::KInterfaceUid, ETypeIdQueryDataId )
       
    37 	REGISTER_ATTRIBUTE( CTypeIdDataQuery, iData, TMetaBuf )
       
    38 END_ATTRIBUTE_TABLE_BASE( CTypeIdQuery, 0 )
       
    39 
       
    40 /**
       
    41 ECOM Implementation Factories
       
    42 */
       
    43 
       
    44 class CNetMsgFactory : public CBase
       
    45 /**
       
    46 Connection generic event factory.
       
    47 
       
    48 @internalComponent
       
    49 @released since v9.2
       
    50 */
       
    51     {
       
    52 public:
       
    53     static Meta::SMetaDataECom* InstantiateL(TAny* aParams);
       
    54     };
       
    55 
       
    56 /**
       
    57  * @internalTechnology
       
    58  */
       
    59 // Define the interface UIDs
       
    60 const TImplementationProxy ImplementationTable[] =
       
    61 	{
       
    62 	IMPLEMENTATION_PROXY_ENTRY(KInterfaceUid, CNetMsgFactory::InstantiateL)
       
    63 	};
       
    64 
       
    65 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
    66     {
       
    67     aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
    68     return ImplementationTable;
       
    69     }
       
    70 
       
    71 Meta::SMetaDataECom* CNetMsgFactory::InstantiateL(TAny* aParams)
       
    72 	{
       
    73 	TInt32 type = reinterpret_cast<TInt32>(aParams);
       
    74 
       
    75 	Meta::SMetaDataECom* newInst = 0;
       
    76 
       
    77 	switch (type)
       
    78 		{
       
    79 	case (ETypeIdQueryId):
       
    80 		newInst = new (ELeave) CTypeIdQuery;
       
    81 		break;
       
    82 	case (ETypeIdQueryDataId):
       
    83 		newInst = new (ELeave) CTypeIdDataQuery;
       
    84 		break;
       
    85 	default:
       
    86 		User::Leave(KErrNotFound);
       
    87 		}
       
    88 	return newInst;
       
    89 	}
       
    90 
       
    91