159***084
有相关使用例程或者使用说明吗,我这样子调用了一下,发现进不到这个回调函数里。后续又在SDK \ble\ble_peripheral\ble_app_beacon工程中尝试,还是不行
int main(void)
{
static BaseType_t value;
delay_ms(1000);
app_periph_init(); /*<init user periph .*/
/*其他功能初始化函数*/
ble_stack_init(ble_evt_handler, &heaps_table); /*< init ble stack*/
crypt_cbc_test();
pwr_mgmt_mode_set(PMR_MGMT_IDLE_MODE);
/*其他无关任务创建*/
value = xTaskCreate(adv_manager_task, "ble_gap_task", 1024, NULL, 1, &adv_manager_handle);
xTaskCreate(dfu_schedule_task, "dfu_schedule_task", DFU_TASK_STACK_SIZE, NULL, configMAX_PRIORITIES - 2, NULL);
vTaskStartScheduler(); /*< freertos run all tasks*/
for (;;); /*< Never perform here */
}
uint8_t key[16] = { 0x01,0x02,0x03,0x04,
0x01,0x02,0x03,0x04,
0x01,0x02,0x03,0x04,
0x01,0x02,0x03,0x04}; // 16 字节密钥
uint8_t data[16] = {0x01,0x02,0x03,0x04,
0x01,0x02,0x03,0x04,
0x01,0x02,0x03,0x04,
0x01,0x02,0x03,0x04}; // 16 字节数据(必须是 16 的倍数)
uint8_t iv[16] = { 0x01,0x02,0x03,0x04,
0x01,0x02,0x03,0x04,
0x01,0x02,0x03,0x04,
0x01,0x02,0x03,0x04}; // 16 字节数据(必须是 16 的倍数)
void my_aes_callback(uint8_t status, const uint8_t* aes_result, uint32_t src_info)
{
if (1)
{
data[0]=1;
}
}
//(const uint8_t * key, const uint8_t * iv, const uint8_t * val, aes_result_cb res_cb, uint32_t src_info);
void crypt_cbc_test(void)
{
ble_aes_cbc_encrypt(key,iv,data, my_aes_callback, 1);
}
185***527

Hi ,
问题已经是BLE Stack没有初始化就绪就调用了BLE AES API,所以你可以尝试在BLE Stack初始化完成事件上报之后调用
打开微信,使用“扫一扫”即可关注