STM32WB55设置扫描广播包数据

/* Update Scan data */
	{
		uint8_t scan_data[31] = 
		{
			0x14, /*len 1*/ 
			AD_TYPE_MANUFACTURER_SPECIFIC_DATA,/*type 1*/ 
			0x7e, 0xff, /*manuf id 2*/ 
			/* The following are your payload */
			0x05, 0x01, /*type code 2*/ 
			0x01, 0x00, /*fun code 2*/
			0x10, 0x0a, /*fw ver 2*/ 
			0x01, 0x22, /*battery 2*/
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00,/*mac 6*/
			0x00, /*enroll flag 1*/ 
			0x32, /*protocol ver 1*/ 
			0x01, /*trigg reason 1*/
		};

		const uint8_t *bd_addr = BleGetBdAddress();
		/* set mac addr big endian */
		scan_data[12] = bd_addr[5];
		scan_data[13] = bd_addr[4];
		scan_data[14] = bd_addr[3];
		scan_data[15] = bd_addr[2];
		scan_data[16] = bd_addr[1];
		scan_data[17] = bd_addr[0];
		ret = hci_le_set_scan_response_data(scan_data[0]+1, scan_data);
		if(BLE_STATUS_SUCCESS == ret)
		{
			printf("set scan data ok \r\n");
		}
		else
		{
			printf("set scan data fail \r\n");
		}
    }
    /* Start Fast or Low Power Advertising */
    ret = aci_gap_set_discoverable(
        ADV_IND,/*普通可链接广播*/
        Min_Inter,
        Max_Inter,
        PUBLIC_ADDR,
        NO_WHITE_LIST_USE, /* use white list */
        sizeof(local_name),
        (uint8_t*) &local_name,
        BleApplicationContext.BleApplicationContext_legacy.advtServUUIDlen,
        BleApplicationContext.BleApplicationContext_legacy.advtServUUID,
        0,
        0);

猜你喜欢

转载自blog.csdn.net/qq_28851611/article/details/107399959