HXP
Command Interface Manual
3.2
C#
#region
Constants
const
int
DEFAULT_TO = 1000;
// timeout in milliseconds
const
int
DEFAULT_PORT = 5001;
const
string
DEFAULT_ADDRESS =
"192.168.33.3"
;
#endregion
Constants
#region
Members
///
<summary>
///
Object of HXP Command Interface
///
</summary>
HXP
m_hxp
Interface
;
///
<summary>
///
Controller’s version
///
</summary>
string
m_controllerVersion =
string
.Empty;
#endregion
Members
///
<summary>
///
This function allows checking the HXP communication.
///
Open the communication, get the controller’s version and
close
///
the communication
///
</summary>
///
<param name="deviceKey">
The device key.
</param>
///
<param name="caption">
The window caption.
</param>
public
bool
CheckCommunication (
string
deviceKey,
int
port)
{
bool
startSuccessfull =
false
;
int
returnValue;
string
err =
string
.Empty;
m_controllerVersion =
string
.Empty;
try
{
// Create HXP instance
m_hxpInterface =
new
HXP
();
if
(m_hxpInterface !=
null
)
{
// HXP Connection
returnValue = m_hxpInterface.
OpenInstrument(IPAddress, IPport, DEFAULT_TO)
if
(returnValue == 0)
{
string
str =
string
.Empty;
// Get HXP controller’s version
int
res = m_hxp
Interface.FirmwareVersionGet
(
out
str,
out
err);
if
(res == CommandInterface.
HXP
.FAILURE)
{
labelControllerVersion.Text =
"Failure: " +
err;
startSuccessfull =
false
;
}
else
{
m_controllerVersion = str.Trim();
labelControllerVersion.Text =
m_controllerVersion;
startSuccessfull =
true
;
}
}
// HXP disconnection
m_hxp
Interface
.CloseInstrument();
}
EDH0318En1042 — 12/18
96