2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.digitalstrom.internal.lib.sensorjobexecutor;
15 import org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager;
16 import org.openhab.binding.digitalstrom.internal.lib.sensorjobexecutor.sensorjob.SensorJob;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
21 * The {@link SceneReadingJobExecutor} is the implementation of the {@link AbstractSensorJobExecutor} to execute
22 * digitalSTROM-Device scene configuration {@link SensorJob}'s e.g. {@link SceneConfigReadingJob} and
23 * {@link SceneOutputValueReadingJob}.
25 * In addition priorities can be assigned to jobs therefore the {@link SceneReadingJobExecutor} offers the methods
26 * {@link #addHighPriorityJob(SensorJob)}, {@link #addMediumPriorityJob(SensorJob)} and
27 * {@link #addLowPriorityJob(SensorJob)}.
31 * In contrast to the {@link SensorJobExecutor} the {@link SceneReadingJobExecutor} will execute {@link SensorJob}'s
32 * with high priority always before medium priority {@link SensorJob}s and so on.
34 * @author Michael Ochel - Initial contribution
35 * @author Matthias Siegele - Initial contribution
38 public class SceneReadingJobExecutor extends AbstractSensorJobExecutor {
40 private Logger logger = LoggerFactory.getLogger(SceneReadingJobExecutor.class);
43 * Creates a new {@link SceneReadingJobExecutor}.
45 * @param connectionManager must not be null
47 public SceneReadingJobExecutor(ConnectionManager connectionManager) {
48 super(connectionManager);
52 public void addHighPriorityJob(SensorJob sensorJob) {
53 if (sensorJob == null) {
56 sensorJob.setInitalisationTime(0);
57 addSensorJobToCircuitScheduler(sensorJob);
58 logger.debug("Add SceneReadingJob from device with dSID {} and high-priority to SceneReadingSobExecutor",
63 public void addMediumPriorityJob(SensorJob sensorJob) {
64 if (sensorJob == null) {
67 sensorJob.setInitalisationTime(1);
68 addSensorJobToCircuitScheduler(sensorJob);
69 logger.debug("Add SceneReadingJob from device with dSID {} and medium-priority to SceneReadingJobExecutor",
74 public void addLowPriorityJob(SensorJob sensorJob) {
75 if (sensorJob == null) {
78 sensorJob.setInitalisationTime(2);
79 addSensorJobToCircuitScheduler(sensorJob);
80 logger.debug("Add SceneReadingJob from device with dSID {} and low-priority to SceneReadingJobExecutor",