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
communication/LoRaWanComm.cpp
- Committer:
- AndersonIctus
- Date:
- 2019-06-28
- Revision:
- 8:e00fa6ea253c
- Parent:
- 7:8db3e62ac4e2
- Child:
- 10:d2ce206bd94e
File content as of revision 8:e00fa6ea253c:
#include "sgam_mdw.h"
#include "mbed.h"
#include "mbed_events.h"
#include "LoRaWANInterface.h"
#include "LoRAWanComm.h"
LoRAWanComm::LoRAWanComm(const char* parameters): ev_queue() { }
LoRAWanComm::~LoRAWanComm() { }
int LoRAWanComm::initialize(LoraData* data) {
D_LOG("INITIALIZE %s! \r\n", this->getName() );
// INICIANDO O LORAWAN !!
lorawan = new LoRaWANInterface(*data->radio);
// 1 - Initialize LoRaWAN stack
if (lorawan->initialize(&ev_queue) != LORAWAN_STATUS_OK) {
printf("LoRa initialization failed! \r\n");
return -1;
}
return 1;
}
int LoRAWanComm::finalize() {
D_LOG("FINALIZE %s! \r\n", this->getName() );
if(lorawan != NULL) delete lorawan;
return 1;
}
const char* LoRAWanComm::getName() {
return "LoRAWAN";
}
int LoRAWanComm::connect() {
return -1;
}
int LoRAWanComm::disconnect() {
return -1;
}
////////////////////////////////////////////////////////////////////////////////////
void LoRAWanComm::prepareCallBack( lorawan_app_callbacks_t &callbacks ) {
// prepare application callbacks
lorawan->add_app_callbacks(&callbacks);
}
void LoRAWanComm::lora_event_handler(lorawan_event_t event) {
}
////////////////////////////////////////////////////////////////////////////////////
int LoRAWanComm::write(const char* data) {
return 0;
}
int LoRAWanComm::read(char* buffer, int offset) {
return 0;
}