os/security/authorisation/userpromptservice/examples/integration/tmsgclient/tmsgclient.cpp
Update contrib.
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
16 * No changes necessary to support User Prompt Service
22 #include "tmsgclient.h"
24 static TInt StartServer()
26 const TUidType serverUid(KNullUid,KNullUid,KMsgServerUid3);
28 TInt r=server.Create(KMsgServerImg,KNullDesC,serverUid);
32 server.Rendezvous(stat);
33 if (stat!=KRequestPending)
34 server.Kill(0); // abort startup
36 server.Resume(); // logon OK - start the server
37 User::WaitForRequest(stat); // wait for start or death
38 r=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int();
43 EXPORT_C TInt RMsgSession::Connect()
48 TVersion version(KMsgServerVersionMajor, KMsgServerVersionMinor, KMsgServerVersionBuild);
49 TInt r=CreateSession(KMsgServerName, version);
50 if (r!=KErrNotFound && r!=KErrServerTerminated)
55 if (r!=KErrNone && r!=KErrAlreadyExists)
60 EXPORT_C void RMsgSession::SendMsg(const TDesC& aTo, const TDesC& aBody, TRequestStatus& aStatus) const
63 @param aTo The recipient of the message.
64 @param aBody The message body.
65 @param aStatus The server completes this request object when it has finished handling the request.
68 aStatus = KRequestPending;
69 SendReceive(ESendMsg, TIpcArgs(&aTo, &aBody), aStatus);
72 EXPORT_C void RMsgSession::CancelSendMsg() const
74 Cancels an active call to SendMsg
77 SendReceive(ECancelSendMsg);