1 package net.sf.atmodem4j.core;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 import java.io.IOException;
32 import java.io.InputStream;
33 import java.io.OutputStream;
34 import net.sf.atmodem4j.core.fax.FaxExtention;
35 import net.sf.atmodem4j.core.gsm.GsmExtention;
36 import net.sf.atmodem4j.core.parser.Parser;
37 import net.sf.atmodem4j.core.parser.ResultCodeToken;
38 import net.sf.atmodem4j.core.voice.VoiceExtention;
39
40
41
42
43
44
45 public interface Modem {
46
47
48
49
50 static final char EOF = (char) 0x1A;
51
52 enum ModemCapabilities {
53 Data, Voice, Fax, Gsm;
54
55 static ModemCapabilities[] parseCapabilities(String extractLineData) {
56 throw new UnsupportedOperationException("Not yet implemented");
57 }
58 }
59
60
61
62
63 enum CallState {
64
65 Idle, DialPending, AnswerPending, callEstablished;
66 };
67
68
69
70
71
72 int getDefaultWaitTime();
73
74 int getDefaultTrys();
75
76 boolean isIdle();
77
78 void garbageCollected(Parser parser, String s);
79
80 void parsedResultCode(Parser parser, ResultCodeToken r);
81
82 void parsedPrompt(Parser parser);
83
84 void parsedRing(Parser parser);
85
86 boolean init() throws IOException, InterruptedException;
87
88 boolean init(String... initStrings) throws IOException, InterruptedException;
89
90 void removeIncommingCallHandler(CallHandler callHandler);
91
92 void setIncommingCallHandler(CallHandler callHandler) throws
93 IOException,
94 InterruptedException;
95
96 boolean sendAndWaitForOK(String cmdLine) throws IOException,
97 InterruptedException;
98
99 boolean sendAndWaitForOK(String cmdLine, int trys, int waitTime)
100 throws IOException, InterruptedException;
101
102 boolean sendCommandLineWithPrompt(String command, String data) throws IOException, InterruptedException;
103
104 String[] sendAndEctractData(String cmdLine) throws IOException,
105 InterruptedException;
106
107 String[] sendAndEctractData(String cmdLine, int trys, int waitTime)
108 throws IOException, InterruptedException;
109
110 void setRingListener(RingListener ringListener);
111
112 void setModemInputStream(InputStream inputStream);
113
114 void setModemOutputStream(OutputStream outputStream);
115
116 boolean isGsmExtention();
117
118 boolean isVoiceExtention();
119
120 boolean isFaxExtention();
121
122 GsmExtention getGsmExtention();
123
124 void setGsmExtention(GsmExtention gsmExtention);
125
126 VoiceExtention getVoiceExtention();
127
128 void setVoiceExtention(VoiceExtention voiceExtention);
129
130 FaxExtention getFaxExtention();
131
132 void setFaxExtention(FaxExtention faxExtention);
133
134 Connection dial(String number) throws IOException,
135 InterruptedException;
136
137 void dial(String number, CallHandler waitingOutgoingCall)
138 throws
139 IOException,
140 InterruptedException;
141
142 void setSpeaker();
143
144 boolean reset() throws IOException, InterruptedException;
145
146 String getAutomaticAnswer() throws IOException, InterruptedException;
147
148 String getCommandLineTerminationCharacter() throws IOException,
149 InterruptedException;
150
151 String getResponseFormattingChar() throws IOException,
152 InterruptedException;
153
154 String getCommandLineEditingChar() throws IOException,
155 InterruptedException;
156
157 String getModulationSelection() throws IOException,
158 InterruptedException;
159
160 String getManufacturerId() throws IOException, InterruptedException;
161
162 String getModelId() throws IOException, InterruptedException;
163
164 String getRevisionId() throws IOException, InterruptedException;
165
166 String getSerialNumber() throws IOException, InterruptedException;
167
168 String getObjectId() throws IOException, InterruptedException;
169
170 ModemCapabilities[] getCapabilities() throws IOException, InterruptedException;
171
172 String getCountryOfInstallation() throws IOException,
173 InterruptedException;
174
175 void setInitStrings(String... initStrings);
176
177 String[] getInitStrings();
178
179 boolean hangUp() throws IOException, InterruptedException;
180
181 boolean close();
182
183 void reenterDataMode();
184
185 String extractData(String data);
186
187 }