我想为Raspberry Pi 的 GPIO编写一个OSGI 捆绑包(Eclipse SmartHome 绑定)。
对于 GPIO,我需要包含 Pi4J 库。我将它们添加到我的项目文件夹中的 lib 文件夹中,并将 pi4j-core.jar 添加到我的构建路径中。
这是我的代码:
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschraenkt) and others.
* 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.statusgpio.handler;
import static org.openhab.binding.statusgpio.StatusGPIOBindingConstants.*;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.eclipse.smarthome.core.library.types.StringType;
import org.eclipse.smarthome.core.thing.ChannelUID;
import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.thing.binding.BaseThingHandler; …Run Code Online (Sandbox Code Playgroud)