]> git.basschouten.com Git - openhab-addons.git/blob
1396b0567daaadff81537ee13c7ccd88e583466c
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.onewire.internal.device;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.onewire.internal.DigitalIoConfig;
17 import org.openhab.binding.onewire.internal.OwException;
18 import org.openhab.binding.onewire.internal.SensorId;
19 import org.openhab.binding.onewire.internal.handler.OwBaseThingHandler;
20 import org.openhab.binding.onewire.internal.owserver.OwserverDeviceParameter;
21
22 /**
23  * The {@link DS2408} class defines a DS2408 device
24  *
25  * @author Jan N. Klug - Initial contribution
26  */
27 @NonNullByDefault
28 public class DS2408 extends AbstractDigitalOwDevice {
29     public DS2408(SensorId sensorId, OwBaseThingHandler callback) {
30         super(sensorId, callback);
31     }
32
33     @Override
34     public void configureChannels() throws OwException {
35         ioConfig.clear();
36
37         for (int i = 0; i < 8; i++) {
38             ioConfig.add(new DigitalIoConfig(callback.getThing(), i,
39                     new OwserverDeviceParameter("uncached/", String.format("/sensed.%d", i)),
40                     new OwserverDeviceParameter(String.format("/PIO.%d", i))));
41         }
42
43         fullInParam = new OwserverDeviceParameter("uncached/", "/sensed.BYTE");
44         fullOutParam = new OwserverDeviceParameter("/PIO.BYTE");
45
46         super.configureChannels();
47     }
48 }