Skip to content
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

Add server mode #7

Closed
5 of 7 tasks
muka opened this issue Aug 22, 2017 · 16 comments
Closed
5 of 7 tasks

Add server mode #7

muka opened this issue Aug 22, 2017 · 16 comments
Assignees

Comments

@muka
Copy link
Owner

muka commented Aug 22, 2017

Expose GATT services via bluez GattManager1

References

Tasks

  • Create an Application wrapper interface
  • Create the ObjectManger interface
  • Create the Properties interface
  • Allow to create Service & Characteristic
  • Add Advertising support (Advertisment support #25)
  • Add integrated test for client/server communications
  • Write docs with examples
@muka muka self-assigned this Aug 22, 2017
@Packetdancer
Copy link
Contributor

While the baseline is in place, there are several limitations:

  1. There doesn't seem to be an easy way to actually include service UUIDs in the advertisement packet.
  2. There doesn't seem to be an easy way to actually override the ReadValue/WriteValue behavior in order to provide values.
  3. The notification behavior doesn't presently work.

If these three points are addressed, the service mode should work properly.

@muka
Copy link
Owner Author

muka commented Apr 18, 2018

Based on your PR I would say that 2 is done. Do you have any suggestion on the other points ?

  1. Maybe can be enabled via an hci command or related to Advertisment support #25?
  2. Will check it, probably a communication issue on go-bluetooth side..

Thanks!

@Packetdancer
Copy link
Contributor

2 and 3 are done in the PR, actually; if you use UpdateValue it properly does notification now.

1 can be fixed by #25, yes; adding the UUIDs to ServiceUUIDs would do the trick.

@muka
Copy link
Owner Author

muka commented Apr 18, 2018

Will see to work on #25 soon to close that issue, if you are interested in working on that let me know

@Packetdancer
Copy link
Contributor

I do actually need it for a project, but I'm stuck in client meetings right now; if you haven't gotten to it later this week I might take a stab at it.

@Packetdancer
Copy link
Contributor

For what it's worth, I managed to get advertisement working entirely over dbus (no need to use the btmgmt command), but I'm not 100% happy with the API I put together while testing; I don't quite think it fits with the rest of the existing API properly.

I can throw what I have your way to look at later if you'd like, though.

@muka
Copy link
Owner Author

muka commented Apr 19, 2018

Yup yup, cross posting here 🥇

Please share, I have no particular need to keep that API approach and can eventually forsee a v2

In the meanwhile, I added an inital implementation and next step is probably to be bind at the service initialization

@Packetdancer
Copy link
Contributor

Awesome! My implementation had it as part of Application; when you initialized a service I had a new 'Advertised' field in the config struct, and then Application had a StartAdvertising where it would build an LEAdvertisement1 based on the app.config.name (for LocalName) and what services were flagged as Advertised, and register the advertisement.

@muka
Copy link
Owner Author

muka commented Apr 19, 2018

Great, let me check the implementation. Mine is in https://github.com/muka/go-bluetooth/tree/dev

@Packetdancer
Copy link
Contributor

Mine's in https://github.com/packetdancer/go-bluetooth/tree/service-advertisement — feel free to grab whatever helps from there. :)

@Packetdancer
Copy link
Contributor

Only caveat in mine is that after you've called StartAdvertising on the application, you want to grab an Adapter1 and set the Discoverable and Powered properties to true.

The Application implementation of StartAdvertising also needs the Call functionality pulled over into api.* most likely, if my approach was followed.

@Packetdancer
Copy link
Contributor

I also discovered that including the entire advertisement packet doesn't always advertise correctly if not everything was filled out; including just Type, ServiceUUIDs, and LocalName worked properly.

@muka
Copy link
Owner Author

muka commented Apr 19, 2018

Your code looks good to me, would you like to PR?

Thanks!

@Packetdancer
Copy link
Contributor

Let me pull in your implementation and add my features atop it, I think your inclusion of LEAdvertisementManager is a better design in keeping with the framework.

@Packetdancer
Copy link
Contributor

Pull request in!

@muka
Copy link
Owner Author

muka commented Apr 19, 2018

Merged, kudos to @Packetdancer for the great contribution!

Closing #7 and #25. Let's open new ones in case of bugs or further features request

@muka muka closed this as completed Apr 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants