• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 package android.bluetooth;
17 
18 import android.os.Parcel;
19 import android.os.Parcelable;
20 
21 /** @hide */
22 public class SdpPseRecord implements Parcelable {
23     private final int mL2capPsm;
24     private final int mRfcommChannelNumber;
25     private final int mProfileVersion;
26     private final int mSupportedFeatures;
27     private final int mSupportedRepositories;
28     private final String mServiceName;
29 
SdpPseRecord(int l2cap_psm, int rfcomm_channel_number, int profile_version, int supported_features, int supported_repositories, String service_name)30     public SdpPseRecord(int l2cap_psm,
31             int rfcomm_channel_number,
32             int profile_version,
33             int supported_features,
34             int supported_repositories,
35             String service_name){
36         this.mL2capPsm = l2cap_psm;
37         this.mRfcommChannelNumber = rfcomm_channel_number;
38         this.mProfileVersion = profile_version;
39         this.mSupportedFeatures = supported_features;
40         this.mSupportedRepositories = supported_repositories;
41         this.mServiceName = service_name;
42     }
43 
SdpPseRecord(Parcel in)44     public SdpPseRecord(Parcel in){
45            this.mRfcommChannelNumber = in.readInt();
46            this.mL2capPsm = in.readInt();
47            this.mProfileVersion = in.readInt();
48            this.mSupportedFeatures = in.readInt();
49            this.mSupportedRepositories = in.readInt();
50            this.mServiceName = in.readString();
51     }
52     @Override
describeContents()53     public int describeContents() {
54         // TODO Auto-generated method stub
55         return 0;
56     }
57 
getL2capPsm()58     public int getL2capPsm() {
59         return mL2capPsm;
60     }
61 
getRfcommChannelNumber()62     public int getRfcommChannelNumber() {
63         return mRfcommChannelNumber;
64     }
65 
getSupportedFeatures()66     public int getSupportedFeatures() {
67         return mSupportedFeatures;
68     }
69 
getServiceName()70     public String getServiceName() {
71         return mServiceName;
72     }
73 
getProfileVersion()74     public int getProfileVersion() {
75         return mProfileVersion;
76     }
77 
getSupportedRepositories()78     public int getSupportedRepositories() {
79         return mSupportedRepositories;
80     }
81     @Override
writeToParcel(Parcel dest, int flags)82     public void writeToParcel(Parcel dest, int flags) {
83         dest.writeInt(mRfcommChannelNumber);
84         dest.writeInt(mL2capPsm);
85         dest.writeInt(mProfileVersion);
86         dest.writeInt(mSupportedFeatures);
87         dest.writeInt(mSupportedRepositories);
88         dest.writeString(mServiceName);
89 
90     }
91 
toString()92     public String toString(){
93         String ret = "Bluetooth MNS SDP Record:\n";
94 
95         if(mRfcommChannelNumber != -1){
96             ret += "RFCOMM Chan Number: " + mRfcommChannelNumber + "\n";
97         }
98         if(mL2capPsm != -1){
99             ret += "L2CAP PSM: " + mL2capPsm + "\n";
100         }
101         if(mProfileVersion != -1){
102             ret += "profile version: " + mProfileVersion + "\n";
103         }
104         if(mServiceName != null){
105             ret += "Service Name: " + mServiceName + "\n";
106         }
107         if(mSupportedFeatures != -1){
108             ret += "Supported features: " + mSupportedFeatures + "\n";
109         }
110         if(mSupportedRepositories != -1){
111             ret += "Supported repositories: " + mSupportedRepositories + "\n";
112         }
113 
114         return ret;
115     }
116 
117     public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
118         public SdpPseRecord createFromParcel(Parcel in) {
119             return new SdpPseRecord(in);
120         }
121         public SdpPseRecord[] newArray(int size) {
122             return new SdpPseRecord[size];
123         }
124     };
125 }
126