Difficulty connecting to ZQ510 over BLE on iOS

// Expert user has replied.
O Oscar Goh 3 years 7 months ago
32 1 0

Hi, I'm trying to connect my iOS app to a Zebra ZQ510 printer over CoreBluetooth, but not having much luck locating the printer. Looking at the sample code from https://github.com/ZebraDevs/LinkOS-iOS-Samples/tree/ZebraPrinterBLEDemo, I call scanForPeripherals( ) to locate the printer:
central.scanForPeripherals(withServices: services, options: [
CBCentralManagerScanOptionAllowDuplicatesKey : false
])
The callbacks for centralManager(_, didDiscover:, advertisementData:, rssi:) all differ depending on what I pass in for services in the call above, but none of them let me get to the Zebra printer.
If I set services to nil, I get a number of nameless peripherals with no way to determine which one is the printer without connecting to each peripheral individually.
If I set services like so:
let services = [CBUUID(string: ZPRINTER_SERV_ID_FOR_CONNECTION)]
I do not get a response.
I'm not sure what else I'm missing to try to find my printer. Can someone please point me in the right direction? Thanks in advance.

Please Register or Login to post a reply

1 Replies

S Steven Si

Make sure that the particular sub-model of the ZQ510 printer has the BLE equipped and enabled. If the BLE is equipped and enabled on the ZQ510, you can use the demo (https://github.com/ZebraDevs/LinkOS-iOS-Samples/tree/ZebraPrinterBLEDemo) to test it out first before preceeding to create you own app. Use the following commands to check and enable the BLE. The printer needs a reset after issuing the commands.

// Check if BLE is equipped
! U1 getvar "bluetooth.le.controller_mode"

// Enable BLE
! U1 setvar "bluetooth.le.controller_mode" "le"
! U1 setvar "bluetooth.le.controller_mode" "both"