-
Notifications
You must be signed in to change notification settings - Fork 58
Wi-Fi frames #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wi-Fi frames #71
Conversation
rubenmoral
commented
Dec 2, 2016
- cellular: some improvements and changes in the cellular API frames
- wifi: add support for XBee Wi-Fi and Device Cloud API frames
| * @see #getRequestTarget() | ||
| */ | ||
| public void setRequestTarget(String target) { | ||
| if (target.length() > 255) |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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[]) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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>
143734d to
4e4211f
Compare