Premier commit suite au crash du repo le 10 juillet 2017
This commit is contained in:
@@ -0,0 +1,402 @@
|
||||
#include "DI710Driver.h"
|
||||
#include <QDebug>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <cstring> // Needed for memset
|
||||
#include <sys/socket.h> // Needed for the socket functions
|
||||
#include <netdb.h> // Needed for the socket functions
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
|
||||
CDI710Driver::CDI710Driver()
|
||||
{
|
||||
mRunThread = true;
|
||||
mRunning = false;
|
||||
mPendingOperation = DI710_NO_OPERATION;
|
||||
}
|
||||
|
||||
unsigned int CDI710Driver::OpenDevice(QString IPAdress, int Port)
|
||||
{
|
||||
|
||||
// int status;
|
||||
// struct addrinfo host_info; // The struct that getaddrinfo() fills up with data.
|
||||
// struct addrinfo *host_info_list; // Pointer to the to the linked list of host_info's.
|
||||
|
||||
// // The MAN page of getaddrinfo() states "All the other fields in the structure pointed
|
||||
// // to by hints must contain either 0 or a null pointer, as appropriate." When a struct
|
||||
// // is created in c++, it will be given a block of memory. This memory is not nessesary
|
||||
// // empty. Therefor we use the memset function to make sure all fields are NULL.
|
||||
// memset(&host_info, 0, sizeof host_info);
|
||||
|
||||
// std::cout << "Setting up the structs..." << std::endl;
|
||||
|
||||
// host_info.ai_family = AF_UNSPEC; // IP version not specified. Can be both.
|
||||
// host_info.ai_socktype = SOCK_STREAM; // Use SOCK_STREAM for TCP or SOCK_DGRAM for UDP.
|
||||
|
||||
// // Now fill up the linked list of host_info structs with google's address information.
|
||||
// status = getaddrinfo("www.google.com", "80", &host_info, &host_info_list);
|
||||
// // getaddrinfo returns 0 on succes, or some other value when an error occured.
|
||||
// // (translated into human readable text by the gai_gai_strerror function).
|
||||
// if (status != 0) std::cout << "getaddrinfo error" << gai_strerror(status) ;
|
||||
|
||||
|
||||
// std::cout << "Creating a socket..." << std::endl;
|
||||
// int socketfd ; // The socket descripter
|
||||
// socketfd = socket(host_info_list->ai_family, host_info_list->ai_socktype,
|
||||
// host_info_list->ai_protocol);
|
||||
// if (socketfd == -1) std::cout << "socket error " ;
|
||||
|
||||
|
||||
// std::cout << "Connect()ing..." << std::endl;
|
||||
// status = connect(socketfd, host_info_list->ai_addr, host_info_list->ai_addrlen);
|
||||
// if (status == -1) std::cout << "connect error" ;
|
||||
|
||||
|
||||
// std::cout << "send()ing message..." << std::endl;
|
||||
// char *msg = "GET / HTTP/1.1\nhost: www.google.com\n\n";
|
||||
// int len;
|
||||
// ssize_t bytes_sent;
|
||||
// len = strlen(msg);
|
||||
// bytes_sent = send(socketfd, msg, len, 0);
|
||||
|
||||
// std::cout << "Waiting to recieve data..." << std::endl;
|
||||
// ssize_t bytes_recieved;
|
||||
// char incomming_data_buffer[1000];
|
||||
// bytes_recieved = recv(socketfd, incomming_data_buffer,1000, 0);
|
||||
// // If no data arrives, the program will just wait here until some data arrives.
|
||||
// if (bytes_recieved == 0) std::cout << "host shut down." << std::endl ;
|
||||
// if (bytes_recieved == -1)std::cout << "recieve error!" << std::endl ;
|
||||
// std::cout << bytes_recieved << " bytes recieved :" << std::endl ;
|
||||
// incomming_data_buffer[bytes_recieved] = '\0' ;
|
||||
// std::cout << incomming_data_buffer << std::endl;
|
||||
// std::cout << "Receiving complete. Closing socket..." << std::endl;
|
||||
// freeaddrinfo(host_info_list);
|
||||
// close(socketfd);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
mDataQIPAddress.setAddress(IPAdress);
|
||||
mDataQPort = Port;
|
||||
mTCPSocket.setSocketOption(QAbstractSocket::LowDelayOption,1);
|
||||
|
||||
mTCPSocket.connectToHost(IPAdress,Port);
|
||||
|
||||
if(mTCPSocket.waitForConnected(5000) == true)
|
||||
{
|
||||
qDebug("DI710 device Connected");
|
||||
return SetupDevice();
|
||||
return DI710_RET_OK;
|
||||
}
|
||||
|
||||
return DI710_RET_ERR_MODULE_OFFLINE;
|
||||
}
|
||||
|
||||
void CDI710Driver::Run()
|
||||
{
|
||||
bool Run = true;
|
||||
int Operation;
|
||||
mRunning = true;
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
|
||||
qDebug("DataQ thread started");
|
||||
|
||||
while(Run)
|
||||
{
|
||||
|
||||
mTCPSocket.waitForReadyRead(200);
|
||||
if(mTCPSocket.bytesAvailable() >= 2)
|
||||
{
|
||||
// QByteArray data = mTCPSocket.read(2);
|
||||
// qint16 temp;
|
||||
// QDataStream stream(&data,QIODevice::ReadOnly);
|
||||
// stream.device()->seek(0);
|
||||
// stream >> temp;
|
||||
|
||||
|
||||
|
||||
|
||||
char data[2];
|
||||
quint16 temp = 0;
|
||||
mTCPSocket.read(data,2);
|
||||
// data[3] = 0;
|
||||
|
||||
temp = data[1];
|
||||
temp <<= 8;
|
||||
temp += data[0];
|
||||
|
||||
mMutex.lockForWrite();
|
||||
mCurData = (int)temp;
|
||||
mMutex.unlock();
|
||||
qDebug() << QByteArray(data,2).toHex() << " : " << temp;
|
||||
//qDebug() << timer.elapsed();
|
||||
// qDebug() << mTCPSocket.bytesAvailable();
|
||||
timer.start();
|
||||
|
||||
}
|
||||
|
||||
mMutex.lockForRead();
|
||||
//Run = mRunThread;
|
||||
Operation = mPendingOperation;
|
||||
mPendingOperation = DI710_NO_OPERATION;
|
||||
mMutex.unlock();
|
||||
|
||||
|
||||
switch(Operation)
|
||||
{
|
||||
case DI710_NO_OPERATION:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case DI710_STOP_ACQUISITION_OPERATION:
|
||||
{
|
||||
SendStopAcquisitionFrame();
|
||||
// qDebug("DataQ stop acquisition operation executed");
|
||||
break;
|
||||
}
|
||||
case DI710_START_ACQUISITION_OPERATION:
|
||||
{
|
||||
SendStartAcquisitionFrame();
|
||||
// qDebug("Dataq start acquisition operation executed");
|
||||
break;
|
||||
}
|
||||
case DI710_STOP_THREAD_OPERATION:
|
||||
{
|
||||
SendStopAcquisitionFrame();
|
||||
Run = false;
|
||||
// qDebug("Dataq stop thread operation executed");
|
||||
break;
|
||||
}
|
||||
case DI710_INVALID_OPERATION:
|
||||
{
|
||||
qDebug("Dataq invalid operation...");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mMutex.lockForWrite();
|
||||
mRunning = false;
|
||||
mMutex.unlock();
|
||||
// qDebug("DataQ thread stopped");
|
||||
}
|
||||
|
||||
int CDI710Driver::GetAnalogData(int channel)
|
||||
{
|
||||
Q_UNUSED(channel)
|
||||
|
||||
int data = 0XDEADBEEF;
|
||||
mMutex.lockForRead();
|
||||
data = mCurData;
|
||||
mMutex.unlock();
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
unsigned int CDI710Driver::SetupDevice()
|
||||
{
|
||||
|
||||
mTCPSocket.readAll();
|
||||
|
||||
QByteArray data;
|
||||
|
||||
|
||||
if(SendStopAcquisitionFrame() != DI710_RET_OK)
|
||||
return DI710_RET_CANNOT_CONFIGURE;
|
||||
|
||||
|
||||
|
||||
data.clear();
|
||||
data.append((char)0);
|
||||
data.append("X00");
|
||||
mTCPSocket.write(data);
|
||||
if(mTCPSocket.waitForReadyRead(1000) == true)
|
||||
{
|
||||
qDebug() << mTCPSocket.readAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
return DI710_RET_CANNOT_CONFIGURE;
|
||||
}
|
||||
|
||||
data.clear();
|
||||
data.append((char)0);
|
||||
data.append("M000E");
|
||||
mTCPSocket.write(data);
|
||||
if(mTCPSocket.waitForReadyRead(1000) == true)
|
||||
{
|
||||
qDebug() << mTCPSocket.readAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
return DI710_RET_CANNOT_CONFIGURE;
|
||||
}
|
||||
|
||||
data.clear();
|
||||
data.append((char)0);
|
||||
data.append("L00F001");
|
||||
mTCPSocket.write(data);
|
||||
if(mTCPSocket.waitForReadyRead(1000) == true)
|
||||
{
|
||||
qDebug() << mTCPSocket.readAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
return DI710_RET_CANNOT_CONFIGURE;
|
||||
}
|
||||
|
||||
data.clear();
|
||||
data.append((char)0);
|
||||
data.append("C01");
|
||||
mTCPSocket.write(data);
|
||||
if(mTCPSocket.waitForReadyRead(1000) == true)
|
||||
{
|
||||
qDebug() << mTCPSocket.readAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
return DI710_RET_CANNOT_CONFIGURE;
|
||||
}
|
||||
|
||||
|
||||
//Check if we can start...
|
||||
if(SendStartAcquisitionFrame() != DI710_RET_OK)
|
||||
return DI710_RET_CANNOT_CONFIGURE;
|
||||
|
||||
//stop for the moment...
|
||||
if(SendStopAcquisitionFrame() != DI710_RET_OK)
|
||||
return DI710_RET_CANNOT_CONFIGURE;
|
||||
|
||||
// mTCPSocket.setReadBufferSize(2);
|
||||
|
||||
|
||||
return DI710_RET_OK;
|
||||
}
|
||||
|
||||
int CDI710Driver::SendStopAcquisitionFrame()
|
||||
{
|
||||
bool done = false;
|
||||
QByteArray data;
|
||||
data.clear();
|
||||
data.append((char)0);
|
||||
data.append("T0");
|
||||
mTCPSocket.setReadBufferSize(0);
|
||||
mTCPSocket.readAll();
|
||||
mTCPSocket.write(data);
|
||||
|
||||
QByteArray rxdata;
|
||||
rxdata.clear();
|
||||
while(done == false)
|
||||
{
|
||||
|
||||
if(mTCPSocket.waitForReadyRead(1000) == true)
|
||||
{
|
||||
rxdata.append(mTCPSocket.readAll());
|
||||
|
||||
if(rxdata.contains("T0"))
|
||||
{
|
||||
done = true;
|
||||
}
|
||||
|
||||
// qDebug() << rxdata;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DI710_RET_CANNOT_CONFIGURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return DI710_RET_OK;
|
||||
}
|
||||
|
||||
int CDI710Driver::SendStartAcquisitionFrame()
|
||||
{
|
||||
bool done = false;
|
||||
QByteArray data;
|
||||
data.clear();
|
||||
data.append((char)0);
|
||||
data.append("S3");
|
||||
mTCPSocket.setReadBufferSize(0);
|
||||
mTCPSocket.write(data);
|
||||
|
||||
QByteArray rxdata;
|
||||
rxdata.clear();
|
||||
while(done == false)
|
||||
{
|
||||
if(mTCPSocket.waitForReadyRead(1000) == true)
|
||||
{
|
||||
|
||||
rxdata.append(mTCPSocket.read(1));
|
||||
if(rxdata.contains("S3"))
|
||||
{
|
||||
done = true;
|
||||
// qDebug() << rxdata;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << rxdata;
|
||||
return DI710_RET_CANNOT_CONFIGURE;
|
||||
}
|
||||
}
|
||||
|
||||
// mTCPSocket.setReadBufferSize(2);
|
||||
|
||||
return DI710_RET_OK;
|
||||
}
|
||||
|
||||
void CDI710Driver::StopThread()
|
||||
{
|
||||
// mMutex.lockForWrite();
|
||||
// mRunThread = false;
|
||||
// mMutex.unlock();
|
||||
mMutex.lockForWrite();
|
||||
mPendingOperation = DI710_STOP_THREAD_OPERATION;
|
||||
mMutex.unlock();
|
||||
}
|
||||
|
||||
bool CDI710Driver::IsThreadRunning()
|
||||
{
|
||||
bool ret;
|
||||
mMutex.lockForRead();
|
||||
ret = mRunning;
|
||||
mMutex.unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int CDI710Driver::StartAcquisition()
|
||||
{
|
||||
mMutex.lockForWrite();
|
||||
mPendingOperation = DI710_START_ACQUISITION_OPERATION;
|
||||
mMutex.unlock();
|
||||
return DI710_RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CDI710Driver::StopAcquisition()
|
||||
{
|
||||
mMutex.lockForWrite();
|
||||
mPendingOperation = DI710_STOP_ACQUISITION_OPERATION;
|
||||
mMutex.unlock();
|
||||
return DI710_RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CDI710Driver::GetAnalogInput(int Channel, int *Data)
|
||||
{
|
||||
Q_UNUSED(Channel)
|
||||
*Data = GetAnalogData(0);
|
||||
return DI710_RET_OK;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
#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
|
||||
@@ -0,0 +1,263 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Classe haut niveau de gestion des modules d'entrées/sorties externes (Sealevel).
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121213 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
#include "ExternalIOMgr.h"
|
||||
#include "ZTconfigmgr.h"
|
||||
#ifndef WINDOWS_OS
|
||||
#include "Seaio430driver.h"
|
||||
#include "Seaio440driver.h"
|
||||
#include "Seaio470driver.h"
|
||||
#endif
|
||||
#include "EngLog.h"
|
||||
|
||||
CExternalIOMgr::CExternalIOMgr():
|
||||
mNbOpenedModules(0)
|
||||
{
|
||||
}
|
||||
CExternalIOMgr::~CExternalIOMgr()
|
||||
{
|
||||
for(int i = 0; i < mExternalModulesList.size(); i++)
|
||||
{
|
||||
if(mExternalModulesList.at(i))
|
||||
delete mExternalModulesList.at(i);
|
||||
}
|
||||
|
||||
mExternalModulesList.clear();
|
||||
mExternalIODriver.CloseSeaMaxInterface();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CExternalIOMgr::DestroyModule()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned int CExternalIOMgr::InitExternalIO()
|
||||
{
|
||||
if(mExternalIODriver.OpenSeaMaxInterface(CZTConfigMgr::instance()->GetExtIOIPAddress()) == RET_ERROR)
|
||||
{
|
||||
CEngLog::instance()->AddLogString("Impossible de se connecter aux modules d'entrées/sorties externes",1);
|
||||
return EXTIO_MGR_RET_ERR_CANNOT_CONNECT;
|
||||
}
|
||||
|
||||
//Cycle the interface initialization. This prevents the communication
|
||||
//failure in case the app is recovering from a crash.
|
||||
mExternalIODriver.CloseSeaMaxInterface();
|
||||
usleep(500000);
|
||||
if(mExternalIODriver.OpenSeaMaxInterface(CZTConfigMgr::instance()->GetExtIOIPAddress()) == RET_ERROR)
|
||||
{
|
||||
CEngLog::instance()->AddLogString("Impossible de se connecter aux modules d'entrées/sorties externes",1);
|
||||
return EXTIO_MGR_RET_ERR_CANNOT_CONNECT;
|
||||
}
|
||||
|
||||
//Open each module and make shure the configuration matches the slave address
|
||||
QList<stExtModulesConfig_t> * ModulesList = 0;
|
||||
int i;
|
||||
|
||||
//Parse list extracted from config file and create modules instances.
|
||||
ModulesList = CZTConfigMgr::instance()->GetExtIOModulesConfigList();
|
||||
for(i = 0; i < ModulesList->size(); i++)
|
||||
{
|
||||
|
||||
switch(ModulesList->at(i).ModuleType)
|
||||
{
|
||||
case EXT_IO_TYPE_430:
|
||||
{
|
||||
CSeaIO430Module *NewModule = new CSeaIO430Module();
|
||||
|
||||
unsigned int Ret = NewModule->OpenModule(ModulesList->at(i).ModuleSlaveAddress,mExternalIODriver.GetSeaMaxInterfacePtr(),ModulesList->at(i).ModuleID);
|
||||
|
||||
switch(Ret)
|
||||
{
|
||||
case EXT_MOD_RET_MODULE_ALREADY_OPENED:
|
||||
case EXT_MOD_RET_ERR_INVALID_POINTER:
|
||||
{
|
||||
return EXTIO_MGR_RET_ERR_CANNOT_OPEN_MODULE;
|
||||
break;
|
||||
}
|
||||
case EXT_MOD_RET_ERR_MODULE_OFFLINE:
|
||||
{
|
||||
return EXTIO_MGR_RET_ERR_MOD_OFFLINE;
|
||||
break;
|
||||
}
|
||||
case EXT_MOD_RET_ERR_MODULE_TYPE_MISMATCH:
|
||||
{
|
||||
return EXTIO_MGR_RET_ERR_MOD_TYPE_MISMATCH;
|
||||
break;
|
||||
}
|
||||
case EXTIO_MGR_RET_OK:
|
||||
{
|
||||
mExternalModulesList.append(NewModule);
|
||||
mNbOpenedModules++;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
CEngLog::instance()->AddLogString("CExternalIOMgr::InitExternalIO. Erreur non gérée...",1);
|
||||
return EXTIO_MGR_RET_ERR_CANNOT_OPEN_MODULE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EXT_IO_TYPE_440:
|
||||
{
|
||||
CSeaIO440Module *NewModule = new CSeaIO440Module();
|
||||
unsigned int Ret = NewModule->OpenModule(ModulesList->at(i).ModuleSlaveAddress,mExternalIODriver.GetSeaMaxInterfacePtr(),ModulesList->at(i).ModuleID);
|
||||
|
||||
switch(Ret)
|
||||
{
|
||||
case EXT_MOD_RET_MODULE_ALREADY_OPENED:
|
||||
case EXT_MOD_RET_ERR_INVALID_POINTER:
|
||||
{
|
||||
return EXTIO_MGR_RET_ERR_CANNOT_OPEN_MODULE;
|
||||
break;
|
||||
}
|
||||
case EXT_MOD_RET_ERR_MODULE_OFFLINE:
|
||||
{
|
||||
return EXTIO_MGR_RET_ERR_MOD_OFFLINE;
|
||||
break;
|
||||
}
|
||||
case EXT_MOD_RET_ERR_MODULE_TYPE_MISMATCH:
|
||||
{
|
||||
return EXTIO_MGR_RET_ERR_MOD_TYPE_MISMATCH;
|
||||
break;
|
||||
}
|
||||
case EXTIO_MGR_RET_OK:
|
||||
{
|
||||
mExternalModulesList.append(NewModule);
|
||||
mNbOpenedModules++;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
CEngLog::instance()->AddLogString("CExternalIOMgr::InitExternalIO. Erreur non gérée...",1);
|
||||
return EXTIO_MGR_RET_ERR_CANNOT_OPEN_MODULE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EXT_IO_TYPE_470:
|
||||
{
|
||||
CSeaIO470Module *NewModule = new CSeaIO470Module();
|
||||
unsigned int Ret = NewModule->OpenModule(ModulesList->at(i).ModuleSlaveAddress,mExternalIODriver.GetSeaMaxInterfacePtr(),ModulesList->at(i).ModuleID);
|
||||
|
||||
switch(Ret)
|
||||
{
|
||||
case EXT_MOD_RET_MODULE_ALREADY_OPENED:
|
||||
case EXT_MOD_RET_ERR_INVALID_POINTER:
|
||||
{
|
||||
return EXTIO_MGR_RET_ERR_CANNOT_OPEN_MODULE;
|
||||
break;
|
||||
}
|
||||
case EXT_MOD_RET_ERR_MODULE_OFFLINE:
|
||||
{
|
||||
return EXTIO_MGR_RET_ERR_MOD_OFFLINE;
|
||||
break;
|
||||
}
|
||||
case EXT_MOD_RET_ERR_MODULE_TYPE_MISMATCH:
|
||||
{
|
||||
return EXTIO_MGR_RET_ERR_MOD_TYPE_MISMATCH;
|
||||
break;
|
||||
}
|
||||
case EXTIO_MGR_RET_OK:
|
||||
{
|
||||
mExternalModulesList.append(NewModule);
|
||||
mNbOpenedModules++;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
CEngLog::instance()->AddLogString("CExternalIOMgr::InitExternalIO. Erreur non gérée...",1);
|
||||
return EXTIO_MGR_RET_ERR_CANNOT_OPEN_MODULE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EXT_IO_TYPE_INVALID:
|
||||
default:
|
||||
{
|
||||
//TODO: Manage this erroneous occurence ???
|
||||
//this would be a programming error :(
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return EXTIO_MGR_RET_OK;
|
||||
}
|
||||
|
||||
CExternalIOModule * CExternalIOMgr::GetModuleHandle(eExternalModuleType_t ModuleType, unsigned int ModuleID)
|
||||
{
|
||||
CExternalIOModule* ModulePtr;
|
||||
for(int i = 0; i < mExternalModulesList.size(); i++)
|
||||
{
|
||||
ModulePtr = mExternalModulesList.at(i);
|
||||
// qDebug("TYPE %d",ModulePtr->GetType());
|
||||
// qDebug("ID %d",ModulePtr->GetID());
|
||||
if(ModulePtr->GetType() == ModuleType && ModulePtr->GetID() == ModuleID)
|
||||
{
|
||||
return ModulePtr;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int CExternalIOMgr::InitIO()
|
||||
{
|
||||
return InitExternalIO();
|
||||
}
|
||||
|
||||
CIOModule * CExternalIOMgr::GetModule(eIOModuleType_t type, unsigned int ModuleID)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case IO_MODULE_INPUT_TYPE:
|
||||
{
|
||||
return (CSeaIO430Module*)GetModuleHandle(EXT_IO_TYPE_430,ModuleID);
|
||||
break;
|
||||
}
|
||||
case IO_MODULE_OUTPUT_TYPE:
|
||||
{
|
||||
return (CSeaIO440Module *)GetModuleHandle(EXT_IO_TYPE_440,ModuleID);
|
||||
|
||||
break;
|
||||
}
|
||||
case IO_MODULE_MIXED_TYPE:
|
||||
{
|
||||
return (CSeaIO470Module *)GetModuleHandle(EXT_IO_TYPE_470,ModuleID);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case IO_MODULE_INVALID_TYPE:
|
||||
{
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
#ifndef EXTERNALIOMGR_H
|
||||
#define EXTERNALIOMGR_H
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121213 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "GlobalDefine.h"
|
||||
#ifndef WINDOWS_OS
|
||||
#include "seamaxlin.h"
|
||||
|
||||
#include "Seaiolibinterface.h"
|
||||
#endif
|
||||
#include "Externaliomodule.h"
|
||||
#include "QList"
|
||||
#include "IOManager.h"
|
||||
|
||||
class CExternalIOMgr : public CIOManager
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
CExternalIOMgr();
|
||||
~CExternalIOMgr();
|
||||
|
||||
unsigned int InitExternalIO(void);
|
||||
CExternalIOModule *GetModuleHandle(eExternalModuleType_t ModuleType, unsigned int ModuleID);
|
||||
|
||||
virtual CIOModule *GetModule(eIOModuleType_t type, unsigned int ModuleID);
|
||||
virtual unsigned int InitIO();
|
||||
void DestroyModule();
|
||||
|
||||
|
||||
private:
|
||||
#ifndef WINDOWS_OS
|
||||
CSeaMaxLin *mSeaMaxInterface; //The SeaMax driver interface used to communicate with the modules
|
||||
CSeaIOLibInterface mExternalIODriver;
|
||||
unsigned int mNbOpenedModules;
|
||||
QList<CExternalIOModule*> mExternalModulesList;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif // EXTERNALIOMGR_H
|
||||
@@ -0,0 +1,127 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Classe d'interface avec le driver de communication des modules ethernet
|
||||
externes (Sealevel).
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121213 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Externaliomodule.h"
|
||||
#include <QtGlobal>
|
||||
|
||||
CExternalIOModule::CExternalIOModule():
|
||||
mIsOpened(false)
|
||||
{
|
||||
|
||||
}
|
||||
CExternalIOModule::~CExternalIOModule()
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef WINDOWS_OS
|
||||
unsigned int CExternalIOModule::SetModuleDriverPtr(CSeaMaxLin *DriverPtr)
|
||||
{
|
||||
if(DriverPtr == 0)
|
||||
return RET_ERROR;
|
||||
|
||||
mModuleDriverPtr = DriverPtr;
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
//unsigned int CExternalIOModule::OpenModule(unsigned int SlaveAddress,SeaMaxLin *DriverPtr, unsigned int ModuleID)
|
||||
//{
|
||||
//// if(mIsOpened == true)
|
||||
//// return EXT_MOD_RET_MODULE_ALREADY_OPENED;
|
||||
|
||||
////// if(SetModuleDriverPtr(DriverPtr) == RET_ERROR)
|
||||
////// {
|
||||
////// CEngLog::instance()->AddLogString("Erreur Fatale: CExternalIOModule::OpenModule, le pointeur DriverPtr est invalide",1);
|
||||
////// return EXT_MOD_RET_ERR_INVALID_POINTER;
|
||||
////// }
|
||||
|
||||
//// unsigned short ModuleType;
|
||||
//// int Ret;
|
||||
//// mModuleAddress = SlaveAddress;
|
||||
//// mModuleID = ModuleID;
|
||||
//// // Ret = mModuleDriverPtr->Ioctl(mModuleAddress,IOCTL_GET_EXT_CONFIG,&ModuleType);
|
||||
//// Ret = SeaMaxLinIoctl(DriverPtr,(unsigned char)SlaveAddress,IOCTL_GET_EXT_CONFIG,&ModuleType);
|
||||
//// if(Ret != 0)
|
||||
//// {
|
||||
//// CEngLog::instance()->AddLogString(QString("").sprintf("Erreur: CExternalIOModule::OpenModule, aucune réponse du module Type: %d, addresse: %d, ID: %d",mModuleType,SlaveAddress,ModuleID),1);
|
||||
//// return EXT_MOD_RET_ERR_MODULE_OFFLINE;
|
||||
//// }
|
||||
|
||||
//// if((eExternalModuleType_t)ModuleType != mModuleType)
|
||||
//// {
|
||||
//// CEngLog::instance()->AddLogString(QString("").sprintf("Erreur: le module à l'addresse %d est configuré de type %d mais est plutôt de type %d",SlaveAddress,(unsigned short)mModuleType,ModuleType),1);
|
||||
//// mIsOpened = false;
|
||||
//// return EXT_MOD_RET_ERR_MODULE_TYPE_MISMATCH;
|
||||
//// }
|
||||
|
||||
//// CEngLog::instance()->AddLogString(QString("").sprintf("Module ouvert avec succès. Addresse: %d, Type: %d, ID: %d",SlaveAddress,(unsigned short)mModuleType,ModuleID),3);
|
||||
//// mIsOpened = true;
|
||||
|
||||
//// return EXT_MOD_RET_OK;
|
||||
// return EXT_MOD_RET_ERR_MODULE_OFFLINE;
|
||||
|
||||
|
||||
//}
|
||||
|
||||
unsigned int CExternalIOModule::OpenModule(unsigned int SlaveAddress,CSeaMaxLin *DriverPtr, unsigned int ModuleID)
|
||||
{
|
||||
if(mIsOpened == true)
|
||||
return EXT_MOD_RET_MODULE_ALREADY_OPENED;
|
||||
|
||||
if(SetModuleDriverPtr(DriverPtr) == RET_ERROR)
|
||||
{
|
||||
CEngLog::instance()->AddLogString("Erreur Fatale: CExternalIOModule::OpenModule, le pointeur DriverPtr est invalide",1);
|
||||
return EXT_MOD_RET_ERR_INVALID_POINTER;
|
||||
}
|
||||
|
||||
unsigned short buf[50];
|
||||
unsigned short ModuleType;
|
||||
int Ret;
|
||||
mModuleAddress = SlaveAddress;
|
||||
mModuleID = ModuleID;
|
||||
Ret = mModuleDriverPtr->Ioctl(mModuleAddress,IOCTL_READ_COMM_PARAM/*IOCTL_GET_EXT_CONFIG*/,buf);
|
||||
if(Ret != 0)
|
||||
{
|
||||
CEngLog::instance()->AddLogString(QString("").sprintf("Erreur: CExternalIOModule::OpenModule, aucune réponse du module Type: %d, addresse: %d, ID: %d",mModuleType,SlaveAddress,ModuleID),1);
|
||||
return EXT_MOD_RET_ERR_MODULE_OFFLINE;
|
||||
}
|
||||
ModuleType = buf[0];
|
||||
if((eExternalModuleType_t)ModuleType != mModuleType)
|
||||
{
|
||||
CEngLog::instance()->AddLogString(QString("").sprintf("Erreur: le module à l'addresse %d est configuré de type %d mais est plutôt de type %d",SlaveAddress,(unsigned short)mModuleType,ModuleType),1);
|
||||
mIsOpened = false;
|
||||
return EXT_MOD_RET_ERR_MODULE_TYPE_MISMATCH;
|
||||
}
|
||||
|
||||
CEngLog::instance()->AddLogString(QString("").sprintf("Module ouvert avec succès. Addresse: %d, Type: %d, ID: %d",SlaveAddress,(unsigned short)mModuleType,ModuleID),3);
|
||||
mIsOpened = true;
|
||||
|
||||
return EXT_MOD_RET_OK;
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef EXTERNALIOMODULE_H
|
||||
#define EXTERNALIOMODULE_H
|
||||
#include "GlobalDefine.h"
|
||||
#ifndef WINDOWS_OS
|
||||
#include "seamaxlin.h"
|
||||
#endif
|
||||
#include "IOModule.h"
|
||||
|
||||
typedef enum eExternalModuleType
|
||||
{
|
||||
EXT_IO_TYPE_430 = 430,
|
||||
EXT_IO_TYPE_440 = 440,
|
||||
EXT_IO_TYPE_470 = 470,
|
||||
EXT_IO_TYPE_INVALID = 0
|
||||
}eExternalModuleType_t;
|
||||
|
||||
enum eExternalModuleRetValue
|
||||
{
|
||||
EXT_MOD_RET_OK,
|
||||
EXT_MOD_RET_ERR_INVALID_POINTER,
|
||||
EXT_MOD_RET_ERR_MODULE_OFFLINE,
|
||||
EXT_MOD_RET_ERR_MODULE_TYPE_MISMATCH,
|
||||
EXT_MOD_RET_MODULE_ALREADY_OPENED,
|
||||
EXT_MOD_RET_WRONG_ANALOG_CONFIGURATION
|
||||
};
|
||||
|
||||
class CExternalIOModule
|
||||
{
|
||||
public:
|
||||
|
||||
CExternalIOModule();
|
||||
virtual ~CExternalIOModule();
|
||||
#ifndef WINDOWS_OS
|
||||
unsigned int SetModuleDriverPtr(CSeaMaxLin *DriverPtr);
|
||||
virtual unsigned int OpenModule(unsigned int SlaveAddress,CSeaMaxLin *DriverPtr, unsigned int ModuleID);
|
||||
// unsigned int OpenModule(unsigned int SlaveAddress,SeaMaxLin *DriverPtr, unsigned int ModuleID);
|
||||
|
||||
eExternalModuleType_t GetType(void){return mModuleType;}
|
||||
unsigned int GetID(void){return mModuleID;}
|
||||
#endif
|
||||
|
||||
|
||||
protected:
|
||||
bool mIsOpened;
|
||||
#ifndef WINDOWS_OS
|
||||
CSeaMaxLin *mModuleDriverPtr;
|
||||
unsigned int mModuleAddress;
|
||||
unsigned int mModuleID;
|
||||
eExternalModuleType_t mModuleType;
|
||||
|
||||
seaio_type_t mSeaIOModuleType;
|
||||
address_loc_t mRegisterStart;
|
||||
address_range_t mRegisterRange;
|
||||
#endif
|
||||
|
||||
|
||||
// pseaMaxModule->Read(2,type,start,range,&data[0]);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // EXTERNALIOMODULE_H
|
||||
@@ -0,0 +1,105 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Pilote d'interface avec un module d'entrées discrètes SEAIO430
|
||||
Hérite de CInputModule et réimplémente les fonctions virtuelles d'accès aux
|
||||
données du module d'entrées externes.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121213 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Seaio430driver.h"
|
||||
#include <string.h>
|
||||
#include <QDebug>
|
||||
#include "EngLog.h"
|
||||
|
||||
CSeaIO430Module::CSeaIO430Module(CSeaMaxLin *ModuleDriverPtr)
|
||||
{
|
||||
mModuleDriverPtr = ModuleDriverPtr;
|
||||
mModuleType = EXT_IO_TYPE_430;
|
||||
}
|
||||
|
||||
unsigned int CSeaIO430Module::GetInputs(unsigned char *DataBuf)
|
||||
{
|
||||
if(DataBuf == 0)
|
||||
return RET_ERROR;
|
||||
|
||||
if(ReadInputs() == RET_ERROR)
|
||||
return RET_ERROR;
|
||||
|
||||
memcpy(DataBuf,mInputBuffer,4/*sizeof(mInputBuffer)*/);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSeaIO430Module::GetInputs()
|
||||
{
|
||||
unsigned int Buf;
|
||||
|
||||
mMutex.lock();
|
||||
ReadInputs();
|
||||
memcpy(&Buf,mInputBuffer,sizeof(mInputBuffer));
|
||||
mMutex.unlock();
|
||||
return Buf;
|
||||
}
|
||||
|
||||
unsigned int CSeaIO430Module::GetInputBuf()
|
||||
{
|
||||
unsigned int Buf;
|
||||
|
||||
mMutex.lock();
|
||||
ReadInputs();
|
||||
memcpy(&Buf,mInputBuffer,sizeof(mInputBuffer));
|
||||
mMutex.unlock();
|
||||
return Buf;
|
||||
}
|
||||
|
||||
//unsigned char * CSeaIO430Module::GetInputs()
|
||||
//{
|
||||
// return &mInputBuffer[0];
|
||||
//}
|
||||
|
||||
unsigned int CSeaIO430Module::ReadInputs()
|
||||
{
|
||||
if(mModuleDriverPtr == 0)
|
||||
return RET_ERROR;
|
||||
|
||||
mSeaIOModuleType = D_INPUTS; //Input type
|
||||
mRegisterStart = 1; //Start with input 1
|
||||
mRegisterRange = 32; //Read all the 32 inputs
|
||||
|
||||
int RET = mModuleDriverPtr->Read(mModuleAddress,mSeaIOModuleType,mRegisterStart,mRegisterRange,&mInputBuffer[0]);
|
||||
if(RET < 0)
|
||||
{
|
||||
CEngLog::instance()->AddLogString(QString("SeaIO430 module read FAILED: %d").arg(RET));
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
|
||||
}
|
||||
unsigned int CSeaIO430Module::ReadAndGetInputs(unsigned char *DataBuf)
|
||||
{
|
||||
if(ReadInputs() == 0)
|
||||
return RET_ERROR;
|
||||
|
||||
memcpy(DataBuf,mInputBuffer,sizeof(mInputBuffer));
|
||||
return RET_OK;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121213 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SEAIO430DRIVER_H
|
||||
#define SEAIO430DRIVER_H
|
||||
|
||||
#include "GlobalDefine.h"
|
||||
#include "Externaliomodule.h"
|
||||
#include "seamaxlin.h"
|
||||
#include "InputModule.h"
|
||||
#include <QMutex>
|
||||
|
||||
|
||||
class CSeaIO430Module : public CExternalIOModule, public CInputModule
|
||||
{
|
||||
public:
|
||||
CSeaIO430Module(CSeaMaxLin *ModuleInterfacePtr = 0);
|
||||
|
||||
virtual unsigned int GetInputs();
|
||||
virtual unsigned int GetInputBuf();
|
||||
unsigned int ReadInputs(void);
|
||||
unsigned int ReadAndGetInputs(unsigned char *DataBuf);
|
||||
|
||||
private:
|
||||
unsigned char mInputBuffer[4]; //Buffer de données pour les entrées discrètes.
|
||||
//On utilise un array simple pour éviter l'allocation dynamique.
|
||||
unsigned int GetInputs(unsigned char *DataBuf);
|
||||
QMutex mMutex;
|
||||
};
|
||||
|
||||
#endif // SEAIO430DRIVER_H
|
||||
@@ -0,0 +1,101 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Pilote d'interface avec un module d'entrées discrètes SEAIO440
|
||||
Hérite de COutputModule et réimplémente les fonctions virtuelles d'accès aux
|
||||
données du module de sorties externes.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121213 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Seaio440driver.h"
|
||||
#include "EngLog.h"
|
||||
|
||||
CSeaIO440Module::CSeaIO440Module(CSeaMaxLin *ModuleDriverPtr)
|
||||
{
|
||||
mModuleDriverPtr = ModuleDriverPtr;
|
||||
mModuleType = EXT_IO_TYPE_440;
|
||||
mOutputBuffer = 0;
|
||||
}
|
||||
|
||||
CSeaIO440Module::~CSeaIO440Module()
|
||||
{
|
||||
// qDebug("clear outputs");
|
||||
// quint32 out = 0;
|
||||
// SetOutput(out);
|
||||
}
|
||||
|
||||
unsigned int CSeaIO440Module::SetOutput(unsigned char *OutputBuffer)
|
||||
{
|
||||
if(mModuleDriverPtr == 0)
|
||||
return RET_ERROR;
|
||||
|
||||
if(OutputBuffer == 0)
|
||||
return RET_ERROR;
|
||||
|
||||
mSeaIOModuleType = COILS; //Output type
|
||||
mRegisterStart = 1; //Start with input 1
|
||||
mRegisterRange = 32; //Set all the 32 outputs
|
||||
|
||||
int RET = mModuleDriverPtr->Write(mModuleAddress,mSeaIOModuleType,mRegisterStart,mRegisterRange,&OutputBuffer[0]);
|
||||
if(RET < 0)
|
||||
{
|
||||
CEngLog::instance()->AddLogString(QString("SeaIO440 Modbus write FAILED: %d").arg(RET));
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSeaIO440Module::SetOutput(quint32 buffer)
|
||||
{
|
||||
unsigned char buf[4];
|
||||
memcpy(&buf[0],&buffer,4);
|
||||
mOutputBuffer = buffer;
|
||||
|
||||
SetOutput(buf);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSeaIO440Module::SetOutputFlags(quint32 FlagMask)
|
||||
{
|
||||
|
||||
mOutputBuffer |= FlagMask;
|
||||
SetOutput(mOutputBuffer);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSeaIO440Module::ClearOutputFlags(quint32 FlagMask)
|
||||
{
|
||||
mOutputBuffer &= ~FlagMask;
|
||||
SetOutput(mOutputBuffer);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSeaIO440Module::ToggleOutputFlags(quint32 FlagMask)
|
||||
{
|
||||
mOutputBuffer ^= FlagMask;
|
||||
SetOutput(mOutputBuffer);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121213 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SEAIO440DRIVER_H
|
||||
#define SEAIO440DRIVER_H
|
||||
|
||||
#include "GlobalDefine.h"
|
||||
#include "Externaliomodule.h"
|
||||
#include "seamaxlin.h"
|
||||
#include "OutputModule.h"
|
||||
|
||||
|
||||
class CSeaIO440Module : public CExternalIOModule,
|
||||
public COutputModule
|
||||
{
|
||||
public:
|
||||
CSeaIO440Module(CSeaMaxLin *ModuleInterfacePtr = 0);
|
||||
virtual ~CSeaIO440Module();
|
||||
virtual unsigned int SetOutput(unsigned char* buffer);
|
||||
virtual unsigned int SetOutput(quint32 buffer);
|
||||
virtual unsigned int SetOutputFlags(quint32 Flags);
|
||||
virtual unsigned int ClearOutputFlags(quint32 Flags);
|
||||
virtual unsigned int ToggleOutputFlags(quint32 Flags);
|
||||
|
||||
unsigned int mOutputBuffer;
|
||||
|
||||
};
|
||||
|
||||
#endif // SEAIO440DRIVER_H
|
||||
@@ -0,0 +1,152 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Pilote d'interface avec un module d'entrées discrètes SEAIO470
|
||||
Hérite de CAnalogInputModule et réimplémente les fonctions virtuelles d'accès aux
|
||||
données du module mixte externes.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121213 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Seaio470driver.h"
|
||||
|
||||
CSeaIO470Module::CSeaIO470Module(CSeaMaxLin *ModuleDriverPtr)
|
||||
{
|
||||
mModuleDriverPtr = ModuleDriverPtr;
|
||||
mModuleType = EXT_IO_TYPE_470;
|
||||
mCurInput = 0;
|
||||
}
|
||||
|
||||
//Reimplement the base class OpenModule() since the 470 module needs some more operations than the 430 and 440 modules.
|
||||
//
|
||||
unsigned int CSeaIO470Module::OpenModule(unsigned int SlaveAddress, CSeaMaxLin *DriverPtr, unsigned int ModuleID)
|
||||
{
|
||||
if(mIsOpened == true)
|
||||
return EXT_MOD_RET_MODULE_ALREADY_OPENED;
|
||||
|
||||
if(SetModuleDriverPtr(DriverPtr) == RET_ERROR)
|
||||
{
|
||||
CEngLog::instance()->AddLogString("Erreur Fatale: CExternalIOModule::OpenModule, le pointeur DriverPtr est invalide",1);
|
||||
return EXT_MOD_RET_ERR_INVALID_POINTER;
|
||||
}
|
||||
|
||||
unsigned short buf[50];
|
||||
unsigned short ModuleType;
|
||||
int Ret;
|
||||
mModuleAddress = SlaveAddress;
|
||||
mModuleID = ModuleID;
|
||||
Ret = mModuleDriverPtr->Ioctl(mModuleAddress,IOCTL_READ_COMM_PARAM,buf);
|
||||
if(Ret != 0)
|
||||
{
|
||||
CEngLog::instance()->AddLogString(QString("").sprintf("Erreur: CExternalIOModule::OpenModule, aucune réponse du module Type: %d, addresse: %d, ID: %d",mModuleType,SlaveAddress,ModuleID),1);
|
||||
return EXT_MOD_RET_ERR_MODULE_OFFLINE;
|
||||
}
|
||||
ModuleType = buf[0];
|
||||
if((eExternalModuleType_t)ModuleType != mModuleType)
|
||||
{
|
||||
CEngLog::instance()->AddLogString(QString("").sprintf("Erreur: le module à l'addresse %d est configuré de type %d mais est plutôt de type %d",SlaveAddress,(unsigned short)mModuleType,ModuleType),1);
|
||||
mIsOpened = false;
|
||||
return EXT_MOD_RET_ERR_MODULE_TYPE_MISMATCH;
|
||||
}
|
||||
|
||||
//Force analog inputs config.
|
||||
//
|
||||
adda_config ModuleConfig;
|
||||
ModuleConfig.device.channel_mode = CURRENT_LOOP;
|
||||
ModuleConfig.device.channel_mode = ANALOG_OFFSET;
|
||||
ModuleConfig.channels.ch_1 = ZERO_TO_TEN;
|
||||
ModuleConfig.channels.ch_2 = ZERO_TO_TEN;
|
||||
ModuleConfig.channels.ch_3 = ZERO_TO_TEN;
|
||||
ModuleConfig.channels.ch_4 = ZERO_TO_TEN;
|
||||
ModuleConfig.channels.ch_5 = ZERO_TO_TEN;
|
||||
ModuleConfig.channels.ch_6 = ZERO_TO_TEN;
|
||||
ModuleConfig.channels.ch_7 = ZERO_TO_TEN;
|
||||
ModuleConfig.channels.ch_8 = ZERO_TO_TEN;
|
||||
|
||||
|
||||
// ModuleConfig.device.channel_mode = SINGLE_ENDED;
|
||||
// ModuleConfig.device.channel_mode = ANALOG_OFFSET;
|
||||
// ModuleConfig.channels.ch_1 = ZERO_TO_FIVE;
|
||||
// ModuleConfig.channels.ch_2 = ZERO_TO_FIVE;
|
||||
// ModuleConfig.channels.ch_3 = ZERO_TO_FIVE;
|
||||
// ModuleConfig.channels.ch_4 = ZERO_TO_FIVE;
|
||||
// ModuleConfig.channels.ch_5 = ZERO_TO_FIVE;
|
||||
// ModuleConfig.channels.ch_6 = ZERO_TO_FIVE;
|
||||
// ModuleConfig.channels.ch_7 = ZERO_TO_FIVE;
|
||||
// ModuleConfig.channels.ch_8 = ZERO_TO_FIVE;
|
||||
int result = mModuleDriverPtr->Ioctl(mModuleAddress,IOCTL_SET_ADDA_CONFIG,&ModuleConfig);
|
||||
if(result < 0)
|
||||
{
|
||||
// qDebug("Impossible de configurer le module 470");
|
||||
}
|
||||
|
||||
|
||||
CEngLog::instance()->AddLogString(QString("").sprintf("Module ouvert avec succès. Addresse: %d, Type: %d, ID: %d",SlaveAddress,(unsigned short)mModuleType,ModuleID),3);
|
||||
mIsOpened = true;
|
||||
|
||||
return EXT_MOD_RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSeaIO470Module::ReadInput(int Channel)
|
||||
{
|
||||
if(mModuleDriverPtr == 0)
|
||||
return RET_ERROR;
|
||||
|
||||
if(Channel < 1 || Channel > SEAIO_470_MAX_CHANNEL)
|
||||
return RET_ERROR;
|
||||
|
||||
mSeaIOModuleType = INPUTREG; //Input type
|
||||
mRegisterStart = Channel; //Assign channel to read
|
||||
mRegisterRange = 1; //only 1 input
|
||||
|
||||
|
||||
int result = mModuleDriverPtr->Read(mModuleAddress,INPUTREG,Channel,1,&mInputBuffer[0]);
|
||||
if(result < 0)
|
||||
{
|
||||
// qDebug("impossible de lire l'entrée ananogique");
|
||||
}
|
||||
|
||||
//We know the module is configured in 0 - 10V range (see the Open() function).
|
||||
mCurInput = (mInputBuffer[0] << 8) + (mInputBuffer[1]);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSeaIO470Module::GetAnalogInput(int Channel, int *Data)
|
||||
{
|
||||
if(ReadInput(Channel) == RET_ERROR)
|
||||
return RET_ERROR;
|
||||
|
||||
*Data = mCurInput;
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSeaIO470Module::GetAnalogInput(int Channel, double &Data)
|
||||
{
|
||||
if(ReadInput(Channel) == RET_ERROR)
|
||||
return RET_ERROR;
|
||||
|
||||
Data = (double)mCurInput;
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121213 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SEAIO470DRIVER_H
|
||||
#define SEAIO470DRIVER_H
|
||||
|
||||
#include "GlobalDefine.h"
|
||||
#include "Externaliomodule.h"
|
||||
#include "seamaxlin.h"
|
||||
#include "AnalogInputModule.h"
|
||||
|
||||
#define SEAIO_470_MAX_CHANNEL 8
|
||||
|
||||
|
||||
class CSeaIO470Module : public CExternalIOModule,
|
||||
public CAnalogInputModule
|
||||
{
|
||||
public:
|
||||
CSeaIO470Module(CSeaMaxLin *ModuleInterfacePtr = 0);
|
||||
unsigned int OpenModule(unsigned int SlaveAddress, CSeaMaxLin *DriverPtr, unsigned int ModuleID);
|
||||
|
||||
unsigned int GetAnalogInput(int Channel, int *Data);
|
||||
virtual unsigned int GetAnalogInput(int Channel, double &Data);
|
||||
|
||||
private:
|
||||
unsigned int ReadInput(int Channel);
|
||||
|
||||
char mInputBuffer[2];
|
||||
int mCurInput;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // SEAIO470DRIVER_H
|
||||
@@ -0,0 +1,77 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Classe qui offre une interface avec la librairie de SeaLevel pour les modules
|
||||
externes.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121213 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Seaiolibinterface.h"
|
||||
|
||||
|
||||
|
||||
CSeaIOLibInterface::CSeaIOLibInterface():
|
||||
mIsOpened(false)
|
||||
{
|
||||
}
|
||||
|
||||
CSeaIOLibInterface::~CSeaIOLibInterface()
|
||||
{
|
||||
mSeaMaxInterface.Close();
|
||||
}
|
||||
void CSeaIOLibInterface::CloseSeaMaxInterface()
|
||||
{
|
||||
mSeaMaxInterface.Close();
|
||||
}
|
||||
|
||||
unsigned int CSeaIOLibInterface::OpenSeaMaxInterface(QString MasterModuleIP)
|
||||
{
|
||||
QString Address = "sealevel_tcp://";
|
||||
Address += MasterModuleIP;
|
||||
CEngLog::instance()->AddLogString(QString("Connexion aux modules externes : " + Address),1);
|
||||
if(mSeaMaxInterface.Open(Address.toAscii().data()) < 0)
|
||||
{
|
||||
|
||||
//Try to connect 2 times... sometimes the first connection is not successful
|
||||
if(mSeaMaxInterface.Open(Address.toAscii().data()) < 0)
|
||||
{
|
||||
CEngLog::instance()->AddLogString(QString("").sprintf("Connexion aux modules externes impossible à l'adresse: %s",Address.toAscii().data()),1);
|
||||
mIsOpened = false;
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CEngLog::instance()->AddLogString("Connexion aux modules externes établie",3);
|
||||
mIsOpened = true;
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
CSeaMaxLin *CSeaIOLibInterface::GetSeaMaxInterfacePtr()
|
||||
{
|
||||
if(mIsOpened == true)
|
||||
return &mSeaMaxInterface;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121213 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SEAIOLIBINTERFACE_H
|
||||
#define SEAIOLIBINTERFACE_H
|
||||
#include "GlobalDefine.h"
|
||||
#include "seamaxlin.h"
|
||||
#include <QString>
|
||||
|
||||
class CSeaIOLibInterface
|
||||
{
|
||||
public:
|
||||
|
||||
CSeaIOLibInterface();
|
||||
~CSeaIOLibInterface();
|
||||
|
||||
unsigned int OpenSeaMaxInterface(QString MasterModuleIP);
|
||||
CSeaMaxLin * GetSeaMaxInterfacePtr(void);
|
||||
void CloseSeaMaxInterface();
|
||||
|
||||
private:
|
||||
|
||||
CSeaMaxLin mSeaMaxInterface;
|
||||
bool mIsOpened;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // SEAIOLIBINTERFACE_H
|
||||
@@ -0,0 +1,33 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121219 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef USB4704DEFINITIONS_H
|
||||
#define USB4704DEFINITIONS_H
|
||||
|
||||
#define USB4704_DAQNAVI_NAME "USB-4704"
|
||||
|
||||
#endif // PCI1756DEFINITIONS_H
|
||||
@@ -0,0 +1,148 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Classe d'interface avec la carte d'I/O PCI1756.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20121219 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "USB4704Interface.h"
|
||||
#include "USB4704Definitions.h"
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
|
||||
CUSB4704Interface::CUSB4704Interface():
|
||||
mOpened(false)
|
||||
{
|
||||
mInputBuf = 0;
|
||||
}
|
||||
|
||||
CUSB4704Interface::~CUSB4704Interface()
|
||||
{
|
||||
mInputCtrl->Dispose();
|
||||
}
|
||||
|
||||
|
||||
unsigned int CUSB4704Interface::OpenInterface()
|
||||
{
|
||||
|
||||
if(mOpened)
|
||||
return RET_ERROR;
|
||||
|
||||
|
||||
|
||||
CEngLog::instance()->AddLogString(QString("Ouverture du module USB externe :"),3);
|
||||
|
||||
mInputCtrl = AdxInstantAiCtrlCreate();
|
||||
ICollection<DeviceTreeNode> *supportedDevices = mInputCtrl->getSupportedDevices();
|
||||
if(supportedDevices->getCount() == 0)
|
||||
{
|
||||
CEngLog::instance()->AddLogString("L'ouverture du module USB a échouée (Aucun module n'est installé)",1);
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
for (int i = 0; i < supportedDevices->getCount(); i++)
|
||||
{
|
||||
DeviceTreeNode const &node = supportedDevices->getItem(i);
|
||||
QString DeviceDescription(QString::fromWCharArray(node.Description));
|
||||
qDebug() << "Device Nbr: " << node.DeviceNumber << " : "<< DeviceDescription;
|
||||
if(QString::fromWCharArray(node.Description).contains(USB4704_DAQNAVI_NAME))
|
||||
{
|
||||
if(mInputCtrl->setSelectedDevice(DeviceInformation(node.Description)) != Success)
|
||||
{
|
||||
CEngLog::instance()->AddLogString("L'ouverture du module USB externe a échouée (Module occupé)",1);
|
||||
supportedDevices->Dispose();
|
||||
mInputCtrl->Dispose();
|
||||
return RET_ERROR;
|
||||
}
|
||||
CEngLog::instance()->AddLogString(QString("Module USB externe initialisé :") + QString::fromWCharArray(node.Description),3);
|
||||
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false)
|
||||
{
|
||||
CEngLog::instance()->AddLogString(QString("").sprintf("Erreur. Incohérence du type de module USB externe"),1);
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
supportedDevices->Dispose();
|
||||
CEngLog::instance()->AddLogString("Module USB externe ouvert avec succès",3);
|
||||
mOpened = true;
|
||||
return RET_OK;
|
||||
|
||||
}
|
||||
|
||||
unsigned int CUSB4704Interface::GetAnalogInput(int Channel,int *Data)
|
||||
{
|
||||
if(mOpened == false)
|
||||
{
|
||||
*Data = 0;
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
int Buf = 0;
|
||||
|
||||
ErrorCode errorCode = Success;
|
||||
mMutex.lock();
|
||||
errorCode = mInputCtrl->Read(Channel,Buf);
|
||||
mMutex.unlock();
|
||||
if(errorCode != Success)
|
||||
{
|
||||
qDebug("USB read Error");
|
||||
*Data = 0;
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
*Data = Buf;
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CUSB4704Interface::GetAnalogInput(int Channel, double &Data)
|
||||
{
|
||||
if(mOpened == false)
|
||||
{
|
||||
Data = 0.0;
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
double Buf = 0;
|
||||
|
||||
ErrorCode errorCode = Success;
|
||||
mMutex.lock();
|
||||
errorCode = mInputCtrl->Read(Channel,Buf);
|
||||
mMutex.unlock();
|
||||
if(errorCode != Success)
|
||||
{
|
||||
qDebug("USB read Error");
|
||||
Data = 0.;
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
Data = Buf;
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### 20140828 JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef USB4704INTERFACE_H
|
||||
#define USB4704INTERFACE_H
|
||||
|
||||
#include <bdaqctrl.h>
|
||||
#include "GlobalDefine.h"
|
||||
#include "AnalogInputModule.h"
|
||||
#include <QMutex>
|
||||
|
||||
using namespace Automation::BDaq;
|
||||
|
||||
class CUSB4704Interface : public CAnalogInputModule
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
|
||||
CUSB4704Interface();
|
||||
~CUSB4704Interface();
|
||||
|
||||
unsigned int OpenInterface(void);
|
||||
virtual unsigned int GetAnalogInput(int Channel, int *Data);
|
||||
virtual unsigned int GetAnalogInput(int Channel, double &Data);
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
InstantAiCtrl *mInputCtrl;
|
||||
bool mOpened;
|
||||
QMutex mMutex;
|
||||
unsigned int mInputBuf;
|
||||
|
||||
};
|
||||
|
||||
#endif // USB4704INTERFACE_H
|
||||
Reference in New Issue
Block a user