@RuleAction(label = "restart the Doorbird", description = "Restarts the Doorbird device.")
public void restart() {
logger.debug("Doorbird action 'restart' called");
+ DoorbellHandler handler = this.handler;
if (handler != null) {
handler.actionRestart();
} else {
@RuleAction(label = "hangup a SIP call", description = "Hangup SIP call.")
public void sipHangup() {
logger.debug("Doorbird action 'sipHangup' called");
+ DoorbellHandler handler = this.handler;
if (handler != null) {
handler.actionSIPHangup();
} else {
@RuleAction(label = "get the ring time limit", description = "Get the value of RING_TIME_LIMIT.")
public @ActionOutput(name = "getRingTimeLimit", type = "java.lang.String") String getRingTimeLimit() {
logger.debug("Doorbird action 'getRingTimeLimit' called");
+ DoorbellHandler handler = this.handler;
if (handler != null) {
return handler.actionGetRingTimeLimit();
} else {
@RuleAction(label = "get the call time limit", description = "Get the value of CALL_TIME_LIMIT.")
public @ActionOutput(name = "getCallTimeLimit", type = "java.lang.String") String getCallTimeLimit() {
logger.debug("Doorbird action 'getCallTimeLimit' called");
+ DoorbellHandler handler = this.handler;
if (handler != null) {
return handler.actionGetCallTimeLimit();
} else {
@RuleAction(label = "get the last error code", description = "Get the value of LASTERRORCODE.")
public @ActionOutput(name = "getLastErrorCode", type = "java.lang.String") String getLastErrorCode() {
logger.debug("Doorbird action 'getLastErrorCode' called");
+ DoorbellHandler handler = this.handler;
if (handler != null) {
return handler.actionGetLastErrorCode();
} else {
@RuleAction(label = "get the last error text", description = "Get the value of LASTERRORTEXT.")
public @ActionOutput(name = "getLastErrorText", type = "java.lang.String") String getLastErrorText() {
logger.debug("Doorbird action 'getLastErrorText' called");
+ DoorbellHandler handler = this.handler;
if (handler != null) {
return handler.actionGetLastErrorText();
} else {
private static final Gson GSON = new Gson();
private final Logger logger = LoggerFactory.getLogger(DoorbirdAPI.class);
+ private static final int CHUNK_SIZE = 256;
private @Nullable Authorization authorization;
private @Nullable HttpClient httpClient;
// It is crucial to send data in small chunks to not overload the doorbird
// It means that we have to wait the appropriate amount of time between chunk to send
// real time data, as if it were live spoken.
- int CHUNK_SIZE = 256;
int nbByteRead = -1;
long nextChunkSendTimeStamp = 0;
do {
}
private void stopImageRefreshJob() {
+ ScheduledFuture<?> imageRefreshJob = this.imageRefreshJob;
if (imageRefreshJob != null) {
imageRefreshJob.cancel(true);
- imageRefreshJob = null;
+ this.imageRefreshJob = null;
logger.debug("Canceling image refresh job");
}
}
}
private void stopUDPListenerJob() {
+ ScheduledFuture<?> listenerJob = this.listenerJob;
if (listenerJob != null) {
listenerJob.cancel(true);
udpListener.shutdown();
+ this.listenerJob = null;
logger.debug("Canceling listener job");
}
}
if (offDelay == null) {
return;
}
+ ScheduledFuture<?> doorbellOffJob = this.doorbellOffJob;
if (doorbellOffJob != null) {
doorbellOffJob.cancel(true);
}
- doorbellOffJob = scheduler.schedule(() -> {
+ this.doorbellOffJob = scheduler.schedule(() -> {
logger.debug("Update channel 'doorbell' to OFF for thing {}", getThing().getUID());
triggerChannel(CHANNEL_DOORBELL, CommonTriggerEvents.RELEASED);
}, offDelay, TimeUnit.SECONDS);
}
private void stopDoorbellOffJob() {
+ ScheduledFuture<?> doorbellOffJob = this.doorbellOffJob;
if (doorbellOffJob != null) {
doorbellOffJob.cancel(true);
- doorbellOffJob = null;
+ this.doorbellOffJob = null;
logger.debug("Canceling doorbell off job");
}
}
if (offDelay == null) {
return;
}
+ ScheduledFuture<?> motionOffJob = this.motionOffJob;
if (motionOffJob != null) {
motionOffJob.cancel(true);
}
- motionOffJob = scheduler.schedule(() -> {
+ this.motionOffJob = scheduler.schedule(() -> {
logger.debug("Update channel 'motion' to OFF for thing {}", getThing().getUID());
updateState(CHANNEL_MOTION, OnOffType.OFF);
}, offDelay, TimeUnit.SECONDS);
}
private void stopMotionOffJob() {
+ ScheduledFuture<?> motionOffJob = this.motionOffJob;
if (motionOffJob != null) {
motionOffJob.cancel(true);
- motionOffJob = null;
+ this.motionOffJob = null;
logger.debug("Canceling motion off job");
}
}