001package com.pi4j.io.gpio;
002
003/*
004 * #%L
005 * **********************************************************************
006 * ORGANIZATION  :  Pi4J
007 * PROJECT       :  Pi4J :: Java Library (Core)
008 * FILENAME      :  GpioPin.java
009 *
010 * This file is part of the Pi4J project. More information about
011 * this project can be found here:  https://www.pi4j.com/
012 * **********************************************************************
013 * %%
014 * Copyright (C) 2012 - 2019 Pi4J
015 * %%
016 * This program is free software: you can redistribute it and/or modify
017 * it under the terms of the GNU Lesser General Public License as
018 * published by the Free Software Foundation, either version 3 of the
019 * License, or (at your option) any later version.
020 *
021 * This program is distributed in the hope that it will be useful,
022 * but WITHOUT ANY WARRANTY; without even the implied warranty of
023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
024 * GNU General Lesser Public License for more details.
025 *
026 * You should have received a copy of the GNU General Lesser Public
027 * License along with this program.  If not, see
028 * <http://www.gnu.org/licenses/lgpl-3.0.html>.
029 * #L%
030 */
031
032
033import com.pi4j.io.gpio.event.GpioPinListener;
034
035import java.util.Collection;
036import java.util.List;
037import java.util.Map;
038
039/**
040 * Gpio pin interface. This interface describes all operations over single GPIO pin.
041 *
042 * @author Robert Savage (<a
043 *         href="http://www.savagehomeautomation.com">http://www.savagehomeautomation.com</a>)
044 */
045@SuppressWarnings("unused")
046public interface GpioPin {
047
048    GpioProvider getProvider();
049    Pin getPin();
050
051    void setName(String name);
052    String getName();
053
054    void setTag(Object tag);
055    Object getTag();
056
057    void setProperty(String key, String value);
058    boolean hasProperty(String key);
059    String getProperty(String key);
060    String getProperty(String key, String defaultValue);
061    Map<String,String> getProperties();
062    void removeProperty(String key);
063    void clearProperties();
064
065    void export(PinMode mode);
066    void export(PinMode mode, PinState defaultState);
067    void unexport();
068    boolean isExported();
069
070    void setMode(PinMode mode);
071    PinMode getMode();
072    boolean isMode(PinMode mode);
073
074    void setPullResistance(PinPullResistance resistance);
075    PinPullResistance getPullResistance();
076    boolean isPullResistance(PinPullResistance resistance);
077
078    Collection<GpioPinListener> getListeners();
079    void addListener(GpioPinListener... listener);
080    void addListener(List<? extends GpioPinListener> listeners);
081    boolean hasListener(GpioPinListener... listener);
082    void removeListener(GpioPinListener... listener);
083    void removeListener(List<? extends GpioPinListener> listeners);
084    void removeAllListeners();
085
086    GpioPinShutdown getShutdownOptions();
087    void setShutdownOptions(GpioPinShutdown options);
088    void setShutdownOptions(Boolean unexport);
089    void setShutdownOptions(Boolean unexport, PinState state);
090    void setShutdownOptions(Boolean unexport, PinState state, PinPullResistance resistance);
091    void setShutdownOptions(Boolean unexport, PinState state, PinPullResistance resistance, PinMode mode);
092}