How to extract Device Address from Payload ?
-
Hi everyone !
I need to know how to extract the device address from the payload ?
data = s.recv(64)
I use this one to receive data. Once the data is received, I have to extract the packet. Once extracting, I have to check with my list.
Sorry for posting this again, I am just confused with this.
Thank you in Advance. -
@harish-kumar As far as I understand the LoRa Spec, the Dev address is contained in the first four bytes of the payload. You may extract it from there and use it for comparison. Depending on how your reference list is formatted, you may have to convert it, eg. with ubinascii.bin2hex().
-
@robert-hh you mean like once I get the data, I have to convert it and I have to compare ?
Is ubinascii.bin2hex() for extracting from payload ?If not, what is the command for extracting ? -
@harish-kumar it should be hexlify(). I just try to verify my post.
-
@harish-kumar Actually it is the second to fifth byte in big endian format. So if you receive data from the socket, e.g.:
rx_data = lora_sock.recv(256) dev_addr = rx_data[1:5] print("Dev-Addr: ", ubinascii.hexlify(dev_addr)) -
@robert-hh Thank you so much ! I got the output.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login