XCom v2.x Install Manual

Similar documents
금오공대 컴퓨터공학전공 강의자료

Poison null byte Excuse the ads! We need some help to keep our site up. List 1 Conditions 2 Exploit plan 2.1 chunksize(p)!= prev_size (next_chunk(p) 3

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D>

chap 5: Trees

PowerPoint Template

C# Programming Guide - Types

Microsoft PowerPoint - chap06-2pointer.ppt

Microsoft PowerPoint - ch07 - 포인터 pm0415

K&R2 Reference Manual 번역본

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt



슬라이드 1

목차 BUG offline replicator 에서유효하지않은로그를읽을경우비정상종료할수있다... 3 BUG 각 partition 이서로다른 tablespace 를가지고, column type 이 CLOB 이며, 해당 table 을 truncate

PowerPoint 프레젠테이션

1 1. INTRODUCTION 2 2. DOWNLOAD Windows Desktop & Server Max OS X, Linux, Windows CE 2 3. API REFERENCE CAN_OpenVcp CAN_Op

PowerPoint Presentation

SRC PLUS 제어기 MANUAL

UI TASK & KEY EVENT

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx

02 C h a p t e r Java

PowerPoint 프레젠테이션

11장 포인터

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770>

다른 JSP 페이지호출 forward() 메서드 - 하나의 JSP 페이지실행이끝나고다른 JSP 페이지를호출할때사용한다. 예 ) <% RequestDispatcher dispatcher = request.getrequestdispatcher(" 실행할페이지.jsp");

Microsoft PowerPoint - chap03-변수와데이터형.pptx

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi

Microsoft PowerPoint 자바-기본문법(Ch2).pptx

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070>

XCom v2.x User's Manual

JAVA 프로그래밍실습 실습 1) 실습목표 - 메소드개념이해하기 - 매개변수이해하기 - 새메소드만들기 - Math 클래스의기존메소드이용하기 ( ) 문제 - 직사각형모양의땅이있다. 이땅의둘레, 면적과대각

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과

Microsoft PowerPoint - C프로그래밍-chap03.ppt [호환 모드]

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

API STORE 키발급및 API 사용가이드 Document Information 문서명 : API STORE 언어별 Client 사용가이드작성자 : 작성일 : 업무영역 : 버전 : 1 st Draft. 서브시스템 : 문서번호 : 단계 : Docum

<4D F736F F F696E74202D20BBB7BBB7C7D15F FBEDFB0A3B1B3C0B05FC1A638C0CFC2F72E BC8A3C8AF20B8F0B5E55D>

Tcl의 문법

The Pocket Guide to TCP/IP Sockets: C Version

03_queue

슬라이드 1

API 매뉴얼

UI TASK & KEY EVENT

일반적인 네트워크의 구성은 다음과 같다

Chapter #01 Subject

PowerPoint 프레젠테이션

Microsoft Word - ASG AT90CAN128 모듈.doc

XCOM v2

adfasdfasfdasfasfadf

PowerPoint Presentation

Microsoft PowerPoint - Chapter_04.pptx

Microsoft PowerPoint 웹 연동 기술.pptx

PowerPoint 프레젠테이션

목차 BUG 문법에맞지않는질의문수행시, 에러메시지에질의문의일부만보여주는문제를수정합니다... 3 BUG ROUND, TRUNC 함수에서 DATE 포맷 IW 를추가지원합니다... 5 BUG ROLLUP/CUBE 절을포함하는질의는 SUBQUE

T100MD+

Design Issues

Microsoft PowerPoint - Java7.pptx

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100

0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x = (12 + 6) / 2 * 3; x = 27 x = 3 * (8 / 4

쉽게

untitled

슬라이드 1

4. #include <stdio.h> #include <stdlib.h> int main() { functiona(); } void functiona() { printf("hihi\n"); } warning: conflicting types for functiona

금오공대 컴퓨터공학전공 강의자료

게시판 스팸 실시간 차단 시스템

학습목차 2.1 다차원배열이란 차원배열의주소와값의참조

Microsoft PowerPoint - additional01.ppt [호환 모드]

untitled

1장. 유닉스 시스템 프로그래밍 개요

목차 BUG DEQUEUE 의 WAIT TIME 이 1 초미만인경우, 설정한시간만큼대기하지않는문제가있습니다... 3 BUG [qp-select-pvo] group by 표현식에있는컬럼을참조하는집합연산이존재하지않으면결괏값오류가발생할수있습니다... 4

A Dynamic Grid Services Deployment Mechanism for On-Demand Resource Provisioning

Microsoft PowerPoint - chap06-1Array.ppt

Microsoft Word - Armjtag_문서1.doc

PowerPoint Presentation

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어

강의 개요

UI TASK & KEY EVENT

Frama-C/JESSIS 사용법 소개

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074>

(SW3704) Gingerbread Source Build & Working Guide

<4D F736F F F696E74202D20B8B6C0CCC5A9B7CEC7C1B7CEBCBCBCAD202839C1D6C2F7207E203135C1D6C2F >

API - Notification 메크로를통하여어느특정상황이되었을때 SolidWorks 및보낸경로를통하여알림메시지를보낼수있습니다. 이번기술자료에서는메크로에서이벤트처리기를통하여진행할예정이며, 메크로에서작업을수행하는데유용할것입니다. 알림이벤트핸들러는응용프로그램구현하는데있어

PowerPoint 프레젠테이션

Microsoft PowerPoint - chap13-입출력라이브러리.pptx

untitled

6주차.key

C++ Programming

PowerPoint Presentation

歯처리.PDF

USB2CAN USB2CAN-UART USB2CAN-FIFO API Reference Manual Copyright NTREXLAB

서현수

ISP and CodeVisionAVR C Compiler.hwp

쉽게 풀어쓴 C 프로그래밍

0. 들어가기 전

<4D F736F F F696E74202D20C1A63038C0E520C5ACB7A1BDBABFCD20B0B4C3BC4928B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

학습목표 함수프로시저, 서브프로시저의의미를안다. 매개변수전달방식을학습한다. 함수를이용한프로그래밍한다. 2

bn2019_2

Microsoft PowerPoint 세션.ppt

1217 WebTrafMon II

OCW_C언어 기초

PowerPoint Presentation

Transcription:

Linkgenesis Co., Ltd. ( 주 ) 링크제니시스 XCom v2.0 ActiveX Control C# Manual XCom SECS Driver v2.x ActiveX Control C# Manual Document v2.1.1k

목차 C# 개발자를위한 XCOM 사용법 1... 1 XCOM 사용요약... 1 XCom.Net Framework Library 설치... 1 Property 요약... 1 Method 요약... 1 Event 요약... 4 PROPERTY 상세설명... 5 short DeviceID;... 5 short Stream;... 5 short ;... 5 int SystemBytes;... 5 short Wbit;... 6 int HeaderSize;... 6 int MsgSize... 6 METHOD 상세설명... 6 short Initialize(string scfgfile );... 7 short Close();... 7 short Start();... 8 short Stop();... 9 short EnableLog( short nlogtype, short nenabled );... 9 string GetParam(string paramtername );... 10 short SetParam(string parametername, string parameter );... 11 short MakeSecsMsg(out int lmsgid, short ndevid, short nstrm, short nfunc, int lsysbyte );... 12 short MakeSecsMsg(out int lmsgid, int ndevid, int nstrm, int nfunc, int lsysbyte );... 12 short SetWBit( int lmsgid, short nwbit );... 13 short Send( int lmsgid );... 14 short SetListItem( int lmsgid, short nitems );... 14 short SetListItem( int lmsgid, int nitems );... 14 short SetBinaryItem(int lmsgid, byte[] pn);... 15 short SetBinaryItem(int lmsgid, byte b);... 15 short SetBoolItem(int lmsgid, bool[] pn);... 16 short SetBoolItem(int lmsgid, bool b);... 16 short SetAsciiFillSpace( short nval);... 16 short SetAsciiItem( int lmsgid, string sz, long lcount );... 17 short SetAsciiItem( int lmsgid, string sz);... 17 short SetJis8Item( int lmsgid, string sz, long lcount );... 18 short SetJis8Item( int lmsgid, string sz);... 18 short SetStringItem( int lmsgid, string sz);... 19 short SetI1Item( int lmsgid, byte[] n);... 19 short SetI1Item( int lmsgid, byte n);... 19 short SetI2Item( int lmsgid, short[] n);... 20 short SetI2Item( int lmsgid, short n);... 20 short SetI4Item( int lmsgid, int[] n );... 21 I

short SetI4Item( int lmsgid, int n );... 21 short SetI8Item( int lmsgid, int[] n );... 21 short SetI8Item( int lmsgid, int n );... 21 short SetU1Item( int lmsgid, byte[] n );... 22 short SetU1Item( int lmsgid, byte n );... 22 short SetU2Item( int lmsgid, int[] l );... 23 short SetU2Item( int lmsgid, int l );... 23 short SetU4Item( int lmsgid, long[] n );... 24 short SetU4Item( int lmsgid, long n );... 24 short SetU8Item( int lmsgid, long[] n );... 24 short SetU8Item( int lmsgid, long n );... 24 short SetF4Item( int lmsgid, float[] f);... 25 short SetF4Item( int lmsgid, float f);... 25 short SetF8Item( long lmsgid, double[] r );... 26 short SetF8Item( long lmsgid, double r );... 26 int GetSysBytes( int lmsgid );... 27 short LoadSecsMsg(out int lmsgid, out short ndevid, out short nstrm, out short pnfunc, out int lsysbyte, out short pnwbit );... 27 void CloseSecsMsg( int lmsgid );... 28 short GetListItem( int lmsgid, out short pnitems );... 28 short GetBinaryItem( int lmsgid, out byte[] pn);... 29 short GetBoolItem(int lmsgid, out bool[] pn );... 30 short GetJis8Item( int lmsgid, out string s, out int lcount );... 30 string GetStringItem( long lmsgid, out int lcount );... 31 short GetI1Item( int lmsgid, out byte[] pn );... 32 short GetI2Item( int lmsgid, out short[] pn);... 32 short GetI4Item( int lmsgid, out int[] pl);... 33 short GetI8Item( int lmsgid, int[] pl);... 34 short GetU1Item( int lmsgid, out byte[] pn );... 35 short GetU2Item( int lmsgid, out int[] pl );... 35 short GetU4Item( int lmsgid, out long[] pn );... 36 short GetU8Item( int lmsgid, out long[] pn );... 37 short GetF4Item( int lmsgid, out float[] pf );... 38 short GetF8Item( long lmsgid, double[] pr );... 38 short GetCurrentItemType( int lmsgid );... 39 short GetCurrentItemCount( int lmsgid );... 40 short GetHeaderBytes( int lmsgid, out byte[] pnheader );... 40 int GetMsgBytes( int lmsgid, out byte[] pnmsg );... 41 short SetHeaderBytes( int lmsgid, byte[] pnheader );... 41 int SetMsgBytes( int lmsgid, byte[] pnmsg );... 42 short MakeSpoolStream( int lmsgid );... 42 short ProcExternalStream( byte[] pnmsg );... 43 short GetAlarmMsgInfo (out int lmsgid, out short ndevid, out short nstrm, out short pnfunc, out int lsysbyte, out short pnwbit );... 44 short GetInvalidMsgInfo (out int lmsgid, out short ndevid, out short nstrm, out short pnfunc, out int lsysbyte, out short pnwbit );... 45 EVENT 상세설명... 46 SecsMsg Event... 46 II

SecsEvent Event... 47 SAMPLE CODES... 47 XCom 초기화... 47 Message 송신... 48 Message 수신... 50 SECS Event 처리... 51 III

C# 개발자를위한 XCom 사용법 1 C# 개발자가 XCom ActiveX Control 을사용하여 Application 을개발하는방법을설명합니다. XCom 사용요약 XCom.Net Framework Library 설치 XCom 을설치한후에.Net Framework 를사용하기위해서는.Net Framework 지원 Library 를수동으로등록해주셔야합니다. 2 장의 XCom 설치의 XCom 등록섹션을참고하시어 XCom 을등록하여주시기바랍니다. Property 요약 XCom 의 property 는현재작업중인 SECS message 의 header 을담고있는데, 이는사용자에게 header 의세부설정을직접제공하는기능을합니다. 하지만, 이 property 는설정된만을볼수있고, header 의을스스로변경하지는못합니다. short DeviceID; short Stream; short ; int SystemBytes; short Wbit; int HeaderSize; int MsgSize; Method 요약 Driver 기본동작과관련된 Method XCom SECS driver 개체를초기화또는종료하고, 통신을시작또는정지시키는기능을합니다. 또한 XCom 이생성하는 log 의종류를 XCom 이동작하고있는중간에실시간으로변경시키는기능도합니다. short Initialize(string scfgfile ); short Close(); 1

short Start(); short Stop(); short EnableLog(short nlogtype, short nenabled ); string GetParam(string parametername ); short SetParam(string parametername, string parameter ); SECS Message 송신과관련된 Method SECS message 를송신하기위해서 message 의각 item 을구성하고이를전송하는기능을합니다. short MakeSecsMsg(out int lmsgid, short ndevid, short nstrm, short nfunc, int lsysbyte ); short MakeSecsMsg(out int lmsgid, int ndevid, int nstrm, int nfunc, int lsysbyte ); short Send(int lmsgid ); short SetWBit(int lmsgid, short nwbit ); short SetListItem(int lmsgid, short nitems ); short SetListItem(int lmsgid, int nitems ); short SetBinaryItem(int lmsgid, byte[] pn); short SetBinaryItem(int lmsgid, byte b); short SetBoolItem(int lmsgid, bool[] pn); short SetBoolItem(int lmsgid, bool b); short SetAsciiFillSpace(short nval); short SetAsciiItem(int lmsgid, string psz, int lcount ); short SetAsciiItem(int lmsgid, string psz); short SetStringItem(int lmsgid, string psz, int lcount ); short SetStringItem(int lmsgid, string psz ); short SetJis8Item(int lmsgid, string psz, int lcount ); short SetJis8Item (int lmsgid, string psz ); short SetI1Item(int lmsgid, byte[] pn); short SetI1Item int lmsgid, byte b); short SetI2Item(int lmsgid, short[] pn); short SetI2Item(int lmsgid, short s); short SetI4Item(int lmsgid, int[] pn); short SetI4Item(int lmsgid, int n); short SetI8Item(int lmsgid, int[] pn); short SetI8Item(int lmsgid, int n); short SetU1Item(int lmsgid, byte[] pn); short SetU1Item int lmsgid, byte b); short SetU2Item(int lmsgid, int[] pn); short SetU2Item(int lmsgid, int n); short SetU4Item(int lmsgid, long[] pn); 2

short SetU4Item(int lmsgid, long n); short SetU8Item(int lmsgid, long[] pn); short SetU8Item(int lmsgid, long n); short SetF4Item(int lmsgid, float[] pf); short SetF4Item(int lmsgid, float f); short SetF8Item(int lmsgid, double[] pr); short SetF8Item(int lmsgid, double r); int GetSysBytes(int lmsgid ); SECS Message 수신과관련된 Method XCom SECS driver 가새로운 SECS message 를수신하게되면, XCom contol 의 event 기능을통해서 SECS message 의수신을사용자에게알려줍니다. 이경우, 사용자는이 event 에대한 event handler 를선언하고, 다음의 method 를이용해서수신된 SECS message 로부터 data 를얻을수있습니다. short LoadSecsMsg(out int lmsgid, out short ndevid, out short nstrm, out short nfunc, out int lsysbyte, out short nwbit ); void CloseSecsMsg(int lmsgid ); short GetCurrentItemType(int lmsgid ); short GetCurrentItemCount(int lmsgid ); short GetListItem(int lmsgid, out short nitems ); short GetBinaryItem(intlMsgId, out byte[] n); short GetBoolItem(intlMsgId, out bool[] n); short GetAsciiItem(int lmsgid, out string s, out int lcount); short GetJis8Item(int lmsgid, out string s, out int lcount); string GetStringItem(int lmsgid, out int lcount); short GetI1Item(int lmsgid, byte[] n ); short GetI2Item(int lmsgid, short[] n ); short GetI4Item(int lmsgid, int[] n ); short GetI8Item(int lmsgid, int[] n ); short GetU1Item(int lmsgid, byte[] n ); short GetU2Item(int lmsgid, int[] n ); short GetU4Item(int lmsgid, long[] n ); short GetU8Item(int lmsgid, long[] n ); short GetF4Item(int lmsgid, float[] f ); short GetF8Item(int lmsgid, double[] r ); SECS Message Stream 자체와관련된 Method XCom v2.x 부터는 SECS message 의분석과정없이바로 SECS message stream 을가져오거나지정하는기능을제공합니다. 3

short GetHeaderBytes(int lmsgid, out byte[] bheader); int GetMsgBytes(int lmsgid, out byte[] bmsg ); short SetHeaderBytes(int lmsgid, byte[] bheader ); int SetMsgBytes(int lmsgid, byte[] bmsg); short SetWBit(int lmsgid, short nwbit ); short MakeSpoolStream(int lmsgid ); short ProcExternalStream(byte[] pnmsg); Alarm 과관련된 Method XCom 은새로운 SECS message 의수신이외에 SECS 통신도중에발생하는상황에대해 event 를발생시킵니다. 이벤트핸들러에는이벤트코드와해당이벤트와관련된정보가 lparam 으로넘겨집니다. 그런데, 이벤트가발생한원인이특정메시지와관련된것이라면이벤트핸들러에는이벤트코드번호와함께해당메시지정보를알아낼수있는 message ID 가 lparam 으로전달됩니다. 사용자는다음과같은함수를이용하여이 message ID 를통해해당이벤트를발생한메시지의정보를얻을수있습니다. short GetAlarmMsgInfo(out int lmsgid, out short ndevid, out short nstrm, out short nfunc, out int lsysbyte, out short nwbit ); short GetInvalidMsgInfo(out int lmsgid, out short ndevid, out short nstrm, out short nfunc, out int lsysbyte, out short nwbit ); Event 요약 SecsMsg Event 새로운 SECS message 를수신하게되면, XCom 은사용자에게 SECS message 의수신을알리기위해 SecsMsg event 를발생시킵니다. 사용자는이 event 에대한 event handler 를선언하고, handler 내에서 SECS message 수신과관련된 method 나 property 등을이용해서수신된을확인할수있습니다. 이 event 는인자를제공하지않습니다. SecsEvent Event 새로운 SECS message 의수신이외에 XCom 의동작과관련해서사용자가알아야할필요가있는상황이발생할수있는데, 이런경우에 XCom 은 SecsEvent event 를발생시킵니다. 4

사용자는이 event 에대한 event handler 를선언하고, handler 내에서발생한 event 중필요한 event 에대해적절한처리를진행할수있습니다. 이 event 는발생한 event 의 event code 와 event 에따른부수적인 parameter 가 lparam 으로 event 의인자로제공됩니다. Property 상세설명 short DeviceID; short Stream; short ; XCom 표준 ActiveX control 에서제공되는 property 는 header 의정보를확인하는기능을합니다. 이정보는확인용으로만사용되고설정을위한값으로는사용되지않습니다. MakeSecsMsg() method 나 LoadSecsMsg() method 가호출되면, XCom 은현재설정된 message 의 header 값으로 property 를설정합니다. SECS message 에설정되어있는 device ID 입니다. 만약 XCom 이 host 로동작하고있다면이값은상대방 equipment 의 device ID 가되고, equipment 로동작하고있다면이값은자신의 device ID 가됩니다. XCom 은 configuration file 에서 multi device ID 를설정하고관리할수있습니다. SECS message 에설정되어있는 stream 값으로, 이값의유효범위는아래와같습니다. 0 stream 127 int SystemBytes; SECS message 에설정되어있는 function 값으로, 이값의유효범위는아래와같습니다. 0 function 255 SECS message 에설정되어있는 system bytes 입니다. 수신되는 SECS message 에대해서는 LoadSecsMsg() method 를호출할때수신된 SECS message 의 system bytes 가얻어지지만, 송신되는 SECS message 의경우는 MakeSecsMsg() method 를호출할때지정되는 parameter 의값에따라그값이변동됩니다. 만약 MakeSecsMsg() 의 function 값이짝수이고, lsysbyte parameter 로 0 이지정되었다면 XCom 이적당한 system bytes 값을스스로생성해서설정합니다. 따라서이런경우 5

short Wbit; int HeaderSize; int MsgSize 는 MakeSecsMsg() method 를호출한직후새로운 system bytes 가 SystemBytes property 값으로지정됩니다. 그러나 MakeSecsMsg() 의 function 값이홀수이거나, lsysbyte parameter 가 0 가아니면, lsysbyte parameter 에지정된다면그값이그대로사용됩니다. SECS message 에설정되어있는 W-Bit 입니다. 이 property 는설정되는시점이다른 property 와는조금다릅니다. 수신되는 SECS message 에대해서는 LoadSecsMsg() method 를호출할때설정되는것은동일하지만, 송신되는 SECS message 의경우는 MakeSecsMsg() method 를호출할때설정되는것이아니라 Send() method 를호출할때설정됩니다. 따라서이값을이용할필요가있다면 Send() method 를호출한후에확인하시기바랍니다. 다만, MakeSecsMsg() 후에사용자가 SetWBit() 를이용하여강제설정하는경우에는 Send() 이전이라도사용자가자신이설정한 WBit 값을이용할수있습니다. SECS message 의 header 크기를설정하거나가져옵니다. header 을읽기위해서는각 byte 별로하나씩읽어야하므로개수를먼저읽어서 byte array 를먼저생성한후값을읽어야합니다. 아래의 HeaderByte property 의 sample code 를참고하시면됩니다. HeaderSize property 는 property 값을가져올때만사용됩니다. 따라서 header size 를가져올 message 는 RMsgId property 에지정된 message ID 를갖는 SECS message 가됩니다. header size 를수정하는것은의미가없습니다. 실제로는 SEMI standard 에 message 의 header size 가 SECS-I, HSMS 모두 10 bytes 로지정되어있기때문에, 이값은거의사용되지않습니다. SECS message 의 header 를제외한 SECS-II message 의크기를설정하거나가져옵니다. 주로 Size property 는수신된 message 의크기를가져올때사용됩니다. 즉, 수신된메시지를다른 XCom control 로 Bypass 할때수신된메시지를가져오기위해필요한공간을확보할목적으로대개사용됩니다. Method 상세설명 6

사용자가 XCom 으로 SECS 통신을구현하기위해사용되는각 method 에대해자세히설명합니다. short Initialize(string scfgfile ); 환경설정 file 을읽고, 설정된으로 XCom control 을초기화합니다. 이름 Type scfgfile string 환경설정을담고있는 configuration file 의경로입니다. 절대경로와상대경로를모두사용할수있습니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks short Close(); Initialize() method 를실행하면, 지정된환경설정 file 의을읽은후에그에맞게 XCom 의상태를조절합니다. 하지만, 아직 XCom 이시작된것은아니고환경만을설정한것이기때문에 XCom 을시작하려면 Start() method 를호출해야합니다. 현재의환경설정을중단하고다른환경으로바꾸 e 려면, Close() method 를호출해서 - 만약 Start() method 가이미호출된상태라면, 먼저 Stop() method 로 XCom 의동작을정지시킵니다 - XCom 의설정을닫은후에새로운환경설정 file 로다시 Initialize() method 를호출하면됩니다. 일단 Initialize() method 가성공적으로수행된후에 XCom 을종료할때에는, Close() method 를호출해서 XCom 의모든상태를종료하도록권장합니다. Close() method 를호출하지않고종료하더라도자동으로 Close() 의기능을수행하지만, 체계적인작업을위해서는 Close() 를호출하는것이좋습니다. 7

XCom 의모든상태를종료하고, 이미초기화된 XCom 의상태를초기화이전 ( 환경설정이전 ) 으로돌려놓습니다. 없음 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. short Start(); Remarks Initialize() 이후에 Start() method 가실행되어 XCom 이동작하고있다면, Close() method 이전에 Stop() method 를호출하여 XCom 의동작을먼저정지시켜야합니다. 설정된으로 XCom control 의작동을시작합니다. HSMS 를사용중인경우, Start() method 를호출하면 socket connection 을만들고기본 control message 를교환한후 HSMS 상태를 SELECTED 로자동으로변경합니다. 없음 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks 시작된 XCom control 의작동을중지하려면, Stop() method 를실행합니다. Stop() method 를실행한후다시 XCom 을시작하려면 Initialize() 작업없이바로 Start() method 를호출합니다. 8

short Stop(); 동작중인 XCom control 을정지시킵니다. HSMS 를사용중인경우, Stop() method 를호출하면 socket connection 을종료한후 HSMS 상태를 NOT CONNECTED 로자동으로변경합니다. 없음 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. short EnableLog( short nlogtype, short nenabled ); XCom 의 log 설정을변경합니다. XCom 의 log 설정은기본적으로 configuration file 에지정된을따르지만, 필요에따라서는 EnableLog() method 를통해서동작중인상황에서변경할수있습니다. 이름 Type nlogtype short 변경하려는 log 의형식입니다. 다음과같은값, 혹은값들의 OR 조합을가질수있습니다. 0x01 : hexadecimal log 0x02 : SECS-II log 0x04 : event log 0x08 : alarm log nenabled short log 의활성화여부를결정하는값입니다. 0 : 비활성화상태로변경합니다. 0 이외의값 : 활성화상태로변경합니다. 9

0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. string GetParam(string paramtername ); XCom 이성공적으로 Initialize 된후에 XCom 의설정상태를돌려줍니다. 이름 Type parametername string 기본적으로 Configuration 파일내의설정변수이름입니다. 예를들어, HSMS 섹션의 IP Address 설정값을알고싶으면 IP 로주면됩니다. Configuration 파일의설정변수이름이외에다음의 Predefined 값을사용할수있습니다. HSMS.STATE 현재의 HSMS 연결상태를돌려줍니다. HSMS.SELECTED HSMS 상태가 SELECTED 이면 true 를돌려줍니다. LicenseType XCom 의라이센스타입을돌려줍니다. AvailableLicense 현재남아있는 XCom instance 의개수를돌려줍니 다. string Configuration 파일의설정값또는 Predefined Parameter 의값을문 10

자열로돌려줍니다. Predefined Parameter 에대한반환값 HSMS.STATE NOT HSMS : HSMS 가아님 SELECTED : HSMS 가 SELECTED 상태임 NOT CONNECTED : HSMS 가 NOT CONNECTED 상태임 NOT SELECTED : HSMS 가 NOT SELECTED 상태임 HSMS.SELECTED true : HSMS 상태가 SELECTED 상태임 false : HSMS 가 SELECTED 상태가아님 LicenseType HASP : 하드웨어키가설치되어있음 NIC : 소프트웨어키가설치되어있음 TRIAL : 라이센스가설치되어있지않음 AvailableLicense 현재남아있는 XCom instance 의개수를문자열로돌려줍니다. Configuration 파일의 Parameter 값은 Configuration 파일내의설정 값을돌려줍니다. short SetParam(string parametername, string parameter ); Run time 에설정가능한 parameter 값을변경합니다. 이름 Type pamrametername string Configuration 파일내의설정변수이름입니다. 예를들어, HSMS 섹션의 IP Address 설정값을알 고싶으면 IP 로주면됩니다. 그러나 GetParam() 에서사용하던 Predefined 11

Parameter 는사용할수없습니다. parameter string 설정하고자하는 parameter 값의문자열입니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. -10001 XCom 이아직 initialized 되어있지않음 -10041 해당 parameter 는 run time 에변경될수없음 short MakeSecsMsg(out int lmsgid, short ndevid, short nstrm, short nfunc, int lsysbyte ); short MakeSecsMsg(out int lmsgid, int ndevid, int nstrm, int nfunc, int lsysbyte ); 전송을위한새로운 SECS message 를생성한후, 생성한 message 의 reference ID 를돌려준다. 이름 Type lmsgid out int 생성된 SECS message 의 message ID 를받아올변 수입니다. SECS item 추가혹은전송명령등에서이 message ID 를사용합니다. ndevid short 전송할 SECS message 의 device ID 입니다. int primary message 를전송할경우, host 인경우는수 신할 equipment 의 device ID 를사용하고, equipment 의경우는자신의 device ID 를사용합니다. secondary message 의경우는수신한 primary message 의 device ID 를그대로사용합니다. nstrm short SECS message 의 stream 값입니다. int 12

nfunc short SECS message 의 function 값입니다. int lsysbyte int SECS message 의 system bytes 입니다. primary message 인 경우는 0 을 사용하고, secondary message 인경우는수신한 primary message 의 system bytes 을그대로사용합니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks 새로운 SECS message 를만드는경우, primary message 를만드는것과 secondary message 를만드는것에차이가있습니다. primary message 의경우는자신이 host 인지 equipment 인지에따라 ndevid parameter 값을다르게설정해야합니다. host 인경우는상대방 equipment 의 device ID 로설정해야하고, equipment 인경우는자신의 device ID 를설정합니다. lsysbyte parameter 는 0 으로설정합니다. 그러면자동으로 XCom 이적절한 system bytes 값을지정합니다. secondary message 를만드는경우는, ndevid 와 lsysbyte parameter 값으로 LoadSecsMsg() method 로부터받은 primary message 의을그대로설정합니다. short SetWBit( int lmsgid, short nwbit ); 주어진 message ID 에해당하는 SECS message 의 WBit 를강제설정합니다. 이함수를호출하지않는경우, XCom 드라이버는 Initialize 시읽어들인 sml 파일을이용하여 WBit 를자동설정합니다. 그러나, 어플리케이션에따라서는 WBit 를다르게줄필요가생기기도하는데, 이때이함수를이용하여 WBit 를설정하면, 메시지전송시 sml 파일의 SECS Message Structure 설정값과는관계없이 SetWBit() 에의해지정된값이사용됩니다. 이름 Type lmsgid int item 을설정할 SECS message 의 message ID 입니 13

다. 이값은 MakeSecsMsg() method 로부터얻어집니다. nwbit short 메시지에강제설정될 W Bit 값입니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. short Send( int lmsgid ); 주어진 message ID 에해당하는 SECS message 를전송합니다. 이름 Type lmsgid int 전송하려는 SECS message 의 message ID 입니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks Send() method 를호출하면전송할 SECS message 의구조를 sml 파일에적힌과비교해서 message 구조의적합성을검사하게됩니다. 만약해당 message 가 UNDEFINED STRUCTURE 로정의되어있다면구조의적합성검사는하지않습니다. short SetListItem( int lmsgid, short nitems ); short SetListItem( int lmsgid, int nitems ); 14

주어진 message ID 를갖는 SECS message 에 LIST format 의 item 을설정합니다. 이름 Type lmsgid long item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. nitems short int 설정할 LIST item 의값입니다. 설정가능한값의범위는부록을참고합니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. short SetBinaryItem(int lmsgid, byte[] pn); short SetBinaryItem(int lmsgid, byte b); 주어진 message ID 를갖는 SECS message 에 binary format 의 item 을설정합니다. 이름 Type lmsgid int item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. pn b byte[] byte 설정할 binary item 값의배열또는 binary 값입니다. 15

0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks 원래 binary format 의변수로는 unsigned char type 이적합하지만, ActiveX 의제약때문에 short type 으로설정합니다. short SetBoolItem(int lmsgid, bool[] pn); short SetBoolItem(int lmsgid, bool b); 주어진 message ID 를갖는 SECS message 에 Boolean format 의 item 을설정합니다. 이름 Type lmsgid long item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. pn bool[] bool 설정할 Boolean item 값으로 bool 배열또는 bool 단일값입니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks 원래 Boolean format 의변수로는 bool type 이적합하지만, ActiveX 의제약때문에 short type 으로설정합니다. short SetAsciiFillSpace( short nval); 16

SetAsciiItem() 에서입력문자열이주어진길이보다작을때공백으로채울지의옵션을설정한다. 이름 Type nval short 0 : SetAsciiItem() 에서입력문자열의길이가주어진길이보다작더라도공백으로채우지않는다. 0 이아닌값 : 이후 SetAsciiItem() 호출시문자열의길이가주어진길이보다작을시공백으로주어진길이만큼채운다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks 문자열의뒤를공백으로자동으로채워전송할때사용하는옵션입니다. short SetAsciiItem( int lmsgid, string sz, long lcount ); short SetAsciiItem( int lmsgid, string sz); 주어진 message ID 를갖는 SECS message 에 ASCII format 의 item 을설정합니다. 이름 Type lmsgid long item 을설정할 SECS message 의 message ID 입니 다. 이값은 MakeSecsMsg() method 로부터얻어집니다. sz string 설정할 ASCII item 값을저장하고있는변수의 pointer 입니다. 17

lcount long 설정할 item 의개수, 즉 string 의길이입니다. 설정가능한값의범위는부록을참고합니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks 일반적으로 ASCII string 을사용하기때문에 ActiveX 의 string type 인 BSTR type 을사용합니다. Visual C++ 사용자는 CString type 이나 LPCTSTR type 을사용하시면됩니다. Borland C++ Builder 를사용하시는경우일부버전에서 SetAsciiItem() 호출시 XCom 으로전달되는과정에서컴파일러내부의 BSTR 변환에서오류가나는경우가있습니다. 이때디버그를해보면 SetAsciiItem() 의호출후 XCom 의 SetAsciiItem() 을호출하기위해 WideString 을 OLE String 으로변환하는도중에에러가발생합니다. 이런경우는 SetAsciiItem() 대신 SetStringItem() 을사용하시기바랍니다. short SetJis8Item( int lmsgid, string sz, long lcount ); short SetJis8Item( int lmsgid, string sz); 주어진 message ID 를갖는 SECS message 에 JIS-8 format 의 item 을설정합니다. 이름 Type lmsgid long item 을설정할 SECS message 의 message ID 입니 다. 이값은 MakeSecsMsg() method 로부터얻어집니다. sz string 설정할 JIS-8 item 값을저장하고있는변수의 pointer 입니다. lcount long 설정할 item 의개수, 즉 string 의길이입니다. 설정가능한값의범위는부록을참고합니다. 18

0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. short SetStringItem( int lmsgid, string sz); 주어진 message ID 를갖는 SECS message 에 ASCII format 의 item 을설정합니다. 이름 Type lmsgid int item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. sz string 설정할 string 입니다. lcount int 설정할 string 의길이입니다. 설정가능한값의범위는부록을참고합니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks short SetI1Item( int lmsgid, byte[] n); short SetI1Item( int lmsgid, byte n); 19

주어진 message ID 를갖는 SECS message 에 1-byte signed integer format 의 item 을설정합니다. 이름 Type lmsgid long item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. n byte[] byte 설정할 1-byte signed integer item 값을저장하고있는 byte 값또는배열입니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks short SetI2Item( int lmsgid, short[] n); short SetI2Item( int lmsgid, short n); 주어진 message ID 를갖는 SECS message 에 2-byte signed integer format 의 item 을설정합니다. 이름 Type lmsgid int item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. n short[] short 설정할 2-byte signed integer item 값을저장하고있는 short 배열또는값입니다. 20

0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. short SetI4Item( int lmsgid, int[] n ); short SetI4Item( int lmsgid, int n ); 주어진 message ID 를갖는 SECS message 에 4-byte signed integer format 의 item 을설정합니다. 이름 Type lmsgid int item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. n int[] int 설정할 4-byte signed integer item 값을저장하고있는 int 배열또는값입니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. short SetI8Item( int lmsgid, int[] n ); short SetI8Item( int lmsgid, int n ); 주어진 message ID 를갖는 SECS message 에 8-byte signed integer format 의 item 을설정합니다. 21

이름 Type lmsgid int item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. n int[] int 설정할 8-byte signed integer item 값을저장하고있는 int 배열또는값입니다. I8 아이템은 8 바이트여야합니다만 XCom 의 ActiveX 가 32 비트기준으로되어있어이에대한호환을위해 int 로하고있습니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks XCom 에서는 8-byte signed integer 를완벽하게지원하지않습니다. 이는 32-bit system 환경때문입니다. 8-byte signed integer 의 format 과송수신자체는지원하지만, 실제 data 는 8-byte signed integer 중하위 4 byte 만사용합니다. 따라서실제로송수신이가능한 data 의범위는 4-byte signed integer 와동일합니다. short SetU1Item( int lmsgid, byte[] n ); short SetU1Item( int lmsgid, byte n ); 주어진 message ID 를갖는 SECS message 에 1-byte unsigned integer format 의 item 을설정합니다. 이름 Type lmsgid int item 을설정할 SECS message 의 message ID 입니 다. 이값은 MakeSecsMsg() method 로부터얻어집니다. 22

n byte[] byte 설정할 1-byte unsigned integer item 값을저장하고 있는 byte 배열또는값입니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks short SetU2Item( int lmsgid, int[] l ); short SetU2Item( int lmsgid, int l ); 주어진 message ID 를갖는 SECS message 에 2-byte unsigned integer format 의 item 을설정합니다. 이름 Type lmsgid int item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. l int[] int 설정할 2-byte unsigned integer item 값을저장하고있는 int 배열또는값입니다..Net Framework 에서는 unsigned short 타입이없기때문에 int 를이용합니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. 23

Remarks U2 item 은원래 2-byte unsigned integer format 로표현해야하는데.Net Framework 에서는 unsigned type 이없기때문에 int 타입을사용하였습니다. short SetU4Item( int lmsgid, long[] n ); short SetU4Item( int lmsgid, long n ); 주어진 message ID 를갖는 SECS message 에 4-byte unsigned integer format 의 item 을설정합니다. 이름 Type lmsgid int item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. n long[] long 설정할 4-byte unsigned integer item 값을저장하고있는 long 배열또는값입니다..Net Framework 에서는 unsigned int 타입이없기때문에 long 타입을이용합니다 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks U4 item 은원래 4-byte unsigned integer format 로표현해야하는데.Net Framework 에서는 unsigned type 이없기때문에 long 타입을사용하였습니다. short SetU8Item( int lmsgid, long[] n ); short SetU8Item( int lmsgid, long n ); 24

주어진 message ID 를갖는 SECS message 에 8-byte unsigned integer format 의 item 을설정합니다. 이름 Type lmsgid int item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. n long[] long 설정할 8-byte unsigned integer item 값을저장하고있는 long 배열또는값입니다. U8 아이템은 8 바이트여야합니다만 XCom 의 ActiveX 가 32 비트기준으로되어있어이에대한호환을위해 long 타입을사용하고있습니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks XCom 에서는 8-byte unsigned integer 를완벽하게지원하지않습니다. 32 비트호환을위해 long 타입의 32 비트부분만을전달하도록하였습니다. 따라서실제로송수신이가능한 data 의범위는 4-byte unsigned integer 와동일합니다. short SetF4Item( int lmsgid, float[] f); short SetF4Item( int lmsgid, float f); 주어진 message ID 를갖는 SECS message 에 4-byte floating point format 의 item 을설정합니다. 25

이름 Type lmsgid int item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. f float[] float 설정할 4-byte floating point item 값을저장하고있는 float 배열또는값입니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. short SetF8Item( long lmsgid, double[] r ); short SetF8Item( long lmsgid, double r ); 주어진 message ID 를갖는 SECS message 에 8-byte floating point format 의 item 을설정합니다. 이름 Type lmsgid long item 을설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. pr double * 설정할 8-byte floating point item 값을저장하고있는 double 배열또는값입니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. 26

int GetSysBytes( int lmsgid ); 주어진 message ID 를갖는 message 의 system bytes 를가져옵니다. 이름 Type lmsgid int system bytes 값을가져올 message 의 message ID 입니다. 이 값으로는 MakeSecsMsg() 를 통해 얻어진 message ID 를사용하시면됩니다. > 0 주어진 message ID 를갖는 message 의 system bytes 값입니다. 0 주어진 message ID 를찾지못했거나기타오류가발생한경우입니다. short LoadSecsMsg(out int lmsgid, out short ndevid, out short nstrm, out short pnfunc, out int lsysbyte, out short pnwbit ); 수신된 SECS message 의정보를가져옵니다. 이 method 를통해서먼저수신된 message 의기본정보를확인한후, 필요에따라서 Get~Item() method 를사용해서수신된 message 의세부 item 을가져와사용합니다. 이 method 는수신 message queue 에서가장먼저수신된 message 를가져오게됩니다. 이름 Type lmsgid out int 가져온 SECS message 의 message ID 를받아올변 수의주소입니다. 추가적으로 SECS item 에관한정보를얻으려면이 27

message ID 를사용합니다. ndevid out short 가져온 SECS message 의 device ID 를받아올 short 변수의주소입니다. nstrm out short 가져온 SECS message 의 stream 값을받아올 short 변수의주소입니다. nfunc out short 가져온 SECS message 의 function 값을받아올 short 변수의주소입니다. lsysbyte out int 가져온 SECS message 의 system bytes 값을받아올 int 변수의주소입니다. nwbit out short 가져온 SECS message 의 W-Bit 값을받아올 short 변수의주소입니다. 0 ~ 44 첫번째 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 SECS item 이하나도없는 header-only message 입니다. 자세한은부록의 error code 를참고합니다. void CloseSecsMsg( int lmsgid ); 지정된 SECS message 의작업을종료하고해당 message 를 message queue 에서삭제합니다. 이 method 는수신된 SECS message 에만사용할수있습니다. 이름 Type lmsgid int 종료할 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. 없음 short GetListItem( int lmsgid, out short pnitems ); 28

주어진 message ID 를갖는 SECS message 로부터 LIST format item 의값을가져옵니다. 이름 Type lmsgid int item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pnitems out short SECS message 에설정된 LIST item 값을받아올 short 변수입니다. 0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. short GetBinaryItem( int lmsgid, out byte[] pn); 주어진 message ID 를갖는 SECS message 로부터 binary format item 의값을가져옵니다. 이름 Type lmsgid int item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pn out short[] SECS message 에설정된 item 값을받아올배열변수입니다. 29

0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. short GetBoolItem(int lmsgid, out bool[] pn ); 주어진 message ID 를갖는 SECS message 로부터 Boolean format item 의값을가져옵니다. 이름 Type lmsgid long item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pn out bool[] SECS message 에설정된 item 값을받아올배열변수입니다. 0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. short GetJis8Item( int lmsgid, out string s, out int lcount ); 30

주어진 message ID 를갖는 SECS message 로부터 ASCII format item 의값을가져옵니다. 이름 Type lmsgid int item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. s out string SECS message 에설정된 item 값을받아올변수입니다. lcount out int item 의실제개수를돌려받을변수입니다. 0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. string GetStringItem( long lmsgid, out int lcount ); 주어진 message ID 를갖는 SECS message 로부터 ASCII format item 의값을가져옵니다. 이름 Type lmsgid long item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. lcount out int item 의실제개수를돌려받을변수입니다. 31

string String 아이템의값입니다. Remarks GetAsciiItem() 과같은역할을합니다. 그러나반환값에문자열이들어있는것이다릅니다. C# 에서는 GetAsciiItem() 대신 GetStringItem() 을사용하시기바랍니다. short GetI1Item( int lmsgid, out byte[] pn ); 주어진 message ID 를갖는 SECS message 로부터 1-byte signed integer format item 의값을가져옵니다. 이름 Type lmsgid long item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pn out byte[] SECS message 에설정된 item 값을받아올배열변수입니다. 0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. short GetI2Item( int lmsgid, out short[] pn); 32

주어진 message ID 를갖는 SECS message 로부터 2-byte signed integer format item 의값을가져옵니다. 이름 Type lmsgid int item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pn out short[] SECS message 에설정된 item 값을받아올배열변수입니다. 0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. short GetI4Item( int lmsgid, out int[] pl); 주어진 message ID 를갖는 SECS message 로부터 4-byte signed integer format item 의값을가져옵니다. 이름 Type lmsgid long item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pl out int[] SECS message 에설정된 item 값을받아올배열변수입니다. 33

0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. short GetI8Item( int lmsgid, int[] pl); 주어진 message ID 를갖는 SECS message 로부터 8-byte signed integer format item 의값을가져옵니다. 이름 Type lmsgid int item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pl out int[] SECS message 에설정된 item 값을받아올배열변수입니다. 0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. Remarks XCom 에서는 8-byte signed integer 를완벽하게지원하지않습니다. 이는 32-bit system 34

에맞게되어있기때문입니다. 8-byte signed integer 의 format 과송수신자체는지원하지만, 실제 data 는 8-byte signed integer 중하위 4 byte 만사용합니다. 따라서실제로송수신이가능한 data 의범위는 4-byte signed integer 와동일합니다. short GetU1Item( int lmsgid, out byte[] pn ); 주어진 message ID 를갖는 SECS message 로부터 1-byte unsigned integer format item 의값을가져옵니다. 이름 Type lmsgid int item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pn out byte[] SECS message 에설정된 item 값을받아올배열변수입니다. 0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. short GetU2Item( int lmsgid, out int[] pl ); 주어진 message ID 를갖는 SECS message 로부터 2-byte unsigned integer format item 의값을가져옵니다. 이름 Type lmsgid int item 값을가져올수신한 SECS message 의 35

message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pl out int[] SECS message 에설정된 item 값을받아올배열변수입니다. 0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. Remarks 원래 2-byte unsigned integer format 의변수로는 unsigned short type 이적합하지만,.Net Framework 에는 unsigned type 이없기때문에 int type 을사용합니다. short GetU4Item( int lmsgid, out long[] pn ); 주어진 message ID 를갖는 SECS message 로부터 4-byte unsigned integer format item 의값을가져옵니다. 이름 Type lmsgid int item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pn out long[] SECS message 에설정된 item 값을받아올배열변수입니다..Net Framework 에는 unsigned type 이없기때문에 long 타입을사용합니다. 36

0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. Remarks 원래 4-byte unsigned integer format 의변수로는 unsigned long type 이적합하지만,.Net Framework 에는 unsigned type 이없기때문에 long type 을사용합니다. short GetU8Item( int lmsgid, out long[] pn ); 주어진 message ID 를갖는 SECS message 로부터 8-byte unsigned integer format item 의값을가져옵니다. 이름 Type lmsgid int item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pr out long[] SECS message 에설정된 item 값을받아올배열변수입니다. XCom 의제약으로 long type 의숫자중 4 바이트부분만전달됩니다. 0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. 37

Remarks XCom 에서는 8-byte unsigned integer 를완벽하게지원하지않습니다. 이는 32-bit system 환경때문입니다. 8-byte unsigned integer 의 format 과송수신자체는지원하지만, 실제 data 는 8-byte unsigned integer 중하위 4 byte 만사용합니다. 따라서실제로송수신이가능한 data 의범위는 4-byte unsigned integer 와동일합니다. short GetF4Item( int lmsgid, out float[] pf ); 주어진 message ID 를갖는 SECS message 로부터 4-byte floating point format item 의값을가져옵니다. 이름 Type lmsgid int item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pr out float [] SECS message 에설정된 item 값을받아올배열변수입니다. 0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. short GetF8Item( long lmsgid, double[] pr ); 주어진 message ID 를갖는 SECS message 로부터 4-byte floating point format item 의값을가져옵니다. 38

이름 Type lmsgid long item 값을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pr out double[] SECS message 에설정된 item 값을받아올배열변수입니다. 0 ~ 44 바로다음에이어지는 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 바로다음에이어지는 SECS item 이하나도없음을의미합니다. 즉이번 item 이 SECS message 의마지막 item 입니다. 자세한은부록의 error code 를참고합니다. short GetCurrentItemType( int lmsgid ); 주어진 message ID 를갖는 SECS message 의현재아이템타입을가져옵니다. 이름 Type lmsgid int item 타입을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. 0 ~ 44 현재 SECS item 의 format 입니다. 각 SECS item 의 format 값은부록을참고합니다. 63 더이상 SECS item 이하나도없음을의미합니다. 자세한은부록의 error code 를참고합니다. 39

short GetCurrentItemCount( int lmsgid ); 주어진 message ID 를갖는 SECS message 의현재아이템의아이템개수를가져옵니다. 이름 Type lmsgid int item 타입을가져올수신한 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. >= 0 현재아이템의개수입니다. 자세한은부록의 error code 를참고합니다. short GetHeaderBytes( int lmsgid, out byte[] pnheader ); 지정된 message ID 를갖는 SECS message 의 header 자체를가져옵니다. 이 method 는수신된 SECS message 에만사용할수있습니다. 이름 Type lmsgid int header 를가져올 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pnheader out byte[] header stream 을받아올변수입니다. 40

>= 0 header 의크기를 byte 로나타낸값입니다. 자세한은부록의 error code 를참고합니다. int GetMsgBytes( int lmsgid, out byte[] pnmsg ); 지정된 message ID 를갖는 SECS message 의 header 를제외한 SECS-II message 부분을가져옵니다. 이 method 는수신된 SECS message 에만사용할수있습니다. 이름 Type lmsgid int SECS-II message 부분을가져올 SECS message 의 message ID 입니다. 이값은 LoadSecsMsg() method 로부터얻어집니다. pnmsg out byte[] SECS-II message body stream 부분을받아올변수입니다. >= 0 SECS-II message 의크기를 byte 로나타낸값입니다. 자세한은부록의 error code 를참고합니다. short SetHeaderBytes( int lmsgid, byte[] pnheader ); header stream 을바로지정해줌으로써지정된 message ID 를갖는 SECS message 의 header 를 SECS item 의계산없이바로설정합니다. 이 method 는송신할 SECS message 에만사용할수있습니다. 이름 Type 41

lmsgid int header 를설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. pnheader byte[] 설정할 header stream 이들어있는 byte 배열입니다.. >= 0 설정된 header 의크기를 byte 로나타낸값입니다. 자세한은부록의 error code 를참고합니다. int SetMsgBytes( int lmsgid, byte[] pnmsg ); SECS-II message stream 을바로지정해줌으로써지정된 message ID 를갖는 SECS message 의 SECS-II message 부분을 SECS item 의계산없이바로설정합니다. 이 method 는송신할 SECS message 에만사용할수있습니다. 이름 Type lmsgid long SECS-II message 를설정할 SECS message 의 message ID 입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. pnmsg byte[] 설정할 SECS-II message stream 이들어있는 byte 배열입니다. >= 0 설정된 SECS-II message 의크기를 byte 로나타낸값입니다. 자세한은부록의 error code 를참고합니다. short MakeSpoolStream( int lmsgid ); 42

MakeSecsMsg 로메시지를만든후에실제메시지를전송하지는않고 SECS 바이트스트림을얻고자할때이용하는함수입니다. 이름 Type lmsgid int 메시지스트림을생성할메시지의아이디입니다. 이값은 MakeSecsMsg() method 로부터얻어집니다. >= 0 작업이성공했음을의미합니다. 자세한은부록의 error code 를참고합니다. Remarks 현재장비의온라인상태가 OFFLINE 이어서메시지를보낼수없지만스풀에저장하기위해메시지의 SECS 바이트스트림을얻어내야하는경우이용할수있습니다. 즉, 메시지를 MakeSecsMsg() 로만들고아이템들을설정한후 MakeSpoolStream() 을호출한후 GetHeaderBytes() 와 GetMsgBytes() 를이용하여메시지의 SECS 스트림을얻을수있습니다. 이후, 해당스트림을장비에서관리하는스풀에저장할수있습니다. short ProcExternalStream( byte[] pnmsg ); 외부의 SECS 스트림을마치내부에서수신한것처럼처리하고자할때이용하는함수입니다. 이름 Type pnmsg byte[] 설정할 SECS-II message stream 이들어있는 byte 배열입니다. 43

>= 0 작업이성공했음을의미합니다. 자세한은부록의 error code 를참고합니다. Remarks 일반적으로 HSMS 연결상태에서는사용하지않는특수한함수입니다. 이함수를이용하면특정메시지스트림을상대편이보낸것처럼에뮬레이션할수있습니다. 이함수를이용하여 SECS 스트림을전달하면정상적인 Stream 이라면메시지수신처리가된후 OnSecsMsg 이벤트가발생하게됩니다. short GetAlarmMsgInfo (out int lmsgid, out short ndevid, out short nstrm, out short pnfunc, out int lsysbyte, out short pnwbit ); SECS alarm 이발생한 message 의정보를가져옵니다. XCom 이제공하는 SECS event 중특정 SECS message 와관련하여발생한 alarm 의경우는해당 SECS message 의 message ID 가함께제공되기도합니다. 이경우, 주어진 message ID 를이용해서해당 message 의정보를얻을수있습니다. 이름 Type lmsgid out int 가져온 SECS message 의 message ID 를받아올변 수의주소입니다. 추가적으로 SECS item 에관한정보를얻으려면이 message ID 를사용합니다. ndevid out short 가져온 SECS message 의 device ID 를받아올 short 변수의주소입니다. nstrm out short 가져온 SECS message 의 stream 값을받아올 short 변수의주소입니다. nfunc out short 가져온 SECS message 의 function 값을받아올 short 변수의주소입니다. lsysbyte out int 가져온 SECS message 의 system bytes 값을받아올 int 변수의주소입니다. nwbit out short 가져온 SECS message 의 W-Bit 값을받아올 short 44

변수의주소입니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks XCom 은동작중에사용자가알아야할 event 나 alarm 상황이발생하면이 alarm 에대해서 SecsEvent event 를발생시킵니다. 개발자가 XCom 의각종상황 (event, alarm) 에대해적절한처리를하고자한다면, SecsEvent event 에대한 handler 를선언하고, 그안에서적절한조치를취하면됩니다. 이렇게발생하는 XCom event 중에는 event code 이외에별도의정보가필요한경우가있는데, 이런들은 SecsEvent event 의 parameter 로제공됩니다. 이런 event 중에서 T3 timeout 과같이특정 SECS message 와연관된 event 나 alarm 의경우는 parameter 로해당 SECS message 의 message ID 가제공됩니다. GetAlarmMsgInfo() method 는바로이런 event 나 alarm 이발생할때, 해당하는 SECS message 의정보를구해오는기능을합니다. 발생하는 event 나 alarm 의종류에관해서는부록을참고하시기바랍니다. short GetInvalidMsgInfo (out int lmsgid, out short ndevid, out short nstrm, out short pnfunc, out int lsysbyte, out short pnwbit ); 상대편으로부터 SECS Message Structure 에정의되어있지않은메시지등을받았을때 SECS Event 로 Invalid Message Received Event 가뜹니다. 이때 lparam 으로넘어오는값을이용하여도착한메시지에대한상세한정보를얻을수있습니다. 이름 Type lmsgid out int 가져온 SECS message 의 message ID 를받아올변수의주소입니다. 추가적으로 SECS item 에관한정보를얻으려면이 message ID 를사용합니다. ndevid out short 가져온 SECS message 의 device ID 를받아올 short 변수의주소입니다. 45

nstrm out short 가져온 SECS message 의 stream 값을받아올 short 변수의주소입니다. nfunc out short 가져온 SECS message 의 function 값을받아올 short 변수의주소입니다. lsysbyte out int 가져온 SECS message 의 system bytes 값을받아올 int 변수의주소입니다. nwbit out short 가져온 SECS message 의 W-Bit 값을받아올 short 변수의주소입니다. 0 작업이성공적으로수행되었습니다. 자세한은부록의 error code 를참고합니다. Remarks XCom 은상대편으로부터 SECS Message Structure 에정의되지않은메시지를수신한경우 Stream 9 오류메시지전송옵션에따라 S9 계열의메시지를송신한후사용자에게는 Event 를통해정의되지않은메시지수신사실을알립니다. 이때사용자는경우에따라도착한메시지를확인해야합니다. 예를들어, S1F13 을전송했는데엉뚱한 S1F14 가도착했다면이를확인후 SF13 을다시재전송해야합니다. 이때도착한메시지정보를확인하기위해사용하는것이 GetInvalidMsgInfo() 메소드입니다. 에러가있는메시지이기때문에 GetAlarmMsgInfo() 를사용할수는없습니다. Event 상세설명 SecsMsg Event 외부로부터 SECS message 를수신하게되면, XCom 은 application 에게 SECS message 의수신을알리기위해이 event 를발생시킵니다. 개발자는 event 가발생한 XCom 객체에대해서이 event 에대한 event handler 를선언하고, 이 handler 를구현하여야합니다. handler 내에서는수신한 SECS message 의을알아보기위해, LoadSecsMsg() method 와 Get~Item() 형태의 method 를사용하게됩니다. 한번의 event 가발생했더라도실제수신된 message 는여러개일수도있으므로, event handler 내에서 LoadSecsMsg() method 를반복사용해서수신된모든 message 를읽을 46

SecsEvent Event 수있도록하는것이좋습니다. SECS message 의수신외에, 통신중에사용자가알아야할각종 event 가발생할수있습니다. XCom 은동작중에사용자가알아야할 event 나 alarm 상황이발생하면이 alarm 에대해서 SecsEvent event 를발생시킵니다. 개발자가 XCom 의각종상황 (event, alarm) 에대해적절한처리를하고자한다면, 이 event 에대한 handler 를선언하고, 그안에서적절한조치를취하면됩니다. SecsEvent event 는두개의 parameter 를가지고있습니다. 첫째 parameter 는 short type 의 event ID( 혹은 event code) 이고, 둘째 parameter 는 long type 의 event ID 별보조정보입니다. 대부분의 SecsEvent event 는의미있는보조정보를가지지않지만, 일부 event 에는중요한보조정보가포함되어있습니다. 의미있는보조정보와해당하는 event 는다음과같습니다. Event ID 보조정보 203 T3 timeout 송신한 primary message 의 message ID alarm 이발생한 message 의정보는 GetAlarmMsgInfo() method 를통해서 확인합니다. 217 Invalid Message ID 도착한메시지의헤더를꺼내볼수있 는 ID GetInvalidMsgInfo() method 를통해 도착한메시지의헤더정보를확인해 볼수있습니다. 218 Transaction Abort ( 0) Stream 값 221 Unrecognized Device ID Device ID 값 222 Unrecognized Stream Dtream 값 223 Unrecognized 값 발생하는 event 나 alarm 의종류에관해서는부록을참고하시기바랍니다. Sample Codes XCom 초기화 XCom 을초기화하는 sample 로, C# 언어를사용하는경우를예로보입니다. 47

XCom 을설치한후 MS.Net Framework 지원툴을설정한후구현할 application 에 XCom 객체를 m_xcom 이라는이름으로선언한경우, XCom 의초기화는다음처럼작성될수있습니다. void InitializeSecsDriver() { short nresult; // XCom 을초기화합니다. if( (nresult = m_xcom.initialize( "XCom.cfg" )) < 0 ) { // error 처리 } else { // XCom 을시작합니다. if( (nresult = m_xcom.start()) < 0 ) { // error 처리 } } } Message 송신 1) Initialize() method 를사용해서입력할 configuration file 이름을지정합니다. configuration file 에는 XCom 이동작하기위한환경설정값이저장되어있습니다. 만약환경설정을제대로읽지못하는경우에, Initialize() method 는음수인 error code 를돌려줍니다. 2) XCom driver 가시작되기를원하는때에 Start() method 를호출합니다. Start() method 에문제가발생하면음수인 error code 를돌려줍니다. 아래와같이 S72F1 이라는이름의사용자정의 message 에임의의값을지정하여송신하고자하는경우, 다음과같이작성될수있습니다. sample code 는 C++ 언어를이용하는경우입니다. SECS message 는 sml 파일에서다음과같이선언되었습니다. <S72F1 P <L 4 <A 12 FirstString> <U4 1 FirstU4> <I1 1 FirstI1> <L 2 48

> > > <F8 1 FirstDouble> <BINARY 1 FirstBinary> 이에해당하는 sample code 는다음과같습니다. void SendS72F1() { short nresult; short ndevid, nfirsti1 = 9; byte nfirstbinary = (byte)0x0f; int lmsgid; string szfirststring = First String ; long nu4=123; double rfirstdouble = 123.45, rfirstu4 = 1234; // 새로운 SECS message 를만듭니다. nresult = m_xcom.makesecsmsg( out lmsgid, ndevid, 72, 1, 0 ); // 만들어진 SECS message 에 SECS item 을설정합니다. nresult = m_xcom.setlistitem( lmsgid, 4 ); nresult = m_xcom.setasciiitem( lmsgid, szfirststring);, nresult = m_xcom.setu4item( lmsgid, nu4); nresult = m_xcom.seti1item( lmsgid, nfirsti1 ); nresult = m_xcom.setlistitem( lmsgid, 2 ); nresult = m_xcom.setf8item( lmsgid, rfirstdouble ); nresult = m_xcom.setbinaryitem( lmsgid, nfirstbinary ); // 만들어진 SECS message 를전송합니다. nresult = m_xcom.send ( lmsgid ); } SECS message 를송신하고자하는경우, code 는다음과같이크게세부분으로나뉘어집니다. 1) 송신하고자하는 message 의특성을설정하는부분으로, MakeSecsMsg() method 를이용해서새로운 message 에대한 reference 인 message ID 를얻어옵니다. 2) message 내의 item 값들을설정하는부분으로, sml 파일에서선언된순서와동일하게각 item 에대응되는 Set~Item() method 를호출합니다. 3) item 구성을모두끝마친 message 에대해송신을하는부분으로, Send() Method 를이용합니다. 49

Message 수신 SECS message 가수신된경우, XCom 은 message 수신에대한 event 가발생되는데, 이 event 의 handler 에서수신된 SECS message 의을알아볼수있습니다. 다음은앞에서선언된 S72F1 message 를 C# 언어를이용하여 SecsMsg event handler 에서값을얻어내는 sample 입니다. void m_xcom_secsmsgxcom(object sender, EventArgs e) { int lmsgid, lsysbyte; short ndevid, nstrm, nfunc, nwbit; short nresult, ncount; string str; byte[] b; short[] sshort; int[] nint; long[] nlong; double[] rdouble; // 수신된 SECS message 를모두받는다. while( m_xcom.loadsecsmsg( out lmsgid, out ndevid, out nstrm, out nfunc, out lsysbyte, out nwbit ) >= 0 ) { if( nstrm == 72 && nfunc == 1 ) { // 각 SECS item 을구한다. nresult = m_xcom.getlistitem( lmsgid, out nitems ); nresult = m_xcom.getasciiitem( lmsgid, out str ); nresult = m_xcom.getu4item( lmsgid, out nlong ); nresult = m_xcom.geti1item( lmsgid, out sshort ); nresult = m_xcom.getlistitem( lmsgid, out ncount ); nresult = m_xcom.getf8item( lmsgid, out ndouble ); nresult = m_xcom.getbinaryitem( lmsgid, out b ); nresult = m_xcom.closesecsmsg( lmsgid ); } } // 응답 (secondary message) 을전송한다. if( nwbit!= 0 ) { nresult = m_xcom.makesecsmsg( lmsgid, ndevid, nstrm, nfunc + 1, lsysbyte ); nresult = m_xcom.setasciiitem( lmsgid, "ACK" ); nresult = m_xcom.send ( lmsgid ); } } 50

SECS Event 처리 수신된 SECS message 의처리는다음의과정으로분석합니다. 1) 수신된 SECS message 의정보를얻어내기위해서, 먼저 LoadSecsMsg() method 를이용하여수신된 SECS message 의기본정보를읽어옵니다. 하나이상의 message 가수신된경우를생각해서 while loop 을사용하는것이좋습니다. LoadSecsMsg() method 는가져올 message 가없으면음수를돌려줍니다. 2) message 송신과마찬가지로, sml 파일에서 message item 이선언된순서와동일하게 Get~Item() method 를호출해서각각의 SECS item 값을가져옵니다. 3) 원하는 SECS item 의값을가져왔다면, CloseSecsMsg() method 를사용해서해당하는 SECS message 를종료하고 memory 를해제합니다. CloseSecsMsg() method 를호출하지않더라도, 모든 SECS item 을다가져갔거나일정시간작업이없는 SECS message 에대해서는자동으로 message 를종료합니다. 4) 필요에따라서는 (W-Bit 가 on 상태 ) secondary message 를송신합니다. 기본적으로이전의 message 전송과동일한방식으로진행되지만, secondary message 의특성상주의할점이있습니다. MakeSecsMsg() method 의 device ID 와 system bytes 는 LoadSecsMsg() method 에서구해진 primary message 의것을사용합니다. 그래야만상대방이 secondary message 를인식할수있습니다. XCom 에서는사용자가 XCom 이나 SECS 와관련된 event 를알아낼수있도록 SecsEvent event 를지원합니다. 이에대한 event handler 가선언된경우에, handler 내부에서는다음과같은방법으로작업을하시면됩니다. void m_xcom_secseventxcom( object sender, XCOMLib._DeXComEvents_SecsEventEvent e ) { int lsysbyte, lmsgid; short ndevid, nstrm, nfunc, nwbit; short nresult; switch( e.neventid ) { case 101: // HSMS connection is closed // You must not send any message at this state. break; case 103: // HSMS connection is selected // You can send SECS message from now on. break; case 203: // T3 timeout lmsgid = e.lparam; nresult = m_xcom.getalarmmsginfo( lmsgid, out ndevid, out nstrm, 51

} } out nfunc, out lsysbyte, out nwbit ); break; case 217: // Invalid message received lmsgid = e.lparam; nresult = m_xcom.getinvalidmsginfo( lmsgid, out ndevid, out nstrm, out nfunc, out lsysbyte, out nwbit ); break; case 221: // Message of unknown device ID received // lparam has the device ID value received break; case 222: // Message of unknown stream received // lparam has the stream value received break; case 223: // Message of unknown function received // lparam has the function value received break; default:; 위의코드는 C# 언어를이용하는경우에대한예제입니다. SecsEvent event 에대한 event handler 를선언하면, handler 의 parameter 로 event ID(event code) 와보조정보를제공하게되고, 이값을이용하여발생된 event 에대한처리를수행합니다. 발생되는 event 는 SECS event 와 alarm 의두종류가있는데, SECS event 는 SECS control 과관련된 event 이고 alarm 은 SECS 통신중발생하는 error 에대한입니다. 만약발생한 alarm 이특정 SECS message 와관련된것이라면, lparam 값으로는해당 SECS message 의 message ID 가제공됩니다. 이런경우는 alarm 을발생시킨 message 의정보를얻기위해 GetAlarmMsgInfo() method 를사용할수있습니다. 52