Print on ZD621 using BT from iOS

// Expert user has replied.
F Forrest Faber 2 years 7 months ago
59 3 0

I'm trying to print to a ZD621 label printer with BLE. Is there a way to do this without using the Link-OS SDK. I would prefer using Swift instead of Objective C.

I'm using the Swift way of connecting to the printer using Core Bluetooth with the CBCentralManager.
I get a connection using:
let PRINTER_SERVICE = CBUUID(string: "0xFE79")
However, when I query for services, I get an empty list:
central.state is .poweredOn
2021-08-04 10:22:57.403049-0400 EquipLabelPrinter[319:6039] Metal API Validation Enabled

Connected!
Services size = 0

func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
print("Connected!")

//The following call returns 0 services.
printerPeripheral.discoverServices([PRINTER_SERVICE])
}
}
extension PrinterViewController: CBPeripheralDelegate {

func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {

guard let services = peripheral.services else { return }
print("Services size = \(services.count)")
for service in services {
print(service)
peripheral.discoverCharacteristics(nil, for: service)
}
}
Any help would be appreciated!

Please register or login to post a reply

3 Replies

S Steven Si

We've a BLE demo for iOS. Though the demo is based on Objective-C, the underneath essence is the same for both Objective-C and Swift. The demo and its related references are on the GitHub - https://github.com/ZebraDevs/LinkOS-iOS-Samples/tree/ZebraPrinterBLEDem…

F Forrest Faber

Thanks, I'll take a look.

J Justin Leger

Hi Forrest,

I seem to be in the same boat as you were. Did you ever make any headway in this? Would you have any swift sample projects you could share? Any help would be greatly appreciated.

Thanks,

Justin

CONTACT
Can’t find what you’re looking for?