![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/UNITTESTS/stubs/LoRaMac_stub.cpp@0:8fdf9a60065b, 2018-10-10 (annotated)
- Committer:
- kadonotakashi
- Date:
- Wed Oct 10 00:33:53 2018 +0000
- Revision:
- 0:8fdf9a60065b
how to make mbed librry
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | /* |
kadonotakashi | 0:8fdf9a60065b | 2 | * Copyright (c) , Arm Limited and affiliates. |
kadonotakashi | 0:8fdf9a60065b | 3 | * SPDX-License-Identifier: Apache-2.0 |
kadonotakashi | 0:8fdf9a60065b | 4 | * |
kadonotakashi | 0:8fdf9a60065b | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kadonotakashi | 0:8fdf9a60065b | 6 | * you may not use this file except in compliance with the License. |
kadonotakashi | 0:8fdf9a60065b | 7 | * You may obtain a copy of the License at |
kadonotakashi | 0:8fdf9a60065b | 8 | * |
kadonotakashi | 0:8fdf9a60065b | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
kadonotakashi | 0:8fdf9a60065b | 10 | * |
kadonotakashi | 0:8fdf9a60065b | 11 | * Unless required by applicable law or agreed to in writing, software |
kadonotakashi | 0:8fdf9a60065b | 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
kadonotakashi | 0:8fdf9a60065b | 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kadonotakashi | 0:8fdf9a60065b | 14 | * See the License for the specific language governing permissions and |
kadonotakashi | 0:8fdf9a60065b | 15 | * limitations under the License. |
kadonotakashi | 0:8fdf9a60065b | 16 | */ |
kadonotakashi | 0:8fdf9a60065b | 17 | |
kadonotakashi | 0:8fdf9a60065b | 18 | #include <stdlib.h> |
kadonotakashi | 0:8fdf9a60065b | 19 | #include "LoRaMac.h" |
kadonotakashi | 0:8fdf9a60065b | 20 | #include "LoRaMac_stub.h" |
kadonotakashi | 0:8fdf9a60065b | 21 | |
kadonotakashi | 0:8fdf9a60065b | 22 | using namespace events; |
kadonotakashi | 0:8fdf9a60065b | 23 | using namespace mbed; |
kadonotakashi | 0:8fdf9a60065b | 24 | |
kadonotakashi | 0:8fdf9a60065b | 25 | int LoRaMac_stub::bool_false_counter = 0; |
kadonotakashi | 0:8fdf9a60065b | 26 | int LoRaMac_stub::bool_true_counter = 0; |
kadonotakashi | 0:8fdf9a60065b | 27 | bool LoRaMac_stub::bool_value = false; |
kadonotakashi | 0:8fdf9a60065b | 28 | int LoRaMac_stub::int_value = 0; |
kadonotakashi | 0:8fdf9a60065b | 29 | rx_slot_t LoRaMac_stub::slot_value = RX_SLOT_WIN_1; |
kadonotakashi | 0:8fdf9a60065b | 30 | lorawan_status_t LoRaMac_stub::status_value = LORAWAN_STATUS_OK; |
kadonotakashi | 0:8fdf9a60065b | 31 | loramac_mcps_confirm_t *LoRaMac_stub::mcps_conf_ptr = NULL; |
kadonotakashi | 0:8fdf9a60065b | 32 | loramac_mcps_indication_t *LoRaMac_stub::mcps_ind_ptr = NULL; |
kadonotakashi | 0:8fdf9a60065b | 33 | loramac_mlme_confirm_t *LoRaMac_stub::mlme_conf_ptr = NULL; |
kadonotakashi | 0:8fdf9a60065b | 34 | loramac_mlme_indication_t *LoRaMac_stub::mlme_ind_ptr = NULL; |
kadonotakashi | 0:8fdf9a60065b | 35 | device_class_t LoRaMac_stub::dev_class_value = CLASS_A; |
kadonotakashi | 0:8fdf9a60065b | 36 | mbed::Callback<void(void)> LoRaMac_stub::_ack_expiry_handler_for_class_c = NULL; |
kadonotakashi | 0:8fdf9a60065b | 37 | mbed::Callback<void(void)> LoRaMac_stub::_scheduling_failure_handler = NULL; |
kadonotakashi | 0:8fdf9a60065b | 38 | |
kadonotakashi | 0:8fdf9a60065b | 39 | |
kadonotakashi | 0:8fdf9a60065b | 40 | LoRaMac::LoRaMac() |
kadonotakashi | 0:8fdf9a60065b | 41 | : _lora_time(), |
kadonotakashi | 0:8fdf9a60065b | 42 | _lora_phy(NULL), |
kadonotakashi | 0:8fdf9a60065b | 43 | _mac_commands(), |
kadonotakashi | 0:8fdf9a60065b | 44 | _channel_plan(), |
kadonotakashi | 0:8fdf9a60065b | 45 | _lora_crypto(), |
kadonotakashi | 0:8fdf9a60065b | 46 | _ev_queue(NULL), |
kadonotakashi | 0:8fdf9a60065b | 47 | _mcps_indication(), |
kadonotakashi | 0:8fdf9a60065b | 48 | _mcps_confirmation(), |
kadonotakashi | 0:8fdf9a60065b | 49 | _mlme_indication(), |
kadonotakashi | 0:8fdf9a60065b | 50 | _mlme_confirmation(), |
kadonotakashi | 0:8fdf9a60065b | 51 | _is_nwk_joined(false), |
kadonotakashi | 0:8fdf9a60065b | 52 | _continuous_rx2_window_open(false), |
kadonotakashi | 0:8fdf9a60065b | 53 | _device_class(CLASS_A) |
kadonotakashi | 0:8fdf9a60065b | 54 | {} |
kadonotakashi | 0:8fdf9a60065b | 55 | |
kadonotakashi | 0:8fdf9a60065b | 56 | LoRaMac::~LoRaMac() |
kadonotakashi | 0:8fdf9a60065b | 57 | { |
kadonotakashi | 0:8fdf9a60065b | 58 | } |
kadonotakashi | 0:8fdf9a60065b | 59 | |
kadonotakashi | 0:8fdf9a60065b | 60 | const loramac_mcps_confirm_t *LoRaMac::get_mcps_confirmation() const |
kadonotakashi | 0:8fdf9a60065b | 61 | { |
kadonotakashi | 0:8fdf9a60065b | 62 | return LoRaMac_stub::mcps_conf_ptr; |
kadonotakashi | 0:8fdf9a60065b | 63 | } |
kadonotakashi | 0:8fdf9a60065b | 64 | |
kadonotakashi | 0:8fdf9a60065b | 65 | const loramac_mcps_indication_t *LoRaMac::get_mcps_indication() const |
kadonotakashi | 0:8fdf9a60065b | 66 | { |
kadonotakashi | 0:8fdf9a60065b | 67 | return LoRaMac_stub::mcps_ind_ptr; |
kadonotakashi | 0:8fdf9a60065b | 68 | } |
kadonotakashi | 0:8fdf9a60065b | 69 | |
kadonotakashi | 0:8fdf9a60065b | 70 | const loramac_mlme_confirm_t *LoRaMac::get_mlme_confirmation() const |
kadonotakashi | 0:8fdf9a60065b | 71 | { |
kadonotakashi | 0:8fdf9a60065b | 72 | return LoRaMac_stub::mlme_conf_ptr; |
kadonotakashi | 0:8fdf9a60065b | 73 | } |
kadonotakashi | 0:8fdf9a60065b | 74 | |
kadonotakashi | 0:8fdf9a60065b | 75 | const loramac_mlme_indication_t *LoRaMac::get_mlme_indication() const |
kadonotakashi | 0:8fdf9a60065b | 76 | { |
kadonotakashi | 0:8fdf9a60065b | 77 | return LoRaMac_stub::mlme_ind_ptr; |
kadonotakashi | 0:8fdf9a60065b | 78 | } |
kadonotakashi | 0:8fdf9a60065b | 79 | |
kadonotakashi | 0:8fdf9a60065b | 80 | void LoRaMac::post_process_mlme_request() |
kadonotakashi | 0:8fdf9a60065b | 81 | { |
kadonotakashi | 0:8fdf9a60065b | 82 | } |
kadonotakashi | 0:8fdf9a60065b | 83 | |
kadonotakashi | 0:8fdf9a60065b | 84 | void LoRaMac::post_process_mcps_req() |
kadonotakashi | 0:8fdf9a60065b | 85 | { |
kadonotakashi | 0:8fdf9a60065b | 86 | } |
kadonotakashi | 0:8fdf9a60065b | 87 | |
kadonotakashi | 0:8fdf9a60065b | 88 | void LoRaMac::post_process_mcps_ind() |
kadonotakashi | 0:8fdf9a60065b | 89 | { |
kadonotakashi | 0:8fdf9a60065b | 90 | } |
kadonotakashi | 0:8fdf9a60065b | 91 | |
kadonotakashi | 0:8fdf9a60065b | 92 | void LoRaMac::post_process_mlme_ind() |
kadonotakashi | 0:8fdf9a60065b | 93 | { |
kadonotakashi | 0:8fdf9a60065b | 94 | } |
kadonotakashi | 0:8fdf9a60065b | 95 | |
kadonotakashi | 0:8fdf9a60065b | 96 | lorawan_time_t LoRaMac::get_current_time(void) |
kadonotakashi | 0:8fdf9a60065b | 97 | { |
kadonotakashi | 0:8fdf9a60065b | 98 | } |
kadonotakashi | 0:8fdf9a60065b | 99 | |
kadonotakashi | 0:8fdf9a60065b | 100 | rx_slot_t LoRaMac::get_current_slot(void) |
kadonotakashi | 0:8fdf9a60065b | 101 | { |
kadonotakashi | 0:8fdf9a60065b | 102 | return LoRaMac_stub::slot_value; |
kadonotakashi | 0:8fdf9a60065b | 103 | } |
kadonotakashi | 0:8fdf9a60065b | 104 | |
kadonotakashi | 0:8fdf9a60065b | 105 | void LoRaMac::handle_join_accept_frame(const uint8_t *payload, uint16_t size) |
kadonotakashi | 0:8fdf9a60065b | 106 | { |
kadonotakashi | 0:8fdf9a60065b | 107 | } |
kadonotakashi | 0:8fdf9a60065b | 108 | |
kadonotakashi | 0:8fdf9a60065b | 109 | void LoRaMac::check_frame_size(uint16_t size) |
kadonotakashi | 0:8fdf9a60065b | 110 | { |
kadonotakashi | 0:8fdf9a60065b | 111 | } |
kadonotakashi | 0:8fdf9a60065b | 112 | |
kadonotakashi | 0:8fdf9a60065b | 113 | bool LoRaMac::message_integrity_check(const uint8_t *const payload, |
kadonotakashi | 0:8fdf9a60065b | 114 | const uint16_t size, |
kadonotakashi | 0:8fdf9a60065b | 115 | uint8_t *const ptr_pos, |
kadonotakashi | 0:8fdf9a60065b | 116 | uint32_t address, |
kadonotakashi | 0:8fdf9a60065b | 117 | uint32_t *downlink_counter, |
kadonotakashi | 0:8fdf9a60065b | 118 | const uint8_t *nwk_skey) |
kadonotakashi | 0:8fdf9a60065b | 119 | { |
kadonotakashi | 0:8fdf9a60065b | 120 | if (LoRaMac_stub::bool_false_counter) { |
kadonotakashi | 0:8fdf9a60065b | 121 | LoRaMac_stub::bool_false_counter--; |
kadonotakashi | 0:8fdf9a60065b | 122 | return false; |
kadonotakashi | 0:8fdf9a60065b | 123 | } |
kadonotakashi | 0:8fdf9a60065b | 124 | if (LoRaMac_stub::bool_true_counter) { |
kadonotakashi | 0:8fdf9a60065b | 125 | LoRaMac_stub::bool_true_counter--; |
kadonotakashi | 0:8fdf9a60065b | 126 | return true; |
kadonotakashi | 0:8fdf9a60065b | 127 | } |
kadonotakashi | 0:8fdf9a60065b | 128 | |
kadonotakashi | 0:8fdf9a60065b | 129 | return LoRaMac_stub::bool_value; |
kadonotakashi | 0:8fdf9a60065b | 130 | } |
kadonotakashi | 0:8fdf9a60065b | 131 | |
kadonotakashi | 0:8fdf9a60065b | 132 | void LoRaMac::extract_data_and_mac_commands(const uint8_t *payload, |
kadonotakashi | 0:8fdf9a60065b | 133 | uint16_t size, |
kadonotakashi | 0:8fdf9a60065b | 134 | uint8_t fopts_len, |
kadonotakashi | 0:8fdf9a60065b | 135 | uint8_t *nwk_skey, |
kadonotakashi | 0:8fdf9a60065b | 136 | uint8_t *app_skey, |
kadonotakashi | 0:8fdf9a60065b | 137 | uint32_t address, |
kadonotakashi | 0:8fdf9a60065b | 138 | uint32_t downlink_counter, |
kadonotakashi | 0:8fdf9a60065b | 139 | int16_t rssi, |
kadonotakashi | 0:8fdf9a60065b | 140 | int8_t snr) |
kadonotakashi | 0:8fdf9a60065b | 141 | { |
kadonotakashi | 0:8fdf9a60065b | 142 | } |
kadonotakashi | 0:8fdf9a60065b | 143 | |
kadonotakashi | 0:8fdf9a60065b | 144 | void LoRaMac::extract_mac_commands_only(const uint8_t *payload, |
kadonotakashi | 0:8fdf9a60065b | 145 | int8_t snr, |
kadonotakashi | 0:8fdf9a60065b | 146 | uint8_t fopts_len) |
kadonotakashi | 0:8fdf9a60065b | 147 | { |
kadonotakashi | 0:8fdf9a60065b | 148 | } |
kadonotakashi | 0:8fdf9a60065b | 149 | |
kadonotakashi | 0:8fdf9a60065b | 150 | void LoRaMac::handle_data_frame(const uint8_t *const payload, |
kadonotakashi | 0:8fdf9a60065b | 151 | const uint16_t size, |
kadonotakashi | 0:8fdf9a60065b | 152 | uint8_t ptr_pos, |
kadonotakashi | 0:8fdf9a60065b | 153 | uint8_t msg_type, |
kadonotakashi | 0:8fdf9a60065b | 154 | int16_t rssi, |
kadonotakashi | 0:8fdf9a60065b | 155 | int8_t snr) |
kadonotakashi | 0:8fdf9a60065b | 156 | { |
kadonotakashi | 0:8fdf9a60065b | 157 | } |
kadonotakashi | 0:8fdf9a60065b | 158 | |
kadonotakashi | 0:8fdf9a60065b | 159 | void LoRaMac::set_batterylevel_callback(mbed::Callback<uint8_t(void)> battery_level) |
kadonotakashi | 0:8fdf9a60065b | 160 | { |
kadonotakashi | 0:8fdf9a60065b | 161 | } |
kadonotakashi | 0:8fdf9a60065b | 162 | |
kadonotakashi | 0:8fdf9a60065b | 163 | void LoRaMac::on_radio_tx_done(lorawan_time_t timestamp) |
kadonotakashi | 0:8fdf9a60065b | 164 | { |
kadonotakashi | 0:8fdf9a60065b | 165 | } |
kadonotakashi | 0:8fdf9a60065b | 166 | |
kadonotakashi | 0:8fdf9a60065b | 167 | void LoRaMac::on_radio_rx_done(const uint8_t *const payload, uint16_t size, |
kadonotakashi | 0:8fdf9a60065b | 168 | int16_t rssi, int8_t snr) |
kadonotakashi | 0:8fdf9a60065b | 169 | { |
kadonotakashi | 0:8fdf9a60065b | 170 | } |
kadonotakashi | 0:8fdf9a60065b | 171 | |
kadonotakashi | 0:8fdf9a60065b | 172 | void LoRaMac::on_radio_tx_timeout(void) |
kadonotakashi | 0:8fdf9a60065b | 173 | { |
kadonotakashi | 0:8fdf9a60065b | 174 | } |
kadonotakashi | 0:8fdf9a60065b | 175 | |
kadonotakashi | 0:8fdf9a60065b | 176 | void LoRaMac::on_radio_rx_timeout(bool is_timeout) |
kadonotakashi | 0:8fdf9a60065b | 177 | { |
kadonotakashi | 0:8fdf9a60065b | 178 | } |
kadonotakashi | 0:8fdf9a60065b | 179 | |
kadonotakashi | 0:8fdf9a60065b | 180 | bool LoRaMac::continue_joining_process() |
kadonotakashi | 0:8fdf9a60065b | 181 | { |
kadonotakashi | 0:8fdf9a60065b | 182 | if (LoRaMac_stub::bool_false_counter) { |
kadonotakashi | 0:8fdf9a60065b | 183 | LoRaMac_stub::bool_false_counter--; |
kadonotakashi | 0:8fdf9a60065b | 184 | return false; |
kadonotakashi | 0:8fdf9a60065b | 185 | } |
kadonotakashi | 0:8fdf9a60065b | 186 | if (LoRaMac_stub::bool_true_counter) { |
kadonotakashi | 0:8fdf9a60065b | 187 | LoRaMac_stub::bool_true_counter--; |
kadonotakashi | 0:8fdf9a60065b | 188 | return true; |
kadonotakashi | 0:8fdf9a60065b | 189 | } |
kadonotakashi | 0:8fdf9a60065b | 190 | return LoRaMac_stub::bool_value; |
kadonotakashi | 0:8fdf9a60065b | 191 | } |
kadonotakashi | 0:8fdf9a60065b | 192 | |
kadonotakashi | 0:8fdf9a60065b | 193 | bool LoRaMac::continue_sending_process() |
kadonotakashi | 0:8fdf9a60065b | 194 | { |
kadonotakashi | 0:8fdf9a60065b | 195 | if (LoRaMac_stub::bool_false_counter) { |
kadonotakashi | 0:8fdf9a60065b | 196 | LoRaMac_stub::bool_false_counter--; |
kadonotakashi | 0:8fdf9a60065b | 197 | return false; |
kadonotakashi | 0:8fdf9a60065b | 198 | } |
kadonotakashi | 0:8fdf9a60065b | 199 | if (LoRaMac_stub::bool_true_counter) { |
kadonotakashi | 0:8fdf9a60065b | 200 | LoRaMac_stub::bool_true_counter--; |
kadonotakashi | 0:8fdf9a60065b | 201 | return true; |
kadonotakashi | 0:8fdf9a60065b | 202 | } |
kadonotakashi | 0:8fdf9a60065b | 203 | return LoRaMac_stub::bool_value; |
kadonotakashi | 0:8fdf9a60065b | 204 | } |
kadonotakashi | 0:8fdf9a60065b | 205 | |
kadonotakashi | 0:8fdf9a60065b | 206 | lorawan_status_t LoRaMac::send_join_request() |
kadonotakashi | 0:8fdf9a60065b | 207 | { |
kadonotakashi | 0:8fdf9a60065b | 208 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 209 | } |
kadonotakashi | 0:8fdf9a60065b | 210 | |
kadonotakashi | 0:8fdf9a60065b | 211 | lorawan_status_t LoRaMac::handle_retransmission() |
kadonotakashi | 0:8fdf9a60065b | 212 | { |
kadonotakashi | 0:8fdf9a60065b | 213 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 214 | } |
kadonotakashi | 0:8fdf9a60065b | 215 | |
kadonotakashi | 0:8fdf9a60065b | 216 | void LoRaMac::on_backoff_timer_expiry(void) |
kadonotakashi | 0:8fdf9a60065b | 217 | { |
kadonotakashi | 0:8fdf9a60065b | 218 | } |
kadonotakashi | 0:8fdf9a60065b | 219 | |
kadonotakashi | 0:8fdf9a60065b | 220 | void LoRaMac::open_rx1_window(void) |
kadonotakashi | 0:8fdf9a60065b | 221 | { |
kadonotakashi | 0:8fdf9a60065b | 222 | } |
kadonotakashi | 0:8fdf9a60065b | 223 | |
kadonotakashi | 0:8fdf9a60065b | 224 | void LoRaMac::open_rx2_window() |
kadonotakashi | 0:8fdf9a60065b | 225 | { |
kadonotakashi | 0:8fdf9a60065b | 226 | } |
kadonotakashi | 0:8fdf9a60065b | 227 | |
kadonotakashi | 0:8fdf9a60065b | 228 | void LoRaMac::on_ack_timeout_timer_event(void) |
kadonotakashi | 0:8fdf9a60065b | 229 | { |
kadonotakashi | 0:8fdf9a60065b | 230 | } |
kadonotakashi | 0:8fdf9a60065b | 231 | |
kadonotakashi | 0:8fdf9a60065b | 232 | bool LoRaMac::validate_payload_length(uint16_t length, |
kadonotakashi | 0:8fdf9a60065b | 233 | int8_t datarate, |
kadonotakashi | 0:8fdf9a60065b | 234 | uint8_t fopts_len) |
kadonotakashi | 0:8fdf9a60065b | 235 | { |
kadonotakashi | 0:8fdf9a60065b | 236 | if (LoRaMac_stub::bool_false_counter) { |
kadonotakashi | 0:8fdf9a60065b | 237 | LoRaMac_stub::bool_false_counter--; |
kadonotakashi | 0:8fdf9a60065b | 238 | return false; |
kadonotakashi | 0:8fdf9a60065b | 239 | } |
kadonotakashi | 0:8fdf9a60065b | 240 | if (LoRaMac_stub::bool_true_counter) { |
kadonotakashi | 0:8fdf9a60065b | 241 | LoRaMac_stub::bool_true_counter--; |
kadonotakashi | 0:8fdf9a60065b | 242 | return true; |
kadonotakashi | 0:8fdf9a60065b | 243 | } |
kadonotakashi | 0:8fdf9a60065b | 244 | return LoRaMac_stub::bool_value; |
kadonotakashi | 0:8fdf9a60065b | 245 | } |
kadonotakashi | 0:8fdf9a60065b | 246 | |
kadonotakashi | 0:8fdf9a60065b | 247 | void LoRaMac::set_mlme_schedule_ul_indication(void) |
kadonotakashi | 0:8fdf9a60065b | 248 | { |
kadonotakashi | 0:8fdf9a60065b | 249 | } |
kadonotakashi | 0:8fdf9a60065b | 250 | |
kadonotakashi | 0:8fdf9a60065b | 251 | // This is not actual transmission. It just schedules a message in response |
kadonotakashi | 0:8fdf9a60065b | 252 | // to MCPS request |
kadonotakashi | 0:8fdf9a60065b | 253 | lorawan_status_t LoRaMac::send(loramac_mhdr_t *machdr, const uint8_t fport, |
kadonotakashi | 0:8fdf9a60065b | 254 | const void *fbuffer, uint16_t fbuffer_size) |
kadonotakashi | 0:8fdf9a60065b | 255 | { |
kadonotakashi | 0:8fdf9a60065b | 256 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 257 | } |
kadonotakashi | 0:8fdf9a60065b | 258 | |
kadonotakashi | 0:8fdf9a60065b | 259 | int LoRaMac::get_backoff_timer_event_id(void) |
kadonotakashi | 0:8fdf9a60065b | 260 | { |
kadonotakashi | 0:8fdf9a60065b | 261 | return LoRaMac_stub::int_value; |
kadonotakashi | 0:8fdf9a60065b | 262 | } |
kadonotakashi | 0:8fdf9a60065b | 263 | |
kadonotakashi | 0:8fdf9a60065b | 264 | lorawan_status_t LoRaMac::clear_tx_pipe(void) |
kadonotakashi | 0:8fdf9a60065b | 265 | { |
kadonotakashi | 0:8fdf9a60065b | 266 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 267 | } |
kadonotakashi | 0:8fdf9a60065b | 268 | |
kadonotakashi | 0:8fdf9a60065b | 269 | lorawan_status_t LoRaMac::schedule_tx() |
kadonotakashi | 0:8fdf9a60065b | 270 | { |
kadonotakashi | 0:8fdf9a60065b | 271 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 272 | } |
kadonotakashi | 0:8fdf9a60065b | 273 | |
kadonotakashi | 0:8fdf9a60065b | 274 | void LoRaMac::calculate_backOff(uint8_t channel) |
kadonotakashi | 0:8fdf9a60065b | 275 | { |
kadonotakashi | 0:8fdf9a60065b | 276 | } |
kadonotakashi | 0:8fdf9a60065b | 277 | |
kadonotakashi | 0:8fdf9a60065b | 278 | void LoRaMac::reset_mac_parameters(void) |
kadonotakashi | 0:8fdf9a60065b | 279 | { |
kadonotakashi | 0:8fdf9a60065b | 280 | } |
kadonotakashi | 0:8fdf9a60065b | 281 | |
kadonotakashi | 0:8fdf9a60065b | 282 | uint8_t LoRaMac::get_default_tx_datarate() |
kadonotakashi | 0:8fdf9a60065b | 283 | { |
kadonotakashi | 0:8fdf9a60065b | 284 | return 0; |
kadonotakashi | 0:8fdf9a60065b | 285 | } |
kadonotakashi | 0:8fdf9a60065b | 286 | |
kadonotakashi | 0:8fdf9a60065b | 287 | void LoRaMac::enable_adaptive_datarate(bool adr_enabled) |
kadonotakashi | 0:8fdf9a60065b | 288 | { |
kadonotakashi | 0:8fdf9a60065b | 289 | } |
kadonotakashi | 0:8fdf9a60065b | 290 | |
kadonotakashi | 0:8fdf9a60065b | 291 | lorawan_status_t LoRaMac::set_channel_data_rate(uint8_t data_rate) |
kadonotakashi | 0:8fdf9a60065b | 292 | { |
kadonotakashi | 0:8fdf9a60065b | 293 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 294 | } |
kadonotakashi | 0:8fdf9a60065b | 295 | |
kadonotakashi | 0:8fdf9a60065b | 296 | bool LoRaMac::tx_ongoing() |
kadonotakashi | 0:8fdf9a60065b | 297 | { |
kadonotakashi | 0:8fdf9a60065b | 298 | if (LoRaMac_stub::bool_false_counter) { |
kadonotakashi | 0:8fdf9a60065b | 299 | LoRaMac_stub::bool_false_counter--; |
kadonotakashi | 0:8fdf9a60065b | 300 | return false; |
kadonotakashi | 0:8fdf9a60065b | 301 | } |
kadonotakashi | 0:8fdf9a60065b | 302 | if (LoRaMac_stub::bool_true_counter) { |
kadonotakashi | 0:8fdf9a60065b | 303 | LoRaMac_stub::bool_true_counter--; |
kadonotakashi | 0:8fdf9a60065b | 304 | return true; |
kadonotakashi | 0:8fdf9a60065b | 305 | } |
kadonotakashi | 0:8fdf9a60065b | 306 | return LoRaMac_stub::bool_value; |
kadonotakashi | 0:8fdf9a60065b | 307 | } |
kadonotakashi | 0:8fdf9a60065b | 308 | |
kadonotakashi | 0:8fdf9a60065b | 309 | void LoRaMac::set_tx_ongoing(bool ongoing) |
kadonotakashi | 0:8fdf9a60065b | 310 | { |
kadonotakashi | 0:8fdf9a60065b | 311 | } |
kadonotakashi | 0:8fdf9a60065b | 312 | |
kadonotakashi | 0:8fdf9a60065b | 313 | void LoRaMac::reset_ongoing_tx(bool reset_pending) |
kadonotakashi | 0:8fdf9a60065b | 314 | { |
kadonotakashi | 0:8fdf9a60065b | 315 | } |
kadonotakashi | 0:8fdf9a60065b | 316 | |
kadonotakashi | 0:8fdf9a60065b | 317 | int16_t LoRaMac::prepare_ongoing_tx(const uint8_t port, |
kadonotakashi | 0:8fdf9a60065b | 318 | const uint8_t *const data, |
kadonotakashi | 0:8fdf9a60065b | 319 | uint16_t length, |
kadonotakashi | 0:8fdf9a60065b | 320 | uint8_t flags, |
kadonotakashi | 0:8fdf9a60065b | 321 | uint8_t num_retries) |
kadonotakashi | 0:8fdf9a60065b | 322 | { |
kadonotakashi | 0:8fdf9a60065b | 323 | return 0; |
kadonotakashi | 0:8fdf9a60065b | 324 | } |
kadonotakashi | 0:8fdf9a60065b | 325 | |
kadonotakashi | 0:8fdf9a60065b | 326 | lorawan_status_t LoRaMac::send_ongoing_tx() |
kadonotakashi | 0:8fdf9a60065b | 327 | { |
kadonotakashi | 0:8fdf9a60065b | 328 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 329 | } |
kadonotakashi | 0:8fdf9a60065b | 330 | |
kadonotakashi | 0:8fdf9a60065b | 331 | device_class_t LoRaMac::get_device_class() const |
kadonotakashi | 0:8fdf9a60065b | 332 | { |
kadonotakashi | 0:8fdf9a60065b | 333 | return LoRaMac_stub::dev_class_value; |
kadonotakashi | 0:8fdf9a60065b | 334 | } |
kadonotakashi | 0:8fdf9a60065b | 335 | |
kadonotakashi | 0:8fdf9a60065b | 336 | void LoRaMac::set_device_class(const device_class_t &device_class, |
kadonotakashi | 0:8fdf9a60065b | 337 | mbed::Callback<void(void)>ack_expiry_handler) |
kadonotakashi | 0:8fdf9a60065b | 338 | { |
kadonotakashi | 0:8fdf9a60065b | 339 | LoRaMac_stub::_ack_expiry_handler_for_class_c = ack_expiry_handler; |
kadonotakashi | 0:8fdf9a60065b | 340 | } |
kadonotakashi | 0:8fdf9a60065b | 341 | |
kadonotakashi | 0:8fdf9a60065b | 342 | void LoRaMac::setup_link_check_request() |
kadonotakashi | 0:8fdf9a60065b | 343 | { |
kadonotakashi | 0:8fdf9a60065b | 344 | } |
kadonotakashi | 0:8fdf9a60065b | 345 | |
kadonotakashi | 0:8fdf9a60065b | 346 | lorawan_status_t LoRaMac::prepare_join(const lorawan_connect_t *params, bool is_otaa) |
kadonotakashi | 0:8fdf9a60065b | 347 | { |
kadonotakashi | 0:8fdf9a60065b | 348 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 349 | } |
kadonotakashi | 0:8fdf9a60065b | 350 | |
kadonotakashi | 0:8fdf9a60065b | 351 | lorawan_status_t LoRaMac::join(bool is_otaa) |
kadonotakashi | 0:8fdf9a60065b | 352 | { |
kadonotakashi | 0:8fdf9a60065b | 353 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 354 | } |
kadonotakashi | 0:8fdf9a60065b | 355 | |
kadonotakashi | 0:8fdf9a60065b | 356 | static void memcpy_convert_endianess(uint8_t *dst, |
kadonotakashi | 0:8fdf9a60065b | 357 | const uint8_t *src, |
kadonotakashi | 0:8fdf9a60065b | 358 | uint16_t size) |
kadonotakashi | 0:8fdf9a60065b | 359 | { |
kadonotakashi | 0:8fdf9a60065b | 360 | } |
kadonotakashi | 0:8fdf9a60065b | 361 | |
kadonotakashi | 0:8fdf9a60065b | 362 | lorawan_status_t LoRaMac::prepare_frame(loramac_mhdr_t *machdr, |
kadonotakashi | 0:8fdf9a60065b | 363 | loramac_frame_ctrl_t *fctrl, |
kadonotakashi | 0:8fdf9a60065b | 364 | const uint8_t fport, |
kadonotakashi | 0:8fdf9a60065b | 365 | const void *fbuffer, |
kadonotakashi | 0:8fdf9a60065b | 366 | uint16_t fbuffer_size) |
kadonotakashi | 0:8fdf9a60065b | 367 | { |
kadonotakashi | 0:8fdf9a60065b | 368 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 369 | } |
kadonotakashi | 0:8fdf9a60065b | 370 | |
kadonotakashi | 0:8fdf9a60065b | 371 | lorawan_status_t LoRaMac::send_frame_on_channel(uint8_t channel) |
kadonotakashi | 0:8fdf9a60065b | 372 | { |
kadonotakashi | 0:8fdf9a60065b | 373 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 374 | } |
kadonotakashi | 0:8fdf9a60065b | 375 | |
kadonotakashi | 0:8fdf9a60065b | 376 | void LoRaMac::reset_mcps_confirmation() |
kadonotakashi | 0:8fdf9a60065b | 377 | { |
kadonotakashi | 0:8fdf9a60065b | 378 | } |
kadonotakashi | 0:8fdf9a60065b | 379 | |
kadonotakashi | 0:8fdf9a60065b | 380 | void LoRaMac::reset_mlme_confirmation() |
kadonotakashi | 0:8fdf9a60065b | 381 | { |
kadonotakashi | 0:8fdf9a60065b | 382 | } |
kadonotakashi | 0:8fdf9a60065b | 383 | |
kadonotakashi | 0:8fdf9a60065b | 384 | void LoRaMac::reset_mcps_indication() |
kadonotakashi | 0:8fdf9a60065b | 385 | { |
kadonotakashi | 0:8fdf9a60065b | 386 | } |
kadonotakashi | 0:8fdf9a60065b | 387 | |
kadonotakashi | 0:8fdf9a60065b | 388 | void LoRaMac::set_tx_continuous_wave(uint8_t channel, int8_t datarate, int8_t tx_power, |
kadonotakashi | 0:8fdf9a60065b | 389 | float max_eirp, float antenna_gain, uint16_t timeout) |
kadonotakashi | 0:8fdf9a60065b | 390 | { |
kadonotakashi | 0:8fdf9a60065b | 391 | } |
kadonotakashi | 0:8fdf9a60065b | 392 | |
kadonotakashi | 0:8fdf9a60065b | 393 | lorawan_status_t LoRaMac::initialize(EventQueue *queue, |
kadonotakashi | 0:8fdf9a60065b | 394 | mbed::Callback<void(void)>scheduling_failure_handler) |
kadonotakashi | 0:8fdf9a60065b | 395 | { |
kadonotakashi | 0:8fdf9a60065b | 396 | LoRaMac_stub::_scheduling_failure_handler = scheduling_failure_handler; |
kadonotakashi | 0:8fdf9a60065b | 397 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 398 | } |
kadonotakashi | 0:8fdf9a60065b | 399 | |
kadonotakashi | 0:8fdf9a60065b | 400 | void LoRaMac::disconnect() |
kadonotakashi | 0:8fdf9a60065b | 401 | { |
kadonotakashi | 0:8fdf9a60065b | 402 | } |
kadonotakashi | 0:8fdf9a60065b | 403 | |
kadonotakashi | 0:8fdf9a60065b | 404 | uint8_t LoRaMac::get_max_possible_tx_size(uint8_t fopts_len) |
kadonotakashi | 0:8fdf9a60065b | 405 | { |
kadonotakashi | 0:8fdf9a60065b | 406 | return 0; |
kadonotakashi | 0:8fdf9a60065b | 407 | } |
kadonotakashi | 0:8fdf9a60065b | 408 | |
kadonotakashi | 0:8fdf9a60065b | 409 | bool LoRaMac::nwk_joined() |
kadonotakashi | 0:8fdf9a60065b | 410 | { |
kadonotakashi | 0:8fdf9a60065b | 411 | if (LoRaMac_stub::bool_false_counter) { |
kadonotakashi | 0:8fdf9a60065b | 412 | LoRaMac_stub::bool_false_counter--; |
kadonotakashi | 0:8fdf9a60065b | 413 | return false; |
kadonotakashi | 0:8fdf9a60065b | 414 | } |
kadonotakashi | 0:8fdf9a60065b | 415 | if (LoRaMac_stub::bool_true_counter) { |
kadonotakashi | 0:8fdf9a60065b | 416 | LoRaMac_stub::bool_true_counter--; |
kadonotakashi | 0:8fdf9a60065b | 417 | return true; |
kadonotakashi | 0:8fdf9a60065b | 418 | } |
kadonotakashi | 0:8fdf9a60065b | 419 | return LoRaMac_stub::bool_value; |
kadonotakashi | 0:8fdf9a60065b | 420 | } |
kadonotakashi | 0:8fdf9a60065b | 421 | |
kadonotakashi | 0:8fdf9a60065b | 422 | void LoRaMac::set_nwk_joined(bool joined) |
kadonotakashi | 0:8fdf9a60065b | 423 | { |
kadonotakashi | 0:8fdf9a60065b | 424 | } |
kadonotakashi | 0:8fdf9a60065b | 425 | |
kadonotakashi | 0:8fdf9a60065b | 426 | lorawan_status_t LoRaMac::add_channel_plan(const lorawan_channelplan_t &plan) |
kadonotakashi | 0:8fdf9a60065b | 427 | { |
kadonotakashi | 0:8fdf9a60065b | 428 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 429 | } |
kadonotakashi | 0:8fdf9a60065b | 430 | |
kadonotakashi | 0:8fdf9a60065b | 431 | lorawan_status_t LoRaMac::remove_channel_plan() |
kadonotakashi | 0:8fdf9a60065b | 432 | { |
kadonotakashi | 0:8fdf9a60065b | 433 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 434 | } |
kadonotakashi | 0:8fdf9a60065b | 435 | |
kadonotakashi | 0:8fdf9a60065b | 436 | lorawan_status_t LoRaMac::get_channel_plan(lorawan_channelplan_t &plan) |
kadonotakashi | 0:8fdf9a60065b | 437 | { |
kadonotakashi | 0:8fdf9a60065b | 438 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 439 | } |
kadonotakashi | 0:8fdf9a60065b | 440 | |
kadonotakashi | 0:8fdf9a60065b | 441 | lorawan_status_t LoRaMac::remove_single_channel(uint8_t id) |
kadonotakashi | 0:8fdf9a60065b | 442 | { |
kadonotakashi | 0:8fdf9a60065b | 443 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 444 | } |
kadonotakashi | 0:8fdf9a60065b | 445 | |
kadonotakashi | 0:8fdf9a60065b | 446 | lorawan_status_t LoRaMac::multicast_channel_link(multicast_params_t *channel_param) |
kadonotakashi | 0:8fdf9a60065b | 447 | { |
kadonotakashi | 0:8fdf9a60065b | 448 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 449 | } |
kadonotakashi | 0:8fdf9a60065b | 450 | |
kadonotakashi | 0:8fdf9a60065b | 451 | lorawan_status_t LoRaMac::multicast_channel_unlink(multicast_params_t *channel_param) |
kadonotakashi | 0:8fdf9a60065b | 452 | { |
kadonotakashi | 0:8fdf9a60065b | 453 | return LoRaMac_stub::status_value; |
kadonotakashi | 0:8fdf9a60065b | 454 | } |
kadonotakashi | 0:8fdf9a60065b | 455 | |
kadonotakashi | 0:8fdf9a60065b | 456 | void LoRaMac::bind_phy(LoRaPHY &phy) |
kadonotakashi | 0:8fdf9a60065b | 457 | { |
kadonotakashi | 0:8fdf9a60065b | 458 | } |