Skip to content

Extracting Transmit Statis for coordinator device #300

@sayaz

Description

@sayaz

Hello,

Using Digi Xbee3 mesh devices (on firmware 802.15.4, 200D). Once as Coordinator (transmitter) other as End device (receiver) (API mode w/o escapes). The transmit and receive of data is working fine. I want to extract the "Transmit Status" of the frame from the transmitter side basically for acknowledgement purpose. Unfortunately I am unable to see/recover the "Transmit Status". The only thing that I can get is the payload part. On the other hand if I use the debugging option, I am able to see, the "Transmit option" is being received (in HEX format, which I can interpret from XCTU tool). How can I extract this information in Python ? Can you please help ? Code as below:

Coordinator code:

import xbee
from digi.xbee.devices import XBeeDevice, RemoteXBeeDevice, XBee64BitAddress
import time
from datetime import datetime
import logging

PORT = "/dev/tty.usbserial-AB0OO9Y6"
BAUD_RATE = 115200

logging.basicConfig(
    format='[%(asctime)s,%(msecs)06d] - %(levelname)s : %(lineno)d - %(message)s',
    level=logging.DEBUG,
    datefmt='%m-%d-%Y %I:%M:%S'  # Exclude milliseconds from the datefmt
)

localDevice = XBeeDevice(PORT, BAUD_RATE)
localDevice.open(force_settings = True)


remoteDevice = RemoteXBeeDevice(localDevice, XBee64BitAddress.from_hex_string("0013A200420108F2"))

localDevice.send_data(remoteDevice, "Hello")

while True:
    received_msg = localDevice.read_data()
    if received_msg:
        print("Data received (before decoding) : ", received_msg )
        print("Decoded data : ", received_msg.data.decode())

End device code

from digi.xbee.devices import XBeeDevice, RemoteXBeeDevice, XBee64BitAddress, Raw802Device, RemoteRaw802Device
from datetime import datetime
import time

PORT = "/dev/tty.usbserial-AB0OPD7U"
BAUD_RATE = 115200

device = XBeeDevice(PORT, BAUD_RATE)
device.open()
coordinator_mac = XBee64BitAddress.from_hex_string("0013A20042015449")

# Define the callback.
def my_data_received_callback(xbee_message):
	address = xbee_message.remote_device.get_64bit_addr()
	data = xbee_message.data.decode("utf8")
	print("Received data from %s: %s" % (address, data))


# Add the callback.
device.add_data_received_callback(my_data_received_callback)
input()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions