phoneclientserver/phoneserver/Inc/Standard/CPhSrvSubSessionBase.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Sub Session Base.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPHSRVSUBSESSIONBASE_H
       
    20 #define CPHSRVSUBSESSIONBASE_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include "mphsrvmessageprocessor.h" 
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CPhSrvSubSessionNotifier;
       
    30 class CPhSrvSession;
       
    31 
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 *  The base class for all subsessions.
       
    37 *
       
    38 *  @since 1.0
       
    39 */
       
    40 class CPhSrvSubSessionBase : 
       
    41     public CObject, 
       
    42     public MPhSrvMessageProcessor
       
    43     {
       
    44     public:
       
    45 
       
    46         /*
       
    47         * The subsessions type.
       
    48         *
       
    49         *   EPhSrvSubSessionTypeUndefined        Undefined subsession, error.
       
    50         *   EPhSrvSubSessionTypeExternalCall     Call subsession.
       
    51         *   EPhSrvSubSessionTypeCallNotifier     CallNotifiers subsession.
       
    52         *   EPhSrvSubSessionTypeUssd             USSD subsession.
       
    53         *   EPhSrvSubSessionTypeIhf              IHF subsession.
       
    54         *   EPhSrvSubSessionTypeEmergencyNumber  Emergency number subsession.
       
    55         *   EPhSrvSubSessionTypeComHand          Command Handler subsession.
       
    56         *   EPhSrvSubSessionTypeComHandNotify    ComHand Notify subsession.
       
    57         *   EPhSrvSubSessionTypeMessenger        Messenger subsession.
       
    58         *   EPhSrvSubSessionTypeImageHandler     Image handler subsession.
       
    59         *   EPhSrvSubSessionTypeEmergencyCall    Emergency call subsession.
       
    60         */
       
    61         enum TPhSrvSubSessionType
       
    62             {
       
    63             EPhSrvSubSessionTypeUndefined = KErrNotFound,
       
    64             EPhSrvSubSessionTypeExternalCall    = 0,
       
    65             EPhSrvSubSessionTypeCallNotifier    = 1,
       
    66             EPhSrvSubSessionTypeUssd            = 2,
       
    67             EPhSrvSubSessionTypeIhf             = 3,
       
    68             EPhSrvSubSessionTypeEmergencyNumber = 4,
       
    69             EPhSrvSubSessionTypeComHand         = 5,
       
    70             EPhSrvSubSessionTypeComHandNotify   = 6,
       
    71             EPhSrvSubSessionTypeMessenger       = 7,
       
    72             EPhSrvSubSessionTypeImageHandler    = 8,
       
    73             EPhSrvSubSessionTypeEmergencyCall   = 9
       
    74 
       
    75             };
       
    76 
       
    77     public:  // Constructors and destructor
       
    78 
       
    79         /**
       
    80         * Create an instance of this class
       
    81         *
       
    82         * @param aSession The session where this subsession belongs.
       
    83         * @param aType The type of subsession that this object should represent.
       
    84         */
       
    85         CPhSrvSubSessionBase( 
       
    86             CPhSrvSession& aSession, 
       
    87             TPhSrvSubSessionType aType );
       
    88 
       
    89         /**
       
    90         * Complete construction of the subsession.
       
    91         */
       
    92         virtual void ConstructL() { }
       
    93 
       
    94 
       
    95     public: // Access
       
    96 
       
    97         /**
       
    98         * Return the owning session.
       
    99         *
       
   100         * @return A handle to the owning session.
       
   101         */
       
   102         CPhSrvSession& PhoneSession();
       
   103 
       
   104         /**
       
   105         * Return the owning session.
       
   106         *
       
   107         * @return A constant handle to the owning session.
       
   108         */
       
   109         const CPhSrvSession& PhoneSession() const;
       
   110 
       
   111         /**
       
   112         * Return the type of this sub-session object.
       
   113         *
       
   114         * @return The type of this sub-session object.
       
   115         */
       
   116         TPhSrvSubSessionType Type() const;
       
   117 
       
   118         /**
       
   119         * Return the unique handle associated with this subsession.
       
   120         *
       
   121         * @return The unique handle associated with a subsession.
       
   122         */
       
   123         TInt SubSessionUniqueHandle() const;
       
   124 
       
   125 
       
   126     public:
       
   127 
       
   128         /**
       
   129         * Writes to client address space and
       
   130         * catch bad descriptors.
       
   131         *
       
   132         * @param aMessage The client.
       
   133         * @param aPtr The location where the data is written.
       
   134         * @param aDes The data that is written.
       
   135         * @param aOffset The data location where to start the writing.
       
   136         */
       
   137         void Write( 
       
   138             const RMessage2& aMessage,
       
   139             TInt aLocation,
       
   140             const TDesC8& aDes,
       
   141             TInt aOffset = 0 );
       
   142 
       
   143         /**
       
   144         * Reads from client address space and
       
   145         * catch bad descriptors.
       
   146         *
       
   147         * @param aMessage The client.
       
   148         * @param aPtr The location where the data is read.
       
   149         * @param aDes The read data storage.
       
   150         * @param aOffset The data location where to start the reading.
       
   151         */
       
   152         void Read(
       
   153             const RMessage2& aMessage,
       
   154             TInt aLocation,
       
   155             TDes8& aDes,
       
   156             TInt aOffset = 0 );
       
   157 
       
   158 
       
   159     private: // Data
       
   160 
       
   161         // A handle to the session which owns this subsession.
       
   162         CPhSrvSession& iSession;
       
   163 
       
   164         // The type of sub-session that this object represents.
       
   165         TPhSrvSubSessionType iSubSessionType;
       
   166     };
       
   167 
       
   168 
       
   169 #endif      // CPHSRVSUBSESSIONBASE_H
       
   170 
       
   171 
       
   172 // End of File