arMaskterK 프로젝트를 vms2016_cs 레포에서 현 레포로 이동
This commit is contained in:
		
							
								
								
									
										236
									
								
								Sub/arMasterK/Project/EnumAStruct.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										236
									
								
								Sub/arMasterK/Project/EnumAStruct.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,236 @@ | ||||
| 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 | ||||
|     { | ||||
|  | ||||
|  | ||||
|         [Description("")] | ||||
|         public enum eMsgType | ||||
|         { | ||||
|             [Description("")] | ||||
|             Rx = 0, | ||||
|             [Description("")] | ||||
|             Tx, | ||||
|             RxRaw, | ||||
|         } | ||||
|  | ||||
|         [Description("Operation Code , 이 코드값으로 컨트롤 보드에 명령합니다.")] | ||||
|         public enum eOpCode : byte | ||||
|         { | ||||
|             GET_IO_DATA = 0, | ||||
|             RELAY_OUTPUT, | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// digital input/output direction | ||||
|         /// </summary> | ||||
|         public enum eIOPINDIR : byte | ||||
|         { | ||||
|             [Description("Digital Input")] | ||||
|             INPUT = 0, | ||||
|             [Description("Digital Output")] | ||||
|             OUTPUT = 1, | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// error code list  | ||||
|         /// </summary> | ||||
|         public enum eErrorCode : byte | ||||
|         { | ||||
|             [Description("포트가사용중입니다.")] | ||||
|             PortBusy = 0, | ||||
|             [Description("열려있지않습니다.")] | ||||
|             NotOpen, | ||||
|             [Description("쓰기오류")] | ||||
|             WriteError, | ||||
|             [Description("읽기오류")] | ||||
|             ReadError, | ||||
|             [Description("프레임오류")] | ||||
|             FrameError, | ||||
|             [Description("체크섬오류")] | ||||
|             ChecksumError | ||||
|         } | ||||
|  | ||||
|  | ||||
|         /// <summary> | ||||
|         /// message frame | ||||
|         /// </summary> | ||||
|         public struct sRecvMessage | ||||
|         { | ||||
|             /// <summary> | ||||
|             /// 국번 | ||||
|             /// </summary> | ||||
|             public string Device; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// 명령어 | ||||
|             /// </summary> | ||||
|             public char Command; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// 명령어타입 | ||||
|             /// </summary> | ||||
|             public string CmdType; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// 블록수 | ||||
|             /// </summary> | ||||
|             public int BlockCount; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// 데이터갯수 | ||||
|             /// </summary> | ||||
|             public int DataLen; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// 데이터 | ||||
|             /// </summary> | ||||
|             public string Data; | ||||
|  | ||||
|  | ||||
|             public string FullString; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// full message frame | ||||
|             /// </summary> | ||||
|             [Description("전체 메세지 영역")] | ||||
|             public byte[] Buffer; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// check byte (crc16) | ||||
|             /// </summary> | ||||
|             [Description("체크섬 2byte(CRC 16)")] | ||||
|             public byte[] checksum; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// checksum error | ||||
|             /// </summary> | ||||
|             [Description("체크섬에 오류가 있는지 확인합니다.(true일경우 오류)")] | ||||
|             public Boolean isCSError; | ||||
|  | ||||
|             [Description("기타메세지")] | ||||
|             public string Message; | ||||
|  | ||||
|             [Description("정보를 삭제합니다.")] | ||||
|             public void Clear() | ||||
|             { | ||||
|                 Message = "NOTSET"; | ||||
|                 Data = null; | ||||
|                 Buffer = null; | ||||
|                 checksum = null; | ||||
|                 isCSError = false; | ||||
|                 BlockCount = 0; | ||||
|                 DataLen = 0; | ||||
|                 FullString = string.Empty; | ||||
|             } | ||||
|  | ||||
|             [Description("응답코드가 NAK인지확인합니다. NAK응답은 컨트롤러로부터 오류가 수신되었음을 의미합니다.")] | ||||
|             public Boolean isNAK | ||||
|             { | ||||
|                 get | ||||
|                 { | ||||
|                     if (Buffer[0] == 0x15) return true; | ||||
|                     else return false; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             [Description("오류가 있는지 체크합니다. 버퍼가 없거나 체크섬 오류 ,  DLC오류등을 체크 합니다.")] | ||||
|             public Boolean isError | ||||
|             { | ||||
|                 get | ||||
|                 { | ||||
|                     if (Buffer == null || isCSError || BlockCount == 0 || isNAK) return true; | ||||
|                     else return false; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         public struct sSendMessage | ||||
|         { | ||||
|             /// <summary> | ||||
|             /// 국번 | ||||
|             /// </summary> | ||||
|             public string Device; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// 명령어 | ||||
|             /// </summary> | ||||
|             public char Command; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// 명령어타입 | ||||
|             /// </summary> | ||||
|             public string CmdType; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// 변수길이 | ||||
|             /// </summary> | ||||
|             public int DeviceLength; | ||||
|  | ||||
|             public int NumberofBlock; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// 변수명 | ||||
|             /// </summary> | ||||
|             public string VarName; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// 데이터갯수 | ||||
|             /// </summary> | ||||
|             public int DataLen; | ||||
|             public string Data; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// full message frame | ||||
|             /// </summary> | ||||
|             [Description("전체 메세지 영역")] | ||||
|             public byte[] Buffer; | ||||
|             public string Strbuffer; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// check byte (crc16) | ||||
|             /// </summary> | ||||
|             [Description("체크섬 2byte(CRC 16)")] | ||||
|             public byte[] checksum; | ||||
|  | ||||
|             /// <summary> | ||||
|             /// checksum error | ||||
|             /// </summary> | ||||
|             [Description("체크섬에 오류가 있는지 확인합니다.(true일경우 오류)")] | ||||
|             public Boolean isCSError; | ||||
|  | ||||
|             [Description("기타메세지")] | ||||
|             public string Message; | ||||
|  | ||||
|             [Description("정보를 삭제합니다.")] | ||||
|             public void Clear() | ||||
|             { | ||||
|                 Data = string.Empty; | ||||
|                 Message = "NOTSET"; | ||||
|                 Buffer = null; | ||||
|                 checksum = null; | ||||
|                 isCSError = false; | ||||
|                 DeviceLength = 0; | ||||
|                 NumberofBlock = 0; | ||||
|                 DataLen = 0; | ||||
|                 Strbuffer = string.Empty; | ||||
|             } | ||||
|  | ||||
|             [Description("오류가 있는지 체크합니다. 버퍼가 없거나 체크섬 오류 ,  DLC오류등을 체크 합니다.")] | ||||
|             public Boolean isError | ||||
|             { | ||||
|                 get | ||||
|                 { | ||||
|                     if (Buffer == null || isCSError || DeviceLength == 0) return true; | ||||
|                     else return false; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Arin(asus)
					Arin(asus)