     
     fileprivate var serviceId = CBUUID(string: "7D912F17-0583-4A1A-A499-205FF6835514")
     fileprivate var remotePeripheral: CBPeripheral? = nil
+    fileprivate var isPairing = false
     fileprivate var pairingStatusCharacteristic = CBMutableCharacteristic(
         type: CBUUID(string: "ECC2D7D1-FB7C-4AF2-B068-0525AEFD7F53"),
         properties: .notify,

        advertisementData: [String : Any],
        rssi RSSI: NSNumber)
    {
        if remotePeripheral == nil {
            remotePeripheral = peripheral
            status = .discoveredRemotePeer
            
            peripheral.delegate = self
            peripheral.readRSSI()
        }
    }
    


extension PairingService: CBCentralManagerDelegate {
    public func centralManagerDidUpdateState(_ central: CBCentralManager) {
        if centralManager.isScanning == false, isPairing, centralManager.state == .poweredOn {
            startPairing()
        }
    }
    
