javamanager/javacaptain/extensionplugins/settingslistener/src.s60/cenreplistener.h
branchRCL_3
changeset 60 6c158198356e
equal deleted inserted replaced
59:e5618cc85d74 60:6c158198356e
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Class is used for listening changes in various Symbian Central
       
    15 *                     repository keys.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef CENREPLISTENER_H
       
    20 #define CENREPLISTENER_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <cenrepnotifyhandler.h>
       
    24 
       
    25 #include "javaosheaders.h"
       
    26 #include "settingschangeeventsprovidermessages.h"
       
    27 #include "javaruntimeprivatecrkeys.h"
       
    28 
       
    29 namespace java
       
    30 {
       
    31 namespace captain
       
    32 {
       
    33 
       
    34 class CoreInterface;
       
    35 
       
    36 OS_NONSHARABLE_CLASS(CenRepListener) :
       
    37         public CBase, public MCenRepNotifyHandlerCallback
       
    38 {
       
    39 public:
       
    40     enum TListenerType {GENERAL_LISTENER = -1};
       
    41 
       
    42     static CenRepListener* NewL(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
       
    43                                 CCenRepNotifyHandler::TCenRepKeyType aKeyType);
       
    44 
       
    45     virtual ~CenRepListener();
       
    46 
       
    47     // MCenRepNotifyHandlerCallback (only partial implementation needed here for now)
       
    48     // These handler methods must know what to do in each case, i.e
       
    49     // how to handle the change in each particular key.
       
    50     virtual void HandleNotifyString(TUint32 aKeyId, const TDesC16& aNewValue);
       
    51     virtual void HandleNotifyError(TUint32 aKeyId, TInt aError,
       
    52                                    CCenRepNotifyHandler* aHandler);
       
    53 protected:
       
    54     CenRepListener();
       
    55 
       
    56     void dispatchEvent(const std::string& aEvent,
       
    57                        const SettingsChangeEventType_t& aType) const;
       
    58 
       
    59 private:
       
    60     void ConstructL(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
       
    61                     CCenRepNotifyHandler::TCenRepKeyType aKeyType);
       
    62     void close();
       
    63     TInt mKeyType;
       
    64     CoreInterface* mCore;
       
    65     TUid mRepoId;
       
    66     CCenRepNotifyHandler* mNotifyHandler;
       
    67     CRepository* mCenRepSession;
       
    68 };
       
    69 
       
    70 } // namespace captain
       
    71 } // namespace java
       
    72 
       
    73 #endif // CENREPLISTENER_H
       
    74