我有一台打印机RW420和Zsdk'm用来打印它,因为当我尝试通过运行软件android 4的mac地址打开连接时,我通过斑马设置实用程序配置了Pin它打开了屏幕询问引脚两次并且无法在eclipse logcat中建立连接返回bluez.Error.AlreadyExists然后第二个错误connectionAttemptFailed(主机已关闭)。有没有人设法用这台打印机和android进行打印?有什么不同的事情要做?使用Zsdk或类进行android的本机通信?
我测试的代码是:
MacAdd String = "00037A67EF08";
BluetoothPrinterConnection myConn = new BluetoothPrinterConnection (macAdd);
PrinterCommandImpl cmdGetFirmware PrinterCommandImpl = new ("! U1 getvar \" appl.name \ "\ r \ n");
try {
/ / Open connection to printer. This requires que
/ / The devices already be paired.
myConn.open ();
/ / Send command to printer and wait for 8000 ms response
byte [] response = cmdGetFirmware.sendAndWaitForResponse (myConn, 8000, 200);
/ / Display the responses in a TextView
/ / Status.setText (new String (response));
String s = new String (response);
/ / Close connection
myConn.close ();
} Catch (Exception ex) {
/ / Catch error here
}
任何事都可以提供帮助,因为我这个问题已经持续了一个星期而无法离开这个地方!也许是一个真正有效的代码示例。
谢谢
答案 0 :(得分:0)
虽然这不一定是编程答案,但使用较旧固件的Zebra打印机会出现一些蓝牙不一致的情况。可能值得检查打印机的固件并确保它是最新的。您需要知道打印机的PCC编号(应该在打印机底部的标签上)以确定您需要的固件。
www.zebra.com/firmware
Android市场上还有一款名为“Zebra Utilities”的免费应用程序,旨在帮助演示Zebra SDK功能。您可能需要下载该应用程序以查看它是否可以与RW 420通信。