     var stopScanBarButtonItem: UIBarButtonItem!
     var startScanBarButtonItem: UIBarButtonItem!
 
+    var scanStatus = false
     var rssiPollingFutures = [NSUUID: (future: FutureStream<Int>, cellUpdate: Bool)]()
     var peripheralConnectionStatus = [NSUUID: PeripheralConnectionStatus]()
 

    }
    
    func setScanButton() {
        if Singletons.centralManager.isScanning || Singletons.timedScannerator.isScanning {
            self.navigationItem.setLeftBarButtonItem(self.stopScanBarButtonItem, animated:false)
        } else {
            self.navigationItem.setLeftBarButtonItem(self.startScanBarButtonItem, animated:false)

                peripheral.stopPollingRSSI()
                self.rssiPollingFutures.removeValueForKey(peripheral.identifier)
                self.peripheralConnectionStatus.removeValueForKey(peripheral.identifier)
                peripheral.terminate()
                self.startScan()
                self.updateWhenActive()
            }
        }
