     }
 }
 
+
 // MARK: - PERIPHERAL MANAGER DELEGATE METHODS
 
 extension Clink: CBPeripheralManagerDelegate {

        
        guard RSSI.intValue > self.minRSSI else { return }
        
        let peer = ClinkPeer(peripheral: peripheral)
        let peerManager = self.peerManager ?? self
        
        peerManager.save(peer: peer)
        
        self.connectedPeers.append(peer)
        self.connect(peerWithId: peripheral.identifier)
        self.delegate?.clink(self, didDiscoverPeer: peer)
        
        NotificationCenter.default.post(name: Clink.Notifications.didDiscoverPeer, object: peer, userInfo: peer.data)
        
        central.connect(peripheral, options: nil)
    }
    
    public final func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
        if self.logLevel == .verbose { print("calling \(#function)") }
        
        q.async {
            if let i = self.connectedPeers.index(where: { $0.id == peripheral.identifier }) { self.connectedPeers.remove(at: i) }
            
            let peer = ClinkPeer(id: peripheral.identifier)
            let peerManager = self.peerManager ?? self
            
            peripheral.delegate = self
            peer.peripheral = peripheral
            peerManager.save(peer: peer)
            

            
            NotificationCenter.default.post(name: Clink.Notifications.didDiscoverPeer, object: peer, userInfo: peer.data)
            
            if newlyDiscoveredPeripheral?.identifier == peripheral.identifier {
                self.centralManager.stopScan()
                newlyDiscoveredPeripheral = nil
            }
            
            
        case timeOfLastUpdateCharacteristic.uuid:
            guard
                let service = peripheral.services?.filter({ $0.uuid == self.serviceId }).first,
