serviceproviders/sapi_logging/inc/logginginterface.h
changeset 19 989d2f495d90
child 33 50974a8b132e
equal deleted inserted replaced
14:a36b1e19a461 19:989d2f495d90
       
     1 /*
       
     2 * Copyright (c) 2006-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 the License "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 location SAPI core implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_LOGINTERFACE_H
       
    19 #define C_LOGINTERFACE_H
       
    20 
       
    21 #include <LiwCommon.h>
       
    22 #include "serviceerrno.h"
       
    23 
       
    24 /**
       
    25 * Forward Declarations
       
    26 */
       
    27 class CLoggingService ;
       
    28 
       
    29 /**
       
    30 * error message
       
    31 */
       
    32 
       
    33 const TInt KMaxMsgSize = 256;
       
    34 const TInt KMaxKeySize = 128;                                                                                                                                                                                                                                                                                     
       
    35 _LIT( KInvalid, "Invalid" );
       
    36 _LIT( KMissing, " Missing" );
       
    37 _LIT( KMsgErr, "Logging:");
       
    38 _LIT( KColon, ":");
       
    39 _LIT8( KErrorMessage, "ErrorMessage");
       
    40 _LIT( KErrLogCmdName, "Invalid commandName" );	
       
    41 _LIT( KErrMissingCallback, "Missing Callback" );	
       
    42 _LIT(KInterfaceMissing,"Logging: Interface name missing");
       
    43 
       
    44 
       
    45 /**
       
    46 * Content Type
       
    47 */
       
    48 _LIT(KContentType , "Log") ;
       
    49 
       
    50 /**
       
    51 * ContentType Key
       
    52 */
       
    53 _LIT8(KContentTypeKey , "Type") ;
       
    54 /**
       
    55 * Error Indntifier in Output parameter list
       
    56 */
       
    57 _LIT8(KErrorCode , "ErrorCode") ; 
       
    58 
       
    59 
       
    60 /**
       
    61 * Operations on the IDatasource(Logging) interface
       
    62 */
       
    63 _LIT8(KCmdAdd , "Add") ;
       
    64 _LIT8(KCmdDelete , "Delete") ; 
       
    65 _LIT8(KCmdGetList ,"GetList") ;
       
    66 _LIT8(KCmdRequestNotification ,"RequestNotification") ;
       
    67 _LIT8(KCmdCancel ,"Cancel") ;
       
    68 
       
    69 
       
    70 /**
       
    71 * Transaction id, which will be part of outparamlist for asynchronous request
       
    72 */
       
    73 _LIT8(KTransactionId, "TransactionID"); 
       
    74 
       
    75 /**
       
    76 * Event map that contains the details of the event to be logged 
       
    77 */
       
    78 _LIT8(KEventDetails , "Item") ;
       
    79 
       
    80 /**
       
    81 * Filter for getlist operation
       
    82 */
       
    83 _LIT8(KFilter , "Filter") ; 
       
    84 
       
    85 /**
       
    86 * DelayInterval
       
    87 */
       
    88 _LIT8(KDelayTime , "DelayTime") ;
       
    89 
       
    90 /**
       
    91 * Key for identifying the type of the event in event map
       
    92 */
       
    93 _LIT8(KEventTypeKey , "EventType") ;
       
    94 
       
    95 /**
       
    96 * Key for identifying the remote party in event map
       
    97 */
       
    98 _LIT8(KRemotePartyKey , "RemoteParty") ;
       
    99 
       
   100 /**
       
   101 * Key for identifying the direction in event map
       
   102 */
       
   103 _LIT8(KDirectionKey , "Direction") ;
       
   104 
       
   105 /**
       
   106 * Key for identifying the time in event map
       
   107 */
       
   108 _LIT8(KEventTimeKey , "EventTime") ;
       
   109 
       
   110 /**
       
   111 * Key for identifying the duration in event map
       
   112 */
       
   113 _LIT8(KEventDurationKey , "EventDuration") ;
       
   114 
       
   115 /**
       
   116 * Key for identifying the deliverystatus in event map
       
   117 */
       
   118 _LIT8(KDeliveryStatusKey , "DeliveryStatus") ;
       
   119 
       
   120 /**
       
   121 * Key for identifying the subject in event map
       
   122 */
       
   123 _LIT8(KSubjectKey , "Subject") ;
       
   124 
       
   125 /**
       
   126 * Key for identifying the phonenumber in event map
       
   127 */
       
   128 _LIT8(KPhoneNumberKey , "PhoneNumber") ;
       
   129 
       
   130 /**
       
   131 * Key for identifying the description in event map
       
   132 */
       
   133 _LIT8(KDescriptionKey , "Description") ;
       
   134 
       
   135 /**
       
   136 * Key for identifying the eventdata in event map
       
   137 */
       
   138 _LIT8(KEventDataKey , "EventData") ;
       
   139 
       
   140 /**
       
   141 * Key for identifying the link in event map
       
   142 */
       
   143 _LIT8(KLinkKey , "Link") ;
       
   144 
       
   145 /**
       
   146 * Key for the flags fields
       
   147 */
       
   148 _LIT8(KFlagsKey , "LogFlags") ;
       
   149 
       
   150 /**
       
   151 * EndTime Key, for getlist filter
       
   152 */
       
   153 _LIT8(KEndTimeKey , "EndTime") ;
       
   154 
       
   155 /**
       
   156 * Error Code
       
   157 */
       
   158 _LIT8(KErrCode , "ErrorCode") ;
       
   159 
       
   160 /**
       
   161 * Key for RecentList for Filter 
       
   162 */
       
   163 _LIT8(KRecentListKey , "RecentList") ; 
       
   164 
       
   165 /**
       
   166 * Key for id
       
   167 */
       
   168 _LIT8(KLogId , "id") ;
       
   169 
       
   170 /**
       
   171 * Key for Data Map
       
   172 */
       
   173 _LIT8(KData , "Data") ;
       
   174 
       
   175 /**
       
   176 * output returnvalue key
       
   177 */
       
   178 _LIT8(KResponse,"ReturnValue");
       
   179 
       
   180 
       
   181 /**
       
   182 * Forward declarations
       
   183 */
       
   184 class MLiwInterface ;
       
   185 class CLogIter ;
       
   186 
       
   187 /**
       
   188 * This class provides the Calendar SAPI interface to LIW Framework 
       
   189 */
       
   190 class CLoggingInterface : public CBase, public MLiwInterface
       
   191     {
       
   192     public :
       
   193 
       
   194         /**
       
   195         *Enums for position pased parsing
       
   196         */
       
   197         enum 
       
   198         {
       
   199         EIndex0 = 0 ,
       
   200         EIndex1 ,
       
   201         EIndex2 ,
       
   202         EIndex3 ,
       
   203 
       
   204         /**
       
   205         * Event Types
       
   206         */
       
   207         EKLogCallEventType  = 0,
       
   208         EKLogDataEventType , 
       
   209         EKLogFaxEventType ,
       
   210         EKLogShortMessageEventType ,
       
   211         EKLogPacketDataEventType ,
       
   212         EKEventTypeNotPresent =-1,
       
   213         /**
       
   214         * RecentList types 
       
   215         */
       
   216         EKLogNullRecentList = -1 ,
       
   217         EKLogRecentIncomingCalls = 1,
       
   218         EKLogRecentOutgoingCalls , 
       
   219         EKLogRecentMissedCalls ,
       
   220         
       
   221 
       
   222         /**
       
   223         * Event Status 
       
   224         */
       
   225 
       
   226         EStatusPending    = 0 ,                     
       
   227         EStatusSent,                    
       
   228         EStatusFalied,                  
       
   229         EStatusNone ,                  
       
   230         EStatusDone ,                  
       
   231         EStatusNotSent,                  
       
   232         EStatusScheduled,                 
       
   233         EStatusNotPresent =-1,
       
   234         /**
       
   235         * Event Flags
       
   236         */
       
   237         EKLogEventContactSearched  = 0 ,
       
   238         EKLogEventRead ,
       
   239         EFlagNotPresent =-1,
       
   240 
       
   241         /**
       
   242         * Direction flags
       
   243         */
       
   244         EIncomingEvent  = 0,
       
   245         EOutgoingEvent ,
       
   246         EIncomingEventAlternateline,                       
       
   247         EOutgoingEventAlternateline,                       
       
   248         EFetchedEvent ,                         
       
   249         EMissedEvent ,                         
       
   250         EMissedEventAlternateline,                     
       
   251         EDirectionNotPresent = -1,
       
   252         };
       
   253 
       
   254     public:
       
   255     
       
   256         /**
       
   257         * NewL: Two phased construction
       
   258         */
       
   259         static CLoggingInterface* NewL();
       
   260 
       
   261         /**
       
   262         * NewLC: Creates an instance of CLoggingServiceClass
       
   263         * Two Phased constructor
       
   264         * returns newly allocated object.
       
   265         */
       
   266         static CLoggingInterface* NewLC() ;
       
   267 
       
   268         /**
       
   269         * Destructor.
       
   270         */
       
   271         virtual ~CLoggingInterface(); 
       
   272 
       
   273         /**
       
   274         * ExecuteCmdL parses the input parameters and then calls an appropriate method on iLoggingServic
       
   275         *
       
   276         * @param aCmdName the name of the service command which the consumer wants to invoke
       
   277         * @param aInParamList the input parameter list, can be empty list
       
   278         * @param [in,out] aOutParamList the output parameter list, can be empty lis. The
       
   279         * service provider can use the output parameter list to fill in necessary return values
       
   280         * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
       
   281         * @param aCallback callback to be registered by consumer application
       
   282         *               
       
   283         * @see TLiwServiceCmdOptions
       
   284         * @see CLiwGenericParamList
       
   285         * @see MLiwNotifyCallback
       
   286         */
       
   287 
       
   288         virtual void ExecuteCmdL( const TDesC8& aCmdName,
       
   289                                   const CLiwGenericParamList& aInParamList,
       
   290                                   CLiwGenericParamList& aOutParamList,
       
   291                                   TUint aCmdOptions = 0,
       
   292                                   MLiwNotifyCallback* aCallback = 0 );
       
   293                                   
       
   294                                   
       
   295         /**
       
   296         * ConvertToSapiError function
       
   297         */                          
       
   298         static TInt ConvertToSapiError( TInt aSymbianErrorCode );
       
   299                 
       
   300         /**
       
   301         * Closes the interface 
       
   302         */
       
   303         virtual void Close();
       
   304         
       
   305     protected:
       
   306 
       
   307         /**
       
   308         * ConstructL(): Internal method to construct members
       
   309         */
       
   310         void ConstructL() ;
       
   311 
       
   312         /**
       
   313         * Default constructor
       
   314         */
       
   315         CLoggingInterface() ;
       
   316 
       
   317         /**
       
   318         * Internal CmdExecute function which parses  the input parameters
       
   319         * this function is called by ExecuteCmdL() function 
       
   320         *
       
   321         * @param aCmdName the name of the service command which the consumer wants to invoke
       
   322         * @param aInParamList the input parameter list, can be empty list
       
   323         * @param [in,out] aOutParamList the output parameter list, can be empty lis. The
       
   324         * service provider can use the output parameter list to fill in necessary return values
       
   325         * @param aCmdOptions Options for the command, see TLiwServiceCmdOptions in LiwCommon.hrh.
       
   326         * @param aCallback callback to be registered by consumer application
       
   327         * @see TLiwServiceCmdOptions
       
   328         * @see CLiwGenericParamList
       
   329         * @see MLiwNotifyCallback
       
   330         *
       
   331         */
       
   332 
       
   333         void CmdExecuteL( const TDesC8& aCmdName,
       
   334                           const CLiwGenericParamList& aInParamList ,
       
   335                           CLiwGenericParamList& aOutParamList,
       
   336                           TUint aCmdOptions,
       
   337                           MLiwNotifyCallback* aCallback );
       
   338 
       
   339         /**
       
   340         * Internal utility method, used for Add from the core class
       
   341         *
       
   342         * @param aParam, input paramater containg the eventdetails. 
       
   343         * @param aCallback, callback address for notification requests.
       
   344         * @param aTransId, transaction id.
       
   345         */
       
   346 
       
   347         TInt32 AddEventL( const TLiwGenericParam *eventdetails ,
       
   348                           TUint& aTansId ,
       
   349                           TUint aCmdOptions, 
       
   350                           MLiwNotifyCallback *aCallBack = NULL ) ; 
       
   351                     
       
   352         /**
       
   353         * Internal utility method, used to getlist from the core class
       
   354         *
       
   355         * @param aFilter, filter for getlist on core class
       
   356         * @param aIter, Valure result argument(TransactionId for async calls) 
       
   357         * @param aCallback, callback method for async events
       
   358         */
       
   359 
       
   360         CLogIter*  GetListL( const TLiwGenericParam  *aFilter  , 
       
   361                              TUint& aTransId,
       
   362                              TUint aCmdOptions,
       
   363                              MLiwNotifyCallback  *aCallBack = NULL) ; 
       
   364                       
       
   365         /**
       
   366         * Internal utility method, used for notification registration
       
   367         *
       
   368         * @param aParam, input paramater containg the delay details/
       
   369         * @param aCallback, callback address for notification requests.
       
   370         * @param aTransId, transaction id.
       
   371         */
       
   372         TInt RequestNotificationsL( const TLiwGenericParam *aParam ,
       
   373                                     MLiwNotifyCallback *aCallback ,
       
   374         		                    TUint& aTransId,
       
   375         		                    TUint aCmdOptions ) ;
       
   376 
       
   377         /**
       
   378         * Internal utility method, used for Delete from the core class
       
   379         *
       
   380         * @param aParam, input paramater containg the logid 
       
   381         * @param aCallback, callback address for notification requests.
       
   382         * @param aTransId, transaction id.
       
   383         */
       
   384         	
       
   385         TInt DeleteEventL( const TLiwGenericParam *aParam,
       
   386                            TUint& aTansId,
       
   387                            TUint aCmdOptions,
       
   388                            MLiwNotifyCallback *aCallBack = NULL );
       
   389          
       
   390         /**
       
   391         * IncorrectValueL function
       
   392         */
       
   393         void IncorrectValueL( const TDesC8* aErrorArgument );
       
   394 
       
   395         /**
       
   396         * MissingValueL function
       
   397         */ 
       
   398         void MissingValueL( const TDesC8* aErrorArgument );   
       
   399                 
       
   400         /**
       
   401         * CheckInputTypeL function
       
   402         */ 
       
   403         void CheckInputTypeL( const TLiwVariant* aSource,
       
   404                               LIW::TVariantTypeId aExpectedtype,
       
   405                               const TDesC8* aErrorArgument );  
       
   406  							
       
   407     private:
       
   408 
       
   409         /**
       
   410         * Handle to core location class for performing location operations
       
   411         */
       
   412 
       
   413         CLoggingService *iLogService ;
       
   414         
       
   415         /**
       
   416         * ErrorString
       
   417         */
       
   418 
       
   419         HBufC16* iErrorString;
       
   420 
       
   421     };
       
   422 
       
   423 
       
   424 #endif //C_LOGINTERFACE_H