int addCmd(string cmd, bool hasResp, string callbackName = null, string devName = null)

Queues up a command for execution.

Parameters

Name Description
cmd string
The command to send. Do not prepend ++++ or append a carriage return.
hasResp bool
You MUST set this to true if the command you send replies with data, and false if not.
callbackName (Optional) string
A JavaScript function name that you would like KioWare to call with the result. If not specified or null, OnKioDeviceCmdResult will be called.
devName (Optional) string
Target the device via the name from the Config Tool.

Return

On success, an incrementing number; the purpose of which is to match a particular call to a callback response. Upon failure, 0.

Security

Trust Level Required: Full Trust

Remarks

After an attempt to send the command to the device, whether successful or not, KioWare will call OnKioDeviceCmdResult in every frame (that has the required trust level) of every browser. If the command sent was an image capture, OnImageProgress will be called with progress, and, when complete, the OnKioDeviceCmdResult data will be a base-64 encoded, JPEG image.

Example


KioCodeCorpCmdBarcode.addCmd('CDTPXEV1', true);

function OnKioDeviceCmdResult(devName, id, cmd, err, data)
{
	KioApp.LogDiag('OnKioDeviceCmdResult ('+devName+'): id:'+id+' cmd:'+cmd+' err:'+err+' data:'+JSON.stringify(data));
}

function OnImageProgress(devName, perc)
{
	KioApp.LogDiag('OnImageProgress: '+perc);
}

function OnKioDeviceData(devName, d)
{
	KioApp.LogDiag('OnKioDeviceData ('+devName+'): '+JSON.stringify(d));
}

Requirements

KioWare for Windows version 8.25 or greater.