then check whether the command succeeded, and retrieve the information you are interested
in.
For example, to select the first reference object in the current configuration (with index 0),
you would call:
// First, define a callback function that handles the result
function setRefObjResponse(response) {
if (response.httpStatus != 200 || response.errorCode != 0) {
alert(response.errorMessage);
}
};
// Then, call the inspector object's setInt function
// with the arguments:
// identifier = 1 for "Set reference object"
// arg1 = 0, for reference object with index 0
function setRefObj() {
inspector.setInt(1, 0, setRefObjResponse );
};
Tip
As an experienced JavaScript developer, you would probably define your callback function
as an anonymous function directly in the call to the inspector methods:
inspector.setInt(1, 0, function(response) {
if (response.httpStatus != 200 || response.errorCode != 0) {
alert(response.errorMessage);
}
});
The content of the response object depends on the function that you called, as well as the
outcome of the command. The following attributes are common for all methods:
type The response type, which is basically the same as the command type.
See Table B.3, “Command ID numbers - for EtherNet/IP” (page 54).
errorCode If non-zero, the command failed for some reason. See Section B.4, “Error
codes” (page 72).
errorMessage A text message that describes the error. Exists only if the command failed.
httpStatus The HTTP status code. If this is not set to 200, the HTTP request failed
and the Inspector didn't return any result at all.
The following table lists the attributes that are specific to the called method:
8015726/2013-11
©SICK AG • Advanced Industrial Sensors • www.sick.com • All rights reserved
Subject to change without notice
18
Reference Manual
Web interface
Interfaces
Inspector PIM