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.
LoRaWANInterface.cpp
00001 /** 00002 * @file 00003 * 00004 * @brief Implementation of LoRaWANBase 00005 * 00006 * Copyright (c) 2017, Arm Limited and affiliates. 00007 * SPDX-License-Identifier: Apache-2.0 00008 * 00009 * Licensed under the Apache License, Version 2.0 (the "License"); 00010 * you may not use this file except in compliance with the License. 00011 * You may obtain a copy of the License at 00012 * 00013 * http://www.apache.org/licenses/LICENSE-2.0 00014 * 00015 * Unless required by applicable law or agreed to in writing, software 00016 * distributed under the License is distributed on an "AS IS" BASIS, 00017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 * See the License for the specific language governing permissions and 00019 * limitations under the License. 00020 */ 00021 00022 #include "LoRaWANInterface.h" 00023 00024 using namespace events; 00025 00026 LoRaWANInterface::LoRaWANInterface(LoRaRadio& radio) 00027 { 00028 _lw_stack.bind_radio_driver(radio); 00029 } 00030 00031 LoRaWANInterface::~LoRaWANInterface() 00032 { 00033 } 00034 00035 lorawan_status_t LoRaWANInterface::initialize(EventQueue *queue) 00036 { 00037 Lock lock(*this); 00038 return _lw_stack.initialize_mac_layer(queue); 00039 } 00040 00041 lorawan_status_t LoRaWANInterface::connect() 00042 { 00043 Lock lock(*this); 00044 return _lw_stack.connect(); 00045 } 00046 00047 lorawan_status_t LoRaWANInterface::connect(const lorawan_connect_t &connect) 00048 { 00049 Lock lock(*this); 00050 return _lw_stack.connect(connect); 00051 } 00052 00053 lorawan_status_t LoRaWANInterface::disconnect() 00054 { 00055 Lock lock(*this); 00056 return _lw_stack.shutdown(); 00057 } 00058 00059 lorawan_status_t LoRaWANInterface::add_link_check_request() 00060 { 00061 Lock lock(*this); 00062 return _lw_stack.set_link_check_request(); 00063 } 00064 00065 void LoRaWANInterface::remove_link_check_request() 00066 { 00067 Lock lock(*this); 00068 _lw_stack.remove_link_check_request(); 00069 } 00070 00071 lorawan_status_t LoRaWANInterface::set_datarate(uint8_t data_rate) 00072 { 00073 Lock lock(*this); 00074 return _lw_stack.set_channel_data_rate(data_rate); 00075 } 00076 00077 lorawan_status_t LoRaWANInterface::set_confirmed_msg_retries(uint8_t count) 00078 { 00079 Lock lock(*this); 00080 return _lw_stack.set_confirmed_msg_retry(count); 00081 } 00082 00083 lorawan_status_t LoRaWANInterface::enable_adaptive_datarate() 00084 { 00085 Lock lock(*this); 00086 return _lw_stack.enable_adaptive_datarate(true); 00087 } 00088 00089 lorawan_status_t LoRaWANInterface::disable_adaptive_datarate() 00090 { 00091 Lock lock(*this); 00092 return _lw_stack.enable_adaptive_datarate(false); 00093 } 00094 00095 lorawan_status_t LoRaWANInterface::set_channel_plan(const lorawan_channelplan_t &channel_plan) 00096 { 00097 Lock lock(*this); 00098 return _lw_stack.add_channels(channel_plan); 00099 } 00100 00101 lorawan_status_t LoRaWANInterface::get_channel_plan(lorawan_channelplan_t &channel_plan) 00102 { 00103 Lock lock(*this); 00104 return _lw_stack.get_enabled_channels(channel_plan); 00105 } 00106 00107 lorawan_status_t LoRaWANInterface::remove_channel(uint8_t id) 00108 { 00109 Lock lock(*this); 00110 return _lw_stack.remove_a_channel(id); 00111 } 00112 00113 lorawan_status_t LoRaWANInterface::remove_channel_plan() 00114 { 00115 Lock lock(*this); 00116 return _lw_stack.drop_channel_list(); 00117 } 00118 00119 int16_t LoRaWANInterface::send(uint8_t port, const uint8_t* data, uint16_t length, int flags) 00120 { 00121 Lock lock(*this); 00122 return _lw_stack.handle_tx(port, data, length, flags); 00123 } 00124 00125 int16_t LoRaWANInterface::receive(uint8_t port, uint8_t* data, uint16_t length, int flags) 00126 { 00127 Lock lock(*this); 00128 return _lw_stack.handle_rx(data, length, port, flags, true); 00129 } 00130 00131 int16_t LoRaWANInterface::receive(uint8_t* data, uint16_t length, uint8_t& port, int& flags) 00132 { 00133 Lock lock(*this); 00134 return _lw_stack.handle_rx(data, length, port, flags, false); 00135 } 00136 00137 lorawan_status_t LoRaWANInterface::add_app_callbacks(lorawan_app_callbacks_t *callbacks) 00138 { 00139 Lock lock(*this); 00140 return _lw_stack.set_lora_callbacks(callbacks); 00141 } 00142 00143 lorawan_status_t LoRaWANInterface::set_device_class(const device_class_t device_class) 00144 { 00145 Lock lock(*this); 00146 return _lw_stack.set_device_class(device_class); 00147 }
Generated on Tue Jul 12 2022 12:32:32 by
