|
DCL 4.1
|
#include <SerialPort.h>
Static Public Member Functions | |
| static bool | access (const String &_path) |
| Static Public Member Functions inherited from File | |
| static File * | openTempFile (const String &_dirname, const String &_prefix, unsigned int _mode=0666) __DCL_THROWS1(IOException *) |
Protected Member Functions | |
| virtual bool | onEvent (short _revents, PollThread *_pPollThread) __DCL_THROWS1(IOException *) |
| Protected Member Functions inherited from File | |
| File () | |
| File (HandleType _handle, const String &_path) | |
| Protected Member Functions inherited from Object | |
| virtual | ~Object () |
| Object () | |
Additional Inherited Members | |
| Public Types inherited from File | |
| enum | Whence { BEGIN , CURRENT , END } |
| Public Member Functions inherited from File | |
| virtual String | toString () const |
| virtual | ~File () |
| File (const String &_path, int _oflags=READONLY, int _mode=0666) __DCL_THROWS1(IOException *) | |
| void | open (const String &_path, int _oflags=READONLY, int _mode=0666) __DCL_THROWS1(IOException *) |
| File (HandleType _handle, int _ohints, bool _closeOnClose) __DCL_THROWS1(IOException *) | |
| void | open (HandleType _handle, int _ohints, bool _closeOnClose) __DCL_THROWS1(IOException *) |
| virtual void | sync () __DCL_THROWS1(IOException *) |
| virtual void | close () __DCL_THROWS1(IOException *) |
| virtual size_t | available () const __DCL_THROWS1(IOException *) |
| virtual size_t | read (void *_buf, size_t _n) __DCL_THROWS1(IOException *) |
| virtual size_t | write (const void *_buf, size_t _n) __DCL_THROWS1(IOException *) |
| off_t | seek (off_t _offset, int _whence) __DCL_THROWS1(IOException *) |
| off_t | size () const __DCL_THROWS1(IOException *) |
| DateTime | mtime () const __DCL_THROWS1(IOException *) |
| bool | time (time_t *_atime, time_t *_mtime, time_t *_ctime) const |
| HandleType | handle () const |
| const String & | path () const |
| Public Member Functions inherited from Object | |
| virtual void | destroy () |
| String | className () const |
| bool | isInstanceOf (const std::type_info &typeinfo) const |
| virtual const std::type_info & | typeInfo () const |
| Protected Attributes inherited from File | |
| String | __path |
| HandleType | __handle |
| bool | __closeOnClose |
직렬포트 관련 장치파일을 구성하고 접근한다.
직렬포트에 대한 파일명은 UNIX에서 /dev/tty#N, /dev/ttyS#N, /dev/ttyUSB#N 과 같은 것들이고, Windows에서는 COM#N 등 이다.
Linux에서 직렬포트는 프로세스가 uucp그룹에 포함되어 있지 않으면 접근이 거부되므로 확인한다.
이 클래스는 직렬포트의 Non-Blocking 입출력에 대하여 준비되어 있다. 자세한 사용방법은 SerialPollThread를 참고한다.
USB-Serial 장치를 사용하는 경우 실행시간에 포트가 제거될 수 있다. UNIX의 경우 onEvent(Events _events, SerialPollThread* _pWatcher)의 _events에 POLLHUP가 전달 되고, Windows의 경우 File::read(void* _buf, size_t _n), File::write(const void* _buf, size_t n)의 호출 과정에서 예외를 처리해야 한다. Windows 에러코드는 ERROR_ACCESS_DENIED (5)이다.
Definition at line 51 of file SerialPort.h.
|
static |
주어진 경로의 가능 여부를 확인한다.
UNIX에서는 access(R_OK | W_OK)로 확인하고, Windows에서는 경로를 열어보고 그 결과를 반환한다.
Definition at line 245 of file SerialPort.cpp.
|
protectedvirtual |
SerialPollThread에의해 감시되다가 이벤트가 발생되었을 때 호출된다.
Implements PollAble.
Definition at line 270 of file SerialPort.cpp.