encryption - How to decrypt the received data from serial to USB using python? -
when send message zigbee connected pc zigbee connected raspberry pi board.we getting message,similarly had sent zigbee connected pc example:* hello world *,but in receiver section getting hello world encrypted data (with header bit , check-sum bit) need hello world in receiver terminal in receiver terminal zigbee connected raspberry pi interfacing ,i using serial usb cable. here simple python code serial usb
import serial time import sleep ser = serial.serial('/dev/ttyusb0', 9600, rtscts=1, timeout=0) while true: line = ser.read(ser.inwaiting()) if len(line) > 0: print line sleep(1) ser.close()
i getting type of results ,do help
pi@raspberrypi ~/iot/xbeeapi/python $ python temperlm.py ~#�}3�@ȶ���#hello world�~#�}3�@ȶ���####��~#�}3�@ȶ���#hello world� ~#�}3�@ȶ���#hello world� ~#�}3�@ȶ���#hello world�~#�}3�@ȶ���#hello world� ~#�}3�@ȶ���#hello world�~#�}3�@ȶ���#hello world� ~#�}3�@ȶ���#hello world�~#�}3�@ȶ���#hello world� ~#�}3�@ȶ���#hello world�~#�}3�@ȶ���#hello world� ~#�}3�@ȶ���#hello world�~#�}3�@ȶ���#hello world� ~#�}3�@ȶ���#hello world�~#�}3�@ȶ���#hello world� ^ctraceback (most recent call last): file "temperlm.py", line 9, in <module> sleep(1) keyboardinterrupt
you have xbee modules configured "api mode", uses formatted packets of data instead of "transparent serial mode" passes serial data straight through. simple applications or serial cable replacement, transparent serial mode great. once start doing more xbee module (like sending @ commands , communication multiple devices on network), typically switch api mode.
look @ atap
setting on module -- 0
transparent serial, 1
api mode , 2
"escaped api mode" characters escaped allow easier detection of start of frame.
be sure read xbee documentation modes gain better understanding of differences , pros/cons of each.
Comments
Post a Comment