diff --git a/PlaneGcsSdk.Contract_Shared/Copters/ICopterStatus.cs b/PlaneGcsSdk.Contract_Shared/Copters/ICopterStatus.cs index e7a9a77..00292be 100644 --- a/PlaneGcsSdk.Contract_Shared/Copters/ICopterStatus.cs +++ b/PlaneGcsSdk.Contract_Shared/Copters/ICopterStatus.cs @@ -172,5 +172,15 @@ namespace Plane.Copters /// 获取当前电池电压,单位为伏特。 /// float Voltage { get; } + + //定位类型RTK,GPS + CopterLocationType LocationType { get; } + + + /// + /// MissionStatus=1表示正在飞向目标中,0标识达到目标 + /// + int MissionStatus { get; set; } + } } diff --git a/PlaneGcsSdk.Contract_Shared/PlaneGcsSdk.Contract_Shared.projitems b/PlaneGcsSdk.Contract_Shared/PlaneGcsSdk.Contract_Shared.projitems index 90ba7c6..7a3f02e 100644 --- a/PlaneGcsSdk.Contract_Shared/PlaneGcsSdk.Contract_Shared.projitems +++ b/PlaneGcsSdk.Contract_Shared/PlaneGcsSdk.Contract_Shared.projitems @@ -20,6 +20,7 @@ + diff --git a/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs b/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs index d822912..dd18bf6 100644 --- a/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs +++ b/PlaneGcsSdk_Shared/Copters/CopterImplSharedPart.cs @@ -155,8 +155,12 @@ namespace Plane.Copters private float _Voltage; + private CopterLocationType _LocationType= CopterLocationType.GPS; + private float _Yaw; + private int _MissionStatus; + #endregion Backing Fields public CopterImplSharedPart(SynchronizationContext uiSyncContext) : base(uiSyncContext) @@ -613,12 +617,27 @@ namespace Plane.Copters protected set { Set(nameof(Voltage), ref _Voltage, value); } } + + public CopterLocationType LocationType + { + get { return _LocationType; } + protected set { Set(nameof(LocationType), ref _LocationType, value); } + } + public float Yaw { get { return _Yaw; } protected set { Set(nameof(Yaw), ref _Yaw, value); } } + public int MissionStatus + { + get { return _MissionStatus; } + set { Set(nameof(MissionStatus), ref _MissionStatus, value); } + } + + + #if PRIVATE public #else diff --git a/PlaneGcsSdk_Shared/Copters/EmptyCopter.cs b/PlaneGcsSdk_Shared/Copters/EmptyCopter.cs index 1f7c642..5ac9007 100644 --- a/PlaneGcsSdk_Shared/Copters/EmptyCopter.cs +++ b/PlaneGcsSdk_Shared/Copters/EmptyCopter.cs @@ -84,6 +84,11 @@ namespace Plane.Copters return TaskUtils.CompletedTask; } + public Task InitAsync() + { + return TaskUtils.CompletedTask; + } + public Task StopPairingAsync() { return TaskUtils.CompletedTask; diff --git a/PlaneGcsSdk_Shared/Copters/FakeCopter.cs b/PlaneGcsSdk_Shared/Copters/FakeCopter.cs index d693bbd..6771e4b 100644 --- a/PlaneGcsSdk_Shared/Copters/FakeCopter.cs +++ b/PlaneGcsSdk_Shared/Copters/FakeCopter.cs @@ -343,6 +343,12 @@ namespace Plane.Copters return TaskUtils.CompletedTask; } + + public Task InitAsync() + { + return TaskUtils.CompletedTask; + } + public Task StopPairingAsync() { return TaskUtils.CompletedTask; diff --git a/PlaneGcsSdk_Shared/Copters/PLCopter.cs b/PlaneGcsSdk_Shared/Copters/PLCopter.cs index 2794b65..f675581 100644 --- a/PlaneGcsSdk_Shared/Copters/PLCopter.cs +++ b/PlaneGcsSdk_Shared/Copters/PLCopter.cs @@ -54,6 +54,8 @@ namespace Plane.Copters await _internalCopter.ConnectAsync().ConfigureAwait(false); IsConnected = _internalCopter.IsConnected; IsCheckingConnection = true; + //连接完成后做一些初始化的工作 + await InitAsync(); } public virtual async Task DisconnectAsync() @@ -248,6 +250,17 @@ namespace Plane.Copters await _internalCopter.GeneratePacketAsync(MAVLink.MAVLINK_MSG_ID_SET_PAIR, packet).ConfigureAwait(false); } + public async Task InitAsync() + { + float Gpstype= await _internalCopter.GetParamAsync("GPS_TYPE") ; + if (Gpstype == 15) + LocationType = CopterLocationType.RTK; + else + LocationType = CopterLocationType.GPS; + } + + + public async Task StopPairingAsync() { if (!IsPairing) return;