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 #ifdef RUDIMENTS_NAMESPACE
10 namespace rudiments {
11 #endif
12 
13 class serialportprofileprivate;
14 
15 // cfmakeraw, cfsetspeed???
16 // wraps struct termios
17 
27 class RUDIMENTS_DLLSPEC serialportprofile {
28  public:
29 
30  enum inputmode_t {
31  cannonical=0,
32  raw
33  };
34 
35  enum flowcontrol_t {
36  fc_none=0,
37  fc_software,
38  fc_hardware
39  };
40 
41  enum baudrate_t {
42  baud_0=0,
43  baud_50,
44  baud_75,
45  baud_110,
46  baud_134,
47  baud_150,
48  baud_200,
49  baud_300,
50  baud_600,
51  baud_1200,
52  baud_1800,
53  baud_2400,
54  baud_4800,
55  baud_9600,
56  baud_19200,
57  exta,
58  baud_38400,
59  extb,
60  baud_57600,
61  baud_76800,
62  baud_115200,
63  baud_230400,
64  baud_460800,
65  baud_500000,
66  baud_576000,
67  baud_921600,
68  baud_1000000,
69  baud_1152000,
70  baud_1500000,
71  baud_2000000,
72  baud_2500000,
73  baud_3000000,
74  baud_3500000,
75  baud_4000000
76  };
77 
78  enum charsize_t {
79  cs_5=0,
80  cs_6,
81  cs_7,
82  cs_8
83  };
84 
85  enum newlinedelay_t {
86  nl_none=0,
87  nl_100
88  };
89 
90  enum carriagereturndelay_t {
91  cr_none=0,
92  cr_depends,
93  cr_100,
94  cr_150
95  };
96 
97  enum tabdelay_t {
98  td_0=0,
99  td_1,
100  td_2,
101  td_xtabs
102  };
103 
104  enum backspacedelay_t {
105  bs_none=0,
106  bs_50
107  };
108 
109  enum verticaltabdelay_t {
110  vt_none=0,
111  vt_2
112  };
113 
114  enum formfeeddelay_t {
115  ff_none=0,
116  ff_2
117  };
118 
121 
124 
126  void defaultControlOptions();
127 
129  void defaultLocalOptions();
130 
132  void defaultInputOptions();
133 
135  void defaultOutputOptions();
136 
138  void defaultControlCharacters();
139 
142  void defaultOptions();
143 
147  void setControlCharacters(const unsigned char *c_cc);
148 
155  void evalOptionsString(const char *string);
156 
158  void inputMode(inputmode_t inputmode);
159 
161  inputmode_t inputMode();
162 
164  void flowControl(flowcontrol_t flowcontrol);
165 
167  flowcontrol_t flowControl();
168 
170  void baud(const char *baudrate);
171 
173  void baud(baudrate_t baudrate);
174 
176  bool inputBaud(const char *baudrate);
177 
179  bool inputBaud(baudrate_t baudrate);
180 
182  bool outputBaud(const char *baudrate);
183 
185  bool outputBaud(baudrate_t baudrate);
186 
189  void characterSize(charsize_t size);
190 
195  void twoStopBits(bool truefalse);
196 
202  void receiverOn(bool truefalse);
203 
207  void parityCheck(bool truefalse);
208 
213  void oddParity(bool truefalse);
214 
219  void hangupOnClose(bool truefalse);
220 
229  void ignoreModemControlLines(bool truefalse);
230 
234  void blockJobControlOutput(bool truefalse);
235 
240  void hardwareFlowControl(bool truefalse);
241 
243  baudrate_t baud();
244 
246  baudrate_t inputBaud();
247 
249  baudrate_t outputBaud();
250 
252  charsize_t characterSize();
253 
255  bool twoStopBits();
256 
258  bool receiverOn();
259 
261  bool parityCheck();
262 
264  bool oddParity();
265 
269  bool hangupOnClose();
270 
273  bool ignoreModemControlLines();
274 
277  bool blockJobControlOutput();
278 
281  bool hardwareFlowControl();
282 
287  void generateSignals(bool truefalse);
288 
295  void canonicalInput(bool truefalse);
296 
307  void escapedUpperCase(bool truefalse);
308 
311  void echoInput(bool truefalse);
312 
318  void eraseCharactersOn(bool truefalse);
319 
323  void killCharacterOn(bool truefalse);
324 
328  void echoNewLine(bool truefalse);
329 
335  void extendedFunctions(bool truefalse);
336 
341  void echoControlCharacters(bool truefalse);
342 
346  void echoErasedCharacter(bool truefalse);
347 
354  void emulateKill(bool truefalse);
355 
359  void noFlushAfterInterruptOrQuit(bool truefalse);
360 
364  void retypePendingCharacters(bool truefalse);
365 
370  void sendSignalForBackgroundOutput(bool truefalse);
371 
375  bool generateSignals();
376 
380  bool canonicalInput();
381 
387  bool escapedUpperCase();
388 
390  bool echoInput();
391 
396  bool eraseCharactersOn();
397 
400  bool killCharacterOn();
401 
404  bool echoNewLine();
405 
410  bool extendedFunctions();
411 
415  bool echoControlCharacters();
416 
419  bool echoErasedCharacter();
420 
424  bool emulateKill();
425 
429  bool noFlushAfterInterruptOrQuit();
430 
433  bool retypePendingCharacters();
434 
438  bool sendSignalForBackgroundOutput();
439 
442  void inputParityCheck(bool truefalse);
443 
448  void ignoreParityErrors(bool truefalse);
449 
455  void markParityErrors(bool truefalse);
456 
459  void stripParityBits(bool truefalse);
460 
463  void softwareFlowControlOnOutput(bool truefalse);
464 
467  void softwareFlowControlOnInput(bool truefalse);
468 
471  void anyCharacterStartsFlow(bool truefalse);
472 
475  void ignoreBreak(bool truefalse);
476 
484  void sendSignalOnBreak(bool truefalse);
485 
488  void mapNewLineToCarriageReturnOnInput(bool truefalse);
489 
492  void discardEndOfTransmission(bool truefalse);
493 
496  void ignoreCarriageReturn(bool truefalse);
497 
500  void mapCarriageReturnToNewLineOnInput(bool truefalse);
501 
504  void lowerCase(bool truefalse);
505 
508  void bellIfLineTooLong(bool truefalse);
509 
511  bool inputParityCheck();
512 
514  bool ignoreParityErrors();
515 
518  bool markParityErrors();
519 
522  bool stripParityBits();
523 
526  bool softwareFlowControlOnOutput();
527 
530  bool softwareFlowControlOnInput();
531 
533  bool anyCharacterStartsFlow();
534 
536  bool ignoreBreak();
537 
542  bool sendSignalOnBreak();
543 
546  bool mapNewLineToCarriageReturnOnInput();
547 
549  bool discardEndOfTransmission();
550 
552  bool ignoreCarriageReturn();
553 
556  bool mapCarriageReturnToNewLineOnInput();
557 
560  bool lowerCase();
561 
564  bool bellIfLineTooLong();
565 
566 
569  void postProcessOutput(bool truefalse);
570 
573  void outputUpperCase(bool truefalse);
574 
577  void mapNewLineToCarriageReturnNewLineOnOutput(
578  bool truefalse);
579 
582  void mapCarriageReturnToNewLineOnOutput(bool truefalse);
583 
586  void dontOutputCarriageReturnAtColumnZero(bool truefalse);
587 
590  void mapNewLineToCarriageReturnOnOutput(bool truefalse);
591 
595  void useFillCharactersForDelay(bool truefalse);
596 
600  void useDelForFill(bool truefalse);
601 
604  void expandTabToSpaces(bool truefalse);
605 
608  void delayAfterNewLine(newlinedelay_t nldelay);
609 
612  void delayAfterCarriageReturn(carriagereturndelay_t crdelay);
613 
616  void delayAfterTab(tabdelay_t tabdelay);
617 
620  void delayAfterBackSpace(backspacedelay_t bsdelay);
621 
624  void delayAfterVerticalTab(verticaltabdelay_t vtdelay);
625 
628  void delayAfterFormFeed(formfeeddelay_t ffdelay);
629 
632  bool postProcessOutput();
633 
636  bool outputUpperCase();
637 
640  bool mapNewLineToCarriageReturnNewLineOnOutput();
641 
644  bool mapCarriageReturnToNewLineOnOutput();
645 
648  bool dontOutputCarriageReturnAtColumnZero();
649 
652  bool mapNewLineToCarriageReturnOnOutput();
653 
656  bool useFillCharactersForDelay();
657 
660  bool useDelForFill();
661 
663  bool expandTabToSpaces();
664 
667  newlinedelay_t delayAfterNewLine();
668 
671  carriagereturndelay_t delayAfterCarriageReturn();
672 
674  tabdelay_t delayAfterTab();
675 
678  backspacedelay_t delayAfterBackSpace();
679 
682  verticaltabdelay_t delayAfterVerticalTab();
683 
686  formfeeddelay_t delayAfterFormFeed();
687 
692  void interruptCharacter(unsigned char character);
693 
698  void quitCharacter(unsigned char character);
699 
703  void eraseCharacter(unsigned char character);
704 
708  void killCharacter(unsigned char character);
709 
715  void endOfFileCharacter(unsigned char character);
716 
720  void endOfLineCharacter(unsigned char character);
721 
725  void secondEndOfLineCharacter(unsigned char character);
726 
729  void switchCharacer(unsigned char character);
730 
733  void startCharacter(unsigned char character);
734 
737  void stopCharacter(unsigned char character);
738 
743  void suspendCharacter(unsigned char character);
744 
749  void delayedSuspendCharacter(unsigned char character);
750 
755  void literalNextCharcter(unsigned char character);
756 
760  void wordEraseCharcter(unsigned char character);
761 
766  void reprintCharacter(unsigned char character);
767 
772  void discardPendingOutputCharacter(unsigned char character);
773 
776  void statusRequestCharacter(unsigned char character);
777 
782  void readThreshold(unsigned char count);
783 
788  void readTimeout(unsigned char deciseconds);
789 
790 
794  unsigned char interruptCharacter();
795 
799  unsigned char quitCharacter();
800 
803  unsigned char eraseCharacter();
804 
807  unsigned char killCharacter();
808 
813  unsigned char endOfFileCharacter();
814 
817  unsigned char endOfLineCharacter();
818 
821  unsigned char secondEndOfLineCharacter();
822 
824  unsigned char switchCharacer();
825 
827  unsigned char startCharacter();
828 
830  unsigned char stopCharacter();
831 
835  unsigned char suspendCharacter();
836 
840  unsigned char delayedSuspendCharacter();
841 
845  unsigned char literalNextCharcter();
846 
849  unsigned char wordEraseCharcter();
850 
851 
855  unsigned char reprintCharacter();
856 
860  unsigned char discardPendingOutputCharacter();
861 
863  unsigned char statusRequestCharacter();
864 
868  unsigned char readThreshold();
869 
873  unsigned char readTimeout();
874 
875  #include <rudiments/private/serialportprofile.h>
876 };
877 
878 #ifdef RUDIMENTS_NAMESPACE
879 }
880 #endif
881 
882 #endif