B4A Library SD: BT Printer Bluetooth

Xfood

Expert
Licensed User
Currently I release the library in three versions:
  • 0.21 SPP bluetooth only.
  • 1.00 Bluetooth SPP + BLE.
  • 1.01 Bluetooth SPP + BLE + USB.
If you are interested in private I will be able to tell you the quotation of each version
1.02 Bluetooth SPP + BLE + USB + LAN ???
1.03 Bluetooth SPP + BLE + USB + LAN + serial ???

it's not a joke, but the lan and serial part might interest me
 

Star-Dust

Expert
Licensed User
Longtime User

Star-Dust

Expert
Licensed User
Longtime User
I don't have an ESC / POS lan printer and therefore can't make it.
 
Last edited:

jahswant

Well-Known Member
Licensed User
Longtime User
I don't have an ESC / POS lan printer and therefore can't make it.
Just a push . This is the code I use to print for lan ESC / POS printers.

B4X:
Dim LANPRINTER As Socket 'Network library
Dim AStreams As AsyncStreams 'RandomAccessFile library

LANPRINTER.Initialize("LANPRINTER")
LANPRINTER.Connect(PIp, Pport, 0) '100=Printer address, 9100=Port number (please look up port number)


Sub LANPRINTER_Connected (Successful As Boolean)
        If Successful Then
            AStreams.Initialize(LANPRINTER.InputStream, LANPRINTER.OutputStream, "AStreams")
            AStreams.Write(PrintTicket1(Sales_Code1).GetBytes("UTF8"))
            Sleep(2000)
            AStreams.Close
            TMT20II.Close
        End If
End Sub

Sub AStreams_NewData (Buffer() As Byte)
    Dim msg As String
    msg = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
    LogDebug("AStreams_NewData = " & msg)
End Sub

Sub AStreams_Error
    BCT.Show(LastException.Message)
End Sub
 

Star-Dust

Expert
Licensed User
Longtime User
Thanks @jahswant, you were very kind.
I have already done the library for Zebra LAN, BLE and USB without having a Zebra printer. But it was actually a gentle way to say no to my friend @Xfood.

Now you have taken away the excuse for not carrying it out
 

Star-Dust

Expert
Licensed User
Longtime User
Good morning Maicon,

The library also works correctly on B4XPage. If you can't see the printers you are wrong in the manifest and / or in the permission request.
Make sure you know the latest changes required to use Bluetooth on SDK 30. (here)

Here you see the version of the example for B4xPages.



PS
In the example you sent me privately there are several errors. As I have already written to you, make sure you know how to set the manifest and how to request permissions inside a B4XPage.
 

Star-Dust

Expert
Licensed User
Longtime User
ANNOUNCEMENT

Starting today, this library will be abandoned and will no longer be distributed.
After 5 years from the moment it was developed, I can say that it has run its full course and now there is a need to take a leap forward.

A new, more comprehensive Android library for ESC / POS thermal printers will be released. (here)
Unlike iOS id which only allows LAN and BLE connection with o.s. Android can be connected in 5 different ways (BT, BLE, LAN, USB, NFC) and I want to collect it in one library.

Here is a preview of the prototype I am testing

 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…