diff --git a/OpenAuth.Repository/Domain/LasaAirLine.cs b/OpenAuth.Repository/Domain/LasaAirLine.cs index 77c0daf..1f20076 100644 --- a/OpenAuth.Repository/Domain/LasaAirLine.cs +++ b/OpenAuth.Repository/Domain/LasaAirLine.cs @@ -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 航线文件地址 } } diff --git a/OpenAuth.Repository/Domain/LasaTask.cs b/OpenAuth.Repository/Domain/LasaTask.cs index 5e27590..93b599f 100644 --- a/OpenAuth.Repository/Domain/LasaTask.cs +++ b/OpenAuth.Repository/Domain/LasaTask.cs @@ -57,16 +57,21 @@ namespace OpenAuth.Repository.Domain /// AI巡检 /// public string AIInspection { get; set; } - + /// /// 状态 /// - public int Status { get; set; } + public int Status { get; set; } + /// /// 周期公式 /// public string PeriodicFormula { get; set; } + /// + /// 航线id + /// + public string AirLineId { get; set; } public long CreateId { get; set; } public DateTime? CreateTime { get; set; } diff --git a/OpenAuth.WebApi/CloudSdk/GatewayManager.cs b/OpenAuth.WebApi/CloudSdk/GatewayManager.cs index c09c3aa..30901b5 100644 --- a/OpenAuth.WebApi/CloudSdk/GatewayManager.cs +++ b/OpenAuth.WebApi/CloudSdk/GatewayManager.cs @@ -7,16 +7,20 @@ public class GatewayManager public GatewayType GatewayType { get; set; } /// - /// 机场任务准备异常通知 + /// 机场任务准备异常通知 flight_setup_exception_notify /// public string FlightSetupExceptionNotify = TopicConst.ThingModelPre + TopicConst.Product + "%s" + TopicConst.EventsSuffix; + /// + /// 下发任务 down(向设备端发布消息) flighttask_prepare(method) thing/product/{gateway_sn}/services(topic) + /// + public string FlightTaskPrepare = TopicConst.ThingModelPre + TopicConst.Product + "%s" + TopicConst.ServicesSuffix; + public GatewayManager(string gatewaySn, string droneSn, GatewayType gatewayType) { GatewaySn = gatewaySn; DroneSn = droneSn; GatewayType = gatewayType; } - } \ No newline at end of file diff --git a/OpenAuth.WebApi/CloudSdk/mqtt/ChannelName.cs b/OpenAuth.WebApi/CloudSdk/mqtt/ChannelName.cs new file mode 100644 index 0000000..ed35f45 --- /dev/null +++ b/OpenAuth.WebApi/CloudSdk/mqtt/ChannelName.cs @@ -0,0 +1,108 @@ +namespace OpenAuth.WebApi.CloudSdk.mqtt; + +/// +/// The name of all channels. +/// +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"; +} \ No newline at end of file diff --git a/OpenAuth.WebApi/CloudSdk/mqtt/MqttClientManager.cs b/OpenAuth.WebApi/CloudSdk/mqtt/MqttClientManager.cs index 6eb3cde..599c518 100644 --- a/OpenAuth.WebApi/CloudSdk/mqtt/MqttClientManager.cs +++ b/OpenAuth.WebApi/CloudSdk/mqtt/MqttClientManager.cs @@ -1,4 +1,5 @@ using MQTTnet; +using MQTTnet.Adapter; using MQTTnet.Client; using MQTTnet.Protocol; @@ -67,6 +68,7 @@ public class MqttClientManager /// json public async Task PublishAsync(string topic, string message) { + // MqttChannelAdapter var mqttMsg = new MqttApplicationMessageBuilder() .WithTopic(topic) .WithPayload(message) diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs index e8cd5a0..04395c8 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/ManageController.cs @@ -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 }); } - + /*/// + /// 更新航线文件 + /// + /// + /// + /// [HttpPost("uploadwpmlfile")] [AllowAnonymous] public async Task 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 // 航线任务在云端的 共享查看、下发执行、取消以及进度上报等功能。 + /// + /// 执行任务 + /// + /// [HttpPost] public async Task ExecuteTask(string taskId) {