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

📄 comoperate.h

📁 RS232串口通讯,主要用来设置芯片中的数据.
💻 H
字号:
// ComOperate.h: interface for the CComOperate class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_COMOPERATE_H__D74DFEDC_45A9_4FCF_A8D7_2317E69FE60B__INCLUDED_)
#define AFX_COMOPERATE_H__D74DFEDC_45A9_4FCF_A8D7_2317E69FE60B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif							// _MSC_VER 
								// > 
								// 1000
#include "communication.h"

#define SOH	            0x2A	/*
								 * "*"
								 * 
								 * 
								 */
#define ENQ	            0x24	/*
								 * "$"
								 * 
								 * 
								 */
#define ACK             0x3F	/*
								 * "?" 
								 */
#define SEND            0x21	/*
								 * "!" 
								 */

#define END             0x19
#define RIGHT           0x07
#define ERR             0x08

#define QUITKEY		0xff
#define ITEM_LEN	249

#define WM_THREADFINISHED	 WM_USER + 5

const int       nLoadlength = 1024;

#define		erOpen_Serial_Fail	-1
#define		erSend_Byte_Fail	-2
#define		erRead_Byte_Fail	-3


class           CComOperate
{ 
public:
   CComOperate(int comno);
   virtual ~ CComOperate();
 public:
	
	 int		iStatus;
     int		mainerrno;
	char		**Errno2string;		//	实可以用静态变量,然未知如何初始化,不得已而为之
	int			comno;	
	

   BOOL            com_ask_answer(int com, char *sbuf, int slen, char *rbuf,		int rlen);
   BOOL            Rece_codestrm(char *rbuff, int buflen, int *rlen);
   BOOL            bRecebyte(char *temp);
   BOOL            bOutmem(char *H, int len);
   BOOL            Port_Res();
   BOOL            Port_Init();
   CComStatus      m_comDev;

   char	 * errno2string( );

  
 private:
	unsigned	int		sendcomretry  ;		//	命令发送重试次数
	unsigned	long		recewaitnum;	//	接收等待重复次数=0xffffff
	 unsigned int receivenum;				//	接收重试次数=2
	 unsigned long receinnum;				//	接收过程中重复次数=9000
};

#endif							// !defined(AFX_COMOPERATE_H__D74DFEDC_45A9_4FCF_A8D7_2317E69FE60B__INCLUDED_)

⌨️ 快捷键说明

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