testexecmgmt/ucc/Source/Uccs.v2/DeviceControlChannel/CUCCSCommandProtocol.h
changeset 0 3da2a79470a7
equal deleted inserted replaced
-1:000000000000 0:3da2a79470a7
       
     1 /*
       
     2 * Copyright (c) 2005-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:  
       
    15 * CUCCSCommandProtocol Class
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef _CUCCSCommandProtocol_H
       
    22 #define _CUCCSCommandProtocol_H
       
    23 
       
    24 /*****************************************************************************
       
    25  *
       
    26  * System Includes 
       
    27  *
       
    28  ****************************************************************************/
       
    29 
       
    30 /*****************************************************************************
       
    31  *
       
    32  * Local Includes
       
    33  *
       
    34  ****************************************************************************/
       
    35 #include "../Core/UCCS_Interfaces.h"
       
    36 #include "CSerialPort.h"
       
    37 #include "CConsolePort.h"
       
    38 #include "CTcpPort.h"
       
    39 #include "CProtocolTypes.h"
       
    40 
       
    41 /*****************************************************************************
       
    42  *
       
    43  *  Types
       
    44  *
       
    45  ****************************************************************************/
       
    46 typedef enum {
       
    47 	TCP_SUCCESS,
       
    48 	TCP_ERRCREATINGBUFFER,
       
    49 	TCP_ERRRECVINGBYTES,
       
    50 	TCP_ERRSENDINGBYTES,
       
    51 	TCP_INVALIDCMDID,
       
    52 	TCP_INVALIDTRANSPORT,
       
    53 	TCP_FAILEDTOOPENPORT,
       
    54 	TCP_FAILED
       
    55 } TCPError;
       
    56 
       
    57 #define KMAXPORTNAME	64
       
    58 #define KMAXFRAMESIZE 1024
       
    59 
       
    60 /*****************************************************************************
       
    61  *
       
    62  * Class Definition
       
    63  *
       
    64  ****************************************************************************/
       
    65 class CUCCSCommandProtocol
       
    66 {
       
    67 public:
       
    68 	CUCCSCommandProtocol();
       
    69 	~CUCCSCommandProtocol();
       
    70 	
       
    71 	TCPError initialise(TRemoteControlTransport aTransport, char* aRemoteHost, IOutput* aOutput);
       
    72 	TCPError disconnect();				
       
    73 	
       
    74 	TCPError sendReply( TPCommand aCommand, int aDataSize, void* aData );
       
    75 	TCPError receiveMessage( TPCommand* aCommand, int* aDataLength, void* aData );
       
    76 
       
    77 private:
       
    78 	bool isValidCMDID(TPCommand aCommand);
       
    79 
       
    80 	CSerialPort iSerialPort;
       
    81 	CConsolePort iConsolePort;
       
    82 	CTcpPort iTcpPort;
       
    83 	IPort* iPort;
       
    84 	IOutput* iOutput;
       
    85 	int iRand_UID;						// The last recieved UID
       
    86 	char iRemoteHost[KMAXPORTNAME];
       
    87 	char iFrame[KMAXFRAMESIZE];
       
    88 };
       
    89 
       
    90 #endif