presetserver/clientinc/psserv.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:  Header file for RPSServ
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef R_RPSSERV_H
       
    20 #define R_RPSSERV_H
       
    21 
       
    22 #include <pscommon.h>
       
    23 #include <s32mem.h>
       
    24 
       
    25 class CPSPresetInterface;
       
    26 
       
    27 /**
       
    28  * Represents a session with the preset server.
       
    29  *
       
    30  * All communication with the server is done via this class.
       
    31  */
       
    32 NONSHARABLE_CLASS( RPSServ ) : public RSessionBase
       
    33     {
       
    34 
       
    35     friend class RPSServNotifier;
       
    36     friend class RPSServSession;
       
    37 
       
    38 public:
       
    39 
       
    40     /**
       
    41      * Constructor.
       
    42      */
       
    43     IMPORT_C RPSServ();
       
    44 
       
    45     /**
       
    46      * Connects the session to the preset server.
       
    47      *
       
    48      * @return  Any of the standard system error codes.
       
    49      */
       
    50     IMPORT_C TInt Connect();
       
    51     
       
    52     /**
       
    53      * Closes the session.
       
    54      */
       
    55     IMPORT_C void Close();
       
    56     
       
    57     /**
       
    58      * Creates a preset.
       
    59      *
       
    60      * If a preset with the supplied index and data handler exists, the call will leave with <code>KErrAlreadyExists</code>.
       
    61      *
       
    62      * @param   aIndex          Index of the preset.
       
    63      * @param   aDataHandler    Data handler of the preset.
       
    64      * @return  The newly created preset, ownership is transferred to the caller.
       
    65      */
       
    66     IMPORT_C CPSPresetInterface* CreatePresetL( TInt aIndex, TUid aDataHandler );
       
    67     
       
    68     /**
       
    69      * Opens a preset.
       
    70      *
       
    71      * If a preset with the specified id does not exist, the call will leave with <code>KErrNotFound</code>.
       
    72      *
       
    73      * @param   aId     Id of the preset to open.
       
    74      * @return  The opened preset, ownership is transferred to the caller.
       
    75      */
       
    76     IMPORT_C CPSPresetInterface* OpenPresetL( TInt aId );            
       
    77 
       
    78     /**
       
    79      * Deletes a preset.
       
    80      *
       
    81      * @param   aId     Id of the preset to delete.
       
    82      */
       
    83     IMPORT_C void DeletePresetL( TInt aId );
       
    84     
       
    85     /**
       
    86      * Moves a preset.
       
    87      *
       
    88      * If a preset with the specified id does not exist, the call will leave with <code>KErrNotFound</code>.
       
    89      *
       
    90      * @param   aId                 Id of the preset to move.
       
    91      * @param   aDestinationIndex   Index to move the preset to.
       
    92      */
       
    93     IMPORT_C void MovePresetL( TInt aId, TInt aDestinationIndex );
       
    94 
       
    95     /**
       
    96      * Gets a list of all presets.
       
    97      *
       
    98      * The presets can then be casted to their respective types by using the CPSPresetInterface::DataHandler() method.
       
    99      *
       
   100      * @param   aPresets    On return, will contain a list of all presets.
       
   101      */
       
   102     IMPORT_C void GetPresetsL( RPointerArray<CPSPresetInterface>& aPresets );
       
   103     
       
   104     /**
       
   105      * Gets a list of all presets matching the specified data handler.
       
   106      *
       
   107      * @param   aPresets        On return, will contain a list of all presets matching the specified data handler.
       
   108      * @param   aDataHandler    Data handler of the presets.
       
   109      */
       
   110     template <typename T>
       
   111     void GetPresetsL( RPointerArray<T>& aPresets, TUid aDataHandler );
       
   112 
       
   113 private:
       
   114 
       
   115     /** Reserved. */
       
   116     TInt iReserved[2];
       
   117 
       
   118     };
       
   119 
       
   120 #include <psserv.inl>
       
   121 
       
   122 #endif // R_RPSSERV_H