Skip to content

Conversation

@Thalley
Copy link
Contributor

@Thalley Thalley commented Mar 2, 2021

This PR implements the Audio Input Control Service (AICS) server and client.

The shell has purposely not been modified to control this server, as the service is a secondary service and only has purpose in the context of a primary service.

This PR is the first in a series of 3 to add the Volume Control Service server and client:

  1. Add Volume Offset Control Service (VOCS) server and client (Volume offset control service and client #31893)
  2. Add Audio Input Control Service (AICS) server and client (this)
  3. Add Volume Control Service (VCS) server and client (TBD)

The reason why VOCS and AICS should be implemented first, is that VCS (as a primary service) uses these two secondary services, and having them implemented first will make it easier to merge.

@Thalley Thalley requested a review from asbjornsabo March 2, 2021 13:41
@Thalley Thalley self-assigned this Mar 2, 2021
@github-actions github-actions bot added area: API Changes to public APIs area: Bluetooth area: Bluetooth Audio area: Tests Issues related to a particular existing or missing test labels Mar 2, 2021
@Thalley Thalley force-pushed the audio_input_control_service branch 5 times, most recently from 4be2f8b to d14200d Compare March 5, 2021 14:07
@Thalley Thalley added the Experimental Experimental features not enabled by default label Mar 9, 2021
@Thalley Thalley force-pushed the audio_input_control_service branch 3 times, most recently from d4f1b25 to 1a7ab00 Compare March 19, 2021 14:48
Copy link
Contributor

@asbjornsabo asbjornsabo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments so far. Some of they may need discussion.

@Thalley Thalley added DNM This PR should not be merged (Do Not Merge) and removed DNM This PR should not be merged (Do Not Merge) labels Mar 23, 2021
@Thalley Thalley force-pushed the audio_input_control_service branch from 1a7ab00 to c8c6447 Compare March 25, 2021 16:24
@Thalley Thalley requested a review from asbjornsabo March 25, 2021 16:25
@Thalley Thalley force-pushed the audio_input_control_service branch from c8c6447 to 9446983 Compare March 26, 2021 10:02
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The license should probably be separated from the description.

Shouldn't Nordic be added? And 2021

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any guidelines on dealing with this?

There weren't any similar comments for my VOCS PR (#31893). Regarding the year; should it be the year that Nordic started working on it, a 2020-2021 or the year Nordic upstreamed this file? I've heard different expectations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But added Nordic to the files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe Nordic policy is the year the work was started

@Thalley Thalley force-pushed the audio_input_control_service branch from 9446983 to 43fd68b Compare March 26, 2021 16:45
@Thalley Thalley force-pushed the audio_input_control_service branch from 43fd68b to ec02f42 Compare April 8, 2021 15:42
@Thalley Thalley requested a review from asbjornsabo April 8, 2021 15:42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I get how this is working the new states are notified after the operation which can never fail, while this might work for testing Id expect the entity handling these settings would have to be requested to accept the operation only then we can confirm the operation has been performed and if there is an error report back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, if I understand you correctly, you'd expect the AICS to request the change towards the application, rather than telling the application that the change was made?

That's an interesting alternative. I don't really have a strong opinion about this. The request for change is how it's implemented in e.g. OTS (see ots.c:192), but other characteristics such as the device name are silently accepted without the application's approval (see gatt.c:111).

So basically we have two different ways of handling writes from the client:

  1. Ask the application for permission to finalize the write and either accept or reject it
  2. Tell the application that a write has happened.

Currently we seem to employ both in different services.

I think this is an interesting discussion to have, and I'd like to bring in @asbjornsabo , @jhedberg and @joerchan as well, although I think this is outside the scope of this particular PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set up a discussion for it.
This is a larger question than this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to #33592 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a good ideia to rename the struct bt_aics_init to be different than the function name, or perhaps rename the function name to something like bt_aics_register as it appears to be registering service instances at runtime.

Btw, we probably need to make clear that both forms of registration seems to be available.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vudentz Thanks, that was actually something that was done to VOCS but not AICS for some reason.

Regarding the single register (i.e. just bt_aics_init/register instead of bt_aics_init and bt_aics_register) makes a lot of sense to me. There's no reason why these can't be done in the same call, unless we want to unregister the callbacks, but I doubt that will make sense to do.

I'll merge the two, and also add a complementary update to VOCS (and VCS/MICS)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this calling register the instances from bt_aics_free_instance_get? Im not sure how that would work because those instances are already registered in the static portion of the table so this would register it again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instances are defined with BT_GATT_SERVICE_INSTANCE_DEFINE which doesn't statically register the GATT services, so this should work correctly.

@Thalley Thalley force-pushed the audio_input_control_service branch from ec02f42 to 889a99d Compare April 9, 2021 09:37
@Thalley Thalley requested review from Vudentz and asbjornsabo April 9, 2021 09:37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Handle not set for control point"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is on purpose, since this is a common cp write function it's useful to log which opcode failed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. But the handle is the same for all opcodes, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I am OK as is, I just thought it might confuse people to believe that different opcodes have different handles.)

Copy link
Contributor

@asbjornsabo asbjornsabo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Been through all the files except aics.h, which I reviewed earlier and where I now only checked the resolution of my comments.

I have some minor comments, but otherwise I think this is OK.

@Thalley Thalley requested a review from asbjornsabo April 9, 2021 13:07
@Thalley Thalley force-pushed the audio_input_control_service branch 2 times, most recently from 18dfe96 to 1a52003 Compare April 12, 2021 09:20
This commit implements the secondary service
Audio Input Control Service (AICS) server and client.

Signed-off-by: Emil Gydesen <[email protected]>
@Thalley Thalley force-pushed the audio_input_control_service branch from 1a52003 to d9b0a05 Compare April 12, 2021 11:40
Copy link
Contributor

@asbjornsabo asbjornsabo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good.

@nashif nashif merged commit 2016509 into zephyrproject-rtos:master Apr 12, 2021
@Thalley Thalley deleted the audio_input_control_service branch June 1, 2021 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: API Changes to public APIs area: Bluetooth Audio area: Bluetooth area: Tests Issues related to a particular existing or missing test Experimental Experimental features not enabled by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants