~ubuntu-branches/ubuntu/quantal/wvdial/quantal

« back to all changes in this revision

Viewing changes to src/wvmodemscan.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-10-06 11:05:06 UTC
  • mfrom: (0.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20041006110506-138x19fe4q0iu46e
Tags: 1.54.0-1ubuntu1
postinst: Disable command-line configuration to not disturb installation;
the script just exits early, so the postinst code is not completely lost
(Warty bug #2069)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Worldvisions Weaver Software:
3
 
 *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4
 
 *
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
11
 
 
12
 
#include "wvlinklist.h"
13
 
#include "wvlog.h"
14
 
 
15
 
class WvModem;
16
 
 
17
 
 
18
 
class WvModemScan
19
 
{
20
 
public:
21
 
    enum Stage { Startup=0, AT, ATZ, ATS0, 
22
 
                        Carrier, DTR, FCLASS, GetIdent,
23
 
                        BaudStep, Reinit, Done, NUM_STAGES };
24
 
    
25
 
private:
26
 
    int stage;
27
 
    enum Status { Fail = -1, Unknown = 0, Worked = 1, Test };
28
 
    Status status[NUM_STAGES];
29
 
    WvLog debug;
30
 
    
31
 
    WvString file;
32
 
    WvString identifier;
33
 
    int baud, tries;
34
 
    WvModem *modem;
35
 
    bool broken;
36
 
    
37
 
    bool doresult(const WvString &s, int msec);
38
 
    size_t coagulate(char *buf, size_t size, int msec);
39
 
        
40
 
public:
41
 
    WvModemScan(const char *devname, bool is_modem_link);
42
 
    ~WvModemScan();
43
 
    
44
 
    WvString modem_name;
45
 
    bool use_modem_link;
46
 
 
47
 
    // check probe status
48
 
    bool isdone() const
49
 
        { return stage == Done; }
50
 
    bool isok() const;
51
 
 
52
 
    // is this an isdn modem?  Returns modem identifier if so.
53
 
    const char *is_isdn() const;
54
 
 
55
 
    bool use_default_asyncmap() const;
56
 
 
57
 
    // continue the probe where we left off
58
 
    void execute();
59
 
 
60
 
    // after a probe finishes (isdone()==true) these functions return
61
 
    // the final status info for the device.
62
 
    const WvString &filename() const
63
 
        { return file; }
64
 
    int maxbaud() const
65
 
        { return baud; }
66
 
    WvString initstr() const;
67
 
};
68
 
 
69
 
 
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(WvModemScan,
75
 
               WvLog *log;
76
 
               int thisline;
77
 
               bool printed;
78
 
               void setup();
79
 
               void shutdown();
80
 
               void execute();
81
 
               bool isdone();
82
 
               bool isready();
83
 
               );
84
 
 
85
 
 
86
 
#endif // __WVMODEMSCAN_H