Forums - How to read Advertising Data

7 posts / 0 new
Last post
How to read Advertising Data
Kiminator
Join Date: 14 Jan 18
Posts: 6
Posted: Sun, 2018-01-14 10:36

Hi,

I am fairly new to this.. so forgive me if this topic has already been addressed (in which case please point me to the information).

I am using a CSR1010 to listen to other CSR1010 advertisement. And I am able to extract the header information of the advertisement when it is triggered by AppProcessLmEvent(lm_event_code event_code, LM_EVENT_T *p_event_data), when event_code == LM_EV_ADVERTISING_REPORT (0x3F).

When parsing the (according to the types in SDK libraries) p_event_data as LM_EV_ADVERTISING_REPORT_T

    LM_EVENT_COMMON_T *lm_event = &(p_event_data->event);

    HCI_EV_DATA_ULP_ADVERTISING_REPORT_T *hci_ev_data = &(p_event_data);

    uint8 rssi = (*p_event_data).rssi;

    uint8 num_reports = (*hci_ev_data).num_reports;

    uint8 event_type = (*hci_ev_data).event_type;

    uint8 address_type = (*hci_ev_data).address_type;

    BD_ADDR_T *bd_address = &(hci_ev_data->address);

    uint8 length_data = (*hci_ev_data).length_data;

I got these information correctly:

     lm_event, rssi, num_reports, address_type, bd_address.

 

The event_type has 2 possibles values received: 0x02, or 0x04

When event_type = 0x02, the length_data = 31.  I assume this is the standard adv_data length.

When event_type = 0x04, the length_data = 17.  This I know corresponds to the remote device's name, as when I change the remote device's name it changes here.  And the remote device name is seen by other bluetooth device (ie my PC properly).

There is nowhere in the HCI_EV_DATA_ULP_ADVERTISING_REPORT_T that there is a data field for adv_data, nor it is anywhere in the LM_EV_ADVERTISING_REPORT_T.

I also tried to parse the p_event_data as HCI_EV_ULP_ADVERTSING_REPORT_T as

    HCI_ULP_EVENT_COMMON_T *hci_event = &(p_event_data->event);

    HCI_EV_DATA_ULP_ADVERTISING_REPORT_T *hci_ev_data = &(p_event_data->data);

    uint8 *adv_data =(uint8*) &(p_event_data->adv_data);

    uint8 rssi = (*p_event_data).rssi;

    (and reparsing of hci_ev_data as above).

In this case, all the information parsed are wrong!  I.E. bd_address, rssi, etc...  And adv_data is not the device's name I expect either

  

So, where can I find the adv_data?

I am using CSR uEnergy SDK 2.4.3.26 (xIDE).  Has it for years now just did not have time to do this until now.

The libraries of my SDK out of day?

Please help!!!!! (already spent days on this).

 

 

 

 

 

 

  • Up0
  • Down0
vincentk Moderator
Join Date: 14 Apr 16
Posts: 3
Posted: Sun, 2018-01-14 22:23

You should use the function GapLsFindAdType. You can see its usage in the function appGattSignalLmAdvertisingReport in the gatt_client example app.

  • Up0
  • Down0
Kiminator
Join Date: 14 Jan 18
Posts: 6
Posted: Mon, 2018-01-15 06:28

Hi Vincent,


Thank-you for your quick reply.

I was searching for the documentation on GapLsFindAdType too... but could not find it.

Has it been documented somewhere that I missed?

Thanks.

 

  • Up0
  • Down0
Kiminator
Join Date: 14 Jan 18
Posts: 6
Posted: Mon, 2018-01-15 08:30

Hi Vincent,

I tested the codes as you suggested from gatt_client.... using GapLsFindAdType....

Well, the data given by GapLsFindAdType sill comes out as wrong data.  The rest of the information meta data are the same as discovered by my previous codes (originally posted).

Is there a data structure for the data provided by GapLsFindAdType?

Or is it privately defined? Which should not be because the should be standard as the device name is discoverable.

I am going thru all the ...types.h libraries and did not find any thing... maybe LS_ADVERTISING_REPORT_IND_T which was mentionned once in core_event_types.h but nowhere else to be found.

 

  • Up0
  • Down0
Kiminator
Join Date: 14 Jan 18
Posts: 6
Posted: Mon, 2018-01-15 11:53

Hi Vincent,

data returned by GapLsFindAdType() is a uint16.

So it was uint8 data packed in uint16.  I was able to retrieve the data by unpack the returned data from GapLsFindAdType().

Nevertheless, if there is a documentation on this function it would help a lot.

Thanks,

  • Up0
  • Down0
vincentk Moderator
Join Date: 14 Apr 16
Posts: 3
Posted: Mon, 2018-01-15 18:38

The detailed description of the function can be found in CSR µEnergy Firmware Library Documentation: Modules->Bluetooth v4.1 (Bluetooth Smart) Protocol Stack->Link Supervisor->LS Advscan Interface.

  • Up0
  • Down0
Kiminator
Join Date: 14 Jan 18
Posts: 6
Posted: Tue, 2018-01-16 05:57

Ok. Thanks.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.