             connectionStatus.text = "Disconnected"
             connectionStatus.textColor = UIColor.red
         }
-    }
+        
+    }
+    
     
     enum SKSState {
         case sksIdle

    fileprivate var paused = false
    
    func cancelMissionSaid() {
        //stop executing or paused mission
        if missionState == DJIWaypointMissionState.executing || missionState == DJIWaypointMissionState.executionPaused
        {
            missionManager?.stopMission(completion: { (error) in
                if error != nil {
                    self.showAlertResult(info: "Stop mission error: " + (error?.localizedDescription)!)
                }
                else {
                    self.showAlertResult(info: "Stop mission successful!" )
                }
            })
        }
        else {
            self.showAlertResult(info: "Mission is not in executing or paused state !" )
        }
        //DJISDKManager.missionControl()?.stopTimeline()
    }
    func pauseMissionSaid(){

        if missionState == DJIWaypointMissionState.executing {
            missionManager?.pauseMission(completion: { (error) in
                if error != nil {
                    self.showAlertResult(info: "Pause mission error: " + (error?.localizedDescription)!)
                }
                else {
                    self.showAlertResult(info: "Pause mission successful!" )
                }
            })
        }
        else {
            self.showAlertResult(info: "Mission is not in executing state!")
        }
        
        //DJISDKManager.missionControl()?.stopTimeline()
    }
    func resumeMissionSaid(){
        
        //you can only call when current state is paused
        if missionState == DJIWaypointMissionState.executionPaused {
            missionManager?.resumeMission(completion: { (error) in
                if error != nil {
                    self.showAlertResult(info: "Resume mission error: " + (error?.localizedDescription)!)
                }
                else {
                    self.showAlertResult(info: "Resume mission successful")
                }
            })
        }
        else {
             self.showAlertResult(info: "Mission is not in pause state")
        }
    
        //DJISDKManager.missionControl()?.resumeTimeline()
    }
    func executeMission(){
        if missionState == DJIWaypointMissionState.readyToExecute {
            missionState = DJIWaypointMissionState.executing
            missionManager?.startMission(completion: { (error) in
                if error != nil {
                    self.showAlertResult(info: "Execute mission error: " + (error?.localizedDescription)!)
                }
                else {
                    self.showAlertResult(info: "Execute mission successful")
                }
            })
        }

    }
    func convertMetersToPoint(m: Double) -> Double{
        var lonO:Double = 0.0

                enableVirtualStickModeSaid()
            }
            //say "disable" to disable virtual stick mode
            if str == "disable" {
                disableVirtualStickModeSaid()
            }
            //say "execute" to executeMission
            if str == "execute" {
                executeMission()
            }
            
            // say "cancel" to cancel mission
            if str == "cancel" {
                cancelMissionSaid()
                VSMText.text = "Mission cancelled"
            }
            // say "stop" to stop mission
            if str == "stop" {
                pauseMissionSaid()
                VSMText.text = "Mission paused"
            }
            // say "resume" to resume mission
            if str == "resume" {
                resumeMissionSaid()
                VSMText.text = "Mission resume"
            }
            
            
            
        }
    }
