connectivity/com.nokia.tcf/native/TCFNative/TCFCommSerial/RealSerialComm.h
changeset 60 9d2210c8eed2
child 366 b054461d2f85
equal deleted inserted replaced
59:c892c53c664e 60:9d2210c8eed2
       
     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 the License "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 *
       
    16 */
       
    17 // RealSerialComm.h: interface for the CRealSerialComm class.
       
    18 //
       
    19 //////////////////////////////////////////////////////////////////////
       
    20 
       
    21 #if !defined(AFX_REALSERIALCOMM_H__B20F73BE_260A_4A99_B7F5_E4F7C42FE05F__INCLUDED_)
       
    22 #define AFX_REALSERIALCOMM_H__B20F73BE_260A_4A99_B7F5_E4F7C42FE05F__INCLUDED_
       
    23 
       
    24 #if _MSC_VER > 1000
       
    25 #pragma once
       
    26 #endif // _MSC_VER > 1000
       
    27 
       
    28 #include "BaseCom.h"
       
    29 #define MAX_MESSAGE_LENGTH	(64*1024L)
       
    30 #define MAX_SERIAL_MESSAGE_BUFFER_LENGTH (2*MAX_MESSAGE_LENGTH)
       
    31 
       
    32 class CRealSerialComm : public CBaseCom  
       
    33 {
       
    34 public:
       
    35 	CRealSerialComm();
       
    36 	CRealSerialComm(ConnectData* connectSettings, DWORD connectionId, CBaseProtocol* protocol);
       
    37 	virtual ~CRealSerialComm();
       
    38 
       
    39 	virtual long OpenPort();
       
    40 	long ClosePort();
       
    41 	long SendDataToPort(DWORD inSize, const void* inData);
       
    42 	long PollPort(DWORD& outSize);
       
    43 	long ReadPort(DWORD inSize, void* outData, DWORD& outSize);
       
    44 	long ProcessBuffer(CConnection* pConn, CRegistry* pRegistry, long& numberProcessed);
       
    45 	void DeleteMsg(DWORD inMsgLength);
       
    46 	bool GetVersion(char* outVersion) { return false; } // don't have enough information for this
       
    47 	bool HasVersion() { return false; } // can we have a version?
       
    48 	virtual long PreProcessMessage(int inMsgType, DWORD inMsgLength, BYTE* inMessage) { return TCAPI_ERR_NONE; }
       
    49 	virtual long PreProcessMessage(BYTE msgId, DWORD inMsgLength, BYTE* inMessage) { return TCAPI_ERR_NONE; }
       
    50 	virtual bool IsConnectionEqual(ConnectData* pConn);
       
    51 
       
    52 #ifdef _DEBUG
       
    53 	DWORD GetErrorText(DWORD inError);
       
    54 	DWORD GetErrorText2(DWORD inError);
       
    55 	void DumpComStat(COMSTAT* stat);
       
    56 	void DumpComStatP(COMSTAT* stat);
       
    57 	void DumpBuffer(BYTE* ptr, long length);
       
    58 #endif
       
    59 
       
    60 private:
       
    61 	long SetDCB();
       
    62 	HANDLE m_hSerial;
       
    63 	DCB m_dcb;
       
    64 	char m_serialPortName[MAX_COMPORT_SIZE];
       
    65 
       
    66 };
       
    67 
       
    68 #endif // !defined(AFX_REALSERIALCOMM_H__B20F73BE_260A_4A99_B7F5_E4F7C42FE05F__INCLUDED_)