001package com.pi4j.io.i2c; 002 003/* 004 * #%L 005 * ********************************************************************** 006 * ORGANIZATION : Pi4J 007 * PROJECT : Pi4J :: Java Library (Core) 008 * FILENAME : I2CBus.java 009 * 010 * This file is part of the Pi4J project. More information about 011 * this project can be found here: http://www.pi4j.com/ 012 * ********************************************************************** 013 * %% 014 * Copyright (C) 2012 - 2013 Pi4J 015 * %% 016 * Licensed under the Apache License, Version 2.0 (the "License"); 017 * you may not use this file except in compliance with the License. 018 * You may obtain a copy of the License at 019 * 020 * http://www.apache.org/licenses/LICENSE-2.0 021 * 022 * Unless required by applicable law or agreed to in writing, software 023 * distributed under the License is distributed on an "AS IS" BASIS, 024 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 025 * See the License for the specific language governing permissions and 026 * limitations under the License. 027 * #L% 028 */ 029 030import java.io.IOException; 031 032/** 033 * This is abstraction of i2c bus. This interface allows bus to return i2c device. 034 * 035 * @author Daniel Sendula 036 * 037 */ 038public interface I2CBus { 039 040 public static final int BUS_0 = 0; 041 public static final int BUS_1 = 1; 042 043 /** 044 * Returns i2c device. 045 * @param address i2c device's address 046 * @return i2c device 047 * 048 * @throws IOException thrown in case this bus cannot return i2c device. 049 */ 050 I2CDevice getDevice(int address) throws IOException; 051 052 /** 053 * Closes this bus. This usually means closing underlying file. 054 * 055 * @throws IOException thrown in case there are problems closing this i2c bus. 056 */ 057 void close() throws IOException; 058}