Android Question problem printer ticket pos connection network

resti

Member
Licensed User
** Hi, I'm doing a print test to a pos ticket printer connected to the network. The problem works well is that when a little time passes it stops printing. I do not know what to do. Thank you. **


#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub



Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

Dim IPIMPRESORA1 As String' IP

Dim IMPRESORA1 As Socket 'Network library

Dim PRINT As AsyncStreams 'RandomAccessFile library

Dim ESPOS As String' CODIGO PARA IMPRIMIR

Private Button1 As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:

Activity.LoadLayout("L1")

IPIMPRESORA1="192.168.0.87"

IMPRESORA1.Initialize("IMPRESORA1")
IMPRESORA1.Connect(IPIMPRESORA1, 9100, 0) 'Printer IP address, 9100=Port number (please look up port number)

End Sub

Sub IMPRESORA1_Connected (Successful As Boolean)

If Successful Then
PRINT.Initialize(IMPRESORA1.InputStream, IMPRESORA1.OutputStream, "PRINT")
Log("conex 1")
End If

End Sub


Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub Button1_Click

ESPOS = Chr(27) & "@"' INICIAR IMPRESORA
PRINT.Write(ESPOS.GetBytes("UTF8"))


ESPOS = "HOLA MUNDO" & CRLF
PRINT.Write(ESPOS.GetBytes("UTF8"))

ESPOS = Chr(27) & Chr(109)' CORTE PARCIAL
PRINT.Write(ESPOS.GetBytes("UTF8"))

End Sub

************************************************************************


#Region Service Attributes
#StartAtBoot: False
#ExcludeFromLibrary: True
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.



End Sub

Sub Service_Create
'This is the program entry point.
'This is a good place to load resources that are not specific to a single activity.



End Sub


Sub Service_Start (StartingIntent As Intent)



End Sub

Sub Service_TaskRemoved
'This event will be raised when the user removes the app from the recent apps list.
End Sub

'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub

Sub Service_Destroy


End Sub
 
Top