订阅飞行器实时数据,更新机场配置文件
parent
e72b868938
commit
752e89a0bb
|
|
@ -40,11 +40,11 @@ namespace OpenAuth.WebApi.Model.mqtt
|
|||
{
|
||||
$"thing/product/{gateway}/osd",
|
||||
$"thing/product/{gateway}/events",
|
||||
$"thing/product/{gateway}/requests1",
|
||||
$"thing/product/{gateway}/requests",
|
||||
$"thing/product/{gateway}/services_reply",
|
||||
//$"thing/product/{gateway}/drc/up",
|
||||
//$"thing/product/{gateway}/drc/down",
|
||||
$"thing/product/{gateway}/status"
|
||||
$"sys/product/{gateway}/status"
|
||||
});
|
||||
}
|
||||
await _mqttCenter.ConnectAndSubscribeAsync(topics.ToArray());
|
||||
|
|
|
|||
|
|
@ -183,8 +183,8 @@ namespace OpenAuth.WebApi.Model.mqtt
|
|||
var topics = new List<string>();
|
||||
topics.AddRange(new[]
|
||||
{
|
||||
$"thing/product/{dronesn}/osd",
|
||||
$"thing/product/{uavsn}/osd",
|
||||
$"sys/product/{dronesn}/osd",
|
||||
$"sys/product/{uavsn}/osd",
|
||||
});
|
||||
await _mqttCenter.SubscribeAsync(topics.ToArray());
|
||||
var requestData = new
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace OpenAuth.WebApi.Model.mqtt
|
|||
{
|
||||
return topic.Contains("/status");
|
||||
}
|
||||
string bid, tid, previousgateway;
|
||||
|
||||
public async Task HandleAsync(string topic, string payload)
|
||||
{
|
||||
_logger.LogError($"[Service] Topic={topic}, Payload={payload}");
|
||||
|
|
@ -35,8 +35,9 @@ namespace OpenAuth.WebApi.Model.mqtt
|
|||
{
|
||||
return;
|
||||
}
|
||||
bid = root["bid"]?.ToString() ?? "";
|
||||
tid = root["tid"]?.ToString() ?? "";
|
||||
var bid = root["bid"]?.ToString() ?? "";
|
||||
var tid = root["tid"]?.ToString() ?? "";
|
||||
var timestamp = long.Parse(root["timestamp"]?.ToString() ?? "0");
|
||||
var requestData = new
|
||||
{
|
||||
bid = bid,
|
||||
|
|
@ -50,7 +51,7 @@ namespace OpenAuth.WebApi.Model.mqtt
|
|||
};
|
||||
string getway = topic.Split('/')[2];
|
||||
string payloadreq = JsonSerializer.Serialize(requestData);
|
||||
await _mqttClientManager.PublishAsync($"thing/product/{getway}/status_reply", payloadreq);
|
||||
await _mqttClientManager.PublishAsync($"sys/product/{getway}/status_reply", payloadreq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue