Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bluetooth interface control in C code ( Linux OS )

Normally I can control the interface through the command

 hciconfig hcix up/down 

Can I do this by using c code ?

Is there sample code I can refer to ?

Thanks

like image 517
Sam Avatar asked Jan 18 '26 19:01

Sam


1 Answers

You can use the c code for hciconfig itself. Just download the BlueZ source and open tools/hciconfig.c and use the following functions:-

static void cmd_up(int ctl, int hdev, char *opt)
{
    ...
}

and

static void cmd_down(int ctl, int hdev, char *opt) 
{
    ... 
}
like image 195
Youssif Saeed Avatar answered Jan 20 '26 08:01

Youssif Saeed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!