1 /*
2  * Copyright (c) 2023 Nordic Semiconductor
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "gatt_common.h"
8 #include <zephyr/logging/log.h>
9 LOG_MODULE_REGISTER(gatt_common);
10 
bt_mesh_test_parse_mesh_gatt_preamble(struct net_buf_simple * buf)11 void bt_mesh_test_parse_mesh_gatt_preamble(struct net_buf_simple *buf)
12 {
13 	ASSERT_EQUAL(0x0201, net_buf_simple_pull_be16(buf));
14 	/* flags */
15 	(void)net_buf_simple_pull_u8(buf);
16 	ASSERT_EQUAL(0x0303, net_buf_simple_pull_be16(buf));
17 }
18 
bt_mesh_test_parse_mesh_pb_gatt_service(struct net_buf_simple * buf)19 void bt_mesh_test_parse_mesh_pb_gatt_service(struct net_buf_simple *buf)
20 {
21 	/* MshPRT Figure 7.1: PB-GATT Advertising Data */
22 	/* mesh provisioning service */
23 	ASSERT_EQUAL(0x2718, net_buf_simple_pull_be16(buf));
24 	ASSERT_EQUAL(0x1516, net_buf_simple_pull_be16(buf));
25 	/* mesh provisioning service */
26 	ASSERT_EQUAL(0x2718, net_buf_simple_pull_be16(buf));
27 }
28 
bt_mesh_test_parse_mesh_proxy_service(struct net_buf_simple * buf)29 void bt_mesh_test_parse_mesh_proxy_service(struct net_buf_simple *buf)
30 {
31 	/* MshPRT Figure 7.2: Advertising with Network ID (Identification Type 0x00) */
32 	/* mesh proxy service */
33 	ASSERT_EQUAL(0x2818, net_buf_simple_pull_be16(buf));
34 	ASSERT_EQUAL(0x0c16, net_buf_simple_pull_be16(buf));
35 	/* mesh proxy service */
36 	ASSERT_EQUAL(0x2818, net_buf_simple_pull_be16(buf));
37 	/* network ID */
38 	ASSERT_EQUAL(0x00, net_buf_simple_pull_u8(buf));
39 }
40