  */
 
 import UIKit
-
-
-
+import AVFoundation
 class XDLQRToolBarController: UIViewController {
 
     var flag = 0

/****************************************************************/
            }
        }
    }
    private func startAnimation(type: XDLQRToolBarButtonType){
    

        
    }
    
    private func startScanCode(){
        
        
        let videoCaptureDevice = AVCaptureDevice.defaultDevice(withMediaType: AVMediaTypeVideo)

        // 创建 input object.
        //let videoInput: AVCaptureDeviceInput?
        do {
           let videoInput = try! AVCaptureDeviceInput(device: videoCaptureDevice)
            
            //1. input
            if  session.canAddInput(videoInput) == false{
                return
            }
            //2. output
            if session.canAddOutput(deviceOutput) == false{
                return
            }
            //3. add input and output into sesstion
            session.addInput(videoInput)
            session.addOutput(deviceOutput)
            //4. setting output to deal with data
            deviceOutput.metadataObjectTypes = deviceOutput.availableMetadataObjectTypes
            //5. monitor data from the output
            deviceOutput.setMetadataObjectsDelegate(self, queue: DispatchQueue.main)
            //6. add preScanView
            view.layer.insertSublayer(preViewScan, at: 0)
            //6. startScan
            session.startRunning()
        } catch {
            
            return
        }
        
    }
    //
    
    /* optional public func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [Any]!, from connection: AVCaptureConnection!)*/
    
    override func viewWillAppear(_ animated: Bool) {
        print("qrLineCodeView appear")
        
