任务下发任务执行能正常执行版本
parent
8d0e5a4381
commit
f1aac4ca20
|
|
@ -50,11 +50,13 @@ public class MqttClientManager
|
|||
var inboundOptions = new MqttClientOptionsBuilder()
|
||||
.WithClientId(Guid.NewGuid() + "_inbound")
|
||||
.WithTcpServer(server, port)
|
||||
.WithKeepAlivePeriod(TimeSpan.FromSeconds(20))
|
||||
.WithCredentials(username, password)
|
||||
.Build();
|
||||
var outboundOptions = new MqttClientOptionsBuilder()
|
||||
.WithClientId(Guid.NewGuid() + "_outbound")
|
||||
.WithTcpServer(server, port)
|
||||
.WithKeepAlivePeriod(TimeSpan.FromSeconds(20))
|
||||
.WithCredentials(username, password)
|
||||
.Build();
|
||||
|
||||
|
|
@ -91,7 +93,6 @@ public class MqttClientManager
|
|||
/// <param name="message">json</param>
|
||||
public async Task PublishAsync(string topic, string message)
|
||||
{
|
||||
Console.WriteLine($"Publish: {topic} - {message}");
|
||||
// MqttChannelAdapter
|
||||
var mqttMsg = new MqttApplicationMessageBuilder()
|
||||
.WithTopic(topic)
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class ConfigSubscribe : IJob
|
|||
switch (method)
|
||||
{
|
||||
case "storage_config_get":
|
||||
Console.WriteLine("进入临时凭证获取处理");
|
||||
Console.WriteLine($"进入临时凭证获取处理 {message}");
|
||||
// {"bid":"afc5c13e-da1c-4a15-aec1-a765aac34c57",
|
||||
// "data":{"module":0},
|
||||
// "method":"storage_config_get",
|
||||
|
|
@ -135,11 +135,8 @@ public class ConfigSubscribe : IJob
|
|||
};
|
||||
// thing/product/{gateway_sn}/requests_reply
|
||||
var tempTopic = $"thing/product/{sn}/requests_reply";
|
||||
//Console.WriteLine($"主题:{tempTopic} request:{JsonConvert.SerializeObject(storageConfigRequest)}");
|
||||
// todo 临时注释
|
||||
await mqttClientManager.PublishAsync(tempTopic,
|
||||
JsonConvert.SerializeObject(storageConfigRequest));
|
||||
//Console.WriteLine("临时凭证获取处理完成");
|
||||
break;
|
||||
case "flight_areas_get":
|
||||
//Console.WriteLine("跳过自定义飞行区文件获取");
|
||||
|
|
@ -158,13 +155,13 @@ public class ConfigSubscribe : IJob
|
|||
// http://175.27.168.120:6013/test/2025062209390863860047.kmz
|
||||
// md5 585c833012ddb794eaac1050ef71aa31
|
||||
// todo 这一小段运行异常
|
||||
/*var taskAssign = await sqlSugarClient
|
||||
var taskAssign = await sqlSugarClient
|
||||
.Queryable<LasaTaskAssign>()
|
||||
.Where(x => x.FlightId == flightId)
|
||||
.SingleAsync();*/
|
||||
//Console.WriteLine($"任务信息:{JsonConvert.SerializeObject(taskAssign)}");
|
||||
.SingleAsync();
|
||||
Console.WriteLine($"任务信息:{JsonConvert.SerializeObject(taskAssign)}");
|
||||
/*var taskAssign =
|
||||
manageApp.GetTaskAssignByBidAndTid1(result.bid, result.tid, flightId);*/
|
||||
manageApp.GetTaskAssignByBidAndTid(result.bid, result.tid, flightId);*/
|
||||
var flightTaskResourceGetTopic = $"thing/product/{sn}/requests_reply";
|
||||
dynamic outData = new ExpandoObject();
|
||||
outData.result = 0;
|
||||
|
|
@ -172,8 +169,9 @@ public class ConfigSubscribe : IJob
|
|||
{
|
||||
file = new
|
||||
{
|
||||
fingerprint = "585c833012ddb794eaac1050ef71aa31",
|
||||
url = "http://175.27.168.120:6013/test/2025062209390863860047.kmz"
|
||||
fingerprint = taskAssign.Md5,
|
||||
url = "http://175.27.168.120:6013/test/2025062415430484240112.kmz"
|
||||
// url = "http://175.27.168.120:6013/test/2025062209390863860047.kmz"
|
||||
}
|
||||
};
|
||||
var outRequest = new TopicServicesRequest<object>()
|
||||
|
|
@ -245,8 +243,8 @@ public class ConfigSubscribe : IJob
|
|||
{
|
||||
case "flighttask_prepare": // 下发任务响应
|
||||
// todo 同一prepare消息只能处理一次
|
||||
lock (locker)
|
||||
{
|
||||
//lock (locker)
|
||||
// {
|
||||
// 报错处理
|
||||
Console.WriteLine("进入prepare订阅消息");
|
||||
code = data.result;
|
||||
|
|
@ -294,7 +292,7 @@ public class ConfigSubscribe : IJob
|
|||
};
|
||||
sqlSugarClient.Updateable(taskAssignRecord).IgnoreNullColumns().ExecuteCommand();
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
break;
|
||||
case "flighttask_execute": // 执行任务响应
|
||||
|
|
|
|||
|
|
@ -646,7 +646,7 @@ namespace OpenAuth.App.ServiceApp
|
|||
var md5 = await _minioService.GetMetaObject(wpml, "");
|
||||
// todo 临时固定代码
|
||||
// http://175.27.168.120:6013/test/2025062209390863860047.kmz
|
||||
//wpml = await _minioService.GetObjectUrl("test", "2025062209390863860047.kmz");
|
||||
// wpml = await _minioService.GetObjectUrl("test", "2025062209390863860047.kmz");
|
||||
data.file = new
|
||||
{
|
||||
url = wpml,
|
||||
|
|
@ -676,7 +676,7 @@ namespace OpenAuth.App.ServiceApp
|
|||
}
|
||||
|
||||
// 返航高度 {"max":1500,"min":20,"step":"","unit_name":"米 / m"}
|
||||
data.rth_altitude = 50; // todo 取自任务
|
||||
data.rth_altitude = 90; // todo 取自任务
|
||||
// 返航高度模式 {"0":"智能高度","1":"设定高度"}
|
||||
// 智能返航模式下,飞行器将自动规划最佳返航高度。大疆机场当前不支持设置返航高度模式,只能选择'设定高度'模式。当环境,光线不满足视觉系统要求时(譬如傍晚阳光直射、夜间弱光无光),飞行器将使用您设定的返航高度进行直线返航
|
||||
data.rth_mode = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue