1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                 DEVSTATE.H                                */
4 /*                                                                           */
5 /* (C) 1996     Ullrich von Bassewitz                                        */
6 /*              Wacholderweg 14                                              */
7 /*              D-70597 Stuttgart                                            */
8 /* EMail:       uz@ibb.schwaben.com                                          */
9 /*                                                                           */
10 /*****************************************************************************/
11 
12 
13 
14 // $Id$
15 //
16 // $Log$
17 //
18 //
19 
20 
21 
22 // State of one device
23 
24 
25 
26 #ifndef _DEVSTATE_H
27 #define _DEVSTATE_H
28 
29 
30 
31 #include "event.h"
32 #include "datetime.h"
33 
34 #include "icintcon.h"
35 
36 
37 
38 /*****************************************************************************/
39 /*                                   Data                                    */
40 /*****************************************************************************/
41 
42 
43 
44 // Wait time after a call before requesting the charges
45 extern int DebugWaitAfterCall;
46 
47 // How many digits of the phone number should be replaced by an 'X'?
48 extern int XDigits;
49 
50 
51 
52 /*****************************************************************************/
53 /*                            class DevStateInfo                             */
54 /*****************************************************************************/
55 
56 
57 
58 class DevStateInfo: public Object, public EventHandler {
59 
60     // Columns for the matrix window
61     //           1         2         3         4         5         6         7
62     // 01234567890123456789012345678901234567890123456789012345678901234567890
63     //
64     //  Nr. Amt1 Amt2 Int1 Int2 Int3 Ton WTon TFE Ruf Nummer
65     enum {
66         colNr       =  1,
67         colSchleife =  3,
68         colAmt1     =  6,
69         colAmt2     = 11,
70         colInt1     = 16,
71         colInt2     = 21,
72         colInt3     = 26,
73         colTon      = 31,
74         colWTon     = 35,
75         colTFE      = 40,
76         colRuf      = 44,
77         colPhone    = 47
78     };
79 
80 
81     void ClearCallPhone ();
82     // Clear the call phone number, reset the stuff in the matrix line
83 
84 
85 public:
86     const unsigned char DevNum;         // Device number
87     u32                 State;          // Device state
88     String              CallPhone;      // Phone number dialed
89     Time                CallStart;      // Start of call
90     TimeDiff            CallDuration;   // Duration of call
91     u16                 StartCharges;   // Charges at start of call
92     u16                 CallCharges;    // Charges for call
93     unsigned            HasExt;         // True if device had an external call
94     String              MatrixLine;     // The line that's displayed
95     Time                ForcedRingEnd;  // End of forced ring
96 
97 
98     DevStateInfo (unsigned char Device);
99     // Create a DevStateInfo object
100 
101     DevStateInfo (const DevStateInfo& X);
102     // Copy constructor
103 
104     String LogMsg ();
105     // Create a message for the logfile from the data
106 
107     int GetState (unsigned StateMask);
108     void SetState (unsigned NewState);
109     void ClrState (unsigned NewState);
110     // Get/set/clear bits in State
111 
112     void SetSchleife (int State);
113     void SetAmt (int State, unsigned Amt);
114     void SetInt (int State, unsigned Int);
115     void SetTon (int State);
116     void SetWTon (int State);
117     void SetTFE (int State);
118     void SetRuf (int State);
119     // Set specific matrix states
120 
121     void AddDigit (char Digit);
122     // Add a digit to the phone number if the device is in a state where a digit
123     // is accepted (dialed)
124 
125     void ReplaceDigits (int Count, char C = 'X');
126     // Replace the given number of trailing digits of the phone number by
127     // the character C.
128 
129     virtual void HandleEvent (Event& E);
130     // Handle incoming events.
131 };
132 
133 
134 
135 // End of DEVSTATE.H
136 
137 #endif
138 
139 
140 
141