Skip to content

Commit db1ded0

Browse files
Juha Heiskanenjuhhei01
authored andcommitted
WS LLC data service enabled to WS bootstrap.
1 parent c326e4a commit db1ded0

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@
2626
#include "6LoWPAN/Bootstraps/protocol_6lowpan_interface.h"
2727
#include "6LoWPAN/MAC/mac_helper.h"
2828
#include "6LoWPAN/MAC/mac_data_poll.h"
29+
#include "6LoWPAN/MAC/mpx_api.h"
2930
#include "6LoWPAN/ws/ws_common.h"
3031
#include "6LoWPAN/ws/ws_bootstrap.h"
3132
#include "RPL/rpl_control.h"
3233
#include "RPL/rpl_data.h"
3334
#include "Common_Protocols/icmpv6.h"
3435
#include "Common_Protocols/icmpv6_radv.h"
36+
#include "6LoWPAN/ws/ws_common_defines.h"
37+
#include "6LoWPAN/ws/ws_llc.h"
38+
#include "6LoWPAN/lowpan_adaptation_interface.h"
3539

3640
#include "net_rpl.h"
3741
#include "mac_api.h"
@@ -111,6 +115,7 @@ static int8_t ws_bootstrap_down(protocol_interface_info_entry_t *cur)
111115

112116
// Reset WS information
113117
// ws_common_reset(cur)
118+
ws_llc_reset(cur);
114119

115120
return nwk_6lowpan_down(cur);
116121
}
@@ -147,6 +152,32 @@ void ws_bootstrap_configuration_reset(protocol_interface_info_entry_t *cur)
147152
return;
148153
}
149154

155+
static void ws_bootstrap_asynch_ind(struct protocol_interface_info_entry *interface, const struct mcps_data_ind_s *data, const struct mcps_data_ie_list *ie_ext, uint8_t message_type)
156+
{
157+
(void)interface;
158+
(void)data;
159+
(void)ie_ext;
160+
161+
switch (message_type) {
162+
case WS_FT_PAN_ADVERT:
163+
break;
164+
case WS_FT_PAN_ADVERT_SOL:
165+
break;
166+
case WS_FT_PAN_CONF:
167+
break;
168+
case WS_FT_PAN_CONF_SOL:
169+
break;
170+
default:
171+
break;
172+
}
173+
}
174+
175+
static void ws_bootstrap_asynch_confirm(struct protocol_interface_info_entry *interface, uint8_t asynch_message)
176+
{
177+
(void)interface;
178+
(void)asynch_message;
179+
}
180+
150181
int ws_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode)
151182
{
152183
(void) bootstrap_mode;
@@ -182,13 +213,30 @@ int ws_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode)
182213
default:
183214
return -3;
184215
}
216+
//Disable allways by default
217+
lowpan_adaptation_interface_mpx_register(interface_id, NULL, 0);
218+
219+
ws_llc_create(cur, &ws_bootstrap_asynch_ind, &ws_bootstrap_asynch_confirm);
185220

221+
mpx_api_t *mpx_api = ws_llc_mpx_api_get(cur);
222+
if (!mpx_api) {
223+
ws_llc_delete(cur);
224+
return -4;
225+
}
186226

187227
if (ws_common_allocate_and_init(cur) < 0) {
228+
ws_llc_delete(cur);
188229
return -4;
189230
}
190231

191232
if (ws_bootstrap_tasklet_init(cur) != 0) {
233+
ws_llc_delete(cur);
234+
return -4;
235+
}
236+
237+
//Register MPXUser to adapatation layer
238+
if (lowpan_adaptation_interface_mpx_register(interface_id, mpx_api, MPX_LOWPAN_ENC_USER_ID) != 0) {
239+
ws_llc_delete(cur);
192240
return -4;
193241
}
194242

0 commit comments

Comments
 (0)