SRK Version of mDot LoRa_Sensormode_SRK
Dependencies: libmDot mbed-rtos mbed
Fork of mDot_LoRa_Sensornode by
Diff: app/LoRaConfig.h
- Revision:
- 1:fe242f3e341b
- Parent:
- 0:f2815503561f
- Child:
- 4:135e5ebdf555
--- a/app/LoRaConfig.h Wed Jul 06 20:40:36 2016 +0000 +++ b/app/LoRaConfig.h Fri Aug 12 11:19:14 2016 +0000 @@ -8,11 +8,12 @@ #include <string> #include <stdint.h> +#include <vector> #ifndef LORACONFIG_H_ #define LORACONFIG_H_ -#define LORA_NETWORK_NAME "conduitgwy" -#define LORA_NETWORK_PASSPHRASE "conduitgwy" +#define LORA_NETWORK_NAME "conduitgwy" +#define LORA_NETWORK_PASSPHRASE "conduitgwy" #define LORA_SUBBAND_0 0 #define LORA_SUBBAND_1 1 @@ -54,6 +55,18 @@ }; /** + * Join Modes for LoRa + */ +enum JOIN_MODE{ + OTA = 0,//!< OTTA + ABP = 1 //!< ABP +}; + +static uint8_t LORA_APP_EUI[] = {0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88}; +static uint8_t LORA_APP_KEY[] = {0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff,0x00}; +static uint8_t LORA_DEVICE_EUI[] = {0x00,0x80,0x00,0x00,0x00,0x00,0xff,0xff}; + +/** * @class LoRaConfig * @brief A configuration container for the LoRa Module. * All its configuration values are stored an held inside @@ -99,6 +112,30 @@ std::string getNetworkPassphrase(); /** + * @brief Gets the Network Address. Only used when using ABP JoinMode + * @return + */ + std::string getNetworkAddress(); + + /** + * @brief Gets the App EUI + * @return + */ + std::vector<uint8_t> getAppEUI(); + + /** + * @brief Gets the App Key + * @return + */ + std::vector<uint8_t> getAppKey(); + + /** + * @brief Gets the Device EUI + * @return + */ + std::vector<uint8_t> getDeviceEUI(); + + /** * @brief Gets the frequency SubBand that will be used by the LoRa Module to * send and receive its data from its Configuration * @return @@ -132,10 +169,21 @@ */ LORA_MODE getLORA_MODE(); + /** + * @brief Gets the Actual JOIN_MODE of the built LoRaConfiguration + * form its Configuration + * @return + */ + JOIN_MODE getJOIN_MODE(); + private: std::string* networkName; std::string* networkPassphrase; + std::string* networkAddress; + std::vector<uint8_t>* appEUI; + std::vector<uint8_t>* appKey; + std::vector<uint8_t>* deviceEUI; bool publicity; bool activity; uint8_t frequencySubBand; @@ -144,6 +192,7 @@ uint8_t acknowledgeRetries; LORA_MODE loraMode; + JOIN_MODE joinMode; /** @@ -171,6 +220,31 @@ void setNetworkPassphrase(char* networkPassphrase); /** + * @brief Sets the Networkaddress of the Network that will be used in the Configuration + * @param networkAddress + */ + void setNetworkAddress(char* networkAddress); + + /** + * @brief Sets the APP EUI for OTAA + * @param appEUI + */ + void setAppEUI(); + + /** + * @brief Sets the APP Key for OTAA + * @param appKey + */ + void setAppKey(); + + /** + * @brief Sets the device EUI for OTAA + * @param deviceEUI + */ + void setDeviceEUI(); + + + /** * @brief Sets the SubBand that will be used in by the LoRa Module in the Configuration * @param subBand the SubBand that will be used */ @@ -200,6 +274,12 @@ */ void setLORA_MODE(LORA_MODE); + /** + * @brief Sets the Join Mode to a Network + * @param + */ + void setJOIN_MODE(JOIN_MODE); + }; #endif /* LORACONFIG_H_ */