I am currently trying out the VB.NET PrinterSample_Step1, "Hello OPOS for .Net" . I have installed the driver for TM-H6000IV using EPSON advanced driver and set it up in the SetUpPOS for OPOS.NET . When I run the sample program, it will return the exception: {"The printer is currently being initialized."}. When I run the CheckHealthTest ,it will be stuck on this screen: https://imgur.com/41Z26Ny and it will return this error: https://imgur.com/avz0wyz . This is the code from the sample program:
Imports Microsoft.PointOfService
Public Class FrameStep1
Inherits System.Windows.Forms.Form
Private m_Printer As Microsoft.PointOfService.PosPrinter = Nothing
#Region " Windows Forms Designer generated code."
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Private components As System.ComponentModel.IContainer
Friend WithEvents btnPrint As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.btnPrint = New System.Windows.Forms.Button
Me.SuspendLayout()
Me.btnPrint.Location = New System.Drawing.Point(84, 40)
Me.btnPrint.Name = "btnPrint"
Me.btnPrint.Size = New System.Drawing.Size(120, 32)
Me.btnPrint.TabIndex = 0
Me.btnPrint.Text = "Print"
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)
Me.ClientSize = New System.Drawing.Size(280, 125)
Me.Controls.Add(Me.btnPrint)
Me.MaximizeBox = False
Me.Name = "FrameStep1"
Me.Text = "Step1 Print ""Hello OPOS for .Net"""
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub btnPrint_Click(ByVal sender As System.Object _
, ByVal e As System.EventArgs) Handles btnPrint.Click
Try
m_Printer.PrintNormal(PrinterStation.Receipt, "Hello OPOS for .Net" + vbCrLf)
Catch ex As PosControlException
End Try
End Sub
Private Sub ChangeButtonStatus()
btnPrint.Enabled = False
End Sub
Private Sub FrameStep1_Load(ByVal sender As System.Object _
, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strLogicalName As String
Dim deviceInfo As DeviceInfo
Dim posExplorer As PosExplorer
strLogicalName = "PosPrinter2"
posExplorer = New PosExplorer
m_Printer = Nothing
Try
deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, strLogicalName)
m_Printer = posExplorer.CreateInstance(deviceInfo)
Catch ex As Exception
ChangeButtonStatus()
Return
End Try
Try
m_Printer.Open()
m_Printer.Claim(1000)
m_Printer.DeviceEnabled = True
Catch ex As PosControlException
ChangeButtonStatus()
End Try
End Sub
Private Sub FrameStep1_Closing(ByVal sender As Object _
, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If m_Printer Is Nothing Then
Return
End If
Try
m_Printer.DeviceEnabled = False
m_Printer.Release()
Catch ex As Exception
Finally
m_Printer.Close()
End Try
End Sub
End Class
The exception will be caught here in these lines:
Private Sub btnPrint_Click(ByVal sender As System.Object _
, ByVal e As System.EventArgs) Handles btnPrint.Click
Try
m_Printer.PrintNormal(PrinterStation.Receipt, "Hello OPOS for .Net" + vbCrLf)
Catch ex As PosControlException
End Try
End Sub
I have found this Q&A: https://okbizcs.okwave.jp/epson/questiondetail/?qid=8318452 but it does not seem to be relevant to this issue.
What I have tried:
I have looked at the stack trace:
ErrorCode: Failure
ErrorCodeExtended: 0
Stack trace: at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at Microsoft.PointOfService.PosException.GetExceptionText(Exception e)
at Microsoft.PointOfService.PosException.LogError()
at Microsoft.PointOfService.PosControlException..ctor(String message, ErrorCode errorCode, Int32 errorCodeExtended)
at jp.co.epson.upos.core.v1_14_0001.pntr.init.AbstractPrinterInitialization.OutputData(Byte[] abyData, Boolean bAddSelect, Int64 lTimeout, Boolean bFlow)
at jp.co.epson.upos.core.v1_14_0001.pntr.init.AbstractPrinterInitialization.GetRealtimeStatus()
at jp.co.epson.upos.core.v1_14_0001.pntr.init.AbstractPrinterInitialization.GetPrinterStatus(Boolean bFullCheck, Int64 lTimeout)
at jp.co.epson.upos.core.v1_14_0001.pntr.init.AbstractPrinterInitialization.GetPrinterStatus(Boolean bFullCheck)
at jp.co.epson.upos.H6000IV.pntr.init.H6000IV_Initialization.InitializeCommon()
at jp.co.epson.upos.core.v1_14_0001.pntr.init.AbstractPrinterInitialization.Initialize()
at jp.co.epson.upos.core.v1_14_0001.pntr.init.AbstractPrinterInitialization.Initialize(Int32 iResetCounter)
at jp.co.epson.upos.core.v1_14_0001.pntr.init.InitializationThread.ThreadProcess()
at jp.co.epson.uposcommon.core.v1_14_0001.util.EpsonCommonThread.Run()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
[PosException]: Microsoft.PointOfService.PosControlException: The printer is currently being initialized. ---> jp.co.epson.upos.core.v1_14_0001.pntr.state.PrinterStateException: The printer is currently being initialized.
at jp.co.epson.upos.core.v1_14_0001.pntr.state.PrinterState_USBSerialCompatible.ConfirmConditionForNotOfflineCommand(Int32 iStation)
at jp.co.epson.upos.core.v1_14_0001.pntr.state.PrinterState_USBSerialCompatible.ConfirmCondition(Int32 iStation)
at jp.co.epson.upos.core.v1_14_0001.pntr.io.CommonOutputToPrinterAndEJ.CheckError(Int32[] aiStationIndex, Boolean bAfterQueue)
--- End of inner exception stack trace ---
There seems to be some issues with the SetUpPOS configuration and also the drivers set up.