132 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			132 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.ComponentModel;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Threading.Tasks;
 | |
| 
 | |
| namespace arDev
 | |
| {
 | |
|     public  partial class MasterK
 | |
|     {
 | |
|         public class DataEventArgs : EventArgs
 | |
|         {
 | |
|             private byte[] _buffer = null;
 | |
| 
 | |
|             /// <summary>
 | |
|             /// 바이트배열의 버퍼값
 | |
|             /// </summary>
 | |
|             public byte[] Value { get { return _buffer; } }
 | |
| 
 | |
|             public eMsgType Direction { get; set; }
 | |
| 
 | |
|             /// <summary>
 | |
|             /// 버퍼(바이트배열)의 데이터를 문자로 반환합니다.
 | |
|             /// </summary>
 | |
|             public string StrValue
 | |
|             {
 | |
|                 get
 | |
|                 {
 | |
|                     if (_buffer == null || _buffer.Length < 1) return string.Empty;
 | |
|                     return System.Text.Encoding.Default.GetString(_buffer);
 | |
|                 }
 | |
|             }
 | |
|             public DataEventArgs(eMsgType dir_, byte[] buffer)
 | |
|             {
 | |
|                 _buffer = buffer;
 | |
|                 Direction = dir_;
 | |
|             }
 | |
|         }
 | |
|         public class MessageEventArgs : EventArgs
 | |
|         {
 | |
|             protected Boolean _isError = false;
 | |
|             public Boolean IsError { get { return _isError; } }
 | |
|             protected string _message = string.Empty;
 | |
|             public string Message { get { return _message; } }
 | |
|             public MessageEventArgs(Boolean isError, string Message)
 | |
|             {
 | |
|                 _isError = isError;
 | |
|                 _message = Message;
 | |
|             }
 | |
|         }
 | |
|         public class FrameEventArgs : EventArgs
 | |
|         {
 | |
|             public eOpCode OpCode { get; set; }
 | |
|             public FrameEventArgs(eOpCode opCode_)
 | |
|             {
 | |
|                 OpCode = opCode_;
 | |
|             }
 | |
|         }
 | |
|         public class IOValueEventArgs : EventArgs
 | |
|         {
 | |
|             protected eIOPINDIR _direction;
 | |
|             protected int _arridx;
 | |
|             protected Boolean _oldvalue;
 | |
|             protected Boolean _newvalue;
 | |
| 
 | |
|             public eIOPINDIR Direction { get { return _direction; } }
 | |
|             public int ArrIDX { get { return _arridx; } }
 | |
|             public Boolean OldValue { get { return _oldvalue; } }
 | |
|             public Boolean NewValue { get { return _newvalue; } }
 | |
| 
 | |
|             public IOValueEventArgs(eIOPINDIR dir, int arridx, Boolean oldvalue, Boolean newvalue)
 | |
|             {
 | |
|                 _direction = dir;
 | |
|                 _arridx = arridx;
 | |
|                 _oldvalue = oldvalue;
 | |
|                 _newvalue = newvalue;
 | |
|             }
 | |
|         }
 | |
|         public class AIValueEventArgs : EventArgs
 | |
|         {
 | |
|             public float[] Value { get; protected set; }
 | |
| 
 | |
|             public AIValueEventArgs(float[] value_)
 | |
|             {
 | |
|                 Value = value_;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         #region "Events"
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 일반적인 메세지 혹은 오류메세지 이벤트
 | |
|         /// </summary>
 | |
|         public event EventHandler<MessageEventArgs> Message;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 데이터메시이벤트 (Rx,Tx) 별로 구분됩니다.
 | |
|         /// </summary>
 | |
|         public event EventHandler<DataEventArgs> DataMessage;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 가공되어진 최종 메세지 형태값을 가지고 있습니다.
 | |
|         /// </summary>
 | |
|         public event EventHandler<FrameEventArgs> ReceiveFrame;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// ReadProcess에의해서 감시되며 포트의 상태값이 바뀐다면 발생함
 | |
|         /// </summary>
 | |
|         public event EventHandler<IOValueEventArgs> IOValueChanged;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// AI의 값을 이벤트로 발생합니다.발생주기는 AIInterval을 참고합니다.
 | |
|         /// </summary>
 | |
|         public event EventHandler<AIValueEventArgs> AIValueChanged;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 오류발생시 메세지가 발생함
 | |
|         /// </summary>
 | |
|         public event EventHandler<MessageEventArgs> IOErrorMessage;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// anlog 관련한 오류 메세지
 | |
|         /// </summary>
 | |
|         /// <remarks>Analog Data Error Message</remarks>
 | |
|         public event EventHandler<MessageEventArgs> AIErrorMessage;
 | |
| 
 | |
|         #endregion
 | |
| 
 | |
|     }
 | |
| }
 | 
