Home | History | Annotate | Download | only in bluetooth
      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 import java.util.Arrays;
     22 
     23 /** @hide */
     24 public class SdpRecord implements Parcelable{
     25 
     26     private final byte[] mRawData;
     27     private final int mRawSize;
     28 
     29     @Override
     30     public String toString() {
     31         return "BluetoothSdpRecord [rawData=" + Arrays.toString(mRawData)
     32                 + ", rawSize=" + mRawSize + "]";
     33     }
     34 
     35     public SdpRecord(int size_record, byte[] record){
     36         this.mRawData = record;
     37         this.mRawSize = size_record;
     38     }
     39 
     40     public SdpRecord(Parcel in){
     41         this.mRawSize = in.readInt();
     42         this.mRawData = new byte[mRawSize];
     43         in.readByteArray(this.mRawData);
     44 
     45     }
     46 
     47     @Override
     48     public int describeContents() {
     49         return 0;
     50     }
     51 
     52     @Override
     53     public void writeToParcel(Parcel dest, int flags) {
     54         dest.writeInt(this.mRawSize);
     55         dest.writeByteArray(this.mRawData);
     56 
     57 
     58     }
     59     public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
     60         public SdpRecord createFromParcel(Parcel in) {
     61             return new SdpRecord(in);
     62         }
     63 
     64         public SdpRecord[] newArray(int size) {
     65             return new SdpRecord[size];
     66         }
     67     };
     68 
     69     public byte[] getRawData() {
     70         return mRawData;
     71     }
     72 
     73     public int getRawSize() {
     74         return mRawSize;
     75     }
     76 }
     77