Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /src/gpib/gpib_class.cc [e63548] .. [3a7836] Maximize Restore

  Switch to side-by-side view

--- a/src/gpib/gpib_class.cc
+++ b/src/gpib/gpib_class.cc
@@ -73,10 +73,10 @@
     return 1;
 }
 
-int octave_gpib::read(uint8_t *buf, unsigned int len)
-{
-    int gperr,fd;
-    int bytes_read = 0, read_retval = -1;
+int octave_gpib::read(uint8_t *buf, unsigned int len, bool *eoi)
+{
+    int gperr,fd;
+    int bytes_read = 0;
 
     if (this->minor < 0)
     {
@@ -203,7 +203,7 @@
     fd = ibdev(this->minor, this->gpibid, this->sad, this->timeout, this->send_eoi, this->eos_mode);
     if (fd < 0)
     {
-        error("gpib_read: error opening gpib device...");
+        error("gpib_write: error opening gpib device...");
         return -1;
     }
 
@@ -219,6 +219,94 @@
     ibonl(fd,0);
 
     return gperr;
+}
+
+int octave_gpib::spoll(char *rqs)
+{
+    int gperr,fd;
+
+    if (this->minor < 0)
+    {
+        error("gpib_spoll: Interface must be opened first...");
+        return -1;
+    }
+
+    fd = ibdev(this->minor, this->gpibid, this->sad, this->timeout, this->send_eoi, this->eos_mode);
+    if (fd < 0)
+    {
+        error("gpib_spoll: error opening gpib device...");
+        return -1;
+    }
+
+    gperr = ibrsp(fd,rqs);
+    if (gperr & ERR) {
+        error ("gpib_spoll: some error occured: %d",  ThreadIberr ());
+        return -1;
+    }
+    //warning ("aaa: %X - %X",gperr, buf);
+
+    ibonl(fd,0);
+
+    return gperr;
+
+}
+
+int octave_gpib::trigger()
+{
+    int gperr,fd;
+
+    if (this->minor < 0)
+    {
+        error("gpib_trigger: Interface must be opened first...");
+        return -1;
+    }
+
+    fd = ibdev(this->minor, this->gpibid, this->sad, this->timeout, this->send_eoi, this->eos_mode);
+    if (fd < 0)
+    {
+        error("gpib_trigger: error opening gpib device...");
+        return -1;
+    }
+
+    gperr = ibtrg(fd);
+    if (gperr & ERR) {
+        error ("gpib_trigger: some error occured: %d",  ThreadIberr ());
+        return -1;
+    }
+
+    ibonl(fd,0);
+
+    return gperr;
+
+}
+
+int octave_gpib::cleardevice()
+{
+    int gperr,fd;
+
+    if (this->minor < 0)
+    {
+        error("gpib_clear: Interface must be opened first...");
+        return -1;
+    }
+
+    fd = ibdev(this->minor, this->gpibid, this->sad, this->timeout, this->send_eoi, this->eos_mode);
+    if (fd < 0)
+    {
+        error("gpib_clear: error opening gpib device...");
+        return -1;
+    }
+
+    gperr = ibclr(fd);
+    if (gperr & ERR) {
+        error ("gpib_clear: some error occured: %d",  ThreadIberr ());
+        return -1;
+    }
+
+    ibonl(fd,0);
+
+    return gperr;
+
 }
 
 int octave_gpib::set_timeout(int timeout)