MT7697 API Reference  LinkIt SDK v4
bt_uuid.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __BT_UUID_H__
36 #define __BT_UUID_H__
37 
71 #include "bt_platform.h"
72 #include "bt_type.h"
73 
74 #if defined(__ARMCC_VERSION)
75 #pragma anon_unions
76 #endif
77 
78 BT_EXTERN_C_BEGIN
79 
86 #define BT_UUID_INIT_WITH_UUID16(x) \
87  {{0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, \
88  0x00, 0x10, 0x00, 0x00, \
89  (uint8_t)x, \
90  (uint8_t)(x >> 8), \
91  0x00, 0x00}}
103 typedef union bt_uuid bt_uuid_t;
108 BT_PACKED(union bt_uuid{
109  uint8_t uuid[16];
110  BT_PACKED(struct {
111  uint32_t reserved1[3];
112  uint32_t uuid32;
113  });
114  BT_PACKED(struct {
115  uint16_t reserved2[6];
116  uint16_t uuid16;
117  uint16_t __zero16;
118  });
119 });
120 
131 void bt_uuid_copy(bt_uuid_t *dst, const bt_uuid_t *src);
132 
139 bool bt_uuid_equal(const bt_uuid_t *uuid1, const bt_uuid_t *uuid2);
140 
146 bool bt_uuid_is_uuid32(const bt_uuid_t *uuid);
147 
153 bool bt_uuid_is_uuid16(const bt_uuid_t *uuid);
154 
162 void bt_uuid_load(bt_uuid_t *dst, const void *src, const uint8_t src_size);
163 
170 void bt_uuid_from_uuid16(bt_uuid_t *dst, const uint16_t uuid16);
171 
178 void bt_uuid_from_uuid32(bt_uuid_t *dst, const uint32_t uuid32);
179 
180 BT_EXTERN_C_END
181 
188 #endif /*__BT_UUID_H__*/
void bt_uuid_copy(bt_uuid_t *dst, const bt_uuid_t *src)
This function copies the UUID from another UUID.
bool bt_uuid_is_uuid16(const bt_uuid_t *uuid)
This function checks if it is a 16-bit UUID.
void bt_uuid_from_uuid16(bt_uuid_t *dst, const uint16_t uuid16)
This function converts the UUID in 16-bit integer format to bt_uuid_t structure.
bool bt_uuid_is_uuid32(const bt_uuid_t *uuid)
This function checks if it is a 32-bit UUID.
void bt_uuid_load(bt_uuid_t *dst, const void *src, const uint8_t src_size)
This function converts the UUID stored as a number in string format to bt_uuid_t structure.
bool bt_uuid_equal(const bt_uuid_t *uuid1, const bt_uuid_t *uuid2)
This function checks if two UUIDs are identical.
void bt_uuid_from_uuid32(bt_uuid_t *dst, const uint32_t uuid32)
This function converts the UUID in 32-bit integer format to bt_uuid_t structure.
bt_uuid union.
Definition: bt_uuid.h:124