Rudiments
serialportprofile.h
1 // Copyright (c) 2004 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 
115 
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
Definition: character.h:11
Definition: serialportprofile.h:21