1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.bluetooth.gatt;
18 
19 import java.util.ArrayList;
20 import java.util.Iterator;
21 import java.util.List;
22 import java.util.UUID;
23 
24 /**
25  * Helper class for passing gatt db elements between java and JNI, equal to
26  * native btgatt_db_element_t.
27  * @hide
28  */
29 public class GattDbElement {
30 
31     public static final int TYPE_PRIMARY_SERVICE = 0;
32     public static final int TYPE_SECONDARY_SERVICE = 1;
33     public static final int TYPE_INCLUDED_SERVICE = 2;
34     public static final int TYPE_CHARACTERISTIC = 3;
35     public static final int TYPE_DESCRIPTOR = 4;
36 
GattDbElement()37     public GattDbElement() {}
38 
39     public int id;
40     public UUID uuid;
41     public int type;
42     public int attributeHandle;
43 
44     /*
45      * If type is TYPE_PRIMARY_SERVICE, or TYPE_SECONDARY_SERVICE,
46      * this contains the start and end attribute handles.
47      */
48     public int startHandle;
49     public int endHandle;
50 
51     /*
52      * If type is TYPE_CHARACTERISTIC, this contains the properties of
53      * the characteristic.
54      */
55     public int properties;
56 }