             dispatch_sync(dispatch_get_main_queue(), {
                 if(result == "284429"){
                     //取消执行
-                   self.nTimer?.invalidate()
+                    self.nTimer?.invalidate()
                     self.nTimer = nil
                 }
                 

    func delay0x41Method() -> Void {
        
    }
    
    
    
    /**
     收/发机制

        }
    }
    
    //MARK: - 执行命令
    
    func executeCommandQ() -> Void {
        self.isECK = false
        self.isEnd = false
        self.xueTangYiType = ""
        
        //取消执行
        self.nTimer?.invalidate()
        self.nTimer = nil
        
        self.GlucoseType = ""
        self.reture0X40Value = self.analyzingRecorderStrLK as String
        //第一次收到值为true
        self.isRecive = true
        //分析0x40的数据
        self.analyzing0x40Data()
        
        if(self.GlucoseType != "000"){
            //1为读到类型，0为未读到类型
            self.isRead = true
            self.isRecive = false
            self.isIdentification = 0
            self.showTipMsg.appendString("已检测到血糖仪...\n")
            
            self.progressView.progress = 0.1
            //发请求
            self.vioceDataInteraction()
        }else{
            self.isRecive = false
            self.showTipMsg.appendString("未识别血糖仪，请手动选择...\n")
            self.isIdentification = 1
            self.isECK=false;
            self.isEnd=false;
            
            //跳转到选择血糖仪的页面
        }
    }
    
    func executeCommandP() -> Void
    {
        self.isRecive = false
        //取消执行
        self.nTimer?.invalidate()
        self.nTimer=nil
        self.showTipMsg.appendString("手机和盒子正在通讯..\n")
        self.progressView.progress = 0.20
        
        self.conut = 0
        //发请求
        self.nTimer = NSTimer(timeInterval: 1.5, target: self, selector: #selector(self.delay0x41Method), userInfo: nil, repeats: true)
        NSRunLoop.mainRunLoop().addTimer(self.nTimer!, forMode: NSDefaultRunLoopMode)
        
        self.nTimer?.fire()
    }
    
    func executeCommandA() -> Void {
        self.isRecive = false;
        
        nTimer?.invalidate()
        nTimer = nil
       
        reture0X41Value = ""
        reture0X41Value = analyzingRecorderStrLK
        
        showTipMsg.appendString("盒子正在读取血糖仪数据中...\n")
        progressView.progress = 0.30;//
        //分析0x41的数据
        analyzing0x41Data()
    }
    
    func executeCommandE() -> Void {
        if (self.isECK==true) {
            return;
        }
        isECK=true;
        
        isRecive=false;
        
        retureECK=analyzingRecorderStrLK;
        
        showTipMsg.appendString("数据上传中...\n")
        
        progressView.progress = 0.40;//
        
        analyzingECK()
        conut=0;
       
        self.nTimer = NSTimer(timeInterval: 1.7, target: self, selector: #selector(self.delay0x42Method), userInfo: nil, repeats: true)
        NSRunLoop.mainRunLoop().addTimer(self.nTimer!, forMode: NSDefaultRunLoopMode)
        
        self.nTimer?.fire()
    }
    
    func executeCommandB() -> Void {
        //第一次发送收到值为1，未收到为0
        isRecive=false;
        //取消执行
        nTimer?.invalidate()
        nTimer = nil
        //获取解析后得到的字符串 （命令执行符号）
        reture0X42Value=analyzingRecorderStrLK;
        showTipMsg.appendString("读取数据中........\n")
        progressView.progress = 0.50;//
        //分析0x42的数据
        analyzing0x42Data()
        
        if(statuOfGlucoseMeterLK == "0" || statuOfGlucoseMeterLK==nil || statuOfGlucoseMeterLK == ""){
            //设置为自动获取血糖仪类型
            isIdentification = 0
            
            showAlert("抱歉", msg: "未识别血糖仪，手动选择后重试...")
            return
        }else
        {
            isRecive=false;
            conut=0;
            bagN=1;
            
            self.nTimer = NSTimer(timeInterval: 2.8, target: self, selector: #selector(self.delay0x43Method), userInfo: nil, repeats: true)
            NSRunLoop.mainRunLoop().addTimer(self.nTimer!, forMode: NSDefaultRunLoopMode)
            
            self.nTimer?.fire()
        }

    }
    /**
     盒子关机
     */
    func executeCommand284429() -> Void {
        
        nTimer?.invalidate()
        nTimer = nil
       
        
        if (isEnd==true) {
            return;
        }
        isEnd=true;
    
        showTipMsg.appendString("盒子已关机\n")
        nTimer?.invalidate()
        nTimer = nil
    }
    
    /**
     命令操作符  #代表结束
     
     - parameter designator: 命令操作符
     */
    func executeCommandC(designator:String) -> Void {
        isRecive=false;
        
        //取消执行
        nTimer?.invalidate()
        nTimer = nil
        reture0X43Value="";//
        let bagNumS = analyzingRecorderStrLK.substringWithRange(NSMakeRange(1, 2))
        //0x43返回来的值
        reture0X43Value=analyzingRecorderStrLK;
        if ((reture0X43Value as! String).isEmpty == true) {
            
            var bagNumber = Int(bagNumS)
            
            if(bagNumber != bagN)
            {
                nTimer?.invalidate()
                nTimer = nil
                
                isRecive=false;
                conut=0;
                
                self.nTimer = NSTimer(timeInterval: 2.5, target: self, selector: #selector(self.delay0x43Method), userInfo: nil, repeats: true)
                NSRunLoop.mainRunLoop().addTimer(self.nTimer!, forMode: NSDefaultRunLoopMode)
                
                self.nTimer?.fire()
                
            }else{
                
                var floatBage = Float(bagNumS)! / 10
                if (floatBage>=0.5) {
                    floatBage=0.4+floatBage/10;
                }
                
                progressView.progress = 0.50 + CGFloat(floatBage);
                
                //影响C02以后的时间 分析解析数据
                analyzing0x43Data()
                
                if (designator == "#") {
                    // 是＃结束
                    
                    if (DateMuArr.count != 0) {
                        nTimer?.invalidate()
                        nTimer = nil
                        
                        sendEnd()
                        self.performSelector(#selector(sendEnd), withObject: self, afterDelay: 1.5)
                        
                        progressView.progress = 1.0;
                        
                        self.performSelector(#selector(LoopPush), withObject: self, afterDelay: 3)
                        nTimer?.invalidate()
                        nTimer = nil;//取消执行
                        return;
                    }
                } else {
                    bagN += 1
                    isRecive=false;
                    conut=0;
                    
                    delay0x43Method()
                    self.performSelector(#selector(sendaa), withObject: nil, afterDelay: 1 )
                }
            }
        }
    }
    
    
    
    func showAlert(title:String,msg:String) -> Void {
        let alert = UIAlertController(title: title, message: msg, preferredStyle: .Alert)
