webengine/device/inc/DeviceLiwPeer.h
changeset 0 dd21522fd290
child 48 79859ed3eea9
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 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:  Liw Device Peer
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __DEVICELIWPEER_H
       
    19 #define __DEVICELIWPEER_H
       
    20 
       
    21 #include <e32std.h>
       
    22 #include <LiwCommon.h>
       
    23 #include "DeviceBinding.h"
       
    24 
       
    25 namespace KJS
       
    26     {
       
    27     class JSValue;
       
    28     class List;
       
    29     class UString;
       
    30     class ExecState;
       
    31     class ServiceEventHandler;
       
    32     class CDeviceLiwBinding;
       
    33 
       
    34     class DeviceLiwPeer : public MDevicePeer, public MLiwNotifyCallback
       
    35         {
       
    36 
       
    37         public: // constructor and destructor
       
    38 
       
    39            /**
       
    40             * Constructor
       
    41             * @return none
       
    42             * @since 5.0
       
    43             **/
       
    44             DeviceLiwPeer( ExecState* exec,
       
    45                 CDeviceLiwBinding* liwbinding, MLiwInterface* liwinterface );
       
    46 
       
    47            /**
       
    48             * Destructor
       
    49             * @return none
       
    50             * @since 5.0
       
    51             **/
       
    52             virtual ~DeviceLiwPeer();
       
    53 
       
    54         public:
       
    55 
       
    56            /**
       
    57             * Set the service name
       
    58             * @return none
       
    59             * @since 5.0
       
    60             **/
       
    61             void SetServiceNameL( ExecState* exec, const List& args );
       
    62 
       
    63            /**
       
    64             * Set the callback
       
    65             * @return none
       
    66             * @since 5.0
       
    67             **/
       
    68             virtual void InstallCallback( ServiceEventHandler* eventHandler );
       
    69 
       
    70            /**
       
    71             * toString
       
    72             * @return UString
       
    73             * @since 5.0
       
    74             **/
       
    75             UString toString( ExecState* exec );
       
    76 
       
    77            /**
       
    78             * Get the interface
       
    79             * @return MLiwInterface*
       
    80             * @since 5.0
       
    81             **/
       
    82             MLiwInterface* Interface() { return m_interface; }
       
    83 
       
    84            /**
       
    85             * Get the service name
       
    86             * @return const HBufC8*
       
    87             * @since 5.0
       
    88             **/
       
    89             const HBufC8* ServiceName() const { return m_serviceName; }
       
    90 
       
    91            /**
       
    92             * Is running callback function
       
    93             * @return bool
       
    94             * @since 5.0
       
    95             **/
       
    96             TBool IsRunningCallBack() const { return m_isRunningCallBack; }
       
    97 
       
    98         public: // From MLiwNotifyCallback
       
    99 
       
   100            /**
       
   101             * Handle invoking callback function for asynchronous calls
       
   102             * @return TInt error code
       
   103             * @since 5.0
       
   104             **/
       
   105             TInt HandleNotifyL(
       
   106                 TInt cmdId,
       
   107                 TInt eventId,
       
   108                 CLiwGenericParamList& eventParamList,
       
   109                 const CLiwGenericParamList& inParamList );
       
   110 
       
   111         private:
       
   112 
       
   113             ExecState* m_globalExecState; // Not owned
       
   114             CDeviceLiwBinding* m_binding; // Not owned
       
   115             MLiwInterface* m_interface; // Not owned, managed by LIW
       
   116             HBufC8* m_serviceName; //owned
       
   117             // a map to contain transaction ID, and event handler
       
   118             RPointerArray<ServiceEventHandler>* m_callbackArray;  // owned
       
   119             TBool m_isRunningCallBack;
       
   120         };
       
   121     }
       
   122 
       
   123 #endif //__DEVICELIWPEER_H