             
             self.delay(2.0) {
                 self.updateOpenButtonStartScan()
-                self.statusLabel.text = "Scan Finished"
+                self.statusLabel.text = "Not Connected"
             }
         })
     }

                        forCharacteristic: rx,
                        type: CBCharacteristicWriteType.WithoutResponse
                    )
                } else {
                    println("Did not find valid password, so not writing anything")
                }
            }
        }
    }
    
    func getActivePeripheral() -> CBPeripheral? {
        if self.discovery == nil {
            println("  Could not find discovery object.")
            return nil
        }
        
        let peripheral = self.discovery!.activePeripheral
        if peripheral == nil {
            println("  Did not get active peripheral.")
            return nil
        }
        
        if peripheral?.state != CBPeripheralState.Connected {
            println("  Peripheral apparently is not connected.")
            return nil
        }

        return peripheral
    }
    
    func getRXCharacteristic() -> CBCharacteristic? {
        let peripheral = self.getActivePeripheral()
        if peripheral == nil { return nil }
        
        let service = self.discovery?.activeService
        if service == nil {
            println("  Did not get active service.")
            return nil
        }
        
        let rx = service?.rxCharacteristic
        if (rx == nil) {
            println("  Did not get rx characteristic")
            return nil
        }
        
        return rx
    }
    
    

        
        nc.addObserver(
            self,
            selector: "handleLightLevelUpdate:",
            name: "GOCaptureCalculatedLightLevelNotification",
            object: nil
