首次上传
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Common
|
||||
{
|
||||
|
||||
public class CommandStringBuilderFactory
|
||||
{
|
||||
public static CommandStringBuilder GetCommandStringBuilder(string deviceName)
|
||||
{
|
||||
if (deviceName.Contains("PfeifferHipace"))
|
||||
{
|
||||
return new PfeifferHipaceCommandStringBuilder();
|
||||
}
|
||||
|
||||
return new CommandStringBuilder();
|
||||
}
|
||||
}
|
||||
|
||||
public class CommandStringBuilder
|
||||
{
|
||||
public virtual void BuildCommandString()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class PfeifferHipaceCommandStringBuilder : CommandStringBuilder
|
||||
{
|
||||
public override void BuildCommandString()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Common
|
||||
{
|
||||
|
||||
public class IOCommandModel
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string CommandStr { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool IsBasicFunction { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string IOCommandType { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool IsSelected { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool SpecialHandler { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string FunctionName { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string FunctionDiscription { get; set; }
|
||||
|
||||
|
||||
public string CommandName { get; set; }
|
||||
public string CommandParameter { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class CommandModelConfig
|
||||
{
|
||||
public List<IOCommandModel> IOCommandList { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Common
|
||||
{
|
||||
public class IOCommandReader
|
||||
{
|
||||
|
||||
private static Dictionary<string, CommandModelConfig> _commandModelConfigDict = new Dictionary<string, CommandModelConfig>();
|
||||
|
||||
public static CommandModelConfig GetCommandModelConfig(string hardwarePath, string hardwareName)
|
||||
{
|
||||
CommandModelConfig commandModelConfig = null;
|
||||
if (_commandModelConfigDict.Keys.Contains(hardwareName))
|
||||
{
|
||||
commandModelConfig = _commandModelConfigDict[hardwareName];
|
||||
}
|
||||
else
|
||||
{
|
||||
commandModelConfig = JsonConvert.DeserializeObject<CommandModelConfig>(File.ReadAllText(ConfigPath.HardwareUnitsPath + $"{hardwarePath}\\{hardwareName}\\IOCommands.json"));
|
||||
_commandModelConfigDict.Add(hardwareName, commandModelConfig);
|
||||
}
|
||||
return commandModelConfig;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ConfigPath
|
||||
{
|
||||
public static string HardwareUnitsPath
|
||||
{
|
||||
get
|
||||
{
|
||||
string path = Assembly.GetExecutingAssembly().Location;
|
||||
FileInfo finfo = new FileInfo(path);
|
||||
return finfo.DirectoryName + @"\\HardwareUnits\";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Common
|
||||
{
|
||||
public class IOResponse
|
||||
{
|
||||
public string SourceCommandName { get; set; }
|
||||
public string SourceCommand { get; set; }
|
||||
public string SourceCommandType { get; set; }
|
||||
public string ResonseContent { get; set; }
|
||||
public DateTime ResonseRecievedTime { get; set; }
|
||||
public bool IsAck { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Aitex.Core.RT.Device;
|
||||
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Common
|
||||
{
|
||||
public class SerialPortDevice : BaseDevice, IDevice
|
||||
{
|
||||
|
||||
public string PortName { get; set; }
|
||||
public SerialPortDevice(string module, string name)
|
||||
{
|
||||
Module = module;
|
||||
Name = name;
|
||||
}
|
||||
public virtual bool Initialize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public virtual bool Initialize(string portName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void Monitor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void Terminate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void Reset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual bool Home(out string reason)
|
||||
{
|
||||
reason = string.Empty;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using Aitex.Core.RT.Device;
|
||||
|
||||
namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Common
|
||||
{
|
||||
|
||||
public class TCPSocketDevice : BaseDevice, IDevice
|
||||
{
|
||||
|
||||
public TCPSocketDevice(string module, string name)
|
||||
{
|
||||
Module = module;
|
||||
Name = name;
|
||||
}
|
||||
public virtual bool Initialize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public virtual bool Initialize(string portName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void Monitor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void Terminate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void Reset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual bool Home(out string reason)
|
||||
{
|
||||
reason = string.Empty;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user