gpib.h
1 /***************************************************************************
2  Copyright (C) 2002-2015 Kentaro Kitagawa
3  kitagawa@phys.s.u-tokyo.ac.jp
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  You should have received a copy of the GNU Library General
11  Public License and a list of authors along with this program;
12  see the files COPYING and AUTHORS.
13 ***************************************************************************/
14 #ifndef GPIB_H_
15 #define GPIB_H_
16 
17 #include "charinterface.h"
18 
19 #ifdef HAVE_LINUX_GPIB
20 #define GPIB_NI
21 #endif
22 
23 #ifdef HAVE_NI488
24 #define GPIB_NI
25 #endif
26 
27 #if defined GPIB_WIN32_IF_4304 || defined GPIB_NI
28 #define USE_GPIB
29 #endif
30 
31 #ifdef GPIB_NI
32 
33 class XNIGPIBPort : public XPort
34 {
35 public:
36  XNIGPIBPort(XCharInterface *interface);
37  virtual ~XNIGPIBPort();
38 
39  virtual void open(const XCharInterface *pInterface) throw (XInterface::XCommError &);
40  virtual void send(const char *str) throw (XInterface::XCommError &);
41  virtual void write(const char *sendbuf, int size) throw (XInterface::XCommError &);
42  virtual void receive() throw (XInterface::XCommError &);
43  virtual void receive(unsigned int length) throw (XInterface::XCommError &);
44 
45 private:
46  int m_ud;
47  void gpib_close() throw (XInterface::XCommError &);
48  void gpib_open() throw (XInterface::XCommError &);
49  void gpib_reset() throw (XInterface::XCommError &);
50  void gpib_spoll_before_write() throw (XInterface::XCommError &);
51  void gpib_spoll_before_read() throw (XInterface::XCommError &);
52  XString gpibStatus(const XString &msg);
53  unsigned int gpib_receive(unsigned int est_length, unsigned int max_length)
54  throw (XInterface::XCommError &);
55  static int s_cntOpened;
56  static XMutex s_lock;
57 
58  bool m_bGPIBUseSerialPollOnWrite;
59  bool m_bGPIBUseSerialPollOnRead;
60  int m_gpibWaitBeforeWrite;
61  int m_gpibWaitBeforeRead;
62  int m_gpibWaitBeforeSPoll;
63  unsigned char m_gpibMAVbit; //! don't check if zero
64 
65  unsigned int m_address;
66 };
67 
68 typedef XNIGPIBPort XGPIBPort;
69 
70 #endif /*GPIB_NI*/
71 
72 #endif /*GPIB_H_*/

Generated for KAME4 by  doxygen 1.8.3