|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthypermedia.picoip.PicoIP
public class PicoIP
A simple object to easily communicate with PicoIP card (http://www.pictec.org/).
Field Summary | |
---|---|
static int |
DEFAULT_PIN_COUNT
The number of pins on the PicoIP card |
static int |
TIMEOUT
The default connection timeout in milliseconds |
Constructor Summary | |
---|---|
PicoIP(Object parent,
String address)
Initializes PicoIP object and binds it to an available port. |
|
PicoIP(Object parent,
String address,
int pin_count)
Initializes PicoIP object and binds it to an available port. |
|
PicoIP(Object parent,
String address,
int pin_count,
int port)
Initializes PicoIP object with the given listening port. |
Method Summary | |
---|---|
boolean |
ask(int pin)
Ask for the given pin's value. |
void |
close()
Close the current connection. |
void |
log(boolean on)
Enable or disable UDP connexion log |
int |
port()
Return the actual listening port or -1 if the connexion is not set. |
void |
receive(byte[] data)
PicoIP receive handler. |
void |
reset()
Turn off all pins |
boolean |
set(int pin,
boolean state)
Turn on/off the requested pin. |
boolean |
set(int pin,
int value)
Change the given pin's value. |
void |
timeout(int millis)
Set the timeout value for the response time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_PIN_COUNT
public static final int TIMEOUT
Constructor Detail |
---|
public PicoIP(Object parent, String address)
parent
- the object owneraddress
- the PicoIP card addresspublic PicoIP(Object parent, String address, int pin_count)
parent
- the object owneraddress
- the PicoIP card addresspin_count
- the number of PIcoIP inputs/outputspublic PicoIP(Object parent, String address, int pin_count, int port)
note: PicoIP use two different ports for the communication. One for sending messages, the other for listening. The only rule to remember is that PicoIP receive message on his sending port + 100.
parent
- the object owneraddress
- the card addresspin_count
- the number of PIcoIP inputs/outputsport
- the listening port to bind onMethod Detail |
---|
public int port()
public void log(boolean on)
on
- print out UDP activity while truepublic boolean set(int pin, boolean state)
true
on success, false
otherwise.
pin
- the pin indexstate
- the required pin status
public boolean set(int pin, int value)
true
on success, false
otherwise.
pin
- the pin indexvalue
- the new pin value
public boolean ask(int pin)
void receive(int pin, int value) { // do something here... }
Return true
on success, false
otherwise.
notes : this method will be automatically called when the socket receive incoming data.
pin
- the pin index to be check
public void receive(byte[] data)
public void timeout(int millis)
millis
- the new timeout value in millisecondsTIMEOUT
public void reset()
public void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |