BA / Mbed OS BaBoRo1
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LoRaMacMlme.cpp Source File

LoRaMacMlme.cpp

00001 /**
00002  / _____)             _              | |
00003 ( (____  _____ ____ _| |_ _____  ____| |__
00004  \____ \| ___ |    (_   _) ___ |/ ___)  _ \
00005  _____) ) ____| | | || |_| ____( (___| | | |
00006 (______/|_____)_|_|_| \__)_____)\____)_| |_|
00007     (C)2013 Semtech
00008  ___ _____ _   ___ _  _____ ___  ___  ___ ___
00009 / __|_   _/_\ / __| |/ / __/ _ \| _ \/ __| __|
00010 \__ \ | |/ _ \ (__| ' <| _| (_) |   / (__| _|
00011 |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
00012 embedded.connectivity.solutions===============
00013 
00014 Description: LoRaWAN stack layer that controls both MAC and PHY underneath
00015 
00016 License: Revised BSD License, see LICENSE.TXT file include in the project
00017 
00018 Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
00019 
00020 
00021 Copyright (c) 2017, Arm Limited and affiliates.
00022 
00023 SPDX-License-Identifier: BSD-3-Clause
00024 */
00025 
00026 #include "LoRaMac.h"
00027 #include "lorastack/mac/LoRaMacMlme.h"
00028 
00029 LoRaMacMlme::LoRaMacMlme()
00030 : _lora_phy(NULL)
00031 {
00032 }
00033 
00034 LoRaMacMlme::~LoRaMacMlme()
00035 {
00036 }
00037 
00038 void LoRaMacMlme::reset_confirmation()
00039 {
00040     memset((uint8_t*) &confirmation, 0, sizeof(confirmation));
00041 
00042     confirmation.status = LORAMAC_EVENT_INFO_STATUS_ERROR ;
00043 }
00044 
00045 loramac_mlme_confirm_t & LoRaMacMlme::get_confirmation()
00046 {
00047     return confirmation;
00048 }
00049 
00050 loramac_mlme_indication_t & LoRaMacMlme::get_indication()
00051 {
00052     return indication;
00053 }
00054 
00055 void LoRaMacMlme::activate_mlme_subsystem(LoRaPHY *phy)
00056 {
00057     _lora_phy = phy;
00058 }
00059 
00060 void LoRaMacMlme::set_tx_continuous_wave(uint8_t channel, int8_t datarate, int8_t tx_power,
00061                                          float max_eirp, float antenna_gain, uint16_t timeout)
00062 {
00063     cw_mode_params_t  continuous_wave;
00064 
00065     continuous_wave.channel  = channel;
00066     continuous_wave.datarate  = datarate;
00067     continuous_wave.tx_power  = tx_power;
00068     continuous_wave.max_eirp  = max_eirp;
00069     continuous_wave.antenna_gain  = antenna_gain;
00070     continuous_wave.timeout  = timeout;
00071 
00072     _lora_phy->set_tx_cont_mode(&continuous_wave);
00073 }