1 /*
2 * Copyright (C) 2015 Samsung System LSI
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *      http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 package android.bluetooth;
16 
17 import java.util.Arrays;
18 
19 import android.os.Parcel;
20 import android.os.Parcelable;
21 
22 /**
23  * Data representation of a Object Push Profile Server side SDP record.
24  */
25 /** @hide */
26 public class SdpDipRecord implements Parcelable {
27     private final int mSpecificationId;
28     private final int mVendorId;
29     private final int mVendorIdSource;
30     private final int mProductId;
31     private final int mVersion;
32     private final boolean mPrimaryRecord;
33 
SdpDipRecord(int specificationId, int vendorId, int vendorIdSource, int productId, int version, boolean primaryRecord)34     public SdpDipRecord(int specificationId,
35             int vendorId, int vendorIdSource,
36             int productId, int version,
37             boolean primaryRecord) {
38         super();
39         this.mSpecificationId = specificationId;
40         this.mVendorId = vendorId;
41         this.mVendorIdSource = vendorIdSource;
42         this.mProductId = productId;
43         this.mVersion = version;
44         this.mPrimaryRecord = primaryRecord;
45     }
46 
SdpDipRecord(Parcel in)47     public SdpDipRecord(Parcel in) {
48         this.mSpecificationId = in.readInt();
49         this.mVendorId = in.readInt();
50         this.mVendorIdSource = in.readInt();
51         this.mProductId = in.readInt();
52         this.mVersion = in.readInt();
53         this.mPrimaryRecord = in.readBoolean();
54     }
55 
getSpecificationId()56     public int getSpecificationId() {
57         return mSpecificationId;
58     }
59 
getVendorId()60     public int getVendorId() {
61         return mVendorId;
62     }
63 
getVendorIdSource()64     public int getVendorIdSource() {
65         return mVendorIdSource;
66     }
67 
getProductId()68     public int getProductId() {
69         return mProductId;
70     }
71 
getVersion()72     public int getVersion() {
73         return mVersion;
74     }
75 
getPrimaryRecord()76     public boolean getPrimaryRecord() {
77         return mPrimaryRecord;
78     }
79 
80     @Override
writeToParcel(Parcel dest, int flags)81     public void writeToParcel(Parcel dest, int flags) {
82         dest.writeInt(mSpecificationId);
83         dest.writeInt(mVendorId);
84         dest.writeInt(mVendorIdSource);
85         dest.writeInt(mProductId);
86         dest.writeInt(mVersion);
87         dest.writeBoolean(mPrimaryRecord);
88     }
89 
90     @Override
describeContents()91     public int describeContents() {
92         /* No special objects */
93         return 0;
94     }
95 
96     public static  final Parcelable.Creator CREATOR = new Parcelable.Creator() {
97         public SdpDipRecord createFromParcel(Parcel in) {
98             return new SdpDipRecord(in);
99         }
100         public SdpDipRecord[] newArray(int size) {
101             return new SdpDipRecord[size];
102         }
103     };
104 }
105