hti/hti_plat/hti_api/inc/HtiCommPluginInterface.h
changeset 38 169364e7e4b4
parent 34 7259cf1302ad
child 45 185201be11b0
equal deleted inserted replaced
34:7259cf1302ad 38:169364e7e4b4
     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 communication plugins.
       
    15 *        Implementation is constructed by matching string.
       
    16 *        The default implementation is FBus plugin.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef HTICOMMPLUGININTERFACE_H__
       
    22 #define HTICOMMPLUGININTERFACE_H__
       
    23 
       
    24 #include <ecom/ecom.h>
       
    25 
       
    26 #ifndef __WINS__
       
    27 _LIT8( KCommDefaultImplementation, "USBSERIAL" );
       
    28 #else
       
    29 _LIT8( KCommDefaultImplementation, "SERIAL" );
       
    30 #endif
       
    31 
       
    32 const TUid KHTICommInterfaceUid = { 0x1020DEB8 };
       
    33 
       
    34 /**
       
    35 *  Completion code for Receive() and Send(), when underlying communication
       
    36 *  module has reinitialized, i.e. cancelled any send and receive operations.
       
    37 */
       
    38 const TInt KErrComModuleReset = 100;
       
    39 
       
    40 
       
    41 class CHTICommPluginInterface : public CBase
       
    42     {
       
    43 public: //ECom specific methods (implemented as inline)
       
    44 
       
    45     /**
       
    46     * Wraps ECom object instantitation
       
    47     * default resovler is used.
       
    48     * Plug-in specified by KCommDefaultImplementation
       
    49     * is loaded.
       
    50     */
       
    51     static CHTICommPluginInterface* NewL();
       
    52 
       
    53     /**
       
    54     * Wraps ECom object instantitation
       
    55     * default resovler is used
       
    56     *
       
    57     * @param aMatchString plug-in name as specified in
       
    58     *        in plug-in implementation resource file
       
    59     */
       
    60     static CHTICommPluginInterface* NewL(const TDesC8& aMatchString);
       
    61 
       
    62     /**
       
    63     * Wraps ECom object destruction
       
    64     */
       
    65     virtual ~CHTICommPluginInterface();
       
    66 
       
    67 
       
    68 public: //Service plugin interface methods
       
    69 
       
    70     /**
       
    71     * Receive a message to the provided descriptor.
       
    72     * It is possible that the descriptor will not be full on request
       
    73     *   complition.
       
    74     *
       
    75     * @param aMessage Buffer for receiving incoming message
       
    76     * @param aStatus AO's status
       
    77     */
       
    78     virtual void Receive( TDes8& aMessage, TRequestStatus& aStatus ) = 0;
       
    79 
       
    80     /**
       
    81     * Send a message.
       
    82     *
       
    83     * @param aMessage Buffer with data for sending
       
    84     * @param aStatus AO's status
       
    85     */
       
    86     virtual void Send(const TDesC8& aMessage, TRequestStatus& aStatus ) = 0;
       
    87 
       
    88     /**
       
    89     * Cancels receive operation
       
    90     */
       
    91     virtual void CancelReceive() = 0;
       
    92     /**
       
    93     * Cancels send operation
       
    94     */
       
    95     virtual void CancelSend() = 0;
       
    96 
       
    97     /**
       
    98     *   Retruns the size of a buffer used for
       
    99     *   Send() function.
       
   100     **/
       
   101     virtual TInt GetSendBufferSize() = 0;
       
   102 
       
   103     /**
       
   104     *   Retruns the size of a buffer used for
       
   105     *   Receive() function.
       
   106     **/
       
   107     virtual TInt GetReceiveBufferSize() = 0;
       
   108 
       
   109 private:
       
   110     /**
       
   111     * Instance identifier key
       
   112     */
       
   113     TUid iDtor_ID_Key;
       
   114     };
       
   115 
       
   116 #include <HtiCommPluginInterface.inl>
       
   117 
       
   118 #endif