无人机状态上报
parent
e61f3187f7
commit
5d95cc9da2
|
|
@ -25,6 +25,7 @@ using Infrastructure.Extensions;
|
|||
using System.Security.Cryptography;
|
||||
using System.Text.Json.Nodes;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OpenAuth.WebApi;
|
||||
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.DroneDocking
|
||||
|
|
@ -35,12 +36,14 @@ namespace OpenAuth.App.ServiceApp.DroneDocking
|
|||
private IConfiguration configuration;
|
||||
private readonly ISqlSugarClient _client;
|
||||
private readonly MinioService _minioService;
|
||||
public DroneDockApp(EncryptionHelper helper, IConfiguration configuration, ISqlSugarClient client, MinioService minioService, ISugarUnitOfWork<SugarDbContext> unitWork, ISimpleClient<DroneDocktask> repository, IAuth auth) : base(unitWork, repository, auth)
|
||||
private readonly MqttClientManager _mqttClientManager;
|
||||
public DroneDockApp(EncryptionHelper helper, IConfiguration configuration, ISqlSugarClient client, MinioService minioService, MqttClientManager mqttClientManager, ISugarUnitOfWork<SugarDbContext> unitWork, ISimpleClient<DroneDocktask> repository, IAuth auth) : base(unitWork, repository, auth)
|
||||
{
|
||||
_helper = helper;
|
||||
this.configuration = configuration;
|
||||
_client = client;
|
||||
_minioService = minioService;
|
||||
_mqttClientManager = mqttClientManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -648,6 +651,14 @@ namespace OpenAuth.App.ServiceApp.DroneDocking
|
|||
ResData Response = new ResData();
|
||||
string data = "{\r\n\"code\": 200,\r\n\"data\": {\r\n\"mode_code\":0,\r\n\"longitude\":122.45,\r\n\"latitude\":30.45,\r\n\"height\":80,\r\n\"elevation\":50,\r\n\"gimbal_pitch\":-45,\r\n\"gimbal_yaw\":23,\r\n\"battery_capacity_percent\":35,\r\n\"gps_state\":2,\r\n},\r\n\"message\": \"获取无人机机场状态成功!\",\r\n\"traceid\": \"xxx\"\r\n}";
|
||||
//todo deviceid
|
||||
var topicRequest1 = $"thing/product/" + deviceid + "/osd";
|
||||
await _mqttClientManager.SubscribeAsync(topicRequest1, async (args) =>
|
||||
{
|
||||
var payload1 = args.ApplicationMessage.Payload;
|
||||
var message = Encoding.UTF8.GetString(payload1);
|
||||
Console.WriteLine($"收到主题 [{args.ApplicationMessage.Topic}] 的消息: {message}");
|
||||
await Task.CompletedTask;
|
||||
});
|
||||
if (true)
|
||||
{
|
||||
string x_lc_secret = _helper.getxseret();
|
||||
|
|
|
|||
|
|
@ -295,6 +295,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|||
[Route("/zhcfzx/droneAirport/getDroneStatus")]
|
||||
public async Task<ReciveData<string>> getDroneStatus( string deviceid)
|
||||
{
|
||||
|
||||
var result = new ReciveData<string>();
|
||||
if (Request.Headers.TryGetValue("x-lc-token", out var tokenValue))
|
||||
{
|
||||
|
|
@ -307,8 +308,6 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|||
result.data = data.Result;
|
||||
result.code = data.Code;
|
||||
result.message = data.Message;
|
||||
//Request.Headers.TryGetValue("traceid", out var traceid);
|
||||
//result.traceid = traceid;
|
||||
result.traceid = Guid.NewGuid().ToString();
|
||||
Response.Headers.Add("x-lc-secret", data.Secret);
|
||||
}
|
||||
|
|
@ -316,8 +315,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|||
{
|
||||
result.code = 200;
|
||||
result.message = "error";
|
||||
//Request.Headers.TryGetValue("traceid", out var traceid);
|
||||
//result.traceid = traceid;
|
||||
|
||||
result.traceid = Guid.NewGuid().ToString();
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Reference in New Issue