📄 alarm.java
字号:
package com.khan.datetime;
import com.khan.util.common;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Alarm {
private long Begin_Time = SMPTime.getNow();
private int timmer = 0;
private int test_flag = 0; //0初始, 1需要发送test包
private int timeout = 0;
public Alarm(int secs, int timeout) {
timmer = secs;
this.timeout = timeout;
}
/**到达规定时间后通知发送线程发送active包*/
public boolean getSendTestStatus() {
if (0 == test_flag) {
if (SMPTime.getNow() - Begin_Time > timmer) {
test_flag = 1;
return true;
}
}
return false;
}
/**复位active包发送状态*/
public void resetAlarmStatus() {
test_flag = 0;
Begin_Time = SMPTime.getNow();
}
/**到达规定时间没有收到active_test_resp包则返回超时状态*/
public boolean getTimeoutStatus() {
if (1 == test_flag) {
if (SMPTime.getNow() - Begin_Time > (timmer + timeout)) {
//common.Assert("debug:Cmpp3Transceiver未收到Active_resp包,超时!");
test_flag = 0;
Begin_Time = SMPTime.getNow();
return true;
}
}
return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -