The data length is 8 bit unsigned integer value (uint8). Please go to the definition of the variable advReport and check the structure.
In the BLE peripheral GUI, in the GAP settings--> Scanresponse packet you can see that the data length is mentioned in hexadecimal format. You can use the hexadecimal format "0x__" for checking.
Question>>"Also, what is the dataLen property actually counting? Is it the length of the entire response packet including headers or is it just the response data? According to the documentation it is the length of the data for each device that responded to scanning. I am not sure what this means but I would like to check the specific length of the data I am sending in the advertising packet."
Answer--> Data Length includes the entire advertisement packet. It is the combination of user name data as well as other data like Manufacturer data. We recommend you to check data length field also as advReport->data[x] to avoid confusion.
Please ensure whether you are doing active scanning or passive scanning at central side. If you are doing active scanning you have to check scan response packet. Or if you are using passive scanning you have to check the advertisement packet.
Thank you Ganesh this response is very helpful. I just have a couple of follow up questions.
1) You mention that I should check the data length field also as advReport->data[x] to avoid confusion. What is x?
2) I am using this sample project for the Central side. How do I know if this is passive or active mode? I have not changed anything from the sample.
>>"1) You mention that I should check the data length field also as advReport->data[x] to avoid confusion. What is x?"
--> 'x' is the byte position. It is the postion of the byte inside the array. So what I recommended is instead of reading the "Data Length", you can use the position of Data Length inside the advertisement packet.
>>"I am using this sample project for the Central side. How do I know if this is passive or active mode? I have not changed anything from the sample."
--> In central project, In the GAP settings--> Scan settings--> scanning mode you can find this setting.
scan_settings.PNG 80.6 K
Thank you Ganesh! I will try these recommendations and let you.