/** * Copyright (c) 2010-2016 by the respective copyright holders. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ package org.openhab.binding.souliss.internal.network.typicals; import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.OpenClosedType; import org.openhab.core.types.State; /** * Typical T13 Digital Input Value * * @author Tonino Fazio * @since 1.7.0 */ public class SoulissT13 extends SoulissGenericTypical { public SoulissT13(String sSoulissNodeIPAddressOnLAN, int iIDNodo, int iSlot, String sOHType) { super(); this.setSlot(iSlot); this.setSoulissNodeID(iIDNodo); this.setType(Constants.Souliss_T13); this.setNote(sOHType); } @Override public State getOHState() { String sOHState = StateTraslator.statesSoulissToOH(this.getNote(), this.getType(), (short) this.getState()); if (sOHState != null) { if (this.getNote().equals("ContactItem")) { return OpenClosedType.valueOf(sOHState); } else { return OnOffType.valueOf(sOHState); } } return null; } }