mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-15 22:20:59 +00:00
hid examples: allow for role switch and sniff mode
This commit is contained in:
parent
3c214e8a16
commit
45a92aba53
@ -383,10 +383,17 @@ int btstack_main(int argc, const char * argv[]){
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
// allow to get found by inquiry
|
||||
gap_discoverable_control(1);
|
||||
// use Limited Discoverable Mode; Peripheral; Keyboard as CoD
|
||||
gap_set_class_of_device(0x2540);
|
||||
// set local name to be identified - zeroes will be replaced by actual BD ADDR
|
||||
gap_set_local_name("HID Keyboard Demo 00:00:00:00:00:00");
|
||||
|
||||
// allow for role switch in general and sniff mode
|
||||
gap_set_default_link_policy_settings( LM_LINK_POLICY_ENABLE_ROLE_SWITCH | LM_LINK_POLICY_ENABLE_SNIFF_MODE );
|
||||
// allow for role switch on outgoing connections - this allow HID Host to become master when we re-connect to it
|
||||
gap_set_allow_role_switch(true);
|
||||
|
||||
// L2CAP
|
||||
l2cap_init();
|
||||
|
||||
|
@ -285,9 +285,16 @@ int btstack_main(int argc, const char * argv[]){
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
// allow to get found by inquiry
|
||||
gap_discoverable_control(1);
|
||||
gap_set_class_of_device(0x2540);
|
||||
// use Limited Discoverable Mode; Peripheral; Pointing Device as CoD
|
||||
gap_set_class_of_device(0x2580);
|
||||
// set local name to be identified - zeroes will be replaced by actual BD ADDR
|
||||
gap_set_local_name("HID Mouse Demo 00:00:00:00:00:00");
|
||||
// allow for role switch in general and sniff mode
|
||||
gap_set_default_link_policy_settings( LM_LINK_POLICY_ENABLE_ROLE_SWITCH | LM_LINK_POLICY_ENABLE_SNIFF_MODE );
|
||||
// allow for role switch on outgoing connections - this allow HID Host to become master when we re-connect to it
|
||||
gap_set_allow_role_switch(true);
|
||||
|
||||
// L2CAP
|
||||
l2cap_init();
|
||||
|
@ -599,6 +599,9 @@ int btstack_main(int argc, const char * argv[]){
|
||||
// setup le device db
|
||||
le_device_db_init();
|
||||
|
||||
// allow for role switch in general and sniff mode
|
||||
gap_set_default_link_policy_settings( LM_LINK_POLICY_ENABLE_ROLE_SWITCH | LM_LINK_POLICY_ENABLE_SNIFF_MODE );
|
||||
|
||||
//
|
||||
l2cap_init();
|
||||
sm_init();
|
||||
|
Loading…
x
Reference in New Issue
Block a user