     */
     func changeTorch()
     {
-        do
-        {
-            try input?.device.lockForConfiguration()
-            
-            var torch = false
-            
-            if input?.device.torchMode == AVCaptureTorchMode.On
-            {
-                torch = false
-            }
-            else if input?.device.torchMode == AVCaptureTorchMode.Off
-            {
-                torch = true
-            }
-            
-            input?.device.torchMode = torch ? AVCaptureTorchMode.On : AVCaptureTorchMode.Off
-            
-            input?.device.unlockForConfiguration()
-        }
-        catch let error as NSError {
-            print("device.lockForConfiguration(): \(error)")
-            
+        if isGetFlash()
+        {
+            do
+            {
+                try input?.device.lockForConfiguration()
+                
+                var torch = false
+                
+                if input?.device.torchMode == AVCaptureTorchMode.On
+                {
+                    torch = false
+                }
+                else if input?.device.torchMode == AVCaptureTorchMode.Off
+                {
+                    torch = true
+                }
+                
+                input?.device.torchMode = torch ? AVCaptureTorchMode.On : AVCaptureTorchMode.Off
+                
+                input?.device.unlockForConfiguration()
+            }
+            catch let error as NSError {
+                print("device.lockForConfiguration(): \(error)")
+                
+            }
         }
     }
     

     */
    func setTorch(torch:Bool)
    {
        do
        {
            try input?.device.lockForConfiguration()
            
            input?.device.torchMode = torch ? AVCaptureTorchMode.On : AVCaptureTorchMode.Off            
            
            input?.device.unlockForConfiguration()
        }
        catch let error as NSError {
            print("device.lockForConfiguration(): \(error)")
            
        }
    }
    
    


class LBXScanWrapper: NSObject,AVCaptureMetadataOutputObjectsDelegate {
    
    let device:AVCaptureDevice? = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo);
    
    var input:AVCaptureDeviceInput?
    var output:AVCaptureMetadataOutput
