tinytronix/LoRa

Question about sending broadcast messages

fmc5046 opened this issue · 1 comments

Hi really cool project! I had a question about sending messages to other nodes, is there a way to broadcast messages to all nodes and not expect or wait for a reply? I'm working on a project where I'd like to both broadcast to all nearby nodes and also send messages directly to a node and wait for the acknowledgement to ensure the message was delivered successfully. Thanks.

Not waiting for reply for sending broadcasts needs some modification in the code.

The fast hack is:

1st:
copy function LoraGateway::Send to LoraGateway::SendWithoutReply and modify
currTransaction.nRepeat = 3;
to
currTransaction.nRepeat = 0;

2nd:
Give each node private device ids and callbacks as required AND:
Give each node the same common broadcast device id (any id will do as long as it is the same in each node):
lora.RegisterCallback(0xffffffff, //Lora node ID
LORA_ACTOR_REQ, //Lora command id
(void*)onLORA_Broadcast);//callback function for command LORA_ACTOR_REQ

3rd:
in the callback function onLORA_Broadcast do not send a confirmation

4th:
DONE!

The smarter way would be:

create a new define
#define LORA_STATUS_DONT_REPLY 8
in the above mentioned new function LoraGateway::SendWithoutReply set
currTransaction.nRepeat = 0;
and set
currTransaction.loraFrameTx.head.status = LORA_STATUS_DONT_REPLY;
Then in the node implementation create a function which returns the current dataFrame.head.status which then will
reflect LORA_STATUS_DONT_REPLY.

The advantage of this solution: Reply or not reply does not depend on a specific node id. The gateway can decide for
each transmission if it wants a reply or not.

A common broadcast device id for each node is needed for both solutions.