

#ifndef __OPTOSKYBASE_H__
#define __OPTOSKYBASE_H__
#include"HardwareSerial.h"

struct STRSensorInfo
{
	String SensorName;
	long maxValue;
	long BandNum;
	String WavelenthStr;
	float *wavelenthlist;
	//double *wavelenth;
	bool isSensorInit;
	String serialnumber;
    float a1,a2,a3,a4;

};



#define GET_MODEBOARD_TEMP 0x01
#define GET_PN_NUMBER 0x03
#define GET_SN_NUMBER 0x04
#define GET_MANUFACTURE_DATA 0x06
#define GET_MANUFACTOR_INFO 0x09
#define GET_PIXEL_LENGTH 0x0a
#define GET_TEC_TEMP 0x13
#define SET_TEC_TEMP 0x12
#define GET_OPTICFLAT_TEMP 0x35
#define GET_CIRCUIT_BOARD_TEMP 0x36
#define SET_INTEGRAL_TIME 0x14
#define GET_INTEGRAL_TIME 0x41
#define GET_MAX_INTEGRAL_TIME 0x42
#define GET_MIN_INTEGRAL_TIME 0x43
#define ASYNCHRONOUS_COLLECT_DARK 0x23
#define ASYNCHRONOUS_START_COLLECTION 0x16
#define ASYNCHRONOUS_READ_DATA 0x17
#define SET_AVERAGE_NUMBER 0x28
#define SYNCHRONIZATION_GET_DATA 0x1e
#define SYNCHRONIZATION_GET_DARK 0x2f
//#define SYNCHRONIZATION_GET_DARK 0x23
#define EXTERNAL_TRIGGER_ENABLE 0x1f
#define SET_XENON_LAMP_DELAY_TIME 0x24
#define GET_WAVELENGTH_CALIBRATION_COFF 0x55
#define GET_STAT_OF_LAMPOUT 0x60
#define SET_GPIO 0x61
#define byte uint8_t








class OptoSky
{
    public:
    OptoSky();
byte *result;
HardwareSerial *ISserial;
bool IsOptoskyinit;
void SetPortName(int serial);
void SendComment(byte *commend,int lenth);
void SendComment(byte comid);
void SendComment(byte *Comment,int commentlenth, byte *data,int lenth);
void SendComment(byte comid, byte *data,int lenth);
bool GetReturn(byte id,int &lenth,int timewaitbefor=20);
bool GetReturn(int &lenth,int timewaitbefor);

bool isSensorInit();
void RemoveHeaderandEnd(byte *data,int lenth);

};
#endif // __OPTOSKYBASE_H__