00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef dsModem_h
00010 #define dsModem_h
00011
00012 #ifdef HAVE_CONFIG_H
00013 # include <config.h>
00014 #endif
00015
00016 #include <dsSmartException.h>
00017 #include <dsSerial.h>
00018
00019 DECLARE_EXCEPTION(dsModem);
00020
00021 #define MODEM_8N1 (CS8 | HUPCL | CRTSCTS)
00022 #define MODEM_7E1 (CS7 | HUPCL | PARENB | CRTSCTS)
00023
00029 class dsModem : public dsSerial
00030 {
00031 public:
00032 enum Answers
00033 {
00034 anNONE, anOK, anCONNECT, anRING, anNO_CARRIER, anERROR,
00035 anNO_DT, anBUSY, anNO_ANSWER, anRINGING, anVOICE
00036 };
00037
00043 dsModem(const char *tty, int speed, int flags = MODEM_8N1);
00044 virtual ~dsModem();
00045
00046
00047 void initModem(const char *cmd, int wait);
00048
00049 void sendCmd(const char *cmd);
00050 void sendDial(const char *cmd);
00051
00052 int readAnswer(std::ostream& os, int wait);
00053
00054 Answers parseAnswer(const char *answer);
00055
00059 bool testDCD();
00060 };
00061
00062
00063 #endif