33
33
#include "6LoWPAN/ws/ws_mpx_header.h"
34
34
#include "6LoWPAN/lowpan_adaptation_interface.h"
35
35
#include "nsdynmemLIB_stub.h"
36
- #include "adaptation_interface_stub.h"
37
36
#include "mac_ie_lib_stub.h"
38
37
#include "ws_mpx_header_stub.h"
39
38
@@ -91,14 +90,9 @@ static int8_t test_mac_api_enable_mcps_ext(mac_api_t *api,
91
90
return 0 ;
92
91
}
93
92
94
- static bool register_mpx_user (void )
93
+ static void register_mpx_user (mpx_api_t * mpx_api )
95
94
{
96
-
97
- if (!adaptation_interface_stub .mpx_api ) {
98
- return false;
99
- }
100
- adaptation_interface_stub .mpx_api -> mpx_user_registration (adaptation_interface_stub .mpx_api , & test_mpx_data_confirm , & test_mpx_data_indication , 0xA0ED );
101
- return true;
95
+ mpx_api -> mpx_user_registration (mpx_api , & test_mpx_data_confirm , & test_mpx_data_indication , 0xA0ED );
102
96
}
103
97
104
98
static uint8_t test_handle ;
@@ -132,22 +126,16 @@ bool test_ws_llc_create()
132
126
if (ws_llc_create (& interface , test_ws_asynch_ind , test_ws_asynch_confirm ) != -2 ) {
133
127
return false;
134
128
}
135
- nsdynmemlib_stub .returnCounter = 1 ;
136
- adaptation_interface_stub .expectedInt8 = -1 ;
137
- if (ws_llc_create (& interface , test_ws_asynch_ind , test_ws_asynch_confirm ) != -1 ) {
129
+ if (ws_llc_mpx_api_get (& interface )) {
138
130
return false;
139
131
}
132
+
140
133
nsdynmemlib_stub .returnCounter = 1 ;
141
- adaptation_interface_stub .expectedInt8 = 0 ;
142
134
if (ws_llc_create (& interface , test_ws_asynch_ind , test_ws_asynch_confirm ) != 0 ) {
143
135
return false;
144
136
}
145
137
146
- if (!register_mpx_user ()) {
147
- return false;
148
- }
149
-
150
- if (ws_llc_create (& interface , test_ws_asynch_ind , test_ws_asynch_confirm ) != -1 ) {
138
+ if (ws_llc_create (& interface , test_ws_asynch_ind , test_ws_asynch_confirm ) != 0 ) {
151
139
return false;
152
140
}
153
141
ws_llc_delete (& interface );
@@ -161,9 +149,9 @@ bool test_ws_llc_reset()
161
149
interface_api_init (& api );
162
150
163
151
nsdynmemlib_stub .returnCounter = 1 ;
164
- adaptation_interface_stub .expectedInt8 = 0 ;
165
152
ws_llc_create (& interface , test_ws_asynch_ind , test_ws_asynch_confirm );
166
- register_mpx_user ();
153
+ mpx_api_t * mpx_api = ws_llc_mpx_api_get (& interface );
154
+ register_mpx_user (mpx_api );
167
155
ws_llc_reset (NULL );
168
156
//Tri Asynch and MPX to queue
169
157
mcps_data_req_t data_req ;
@@ -174,7 +162,7 @@ bool test_ws_llc_reset()
174
162
data_req .msdu = test_data ;
175
163
data_req .msduLength = 80 ;
176
164
nsdynmemlib_stub .returnCounter = 1 ;
177
- adaptation_interface_stub . mpx_api -> mpx_data_request (adaptation_interface_stub . mpx_api , & data_req , 0xA0ED );
165
+ mpx_api -> mpx_data_request (mpx_api , & data_req , 0xA0ED );
178
166
nsdynmemlib_stub .returnCounter = 1 ;
179
167
asynch_request_t asynch_request ;
180
168
asynch_request .message_type = WS_FT_PAN_ADVERT ;
@@ -191,9 +179,9 @@ bool test_asynch_msg_send()
191
179
interface_api_init (& api );
192
180
193
181
nsdynmemlib_stub .returnCounter = 1 ;
194
- adaptation_interface_stub .expectedInt8 = 0 ;
195
182
ws_llc_create (& interface , test_ws_asynch_ind , test_ws_asynch_confirm );
196
- register_mpx_user ();
183
+ mpx_api_t * mpx_api = ws_llc_mpx_api_get (& interface );
184
+ register_mpx_user (mpx_api );
197
185
asynch_request_t asynch_request ;
198
186
asynch_request .message_type = WS_FT_PAN_ADVERT_SOL ;
199
187
message_id = WS_FT_PAN_ADVERT_SOL ;
@@ -268,9 +256,9 @@ bool test_mpx_msg_send()
268
256
interface_api_init (& api );
269
257
270
258
nsdynmemlib_stub .returnCounter = 1 ;
271
- adaptation_interface_stub .expectedInt8 = 0 ;
272
259
ws_llc_create (& interface , test_ws_asynch_ind , test_ws_asynch_confirm );
273
- register_mpx_user ();
260
+ mpx_api_t * mpx_api = ws_llc_mpx_api_get (& interface );
261
+ register_mpx_user (mpx_api );
274
262
275
263
mcps_data_req_t data_req ;
276
264
uint8_t test_data [100 ];
@@ -283,7 +271,7 @@ bool test_mpx_msg_send()
283
271
valid_mpx_conf = false;
284
272
test_status = MLME_TRANSACTION_OVERFLOW ;
285
273
mpx_handle_test = 10 ;
286
- adaptation_interface_stub . mpx_api -> mpx_data_request (adaptation_interface_stub . mpx_api , & data_req , 0xA0ED );
274
+ mpx_api -> mpx_data_request (mpx_api , & data_req , 0xA0ED );
287
275
if (!valid_mpx_conf ) {
288
276
return false;
289
277
}
@@ -294,7 +282,7 @@ bool test_mpx_msg_send()
294
282
test_status = MLME_SUCCESS ;
295
283
mpx_handle_test = 11 ;
296
284
nsdynmemlib_stub .returnCounter = 1 ;
297
- adaptation_interface_stub . mpx_api -> mpx_data_request (adaptation_interface_stub . mpx_api , & data_req , 0xA0ED );
285
+ mpx_api -> mpx_data_request (mpx_api , & data_req , 0xA0ED );
298
286
if (valid_mpx_conf ) {
299
287
return false;
300
288
}
@@ -322,18 +310,18 @@ bool test_mpx_msg_send()
322
310
test_status = MLME_SUCCESS ;
323
311
mpx_handle_test = 12 ;
324
312
nsdynmemlib_stub .returnCounter = 1 ;
325
- adaptation_interface_stub . mpx_api -> mpx_data_request (adaptation_interface_stub . mpx_api , & data_req , 0xA0ED );
313
+ mpx_api -> mpx_data_request (mpx_api , & data_req , 0xA0ED );
326
314
uint8_t test_1 = test_handle ;
327
315
data_req .msduHandle = 13 ;
328
316
nsdynmemlib_stub .returnCounter = 1 ;
329
- adaptation_interface_stub . mpx_api -> mpx_data_request (adaptation_interface_stub . mpx_api , & data_req , 0xA0ED );
317
+ mpx_api -> mpx_data_request (mpx_api , & data_req , 0xA0ED );
330
318
uint8_t test_2 = test_handle ;
331
319
332
320
struct mcps_purge_s purge ;
333
321
purge .msduHandle = 12 ;
334
- adaptation_interface_stub . mpx_api -> mpx_data_purge (adaptation_interface_stub . mpx_api ,& purge , 0xA0ED );
322
+ mpx_api -> mpx_data_purge (mpx_api ,& purge , 0xA0ED );
335
323
purge .msduHandle = 13 ;
336
- adaptation_interface_stub . mpx_api -> mpx_data_purge (adaptation_interface_stub . mpx_api ,& purge , 0xA0ED );
324
+ mpx_api -> mpx_data_purge (mpx_api ,& purge , 0xA0ED );
337
325
//Purge and after that test confirm
338
326
data_conf .msduHandle = test_handle ;
339
327
data_confirmation_cb (& api , & data_conf , & conf_payload );
@@ -342,18 +330,18 @@ bool test_mpx_msg_send()
342
330
}
343
331
uint8_t vendor_test [10 ];
344
332
//Test OverHead check
345
- uint16_t test_length = adaptation_interface_stub . mpx_api -> mpx_headroom_size_get (adaptation_interface_stub . mpx_api , 0xA0ED );
333
+ uint16_t test_length = mpx_api -> mpx_headroom_size_get (mpx_api , 0xA0ED );
346
334
if (test_length != 14 ) {
347
335
return false;
348
336
}
349
337
ws_llc_set_vendor_header_data (& interface , vendor_test , 10 );
350
- test_length = adaptation_interface_stub . mpx_api -> mpx_headroom_size_get (adaptation_interface_stub . mpx_api , 0xA0ED );
338
+ test_length = mpx_api -> mpx_headroom_size_get (mpx_api , 0xA0ED );
351
339
if (test_length != 14 + 13 ) {
352
340
return false;
353
341
}
354
342
355
343
ws_llc_set_vendor_payload_data (& interface , vendor_test , 10 );
356
- test_length = adaptation_interface_stub . mpx_api -> mpx_headroom_size_get (adaptation_interface_stub . mpx_api , 0xA0ED );
344
+ test_length = mpx_api -> mpx_headroom_size_get (mpx_api , 0xA0ED );
357
345
if (test_length != 14 + 13 + 14 ) {
358
346
return false;
359
347
}
@@ -371,9 +359,9 @@ bool test_mpx_msg_rx()
371
359
interface_api_init (& api );
372
360
373
361
nsdynmemlib_stub .returnCounter = 1 ;
374
- adaptation_interface_stub .expectedInt8 = 0 ;
375
362
ws_llc_create (& interface , test_ws_asynch_ind , test_ws_asynch_confirm );
376
- register_mpx_user ();
363
+ mpx_api_t * mpx_api = ws_llc_mpx_api_get (& interface );
364
+ register_mpx_user (mpx_api );
377
365
378
366
mcps_data_ind_t data_ind ;
379
367
uint8_t utt_type = 0 ;
0 commit comments