Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

How to set it up so that it can be connected directly without pairing? #192

Open
cyub opened this issue Nov 10, 2023 · 1 comment
Open

Comments

@cyub
Copy link

cyub commented Nov 10, 2023

I want to use the go-bluetooth package to configure wifi (WiFi setup over BLE). When operating our app, a pairing pop-up window always pops up. How to connect the ble device directly without popping up the pairing pop-up window. Our ble device driver uses bluez5.63. Can anyone give some advice?

@cyub
Copy link
Author

cyub commented Dec 18, 2023

I found that when using btmgmt to set pairable to false after Advertise, the central device, such as a mobile phone, etc., can no longer pop up the pairing window. This will solve the problem. The code example is as follows:

options := service.AppOptions{
	AdapterID:  adapterID,
	AgentCaps:  agent.CapNoInputNoOutput,
	UUIDSuffix: "-0000-1000-8000-00805F9B34FB",
	UUID:       "1234",
}

a, err := service.NewApp(options)
if err != nil {
	return err
}
defer a.Close()

...

ancel, err := a.Advertise(timeout)
if err != nil {
	return err
}

btmgmt := hw.NewBtMgmt(adapterID)
btmgmt.SetPairable(false)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant