From 591bc7da1f21d20d0c6daf0330da8de02926a3d5 Mon Sep 17 00:00:00 2001 From: Kimmo Vaisanen Date: Fri, 16 Feb 2018 15:37:44 +0200 Subject: [PATCH] Add the possibility to set the default antenna gain. --- features/lorawan/lorastack/mac/LoRaMacMib.cpp | 10 ++++++++++ .../lorawan/system/lorawan_data_structures.h | 16 +++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/features/lorawan/lorastack/mac/LoRaMacMib.cpp b/features/lorawan/lorastack/mac/LoRaMacMib.cpp index b80ddcf2d4..98bda6471d 100644 --- a/features/lorawan/lorastack/mac/LoRaMacMib.cpp +++ b/features/lorawan/lorastack/mac/LoRaMacMib.cpp @@ -241,6 +241,11 @@ lorawan_status_t LoRaMacMib::set_request(loramac_mib_req_confirm_t *mibSet, params->sys_params.antenna_gain = mibSet->param.antenna_gain; break; } + case MIB_DEFAULT_ANTENNA_GAIN: + { + params->sys_params.antenna_gain = mibSet->param.default_antenna_gain; + break; + } default: status = LORAWAN_STATUS_SERVICE_UNKNOWN; break; @@ -414,6 +419,11 @@ lorawan_status_t LoRaMacMib::get_request(loramac_mib_req_confirm_t *mibGet, mibGet->param.antenna_gain = params->sys_params.antenna_gain; break; } + case MIB_DEFAULT_ANTENNA_GAIN: + { + mibGet->param.default_antenna_gain = params->sys_params.antenna_gain; + break; + } default: status = LORAWAN_STATUS_SERVICE_UNKNOWN; break; diff --git a/features/lorawan/system/lorawan_data_structures.h b/features/lorawan/system/lorawan_data_structures.h index 4dfc9ebf65..af43aba4d3 100644 --- a/features/lorawan/system/lorawan_data_structures.h +++ b/features/lorawan/system/lorawan_data_structures.h @@ -1127,6 +1127,7 @@ typedef struct { * \ref MIB_SYSTEM_MAX_RX_ERROR | YES | YES * \ref MIB_MIN_RX_SYMBOLS | YES | YES * \ref MIB_ANTENNA_GAIN | YES | YES + * \ref MIB_DEFAULT_ANTENNA_GAIN | YES | YES * * The following table provides links to the function implementations of the * related MIB primitives: @@ -1332,7 +1333,14 @@ typedef enum { * The formula is: * radioTxPower = ( int8_t )floor( maxEirp - antennaGain ) */ - MIB_ANTENNA_GAIN + MIB_ANTENNA_GAIN, + /*! + * Default antenna gain of the node. Default value is region specific. + * The antenna gain is used to calculate the TX power of the node. + * The formula is: + * radioTxPower = ( int8_t )floor( maxEirp - antennaGain ) + */ + MIB_DEFAULT_ANTENNA_GAIN } mib_type_t; /*! @@ -1519,6 +1527,12 @@ typedef union { * Related MIB type: \ref MIB_ANTENNA_GAIN */ float antenna_gain; + /*! + * Default antenna gain + * + * Related MIB type: \ref MIB_DEFAULT_ANTENNA_GAIN + */ + float default_antenna_gain; } mib_params_t; /*!