iOS Question BLE Mini Printer

iCAB

Well-Known Member
Licensed User
Longtime User
Hi All

I am using the BLE sample code to print to a bluetooth mini printer

The Log in the connected event looks like this

B4X:
Found: Thermal Printer, 7707E342-B321-4E40-ABB8-EF384D43CD92, RSSI = -38, (read only map) {
    kCBAdvDataIsConnectable = 1;
    kCBAdvDataLocalName = "Thermal Printer";
    kCBAdvDataServiceUUIDs =     (
        18F0,
        "E7810A71-73AE-499D-8C15-FAA9AEF0C3F2"
    );
    kCBAdvDataTxPowerLevel = 4;
}


I was trying to figure out the proper service and id to use to print.

So what I did is this:

B4X:
Sub Manager_DataAvailable (Service As String, Characteristics As Map)
    ActivityIndicator2.Visible = False
    clv.Add(CreateServiceItem(Service), 30, "")
    For Each id As String In Characteristics.Keys
        clv.Add(CreateCharacteristicItem(id, Characteristics.Get(id)), 40, "")
       
        Dim s As String = "abcde"
        Dim msg() As Byte = s.GetBytes("ASCII")
        Dim msg2(msg.Length + 2)   As Byte
       
        ByteConv1.ArrayCopy(msg,0,msg2,0,msg.Length)
        msg2(msg.Length) = 10
        msg2(msg.Length+ 1) = 13
           
    Log ( " ID  " & Service & " " & id)
        manager.WriteData(Service,id, msg2)
    Next
End Sub

The data is printed for the following 3 cases:
B4X:
ID  49535343-FE7D-4AE5-8FA9-9FAFD205E455   49535343-8841-43F4-A8D4-ECBE34729BB3
ID  18F0  2AF1
ID  E7810A71-73AE-499D-8C15-FAA9AEF0C3F2   BEF8D6C9-9C21-4C9E-B632-BD58C1009F9F

What is the proper way of determining which service and id to use for printing?

Thanks in advance
 

iCAB

Well-Known Member
Licensed User
Longtime User
Are you sure that the printer supports printing with BLE? Does it come with any documentation?

Honestly, I am not sure at the moment. I am still trying to get the documentation for it.

All what I know that it is supposed to support bluetooth for iOS. And if I understood correctly by reading different posts, that iOS doesn't support bluetooth serial (please correct if I am wrong).
That's why, I gave it a try using the BLE sample code as I described above and it does seem to print (but I am not sure how reliable it is going to be).


Thanks
iCAB
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
Are you sure that the printer supports printing with BLE? Does it come with any documentation?
Hi Erel
Yes according to the manufacturer, it does support BLE.
I am also having an issue with WriteComplete event not being fired

B4X:
Sub Manager_WriteComplete(Characteristic As String, Success As Boolean)
    Log("Write complete: " & Characteristic )
End Sub

is there anything special that I have to do for this to work?

Thanks in advance
 
Upvote 0
Top