//功能:实现串口操作的一些函数 #ifndef COM_CONTROL_FUNCTION_H #define COM_CONTROL_FUNCTION_H //查找系统可用的串口号,将所有的串口号保存在pPortList数组里 //输出:串口数portNumber,串口号数组pPortList //pPortList保存各串口的串口数字 extern BOOL ScanPCCom( int *pPortList, int& portNumber ); //判断串口是否被占有,串口可用返回true,否则返回false extern bool OnCheckComPort( const CString& portName ); //功能:检测2个串口是否相同,相同返回True,否则返回false extern bool CompareTwoComPort( const CString port1, const CString port2 ); //判断串口是否可用 //可用返回true,否则返回false extern bool CheckComPortCanWork( const CString strPort ); //判断串口是否为空 //串口为空返回true,否则返回false extern bool CheckComPortIsEmpty( const CString strPort ); //判断串口名称是否正确,正确的名称为“串口XX” //串口名称正确返回true, 否则返回false extern bool CheckComPortName( const CString strPort ); //从串口数组中进行查找,查找出配置文件设置的串口号 //输入:数组portArray,数组长度arrLength,查找元素itemValue //输出:元素的位置pos //返回值:查找成功返回true,否则返回false extern bool FindItemFromComList( int& pos, const int *portArray, const int& arrLength, const int& itemValue ); const int MaxComPortNumber = 1024; #endif