hti/hti_plat/hti_api/inc/HtiDispatcherInterface.h
branchRCL_3
changeset 59 8ad140f3dd41
parent 0 a03f92240627
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:  Definition of MDispatcher interface that used
       
    15 *        to dispatch incoming messages to servers
       
    16 *        and outcoming to host client.
       
    17 *        MDispatcher* should be used by services to send outcoming
       
    18 *        messages
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 #ifndef DISPATCHERINTERFACE_H__
       
    24 #define DISPATCHERINTERFACE_H__
       
    25 
       
    26 #include <e32std.h>
       
    27 
       
    28 class CHtiMessage;
       
    29 class CConsoleBase;
       
    30 
       
    31 enum THtiMessagePriority
       
    32     {
       
    33     EHtiPriorityDefault = 0,
       
    34     EHtiPriorityData = 0,
       
    35     EHtiPriorityControl = 2
       
    36     };
       
    37 
       
    38 const TInt KErrorDescriptionMaxLength = 118;
       
    39 
       
    40 /**
       
    41 * Observer interface that should be implemented by plugin if it wants
       
    42 * to resend message failed due to KErrNoMemory.
       
    43 **/
       
    44 class MHtiMemoryObserver
       
    45     {
       
    46 public:
       
    47     /**
       
    48     *
       
    49     * This function called by the dispatcher after plug-in request
       
    50     * (@see MHtiDispatcher::AddMemoryObserver()) every time
       
    51     * when some message was removed from the outgoing queue.
       
    52     *
       
    53     * @param aAvailableMemory amount of memory currently available for
       
    54     *           outgoing messages
       
    55     **/
       
    56     virtual void NotifyMemoryChange(TInt aAvailableMemory) = 0;
       
    57     };
       
    58 
       
    59 /**
       
    60 * Interface to the HTI dispatcher used by service plug-ins for message
       
    61 * sending.
       
    62 **/
       
    63 class MHtiDispatcher
       
    64     {
       
    65 public:
       
    66 
       
    67     /**
       
    68     *
       
    69     * Send message from the service back to host client.
       
    70     * Transfer ownership of aMessage.
       
    71     * The function adds messages to the outgoing queue.
       
    72     * Message will be actualy sent later.
       
    73     * Function can return KErrNoMemory if there is not enough memory to
       
    74     * add it to the queue.
       
    75     * Plug-in use AddMemoryObserver to be notified later when memory
       
    76     * will be available to continue data transfer.
       
    77     *
       
    78     * @param aMessage contain server-specific data
       
    79     * @param aTargetServiceUid service UID
       
    80     * @param aWrappedFlag shoud set to ETrue if message should be
       
    81     *       wrapped by security manager
       
    82     * @param aPriority message priority
       
    83     *
       
    84     * @return KErrNone if message was succesfully added to the outgoing queue
       
    85     *         KErrNoMemory when there is not enough memory.
       
    86     */
       
    87     virtual TInt DispatchOutgoingMessage( TDesC8* aMessage,
       
    88                     const TUid aTargetServiceUid,
       
    89                     TBool aWrappedFlag,
       
    90                     THtiMessagePriority aPriority ) = 0;
       
    91 
       
    92     virtual TInt DispatchOutgoingMessage(TDesC8* aMessage,
       
    93                     const TUid aTargetServiceUid) = 0;
       
    94 
       
    95     virtual TInt DispatchOutgoingErrorMessage(TInt aErrorCode,
       
    96                     const TDesC8& aErrorDescription,
       
    97                     const TUid aTargetServiceUid) = 0;
       
    98     /**
       
    99     * Adds memory observer.
       
   100     *
       
   101     * @param anObserver memory observer
       
   102     */
       
   103     virtual void AddMemoryObserver(MHtiMemoryObserver* anObserver) = 0;
       
   104 
       
   105     /**
       
   106     * Removes memory observer.
       
   107     *
       
   108     * @param anObserver memory observer
       
   109     */
       
   110     virtual void RemoveMemoryObserver(MHtiMemoryObserver* anObserver) = 0;
       
   111 
       
   112     /**
       
   113     * Returns tha amount of currenly available memory for messages.
       
   114     */
       
   115     virtual TInt GetFreeMemory() = 0;
       
   116 
       
   117     /**
       
   118     * Notifis dispatcher that some async request is over.
       
   119     * Should be used when plug-in uses async services
       
   120     * and enters in a busy state (IsBusy() returns true)
       
   121     * Should be called when plug-in is able to process new messages again
       
   122     */
       
   123     virtual void Notify( TInt anError ) = 0;
       
   124 
       
   125     /*
       
   126     * Getter for the HTI console
       
   127     */
       
   128     virtual CConsoleBase* GetConsole() = 0;
       
   129 
       
   130     /*
       
   131     * Shutdown HTI and reboot the device.
       
   132     *
       
   133     * Called from service plug-ins or from EHtiReboot HtiSystem command
       
   134     */
       
   135     virtual void ShutdownAndRebootDeviceL() = 0;
       
   136     };
       
   137 
       
   138 #endif