|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.squawk.io.ConnectionBase
com.sun.spot.peripheral.RadioConnectionBase
com.sun.squawk.io.j2me.radiogram.Protocol
public class Protocol
This class provides the "radiogram" protocol for accessing the SPOT radio using datagrams.
It is an implementor of RadioConnection
RadioConnection| Field Summary |
|---|
| Fields inherited from class com.sun.spot.peripheral.RadioConnectionBase |
|---|
DEFAULT_TIMEOUT |
| Constructor Summary | |
|---|---|
Protocol()
Default constructor - normally not called by user code which should use the GCF framework instead. |
|
| Method Summary | |
|---|---|
void |
close()
Close |
long |
getMacAddress()
|
int |
getMaximumLength()
Get the maximum length a datagram can be. |
int |
getNominalLength()
Get the nominal length of a datagram. |
boolean |
isBroadcast()
|
boolean |
isPointToPoint()
|
boolean |
isServer()
|
Datagram |
newDatagram(byte[] buf,
int size)
Make a new datagram object. |
Datagram |
newDatagram(byte[] buf,
int size,
String addr)
Make a new datagram object. |
Datagram |
newDatagram(int size)
Make a new datagram object automatically allocating a buffer. |
Datagram |
newDatagram(int size,
String addr)
Make a new datagram object. |
Connection |
open(String protocolName,
String name,
int mode,
boolean timeouts)
Open a connection to a target. |
void |
receive(Datagram dgram)
Receive a datagram. |
RadioPacket |
receivePacket()
|
RadioPacket |
receivePacket(long timeout)
|
void |
send(Datagram dgram)
Send a datagram. |
void |
sendPacket(RadioPacket rp)
|
static void |
setPBPM(IPortBasedProtocolManager pbpm)
|
| Methods inherited from class com.sun.spot.peripheral.RadioConnectionBase |
|---|
getTimeout, setTimeout |
| Methods inherited from class com.sun.squawk.io.ConnectionBase |
|---|
openDataInputStream, openDataOutputStream, openInputStream, openOutputStream |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sun.spot.peripheral.ITimeoutableConnection |
|---|
getTimeout, setTimeout |
| Constructor Detail |
|---|
public Protocol()
| Method Detail |
|---|
public static void setPBPM(IPortBasedProtocolManager pbpm)
public Connection open(String protocolName,
String name,
int mode,
boolean timeouts)
ConnectionBase
open in class ConnectionBaseprotocolName - The URL protocolname - The URL for the connectionmode - The access modetimeouts - A flag to indicate that the caller
wants timeout exceptions
public void close()
throws IOException
ConnectionBase
close in interface Connectionclose in class ConnectionBaseIOException - If an I/O error occurspublic int getMaximumLength()
DatagramConnection
getMaximumLength in interface DatagramConnectionpublic int getNominalLength()
DatagramConnection
getNominalLength in interface DatagramConnection
public void send(Datagram dgram)
throws NoAckException,
ChannelBusyException
DatagramConnection
send in interface DatagramConnectiondgram - A datagram.
NoAckException
ChannelBusyException
public void receive(Datagram dgram)
throws IOException
DatagramConnection
receive in interface DatagramConnectiondgram - A datagram.
IOException - If an I/O error occurs.
InterruptedIOException - Timeout or upon closing the
connection with outstanding I/O.public Datagram newDatagram(int size)
DatagramConnection
newDatagram in interface DatagramConnectionsize - The length of the buffer to be allocated
for the datagram
public Datagram newDatagram(int size,
String addr)
DatagramConnection
newDatagram in interface DatagramConnectionsize - The length of the buffer to be usedaddr - The I/O address to which the datagram
will be sent
public Datagram newDatagram(byte[] buf,
int size)
DatagramConnection
newDatagram in interface DatagramConnectionbuf - The buffer to be used in the datagramsize - The length of the buffer to be allocated
for the datagram
public Datagram newDatagram(byte[] buf,
int size,
String addr)
DatagramConnection
newDatagram in interface DatagramConnectionbuf - The buffer to be used in the datagramsize - The length of the buffer to be usedaddr - The I/O address to which the datagram
will be sent
public boolean isBroadcast()
public boolean isPointToPoint()
public boolean isServer()
public long getMacAddress()
public void sendPacket(RadioPacket rp)
throws NoAckException,
ChannelBusyException
NoAckException
ChannelBusyExceptionpublic RadioPacket receivePacket(long timeout)
public RadioPacket receivePacket()
|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||