想问一下我这个初始化有什么问题导致蓝牙没有打开到接收的功能,并且报错failed:0x48,具体想问一下是哪里设置出现问题了。
void Add_Server(void)
{
uint8_t status = BLE_STATUS_SUCCESS; const uint8_t uuid[16] = {0x66,0x9a,0x0c,0x20,0x00,0x08,0x81,0x98,0xeb,0x11,0x8b,0x7d,0x20,0xd1,0x69,0x86};
const uint8_t charUuidTX[16] = {0x66,0x9a,0x0c,0x20,0x00,0x08,0x81,0x98,0xeb,0x11,0x8b,0x7d,0x21,0xd1,0x69,0x86};
const uint8_t charUuidRX[16] = {0x66,0x9a,0x0c,0x20,0x00,0x08,0x81,0x98,0xeb,0x11,0x8b,0x7d,0x22,0xd1,0x69,0x86};
Osal_MemCpy(&service_uuid.Service_UUID_128, uuid, 16);
status = aci_gatt_add_service(UUID_TYPE_128 ,&service_uuid ,PRIMARY_SERVICE ,0x04 ,&ServHandle); *红色表明的那位,用0x04的话蓝牙没有接收,发送和服务是正常的,用0x06的话就三个都错误了
if (status != BLE_STATUS_SUCCESS) {
PRINTF("aci_gatt_add_service() failed:0x%02x\r\n", status);
APP_FLAG_SET(APP_ERROR);
}else{
PRINTF("aci_gatt_add_service --> SUCCESS\r\n");
}
Osal_MemCpy(&char_uuid.Char_UUID_128, charUuidTX, 16);
status = aci_gatt_add_char(ServHandle ,UUID_TYPE_128 , &char_uuid ,20 ,CHAR_PROP_NOTIFY ,ATTR_PERMISSION_NONE ,0 ,16 ,1 ,&TXCharHandle); if (status != BLE_STATUS_SUCCESS) {
PRINTF("aci_gatt_add_TXchar() failed:0x%02x\r\n", status);
APP_FLAG_SET(APP_ERROR);
}else{
PRINTF("aci_gatt_add_TXchar --> SUCCESS);
}
Osal_MemCpy(&char_uuid.Char_UUID_128, charUuidRX, 16);
status = aci_gatt_add_char(ServHandle ,UUID_TYPE_128 ,&char_uuid ,20 ,CHAR_PROP_WRITE|CHAR_PROP_WRITE_WITHOUT_RESP ,ATTR_PERMISSION_NONE ,GATT_NOTIFY_ATTRIBUTE_WRITE ,16 ,1 ,&RXCharHandle);
if (status != BLE_STATUS_SUCCESS) {
PRINTF("aci_gatt_add_RXchar() failed:0x%02x\r\n", status);
APP_FLAG_SET(APP_ERROR);
}else{
PRINTF("aci_gatt_add_RXchar --> SUCCESS);
}
}
|