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

general HCI layer #29

Open
TorstenRobitzki opened this issue Jun 28, 2018 · 9 comments
Open

general HCI layer #29

TorstenRobitzki opened this issue Jun 28, 2018 · 9 comments

Comments

@TorstenRobitzki
Copy link
Owner

Connecting HCI over a generalized transport (USB, SPI, UART...) to a bluetoe::server<> instance.

We can start this on a separated branch. Separating the transport will help in making the part of the library testable. I would suggest to add new folders named hci to the ./bluetoe and ./tests folder.

I don't think that reusing bluetoe::link_layer::link_layer would make sense, when we are implementing L2CAP over HCI.

@kaofishy
Copy link
Contributor

Yeah I've come to the same conclusion. I'm trying to see if there's anything from the existing link layer that we can re-use but even things like white lists seem difficult to decouple at first glance.

@kaofishy
Copy link
Contributor

Hey @TorstenRobitzki ,

I've mocked up this prototype to generate HCI command packets. I've taken into account your comment about endianness. Let me know what you think.

Tony

@TorstenRobitzki
Copy link
Owner Author

Yes, I don't think that reusing from the link_layer makes sense. At least not if you are not going to base the implementation on the scheduled_radio hardware abstraction. Most of the BLE link layer is already implemented in a HCI. I would base L2CAP onto HCI and then pass the L2CAP stuff to the GATT, SM and Signaling Chanel (link in link_layer::handle_l2cap).

@TorstenRobitzki
Copy link
Owner Author

Well, I mostly looked at the calling side in main(). Looks good to me. I think, if you use functions instead of struct, you could even deduct the buffer size from call.

I would give it a goo. If you think this results in readable, maintainable software structure, I would try it out.

@kaofishy
Copy link
Contributor

Oh right, totally forgot I could try deducing the size of the buffer if it is known at compile time lol

I'm using structs because templates on functions don't have partial specialization on non-type parameters apparently.

@TorstenRobitzki
Copy link
Owner Author

I've started a new branch (HCI_2) to sketch, how an HCI binding could look like. We have a link_layer implementation that is based on a schedule_radio implementation and we would now add a second link_layer implementation, that used HCI.

One thing to factor out, would be the transport. The Bluetooth SIG documents UART and USB. An additional thing to factor out, could be the protocol handling error. If one is sure, that there can not be any bit errors on the transport and that the BLE controller is free of errors, one could then simple do no error handling at all.

@TorstenRobitzki
Copy link
Owner Author

An interesting feature could be to be able to configure the link layer so that it provides support for only a limited number of HCI versions.

@TorstenRobitzki
Copy link
Owner Author

Zephire could be used to program a Nordic eval board as HCI controller that communicates via UART.

@TorstenRobitzki
Copy link
Owner Author

moved sketch to sci_3 branch as merge of master created tons of conflicts

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