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

bluetooth_service: Add function to get connected A2DP device (AUD-4747) #1038

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ftab
Copy link
Contributor

@ftab ftab commented Jul 19, 2023

This is helpful for storing the last known connected device for reconnecting to it on startup.

For example:

            if ((msg.cmd == PERIPH_BLUETOOTH_CONNECTED))
            {
                /* Save this as the last device that was connected */
                nvs_handle_t my_handle;
                esp_err_t err;

                err = nvs_open("storage", NVS_READWRITE, &my_handle);
                ESP_ERROR_CHECK_WITHOUT_ABORT(err);

                esp_bd_addr_t connected_bd_addr;
                periph_bt_get_connected_bd_addr(periph_set_handle, connected_bd_addr);

                err = nvs_set_blob(my_handle, "last_bd_addr", connected_bd_addr, 6);
                ESP_ERROR_CHECK_WITHOUT_ABORT(err);

                err = nvs_commit(my_handle);
                ESP_ERROR_CHECK_WITHOUT_ABORT(err);

                nvs_close(my_handle);
            }

@CLAassistant
Copy link

CLAassistant commented Jul 19, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot changed the title Add function to get connected device Add function to get connected device (AUD-4747) Jul 19, 2023
@JosephTang
Copy link
Contributor

Hi @ftab , the commit message should inform the new function is to get the address of a2dp connected device

@ftab
Copy link
Contributor Author

ftab commented Jul 24, 2023

@JosephTang Thanks for the review, I have updated the commit message and implemented your suggestions.

@ftab ftab changed the title Add function to get connected device (AUD-4747) bluetooth_service: Add function to get connected A2DP device (AUD-4747) Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants