|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.squawk.io.ConnectionBase com.sun.spot.peripheral.RadioConnectionBase com.sun.spot.io.j2me.radiogram.RadiogramConnImpl
public class RadiogramConnImpl
This class provides the "radiogram" protocol for accessing the SPOT radio using datagrams.
It is an implementor of RadiostreamConnection
RadiostreamConnection
Field Summary |
---|
Fields inherited from class com.sun.spot.peripheral.RadioConnectionBase |
---|
DEFAULT_TIMEOUT |
Constructor Summary | |
---|---|
RadiogramConnImpl()
DO NOT USE THIS CONSTRUCTOR - connections should be created using Connector.open(...) |
|
RadiogramConnImpl(String addr,
byte portNo,
boolean isServer,
boolean timeouts)
DO NOT USE THIS CONSTRUCTOR - connections should be created using Connector.open(...) |
Method Summary | |
---|---|
void |
close()
Close |
byte |
getLocalPort()
Answer the port number for this connection |
long |
getMacAddress()
|
int |
getMaxBroadcastHops()
returns the maximum number of mesh hops broadcasts sent on this connection will traverse |
int |
getMaximumLength()
Get the maximum length a datagram can be. |
int |
getNominalLength()
Get the nominal length of a datagram. |
static IRadioPolicyManager |
getRadioPolicyManager()
|
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 arg0,
String arg1,
int arg2,
boolean arg3)
Open a connection to a target. |
boolean |
packetsAvailable()
determines whether there are radiograms that can be read from this connection |
void |
receive(Datagram dgram)
Receive a datagram. |
IncomingData |
receivePacket()
|
void |
send(Datagram dgram)
Send a datagram. |
void |
setMaxBroadcastHops(int hops)
change the number of mesh hops a broadcast packet may take |
static void |
setProtocolManager(IRadiogramProtocolManager protocolManager)
|
void |
setRadioPolicy(RadioPolicy policy)
Set the radio policy for this connection |
static void |
setRadioPolicyManager(IRadioPolicyManager manager)
|
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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.sun.spot.peripheral.ITimeoutableConnection |
---|
getTimeout, setTimeout |
Constructor Detail |
---|
public RadiogramConnImpl(String addr, byte portNo, boolean isServer, boolean timeouts)
public RadiogramConnImpl()
Method Detail |
---|
public static void setProtocolManager(IRadiogramProtocolManager protocolManager)
public static IRadioPolicyManager getRadioPolicyManager()
public static void setRadioPolicyManager(IRadioPolicyManager manager)
public void close() throws IOException
ConnectionBase
close
in interface Connection
close
in class ConnectionBase
IOException
- If an I/O error occurspublic int getMaximumLength()
DatagramConnection
getMaximumLength
in interface DatagramConnection
public int getNominalLength()
DatagramConnection
getNominalLength
in interface DatagramConnection
public void send(Datagram dgram) throws NoAckException, ChannelBusyException, NoRouteException, NoMeshLayerAckException
DatagramConnection
send
in interface DatagramConnection
dgram
- A datagram.
NoAckException
ChannelBusyException
NoRouteException
NoMeshLayerAckException
public void receive(Datagram dgram) throws IOException
DatagramConnection
receive
in interface DatagramConnection
dgram
- A datagram.
IOException
- If an I/O error occurs.public Datagram newDatagram(int size)
DatagramConnection
newDatagram
in interface DatagramConnection
size
- The length of the buffer to be allocated
for the datagram
public Datagram newDatagram(int size, String addr)
DatagramConnection
newDatagram
in interface DatagramConnection
size
- 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 DatagramConnection
buf
- 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 DatagramConnection
buf
- 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 setRadioPolicy(RadioPolicy policy)
IRadioControl
setRadioPolicy
in interface IRadioControl
policy
- the policy requiredpublic Connection open(String arg0, String arg1, int arg2, boolean arg3) throws IOException
ConnectionBase
open
in class ConnectionBase
arg0
- The URL protocolarg1
- The URL for the connectionarg2
- The access modearg3
- A flag to indicate that the caller
wants timeout exceptions
IOException
- If some other kind of I/O error occurs.public IncomingData receivePacket()
public byte getLocalPort()
IRadioControl
getLocalPort
in interface IRadioControl
public boolean packetsAvailable()
RadiogramConnection
packetsAvailable
in interface RadiogramConnection
public void setMaxBroadcastHops(int hops)
IMultipleHopConnection
setMaxBroadcastHops
in interface IMultipleHopConnection
hops
- the new number of mesh hops a packet will traversepublic int getMaxBroadcastHops()
IMultipleHopConnection
getMaxBroadcastHops
in interface IMultipleHopConnection
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |