-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implement McpsRetransmit primitive to notify the application of uplink retransmissions #1295
base: master
Are you sure you want to change the base?
Conversation
Thanks for the proposition. I think that we should provide this information using To the Click to expand!
/*!
* LoRaMAC MCPS-Indication primitive
*/
typedef struct sMcpsIndication
{
/*!
* MCPS-Indication type
*/
Mcps_t McpsIndication;
/*!
* Status of the operation
*/
LoRaMacEventInfoStatus_t Status;
/*!
* Multicast
*/
uint8_t Multicast;
/*!
* Application port
*/
uint8_t Port;
/*!
* Downlink datarate
*/
uint8_t RxDatarate;
/*!
* Frame pending status
*/
uint8_t IsUplinkTxPending;
/*!
* Indicate if the uplink was a re-transmission
*/
bool IsUplinkTxRetransmit;
/*!
* Pointer to the received data stream
*/
uint8_t* Buffer;
/*!
* Size of the received data stream
*/
uint8_t BufferSize;
/*!
* Indicates, if data is available
*/
bool RxData;
/*!
* Rssi of the received packet
*/
int16_t Rssi;
/*!
* Snr of the received packet
*/
int8_t Snr;
/*!
* Receive window
*/
LoRaMacRxSlot_t RxSlot;
/*!
* Set if an acknowledgement was received
*/
bool AckReceived;
/*!
* The downlink counter value for the received frame
*/
uint32_t DownLinkCounter;
/*!
* The device address of the frame
*/
uint32_t DevAddress;
/*!
* Set if a DeviceTimeAns MAC command was received.
*/
bool DeviceTimeAnsReceived;
/*!
* Response timeout for a class b or c device when a
* confirmed downlink has been received. In all other
* cases this variable is 0.
*/
TimerTime_t ResponseTimeout;
}McpsIndication_t; @djaeckle what do you think? |
Hi @mluis1, |
@janakj I forgot to provide an answer here. Sorry. Yes, please. |
Hi @mluis1, so I was looking into this and I am wondering if invoking the McpsIndication primitive for uplink retransmissions is the right thing to do. When I look at the documentation and the various fields in Do we really want to overload the McpsIndication primitive for uplink retransmission notifications? Conceptually, this might be hard to understand for application developers if they assume that McpsIndication is invoked whenever something has arrived from the network. It may also break existing applications. Every application using the McpsIndication primitive would need to be updated to check IsUplinkTxRetransmit flag in the callback function. Without the update, the callback might erroneously assume that it's being called for a downlink, while it is in fact being notified of an uplink retransmission. What do you think? |
Hi @janakj Thanks for the feedback. With @djaeckle we have discussed you proposition and we would like to avoid adding a new callback as originally proposed. As we would like to keep the MAC layer handling as close as possible to the original specification LoRaMac-node-doc-v4.6.0 We would like to propose instead to use Reporting the re-transmissions states/events fall under the Therefore our proposition would be to add a Would you be OK with this compromise? diff --git a/src/mac/LoRaMac.h b/src/mac/LoRaMac.h
index de52e9a2..4a0684c4 100644
--- a/src/mac/LoRaMac.h
+++ b/src/mac/LoRaMac.h
@@ -1096,6 +1096,7 @@ typedef struct sMcpsIndication
* \ref MLME_DERIVE_MC_KE_KEY | YES | NO | NO | YES
* \ref MLME_DERIVE_MC_KEY_PAIR | YES | NO | NO | YES
* \ref MLME_REVERT_JOIN | NO | YES | NO | NO
+ * \ref MLME_RETRANSMISSION | NO | YES | NO | NO
*
* The following table provides links to the function implementations of the
* related MLME primitives.
@@ -1203,6 +1204,10 @@ typedef enum eMlme
* \remark The upper layer is required to trigger the Join process again.
*/
MLME_REVERT_JOIN,
+ /*!
+ * Indicates that an uplink retransmission has been executed
+ */
+ MLME_RETRANSMISSION,
}Mlme_t;
/*!
@@ -1366,6 +1371,7 @@ typedef struct sMlmeConfirm
/*!
* LoRaMAC MLME-Indication primitive
*/
+// TODO: In future major release use an union around the indication parameters \ref BeaconInfo and \ref NbTransCounter.
typedef struct sMlmeIndication
{
/*!
@@ -1381,6 +1387,11 @@ typedef struct sMlmeIndication
* status \ref LORAMAC_EVENT_INFO_STATUS_BEACON_LOCKED
*/
BeaconInfo_t BeaconInfo;
+ /*!
+ * Provides the current number of retransmissions that have been executed
+ * Only valid for \ref MLME_RETRANSMISSION
+ */
+ uint8_t NbTransCounter;
}MlmeIndication_t;
/*!
|
Hi @mluis1, I like this idea! Conceptually, I think it fits nicely with all the other uses of MlmeIndication. I will update the PR. Thanks. |
The primitive will be invoked whenever the LoRaMac-node library retransmits an uplink message. This could be used by the application to get notified of uplink retransmissions.
I am working on an application that needs to be notified of uplink retransmissions. Since I haven't found a way to obtain retransmission notifications from vanilla LoRaMac-node, I have created a new primitive called
McpsRetransmit
that is invoked by the MAC on each retransmission.This is a draft PR to solicit feedback from LoRaMac-node authors. If you would like to include such functionality in LoRaMac-node, please feel free to merge the PR, or let me know if you would like to have this implemented in some other way. I am not overly attached to the current implementation.