Rudiments: /home/dmuse/temp/rudiments/include/rudiments/serialportprofile.h Source File

Rudiments

serialportprofile.h
1 // Copyright (c) 1999-2018 David Muse
2 // See the COPYING file for more information.
3
4 #ifndef RUDIMENTS_SERIALPORTPROFILE_H
5 #define RUDIMENTS_SERIALPORTPROFILE_H
6
7 #include <rudiments/private/serialportprofileincludes.h>
8
9 // cfmakeraw, cfsetspeed???
10 // wraps struct termios
11
21 class RUDIMENTS_DLLSPEC serialportprofile {
22 public:
23
24 enum inputmode_t {
25 cannonical=0,
26 raw
27 };
28
29 enum flowcontrol_t {
30 fc_none=0,
31 fc_software,
32 fc_hardware
33 };
34
35 enum baudrate_t {
36 baud_0=0,
37 baud_50,
38 baud_75,
39 baud_110,
40 baud_134,
41 baud_150,
42 baud_200,
43 baud_300,
44 baud_600,
45 baud_1200,
46 baud_1800,
47 baud_2400,
48 baud_4800,
49 baud_9600,
50 baud_19200,
51 exta,
52 baud_38400,
53 extb,
54 baud_57600,
55 baud_76800,
56 baud_115200,
57 baud_230400,
58 baud_460800,
59 baud_500000,
60 baud_576000,
61 baud_921600,
62 baud_1000000,
63 baud_1152000,
64 baud_1500000,
65 baud_2000000,
66 baud_2500000,
67 baud_3000000,
68 baud_3500000,
69 baud_4000000
70 };
71
72 enum charsize_t {
73 cs_5=0,
74 cs_6,
75 cs_7,
76 cs_8
77 };
78
79 enum newlinedelay_t {
80 nl_none=0,
81 nl_100
82 };
83
84 enum carriagereturndelay_t {
85 cr_none=0,
86 cr_depends,
87 cr_100,
88 cr_150
89 };
90
91 enum tabdelay_t {
92 td_0=0,
93 td_1,
94 td_2,
95 td_xtabs
96 };
97
98 enum backspacedelay_t {
99 bs_none=0,
100 bs_50
101 };
102
103 enum verticaltabdelay_t {
104 vt_none=0,
105 vt_2
106 };
107
108 enum formfeeddelay_t {
109 ff_none=0,
110 ff_2
111 };
112
114 serialportprofile();
115
117 ~serialportprofile();
118
120 void defaultControlOptions();
121
123 void defaultLocalOptions();
124
126 void defaultInputOptions();
127
129 void defaultOutputOptions();
130
132 void defaultControlCharacters();
133
136 void defaultOptions();
137
141 void setControlCharacters(const unsigned char *c_cc);
142
149 void evalOptionsString(const char *string);
150
152 void inputMode(inputmode_t inputmode);
153
155 inputmode_t inputMode();
156
158 void flowControl(flowcontrol_t flowcontrol);
159
161 flowcontrol_t flowControl();
162
164 void baud(const char *baudrate);
165
167 void baud(baudrate_t baudrate);
168
170 bool inputBaud(const char *baudrate);
171
173 bool inputBaud(baudrate_t baudrate);
174
176 bool outputBaud(const char *baudrate);
177
179 bool outputBaud(baudrate_t baudrate);
180
183 void characterSize(charsize_t size);
184
189 void twoStopBits(bool truefalse);
190
196 void receiverOn(bool truefalse);
197
201 void parityCheck(bool truefalse);
202
207 void oddParity(bool truefalse);
208
213 void hangupOnClose(bool truefalse);
214
223 void ignoreModemControlLines(bool truefalse);
224
228 void blockJobControlOutput(bool truefalse);
229
234 void hardwareFlowControl(bool truefalse);
235
237 baudrate_t baud();
238
240 baudrate_t inputBaud();
241
243 baudrate_t outputBaud();
244
246 charsize_t characterSize();
247
249 bool twoStopBits();
250
252 bool receiverOn();
253
255 bool parityCheck();
256
258 bool oddParity();
259
263 bool hangupOnClose();
264
267 bool ignoreModemControlLines();
268
271 bool blockJobControlOutput();
272
275 bool hardwareFlowControl();
276
281 void generateSignals(bool truefalse);
282
289 void canonicalInput(bool truefalse);
290
301 void escapedUpperCase(bool truefalse);
302
305 void echoInput(bool truefalse);
306
312 void eraseCharactersOn(bool truefalse);
313
317 void killCharacterOn(bool truefalse);
318
322 void echoNewLine(bool truefalse);
323
329 void extendedFunctions(bool truefalse);
330
335 void echoControlCharacters(bool truefalse);
336
340 void echoErasedCharacter(bool truefalse);
341
348 void emulateKill(bool truefalse);
349
353 void noFlushAfterInterruptOrQuit(bool truefalse);
354
358 void retypePendingCharacters(bool truefalse);
359
364 void sendSignalForBackgroundOutput(bool truefalse);
365
369 bool generateSignals();
370
374 bool canonicalInput();
375
381 bool escapedUpperCase();
382
384 bool echoInput();
385
390 bool eraseCharactersOn();
391
394 bool killCharacterOn();
395
398 bool echoNewLine();
399
404 bool extendedFunctions();
405
409 bool echoControlCharacters();
410
413 bool echoErasedCharacter();
414
418 bool emulateKill();
419
423 bool noFlushAfterInterruptOrQuit();
424
427 bool retypePendingCharacters();
428
432 bool sendSignalForBackgroundOutput();
433
436 void inputParityCheck(bool truefalse);
437
442 void ignoreParityErrors(bool truefalse);
443
449 void markParityErrors(bool truefalse);
450
453 void stripParityBits(bool truefalse);
454
457 void softwareFlowControlOnOutput(bool truefalse);
458
461 void softwareFlowControlOnInput(bool truefalse);
462
465 void anyCharacterStartsFlow(bool truefalse);
466
469 void ignoreBreak(bool truefalse);
470
478 void sendSignalOnBreak(bool truefalse);
479
482 void mapNewLineToCarriageReturnOnInput(bool truefalse);
483
486 void discardEndOfTransmission(bool truefalse);
487
490 void ignoreCarriageReturn(bool truefalse);
491
494 void mapCarriageReturnToNewLineOnInput(bool truefalse);
495
498 void lowerCase(bool truefalse);
499
502 void bellIfLineTooLong(bool truefalse);
503
505 bool inputParityCheck();
506
508 bool ignoreParityErrors();
509
512 bool markParityErrors();
513
516 bool stripParityBits();
517
520 bool softwareFlowControlOnOutput();
521
524 bool softwareFlowControlOnInput();
525
527 bool anyCharacterStartsFlow();
528
530 bool ignoreBreak();
531
536 bool sendSignalOnBreak();
537
540 bool mapNewLineToCarriageReturnOnInput();
541
543 bool discardEndOfTransmission();
544
546 bool ignoreCarriageReturn();
547
550 bool mapCarriageReturnToNewLineOnInput();
551
554 bool lowerCase();
555
558 bool bellIfLineTooLong();
559
560
563 void postProcessOutput(bool truefalse);
564
567 void outputUpperCase(bool truefalse);
568
571 void mapNewLineToCarriageReturnNewLineOnOutput(
572 bool truefalse);
573
576 void mapCarriageReturnToNewLineOnOutput(bool truefalse);
577
580 void dontOutputCarriageReturnAtColumnZero(bool truefalse);
581
584 void mapNewLineToCarriageReturnOnOutput(bool truefalse);
585
589 void useFillCharactersForDelay(bool truefalse);
590
594 void useDelForFill(bool truefalse);
595
598 void expandTabToSpaces(bool truefalse);
599
602 void delayAfterNewLine(newlinedelay_t nldelay);
603
606 void delayAfterCarriageReturn(carriagereturndelay_t crdelay);
607
610 void delayAfterTab(tabdelay_t tabdelay);
611
614 void delayAfterBackSpace(backspacedelay_t bsdelay);
615
618 void delayAfterVerticalTab(verticaltabdelay_t vtdelay);
619
622 void delayAfterFormFeed(formfeeddelay_t ffdelay);
623
626 bool postProcessOutput();
627
630 bool outputUpperCase();
631
634 bool mapNewLineToCarriageReturnNewLineOnOutput();
635
638 bool mapCarriageReturnToNewLineOnOutput();
639
642 bool dontOutputCarriageReturnAtColumnZero();
643
646 bool mapNewLineToCarriageReturnOnOutput();
647
650 bool useFillCharactersForDelay();
651
654 bool useDelForFill();
655
657 bool expandTabToSpaces();
658
661 newlinedelay_t delayAfterNewLine();
662
665 carriagereturndelay_t delayAfterCarriageReturn();
666
668 tabdelay_t delayAfterTab();
669
672 backspacedelay_t delayAfterBackSpace();
673
676 verticaltabdelay_t delayAfterVerticalTab();
677
680 formfeeddelay_t delayAfterFormFeed();
681
686 void interruptCharacter(unsigned char character);
687
692 void quitCharacter(unsigned char character);
693
697 void eraseCharacter(unsigned char character);
698
702 void killCharacter(unsigned char character);
703
709 void endOfFileCharacter(unsigned char character);
710
714 void endOfLineCharacter(unsigned char character);
715
719 void secondEndOfLineCharacter(unsigned char character);
720
723 void switchCharacer(unsigned char character);
724
727 void startCharacter(unsigned char character);
728
731 void stopCharacter(unsigned char character);
732
737 void suspendCharacter(unsigned char character);
738
743 void delayedSuspendCharacter(unsigned char character);
744
749 void literalNextCharcter(unsigned char character);
750
754 void wordEraseCharcter(unsigned char character);
755
760 void reprintCharacter(unsigned char character);
761
766 void discardPendingOutputCharacter(unsigned char character);
767
770 void statusRequestCharacter(unsigned char character);
771
776 void readThreshold(unsigned char count);
777
782 void readTimeout(unsigned char deciseconds);
783
784
788 unsigned char interruptCharacter();
789
793 unsigned char quitCharacter();
794
797 unsigned char eraseCharacter();
798
801 unsigned char killCharacter();
802
807 unsigned char endOfFileCharacter();
808
811 unsigned char endOfLineCharacter();
812
815 unsigned char secondEndOfLineCharacter();
816
818 unsigned char switchCharacer();
819
821 unsigned char startCharacter();
822
824 unsigned char stopCharacter();
825
829 unsigned char suspendCharacter();
830
834 unsigned char delayedSuspendCharacter();
835
839 unsigned char literalNextCharcter();
840
843 unsigned char wordEraseCharcter();
844
845
849 unsigned char reprintCharacter();
850
854 unsigned char discardPendingOutputCharacter();
855
857 unsigned char statusRequestCharacter();
858
862 unsigned char readThreshold();
863
867 unsigned char readTimeout();
868
869 #include <rudiments/private/serialportprofile.h>
870 };
871
872 #endif
character
Definition: character.h:11
serialportprofile
Definition: serialportprofile.h:21
serialportprofile::ignoreParityErrors
bool ignoreParityErrors()
serialportprofile::mapNewLineToCarriageReturnNewLineOnOutput
bool mapNewLineToCarriageReturnNewLineOnOutput()
serialportprofile::lowerCase
bool lowerCase()
serialportprofile::delayAfterCarriageReturn
carriagereturndelay_t delayAfterCarriageReturn()
serialportprofile::echoControlCharacters
bool echoControlCharacters()
serialportprofile::inputMode
void inputMode(inputmode_t inputmode)
serialportprofile::outputBaud
bool outputBaud(const char *baudrate)
serialportprofile::secondEndOfLineCharacter
void secondEndOfLineCharacter(unsigned char character)
serialportprofile::killCharacterOn
void killCharacterOn(bool truefalse)
serialportprofile::noFlushAfterInterruptOrQuit
bool noFlushAfterInterruptOrQuit()
serialportprofile::defaultControlCharacters
void defaultControlCharacters()
serialportprofile::inputBaud
bool inputBaud(baudrate_t baudrate)
serialportprofile::sendSignalForBackgroundOutput
bool sendSignalForBackgroundOutput()
serialportprofile::sendSignalForBackgroundOutput
void sendSignalForBackgroundOutput(bool truefalse)
serialportprofile::flowControl
void flowControl(flowcontrol_t flowcontrol)
serialportprofile::expandTabToSpaces
void expandTabToSpaces(bool truefalse)
serialportprofile::echoNewLine
bool echoNewLine()
serialportprofile::bellIfLineTooLong
void bellIfLineTooLong(bool truefalse)
serialportprofile::baud
void baud(baudrate_t baudrate)
serialportprofile::hardwareFlowControl
bool hardwareFlowControl()
serialportprofile::flowControl
flowcontrol_t flowControl()
serialportprofile::twoStopBits
bool twoStopBits()
serialportprofile::~serialportprofile
~serialportprofile()
serialportprofile::endOfLineCharacter
void endOfLineCharacter(unsigned char character)
serialportprofile::ignoreCarriageReturn
void ignoreCarriageReturn(bool truefalse)
serialportprofile::mapCarriageReturnToNewLineOnInput
void mapCarriageReturnToNewLineOnInput(bool truefalse)
serialportprofile::eraseCharactersOn
bool eraseCharactersOn()
serialportprofile::interruptCharacter
void interruptCharacter(unsigned char character)
serialportprofile::hangupOnClose
bool hangupOnClose()
serialportprofile::dontOutputCarriageReturnAtColumnZero
void dontOutputCarriageReturnAtColumnZero(bool truefalse)
serialportprofile::switchCharacer
unsigned char switchCharacer()
serialportprofile::readThreshold
unsigned char readThreshold()
serialportprofile::hardwareFlowControl
void hardwareFlowControl(bool truefalse)
serialportprofile::defaultOptions
void defaultOptions()
serialportprofile::discardEndOfTransmission
bool discardEndOfTransmission()
serialportprofile::defaultLocalOptions
void defaultLocalOptions()
serialportprofile::delayedSuspendCharacter
void delayedSuspendCharacter(unsigned char character)
serialportprofile::delayAfterFormFeed
void delayAfterFormFeed(formfeeddelay_t ffdelay)
serialportprofile::suspendCharacter
unsigned char suspendCharacter()
serialportprofile::interruptCharacter
unsigned char interruptCharacter()
serialportprofile::oddParity
bool oddParity()
serialportprofile::mapCarriageReturnToNewLineOnOutput
void mapCarriageReturnToNewLineOnOutput(bool truefalse)
serialportprofile::inputBaud
bool inputBaud(const char *baudrate)
serialportprofile::mapCarriageReturnToNewLineOnOutput
bool mapCarriageReturnToNewLineOnOutput()
serialportprofile::bellIfLineTooLong
bool bellIfLineTooLong()
serialportprofile::outputUpperCase
void outputUpperCase(bool truefalse)
serialportprofile::generateSignals
bool generateSignals()
serialportprofile::suspendCharacter
void suspendCharacter(unsigned char character)
serialportprofile::delayAfterNewLine
newlinedelay_t delayAfterNewLine()
serialportprofile::characterSize
void characterSize(charsize_t size)
serialportprofile::startCharacter
unsigned char startCharacter()
serialportprofile::endOfFileCharacter
void endOfFileCharacter(unsigned char character)
serialportprofile::twoStopBits
void twoStopBits(bool truefalse)
serialportprofile::softwareFlowControlOnOutput
void softwareFlowControlOnOutput(bool truefalse)
serialportprofile::characterSize
charsize_t characterSize()
serialportprofile::softwareFlowControlOnOutput
bool softwareFlowControlOnOutput()
serialportprofile::delayAfterCarriageReturn
void delayAfterCarriageReturn(carriagereturndelay_t crdelay)
serialportprofile::canonicalInput
bool canonicalInput()
serialportprofile::parityCheck
bool parityCheck()
serialportprofile::literalNextCharcter
void literalNextCharcter(unsigned char character)
serialportprofile::inputBaud
baudrate_t inputBaud()
serialportprofile::delayAfterTab
void delayAfterTab(tabdelay_t tabdelay)
serialportprofile::reprintCharacter
unsigned char reprintCharacter()
serialportprofile::outputBaud
baudrate_t outputBaud()
serialportprofile::ignoreModemControlLines
void ignoreModemControlLines(bool truefalse)
serialportprofile::receiverOn
void receiverOn(bool truefalse)
serialportprofile::eraseCharacter
unsigned char eraseCharacter()
serialportprofile::defaultInputOptions
void defaultInputOptions()
serialportprofile::eraseCharacter
void eraseCharacter(unsigned char character)
serialportprofile::baud
void baud(const char *baudrate)
serialportprofile::secondEndOfLineCharacter
unsigned char secondEndOfLineCharacter()
serialportprofile::inputParityCheck
void inputParityCheck(bool truefalse)
serialportprofile::useDelForFill
bool useDelForFill()
serialportprofile::reprintCharacter
void reprintCharacter(unsigned char character)
serialportprofile::markParityErrors
bool markParityErrors()
serialportprofile::postProcessOutput
bool postProcessOutput()
serialportprofile::stripParityBits
void stripParityBits(bool truefalse)
serialportprofile::discardPendingOutputCharacter
void discardPendingOutputCharacter(unsigned char character)
serialportprofile::evalOptionsString
void evalOptionsString(const char *string)
serialportprofile::statusRequestCharacter
void statusRequestCharacter(unsigned char character)
serialportprofile::echoInput
void echoInput(bool truefalse)
serialportprofile::mapNewLineToCarriageReturnNewLineOnOutput
void mapNewLineToCarriageReturnNewLineOnOutput(bool truefalse)
serialportprofile::ignoreModemControlLines
bool ignoreModemControlLines()
serialportprofile::echoErasedCharacter
void echoErasedCharacter(bool truefalse)
serialportprofile::defaultControlOptions
void defaultControlOptions()
serialportprofile::stopCharacter
unsigned char stopCharacter()
serialportprofile::mapNewLineToCarriageReturnOnInput
bool mapNewLineToCarriageReturnOnInput()
serialportprofile::endOfFileCharacter
unsigned char endOfFileCharacter()
serialportprofile::softwareFlowControlOnInput
void softwareFlowControlOnInput(bool truefalse)
serialportprofile::ignoreParityErrors
void ignoreParityErrors(bool truefalse)
serialportprofile::extendedFunctions
void extendedFunctions(bool truefalse)
serialportprofile::killCharacter
unsigned char killCharacter()
serialportprofile::wordEraseCharcter
unsigned char wordEraseCharcter()
serialportprofile::retypePendingCharacters
void retypePendingCharacters(bool truefalse)
serialportprofile::useDelForFill
void useDelForFill(bool truefalse)
serialportprofile::delayAfterNewLine
void delayAfterNewLine(newlinedelay_t nldelay)
serialportprofile::stopCharacter
void stopCharacter(unsigned char character)
serialportprofile::inputParityCheck
bool inputParityCheck()
serialportprofile::echoInput
bool echoInput()
serialportprofile::mapCarriageReturnToNewLineOnInput
bool mapCarriageReturnToNewLineOnInput()
serialportprofile::quitCharacter
unsigned char quitCharacter()
serialportprofile::eraseCharactersOn
void eraseCharactersOn(bool truefalse)
serialportprofile::noFlushAfterInterruptOrQuit
void noFlushAfterInterruptOrQuit(bool truefalse)
serialportprofile::markParityErrors
void markParityErrors(bool truefalse)
serialportprofile::setControlCharacters
void setControlCharacters(const unsigned char *c_cc)
serialportprofile::oddParity
void oddParity(bool truefalse)
serialportprofile::killCharacter
void killCharacter(unsigned char character)
serialportprofile::delayAfterVerticalTab
verticaltabdelay_t delayAfterVerticalTab()
serialportprofile::switchCharacer
void switchCharacer(unsigned char character)
serialportprofile::quitCharacter
void quitCharacter(unsigned char character)
serialportprofile::dontOutputCarriageReturnAtColumnZero
bool dontOutputCarriageReturnAtColumnZero()
serialportprofile::readThreshold
void readThreshold(unsigned char count)
serialportprofile::stripParityBits
bool stripParityBits()
serialportprofile::delayAfterBackSpace
backspacedelay_t delayAfterBackSpace()
serialportprofile::ignoreCarriageReturn
bool ignoreCarriageReturn()
serialportprofile::statusRequestCharacter
unsigned char statusRequestCharacter()
serialportprofile::mapNewLineToCarriageReturnOnOutput
void mapNewLineToCarriageReturnOnOutput(bool truefalse)
serialportprofile::escapedUpperCase
bool escapedUpperCase()
serialportprofile::hangupOnClose
void hangupOnClose(bool truefalse)
serialportprofile::defaultOutputOptions
void defaultOutputOptions()
serialportprofile::inputMode
inputmode_t inputMode()
serialportprofile::readTimeout
void readTimeout(unsigned char deciseconds)
serialportprofile::lowerCase
void lowerCase(bool truefalse)
serialportprofile::killCharacterOn
bool killCharacterOn()
serialportprofile::canonicalInput
void canonicalInput(bool truefalse)
serialportprofile::mapNewLineToCarriageReturnOnInput
void mapNewLineToCarriageReturnOnInput(bool truefalse)
serialportprofile::literalNextCharcter
unsigned char literalNextCharcter()
serialportprofile::emulateKill
bool emulateKill()
serialportprofile::parityCheck
void parityCheck(bool truefalse)
serialportprofile::discardEndOfTransmission
void discardEndOfTransmission(bool truefalse)
serialportprofile::readTimeout
unsigned char readTimeout()
serialportprofile::echoErasedCharacter
bool echoErasedCharacter()
serialportprofile::sendSignalOnBreak
bool sendSignalOnBreak()
serialportprofile::anyCharacterStartsFlow
void anyCharacterStartsFlow(bool truefalse)
serialportprofile::delayedSuspendCharacter
unsigned char delayedSuspendCharacter()
serialportprofile::retypePendingCharacters
bool retypePendingCharacters()
serialportprofile::expandTabToSpaces
bool expandTabToSpaces()
serialportprofile::delayAfterVerticalTab
void delayAfterVerticalTab(verticaltabdelay_t vtdelay)
serialportprofile::delayAfterFormFeed
formfeeddelay_t delayAfterFormFeed()
serialportprofile::generateSignals
void generateSignals(bool truefalse)
serialportprofile::emulateKill
void emulateKill(bool truefalse)
serialportprofile::discardPendingOutputCharacter
unsigned char discardPendingOutputCharacter()
serialportprofile::baud
baudrate_t baud()
serialportprofile::endOfLineCharacter
unsigned char endOfLineCharacter()
serialportprofile::echoNewLine
void echoNewLine(bool truefalse)
serialportprofile::extendedFunctions
bool extendedFunctions()
serialportprofile::sendSignalOnBreak
void sendSignalOnBreak(bool truefalse)
serialportprofile::blockJobControlOutput
void blockJobControlOutput(bool truefalse)
serialportprofile::delayAfterBackSpace
void delayAfterBackSpace(backspacedelay_t bsdelay)
serialportprofile::useFillCharactersForDelay
void useFillCharactersForDelay(bool truefalse)
serialportprofile::softwareFlowControlOnInput
bool softwareFlowControlOnInput()
serialportprofile::useFillCharactersForDelay
bool useFillCharactersForDelay()
serialportprofile::escapedUpperCase
void escapedUpperCase(bool truefalse)
serialportprofile::blockJobControlOutput
bool blockJobControlOutput()
serialportprofile::startCharacter
void startCharacter(unsigned char character)
serialportprofile::receiverOn
bool receiverOn()
serialportprofile::ignoreBreak
bool ignoreBreak()
serialportprofile::delayAfterTab
tabdelay_t delayAfterTab()
serialportprofile::anyCharacterStartsFlow
bool anyCharacterStartsFlow()
serialportprofile::serialportprofile
serialportprofile()
serialportprofile::wordEraseCharcter
void wordEraseCharcter(unsigned char character)
serialportprofile::postProcessOutput
void postProcessOutput(bool truefalse)
serialportprofile::ignoreBreak
void ignoreBreak(bool truefalse)
serialportprofile::outputBaud
bool outputBaud(baudrate_t baudrate)
serialportprofile::outputUpperCase
bool outputUpperCase()
serialportprofile::mapNewLineToCarriageReturnOnOutput
bool mapNewLineToCarriageReturnOnOutput()
serialportprofile::echoControlCharacters
void echoControlCharacters(bool truefalse)