This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF9160 DK lte_ble_gateway sample to get beacon UUID

Hi,
       I am working on nRF9160DK lte_ble_gateway sample, in that I want to scan for beacons UUID and major, minor value.
       nRF52 device is programmed with bluetooth HCI (UART). I dont want to use BLE scan filters.

      Could someone please provide me a sample or hint on how to get it.

Parents
  • You need to somehow filter the advertising data. This is because beacon data usually is in the form of manufacturer-specific data (see this link), and you need to check all incoming advertising packets and check if it contains a manufacturer-specific AD type (check the bottom of this link). I am not too familiar with the Zephyr BLE libraries, and I am not sure what the proper way of going about this is, but here is one approach:

    • Make a copy of the lte_ble_gateway example, which you can modify
    • Inside <..>\ncs\nrf\samples\nrf9160\lte_ble_gateway\src\ble.c do the following
      • Change scan_start() to the following:

    static void scan_start(void){
            int err;
          
          	err = bt_le_scan_start(&scan_param, scan_cb);
    	if (err) {
    		printk("Starting scanning failed (err %d)\n", err);
    		return;
    	}
    }

      • Change scan_cb to the following:

    static void scan_cb(const bt_addr_le_t *addr, s8_t rssi, u8_t adv_type,
    		    struct net_buf_simple *buf)
    {
            bt_data_parse(ad, adv_data_found, NULL);
    }

    • Create adv_data_found:

    static bool adv_data_found(struct bt_data *data, void *user_data)
    {
    	struct bt_scan_control *scan_control =
    			(struct bt_scan_control *)user_data;
    
    	if(data->type== BT_DATA_MANUFACTURER_DATA) {
    	   //process the "data" variable
    	   //Get minor and major values, uuid etc. from data
    	   return false
    	}
    
    
    	return true;
    }

    • Then delete everything from <..>\ncs\nrf\samples\nrf9160\lte_ble_gateway\src\ble.c that you don't need, e.g. functionality for connecting to a device.

    I have not tested this myself, and my approach my contain errors/mistakes. Please ask if this approach doesn't work, or if you want me to elaborate more on anything.

    Best regards,

    Simon

  • Check out this ticket where I have provided the complete code to get this working.

    Best regards,

    Simon

  • I got expected UUID, major and minor values.

    Thanks Simon..

  • Hi,

    We are able to filter the BLE beacons values with UUID values without any issues.

    For information: We are testing only with 2 Gimbal beacons.
    And we are filtering by using vendor ID of Gimbal beacon (0x008C).

    But strangely, we are able to see that, the UUID of the above vendor (Gimbal) is changing every time.  

    As per our understanding, UUIDs of beacon should be same as its constant value for each beacon.

    Please share us some info about, why UUID is changing.

    Thank you.

  • I am sorry for the delay, have you been able to figure this out?

    Best regards,

    Simon

  • still not able to findout,why UUID changing everytime. Please share if you have any information about it.

  • Tejaswini said:
    But strangely, we are able to see that, the UUID of the above vendor (Gimbal) is changing every time.  

    As per our understanding, UUIDs of beacon should be same as its constant value for each beacon.

    Please share us some info about, why UUID is changing.

    Please contact Gimbal about this, I think they are in a better position about it.

    Best regards,

    Simon

Reply
  • Tejaswini said:
    But strangely, we are able to see that, the UUID of the above vendor (Gimbal) is changing every time.  

    As per our understanding, UUIDs of beacon should be same as its constant value for each beacon.

    Please share us some info about, why UUID is changing.

    Please contact Gimbal about this, I think they are in a better position about it.

    Best regards,

    Simon

Children
No Data
Related