phoneclientserver/phoneserver/Inc/Messenger/CPhSrvSubSessionMessenger.h
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:15:03 +0100
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Subsession for Messenger.
*
*/

#ifndef CPHSRVSUBSESSIONMESSENGER_H
#define CPHSRVSUBSESSIONMESSENGER_H


// INCLUDES
#include "CPhSrvSubSessionBase.h"
#include <CPhCltMessenger.h>

// FORWARD DECLARATIONS
class MPhSrvMessengerNegotiator;



// CLASS DECLARATION

/**
*  Messenger Subsession.
*
*  @since 2.6
*/
class CPhSrvSubSessionMessenger
:   public CPhSrvSubSessionBase
    {
    public:  // Constructors and destructor

        /**
        * Two-phased constructor.
        * 
        * @param aSession The pre-opened Phone Server session.
        * @return CPhSrvSubSessionMessenger subsession.
        */
        static CPhSrvSubSessionBase* NewL(
            CPhSrvSession& aSession );

        /**
        * Destructor.
        *
        */
        ~CPhSrvSubSessionMessenger();


    private: // Functions from base classes   

        /**
        * @see MPhSrvMessageDecoder
        */
        TBool PhSrvMessageDecoderCanProcessMessage( TInt aFunction );

        /**
        * @see MPhSrvMessageProcessor
        */
        void PhSrvMessageProcessorHandleMessageL( const RMessage2& aMessage );


    private: // SubSession function handlers

        /**
        * Handle the close command.
        * 
        * @param aMessage The received message.
        */
        void CmdSubSessionClose( const RMessage2& aMessage );

        /**
        * Handle the construct command.

        */
        void CmdSubSessionMessengerConstructL( const RMessage2& aMessage );

        /**
        * Handle the receive command.
        */
        void CmdSubSessionMessengerReceive( const RMessage2& aMessage );

        /**
        * Handle the send command.
        * 
        * @param aMessage The received message.
        */
        void CmdSubSessionMessengerSend( const RMessage2& aMessage );

        /**
        * Handle the skip command.
        * 
        * @param aMessage The received message.
        */
        void CmdSubSessionMessengerSkip( const RMessage2& aMessage );

        /**
        * Handle the cancel command.
        * 
        * @param aMessage The received message.
        */
        void CmdSubSessionMessengerCancel( const RMessage2& aMessage );


    private: // Helper functions.

        /**
        * Returns the Messenger negotiator.
        * 
        * @return Messenger negotiator.
        */
        MPhSrvMessengerNegotiator& GetMessengerNegotiator();

        /**
        * Forwards the request to messenger negotiator.
        * 
        * @param aSubSession Subsession for messenger.
        * @param aParameters The request parameters.
        * @param aMessage The received message.
        */
        void ForwardRequest(
            CPhSrvSubSessionBase& aSubSession,
            const TPhCltMessengerParameters& aParameters,
            const RMessage2& aMessage );

        /**
        * Cleans the negotiator side.
        */
        void Clean();


    private: 

        /**
        * Constructor.
        *
        * @param aSession The session where this subsession belongs.
        */
        CPhSrvSubSessionMessenger( CPhSrvSession& aSession );

    };

#endif // CPHSRVSUBSESSIONMESSENGER_H


// End of File