xbee-python icon indicating copy to clipboard operation
xbee-python copied to clipboard

Feature Request: Add formal serialization/de-serialization to methods to data objects

Open dzimmanck opened this issue 4 years ago • 0 comments

The XBee data and metadata objects (messages, status, addresses, etc) are not natively JSON serializable, which slightly complicates integration of this library into a multi-agent control frameworks where agents communicate over a message brokers such as ZeroMQ, RabbitMQ, or Mosquitto, which require all messages JSON serializable. I find myself frequently building serializations for the XBee data classes.

Since the serialize/deserialize format must be compatible between sender and reeiver, it would be good if there are formal serialize/deserialize methods build into these objects to guarantee this compatibility. Something like:

msq = device.read(...) msq_json = msg.to_json() publish(msq_json) # some publish over a message broker

from digi.xbee.utils import read_json msg = read_json(msq_json)

dzimmanck avatar Dec 18 '19 18:12 dzimmanck