102 lines
3.5 KiB
C#
102 lines
3.5 KiB
C#
using JiShe.CollectBus.Protocol.Contracts.Abstracts;
|
|
using JiShe.CollectBus.Protocol.Contracts.Attributes;
|
|
using JiShe.CollectBus.Protocol.Contracts.DependencyInjection;
|
|
using JiShe.CollectBus.Protocol.Contracts.Models;
|
|
using Microsoft.Extensions.Caching.Distributed;
|
|
using TouchSocket.Sockets;
|
|
|
|
namespace JiShe.CollectBus.Protocol.Test
|
|
{
|
|
[ProtocolName("TestProtocol")]
|
|
public class TestProtocolPlugin(IDistributedCache cache) : BaseProtocolPlugin(cache), ISingletonDependency
|
|
{
|
|
public override ProtocolInfo Get()
|
|
{
|
|
return new ProtocolInfo("Test", "376.1", "TCP", "376.1协议", "DTSU1980");
|
|
}
|
|
|
|
public override void Received(ReceivedDataEventArgs e)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public override void Send()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
//档案下发
|
|
//var listMeter = new List<MeterParameter>() { new MeterParameter(){
|
|
// Pn = 1,
|
|
// BaudRate = 3,
|
|
// Port = 2,
|
|
// ProtocolType = ProtocolType.DLT6452007,
|
|
// Address = "312408006642",
|
|
// Password = "000000",
|
|
// RateNumber = 4,
|
|
// IntegerBitNumber = 4,
|
|
// DecimalBitNumber = 4,
|
|
// CollectorAddress = "000000000000",
|
|
// UserCategoryNumber = 0,
|
|
// UserSubclassNumber = 0
|
|
//} };
|
|
//new BuildCommand().GetAFN04F10DataUnit(new ReqParameter2() {
|
|
// AFN = AFN.设置参数,
|
|
// CMasterStationFunCode = CMasterStationFunCode.请求1级数据,
|
|
// A= "322009872",
|
|
// Seq = new Seq()
|
|
// {
|
|
// TpV = TpV.附加信息域中无时间标签,
|
|
// FIRFIN = FIRFIN.单帧,
|
|
// CON = CON.需要对该帧进行确认,
|
|
// PRSEQ = 10,
|
|
// },
|
|
// MSA = 13,
|
|
// Pn = 0,
|
|
// Fn = 10
|
|
//},listMeter);
|
|
//档案读取
|
|
//new BuildCommand().GetAFN10F10DataUnit(new ReqParameter2()
|
|
//{
|
|
// AFN = AFN.查询参数,
|
|
// CMasterStationFunCode = CMasterStationFunCode.请求2级数据,
|
|
// A = "322009872",
|
|
// Seq = new Seq()
|
|
// {
|
|
// TpV = TpV.附加信息域中无时间标签,
|
|
// FIRFIN = FIRFIN.单帧,
|
|
// CON = CON.不需要对该帧进行确认,
|
|
// PRSEQ = 2,
|
|
// },
|
|
// MSA = 13,
|
|
// Pn = 0,
|
|
// Fn = 10
|
|
//},new List<int>() {1,2 });
|
|
|
|
//var str = "68A600A6006888203290261A0A6200000201010001000100621E426622082431000000000000040300000000000000CA16";
|
|
//var cmdResult = new BuildCommand().AnalysisCmd(str);
|
|
//if(cmdResult != null)
|
|
//{
|
|
// var list = new BuildCommand().AnalysisAFN04F10DataUnit(cmdResult.HexDatas);
|
|
//}
|
|
//new BuildCommand().GetCommandBytes(new ReqParameter2()
|
|
//{
|
|
// AFN = AFN.请求实时数据,
|
|
// CMasterStationFunCode = CMasterStationFunCode.请求2级数据,
|
|
// A = "322009872",
|
|
// Seq = new Seq()
|
|
// {
|
|
// TpV = TpV.附加信息域中无时间标签,
|
|
// FIRFIN = FIRFIN.单帧,
|
|
// CON = CON.不需要对该帧进行确认,
|
|
// PRSEQ = 2,
|
|
// },
|
|
// MSA = 13,
|
|
// Pn = 1,
|
|
// Fn = 129
|
|
// });
|
|
|
|
//new BuildCommand().AmmeterValveControl("312408006642", "", "000000", true);
|
|
}
|
|
}
|