contentcontrolsrv/ccsrvapi/inc/ccsrvapi.h
changeset 0 79c6a41cd166
child 11 bd874ee5e5e2
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2008 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 control server API definitions
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CCSRVAPI_H
       
    19 #define CCSRVAPI_H
       
    20 
       
    21 // System includes
       
    22 #include <e32base.h>
       
    23 
       
    24 // Forward declarations
       
    25 class RWriteStream;
       
    26 class RReadStream;
       
    27 
       
    28 // Constants
       
    29 
       
    30 // ----------------------------------------------------------------------------
       
    31 // Content control server IPC functions
       
    32 // ----------------------------------------------------------------------------
       
    33 enum TCcSrvIPCFunctions
       
    34     {
       
    35     ECcIPCFunctionBase = 0,
       
    36 // ----------------------------------------------------------------------------
       
    37 // RegisterProvider
       
    38 // ----------------------------------------------------------------------------
       
    39 // Purpose:
       
    40 // This request is used to register content control service provider
       
    41 // to content control server
       
    42 //
       
    43 // IPC parameters:
       
    44 // - Function: ECcReqisterProvider
       
    45 // - Arg[0]:   Provider id (in), TInt
       
    46 // - Arg[1]:   Registered provider address (out), TUint32
       
    47 // - Arg[2]:   Not used
       
    48 // - Arg[2]:   Not used
       
    49     ECcReqisterProvider = ECcIPCFunctionBase,
       
    50 // ----------------------------------------------------------------------------
       
    51 // RegisterObserver
       
    52 // ----------------------------------------------------------------------------
       
    53 // Purpose:
       
    54 // This request is used to register observer for content control service
       
    55 // provider
       
    56 //
       
    57 // IPC parameters:
       
    58 // - Function: ECcRegisterObserver
       
    59 // - Arg[0]:   Provider id (in), TInt
       
    60 // - Arg[1]:   Registered observer address (out), TUint32
       
    61 // - Arg[2]:   Not used
       
    62 // - Arg[2]:   Not used
       
    63     ECcRegisterObserver,
       
    64 // ----------------------------------------------------------------------------
       
    65 // WaitForApiReq
       
    66 // ----------------------------------------------------------------------------
       
    67 // Purpose:
       
    68 // This request is used by content control service provider to receive
       
    69 // API requests
       
    70 //
       
    71 // IPC parameters:
       
    72 // - Function: ECcWaitForApiReq
       
    73 // - Arg[0]:   Provider id (in), TInt
       
    74 // - Arg[1]:   Provider address (in), TUint32
       
    75 // - Arg[2]:   API request sender address (out), TUint32
       
    76 // - Arg[2]:   API request header buffer (out), TPtr8 pointing to 
       
    77 //             HBufC8 descriptor
       
    78     ECcWaitForApiReq,
       
    79 // ----------------------------------------------------------------------------
       
    80 // WaitForApiNtf
       
    81 // ----------------------------------------------------------------------------
       
    82 // Purpose:
       
    83 // This request is used by observer of content control service provider to
       
    84 // receive content change notifications
       
    85 //
       
    86 // IPC parameters:
       
    87 // - Function: ECcWaitForApiNtf
       
    88 // - Arg[0]:   Provider id (in), TInt
       
    89 // - Arg[1]:   Observer address (out), TUint32
       
    90 // - Arg[2]:   Provider address (out), TUint32
       
    91 // - Arg[2]:   API notification header buffer (out), TPtr8 pointing to 
       
    92 //             HBufC8 descriptor
       
    93     ECcWaitForApiNtf,
       
    94 // ----------------------------------------------------------------------------
       
    95 // ApiReq
       
    96 // ----------------------------------------------------------------------------
       
    97 // Purpose:
       
    98 // This request is used to send a API request to the content control service
       
    99 // provider
       
   100 //
       
   101 // IPC parameters:
       
   102 // - Function: ECcApiReq
       
   103 // - Arg[0]:   Provider id (in), TInt
       
   104 // - Arg[1]:   API request sender address (out), TUint32
       
   105 // - Arg[2]:   Provider sender address (out), TUint32
       
   106 // - Arg[2]:   API request buffer (in)/API response header (out), 
       
   107 //             TPtr8 pointing to HBufC8 descriptor
       
   108     ECcApiReq,
       
   109 // ----------------------------------------------------------------------------
       
   110 // ApiResp
       
   111 // ----------------------------------------------------------------------------
       
   112 // Purpose:
       
   113 // This request is used to send a API response to the API request sender
       
   114 //
       
   115 // IPC parameters:
       
   116 // - Function: ECcApiResp
       
   117 // - Arg[0]:   Provider id (in), TInt
       
   118 // - Arg[1]:   Provider address (in), TUint32
       
   119 // - Arg[2]:   API response receiver address (in), TUint32
       
   120 // - Arg[2]:   API response buffer (in), TPtr8 pointing to HBufC8 descriptor
       
   121     ECcApiResp,
       
   122 // ----------------------------------------------------------------------------
       
   123 // ApiNtf
       
   124 // ----------------------------------------------------------------------------
       
   125 // Purpose:
       
   126 // This request is used to send a API notification
       
   127 //
       
   128 // IPC parameters:
       
   129 // - Function: ECcApiNtf
       
   130 // - Arg[0]:   Provider id (in), TInt
       
   131 // - Arg[1]:   Provider address (in), TUint32
       
   132 // - Arg[2]:   API notification receiver address (in), TUint32
       
   133 // - Arg[2]:   API notification buffer (in), 
       
   134 //             TPtr8 pointing to HBufC8 descriptor
       
   135     ECcApiNtf,
       
   136 // ----------------------------------------------------------------------------
       
   137 // GetMsgData
       
   138 // ----------------------------------------------------------------------------
       
   139 // Purpose:
       
   140 // This request is used to read message data
       
   141 //
       
   142 // IPC parameters:
       
   143 // - Function: ECcGetMsgData
       
   144 // - Arg[0]:   Transaction id of a message which data is requested (in), TUint32
       
   145 // - Arg[1]:   Message data buffer (out), TPtr8 pointing to HBufC8 descriptor
       
   146 // - Arg[2]:   None
       
   147 // - Arg[2]:   None
       
   148     ECcGetMsgData,
       
   149 // ----------------------------------------------------------------------------
       
   150 // Cancel
       
   151 // ----------------------------------------------------------------------------
       
   152 // Purpose:
       
   153 // This request is used to cancel outstanding WaitForApiReq or 
       
   154 // WaitForNotification request
       
   155 //
       
   156 // IPC parameters:
       
   157 // - Function: ECcCancel
       
   158 // - Arg[0]:   Canceled IPC function (WaitForApiReq||WaitForNotification)
       
   159 // - Arg[1]:   None
       
   160 // - Arg[2]:   None
       
   161 // - Arg[2]:   None
       
   162     ECcCancel,
       
   163     ECcNotSupported
       
   164     };
       
   165 
       
   166 // ----------------------------------------------------------------------------
       
   167 // Content control server message header
       
   168 // ----------------------------------------------------------------------------
       
   169 // Items:
       
   170 // - Message id, TInt
       
   171 // - Transaction id, TInt
       
   172 // - Status, TInt
       
   173 // - Data size, TInt
       
   174 // Externalized message header size:
       
   175 const TInt KCcHeaderSize = 16;
       
   176 
       
   177 // ----------------------------------------------------------------------------
       
   178 // Content control server messages
       
   179 // ----------------------------------------------------------------------------
       
   180 enum TCcSrvMessages
       
   181     {
       
   182     ECcMessageBase = 0,
       
   183 // ----------------------------------------------------------------------------
       
   184 // RegisterObserverNtf
       
   185 // ----------------------------------------------------------------------------
       
   186 // Purpose:
       
   187 // This notification is used to inform content provider of registerd observer
       
   188 //
       
   189 // Message parameters:
       
   190 // - Message id:     EHsCcRegisterObserverNtf
       
   191 // - Transaction id: None
       
   192 // - Message data:   None
       
   193     ECcRegisterObserverNtf = ECcMessageBase,
       
   194 // ----------------------------------------------------------------------------
       
   195 // UnregisterObserverNtf
       
   196 // ----------------------------------------------------------------------------
       
   197 // Purpose:
       
   198 // This notification is used to inform content provider of unregisterd observer
       
   199 //
       
   200 // Message parameters:
       
   201 // - Message id:     EHsCcUnregisterObserverNtf
       
   202 // - Transaction id: None
       
   203 // - Message data:   None
       
   204     ECcUnregisterObserverNtf,
       
   205 // ----------------------------------------------------------------------------
       
   206 // ProviderMessageBase
       
   207 // ----------------------------------------------------------------------------
       
   208 // Purpose:
       
   209 // ProviderMessageBase is used to define the start of provider message ids
       
   210 //
       
   211     ECcProviderMessageBase
       
   212     };
       
   213 
       
   214 /**
       
   215  *  Content control server message
       
   216  *
       
   217  *
       
   218  *  @code
       
   219  *
       
   220  *  @endcode
       
   221  *
       
   222  *  @lib ccsrvapi.lib
       
   223  *  @since S60 v5.0
       
   224  */
       
   225 class CCcSrvMsg : public CBase
       
   226     {
       
   227 public: // Constructor and destructor
       
   228     /**
       
   229      * Two-phased constructor.
       
   230      */
       
   231     IMPORT_C static CCcSrvMsg* NewL();
       
   232 
       
   233     /**
       
   234      * Destructor.
       
   235      */
       
   236     ~CCcSrvMsg();
       
   237 
       
   238 private: // Constructors
       
   239     /**
       
   240      * Constructor
       
   241      */
       
   242     CCcSrvMsg();
       
   243 
       
   244     /** Second phase constructor */
       
   245     void ConstructL();
       
   246 
       
   247 
       
   248 public: // New functions
       
   249     /**
       
   250      * Returns pending request
       
   251      */
       
   252     IMPORT_C RMessage2 Message();
       
   253 
       
   254     /**
       
   255      * Stores pending request
       
   256      * @param aMessage Pending request
       
   257      */
       
   258     IMPORT_C void SetMessage( RMessage2& aMessage );
       
   259 
       
   260     /**
       
   261      * Returns message id
       
   262      */
       
   263     IMPORT_C TUint32 MsgId();
       
   264 
       
   265     /**
       
   266      * Stores message id
       
   267      * @param aMsgId Message id
       
   268      */
       
   269     IMPORT_C void SetMsgId( TUint32 aMsgId );
       
   270 
       
   271     /**
       
   272      * Returns transaction id
       
   273      */
       
   274     IMPORT_C TUint32 TrId();
       
   275 
       
   276     /**
       
   277      * Stores transaction id
       
   278      * @param aTrId Transaction id
       
   279      */
       
   280     IMPORT_C void SetTrId( TUint32 aTrId );
       
   281 
       
   282     /**
       
   283      * Returns message status
       
   284      */
       
   285     IMPORT_C TInt Status();
       
   286 
       
   287     /**
       
   288      * Stores message status
       
   289      * @param aStatus Transaction status
       
   290      */
       
   291     IMPORT_C void SetStatus( TInt aStatus );
       
   292 
       
   293     /**
       
   294      * Returns pointer to message data
       
   295      */
       
   296     IMPORT_C TPtrC8 Data();
       
   297 
       
   298     /**
       
   299      * Stores message data
       
   300      * @param aData Message data
       
   301      */
       
   302     IMPORT_C void SetData( const TDesC8& aData );
       
   303 
       
   304     /**
       
   305      * Returns message data size
       
   306      */
       
   307     IMPORT_C TInt DataSize();
       
   308 
       
   309     /**
       
   310      * Externalizes message (header and data)
       
   311      * @param aStream Write stream where message is externalized
       
   312      */
       
   313     IMPORT_C void ExternalizeL( RWriteStream& aStream );
       
   314 
       
   315     /**
       
   316      * Externalizes message header
       
   317      * @param aStream Write stream where message header is externalized
       
   318      */
       
   319     IMPORT_C void ExternalizeHeaderL( RWriteStream& aStream );
       
   320 
       
   321     /**
       
   322      * Internalizes message (header and data)
       
   323      * @param aStream Read stream where message is internalized
       
   324      */
       
   325     IMPORT_C void InternalizeL( RReadStream& aStream );
       
   326 
       
   327     /**
       
   328      * Internalizes message header
       
   329      * @param aStream Read stream where message header is internalized
       
   330      */
       
   331     IMPORT_C void InternalizeHeaderL( RReadStream& aStream );
       
   332 
       
   333     /**
       
   334      * Marshals message to a descrptor
       
   335      * @return Pointer to created descriptor
       
   336      */
       
   337     IMPORT_C HBufC8* MarshalL();
       
   338 
       
   339 private: // Data
       
   340     /**
       
   341      * Pending request
       
   342      */
       
   343     RMessage2 iMessage;
       
   344 
       
   345     /**
       
   346      * Message id
       
   347      */
       
   348     TUint32 iMsgId;
       
   349 
       
   350     /**
       
   351      * Transaction id
       
   352      */
       
   353     TUint32 iTrId;
       
   354 
       
   355     /**
       
   356      * Operation status
       
   357      */
       
   358     TInt iStatus;
       
   359 
       
   360     /**
       
   361      * Data size
       
   362      */
       
   363     TInt iDataSize;
       
   364 
       
   365     /**
       
   366      * Data
       
   367      */
       
   368     HBufC8* iData;
       
   369 
       
   370     };
       
   371 
       
   372 
       
   373 #endif // CCSRVAPI_H
       
   374 
       
   375 // End of file