presetserver/clientinc/psservsession.h
changeset 0 09774dfdd46b
child 12 608f67c22514
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2006-2006 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:  Represents a session with the Preset Server
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef R_RPSSERVSESSION_H
       
    20 #define R_RPSSERVSESSION_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <pscommon.h>
       
    24 
       
    25 class RPSServ;
       
    26 
       
    27 /**
       
    28  * Preset server session class.
       
    29  *
       
    30  * Provides access to the preset server for the preset interface. Each session is bound to a single preset by its id.
       
    31  */
       
    32 class RPSServSession
       
    33     {
       
    34 
       
    35 public:
       
    36 
       
    37     /**
       
    38      * Constructor.
       
    39      *
       
    40      * @param   aServ       Preset server client.
       
    41      * @param   aId         Id of the preset.
       
    42      */
       
    43     RPSServSession( RPSServ& aServ, TInt aId );
       
    44     
       
    45     /**
       
    46      * Closes the session.
       
    47      */
       
    48     void Close();
       
    49 
       
    50     /**
       
    51      * Begins a transaction.
       
    52      */
       
    53     void BeginTransactionL();
       
    54 
       
    55     /**
       
    56      * Commits the transaction.
       
    57      */
       
    58     void CommitL();
       
    59 
       
    60     /**
       
    61      * Reverts all changes done to the preset prior to a commit.
       
    62      */
       
    63     void Rollback();
       
    64 
       
    65     /**
       
    66      * Sends data to the server via the client-server IPC framework.
       
    67      * 
       
    68      * @param   aServerCommand      Server opcode to use.
       
    69      * @param   aValue              Data to write.
       
    70      */
       
    71     void SetL( TPSOpCode aServerCommand, TInt aValue );
       
    72 
       
    73     /**
       
    74      * Gets data from the server via the client-server IPC framework.
       
    75      * 
       
    76      * @param   aServerCommand      Server opcode to use.
       
    77      * @param   aValue              Data to read.
       
    78      */
       
    79     void GetL( TPSOpCode aServerCommand, TInt& aValue );
       
    80 
       
    81     /**
       
    82      * Sends data to the server via the client-server IPC framework.
       
    83      * 
       
    84      * @param   aServerCommand      Server opcode to use.
       
    85      * @param   aValue              Data to write.
       
    86      */
       
    87     void SetL( TPSOpCode aServerCommand, const TDesC8& aValue );    
       
    88     
       
    89     /**
       
    90      * Gets data from the server via the client-server IPC framework.
       
    91      * 
       
    92      * @param   aServerCommand      Server opcode to use.
       
    93      * @param   aLengthCommand      PS operation code.
       
    94      * @param   aValue              Data to read.
       
    95      */
       
    96     void GetL( TPSOpCode aServerCommand, TPSOpCode aLengthCommand, HBufC8*& aValue );
       
    97     
       
    98     /**
       
    99      * Sends data to the server via the client-server IPC framework.
       
   100      * 
       
   101      * @param   aServerCommand      Server opcode to use.
       
   102      * @param   aValue              Data to write.
       
   103      */
       
   104     void SetL( TPSOpCode aServerCommand, const TDesC& aValue );    
       
   105 
       
   106     /**
       
   107      * Gets data from the server via the client-server IPC framework.
       
   108      * 
       
   109      * @param   aServerCommand      Server opcode to use.
       
   110      * @param   aLengthCommand      PS operation code.
       
   111      * @param   aValue              Data to read.
       
   112      */
       
   113     void GetL( TPSOpCode aServerCommand, TPSOpCode aLengthCommand, HBufC*& aValue );    
       
   114 
       
   115 private:
       
   116 
       
   117     /** Preset server client. */
       
   118     RPSServ& iPresetServ;
       
   119     /** Id of the preset this session is bound to. */
       
   120     TInt iId;
       
   121 
       
   122     };
       
   123 
       
   124 #endif // R_RPSSERVSESSION_H