0

If I want to do "NFC based transactions" but in the iBeacon way, when 2 iOS devices are in the "immediate" range, how can I connect both device automatically without pairing/authentication, so that I can do the transaction communication?

The scenario:

  1. User's iPhone detects iBeacon signal, prompt user to open the app
  2. User opens the app, and wants to purchase a physical item
  3. User grab his device to the retailer's iOS-based POS device
  4. Both iOS devices detect each other are in the "Immediate" range and start the connection/pairing without manual authentication
  5. Transaction communication starts here

From my understanding, scanForPeripheralsWithServices cannot return enough information for the above scenario to happen, does anyone know the correct way to implement such service?

Thank you

2 Answers 2

0

The scenario you describe can be carried out with very basic connections exactly the way you listed it, no BLE level pairing, authentication is required at all. More precisely:

  1. The presence of iBeacon triggers the app to notify the user of an opportunity to buy something.
  2. The client's iOS device scans for peripherals and the retailer's POS advertises itseld. The distance between the two is estimated using the RSSI value from the advertisement packages. The next step is activated if this value gets high enough (practically, higher than a given threshold, like -30 or so. You can select whatever fits your needs)
  3. The client uses connectPeripheral: to connect to the POS. This alone will not trigger authentication or pairing.
  4. You implement the the transaction by using secure encryption and authentication and whatever needed. This is completely proprietary to your solution and you need to create it or get some existing one to work. (I don't know about existing implementations, though.)

To see an example, the of the RSSI based distance estimation, the BTLE example is a good starting point. Here is the corresponding excerpt from BTLECentralViewController.m

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
{
    // Reject any where the value is above reasonable range
    if (RSSI.integerValue > -15) {
        return;
    }

To implement the transaction, you need to understand the basics of Core Bluetooth: the services, characteristics, BLE transactions (read, write, notifications...)

0

Pairing and authentication are never required for detecting and ranging for iBeacons when using iOS CoreLocation APIs. iBeacons are connectionless and transmit only. You can tell that two devices are in immediate range from one another by making both transmit as iBeacons, and then using the CoreLocation ranging APIs to detect the proximity:

  - (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)iBeacons inRegion:(CLBeaconRegion *)region {

      for (CLBeacon *iBeacon in iBeacons) {
          if (iBeacon.proximity == CLProximityImmediate) {
               // Add code to process transaction here
          }
      }

If you want to exchanges secure data wirelessly between the two devices after you have verified they are in immediate proximity, you can do so with Bluetooth as @allprog suggests in his answer. You can also do this through web services, which allow you to have an iBeacon-only solution without having to drop down to using CoreBluetooth APIs. See this answer for more details on how that might work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.