-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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: tester: MICP Client tests #60045
Conversation
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.
Hello @piotrnarajowski, and thank you very much for your first pull request to the Zephyr project!
A project maintainer just triggered our CI pipeline to run it against your PR and ensure it's compliant and doesn't cause any issues. You might want to take this opportunity to review the project's Contributor Expectations and make any updates to your pull request if necessary. 😊
4fec3cc
to
36efa0d
Compare
@@ -271,6 +271,36 @@ int bt_micp_mic_ctlr_mute_get(struct bt_micp_mic_ctlr *mic_ctlr); | |||
* @return 0 if success, errno on failure. | |||
*/ | |||
int bt_micp_mic_ctlr_cb_register(struct bt_micp_mic_ctlr_cb *cb); | |||
|
|||
/** |
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 that those APIs should be under BLUETOOTH_TESTING (those are upper tester interfaces only)
(see include/zephyr/bluetooth/testing.h)
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.
These should not be added at all :)
None of our other tests depend on the GATT handle - Why would these?
@@ -19,6 +19,7 @@ | |||
#include <zephyr/bluetooth/conn.h> | |||
#include <zephyr/bluetooth/gatt.h> | |||
#include <zephyr/bluetooth/audio/micp.h> | |||
#include <../../subsys/bluetooth/audio/aics_internal.h> |
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.
why is this needed?
#include "btp/btp.h" | ||
|
||
static struct bt_micp_mic_ctlr *mic_ctlr; | ||
#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS) |
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.
nitpick: empty line before #if, no emptu line before #endif
(void) bt_conn_get_info(conn, &info); | ||
bt_addr_le_copy(&ev.address, info.le.dst); | ||
|
||
ev.mute_handle = mute_handle; |
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.
sys_cpu_to_le16()
every uint16, uint32 and uint64 needs to be converted to LE when sending over BTP
(void) bt_conn_get_info(conn, &info); | ||
bt_addr_le_copy(&ev.address, info.le.dst); | ||
|
||
ev.state_handle = state_handle; |
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.
ditto
} | ||
|
||
err = bt_micp_mic_ctlr_discover(conn, &mic_ctlr); | ||
|
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.
ditto
static uint8_t micp_aics_unmute(const void *cmd, uint16_t cmd_len, | ||
void *rsp, uint16_t *rsp_len) | ||
{ | ||
LOG_DBG("Unmute"); |
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.
should we verify that expected peer has profile connected? (BTP command has peer address)
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 MICP commands will return -ENOTCONN
if not connected (or more like -EINVAL
since the GATT handles would not have been set yet if discovery hasn't been done, so it will still fail gracefully if not connected
|
||
static uint8_t micp_aics_mute(const void *cmd, uint16_t cmd_len, | ||
void *rsp, uint16_t *rsp_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.
ditto and others command too
|
||
err = bt_micp_mic_ctlr_cb_register(&micp_cbs); | ||
if (err != 0) { | ||
LOG_DBG("Failed to register callbacks: %d", err); |
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.
return BTP_STATUS_FAILED;
we don't want to initialize service if those failed
|
||
uint8_t tester_unregister_micp(void) | ||
{ | ||
return BTP_STATUS_SUCCESS; |
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.
maybe call bt_micp_mic_ctlr_cb_register(NULL); here to "unregister" callbacks?
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.
Mostly code style and minor comment. The big comment is that these tests should not depend on the GATT handle if it can be avoided.
@@ -271,6 +271,36 @@ int bt_micp_mic_ctlr_mute_get(struct bt_micp_mic_ctlr *mic_ctlr); | |||
* @return 0 if success, errno on failure. | |||
*/ | |||
int bt_micp_mic_ctlr_cb_register(struct bt_micp_mic_ctlr_cb *cb); | |||
|
|||
/** |
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.
These should not be added at all :)
None of our other tests depend on the GATT handle - Why would these?
static uint8_t micp_aics_unmute(const void *cmd, uint16_t cmd_len, | ||
void *rsp, uint16_t *rsp_len) | ||
{ | ||
LOG_DBG("Unmute"); |
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 MICP commands will return -ENOTCONN
if not connected (or more like -EINVAL
since the GATT handles would not have been set yet if discovery hasn't been done, so it will still fail gracefully if not connected
9cba7b3
to
ea16167
Compare
|
||
if (err != 0) { | ||
LOG_DBG("Discovery failed (%d)", err); | ||
return BTP_MICP_DISCOVERY_STATUS_FAILED; |
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.
Build warning: 'return' with a value, in function returning void
return BTP_MICP_DISCOVERY_STATUS_FAILED; | |
return; |
|
||
err = bt_micp_mic_ctlr_mute_get(mic_ctlr); | ||
if (err != 0) { | ||
BTP_STATUS_FAILED; |
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.
Build warning: statement with no effect
BTP_STATUS_FAILED; | |
return BTP_STATUS_FAILED; |
|
||
#define LOG_MODULE_NAME bttester_aics | ||
LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_BTTESTER_LOG_LEVEL | ||
); |
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.
Move closing bracket into upper line.
22bca3f
to
cda4ccf
Compare
8827a07
to
9580ea6
Compare
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.
My comments have been resolved, but I still see a few unresolved comments from other reviews
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.
LGTM
@@ -20,6 +20,7 @@ | |||
*/ | |||
|
|||
#include <stdint.h> | |||
#include <../../subsys/bluetooth/audio/micp_internal.h> |
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.
Public header include/zephyr/bluetooth/audio/micp.h shall not include internal header ../../subsys/bluetooth/audio/micp_internal.h
This is needed for upper tester. Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
Add support for MICP Client tests. Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
f8e0162
@carlescufi I think this can be merged without @sjanc approval (he is on OOO for 2 weeks it seems) |
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.
Hi @piotrnarajowski!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!
To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.
Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁
Add support for MICP Client tests