User Data Relay Output - 0xAD

Input frame: User Data Relay Input - 0x2D

Description

This frame type is emitted when user data is relayed to the serial port from a local interface: MicroPython (internal interface), BLE, or the serial port.

For information and examples on how to relay user data using MicroPython, see Send and receive User Data Relay frames in the MicroPython Programming Guide.

for information and examples on how to relay user data using BLE, see Communicate with a Micropython application in the XBee Mobile SDK user guide.

Format

The following table provides the contents of the frame. For details on frame structure, see API frame format.

Offset Size Frame Field Description
0 8-bit Start Delimiter Indicates the start of an API frame.
1 16-bit Length Number of bytes between the length and checksum.
3 8-bit Frame type

User Data Relay Output - 0xAD

4 8-bit Source Interface

The intended interface for the payload data:

0 = Serial port—SPI, or UART when in API mode

1 = BLE

2 = MicroPython

5-n

variable

Data

The user data to be relayed

EOF 8-bit Checksum 0xFF minus the 8-bit sum of bytes from offset 3 to this byte (between length and checksum).

Error cases

Errors are reported in a Transmit Status - 0x89 frame that corresponds with the Frame ID of the Relay Data frame:

Error code Error Description
0x7C Invalid Interface The user specified a destination interface that does not exist or is unsupported.
0x7D Interface not accepting frames

The destination interface is a valid interface, but is not in a state that can accept data.
For example: UART not in API mode, BLE does not have a GATT client connected, or buffer queues are full.

If the message was relayed successfully, no status will be generated.

Examples

Each example is written without escapes (AP = 1) and all bytes are represented in hex format. For brevity, the start delimiter, length, and checksum fields have been excluded.

Relay from Bluetooth (BLE)

A mobile phone sends a serial data message to the XBee device's BLE interface. The message is flagged to be sent out of the serial port of the XBee device. The following frame outputs the relayed data:

7E 00 0C AD 01 52 65 6C 61 79 20 44 61 74 61 BA
Frame type Source interface Data
0xAD 0x01 0x52656C61792044617461
Output Bluetooth "Relay Data"