📄 repalereceivemsg.java
字号:
package com;
import javax.swing.JOptionPane;
public class RepaleReceiveMsg extends Thread {
public void run() {
while (true) {
for (int j = 5 * 60 * 2; j > 0; j--) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
System.out.println("刷新线程出错!\n");
}
if (GetInput.Ring == true) {
JOptionPane.showMessageDialog(null, "有电话接入...");
boolean ring = true;
int timeout = 30;// 30秒内接电话
while (GetInput.Ring == true) {
if (timeout-- > 0) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
System.out.println("刷新线程出错!\n");
}
ring = (!ring);
if (ring)
Gsm_Main_Frame.system_call_jTextArea.insert(
"有电话接入...\n", 0);
else
Gsm_Main_Frame.system_call_jTextArea.insert(
"啦~啦~~啦~~~啦...\n", 0);
} else
break;
}
if (timeout < 1) {
Gsm_Main_Frame.system_call_jTextArea.insert(
"1个未接电话!\n", 0);
Gsm_Main_Frame.sendMsg.cancelCall();
}
}
if (GetInput.NewMsgs == true) {
Gsm_Main_Frame.sendMsg.receivesMsg(true);// 获取卡上新信息
GetInput.NewMsgs = false;
}
}
if (Gsm_Main_Frame.sendMsg.testAT()) {//测试通信模块联通性
Gsm_Main_Frame.sendMsg.receivesMsg(false);// 获取卡上已读信息,10分钟刷新一次
Gsm_Main_Frame.sendMsg.receivesMsg(true);// 获取卡上新信息
}else
JOptionPane.showMessageDialog(null, "和通信模块失去联系!");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -