23
23
24
24
using namespace events ;
25
25
26
- inline LoRaWANStack& stk_obj ()
27
- {
28
- return LoRaWANStack::get_lorawan_stack ();
29
- }
30
-
31
26
LoRaWANInterface::LoRaWANInterface (LoRaRadio& radio)
32
27
{
33
- stk_obj () .bind_radio_driver (radio);
28
+ _lw_stack .bind_radio_driver (radio);
34
29
}
35
30
36
31
LoRaWANInterface::~LoRaWANInterface ()
@@ -39,95 +34,95 @@ LoRaWANInterface::~LoRaWANInterface()
39
34
40
35
lorawan_status_t LoRaWANInterface::initialize (EventQueue *queue)
41
36
{
42
- return stk_obj () .initialize_mac_layer (queue);
37
+ return _lw_stack .initialize_mac_layer (queue);
43
38
}
44
39
45
40
lorawan_status_t LoRaWANInterface::connect ()
46
41
{
47
- return stk_obj () .connect ();
42
+ return _lw_stack .connect ();
48
43
}
49
44
50
45
lorawan_status_t LoRaWANInterface::connect (const lorawan_connect_t &connect)
51
46
{
52
- return stk_obj () .connect (connect);
47
+ return _lw_stack .connect (connect);
53
48
}
54
49
55
50
lorawan_status_t LoRaWANInterface::disconnect ()
56
51
{
57
- return stk_obj () .shutdown ();
52
+ return _lw_stack .shutdown ();
58
53
}
59
54
60
55
lorawan_status_t LoRaWANInterface::add_link_check_request ()
61
56
{
62
- return stk_obj () .set_link_check_request ();
57
+ return _lw_stack .set_link_check_request ();
63
58
}
64
59
65
60
void LoRaWANInterface::remove_link_check_request ()
66
61
{
67
- stk_obj () .remove_link_check_request ();
62
+ _lw_stack .remove_link_check_request ();
68
63
}
69
64
70
65
lorawan_status_t LoRaWANInterface::set_datarate (uint8_t data_rate)
71
66
{
72
- return stk_obj () .set_channel_data_rate (data_rate);
67
+ return _lw_stack .set_channel_data_rate (data_rate);
73
68
}
74
69
75
70
lorawan_status_t LoRaWANInterface::set_confirmed_msg_retries (uint8_t count)
76
71
{
77
- return stk_obj () .set_confirmed_msg_retry (count);
72
+ return _lw_stack .set_confirmed_msg_retry (count);
78
73
}
79
74
80
75
lorawan_status_t LoRaWANInterface::enable_adaptive_datarate ()
81
76
{
82
- return stk_obj () .enable_adaptive_datarate (true );
77
+ return _lw_stack .enable_adaptive_datarate (true );
83
78
}
84
79
85
80
lorawan_status_t LoRaWANInterface::disable_adaptive_datarate ()
86
81
{
87
- return stk_obj () .enable_adaptive_datarate (false );
82
+ return _lw_stack .enable_adaptive_datarate (false );
88
83
}
89
84
90
85
lorawan_status_t LoRaWANInterface::set_channel_plan (const lorawan_channelplan_t &channel_plan)
91
86
{
92
- return stk_obj () .add_channels (channel_plan);
87
+ return _lw_stack .add_channels (channel_plan);
93
88
}
94
89
95
90
lorawan_status_t LoRaWANInterface::get_channel_plan (lorawan_channelplan_t &channel_plan)
96
91
{
97
- return stk_obj () .get_enabled_channels (channel_plan);
92
+ return _lw_stack .get_enabled_channels (channel_plan);
98
93
}
99
94
100
95
lorawan_status_t LoRaWANInterface::remove_channel (uint8_t id)
101
96
{
102
- return stk_obj () .remove_a_channel (id);
97
+ return _lw_stack .remove_a_channel (id);
103
98
}
104
99
105
100
lorawan_status_t LoRaWANInterface::remove_channel_plan ()
106
101
{
107
- return stk_obj () .drop_channel_list ();
102
+ return _lw_stack .drop_channel_list ();
108
103
}
109
104
110
105
int16_t LoRaWANInterface::send (uint8_t port, const uint8_t * data, uint16_t length, int flags)
111
106
{
112
- return stk_obj () .handle_tx (port, data, length, flags);
107
+ return _lw_stack .handle_tx (port, data, length, flags);
113
108
}
114
109
115
110
int16_t LoRaWANInterface::receive (uint8_t port, uint8_t * data, uint16_t length, int flags)
116
111
{
117
- return stk_obj () .handle_rx (data, length, port, flags, true );
112
+ return _lw_stack .handle_rx (data, length, port, flags, true );
118
113
}
119
114
120
115
int16_t LoRaWANInterface::receive (uint8_t * data, uint16_t length, uint8_t & port, int & flags)
121
116
{
122
- return stk_obj () .handle_rx (data, length, port, flags, false );
117
+ return _lw_stack .handle_rx (data, length, port, flags, false );
123
118
}
124
119
125
120
lorawan_status_t LoRaWANInterface::add_app_callbacks (lorawan_app_callbacks_t *callbacks)
126
121
{
127
- return stk_obj () .set_lora_callbacks (callbacks);
122
+ return _lw_stack .set_lora_callbacks (callbacks);
128
123
}
129
124
130
125
lorawan_status_t LoRaWANInterface::set_device_class (const device_class_t device_class)
131
126
{
132
- return stk_obj () .set_device_class (device_class);
127
+ return _lw_stack .set_device_class (device_class);
133
128
}
0 commit comments