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 class serialportprofileprivate;
10 
11 // cfmakeraw, cfsetspeed???
12 // wraps struct termios
13 
23 class RUDIMENTS_DLLSPEC serialportprofile {
24  public:
25 
26  enum inputmode_t {
27  cannonical=0,
28  raw
29  };
30 
31  enum flowcontrol_t {
32  fc_none=0,
33  fc_software,
34  fc_hardware
35  };
36 
37  enum baudrate_t {
38  baud_0=0,
39  baud_50,
40  baud_75,
41  baud_110,
42  baud_134,
43  baud_150,
44  baud_200,
45  baud_300,
46  baud_600,
47  baud_1200,
48  baud_1800,
49  baud_2400,
50  baud_4800,
51  baud_9600,
52  baud_19200,
53  exta,
54  baud_38400,
55  extb,
56  baud_57600,
57  baud_76800,
58  baud_115200,
59  baud_230400,
60  baud_460800,
61  baud_500000,
62  baud_576000,
63  baud_921600,
64  baud_1000000,
65  baud_1152000,
66  baud_1500000,
67  baud_2000000,
68  baud_2500000,
69  baud_3000000,
70  baud_3500000,
71  baud_4000000
72  };
73 
74  enum charsize_t {
75  cs_5=0,
76  cs_6,
77  cs_7,
78  cs_8
79  };
80 
81  enum newlinedelay_t {
82  nl_none=0,
83  nl_100
84  };
85 
86  enum carriagereturndelay_t {
87  cr_none=0,
88  cr_depends,
89  cr_100,
90  cr_150
91  };
92 
93  enum tabdelay_t {
94  td_0=0,
95  td_1,
96  td_2,
97  td_xtabs
98  };
99 
100  enum backspacedelay_t {
101  bs_none=0,
102  bs_50
103  };
104 
105  enum verticaltabdelay_t {
106  vt_none=0,
107  vt_2
108  };
109 
110  enum formfeeddelay_t {
111  ff_none=0,
112  ff_2
113  };
114 
117 
120 
122  void defaultControlOptions();
123 
125  void defaultLocalOptions();
126 
128  void defaultInputOptions();
129 
131  void defaultOutputOptions();
132 
134  void defaultControlCharacters();
135 
138  void defaultOptions();
139 
143  void setControlCharacters(const unsigned char *c_cc);
144 
151  void evalOptionsString(const char *string);
152 
154  void inputMode(inputmode_t inputmode);
155 
157  inputmode_t inputMode();
158 
160  void flowControl(flowcontrol_t flowcontrol);
161 
163  flowcontrol_t flowControl();
164 
166  void baud(const char *baudrate);
167 
169  void baud(baudrate_t baudrate);
170 
172  bool inputBaud(const char *baudrate);
173 
175  bool inputBaud(baudrate_t baudrate);
176 
178  bool outputBaud(const char *baudrate);
179 
181  bool outputBaud(baudrate_t baudrate);
182 
185  void characterSize(charsize_t size);
186 
191  void twoStopBits(bool truefalse);
192 
198  void receiverOn(bool truefalse);
199 
203  void parityCheck(bool truefalse);
204 
209  void oddParity(bool truefalse);
210 
215  void hangupOnClose(bool truefalse);
216 
225  void ignoreModemControlLines(bool truefalse);
226 
230  void blockJobControlOutput(bool truefalse);
231 
236  void hardwareFlowControl(bool truefalse);
237 
239  baudrate_t baud();
240 
242  baudrate_t inputBaud();
243 
245  baudrate_t outputBaud();
246 
248  charsize_t characterSize();
249 
251  bool twoStopBits();
252 
254  bool receiverOn();
255 
257  bool parityCheck();
258 
260  bool oddParity();
261 
265  bool hangupOnClose();
266 
269  bool ignoreModemControlLines();
270 
273  bool blockJobControlOutput();
274 
277  bool hardwareFlowControl();
278 
283  void generateSignals(bool truefalse);
284 
291  void canonicalInput(bool truefalse);
292 
303  void escapedUpperCase(bool truefalse);
304 
307  void echoInput(bool truefalse);
308 
314  void eraseCharactersOn(bool truefalse);
315 
319  void killCharacterOn(bool truefalse);
320 
324  void echoNewLine(bool truefalse);
325 
331  void extendedFunctions(bool truefalse);
332 
337  void echoControlCharacters(bool truefalse);
338 
342  void echoErasedCharacter(bool truefalse);
343 
350  void emulateKill(bool truefalse);
351 
355  void noFlushAfterInterruptOrQuit(bool truefalse);
356 
360  void retypePendingCharacters(bool truefalse);
361 
366  void sendSignalForBackgroundOutput(bool truefalse);
367 
371  bool generateSignals();
372 
376  bool canonicalInput();
377 
383  bool escapedUpperCase();
384 
386  bool echoInput();
387 
392  bool eraseCharactersOn();
393 
396  bool killCharacterOn();
397 
400  bool echoNewLine();
401 
406  bool extendedFunctions();
407 
411  bool echoControlCharacters();
412 
415  bool echoErasedCharacter();
416 
420  bool emulateKill();
421 
425  bool noFlushAfterInterruptOrQuit();
426 
429  bool retypePendingCharacters();
430 
434  bool sendSignalForBackgroundOutput();
435 
438  void inputParityCheck(bool truefalse);
439 
444  void ignoreParityErrors(bool truefalse);
445 
451  void markParityErrors(bool truefalse);
452 
455  void stripParityBits(bool truefalse);
456 
459  void softwareFlowControlOnOutput(bool truefalse);
460 
463  void softwareFlowControlOnInput(bool truefalse);
464 
467  void anyCharacterStartsFlow(bool truefalse);
468 
471  void ignoreBreak(bool truefalse);
472 
480  void sendSignalOnBreak(bool truefalse);
481 
484  void mapNewLineToCarriageReturnOnInput(bool truefalse);
485 
488  void discardEndOfTransmission(bool truefalse);
489 
492  void ignoreCarriageReturn(bool truefalse);
493 
496  void mapCarriageReturnToNewLineOnInput(bool truefalse);
497 
500  void lowerCase(bool truefalse);
501 
504  void bellIfLineTooLong(bool truefalse);
505 
507  bool inputParityCheck();
508 
510  bool ignoreParityErrors();
511 
514  bool markParityErrors();
515 
518  bool stripParityBits();
519 
522  bool softwareFlowControlOnOutput();
523 
526  bool softwareFlowControlOnInput();
527 
529  bool anyCharacterStartsFlow();
530 
532  bool ignoreBreak();
533 
538  bool sendSignalOnBreak();
539 
542  bool mapNewLineToCarriageReturnOnInput();
543 
545  bool discardEndOfTransmission();
546 
548  bool ignoreCarriageReturn();
549 
552  bool mapCarriageReturnToNewLineOnInput();
553 
556  bool lowerCase();
557 
560  bool bellIfLineTooLong();
561 
562 
565  void postProcessOutput(bool truefalse);
566 
569  void outputUpperCase(bool truefalse);
570 
573  void mapNewLineToCarriageReturnNewLineOnOutput(
574  bool truefalse);
575 
578  void mapCarriageReturnToNewLineOnOutput(bool truefalse);
579 
582  void dontOutputCarriageReturnAtColumnZero(bool truefalse);
583 
586  void mapNewLineToCarriageReturnOnOutput(bool truefalse);
587 
591  void useFillCharactersForDelay(bool truefalse);
592 
596  void useDelForFill(bool truefalse);
597 
600  void expandTabToSpaces(bool truefalse);
601 
604  void delayAfterNewLine(newlinedelay_t nldelay);
605 
608  void delayAfterCarriageReturn(carriagereturndelay_t crdelay);
609 
612  void delayAfterTab(tabdelay_t tabdelay);
613 
616  void delayAfterBackSpace(backspacedelay_t bsdelay);
617 
620  void delayAfterVerticalTab(verticaltabdelay_t vtdelay);
621 
624  void delayAfterFormFeed(formfeeddelay_t ffdelay);
625 
628  bool postProcessOutput();
629 
632  bool outputUpperCase();
633 
636  bool mapNewLineToCarriageReturnNewLineOnOutput();
637 
640  bool mapCarriageReturnToNewLineOnOutput();
641 
644  bool dontOutputCarriageReturnAtColumnZero();
645 
648  bool mapNewLineToCarriageReturnOnOutput();
649 
652  bool useFillCharactersForDelay();
653 
656  bool useDelForFill();
657 
659  bool expandTabToSpaces();
660 
663  newlinedelay_t delayAfterNewLine();
664 
667  carriagereturndelay_t delayAfterCarriageReturn();
668 
670  tabdelay_t delayAfterTab();
671 
674  backspacedelay_t delayAfterBackSpace();
675 
678  verticaltabdelay_t delayAfterVerticalTab();
679 
682  formfeeddelay_t delayAfterFormFeed();
683 
688  void interruptCharacter(unsigned char character);
689 
694  void quitCharacter(unsigned char character);
695 
699  void eraseCharacter(unsigned char character);
700 
704  void killCharacter(unsigned char character);
705 
711  void endOfFileCharacter(unsigned char character);
712 
716  void endOfLineCharacter(unsigned char character);
717 
721  void secondEndOfLineCharacter(unsigned char character);
722 
725  void switchCharacer(unsigned char character);
726 
729  void startCharacter(unsigned char character);
730 
733  void stopCharacter(unsigned char character);
734 
739  void suspendCharacter(unsigned char character);
740 
745  void delayedSuspendCharacter(unsigned char character);
746 
751  void literalNextCharcter(unsigned char character);
752 
756  void wordEraseCharcter(unsigned char character);
757 
762  void reprintCharacter(unsigned char character);
763 
768  void discardPendingOutputCharacter(unsigned char character);
769 
772  void statusRequestCharacter(unsigned char character);
773 
778  void readThreshold(unsigned char count);
779 
784  void readTimeout(unsigned char deciseconds);
785 
786 
790  unsigned char interruptCharacter();
791 
795  unsigned char quitCharacter();
796 
799  unsigned char eraseCharacter();
800 
803  unsigned char killCharacter();
804 
809  unsigned char endOfFileCharacter();
810 
813  unsigned char endOfLineCharacter();
814 
817  unsigned char secondEndOfLineCharacter();
818 
820  unsigned char switchCharacer();
821 
823  unsigned char startCharacter();
824 
826  unsigned char stopCharacter();
827 
831  unsigned char suspendCharacter();
832 
836  unsigned char delayedSuspendCharacter();
837 
841  unsigned char literalNextCharcter();
842 
845  unsigned char wordEraseCharcter();
846 
847 
851  unsigned char reprintCharacter();
852 
856  unsigned char discardPendingOutputCharacter();
857 
859  unsigned char statusRequestCharacter();
860 
864  unsigned char readThreshold();
865 
869  unsigned char readTimeout();
870 
871  #include <rudiments/private/serialportprofile.h>
872 };
873 
874 #endif
Definition: character.h:11
Definition: serialportprofile.h:23