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

📄 gprs.h

📁 linux 环境下GPRS通信
💻 H
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -