1

I am working on one Bluetooth printing application, in which I discover all near by Bluetooth. Now I have to check particular Bluetooth is Samsung printer OR zebra printer or any other type of printer.

As we can get identifier of bluetooth by using ExternalAccessory.framework in iOS by using following code.

ExternalAccessory.framework
  if ([accessory.protocolStrings indexOfObject:@"com.zebra.rawport"] != NSNotFound) {
      discoveredPrinter.device_type = @(DeviceTypeZebra);
}

I searched for same way in Android, but I come to know in android we can not achieve this kind of thing with Bluetooth. Please let me know if anyone resolved same issue before to identify type of Bluetooth printer.

Hardik Joshi
  • 9,477
  • 12
  • 61
  • 113

1 Answers1

0

You can use BluetoothClass.Device.Major and BluetoothClass.Device to identify a type of device. For a printer, it would be:

if (btDevice.bluetoothClass.majorDeviceClass == BluetoothClass.Device.Major.IMAGING 
    && btDevice.bluetoothClass.deviceClass == 1664) 
{
    // it's a printer

From then on you can try Epson's ESC codes (the de facto standard) or the manufacturer's SDKs (like Zebra's).

As for OUIs they're defined by IEEE but you can get them in a more sanitized form.

(Source for the printer class code, in Dutch.)

vesperto
  • 804
  • 1
  • 6
  • 26