11

I have connected Barcode Scanner device

Barcode Scanner Information

I want to know the paired status of it. Whether it is connected with device or not.

- (void) centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
    {
        self.connectingPeripheral = peripheral;        
        NSLog(@"@@@@@@Peripheral Name is:%@ Identifier:%@ Services:%@",peripheral.name,peripheral.identifier,peripheral.services);
        [self.bluetoothManager connectPeripheral: self.connectingPeripheraloptions: nil];
}

Paired List

I am getting information about Mac's which are nearby and enabled. But I am not getting Barcode Scanner information in this Method.

I need whether barcode scanner is connected to device or not.

can anyone suggest how to find connectivity of barcode scanner.

I appreciate your response, Thanks.

user13267
  • 6,871
  • 28
  • 80
  • 138
Vidhyanand
  • 5,369
  • 4
  • 26
  • 59
  • Are you sure it's a Bluetooth Low-Energy device? It's unclear on its information page. – Larme Jul 25 '16 at 11:50
  • Update: I saw on the doc (http://www.barcodedatalink.com/media/pdf/Motorola_CS3000_Brochure.pdf) "Bluetooth, Class 2, Version 2.1 + Enhanced Data". So you won't find it with CoreBluetooth (which is only for Bluetooth Low-Energy). You may find it with ExternalAccessory.framework. – Larme Aug 03 '16 at 12:46
  • @Larme, Can you suggest any solution other than core bluetooth & ExternalAccessory as they are not getting the details of barcode scanner. – Vidhyanand Aug 03 '16 at 12:56
  • @Vidhyanand are you able to get any solution? I'm also facing the same issue, it would be helpful if you've got solution. – Manikanta Jul 17 '18 at 14:09
  • Did you find out how to do it? Is the consensus this is not possible? Is there anyway to use EAAccessoryManager to do this? – user13267 Nov 26 '20 at 04:56

3 Answers3

4

Read the below answer:

https://stackoverflow.com/a/11128869/5178107

Might help you. More over, CoreBluetooth only allows you to access Bluetooth Low Energy devices. You can pair these devices if you need encryption but typically you don't. However, there is no API to list the paired devices - you need to discover the device(s) that are offering the service you are interested in and present a list, if necessary using your own UI in your app. Once you have identified the target device you can initiate a connection.

Community
  • 1
  • 1
Vikas Dadheech
  • 1,672
  • 12
  • 23
3
  1. The Settings App can discover nearly all kinds of bluetooth devices,but the system only notify your app for BLE devices.
    Reboot your Scanner , and make sure your iPhone and Scanner are not connected with any devices.Enable your Scanner's discoverabilty.
    If Settings App can find the Scanner while your demo are not,the Scanner is not a BLE device, and is not supported by iOS since iPhone 4s.

  2. If the Scanner is a BLE device,there are some extra work to do to figure out if they are connected.

    • You can check the state of the discovered CBPeripheral in func centralManager(_ central: CBCentralManager, didDiscoverPeripheral peripheral: CBPeripheral, advertisementData advertisementData: [String : AnyObject], RSSI RSSI: NSNumber) .

    • Store CBPeripheral's identifier,before you connect to it.Use this identifier in func retrievePeripheralsWithIdentifiers(_ identifiers: [NSUUID]) -> [CBPeripheral].And check if your Scanner is in the return Array.

If you don't store the identifier,there is no way that you can access an connected BLE Device.

wj2061
  • 6,778
  • 3
  • 36
  • 62
0

As mentioned in the comments, Core Bluetooth is for Bluetooth low energy, while the bar code scanner is Bluetooth 2.1 (classic). For this to work you have to use IOBluetooth at the very least.

Check the IOBluetooth framework. The bad news is that Apple is quite restrictive on Bluetooth classic development, but hopefully there is something you can do. I didn't see any equivalent to the Core Bluetooth on first glance.

Eirik M
  • 726
  • 1
  • 6
  • 12