メインページ | ネームスペース一覧 | クラス階層 | 構成 | Directories | ファイル一覧 | ネームスペースメンバ | 構成メンバ | ファイルメンバ | 関連ページ

WBComStream.h

00001 #ifndef COMSTREAM_H
00002 #define COMSTREAM_H
00003 #if _MSC_VER >= 1000
00004 #pragma once
00005 #endif // _MSC_VER >= 1000
00006 
00007 #include <Base/StrbufBase.h>
00008 #include "WBWin.h"
00009 #include <iostream>
00010 
00011 namespace Spr {;
00012 
00013 class WBComStream;
00014 class WBComStreambuf;
00015 
00016 /// シリアルの設定
00017 struct WBComStatus{
00018     enum {FC_NONE, FC_DTRDSR, FC_RTSCTS, FC_HARDWARE,
00019         FC_XONXOFF, FC_SOFTWARE=FC_XONXOFF} flowControl;
00020     int     port;
00021     DWORD   boudRate;
00022     BYTE    byteSize;
00023     BYTE    parity;
00024     BYTE    stopBits;
00025     WBComStatus();
00026 };
00027 
00028 class SPR_DLL WBComStreambuf:public UTStreambufBase, public WBComStatus
00029     {
00030     int error;
00031     friend WBComStream;
00032     public:
00033     enum {COMBUFLEN = 4096};    
00034     enum {ASCII_XON = 0x11, ASCII_XOFF = 0x13};
00035     WBComStreambuf(const WBComStatus& cs,
00036         char* gb, int gl, char* pb, int pl);
00037     BCC_CDECL ~WBComStreambuf();
00038     protected:
00039     HANDLE hFile;
00040     bool init();
00041     bool init(const WBComStatus& cs);
00042     bool openConnection();
00043     bool setupConnection();
00044     void closeConnection();
00045     void cleanup();
00046     UINT read(void* buf, UINT bufLen);
00047     UINT write(void* buf, UINT bufLen);
00048     UINT comAvail();
00049     UINT comWaiting();
00050     virtual int in_avail_stream()
00051         {
00052         return comAvail();
00053         }
00054 };
00055 /// シリアル通信ストリーム
00056 class SPR_DLL WBComStream:public std::iostream{
00057     char getbuf[1024];
00058     char putbuf[1024];
00059 public:
00060     WBComStatus comStatus;
00061     WBComStream(const WBComStatus& cs);
00062     WBComStream();
00063     BCC_CDECL ~WBComStream();
00064     WBComStreambuf buf;
00065     int avail();                        ///<    読み出しバッファに溜まっているバイト数を返す.
00066     bool init(const WBComStatus& cs);   ///<    初期化.
00067     };
00068 }   //  namespace Spr
00069 #endif

Springheadに対してSun Apr 16 01:57:58 2006に生成されました。  doxygen 1.4.1