1 /*
2  * Copyright (c) 2023 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <stdint.h>
8 
9 #include <zephyr/kernel.h>
10 
11 #include <zephyr/bluetooth/gap.h>
12 #include <zephyr/bluetooth/bluetooth.h>
13 
14 #include "common.h"
15 
16 #define LF_ID_MSB ((BT_COMP_ID_LF >> 8) & 0xff)
17 #define LF_ID_LSB ((BT_COMP_ID_LF) & 0xff)
18 
19 #define AD_DATA_0_SIZE 10
20 static uint8_t ad_data_0[] = {'E', 'A', 'D', ' ', 'S', 'a', 'm', 'p', 'l', 'e'};
21 BUILD_ASSERT(sizeof(ad_data_0) == AD_DATA_0_SIZE);
22 
23 #define AD_DATA_1_SIZE 8
24 static uint8_t ad_data_1[] = {LF_ID_MSB, LF_ID_LSB, 'Z', 'e', 'p', 'h', 'y', 'r'};
25 BUILD_ASSERT(sizeof(ad_data_1) == AD_DATA_1_SIZE);
26 
27 #define AD_DATA_2_SIZE 7
28 static uint8_t ad_data_2[] = {LF_ID_MSB, LF_ID_LSB, 0x49, 0xd2, 0xf4, 0x55, 0x76};
29 BUILD_ASSERT(sizeof(ad_data_2) == AD_DATA_2_SIZE);
30 
31 #define AD_DATA_3_SIZE 4
32 static uint8_t ad_data_3[] = {LF_ID_MSB, LF_ID_LSB, 0xc1, 0x25};
33 BUILD_ASSERT(sizeof(ad_data_3) == AD_DATA_3_SIZE);
34 
35 #define AD_DATA_4_SIZE 3
36 static uint8_t ad_data_4[] = {LF_ID_MSB, LF_ID_LSB, 0x17};
37 BUILD_ASSERT(sizeof(ad_data_4) == AD_DATA_4_SIZE);
38 
39 static const struct bt_data ad[] = {
40 	BT_DATA(BT_DATA_NAME_COMPLETE, ad_data_0, sizeof(ad_data_0)),
41 	BT_DATA(BT_DATA_MANUFACTURER_DATA, ad_data_1, sizeof(ad_data_1)),
42 	BT_DATA(BT_DATA_MANUFACTURER_DATA, ad_data_2, sizeof(ad_data_2)),
43 	BT_DATA(BT_DATA_MANUFACTURER_DATA, ad_data_3, sizeof(ad_data_3)),
44 	BT_DATA(BT_DATA_MANUFACTURER_DATA, ad_data_4, sizeof(ad_data_4)),
45 };
46 
47 static struct key_material mk = {
48 	.session_key = {0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB,
49 			0xCC, 0xCD, 0xCE, 0xCF},
50 	.iv = {0xFB, 0x56, 0xE1, 0xDA, 0xDC, 0x7E, 0xAD, 0xF5},
51 };
52