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 android.os.Parcel;
18 import android.os.Parcelable;
19 
20 /** Data representation of a Object Push Profile Server side SDP record. */
21 /** @hide */
22 public class SdpDipRecord implements Parcelable {
23     private final int mSpecificationId;
24     private final int mVendorId;
25     private final int mVendorIdSource;
26     private final int mProductId;
27     private final int mVersion;
28     private final boolean mPrimaryRecord;
29 
SdpDipRecord( int specificationId, int vendorId, int vendorIdSource, int productId, int version, boolean primaryRecord)30     public SdpDipRecord(
31             int specificationId,
32             int vendorId,
33             int vendorIdSource,
34             int productId,
35             int version,
36             boolean primaryRecord) {
37         super();
38         this.mSpecificationId = specificationId;
39         this.mVendorId = vendorId;
40         this.mVendorIdSource = vendorIdSource;
41         this.mProductId = productId;
42         this.mVersion = version;
43         this.mPrimaryRecord = primaryRecord;
44     }
45 
SdpDipRecord(Parcel in)46     public SdpDipRecord(Parcel in) {
47         this.mSpecificationId = in.readInt();
48         this.mVendorId = in.readInt();
49         this.mVendorIdSource = in.readInt();
50         this.mProductId = in.readInt();
51         this.mVersion = in.readInt();
52         this.mPrimaryRecord = in.readBoolean();
53     }
54 
getSpecificationId()55     public int getSpecificationId() {
56         return mSpecificationId;
57     }
58 
getVendorId()59     public int getVendorId() {
60         return mVendorId;
61     }
62 
getVendorIdSource()63     public int getVendorIdSource() {
64         return mVendorIdSource;
65     }
66 
getProductId()67     public int getProductId() {
68         return mProductId;
69     }
70 
getVersion()71     public int getVersion() {
72         return mVersion;
73     }
74 
getPrimaryRecord()75     public boolean getPrimaryRecord() {
76         return mPrimaryRecord;
77     }
78 
79     @Override
writeToParcel(Parcel dest, int flags)80     public void writeToParcel(Parcel dest, int flags) {
81         dest.writeInt(mSpecificationId);
82         dest.writeInt(mVendorId);
83         dest.writeInt(mVendorIdSource);
84         dest.writeInt(mProductId);
85         dest.writeInt(mVersion);
86         dest.writeBoolean(mPrimaryRecord);
87     }
88 
89     @Override
describeContents()90     public int describeContents() {
91         /* No special objects */
92         return 0;
93     }
94 
95     public static final Parcelable.Creator CREATOR =
96             new Parcelable.Creator() {
97                 public SdpDipRecord createFromParcel(Parcel in) {
98                     return new SdpDipRecord(in);
99                 }
100 
101                 public SdpDipRecord[] newArray(int size) {
102                     return new SdpDipRecord[size];
103                 }
104             };
105 }
106