Esempio n. 1
0
        public async static Task SetAircraftLimitation()
        {
            try
            {
                var res = await DJISDKManager.Instance.ComponentManager.GetFlightControllerHandler(0, 0).SetDistanceLimitEnabledAsync(new BoolMsg()
                {
                    value = true
                });

                IsResultReceivedEvent("SetDistanceLimitEnabled =true Result: " + res.ToString());
                var res1 = await DJISDKManager.Instance.ComponentManager.GetFlightControllerHandler(0, 0).SetDistanceLimitAsync(new IntMsg()
                {
                    value = 15
                });

                IsResultReceivedEvent("SetDistanceLimit = 15 Result " + res1.ToString());
                var res2 = await DJISDKManager.Instance.ComponentManager.GetFlightControllerHandler(0, 0).SetHeightLimitAsync(new IntMsg()
                {
                    value = 20
                });

                IsResultReceivedEvent("SetHeightLimit = 20 Result: " + res2.ToString());
            }
            catch (Exception ex)
            {
                UIOperations.ShowContentDialog("SetAirCraftLimitation Error", ex.ToString());
            }
        }
Esempio n. 2
0
        public static async Task CreateApplicationDataFolder()
        {
            try
            {
                StorageFolder outputLocation = await StorageFolder.GetFolderFromPathAsync(APPConfig.instance.getConfigProperties("Drive"));

                StorageFolder storageFolder = await outputLocation.CreateFolderAsync(APPConfig.instance.getConfigProperties("ExtractedFramesFolder"), CreationCollisionOption.OpenIfExists);
            }
            catch (Exception ex)
            {
                UIOperations.ShowContentDialog("Create Folder Error", "Please go to Settings > Privacy > File system and the enable file access right of DTP." + Environment.NewLine + ex.ToString());
            }
        }
Esempio n. 3
0
        public async static void StartAutoTakeoff()
        {
            try
            {
                var res = await DJISDKManager.Instance.ComponentManager.GetFlightControllerHandler(0, 0).StartTakeoffAsync();

                IsResultReceivedEvent(String.Format("Start send takeoff command: {0}", res.ToString()));
            }
            catch (Exception ex)
            {
                UIOperations.ShowContentDialog("StartAutoTakeoff Error", ex.ToString());
            }
        }
Esempio n. 4
0
        public async static Task SetAircraftFailSafeAction()
        {
            try
            {
                FCFailsafeActionMsg fCFailsafeActionMsg;
                fCFailsafeActionMsg.value = FCFailsafeAction.LANDING;
                var res = await DJISDKManager.Instance.ComponentManager.GetFlightControllerHandler(0, 0).SetFailsafeActionAsync(fCFailsafeActionMsg);

                IsResultReceivedEvent("SetFailsafeAction = Landing Result: " + res.ToString());
            }
            catch (Exception ex)
            {
                UIOperations.ShowContentDialog("SetAircraftFailSafeAction Error", ex.ToString());
            }
        }
Esempio n. 5
0
        public async static Task EnableUpwardsAvoidance()
        {
            try
            {
                var res = await DJISDKManager.Instance.ComponentManager.GetFlightAssistantHandler(0, 0).SetUpwardsAvoidanceEnableAsync(new BoolMsg()
                {
                    value = true
                });

                IsResultReceivedEvent("EnableUpwardsAvoidance Result: " + res.ToString());
            }
            catch (Exception ex)
            {
                UIOperations.ShowContentDialog("EnableUpwardsAvoidance Error", ex.ToString());
            }
        }
Esempio n. 6
0
        public async static Task EnableLandingProtection()
        {
            try
            {
                var res = await DJISDKManager.Instance.ComponentManager.GetFlightAssistantHandler(0, 0).SetLandingProtectionEnabledAsync(new BoolMsg()
                {
                    value = false
                });

                IsResultReceivedEvent("EnableLandingProtection = false Result: " + res.ToString());
            }
            catch (Exception ex)
            {
                UIOperations.ShowContentDialog("EnableLandingProtection Error", ex.ToString());
            }
        }
Esempio n. 7
0
        public static async Task HousekeepExtractedFramesFolder()
        {
            try
            {
                string        ExtractedFrameFolderPath = APPConfig.instance.getConfigProperties("ExtractedFramesFolder");
                String        outputDrivePath          = APPConfig.instance.getConfigProperties("Drive");
                StorageFolder outputDrive = await StorageFolder.GetFolderFromPathAsync(outputDrivePath);

                if (await outputDrive.TryGetItemAsync(ExtractedFrameFolderPath) != null)
                {
                    IStorageItem ExtractedFramesFolder = await outputDrive.GetItemAsync(ExtractedFrameFolderPath);

                    await ExtractedFramesFolder.DeleteAsync(StorageDeleteOption.PermanentDelete);
                }
            }
            catch (Exception ex)
            {
                UIOperations.ShowContentDialog("Housekeep Folder Error", "Please go to Settings > Privacy > File system and enable the file access right of DTP." + Environment.NewLine + ex.ToString());
            }
        }
Esempio n. 8
0
 async public void isAirCraftConnected()
 {
     try
     {
         var productType = (await DJISDKManager.Instance.ComponentManager.GetProductHandler(0).GetProductTypeAsync()).value;
         if (productType != null && productType?.value != ProductType.UNRECOGNIZED)
         {
             //System.Diagnostics.Debug.WriteLine("The Aircraft is connected now.");
             isConnectionChangedEvent(true);
         }
         else
         {
             isConnectionChangedEvent(false);
         }
     }
     catch (Exception ex)
     {
         UIOperations.ShowContentDialog("isAirCraftConnected Error", ex.ToString());
     }
 }
Esempio n. 9
0
        public async static void StartAutoLanding()
        {
            try
            {
                var res = await DJISDKManager.Instance.ComponentManager.GetFlightControllerHandler(0, 0).StartAutoLandingAsync();

                IsResultReceivedEvent(String.Format("Start send landing command: {0}", res.ToString()));
                //var res1 = await DJISDKManager.Instance.ComponentManager.GetFlightControllerHandler(0, 0).GetIsLandingConfirmationNeededAsync();
                //isResultReceivedEvent(String.Format("Is Confirm landing Required: {0}", res1.value.Value.value.ToString()));

                //if (res1.value.Value.value)
                //{
                //    var res2 = await DJISDKManager.Instance.ComponentManager.GetFlightControllerHandler(0, 0).ConfirmLandingAsync();
                //    isResultReceivedEvent("Confirm Landing Result: " + res2.ToString());
                //}
            }
            catch (Exception ex)
            {
                UIOperations.ShowContentDialog("StartAutoLanding Error", ex.ToString());
            }
        }