IM Profile

com.siemens.icm.io
Class InPort

java.lang.Object
  extended bycom.siemens.icm.io.InPort

public class InPort
extends Object

This class supports the access and configuration of a port of input pins of the general purpose IO driver (GPIO).
The usage of all GPIO ports is restricted to the same interface where the GPIO driver was opened. The parallel access of the GPIO driver by Java and another interface (i.e. AT commnad interface) is not supported.
When the module starts up, all GPIO pins are set to high-impedance state after initializing. Therefore, it is recommended to connect pull-up or pull-down resistors to all GPIO pins you want to use as output. This is necessary to keep these pins from floating or driving any external devices before all settings are done by the input port constructor and after release the input port again.
For example, to create a GPIO port of input pins:


      Vector pins = new Vector();

      pins.addElement("GPIO10");
      pins.addElement("GPIO5");
      pins.addElement("GPIO3");
      pins.addElement("GPIO1");

     InPort inport = new InPort(pins);
 

A group of maximum 10 pins can be configured to act as a parallel port. A pin can only be added once to a port, and only to a port. A maximun of 5 GPIO ports can be configured.


Constructor Summary
InPort(Vector pins)
          Creates a new instance of a GPIO port of input pins.
 
Method Summary
 void addListener(InPortListener listener)
          Registers listeners to receive value changes at an input port.
 void clearListener()
          Removes all listener objects which have been previously added to this input port.
 Vector getPins()
          Gets the given pin configuration of an instance of a GPIO port of input pins.
 int getValue()
          Gets the current value of an instance of a GPIO port of input pins.
 void release()
          Releases an instance of a GPIO port of input pins.
 void removeListener(InPortListener listener)
          Removes a listener object which has been previously added from the internal list table of listener objects.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InPort

public InPort(Vector pins)
       throws IOException
Creates a new instance of a GPIO port of input pins.

Parameters:
pins - pin configuration of port. First pin in vector is the LSB
Throws:
IOException - if creating the GPIO port instance fails
Method Detail

release

public void release()
             throws IOException
Releases an instance of a GPIO port of input pins. The pins of the port are closed as well and can be added to a new port.

Throws:
IOException - if releasing the GPIO port instance fails

getValue

public int getValue()
             throws IOException
Gets the current value of an instance of a GPIO port of input pins. Getting the state of a port whose width is less than 10 bits, the bits of the returned value that are more significant than the MSB of the port are set to zero.

Throws:
IOException - if getting value failed

getPins

public Vector getPins()
Gets the given pin configuration of an instance of a GPIO port of input pins.

Throws:
IOException - if creating the GPIO port instance failed

addListener

public void addListener(InPortListener listener)
Registers listeners to receive value changes at an input port. A maximum of 10 listeners can be added. The listener object is an implementation of InPortListener interface. Registered listener instances are stored in an internal table but are not guaranteed to be called in the order they has been registered. By starting the input port, a port value 0 is assumed as reference for changes. If the input port value is different from 0, the current value will be sent by the listener immediately after creating the port. If the value of the port is 0, no changes will be notified.

Parameters:
listener - The InPortListener object to be registered.
See Also:
InPortListener, removeListener(com.siemens.icm.io.InPortListener), clearListener()

removeListener

public void removeListener(InPortListener listener)
Removes a listener object which has been previously added from the internal list table of listener objects. After it has been removed from the list it won't be called in case of changes at the input port. If it hasn't been registered before the list will remain unchanged.

Parameters:
listener - The InPortListener object to be removed from the list.
See Also:
InPortListener, addListener(com.siemens.icm.io.InPortListener), clearListener()

clearListener

public void clearListener()
Removes all listener objects which have been previously added to this input port. After all objects have been removed from the list no listener will be called in case of changes at the input port. If no listener has been registered before the list will remain unchanged.

See Also:
InPortListener, addListener(com.siemens.icm.io.InPortListener), removeListener(com.siemens.icm.io.InPortListener)

IM Profile

Submit a comment or suggestion Version 2.0 of IM Profile Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries. Copyright (c) 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A. All Rights Reserved.