1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmtestenv/mmtestfw/include/TestFrameworkIpc.inl Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,194 @@
1.4 +/*
1.5 +* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifndef __TESTFRAMEWORKIPC_INL__
1.23 +#define __TESTFRAMEWORKIPC_INL__
1.24 +
1.25 +
1.26 +//
1.27 +// RMmfSessionBaseX
1.28 +//
1.29 +
1.30 +// Pass throughs - equiv to using...
1.31 +
1.32 +inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction) const
1.33 + {
1.34 + return RMmfSessionBase::SendReceive(aFunction);
1.35 + }
1.36 +
1.37 +inline void RMmfSessionBaseX::SendReceive(TInt aFunction, TRequestStatus& aStatus) const
1.38 + {
1.39 + RMmfSessionBase::SendReceive(aFunction, aStatus);
1.40 + }
1.41 +
1.42 +inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, TInt aParam0) const
1.43 + {
1.44 + return RMmfSessionBase::SendReceive(aFunction, aParam0);
1.45 + }
1.46 +
1.47 +inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, TInt aParam0, TInt aParam1) const
1.48 + {
1.49 + return RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1);
1.50 + }
1.51 +
1.52 +inline void RMmfSessionBaseX::SendReceive(TInt aFunction, TInt aParam0, TRequestStatus& aStatus) const
1.53 + {
1.54 + RMmfSessionBase::SendReceive(aFunction, aParam0, aStatus);
1.55 + }
1.56 +
1.57 +inline void RMmfSessionBaseX::SendReceive(TInt aFunction, TInt aParam0, TInt aParam1, TRequestStatus& aStatus) const
1.58 + {
1.59 + RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1, aStatus);
1.60 + }
1.61 +
1.62 +inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0) const
1.63 + {
1.64 + return RMmfSessionBase::SendReceive(aFunction, aParam0);
1.65 + }
1.66 +
1.67 +inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, const TDesC8& aParam1) const
1.68 + {
1.69 + return RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1);
1.70 + }
1.71 +
1.72 +inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, const TDesC8& aParam1, const TDesC8& aParam2) const
1.73 + {
1.74 + return RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1, aParam2);
1.75 + }
1.76 +
1.77 +inline void RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, TRequestStatus& aStatus) const
1.78 + {
1.79 + RMmfSessionBase::SendReceive(aFunction, aParam0, aStatus);
1.80 + }
1.81 +
1.82 +inline void RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, const TDesC8& aParam1, TRequestStatus& aStatus) const
1.83 + {
1.84 + RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1, aStatus);
1.85 + }
1.86 +
1.87 +inline void RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, const TDesC8& aParam1, const TDesC8& aParam2, TRequestStatus& aStatus) const
1.88 + {
1.89 + RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1, aParam2, aStatus);
1.90 + }
1.91 +
1.92 +// New call
1.93 +
1.94 +inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC& aParam0, TInt aParam1) const
1.95 + {
1.96 +#ifdef __MMF_USE_IPC_V2__
1.97 + return RSessionBase::SendReceive(aFunction, TIpcArgs(&aParam0,aParam1));
1.98 +#else
1.99 + TAny* p[KMaxMessageArguments];
1.100 + p[0] = static_cast<TAny*>(const_cast<TDesC16*>(&aParam0));
1.101 + p[1] = reinterpret_cast<TAny*>(aParam1);
1.102 + p[2] = NULL;
1.103 + p[3] = NULL;
1.104 + return RSessionBase::SendReceive(aFunction, p);
1.105 +#endif __MMF_USE_IPC_V2__
1.106 + }
1.107 +
1.108 +//
1.109 +// MmfMEssageUtilX
1.110 +//
1.111 +
1.112 +// Using calls
1.113 +
1.114 +inline TInt MmfMessageUtilX::Read(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult)
1.115 + {
1.116 + return MmfMessageUtil::Read(aMessage, aParam, aResult);
1.117 + }
1.118 +
1.119 +inline TInt MmfMessageUtilX::Write(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue)
1.120 + {
1.121 + return MmfMessageUtil::Write(aMessage, aParam, aValue);
1.122 + }
1.123 +
1.124 +inline void MmfMessageUtilX::ReadL(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult)
1.125 + {
1.126 + MmfMessageUtil::ReadL(aMessage, aParam, aResult);
1.127 + }
1.128 +
1.129 +inline void MmfMessageUtilX::WriteL(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue)
1.130 + {
1.131 + MmfMessageUtil::WriteL(aMessage, aParam, aValue);
1.132 + }
1.133 +
1.134 +
1.135 +// New calls
1.136 +
1.137 +inline void MmfMessageUtilX::ReadL(const RMmfIpcMessage& aMessage, TInt aParam, TDes16& aResult)
1.138 + {
1.139 +#ifdef __MMF_USE_IPC_V2__
1.140 + User::LeaveIfError(aMessage.Read(aParam, aResult));
1.141 +#else
1.142 + // expect aParam to be a literal - so this code should optimise out
1.143 + if (aParam==0)
1.144 + aMessage.ReadL(aMessage.Ptr0(), aResult);
1.145 + else if (aParam==1)
1.146 + aMessage.ReadL(aMessage.Ptr1(), aResult);
1.147 + else if (aParam==2)
1.148 + aMessage.ReadL(aMessage.Ptr2(), aResult);
1.149 + else if (aParam==3)
1.150 + aMessage.ReadL(aMessage.Ptr3(), aResult);
1.151 + else
1.152 + User::Leave(KErrArgument);
1.153 +#endif __MMF_USE_IPC_V2__
1.154 + }
1.155 +
1.156 +inline void MmfMessageUtilX::WriteL(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC16& aValue)
1.157 + {
1.158 +#ifdef __MMF_USE_IPC_V2__
1.159 + User::LeaveIfError(aMessage.Write(aParam, aValue));
1.160 +#else
1.161 + // expect aParam to be a literal - so this code should optimise out
1.162 + if (aParam==0)
1.163 + aMessage.WriteL(aMessage.Ptr0(), aValue);
1.164 + else if (aParam==1)
1.165 + aMessage.WriteL(aMessage.Ptr1(), aValue);
1.166 + else if (aParam==2)
1.167 + aMessage.WriteL(aMessage.Ptr2(), aValue);
1.168 + else if (aParam==3)
1.169 + aMessage.WriteL(aMessage.Ptr3(), aValue);
1.170 + else
1.171 + User::Leave(KErrArgument);
1.172 +#endif __MMF_USE_IPC_V2__
1.173 + }
1.174 +
1.175 +inline TInt MmfMessageUtilX::Read(const RMmfIpcMessage& aMessage, TInt aParam, TDes16& aResult)
1.176 + {
1.177 +#ifdef __MMF_USE_IPC_V2__
1.178 + return aMessage.Read(aParam, aResult);
1.179 +#else
1.180 + TRAPD(error, ReadL(aMessage, aParam, aResult));
1.181 + return error;
1.182 +#endif __MMF_USE_IPC_V2__
1.183 + }
1.184 +
1.185 +inline TInt MmfMessageUtilX::Write(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC16& aValue)
1.186 + {
1.187 +#ifdef __MMF_USE_IPC_V2__
1.188 + return aMessage.Write(aParam, aValue);
1.189 +#else
1.190 + TRAPD(error, WriteL(aMessage, aParam, aValue));
1.191 + return error;
1.192 +#endif __MMF_USE_IPC_V2__
1.193 + }
1.194 +
1.195 +
1.196 +
1.197 +#endif // __TESTFRAMEWORKIPC_INL__