WPOCT Software Developer's Kit (SDK)
SDK For using Wasatch Photonics OCT Spectrometers
IWPOCTController.h
Go to the documentation of this file.
1 
6 #pragma once
7 
9 typedef void (*SendNoParams) (void*);
10 typedef void (*NotifyErrorCallback)(bool);
11 
75 {
76 public:
77 
79  // Data Types
81 
85  enum ErrorCode
86  {
87  NoError = 0,
88  PortNotOpen = 1,
89  PortFailedToOpen = 2,
90  PortFailedToClose = 3,
91  LostConnection = 4,
92  CommunicationError = 5,
93  UnrecognizedCommand = 6,
94  InvalidCommandValues = 7,
95  MissingCommandParameter = 8,
96  InvalidResponse = 9,
97  NumErrors = 10
98  };
99 
104  {
105  PortClosed = 0,
106  PortOpened = 1,
107  CommandProcessed = 2,
108  Busy = 4,
109  NumStates = 8
110  };
111 
113  // Lifecycle
115 
117  virtual ~IWPOCTController() { }
118 
120  // Getters
122 
125  virtual bool IsPortOpen () const = 0;
126 
129  virtual bool IsLightOn (int index) = 0;
130 
133  virtual bool IsScanning () const = 0;
134 
137  virtual int GetBaudRate () const = 0;
138 
141  virtual int GetNumStopBits () const = 0;
142 
145  virtual int GetPortTimeout () const = 0;
146 
149  virtual bool GetMonitorPort () const = 0;
150 
153  virtual bool GetReadResponse () const = 0;
154 
157  virtual const char* GetVersion () const = 0;
158 
161  virtual int GetAScans () const = 0;
162 
165  virtual int GetBScans () const = 0;
166 
169  virtual int GetFoci () const = 0;
170 
173  virtual int GetDelay () const = 0;
174 
177  virtual int GetPulse () const = 0;
178 
181  virtual int GetPhase () const = 0;
182 
185  virtual int GetArmPosition () const = 0;
186 
192  virtual void GetScanArea (int* xStart, int* xStop, int* yStart, int* yStop) const = 0;
193 
197  virtual void GetMirror (int* major, int* minor) const = 0;
198 
202  virtual bool GetSwapXY () const = 0;
203 
207  virtual const char* GetPortName () = 0;
208 
212  virtual const char* GetLastCommandSent () const = 0;
213 
216  virtual const char* GetLastResponse () const = 0;
217 
220  virtual int GetXRampMinPos() const = 0;
221 
224  virtual int GetXRampMaxPos() const = 0;
225 
228  virtual int GetYRampMinPos() const = 0;
229 
232  virtual int GetYRampMaxPos() const = 0;
233 
236  virtual int GetXRampStartPos() const = 0;
237 
240  virtual int GetXRampStopPos () const = 0;
241 
244  virtual int GetYRampStartPos() const = 0;
245 
248  virtual int GetYRampStopPos () const = 0;
249 
252  virtual int GetPathMotorPosMax () const = 0;
253 
256  virtual int GetQuarterHalfWavePosMax() const = 0;
257 
259  // Setters
261 
265  virtual bool SetAScans (int value) = 0;
266 
270  virtual bool SetBScans (int value) = 0;
271 
274  virtual bool SetFoci (int value) = 0;
275 
279  virtual bool SetDelay (int value) = 0;
280 
284  virtual bool SetPulse (int value) = 0;
285 
289  virtual bool SetPhase (int value) = 0;
290 
294  virtual bool SetArmPosition (int position) = 0;
295 
302  virtual bool SetScanArea (int xStart, int xStop, int yStart, int yStop) = 0;
303 
311  virtual bool SetScanArea (int xStart, int xStop, int yStart, int yStop, int numPasses) = 0;
312 
315  virtual bool SetMirror (int major, int minor) = 0;
316 
320  virtual bool SetSwapXY (bool value) = 0;
321 
325  virtual bool SetXRampMinPos (int value) = 0;
326 
330  virtual bool SetXRampMaxPos (int value) = 0;
331 
335  virtual bool SetYRampMinPos (int value) = 0;
336 
340  virtual bool SetYRampMaxPos (int value) = 0;
341 
345  virtual bool SetReadResponse (bool value) = 0;
346 
349  virtual bool SetPathMotorPosMax (int value) = 0;
350 
353  virtual bool SetQuarterHalfWavePosMax(int value) = 0;
354 
356  // Serial port commands
358 
369  virtual bool OpenPort (const char* portName, int baudRate, int numStopBits,
370  int timeout, bool monitorConnection) = 0;
371 
381  virtual bool OpenPort (int baudRate, int numStopBits, int timeout, bool monitorConnection) = 0;
382 
386  virtual bool OpenPort () = 0;
387 
390  virtual bool ClosePort () = 0;
391 
405  virtual bool SendCommand (const char* command, char* response, int maxResponseSize) = 0;
406 
418  virtual bool SendCommand (const char* command) = 0;
419 
421  // Light commands
423 
427  virtual bool TurnLightOn (int num) = 0;
428 
432  virtual bool TurnLightOff (int num) = 0;
433 
436  virtual bool TurnLightsOff () = 0;
437 
439  // Scanner Commands
441 
444  virtual bool StartScan () = 0;
445 
448  virtual bool StopScan () = 0;
449 
451  // Movement Commands
453 
456  virtual bool ParkArm () = 0;
457 
460  virtual bool SendMotorsHome () = 0;
461 
463  // Optical switch commands
465 
468  virtual int GetActiveOpticalPort () = 0;
469 
473  virtual bool SetActiveOpticalPort (int port) = 0;
474 
477  virtual bool ToggleOpticalSwitch () = 0;
478 
480  // Shutter commands
482 
483  virtual bool IsShutterOpen (int ID, bool* open) = 0;
484  virtual bool OpenShutter (int ID) = 0;
485  virtual bool CloseShutter (int ID) = 0;
486 
488  // Status Commands
490 
494 
499 
508  virtual void SetSerialPortLostCallback (NotifyErrorCallback notifyError) = 0;
509 
517  virtual void SetSerialPortLostCallback2 (SendNoParams serialPortLost, void* context) = 0;
518 
519 // Include the section below when compiling with Swig.
520 #ifdef _RUNSWIG
523  static IWPOCTController* GetOCTController();
524 
527  static bool DestroyOCTController();
528 };
529 
530 // Include the section below when compiling in Visual Studio.
531 #else
532 };
533 #ifdef __cplusplus
534 extern "C" {
535 #endif
536 
539 __declspec(dllexport) IWPOCTController* GetOCTController();
540 
543 __declspec(dllexport) bool DestroyOCTController();
544 
545 #ifdef __cplusplus
546 }
547 #endif
548 #endif
void(* SendNoParams)(void *)
Typedefs for callbacks.
Definition: IWPOCTController.h:9
__declspec(dllexport) IWPOCTController *GetOCTController()
Gets the instance of the controller object.
Definition: IWPOCTController.cpp:13
The WPOCT Controller is packaged as a toolkit and provides a set of application programming interface...
Definition: IWPOCTController.h:75
virtual bool SetActiveOpticalPort(int port)=0
Sets the optical switch to the specified port.
virtual bool SetAScans(int value)=0
Sets the number of A-scans sent out in a frame (B-scan).
virtual bool ToggleOpticalSwitch()=0
Toggles the optical switch from one position to the other.
virtual bool GetSwapXY() const =0
Gets the value of the SwapXY flag.
virtual const char * GetVersion() const =0
Get the firmware version of the controller.
virtual bool SetSwapXY(bool value)=0
Sets the SwapXY flag.
virtual int GetAScans() const =0
Gets the number of A-scans per B-scan output by the controller.
virtual bool ParkArm()=0
Park the reference arm.
virtual bool OpenPort(const char *portName, int baudRate, int numStopBits, int timeout, bool monitorConnection)=0
Open the specified port with the parameters supplied.
virtual int GetPulse() const =0
Gets the size of the timing pulse in milliseconds that is used to trigger an A-scan.
virtual IWPOCTController::ErrorCode GetLastError() const =0
Gets the result of the most current operation.
virtual bool StartScan()=0
Start the scan using the parameters previously specified.
virtual bool SetPulse(int value)=0
Sets the pulse duration value in quarter milliseconds.
virtual const char * GetLastResponse() const =0
Get the last response from the serial port.
virtual int GetNumStopBits() const =0
Gets the number of stop bits used to communicate with the controller.
virtual bool SetYRampMaxPos(int value)=0
Set the max y ramp value.
virtual int GetDelay() const =0
Gets the delay in milliseconds between the end of one pulse and the start of another.
virtual bool SetReadResponse(bool value)=0
Sets the flag that determines if the response from the serial port is read after a command is issued.
virtual int GetXRampStopPos() const =0
Get the x ramp stop position.
virtual bool TurnLightOn(int num)=0
Turns the specified light on.
virtual bool SetScanArea(int xStart, int xStop, int yStart, int yStop)=0
Set the limits of the scanning area (each value is between 1500 and 52000).
virtual bool IsLightOn(int index)=0
Returns whether the given light is on or off.
virtual int GetYRampStopPos() const =0
Get the y ramp stop position.
virtual int GetPhase() const =0
Get the phase delay.
virtual bool TurnLightsOff()=0
Turns all lights off.
virtual int GetXRampMaxPos() const =0
Get the x ramp max position.
virtual bool SetScanArea(int xStart, int xStop, int yStart, int yStop, int numPasses)=0
Set the limits of the scanning area (each value is between 1500 and 52000).
virtual bool SetArmPosition(int position)=0
Sets the reference arm position.
virtual bool SendMotorsHome()=0
Send all motors to their home position (position 0).
virtual void GetMirror(int *major, int *minor) const =0
Get the major and minor mirror values.
virtual bool SetMirror(int major, int minor)=0
Set the major and minor mirror values.
virtual int GetYRampMinPos() const =0
Get the y ramp min position.
virtual bool SendCommand(const char *command, char *response, int maxResponseSize)=0
Send a command to the serial port and receive its response back if GetReadResponse() is true.
virtual bool SetXRampMaxPos(int value)=0
Sets the maximum scan position in the x direction.
virtual void SetSerialPortLostCallback(NotifyErrorCallback notifyError)=0
Sets the callback to run if the serial port connection is lost.
virtual bool ClosePort()=0
Close the serial port.
virtual int GetYRampStartPos() const =0
Get the y ramp start position.
virtual bool OpenPort()=0
Open the port using the default or previous parameters.
virtual bool SendCommand(const char *command)=0
Send a command to the serial port.
virtual int GetXRampMinPos() const =0
Get the x ramp min position.
virtual bool GetReadResponse() const =0
Gets the flag that determines if the response is read from the serial port after each command is sent...
virtual int GetPortTimeout() const =0
Gets the timeout period of the serial port in milliseconds.
virtual bool TurnLightOff(int num)=0
Turns the specified light off.
virtual bool IsScanning() const =0
Returns the scanning state.
virtual bool SetPhase(int value)=0
Sets the phase delay value in milliseconds.
virtual int GetBScans() const =0
Gets the number of B-scans output by the controller.
virtual bool SetXRampMinPos(int value)=0
Sets the minimum scan position in the x direction.
virtual bool StopScan()=0
Stop the scan.
ErrorCode
The following are error codes that are used within the controller.
Definition: IWPOCTController.h:86
virtual void SetSerialPortLostCallback2(SendNoParams serialPortLost, void *context)=0
Sets the callback to run if the serial port connection is lost.
virtual int GetYRampMaxPos() const =0
Get the y ramp max position.
virtual int GetArmPosition() const =0
Get the reference arm position.
virtual int GetXRampStartPos() const =0
Get the x ramp start position.
virtual bool SetFoci(int value)=0
Sets the foci value.
virtual int GetQuarterHalfWavePosMax() const =0
Gets the max possible value of the quarter and half wave motors’ position.
virtual int GetActiveOpticalPort()=0
Gets the active optical port.
virtual int GetFoci() const =0
Get the foci value.
CurrentStates
The following are status codes that are used within the controller.
Definition: IWPOCTController.h:104
virtual void GetScanArea(int *xStart, int *xStop, int *yStart, int *yStop) const =0
Get the limits of the scanning area (each value is between 1500 and 52000).
virtual bool GetMonitorPort() const =0
Gets the flag that determines if serial port is constantly being monitored for a connection.
virtual ~IWPOCTController()
Destructor
Definition: IWPOCTController.h:117
virtual int GetPathMotorPosMax() const =0
Gets the max possible value of the path motor.
virtual bool IsPortOpen() const =0
Returns whether the port is open or closed.
virtual bool SetDelay(int value)=0
Sets the delay value in quarter milliseconds.
virtual bool SetPathMotorPosMax(int value)=0
Sets the max possible value of the path motor.
virtual bool SetYRampMinPos(int value)=0
Set the min y ramp value.
virtual bool OpenPort(int baudRate, int numStopBits, int timeout, bool monitorConnection)=0
Open the specified port.
virtual const char * GetLastCommandSent() const =0
Get the last command sent.
virtual IWPOCTController::CurrentStates GetCurrentStatus() const =0
Gets the current status of the controller.
virtual bool SetBScans(int value)=0
Sets the number of B-scans sent out.
virtual int GetBaudRate() const =0
Gets the baud rate used to communicate with the controller.
virtual const char * GetPortName()=0
Gets the name of the serial port used by the controller.
virtual bool SetQuarterHalfWavePosMax(int value)=0
Sets the max possible value of the quarter and half wave motor position.