Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set DevEUI from userFields for data packet #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emanuele-dedonatis
Copy link

DevEUI is set from userFields only for join requests

@anthonykirby
Copy link
Owner

Hi @emanuele-dedonatis, thank you for the PR.

I'm puzzled about the use-case for the change: (Please be patient with me, as I can't remember all the details of the LoRA spec!)

As I understand it, DevEUI is used for a "join-request", and there's code to handle it already in _initialiseJoinRequestPacketFromFields (see LoraPacket.ts#L351-L362). This is called if the type is MType.JOIN_REQUEST or if all three of AppEUI, DevEUI & DevNonce are supplied.

However, the PR is passing in a DevEUI when creating a data packet, which I don't understand.

@emanuele-dedonatis
Copy link
Author

Hi @anthonykirby, you are right: the DevEUI is not used to build the packet in case mtype is not a JOIN_REQ.

But in my use case, I have a shared function to extract lora-packet info for every mtype. Thus, when it's not a JOIN_REQ, packet.DevEUI will be undefined even if I passed it at initialization time :(

@anthonykirby
Copy link
Owner

Sorry, I don't understand. If the packet is a JOIN_REQ then you wouldn't expect it to have a DevEUI. (It won't have an AppEUI or DevNonce either, but the PR isn't adding them as well 😁)

I'm concerned that if we allow properties that aren't valid for the current packet type, it would cause confusion for users. We currently allow only valid properties, and I think the validation is useful.

(Of course, it would have been possible to have all packet types allowing all properties - but that's an architecture decision that too late to change.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants