首次上传
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
using MECF.Framework.Common.Communications;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.UPS
|
||||
{
|
||||
public class UPSConnection : SNMPBase
|
||||
{
|
||||
private List<byte> _lstCacheBuffer = new List<byte>();
|
||||
private string sendMessage;
|
||||
public UPSConnection(string portName) : base(portName, "public", 1, "\n")
|
||||
{
|
||||
|
||||
}
|
||||
public override bool SendMessage(string message)
|
||||
{
|
||||
_lstCacheBuffer.Clear();
|
||||
sendMessage = message;
|
||||
return base.SendMessage(message);
|
||||
}
|
||||
public override bool SendMessage(List<string> message)
|
||||
{
|
||||
_lstCacheBuffer.Clear();
|
||||
return base.SendMessage(message);
|
||||
}
|
||||
protected override MessageBase ParseResponse(string rawMessage)
|
||||
{
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
protected override MessageBase ParseResponse(string Oid, string Value)
|
||||
{
|
||||
|
||||
UPSMessage msg = new UPSMessage();
|
||||
msg.IsResponse = false;
|
||||
msg.IsAck = false;
|
||||
msg.IsComplete = false;
|
||||
|
||||
if (!sendMessage.Equals(Oid)) return msg;
|
||||
msg.Oid = Oid;
|
||||
msg.Value = Value;
|
||||
msg.IsResponse = true;
|
||||
msg.IsAck = true;
|
||||
msg.IsComplete = true;
|
||||
|
||||
return msg;
|
||||
}
|
||||
protected override MessageBase ParseResponse(Dictionary<string, string> rawMessagelist)
|
||||
{
|
||||
UPSMessage msg = new UPSMessage();
|
||||
msg.IsResponse = false;
|
||||
msg.IsAck = false;
|
||||
msg.IsComplete = false;
|
||||
|
||||
//if (!) return msg;
|
||||
//msg.Oid = Oid;
|
||||
// msg.Value = Value;
|
||||
if (rawMessagelist != null && rawMessagelist.Count == 0)
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
msg.oidic = rawMessagelist;
|
||||
msg.IsResponse = true;
|
||||
msg.IsAck = true;
|
||||
msg.IsComplete = true;
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user