This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

scan and parse manufacturer specific data (zephyr)

Hi. 

Hope someone could help me on how to scan and parse the Manufacturer Specific Data that comes after the Company ID. I am using zephyr with nRF52840.

Thanks!

Parents
  • Hi

    My colleague has provided you with what should be a working example in your private ticket, and has requested that you continue the discussion there.

    For any other DevZone users finding this thread, modify the Zephyr beacon sample accordingly:

    static char mfg_data[] = "simon_manuf";
    
    static const struct bt_data ad[] = {
    	BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data, sizeof(mfg_data)),
    };

    Program that onto I.E. an nRF52840 DK or Dongle, then modify the observer sample like this and program that onto another DK:

    static bool data_cb(struct bt_data *data, void *user_data)
    {
    	char *name = user_data;
    	uint8_t len;
    
    	switch (data->type) {
    	case BT_DATA_MANUFACTURER_DATA:
    		len = MIN(data->data_len, NAME_LEN - 1);
    		memcpy(name, data->data, len);
    		name[len] = '\0';
    		return false;
    	default:
    		return true;
    	}
    }

    Best regards,

    Simon

Reply
  • Hi

    My colleague has provided you with what should be a working example in your private ticket, and has requested that you continue the discussion there.

    For any other DevZone users finding this thread, modify the Zephyr beacon sample accordingly:

    static char mfg_data[] = "simon_manuf";
    
    static const struct bt_data ad[] = {
    	BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data, sizeof(mfg_data)),
    };

    Program that onto I.E. an nRF52840 DK or Dongle, then modify the observer sample like this and program that onto another DK:

    static bool data_cb(struct bt_data *data, void *user_data)
    {
    	char *name = user_data;
    	uint8_t len;
    
    	switch (data->type) {
    	case BT_DATA_MANUFACTURER_DATA:
    		len = MIN(data->data_len, NAME_LEN - 1);
    		memcpy(name, data->data, len);
    		name[len] = '\0';
    		return false;
    	default:
    		return true;
    	}
    }

    Best regards,

    Simon

Children
No Data
Related