accessoryservices/remotecontrolfw/server/src/remconmessage.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     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  @internalComponent
       
    19 */
       
    20 
       
    21 #include "remconmessage.h"
       
    22 #include "utils.h"
       
    23 #include <bluetooth/logger.h>
       
    24 
       
    25 #ifdef __FLOG_ACTIVE
       
    26 _LIT8(KLogComponent, LOG_COMPONENT_REMCON_SERVER);
       
    27 #endif
       
    28 
       
    29 CRemConMessage* CRemConMessage::NewL(
       
    30 	const TRemConAddress& aAddr,
       
    31 	TRemConMessageType aMsgType,
       
    32 	TRemConMessageSubType aMsgSubType,
       
    33 	TUid aInterfaceUid,
       
    34 	TUint aOperationId,
       
    35 	const RBuf8& aData,
       
    36 	TUint aSessionId,
       
    37 	TUint aTransactionId,
       
    38 	TBool aIsReliableSend)
       
    39 	{
       
    40 	LOG_STATIC_FUNC
       
    41 	return new(ELeave) CRemConMessage(
       
    42 		aAddr,
       
    43 		KNullClientId,
       
    44 		aMsgType,
       
    45 		aMsgSubType,
       
    46 		aInterfaceUid,
       
    47 		aOperationId,
       
    48 		aData,
       
    49 		aSessionId,
       
    50 		aTransactionId,
       
    51 		aIsReliableSend
       
    52 		);
       
    53 	}
       
    54 
       
    55 CRemConMessage* CRemConMessage::NewL(
       
    56 	const TRemConAddress& aAddr,
       
    57 	const TRemConClientId& aClient,
       
    58 	TRemConMessageType aMsgType,
       
    59 	TRemConMessageSubType aMsgSubType,
       
    60 	TUid aInterfaceUid,
       
    61 	TUint aOperationId,
       
    62 	const RBuf8& aData,
       
    63 	TUint aSessionId,
       
    64 	TUint aTransactionId)
       
    65 	{
       
    66 	LOG_STATIC_FUNC
       
    67 	return CRemConMessage::NewL(
       
    68 		aAddr,
       
    69 		aClient,
       
    70 		aMsgType,
       
    71 		aMsgSubType,
       
    72 		aInterfaceUid,
       
    73 		aOperationId,
       
    74 		aData,
       
    75 		aSessionId,
       
    76 		aTransactionId,
       
    77 		EFalse
       
    78 		);
       
    79 	}
       
    80 
       
    81 CRemConMessage* CRemConMessage::NewL(
       
    82 	const TRemConAddress& aAddr,
       
    83 	const TRemConClientId& aClient,
       
    84 	TRemConMessageType aMsgType,
       
    85 	TRemConMessageSubType aMsgSubType,
       
    86 	TUid aInterfaceUid,
       
    87 	TUint aOperationId,
       
    88 	const RBuf8& aData,
       
    89 	TUint aSessionId,
       
    90 	TUint aTransactionId,
       
    91 	TBool aIsReliableSend)
       
    92 	{
       
    93 	LOG_STATIC_FUNC
       
    94 	return new(ELeave) CRemConMessage(
       
    95 		aAddr,
       
    96 		aClient,
       
    97 		aMsgType,
       
    98 		aMsgSubType,
       
    99 		aInterfaceUid,
       
   100 		aOperationId,
       
   101 		aData,
       
   102 		aSessionId,
       
   103 		aTransactionId,
       
   104 		aIsReliableSend
       
   105 		);
       
   106 	}
       
   107 
       
   108 CRemConMessage::CRemConMessage(
       
   109 	const TRemConAddress& aAddr,
       
   110 	const TRemConClientId& aClient,
       
   111 	TRemConMessageType aMsgType,
       
   112 	TRemConMessageSubType aMsgSubType,
       
   113 	TUid aInterfaceUid,
       
   114 	TUint aOperationId,
       
   115 	const RBuf8& aData,
       
   116 	TUint aSessionId,
       
   117 	TUint aTransactionId,
       
   118 	TBool aIsReliableSend)
       
   119 :	iAddr(aAddr),
       
   120 	iClient(aClient),
       
   121 	iMsgType(aMsgType),
       
   122 	iMsgSubType(aMsgSubType),
       
   123 	iInterfaceUid(aInterfaceUid),
       
   124 	iOperationId(aOperationId),
       
   125 	iSessionId(aSessionId),
       
   126 	iTransactionId(aTransactionId),
       
   127 	iIsReliableSend(aIsReliableSend)
       
   128 	{
       
   129 	LOG_FUNC
       
   130 	iData.Assign(aData);
       
   131 	}
       
   132 
       
   133 CRemConMessage::~CRemConMessage()
       
   134 	{
       
   135 	LOG_FUNC
       
   136 	iData.Close();
       
   137 	}
       
   138 
       
   139 CRemConMessage* CRemConMessage::CopyL(const CRemConMessage& aMsg)
       
   140 	{
       
   141 	LOG_STATIC_FUNC
       
   142 	// Allocate a new heap descriptor with a copy of that in aMsg, then make a 
       
   143 	// new CRemConMessage to take ownership of it.
       
   144 	RBuf8 newData;
       
   145 	newData.CreateL(aMsg.OperationData());
       
   146 	
       
   147 	CleanupClosePushL(newData);
       
   148 	CRemConMessage* msg = NewL(
       
   149 		aMsg.Addr(),
       
   150 		aMsg.Client(),
       
   151 		aMsg.MsgType(),
       
   152 		aMsg.MsgSubType(),
       
   153 		aMsg.InterfaceUid(),
       
   154 		aMsg.OperationId(),
       
   155 		newData,
       
   156 		aMsg.SessionId(),
       
   157 		aMsg.TransactionId(),
       
   158 		aMsg.IsReliableSend()
       
   159 		);
       
   160 	CLEANUPSTACK_POP1(&newData);	
       
   161 	return msg;
       
   162 	}