HEAD: remove ridiculous dependency of wvmapi (actually wvtnef) on evolution
[wvapps.git] / wvdial / wvmodemscan.h
blobd0877127ff86b3cfdd69a91355816ccfaec53a37
1 /*
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2003 Net Integration Technologies, Inc.
5 * Intelligent serial port scanner: try to find a port (or ports)
6 * with a working modem, guess a basic startup init string, and find
7 * the maximum baud rate.
8 */
9 #ifndef __WVMODEMSCAN_H
10 #define __WVMODEMSCAN_H
12 #include "wvlinklist.h"
13 #include "wvlog.h"
15 class WvModem;
18 class WvModemScan
20 public:
21 enum Stage { Startup=0, AT, ATZ, ATS0,
22 Carrier, DTR, FCLASS, GetIdent,
23 BaudStep, Reinit, Done, NUM_STAGES };
25 private:
26 int stage;
27 enum Status { Fail = -1, Unknown = 0, Worked = 1, Test };
28 Status status[NUM_STAGES];
29 WvLog debug;
31 WvString file;
32 WvString identifier;
33 int baud, tries;
34 WvModem *modem;
35 bool broken;
37 bool doresult(WvStringParm s, int msec);
38 size_t coagulate(char *buf, size_t size, int msec);
40 public:
41 WvModemScan(WvStringParm devname, bool is_modem_link);
42 ~WvModemScan();
44 WvString modem_name;
45 bool use_modem_link;
47 // check probe status
48 bool isdone() const
49 { return stage == Done; }
50 bool isok() const;
52 // is this an isdn modem? Returns modem identifier if so.
53 const char *is_isdn() const;
55 bool use_default_asyncmap() const;
57 // continue the probe where we left off
58 void execute();
60 // after a probe finishes (isdone()==true) these functions return
61 // the final status info for the device.
62 WvStringParm filename() const
63 { return file; }
64 int maxbaud() const
65 { return baud; }
66 WvString initstr() const;
70 // Declare a WvModemScanList, which searches for all available modems.
71 // After an instance of the class has been created, run execute()
72 // again and again until isdone()==true; then the contents of the list
73 // is a set of all available modems, in the form of WvModemScan objects.
74 DeclareWvList2(WvModemScanListBase, WvModemScan);
76 class WvModemScanList : public WvModemScanListBase
78 WvLog log;
79 int thisline;
80 bool printed;
81 public:
82 WvModemScanList(WvStringParm _exception = WvString::null);
84 void execute();
85 bool isdone();
89 #endif // __WVMODEMSCAN_H