Update rel. 0.10
Add event
- DiscoveryNoDeviceFound
Yes. The attached version is Demo.I am trying to use the library but it displays the message: Demo library - Sorry not avaliable.
Unfortunately, the printer's bluetooth channel only receives but not answers like the print end.Hello .. Good evening..
is there any way I can tell if the printer has finished printing the entire buffer?
because I give the command 'flushAllAndClose'. and it activates the SendTerminated event even without having finished printing the entire buffer
sorry the English. I used google translator.
ex:
Sub bt_priter_functions_ConnectedToPrint
ToastMessageShow(mensagens.content_msg_conect_success_bt, True)
bt_priter_functions.Connected
For Each mp_modalit As Map In Main.lst_print_infos
Dim r As Map = mp_modalit.Get("r")
' Log( r.Get("dados"))
bt_priter_functions.AddBuffer_WriteLine( r.Get("dados"))
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Next
bt_priter_functions.AddBuffer_WriteLine(mutil.Align_miniPrinters(mensagens.system_version & mensagens.update_version,mutil.ALING_CENTER))
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
bt_priter_functions.AddBuffer_WriteLine(mutil.Align_miniPrinters(Main.current_date &" "& DateTime.Time(DateTime.Now),mutil.ALING_CENTER))
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
bt_priter_functions.AddBuffer_WriteLine(CRLF & CRLF & CRLF)
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
' Log(bt_priter_functions)
' bt_priter_functions
bt_priter_functions.flushAllAndClose
End Sub
Sub bt_priter_functions_SendTerminated
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
bt_priter_functions.Close
bluetooth_functions.TurnBluetoothOff
' Log(bt_priter_functions.Preview.Height)
pnl_option_send_print_poule.Visible = False
' Activity_Pause (True)
Activity.Finish
StartActivity(Main)
End Sub
Sub Class_Globals
Private bluetooth_functions As Toggle
Private bt_priter_functions As BT_Printer
Private retono_print As Int
Private int_count_time_window As Int = 0
Private tempo_visualiza_impressao As Timer
Private time_finish As Int
Dim qr As QRcode
Dim bm As Bitmap
End Sub
Public Sub Initialize(temp_milisecon As Int)
tempo_visualiza_impressao.Initialize("tempo_visualiza_impressao",10000)
tempo_visualiza_impressao.Enabled = True
time_finish = temp_milisecon
int_count_time_window = 0
retono_print = 0
bt_priter_functions.Initialize(Me,"bt_priter_functions",Encoding.UTF8)
bt_priter_functions.Close
Dim ImpPadrao As String
If File.Exists(File.DirDefaultExternal,"ConfImp.cfg") Then
ImpPadrao = File.GetText(File.DirDefaultExternal, "ConfImp.cfg") ' default printer mac
bt_priter_functions.ClearBuffer
bt_priter_functions.SelectFromMac(ImpPadrao)
bt_priter_functions.Connected
qr.Initialize
bm = qr.drawQRCode(Main.str_url_link)
End If
End Sub
Sub tempo_visualiza_impressao_Tick
If retono_print > 0 Then
int_count_time_window = int_count_time_window + 1
Log(int_count_time_window)
If int_count_time_window > time_finish Then
bt_priter_functions.flushAllAndClose
End If
End If
End Sub
Sub bt_priter_functions_ListPrinterAssociated (ListNameAndMac As List)
End Sub
Sub bt_priter_functions_DiscoveryNewPrinter (Print As NameAndMac)
End Sub
Sub bt_priter_functions_DiscoveryFinished
End Sub
Sub bt_priter_functions_DiscoveryNoDeviceFound
ToastMessageShow("Device not found",True)
End Sub
Sub bt_priter_functions_ConnectedToPrint
Dim is_qr_code As Boolean = False
retono_print = 1
bt_priter_functions.Connected
Log(Main.lst_print_infos.Size)
For Each mp_modalit As Map In Main.lst_print_infos
Dim r As Map = mp_modalit.Get("r")
If IsNumber( r.Get("dados")) Then
Dim int_dados As Int = r.Get("dados")
If int_dados = -11 Then
is_qr_code = True
End If
Else
is_qr_code = False
End If
If is_qr_code = True Then
bt_priter_functions.AddBuffer_Bitmap(bm,95)
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Else
bt_priter_functions.AddBuffer_WriteLine( r.Get("dados"))
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
End If
Next
bt_priter_functions.AddBuffer_WriteLine(mutil.Align_miniPrinters(mensagens.system_version & mensagens.update_version,mutil.ALING_CENTER))
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
bt_priter_functions.AddBuffer_WriteLine(CRLF & CRLF & CRLF)
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
End Sub
Sub bt_priter_functions_SendTerminated
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
End Sub
bt_priter_functions.SendBufferToPrinter
bt_priter_functions.ClearBuffer
Sub BTPrinter_DiscoveryNewPrinter (Print As NameAndMac, DeviceClass As Int)
' Find new printer
If DeviceClass=Printer.Const_PERIPHERAL Then
ListView1.AddSingleLine2(Print.Name,Print.Mac)
End If
End Sub
Unfortunately, the Bluetooth printer does not provide vertical printing.Your library is working great, thank you.
I do have 1 more question however.
The receipt I am printing on has a left perforation, and I want to print something vertically (receipt # to be torn off) between the left edge and the perf.
How do I print something vertically?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?