hti/HtiCommPlugins/HtiIPCommPlugin/inc/HtiIPCommEcomPlugin.h
changeset 36 813b186005b6
parent 30 86a2e675b80a
child 41 838cdffd57ce
equal deleted inserted replaced
30:86a2e675b80a 36:813b186005b6
     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:  ECOM plugin to communicate over IP port
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CHTIIPCOMMECOMPLUGIN_H
       
    20 #define CHTIIPCOMMECOMPLUGIN_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <HtiCommPluginInterface.h> // defined in HtiFramework project
       
    25 #include "HtiIPCommServerClient.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 
       
    29 // CLASS DECLARATION
       
    30 /**
       
    31 * ECOM plugin module for communicating with PC using IP port.
       
    32 *
       
    33 */
       
    34 class CHtiIPCommEcomPlugin :
       
    35     public CHTICommPluginInterface
       
    36     {
       
    37 public:
       
    38 
       
    39     /**
       
    40     * Create instance of plugin.
       
    41     * Reads configuration, opens and initializes IP connection.
       
    42     * @return Plugin instance.
       
    43     */
       
    44     static CHtiIPCommEcomPlugin* NewL();
       
    45 
       
    46     /**
       
    47     * Destructor.
       
    48     */
       
    49     ~CHtiIPCommEcomPlugin();
       
    50 
       
    51 public: // Interface implementation
       
    52 
       
    53     /**
       
    54     * Receive data from IP port.
       
    55     * The size of supplied buffer must equal to size given
       
    56     * by GetReceiveBufferSize.
       
    57     * The number of received bytes may be anything between 1
       
    58     * and GetReceiveBufferSize.
       
    59     *
       
    60     * @param aRawdataBuf Buffer where the result is written
       
    61     * @param aStatus Request status
       
    62     */
       
    63     void Receive( TDes8& aRawdataBuf, TRequestStatus& aStatus );
       
    64 
       
    65     /**
       
    66     * Send data to IP port. The size of data must not
       
    67     * exceed GetSendBufferSize.
       
    68     * @param aRawdataBuf Buffer where the data is read from.
       
    69     * @param aStatus Request status
       
    70     */
       
    71     void Send( const TDesC8& aRawdataBuf, TRequestStatus& aStatus );
       
    72 
       
    73     /**
       
    74     * Cancel read operation
       
    75     */
       
    76     void CancelReceive();
       
    77 
       
    78     /**
       
    79     * Cancel send operation
       
    80     */
       
    81     void CancelSend();
       
    82 
       
    83     /**
       
    84      *  Return required buffer size for Send operation.
       
    85      */
       
    86     TInt GetSendBufferSize();
       
    87 
       
    88     /**
       
    89      *  Return required buffer size for Receive operation.
       
    90      */
       
    91     TInt GetReceiveBufferSize();
       
    92 
       
    93 private:
       
    94 
       
    95     /**
       
    96     * Constructor of this plugin.
       
    97     */
       
    98     CHtiIPCommEcomPlugin();
       
    99 
       
   100     /**
       
   101     * Second phase construction.
       
   102     */
       
   103     void ConstructL();
       
   104 
       
   105     /**
       
   106     * Load configuration file.
       
   107     */
       
   108     void LoadConfigL();
       
   109 
       
   110 private: // Data
       
   111     RHtiIPCommServer iHtiIPCommServer;
       
   112     };
       
   113 
       
   114 #endif // CHTIIPCOMMECOMPLUGIN_H