#pragma once
#include "cdrivercard.h"
#include "cmserialport.h"
class CCoatVolumeSensor :
	public CDriverCard
{
public:
	enum msg_id
	{
		MeasureVolume=DRIVER_MSG_ID,
		MSG_ZeroSensor,
		MAX_MSG_COATVOLUME_SENSOR,
	};

	CCoatVolumeSensor(const QString& name,int32_t id);
	virtual ~CCoatVolumeSensor(void);

	virtual void do_msg(int iID,QVariantList& vlInput,V_MsgOutput* pvlOutput);

	virtual int ReadConfig(QDomElement &root);
	virtual QDomElement WriteConfig(QDomDocument &doc, QDomElement &root);

	virtual int32_t init_driver();
	virtual int32_t exit_driver();

	unsigned short  CRC16(byte* pDataIn, int iLenIn);

	bool ReadGrams(int times=1);
	bool ZeroSensor();
	bool CheckResponse(byte *pResponse, int recvLength);

	CMSerialPort* m_pSerialPort;

	double m_dGrams; //ml
	//double m_dTareValue; //ml
};

