Fix various compilation errors across bluetooth framework, service,
and stack layers including:
- Add missing function declarations and header includes
- Fix type mismatches and implicit function declarations
- Add missing macro definitions in dfx headers
- Add stub implementation for hid device interface
- Fix list utility inline function issues
Signed-off-by: openvela <openvela@xiaomi.com>
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>
bug: v/86395
rootcause:
Previously, CCC descriptors (defined by `GATT_H_CCCD`) would automatically respond to *read requests* within the stack, while forwarding all *write operations* (including write requests and write commands) to the application. This allowed the app to detect when a characteristic's notify/indicate status changed, without needing to implement `on_read_cb`.
During the Android BTIF porting, CCC read requests started being passed up to the application. This introduced compatibility issues for existing services that used `GATT_H_CCCD` without registering an `on_read_cb`, resulting in unhandled read responses.
To preserve backward compatibility, a new `rsp_type` value — `ATTR_AUTO_RSP_CCC_READ` — is introduced for `GATT_H_CCCD`. It restores the original behavior:
* Automatically respond to CCC descriptor read requests inside the stack
* Still forward write requests and write commands to the application via `on_write_cb`
This allows legacy services to continue functioning without modification.
Apps that require full control over both read and write (e.g. Android BTIF layer) should use `GATT_H_CCCD_USER_RSP`.
Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
bug: v/84177
The on_scan_start_status callback was incorrectly used in BT_LE_ON_SCAN_STOPPED. It has now been reverted to on_scan_stopped.
Signed-off-by: liuxiang18 <liuxiang18@xiaomi.com>
bug: v/84177
When a member variable is NULL within the scan_callback or adv_callback of the client call interface, the bt_socket_scan/adv fails to check for nullptr, resulting in a null address access.
Signed-off-by: liuxiang18 <liuxiang18@xiaomi.com>
bug: v/83666
In the current bt_socket_profile file, all client-side callbacks use the generic macro interface
BREDR & common: CALLBACK_FOREACH
BLE: CALLBACK_REMOTE
Signed-off-by: liuxiang18 <liuxiang18@xiaomi.com>
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>
bug: v/76636
rootcasue: fix ci break
./frameworks/connectivity/bluetooth/service/ipc/socket/src/bt_socket_server.c:171:96: error: code should be clang-formatted [-Wclang-format-violations]
if (BT_IPC_CODE_CHECK_RANGE(packet->code, BT_MANAGER_MESSAGE_START, BT_MANAGER_MESSAGE_END)
./frameworks/connectivity/bluetooth/service/ipc/socket/src/bt_socket_server.c:174:103: error: code should be clang-formatted [-Wclang-format-violations]
} else if (BT_IPC_CODE_CHECK_RANGE(packet->code, BT_ADAPTER_MESSAGE_START, BT_ADAPTER_MESSAGE_END)
./frameworks/connectivity/bluetooth/service/ipc/socket/src/bt_socket_server.c:177:78: error: code should be clang-formatted [-Wclang-format-violations]
} else if (BT_IPC_CODE_CHECK_RANGE(packet->code, BT_DEVICE_MESSAGE_START,BT_DEVICE_MESSAGE_END)
Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
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>
bug: v/58186
Detail:
- Implemented batch reporting for BLE scan results via 1024-byte pipe buffer.
Supports up to 15 scan packets per batch.
- Added 150ms flush timeout to ensure timely reporting in low-traffic environments.
Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
bug: v/54141
Rootcause: The new interface will inform the upper-layer application of the previous bond state, thus distinguishing the different scenarios that may occur during the bonding process.
Signed-off-by: chejinxian1 <chejinxian1@xiaomi.com>
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>
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>
rootcause:
Previously, CCC descriptors (defined by `GATT_H_CCCD`) would automatically respond to *read requests* within the stack, while forwarding all *write operations* (including write requests and write commands) to the application. This allowed the app to detect when a characteristic's notify/indicate status changed, without needing to implement `on_read_cb`.
During the Android BTIF porting, CCC read requests started being passed up to the application. This introduced compatibility issues for existing services that used `GATT_H_CCCD` without registering an `on_read_cb`, resulting in unhandled read responses.
To preserve backward compatibility, a new `rsp_type` value — `ATTR_AUTO_RSP_CCC_READ` — is introduced for `GATT_H_CCCD`. It restores the original behavior:
* Automatically respond to CCC descriptor read requests inside the stack
* Still forward write requests and write commands to the application via `on_write_cb`
This allows legacy services to continue functioning without modification.
Apps that require full control over both read and write (e.g. Android BTIF layer) should use `GATT_H_CCCD_USER_RSP`.
Signed-off-by: zhongzhijie1 <zhongzhijie1@xiaomi.com>
When priv dynamically allocates memory successfully but fails later due to other reasons before reaching the assignment ins->priv = priv;, the memory allocated to priv cannot be freed in bt_socket_async_client_deinit, leading to a resource leak.
Signed-off-by: jialu <jialu@xiaomi.com>
Signed-off-by: miot-robot <miot-robot@xiaomi.com>
When the family is not AF_LOCAL or AF_RPMSG, the function returns immediately without freeing the memory allocated for 'priv', leading to a memory leak.
Signed-off-by: jialu <jialu@xiaomi.com>
Signed-off-by: miot-robot <miot-robot@xiaomi.com>
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>
When the length of a song's attribute is 0, both types and chr_sets of that attribute are set to the default value 0. During message processing on the client side, the attribute's text is not assigned a NULL value due to types = 0. This leads to an error during string length calculation (strlen) when the feature processes the callback.
Signed-off-by: jialu <jialu@xiaomi.com>