WPOCT Software Developer's Kit (SDK)
SDK For using Wasatch Photonics OCT Spectrometers
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
WPScanController Class Reference

Class that converts a scanned image from one format to another. More...

#include <WPScanController.h>

Inheritance diagram for WPScanController:
Inheritance graph
[legend]
Collaboration diagram for WPScanController:
Collaboration graph
[legend]

Public Member Functions

 WPScanController ()
 Constructor.
 
virtual ~WPScanController ()
 Destructor.
 
bool IsPortOpen () const override
 Returns whether the port is open or closed. More...
 
bool IsLightOn (int index) override
 Returns whether the given light is on or off. More...
 
bool IsScanning () const override
 Returns the scanning state. More...
 
int GetBaudRate () const override
 Gets the baud rate used to communicate with the controller. More...
 
int GetNumStopBits () const override
 Gets the number of stop bits used to communicate with the controller. More...
 
int GetPortTimeout () const override
 Gets the timeout period of the serial port in milliseconds. More...
 
bool GetMonitorPort () const override
 Gets the flag that determines if serial port is constantly being monitored for a connection. More...
 
bool GetReadResponse () const override
 Gets the flag that determines if the response is read from the serial port after each command is sent. More...
 
const char * GetVersion () const override
 Get the firmware version of the controller. More...
 
int GetAScans () const override
 Gets the number of A-scans per B-scan output by the controller. More...
 
int GetBScans () const override
 Gets the number of B-scans output by the controller. More...
 
int GetFoci () const override
 Get the foci value. More...
 
int GetDelay () const override
 Gets the delay in milliseconds between the end of one pulse and the start of another. More...
 
int GetPulse () const override
 Gets the size of the timing pulse in milliseconds that is used to trigger an A-scan. More...
 
int GetPhase () const override
 Get the phase delay. More...
 
int GetArmPosition () const override
 Get the reference arm position. More...
 
void GetScanArea (int *xStart, int *xStop, int *yStart, int *yStop) const override
 Get the limits of the scanning area (each value is between 1500 and 52000). More...
 
void GetMirror (int *major, int *minor) const override
 Get the major and minor mirror values. More...
 
bool GetSwapXY () const override
 Gets the value of the SwapXY flag. More...
 
const char * GetPortName () override
 Gets the name of the serial port used by the controller. More...
 
const char * GetLastCommandSent () const override
 Get the last command sent. More...
 
const char * GetLastResponse () const override
 Get the last response from the serial port. More...
 
int GetXRampMinPos () const override
 Get the x ramp min position. More...
 
int GetXRampMaxPos () const override
 Get the x ramp max position. More...
 
int GetYRampMinPos () const override
 Get the y ramp min position. More...
 
int GetYRampMaxPos () const override
 Get the y ramp max position. More...
 
int GetXRampStartPos () const override
 Get the x ramp start position. More...
 
int GetXRampStopPos () const override
 Get the x ramp stop position. More...
 
int GetYRampStartPos () const override
 Get the y ramp start position. More...
 
int GetYRampStopPos () const override
 Get the y ramp stop position. More...
 
int GetPathMotorPosMax () const override
 Gets the max possible value of the path motor. More...
 
int GetQuarterHalfWavePosMax () const override
 Gets the max possible value of the quarter and half wave motors’ position. More...
 
bool SetAScans (int value) override
 Sets the number of A-scans sent out in a frame (B-scan). More...
 
bool SetBScans (int value) override
 Sets the number of B-scans sent out. More...
 
bool SetFoci (int value) override
 Sets the foci value. More...
 
bool SetDelay (int value) override
 Sets the delay value in quarter milliseconds. More...
 
bool SetPulse (int value) override
 Sets the pulse duration value in quarter milliseconds. More...
 
bool SetPhase (int value) override
 Sets the phase delay value in milliseconds. More...
 
bool SetXRampMinPos (int value) override
 Sets the minimum scan position in the x direction. More...
 
bool SetXRampMaxPos (int value) override
 Sets the maximum scan position in the x direction. More...
 
bool SetYRampMinPos (int value) override
 Set the min y ramp value. More...
 
bool SetYRampMaxPos (int value) override
 Set the max y ramp value. More...
 
bool SetArmPosition (int position) override
 Sets the reference arm position. More...
 
bool SetScanArea (int xStart, int xStop, int yStart, int yStop) override
 Set the limits of the scanning area (each value is between 1500 and 52000). More...
 
bool SetScanArea (int xStart, int xStop, int yStart, int yStop, int numPasses) override
 Set the limits of the scanning area (each value is between 1500 and 52000). More...
 
bool SetMirror (int major, int minor) override
 Set the major and minor mirror values. More...
 
bool SetSwapXY (bool value) override
 Sets the SwapXY flag. More...
 
bool SetReadResponse (bool value) override
 Sets the flag that determines if the response from the serial port is read after a command is issued. More...
 
bool SetPathMotorPosMax (int value) override
 Sets the max possible value of the path motor. More...
 
bool SetQuarterHalfWavePosMax (int value) override
 Sets the max possible value of the quarter and half wave motor position. More...
 
bool OpenPort (const char *portName, int baudRate, int numStopBits, int timeout, bool monitorConnection) override
 Open the specified port with the parameters supplied. More...
 
bool OpenPort (int baudRate, int numStopBits, int timeout, bool monitorConnection) override
 Open the specified port, determining the COM port automatically.
 
bool OpenPort () override
 Open the port using the default or previous parameters.
 
void ReadControllerVersion (bool &result)
 
bool ClosePort () override
 Close the serial port.
 
bool SendCommand (const char *command, char *response, int maxResponseSize) override
 Send a command to the serial port and receive its response back if GetReadResponse() is true. More...
 
bool SendCommand (const char *command) override
 Send a command to the serial port. More...
 
bool TurnLightOn (int num) override
 Turns the specified light on. More...
 
bool TurnLightOff (int num) override
 Turns the specified light off. More...
 
bool TurnLightsOff () override
 Turns all lights off. More...
 
bool StartScan () override
 Start the scan using the parameters previously specified.
 
bool StopScan () override
 Stop the scan.
 
bool ParkArm () override
 Park the reference arm.
 
bool SendMotorsHome () override
 Send the motors home.
 
int GetActiveOpticalPort () override
 Gets the active optical port. More...
 
bool SetActiveOpticalPort (int port) override
 Sets the optical switch to the specified port. More...
 
bool ToggleOpticalSwitch () override
 Toggles the optical switch from one position to the other. More...
 
bool IsShutterOpen (int ID, bool *open) override
 
bool OpenShutter (int ID) override
 
bool CloseShutter (int ID) override
 
virtual IWPOCTController::ErrorCode GetLastError () const override
 Gets the result of the most current operation. More...
 
virtual IWPOCTController::CurrentStates GetCurrentStatus () const override
 Gets the current status of the controller. More...
 
virtual void SetSerialPortLostCallback (NotifyErrorCallback notifyError) override
 Sets the callback to run if the serial port connection is lost. More...
 
virtual void SetSerialPortLostCallback2 (SendNoParams serialPortLost, void *context) override
 Sets the callback to run if the serial port connection is lost. More...
 
void CheckPingResponse ()
 
- Public Member Functions inherited from IWPOCTController
virtual ~IWPOCTController ()
 Destructor

 
virtual void Dispose ()
 
virtual bool IsPortOpen ()
 
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 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 OpenPort (string portName, int baudRate, int numStopBits, int timeout, bool monitorConnection)
 
virtual bool SendCommand (string command, string response, int maxResponseSize)
 
virtual bool SendCommand (string command)
 
virtual bool IsShutterOpen (int ID, ref bool open)
 
virtual IWPOCTController.ErrorCode GetLastError ()
 
virtual IWPOCTController.CurrentStates GetCurrentStatus ()
 
virtual void SetSerialPortLostCallback (SerialPortLost notifyError)
 

Protected Member Functions

bool SendStringToWasatchPort (std::string rawCommand)
 Send string command to controller serial port.
 
bool SendStringToCameraPort (std::string rawCommand)
 Send string command to camera serial port.
 
bool SendCommandToPort (std::string command)
 
bool SendShutterCommand (std::string &inCommand)
 
void ReadResponse (std::string &finalCommand)
 
bool CheckWasatchCommandValid (std::string &inCommand, std::string &outCommand)
 Parse commands to update parameters or override values as needed.
 
bool CheckCameraCommandValid (std::string &inCommand, std::string &outCommand)
 Right now any command is valid for the camera.
 
bool ChangePortMonitoring (bool isOn)
 
bool ReestablishConnection ()
 
void FormatVersionString ()
 
bool FormAScansCmd (vector< std::string > &words, string &outCommand)
 
bool FormBScansCmd (vector< std::string > &words, string &outCommand)
 
bool FormDelayCmd (vector< std::string > &words, string &outCommand)
 
bool FormPulseCmd (vector< std::string > &words, string &outCommand)
 
bool FormPhaseCmd (vector< std::string > &words, string &outCommand)
 
bool FormFociCmd (vector< std::string > &words, string &outCommand)
 
bool FormFocusCmd (vector< std::string > &words, string &outCommand)
 
bool FormScanCmd (vector< std::string > &words, string &outCommand)
 
bool FormMirrorCmd (vector< std::string > &words, string &outCommand)
 
bool FormVerboseCmd (vector< std::string > &words, string &outCommand)
 
bool FormPauseTimeoutCmd (vector< std::string > &words, string &outCommand)
 
bool FormSetOpticalPortCmd (vector< std::string > &words, string &outCommand)
 
bool FormMghCmd (vector< std::string > &words, string &outCommand)
 
bool FormMstopCmd (vector< std::string > &words, string &outCommand)
 
bool FormMgrCmd (vector< std::string > &words, string &outCommand)
 
bool FormMg2Cmd (vector< std::string > &words, string &outCommand)
 
bool FormMihCmd (vector< std::string > &words, string &outCommand)
 
bool FormMasetCmd (vector< std::string > &words, string &outCommand)
 
bool FormMssetCmd (vector< std::string > &words, string &outCommand)
 
bool FormCameraCommand (vector< std::string > &words, string &outCommand)
 
bool RunSetShutterCmd (vector< std::string > &words)
 
bool RunGetShutterCmd (vector< std::string > &words, bool &open)
 
int CheckMotorPosLimits (vector< std::string > &words)
 
int CheckRelativeMotorPosLimits (vector< std::string > &words)
 
int CheckMotorAccelLimits (vector< std::string > &words)
 
int CheckMotorSpeedLimits (vector< std::string > &words)
 
void RecordMotorPos (std::vector< std::string > &words, int pos)
 
void RecordRelativeMotorPos (std::vector< std::string > &words, int relativePos)
 
bool FormPrampCmd (vector< std::string > &words, string &outCommand)
 
bool FormXYRampCmd (vector< std::string > &words, string &outCommand)
 
bool FormXRampCmd (vector< std::string > &words, string &outCommand)
 
bool FormYRampCmd (vector< std::string > &words, string &outCommand)
 
bool FormOut1Cmd (vector< std::string > &words, string &outCommand)
 
bool FormOut2Cmd (vector< std::string > &words, string &outCommand)
 
bool FormTRetCmd (vector< std::string > &words, string &outCommand)
 
bool FormTriggerCmd (vector< std::string > &words, string &outCommand)
 
bool FormTrigDelayModeCmd (vector< std::string > &words, string &outCommand)
 
bool FormTrigDelayCmd (vector< std::string > &words, string &outCommand)
 
bool FormADivCmd (vector< std::string > &words, string &outCommand)
 
bool FormAHoldCmd (vector< std::string > &words, string &outCommand)
 
bool FormBHoldCmd (vector< std::string > &words, string &outCommand)
 
bool FormRRampCmd (vector< std::string > &words, string &outCommand)
 
bool FormRotCrossCmd (vector< std::string > &words, string &outCommand)
 

Protected Attributes

const int PathMotorSpeedMax = 2900
 
const int QuarterHalfWaveSpeedMax = 10000
 
const int PathMotorAccelMax = 10000
 
const int QuarterHalfWaveAccelMax = 10000
 
- Protected Attributes inherited from IWPOCTController
bool swigCMemOwn
 

Additional Inherited Members

- Public Types inherited from IWPOCTController
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
}
 
- Static Public Member Functions inherited from IWPOCTController
static IWPOCTController GetOCTController ()
 
static bool DestroyOCTController ()
 

Detailed Description

Class that converts a scanned image from one format to another.

This class is the implementation of IWPOCTScanConverter.

Member Function Documentation

◆ GetActiveOpticalPort()

int WPScanController::GetActiveOpticalPort ( )
overridevirtual

Gets the active optical port.

Returns
the active port (0-1)

Implements IWPOCTController.

◆ GetArmPosition()

int WPScanController::GetArmPosition ( ) const
inlineoverridevirtual

Get the reference arm position.

Returns
integral position (unitless)

Implements IWPOCTController.

◆ GetAScans()

int WPScanController::GetAScans ( ) const
inlineoverridevirtual

Gets the number of A-scans per B-scan output by the controller.

Returns
the number of A-scans

Implements IWPOCTController.

◆ GetBaudRate()

int WPScanController::GetBaudRate ( ) const
inlineoverridevirtual

Gets the baud rate used to communicate with the controller.

Returns
baud rate, typically 9600

Implements IWPOCTController.

◆ GetBScans()

int WPScanController::GetBScans ( ) const
inlineoverridevirtual

Gets the number of B-scans output by the controller.

Returns
the number of B-scans

Implements IWPOCTController.

◆ GetCurrentStatus()

virtual IWPOCTController::CurrentStates WPScanController::GetCurrentStatus ( ) const
inlineoverridevirtual

Gets the current status of the controller.

Returns
the staus code, comprised of multiple flags "OR"d together.
More than one can be active at the same time.

Implements IWPOCTController.

◆ GetDelay()

int WPScanController::GetDelay ( ) const
inlineoverridevirtual

Gets the delay in milliseconds between the end of one pulse and the start of another.

Returns
delay in milliseconds

Implements IWPOCTController.

◆ GetFoci()

int WPScanController::GetFoci ( ) const
inlineoverridevirtual

Get the foci value.

Returns
foci value (0-255)

Implements IWPOCTController.

◆ GetLastCommandSent()

const char * WPScanController::GetLastCommandSent ( ) const
overridevirtual

Get the last command sent.

The char array returned may be different from what the user sent in a SendCommand.

Returns
pointer to the character array that holds the last command sent to the controller

Implements IWPOCTController.

◆ GetLastError()

virtual IWPOCTController::ErrorCode WPScanController::GetLastError ( ) const
inlineoverridevirtual

Gets the result of the most current operation.

Returns
the error code

Implements IWPOCTController.

◆ GetLastResponse()

const char * WPScanController::GetLastResponse ( ) const
overridevirtual

Get the last response from the serial port.


Returns
pointer to the character array that holds the most recent controller response to a command

Implements IWPOCTController.

◆ GetMirror()

void WPScanController::GetMirror ( int *  major,
int *  minor 
) const
overridevirtual

Get the major and minor mirror values.

Parameters
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

Implements IWPOCTController.

◆ GetMonitorPort()

bool WPScanController::GetMonitorPort ( ) const
inlineoverridevirtual

Gets the flag that determines if serial port is constantly being monitored for a connection.

Default is false.

Returns
true if the serial port is being monitored constantly

Implements IWPOCTController.

◆ GetNumStopBits()

int WPScanController::GetNumStopBits ( ) const
inlineoverridevirtual

Gets the number of stop bits used to communicate with the controller.

Returns
the number of stop bits used

Implements IWPOCTController.

◆ GetPathMotorPosMax()

int WPScanController::GetPathMotorPosMax ( ) const
inlineoverridevirtual

Gets the max possible value of the path motor.

Returns
maximum path motor value

Implements IWPOCTController.

◆ GetPhase()

int WPScanController::GetPhase ( ) const
inlineoverridevirtual

Get the phase delay.

Should not be greater that trdelay.

Returns
phase length in milliseconds

Implements IWPOCTController.

◆ GetPortName()

const char * WPScanController::GetPortName ( )
overridevirtual

Gets the name of the serial port used by the controller.

The port name is determined automatically by using the keyword “STMicroelectronics”.

Returns
pointer to character string containing serial port name

Implements IWPOCTController.

◆ GetPortTimeout()

int WPScanController::GetPortTimeout ( ) const
inlineoverridevirtual

Gets the timeout period of the serial port in milliseconds.

Default is 500.

Returns
timeout in milliseconds

Implements IWPOCTController.

◆ GetPulse()

int WPScanController::GetPulse ( ) const
inlineoverridevirtual

Gets the size of the timing pulse in milliseconds that is used to trigger an A-scan.

Returns
pulse size in milliseconds

Implements IWPOCTController.

◆ GetQuarterHalfWavePosMax()

int WPScanController::GetQuarterHalfWavePosMax ( ) const
inlineoverridevirtual

Gets the max possible value of the quarter and half wave motors’ position.

Returns
maximum position of the quarter and half wave motors

Implements IWPOCTController.

◆ GetReadResponse()

bool WPScanController::GetReadResponse ( ) const
inlineoverridevirtual

Gets the flag that determines if the response is read from the serial port after each command is sent.

Default is true.

Returns
true if the response is read after each command

Implements IWPOCTController.

◆ GetScanArea()

void WPScanController::GetScanArea ( int *  xStart,
int *  xStop,
int *  yStart,
int *  yStop 
) const
overridevirtual

Get the limits of the scanning area (each value is between 1500 and 52000).

Parameters
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

Implements IWPOCTController.

◆ GetSwapXY()

bool WPScanController::GetSwapXY ( ) const
inlineoverridevirtual

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.

Returns
true if x and y values are being switched

Implements IWPOCTController.

◆ GetVersion()

const char* WPScanController::GetVersion ( ) const
inlineoverridevirtual

Get the firmware version of the controller.

Returns
pointer to a character array that holds the firmware version

Implements IWPOCTController.

◆ GetXRampMaxPos()

int WPScanController::GetXRampMaxPos ( ) const
inlineoverridevirtual

Get the x ramp max position.

Returns
maximum x ramp position in DAC units

Implements IWPOCTController.

◆ GetXRampMinPos()

int WPScanController::GetXRampMinPos ( ) const
inlineoverridevirtual

Get the x ramp min position.

Returns
minimum x ramp position in DAC units

Implements IWPOCTController.

◆ GetXRampStartPos()

int WPScanController::GetXRampStartPos ( ) const
inlineoverridevirtual

Get the x ramp start position.

Returns
the x ramp start position in DAC units

Implements IWPOCTController.

◆ GetXRampStopPos()

int WPScanController::GetXRampStopPos ( ) const
inlineoverridevirtual

Get the x ramp stop position.

Returns
the x ramp stop position in DAC units

Implements IWPOCTController.

◆ GetYRampMaxPos()

int WPScanController::GetYRampMaxPos ( ) const
inlineoverridevirtual

Get the y ramp max position.

Returns
maximum y ramp position in DAC units

Implements IWPOCTController.

◆ GetYRampMinPos()

int WPScanController::GetYRampMinPos ( ) const
inlineoverridevirtual

Get the y ramp min position.

Returns
minimum y ramp position in DAC units

Implements IWPOCTController.

◆ GetYRampStartPos()

int WPScanController::GetYRampStartPos ( ) const
inlineoverridevirtual

Get the y ramp start position.

Returns
the y ramp start position in DAC units

Implements IWPOCTController.

◆ GetYRampStopPos()

int WPScanController::GetYRampStopPos ( ) const
inlineoverridevirtual

Get the y ramp stop position.

Returns
the y ramp stop position in DAC units

Implements IWPOCTController.

◆ IsLightOn()

bool WPScanController::IsLightOn ( int  index)
overridevirtual

Returns whether the given light is on or off.

Returns
true if the light is on

Implements IWPOCTController.

◆ IsPortOpen()

bool WPScanController::IsPortOpen ( ) const
inlineoverridevirtual

Returns whether the port is open or closed.

Returns
true if the port is opened

Implements IWPOCTController.

◆ IsScanning()

bool WPScanController::IsScanning ( ) const
inlineoverridevirtual

Returns the scanning state.

Returns
true if scanning is occuring

Implements IWPOCTController.

◆ OpenPort()

bool WPScanController::OpenPort ( const char *  portName,
int  baudRate,
int  numStopBits,
int  timeout,
bool  monitorConnection 
)
overridevirtual

Open the specified port with the parameters supplied.

Port must be open before any commands are issued.

Implements IWPOCTController.

◆ SendCommand() [1/2]

bool WPScanController::SendCommand ( const char *  command)
overridevirtual

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.

Parameters
command[in]pointer to character array that contains the command.
Returns
true on success
See also
ENG-0060 OCT Engine Serial Command Reference

Implements IWPOCTController.

◆ SendCommand() [2/2]

bool WPScanController::SendCommand ( const char *  command,
char *  response,
int  maxResponseSize 
)
overridevirtual

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.

Parameters
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.
Returns
true on success
See also
ENG-0060 OCT Engine Serial Command Reference

Implements IWPOCTController.

◆ SetActiveOpticalPort()

bool WPScanController::SetActiveOpticalPort ( int  port)
overridevirtual

Sets the optical switch to the specified port.

Parameters
port[in]0 or 1
Returns
true on success

Implements IWPOCTController.

◆ SetArmPosition()

bool WPScanController::SetArmPosition ( int  position)
overridevirtual

Sets the reference arm position.

Default is 0. It should be a number between 0 and the max value set.

Returns
true on success

Implements IWPOCTController.

◆ SetAScans()

bool WPScanController::SetAScans ( int  value)
overridevirtual

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.

Returns
true on success

Implements IWPOCTController.

◆ SetBScans()

bool WPScanController::SetBScans ( int  value)
overridevirtual

Sets the number of B-scans sent out.

Default is 0. It should be an even number between 0 and 65534.

Returns
true on success

Implements IWPOCTController.

◆ SetDelay()

bool WPScanController::SetDelay ( int  value)
overridevirtual

Sets the delay value in quarter milliseconds.

Default is 50. It should be a number between 0 and 65535.

Returns
true on success

Implements IWPOCTController.

◆ SetFoci()

bool WPScanController::SetFoci ( int  value)
overridevirtual

Sets the foci value.

Default is 0. It should be a number between 0 and 255.

Returns
true on success

Implements IWPOCTController.

◆ SetMirror()

bool WPScanController::SetMirror ( int  major,
int  minor 
)
overridevirtual

Set the major and minor mirror values.

Returns
true on success

Implements IWPOCTController.

◆ SetPathMotorPosMax()

bool WPScanController::SetPathMotorPosMax ( int  value)
inlineoverridevirtual

Sets the max possible value of the path motor.

Returns
true on success

Implements IWPOCTController.

◆ SetPhase()

bool WPScanController::SetPhase ( int  value)
overridevirtual

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.

Returns
true on success

Implements IWPOCTController.

◆ SetPulse()

bool WPScanController::SetPulse ( int  value)
overridevirtual

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.

Returns
true on success

Implements IWPOCTController.

◆ SetQuarterHalfWavePosMax()

bool WPScanController::SetQuarterHalfWavePosMax ( int  value)
inlineoverridevirtual

Sets the max possible value of the quarter and half wave motor position.

Returns
true on success

Implements IWPOCTController.

◆ SetReadResponse()

bool WPScanController::SetReadResponse ( bool  value)
inlineoverridevirtual

Sets the flag that determines if the response from the serial port is read after a command is issued.

Default is true.

Returns
true on success

Implements IWPOCTController.

◆ SetScanArea() [1/2]

bool WPScanController::SetScanArea ( int  xStart,
int  xStop,
int  yStart,
int  yStop 
)
overridevirtual

Set the limits of the scanning area (each value is between 1500 and 52000).

Parameters
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
Returns
true on success

Implements IWPOCTController.

◆ SetScanArea() [2/2]

bool WPScanController::SetScanArea ( int  xStart,
int  xStop,
int  yStart,
int  yStop,
int  numPasses 
)
overridevirtual

Set the limits of the scanning area (each value is between 1500 and 52000).

Parameters
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.
Returns
true on success

Implements IWPOCTController.

◆ SetSerialPortLostCallback()

void WPScanController::SetSerialPortLostCallback ( NotifyErrorCallback  notifyError)
overridevirtual

Sets the callback to run if the serial port connection is lost.


Note
C++ programs should use this call. See the demo app for details on how to setup this call.
Parameters
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.

Implements IWPOCTController.

◆ SetSerialPortLostCallback2()

void WPScanController::SetSerialPortLostCallback2 ( SendNoParams  serialPortLost,
void *  context 
)
overridevirtual

Sets the callback to run if the serial port connection is lost.


Note
C# programs should use this call.
Parameters
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.

Implements IWPOCTController.

◆ SetSwapXY()

bool WPScanController::SetSwapXY ( bool  value)
inlineoverridevirtual

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.

Returns
true on success

Implements IWPOCTController.

◆ SetXRampMaxPos()

bool WPScanController::SetXRampMaxPos ( int  value)
overridevirtual

Sets the maximum scan position in the x direction.


Warning
This value is board dependent and should not be set arbitrarily.
Returns
true on success

Implements IWPOCTController.

◆ SetXRampMinPos()

bool WPScanController::SetXRampMinPos ( int  value)
overridevirtual

Sets the minimum scan position in the x direction.


Warning
This value is board dependent and should not be set arbitrarily.
Returns
true on success

Implements IWPOCTController.

◆ SetYRampMaxPos()

bool WPScanController::SetYRampMaxPos ( int  value)
overridevirtual

Set the max y ramp value.

Warning
This value is board dependent and should not be set arbitrarily.
Returns
true on success

Implements IWPOCTController.

◆ SetYRampMinPos()

bool WPScanController::SetYRampMinPos ( int  value)
overridevirtual

Set the min y ramp value.

Warning
This value is board dependent and should not be set arbitrarily.
Returns
true on success

Implements IWPOCTController.

◆ ToggleOpticalSwitch()

bool WPScanController::ToggleOpticalSwitch ( )
overridevirtual

Toggles the optical switch from one position to the other.

Returns
true on success

Implements IWPOCTController.

◆ TurnLightOff()

bool WPScanController::TurnLightOff ( int  num)
overridevirtual

Turns the specified light off.

Parameters
num[in]light (1 or 2)
Returns
true on success

Implements IWPOCTController.

◆ TurnLightOn()

bool WPScanController::TurnLightOn ( int  num)
overridevirtual

Turns the specified light on.

Parameters
num[in]light (1 or 2)
Returns
true on success

Implements IWPOCTController.

◆ TurnLightsOff()

bool WPScanController::TurnLightsOff ( )
overridevirtual

Turns all lights off.

Returns
true on success

Implements IWPOCTController.


The documentation for this class was generated from the following files: