83 lines
1.6 KiB
C++
83 lines
1.6 KiB
C++
#ifndef DI710DRIVER_H
|
|
#define DI710DRIVER_H
|
|
#include "GlobalDefine.h"
|
|
//#include <QObject>
|
|
#include <QTcpSocket>
|
|
#include <QReadWriteLock>
|
|
#include <QUdpSocket>
|
|
#include <AnalogInputModule.h>
|
|
|
|
|
|
#include <iostream>
|
|
#include <sys/socket.h>
|
|
|
|
#define DI710_TCP_PORT 10001
|
|
|
|
enum eDI710RetValue
|
|
{
|
|
DI710_RET_OK,
|
|
DI710_RET_ERR_INVALID_POINTER,
|
|
DI710_RET_ERR_MODULE_OFFLINE,
|
|
DI710_RET_ERR_MODULE_TYPE_MISMATCH,
|
|
DI710_RET_MODULE_ALREADY_OPENED,
|
|
DI710_RET_CANNOT_CONFIGURE
|
|
};
|
|
|
|
enum eDI710Operations
|
|
{
|
|
DI710_NO_OPERATION,
|
|
DI710_STOP_ACQUISITION_OPERATION,
|
|
DI710_START_ACQUISITION_OPERATION,
|
|
DI710_STOP_THREAD_OPERATION,
|
|
DI710_INVALID_OPERATION
|
|
};
|
|
|
|
class CDI710Driver : /*public QObject, */public CAnalogInputModule
|
|
{
|
|
//Q_OBJECT
|
|
public:
|
|
CDI710Driver();
|
|
|
|
|
|
unsigned int OpenDevice(QString IPAdress,int Port);
|
|
int GetAnalogData(int channel);
|
|
void StopThread();
|
|
bool IsThreadRunning();
|
|
unsigned int StartAcquisition();
|
|
unsigned int StopAcquisition();
|
|
virtual unsigned int GetAnalogInput(int Channel, int *Data);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
unsigned int SetupDevice();
|
|
bool mRunThread;
|
|
QReadWriteLock mMutex;
|
|
QTcpSocket mTCPSocket;
|
|
int mCurData;
|
|
int mPendingOperation;
|
|
bool mRunning;
|
|
QHostAddress mDataQIPAddress;
|
|
int mDataQPort;
|
|
|
|
int SendStopAcquisitionFrame();
|
|
int SendStartAcquisitionFrame();
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
void Run();
|
|
// void DeviceSocketConnected();
|
|
// void DeviceSocketDisconnected();
|
|
// void DeviceSocketError(QAbstractSocket::SocketError);
|
|
// void DataAvailable();
|
|
|
|
};
|
|
|
|
#endif // DI710DRIVER_H
|