I use DSPS host project to make a scanner. But,I can't get a full packet in .
我有一个外围设备与27个字节长Packet. But, every time it goes to , I got 18 bytes data. Device name was cut off.
Here's the data I captured from BLE Tools:
02 01 06 07 03 0F 18 0A 18 D0 ED 13 09 45 44 44 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 --- 08 FF 44 4C 54 20 50 3A 4E
And what I get form param->report.data:
02 01 06 07 03 0F 18 0A 18 D0 ED 13 09 45 44 44 30 08
How do I get the full packet like BLE Tools get?
Thanks!
Device:
Hi Oliver_Zero,
There is no switch or special handling in order to get all the advertising data from the advertising string, all the data should be reported in the user_on_adv_report_ind(), how do you get the values that you are describing ? Are you printing the values or you watch then through the debug window ? The second report that you mentioned seems that it has the advertising data chopped off, since i can see that the length is 0x13 but not all the data, so are you sure that you are printing this correctly ?
Thanks MT_dialog
Hi MT_dialog,
I got the values in user_on_adv_report_ind(), and code I use below:
Here's the 2 function I used:
I can't guarantee that the write_bytes() works well. Because I didn't get the complete data from UART output.
//--------------------------------------------------------------------updated-------------------------------------------------------------
I use Watch Window to watch buf, it contains the complete data of Advertising Packet.
But, what's the reason why uart2_write() didn't output a full buf values?
And, how do I do to get Scan Response Data?
Thanks!
//------------------------------Summary---------------------------//
What I made now:
The reason why it don't give me a complete Advertise data is due to uart2_write().
The function should be like this:
void write_bytes(uint8_t *buf, uint8_t len)
{
uart2_write(buf, len, NULL);
uart2_finish_transfers();
}
uart2_finish_transfers() is import to be call after uart2_write()!
//------------------------------------TO-DO-------------------------------//
I still have a question need to be solve.
How can I get the Scan Response data?
If scan response data could be gotten in user_on_adv_report_ind(), I believe Adv data and Scan Resp data were contains in 2 variables.
So, How can I associate Adv packet with Scan Resp packet?
Thanks!
Hi Oliver_Zero,
The scan response data should come immidiatelly after you get the advertising data, once the central gets the advertising data and its performing an active scan it will automatically send a scan request and the peripheral is obligated to send the scan response before transmits the next advertising packet on the next channel and before the central scans on the next channel. So it should come right after the advertising data from the device that has the same bd address with an evt_type on the gapm_adv_report_ind as 0x04.
Thanks MT_dialog
Hi, MT_dialog
Thanks for your help.
BR
Oliver