====== 모노에서 시리얼 포트 제어하기 ====== 모노 프레임웍에서 SerialPort 클래스는 DataRecevied 이벤트를 제공하지 않습니다. 따라서 수신데이터를 수시로 확인해주는 방법을 쓰거나 아니면 다음과 같은 방법으로 해결가능합니다. * [[https://antanas.veiverys.com/mono-serialport-datareceived-event-workaround-using-a-derived-class/|Mono SerialPort.DataReceived 이벤트 해결 – 파생 클래스]] * 이러한 해결 방법을 구현한 솔루션: [[http://110.10.189.172/ComfilePi/Comfile.ComfilePi.SerialPortExample.zip|Visual Studio 솔루션 다운로드]] * [[http://www.sparxeng.com/blog/software/must-use-net-system-io-ports-serialport#comment-840|If you *must* use .NET System.IO.Ports.SerialPort ]] ===== 예제 프로그램 ===== 클라이언트와 서버간의 단순 통신 예제입니다. C#을 사용해서 짠 소스입니다. ''Server.exe'' 는 PC에서 실행시키고, ''Client.exe'' 는 ComfilePi에서 실행시키세요. 물론 PC와 ComfilePi는 RS232C로 연결되어 있어야 합니다. ComfilePi에서 ''date'' 또는 ''time'' 을 타이핑하면, PC측 (server)에서 응답을 합니다. | {{ :comfilepi:monoserialport:client.png?nolink&500 |}} | {{ :comfilepi:monoserialport:server.png?nolink&500 |}} | {{ :comfilepi:monoserialport:datetimequery.zip | [소스 다운로드]}} [[comfilepi:index#추가설명|상위 페이지로 이동]]