contentstorage/caclient/s60/inc/caclientsession.h
changeset 60 f62f87b200ec
equal deleted inserted replaced
4:1a2a00e78665 60:f62f87b200ec
       
     1 /*
       
     2  * Copyright (c) 2007 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 : Content Arsenal client session
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef CACLIENTSESSION_H
       
    19 #define CACLIENTSESSION_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "caoperationparams.h"
       
    25 #include "casrvdef.h"
       
    26 
       
    27 //FORWARD DECLARATIONS
       
    28 class CCaInnerEntry;
       
    29 class CCaInnerQuery;
       
    30 class RCaEntriesArray;
       
    31 class RCaIdsArray;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 /**
       
    35  * Client-side interface to Content Arsenal Server
       
    36  *
       
    37  * This class provides the client-side interface to the content arsenal server
       
    38  * session, it just passes requests to the server.
       
    39  *
       
    40  */
       
    41 class RCaClientSession: public RSessionBase
       
    42     {
       
    43 public:
       
    44 
       
    45     /**
       
    46      * Construct the object.
       
    47      */
       
    48     RCaClientSession();
       
    49 
       
    50     /**
       
    51      * Connects to the server and create a session.
       
    52      * @return error code
       
    53      */
       
    54     TInt Connect();
       
    55 
       
    56     /**
       
    57      * Starts the server if it is not running.
       
    58      * @return error code
       
    59      */
       
    60     TInt StartServer();
       
    61 
       
    62     /**
       
    63      * Create subsession.
       
    64      * @return error code
       
    65      */
       
    66     TInt Create( TInt aFunction, const TIpcArgs& aArgs );
       
    67 
       
    68     /**
       
    69      * Closes session
       
    70      *
       
    71      * @since S60 v 5.0
       
    72      */
       
    73     void Close();
       
    74 
       
    75     /**
       
    76      * Return version information
       
    77      */
       
    78     TVersion Version() const;
       
    79 
       
    80     /*
       
    81      * Gets entries list
       
    82      * @param aQuery query
       
    83      * @param aResult contains operation result
       
    84      */
       
    85     void GetListL( const CCaInnerQuery& aQuery, RCaEntriesArray& aResult );
       
    86 
       
    87     /*
       
    88      * Gets entries ids list
       
    89      * @param aQuery query
       
    90      * @param aResult contains operation result
       
    91      */
       
    92     void GetEntryIdsL( const CCaInnerQuery& aQuery, RCaIdsArray& aResult );
       
    93 
       
    94     /*
       
    95      * Adds entry to a storage
       
    96      * @param aEntry input entry
       
    97      * @param aResult output entry
       
    98      */
       
    99     void AddL( CCaInnerEntry& aEntry );
       
   100 
       
   101     /*
       
   102      * Removes entry from a storage
       
   103      * @param aEntries array containing entries ids
       
   104      */
       
   105     void RemoveL( const RCaIdsArray& aEntries );
       
   106 
       
   107     /*
       
   108      * Organizes entries in a storage
       
   109      * @param aEntries array containing entires to organize
       
   110      * @param aParams operation parameters
       
   111      */
       
   112     void OrganizeL( const RCaIdsArray& aEntries,
       
   113             TCaOperationParams aParams );
       
   114 
       
   115     /*
       
   116      * Touch operation for entry in storage
       
   117      * @param aEntry entry to be touched
       
   118      */
       
   119     void TouchL( const CCaInnerEntry& aEntry );
       
   120     
       
   121     /*
       
   122      * Custom sort in a storage.
       
   123      * @param aEntries array containing entries ids.
       
   124      * @param aGroupId The group Id to custom sort.
       
   125      */
       
   126     void CustomSortL( const RCaIdsArray& aEntries, const TInt aGroupId );
       
   127 
       
   128 private:
       
   129 
       
   130     /*
       
   131      * Gets operation result
       
   132      * @param aSize size of descriptor
       
   133      * @param aRequest server request
       
   134      * @param aObject object to store result
       
   135      */
       
   136     template<typename SerializableObject>
       
   137     TInt GetResultL( TInt aSize, TCaServerRequests aRequest,
       
   138             SerializableObject& aObject );
       
   139 
       
   140     /*
       
   141      * GetSizeL method
       
   142      * Return error
       
   143      * @param aQuery query
       
   144      * @param aServerRequest
       
   145      * @param aResultSize
       
   146      */
       
   147     TInt GetSizeL( const CCaInnerQuery& aQuery,
       
   148             const TCaServerRequests aServerRequest, TInt& aResultSize );
       
   149     };
       
   150 
       
   151 #endif // CACLIENTSESSION_H
       
   152 // End of File