Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MPU6050 Grove_temperature
LoRaWanComm.h
00001 #ifndef SGAM_MDW_COMMUNICATION_LoRaWanComm_H 00002 #define SGAM_MDW_COMMUNICATION_LoRaWanComm_H 00003 00004 #include "sgam_mdw.h" 00005 #include "mbed.h" 00006 #include "mbed_events.h" 00007 #include "LoRaWANInterface.h" 00008 00009 // #include "helper/lora_radio_helper.h" 00010 // #include "helper/mbedtls_lora_config.h" 00011 00012 class LoraData { 00013 public: 00014 LoraData(lorawan_connect_t* connect_params, LoRaRadio* radio, EventQueue* ev_queue): 00015 connect_params(connect_params), radio(radio), ev_queue(ev_queue) { 00016 confirmed_msg_retries = 3; // padrão 00017 enable_adaptive_datarate = true; // padrao 00018 00019 callbacks = NULL; 00020 lora_port = 0; 00021 read_write_flags = 0; 00022 }; 00023 00024 void prepareCallBack(lorawan_app_callbacks_t &callbacks) { 00025 this->callbacks = &callbacks; 00026 } 00027 00028 lorawan_app_callbacks_t* getCallBack() { 00029 return callbacks; 00030 } 00031 00032 ////////////////////////////////////////////////////////////////////////////////// 00033 // 00034 LoRaRadio* radio; 00035 lorawan_connect_t* connect_params; 00036 00037 EventQueue* ev_queue; 00038 uint8_t confirmed_msg_retries; 00039 bool enable_adaptive_datarate; 00040 00041 // Flags para leitura !! 00042 uint8_t lora_port; 00043 int read_write_flags; 00044 00045 private: 00046 lorawan_app_callbacks_t* callbacks; 00047 }; 00048 00049 class LoRaWanComm: public Communication<LoraData> { 00050 public: 00051 LoRaWanComm(const char* parameters); 00052 virtual ~LoRaWanComm(); 00053 00054 virtual int initialize(LoraData* data); 00055 virtual int finalize(); 00056 00057 virtual int connect(); 00058 virtual int disconnect(); 00059 00060 virtual const char* getName(); 00061 virtual LoraData* getData(); 00062 00063 virtual int write(const unsigned char* buffer, int offset); 00064 virtual int read(unsigned char* buffer, int offset); 00065 00066 private: 00067 LoRaWANInterface* lorawan; 00068 LoraData* data; 00069 }; 00070 #endif
Generated on Fri Jul 15 2022 01:20:42 by
1.7.2