亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dcb32.cpp

?? DOS下采用中斷接收數(shù)據(jù)的串口通訊的例子,很難找到的好東西!
?? CPP
字號:
//
//  DCB32.CPP
//
//  Source code from:
//
//  Serial Communications: A C++ Developer's Guide, 2nd Edition
//  by Mark Nelson, M&T Books, 1999
//
// The m_Dcb member of the Win32Port class is used to hold most
// of the information regarding the current state of the port.
// The only reason that the DCB was encapsulated into this
// class was simply to make the Win32Port code more readable.
// The Win32Port code becomes more readable because a lot of
// the initialization code for the various members is offloaded
// to the Dcb class. Note that this class is derived from the
// DCB structure defined in the WIN32 header files, so any
// function that takes a pointer to a DCB can take a pointer to
// one of these structures as well.


#include <cctype>

#include "rs232.h"
#include "Dcb32.h"

//
// The Dcb32 constructor initializes every member of the base
// class DCB, so that you get to skip all the initialization
// code you would normally have in a class that has a member of
// this type. In particular, the Win32Port constructor gets to
// take advantage of this by passively allowing the Dcb
// constructor to be invoked.
//

Dcb32::Dcb32()
{
    DCBlength = sizeof( DCB ); //Windows API expects this
    BaudRate = 38400;           //Default baud rate
    fBinary = TRUE;            //Under Win32 this should always be true
    fParity = FALSE;           //Our default is no parity
    fOutxCtsFlow = FALSE;      //Default is no RTS/CTS flow control
    fOutxDsrFlow = FALSE;      //Default is no DTR/DSR flow control
    fDtrControl = DTR_CONTROL_ENABLE; //Assert DTR by default
    fDsrSensitivity = FALSE;   //Ignore incoming DSR by default
    fTXContinueOnXoff = FALSE; //No special action on Xoff by default
    fOutX = FALSE;             //No outbound XON/XOFF handshaking
    fInX = FALSE;              //No incoming XON/XOFF handshaking
    fErrorChar = FALSE;           //No special character on line errors
    fNull = FALSE;             //No null detection
    fRtsControl = RTS_CONTROL_ENABLE; //Assert RTS by default
    fAbortOnError = TRUE;      //Always respond to errors
    fDummy2 = 0;
    wReserved = 0;
    XonLim = 128;               //Issue XON when 128 characters left
    XoffLim = 128;             //Issue XOFF when space left = 128
    ByteSize = 8;              //Default word size
    Parity = NOPARITY;         //Default is no parity
    StopBits = ONESTOPBIT;     //Default is one stop bit
    XonChar = 0x11;            //Default XON is ^Q
    XoffChar = 0x13;           //Default XOFF is ^S
    ErrorChar = 0;             //Not using error char, don't care
    EofChar = 0;               //Not using EOF char, don't care
    EvtChar = 0;               //Not using event char, don't care
};

//
// Setting the baud rate is as simple as stuffing it verbatim
// into the DCB. There are some intricacies regarding baud rate
// management in the Win32 API, but we don't get into them
// here.
//
void Dcb32::SetBaudRate( int rate )
{
    if ( rate != UNCHANGED )
        BaudRate = rate;
}

//
// Setting parity is done by passing a single character that is
// the first character in the name of the parity being
// selected. The actual setting of the parity affects two
// members of the DCB. The fParity member tells the driver
// whether or not to pay any attention to parity. The Parity
// member tells it which parity to use if fParity is set.

void Dcb32::SetParity( int parity, RS232Error &error )
{
    switch ( toupper( parity ) ) {
    case 'N'       : fParity = FALSE; Parity = NOPARITY;    break;
    case 'E'       : fParity = TRUE;  Parity = EVENPARITY;  break;
    case 'O'       : fParity = TRUE;  Parity = ODDPARITY;   break;
    case 'M'       : fParity = TRUE;  Parity = MARKPARITY;  break;
    case 'S'       : fParity = TRUE;  Parity = SPACEPARITY; break;
    case UNCHANGED :                              break;
    default        : error = RS232_ILLEGAL_PARITY_SETTING;
    }
};

//
// The word length setting is trivial.
//
void Dcb32::SetWordLength( int word_length, RS232Error &error )
{
    switch ( word_length ) {
    case 5         : ByteSize = 5; break;
    case 6         : ByteSize = 6; break;
    case 7         : ByteSize = 7; break;
    case 8         : ByteSize = 8; break;
    case UNCHANGED : break;
    default        : error = RS232_ILLEGAL_WORD_LENGTH;
    }
}

//
// Setting the number of stop bits is nice and simple. I don't
// take into account the possibility of 1.5 stop bits in this
// function, as it really serves no practical purpose.
//
void Dcb32::SetStopBits( int stop_bits, RS232Error &error )
{
    switch ( stop_bits ) {
    case 1              : StopBits = ONESTOPBIT;  break;
    case 2              : StopBits = TWOSTOPBITS; break;
    case UNCHANGED    :                            break;
    default           : error = RS232_ILLEGAL_STOP_BITS; break;
    }
}

//
// Setting DTR is fairly simple. Note that this has an
// unintended side effect. If DTR/DSR handshaking was enabled
// before this call, it won't be any more. So you should either
// call this function before you set up handshaking, or skip
// the call if handshaking is enabled.
//
void Dcb32::SetDtr( int value )
{
    if ( value == UNCHANGED )
        return;
    else if ( value )
        fDtrControl = DTR_CONTROL_ENABLE;
    else
        fDtrControl = DTR_CONTROL_DISABLE;
}

//
// Setting RTS is fairly simple. Note that this has an
// unintended side effect. If RTS/CTS handshaking was enabled
// before this call, it won't be any more. So you should either
// call this function before you set up handshaking, or skip
// the call if handshaking is enabled.
//
void Dcb32::SetRts( int value )
{
    if ( value == UNCHANGED )
        return;
    else if ( value )
        fRtsControl = RTS_CONTROL_ENABLE;
    else
        fRtsControl = RTS_CONTROL_DISABLE;
}

//
// This function either turns XON/XOFF handshking on or off. It
// assumes that the high and low water marks have already been
// set to where you would like them, and that the definitons of
// the XON and XOFF characters have already been made. Since
// these are set up in the Dcb32 constructor, the odds are that
// they still have good values.
//
void Dcb32::SetXonXoff( int value )
{
    if ( value != UNCHANGED ) {
        if ( value ) {
            fOutX = TRUE;
            fInX = TRUE;
        } else {
            fOutX = FALSE;
            fInX = FALSE;
        }
    }
}

//
// If DTR/DSR handshaking is to be enabled, this function sets
// the control bits for both input and output handshaking. If
// handshaking is not to be enabled, the inbound sensitivity
// bit is turned off. However, we don't do anything about the
// outbound control of DTR if handshaking is to be turned off.
// We assume that the caller will have already set DTR to the
// setting they desire.
//

void Dcb32::SetDtrDsr( int value )
{
    if ( value != UNCHANGED ) {
        if ( value ) {
            fDtrControl = DTR_CONTROL_HANDSHAKE;
            fOutxDsrFlow = TRUE;
        } else
            fOutxDsrFlow = FALSE;
    }
}

//
// If RTS/CTS handshaking is to be enabled, this function sets
// the control bits for both input and output handshaking. If
// handshaking is not to be enabled, the inbound sensitivity
// bit is turned off. However, we don't do anything about the
// outbound control of RTS if handshaking is to be turned off.
// We assume that the caller will have already set RTS to the
// setting they desire.
//
void Dcb32::SetRtsCts( int value )
{
    if ( value != UNCHANGED ) {
        if ( value ) {
            fRtsControl = RTS_CONTROL_HANDSHAKE;
            fOutxCtsFlow = TRUE;
        } else
            fOutxCtsFlow = FALSE;
    }
}

//EOF Dcb32.cpp

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久99久久精品国产片果冻| 亚洲色欲色欲www在线观看| 香蕉乱码成人久久天堂爱免费| 99久久精品免费看国产| 国产精品不卡一区| 91猫先生在线| 亚洲一区二区三区在线| 欧美性大战久久久久久久蜜臀| 亚洲国产美女搞黄色| 欧美精品在线一区二区| 免费人成网站在线观看欧美高清| 91精品国产综合久久久蜜臀图片| 免费看精品久久片| 国产三级三级三级精品8ⅰ区| 粗大黑人巨茎大战欧美成人| 亚洲日韩欧美一区二区在线| 欧美视频中文字幕| 蜜桃在线一区二区三区| 久久综合九色综合97婷婷| 丁香激情综合五月| 夜夜嗨av一区二区三区网页| 欧美精品 日韩| 国产精品一区二区三区99| 亚洲欧美中日韩| 欧美在线观看一区| 激情综合色播激情啊| 国产精品蜜臀在线观看| 欧洲亚洲国产日韩| 伦理电影国产精品| 中文字幕一区二区三区不卡| 欧美日韩另类一区| 国产成人免费9x9x人网站视频| 亚洲欧洲精品天堂一级| 91精品婷婷国产综合久久性色| 国产二区国产一区在线观看| 一个色妞综合视频在线观看| www一区二区| 欧美午夜一区二区三区免费大片| 看片网站欧美日韩| 亚洲免费观看高清完整版在线观看熊 | 一区二区理论电影在线观看| 4438x成人网最大色成网站| 国产91精品露脸国语对白| 亚洲一区二区在线播放相泽| 国产亚洲精久久久久久| 欧美日韩国产小视频在线观看| 国产成人综合视频| 天天综合网天天综合色| 久久久久久久av麻豆果冻| 91首页免费视频| 国内精品伊人久久久久av影院| 亚洲精品免费一二三区| 国产色产综合产在线视频| 欧美午夜寂寞影院| 91麻豆文化传媒在线观看| 国产大陆a不卡| 国产三级欧美三级日产三级99 | 色哟哟在线观看一区二区三区| 日韩欧美国产1| 丁香六月久久综合狠狠色| 美女一区二区三区| 亚洲国产aⅴ天堂久久| 亚洲国产精华液网站w| 精品乱码亚洲一区二区不卡| 欧美日韩三级在线| 精品无人区卡一卡二卡三乱码免费卡| 精品亚洲成a人在线观看| 国产真实乱对白精彩久久| 福利电影一区二区| 色屁屁一区二区| 欧美日本一区二区在线观看| 精品国产免费人成在线观看| 国产喷白浆一区二区三区| 亚洲乱码日产精品bd| 亚洲成人福利片| 国产在线播放一区二区三区| 大胆欧美人体老妇| 欧美三级日本三级少妇99| 欧美tickling挠脚心丨vk| 国产精品伦理在线| 亚洲午夜久久久久中文字幕久| 蜜桃一区二区三区在线| 成人精品免费网站| 678五月天丁香亚洲综合网| 欧美成人猛片aaaaaaa| 国产精品三级视频| 日日骚欧美日韩| 成人免费av网站| 欧美一区二区三区喷汁尤物| 国产日韩影视精品| 亚洲成人免费视频| 国产xxx精品视频大全| 在线视频国内自拍亚洲视频| 日韩精品一区二区三区视频播放 | 国产女人18水真多18精品一级做 | 国产做a爰片久久毛片| 91网站最新地址| 日韩精品中午字幕| 亚洲人成网站精品片在线观看| 麻豆精品一二三| 欧美最猛黑人xxxxx猛交| 久久久天堂av| 日韩电影免费在线观看网站| 99久久综合色| 精品国产精品网麻豆系列| 亚洲卡通欧美制服中文| 国产91精品一区二区| 91精品视频网| 亚洲一区电影777| 成人av动漫网站| wwww国产精品欧美| 天堂蜜桃91精品| 色猫猫国产区一区二在线视频| 国产亚洲精久久久久久| 老司机午夜精品99久久| 欧美日韩一本到| 亚洲另类一区二区| 成人av电影免费在线播放| 26uuu国产在线精品一区二区| 日韩成人精品在线观看| 欧美性大战久久| 亚洲一区二区三区爽爽爽爽爽| 成人激情小说网站| 欧美国产精品一区二区三区| 国内精品国产成人国产三级粉色 | 日韩毛片高清在线播放| 国产一区二区三区黄视频 | 欧美最猛性xxxxx直播| 中文字幕一区二区三区不卡| 国产在线国偷精品产拍免费yy| 6080yy午夜一二三区久久| 亚洲一区二区免费视频| 色哦色哦哦色天天综合| 亚洲免费成人av| 色综合天天综合网国产成人综合天 | 在线观看视频一区二区| 专区另类欧美日韩| 成人99免费视频| 国产精品久久久久三级| 成人免费看视频| 国产精品色呦呦| 99久久99精品久久久久久| 亚洲特级片在线| 日本福利一区二区| 亚洲一区二区影院| 欧美伊人久久久久久午夜久久久久| 国产精品久久久久久久久搜平片 | 国产精品久久国产精麻豆99网站| 粉嫩欧美一区二区三区高清影视 | 精品欧美久久久| 国产永久精品大片wwwapp| 久久亚洲精精品中文字幕早川悠里| 91麻豆精品91久久久久同性| 亚洲bt欧美bt精品| 日韩三级视频在线看| 麻豆精品一区二区av白丝在线| 精品久久久久香蕉网| 国产综合色视频| 欧美激情一区二区三区不卡| 成人网页在线观看| 亚洲欧美另类久久久精品2019| 欧美亚洲国产怡红院影院| 亚洲mv在线观看| 精品国产一区二区三区忘忧草 | 日韩欧美一区在线观看| 久久精品久久99精品久久| 久久精品网站免费观看| 92精品国产成人观看免费| 亚洲无人区一区| 精品免费日韩av| 成人18视频在线播放| 亚洲动漫第一页| 久久久久久久久久看片| 97精品久久久久中文字幕 | 老司机免费视频一区二区三区| 国产亚洲自拍一区| 在线观看不卡视频| 韩国女主播成人在线| 亚洲免费大片在线观看| 日韩精品一区二区三区中文精品| 波多野结衣中文一区| 视频精品一区二区| 欧美国产禁国产网站cc| 在线电影一区二区三区| 国产一区二区三区精品视频| 亚洲精品乱码久久久久久| 欧美一区二区三级| 91一区一区三区| 精品亚洲免费视频| 亚洲综合免费观看高清完整版 | 一区二区三区在线免费视频| 日韩你懂的在线观看| 91碰在线视频| 久久99国内精品| 一区二区成人在线视频| 久久嫩草精品久久久精品| 欧美在线不卡视频| 国产91精品露脸国语对白| 日韩精品一二三四| 亚洲日本中文字幕区|