-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Bluetooth: Classic: SDP: Improve SDP discover #78867
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
Bluetooth: Classic: SDP: Improve SDP discover #78867
Conversation
|
What's with the super short commit message lines? :) It seems like you've set your editor to wrap the lines at 49 characters? Zephyr CI should be happy up to 74, so please update your editor configuration accordingly! |
e90a469 to
a4844de
Compare
Sure. I didn't realize this would be a problem. |
a4844de to
15d2273
Compare
subsys/bluetooth/host/classic/sdp.c
Outdated
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.
Minor: merge these to just one line
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.
It is done.
subsys/bluetooth/host/classic/sdp.c
Outdated
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.
I think these can also be merged to a single line, without violating the 100 max line length. That said, whenever you do have to split the lines, please align the split line so that it starts right after the opening parenthesis of the previous line (N tabs + 0-7 spaces)
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.
Yes. It is done.
subsys/bluetooth/host/classic/sdp.c
Outdated
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.
Same here
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.
It is done.
subsys/bluetooth/host/classic/sdp.c
Outdated
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.
Incorrectly aligned line, which makes the subsequent LOG_DBG statement indistinguishable from being part of the if-condition itself. However, you can probably just merge here too. You'll note that the clang-format checker is actually suggesting you to do exactly this.
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.
Yes. I updated all according to the suggestion of clang-format checker.
subsys/bluetooth/host/classic/sdp.c
Outdated
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.
Same here
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.
It is done.
|
@lylezhu2012 I posted some small coding style comments. They're generally minor issues, but since the Zephyr 4.0 code freeze will anyway prevent this PR from getting merged until next week (post-4.0) you might as well fix those now. |
Extend the function `bt_sdp_discover` to support service search transaction and service attribute transaction. Improve the `session->rec_buf`. If the net buffer cannot be allocated from the channel, disconnect the SDP session. Set the `MaximumAttributeByteCount` of the request `SDP_SERVICE_SEARCH_ATTR_REQ` with the tail room of `session->rec_buf`. Set the `MaximumAttributeByteCount` of the request `SDP_SERVICE_ATTR_REQ` with the tail room of `session->rec_buf`. Set the `MaximumServiceRecordCount` of the request `SDP_SERVICE_SEARCH_REQ` according to the tail room of `session->rec_buf`. Handle the response code `SDP_SERVICE_SEARCH_RSP`, and `SDP_SERVICE_ATTR_RSP`. Handle the error `SDP_ERROR_RSP`. Start the next SDP discovery if the error received. If there no more request, disconnect the session. If the request cannot be sent, start the next SDP discovery. Signed-off-by: Lyle Zhu <[email protected]>
Since the function `bt_sdp_discover` has been updated, the caller of function needs to be updated to avoid the building and functionality fault. Add set the parameter `type` to value `BT_SDP_DISCOVER_SERVICE_SEARCH_ATTR`. Update the SDP discovery callback function. Make it align with `bt_sdp_discover_func_t`. Signed-off-by: Lyle Zhu <[email protected]>
Add set the parameter `type` to value `BT_SDP_DISCOVER_SERVICE_SEARCH_ATTR`. Update the SDP discovery callback function by adding a third parameter `const struct bt_sdp_discover_params *params`. Make it align with `bt_sdp_discover_func_t`. Signed-off-by: Lyle Zhu <[email protected]>
15d2273 to
4076df4
Compare
| goto iterate; | ||
| } | ||
|
|
||
| net_buf_add_mem(session->rec_buf, buf->data, record_len); |
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.
Do we need to consider the peer doesn't comply with the agreement, and response more data? Add if here to check whether session->rec_buf is overwritten.
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.
The tail room of receiving buffer has been checked there.
Extend the function
bt_sdp_discoverto support service search transaction and service attribute transaction.Improve the
session->rec_buf. If the net buffer cannot be allocated from the channel, disconnect the SDP session.Set the
MaximumAttributeByteCountof the requestSDP_SERVICE_SEARCH_ATTR_REQwith the tail room ofsession->rec_buf.Set the
MaximumAttributeByteCountof the requestSDP_SERVICE_ATTR_REQwith the tail room ofsession->rec_buf.Set the
MaximumServiceRecordCountof the requestSDP_SERVICE_SEARCH_REQaccording to the tail room ofsession->rec_buf.Handle the response code
SDP_SERVICE_SEARCH_RSP, andSDP_SERVICE_ATTR_RSP.Handle the error
SDP_ERROR_RSP. Start the next SDP discovery if the error received.If there no more request, disconnect the session.
If the request cannot be sent, start the next SDP discovery.