Skip to content

Conversation

@rubenmoral
Copy link
Member

  • cellular: some improvements and changes in the cellular API frames
  • wifi: add support for XBee Wi-Fi and Device Cloud API frames

@rubenmoral rubenmoral added this to the cellular milestone Dec 2, 2016
* @see #getRequestTarget()
*/
public void setRequestTarget(String target) {
if (target.length() > 255)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check first that target is not null.

* @see com.digi.xbee.packet.XBeeAPIPacket#getAPIPacketParameters()
*/
@Override
public LinkedHashMap<String, String> getAPIPacketParameters() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, I think that we should format the parameters of the packets with the hexadecimal string followed by the interpreted value (when necessary).

* using the parameters of the constructor or providing a valid API payload.
*
* <p>This frame type is sent out the serial port in response to the
* {@link SendDataRequestPacket}, providing its frame ID is non-zero.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

providing its frame ID is non-zero... Should it be... providing its frame ID if it is non-zero ?

*
* @return Received RF data.
*
* @see #setRFData(byte[])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is not any setRFData(byte[]) method.

parameters.put("Source address", sourceAddress.toString());
parameters.put("RSSI", String.valueOf(rssi));
parameters.put("Receive options", String.valueOf(receiveOptions));
if (ioSample != null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add more detailed information about the sample here:

if (ioSample != null) {
	parameters.put("Number of samples", HexUtils.prettyHexString(HexUtils.integerToHexString(1, 1))); // There is always 1 sample.
	parameters.put("Digital channel mask", HexUtils.prettyHexString(HexUtils.integerToHexString(ioSample.getDigitalMask(), 2)));
	parameters.put("Analog channel mask", HexUtils.prettyHexString(HexUtils.integerToHexString(ioSample.getAnalogMask(), 2)));
	for (int i = 0; i < 16; i++) {
		if (ioSample.hasDigitalValue(IOLine.getDIO(i)))
			parameters.put(IOLine.getDIO(i).getName() + " digital value", ioSample.getDigitalValue(IOLine.getDIO(i)).getName());
	}
	for (int i = 0; i < 6; i++) {
		if (ioSample.hasAnalogValue(IOLine.getDIO(i)))
			parameters.put(IOLine.getDIO(i).getName() + " analog value", HexUtils.prettyHexString(HexUtils.integerToHexString(ioSample.getAnalogValue(IOLine.getDIO(i)), 2)));
	}
} else if (rfData != null)
	parameters.put("RF data", HexUtils.prettyHexString(HexUtils.byteArrayToHexString(rfData)));

*
* @return The status of the device response.
*
* @see DeviceCloudStatus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add:

* @see #setStatus(DeviceCloudStatus)

*
* @throws NullPointerException if {@code error == null}.
*
* @see FrameError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add:

* @see getError()

*
* @return The frame error.
*
* @see FrameError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add:

* @see setError(FrameError)

* @throws NullPointerException if {@code status == null}.
*
* @see #getStatus()
* @see SendDataResponseStatus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace by:

* @see DeviceCloudStatus

* @return The file upload status.
*
* @see #setStatus(DeviceCloudStatus)
* @see SendDataResponseStatus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace by:

* @see DeviceCloudStatus

Signed-off-by: Ruben Moral <Ruben.Moral@digi.com>
Wi-Fi frames:
* 0x07 - Remote AT Command (Wi-Fi)
* 0x87 - Remote AT Command Response (Wi-Fi)
* 0x8F - IO Data Sample RX Indicator

Device Cloud frames:
* 0x28 - Send Data Request
* 0x2A - Device Response
* 0xB8 - Send Data Response
* 0xB9 - Device Request
* 0xBA - Device Response Status
* 0xFE - Frame Error

Unit tests for all new code

https://jira.digi.com/browse/XBJAPI-316

Signed-off-by: Ruben Moral <Ruben.Moral@digi.com>
@rubenmoral rubenmoral merged commit 4e4211f into wlan_support Dec 5, 2016
@rubenmoral rubenmoral deleted the rmoral/wifi_frames branch December 5, 2016 12:48
@rubenmoral rubenmoral modified the milestones: wifi, cellular Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants