?? at.cpp
字號:
// AT.cpp: implementation of the CAT class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "SMM4COM.h"
#include "AT.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CAT::CAT()
{
}
CAT::~CAT()
{
}
//////////////////////////////////////////////////////////////////////
//作者:梁紹博
//時間:2003-11-4
//功能描述:
// 向指定的串口發送AT指令字符串,并同步返回指令結果字符串。
//參數描述:
// szCmd:輸入,AT命令字符串指針
// szState:輸出,AT命令返回結果的字符串指針
// lLimit:輸入,szState字符串的最大長度
//返回值描述:
// 0:成功
// 1:系統錯誤,具體錯誤原因請查詢m_dwError
// 2:沒有返回AT命令結果
// 3:AT命令返回結果字符串溢出
// 4:端口沒打開
//////////////////////////////////////////////////////////////////////
int CAT::SendCmd(const char *szCmd, char *szState, long lLimit)
{
int iReturn = 0;
if(!IsOpened())return 4;
if(SendData((const unsigned char *)szCmd, strlen(szCmd)))
{
iReturn = ReadCmd(szState, lLimit);
}
else
{
iReturn = 1;
}
return iReturn;
}
//////////////////////////////////////////////////////////////////////
//作者:梁紹博
//時間:2003-11-4
//功能描述:
// 從指定的串口接收AT指令字符串。
//參數描述:
// szState:輸出,AT命令返回結果的字符串指針
// lLimit:輸入,szState字符串的最大長度
//返回值描述:
// 0:成功
// 1:系統錯誤,具體錯誤原因請查詢m_dwError
// 2:沒有返回AT命令結果
// 3:AT命令返回結果字符串溢出
// 4:端口沒打開
//////////////////////////////////////////////////////////////////////
int CAT::ReadCmd(char *szState, long lLimit)
{
int iReturn = 0;
if(!IsOpened())return 4;
iReturn = ReadData(szState, lLimit);
if(iReturn == lLimit)
iReturn = 3;
else if(iReturn == 0)
iReturn = 2;
else
{
szState[iReturn] = 0;
iReturn = 0;
}
return iReturn;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -