blob: a1e2f7b51f35646a17f1ebb3e754a6d468e149be [file] [log] [blame]
Casper Bondeda177bb2015-04-16 15:28:21 +02001/*
2 * Copyright (C) 2015 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
17package android.bluetooth;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22/** @hide */
23public class SdpSapsRecord implements Parcelable {
24 private final int mRfcommChannelNumber;
25 private final int mProfileVersion;
26 private final String mServiceName;
27
Jack He2992cd02017-08-22 21:21:23 -070028 public SdpSapsRecord(int rfcommChannelNumber, int profileVersion, String serviceName) {
29 mRfcommChannelNumber = rfcommChannelNumber;
30 mProfileVersion = profileVersion;
31 mServiceName = serviceName;
Casper Bondeda177bb2015-04-16 15:28:21 +020032 }
33
34 public SdpSapsRecord(Parcel in) {
Jack He2992cd02017-08-22 21:21:23 -070035 mRfcommChannelNumber = in.readInt();
36 mProfileVersion = in.readInt();
37 mServiceName = in.readString();
Casper Bondeda177bb2015-04-16 15:28:21 +020038 }
39
40 @Override
41 public int describeContents() {
Jack Hea355e5e2017-08-22 16:06:54 -070042 return 0;
Casper Bondeda177bb2015-04-16 15:28:21 +020043 }
44
45 public int getRfcommCannelNumber() {
46 return mRfcommChannelNumber;
47 }
48
49 public int getProfileVersion() {
50 return mProfileVersion;
51 }
52
53 public String getServiceName() {
54 return mServiceName;
55 }
56
57 @Override
58 public void writeToParcel(Parcel dest, int flags) {
Jack He2992cd02017-08-22 21:21:23 -070059 dest.writeInt(mRfcommChannelNumber);
60 dest.writeInt(mProfileVersion);
61 dest.writeString(mServiceName);
Casper Bondeda177bb2015-04-16 15:28:21 +020062
63 }
64
65 @Override
66 public String toString() {
67 String ret = "Bluetooth MAS SDP Record:\n";
68
69 if (mRfcommChannelNumber != -1) {
70 ret += "RFCOMM Chan Number: " + mRfcommChannelNumber + "\n";
71 }
72 if (mServiceName != null) {
73 ret += "Service Name: " + mServiceName + "\n";
74 }
75 if (mProfileVersion != -1) {
76 ret += "Profile version: " + mProfileVersion + "\n";
77 }
78 return ret;
79 }
80
81 public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
82 public SdpSapsRecord createFromParcel(Parcel in) {
83 return new SdpSapsRecord(in);
84 }
Jack Hea355e5e2017-08-22 16:06:54 -070085
Casper Bondeda177bb2015-04-16 15:28:21 +020086 public SdpRecord[] newArray(int size) {
87 return new SdpRecord[size];
88 }
89 };
90}