1 /*
2  * Copyright (C) 2014 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 package com.android.bluetooth.gatt;
17 
18 /**
19  * Helper class that keeps track of callback parameters for app callbacks. These are held during
20  * congestion and reported when congestion clears.
21  */
22 public class CallbackInfo {
23     public String address;
24     public int status;
25     public int handle;
26     public byte[] value;
27 
28     static class Builder {
29         private String mAddress;
30         private int mStatus;
31         private int mHandle;
32         private byte[] mValue;
33 
Builder(String address, int status)34         Builder(String address, int status) {
35             mAddress = address;
36             mStatus = status;
37         }
38 
setHandle(int handle)39         Builder setHandle(int handle) {
40             mHandle = handle;
41             return this;
42         }
43 
setValue(byte[] value)44         Builder setValue(byte[] value) {
45             mValue = value;
46             return this;
47         }
48 
build()49         CallbackInfo build() {
50             return new CallbackInfo(mAddress, mStatus, mHandle, mValue);
51         }
52     }
53 
CallbackInfo(String address, int status, int handle, byte[] value)54     private CallbackInfo(String address, int status, int handle, byte[] value) {
55         this.address = address;
56         this.status = status;
57         this.handle = handle;
58         this.value = value;
59     }
60 }
61