qrmode 에서 wms rcv 태그 인식되게 함
This commit is contained in:
Submodule Handler/Sub/AmkorRestfulService deleted from c2a5826f21
@@ -46,6 +46,7 @@
|
||||
<Compile Include="Enum.cs" />
|
||||
<Compile Include="Enum_IO.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RS232.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
1174
Handler/Sub/CommData/RS232.cs
Normal file
1174
Handler/Sub/CommData/RS232.cs
Normal file
File diff suppressed because it is too large
Load Diff
Submodule Handler/Sub/CommUtil deleted from 11d464e16a
36
Handler/Sub/MemoryMapCore/Client.cs
Normal file
36
Handler/Sub/MemoryMapCore/Client.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.IO.MemoryMappedFiles;
|
||||
using System.Threading;
|
||||
|
||||
namespace AR.MemoryMap
|
||||
{
|
||||
public class Client : Core
|
||||
{
|
||||
public Client(string MapFileName, int MapFileSize, int loopDelay = 50) : base(MapFileName, MapFileSize, loopDelay)
|
||||
{
|
||||
StartAction = () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var MapFileSync = $"{MapFileName}{MapFileSize}";
|
||||
mmf = MemoryMappedFile.CreateOrOpen(MapFileName, MapFileSize);
|
||||
mutex = new Mutex(false, MapFileSync, out mutexCreated);
|
||||
ErrorMessage = string.Empty;
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorMessage = ex.Message;
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
StopAction = () =>
|
||||
{
|
||||
ErrorMessage = string.Empty;
|
||||
brun = false;
|
||||
return true;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
574
Handler/Sub/MemoryMapCore/Core.cs
Normal file
574
Handler/Sub/MemoryMapCore/Core.cs
Normal file
@@ -0,0 +1,574 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.MemoryMappedFiles;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AR.MemoryMap
|
||||
{
|
||||
public abstract class Core
|
||||
{
|
||||
protected ManualResetEvent mre;
|
||||
protected MemoryMappedFile mmf;
|
||||
protected Mutex mutex;
|
||||
protected bool mutexCreated;
|
||||
protected Func<bool> StartAction;
|
||||
protected Func<bool> StopAction;
|
||||
string MapFileName = string.Empty;
|
||||
public int WriteTime = 100;
|
||||
public int ReadTime = 100;
|
||||
int MapSize = 100;
|
||||
public bool Init { get; set; } = false;
|
||||
Task loop;
|
||||
protected bool brun = false;
|
||||
public int LoopDelay { get; set; }
|
||||
public string ErrorMessage { get; set; }
|
||||
public Core(string mapFileName, int mapSize, int loopDelay = 50)
|
||||
{
|
||||
LoopDelay = loopDelay;
|
||||
this.MapFileName = mapFileName;
|
||||
this.MapSize = mapSize;
|
||||
this.monitorvalue = new byte[mapSize];
|
||||
mre = new ManualResetEvent(false);
|
||||
}
|
||||
~Core()
|
||||
{
|
||||
brun = false;
|
||||
}
|
||||
|
||||
public bool Start()
|
||||
{
|
||||
Init = StartAction.Invoke();
|
||||
return Init;
|
||||
}
|
||||
public void StartMonitor()
|
||||
{
|
||||
if (Init == false) return;
|
||||
if (IsMonitorRun) return;
|
||||
|
||||
|
||||
brun = true;
|
||||
loop = Task.Factory.StartNew(() =>
|
||||
{
|
||||
Monitor_Loop();
|
||||
});
|
||||
}
|
||||
public void StopMonitor()
|
||||
{
|
||||
brun = false;
|
||||
}
|
||||
public bool IsMonitorRun
|
||||
{
|
||||
get
|
||||
{
|
||||
if (loop == null) return false;
|
||||
if (loop.IsCompleted) return false;
|
||||
if (loop.IsCanceled) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool SetMonitorTarget(bool All)
|
||||
{
|
||||
if (mre.WaitOne(100) == false) return false;
|
||||
|
||||
|
||||
mre.Set();
|
||||
return true;
|
||||
}
|
||||
|
||||
byte[] monitorvalue;
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
StopAction.Invoke();
|
||||
}
|
||||
private void Monitor_Loop()
|
||||
{
|
||||
while (brun)
|
||||
{
|
||||
//작업가능확인
|
||||
bool readok = false;
|
||||
byte[] value = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (mre.WaitOne(100))
|
||||
{
|
||||
try
|
||||
{
|
||||
//메모리접근 권한 확인
|
||||
if (MutexWaitOne(100))
|
||||
{
|
||||
//값을 읽은 경우
|
||||
if (ReadBytes(0, this.MapSize, out value))
|
||||
{
|
||||
readok = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
finally { mutex.ReleaseMutex(); }
|
||||
}
|
||||
}
|
||||
finally { mre.Set(); }
|
||||
|
||||
|
||||
if (readok)
|
||||
{
|
||||
//값의 변화가 있다면 이벤트 발생
|
||||
List<int> changeindex = new List<int>();
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
{
|
||||
if (value[i] != monitorvalue[i]) changeindex.Add(i);
|
||||
}
|
||||
if (changeindex.Any())
|
||||
{
|
||||
ValueChanged.Invoke(this, new monitorvalueargs(changeindex.ToArray(), monitorvalue, value));
|
||||
}
|
||||
//신규값을 업데이트
|
||||
Array.Copy(value, monitorvalue, value.Length);
|
||||
}
|
||||
|
||||
//write
|
||||
System.Threading.Thread.Sleep(LoopDelay);
|
||||
}
|
||||
}
|
||||
public bool MutexWaitOne(int milli)
|
||||
{
|
||||
var MapFileSync = $"{MapFileName}{MapSize}";
|
||||
if (mutexCreated == false)
|
||||
{
|
||||
mutex = new Mutex(false, MapFileSync, out mutexCreated);
|
||||
return mutex.WaitOne(milli);
|
||||
}
|
||||
else
|
||||
{
|
||||
//이미생성된 경우에는 에러처리를 해야한다
|
||||
try
|
||||
{
|
||||
return mutex.WaitOne(milli);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//오류가있으니 다시 작성한다
|
||||
mutex = new Mutex(false, MapFileSync, out mutexCreated);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<monitorvalueargs> ValueChanged;
|
||||
public class monitorvalueargs : EventArgs
|
||||
{
|
||||
public byte[] newdata;
|
||||
public byte[] olddata;
|
||||
public int[] idxlist;
|
||||
public monitorvalueargs(int[] idxs, byte[] beforedata, byte[] afterdata)
|
||||
{
|
||||
idxlist = new int[idxs.Length];
|
||||
Array.Copy(idxs, this.idxlist, idxs.Length);
|
||||
newdata = new byte[afterdata.Length];
|
||||
Array.Copy(afterdata, newdata, afterdata.Length);
|
||||
olddata = new byte[beforedata.Length];
|
||||
Array.Copy(beforedata, olddata, beforedata.Length);
|
||||
}
|
||||
}
|
||||
|
||||
#region "WRITE"
|
||||
public bool Write(int address, Boolean value)
|
||||
{
|
||||
if (Init == false) return false;
|
||||
if (MutexWaitOne(WriteTime) == false) return false;
|
||||
Type type = value.GetType();
|
||||
var size = Marshal.SizeOf(value.GetType());
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
using (var writer = new BinaryWriter(stream))
|
||||
writer.Write(value);
|
||||
mutex.ReleaseMutex();
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Write(int address, byte[] value, int startIndex = 0, int size = 0)
|
||||
{
|
||||
if (Init == false) return false;
|
||||
if (MutexWaitOne(WriteTime) == false) return false;
|
||||
Type type = value.GetType();
|
||||
if (size == 0) size = Marshal.SizeOf(value.GetType());
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
using (var writer = new BinaryWriter(stream))
|
||||
writer.Write(value,startIndex,size);
|
||||
mutex.ReleaseMutex();
|
||||
return true;
|
||||
}
|
||||
public bool Write(int address, byte value)
|
||||
{
|
||||
if (Init == false) return false;
|
||||
if (MutexWaitOne(WriteTime) == false) return false;
|
||||
Type type = value.GetType();
|
||||
var size = Marshal.SizeOf(value.GetType());
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
using (var writer = new BinaryWriter(stream))
|
||||
writer.Write(value);
|
||||
mutex.ReleaseMutex();
|
||||
return true;
|
||||
}
|
||||
public bool Write(int address, string value)
|
||||
{
|
||||
if (Init == false) return false;
|
||||
if (MutexWaitOne(WriteTime) == false) return false;
|
||||
Type type = value.GetType();
|
||||
var size = Marshal.SizeOf(type);
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
using (var writer = new BinaryWriter(stream))
|
||||
writer.Write(value);
|
||||
mutex.ReleaseMutex();
|
||||
return true;
|
||||
}
|
||||
public bool Write(int address, Int32 value)
|
||||
{
|
||||
if (Init == false) return false;
|
||||
if (MutexWaitOne(WriteTime) == false) return false;
|
||||
Type type = value.GetType();
|
||||
var size = Marshal.SizeOf(type);
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
using (var writer = new BinaryWriter(stream))
|
||||
writer.Write(value);
|
||||
mutex.ReleaseMutex();
|
||||
return true;
|
||||
}
|
||||
public bool Write(int address, Int16 value)
|
||||
{
|
||||
if (Init == false) return false;
|
||||
if (MutexWaitOne(WriteTime) == false) return false;
|
||||
Type type = value.GetType();
|
||||
var size = Marshal.SizeOf(type);
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
using (var writer = new BinaryWriter(stream))
|
||||
writer.Write(value);
|
||||
mutex.ReleaseMutex();
|
||||
return true;
|
||||
}
|
||||
public bool Write(int address, UInt32 value)
|
||||
{
|
||||
if (Init == false) return false;
|
||||
if (MutexWaitOne(WriteTime) == false) return false;
|
||||
Type type = value.GetType();
|
||||
var size = Marshal.SizeOf(type);
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
using (var writer = new BinaryWriter(stream))
|
||||
writer.Write(value);
|
||||
mutex.ReleaseMutex();
|
||||
return true;
|
||||
}
|
||||
public bool Write(int address, UInt16 value)
|
||||
{
|
||||
if (Init == false) return false;
|
||||
if (MutexWaitOne(WriteTime) == false) return false;
|
||||
Type type = value.GetType();
|
||||
var size = Marshal.SizeOf(type);
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
using (var writer = new BinaryWriter(stream))
|
||||
writer.Write(value);
|
||||
mutex.ReleaseMutex();
|
||||
return true;
|
||||
}
|
||||
public bool Write(int address, Single value)
|
||||
{
|
||||
if (Init == false) return false;
|
||||
if (MutexWaitOne(WriteTime) == false) return false;
|
||||
Type type = value.GetType();
|
||||
var size = Marshal.SizeOf(type);
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
using (var writer = new BinaryWriter(stream))
|
||||
writer.Write(value);
|
||||
mutex.ReleaseMutex();
|
||||
return true;
|
||||
}
|
||||
public bool Write(int address, Double value)
|
||||
{
|
||||
if (Init == false) return false;
|
||||
if (MutexWaitOne(WriteTime) == false) return false;
|
||||
Type type = value.GetType();
|
||||
var size = Marshal.SizeOf(type);
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
using (var writer = new BinaryWriter(stream))
|
||||
writer.Write(value);
|
||||
mutex.ReleaseMutex();
|
||||
return true;
|
||||
}
|
||||
|
||||
//public bool Write<T>(int address, T value)
|
||||
//{
|
||||
// if (checktype(value.GetType()) == false) return false;
|
||||
// if (MutexWaitOne(3000) == false) return false;
|
||||
// var size = Marshal.SizeOf(typeof(T));
|
||||
// using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
// {
|
||||
// using (var reader = new BinaryWriter(stream))
|
||||
// {
|
||||
// var a = (byte[])Convert.ChangeType(value, typeof(byte[]));
|
||||
// reader.Write(a, 0, a.Length);
|
||||
// }
|
||||
// }
|
||||
// mutex.ReleaseMutex();
|
||||
// return true;
|
||||
//}
|
||||
#endregion
|
||||
#region "READ"
|
||||
public bool ReadSingle(int address, out Single value)
|
||||
{
|
||||
value = 0;
|
||||
if (Init == false) return false;
|
||||
var retval = true;
|
||||
var type = value.GetType();
|
||||
if (MutexWaitOne(ReadTime) == false) return false;
|
||||
var size = 1;
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
{
|
||||
using (var reader = new BinaryReader(stream))
|
||||
{
|
||||
byte[] buffer = new byte[size];
|
||||
reader.Read(buffer, 0, size);
|
||||
value = BitConverter.ToSingle(buffer, 0);
|
||||
}
|
||||
}
|
||||
mutex.ReleaseMutex();
|
||||
return retval;
|
||||
}
|
||||
public bool ReadDouble(int address, out double value)
|
||||
{
|
||||
var retval = true;
|
||||
value = 0;
|
||||
if (Init == false) return false;
|
||||
var type = value.GetType();
|
||||
if (MutexWaitOne(ReadTime) == false) return false;
|
||||
var size = 1;
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
{
|
||||
using (var reader = new BinaryReader(stream))
|
||||
{
|
||||
byte[] buffer = new byte[size];
|
||||
reader.Read(buffer, 0, size);
|
||||
value = BitConverter.ToDouble(buffer, 0);
|
||||
}
|
||||
}
|
||||
mutex.ReleaseMutex();
|
||||
return retval;
|
||||
}
|
||||
public bool ReadBytes(int address, int size, out byte[] value)
|
||||
{
|
||||
var retval = true;
|
||||
value = new byte[size];
|
||||
if (Init == false) return false;
|
||||
var type = value.GetType();
|
||||
if (MutexWaitOne(ReadTime) == false) return false;
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
{
|
||||
using (var reader = new BinaryReader(stream))
|
||||
{
|
||||
reader.Read(value, 0, size);
|
||||
}
|
||||
}
|
||||
mutex.ReleaseMutex();
|
||||
return retval;
|
||||
}
|
||||
public bool ReadByte(int address, out byte value)
|
||||
{
|
||||
var retval = true;
|
||||
value = 0;
|
||||
if (Init == false) return false;
|
||||
var type = value.GetType();
|
||||
if (MutexWaitOne(ReadTime) == false) return false;
|
||||
var size = 1;
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
{
|
||||
using (var reader = new BinaryReader(stream))
|
||||
{
|
||||
byte[] buffer = new byte[size];
|
||||
reader.Read(buffer, 0, size);
|
||||
value = buffer.First();
|
||||
}
|
||||
}
|
||||
mutex.ReleaseMutex();
|
||||
return retval;
|
||||
}
|
||||
public bool ReadInt16(int address, out Int16 value)
|
||||
{
|
||||
var retval = true;
|
||||
value = 0;
|
||||
if (Init == false) return false;
|
||||
var type = value.GetType();
|
||||
if (MutexWaitOne(ReadTime) == false) return false;
|
||||
var size = 4;
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
{
|
||||
using (var reader = new BinaryReader(stream))
|
||||
{
|
||||
byte[] buffer = new byte[size];
|
||||
reader.Read(buffer, 0, size);
|
||||
value = BitConverter.ToInt16(buffer, 0);
|
||||
}
|
||||
}
|
||||
mutex.ReleaseMutex();
|
||||
return retval;
|
||||
}
|
||||
public bool ReadInt32(int address, out Int32 value)
|
||||
{
|
||||
var retval = true;
|
||||
value = 0;
|
||||
if (Init == false) return false;
|
||||
var type = value.GetType();
|
||||
if (MutexWaitOne(ReadTime) == false) return false;
|
||||
var size = 4;
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
{
|
||||
using (var reader = new BinaryReader(stream))
|
||||
{
|
||||
byte[] buffer = new byte[size];
|
||||
reader.Read(buffer, 0, size);
|
||||
value = BitConverter.ToInt32(buffer, 0);
|
||||
}
|
||||
}
|
||||
mutex.ReleaseMutex();
|
||||
return retval;
|
||||
}
|
||||
public bool ReadInt64(int address, out Int64 value)
|
||||
{
|
||||
var retval = true;
|
||||
value = 0;
|
||||
if (Init == false) return false;
|
||||
var type = value.GetType();
|
||||
if (MutexWaitOne(ReadTime) == false) return false;
|
||||
var size = 4;
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
{
|
||||
using (var reader = new BinaryReader(stream))
|
||||
{
|
||||
byte[] buffer = new byte[size];
|
||||
reader.Read(buffer, 0, size);
|
||||
value = BitConverter.ToInt64(buffer, 0);
|
||||
}
|
||||
}
|
||||
mutex.ReleaseMutex();
|
||||
return retval;
|
||||
}
|
||||
public bool ReadUInt16(int address, out UInt16 value)
|
||||
{
|
||||
var retval = true;
|
||||
value = 0;
|
||||
if (Init == false) return false;
|
||||
var type = value.GetType();
|
||||
if (MutexWaitOne(ReadTime) == false) return false;
|
||||
var size = 4;
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
{
|
||||
using (var reader = new BinaryReader(stream))
|
||||
{
|
||||
byte[] buffer = new byte[size];
|
||||
reader.Read(buffer, 0, size);
|
||||
value = BitConverter.ToUInt16(buffer, 0);
|
||||
}
|
||||
}
|
||||
mutex.ReleaseMutex();
|
||||
return retval;
|
||||
}
|
||||
public bool ReadUInt32(int address, out UInt32 value)
|
||||
{
|
||||
var retval = true;
|
||||
value = 0;
|
||||
if (Init == false) return false;
|
||||
var type = value.GetType();
|
||||
if (MutexWaitOne(ReadTime) == false) return false;
|
||||
var size = 4;
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
{
|
||||
using (var reader = new BinaryReader(stream))
|
||||
{
|
||||
byte[] buffer = new byte[size];
|
||||
reader.Read(buffer, 0, size);
|
||||
value = BitConverter.ToUInt32(buffer, 0);
|
||||
}
|
||||
}
|
||||
mutex.ReleaseMutex();
|
||||
return retval;
|
||||
}
|
||||
public bool ReadUInt64(int address, out UInt64 value)
|
||||
{
|
||||
var retval = true;
|
||||
value = 0;
|
||||
if (Init == false) return false;
|
||||
var type = value.GetType();
|
||||
if (MutexWaitOne(ReadTime) == false) return false;
|
||||
var size = 4;
|
||||
using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
{
|
||||
using (var reader = new BinaryReader(stream))
|
||||
{
|
||||
byte[] buffer = new byte[size];
|
||||
reader.Read(buffer, 0, size);
|
||||
value = BitConverter.ToUInt64(buffer, 0);
|
||||
}
|
||||
}
|
||||
mutex.ReleaseMutex();
|
||||
return retval;
|
||||
}
|
||||
|
||||
//public bool Read<T>(int address, out T value) where T : IConvertible
|
||||
//{
|
||||
// var retval = true;
|
||||
// value = default(T);
|
||||
// var type = value.GetType();
|
||||
// if (checktype(type) == false) return false;
|
||||
|
||||
// if (MutexWaitOne(3000) == false) return false;
|
||||
// var size = Marshal.SizeOf(typeof(T));
|
||||
// using (MemoryMappedViewStream stream = mmf.CreateViewStream(address, size))
|
||||
// {
|
||||
// using (var reader = new BinaryReader(stream))
|
||||
// {
|
||||
// byte[] buffer = new byte[size];
|
||||
// reader.Read(buffer, 0, size);
|
||||
// if (type == typeof(Int32))
|
||||
// value = (T)Convert.ChangeType(BitConverter.ToInt32(buffer, 0), typeof(T));
|
||||
// else if (type == typeof(UInt32))
|
||||
// value = (T)Convert.ChangeType(BitConverter.ToUInt32(buffer, 0), typeof(T));
|
||||
// else if (type == typeof(Int16))
|
||||
// value = (T)Convert.ChangeType(BitConverter.ToInt16(buffer, 0), typeof(T));
|
||||
// else if (type == typeof(UInt16))
|
||||
// value = (T)Convert.ChangeType(BitConverter.ToUInt16(buffer, 0), typeof(T));
|
||||
// else if (type == typeof(byte))
|
||||
// value = (T)Convert.ChangeType(buffer[0], typeof(T));
|
||||
// else if (type == typeof(string))
|
||||
// value = (T)Convert.ChangeType(System.Text.Encoding.Default.GetString(buffer), typeof(T));
|
||||
// else retval = false;
|
||||
// }
|
||||
// }
|
||||
// mutex.ReleaseMutex();
|
||||
// return retval;
|
||||
//}
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 지정한 타입이 호환되는 타입인가?
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
//bool checktype(Type value)
|
||||
//{
|
||||
// if (value == typeof(Int32)) return true;
|
||||
// else if (value == typeof(UInt32)) return true;
|
||||
// else if (value == typeof(Int16)) return true;
|
||||
// else if (value == typeof(UInt16)) return true;
|
||||
// else if (value == typeof(byte)) return true;
|
||||
// else if (value == typeof(string)) return true;
|
||||
// else return false;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
45
Handler/Sub/MemoryMapCore/MemoryMap.txt
Normal file
45
Handler/Sub/MemoryMapCore/MemoryMap.txt
Normal file
@@ -0,0 +1,45 @@
|
||||
IO
|
||||
|
||||
01:VERSION(0~255)
|
||||
10:DEVICE_ID
|
||||
01:DICount(0~255)
|
||||
01:DOCount(0~255)
|
||||
---------------------12byte-----------
|
||||
##Command Area
|
||||
02:Command Device
|
||||
02:Command Code
|
||||
04:Command Value
|
||||
---------------------20byte-----------
|
||||
01:Status
|
||||
0 : init(<28>ʱ<EFBFBD>ȭ<EFBFBD><C8AD><EFBFBD><EFBFBD>)
|
||||
1 : error
|
||||
|
||||
02:StatusCode(-32767~32767)
|
||||
32:DIValue (dicount<6E><74> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> dicount/8)
|
||||
32:DOValue (docount<6E><74> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> docount/8)
|
||||
---------------------87byte-----------
|
||||
|
||||
|
||||
MOT
|
||||
01:VERSION(0~255)
|
||||
10:DEVICE_ID
|
||||
01:Axis Count(0~255)
|
||||
---------------------12byte----------------
|
||||
02:Status
|
||||
0 : init(<28>ʱ<EFBFBD>ȭ<EFBFBD><C8AD><EFBFBD><EFBFBD>)
|
||||
1 : error
|
||||
|
||||
02:StatusCode(-32767~32767)
|
||||
---------------------16byte----------------
|
||||
<EFBFBD>ະ<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><>ȯ<EFBFBD>ȴ<EFBFBD>. <20><>10byte<74><65> <20><><EFBFBD><EFBFBD> <20><>
|
||||
01:Axis No
|
||||
01:Axist Status
|
||||
0 : Servo On
|
||||
1 : Inposition
|
||||
2 : N-Limit
|
||||
3 : P-Limit
|
||||
4 : Origin Sensor
|
||||
5 : HomeSet
|
||||
7 : Emergency
|
||||
04:Current Position
|
||||
04:Command Position
|
||||
52
Handler/Sub/MemoryMapCore/MemoryMapCore.csproj
Normal file
52
Handler/Sub/MemoryMapCore/MemoryMapCore.csproj
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{140AF52A-5986-4413-BF02-8EA55A61891B}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MemoryMapCore</RootNamespace>
|
||||
<AssemblyName>MemoryMapCore</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Client.cs" />
|
||||
<Compile Include="Core.cs" />
|
||||
<Compile Include="Server.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
36
Handler/Sub/MemoryMapCore/Properties/AssemblyInfo.cs
Normal file
36
Handler/Sub/MemoryMapCore/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
|
||||
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이러한 특성 값을 변경하세요.
|
||||
[assembly: AssemblyTitle("MemoryMapCore")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MemoryMapCore")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("140af52a-5986-4413-bf02-8ea55a61891b")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
|
||||
// 기본값으로 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
40
Handler/Sub/MemoryMapCore/Server.cs
Normal file
40
Handler/Sub/MemoryMapCore/Server.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.CodeDom;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.MemoryMappedFiles;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace AR.MemoryMap
|
||||
{
|
||||
public class Server : Core
|
||||
{
|
||||
public Server(string MapFileName, int MapFileSize, int loopDelay = 50) : base(MapFileName, MapFileSize, loopDelay)
|
||||
{
|
||||
StartAction = () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var MapFileSync = $"{MapFileName}{MapFileSize}";
|
||||
mmf = MemoryMappedFile.CreateOrOpen(MapFileName, MapFileSize);
|
||||
mutex = new Mutex(false, MapFileSync, out mutexCreated);
|
||||
ErrorMessage = string.Empty;
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorMessage = ex.Message;
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
StopAction = () =>
|
||||
{
|
||||
ErrorMessage = string.Empty;
|
||||
brun = false;
|
||||
return true;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,14 +138,17 @@ namespace AR
|
||||
|
||||
#endregion
|
||||
|
||||
[Category("WMS")]
|
||||
public bool WMS_DB_PROD { get; set; }
|
||||
[Category("WMS")]
|
||||
public string WMS_PROGRAM_ID { get; set; }
|
||||
[Category("WMS")]
|
||||
public string WMS_CENTER_CD { get; set; }
|
||||
[Category("WMS")]
|
||||
public string WMS_REG_USERID { get; set; }
|
||||
|
||||
#region "Advanced Parameter"
|
||||
|
||||
[Category("Advanced Parameter"), DisplayName("ECS 자료조회 비활성"), Description("ECS 자료조회를 비활성화 합니다.\n기존 장비정보에 해당하는 자료를 사용합니다")]
|
||||
public bool ECSSkip { get; set; }
|
||||
|
||||
|
||||
[Category("Advanced Parameter")]
|
||||
public bool InboundWebService_RID_DupSKIP { get; set; }
|
||||
|
||||
|
||||
[Category("Advanced Parameter"), DisplayName("Remote Contoller Port"), Description("디버그 포트 정보(시리얼통신), 입력 예) COM1:9600"), Editor(typeof(MyUITypeEditor), typeof(UITypeEditor))]
|
||||
public string Serial_Remocon { get; set; }
|
||||
@@ -512,6 +515,9 @@ namespace AR
|
||||
|
||||
public override void AfterLoad()
|
||||
{
|
||||
if (WMS_CENTER_CD.isEmpty()) WMS_CENTER_CD = "V1";
|
||||
if (WMS_PROGRAM_ID.isEmpty()) WMS_PROGRAM_ID = "LABEL ATTACH";
|
||||
if (WMS_REG_USERID.isEmpty()) WMS_REG_USERID = "ATVLA1";
|
||||
|
||||
if (WebAPI_R1.isEmpty()) WebAPI_R1 = "http://10.131.32.31:9001";
|
||||
if (WebAPI_R2.isEmpty()) WebAPI_R2 = "http://10.131.32.24:9001";
|
||||
|
||||
@@ -25,10 +25,6 @@ namespace AR
|
||||
User.Save();
|
||||
}
|
||||
|
||||
public static bool isEmpty(this string data)
|
||||
{
|
||||
return string.IsNullOrEmpty(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="arCommUtil, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\DLL\arCommUtil.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ArSetting.Net4">
|
||||
<HintPath>..\..\DLL\ArSetting.Net4.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -53,15 +57,5 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SETTING.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\arCtl\arControl.csproj">
|
||||
<Project>{f31c242c-1b15-4518-9733-48558499fe4b}</Project>
|
||||
<Name>arControl</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\CommUtil\arCommUtil.csproj">
|
||||
<Project>{14e8c9a5-013e-49ba-b435-ffffff7dd623}</Project>
|
||||
<Name>arCommUtil</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Submodule Handler/Sub/arAzinAxt updated: e14c9dd159...34b3996759
Submodule Handler/Sub/arCtl deleted from 249154147d
@@ -87,12 +87,6 @@
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\arCtl\arControl.csproj">
|
||||
<Project>{f31c242c-1b15-4518-9733-48558499fe4b}</Project>
|
||||
<Name>arControl</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
Submodule Handler/Sub/arMCFrame deleted from a398dc0ae4
Submodule Handler/Sub/arRS232 deleted from e9b6a0a0d1
Submodule Handler/Sub/tcpservice deleted from d7fe2baa0e
Reference in New Issue
Block a user