use of org.openhab.binding.lcn.common.LcnAddrGrp in project openhab1-addons by openhab.
the class Connection method update.
/** Must be called periodically to keep the inner logic active. */
void update() {
long currTime = System.nanoTime();
// Reconnect logic
if (this.reconnectTimestamp != 0 && currTime >= this.reconnectTimestamp) {
this.beginConnect();
this.reconnectTimestamp = 0;
} else {
if (this.isChannelConnected()) {
// Keep-alive / ping logic
if (currTime - this.lastPingTimeStamp > PING_INTERVAL_MSEC * 1000000L) {
this.queue(PckGenerator.ping(++this.pingCounter));
this.lastPingTimeStamp = currTime;
}
// Segment scan logic
if (this.statusSegmentScan.shouldSendNextRequest(this.sets.getTimeout(), currTime)) {
this.queue(new LcnAddrGrp(3, 3), false, PckGenerator.segmentCouplerScan());
this.statusSegmentScan.onRequestSent(currTime);
} else if (this.statusSegmentScan.isFailed(this.sets.getTimeout(), currTime)) {
// Give up. Probably no segments available.
this.setLocalSegId(0);
}
}
// LcnModInfo logic
this.callback.updateItems(this);
if (this.isReady()) {
for (Map.Entry<LcnAddrMod, ModInfo> entry : this.modData.entrySet()) {
entry.getValue().update(this, this.sets.getTimeout(), currTime);
}
}
}
}
Aggregations