| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace VehicleControlSystem.ControlLayer.IO
- {
- public interface IIO
- {
- //int GetIOTable( SIOTABLE* Input, SIOTABLE* Output )=0;
- int LoadIOMap(string strFileName);
- //int SetEtherCatAddress( int* iEcOut, int* iEcIn ) = 0;
- /**
- * Hilscher Board와의 Communication을 위한 Driver를 Open하며, Board를 초기화하고 통신 대기 상태가 되게 한다.
- * @precondition 이 함수는 객체가 생성된후 맨처음 한번만 실행한다. 전에 실행했을 경우는 실행하지 말아야한다.
- * @postcondition Hilscher Board가 통신을 위한 준비 상태가 된다.
- * @return 0 = Success, 그외 = Error Number
- */
- int Initialize();
- /**
- * I/O Device의 Digital Status (Bit) 를 읽어드린다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param usIOAddr : IO Address
- * @param pbVal : IO 값
- * @return 0 : SUCCESS
- else : Device \Error 코드
- */
- int GetBit(uint usIOAddr, bool pbval);
- /**
- * Hilscher Board와의 Communication을 종료하고 Device Driver를 Close한다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @postcondition Hilscher Board와 통신 종결
- * @return 0 = Success, 그외 = Error Number
- */
- int Terminate();
- /**
- * I/O Device의 Digital Status (Bit) 를 읽어들여 리턴한다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param usIOAddr : IO Address
- * @return TRUE : ON
- FALSE : ON이 아님
- */
- bool IsOn(uint usIOAddr);
- /**
- * I/O Device의 Digital Status (Bit) 를 읽어들여 리턴한다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param usIOAddr : IO Address
- * @return TRUE : OFF
- FALSE : OFF가 아님
- */
- bool IsOff(uint usIOAddr);
- /**
- * Output Device에 On Command (Bit = 1) 를 보낸다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param usIOAddr : IO Address
- * @return 0 = Success, 그외 = Error Number
- */
- int OutputOn(uint usIOAddr);
- /**
- * Output Device에 Off Command (Bit = 0) 를 보낸다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param usIOAddr : IO Address
- * @return 0 = Success, 그외 = Error Number
- */
- int OutputOff(uint usIOAddr);
- /**
- * Output Device의 Digital Status가 Set이면 (Bit = 0), Output Device에 On Command (Bit = 1) 를 보내고,
- * Output Device의 Digital Status가 Clear이면 (Bit = 1), Output Device에 Off Command (Bit = 0) 를 보낸다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param usIOAddr : IO Address
- * @return 0 = Success, 그외 = Error Number
- */
- int OutputToggle(uint usIOAddr);
- /**
- * 연속된 8개의 IO Address로 구성된 Input Device 들의 Digital Status를 읽어들여 pcValue pointer에 넘겨준다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param usIOAddr : 연속된 8개의 IO Address를 시작하는 IO Address
- * @param pcValuse : 연속된 8개의 IO Address로 구성된 Input Device 들의 Digital Status를 읽어들여 pcValue에 저장한다.
- * @return 0 = Success, 그외 = Error Number
- */
- int GetByte(uint usIOAddr, byte pcValue);
- /**
- * 연속된 8개의 IO Address로 구성된 Output Device들에 On or Off Command를 보낸다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param usIOAddr : 연속된 8개의 IO Address를 시작하는 IO Address
- * @param pcValuse : Output Device에 보낼 Command를 저장하고 있는 변수이다.
- * @return 0 = Success, 그외 = Error Number
- */
- int PutByte(uint usIOAddr, byte pcValue);
- /**
- * 연속된 16개의 IO Address로 구성된 Input Device 들의 Digital Status를 읽어들여 pcValue pointer에 넘겨준다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param usIOAddr : 연속된 16개의 IO Address를 시작하는 IO Address
- * @param pwValuse : 연속된 16개의 IO Address로 구성된 Input Device 들의 Digital Status를 읽어들여 pcValue에 저장한다.
- * @return 0 = Success, 그외 = Error Number
- */
- int GetWord(uint usIOAddr, short pwValue);
- /**
- * 연속된 16개의 IO Address로 구성된 Output Device들에 On or Off Command를 보낸다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param usIOAddr : 연속된 16개의 IO Address를 시작하는 IO Address
- * @param pwValuse : Output Device에 보낼 Command를 저장하고 있는 변수이다.
- * @return 0 = Success, 그외 = Error Number
- */
- int PutWord(uint usIOAddr, short pwValue);
- /**
- * I/O Device의 Digital Status (Bit) 를 읽어드린다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param strIOAddr : IO Address String (ex, "1000:START_SW")
- * @param pbVal : IO 값
- * @return 0 : SUCCESS
- else : Device \Error 코드
- */
- int GetBit(string strIOAddr, bool pbVal);
- /**
- * I/O Device의 Digital Status (Bit) 를 읽어들여 Bit = 1이면, TRUE(1)를 Return하고, Bit = 0이면 FALSE(0)를 Return한다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param strIOAddr : IO Address String (ex, "1000:START_SW")
- * @param pbVal : 결과값 TRUE/FALSE
- * @return 0 : IO값 읽어오기 성공
- others : IO값 읽어오기 실패
- */
- //int IsOn( string strIOAddr, bool pbVal );
- bool IsOn(string ioTag, bool isInput = true);
- /**
- * I/O Device의 Digital Status (Bit) 를 읽어들여 Bit = 1이면, TRUE(1)를 Return하고, Bit = 0이면 FALSE(0)를 Return한다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param strIOAddr : IO Address String (ex, "1000:START_SW")
- * @param pbVal : 결과값 TRUE/FALSE
- * @return 0 : IO값 읽어오기 성공
- others : IO값 읽어오기 실패
- */
- //int IsOff( string strIOAddr, bool pbVal );
- bool IsOff(string ioTag, bool isInput = true);
- /**
- * Output Device에 On Command (Bit = 1) 를 보낸다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param strIOAddr : IO Address String (ex, "1000:START_SW")
- * @return 0 = Success, 그외 = Error Number
- */
- int OutputOn(string outputTag);
- /**
- * Output Device에 Off Command (Bit = 0) 를 보낸다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param strIOAddr : IO Address String (ex, "1000:START_SW")
- * @return 0 = Success, 그외 = Error Number
- */
- int OutputOff(string outputTag);
- /**
- * Output Device의 Digital Status가 Set이면 (Bit = 0), Output Device에 On Command (Bit = 1) 를 보내고,
- * Output Device의 Digital Status가 Clear이면 (Bit = 1), Output Device에 Off Command (Bit = 0) 를 보낸다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param strIOAddr : IO Address String (ex, "1000:START_SW")
- * @return 0 = Success, 그외 = Error Number
- */
- int OutputToggle(string strIOAddr);
- /**
- * 연속된 8개의 IO Address로 구성된 Input Device 들의 Digital Status를 읽어들여 pcValue pointer에 넘겨준다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param strIOAddr : 연속된 8개의 IO Address를 시작하는 IO Address의 String Type (ex, "1000:START_SW")
- * @param pcValuse : 연속된 8개의 IO Address로 구성된 Input Device 들의 Digital Status를 읽어들여 pcValue에 저장한다.
- * @return 0 = Success, 그외 = Error Number
- */
- int GetByte(string strIOAddr, byte pcValue);
- /**
- * 연속된 8개의 IO Address로 구성된 Output Device들에 On or Off Command를 보낸다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param strIOAddr : 연속된 8개의 IO Address를 시작하는 IO Address의 String Type (ex, "1000:START_SW")
- * @param pcValuse : Output Device에 보낼 Command를 저장하고 있는 변수이다.
- * @return 0 = Success, 그외 = Error Number
- */
- int PutByte(string strIOAddr, byte pcValue);
- /**
- * 연속된 16개의 IO Address로 구성된 Input Device 들의 Digital Status를 읽어들여 pcValue pointer에 넘겨준다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param strIOAddr : 연속된 16개의 IO Address를 시작하는 IO Address의 String Type (ex, "1000:START_SW")
- * @param pwValuse : 연속된 16개의 IO Address로 구성된 Input Device 들의 Digital Status를 읽어들여 pcValue에 저장한다.
- * @return 0 = Success, 그외 = Error Number
- */
- int GetWord(string strIOAddr, short pwValue);
- /**
- * 연속된 16개의 IO Address로 구성된 Output Device들에 On or Off Command를 보낸다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @param strIOAddr : 연속된 16개의 IO Address를 시작하는 IO Address의 String Type (ex, "1000:START_SW")
- * @param pwValuse : Output Device에 보낼 Command를 저장하고 있는 변수이다.
- * @return 0 = Success, 그외 = Error Number
- */
- int PutWord(string strIOAddr, short pwValue);
- /**
- * Incoming Buffer를 Update하고, Outgoing Buffer의 내용을 Physical I/O에 적용하는 IOThread를 Run한다.
- * @precondition 이 함수를 실행하기 전에 initialize 함수가 미리 실행되었어야 한다.
- * @postcondition Incoming Buffer를 Update하고, Outgoing Buffer의 내용을 Physical I/O에 적용하는 IOThread가 Run한다.
- */
- void RunIOThread();
- ///**
- // * Master 모듈 및 Slave 모듈 상태 정보를 얻어온다.
- // *
- // * @param DnStatus : 마스터와 64개의 Slave에 대한 상태 정보 구조체
- // * @return 0 = 모두 정상
- // others = 하나라도 실패
- // */
- //virtual int DnStatusGet(DN_STATUS DnStatus) = 0;
- bool IsDeviceOpened();
- void WriteOutputIO(string tag, bool on, int after = 0);
- bool WaitChangeInputIO(bool exp, int timeout, string tag);
- }
- }
|