examples/AppFramework/Apparc/ServerApplication/service_support/session.cpp

00001 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 //
00015 
00016 #include "session.h"
00017 #include "definitions.h"
00018 
00019 // Constructor
00020 EXPORT_C CServAppSession::CServAppSession()
00021 {
00022 }
00023 
00024 // Destructor
00025 EXPORT_C CServAppSession::~CServAppSession()
00026 {
00027 }
00028 
00029 // Implements the virtual function of the base class.
00030 // According to the service type the client requested,
00031 // the appropriate service support code is called.
00032 // In this case, where there is just one service type, the 1st argument
00033 // of the RMessage2 object is extracted and HandleDisplayMessage() method is called
00034 // to handle this argument.
00035 
00036 // In case of unidentified requested service, the ServiceL() method
00037 // of base class is called.
00038 EXPORT_C void CServAppSession::ServiceL (const RMessage2& aMessage)
00039 {
00040         TInt ret = KErrNone;
00041         switch(aMessage.Function())
00042         {
00043                 case EServAppServExample:
00044                         {
00045                         HBufC* buf;
00046                         buf = HBufC::NewLC(aMessage.GetDesLength(0));
00047                         TPtr ptr (buf->Des());
00048                         ret = aMessage.Read(0,ptr);
00049                         Display(ptr);  
00050                         CleanupStack::PopAndDestroy(buf);  //free the heap memory that was allocated with HBufC::NewLC()
00051                         }
00052                         break;
00053                 default:
00054                         {
00055                         CApaAppServiceBase::ServiceL(aMessage);
00056                         }
00057                         break;
00058         }
00059         aMessage.Complete(ret);
00060 }

Generated by  doxygen 1.6.2