bluetoothcommsprofiles/btpan/panmessages/src/panmessages.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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #include "panmessages.h"
       
    22 #include <es_sock.h>
       
    23 #include <ss_glob.h>
       
    24 #include <comms-infras/ss_thread.h>
       
    25 #include <comms-infras/metatype.h>
       
    26 #include <elements/nm_common.h>
       
    27 
       
    28 // PAN Message _Signatures_ (NOT messages)
       
    29 enum EMessageTypeId 
       
    30 	{
       
    31 	ESigInternalSocket              = 0,
       
    32 	ESigBool                        = 1,
       
    33 	ESigSetupConnectionResponse     = 2,
       
    34 	ESigUuidUuid                    = 3,
       
    35 	ESigPanRolePanRole              = 4,
       
    36 	};
       
    37 
       
    38 
       
    39 EXPORT_START_ATTRIBUTE_TABLE_AND_FN(TSigInternalSocket, KPanMessagesImplementationUid, ESigInternalSocket)
       
    40 	REGISTER_ATTRIBUTE(TSigInternalSocket, iSocket, TMeta<RInternalSocket>)
       
    41 END_ATTRIBUTE_TABLE_BASE(TSignatureBase, 0)
       
    42 
       
    43 EXPORT_START_ATTRIBUTE_TABLE_AND_FN(TSigBool, KPanMessagesImplementationUid, ESigInternalSocket)
       
    44 	REGISTER_ATTRIBUTE(TSigBool, iValue, TMeta<TBool>)
       
    45 END_ATTRIBUTE_TABLE_BASE(TSignatureBase, 0)
       
    46 
       
    47 EXPORT_START_ATTRIBUTE_TABLE_AND_FN(TSigSetupConnectionResponse, KPanMessagesImplementationUid, ESigInternalSocket)
       
    48 	REGISTER_ATTRIBUTE(TSigSetupConnectionResponse, iSetupResponse, TMeta<TBnepSetupConnectionResponseMessage>)
       
    49 END_ATTRIBUTE_TABLE_BASE(TSignatureBase, 0)
       
    50 
       
    51 EXPORT_START_ATTRIBUTE_TABLE_AND_FN(TSigUuidUuid, KPanMessagesImplementationUid, ESigUuidUuid)
       
    52 	REGISTER_ATTRIBUTE(TSigUuidUuid, iRequestedLocalRole, TMeta<TUUID>)
       
    53 	REGISTER_ATTRIBUTE(TSigUuidUuid, iRequestedRemoteRole, TMeta<TUUID>)
       
    54 END_ATTRIBUTE_TABLE_BASE(TSignatureBase, 0)
       
    55 
       
    56 EXPORT_START_ATTRIBUTE_TABLE_AND_FN(TSigPanRolePanRole, KPanMessagesImplementationUid, ESigPanRolePanRole)
       
    57 	REGISTER_ATTRIBUTE(TSigPanRolePanRole, iRequestedLocalRole, TMeta<TBluetoothPanRole>)
       
    58 	REGISTER_ATTRIBUTE(TSigPanRolePanRole, iRequestedRemoteRole, TMeta<TBluetoothPanRole>)
       
    59 END_ATTRIBUTE_TABLE_BASE(TSignatureBase, 0)
       
    60 
       
    61 
       
    62 DEFINE_MVIP_CTR(TSigInternalSocket);
       
    63 DEFINE_MVIP_CTR(TSigBool);
       
    64 DEFINE_MVIP_CTR(TSigSetupConnectionResponse);
       
    65 DEFINE_MVIP_CTR(TSigUuidUuid);
       
    66 DEFINE_MVIP_CTR(TSigPanRolePanRole);
       
    67 
       
    68 
       
    69 const TImplementationProxy SignatureImplementationTable[] = 
       
    70 	{
       
    71 	//NOTE: Entries must be sorted for the binary search to work efficiently!
       
    72 	MVIP_CTR_ENTRY(ESigInternalSocket, TSigInternalSocket),     // 0
       
    73 	MVIP_CTR_ENTRY(ESigBool, TSigBool),                         // 1
       
    74 	MVIP_CTR_ENTRY(ESigSetupConnectionResponse, TSigSetupConnectionResponse),   // 2
       
    75 	MVIP_CTR_ENTRY(ESigUuidUuid, TSigUuidUuid),                 // 3
       
    76 	MVIP_CTR_ENTRY(ESigPanRolePanRole, TSigPanRolePanRole),     // 4
       
    77 	};
       
    78 
       
    79 
       
    80 EXPORT_C void TPanMessage::RegisterL()
       
    81 	{
       
    82 	Messages::TlsGlobals::Get().RegisterInterfaceL(TUid::Uid(KPanMessagesImplementationUid), sizeof(SignatureImplementationTable) / sizeof(SignatureImplementationTable[0]), SignatureImplementationTable);
       
    83 	}
       
    84 
       
    85 EXPORT_C void TPanMessage::DeRegister()
       
    86 	{
       
    87 	Messages::TlsGlobals::Get().DeregisterInterface(TUid::Uid(KPanMessagesImplementationUid));	
       
    88 	}
       
    89