javauis/remconobserver_akn/inc/javaremconobservable.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     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:  Java RemCon Observer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef JAVAREMCONOBSERVABLE_H
       
    20 #define JAVAREMCONOBSERVABLE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <remconcoreapitargetobserver.h>
       
    24 #include "javaremconobserver.h"
       
    25 
       
    26 class CRemConInterfaceSelector;
       
    27 class CRemConCoreApiTarget;
       
    28 
       
    29 
       
    30 /**
       
    31  * Class provides common access to CRemConInterfaceSelector for Java components
       
    32  *
       
    33  * Java RunTime needs to listen to various events like volume key press,
       
    34  * media key press and so on. For this purpose, various modules
       
    35  * in Java middleware register with CRemConCoreApiTarget to get events
       
    36  * to the observer MRemConCoreApiTargetObserver.
       
    37  * For this to happen, a target session has to be opened to RemCon,
       
    38  * which is done via CRemConInterfaceSelector::OpenTargetL(). At present,
       
    39  * whichever module wants it (say MMAPI, LCDUI etc) goes ahead and registers
       
    40  * by calling CRemConInterfaceSelector::OpenTargetL(). However when someother
       
    41  * module also calls the same, the OpenTargetL() returns KErrInUse as in
       
    42  * Java all modules are in one single process and one process can have
       
    43  * only one target session open to RemCon. This means that only one of the
       
    44  * required modules will get the events needed.
       
    45  *
       
    46  * Class provides common access to the target session to RemCon
       
    47  * which can be used by any module in Java.
       
    48  * The user of CRemConCoreApiTarget will need to use this class for the purpose
       
    49  * instead of creating themselves.
       
    50  *
       
    51  *  @lib javaremconobserver
       
    52  *  @since S60 v3.2
       
    53  */
       
    54 class CJavaRemConObservable : public CBase, public MRemConCoreApiTargetObserver
       
    55 {
       
    56 public:
       
    57 
       
    58     static CJavaRemConObservable* NewL();
       
    59 
       
    60     static CJavaRemConObservable* NewLC();
       
    61 
       
    62     virtual ~CJavaRemConObservable();
       
    63 
       
    64 public:
       
    65 
       
    66     /**
       
    67      * Add Observer
       
    68      *
       
    69      * @since S60 v3.2
       
    70      * @param aObserver Added observer, not owned
       
    71      */
       
    72     void AddObserverL(CJavaRemConObserver &aObserver);
       
    73 
       
    74     /**
       
    75      * Remove Observer
       
    76      *
       
    77      * @since S60 v3.2
       
    78      * @param aObserver Removed observer, not owned
       
    79      */
       
    80     void RemoveObserver(CJavaRemConObserver &aObserver);
       
    81 
       
    82     /**
       
    83      * Observers count
       
    84      *
       
    85      * @since S60 3.2
       
    86      */
       
    87     TInt Count();
       
    88 
       
    89 public: // From MRemConCoreApiTargetObserver
       
    90 
       
    91     void MrccatoCommand(TRemConCoreApiOperationId aOperationId,
       
    92                         TRemConCoreApiButtonAction aButtonAct);
       
    93 
       
    94     void MrccatoPlay(TRemConCoreApiPlaybackSpeed aSpeed,
       
    95                      TRemConCoreApiButtonAction aButtonAct);
       
    96 
       
    97     void MrccatoTuneFunction(TBool aTwoPart,
       
    98                              TUint aMajorChannel,
       
    99                              TUint aMinorChannel,
       
   100                              TRemConCoreApiButtonAction aButtonAct);
       
   101 
       
   102     void MrccatoSelectDiskFunction(TUint aDisk,
       
   103                                    TRemConCoreApiButtonAction aButtonAct);
       
   104 
       
   105     void MrccatoSelectAvInputFunction(TUint8 aAvInputSignalNumber,
       
   106                                       TRemConCoreApiButtonAction aButtonAct);
       
   107 
       
   108     void MrccatoSelectAudioInputFunction(TUint8 aAudioInputSignalNumber,
       
   109                                          TRemConCoreApiButtonAction aButtonAct);
       
   110 
       
   111 private:
       
   112 
       
   113     CJavaRemConObservable();
       
   114 
       
   115     void ConstructL();
       
   116 
       
   117 private: // data
       
   118 
       
   119     /**
       
   120     * Observers
       
   121     */
       
   122     RPointerArray<CJavaRemConObserver> iObservers;
       
   123 
       
   124     /**
       
   125     * Owned.
       
   126     */
       
   127     CRemConInterfaceSelector* iInterfaceSelector;
       
   128 
       
   129     /**
       
   130     * Owned by iInterfaceSelector.
       
   131     */
       
   132     CRemConCoreApiTarget* iCoreTarget;
       
   133 };
       
   134 
       
   135 
       
   136 #endif // JAVAREMCONOBSERVABLE_H