Beacon Scanner lib wont compile on new P2

Been using the beacon scanner lib with Tracker, argon, boron, BSoM and TSoM.

Wont compile with a P2.
Error code points to the Laird BT510 .cpp file

BLE_ GAP_ SEC_ STATUS_ SUCCESS & BLE_ GAP_ SEC_ STATUS_ CONFIRM_VALUE. " was not declared in this scope"

1 Like

Yes, this is a problem with the 1.3.0 version of BleScanner because the P2/Photon 2 don't support LESC pairing in BLE.

The easiest solution is to build in Particle Workbench and make the following changes:

  • In lairdbt510.cpp, add a #if around the code that will fail. Note that Laird sensors won't work, but the code will compile and other beacons will work:
        case BlePairingEventType::STATUS_UPDATED:
        {
            switch (event.payload.status.status)
            {
#if !HAL_PLATFORM_RTL872X
            case BLE_GAP_SEC_STATUS_SUCCESS:
                dev->state_ = SENDING;
                Log.trace("Pairing complete for: %s", dev->getAddress().toString().c_str());
                break;
            case BLE_GAP_SEC_STATUS_CONFIRM_VALUE:
                dev->state_ = DISCONNECT;
                Log.error("Passkey is incorrect");
                if (dev->state_ != CLEANUP) {
                    auto p = Promise<bool>::fromDataPtr(dev->handler_data_);
                    p.setError(Error::INVALID_ARGUMENT);
                    dev->state_ = CLEANUP;
                }
                break;
#endif
            default:
                if (dev->state_ != CLEANUP) {

With Device OS 5.x you'll also get some warnings, but these can be ignored for now.

Also in project.properties in your project, modify it so it looks more like:

name=BeaconScanTest1
orig_dependencies.BeaconScanner=1.3.0

Note the orig_ prefix because otherwise the official version of BeaconScanner 1.3.0 will be used with cloud compiles instead of your modified version, and it won't compile.

1 Like

Thanks rickkas,
But I am using it specifically for LairdBT510/BT610's

It won't be possible to use the BT510 with the P2 or Photon 2 because the Realtek RTL872x MCU doesn't support coded PHY or LESC secure pairing.

I dont actually pair too any of the Laird sensors , just look at advertisements so thats not big deal. The coded PHY is a beast in the field for range and wall penitration. Thats a dissapointment.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.