修改代码
This commit is contained in:
parent
807ba4446d
commit
0d10c956db
@ -1,4 +1,4 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Models;
|
using JiShe.CollectBus.Common.Models;
|
||||||
using JiShe.CollectBus.RabbitMQ.Senders;
|
using JiShe.CollectBus.RabbitMQ.Senders;
|
||||||
@ -8,34 +8,17 @@ namespace JiShe.CollectBus.Host.Controllers
|
|||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("[controller]/[action]")]
|
[Route("[controller]/[action]")]
|
||||||
public class WeatherForecastController : ControllerBase
|
public class CommandController : ControllerBase
|
||||||
{
|
{
|
||||||
private static readonly string[] Summaries = new[]
|
private readonly ILogger<CommandController> _logger;
|
||||||
{
|
|
||||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
|
||||||
};
|
|
||||||
|
|
||||||
private readonly ILogger<WeatherForecastController> _logger;
|
|
||||||
private readonly INSender _nSender;
|
private readonly INSender _nSender;
|
||||||
|
|
||||||
public WeatherForecastController(INSender nSender, ILogger<WeatherForecastController> logger)
|
public CommandController(INSender nSender, ILogger<CommandController> logger)
|
||||||
{
|
{
|
||||||
_nSender = nSender;
|
_nSender = nSender;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet(Name = "GetWeatherForecast")]
|
|
||||||
public IEnumerable<WeatherForecast> Get()
|
|
||||||
{
|
|
||||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
|
||||||
{
|
|
||||||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
|
||||||
TemperatureC = Random.Shared.Next(-20, 55),
|
|
||||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
|
||||||
})
|
|
||||||
.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet(Name = "AmmeterParameterSend")]
|
[HttpGet(Name = "AmmeterParameterSend")]
|
||||||
public async Task<bool> AmmeterParameterSendAsync()
|
public async Task<bool> AmmeterParameterSendAsync()
|
||||||
{
|
{
|
||||||
@ -60,14 +43,14 @@ namespace JiShe.CollectBus.Host.Controllers
|
|||||||
};
|
};
|
||||||
var bytes = HexStringExtensions.BuildAmmeterParameterSetSendCmd(new ReqParameter2()
|
var bytes = HexStringExtensions.BuildAmmeterParameterSetSendCmd(new ReqParameter2()
|
||||||
{
|
{
|
||||||
AFN = AFN.设置参数,
|
AFN = AFN.设置参数,
|
||||||
FunCode = (int)CMasterStationFunCode.请求1级数据,
|
FunCode = (int)CMasterStationFunCode.请求1级数据,
|
||||||
A = "322009872",
|
A = "322009872",
|
||||||
Seq = new Seq()
|
Seq = new Seq()
|
||||||
{
|
{
|
||||||
TpV = TpV.附加信息域中无时间标签,
|
TpV = TpV.附加信息域中无时间标签,
|
||||||
FIRFIN = FIRFIN.单帧,
|
FIRFIN = FIRFIN.单帧,
|
||||||
CON = CON.需要对该帧进行确认,
|
CON = CON.需要对该帧进行确认,
|
||||||
PRSEQ = 10,
|
PRSEQ = 10,
|
||||||
},
|
},
|
||||||
MSA = 13,
|
MSA = 13,
|
||||||
@ -84,14 +67,14 @@ namespace JiShe.CollectBus.Host.Controllers
|
|||||||
{
|
{
|
||||||
HexStringExtensions.BuildAmmeterParameterReadingSendCmd(new ReqParameter2()
|
HexStringExtensions.BuildAmmeterParameterReadingSendCmd(new ReqParameter2()
|
||||||
{
|
{
|
||||||
AFN = AFN.查询参数,
|
AFN = AFN.查询参数,
|
||||||
FunCode = (int)CMasterStationFunCode.请求2级数据,
|
FunCode = (int)CMasterStationFunCode.请求2级数据,
|
||||||
A = "322009872",
|
A = "322009872",
|
||||||
Seq = new Seq()
|
Seq = new Seq()
|
||||||
{
|
{
|
||||||
TpV = TpV.附加信息域中无时间标签,
|
TpV = TpV.附加信息域中无时间标签,
|
||||||
FIRFIN = FIRFIN.单帧,
|
FIRFIN = FIRFIN.单帧,
|
||||||
CON = CON.不需要对该帧进行确认,
|
CON = CON.不需要对该帧进行确认,
|
||||||
PRSEQ = 2,
|
PRSEQ = 2,
|
||||||
},
|
},
|
||||||
MSA = 13,
|
MSA = 13,
|
||||||
@ -114,14 +97,14 @@ namespace JiShe.CollectBus.Host.Controllers
|
|||||||
//}
|
//}
|
||||||
HexStringExtensions.BuildSendCommandBytes(new ReqParameter2()
|
HexStringExtensions.BuildSendCommandBytes(new ReqParameter2()
|
||||||
{
|
{
|
||||||
AFN = AFN.请求实时数据,
|
AFN = AFN.请求实时数据,
|
||||||
FunCode = (int)CMasterStationFunCode.请求2级数据,
|
FunCode = (int)CMasterStationFunCode.请求2级数据,
|
||||||
A = "322009872",
|
A = "322009872",
|
||||||
Seq = new Seq()
|
Seq = new Seq()
|
||||||
{
|
{
|
||||||
TpV = TpV.附加信息域中无时间标签,
|
TpV = TpV.附加信息域中无时间标签,
|
||||||
FIRFIN = FIRFIN.单帧,
|
FIRFIN = FIRFIN.单帧,
|
||||||
CON = CON.不需要对该帧进行确认,
|
CON = CON.不需要对该帧进行确认,
|
||||||
PRSEQ = 2,
|
PRSEQ = 2,
|
||||||
},
|
},
|
||||||
MSA = 13,
|
MSA = 13,
|
||||||
33
JiShe.CollectBus.Host/Models/GeneralIssuedInput.cs
Normal file
33
JiShe.CollectBus.Host/Models/GeneralIssuedInput.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using JiShe.CollectBus.Common.Enums;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.Host.Models
|
||||||
|
{
|
||||||
|
public class GeneralIssuedInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 测量点号 0~2040 为0被删除
|
||||||
|
/// </summary>
|
||||||
|
public int Pn { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 波特率600起 1~7
|
||||||
|
/// </summary>
|
||||||
|
public int BaudRate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 端口号 1-31
|
||||||
|
/// </summary>
|
||||||
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
public CommunicationProtocolType ProtocolType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 通信地址 0~999999999999
|
||||||
|
/// </summary>
|
||||||
|
public string Address { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通信密码
|
||||||
|
/// </summary>
|
||||||
|
public string Password { get; set; } = "000000";
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user