Android Question Printing ttyMT0 port

mrjaw

Active Member
Licensed User
Longtime User
Hi!
I have a device with printer included. This device has a demo in java and this use the port ttyMT0 to open this. I am trying to do the same . THere is any library to allow use this port.
The code to open this in java is here
<code>
public void onCreate(Bundle savedInstanceState) {
if (savedInstanceState==null) {
savedInstanceState=new Bundle();
}
savedInstanceState.putString("device", "/dev/ttyMT0");
savedInstanceState.putInt("baudrate", 9600);
super.onCreate(savedInstanceState);
setContentView(R.layout.printer);
pmw_ctrl(Constant_Scan.IOCTRL_PMU_PRINTER_ON);
</code>
 

mrjaw

Active Member
Licensed User
Longtime User
But you tell me use wrap to this java library , I mean create a B4A library to use it ?
Where can I find info about JavaObjects ?
 
Upvote 0

hogiebaer

Active Member
Licensed User
Longtime User
Try this
<CODE>
Dim Printer_AStream as AsyncStreams
Dim tr as textreader
Dim Buffer() as byte
Dim Success as Boolean

SerialPrinter.SetPort("/dev/ttyMT0",9600,0)
Printer_AStream.Initialize(SerialPrinter.InputStream,SerialPrinter.OutputStream,"Printer_Astream")

tr.Initialize(File.OpenInput(File.Dirdefaultexternal , "example.txt"))

buffer = tr.ReadAll.GetBytes("ISO-8859-1") 'Or other Iso Format
Success = Printer_AStream.Write(buffer)

...
..
</CODE>

You need Module SerialLibJab for this
 
Upvote 0
Top