Commit Graph

61 Commits

Author SHA1 Message Date
Zihao Gao ea27e37547 bt_uuid: define BT_UUID_STR_LENGTH macro and update usages
Bug: v/87379

Define BT_UUID_STR_LENGTH macro (40) in bt_uuid.h to replace hardcoded
magic numbers for UUID string buffer size. Use LENGTH suffix to avoid
conflict with Zephyr's BT_UUID_STR_LEN definition.

Update all usages across the codebase to use the new macro.

Signed-off-by: Zihao Gao <gaozihao@xiaomi.com>
2026-04-27 23:14:55 +08:00
jialu b05d6fe309 AVRCP: add avrcp metadata feature
bug:v/42364

Adding AVRCP metadata feature

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-27 23:14:50 +08:00
openvela-robot 9d0c825cbb Merge commit
Change-Id: If26995eebd18a82ac4cd827e6801458e57a6ead3
2026-04-27 23:14:50 +08:00
Lu Jia 6401b80dd6 Revert "fix the feature error code issue."
This reverts commit f8a03639cc9037ac213aba564948dbe1290ef2d4.

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:53:22 +08:00
wuxiaodong6 3541de0f66 fix the feature error code issue.
rootcause: A compilation issue occurred when the framework group patch was not synchronized.

Signed-off-by: wuxiaodong6 <wuxiaodong6@xiaomi.com>
2026-04-20 14:52:50 +08:00
wuxiaodong6 28359ce32a Feature error code mapping
Rootcause: mapping of Bluetooth error codes and feature error codes

Signed-off-by: wuxiaodong6 <wuxiaodong6@xiaomi.com>
2026-04-20 14:52:49 +08:00
Lu Jia 0647f85b0f bluetooth: Fix the issue of failed GATTC deletion.
When deleting a GATTC instance, the Advanced API identifies clients based on their device address. If an application creates two GATTC instances with the same device address, and attempts to delete the second instance before the server has returned the asynchronous callback for the first deletion, both deletion operations will effectively target the same underlying GATTC instance due to the identical device address.

Signed-off-by: jialu <jialu@xiaomi.com>
Signed-off-by: miot-robot <miot-robot@xiaomi.com>
2026-04-20 14:52:34 +08:00
Lu Jia 8407e651bc bluetooth: Check the validity of ins->context before use
When deleting the instance, ins->context is set to NULL. During asynchronous callback execution, ins->context may already be NULL.

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:34 +08:00
Lu Jia c025f07210 bluetooth: In GATTC discovery, report results as a single array per discovery event.
Report one service per discovery event. Data caching is required in this feature module. If the application exits during the discovery process, releasing the cached services becomes highly complex.

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:34 +08:00
Lu Jia 7900c7c95e bluetooth: Fix code formatting issues
Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:12 +08:00
Lu Jia fb48a9d9d9 bluetooth: use legacy adv
iOS cannot search for the extension adv, we need to change the adv type to legacy.

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:12 +08:00
Lu Jia e420127723 bluetooth: Dereference before null check.
Root cause: The function advertiser_data_new() may return NULL. It is used without checking if the pointer is empty after calling the function.

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:10 +08:00
Lu Jia bc0c3303c8 bluetooth: Add macro control for the feature bluetooth gattc.
Signed-off-by: jialu <jialu@xiaomi.com
2026-04-20 14:52:10 +08:00
Lu Jia 15733a78a3 bluetooth: Add macro control for the feature bluetooth scan.
Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:10 +08:00
Lu Jia 31eb46e669 bluetooth: Add macro control for the feature bluetooth adv.
Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:10 +08:00
Lu Jia edf40cdc07 bluetooth: Change the addressType parameter of bluetooth.BLE.createGattClientDevice to be an optional parameter.
Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:09 +08:00
gaoyuan28 1fdaf0e834 bluetooth: Correct event name
Signed-off-by: gaoyuan28 <gaoyuan28@xiaomi.com>
2026-04-20 14:52:09 +08:00
Lu Jia a4e756ae9f bluetooth: Change the scan state parameter reported to the application to a struct type.
Root Cause: The return value parameter defined by the API for obtaining scan status is of type object.

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:09 +08:00
Lu Jia 8e51f9d3de bluetooth: Fix the issue of scanner state not being cleared due to closing Bluetooth during scanning, which leads to scan failure again.
Root cause: The state of the scanner is only cleared when the scan is stopped or closed. When Bluetooth is turned off while scanning is in progress, the state of the scanner is not cleared. This leads to the failure to start scanning when Bluetooth is turned back on.

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:09 +08:00
Lu Jia 9b339760af bluetooth: Fix the issue of obtaining the scan status abnormally when there is no scan.
Root cause: The request for connection status was directly denied before starting the scan, it should return STATE_NON_SCAN.

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:09 +08:00
Lu Jia 11e061ab3b bluetooth: Add close functionality for advertiser, scanner, and GattClientDevice in the bluetooth.ble feature.
Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:09 +08:00
Lu Jia 89ed5d9773 bluetooth: Implement the features bluetooth BLE gattc.
Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:09 +08:00
Lu Jia ed791e8587 bluetooth: Implement the features bluetooth BLE scan.
Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:08 +08:00
Lu Jia c7766de761 bluetooth: Modify the Bluetooth feature implementation plan.
Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:08 +08:00
zhongzhijie1 2bd399c711 [adapter_disable_safe] Framework/feature API support.
the feature now only access in adapter_disable_safe(), when using normal enable and disable, will not affect disable_safe.

Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
2026-04-20 14:52:06 +08:00
Lu Jia a66e3bd48d Fix the issue of the broadcast not being able to be stopped.
Root Cause: An advertiser can only keep track of one handle for a adv. If an application calls start advertising multiple times, it may result in some broadcasts not being able to be turned off.

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:02 +08:00
Lu Jia 4ae2c3a3de bluetooth: After starting the advertisement multiple times, stopping the advertisement failed.
Root cause: Multiple start adv operations were performed, and the feature called the Bluetooth interface to send broadcasts. However, the feature only recorded the first broadcast and only stopped the broadcast once when stopping it, causing the second broadcast to not stop.

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:01 +08:00
Lu Jia 8e222f88ab bluetooth: Implement the features of Bluetooth and Bluetooth BLE.
getAddressAsync
createAdvertiser
startAdvertising
stopAdvertising

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:52:01 +08:00
jialu 715308ed29 AVRCP: add avrcp metadata feature
Adding AVRCP metadata feature

Signed-off-by: jialu <jialu@xiaomi.com>
2026-04-20 14:51:23 +08:00
gaoyuan28 041cc3dedd fix the type of FtUInt32 for jidl-rust
Signed-off-by: gaoyuan28 <gaoyuan28@xiaomi.com>
2026-04-20 14:51:22 +08:00
duqunbo 55856e0090 Feature: When the post fails, the resource is released
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:51:16 +08:00
duqunbo e5ff501baa Post all feature framework apis back to the feature framework thread for execution to resolve possible concurrency contention issues.
rootcause:With the exception of the post API, all feature framework apis are not thread-safe and should not be accessed from own thread

Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:51:15 +08:00
duqunbo 5701ea9c6f Feature: When disconnect with the peer device, disconnect the ACL.
rootcause: If only the profiles is disconnected, the ACL connection is retained for a period of time

Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:51:13 +08:00
wujinfeng d413e10b3a change the jidl glue generation from manual mode to automatic mode
Signed-off-by: wujinfeng <wujinfeng@xiaomi.com>
2026-04-20 14:51:12 +08:00
duqunbo 8a268c73c5 Feature: Log Demotion
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:51:05 +08:00
duqunbo 6bb5a0b2ba Adding property is that we can manually turn off the Bluetooth feature
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:51:04 +08:00
duqunbo b8c84b51bc Modify the allocation function of elements in a feature array
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:51:04 +08:00
duqunbo e6c1f6d1a6 Free the resource after the invokeCallback
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:51:01 +08:00
duqunbo 99db0618d1 Remove callbackId after it is used
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:51:01 +08:00
duqunbo d671e31eb9 Change the management of resources in the feature lifecycle so that our resources can be released in a timely manner
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:51:00 +08:00
Haishen Zhang 19bc307ac2 Clang-format: Update format of all files based on new .clang-format
1. Update format of all files based on new .clang-format

Signed-off-by: Haishen Zhang <zhanghaishen@xiaomi.com>
2026-04-20 14:50:50 +08:00
duqunbo bf307f615b Lock the framework callback to prevent feature callback from being modified during triggering framework callback
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:50:42 +08:00
duqunbo fac0deae55 Removes responses to pairing and connection requests in feature, lets other apps do it
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:50:42 +08:00
duqunbo dd412f6a6b Avoid repeated creation of bluetooth instances during feature registration, and solve the accessing the freed memory during instance destruction
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:50:41 +08:00
duqunbo e6a32e3554 Create a callback object for each feature instance
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:50:41 +08:00
duqunbo 7cc2bbb377 Resolve conflicts where global Bluetooth instance is used by multiple processes
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:50:41 +08:00
fangzhenwei 49d5c962c8 reformat with clang-format 14 coding style
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:50:37 +08:00
duqunbo 4e13f0e930 make the call of feature callback occur in the app thread
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:50:36 +08:00
duqunbo 9d594f9f4a change the remove bonded process to ensure consistent interface behavior
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:50:36 +08:00
duqunbo 43984a97c9 change disconnect process
Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2026-04-20 14:50:36 +08:00