Use Barcode Reader
Understand the differences between these SDKs before migrating to StarXpand SDK.
StarPRNT SDK
Set an object conforming to the StarIoExtManagerDelegate protocol to the StarIoExtManager.delegate property.
Calling connect() in this state causes the corresponding delegate method to be executed when the above event occurs.
func didBarcodeDataReceive(_ manager: StarIoExtManager!, data: Data!) {
print("Barcode Reader: Received data \(data)")
}
func didBarcodeReaderDisconnect(_ manager: StarIoExtManager!) {
print("Barcode Reader: Disconnect")
}
The delegate methods for barcode readers are as follows:
- didBarcodeReaderImpossible: Notify that a barcode reader has become unavailable.
- didBarcodeReaderConnect: Notify that a barcode reader has been connected.
- didBarcodeReaderDisconnect: Notify that a barcode reader has been disconnected.
- didBarcodeDataReceive: Notify that barcode data has been received.
StarXpand SDK
Calling open() in this state causes the corresponding delegate method to be executed when an event occurs on a peripheral connected to the printer.
func inputDeviceDidDisconnect(printer: StarPrinter) {
print("Input Device: Disconnected")
}
func inputDevice(printer: StarPrinter, didReceive data: Data) {
print("Input Device: DataReceived \(NSData(data: data))")
}
The delegate methods corresponding to barcode reader events are as follows:
- inputDeviceDidConnect(printer: StarPrinter): Notify that a barcode reader has been connected.
- inputDeviceDidDisconnect(printer: StarPrinter): Notify that a barcode reader has been disconnected.
- inputDevice(printer: StarPrinter, didReceive data: Data): Notify that barcode data has been received.
- inputDevice(printer: StarPrinter, communicationErrorDidOccur error: Error): Notify that a communication error has occurred.
Refer to Supported API List for information on whether each API is supported in StarPRNT SDK and StarXpand SDK.
Understand the differences between these SDKs before migrating to StarXpand SDK.
StarPRNT SDK
Specify an object implementing the IStarIoExtManagerListener interface in the StarIoExtManager constructor.
Calling connect() in this state causes the corresponding listener method to be executed when any event occurs on the barcode reader.
override fun onBarcodeDataReceive(data: ByteArray) {
Log.d(TAG, "Barcode Reader: Received data ${data.contentToString()}")
}
override fun onBarcodeReaderDisconnect() {
Log.d(TAG, "Barcode Reader: Disconnect")
}
The listener methods for barcode readers are as follows:
- onBarcodeReaderImpossible: Notify that a barcode reader has become unavailable.
- onBarcodeReaderConnect: Notify that a barcode reader has been connected.
- onBarcodeReaderDisconnect: Notify that a barcode reader has been disconnected.
- onBarcodeDataReceive: Notify that barcode data has been received.
StarXpand SDK
Calling openAsync() in this state causes the corresponding callback method to be executed when an event occurs on a peripheral connected to the printer.
override fun inputDeviceDidDisconnect(printer: StarPrinter) {
Log.d(TAG, "Input Device: Disconnected")
}
override fun inputDeviceDidReceive(printer: StarPrinter, data: ByteArray) {
Log.d(TAG, "Input Device: DataReceived ${data.contentToString()}")
}
The callback methods corresponding to barcode reader events are as follows:
- onConnected(): Notify that a barcode reader has been connected.
- onDisconnected(): Notify that a barcode reader has been disconnected.
- onDataReceived(data: ByteArray): Notify that barcode data has been received.
- onCommunicationError(error: Exception): Notify that a communication error has occurred.
Refer to Supported API List for information on whether each API is supported in StarPRNT SDK and StarXpand SDK.

