paypal / gatt

Gatt is a Go package for building Bluetooth Low Energy peripherals
BSD 3-Clause "New" or "Revised" License
1.13k stars 284 forks source link

add Getter/Setter of the service, characteristic, and descriptor. #42

Closed shirou closed 9 years ago

shirou commented 9 years ago

From previous issue, I found noble uses two tiny C programs to read/write HCI and L2CAP, and works on Intel Edison(kernel 3.10). So that, I created noblechild which provides almost same interface to paypal/gatt via noble's C programs. Currently, noblechild can read/write attributes. But I have to make some changes to paypal/gatt.

This PR includes some setter/getter functions to use unexported variables in Server, Characteristic, and Descriptor. No other functions are changes. Would you please merge this PR?

Thank you!

roylee17 commented 9 years ago

Sorry for the late response.

In the go gatt stack, we manage at the connections at L2CAP level, and we would like exclusive control. This could be achieved only with the HCI USER CHANNEL, which was introduced since linux v3.14. Without it, user may feel some inconsistent issue due to both kernel and our stack try to manage the connections.

For minor changes that could help us get along with older kernels are fine. But changing API to expose more implementation might not worth it in my opinion.

Thanks, Roy

shirou commented 9 years ago

Thank you for the response.

I understand and agree about you are not support without HCI USER CHANNEL kernel. So I don't include my proxy itself into this PR. I think my proxy should be independent. This PR only includes the missing piece to get interoperability with your great stack. I try to not change your code, but I couldn't. I think this PR has only minimal changes and it does not expose so much.

I know my approach is not usual and ugly. Even so, I want to support kernel 3.10 people like Intel Edison.

I would appreciate if you would think again.

Thank you, Shirou

roylee17 commented 9 years ago

Though the intention was linux-specific, but the changes in this PR are pretty platform-independent.

It somewhat promotes (exposes) implementation to the API. But I think those handles are commonly presented in other BLE stack's API as well.

Thanks!

shirou commented 9 years ago

Thank you!!