Skip to content

Commit 4fe2b72

Browse files
Daniel Jaecklemluis1
authored andcommitted
Add the DevEui and the JoinEui to the MIB
1 parent 71740b8 commit 4fe2b72

File tree

2 files changed

+58
-35
lines changed

2 files changed

+58
-35
lines changed

src/mac/LoRaMac.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3422,6 +3422,16 @@ LoRaMacStatus_t LoRaMacMibGetRequestConfirm( MibRequestConfirm_t* mibGet )
34223422
mibGet->Param.NetworkActivation = MacCtx.NvmCtx->NetworkActivation;
34233423
break;
34243424
}
3425+
case MIB_DEV_EUI:
3426+
{
3427+
mibGet->Param.DevEui = SecureElementGetDevEui( );
3428+
break;
3429+
}
3430+
case MIB_JOIN_EUI:
3431+
{
3432+
mibGet->Param.JoinEui = SecureElementGetJoinEui( );
3433+
break;
3434+
}
34253435
case MIB_ADR:
34263436
{
34273437
mibGet->Param.AdrEnable = MacCtx.NvmCtx->AdrCtrlOn;
@@ -3609,6 +3619,22 @@ LoRaMacStatus_t LoRaMacMibSetRequestConfirm( MibRequestConfirm_t* mibSet )
36093619
}
36103620
break;
36113621
}
3622+
case MIB_DEV_EUI:
3623+
{
3624+
if( SecureElementSetDevEui( mibSet->Param.DevEui ) != SECURE_ELEMENT_SUCCESS )
3625+
{
3626+
status = LORAMAC_STATUS_PARAMETER_INVALID;
3627+
}
3628+
break;
3629+
}
3630+
case MIB_JOIN_EUI:
3631+
{
3632+
if( SecureElementSetJoinEui( mibSet->Param.JoinEui ) != SECURE_ELEMENT_SUCCESS )
3633+
{
3634+
status = LORAMAC_STATUS_PARAMETER_INVALID;
3635+
}
3636+
break;
3637+
}
36123638
case MIB_ADR:
36133639
{
36143640
MacCtx.NvmCtx->AdrCtrlOn = mibSet->Param.AdrEnable;

src/mac/LoRaMac.h

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -985,18 +985,6 @@ typedef enum eMlme
985985
*/
986986
typedef struct sMlmeReqJoin
987987
{
988-
/*!
989-
* Globally unique end-device identifier
990-
*
991-
* LoRaWAN Specification V1.1.0, chapter 6.1.1.2
992-
*/
993-
uint8_t* DevEui;
994-
/*!
995-
* Join Sever identifier
996-
*
997-
* LoRaWAN Specification V1.1.0, chapter 6.1.1.1
998-
*/
999-
uint8_t* JoinEui;
1000988
/*!
1001989
* Datarate used for join request.
1002990
*/
@@ -1168,6 +1156,8 @@ typedef struct sMlmeIndication
11681156
* ----------------------------------------------| :-: | :-:
11691157
* \ref MIB_DEVICE_CLASS | YES | YES
11701158
* \ref MIB_NETWORK_ACTIVATION | YES | YES
1159+
* \ref MIB_DEV_EUI | YES | YES
1160+
* \ref MIB_JOIN_EUI | YES | YES
11711161
* \ref MIB_ADR | YES | YES
11721162
* \ref MIB_NET_ID | YES | YES
11731163
* \ref MIB_DEV_ADDR | YES | YES
@@ -1253,6 +1243,18 @@ typedef enum eMib
12531243
* LoRaWAN Specification V1.0.2
12541244
*/
12551245
MIB_NETWORK_ACTIVATION,
1246+
/*!
1247+
* LoRaWAN device EUI
1248+
*
1249+
* LoRaWAN Specification V1.0.2
1250+
*/
1251+
MIB_DEV_EUI,
1252+
/*!
1253+
* LoRaWAN join EUI
1254+
*
1255+
* LoRaWAN Specification V1.0.2
1256+
*/
1257+
MIB_JOIN_EUI,
12561258
/*!
12571259
* Adaptive data rate
12581260
*
@@ -1549,7 +1551,7 @@ typedef enum eMib
15491551
* The antenna gain is used to calculate the TX power of the node.
15501552
* The formula is:
15511553
* radioTxPower = ( int8_t )floor( maxEirp - antennaGain )
1552-
*
1554+
*
15531555
* \remark The antenna gain value is referenced to the isotropic antenna.
15541556
* The value is in dBi.
15551557
* MIB_ANTENNA_GAIN[dBi] = measuredAntennaGain[dBd] + 2.15
@@ -1560,7 +1562,7 @@ typedef enum eMib
15601562
* The antenna gain is used to calculate the TX power of the node.
15611563
* The formula is:
15621564
* radioTxPower = ( int8_t )floor( maxEirp - antennaGain )
1563-
*
1565+
*
15641566
* \remark The antenna gain value is referenced to the isotropic antenna.
15651567
* The value is in dBi.
15661568
* MIB_DEFAULT_ANTENNA_GAIN[dBi] = measuredAntennaGain[dBd] + 2.15
@@ -1651,6 +1653,18 @@ typedef union uMibParam
16511653
* Related MIB type: \ref MIB_NETWORK_ACTIVATION
16521654
*/
16531655
ActivationType_t NetworkActivation;
1656+
/*!
1657+
* LoRaWAN device class
1658+
*
1659+
* Related MIB type: \ref MIB_DEV_EUI
1660+
*/
1661+
uint8_t* DevEui;
1662+
/*!
1663+
* LoRaWAN device class
1664+
*
1665+
* Related MIB type: \ref MIB_JOIN_EUI
1666+
*/
1667+
uint8_t* JoinEui;
16541668
/*!
16551669
* Activation state of ADR
16561670
*
@@ -2567,32 +2581,15 @@ LoRaMacStatus_t LoRaMacMibSetRequestConfirm( MibRequestConfirm_t* mibSet );
25672581
*
25682582
* \details The Mac layer management entity handles management services. The
25692583
* following code-snippet shows how to use the API to perform a
2570-
* network join request.
2584+
* network join request. Please note that for a join request, the
2585+
* DevEUI and the JoinEUI must be set previously via the MIB. Please
2586+
* also refer to the sample implementations.
25712587
*
25722588
* \code
2573-
* static uint8_t DevEui[] =
2574-
* {
2575-
* 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2576-
* };
2577-
* static uint8_t JoinEui[] =
2578-
* {
2579-
* 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2580-
* };
2581-
* static uint8_t NwkKey[] =
2582-
* {
2583-
* 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
2584-
* 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
2585-
* };
2586-
* static uint8_t AppKey[] =
2587-
* {
2588-
* 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
2589-
* 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
2590-
* };
25912589
*
25922590
* MlmeReq_t mlmeReq;
25932591
* mlmeReq.Type = MLME_JOIN;
2594-
* mlmeReq.Req.Join.DevEui = DevEui;
2595-
* mlmeReq.Req.Join.JoinEui = JoinEui;
2592+
* mlmeReq.Req.Join.Datarate = LORAWAN_DEFAULT_DATARATE;
25962593
*
25972594
* if( LoRaMacMlmeRequest( &mlmeReq ) == LORAMAC_STATUS_OK )
25982595
* {

0 commit comments

Comments
 (0)