     fileprivate var paused = false
     
     func cancelMissionSaid() {
-        //need to define DJIWaypointMissionOperator
-        //var oper: DJIWaypointMissionOperator
-        
-        
-        print("Mission Cancelled !")
-        DJISDKManager.missionControl()?.stopTimeline()
+        //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(){
-        print("Mission paused !")
-        DJISDKManager.missionControl()?.stopTimeline()
-        // DJISDKManager.missionControl()?.pauseTimeline()
-        
+
+        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(){
-        print("Mission resume !")
-        DJISDKManager.missionControl()?.resumeTimeline()
+        
+        //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(){
-        print("Mission executed !")
-        if self.paused {
-            DJISDKManager.missionControl()?.resumeTimeline()
-        } else if self.started {
-            DJISDKManager.missionControl()?.pauseTimeline()
-        } else {
-            DJISDKManager.missionControl()?.startTimeline()
-        }
+        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

        
    }
    func checkProductConnected() {

        //Display conneciton status
        if ConnectedProductManager.sharedInstance.product != nil {
            connectionStatus.text = "Connected"

            if strArr[0] == "take" && strArr[1] == "off" {
                takeOff(fc)
            }
            else if (strArr[0] == "power" && strArr[1] == "on") || strArr[0] == "on" {
                self.showAlertResult(info: "Power on function is not existed. Please say your next command !")
                // startPropellers(fc)
