SunSPOT API V3.0


com.sun.squawk.io.j2me.radiostream
Class Protocol

java.lang.Object
  extended by com.sun.squawk.io.ConnectionBase
      extended by com.sun.spot.peripheral.RadioConnectionBase
          extended by com.sun.squawk.io.j2me.radiostream.Protocol
All Implemented Interfaces:
RadiostreamConnection, IRadioControl, ITimeoutableConnection, Connection, InputConnection, OutputConnection, StreamConnection

public class Protocol
extends RadioConnectionBase
implements RadiostreamConnection

This class provides the "radiostream" protocol for accessing the SPOT radio using streams. It is an implementor of RadiostreamConnection

See Also:
RadiostreamConnection

Field Summary
 
Fields inherited from class com.sun.spot.peripheral.RadioConnectionBase
DEFAULT_TIMEOUT
 
Constructor Summary
Protocol()
           
 
Method Summary
 byte getLocalPort()
          Answer the port number for this connection
 Connection open(String protocolName, String name, int mode, boolean timeouts)
          Open a connection to a target.
 InputStream openInputStream()
          Open and return a data input stream for a connection.
 OutputStream openOutputStream()
          Open and return a data output stream for a connection.
static void setProtocolManager(IRadiostreamProtocolManager protocolManager)
           
 void setRadioPolicy(RadioPolicy selection)
          Set the radio policy for this connection
static void setRadioPolicyManager(IRadioPolicyManager manager)
           
 void setTimeout(long time)
          Set the timeout for receiving information on this connection
 
Methods inherited from class com.sun.spot.peripheral.RadioConnectionBase
getTimeout
 
Methods inherited from class com.sun.squawk.io.ConnectionBase
close, openDataInputStream, openDataOutputStream
 
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
 
Methods inherited from interface javax.microedition.io.InputConnection
openDataInputStream
 
Methods inherited from interface javax.microedition.io.Connection
close
 
Methods inherited from interface javax.microedition.io.OutputConnection
openDataOutputStream
 
Methods inherited from interface javax.microedition.io.Connection
close
 

Constructor Detail

Protocol

public Protocol()
Method Detail

setProtocolManager

public static void setProtocolManager(IRadiostreamProtocolManager protocolManager)

setRadioPolicyManager

public static void setRadioPolicyManager(IRadioPolicyManager manager)

open

public Connection open(String protocolName,
                       String name,
                       int mode,
                       boolean timeouts)
Description copied from class: ConnectionBase
Open a connection to a target.

Specified by:
open in class ConnectionBase
Parameters:
protocolName - The URL protocol
name - The URL for the connection
mode - The access mode
timeouts - A flag to indicate that the caller wants timeout exceptions
Returns:
A new Connection object

openInputStream

public InputStream openInputStream()
Description copied from class: ConnectionBase
Open and return a data input stream for a connection.

Specified by:
openInputStream in interface InputConnection
Overrides:
openInputStream in class ConnectionBase
Returns:
An input stream

openOutputStream

public OutputStream openOutputStream()
Description copied from class: ConnectionBase
Open and return a data output stream for a connection.

Specified by:
openOutputStream in interface OutputConnection
Overrides:
openOutputStream in class ConnectionBase
Returns:
An input stream

setRadioPolicy

public void setRadioPolicy(RadioPolicy selection)
Description copied from interface: IRadioControl
Set the radio policy for this connection

Specified by:
setRadioPolicy in interface IRadioControl
Parameters:
selection - the policy required

getLocalPort

public byte getLocalPort()
Description copied from interface: IRadioControl
Answer the port number for this connection

Specified by:
getLocalPort in interface IRadioControl
Returns:
the port number

setTimeout

public void setTimeout(long time)
Description copied from interface: ITimeoutableConnection
Set the timeout for receiving information on this connection

Specified by:
setTimeout in interface ITimeoutableConnection
Overrides:
setTimeout in class RadioConnectionBase
Parameters:
time - - Timeout period in milliseconds. Set this to -1 to turn off timeouts (infinite wait), or to 0 or more to wait that long for data before throwing a TimeoutException.

SunSPOT API V3.0


Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.