Home/Support/Support Forum/XBee3 Micropython: when using transmit, what is buffer protocol error when payload is dictionary type

XBee3 Micropython: when using transmit, what is buffer protocol error when payload is dictionary type

0 votes
Hello,

using my xbee3 micropython script I have successfully sent data to my coordinator from my router module using:
xbee.transmit(addr64, data)

now that works when the data is a bytearray type

when I attempt to send dictionary type via the same built-in:

xbee.transmit(addr64, data_dict)

I get this error:

Transmit failure: object with buffer protocol required


My question is what is the cause of this error (type of payload im assuming)

secondly, what does "object with buffer protocol required" mean really?


thank you,

:)
asked Aug 11 in MicroPython by edunn106 New to the Community (24 points)

Please log in or register to answer this question.

1 Answer

+2 votes
 
Best answer
Yes, a dictionary cannot be translated to bytes implicitly. An object with buffer protocol just means it can be implicitly translated to a payload of contiguous binary data.
Certain objects available in MicroPython and Python wrap access to an underlying memory array or buffer. Such objects include the built-in bytes and bytearray.
answered Aug 11 by DigiFan23 Veteran of the Digi Community (278 points)
selected Aug 13 by edunn106
...