sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\misc\t_asid.cpp sl@0: // sl@0: // sl@0: #define __E32TEST_EXTENSION__ sl@0: #include sl@0: #include "t_asid.h" sl@0: #include "d_asid.h" sl@0: sl@0: RTest test(_L("T_ASID_DUMMY")); sl@0: sl@0: class RAsidSession : RSessionBase sl@0: { sl@0: public: sl@0: TInt CreateSession(const TDesC& aServerName, TInt aMsgSlots) sl@0: { sl@0: return RSessionBase::CreateSession(aServerName,User::Version(),aMsgSlots); sl@0: } sl@0: TInt PublicSendReceive(TInt aFunction, const TIpcArgs &aPtr) sl@0: { sl@0: return (SendReceive(aFunction, aPtr)); sl@0: } sl@0: TInt PublicSend(TInt aFunction, const TIpcArgs &aPtr) sl@0: { sl@0: return (Send(aFunction, aPtr)); sl@0: } sl@0: }; sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: sl@0: TUint len = User::CommandLineLength(); sl@0: if (len > 0) sl@0: { sl@0: HBufC* buf = HBufC::New(len); sl@0: test(buf != NULL); sl@0: TPtr ptr = buf->Des(); sl@0: User::CommandLine(ptr); sl@0: sl@0: if (ptr == KAsidIpcServerName) sl@0: { sl@0: TUint8 array[KAsidDesLen]; sl@0: memset(array, KAsidValue, KAsidDesLen); sl@0: TPtr8 buf(array, KAsidDesLen, KAsidDesLen); sl@0: sl@0: RAsidSession session; sl@0: test_KErrNone(session.CreateSession(KAsidIpcServerName, 1)); sl@0: sl@0: test_KErrNone(session.PublicSendReceive(EIpcData, TIpcArgs(&buf))); sl@0: test_KErrNone(session.PublicSend(EIpcData, TIpcArgs(&buf))); sl@0: // Just exit badly, i.e. without disconnecting... sl@0: } sl@0: else if (ptr == KAsidDesServerName) sl@0: { sl@0: TUint8 array[KAsidDesLen]; sl@0: memset(array, KAsidValue, KAsidDesLen); sl@0: TPtr8 buf(array, KAsidDesLen, KAsidDesLen); sl@0: sl@0: // Get the current thread pointer to pass to server. sl@0: TAny* threadPtr; sl@0: RAsidLdd asidLdd; sl@0: test_KErrNone(asidLdd.Open()); sl@0: test_KErrNone(asidLdd.GetCurrentThread(threadPtr)); sl@0: sl@0: RAsidSession session; sl@0: test_KErrNone(session.CreateSession(KAsidDesServerName, 1)); sl@0: sl@0: test_KErrNone(session.PublicSendReceive(EDesData, TIpcArgs((TAny*)&buf, threadPtr))); sl@0: test_KErrNone(session.PublicSend(EDesData, TIpcArgs((TAny*)&buf, threadPtr))); sl@0: // Just exit badly, i.e. without disconnecting... sl@0: } sl@0: sl@0: } sl@0: sl@0: return KErrNone; sl@0: }