3 #ifndef SZA_UTIL_GPIBUSBCONTROLLER_H
4 #define SZA_UTIL_GPIBUSBCONTROLLER_H
23 #define GPIB_RESPONSE_HANDLER(fn) bool (fn)(void* arg)
32 class GpibUsbControllerMsg :
public GenericTaskMsg {
41 unsigned char cmd_[100];
42 bool expectsResponse_;
43 GPIB_RESPONSE_HANDLER(*responseHandler_);
53 class GpibUsbController :
public SerialClient,
public SpawnableTask<GpibUsbControllerMsg> {
58 GpibUsbController(
bool doSpawn=
false);
59 GpibUsbController(std::string port,
bool doSpawn=
false);
63 virtual ~GpibUsbController();
70 int connectAndClear();
78 void setAuto(
bool doAuto);
87 void setMode(Mode mode);
91 virtual void setAddress(
unsigned address);
92 virtual unsigned getAddress();
96 void setEoi(
bool sendEoi);
101 std::string getVersion();
105 std::string getHelp();
116 void setEos(
unsigned);
117 std::string getEos();
121 void clearInterface();
125 void resetController();
132 void enableEot(
bool enable);
137 void setEotChar(
char eot);
145 std::string getDevice();
157 void clearDeviceInterface();
161 std::string getSelfTest();
167 std::ostringstream response_;
176 static GPIB_RESPONSE_HANDLER(checkString);
180 friend class GpibUsbDevice;
193 std::string devName_;
194 std::string lastCmd_;
195 bool expectingResponse_;
196 GPIB_RESPONSE_HANDLER(*responseHandler_);
205 void initialize(
bool doSpawn);
206 void serviceMsgQ(
void);
207 void processMsg(GpibUsbControllerMsg* msg);
211 void suspendProcessingMessages(
bool suspend);
215 void watchForResponse(
bool watch);
219 void respondToTimeOut();
227 void respondToUnexpectedInput();
229 void sendDeviceCommand(std::string cmd,
bool expectsResponse=
false,
230 GPIB_RESPONSE_HANDLER(*handler)=0,
bool block=
false,
233 void sendControllerCommand(std::string cmd,
bool expectsResponse=
false,
234 GPIB_RESPONSE_HANDLER(*handler)=0,
bool block=
false,
void* retVal=0);
236 virtual void sendCommand(std::string cmd, Receiver rx,
bool expectsResponse=
false,
237 GPIB_RESPONSE_HANDLER(*handler)=0,
bool block=
false,
void* retVal=0);
239 void executeCommand(std::string cmd,
bool expectsResponse,
240 GPIB_RESPONSE_HANDLER(*handler), CondVar* condVar,
void* retVal);
244 void executeConnect(
void* retVal);
246 static GPIB_RESPONSE_HANDLER(checkHandler);
248 static GPIB_RESPONSE_HANDLER(checkAddress);
249 static GPIB_RESPONSE_HANDLER(checkDevice);
250 static GPIB_RESPONSE_HANDLER(checkCompletion);
259 #endif // End #ifndef SZA_UTIL_GPIBUSBCONTROLLER_H
Tagged: Fri Nov 14 12:39:34 UTC 2003.
Tagged: Mon May 10 15:32:08 PDT 2004.
Tagged: Thu Oct 18 13:20:31 PDT 2007.
Tagged: Tue May 2 16:31:46 PDT 2006.
Tagged: Fri Jan 26 16:49:57 NZDT 2007.