harvester/blacklistclient/inc/blacklistclient.h
changeset 0 c53acadfccc6
child 10 ab88d4a85041
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 #ifndef _RBLACKLISTCLIENT_H_
       
    18 #define _RBLACKLISTCLIENT_H_
       
    19 
       
    20 // SYSTEM INCLUDE
       
    21 #include <e32base.h>
       
    22 #include <e32std.h>
       
    23 #include <f32file.h>
       
    24 
       
    25 // FORWARD DECLERATIONS
       
    26 class CBlacklistItem;
       
    27 
       
    28 /*!
       
    29   @class RBlacklistClient
       
    30   @discussion An instance of the RBlacklistClient object 
       
    31   */
       
    32 NONSHARABLE_CLASS( RBlacklistClient ) : public RSessionBase
       
    33     {
       
    34     public:
       
    35         /*!
       
    36         @function RBlacklistClient
       
    37         @discussion standard C++ constructor
       
    38         */
       
    39         IMPORT_C RBlacklistClient();
       
    40         
       
    41         /*!
       
    42         @function ~RBlacklistClient
       
    43         @discussion Destroy the object and release all memory objects
       
    44         */
       
    45         IMPORT_C ~RBlacklistClient();
       
    46             
       
    47     public: // Exported public functions
       
    48 
       
    49         /*!
       
    50         @function Connect
       
    51         @discussion Create connection to server
       
    52         @result KErrNone if connected succesfully
       
    53         */
       
    54         IMPORT_C TInt Connect();
       
    55         
       
    56         /*!
       
    57         @function IsBlacklistedL
       
    58         @discussion Destroy the object and release all memory objects.
       
    59         @result ETrue if object is blaklisted, EFalse otherwise.
       
    60         @param aUri - object uri.
       
    61         @param aMediaId - drive id where object is located (E,C ...).
       
    62         @param aLastModifiedTime - time when object is modified.
       
    63         */
       
    64         IMPORT_C TBool IsBlacklistedL( const TDesC& aUri, TUint32 aMediaId, TTime aLastModifiedTime );
       
    65         
       
    66         /*!
       
    67         @function AddL
       
    68         @discussion Add object to blacklist.
       
    69         @param aUri - object uri.
       
    70         @param aMediaId - drive id where object is located (E,C ...).
       
    71         @param aLastModifiedTime - time when object is modified.
       
    72         */
       
    73         IMPORT_C void AddL( const TDesC& aUri, TUint32 aMediaId, TTime aLastModifiedTime ) const;
       
    74         
       
    75         /*!
       
    76         @function RemoveL
       
    77         @discussion Remove object from blacklist.
       
    78         */
       
    79         IMPORT_C void RemoveL( const TDesC& aUri, TUint32 aMediaId ) const;
       
    80         
       
    81         /*!
       
    82         @function LoadBlacklistL
       
    83         @discussion Load blacklist from server.
       
    84         */
       
    85         IMPORT_C void LoadBlacklistL();
       
    86         
       
    87         /*!
       
    88         @function CloseDBL
       
    89         @discussion Closes server database. 
       
    90         */
       
    91         IMPORT_C void CloseDBL();
       
    92 
       
    93     private: // private functions
       
    94     
       
    95         /*!
       
    96         @function Version
       
    97         @discussion Returns version
       
    98         @result TVersion - Returns version of the server.
       
    99         */
       
   100         TVersion Version() const;
       
   101         
       
   102         /*!
       
   103         @function DoLoadBlacklistL
       
   104         @discussion sends request load blacklist to server.  
       
   105         @param aHandle memory handle, used to create memory chunk.
       
   106         */
       
   107         void DoLoadBlacklistL( TInt& aHandle ) const;
       
   108         
       
   109         /*!
       
   110         @function AddToMemoryTableL
       
   111         @discussion Add object to client list (not actually a memory table).
       
   112         @param aLastModifiedTime - time when object is modified.
       
   113         @param aUri - object uri.
       
   114         @param aMediaId - drive id where object is located (E,C ...).
       
   115         */
       
   116         void AddToMemoryTableL( const TInt64& aModified, const TDesC& aUri,
       
   117             const TUint32 aMediaId );
       
   118         
       
   119         /*!
       
   120         @function RemoveFromMemoryTableL
       
   121         @discussion Remove object from client list (not actually a memory table).
       
   122         @param aUri - object uri.
       
   123         @param aMediaId - drive id where object is located (E,C ...).
       
   124         */
       
   125         void RemoveFromMemoryTableL( const TDesC& aUri, const TUint32 aMediaId );
       
   126         
       
   127         /*!
       
   128         @function GetListIndex NOTE: WRONG NAMING NOT BASED S60 CODING CONVENTIONS!!!
       
   129         @discussion Returns list index.
       
   130         */
       
   131         TInt GetListIndex( const TDesC& aUri, TUint32 aMediaId );
       
   132           
       
   133         /*!
       
   134         @function RemoveFromDBL
       
   135         @discussion removes object from server's database.
       
   136         @param aUri - object uri.
       
   137         @param aMediaId - drive id where object is located (E,C ...).
       
   138         */
       
   139         void RemoveFromDBL( const TDesC& aUri, TUint32 aMediaId ) const;  
       
   140 
       
   141         /*!
       
   142         @function StartServer
       
   143         @discussion starts server.
       
   144         @result KErrNone if succesfully created.
       
   145         */
       
   146         TInt StartServer();
       
   147   
       
   148     private: // private data
       
   149        
       
   150         /*! @var iSessionOk flag to indicate if session is ok or not.*/
       
   151         TBool iSessionOk;
       
   152        
       
   153        	/*! @var iBlacklistChunk used to create global memory area.*/
       
   154        	RChunk iBlacklistChunk;
       
   155        
       
   156         /*! @var iBlacklistMemoryTable used to keep blacklisted items.*/
       
   157         RPointerArray<CBlacklistItem> iBlacklistMemoryTable;
       
   158 
       
   159     };
       
   160 
       
   161 #endif      // _RBLACKLISTCLIENT_H_   
       
   162             
       
   163