API mode in detail

API mode provides a structured interface where data is communicated through the serial interface in organized packets and in a determined order. This enables you to establish complex communication between devices without having to define your own protocol.

By default, XBee devices are configured to work in transparent mode: all data received through the serial input is queued up for radio transmission and data received wirelessly is sent to the serial output exactly as it is received, with no additional information.

Because of this behavior, devices working in Transparent mode have some limitations:

  1. To read or write the configuration of an device in Transparent mode, you must first transition the device into Command mode.
  2. If a device needs to transmit messages to different devices, you must update its configuration to establish a new destination. The device must enter Command mode to set up the destination.
  3. A device operating in Transparent mode cannot identify the source of a wireless message it receives. If it needs to distinguish between data coming from different devices, the sending devices must include extra information known by all the devices so it can be extracted later. To do this, you must define a robust protocol that includes all the information you think you need in your transmissions.

To minimize the limitations of the transparent mode, devices provide an alternative mode called Application Programming Interface (API). API mode provides a structured interface where data is communicated through the serial interface in organized packets and in a determined order. This enables you to establish complex communication between modules without having to define your own protocol.

API mode provides a much easier way to perform the actions listed above:

  1. Since there are different frames for different purposes (such as configuration and communication), you can configure a device without entering Command mode.
  2. Since the data destination is included as part of the API frame structure, you can use API mode to transmit messages to multiple devices.
  3. The API frame includes the source of the message so it is easy to identify where data is coming from.

Advantages of API mode

 

© 2019 Digi International Inc. All rights reserved.
API mode in detail updated on 29 August 2019 11:19:28 AM