com.rapplogic.xbee.api.zigbee
Class ZNetRxIoSampleResponse

java.lang.Object
  extended by com.rapplogic.xbee.api.XBeeResponse
      extended by com.rapplogic.xbee.api.zigbee.ZNetRxBaseResponse
          extended by com.rapplogic.xbee.api.zigbee.ZNetRxIoSampleResponse
All Implemented Interfaces:
NoRequestResponse, java.io.Serializable

public class ZNetRxIoSampleResponse
extends ZNetRxBaseResponse
implements NoRequestResponse

Series 2 XBee. Represents an I/O Sample resposne sent from a remote radio. Provides access to the XBee's 4 Analog (0-4), 11 Digital (0-7,10-12), and 1 Supply Voltage pins

Note: Series 2 XBee does not support multiple samples (IT) per packet

Author:
andrew
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.rapplogic.xbee.api.zigbee.ZNetRxBaseResponse
ZNetRxBaseResponse.Option
 
Constructor Summary
ZNetRxIoSampleResponse()
           
 
Method Summary
 boolean containsAnalog()
          Returns true if this sample contains data from analog inputs or supply voltage How does supply voltage get enabled?? See manual page 68 for byte bit mapping
 boolean containsDigital()
          Returns true if this sample contains data from digital inputs See manual page 68 for byte bit mapping
 java.lang.Integer getAnalog(int pin)
          Returns a 10 bit value of ADC line 0, if enabled.
 java.lang.Integer getAnalog0()
          Consider using getAnalog(pin) instead
 java.lang.Integer getAnalog1()
           
 java.lang.Integer getAnalog2()
           
 java.lang.Integer getAnalog3()
           
 int getAnalogChannelMask()
           
 int getDigitalChannelMaskLsb()
           
 int getDigitalChannelMaskMsb()
           
 java.lang.Integer getDioLsb()
          Returns the DIO LSB, only if sample contains digital; null otherwise
 java.lang.Integer getDioMsb()
          Returns the DIO MSB, only if sample contains digital; null otherwise
 java.lang.Integer getSupplyVoltage()
           
 boolean isA0Enabled()
          Consider using isAnalogEnable(pin) instead
 boolean isA1Enabled()
           
 boolean isA2Enabled()
           
 boolean isA3Enabled()
           
 boolean isAnalogEnabled(int pin)
           
 boolean isD0Enabled()
          Consider using isDigitalEnabled(pin) instead
 java.lang.Boolean isD0On()
          Consider using isDigitalOn(pin)
 boolean isD10Enabled()
           
 java.lang.Boolean isD10On()
           
 boolean isD11Enabled()
           
 java.lang.Boolean isD11On()
           
 boolean isD12Enabled()
           
 java.lang.Boolean isD12On()
           
 boolean isD1Enabled()
           
 java.lang.Boolean isD1On()
           
 boolean isD2Enabled()
           
 java.lang.Boolean isD2On()
           
 boolean isD3Enabled()
           
 java.lang.Boolean isD3On()
           
 boolean isD4Enabled()
           
 java.lang.Boolean isD4On()
           
 boolean isD5Enabled()
           
 java.lang.Boolean isD5On()
           
 boolean isD6Enabled()
           
 java.lang.Boolean isD6On()
           
 boolean isD7Enabled()
           
 java.lang.Boolean isD7On()
           
 boolean isDigitalEnabled(int pin)
           
 java.lang.Boolean isDigitalOn(int pin)
          If digital I/O line (DIO0) is enabled: returns true if digital 0 is HIGH (ON); false if it is LOW (OFF).
 boolean isSupplyVoltageEnabled()
          (from the spec) The voltage supply threshold is set with the V+ command.
 void parse(IIntArrayInputStream ps)
          This method is a bit non standard since it needs to parse an IO sample from either a RX response or a Remote AT/Local AT response (IS).
static ZNetRxIoSampleResponse parseIsSample(AtCommandResponse response)
           
 void setAnalog0(java.lang.Integer analog0)
           
 void setAnalog1(java.lang.Integer analog1)
           
 void setAnalog2(java.lang.Integer analog2)
           
 void setAnalog3(java.lang.Integer analog3)
           
 void setSupplyVoltage(java.lang.Integer supplyVoltage)
           
 java.lang.String toString()
           
 
Methods inherited from class com.rapplogic.xbee.api.zigbee.ZNetRxBaseResponse
getOption, getRemoteAddress16, getRemoteAddress64, setOption, setRemoteAddress16, setRemoteAddress64
 
Methods inherited from class com.rapplogic.xbee.api.XBeeResponse
equals, finish, getApiId, getChecksum, getLength, getPacketBytes, getProcessedPacketBytes, getRawPacketBytes, hashCode, isError, setApiId, setChecksum, setError, setLength, setRawPacketBytes
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZNetRxIoSampleResponse

public ZNetRxIoSampleResponse()
Method Detail

parseIsSample

public static ZNetRxIoSampleResponse parseIsSample(AtCommandResponse response)
                                            throws java.io.IOException
Throws:
java.io.IOException

parse

public void parse(IIntArrayInputStream ps)
           throws java.io.IOException
This method is a bit non standard since it needs to parse an IO sample from either a RX response or a Remote AT/Local AT response (IS).

Parameters:
ps -
Throws:
java.io.IOException

getDigitalChannelMaskMsb

public int getDigitalChannelMaskMsb()

getDigitalChannelMaskLsb

public int getDigitalChannelMaskLsb()

getAnalogChannelMask

public int getAnalogChannelMask()

isD0Enabled

public boolean isD0Enabled()
Consider using isDigitalEnabled(pin) instead

Returns:

isD1Enabled

public boolean isD1Enabled()

isD2Enabled

public boolean isD2Enabled()

isD3Enabled

public boolean isD3Enabled()

isD4Enabled

public boolean isD4Enabled()

isD5Enabled

public boolean isD5Enabled()

isD6Enabled

public boolean isD6Enabled()

isD7Enabled

public boolean isD7Enabled()

isD10Enabled

public boolean isD10Enabled()

isD11Enabled

public boolean isD11Enabled()

isD12Enabled

public boolean isD12Enabled()

isA0Enabled

public boolean isA0Enabled()
Consider using isAnalogEnable(pin) instead

Returns:

isA1Enabled

public boolean isA1Enabled()

isA2Enabled

public boolean isA2Enabled()

isA3Enabled

public boolean isA3Enabled()

isDigitalEnabled

public boolean isDigitalEnabled(int pin)

isAnalogEnabled

public boolean isAnalogEnabled(int pin)

isSupplyVoltageEnabled

public boolean isSupplyVoltageEnabled()
(from the spec) The voltage supply threshold is set with the V+ command. If the measured supply voltage falls below or equal to this threshold, the supply voltage will be included in the IO sample set. V+ is set to 0 by default (do not include the supply voltage).

Returns:

isD0On

public java.lang.Boolean isD0On()
Consider using isDigitalOn(pin)

Returns:

isD1On

public java.lang.Boolean isD1On()

isD2On

public java.lang.Boolean isD2On()

isD3On

public java.lang.Boolean isD3On()

isD4On

public java.lang.Boolean isD4On()

isD5On

public java.lang.Boolean isD5On()

isD6On

public java.lang.Boolean isD6On()

isD7On

public java.lang.Boolean isD7On()

isD10On

public java.lang.Boolean isD10On()

isD11On

public java.lang.Boolean isD11On()

isD12On

public java.lang.Boolean isD12On()

isDigitalOn

public java.lang.Boolean isDigitalOn(int pin)
If digital I/O line (DIO0) is enabled: returns true if digital 0 is HIGH (ON); false if it is LOW (OFF). If digital I/O line is not enabled this method returns null as it has no value.

Important: the pin number corresponds to the logical pin (e.g. D4), not the physical pin number.

Digital I/O pins seem to report high when open circuit (unconnected)

Returns:

containsDigital

public boolean containsDigital()
Returns true if this sample contains data from digital inputs See manual page 68 for byte bit mapping

Returns:

containsAnalog

public boolean containsAnalog()
Returns true if this sample contains data from analog inputs or supply voltage How does supply voltage get enabled?? See manual page 68 for byte bit mapping

Returns:

getDioMsb

public java.lang.Integer getDioMsb()
Returns the DIO MSB, only if sample contains digital; null otherwise

Returns:

getDioLsb

public java.lang.Integer getDioLsb()
Returns the DIO LSB, only if sample contains digital; null otherwise

Returns:

getAnalog0

public java.lang.Integer getAnalog0()
Consider using getAnalog(pin) instead

Returns:

setAnalog0

public void setAnalog0(java.lang.Integer analog0)

getAnalog1

public java.lang.Integer getAnalog1()

setAnalog1

public void setAnalog1(java.lang.Integer analog1)

getAnalog2

public java.lang.Integer getAnalog2()

setAnalog2

public void setAnalog2(java.lang.Integer analog2)

getAnalog3

public java.lang.Integer getAnalog3()

setAnalog3

public void setAnalog3(java.lang.Integer analog3)

getAnalog

public java.lang.Integer getAnalog(int pin)
Returns a 10 bit value of ADC line 0, if enabled. Returns null if ADC line 0 is not enabled.

The range of Digi XBee series 2 ADC is 0 - 1.2V and although I couldn't find this in the spec a few google searches seems to confirm. When I connected 3.3V to just one of the ADC pins, it displayed its displeasure by reporting all ADC pins at 1023.

Analog pins seem to float around 512 when open circuit

The reason this returns null is to prevent bugs in the event that you thought you were reading the actual value when the pin is not enabled.

Returns:

getSupplyVoltage

public java.lang.Integer getSupplyVoltage()

setSupplyVoltage

public void setSupplyVoltage(java.lang.Integer supplyVoltage)

toString

public java.lang.String toString()
Overrides:
toString in class ZNetRxBaseResponse