Reputation: 31
I cannot seem to be able to print on the Epson TM-T88VI printer.
I have followed the tutorial in the docs. I can find a printer with the ePos Finder class and it gets populated in the mList variable. I can build using the epos builder but
While debugging
printer.openPrinter(firstDevice.deviceType,firstDevice.ipAddress,Print.TRUE,10,10)
eposOpenPrinter()
line.class MainActivity : ComponentActivity(), BatteryStatusChangeEventListener, StatusChangeEventListener{
private var mList: Array<DeviceInfo>? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initializePrinter()
}
private fun initializePrinter() {
try {
Finder.start(baseContext, DevType.TCP, "192.168.0.34")
while (mList == null || mList?.size == 0) {
mList = Finder.getDeviceInfoList(FilterOption.PARAM_DEFAULT)
}
Finder.stop()
if (!mList.isNullOrEmpty()) {
val builder = Builder("TM-T88VI", Builder.MODEL_ANK)
builder.apply {
addTextLang(Builder.LANG_EN)
addTextSmooth(Builder.TRUE)
addTextFont(Builder.FONT_A)
addTextSize(3, 3)
addText("It \t")
addText("Finally Works\n")
addCut(Builder.CUT_FEED)
}
val printer = Print()
val status = intArrayOf(0)
//wifi/ethernet
val firstDevice = mList!!.first()
printer.openPrinter(
firstDevice.deviceType,
firstDevice.ipAddress,
Print.TRUE,
10,
10
)
printer.sendData(builder, 10_000, status)
if ((status[0] and Print.ST_PRINT_SUCCESS) == Print.ST_PRINT_SUCCESS) {
builder.clearCommandBuffer()
}
printer.closePrinter()
}
} catch (e: EposException) {
e.printStackTrace()
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onBatteryStatusChangeEvent(p0: String?, p1: Int) {
TODO("Not yet implemented")
}
override fun onStatusChangeEvent(p0: String?, p1: Int) {
TODO("Not yet implemented")
}
}
'''
The stack trace is
2024-04-30 15:16:52.524 15851-15851 System.err com.example.printertest W at com.epson.eposprint.Print.openPrinter(Print.java:467)
2024-04-30 15:16:52.524 15851-15851 System.err com.example.printertest W at com.example.printertest.MainActivity.initializePrinter(MainActivity.kt:47)
2024-04-30 15:16:52.524 15851-15851 System.err com.example.printertest W at com.example.printertest.MainActivity.onCreate(MainActivity.kt:20)
2024-04-30 15:16:52.524 15851-15851 System.err com.example.printertest W at android.app.Activity.performCreate(Activity.java:8595)
2024-04-30 15:16:52.525 15851-15851 System.err com.example.printertest W at android.app.Activity.performCreate(Activity.java:8573)
2024-04-30 15:16:52.525 15851-15851 System.err com.example.printertest W at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456)
2024-04-30 15:16:52.525 15851-15851 System.err com.example.printertest W at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3764)
2024-04-30 15:16:52.525 15851-15851 System.err com.example.printertest W at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922)
2024-04-30 15:16:52.525 15851-15851 System.err com.example.printertest W at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
2024-04-30 15:16:52.525 15851-15851 System.err com.example.printertest W at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
2024-04-30 15:16:52.526 15851-15851 System.err com.example.printertest W at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
2024-04-30 15:16:52.527 15851-15851 System.err com.example.printertest W at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
2024-04-30 15:16:52.528 15851-15851 System.err com.example.printertest W at android.os.Handler.dispatchMessage(Handler.java:106)
2024-04-30 15:16:52.528 15851-15851 System.err com.example.printertest W at android.os.Looper.loopOnce(Looper.java:205)
2024-04-30 15:16:52.528 15851-15851 System.err com.example.printertest W at android.os.Looper.loop(Looper.java:294)
2024-04-30 15:16:52.528 15851-15851 System.err com.example.printertest W at android.app.ActivityThread.main(ActivityThread.java:8177)
2024-04-30 15:16:52.528 15851-15851 System.err com.example.printertest W at java.lang.reflect.Method.invoke(Native Method)
2024-04-30 15:16:52.529 15851-15851 System.err com.example.printertest W at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
2024-04-30 15:16:52.529 15851-15851 System.err com.example.printertest W at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Upvotes: 0
Views: 88