This commit is contained in:
lmx
2025-10-30 16:14:14 +08:00
parent c21ac0ab82
commit a6919c7e43
28 changed files with 209514 additions and 209842 deletions

View File

@ -1647,3 +1647,28 @@ void send_version_to_sibling(void)
}
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////////
void send_data_to_ble_client(const u8* data, u16 length)
{
// 检查数据长度是否有效
if (length == 0 || length > 512) {
printf("Error: Data length %d is out of range (1-512)\n", length);
return;
}
// 检查缓冲区空间
if (app_send_user_data_check(length)) {
// 发送数据
int ret = app_send_user_data(ATT_CHARACTERISTIC_ae02_01_VALUE_HANDLE, data, length, ATT_OP_NOTIFY);
if (ret == 0) { // 假设 0 表示成功
printf("Data sent successfully: Length %d\n", length);
} else {
printf("Failed to send data: Length %d, Error code: %d\n", length, ret);
}
} else {
printf("Insufficient buffer space to send data: Length %d\n", length);
}
}