function onResult (decodeResults, readerProperties, output)
{
var myoutput;
var result_tmp = dmccCommand(”BEEP”, 1, 1);
result_tmp = dmccSet(”FTP-IMAGE.IP-ADDRESS”, ”192.168.23.42”);
if(result_tmp.status !=0)
{
throw(”FATAL: failed to set the ftp server address”);
}
var mac = dmccGet(”DEVICE.MAC-ADDRESS”);
myoutput = ’Result=”’ + decodeResults[0].c ’”, MAC=’+mac.response;
output.content = myoutput;
}
In case the DMCC set command for the IP address fails, a non-zero status will be returned, and a script exception will be
thrown that is reported by the DataMan Setup Tool.
Note
: If you use the Throw() command, like in the example above, to report the occurrence of an anomalous
situation (exception), the error will appear in the Setup Tool’s error log. To access the error log, in the Setup Tool’s
menu bar, click System and then click Show Device Log.
Example
To get the device name using the dmccGet function the correct string argument is required:
var res = dmccGet(”DEVICE.NAME”);
The dmccSend function can be used in a similar way, but without splitting the command and type correct arguments:
var res = dmccSend(”GET DEVICE.NAME”);
The return value is the same.
DMCC Support
The following DMCC commands are available for Script-Based Formatting:
Command
Range
Description
GET/SET FORMAT.MODE
[0..1]
Select formatting mode:
l
0 = basic formatting
l
1 = script-based formatting
SCRIPT.LOAD
length
Load the formatting script from the host to the reader.
SCRIPT.SEND
-
Send the formatting script from the reader to the host.
Auxiliary Functions
The following auxiliary global functions are also available:
l
function for decoding escape sequences
l
function to encode a string argument into base64 encoding
Function decode_sequences
This global function is used to decode escape sequences. The function returns the string that contains the decoded
escape sequence. The return value can be used to add keyboard control commands to a result transmitted over a HID
connection.
26
DataMan Application Development