Rudiments
/home/dmuse/src/rudiments/include/rudiments/serialportprofile.h
00001 // Copyright (c) 2004 David Muse
00002 // See the COPYING file for more information.
00003 
00004 #ifndef RUDIMENTS_SERIALPORTPROFILE_H
00005 #define RUDIMENTS_SERIALPORTPROFILE_H
00006 
00007 #include <rudiments/private/serialportprofileincludes.h>
00008 
00009 #ifdef RUDIMENTS_NAMESPACE
00010 namespace rudiments {
00011 #endif
00012 
00013 class serialportprofileprivate;
00014 
00015 // cfmakeraw, cfsetspeed???
00016 // wraps struct termios
00017 
00027 class RUDIMENTS_DLLSPEC serialportprofile {
00028         public:
00029 
00030                 enum    inputmode_t {
00031                         cannonical=0,
00032                         raw
00033                 };
00034 
00035                 enum    flowcontrol_t {
00036                         fc_none=0,
00037                         fc_software,
00038                         fc_hardware
00039                 };
00040 
00041                 enum    baudrate_t {
00042                         baud_0=0,
00043                         baud_50,
00044                         baud_75,
00045                         baud_110,
00046                         baud_134,
00047                         baud_150,
00048                         baud_200,
00049                         baud_300,
00050                         baud_600,
00051                         baud_1200,
00052                         baud_1800,
00053                         baud_2400,
00054                         baud_4800,
00055                         baud_9600,
00056                         baud_19200,
00057                         exta,
00058                         baud_38400,
00059                         extb,
00060                         baud_57600,
00061                         baud_76800,
00062                         baud_115200,
00063                         baud_230400,
00064                         baud_460800,
00065                         baud_500000,
00066                         baud_576000,
00067                         baud_921600,
00068                         baud_1000000,
00069                         baud_1152000,
00070                         baud_1500000,
00071                         baud_2000000,
00072                         baud_2500000,
00073                         baud_3000000,
00074                         baud_3500000,
00075                         baud_4000000
00076                 };
00077 
00078                 enum    charsize_t {
00079                         cs_5=0,
00080                         cs_6,
00081                         cs_7,
00082                         cs_8
00083                 };
00084 
00085                 enum    newlinedelay_t {
00086                         nl_none=0,
00087                         nl_100
00088                 };
00089 
00090                 enum    carriagereturndelay_t {
00091                         cr_none=0,
00092                         cr_depends,
00093                         cr_100,
00094                         cr_150
00095                 };
00096 
00097                 enum    tabdelay_t {
00098                         td_0=0,
00099                         td_1,
00100                         td_2,
00101                         td_xtabs
00102                 };
00103 
00104                 enum    backspacedelay_t {
00105                         bs_none=0,
00106                         bs_50
00107                 };
00108 
00109                 enum    verticaltabdelay_t {
00110                         vt_none=0,
00111                         vt_2
00112                 };
00113 
00114                 enum    formfeeddelay_t {
00115                         ff_none=0,
00116                         ff_2
00117                 };
00118 
00120                 serialportprofile();
00121 
00123                 ~serialportprofile();
00124 
00126                 void    defaultControlOptions();
00127 
00129                 void    defaultLocalOptions();
00130 
00132                 void    defaultInputOptions();
00133 
00135                 void    defaultOutputOptions();
00136 
00138                 void    defaultControlCharacters();
00139 
00142                 void    defaultOptions();
00143 
00147                 void    setControlCharacters(const unsigned char *c_cc);
00148 
00155                 void    evalOptionsString(const char *string);
00156 
00158                 void            inputMode(inputmode_t inputmode);
00159 
00161                 inputmode_t     inputMode();
00162 
00164                 void            flowControl(flowcontrol_t flowcontrol);
00165 
00167                 flowcontrol_t   flowControl();
00168 
00170                 void    baud(const char *baudrate);
00171 
00173                 void    baud(baudrate_t baudrate);
00174 
00176                 bool    inputBaud(const char *baudrate);
00177 
00179                 bool    inputBaud(baudrate_t baudrate);
00180 
00182                 bool    outputBaud(const char *baudrate);
00183 
00185                 bool    outputBaud(baudrate_t baudrate);
00186 
00189                 void    characterSize(charsize_t size);
00190 
00195                 void    twoStopBits(bool truefalse);
00196 
00202                 void    receiverOn(bool truefalse);
00203 
00207                 void    parityCheck(bool truefalse);
00208 
00213                 void    oddParity(bool truefalse);
00214 
00219                 void    hangupOnClose(bool truefalse);
00220 
00229                 void    ignoreModemControlLines(bool truefalse);
00230 
00234                 void    blockJobControlOutput(bool truefalse);
00235 
00240                 void    hardwareFlowControl(bool truefalse);
00241 
00243                 baudrate_t      baud();
00244 
00246                 baudrate_t      inputBaud();
00247 
00249                 baudrate_t      outputBaud();
00250 
00252                 charsize_t      characterSize();
00253 
00255                 bool            twoStopBits();
00256 
00258                 bool            receiverOn();
00259 
00261                 bool            parityCheck();
00262 
00264                 bool            oddParity();
00265 
00269                 bool            hangupOnClose();
00270 
00273                 bool            ignoreModemControlLines();
00274 
00277                 bool            blockJobControlOutput();
00278 
00281                 bool            hardwareFlowControl();
00282 
00287                 void    generateSignals(bool truefalse);
00288 
00295                 void    canonicalInput(bool truefalse);
00296 
00307                 void    escapedUpperCase(bool truefalse);
00308 
00311                 void    echoInput(bool truefalse);
00312 
00318                 void    eraseCharactersOn(bool truefalse);
00319 
00323                 void    killCharacterOn(bool truefalse);
00324 
00328                 void    echoNewLine(bool truefalse);
00329 
00335                 void    extendedFunctions(bool truefalse);
00336 
00341                 void    echoControlCharacters(bool truefalse);
00342 
00346                 void    echoErasedCharacter(bool truefalse);
00347 
00354                 void    emulateKill(bool truefalse);
00355 
00359                 void    noFlushAfterInterruptOrQuit(bool truefalse);
00360 
00364                 void    retypePendingCharacters(bool truefalse);
00365 
00370                 void    sendSignalForBackgroundOutput(bool truefalse);
00371 
00375                 bool    generateSignals();
00376 
00380                 bool    canonicalInput();
00381 
00387                 bool    escapedUpperCase();
00388 
00390                 bool    echoInput();
00391 
00396                 bool    eraseCharactersOn();
00397 
00400                 bool    killCharacterOn();
00401 
00404                 bool    echoNewLine();
00405 
00410                 bool    extendedFunctions();
00411 
00415                 bool    echoControlCharacters();
00416 
00419                 bool    echoErasedCharacter();
00420 
00424                 bool    emulateKill();
00425 
00429                 bool    noFlushAfterInterruptOrQuit();
00430 
00433                 bool    retypePendingCharacters();
00434 
00438                 bool    sendSignalForBackgroundOutput();
00439 
00442                 void    inputParityCheck(bool truefalse);
00443 
00448                 void    ignoreParityErrors(bool truefalse);
00449 
00455                 void    markParityErrors(bool truefalse);
00456 
00459                 void    stripParityBits(bool truefalse);
00460 
00463                 void    softwareFlowControlOnOutput(bool truefalse);
00464 
00467                 void    softwareFlowControlOnInput(bool truefalse);
00468 
00471                 void    anyCharacterStartsFlow(bool truefalse);
00472 
00475                 void    ignoreBreak(bool truefalse);
00476 
00484                 void    sendSignalOnBreak(bool truefalse);
00485 
00488                 void    mapNewLineToCarriageReturnOnInput(bool truefalse);
00489 
00492                 void    discardEndOfTransmission(bool truefalse);
00493 
00496                 void    ignoreCarriageReturn(bool truefalse);
00497 
00500                 void    mapCarriageReturnToNewLineOnInput(bool truefalse);
00501 
00504                 void    lowerCase(bool truefalse);
00505 
00508                 void    bellIfLineTooLong(bool truefalse);
00509 
00511                 bool    inputParityCheck();
00512 
00514                 bool    ignoreParityErrors();
00515 
00518                 bool    markParityErrors();
00519 
00522                 bool    stripParityBits();
00523 
00526                 bool    softwareFlowControlOnOutput();
00527 
00530                 bool    softwareFlowControlOnInput();
00531 
00533                 bool    anyCharacterStartsFlow();
00534 
00536                 bool    ignoreBreak();
00537 
00542                 bool    sendSignalOnBreak();
00543 
00546                 bool    mapNewLineToCarriageReturnOnInput();
00547 
00549                 bool    discardEndOfTransmission();
00550 
00552                 bool    ignoreCarriageReturn();
00553 
00556                 bool    mapCarriageReturnToNewLineOnInput();
00557 
00560                 bool    lowerCase();
00561 
00564                 bool    bellIfLineTooLong();
00565 
00566 
00569                 void    postProcessOutput(bool truefalse);
00570 
00573                 void    outputUpperCase(bool truefalse);
00574 
00577                 void    mapNewLineToCarriageReturnNewLineOnOutput(
00578                                                         bool truefalse);
00579 
00582                 void    mapCarriageReturnToNewLineOnOutput(bool truefalse);
00583 
00586                 void    dontOutputCarriageReturnAtColumnZero(bool truefalse);
00587 
00590                 void    mapNewLineToCarriageReturnOnOutput(bool truefalse);
00591 
00595                 void    useFillCharactersForDelay(bool truefalse);
00596 
00600                 void    useDelForFill(bool truefalse);
00601 
00604                 void    expandTabToSpaces(bool truefalse);
00605 
00608                 void    delayAfterNewLine(newlinedelay_t nldelay);
00609 
00612                 void    delayAfterCarriageReturn(carriagereturndelay_t crdelay);
00613 
00616                 void    delayAfterTab(tabdelay_t tabdelay);
00617 
00620                 void    delayAfterBackSpace(backspacedelay_t bsdelay);
00621 
00624                 void    delayAfterVerticalTab(verticaltabdelay_t vtdelay);
00625 
00628                 void    delayAfterFormFeed(formfeeddelay_t ffdelay);
00629 
00632                 bool    postProcessOutput();
00633 
00636                 bool    outputUpperCase();
00637 
00640                 bool    mapNewLineToCarriageReturnNewLineOnOutput();
00641 
00644                 bool    mapCarriageReturnToNewLineOnOutput();
00645 
00648                 bool    dontOutputCarriageReturnAtColumnZero();
00649 
00652                 bool    mapNewLineToCarriageReturnOnOutput();
00653 
00656                 bool    useFillCharactersForDelay();
00657 
00660                 bool    useDelForFill();
00661 
00663                 bool    expandTabToSpaces();
00664 
00667                 newlinedelay_t          delayAfterNewLine();
00668 
00671                 carriagereturndelay_t   delayAfterCarriageReturn();
00672 
00674                 tabdelay_t              delayAfterTab();
00675 
00678                 backspacedelay_t        delayAfterBackSpace();
00679 
00682                 verticaltabdelay_t      delayAfterVerticalTab();
00683 
00686                 formfeeddelay_t         delayAfterFormFeed();
00687 
00692                 void    interruptCharacter(unsigned char character);
00693 
00698                 void    quitCharacter(unsigned char character);
00699 
00703                 void    eraseCharacter(unsigned char character);
00704 
00708                 void    killCharacter(unsigned char character);
00709 
00715                 void    endOfFileCharacter(unsigned char character);
00716 
00720                 void    endOfLineCharacter(unsigned char character);
00721 
00725                 void    secondEndOfLineCharacter(unsigned char character);
00726 
00729                 void    switchCharacer(unsigned char character);
00730 
00733                 void    startCharacter(unsigned char character);
00734 
00737                 void    stopCharacter(unsigned char character);
00738 
00743                 void    suspendCharacter(unsigned char character);
00744 
00749                 void    delayedSuspendCharacter(unsigned char character);
00750 
00755                 void    literalNextCharcter(unsigned char character);
00756 
00760                 void    wordEraseCharcter(unsigned char character);
00761 
00766                 void    reprintCharacter(unsigned char character);
00767 
00772                 void    discardPendingOutputCharacter(unsigned char character);
00773 
00776                 void    statusRequestCharacter(unsigned char character);
00777 
00782                 void    readThreshold(unsigned char count);
00783 
00788                 void    readTimeout(unsigned char deciseconds);
00789 
00790 
00794                 unsigned char   interruptCharacter();
00795 
00799                 unsigned char   quitCharacter();
00800 
00803                 unsigned char   eraseCharacter();
00804 
00807                 unsigned char   killCharacter();
00808 
00813                 unsigned char   endOfFileCharacter();
00814 
00817                 unsigned char   endOfLineCharacter();
00818 
00821                 unsigned char   secondEndOfLineCharacter();
00822 
00824                 unsigned char   switchCharacer();
00825 
00827                 unsigned char   startCharacter();
00828 
00830                 unsigned char   stopCharacter();
00831 
00835                 unsigned char   suspendCharacter();
00836 
00840                 unsigned char   delayedSuspendCharacter();
00841 
00845                 unsigned char   literalNextCharcter();
00846 
00849                 unsigned char   wordEraseCharcter();
00850 
00851 
00855                 unsigned char   reprintCharacter();
00856 
00860                 unsigned char   discardPendingOutputCharacter();
00861 
00863                 unsigned char   statusRequestCharacter();
00864 
00868                 unsigned char   readThreshold();
00869 
00873                 unsigned char   readTimeout();
00874 
00875         #include <rudiments/private/serialportprofile.h>
00876 };
00877 
00878 #ifdef RUDIMENTS_NAMESPACE
00879 }
00880 #endif
00881 
00882 #endif