hti/hti_plat/hti_api/inc/HtiServicePluginInterface.h
branchRCL_3
changeset 59 8ad140f3dd41
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     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:  Interface defenition for HTI services
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SERVICEPLUGININTERFACE_H__
       
    20 #define SERVICEPLUGININTERFACE_H__
       
    21 
       
    22 #include <ecom/ecom.h>
       
    23 
       
    24 #include <HtiDispatcherInterface.h>
       
    25 
       
    26 const TUid KHTIServiceInterfaceUid = {0x1020DEB7};
       
    27 
       
    28 
       
    29 class CHTIServicePluginInterface : public CBase, public MHtiMemoryObserver
       
    30     {
       
    31 public: //ECom specific methods (implemented as inline)
       
    32 
       
    33     /**
       
    34     * Wraps ECom object instantitation
       
    35     * plug-in loaded by its UID
       
    36     *
       
    37     * @param aUID service plugin implementation UDI
       
    38     */
       
    39     static CHTIServicePluginInterface* NewL(const TUid aUID);
       
    40 
       
    41     /**
       
    42     * Wraps ECom object instantitation
       
    43     * default resovler is used
       
    44     *
       
    45     * @param aMatchString service plugin name
       
    46     */
       
    47     static CHTIServicePluginInterface* NewL(const TDesC8& aMatchString);
       
    48 
       
    49     /**
       
    50     * Wraps ECom object destruction
       
    51     */
       
    52     virtual ~CHTIServicePluginInterface();
       
    53 
       
    54 public: //Comm plugin interface methods
       
    55 
       
    56     /**
       
    57     * This method is called by framework after the plugin was loaded and
       
    58     * iDispatcher set.
       
    59     */
       
    60     virtual void InitL(){};
       
    61 
       
    62     /**
       
    63     * Result indicates eiterh plug-in is able to process request
       
    64     * (e.g. a plug-in doesn't have an outstanding request to async service).
       
    65     * Framework calls this method before calling ProcessMessageL().
       
    66     * If plug-in is busy, request will be dispatched later.
       
    67     * Typically, AO's CActive::IsActive() can be used
       
    68     * in a overriden implementation.
       
    69     * Default implementation returns EFalse.
       
    70     */
       
    71     virtual TBool IsBusy();
       
    72 
       
    73     /**
       
    74     * Interface service
       
    75     * implementation of service, should return ASAP.
       
    76     * aMessage contan is service specific.
       
    77     *
       
    78     * @param aMessage message body destinated to a servive
       
    79     * @param aPriority message priority
       
    80     */
       
    81     virtual void ProcessMessageL(const TDesC8& aMessage,
       
    82                                 THtiMessagePriority aPriority) = 0;
       
    83 
       
    84     virtual void Error(TInt /*aErrorCode*/, const TDesC8& /*aErrorDescription*/){};
       
    85 
       
    86     /**
       
    87     * Set dispatcher that used by services to send messages.
       
    88     *
       
    89     */
       
    90     virtual void SetDispatcher(MHtiDispatcher* aDispatcher);
       
    91 
       
    92 public: //from MHtiMemoryObserver
       
    93     /**
       
    94     * Empty implementation.
       
    95     */
       
    96     virtual void NotifyMemoryChange(TInt /*aAvailableMemory*/){};
       
    97 
       
    98 protected:
       
    99     /**
       
   100     * Pointer to a dispatcher. It is not availble during construction.
       
   101     * If it should be used before starting process messages, InitL()
       
   102     * must be overriden.
       
   103     */
       
   104     MHtiDispatcher* iDispatcher;
       
   105 
       
   106 private:
       
   107     /**
       
   108     * Instance identifier key
       
   109     */
       
   110     TUid iDtor_ID_Key;
       
   111     };
       
   112 
       
   113 #include <HtiServicePluginInterface.inl>
       
   114 
       
   115 #endif