Skip to content

Commit

Permalink
Add the DevEui and the JoinEui to the MIB
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Jaeckle authored and mluis1 committed Jul 8, 2019
1 parent 71740b8 commit 4fe2b72
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 35 deletions.
26 changes: 26 additions & 0 deletions src/mac/LoRaMac.c
Original file line number Diff line number Diff line change
Expand Up @@ -3422,6 +3422,16 @@ LoRaMacStatus_t LoRaMacMibGetRequestConfirm( MibRequestConfirm_t* mibGet )
mibGet->Param.NetworkActivation = MacCtx.NvmCtx->NetworkActivation;
break;
}
case MIB_DEV_EUI:
{
mibGet->Param.DevEui = SecureElementGetDevEui( );
break;
}
case MIB_JOIN_EUI:
{
mibGet->Param.JoinEui = SecureElementGetJoinEui( );
break;
}
case MIB_ADR:
{
mibGet->Param.AdrEnable = MacCtx.NvmCtx->AdrCtrlOn;
Expand Down Expand Up @@ -3609,6 +3619,22 @@ LoRaMacStatus_t LoRaMacMibSetRequestConfirm( MibRequestConfirm_t* mibSet )
}
break;
}
case MIB_DEV_EUI:
{
if( SecureElementSetDevEui( mibSet->Param.DevEui ) != SECURE_ELEMENT_SUCCESS )
{
status = LORAMAC_STATUS_PARAMETER_INVALID;
}
break;
}
case MIB_JOIN_EUI:
{
if( SecureElementSetJoinEui( mibSet->Param.JoinEui ) != SECURE_ELEMENT_SUCCESS )
{
status = LORAMAC_STATUS_PARAMETER_INVALID;
}
break;
}
case MIB_ADR:
{
MacCtx.NvmCtx->AdrCtrlOn = mibSet->Param.AdrEnable;
Expand Down
67 changes: 32 additions & 35 deletions src/mac/LoRaMac.h
Original file line number Diff line number Diff line change
Expand Up @@ -985,18 +985,6 @@ typedef enum eMlme
*/
typedef struct sMlmeReqJoin
{
/*!
* Globally unique end-device identifier
*
* LoRaWAN Specification V1.1.0, chapter 6.1.1.2
*/
uint8_t* DevEui;
/*!
* Join Sever identifier
*
* LoRaWAN Specification V1.1.0, chapter 6.1.1.1
*/
uint8_t* JoinEui;
/*!
* Datarate used for join request.
*/
Expand Down Expand Up @@ -1168,6 +1156,8 @@ typedef struct sMlmeIndication
* ----------------------------------------------| :-: | :-:
* \ref MIB_DEVICE_CLASS | YES | YES
* \ref MIB_NETWORK_ACTIVATION | YES | YES
* \ref MIB_DEV_EUI | YES | YES
* \ref MIB_JOIN_EUI | YES | YES
* \ref MIB_ADR | YES | YES
* \ref MIB_NET_ID | YES | YES
* \ref MIB_DEV_ADDR | YES | YES
Expand Down Expand Up @@ -1253,6 +1243,18 @@ typedef enum eMib
* LoRaWAN Specification V1.0.2
*/
MIB_NETWORK_ACTIVATION,
/*!
* LoRaWAN device EUI
*
* LoRaWAN Specification V1.0.2
*/
MIB_DEV_EUI,
/*!
* LoRaWAN join EUI
*
* LoRaWAN Specification V1.0.2
*/
MIB_JOIN_EUI,
/*!
* Adaptive data rate
*
Expand Down Expand Up @@ -1549,7 +1551,7 @@ typedef enum eMib
* The antenna gain is used to calculate the TX power of the node.
* The formula is:
* radioTxPower = ( int8_t )floor( maxEirp - antennaGain )
*
*
* \remark The antenna gain value is referenced to the isotropic antenna.
* The value is in dBi.
* MIB_ANTENNA_GAIN[dBi] = measuredAntennaGain[dBd] + 2.15
Expand All @@ -1560,7 +1562,7 @@ typedef enum eMib
* The antenna gain is used to calculate the TX power of the node.
* The formula is:
* radioTxPower = ( int8_t )floor( maxEirp - antennaGain )
*
*
* \remark The antenna gain value is referenced to the isotropic antenna.
* The value is in dBi.
* MIB_DEFAULT_ANTENNA_GAIN[dBi] = measuredAntennaGain[dBd] + 2.15
Expand Down Expand Up @@ -1651,6 +1653,18 @@ typedef union uMibParam
* Related MIB type: \ref MIB_NETWORK_ACTIVATION
*/
ActivationType_t NetworkActivation;
/*!
* LoRaWAN device class
*
* Related MIB type: \ref MIB_DEV_EUI
*/
uint8_t* DevEui;
/*!
* LoRaWAN device class
*
* Related MIB type: \ref MIB_JOIN_EUI
*/
uint8_t* JoinEui;
/*!
* Activation state of ADR
*
Expand Down Expand Up @@ -2567,32 +2581,15 @@ LoRaMacStatus_t LoRaMacMibSetRequestConfirm( MibRequestConfirm_t* mibSet );
*
* \details The Mac layer management entity handles management services. The
* following code-snippet shows how to use the API to perform a
* network join request.
* network join request. Please note that for a join request, the
* DevEUI and the JoinEUI must be set previously via the MIB. Please
* also refer to the sample implementations.
*
* \code
* static uint8_t DevEui[] =
* {
* 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
* };
* static uint8_t JoinEui[] =
* {
* 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
* };
* static uint8_t NwkKey[] =
* {
* 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
* 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
* };
* static uint8_t AppKey[] =
* {
* 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
* 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
* };
*
* MlmeReq_t mlmeReq;
* mlmeReq.Type = MLME_JOIN;
* mlmeReq.Req.Join.DevEui = DevEui;
* mlmeReq.Req.Join.JoinEui = JoinEui;
* mlmeReq.Req.Join.Datarate = LORAWAN_DEFAULT_DATARATE;
*
* if( LoRaMacMlmeRequest( &mlmeReq ) == LORAMAC_STATUS_OK )
* {
Expand Down

0 comments on commit 4fe2b72

Please sign in to comment.