我想构建像callerID应用程序这样的java应用程序
有来电时,此应用程序将在文本框中显示电话号码
我使用 serialEvent 功能,并在有传入时检测到。
但我刚收到 RING 文字。
public synchronized void serialEvent(SerialPortEvent oEvent) {
if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
try {
String inputLine=input.readLine();
System.out.println(inputLine);
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
我们如何获取电话号码?
ps:我使用PCI调制解调器
答案 0 :(得分:0)
您可能必须向调制解调器发送串行命令并等待它回复。环顾网络我发现了这个:
AT commands are issued to the modem to control the modems operation
and software configuration. The basic command syntax is as follows:
<command><parameter>
The <command> is a combination of the attention prefix (AT) followed by
the AT command.
然后是这些特定的命令(似乎需要“AT”的东西):
I10, I11 Displays connection information. If the modem has not
connected with a remote DCE the ATI 11 commands returns -
No Previous Call.
所以,如果您发送调制解调器“ATI10”或“ATI11”,它会告诉您它的状态,其中可能包括它所连接的电话号码。
还有这些命令可以将传入号码打印到串口:
+VCID=<value> Caller ID
Use this command to enable or disable caller ID.
+VCID=0 Disable caller ID.
+VCID=1 Enable caller ID with formatted presentation.
+VCID=2 Enable caller ID with out formatting.
同样,我认为它需要AT前缀。
我无法测试任何这些,但本指南似乎很好地描述了很多串行命令,并且是我从中获取信息的地方: