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

📄 clinkcom.h

📁 linux 下串口调用通用类 方便通用
💻 H
字号:
#ifndef LINKCOM_H#define LINKCOM_Hclass clinkcom:public clink{//变量private:	struct termios termios_old;	struct termios termios_new;protected:public://函数private:	int cominit();	int comclear();protected:	int setportattrib(const scomarg *parg);/* * Function:	static INT32 BAUDRATE (INT32 baudrate) * Arguments:	INT32 baudrate; * Description:	convert baudrate from INT32 to MACRO B** */	int baudrate(int baudrate);/* * Function:	static INT32 _BAUDRATE (INT32 baudrate) * Arguments:	INT32 baudrate; * Description:	convert baudrate from MACRO B** to INT32 */	int _baudrate(int baudrate);	int getbaudrate ();/* * Function:	static void SetBaudrate (INT32 baudrate) * Arguments:	INT32 baudrate; * Description:	set serial port baudrate by use of file descriptor fd */	void setbaudrate (int baudrate);/* * Function:	static static void SetDataBit (INT32 databit) * Arguments:	INT32 databit; * Description:	Set	databit; */	void setdatabit (char databit);/* * Function:	static void SetStopBit (const char *stopbit) * Arguments:	const char *stopbit; * Description:	Set Stop Bit */	void setstopbit (const char *stopbit);/* * Function:	static void SetParityCheck (char parity) * Arguments:	char parity; * Description:	Set Parity Check */	void setparitycheck (char parity);/* * Function:	static void SetFlowControl(INT32 fctrl) * Arguments:	INT32 fctrl; * 				0: No Flow Control; *				1: Hardware Control; *				2: Software Control; */	void setflowcontrol (char fctrl);public:	//构造函数	clinkcom();	//析构函数	~clinkcom();	//读当前连接的数据//	int read(void *buff,int len,int flags=0);	//通过当前连接,写数据	int write(void *buff,int len,int flags=0);	//用串口参数连接设备	int connect(void *pvoidarg);};#endif

⌨️ 快捷键说明

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