@@ -44,7 +44,7 @@ NET_BUF_POOL_FIXED_DEFINE(data_pool, 1, DATA_BREDR_MTU, NULL);
44
44
NET_BUF_POOL_FIXED_DEFINE (sdp_client_pool , CONFIG_BT_MAX_CONN ,
45
45
SDP_CLIENT_USER_BUF_LEN , NULL );
46
46
47
- static int cmd_auth_pincode (const struct shell * shell ,
47
+ static int cmd_auth_pincode (const struct shell * sh ,
48
48
size_t argc , char * argv [])
49
49
{
50
50
struct bt_conn * conn ;
@@ -59,41 +59,41 @@ static int cmd_auth_pincode(const struct shell *shell,
59
59
}
60
60
61
61
if (!conn ) {
62
- shell_print (shell , "Not connected" );
62
+ shell_print (sh , "Not connected" );
63
63
return 0 ;
64
64
}
65
65
66
66
if (strlen (argv [1 ]) > max ) {
67
- shell_print (shell , "PIN code value invalid - enter max %u "
67
+ shell_print (sh , "PIN code value invalid - enter max %u "
68
68
"digits" , max );
69
69
return 0 ;
70
70
}
71
71
72
- shell_print (shell , "PIN code \"%s\" applied" , argv [1 ]);
72
+ shell_print (sh , "PIN code \"%s\" applied" , argv [1 ]);
73
73
74
74
bt_conn_auth_pincode_entry (conn , argv [1 ]);
75
75
76
76
return 0 ;
77
77
}
78
78
79
- static int cmd_connect (const struct shell * shell , size_t argc , char * argv [])
79
+ static int cmd_connect (const struct shell * sh , size_t argc , char * argv [])
80
80
{
81
81
struct bt_conn * conn ;
82
82
bt_addr_t addr ;
83
83
int err ;
84
84
85
85
err = bt_addr_from_str (argv [1 ], & addr );
86
86
if (err ) {
87
- shell_print (shell , "Invalid peer address (err %d)" , err );
87
+ shell_print (sh , "Invalid peer address (err %d)" , err );
88
88
return - ENOEXEC ;
89
89
}
90
90
91
91
conn = bt_conn_create_br (& addr , BT_BR_CONN_PARAM_DEFAULT );
92
92
if (!conn ) {
93
- shell_print (shell , "Connection failed" );
93
+ shell_print (sh , "Connection failed" );
94
94
} else {
95
95
96
- shell_print (shell , "Connection pending" );
96
+ shell_print (sh , "Connection pending" );
97
97
98
98
/* unref connection obj in advance as app user */
99
99
bt_conn_unref (conn );
@@ -164,7 +164,7 @@ static void br_discovery_complete(struct bt_br_discovery_result *results,
164
164
}
165
165
}
166
166
167
- static int cmd_discovery (const struct shell * shell , size_t argc , char * argv [])
167
+ static int cmd_discovery (const struct shell * sh , size_t argc , char * argv [])
168
168
{
169
169
const char * action ;
170
170
@@ -186,20 +186,20 @@ static int cmd_discovery(const struct shell *shell, size_t argc, char *argv[])
186
186
if (bt_br_discovery_start (& param , br_discovery_results ,
187
187
ARRAY_SIZE (br_discovery_results ),
188
188
br_discovery_complete ) < 0 ) {
189
- shell_print (shell , "Failed to start discovery" );
189
+ shell_print (sh , "Failed to start discovery" );
190
190
return 0 ;
191
191
}
192
192
193
- shell_print (shell , "Discovery started" );
193
+ shell_print (sh , "Discovery started" );
194
194
} else if (!strcmp (action , "off" )) {
195
195
if (bt_br_discovery_stop ()) {
196
- shell_print (shell , "Failed to stop discovery" );
196
+ shell_print (sh , "Failed to stop discovery" );
197
197
return 0 ;
198
198
}
199
199
200
- shell_print (shell , "Discovery stopped" );
200
+ shell_print (sh , "Discovery stopped" );
201
201
} else {
202
- shell_help (shell );
202
+ shell_help (sh );
203
203
}
204
204
205
205
return 0 ;
@@ -261,28 +261,28 @@ static struct bt_l2cap_server br_server = {
261
261
.accept = l2cap_accept ,
262
262
};
263
263
264
- static int cmd_l2cap_register (const struct shell * shell ,
264
+ static int cmd_l2cap_register (const struct shell * sh ,
265
265
size_t argc , char * argv [])
266
266
{
267
267
if (br_server .psm ) {
268
- shell_print (shell , "Already registered" );
268
+ shell_print (sh , "Already registered" );
269
269
return 0 ;
270
270
}
271
271
272
272
br_server .psm = strtoul (argv [1 ], NULL , 16 );
273
273
274
274
if (bt_l2cap_br_server_register (& br_server ) < 0 ) {
275
- shell_error (shell , "Unable to register psm" );
275
+ shell_error (sh , "Unable to register psm" );
276
276
br_server .psm = 0U ;
277
277
return - ENOEXEC ;
278
278
} else {
279
- shell_print (shell , "L2CAP psm %u registered" , br_server .psm );
279
+ shell_print (sh , "L2CAP psm %u registered" , br_server .psm );
280
280
}
281
281
282
282
return 0 ;
283
283
}
284
284
285
- static int cmd_discoverable (const struct shell * shell ,
285
+ static int cmd_discoverable (const struct shell * sh ,
286
286
size_t argc , char * argv [])
287
287
{
288
288
int err ;
@@ -295,22 +295,22 @@ static int cmd_discoverable(const struct shell *shell,
295
295
} else if (!strcmp (action , "off" )) {
296
296
err = bt_br_set_discoverable (false);
297
297
} else {
298
- shell_help (shell );
298
+ shell_help (sh );
299
299
return 0 ;
300
300
}
301
301
302
302
if (err ) {
303
- shell_print (shell , "BR/EDR set/reset discoverable failed "
303
+ shell_print (sh , "BR/EDR set/reset discoverable failed "
304
304
"(err %d)" , err );
305
305
return - ENOEXEC ;
306
306
} else {
307
- shell_print (shell , "BR/EDR set/reset discoverable done" );
307
+ shell_print (sh , "BR/EDR set/reset discoverable done" );
308
308
}
309
309
310
310
return 0 ;
311
311
}
312
312
313
- static int cmd_connectable (const struct shell * shell ,
313
+ static int cmd_connectable (const struct shell * sh ,
314
314
size_t argc , char * argv [])
315
315
{
316
316
int err ;
@@ -323,37 +323,37 @@ static int cmd_connectable(const struct shell *shell,
323
323
} else if (!strcmp (action , "off" )) {
324
324
err = bt_br_set_connectable (false);
325
325
} else {
326
- shell_help (shell );
326
+ shell_help (sh );
327
327
return 0 ;
328
328
}
329
329
330
330
if (err ) {
331
- shell_print (shell , "BR/EDR set/rest connectable failed "
331
+ shell_print (sh , "BR/EDR set/rest connectable failed "
332
332
"(err %d)" , err );
333
333
return - ENOEXEC ;
334
334
} else {
335
- shell_print (shell , "BR/EDR set/reset connectable done" );
335
+ shell_print (sh , "BR/EDR set/reset connectable done" );
336
336
}
337
337
338
338
return 0 ;
339
339
}
340
340
341
- static int cmd_oob (const struct shell * shell , size_t argc , char * argv [])
341
+ static int cmd_oob (const struct shell * sh , size_t argc , char * argv [])
342
342
{
343
343
char addr [BT_ADDR_STR_LEN ];
344
344
struct bt_br_oob oob ;
345
345
int err ;
346
346
347
347
err = bt_br_oob_get_local (& oob );
348
348
if (err ) {
349
- shell_print (shell , "BR/EDR OOB data failed" );
349
+ shell_print (sh , "BR/EDR OOB data failed" );
350
350
return - ENOEXEC ;
351
351
}
352
352
353
353
bt_addr_to_str (& oob .addr , addr , sizeof (addr ));
354
354
355
- shell_print (shell , "BR/EDR OOB data:" );
356
- shell_print (shell , " addr %s" , addr );
355
+ shell_print (sh , "BR/EDR OOB data:" );
356
+ shell_print (sh , " addr %s" , addr );
357
357
return 0 ;
358
358
}
359
359
@@ -495,14 +495,14 @@ static struct bt_sdp_discover_params discov_a2src = {
495
495
496
496
static struct bt_sdp_discover_params discov ;
497
497
498
- static int cmd_sdp_find_record (const struct shell * shell ,
498
+ static int cmd_sdp_find_record (const struct shell * sh ,
499
499
size_t argc , char * argv [])
500
500
{
501
501
int res ;
502
502
const char * action ;
503
503
504
504
if (!default_conn ) {
505
- shell_print (shell , "Not connected" );
505
+ shell_print (sh , "Not connected" );
506
506
return 0 ;
507
507
}
508
508
@@ -513,18 +513,18 @@ static int cmd_sdp_find_record(const struct shell *shell,
513
513
} else if (!strcmp (action , "A2SRC" )) {
514
514
discov = discov_a2src ;
515
515
} else {
516
- shell_help (shell );
516
+ shell_help (sh );
517
517
return 0 ;
518
518
}
519
519
520
- shell_print (shell , "SDP UUID \'%s\' gets applied" , action );
520
+ shell_print (sh , "SDP UUID \'%s\' gets applied" , action );
521
521
522
522
res = bt_sdp_discover (default_conn , & discov );
523
523
if (res ) {
524
- shell_error (shell , "SDP discovery failed: result %d" , res );
524
+ shell_error (sh , "SDP discovery failed: result %d" , res );
525
525
return - ENOEXEC ;
526
526
} else {
527
- shell_print (shell , "SDP discovery started" );
527
+ shell_print (sh , "SDP discovery started" );
528
528
}
529
529
530
530
return 0 ;
@@ -547,15 +547,15 @@ SHELL_STATIC_SUBCMD_SET_CREATE(br_cmds,
547
547
SHELL_SUBCMD_SET_END
548
548
);
549
549
550
- static int cmd_br (const struct shell * shell , size_t argc , char * * argv )
550
+ static int cmd_br (const struct shell * sh , size_t argc , char * * argv )
551
551
{
552
552
if (argc == 1 ) {
553
- shell_help (shell );
553
+ shell_help (sh );
554
554
/* shell returns 1 when help is printed */
555
555
return 1 ;
556
556
}
557
557
558
- shell_error (shell , "%s unknown parameter: %s" , argv [0 ], argv [1 ]);
558
+ shell_error (sh , "%s unknown parameter: %s" , argv [0 ], argv [1 ]);
559
559
560
560
return - ENOEXEC ;
561
561
}
0 commit comments