⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 physerver.h

📁 一个通讯管理机的源代码。比较好用。推荐
💻 H
字号:
/***************************************************************************                          physerver.h  -  description                             -------------------    begin                : Thu Jan 17 2002    copyright            : (C) 2002 by     email                :  ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************//***************************************************************************                          physerver.h  -  description                             -------------------    begin                : Fri Nov 2 2001    copyright            : (C) 2001 by     email                :  ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#ifndef PHYSERVER_H#define PHYSERVER_H/**  *@author	*enum phyService {		*ps_eSend,ps_eReceive,ps_eConnect,ps_eDisconnect,	*};  */#include "msystem.h"#include "serial.h"using namespace Serial;void * ReadSerial(void * arg);class CPhyService : public CIOStream{public:	CPhyService(CSerialPortDef *pChannel);	~CPhyService();	int Status()//-1:Disconnect,0:Idle,1:Busy	{		if (m_nStatus == -1)			Connect();		return m_nStatus;	}	bool Write(BYTE *pData,WORD wSize)	{		bool bRet = false;		if ((Status()==0) && (write(m_serial.GetFileHandle(),pData,wSize) == wSize))		{			timeval tv;			gettimeofday(&tv,NULL);			AddIOStream(tv,pData,wSize);			bRet = true;            #ifdef _COMMONITOR		        cout  << endl;	        cout  << "->{" <<wSize << '}';	        for (int nnn=0; nnn<wSize; nnn++)	        {		        char c[16];		        sprintf(c," %02x ",pData[nnn]);		        cout << c;	        }            #endif			}		return bRet;	}	bool Connect() ;	void Disconnect();	bool Reset();	CDQue *GetRecvQueue()	{		return &m_queRecv;	}protected:	CSerial	m_serial;//int m_hComDev;	int m_nStatus;	pthread_t m_hThread;	CDQue	m_queRecv;	char *m_pszDevName;	friend void *ReadSerial(void *);};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -