javaextensions/midprms_db/rmsplugin/src/rmsextensionplugin.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     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: Java Captain extension plugin for RMS
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef RMSEXTENSIONPLUGIN_H
       
    19 #define RMSEXTENSIONPLUGIN_H
       
    20 
       
    21 #include <map>
       
    22 #include <vector>
       
    23 
       
    24 #include "javaosheaders.h"
       
    25 #include "commslistener.h"
       
    26 #include "extensionplugininterface.h"
       
    27 
       
    28 namespace java
       
    29 {
       
    30 namespace rms
       
    31 {
       
    32 const int MSG_ID_RECORD_CHANGE = 1;
       
    33 const int MSG_ID_LISTENER_CHANGE = 2;
       
    34 const int MSG_ID_LISTENER_COUNT = 3;
       
    35 
       
    36 const int ADD_LISTENER = 0;
       
    37 const int REMOVE_LISTENER = 1;
       
    38 
       
    39 using namespace java::captain;
       
    40 using namespace java::comms;
       
    41 
       
    42 OS_NONSHARABLE_CLASS(RmsExtensionPlugin) : public ExtensionPluginInterface, public CommsListener
       
    43 {
       
    44 public:
       
    45     RmsExtensionPlugin();
       
    46     virtual ~RmsExtensionPlugin();
       
    47 
       
    48     // ExtensionPluginInterface methods
       
    49     virtual void startPlugin(CoreInterface* aCore);
       
    50     virtual void stopPlugin();
       
    51     virtual CommsListener* getCommsListener();
       
    52 
       
    53     // CommsListener
       
    54     virtual void processMessage(CommsMessage& aMessage);
       
    55 
       
    56 protected:
       
    57     virtual void addListener(std::string aName, int aAddress);
       
    58     virtual void removeListener(std::string aName, int aAddress);
       
    59     virtual void notifyListeners(std::string aName, CommsMessage& aMessage);
       
    60     virtual void sendListenerCount(std::string aName, CommsMessage& aSender);
       
    61     virtual CommsMessage createListenerCountMsg(std::string aName, int aCount);
       
    62     virtual int send(CommsMessage& aMessage);
       
    63 
       
    64     CoreInterface* mCore;
       
    65 
       
    66     typedef std::map< std::string, std::vector<int> > listeners_t;
       
    67     typedef listeners_t::iterator listenersIterator;
       
    68     listeners_t mListeners;
       
    69 };
       
    70 
       
    71 } // namespace rms
       
    72 } // namespace java
       
    73 
       
    74 #endif // RMSEXTENSIONPLUGIN_H
       
    75