SunSPOT API V3.0


com.sun.spot.peripheral.radio
Class RadioInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.sun.spot.peripheral.radio.RadioInputStream
All Implemented Interfaces:
IRadioControl

Deprecated. Please use com.sun.spot.io.j2me.radiostream.RadioInputStream

public class RadioInputStream
extends InputStream
implements IRadioControl

Helper class for "radiostream:" connections. This class provides an InputStream over the data received from another Spot. It also provides a small set of accessors to get information about the quality of the link. You should NOT normally instantiate this class directly, but rather via the GCF framework: see the first reference below for more details.

See Also:
RadiostreamConnection

Constructor Summary
RadioInputStream(IRadiostreamProtocolManager dispatcher, ConnectionID cid, long timeout, RadioPolicy initialPolicy, IRadioPolicyManager radioPolicyManager)
          Deprecated. Construct a RadioInputStream
 
Method Summary
 int available()
          Deprecated. Return the number of bytes available to be read from the stream without blocking.
 void close()
          Deprecated. Closes this input stream and releases any system resources associated with the stream.
 int getCorr()
          Deprecated. CORR measures the average correlation value of the first 4 bytes of the packet header.
 int getLinkQuality()
          Deprecated. Link Quality Indication (LQI) is a characterization of the quality of a received packet.
 byte getLocalPort()
          Deprecated. Answer the port number for this connection
 int getRssi()
          Deprecated. RSSI (received signal strength indicator) measures the strength (power) of the signal for the packet.
 int read()
          Deprecated. Reads the next byte of data from the input stream.
 void setRadioPolicy(RadioPolicy selection)
          Deprecated. Set the radio policy for this connection
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RadioInputStream

public RadioInputStream(IRadiostreamProtocolManager dispatcher,
                        ConnectionID cid,
                        long timeout,
                        RadioPolicy initialPolicy,
                        IRadioPolicyManager radioPolicyManager)
Deprecated. 
Construct a RadioInputStream

Parameters:
dispatcher - the PortBasedProtocolManager that will dispatch radio packets
cid - the ConnectionID object being used
timeout - the timeout to use when waiting for input
Method Detail

read

public int read()
         throws IOException
Deprecated. 
Description copied from class: InputStream
Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

A subclass must provide an implementation of this method.

Specified by:
read in class InputStream
Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
IOException - if an I/O error occurs.

available

public int available()
              throws IOException
Deprecated. 
Return the number of bytes available to be read from the stream without blocking. Returns the number of bytes available in the current underlying radio packet - more packets might be coming but we just don't know.

Overrides:
available in class InputStream
Returns:
the number of bytes available right now
Throws:
IOException - if an I/O error occurs.

getLinkQuality

public int getLinkQuality()
Deprecated. 
Link Quality Indication (LQI) is a characterization of the quality of a received packet. Its value is computed from the CORR, correlation value. The LQI ranges from 0 (bad) to 255 (good).

Returns:
linkQuality - range 0 to 0xFF
See Also:
RadioPacket.getLinkQuality()

getCorr

public int getCorr()
Deprecated. 
CORR measures the average correlation value of the first 4 bytes of the packet header. A correlation value of ~110 indicates a maximum quality packet while a value of ~50 is typically the lowest quality packet detectable by the SPOT's receiver.

Returns:
- correlation value
See Also:
RadioPacket.getCorr()

getRssi

public int getRssi()
Deprecated. 
RSSI (received signal strength indicator) measures the strength (power) of the signal for the packet. It ranges from +60 (strong) to -60 (weak). To convert it to decibels relative to 1 mW (= 0 dBm) subtract 45 from it, e.g. for an RSSI of -20 the RF input power is approximately -65 dBm.

Returns:
- RSSI value
See Also:
RadioPacket.getRssi()

close

public void close()
           throws IOException
Deprecated. 
Description copied from class: InputStream
Closes this input stream and releases any system resources associated with the stream.

The close method of InputStream does nothing.

Overrides:
close in class InputStream
Throws:
IOException - if an I/O error occurs.

setRadioPolicy

public void setRadioPolicy(RadioPolicy selection)
Deprecated. 
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()
Deprecated. 
Description copied from interface: IRadioControl
Answer the port number for this connection

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

SunSPOT API V3.0


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