gprs.h

来自「linux 环境下GPRS通信」· C头文件 代码 · 共 52 行

H
52
字号
#ifndef GPRS_H
#define GPRS_H

#include "phys.h"

#define GPRSDIAG 0

struct TGPRSConfig
{
	char ServerIp[16];
	int  ServerPort;
	char UserName[17];
	char Pwd[17];
	char Apn[17];
};

class GPRS:public PhysicalLayer
{
private:
	EscInt fdPower;
	EscInt fdCom;

	EscInt sendATCommand(EscChar *pAtCmd,EscByte secondsToTimeOut=1);
	void sendATRecvCommand(EscInt length);
	
	EscInt requestToWrite(EscWord length);
	EscInt readLine(EscChar* buf,EscInt &length,EscByte secondsToTimeOut=1);
	void setMode();
	void reset();
public:
	EscBool bPowerOn;
	bool bHardwareError;
	int ReadTimeoutTimes;
	TGPRSConfig ChannelConfig;
	bool bProfileCreated;
public:
	GPRS(EscInt poolSize);
	~GPRS();
	EscInt getServiceState();
	EscInt getSignalQuality();
	EscBool send(EscChar *buf,EscInt length);
	EscInt recv(EscChar *buf,EscInt length,EscInt maxTimeOut,EscBool *timeoutOccur);
	EscBool openChannel();
	void closeChannel();
	void initChannel(TGPRSConfig *pChnlCfg);
	void powerOn();
	void powerOff();
	void createConnectProfile(EscChar *user,EscChar *pwd,EscChar *apn);
	void createServiceProfile(EscChar *ip,EscWord port);
};

#endif

⌨️ 快捷键说明

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