private final int TIMEOUT_FOR_RESEND_MSEC = 900;
private IoTZigbee zigConnection = null;
-
- private int status = 0;
private boolean didClose; // make sure that the clean up was done correctly
- //private boolean detectStatus = false;
+ private boolean detectStatus = false;
- //private int detectedValue = 0;
+ private int detectedValue = 0;
private Date timestampOfLastDetecting = null;
private AtomicBoolean didAlreadyClose = new AtomicBoolean(true);
private AtomicBoolean didAlreadyInit = new AtomicBoolean(false);
private AtomicBoolean didWriteAttrb = new AtomicBoolean(false);
- //private AtomicBoolean didMatchDscr = new AtomicBoolean(false);
+ private AtomicBoolean didMatchDscr = new AtomicBoolean(false);
private AtomicBoolean didBind = new AtomicBoolean(false);
private AtomicBoolean didDoorLockConfigureReporting = new AtomicBoolean(false); //made by Jiawei
static Semaphore gettingLatestDataMutex = new Semaphore(1);
}
// made by Jiawei
- public int getStatus() {
+ //public int getStatus() {
+ public int getValue() {
int tmp = 0;
try {
gettingLatestDataMutex.acquire();
- tmp = status;
+ tmp = detectedValue;
} catch (Exception e) {
e.printStackTrace();
return tmp;
}
+ public boolean isActiveValue() {
+
+ int tmp = getValue();
+ if (tmp == 1)
+ detectStatus = true; // Door is locked
+ else
+ detectStatus = false; // Door is not locked/not fully locked
+ return detectStatus;
+ }
+
public void close() {
if (didAlreadyClose.compareAndSet(false, true) == false) {
try {
gettingLatestDataMutex.acquire();
- status = value;
+ detectedValue = value;
timestampOfLastDetecting = new Date();
} catch (Exception e) {
e.printStackTrace();
try {
for (SmartthingsSensorCallback cb : callbackList) {
- cb.newReadingAvailable(this);
+ cb.newReadingAvailable(this.getValue(), this.isActiveValue());
}
} catch (Exception e) {
e.printStackTrace();