#ifndef DIAL5G_DIAL_H_
#define DIAL5G_DIAL_H_

#include <string>
#include "common/global.hpp"

class Dial {
public:
	Dial();
	virtual ~Dial();

	//枚举所有状态
	enum State
	{
		CPIN = 0,
		QCFGNET,
		QICSGPAPN,
		QCFGSMS,
		QENG,
		QNETDEVCTL,
		QNETDEVSTATUS,
		QDCHPC,
		NORMAL
	};

	//枚举所有事件
	enum Event
	{
		Event_CPIN = 0,
		Event_QCFGNET,
		Event_QICSGPAPN,
		Event_QCFGSMS,
		Event_QENG,
		Event_QNETDEVCTL,
		Event_QNETDEVSTATUS,
		Event_OK,
		Event_ERROR,
		Event_TEMP
	};

	State  m_curState;
	int m_fd;
	int m_dial;
	int m_APN;
	int openPort(const char* pPort);
	int closePort();
	int recvData();
	int queryPin();
	int configNet();
	int configApn();
	int getCsq();
	int getTemp();
	int conncectUSB();
	int dial5G();
	int configims();
	int configdhcp();
	int parseData(Event event,const char* pData);
	int setState();
};

#endif /* DIAL5G_DIAL_H_ */
