-
Notifications
You must be signed in to change notification settings - Fork 172
Expose stop service advertisment on Windows #281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,8 @@ func (a *Adapter) AddService(s *Service) error { | |
return err | ||
} | ||
|
||
a.gattServiceProvider = serviceProvider | ||
|
||
localService, err := serviceProvider.GetService() | ||
if err != nil { | ||
return err | ||
|
@@ -237,6 +239,10 @@ func (a *Adapter) AddService(s *Service) error { | |
return serviceProvider.StartAdvertisingWithParameters(params) | ||
} | ||
|
||
func (a *Adapter) StopServiceAdvertisement() error { | ||
return a.gattServiceProvider.StopAdvertising() | ||
} | ||
Comment on lines
+242
to
+244
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait - so normally after you call Apparently Windows works differently. This is quite annoying.
So how this could work in practice:
(We don't currently have a way to stop services, that would probably also be useful to add). |
||
|
||
// Write replaces the characteristic value with a new value. | ||
func (c *Characteristic) Write(p []byte) (n int, err error) { | ||
length := len(p) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understood correctly each GATT service requires its own
GattServiceProvider
. So if someone adds two services this would only store the latest created.Users should be able to add and stop the specific service they want.
I was thinking that a map with the UUID and the service provider could work, but the BLE spec allows UUIDs to be repeated (a problem already found on other ble libraries hbldh/bleak#362).
So maybe
AddService()
should return some handle to the created service to stop it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like a very reasonable suggestion!