Android Question printed problem with varius print

fifiddu70

Well-Known Member
Licensed User
Longtime User
Hi everyone, using asyncstreams to send data via ethernet to an esc/pos printer, model 8330, I can only print once, then it doesn't print anymore and I have to turn the printer off and on again to reprint new data but it always stops waiting to turn it off and on again to start again in the same way, while using a small Rongtha RPP300 printer this problem does not exist and it prints every time the print button is pressed

H E L P
 

DonManfred

Expert
Licensed User
Longtime User
I don´t see how we could help here.

Basically i would like to suggest to buy a second Rongtha RPP300 instead if that printer works.
 
Upvote 0

fifiddu70

Well-Known Member
Licensed User
Longtime User
I don´t see how we could help here.

Basically i would like to suggest to buy a second Rongtha RPP300 instead if that printer works.
the 8330 is thermal printer 80mm auto cut
the rpp300 is 56mm thermal printer
i need to work with 8330
 
Upvote 0

fifiddu70

Well-Known Member
Licensed User
Longtime User
check if they provide an SDK for the printer and use it if so.

Again: i can not see how anyone could help here.

You are providing basically zero Informations.
you're right, now I'll enter the offending code and hope to find help
 
Upvote 0

fifiddu70

Well-Known Member
Licensed User
Longtime User
if I choose to print with btntransmit the printer works perfectly and waits for other prints, while if I choose the option: trasmettipreconto, the printer prints the first time but then in the next print the socket is not connected and it shows me in the log
Log("sub Client_Connected end table " & txttavolo.Text)

B4X:
Private Sub btnpreconto_Click
    precontoswitch = 1
If connected = False Then
        connected = True
        If connected Then
            ip=txtipserver.Text
            port = txtport.Text
            CltSock.Initialize("Client")
            CltSock.Connect(ip,port,20000)
            Log("Connesso con preconto in WiFi " & ip & " " & port & " " )
        End If
    Log("Connected " & connected & " chiamo la sub invio ")
                
    else If connected = True Then
        If connected Then
            ip=txtipserver.Text
            port = txtport.Text
            CltSock.Initialize("Client")
            CltSock.Connect(ip,port,20000)
            Log("Connesso in WiFi " & ip & " " & port & " " )
        End If
    Log("Connected " & connected & " chiamo la sub invio ")
    
End If
    

    Log("sub btnpreconto tavolo " & txttavolo.Text)
    
End Sub

Sub Client_Connected(ConStatus As Boolean)
    
    If ConStatus = True Then
        ToastMessageShow("Connesso con wifi su IP " & ip & " Porta " &  port,True)
        AStreams.InitializePrefix(CltSock.InputStream, False, CltSock.OutputStream, "AStreams")
        If wifi2.isWifiEnabled = True Then
            If precontoswitch = 1 Then ' se precontoswitch è 1 allora uso trasmettipreconto
                
                Log("sub Client_Connectedt if tavolo " & txttavolo.Text)
                trasmettipreconto '
                Else
                    
                    btntrasmetti_Click ' if pressed the printer print perfect and then press print another

                Log( "client_connected sta trasmettendo a btntrasmetti_Click")
                Log("sub Client_Connected else tavolo " & txttavolo.Text)
            End If
            
            
            
        Else
            mp2.Load(File.DirAssets,"alert.wav")
            mp2.Play
        MsgboxAsync("Non sei connesso con WiFi, controlla se sei connesso", " ATTENZIONE !!")
            
            End If
    End If
    Log("sub Client_Connected end tavolo " & txttavolo.Text)
End Sub

Sub trasmettipreconto
    
    If connected  Then
        Dim SendMsg As String
        If AStreams.IsInitialized = False Then Return
        Dim buffer() As Byte
        buffer = txttavolozza.Text.GetBytes("UTF8") 'Testosend lo realizzata per inviare tutta la comanda dentro questa casella di testo per essere trasmessa sul buffer di asyncstream.
        Log("TXTTAVOLOZZA =: " & txttavolozza.Text)
        AStreams.Write(buffer)
        txttavolozza.SelectAll
        If chfont.Checked = True Then
            SendMsg = Chr(27) & "!" &Chr(8+8+16) & "" & CRLF
            AStreams.Write(SendMsg.GetBytes("UTF8"))
        End If
         StampaTest
    End If
    
    precontoswitch = 0
End Sub

Sub StampaTest
    Log("sono sulla sub stampatest")
    
    If connected  Then
        Log("sono sulla sub stampatest dentro if connected")
        If AStreams.IsInitialized = False Then Return
        Dim buffertest() As Byte
        Dim sendMsgtest As String
        AStreams.Write(buffertest)
        sendMsgtest=Chr(29) & Chr(86) & Chr(48)' Cut?
        AStreams.Write(sendMsgtest.GetBytes("UTF8"))
        Log("sub stampatest tavolo " & txttavolo.Text)
        
    Else
        
        Log("sono sulla sub stampatest sull'else")
    End If
End Sub
 
Upvote 0
Top