SEAN O CONNELL / Mbed 2 deprecated mDot_LoRa_Sensornode

Dependencies:   libmDot mbed-rtos mbed

Fork of mDot_LoRa_Sensornode by Adrian Mitevski

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LoRaConfig.h Source File

LoRaConfig.h

Go to the documentation of this file.
00001 /**
00002  * @file LoRaConfig.h
00003  *
00004  * @author Adrian
00005  * @date Jun 11, 2016
00006  *
00007  */
00008 
00009 #include <string>
00010 #include <stdint.h>
00011 #ifndef LORACONFIG_H_
00012 #define LORACONFIG_H_
00013 
00014 #define LORA_NETWORK_NAME               "conduitgwy"
00015 #define LORA_NETWORK_PASSPHRASE         "conduitgwy"
00016 
00017 #define LORA_SUBBAND_0                      0
00018 #define LORA_SUBBAND_1                      1
00019 #define LORA_SUBBAND_2                      2
00020 #define LORA_SUBBAND_3                      3
00021 #define LORA_SUBBAND_4                      4
00022 #define LORA_SUBBAND_5                      5
00023 #define LORA_SUBBAND_6                      6
00024 #define LORA_SUBBAND_7                      7
00025 #define LORA_SUBBAND_8                      8
00026 
00027 #define LORA_SPREADING_FACTOR_7             7
00028 #define LORA_SPREADING_FACTOR_8             8
00029 #define LORA_SPREADING_FACTOR_9             9
00030 #define LORA_SPREADING_FACTOR_10            10
00031 #define LORA_SPREADING_FACTOR_11            11
00032 #define LORA_SPREADING_FACTOR_12            12
00033 
00034 #define LORA_TX_POWER_2_DBM                 2
00035 #define LORA_TX_POWER_4_DBM                 4
00036 #define LORA_TX_POWER_8_DBM                 8
00037 #define LORA_TX_POWER_16_DBM                16
00038 #define LORA_TX_POWER_20_DBM                20
00039 
00040 #define LORA_ACKNOWLEDGE_RETRIES_0          0
00041 #define LORA_ACKNOWLEDGE_RETRIES_1          1
00042 #define LORA_ACKNOWLEDGE_RETRIES_2          2
00043 
00044 /**
00045  * LoRa Modes.
00046  */
00047 enum LORA_MODE{
00048     LORA_MODE_0_OFF = 0,//!< LORA_MODE_0
00049     LORA_MODE_1 = 1,//!< LORA_MODE_1
00050     LORA_MODE_2 = 2,//!< LORA_MODE_2
00051     LORA_MODE_3 = 3,//!< LORA_MODE_3
00052     LORA_MODE_4 = 4,//!< LORA_MODE_4
00053     LORA_MODE_5 = 5,//!< LORA_MODE_5
00054 };
00055 
00056 /**
00057  * @class LoRaConfig
00058  * @brief A configuration container for the LoRa Module.
00059  * All its configuration values are stored an held inside
00060  * this Class. Depending on the LORA_MODE it sets all the configuration values.
00061  */
00062 class LoRaConfig {
00063 public:
00064     LoRaConfig();
00065     virtual ~LoRaConfig();
00066 
00067     /**
00068      * @brief Generates a configuration according to the chosen LORA_MODE
00069      * by setting all LoRa Module specific configuration values depending on the chosen LORA_MODE
00070      * @param desiredMode the mode to build the configuration according to
00071      */
00072     void build(LORA_MODE desiredMode);
00073 
00074     /**
00075      * @brief Gets info if the Network to which the LoRa Module sings up
00076      * is public or not from its Configuration
00077      */
00078     bool isPublic();
00079 
00080     /**
00081      * @brief Gets info if LoRa Module will be active and run or not
00082      * from its Configuration
00083      * @return
00084      */
00085     bool isActiv();
00086 
00087     /**
00088      * @brief Gets the name of the Network to which the LoRa Module sings up
00089      * from its Configuration
00090      * @return
00091      */
00092     std::string getNetworkName();
00093 
00094     /**
00095      * @brief Gets the Passphrase of the Network to which the LoRa Module sings up
00096      * from its Configuration
00097      * @return
00098      */
00099     std::string getNetworkPassphrase();
00100 
00101     /**
00102      * @brief Gets the frequency SubBand that will be used by the LoRa Module to
00103      * send and receive its data from its Configuration
00104      * @return
00105      */
00106     uint8_t getFrequencySubBand();
00107 
00108     /**
00109      * @brief Gets the spreading Factor that the LoRa Module will us for data transmission
00110      * from its Configuration
00111      * @return
00112      */
00113     uint8_t getSpreadingFactor();
00114 
00115     /**
00116      * @brief Gets the transmission Power of the LoRa Module from its Configuration
00117      * @return
00118      */
00119     uint8_t getTxPowerdBm();
00120 
00121     /**
00122      * @brief Gets the number of Acknowledgment Retries that will be made
00123      * from its Configuration
00124      * @return
00125      */
00126     uint8_t getAcknowledgeRetries();
00127 
00128     /**
00129      * @brief Gets the Actual LORA_MODE of the built LoRaConfiguration
00130      * from its Configuration
00131      * @return
00132      */
00133     LORA_MODE getLORA_MODE();
00134 
00135 
00136 private:
00137     std::string* networkName;
00138     std::string* networkPassphrase;
00139     bool publicity;
00140     bool activity;
00141     uint8_t frequencySubBand;
00142     uint8_t spreadingFactor;
00143     uint8_t txPowerdBm;
00144     uint8_t acknowledgeRetries;
00145 
00146     LORA_MODE loraMode;
00147 
00148 
00149     /**
00150      * @brief Sets the Network publicity of the network that will be used in the Configuration
00151      * @param
00152      */
00153     void setNetworkPublicity(bool publicity);
00154 
00155     /**
00156      * @brief Sets the Activity of the LoRa module for the Configuration
00157      * @param activity true = module will be active false = module will not be active
00158      */
00159     void setActivity(bool activity);
00160 
00161     /**
00162      * @brief Sets the Name of the Network that will be used in the Configuration
00163      * @param networkName the name of the network
00164      */
00165     void setNetworkName(char* networkName);
00166 
00167     /**
00168      * @brief Sets the Passphrase of the Network that will be used in the Configuration
00169      * @param networkPassphrase passphrase of the Network
00170      */
00171     void setNetworkPassphrase(char* networkPassphrase);
00172 
00173     /**
00174      * @brief Sets the SubBand that will be used in by the LoRa Module in the Configuration
00175      * @param subBand the SubBand that will be used
00176      */
00177     void setFrequencySubBand(uint8_t subBand);
00178 
00179     /**
00180      * @brief Sets the spreading Factor of a LoRa Data Transmission in the Configuration
00181      * @param spreadingFactor
00182      */
00183     void setSpreadingFactor(uint8_t spreadingFactor);
00184 
00185     /**
00186      * @brief Sets the Data transmission Power via LoRa in the Configuration
00187      * @param
00188      */
00189     void setTxPowerdBm(uint8_t );
00190 
00191     /**
00192      * @brief Set the Acknowledgment Retries in the Configuration
00193      * @param
00194      */
00195     void setAcknowledgeRetries(uint8_t);
00196 
00197     /**
00198      * @brief Sets the LORA_MODE of the Configuration
00199      * @param
00200      */
00201     void setLORA_MODE(LORA_MODE);
00202 
00203 };
00204 
00205 #endif /* LORACONFIG_H_ */