|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.alarexgroup.m2mplf.adapters.io.PortAdapter
public class PortAdapter
Lets you create groups from respective GPIOs, aka ports.
These ports can be input or output. You can monitor status changes on input ports
Example of monitoring ports from pins GPIO1..4:
import com.alarexgroup.m2mplf.M2Mlet;
|
import com.alarexgroup.m2mplf.M2Mlet;
|
| Field Summary | |
|---|---|
static int |
PORT_DIRECTION_INPUT
Input port |
static int |
PORT_DIRECTION_OUTPUT
Output port |
| Method Summary | |
|---|---|
Port |
createInputPort(int[] pinIds,
boolean startPooling)
Method creates input port from array-specified GPIO pins. |
Port |
createOutputPort(int[] pinIds)
Creates output port from GPIO |
void |
destroyPort(Port port)
This method releases port from usage |
static PortAdapter |
getPortAdapter(PortAdapterListener listener)
Initializes this adapter and returns referrence |
void |
onURCEvent(java.lang.String urc)
This method is called when gets AT command answer. |
int |
readPortValue(Port port)
Returns the port's value |
void |
startPoolingPort(Port port)
Start port status monitoring. |
void |
stopPoolingPort(Port port)
Stops port monitoring. |
void |
writePortValue(Port port,
int value)
Sets the port value to specified value |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PORT_DIRECTION_INPUT
public static final int PORT_DIRECTION_OUTPUT
| Method Detail |
|---|
public static PortAdapter getPortAdapter(PortAdapterListener listener)
listener - interface for handling port events.
public Port createInputPort(int[] pinIds,
boolean startPooling)
throws PortIOException
PortAdapterListener.onPortValueChanged(com.alarexgroup.m2mplf.adapters.io.Port, long) is automatically called
pinIds - array with numbers of GPIOs, that should create the port.startPooling - true, if port status monitoring should be commenced immediatelly
PortIOException - In case of trouble with creating, e.g. when GPIO pin is alredy in other port
public Port createOutputPort(int[] pinIds)
throws PortIOException
pinIds - array of GPIO numbers, that should create the port
PortIOException - In case of trouble with creating, e.g. when GPIO pin is alredy in other portpublic void destroyPort(Port port)
port - AT_COMMAND AT^SDPORTpublic int readPortValue(Port port)
port - specific port, whose value we want to know
public void writePortValue(Port port,
int value)
port - Port to which we wil lwrite the valuevalue - value to be written
public void startPoolingPort(Port port)
throws PortIOException
PortAdapterListener.onPortValueChanged(com.alarexgroup.m2mplf.adapters.io.Port, long) is automatically called
port - monitored port
PortIOException - In case of problems
public void stopPoolingPort(Port port)
throws PortIOException
port - monitored port
PortIOException - in case of troublepublic void onURCEvent(java.lang.String urc)
ATCommanderListener
onURCEvent in interface ATCommanderListenerurc - - URC string
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||