Zebra ZQ 510 移动打印机兼容摩托罗拉 MC32NO(Windows Embedded Compact 7.0)
Zebra ZQ 510 Mobile Printer compatible with Motorola MC32NO (Windows Embedded Compact 7.0)
使用以下旧代码(引用 InTheHand.Net.Personal dll)通过蓝牙连接新购买的摩托罗拉 MC32N0 Zebra ZQ 510 移动打印机时遇到问题:
using InTheHand.Net;
using InTheHand.Net.Bluetooth;
using InTheHand.Net.Sockets;
using InTheHand.Net.Ports;
BluetoothAddress mac = BluetoothAddress.Parse("B0B44879581D");
BluetoothEndPoint btEndPoint = new BluetoothEndPoint(mac, BluetoothService.SerialPort);
BluetoothClient bluetoothClient = new BluetoothClient();
bluetoothClient.Connect(btEndPoint);
我的解决方法是使用 BluetoothSecurity.PairRequest() 函数配对打印机,但使用 BTUI 应用程序手动分配串行端口(COM5 或 COM9)。然后使用以下代码(引用 Zebra Link OS SDK(ZSDK_API.dll)):
using ZSDK_API.Comm;
// Instantiate connection for ZPL Serial port on COM5.
ZebraPrinterConnection thePrinterConn = new SerialPrinterConnection("COM5");
// Open the connection - physical connection is established here.
thePrinterConn.Open();
连接到它进行打印。
有两个问题想请教:
1. 想知道 Zebra ZQ 510 智能蓝牙移动打印机是否兼容 Motorola MC32NO (运行 on Windows Embedded Compact 7.0)?
2. 有没有办法在 Windows CE 中以编程方式创建虚拟 COM 端口?
终于找到解决办法了。下载 Motorola EMDK for .NET v2.9,并引用 Symbol.WPAN.dll。通过使用以下代码,设法连接到 Zebra ZQ510 打印机,并按预期打印出标签。不要忘记从 EMDK 复制 BTInterface.dll 到程序文件夹。
using Symbol.WPAN.Bluetooth;
Bluetooth m_Bluetooth = new Bluetooth();
m_Bluetooth.Enable();
RemoteDevice rd = new RemoteDevice("", currentBTPrinterMacAdd, "");
rd.LocalComPort = LocalComPortForZebraPrinterZQ510;
m_Bluetooth.RemoteDevices.Add(rd);
if (!rd.IsPaired)
rd.Pair();
rd.OpenPort();
rd.Write(Encoding.Default.GetBytes(template));
rd.ClosePort();
rd.UnPair();
m_Bluetooth.Disable();
m_Bluetooth.Dispose();
我在没有 Zebra 的 QLN320 上看到了同样的问题 link。在手中会配对,但如果您尝试使用本地端口,则会出错。
这里是 VB 2008 年的同一个例子。它工作正常,但有时连接速度有点慢。
Imports Symbol.WPAN
Imports Symbol.WPAN.Bluetooth
Imports System.Text
Dim printline As String = ""
printline = printline & "! 0 200 200 631 1" & vbCrLf
printline = printline & "PW 576" & vbCrLf
printline = printline & "TONE 0" & vbCrLf
printline = printline & "SPEED 4" & vbCrLf
printline = printline & "ON-FEED IGNORE" & vbCrLf
printline = printline & "NO-PACE" & vbCrLf
printline = printline & "GAP-SENSE" & vbCrLf
printline = printline & "BT 7 0 3" & vbCrLf
printline = printline & "B 128 2 30 458 69 62 02029990324041000014" & vbCrLf
printline = printline & "PRINT" & vbCrLf
Dim m_Bluetooth As New Bluetooth
m_Bluetooth.Enable()
m_Bluetooth.RemoteDevices.DeleteAll()
Dim rd As New RemoteDevice("Printer35", "", "")
rd.LocalComPort = 5
m_Bluetooth.RemoteDevices.Add(rd)
Try
If Not (rd.IsPaired) Then
rd.Pair("0035")
End If
rd.OpenPort()
Dim ByteArray As Byte() = Encoding.Default.GetBytes(printline & vbCrLf)
rd.Write(ByteArray)
rd.ClosePort()
rd.UnPair()
m_Bluetooth.RemoteDevices.DeleteAll()
Catch ex As Exception
MessageBox.Show("Error - " & ex.Message.ToString)
End Try
m_Bluetooth.Disable()
m_Bluetooth.Dispose()
使用以下旧代码(引用 InTheHand.Net.Personal dll)通过蓝牙连接新购买的摩托罗拉 MC32N0 Zebra ZQ 510 移动打印机时遇到问题:
using InTheHand.Net;
using InTheHand.Net.Bluetooth;
using InTheHand.Net.Sockets;
using InTheHand.Net.Ports;
BluetoothAddress mac = BluetoothAddress.Parse("B0B44879581D");
BluetoothEndPoint btEndPoint = new BluetoothEndPoint(mac, BluetoothService.SerialPort);
BluetoothClient bluetoothClient = new BluetoothClient();
bluetoothClient.Connect(btEndPoint);
我的解决方法是使用 BluetoothSecurity.PairRequest() 函数配对打印机,但使用 BTUI 应用程序手动分配串行端口(COM5 或 COM9)。然后使用以下代码(引用 Zebra Link OS SDK(ZSDK_API.dll)):
using ZSDK_API.Comm;
// Instantiate connection for ZPL Serial port on COM5.
ZebraPrinterConnection thePrinterConn = new SerialPrinterConnection("COM5");
// Open the connection - physical connection is established here.
thePrinterConn.Open();
连接到它进行打印。
有两个问题想请教: 1. 想知道 Zebra ZQ 510 智能蓝牙移动打印机是否兼容 Motorola MC32NO (运行 on Windows Embedded Compact 7.0)? 2. 有没有办法在 Windows CE 中以编程方式创建虚拟 COM 端口?
终于找到解决办法了。下载 Motorola EMDK for .NET v2.9,并引用 Symbol.WPAN.dll。通过使用以下代码,设法连接到 Zebra ZQ510 打印机,并按预期打印出标签。不要忘记从 EMDK 复制 BTInterface.dll 到程序文件夹。
using Symbol.WPAN.Bluetooth;
Bluetooth m_Bluetooth = new Bluetooth();
m_Bluetooth.Enable();
RemoteDevice rd = new RemoteDevice("", currentBTPrinterMacAdd, "");
rd.LocalComPort = LocalComPortForZebraPrinterZQ510;
m_Bluetooth.RemoteDevices.Add(rd);
if (!rd.IsPaired)
rd.Pair();
rd.OpenPort();
rd.Write(Encoding.Default.GetBytes(template));
rd.ClosePort();
rd.UnPair();
m_Bluetooth.Disable();
m_Bluetooth.Dispose();
我在没有 Zebra 的 QLN320 上看到了同样的问题 link。在手中会配对,但如果您尝试使用本地端口,则会出错。
这里是 VB 2008 年的同一个例子。它工作正常,但有时连接速度有点慢。
Imports Symbol.WPAN
Imports Symbol.WPAN.Bluetooth
Imports System.Text
Dim printline As String = ""
printline = printline & "! 0 200 200 631 1" & vbCrLf
printline = printline & "PW 576" & vbCrLf
printline = printline & "TONE 0" & vbCrLf
printline = printline & "SPEED 4" & vbCrLf
printline = printline & "ON-FEED IGNORE" & vbCrLf
printline = printline & "NO-PACE" & vbCrLf
printline = printline & "GAP-SENSE" & vbCrLf
printline = printline & "BT 7 0 3" & vbCrLf
printline = printline & "B 128 2 30 458 69 62 02029990324041000014" & vbCrLf
printline = printline & "PRINT" & vbCrLf
Dim m_Bluetooth As New Bluetooth
m_Bluetooth.Enable()
m_Bluetooth.RemoteDevices.DeleteAll()
Dim rd As New RemoteDevice("Printer35", "", "")
rd.LocalComPort = 5
m_Bluetooth.RemoteDevices.Add(rd)
Try
If Not (rd.IsPaired) Then
rd.Pair("0035")
End If
rd.OpenPort()
Dim ByteArray As Byte() = Encoding.Default.GetBytes(printline & vbCrLf)
rd.Write(ByteArray)
rd.ClosePort()
rd.UnPair()
m_Bluetooth.RemoteDevices.DeleteAll()
Catch ex As Exception
MessageBox.Show("Error - " & ex.Message.ToString)
End Try
m_Bluetooth.Disable()
m_Bluetooth.Dispose()