ncdengine/engine/inc/catalogsclientserver.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 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:   Interface MCatalogsClientServer declaration 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef M_CATALOGS_CLIENT_SERVER_H
       
    20 #define M_CATALOGS_CLIENT_SERVER_H
       
    21 
       
    22 #include <f32file.h>
       
    23 
       
    24 class TRequestStatus;
       
    25 class TDesC8;
       
    26 class TDes8;
       
    27 class HBufC8;
       
    28 
       
    29 /**
       
    30  *  An interface including message sending methods
       
    31  *
       
    32  *  This interface is used on the client side
       
    33  *  to send messages to the server side objects 
       
    34  *
       
    35  *  @lib ?library
       
    36  *  @since S60 ?S60_version *** for example, S60 v3.0
       
    37  */
       
    38 class MCatalogsClientServer
       
    39     {
       
    40 
       
    41 public:
       
    42 
       
    43     /**
       
    44      * Sends a message to a server side object
       
    45      * and waits synchronously for the reply
       
    46      *
       
    47      * @since S60 ?S60_version
       
    48      * @param aFunction the opcode specifying the requested service
       
    49      * @param aInput input data to be sent
       
    50      * @param aOutput a descriptor where the output data can be written
       
    51      *                  The maximum length of the output data must be known and
       
    52      *                  the descriptor allocated accordingly
       
    53      * @param aHandle a handle that is used to specify the receiving
       
    54      *                  object on the server side
       
    55      * @return KErrNone if successful, otherwise an error code
       
    56      */
       
    57     virtual TInt SendSync( TInt aFunction,
       
    58                            const TDesC8& aInput,
       
    59                            TDes8& aOutput,
       
    60                            TInt aHandle ) = 0;
       
    61                            
       
    62      /**
       
    63      * Sends a message to a server side object
       
    64      * and waits synchronously for the reply
       
    65      *
       
    66      * @since S60 ?S60_version
       
    67      * @param aFunction the opcode specifying the requested service
       
    68      * @param aInput input data to be sent
       
    69      * @param aOutput a descriptor where the output data can be written
       
    70      *                  The maximum length of the output data must be known and
       
    71      *                  the descriptor allocated accordingly
       
    72      * @param aHandle a handle that is used to specify the receiving
       
    73      *                  object on the server side
       
    74      * @return KErrNone if successful, otherwise an error code
       
    75      */
       
    76     virtual TInt SendSync( TInt aFunction,
       
    77                            const TDesC16& aInput,
       
    78                            TDes16& aOutput,
       
    79                            TInt aHandle ) = 0;
       
    80 
       
    81      /**
       
    82      * Sends a message to a server side object
       
    83      * and waits synchronously for the reply
       
    84      *
       
    85      * @since S60 ?S60_version
       
    86      * @param aFunction the opcode specifying the requested service
       
    87      * @param aInput input data to be sent
       
    88      * @param aOutputInt a integer where the output data can be written
       
    89      * @param aHandle a handle that is used to specify the receiving
       
    90      *                  object on the server side
       
    91      * @return KErrNone if successful, otherwise an error code
       
    92      */
       
    93     virtual TInt SendSync( TInt aFunction,
       
    94                            const TDesC16& aInput,
       
    95                            TInt& aOutputInt,
       
    96                            TInt aHandle ) = 0;    
       
    97 
       
    98      /**
       
    99      * Sends a message to a server side object
       
   100      * and waits synchronously for the reply
       
   101      *
       
   102      * @since S60 ?S60_version
       
   103      * @param aFunction the opcode specifying the requested service
       
   104      * @param aInput input data to be sent
       
   105      * @param aOutputInt a integer where the output data can be written
       
   106      * @param aHandle a handle that is used to specify the receiving
       
   107      *                  object on the server side
       
   108      * @return KErrNone if successful, otherwise an error code
       
   109      */
       
   110     virtual TInt SendSync( TInt aFunction,
       
   111                            const TDesC8& aInput,
       
   112                            TInt& aOutputInt,
       
   113                            TInt aHandle ) = 0;  
       
   114 
       
   115     /**
       
   116      * Sends a message to a server side object
       
   117      * and waits synchronously for the reply. The maximum length
       
   118      * of the output data does not have to be known beforehand. The 
       
   119      * implementing class allocates an output buffer of adequate length.
       
   120      * NOTICE: If user sends a message from the server-side with some
       
   121      *         other outcome than KErrNone, it passes through (when it is
       
   122      *         not KCatalogsErrorTooSmallDescriptor) and the
       
   123      *         output message has to be deleted after usage.
       
   124      *         If outcome is KCatalogsErrorTooSmallDescriptor, a null-pointer
       
   125      *         is received.
       
   126      * NOTICE: aOutput should be initially a NULL-pointer
       
   127      *
       
   128      * @since S60 ?S60_version
       
   129      * @param aFunction the opcode specifying the requested service
       
   130      * @param aInput input data to be sent
       
   131      * @param aOutput a reference to a pointer that points to a descriptor
       
   132      *                  that includes the output data when after the reply
       
   133      *                  is received from the server
       
   134      * @param aHandle a handle that is used to specify the receiving
       
   135      *                  object on the server side
       
   136      * @param aLength estimated maximum length of the output data. This length
       
   137      *              does not have to be known for sure when sending a message
       
   138      * @return KErrNone if successful, otherwise an error code
       
   139      */
       
   140     virtual TInt SendSyncAlloc( TInt aFunction,
       
   141                                 const TDesC8& aInput,
       
   142                                 HBufC8*& aOutput,
       
   143                                 TInt aHandle,
       
   144                                 TInt aLength ) = 0;
       
   145 
       
   146 
       
   147     /**
       
   148      * Sends a message to a server side object
       
   149      * and waits synchronously for the reply. The maximum length
       
   150      * of the output data does not have to be known beforehand. The 
       
   151      * implementing class allocates an output buffer of adequate length.
       
   152      * NOTICE: If user sends a message from the server-side with some
       
   153      *         other outcome than KErrNone, it passes through (when it is
       
   154      *         not KCatalogsErrorTooSmallDescriptor) and the
       
   155      *         output message has to be deleted after usage.
       
   156      *         If outcome is KCatalogsErrorTooSmallDescriptor, a null-pointer
       
   157      *         is received.
       
   158      * NOTICE: aOutput should be initially a NULL-pointer
       
   159      *
       
   160      * @since S60 ?S60_version
       
   161      * @param aFunction the opcode specifying the requested service
       
   162      * @param aInput input data to be sent
       
   163      * @param aOutput a reference to a pointer that points to a descriptor
       
   164      *                  that includes the output data when after the reply
       
   165      *                  is received from the server
       
   166      * @param aHandle a handle that is used to specify the receiving
       
   167      *                  object on the server side
       
   168      * @param aLength estimated maximum length of the output data. This length
       
   169      *              does not have to be known for sure when sending a message
       
   170      * @return KErrNone if successful, otherwise an error code
       
   171      */
       
   172     virtual TInt SendSyncAlloc( TInt aFunction,
       
   173                                 const TDesC16& aInput,
       
   174                                 HBufC16*& aOutput,
       
   175                                 TInt aHandle,
       
   176                                 TInt aLength ) = 0;
       
   177                                   
       
   178     
       
   179     /**
       
   180      * Sends a message to a server side object
       
   181      * and waits asynchronously for the reply. 
       
   182      *
       
   183      * @since S60 ?S60_version
       
   184      * @param aFunction the opcode specifying the requested service
       
   185      * @param aInput input data to be sent
       
   186      * @param aOutput a descriptor where the output data can be written.
       
   187      *                  The maximum length of the output data must be known and
       
   188      *                  the descriptor allocated accordingly
       
   189      * @param aHandle a handle that is used to specify the receiving
       
   190      *                  object on the server side
       
   191      * @param aStatus a request status which indicates the completion 
       
   192      *                  status of the asynchronous request.
       
   193      */
       
   194     virtual void SendAsync( TInt aFunction,
       
   195                             const TDesC8& aInput,
       
   196                             TDes8& aOutput,
       
   197                             TInt aHandle,
       
   198                             TRequestStatus& aStatus ) = 0;
       
   199     
       
   200 
       
   201     /**
       
   202      * Sends a file open message to a server side object. The server side object
       
   203      * should return an open RFile handle
       
   204      *
       
   205      * @since S60 ?S60_version
       
   206      * @param aFunction the opcode specifying the requested service
       
   207      * @param aInput input data to be sent
       
   208      * @param aOutput Open RFile
       
   209      *                
       
   210      * @param aHandle a handle that is used to specify the receiving
       
   211      *                  object on the server side
       
   212      * @param aStatus a request status which indicates the completion 
       
   213      *                  status of the asynchronous request.
       
   214      */
       
   215     virtual RFile SendSyncFileOpenL( TInt aFunction,
       
   216                                      const TDesC8& aInput,
       
   217                                      TInt aHandle ) = 0;    
       
   218 
       
   219     /**
       
   220      * Sends a message to a server side object
       
   221      * and waits asynchronously for the reply. The maximum length
       
   222      * of the output data does not have to be known beforehand. The 
       
   223      * implementing class allocates an output buffer of adequate length.
       
   224      * NOTICE: If user sends a message from the server-side with some
       
   225      *         other outcome than KErrNone, it passes through (when it is
       
   226      *         not KCatalogsErrorTooSmallDescriptor) and the
       
   227      *         output message has to be deleted after usage.
       
   228      *         If outcome is KCatalogsErrorTooSmallDescriptor, a null-pointer
       
   229      *         is received.
       
   230      * NOTICE: aOutput should be initially a NULL-pointer
       
   231      *
       
   232      * @since S60 ?S60_version
       
   233      * @param aFunction the opcode specifying the requested service
       
   234      * @param aInput input data to be sent
       
   235      * @param aOutput a reference to a pointer that points to a descriptor
       
   236      *                  that includes the output data when after the reply
       
   237      *                  is received from the server
       
   238      * @param aHandle a handle that is used to specify the receiving
       
   239      *                  object on the server side
       
   240      * @param aStatus a request status which indicates the completion 
       
   241      *                  status of the asynchronous request.
       
   242      * @param aLength estimated maximum length of the output data. This length
       
   243      *              does not have to be known for sure when sending a message
       
   244      */
       
   245     virtual void SendAsyncAlloc( TInt aFunction,
       
   246                                   const TDesC8& aInput,
       
   247                                   HBufC8*& aOutput,
       
   248                                   TInt aHandle,
       
   249                                   TRequestStatus& aStatus,
       
   250                                   TInt aLength ) = 0;
       
   251     
       
   252     /**
       
   253      * Informs ClientServer that sender has gone down and no messages
       
   254      * related to that specific sender should be completed anymore by
       
   255      * ClientServer. ClientServer still expects that the messages that
       
   256      * were sent from the sender are completed by the receiver on the
       
   257      * server side.
       
   258      *
       
   259      * @notice aStatus has to be the same TRequestStatus that was given
       
   260      *         when sending the message. Comparation is done simply by
       
   261      *         comparing the addresses of TRequestStatus given now and
       
   262      *         TRequestStatuses given during message sends.
       
   263      *
       
   264      * @since S60 ?S60_version
       
   265      * @param aStatus TRequestStatus that identifies the sender whose
       
   266      *                messages should not be completed anymore.
       
   267      *
       
   268      */
       
   269     virtual void AsyncMessageSenderDown( TRequestStatus& aStatus ) = 0;
       
   270 
       
   271     };
       
   272 
       
   273 
       
   274 #endif // M_CATALOGS_CLIENT_SERVER_H