|
WPOCT Software Developer's Kit (SDK)
SDK For using Wasatch Photonics OCT Spectrometers
|
The WPOCT Controller is packaged as a toolkit and provides a set of application programming interfaces (APIs) that are designed to control and monitor the OCT engine board sold by Wasatch Photonics. More...
#include <IWPOCTController.h>


Public Types | |
| enum | ErrorCode { NoError = 0 , PortNotOpen = 1 , PortFailedToOpen = 2 , PortFailedToClose = 3 , LostConnection = 4 , CommunicationError = 5 , UnrecognizedCommand = 6 , InvalidCommandValues = 7 , MissingCommandParameter = 8 , InvalidResponse = 9 , NumErrors = 10 , NoError = 0 , PortNotOpen = 1 , PortFailedToOpen = 2 , PortFailedToClose = 3 , LostConnection = 4 , CommunicationError = 5 , UnrecognizedCommand = 6 , InvalidCommandValues = 7 , MissingCommandParameter = 8 , InvalidResponse = 9 , NumErrors = 10 } |
| The following are error codes that are used within the controller. More... | |
| enum | CurrentStates { PortClosed = 0 , PortOpened = 1 , CommandProcessed = 2 , Busy = 4 , NumStates = 8 , PortClosed = 0 , PortOpened = 1 , CommandProcessed = 2 , Busy = 4 , NumStates = 8 } |
| The following are status codes that are used within the controller. More... | |
| enum class | ErrorCode { NoError = 0 , PortNotOpen = 1 , PortFailedToOpen = 2 , PortFailedToClose = 3 , LostConnection = 4 , CommunicationError = 5 , UnrecognizedCommand = 6 , InvalidCommandValues = 7 , MissingCommandParameter = 8 , InvalidResponse = 9 , NumErrors = 10 , NoError = 0 , PortNotOpen = 1 , PortFailedToOpen = 2 , PortFailedToClose = 3 , LostConnection = 4 , CommunicationError = 5 , UnrecognizedCommand = 6 , InvalidCommandValues = 7 , MissingCommandParameter = 8 , InvalidResponse = 9 , NumErrors = 10 } |
| enum class | CurrentStates { PortClosed = 0 , PortOpened = 1 , CommandProcessed = 2 , Busy = 4 , NumStates = 8 , PortClosed = 0 , PortOpened = 1 , CommandProcessed = 2 , Busy = 4 , NumStates = 8 } |
Public Member Functions | |
| virtual | ~IWPOCTController () |
| Destructor | |
| virtual bool | IsPortOpen () const =0 |
| Returns whether the port is open or closed. More... | |
| virtual bool | IsLightOn (int index)=0 |
| Returns whether the given light is on or off. More... | |
| virtual bool | IsScanning () const =0 |
| Returns the scanning state. More... | |
| virtual int | GetBaudRate () const =0 |
| Gets the baud rate used to communicate with the controller. More... | |
| virtual int | GetNumStopBits () const =0 |
| Gets the number of stop bits used to communicate with the controller. More... | |
| virtual int | GetPortTimeout () const =0 |
| Gets the timeout period of the serial port in milliseconds. More... | |
| virtual bool | GetMonitorPort () const =0 |
| Gets the flag that determines if serial port is constantly being monitored for a connection. More... | |
| virtual bool | GetReadResponse () const =0 |
| Gets the flag that determines if the response is read from the serial port after each command is sent. More... | |
| virtual const char * | GetVersion () const =0 |
| Get the firmware version of the controller. More... | |
| virtual int | GetAScans () const =0 |
| Gets the number of A-scans per B-scan output by the controller. More... | |
| virtual int | GetBScans () const =0 |
| Gets the number of B-scans output by the controller. More... | |
| virtual int | GetFoci () const =0 |
| Get the foci value. More... | |
| virtual int | GetDelay () const =0 |
| Gets the delay in milliseconds between the end of one pulse and the start of another. More... | |
| virtual int | GetPulse () const =0 |
| Gets the size of the timing pulse in milliseconds that is used to trigger an A-scan. More... | |
| virtual int | GetPhase () const =0 |
| Get the phase delay. More... | |
| virtual int | GetArmPosition () const =0 |
| Get the reference arm position. More... | |
| 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). More... | |
| virtual void | GetMirror (int *major, int *minor) const =0 |
| Get the major and minor mirror values. More... | |
| virtual bool | GetSwapXY () const =0 |
| Gets the value of the SwapXY flag. More... | |
| virtual const char * | GetPortName ()=0 |
| Gets the name of the serial port used by the controller. More... | |
| virtual const char * | GetLastCommandSent () const =0 |
| Get the last command sent. More... | |
| virtual const char * | GetLastResponse () const =0 |
| Get the last response from the serial port. More... | |
| virtual int | GetXRampMinPos () const =0 |
| Get the x ramp min position. More... | |
| virtual int | GetXRampMaxPos () const =0 |
| Get the x ramp max position. More... | |
| virtual int | GetYRampMinPos () const =0 |
| Get the y ramp min position. More... | |
| virtual int | GetYRampMaxPos () const =0 |
| Get the y ramp max position. More... | |
| virtual int | GetXRampStartPos () const =0 |
| Get the x ramp start position. More... | |
| virtual int | GetXRampStopPos () const =0 |
| Get the x ramp stop position. More... | |
| virtual int | GetYRampStartPos () const =0 |
| Get the y ramp start position. More... | |
| virtual int | GetYRampStopPos () const =0 |
| Get the y ramp stop position. More... | |
| virtual int | GetPathMotorPosMax () const =0 |
| Gets the max possible value of the path motor. More... | |
| virtual int | GetQuarterHalfWavePosMax () const =0 |
| Gets the max possible value of the quarter and half wave motors’ position. More... | |
| virtual bool | SetAScans (int value)=0 |
| Sets the number of A-scans sent out in a frame (B-scan). More... | |
| virtual bool | SetBScans (int value)=0 |
| Sets the number of B-scans sent out. More... | |
| virtual bool | SetFoci (int value)=0 |
| Sets the foci value. More... | |
| virtual bool | SetDelay (int value)=0 |
| Sets the delay value in quarter milliseconds. More... | |
| virtual bool | SetPulse (int value)=0 |
| Sets the pulse duration value in quarter milliseconds. More... | |
| virtual bool | SetPhase (int value)=0 |
| Sets the phase delay value in milliseconds. More... | |
| virtual bool | SetArmPosition (int position)=0 |
| Sets the reference arm position. More... | |
| 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). More... | |
| 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). More... | |
| virtual bool | SetMirror (int major, int minor)=0 |
| Set the major and minor mirror values. More... | |
| virtual bool | SetSwapXY (bool value)=0 |
| Sets the SwapXY flag. More... | |
| virtual bool | SetXRampMinPos (int value)=0 |
| Sets the minimum scan position in the x direction. More... | |
| virtual bool | SetXRampMaxPos (int value)=0 |
| Sets the maximum scan position in the x direction. More... | |
| virtual bool | SetYRampMinPos (int value)=0 |
| Set the min y ramp value. More... | |
| virtual bool | SetYRampMaxPos (int value)=0 |
| Set the max y ramp value. More... | |
| 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. More... | |
| virtual bool | SetPathMotorPosMax (int value)=0 |
| Sets the max possible value of the path motor. More... | |
| virtual bool | SetQuarterHalfWavePosMax (int value)=0 |
| Sets the max possible value of the quarter and half wave motor position. More... | |
| virtual bool | OpenPort (const char *portName, int baudRate, int numStopBits, int timeout, bool monitorConnection)=0 |
| Open the specified port with the parameters supplied. More... | |
| virtual bool | OpenPort (int baudRate, int numStopBits, int timeout, bool monitorConnection)=0 |
| Open the specified port. More... | |
| virtual bool | OpenPort ()=0 |
| Open the port using the default or previous parameters. More... | |
| virtual bool | ClosePort ()=0 |
| Close the serial port. More... | |
| 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. More... | |
| virtual bool | SendCommand (const char *command)=0 |
| Send a command to the serial port. More... | |
| virtual bool | TurnLightOn (int num)=0 |
| Turns the specified light on. More... | |
| virtual bool | TurnLightOff (int num)=0 |
| Turns the specified light off. More... | |
| virtual bool | TurnLightsOff ()=0 |
| Turns all lights off. More... | |
| virtual bool | StartScan ()=0 |
| Start the scan using the parameters previously specified. More... | |
| virtual bool | StopScan ()=0 |
| Stop the scan. More... | |
| virtual bool | ParkArm ()=0 |
| Park the reference arm. More... | |
| virtual bool | SendMotorsHome ()=0 |
| Send all motors to their home position (position 0). More... | |
| virtual int | GetActiveOpticalPort ()=0 |
| Gets the active optical port. More... | |
| virtual bool | SetActiveOpticalPort (int port)=0 |
| Sets the optical switch to the specified port. More... | |
| virtual bool | ToggleOpticalSwitch ()=0 |
| Toggles the optical switch from one position to the other. More... | |
| virtual bool | IsShutterOpen (int ID, bool *open)=0 |
| virtual bool | OpenShutter (int ID)=0 |
| virtual bool | CloseShutter (int ID)=0 |
| virtual IWPOCTController::ErrorCode | GetLastError () const =0 |
| Gets the result of the most current operation. More... | |
| virtual IWPOCTController::CurrentStates | GetCurrentStatus () const =0 |
| Gets the current status of the controller. More... | |
| virtual void | SetSerialPortLostCallback (NotifyErrorCallback notifyError)=0 |
| Sets the callback to run if the serial port connection is lost. More... | |
| virtual void | SetSerialPortLostCallback2 (SendNoParams serialPortLost, void *context)=0 |
| Sets the callback to run if the serial port connection is lost. More... | |
| virtual void | Dispose () |
| virtual bool | IsPortOpen () |
| virtual bool | IsLightOn (int index) |
| virtual bool | IsScanning () |
| virtual int | GetBaudRate () |
| virtual int | GetNumStopBits () |
| virtual int | GetPortTimeout () |
| virtual bool | GetMonitorPort () |
| virtual bool | GetReadResponse () |
| virtual string | GetVersion () |
| virtual int | GetAScans () |
| virtual int | GetBScans () |
| virtual int | GetFoci () |
| virtual int | GetDelay () |
| virtual int | GetPulse () |
| virtual int | GetPhase () |
| virtual int | GetArmPosition () |
| virtual void | GetScanArea (ref int xStart, ref int xStop, ref int yStart, ref int yStop) |
| virtual void | GetMirror (ref int major, ref int minor) |
| virtual bool | GetSwapXY () |
| virtual string | GetPortName () |
| virtual string | GetLastCommandSent () |
| virtual string | GetLastResponse () |
| virtual int | GetXRampMinPos () |
| virtual int | GetXRampMaxPos () |
| virtual int | GetYRampMinPos () |
| virtual int | GetYRampMaxPos () |
| virtual int | GetXRampStartPos () |
| virtual int | GetXRampStopPos () |
| virtual int | GetYRampStartPos () |
| virtual int | GetYRampStopPos () |
| virtual int | GetPathMotorPosMax () |
| virtual int | GetQuarterHalfWavePosMax () |
| virtual bool | SetAScans (int value) |
| virtual bool | SetBScans (int value) |
| virtual bool | SetFoci (int value) |
| virtual bool | SetDelay (int value) |
| virtual bool | SetPulse (int value) |
| virtual bool | SetPhase (int value) |
| virtual bool | SetArmPosition (int position) |
| virtual bool | SetScanArea (int xStart, int xStop, int yStart, int yStop) |
| virtual bool | SetScanArea (int xStart, int xStop, int yStart, int yStop, int numPasses) |
| virtual bool | SetMirror (int major, int minor) |
| virtual bool | SetSwapXY (bool value) |
| virtual bool | SetXRampMinPos (int value) |
| virtual bool | SetXRampMaxPos (int value) |
| virtual bool | SetYRampMinPos (int value) |
| virtual bool | SetYRampMaxPos (int value) |
| virtual bool | SetReadResponse (bool value) |
| virtual bool | SetPathMotorPosMax (int value) |
| virtual bool | SetQuarterHalfWavePosMax (int value) |
| virtual bool | OpenPort (string portName, int baudRate, int numStopBits, int timeout, bool monitorConnection) |
| virtual bool | OpenPort (int baudRate, int numStopBits, int timeout, bool monitorConnection) |
| virtual bool | OpenPort () |
| virtual bool | ClosePort () |
| virtual bool | SendCommand (string command, string response, int maxResponseSize) |
| virtual bool | SendCommand (string command) |
| virtual bool | TurnLightOn (int num) |
| virtual bool | TurnLightOff (int num) |
| virtual bool | TurnLightsOff () |
| virtual bool | StartScan () |
| virtual bool | StopScan () |
| virtual bool | ParkArm () |
| virtual bool | SendMotorsHome () |
| virtual int | GetActiveOpticalPort () |
| virtual bool | SetActiveOpticalPort (int port) |
| virtual bool | ToggleOpticalSwitch () |
| virtual bool | IsShutterOpen (int ID, ref bool open) |
| virtual bool | OpenShutter (int ID) |
| virtual bool | CloseShutter (int ID) |
| virtual IWPOCTController.ErrorCode | GetLastError () |
| virtual IWPOCTController.CurrentStates | GetCurrentStatus () |
| virtual void | SetSerialPortLostCallback (SerialPortLost notifyError) |
Static Public Member Functions | |
| static IWPOCTController | GetOCTController () |
| static bool | DestroyOCTController () |
Protected Attributes | |
| bool | swigCMemOwn |
The WPOCT Controller is packaged as a toolkit and provides a set of application programming interfaces (APIs) that are designed to control and monitor the OCT engine board sold by Wasatch Photonics.
This section gives a description of the API categories available through WPOCT Controller. For a full description of each API, please refer to the method documentation below.
These commands create a controller object and passes back a pointer to the object, which can then be used to call the worker APIs.
These APIs delete an object created by the creation call above. The controller object is passed to the API as a parameter.
The Get commands return some piece of information about the object that called it. The object’s state does not change when calling one of these commands.
The Set commands change the state of the object that the command acts on.
These commands are used to set the number of A-scans per B-scan, the delay, the scan area, etc.
The serial port commands open, close, and send commands directly to the board. Commands issued are first checked for completeness, bounds checked, and then sent to the board. A response is sent back to the user.
The light commands control whether light 0 and light 1 are on or off.
The commands start and stop scanning.
The movement commands move the reference arm or the motors from one position to another.
The optical switch commands get the switch position and switch the optical switch from one position to the other. There are two possible switch positions.
The status API returns the current status of the controller. It can be used to ensure the controller is working properly. The GetLastError command gets the most recent error code.
The following are status codes that are used within the controller.
They are part of the CurrentStates enum, which can be employed by the user.
One or more codes will be returned when calling GetCurrentStatus().
The following are error codes that are used within the controller.
They are part of the ErrorCodes enum, which can be employed by the user. One code will be returned when calling GetLastError().
|
pure virtual |
|
pure virtual |
|
pure virtual |
Get the reference arm position.
Implemented in WPScanController.
|
pure virtual |
Gets the number of A-scans per B-scan output by the controller.
Implemented in WPScanController.
|
pure virtual |
Gets the baud rate used to communicate with the controller.
Implemented in WPScanController.
|
pure virtual |
Gets the number of B-scans output by the controller.
Implemented in WPScanController.
|
pure virtual |
Gets the current status of the controller.
Implemented in WPScanController.
|
pure virtual |
Gets the delay in milliseconds between the end of one pulse and the start of another.
Implemented in WPScanController.
|
pure virtual |
|
pure virtual |
Get the last command sent.
The char array returned may be different from what the user sent in a SendCommand.
Implemented in WPScanController.
|
pure virtual |
Gets the result of the most current operation.
Implemented in WPScanController.
|
pure virtual |
Get the last response from the serial port.
Implemented in WPScanController.
|
pure virtual |
Get the major and minor mirror values.
| major[out] | pointer to an int that will receive the mirror’s major value |
| minor[out] | pointer to an int that will receive the mirror’s minor value |
Implemented in WPScanController.
|
pure virtual |
Gets the flag that determines if serial port is constantly being monitored for a connection.
Default is false.
Implemented in WPScanController.
|
pure virtual |
Gets the number of stop bits used to communicate with the controller.
Implemented in WPScanController.
|
pure virtual |
Gets the max possible value of the path motor.
Implemented in WPScanController.
|
pure virtual |
Get the phase delay.
Should not be greater that trdelay.
Implemented in WPScanController.
|
pure virtual |
Gets the name of the serial port used by the controller.
The port name is determined automatically by using the keyword “STMicroelectronics”.
Implemented in WPScanController.
|
pure virtual |
Gets the timeout period of the serial port in milliseconds.
Default is 500.
Implemented in WPScanController.
|
pure virtual |
Gets the size of the timing pulse in milliseconds that is used to trigger an A-scan.
Implemented in WPScanController.
|
pure virtual |
Gets the max possible value of the quarter and half wave motors’ position.
Implemented in WPScanController.
|
pure virtual |
Gets the flag that determines if the response is read from the serial port after each command is sent.
Default is true.
Implemented in WPScanController.
|
pure virtual |
Get the limits of the scanning area (each value is between 1500 and 52000).
| xStart[out] | pointer to an int that will receive the start position in the x direction |
| xStop | [out] pointer to an int that will receive the stop position in the x direction |
| yStart[out] | pointer to an int that will receive the start position in the y direction |
| yStop | [out] pointer to an int that will receive the stop position in the y direction |
Implemented in WPScanController.
|
pure virtual |
Gets the value of the SwapXY flag.
When true, x and y values for scan areas are switched, where the x values are used for y and vice-versa.
Implemented in WPScanController.
|
pure virtual |
Get the firmware version of the controller.
Implemented in WPScanController.
|
pure virtual |
Get the x ramp max position.
Implemented in WPScanController.
|
pure virtual |
Get the x ramp min position.
Implemented in WPScanController.
|
pure virtual |
Get the x ramp start position.
Implemented in WPScanController.
|
pure virtual |
Get the x ramp stop position.
Implemented in WPScanController.
|
pure virtual |
Get the y ramp max position.
Implemented in WPScanController.
|
pure virtual |
Get the y ramp min position.
Implemented in WPScanController.
|
pure virtual |
Get the y ramp start position.
Implemented in WPScanController.
|
pure virtual |
Get the y ramp stop position.
Implemented in WPScanController.
|
pure virtual |
Returns whether the given light is on or off.
Implemented in WPScanController.
|
pure virtual |
Returns whether the port is open or closed.
Implemented in WPScanController.
|
pure virtual |
|
pure virtual |
Open the port using the default or previous parameters.
Port must be open before any commands are issued.
Implemented in WPScanController.
|
pure virtual |
Open the specified port with the parameters supplied.
Port must be open before any commands are issued.
| portName[in] | pointer to character array that holds the port name (e.g. COM3). |
| baudRate[in] | the baud rate used to communicate with the serial port. |
| numStopBits[in] | the number of stop bits. |
| timeout[in] | the timout in milliseconds. Default is 500. |
| monitorConnection[in] | flag on whether or not to constantly monitor the serial port connection. |
Implemented in WPScanController.
|
pure virtual |
Open the specified port.
The COM port is determined automatically.
Port must be open before any commands are issued.
| baudRate[in] | the baud rate used to communicate with the serial port. |
| numStopBits[in] | the number of stop bits. |
| timeout[in] | the timout in milliseconds. Default is 500. |
| monitorConnection[in] | flag on whether or not to constantly monitor the serial port connection. |
Implemented in WPScanController.
|
pure virtual |
|
pure virtual |
Send a command to the serial port.
The response can be checked after if the flag GetReadResponse() is true.
There are many commands that can be sent. Refer to “OCT Engine Serial Command Reference” for a complete list of commands that can be sent to the Wasatch controller board. Other serial devices can also have values written and read using the send command.
| command[in] | pointer to character array that contains the command. |
Implemented in WPScanController.
|
pure virtual |
Send a command to the serial port and receive its response back if GetReadResponse() is true.
There are many commands that can be sent. Refer to “OCT Engine Serial Command Reference” for a complete list of commands that can be sent to the Wasatch controller board. Other serial devices can also have values written and read using the send command.
| command[in] | pointer to character array that contains the command. |
| response[in] | pointer to user-supplied character array that receives the response. |
| maxResponseSize[in] | the size of the response array. |
Implemented in WPScanController.
|
pure virtual |
Send all motors to their home position (position 0).
Implemented in WPScanController.
|
pure virtual |
Sets the optical switch to the specified port.
| port[in] | 0 or 1 |
Implemented in WPScanController.
|
pure virtual |
Sets the reference arm position.
Default is 0. It should be a number between 0 and the max value set.
Implemented in WPScanController.
|
pure virtual |
Sets the number of A-scans sent out in a frame (B-scan).
Default is 1024. It should be a value between 2 and 65535.
Implemented in WPScanController.
|
pure virtual |
Sets the number of B-scans sent out.
Default is 0. It should be an even number between 0 and 65534.
Implemented in WPScanController.
|
pure virtual |
Sets the delay value in quarter milliseconds.
Default is 50. It should be a number between 0 and 65535.
Implemented in WPScanController.
|
pure virtual |
Sets the foci value.
Default is 0. It should be a number between 0 and 255.
Implemented in WPScanController.
|
pure virtual |
|
pure virtual |
Sets the max possible value of the path motor.
Implemented in WPScanController.
|
pure virtual |
Sets the phase delay value in milliseconds.
Default is 5. It should be a number between 0 and 65535 but should not be greater than the trigger delay.
Implemented in WPScanController.
|
pure virtual |
Sets the pulse duration value in quarter milliseconds.
Default is 5. It should be a number between 0 and 65535. If set to 0, no trigger pulses occur.
Implemented in WPScanController.
|
pure virtual |
Sets the max possible value of the quarter and half wave motor position.
Implemented in WPScanController.
|
pure virtual |
Sets the flag that determines if the response from the serial port is read after a command is issued.
Default is true.
Implemented in WPScanController.
|
pure virtual |
Set the limits of the scanning area (each value is between 1500 and 52000).
| xStart[in] | start position in the x direction |
| xStop[in] | stop position in the x direction |
| yStart[in] | start position in the y direction |
| yStop[in] | stop position in the y direction |
Implemented in WPScanController.
|
pure virtual |
Set the limits of the scanning area (each value is between 1500 and 52000).
| xStart[in] | start position in the x direction |
| xStop[in] | stop position in the x direction |
| yStart[in] | start position in the y direction |
| yStop[in] | stop position in the y direction |
| numPasses[in] | number of times the scan will occur. Default is 1. |
Implemented in WPScanController.
|
pure virtual |
Sets the callback to run if the serial port connection is lost.
| notifyError[in] | the C# callback function in the calling program. This function is a delegate that contains the code to be run if the serial port fails. |
Implemented in WPScanController.
|
pure virtual |
Sets the callback to run if the serial port connection is lost.
| serialPortLost[in] | the C++ callback function in the calling program. This function should not be a member of a class. It should be a standalone function. |
| context[in] | pointer to the C++ “this” object that has the actual callback function. |
Implemented in WPScanController.
|
pure virtual |
Sets the SwapXY flag.
When true, x and y values for scan areas are switched, where the x values are used for y and vice-versa.
Implemented in WPScanController.
|
pure virtual |
Sets the maximum scan position in the x direction.
Implemented in WPScanController.
|
pure virtual |
Sets the minimum scan position in the x direction.
Implemented in WPScanController.
|
pure virtual |
Set the max y ramp value.
Implemented in WPScanController.
|
pure virtual |
Set the min y ramp value.
Implemented in WPScanController.
|
pure virtual |
Start the scan using the parameters previously specified.
Implemented in WPScanController.
|
pure virtual |
|
pure virtual |
Toggles the optical switch from one position to the other.
Implemented in WPScanController.
|
pure virtual |
Turns the specified light off.
| num[in] | light (1 or 2) |
Implemented in WPScanController.
|
pure virtual |
Turns the specified light on.
| num[in] | light (1 or 2) |
Implemented in WPScanController.
|
pure virtual |