Commit 11ded1ab authored by Abdelali Elaazzouzi's avatar Abdelali Elaazzouzi Committed by Abdelali Elaazzouzi

add gpib driver

parent 12790359
......@@ -30,13 +30,12 @@
namespace fughcp {
const std::string FugHCPDriver::TYPE = "FugHCP";
const std::string FugHCPDriver::TYPE = "OldFugHCP";
/*
* Constructor
*/
FugHCPDriver::FugHCPDriver(const std::string& name) : voltage::VoltageCommon(name) {
driver::RS232::init(name);
registerStates(new RealFugHCPDriver(this), new PerfectFugHCPDriver(this), new SimulatedFugHCPDriver(this));
......
......@@ -40,7 +40,7 @@ namespace fughcp {
* The FugHCP device is a windows computer which running the Fug software made with LabView.
* It is connected to the nomad server using RS232 protocol.
*/
class FugHCPDriver: public voltage::VoltageCommon, public driver::RS232 {
class FugHCPDriver: public voltage::VoltageCommon {
friend class RealFugHCPDriver;
friend class PerfectFugHCPDriver;
......@@ -70,6 +70,13 @@ public:
Property<float64> currentLimit;
protected:
virtual void writeFug(const std::string& aData, bool doClear = false) {
}
virtual void readFug(std::string& aData, const std::string aEnd) {
}
private:
/*!
......
<module name="fughcp">
<driver class="fughcp::FugHCPDriver"/>
<driver class="fughcp::RS232FugHCPDriver"/>
<driver class="fughcp::GPIBFugHCPDriver"/>
</module>
\ No newline at end of file
......@@ -62,8 +62,8 @@ void RealFugHCPDriver::readStatus() {
string status;
ostringstream buf_out1;
buf_out1 << GET_STATUS << TERMINATOR;
owner()->write(buf_out1.str(), true);
owner()->read(status, TERMINATOR);
owner()->writeFug(buf_out1.str(), true);
owner()->readFug(status, TERMINATOR);
char OutputStatus = status[CHAR_OUTPUT_POS_STATUS];
// Test System status
switch (OutputStatus) {
......@@ -141,8 +141,8 @@ void RealFugHCPDriver::read() {
ostringstream buf1;
buf1 << READ_VOLTAGE << TERMINATOR;
owner()->write(buf1.str());
owner()->read(buf_in, TERMINATOR);
owner()->writeFug(buf1.str());
owner()->readFug(buf_in, TERMINATOR);
istringstream sbuf2(buf_in.substr(3));
float64 outputVoltage;
......@@ -153,8 +153,8 @@ void RealFugHCPDriver::read() {
ostringstream buf2;
buf2 << READ_CURRENT << TERMINATOR;
owner()->write(buf2.str());
owner()->read(buf_in2, TERMINATOR);
owner()->writeFug(buf2.str());
owner()->readFug(buf_in2, TERMINATOR);
istringstream sbuf3(buf_in2.substr(3));
float64 outputCurrent;
......@@ -170,11 +170,11 @@ void RealFugHCPDriver::readInfos() {
string buf_in;
ostringstream buf_out;
buf_out << READ_VERSION << TERMINATOR;
owner()->write(buf_out.str());
owner()->read(buf_in, TERMINATOR);
owner()->writeFug(buf_out.str());
owner()->readFug(buf_in, TERMINATOR);
// remove \n
buf_in.resize(buf_in.size() - TERMINATOR_SIZE);
owner()->version = buf_in;
owner()->version.update(buf_in);
}
/*
......@@ -236,8 +236,8 @@ string RealFugHCPDriver::writeFugHCP(const std::string& aCommand) {
ostringstream buf_out;
string buf_in;
buf_out << aCommand << TERMINATOR;
owner()->write(buf_out.str());
owner()->read(buf_in, TERMINATOR);
owner()->writeFug(buf_out.str());
owner()->readFug(buf_in, TERMINATOR);
return buf_in;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment