#pragma once #include #include #include #include #include #define LORA_SCK 5 #define LORA_MISO 19 #define LORA_MOSI 27 #define LORA_NSS 18 #define LORA_RST 23 #define LORA_DIO0 26 #define LORA_DIO1 33 class LoRaTransmitter : public ITransmitter { public: LoRaTransmitter( uint64_t joinEUI, uint64_t devEUI, uint8_t* nwkKey, uint8_t* appKey ); void init() override; void join() override; void send(uint8_t* payload, size_t size) override; private: uint64_t _joinEUI; uint64_t _devEUI; uint8_t _nwkKey[16]; uint8_t _appKey[16]; SX1276 _radio; LoRaWANNode _node; Preferences _prefs; uint8_t _noncesBuffer[RADIOLIB_LORAWAN_NONCES_BUF_SIZE]; void _reset(); void _restoreDevNonce(); void _persistDevNonce(); int16_t _restoreSession(); void _saveSession(); int16_t _fullJoin(); };