Search code examples
bluetoothbluetooth-lowenergywindows-cezebra-printers

Zebra ZQ 510 Mobile Printer compatible with Motorola MC32NO (Windows Embedded Compact 7.0)


Have problem to get connect with the new purchased Zebra ZQ 510 mobile printer from Motorola MC32N0 via bluetooth by using the following legacy code(referencing InTheHand.Net.Personal dll):

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);

My workaround is to use BluetoothSecurity.PairRequest() function to pair the printer, but manually assign a Serial Port( either COM5 or COM9) by using BTUI application. Then use following code(referencing 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();

to connect to it to print.

have two questions to ask: 1. Would like to know whether Zebra ZQ 510 Mobile Printer with Smart Bluetooth compatible with Motorola MC32NO (Running on Windows Embedded Compact 7.0)? 2. Is there a way to create virtual COM Port programmatically in Windows CE?


Solution

  • Finally find out a solution. Downloaded Motorola EMDK for .NET v2.9, and referenced Symbol.WPAN.dll. by using following code, managed to connect to the Zebra ZQ510 printer, and printed out label as expected. Don't forget to copy BTInterface.dll from EMDK to the program folder.

            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();