os/mm/mmtestenv/mmtestfw/include/TestFrameworkIpc.inl
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
#ifndef __TESTFRAMEWORKIPC_INL__
sl@0
    20
#define __TESTFRAMEWORKIPC_INL__
sl@0
    21
sl@0
    22
sl@0
    23
//
sl@0
    24
// RMmfSessionBaseX
sl@0
    25
//
sl@0
    26
sl@0
    27
// Pass throughs - equiv to using...
sl@0
    28
sl@0
    29
inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction) const
sl@0
    30
	{
sl@0
    31
	return RMmfSessionBase::SendReceive(aFunction);
sl@0
    32
	}
sl@0
    33
	
sl@0
    34
inline void RMmfSessionBaseX::SendReceive(TInt aFunction, TRequestStatus& aStatus) const
sl@0
    35
	{
sl@0
    36
	RMmfSessionBase::SendReceive(aFunction, aStatus);
sl@0
    37
	}
sl@0
    38
	
sl@0
    39
inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, TInt aParam0) const
sl@0
    40
	{
sl@0
    41
	return RMmfSessionBase::SendReceive(aFunction, aParam0);
sl@0
    42
	}
sl@0
    43
	
sl@0
    44
inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, TInt aParam0, TInt aParam1) const
sl@0
    45
	{
sl@0
    46
	return RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1);
sl@0
    47
	}
sl@0
    48
	
sl@0
    49
inline void RMmfSessionBaseX::SendReceive(TInt aFunction, TInt aParam0, TRequestStatus& aStatus) const
sl@0
    50
	{
sl@0
    51
	RMmfSessionBase::SendReceive(aFunction, aParam0, aStatus);
sl@0
    52
	}
sl@0
    53
	
sl@0
    54
inline void RMmfSessionBaseX::SendReceive(TInt aFunction, TInt aParam0, TInt aParam1, TRequestStatus& aStatus) const
sl@0
    55
	{
sl@0
    56
	RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1, aStatus);
sl@0
    57
	}
sl@0
    58
	
sl@0
    59
inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0) const
sl@0
    60
	{
sl@0
    61
	return RMmfSessionBase::SendReceive(aFunction, aParam0);
sl@0
    62
	}
sl@0
    63
	
sl@0
    64
inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, const TDesC8& aParam1) const
sl@0
    65
	{
sl@0
    66
	return RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1);
sl@0
    67
	}
sl@0
    68
	
sl@0
    69
inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, const TDesC8& aParam1, const TDesC8& aParam2) const
sl@0
    70
	{
sl@0
    71
	return RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1, aParam2);
sl@0
    72
	}
sl@0
    73
	
sl@0
    74
inline void RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, TRequestStatus& aStatus) const
sl@0
    75
	{
sl@0
    76
	RMmfSessionBase::SendReceive(aFunction, aParam0, aStatus);
sl@0
    77
	}
sl@0
    78
	
sl@0
    79
inline void RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, const TDesC8& aParam1, TRequestStatus& aStatus) const
sl@0
    80
	{
sl@0
    81
	RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1, aStatus);
sl@0
    82
	}
sl@0
    83
	
sl@0
    84
inline void RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC8& aParam0, const TDesC8& aParam1, const TDesC8& aParam2, TRequestStatus& aStatus) const
sl@0
    85
	{
sl@0
    86
	RMmfSessionBase::SendReceive(aFunction, aParam0, aParam1, aParam2, aStatus);
sl@0
    87
	}
sl@0
    88
sl@0
    89
// New call
sl@0
    90
sl@0
    91
inline TInt RMmfSessionBaseX::SendReceive(TInt aFunction, const TDesC& aParam0, TInt aParam1) const
sl@0
    92
	{
sl@0
    93
#ifdef __MMF_USE_IPC_V2__
sl@0
    94
	return RSessionBase::SendReceive(aFunction, TIpcArgs(&aParam0,aParam1));
sl@0
    95
#else
sl@0
    96
	TAny* p[KMaxMessageArguments];
sl@0
    97
	p[0] = static_cast<TAny*>(const_cast<TDesC16*>(&aParam0));
sl@0
    98
	p[1] = reinterpret_cast<TAny*>(aParam1);
sl@0
    99
	p[2] = NULL;
sl@0
   100
	p[3] = NULL;
sl@0
   101
	return RSessionBase::SendReceive(aFunction, p);
sl@0
   102
#endif __MMF_USE_IPC_V2__
sl@0
   103
	}
sl@0
   104
sl@0
   105
//
sl@0
   106
// MmfMEssageUtilX
sl@0
   107
//
sl@0
   108
sl@0
   109
// Using calls
sl@0
   110
sl@0
   111
inline TInt MmfMessageUtilX::Read(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult)
sl@0
   112
	{
sl@0
   113
	return MmfMessageUtil::Read(aMessage, aParam, aResult);
sl@0
   114
	}
sl@0
   115
sl@0
   116
inline TInt MmfMessageUtilX::Write(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue)
sl@0
   117
	{
sl@0
   118
	return MmfMessageUtil::Write(aMessage, aParam, aValue);
sl@0
   119
	}
sl@0
   120
sl@0
   121
inline void MmfMessageUtilX::ReadL(const RMmfIpcMessage& aMessage, TInt aParam, TDes8& aResult)
sl@0
   122
	{
sl@0
   123
	MmfMessageUtil::ReadL(aMessage, aParam, aResult);
sl@0
   124
	}
sl@0
   125
sl@0
   126
inline void MmfMessageUtilX::WriteL(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC8& aValue)
sl@0
   127
	{
sl@0
   128
	MmfMessageUtil::WriteL(aMessage, aParam, aValue);
sl@0
   129
	}
sl@0
   130
sl@0
   131
sl@0
   132
// New calls
sl@0
   133
sl@0
   134
inline void MmfMessageUtilX::ReadL(const RMmfIpcMessage& aMessage, TInt aParam, TDes16& aResult)
sl@0
   135
	{
sl@0
   136
#ifdef __MMF_USE_IPC_V2__
sl@0
   137
	User::LeaveIfError(aMessage.Read(aParam, aResult));
sl@0
   138
#else
sl@0
   139
	// expect aParam to be a literal - so this code should optimise out
sl@0
   140
	if (aParam==0)
sl@0
   141
		aMessage.ReadL(aMessage.Ptr0(), aResult);
sl@0
   142
	else if (aParam==1)
sl@0
   143
		aMessage.ReadL(aMessage.Ptr1(), aResult);
sl@0
   144
	else if (aParam==2)
sl@0
   145
		aMessage.ReadL(aMessage.Ptr2(), aResult);
sl@0
   146
	else if (aParam==3)
sl@0
   147
		aMessage.ReadL(aMessage.Ptr3(), aResult);
sl@0
   148
	else
sl@0
   149
		User::Leave(KErrArgument);
sl@0
   150
#endif __MMF_USE_IPC_V2__
sl@0
   151
	}
sl@0
   152
sl@0
   153
inline void MmfMessageUtilX::WriteL(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC16& aValue)
sl@0
   154
	{
sl@0
   155
#ifdef __MMF_USE_IPC_V2__
sl@0
   156
	User::LeaveIfError(aMessage.Write(aParam, aValue));
sl@0
   157
#else
sl@0
   158
	// expect aParam to be a literal - so this code should optimise out
sl@0
   159
	if (aParam==0)
sl@0
   160
		aMessage.WriteL(aMessage.Ptr0(), aValue);
sl@0
   161
	else if (aParam==1)
sl@0
   162
		aMessage.WriteL(aMessage.Ptr1(), aValue);
sl@0
   163
	else if (aParam==2)
sl@0
   164
		aMessage.WriteL(aMessage.Ptr2(), aValue);
sl@0
   165
	else if (aParam==3)
sl@0
   166
		aMessage.WriteL(aMessage.Ptr3(), aValue);
sl@0
   167
	else
sl@0
   168
		User::Leave(KErrArgument);
sl@0
   169
#endif __MMF_USE_IPC_V2__
sl@0
   170
	}
sl@0
   171
sl@0
   172
inline TInt MmfMessageUtilX::Read(const RMmfIpcMessage& aMessage, TInt aParam, TDes16& aResult)
sl@0
   173
	{
sl@0
   174
#ifdef __MMF_USE_IPC_V2__
sl@0
   175
	return aMessage.Read(aParam, aResult);
sl@0
   176
#else
sl@0
   177
	TRAPD(error, ReadL(aMessage, aParam, aResult));
sl@0
   178
	return error;
sl@0
   179
#endif __MMF_USE_IPC_V2__
sl@0
   180
	}
sl@0
   181
sl@0
   182
inline TInt MmfMessageUtilX::Write(const RMmfIpcMessage& aMessage, TInt aParam, const TDesC16& aValue)
sl@0
   183
	{
sl@0
   184
#ifdef __MMF_USE_IPC_V2__
sl@0
   185
	return aMessage.Write(aParam, aValue);
sl@0
   186
#else
sl@0
   187
	TRAPD(error, WriteL(aMessage, aParam, aValue));
sl@0
   188
	return error;
sl@0
   189
#endif __MMF_USE_IPC_V2__
sl@0
   190
	}
sl@0
   191
sl@0
   192
sl@0
   193
sl@0
   194
#endif // __TESTFRAMEWORKIPC_INL__