1. 任务库curd修改

2. cloud api 部分代码
feature-flyModify
陈伟 2025-06-11 16:53:41 +08:00
parent ddb10c0b04
commit f8c4098593
6 changed files with 138 additions and 8 deletions

View File

@ -26,5 +26,6 @@ namespace OpenAuth.Repository.Domain
public string AircraftYawAngleMode { get; set; } // 飞行器偏航角模式
public DateTime? CreateTime { get; set; } // 创建时间
public long CreateId { get; set; } // 创建人
public string WPML { get; set; } // WPML 航线文件地址
}
}

View File

@ -57,16 +57,21 @@ namespace OpenAuth.Repository.Domain
/// AI巡检
/// </summary>
public string AIInspection { get; set; }
/// <summary>
/// 状态
/// </summary>
public int Status { get; set; }
public int Status { get; set; }
/// <summary>
/// 周期公式
/// </summary>
public string PeriodicFormula { get; set; }
/// <summary>
/// 航线id
/// </summary>
public string AirLineId { get; set; }
public long CreateId { get; set; }
public DateTime? CreateTime { get; set; }

View File

@ -7,16 +7,20 @@ public class GatewayManager
public GatewayType GatewayType { get; set; }
/// <summary>
/// 机场任务准备异常通知
/// 机场任务准备异常通知 flight_setup_exception_notify
/// </summary>
public string FlightSetupExceptionNotify =
TopicConst.ThingModelPre + TopicConst.Product + "%s" + TopicConst.EventsSuffix;
/// <summary>
/// 下发任务 down(向设备端发布消息) flighttask_prepare(method) thing/product/{gateway_sn}/services(topic)
/// </summary>
public string FlightTaskPrepare = TopicConst.ThingModelPre + TopicConst.Product + "%s" + TopicConst.ServicesSuffix;
public GatewayManager(string gatewaySn, string droneSn, GatewayType gatewayType)
{
GatewaySn = gatewaySn;
DroneSn = droneSn;
GatewayType = gatewayType;
}
}

View File

@ -0,0 +1,108 @@
namespace OpenAuth.WebApi.CloudSdk.mqtt;
/// <summary>
/// The name of all channels.
/// </summary>
public static class ChannelName
{
// Basic Channels
public const string Inbound = "inbound";
public const string Default = "default";
public const string Outbound = "outbound";
// Status Channels
public const string InboundStatus = "inboundStatus";
public const string OutboundStatus = "outboundStatus";
public const string InboundStatusOnline = "inboundStatusOnline";
public const string InboundStatusOffline = "inboundStatusOffline";
// State Channels
public const string InboundState = "inboundState";
public const string InboundStateRcControlSource = "inboundStateRcControlSource";
public const string InboundStateDockControlSource = "inboundStateDockControlSource";
public const string InboundStateRcLiveCapacity = "inboundStateRcLiveCapacity";
public const string InboundStateDockLiveCapacity = "inboundStateDockLiveCapacity";
public const string InboundStateRcLiveStatus = "inboundStateRcLiveStatus";
public const string InboundStateDockLiveStatus = "inboundStateDockLiveStatus";
public const string InboundStateRcAndDroneFirmwareVersion = "inboundStateRcAndDroneFirmwareVersion";
public const string InboundStateDockFirmwareVersion = "inboundStateDockFirmwareVersion";
public const string InboundStateRcPayloadFirmware = "inboundStateRcPayloadFirmware";
public const string InboundStateDockDroneWpmzVersion = "inboundStateDockDroneWpmzVersion";
public const string InboundStateDockDronePayload = "inboundStateDockDronePayload";
public const string InboundStateDockDroneRthMode = "inboundStateDockDroneRthMode";
public const string InboundStateDockDroneCurrentRthMode = "inboundStateDockDroneCurrentRthMode";
public const string InboundStateDockDroneCommanderModeLostAction = "inboundStateDockDroneCommanderModeLostAction";
public const string InboundStateDockDroneCurrentCommanderFlightMode =
"inboundStateDockDroneCurrentCommanderFlightMode";
public const string InboundStateDockDroneCommanderFlightHeight = "inboundStateDockDroneCommanderFlightHeight";
public const string InboundStateDockDroneModeCodeReason = "inboundStateDockDroneModeCodeReason";
public const string InboundStateDockDroneOfflineMapEnable = "inboundStateDockDroneOfflineMapEnable";
public const string InboundStateDockAndDroneDongleInfos = "inboundStateDockAndDroneDongleInfos";
public const string InboundStateDockSilentMode = "inboundStateDockSilentMode";
public const string OutboundState = "outboundState";
// Services Reply
public const string InboundServicesReply = "inboundServicesReply";
// OSD Channels
public const string InboundOsd = "inboundOsd";
public const string InboundOsdRc = "inboundOsdRc";
public const string InboundOsdDock = "inboundOsdDock";
public const string InboundOsdRcDrone = "inboundOsdRcDrone";
public const string InboundOsdDockDrone = "inboundOsdDockDrone";
// Request Channels
public const string InboundRequests = "inboundRequests";
public const string InboundRequestsStorageConfigGet = "inboundRequestsStorageConfigGet";
public const string InboundRequestsAirportBindStatus = "inboundRequestsAirportBindStatus";
public const string InboundRequestsAirportOrganizationGet = "inboundRequestsAirportOrganizationGet";
public const string InboundRequestsAirportOrganizationBind = "inboundRequestsAirportOrganizationBind";
public const string InboundRequestsConfig = "inboundRequestsConfig";
public const string InboundRequestsFlightTaskResourceGet = "inboundRequestsFlightTaskResourceGet";
public const string InboundRequestsFlightAreasGet = "inboundRequestsFlightAreasGet";
public const string InboundRequestsOfflineMapGet = "inboundRequestsOfflineMapGet";
public const string OutboundRequests = "outboundRequests";
// Event Channels
public const string InboundEvents = "inboundEvents";
public const string OutboundEvents = "outboundEvents";
public const string InboundEventsDeviceExitHomingNotify = "inboundEventsDeviceExitHomingNotify";
public const string InboundEventsFlighttaskProgress = "inboundEventsFlighttaskProgress";
public const string InboundEventsFlighttaskReady = "inboundEventsFlighttaskReady";
public const string InboundEventsFileUploadCallback = "inboundEventsFileUploadCallback";
public const string InboundEventsHms = "inboundEventsHms";
public const string InboundEventsControlProgress = "inboundEventsControlProgress";
public const string InboundEventsOtaProgress = "inboundEventsOtaProgress";
public const string InboundEventsFileUploadProgress = "inboundEventsFileUploadProgress";
public const string InboundEventsFlyToPointProgress = "inboundEventsFlyToPointProgress";
public const string InboundEventsTakeoffToPointProgress = "inboundEventsTakeoffToPointProgress";
public const string InboundEventsDrcStatusNotify = "inboundEventsDrcStatusNotify";
public const string InboundEventsJoystickInvalidNotify = "inboundEventsJoystickInvalidNotify";
public const string InboundEventsHighestPriorityUploadFlightTaskMedia =
"inboundEventsHighestPriorityUploadFlightTaskMedia";
public const string InboundEventsReturnHomeInfo = "inboundEventsReturnHomeInfo";
public const string InboundEventsCustomDataTransmissionFromEsdk = "inboundEventsCustomDataTransmissionFromEsdk";
public const string InboundEventsCustomDataTransmissionFromPsdk = "inboundEventsCustomDataTransmissionFromPsdk";
public const string InboundEventsAirsenseWarning = "inboundEventsAirsenseWarning";
public const string InboundEventsFlightAreasSyncProgress = "inboundEventsFlightAreasSyncProgress";
public const string InboundEventsFlightAreasDroneLocation = "inboundEventsFlightAreasDroneLocation";
public const string InboundEventsOfflineMapSyncProgress = "inboundEventsOfflineMapSyncProgress";
public const string InboundEventsPoiStatusNotify = "inboundEventsPoiStatusNotify";
public const string InboundEventsCameraPhotoTakeProgress = "inboundEventsCameraPhotoTakeProgress";
// Property Set Reply
public const string InboundPropertySetReply = "inboundPropertySetReply";
// DRC UP Channels
public const string InboundDrcUp = "inboundDrcUp";
public const string InboundDrcUpDroneControl = "inboundDrcUpDroneControl";
public const string InboundDrcUpDroneEmergencyStop = "inboundDrcUpDroneEmergencyStop";
public const string InboundDrcUpHeartBeat = "inboundDrcUpHeartBeat";
public const string InboundDrcUpHsiInfoPush = "inboundDrcUpHsiInfoPush";
public const string InboundDrcUpDelayInfoPush = "inboundDrcUpDelayInfoPush";
public const string InboundDrcUpOsdInfoPush = "inboundDrcUpOsdInfoPush";
}

View File

@ -1,4 +1,5 @@
using MQTTnet;
using MQTTnet.Adapter;
using MQTTnet.Client;
using MQTTnet.Protocol;
@ -67,6 +68,7 @@ public class MqttClientManager
/// <param name="message">json</param>
public async Task PublishAsync(string topic, string message)
{
// MqttChannelAdapter
var mqttMsg = new MqttApplicationMessageBuilder()
.WithTopic(topic)
.WithPayload(message)

View File

@ -210,8 +210,8 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
var uploadsFolder = Path.Combine(Directory.GetCurrentDirectory(), "Waylines");
if (!Directory.Exists(uploadsFolder))
Directory.CreateDirectory(uploadsFolder);
var filePath = Path.Combine(uploadsFolder, "waylines.wpml");
var fileName = GenerateId.GenerateOrderNumber() + ".wpml";
var filePath = Path.Combine(uploadsFolder, fileName);
using (var stream = new FileStream(filePath, FileMode.Create))
{
@ -220,7 +220,12 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
return Ok(new { message = "上传成功", path = filePath });
}
/*/// <summary>
/// 更新航线文件
/// </summary>
/// <param name="xmlFile"></param>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("uploadwpmlfile")]
[AllowAnonymous]
public async Task<IActionResult> UploadWpmlFile(IFormFile xmlFile, string id)
@ -232,6 +237,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
if (!Directory.Exists(uploadsFolder))
Directory.CreateDirectory(uploadsFolder);
// todo 这里只有一个文件,是否得改
var filePath = Path.Combine(uploadsFolder, "waylines.wpml");
using (var stream = new FileStream(filePath, FileMode.Create))
@ -240,7 +246,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
}
return Ok(new { message = "上传成功", path = filePath });
}
}*/
#endregion
@ -302,6 +308,10 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
// 航线任务在云端的 共享查看、下发执行、取消以及进度上报等功能。
/// <summary>
/// 执行任务
/// </summary>
/// <param name="taskId"></param>
[HttpPost]
public async Task ExecuteTask(string taskId)
{