StarWebPrintExtManager.js
Watches the barcode reader and printer status by StarWebPRNTExtManager request element and StarWebPRNTExtManager response element.
Constructor
Method
Property
Name | Description |
onReceive | Communication success event |
onError | Communication error event |
Property(/SendExtMessage)
* It will be notified when connecting to the path "/StarWebPRNT/SendExtMessage".
Property(/SendDisplayExtMessage)
* It will be notified when connecting to the path "/StarWebPRNT/SendDisplayExtMessage".
Star Printer Compatibility Chart
This chart indicates which method or property is supported by the Star webPRNT function of each model.
- LAN … Star webPRNT function in printer
- LAN(HE) … Star webPRNT function in IFBD-HE07X/08X
- LAN(HI) … Star webPRNT function in IFBD-HI01X/02X
- BR … Star webPRNT Browser
Please refer to the interface compatibility table by printer model here.
POS Printer (mCollection/TSP100IV)
*1 Supported with printer firmware version 2.1 or later.
*2 SSL is not supported. You cannot use the barcode reader or monitor the printer status when the web application is published on https.
*3 USB HID class (keyboard mode) is supported (requires printer firmware Ver.3.0 or later for mC-Print2, mC-Print3 and mPOP).
Some devices in the marketplace can NOT communicate with this protocol correctly.
Please confirm correct operation with the actual device before deployment.
NOT all USB HID devices in the marketplace have been confirmed.
NOT all operations with this protocol are guaranteed.
POS Printer (Legacy Printer)
Mobile Printer(ESC/POS)
*1 It is always called as Drawer Close.
Mobile Printer (StarPRNT)
StarWebPrintExtManager
Creates StarWebPrintExtManager object.
syntax
StarWebPrintExtManager(args);
Parameter
Name | Description | Object type | Omission |
url | Star webPRNT endpoint URL Note: When a url is omitted, it should be specified by connect method. | String | - |
pollingTimeout | The time out for polling of Claim management (ms unit) | Number | 30000 |
pollingInterval | The sending interval time for polling of Claim management (ms unit) | Number | 200 |
Return value
Description | Object type |
StarWebPrintExtManager object | StarWebPrintExtManager |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.connect({url:url});
}
// -->
</script>
connect
Parameter
Name | Description | Object type | Omission |
url | Specifies Star webPRNT endpoint URL Note: When a url is omitted, it should be specified by StarWebPrintExtManager constructor. | String | - |
pollingTimeout |
The time out for polling of Claim management (ms unit) Note: When a url is omitted, it should be specified by StarWebPrintExtManager constructor. | Number | - |
pollingInterval | The sending interval time for polling of Claim management (ms unit) Note: When a url is omitted, it should be specified by StarWebPrintExtManager constructor. | Number | - |
Parameter
Description | Object type |
true … Success false … Failed | Boolean |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.connect({url:url});
}
// -->
</script>
disconnect
Parameter
Name | Description | Object type | Omission |
- | - | - | - |
Parameter
Description | Object type |
true … Success false … Failed | Boolean |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onDisconnect(url) {
manager.disconnect();
}
// -->
</script>
write
Parameter
Name | Description | Object type | Omission |
url | Star webPRNT end point URL
Note: When a checkedblock is omitted, the value specified by StarWebPrintExtManager constructor should be used.
In the connected state, this argument is ignored.
| String | Can't be omitted |
request | List of StarWebPRNTExtManager Request Element | String | Can't be omitted |
Parameter
Description | Object type |
true … Success false … Failed | Boolean |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onWrite(url, request) {
manager.write({url:url, request:request});
}
// -->
</script>
onReceive
Communication success event
syntax
function(response);
Parameter
Name | Description | Object type |
managerSuccess | Success code of the communication with printer
- true … Communication succeeded
- false … Communication failed
| String |
managerCode | Result code
- 0 … Success
- 1010 … Printer unconnected state
- 2001 … Printer busy(In use with another device: Need to resend data)
- 3000 … Claim non-acquired state
- 3001 … Not supported
| Number |
managerClaim | Manager claim status
- true … Claim acquired state
- false … Claim non-acquired state
| Boolean |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onReceive = function(response) {
var msg;
if (response.managerSuccess == 'true' && response.managerClaim == 'true') {
msg = 'Connected\n\n'
}
else {
msg = 'Not connected\n\n'
}
msg = '- onReceive -\n\n';
msg += 'ManagerSuccess : [ ' + response.managerSuccess + ' ]\n';
msg += 'ManagerCode : [ ' + response.managerCode + ' ]\n';
alert(msg);
}
manager.connect({url:url});
}
// -->
</script>
onError
Communication error event.
syntax
function(response);
Parameter
Name | Description | Object type |
Status | Status property of XMLHttpRequest object. Refer to the XMLHttpRequest specifications. | Number |
responseText | responseText property of XMLHttpRequest object. Refer to the XMLHttpRequest specifications. | String |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onReceive = function(response) {
var msg;
if (response.managerSuccess == 'true' && response.managerClaim == 'true') {
msg = 'Connected\n\n'
}
else {
msg = 'Not connected\n\n'
}
msg = '- onReceive -\n\n';
msg += 'ManagerSuccess : [ ' + response.managerSuccess + ' ]\n';
msg += 'ManagerCode : [ ' + response.managerCode + ' ]\n';
alert(msg);
}
manager.onError = function(response) {
var msg;
msg = 'onError!' + '\n';
msg += ' Status:' + args.status + '\n';
msg += ' ResponseText:' + args.responseText;
alert(msg);
}
manager.connect({url:url});
}
// -->
</script>
onPrinterImpossible
Notifies that the printer cannot be used.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onPrinterImpossible = function() {
alert('onPrinterImpossible');
}
manager.connect({url:url});
}
// -->
</script>
onPrinterOnline
Notified that the printer is online.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onPrinterOnline = function() {
alert('onPrinterOnline');
}
manager.connect({url:url});
}
// -->
</script>
onPrinterOffline
Notified that the printer is offline.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onPrinterOffline = function() {
alert('onPrinterOffline');
}
manager.connect({url:url});
}
// -->
</script>
onPrinterPaperReady
Notified that the printer paper is ready.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onPrinterPaperReady = function() {
alert('onPrinterPaperReady');
}
manager.connect({url:url});
}
// -->
</script>
onPrinterPaperNearEmpty
Notified that the printer paper is near empty.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onPrinterPaperNearEmpty = function() {
alert('onPrinterPaperNearEmpty');
}
manager.connect({url:url});
}
// -->
</script>
onPrinterPaperEmpty
Notified that the printer paper is empty.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onPrinterPaperEmpty = function() {
alert('onPrinterPaperEmpty');
}
manager.connect({url:url});
}
// -->
</script>
onPrinterCoverOpen
Notified that the printer cover is open.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onPrinterCoverOpen = function() {
alert('onPrinterCoverOpen');
}
manager.connect({url:url});
}
// -->
</script>
onPrinterCoverClose
Notified that the printer cover is closed.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onPrinterCoverClose = function() {
alert('onPrinterCoverClose');
}
manager.connect({url:url});
}
// -->
</script>
onCashDrawerOpen
Notified that the cash drawer is open.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onCashDrawerOpen = function() {
alert('onCashDrawerOpen');
}
manager.connect({url:url});
}
// -->
</script>
onCashDrawerClose
Notified that the cash drawer is closed.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onCashDrawerClose = function() {
alert('onCashDrawerClose');
}
manager.connect({url:url});
}
// -->
</script>
onBarcodeReaderImpossible
Notified that the barcode reader cannot be used.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onBarcodeReaderImpossible = function() {
alert('onBarcodeReaderImpossible');
}
manager.connect({url:url});
}
// -->
</script>
onBarcodeReaderConnect
Notified that the barcode reader is connected.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onBarcodeReaderConnect = function() {
alert('onBarcodeReaderConnect');
}
manager.connect({url:url});
}
// -->
</script>
onBarcodeReaderDisconnect
Notified that the barcode reader is disconnected.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onBarcodeReaderDisconnect = function() {
alert('onBarcodeReaderDisconnect');
}
manager.connect({url:url});
}
// -->
</script>
onBarcodeDataReceive
Notified that the barcode reader data received.
syntax
function(response);
Parameter
Name | Description | Object type |
data | Barcode Data *Form of Base64 | String |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onBarcodeDataReceive = function() {
alert('onBarcodeDataReceive');
}
manager.connect({url:url});
}
// -->
</script>
onAccessoryConnectSuccess
Notified that the accessory(Bluetooth) connect is success.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onAccessoryConnectSuccess = function() {
alert('onAccessoryConnectSuccess');
}
manager.connect({url:url});
}
// -->
</script>
onAccessoryConnectFailure
Notified that the accessory(Bluetooth) connect is failure.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onAccessoryConnectFailure = function() {
alert('onAccessoryConnectFailure');
}
manager.connect({url:url});
}
// -->
</script>
onAccessoryDisconnect
Notified that the accessory(Bluetooth) is disconnected.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onAccessoryDisconnect = function() {
alert('onAccessoryDisconnect');
}
manager.connect({url:url});
}
// -->
</script>
onStatusUpdate
Notified that the printer status is updated.
syntax
function(response);
Parameter
Name | Description | Object type |
status | Hexdecimal digit sequence of 3rd to 6th bytes in Automatic Status (*)
(ex. “28000000”)
Status update timing- When the status changes.
- Even no status change, every 5 min.
* Please refer to STAR Line Mode and StarPRNT command manual for details of Automatic Status. | String |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onStatusUpdate = function() {
alert('onStatusUpdate');
}
manager.connect({url:url});
}
// -->
</script>
onDisplayImpossible
Notified that the display cannot be used.
Parameter
Name | Description | Object type |
- | - | - |
例
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onDisplayImpossible = function() {
alert('onDisplayImpossible');
}
manager.connect({url:url});
}
// -->
</script>
onDisplayConnect
Notified that the barcode reader is connected.
Parameter
Name | Description | Object type |
- | - | - |
例
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onDisplayConnect = function() {
alert('onDisplayConnect');
}
manager.connect({url:url});
}
// -->
</script>
onDisplayDisconnect
Notified that the barcode reader is disconnected.
Parameter
Name | Description | Object type |
- | - | - |
例
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onConnect(url) {
manager.onDisplayDisconnect = function() {
alert('onDisplayDisconnect');
}
manager.connect({url:url});
}
// -->
</script>
onWrite
Notified that the data transmission is complete.
Parameter
Name | Description | Object type |
- | - | - |
Example
<script type='text/javascript' src='js/StarWebPrintTrader.js'></script>
<script type='text/javascript' src='js/StarWebPrintExtManager.js'></script>
<script type='text/javascript'>
<!--
var manager = new StarWebPrintExtManager();
function onWrite(url, request) {
manager.onWrite = function() {
alert('onWrite');
}
manager.write({url:url, request:request});
}
// -->
</script>