Skip to content

Commit

Permalink
Add support for event subtypes to cert callback
Browse files Browse the repository at this point in the history
The certification MLME callback is invoked at the end of the
transmission started by either AT$CW or AT$CW. This change makes it
possible to emit a different event subtype in each function.
  • Loading branch information
janakj committed Jul 24, 2022
1 parent bf5475f commit 8be3dcf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lrw.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define MAX_BAT 254


unsigned int lrw_event_subtype;
static McpsConfirm_t tx_params;
static int joins_left = 0;
static TimerEvent_t join_retry_timer;
Expand Down Expand Up @@ -524,10 +525,10 @@ static void join_callback(MlmeConfirm_t *param)
}


static void cw_callback(MlmeConfirm_t *param)
static void cert_callback(MlmeConfirm_t *param)
{
if (param->Status == LORAMAC_EVENT_INFO_STATUS_TX_TIMEOUT) {
cmd_event(CMD_EVENT_CW, CMD_CW_END);
cmd_event(CMD_EVENT_CERT, lrw_event_subtype);
}
}

Expand All @@ -547,7 +548,7 @@ static void mlme_confirm(MlmeConfirm_t *param)
break;

case MLME_TXCW:
cw_callback(param);
cert_callback(param);
break;

default:
Expand Down
3 changes: 3 additions & 0 deletions src/lrw.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ typedef struct
} lrw_channel_list_t;


extern unsigned int lrw_event_subtype;


/** @brief Initialize the LoRaMac stack
*
* If previously-saved state is found in NVM, the state will be restored and
Expand Down

0 comments on commit 8be3dcf

Please sign in to comment.