001package com.pi4j.io.gpio;
002
003import com.pi4j.io.gpio.event.PinListener;
004
005/*
006 * #%L
007 * **********************************************************************
008 * ORGANIZATION  :  Pi4J
009 * PROJECT       :  Pi4J :: Java Library (Core)
010 * FILENAME      :  GpioProvider.java  
011 * 
012 * This file is part of the Pi4J project. More information about 
013 * this project can be found here:  http://www.pi4j.com/
014 * **********************************************************************
015 * %%
016 * Copyright (C) 2012 - 2013 Pi4J
017 * %%
018 * Licensed under the Apache License, Version 2.0 (the "License");
019 * you may not use this file except in compliance with the License.
020 * You may obtain a copy of the License at
021 * 
022 *      http://www.apache.org/licenses/LICENSE-2.0
023 * 
024 * Unless required by applicable law or agreed to in writing, software
025 * distributed under the License is distributed on an "AS IS" BASIS,
026 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
027 * See the License for the specific language governing permissions and
028 * limitations under the License.
029 * #L%
030 */
031
032/**
033 * Gpio provider interface.
034 *
035 * @author Robert Savage (<a
036 *         href="http://www.savagehomeautomation.com">http://www.savagehomeautomation.com</a>)
037 */
038public interface GpioProvider {
039
040    String getName();
041    
042    boolean hasPin(Pin pin);
043    
044    void export(Pin pin, PinMode mode);
045    boolean isExported(Pin pin);
046    void unexport(Pin pin);
047
048    void setMode(Pin pin, PinMode mode);
049    PinMode getMode(Pin pin);    
050        
051    void setPullResistance(Pin pin, PinPullResistance resistance);
052    PinPullResistance getPullResistance(Pin pin);
053
054    void setState(Pin pin, PinState state);
055    PinState getState(Pin pin);
056    
057    void setValue(Pin pin, double value);
058    double getValue(Pin pin);    
059
060    void setPwm(Pin pin, int value);
061    int getPwm(Pin pin);    
062    
063    void addListener(Pin pin, PinListener listener);
064    void removeListener(Pin pin, PinListener listener);
065    void removeAllListeners();
066
067    void shutdown();
068    boolean isShutdown();
069}