Hi
I manage to get the correct sdk but know I am facing the below problem.
After long discussion and tests with the vendor I asked and receive an operational from their part example of printing just on line within a block. Building and executing the function as a lib inside b4a I can't print. During debugging I found that all the statements are working correctly except the statement sending the string to the printer which execute without error but the printer doesn't print. The test application that vendor send me is working properly. Is there any additional statement needed perhaps inside b4a to allow the sending command to execute successfully? Below the code in lib.
package anywheresoftware.b4a.objects;
import defaultPackage.PRTAndroidPrint;
import java.io.UnsupportedEncodingException;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ActivityObject;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.BA.Permissions;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
@Version(1.0f)
/*@Permissions(values={"android.permission.INTERNET"})*/
@Permissions(values={"android.permission.BLUETOOTH"})
@ShortName("MPT2")
@DependsOn(values={"PRTAndroidPrint"})
@ActivityObject
public class MPTII {
public int prtTest2() throws UnsupportedEncodingException {
PRTAndroidPrint mob=new PRTAndroidPrint();
boolean bRes = mob.PRTInitLib();
BluetoothAdapter mBluetoothAdapter = null;
mBluetoothAdapter=BluetoothAdapter.getDefaultAdapter();
mBluetoothAdapter.enable();
int ires=0;
PRTAndroidPrint.bluetoothAddress = "00:02:5B:B3:22:09";
bRes = mob.PRTConnectDevices();
if (bRes) {
ires+=5;}
bRes = mob.PRTReset();
mob.PRTFormatString(false, false, false, false, false);
//TXT for printing
String str="12345565";
byte data[] = null;
try {
//get printing byte array by making coding
data = str.getBytes("gb2312");
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//Edit command
byte sendText[]=new byte[3];
sendText[0]=0x1B;
sendText[1]=0x74;
sendText[2]=(byte)23;//coding scheme
mob.PRTSendBuffer(sendText, sendText.length);
mob.PRTSendBuffer(data, data.length);
//Paper running
mob.PRTFeedLines(20);
mob.PRTReset();
mob.PRTCloseConnect();
return ires;
}
}
Thanks.