001package com.pi4j.io.gpio.event; 002 003/* 004 * #%L 005 * ********************************************************************** 006 * ORGANIZATION : Pi4J 007 * PROJECT : Pi4J :: Java Library (Core) 008 * FILENAME : PinEvent.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 030 031import java.util.EventObject; 032 033import com.pi4j.io.gpio.Pin; 034 035 036/** 037 * GPIO pin event. 038 * 039 * @author Robert Savage (<a 040 * href="http://www.savagehomeautomation.com">http://www.savagehomeautomation.com</a>) 041 */ 042public class PinEvent extends EventObject { 043 044 private static final long serialVersionUID = 5238592505805435621L; 045 protected final Pin pin; 046 protected final PinEventType type; 047 048 /** 049 * Default event constructor 050 * 051 * @param obj Ignore this parameter 052 * @param pin GPIO pin number (not header pin number; not wiringPi pin number) 053 */ 054 public PinEvent(Object obj, Pin pin, PinEventType type) { 055 super(obj); 056 this.pin = pin; 057 this.type = type; 058 } 059 060 /** 061 * Get the pin number that changed and raised this event. 062 * 063 * @return GPIO pin number (not header pin number; not wiringPi pin number) 064 */ 065 public Pin getPin() { 066 return pin; 067 } 068 069 public PinEventType getEventType() { 070 return type; 071 } 072}