Commit Graph

52 Commits

Author SHA1 Message Date
zhangyuan20 49453c7ba7 CS: add cs socket server and client.
bug: v/80281

Rootcause: Add a socket server and client to enable communication between the user and Bluetooth.

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
2026-03-02 12:07:54 +08:00
chengkai 0114d1c30a bluetooth: add spp insecure feature
bug: v/13885

Signed-off-by: chengkai <chengkai@xiaomi.com>
2026-02-11 17:27:28 +08:00
liuxiang18 1b6e6215fe aync adv/scan: fix build error
bug: v/83666

The callback macro `CALLBACK_REMOTE` currently used in gatts/gattc employs the member variable `callbacks`. For enhanced versatility, the callback member variables in adv and scan have been modified from `callback` to `callbacks`.

Signed-off-by: liuxiang18 <liuxiang18@xiaomi.com>
2026-01-22 09:28:28 +08:00
liuxiang18 b95024eee5 adv/scan: rename member variables callback as callbacks
bug: v/83666

The callback macro `CALLBACK_REMOTE` currently used in gatts/gattc employs the member variable `callbacks`. For enhanced versatility, the callback member variables in adv and scan have been modified from `callback` to `callbacks`.

Signed-off-by: liuxiang18 <liuxiang18@xiaomi.com>
2026-01-22 09:28:28 +08:00
chengkai 6e4d1c3380 bluetooth: add gatts_connect_bear api [1/2]
bug: v/51103

Signed-off-by: chengkai <chengkai@xiaomi.com>
2026-01-14 14:28:28 +08:00
YuhengLi 8db9b23dca Android-Vela:add cind interface for android
bug: v/59050

Rootcause:When reconnect to the headset during a call, the headset will obtain the call status through the cind command. Since Vela does not have modem, the status will be error. So, get cind from Android.

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
2026-01-07 14:11:18 +08:00
Lu Jia cbea408ece bluetooth: Add initialization for local variables.
bug: v/80616

When passed to bt_socket_client_send_with_reply , it may contain undefined values, leading to unpredictable behavior. Initialize packet explicitly before using it.

Signed-off-by: jialu <jialu@xiaomi.com>
2025-12-20 12:56:06 +08:00
Lu Jia 373a30ccc0 bluetooth: Add initialization for local variables.
bug: v/80617

When passed to bt_socket_client_send_with_reply , it may contain undefined values, leading to unpredictable behavior. Initialize packet explicitly  before using it.

Signed-off-by: jialu <jialu@xiaomi.com>
2025-12-20 12:56:06 +08:00
chejinxian1 977bb0838d L2CAP: Update stop listen function to include transport parameter
bug: v/70057

Rootcause: The PSM employed by L2CAP in LE and BR/EDR contexts are not identical concepts. The LE scenario utilises a simplified PSM, whereas the BR/EDR scenario employs the standard PSM. These differ fundamentally in their allocation methods and are not interoperable.

Consequently, the current implementation of listen and stop listen operations requires distinguishing between connection types. Add a new API `bt_l2cap_stop_listen_with_transport` to support stop listen on BR/EDR PSM. This modification will rectify the error where `bt_l2cap_stop_listen` fails to recognise connection types, whilst filtering operations specific to the BR/EDR type.

Signed-off-by: chejinxian1 <chejinxian1@xiaomi.com>
2025-12-15 10:54:59 +08:00
chejinxian1 132453c0d7 IPC: Update the include for RPMSG
bug: v/79112

Rootcause: Within the Android build system, the RPMSG service is inaccessible. Consequently, the corresponding library path has been added to Android.bp, and the include header file for the source file utilising RPMSG has been updated.

Signed-off-by: chejinxian1 <chejinxian1@xiaomi.com>
2025-11-28 21:36:20 +08:00
Lu Jia 4cb36ccf47 bluetooth: Using macros to reduce boilerplate code in asynchronous callbacks.
bug: v/77564

Some processing logic in asynchronous callbacks is identical; extract this common code into a macro.

Signed-off-by: jialu <jialu@xiaomi.com>
2025-11-20 18:14:35 +08:00
Lu Jia dc9897fb67 bluetooth: Release resources within the callback during deletion of the GATTC asynchronous instance.
bug: v/77564

Signed-off-by: jialu <jialu@xiaomi.com>
2025-11-20 18:14:35 +08:00
Lu Jia 4baa9477e4 bluetooth: Before releasing the IPC pending_queue, invoke the asynchronous callbacks for all messages contained within it.
bug: v/77564

When deleting the Bluetooth asynchronous instance, the IPC cached messages are directly released, and their asynchronous callbacks will not be invoked. This could lead to memory leaks if resources are released within the callbacks.

Signed-off-by: jialu <jialu@xiaomi.com>
2025-11-20 18:14:35 +08:00
chejinxian1 64d4df2bca L2CAP: Add function to stop listening on a specific PSM.
bug: v/57319

Signed-off-by: chejinxian1 <chejinxian1@xiaomi.com>
2025-11-17 22:20:28 +08:00
chejinxian1 68ef63520d L2CAP: Refactor L2CAP API to support to multiple application and socket pipe.
bug: v/57319

Refactor L2CAP API to use handles instead of cookies for callback registration and management.

Signed-off-by: chejinxian1 <chejinxian1@xiaomi.com>
2025-11-17 22:20:28 +08:00
Lu Jia 92e9a77eb2 ipc: trace async api
bug: v/62087

Signed-off-by: jialu <jialu@xiaomi.com>
2025-10-15 10:20:50 +08:00
Lu Jia 7d68d3fe06 ipc: gattc async api
bug: v/62106

Signed-off-by: jialu <jialu@xiaomi.com>
2025-10-15 10:20:50 +08:00
Lu Jia d1cc10ef68 bluetooth: Add instance in the handle returned by the callback in scan.
bug: v/62058

Signed-off-by: jialu <jialu@xiaomi.com>
2025-10-15 10:20:50 +08:00
Lu Jia 474067591a ipc: le scan async api
bug: v/62058

Signed-off-by: jialu <jialu@xiaomi.com>
2025-10-15 10:20:50 +08:00
Lu Jia 1b53740d2a bluetooth: Add instance in the handle returned by the callback in adv.
bug: v/67404

Root cause: The interface handle and other information of the feature exist on the instance of Bluetooth. If the callback does not have instance information, it cannot obtain feature-related information, resulting in the JavaScript application not receiving the callback.

Signed-off-by: jialu <jialu@xiaomi.com>
2025-10-15 10:20:50 +08:00
zhongzhijie1 9e14193b3c [bug fix] When bt off is executed, disconnect all acl connections.
bug: v/43852

Originally, only the "adapter_disable" function was executed. An additional step was added before that, which disconnects all ACL connections. A timer was also started to wait for the "disconnect" event for 2 seconds, followed by cleaning up profile resources (by following the normal disable procedure).

Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
2025-09-26 21:42:22 +08:00
liuxiang18 3f7b0c707c PTS: add pts property for dynamic control disconnect or not when pair failed.
bug: v/71321

Signed-off-by: liuxiang18 <liuxiang18@xiaomi.com>
2025-09-25 20:01:14 +08:00
zhongzhijie1 6302f4e2c3 Support the signed write function, which requires BT_SIGNING micro to open.
bug: v/69041

Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
2025-09-25 20:01:14 +08:00
zhongzhijie1 42aeb49c23 Add API for limited Discovery.
bug: v/70809

Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
2025-09-25 20:01:14 +08:00
liuxiang18 140f414f65 bluetooth: implement bt_device_set_bondable_le API to change bond mode.
bug: v/67335

Signed-off-by: liuxiang18 <liuxiang18@xiaomi.com>
2025-09-25 20:01:14 +08:00
liuxiang18 abb204078c bluetooth: implement bt_device_set_security_level API to change bond security level.
bug: v/67009

Signed-off-by: liuxiang18 <liuxiang18@xiaomi.com>
2025-09-25 20:01:14 +08:00
liyuheng f63df58228 Add new interface: hfp_hf_query_current_calls_with_callback.
bug: v/67238

Rootcause: Currently, when the bt_hfp_hf_query_current_calls interface receives a request, it retrieves the result from the state machine cache and returns it immediately. However, since the cache may not be updated in a timely manner, the returned data may not be the latest.

Signed-off-by: liyuheng <liyuheng@xiaomi.com>
2025-09-17 10:41:29 +08:00
zhangyuan20 0ac0044e05 Android-Vela:add cnum interface for android
bug: v/67447

Rootcause: Adapt the cnum interface to obtain the virtual call mobile phone number.

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
2025-08-28 21:14:05 +08:00
Lu Jia 2f7d2053ac bluetooth: Add bluetooth_get_async_instance()
bug: v/63432

Signed-off-by: jialu <jialu@xiaomi.com>
2025-08-08 13:52:12 +08:00
Lu Jia 4b3f987d31 ipc: le advertiser async api
bug: v/62058

Signed-off-by: jialu <jialu@xiaomi.com>
2025-08-08 13:52:12 +08:00
Lu Jia 47fe1432e4 bluetooth: Fix bugs in asynchronous API.
bug: v/62017

Root cause:
1. The application does not pass asynchronous callback when it should directly return an error code. The message should not be sent to the server, and the entire callback list should not be freed.
2. The application registers multiple callbacks, but it should not return the asynchronous callback first and then return the return value of the asynchronous call. This behavior is inconsistent for the application between the first registration of a callback and subsequent registrations. When the application registers multiple callbacks, the message can be sent to the server, and the server will handle duplicate registrations.

Signed-off-by: jialu <jialu@xiaomi.com>
2025-08-08 13:52:12 +08:00
Lu Jia 979b66f3bf bluetooth: Fix compilation errors when calling Bluetooth in C++ files.
bug: v/67883

Root Cause: When a C++ file references a Bluetooth file, compilation errors occur due to the Bluetooth file using C++ keywords.

Signed-off-by: jialu <jialu@xiaomi.com>
2025-08-07 15:57:53 +08:00
zhangyuan20 c932ccd18e fix problem that pair pin command do not send accept
bug: v/60422

Rootcause: Pair pin command do not send accept, The default value is 0, thus rejecting the pair process, So add accept when send to socket.

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
2025-06-12 15:03:22 +08:00
zhangyuan20 c726342078 zephyr-pts: add register notification interface for avrcp ct
bug: v/58789

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
2025-06-12 10:45:11 +08:00
zhangyuan20 e52900eb16 zephyr-pts: add get playback state interface for avrcp ct
bug: v/58789

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
2025-06-12 10:45:11 +08:00
zhangyuan20 ad343e7331 zephyr-pts: add get subunit info interface for avrcp ct
bug: v/58789

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
2025-06-12 10:45:11 +08:00
zhangyuan20 114f7d188c zephyr-pts: add get unit info interface for avrcp ct
bug: v/58789

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
2025-06-12 10:45:11 +08:00
zhangyuan20 8c3353e282 zephyr-pts: add send passthrough cmd for avrcp ct
bug: v/58789

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
2025-06-12 10:45:11 +08:00
liuxiang18 684d6932da IPC: fix build error conversion from 'int' to 'bt_message_type_t'.
bug: v/52485

Signed-off-by: liuxiang18 <liuxiang18@xiaomi.com>
2025-06-05 13:36:49 +08:00
zhangyuan20 a555fb1198 Android-Vela: add clcc interface and callback
bug: v/60610

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
2025-05-13 17:13:40 +08:00
liuxiang18 72143ef6bd bluetooth:connect/disconnect profile API
bug: v/50798

Signed-off-by: liuxiang18 <liuxiang18@xiaomi.com>
2025-05-12 19:58:51 +08:00
zhangyuan20 f2a34393cf framework/bluetooth: Fixed the problem that bt_device_get_alias method returns wrong alias.
bug: v/54666

bt_device_get_alias method returns 62 bytes when alias length is 63 bytes, because the length is reduced by 1 when using strlcpy.
2025-03-15 07:32:34 +08:00
fangzhenwei be87c6a634 ipc: device async api
bug: v/44888

Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2025-02-18 18:21:13 +08:00
fangzhenwei 902b19394c ipc: adapter async api
bug: v/44888

Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2025-02-18 18:21:13 +08:00
fangzhenwei 97982aedca ipc: socket ipc support async call
bug: v/46316

1.add api bt_socket_client_send_with_reply

Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2025-02-18 18:21:13 +08:00
duqunbo e9d4f928ca BTsnoop: add btsnoop API
bug: v/42717

Signed-off-by: duqunbo <duqunbo@xiaomi.com>
2025-02-10 22:30:28 +08:00
chengkai 155a501a1e bluetooth: adapt spp socket api
bug: v/47179

Signed-off-by: chengkai <chengkai@xiaomi.com>
2025-02-10 17:56:41 +08:00
jialu 741a829251 HFP: Adding vendor specific AT command process for AG
bug: v/17775

In order to implement the PTT function of headphone control, it is necessary to add the process of AG send and receive vendor specific AT commands.

Signed-off-by: jialu <jialu@xiaomi.com>
2025-01-16 23:03:41 +08:00
zhangyuan20 090d7d3034 framework/avrcp: add metadata support for avrcp control in BT Service
bug: v/42362

Rootcause: Avrcp control lacks metadata interface, add get metadata interface and callback for avrcp control

Signed-off-by: zhangyuan20 <zhangyuan20@xiaomi.com>
2025-01-03 18:07:52 +08:00
shenyangsi d1d133e78c GATT: fix type mismatch for cookie of socket ipc
bug: v/45006

Rootcause: The 32-bit pointer stored by the Vela socket server may truncate the 64-bit pointer from Android client

Signed-off-by: shenyangsi <shenyangsi@xiaomi.com>
2025-01-02 22:46:44 +08:00