-
Notifications
You must be signed in to change notification settings - Fork 0
Dev hfp zephyr hf #2
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
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| call_count = get_using_call_count(call->hf); | ||
| if (call_count > 1) { | ||
| if (incoming) { | ||
| atomic_test_bit(call->flags, BT_HFP_HF_CALL_INCOMING_3WAY); | ||
| } else { | ||
| atomic_test_bit(call->flags, BT_HFP_HF_CALL_OUTGOING_3WAY); |
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.
Mark 3‑way calls by setting, not testing, the flag
When parsing AT+CLCC, set_call_incoming_flag is supposed to flag calls as INCOMING_3WAY or OUTGOING_3WAY once more than one call is active. The implementation uses atomic_test_bit in both branches, which only reads the bit and never sets it. As a result the flag stays clear, the subsequent clcc_handle check sees incoming as false for every 3‑way call, logs a direction mismatch and returns early, so the second call is never tracked. Replace the atomic_test_bit calls with a setter (atomic_set_bit or atomic_set_bit_to) so the flags are actually recorded.
Useful? React with 👍 / 👎.
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 <lyle.zhu@nxp.com>
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 <lyle.zhu@nxp.com>
Currently, the minimum value of encryption key size is `BT_HCI_ENCRYPTION_KEY_SIZE_MIN`. Add a new Kconfig `BT_BR_MIN_ENC_KEY_SIZE`. It is used to set the specific minimum encryption key size. The default value is `BT_SMP_MIN_ENC_KEY_SIZE`. And it can be configured if `BT_SMP_SC_ONLY` is not enabled. Use `CONFIG_BT_BR_MIN_ENC_KEY_SIZE` as minimum encryption key size in `br_sufficient_key_size`. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Actively disconnect the connection with error code `BT_HCI_ERR_AUTH_FAIL` when the notified link key type is not `BT_LK_AUTH_COMBINATION_P256` in BR SC only mode. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The discovered SDP record of service attribute transaction response cannot notified correctly. There is an error returned from function `get_record_len()`. For service attribute transaction response, only one attribute list is returned. So the total record length is the buffer length. Return buffer length directly from `get_record_len()` to fix the issue. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, the SDP response packet will be ignored if the operation code is `BT_SDP_ERROR_RSP`. And the SDP transaction request is done, but the application is not notified. And the pending SDP transaction cannot be processed. Notify application with empty buffer if the operation code is `BT_SDP_ERROR_RSP`. And process the pending SDP transaction. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add Kconfig to configure the HF `CLI` and `VOLUME` features. Add a macro `BT_HFP_HF_SDP_SUPPORTED_FEATURES` for SDP HF record. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a function at_get_string to get the string from the received AT result code. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Handle the unsolicited result code +CLIP. Add a callback `clip` to notify the application if the configuration `CONFIG_BT_HFP_HF_CLI` is enabled. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add tx pending queue to queue call AT commands. Add a function bt_hfp_hf_cli to enable/disable CLI notification. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Only send AT command `AT+CMEE=1` if HFP_AG supports "Extended Error result code". Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Handle the unsolicited result code +VGS and +VGM if the configuration `CONFIG_BT_HFP_HF_VOLUME` is enabled. Add a callback `vgm` to notify the application speaker microphone notification if the configuration `CONFIG_BT_HFP_HF_VOLUME` is enabled. Add a callback `vgs` to notify the application speaker gain notification if the configuration `CONFIG_BT_HFP_HF_VOLUME` is enabled. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add function bt_hfp_hf_vgm to configure Gain of Microphone. Add function bt_hfp_hf_vgs to configure Gain of Speaker. These functions are controlled by configuration `CONFIG_BT_HFP_HF_VOLUME`. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The AT command `AT+CLIP=1` or `AT+CLIP=0` cannot be parsed correctly. Check `=` before get AT command value. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
It is a debug log message. It should be logged by LOG_DBG instead of LOG_ERR. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
All set flags are cleared when call is terminated. But for case that SLC is not disconnected, only call related flags should be cleared. Just clear call related flags if the call is terminated. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Handle the unsolicited result code +BSIR issued by the AG to indicate to the HF that the in-band ring tone setting has been locally changed. Add a callback `inband_ring` to notify the in-band ring tone setting. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Handle AT commands AT+VGM and AT+VGS. Add function to notify microphone and speaker gain. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Support separator "=". If the separator is "=", only when result code is VGS" or "VGM", the result code is valid. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add AT command sending structure to queue all AT commander needed to be sent after the SLC established. After the SLC established, send AT command line one by one. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Send AT command AT+VGM and AT+VGS after SLC established. The `VGM` and `VGS` can be set by calling function `bt_hfp_hf_vgs` and `bt_hfp_hf_vgs` in HF connection callback. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add function `bt_hfp_hf_get_operator` to read the currently network operator of AG. Add callback `operator` to notify the application of the response. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Expose a function to set the network operator and mode. Response the AT+COPS? command with set mode and operator. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a function `bt_hfp_hf_accept` to accept the incoming call. Add a flag BT_HFP_HF_FLAG_INCOMING to identify the incoming call. Set the flag if the call_setup value is 1. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a dedicated SDP features definition. Set feature "Three-way calling" by default both in SDP features definition and AT command features definition. Because it is set by default in Spec. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a configuration BT_HFP_AG_EXT_ERR for this feature. If the feature is not set, response the ERROR to the peer if the AT command AT+CMEE received. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a configuration BT_HFP_AG_CODEC_NEG to configure the feature. Add a function bt_hfp_ag_audio_connect to setup the codec negotiation procedure. Improve AT+BAC and AT+BCC handle. Add callback codec_negotiate to notify the application of codec negotiation result. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add the configuration `BT_HFP_HF_CODEC_NEG` to configure the codec negotiation feature. Add a configuration `BT_HFP_HF_CODEC_MSBC` to support mSBC codec. Add a configuration `BT_HFP_HF_CODEC_LC3_SWB` to support LC3 SWB codec. Add a function `bt_hfp_hf_audio_connect` to trigger audio connection sequence. Add a function `bt_hfp_hf_select_codec` to response the codec negotiation request. Add a function `bt_hfp_hf_set_codecs` to notify the AG supported Codec IDs of HF. Handle unsolicited response `+BCS` sent from AG. Send supported Codec IDs supported by HF if the SLC is established. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a function `bt_hfp_ag_inband_ringtone` to enable/disable inband ringtone. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
There is an issue that the SCO connect cannot be un-referenced by HFP AG when the SCO connection is broken if the SCO connect is not created by HFP AG. Register SCO connect change callback. And un-reference the SCO connect in SCO disconnected callback. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Use `const` to modify the field `ops` of the structure `struct bt_sco_chan`. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
bug: v/74979 Signed-off-by: liyuheng <liyuheng@xiaomi.com>
Save the air_mode to SCO connect object. Add a structure `struct bt_conn_sco_info` to return the SCO conn info. Return SCO info through `struct bt_conn_sco_info` when calling the function `bt_conn_get_info()`. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, the SLC connected event will be early notified. It causes the SLC state of AG is not aligned with the state of HF. The SLC connected event should be notified after the procedure of HF indicators is done if the HF indicators feature is supported by both devices. Do not notify the SLC connected event after the AG has successfully responded with information about how call hold and multiparty services are supported if the HF indicators feature is supported by both devices. Notify the SLC connected event after the procedure of HF indicators is done. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Due to the flag `BT_HFP_HF_FLAG_CLCC_PENDING` is set when receiving the +CIEV or +CIND notification, the command `AT+CLCC` will be pending due to the flag is not cleared. Add a flag `BT_HFP_HF_FLAG_INITIATING` to indicate the HF initialization is ongoing. Add a flag `BT_HFP_HF_FLAG_QUERY_CALLS` to indicate the current calls list needs to be queried. Set the flag `BT_HFP_HF_FLAG_INITIATING` at the beginning of the HF initialization. Set the flag `BT_HFP_HF_FLAG_QUERY_CALLS` instead of setting the flag `BT_HFP_HF_FLAG_CLCC_PENDING` if the current calls list needs to be queried and the flag `BT_HFP_HF_FLAG_INITIATING` is set. After the HF initialization is done, query list of the current calls by calling the function `hf_query_current_calls()` if the flag `BT_HFP_HF_FLAG_QUERY_CALLS` is set. Set the flag `BT_HFP_HF_FLAG_CLCC_PENDING` if it is not set in the function `hf_query_current_calls()`. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The MTU of HFP HF or AG is fixed value. It cannot be configured. Fix the issue to make the MTU of RFCOMM is consistency with the MTU of L2CAP. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add the function `bt_hfp_hf_query_list_of_current_calls()` to support users to query current call list. Add the callback `bt_hfp_hf_cb::query_call` to notify the received current calls. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The current calls list should not be queried if the SLC is not connected. Or the error `-ENOTCONN` will be returned by function `hf_query_current_calls()`. Check the connection status of HF before submitting a delay-able worker. Only the SLC is established, submit the delay-able worker. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The buffer `BT_RFCOMM_BUF_SIZE` is used to define the TX buffer size of TX pool. In current implementation, the TX buffer size of RFCOMM cannot be calculated due to the macro `BT_RFCOMM_BUF_SIZE` is defined in internal header file `rfcomm_internal.h`. Move the macro `BT_RFCOMM_BUF_SIZE` form internal header file `rfcomm_internal.h` to interface `rfcomm.h`. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
None of these files actually use anything from the hci_driver.h header file. Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Because the number of ACL RX buffers must be at least the number of maximum connections plus one, increasing `CONFIG_BT_MAX_CONN` could inadvertently lead to a build failure if the number of ACL RX buffers is not also increased. This dependency may not be obvious to users. To address this issue, this commit deprecates the `CONFIG_BT_BUF_RX_COUNT` Kconfig symbol and computes the value in `buf.h` using the new `BT_BUF_RX_COUNT` define. Note that the default value and the minimum range value have been changed to 0 to "disable" the option. Additionally, to allow users to increase the number of ACL RX buffers, this commit introduces the new `CONFIG_BT_BUF_RX_COUNT_EXTRA` Kconfig symbol. The value of this symbol will be added to the computed value of `BT_BUF_RX_COUNT`. The configurations of tests and samples have been updated to reflect these changes. Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
In the function `bt_rfcomm_server_register()`, the channel cannot be dynamic allocated. And only pre-set channel is supported. Improve the function `bt_rfcomm_server_register()` to support the dynamic channel allocation if the passed channel is zero. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, the `accept` cannot be identified if the same one `accept` callback is passed by the upper layer. Similar with `accept` of `bt_l2cap_server.accept`, add a parameter `server` to the `bt_rfcomm_server.accept` callback. Add a argument `server` to function bt_hfp_hf_accept() to avoid building issue for HFP_HF. Add a argument `server` to function rfcomm_accept() to avoid building issue for shell/rfcomm.c. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add support for Remote Port Negotiation (RPN) commands in the RFCOMM. This allows applications to configure the serial port parameters over RFCOMM connections, such as baud rate, data bits, stop bits, parity and flow control. Changes include: - Add enumerations for RPN parameters (baud rate, data bits, stop bits, parity) - Add a public API function bt_rfcomm_send_rpn_cmd() to send RPN commands - Add shell command to test RPN with default parameters This functionality is required by certain Bluetooth profiles that use RFCOMM and need to configure serial port parameters. Signed-off-by: Jiawei Yang <jiawei.yang_1@nxp.com>
The CR bit in DISC frames should be set as a command rather than a response. This patch fixes the rfcomm_send_disc function to correctly use BT_RFCOMM_CMD_CR instead of BT_RFCOMM_RESP_CR when setting the CR bit in the address field of DISC frames. Signed-off-by: Jiawei Yang <jiawei.yang_1@nxp.com>
The MTU calculation in rfcomm_connected() was incorrectly adding the FCS size instead of subtracting it. This could lead to buffer overflows when sending data that exceeds the actual available space. Fix the calculation by properly subtracting both the RFCOMM header size and the FCS size from the L2CAP MTU to get the correct RFCOMM session MTU. Signed-off-by: Jiawei Yang <jiawei.yang_1@nxp.com>
There are two main issues found with using DLC TX thread, Issue 1, the RAM consumption. Every DLC will have a dedicated thread and thread stack. Issue 2, the thread stack overflow issue. There is no way to strike a balance between stack size and RAM consumption. Since the deep of call stack is depended on the upper layer, the thread stack needs to set by application. Due to the thread stack of DLC is dedicated, RAM consumption is the product of the added value and the number of DLCs. Use a TX worker to replace DLC TX thread. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
bug: v/74979 Signed-off-by: liyuheng <liyuheng@xiaomi.com>
bug: v/74979 Change `buf_max_len` field from `uint8_t` to `uint16_t` in `struct at_client` for it may larger than 255 Signed-off-by: liyuheng <liyuheng@xiaomi.com>
bug: v/74979 Signed-off-by: liyuheng <liyuheng@xiaomi.com>
bug: v/74979 Signed-off-by: liyuheng <liyuheng@xiaomi.com>
bug: v/74979 Signed-off-by: liyuheng <liyuheng@xiaomi.com>
bug: v/74979 Signed-off-by: YuhengLi <liyuheng@xiaomi.com>
e826514 to
c7df37a
Compare
bug: v/79392 Settings adaptation for multi-controller changes, include: 1. The settings-related API add 'dev_id' parameter for identifying Controller IDs. 2. Change the format of key_str from /* bt/<keys>/<id>(option) / to / bt/<keys>/<dev_id>/<id>(option) */. 3. According #2, modify the logic for `bt_settings_encode/decode_key`. 4. Convert `store_irk_work` and `store_id_work` from global variables to hdev member variables. Signed-off-by: liuxiang18 <liuxiang18@xiaomi.com>
Note: Please adhere to Contributing Guidelines.
Summary
Update this section with information on why change is necessary,
what it exactly does and how, if new feature shows up, provide
references (dependencies, similar problems and solutions), etc.
Impact
Update this section, where applicable, on how change affects users,
build process, hardware, documentation, security, compatibility, etc.
Testing
Update this section with details on how did you verify the change,
what Host was used for build (OS, CPU, compiler, ..), what Target was
used for verification (arch, board:config, ..), etc. Providing build
and runtime logs from before and after change is highly appreciated.