Home | History | Annotate | Download | only in bluetooth
      1 /*
      2  * Copyright (C) 2016 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 
     17 package android.bluetooth;
     18 
     19 import android.os.Parcel;
     20 import android.os.Parcelable;
     21 
     22 import android.util.Log;
     23 
     24 /**
     25  * Out Of Band Data for Bluetooth device pairing.
     26  *
     27  * <p>This object represents optional data obtained from a remote device through
     28  * an out-of-band channel (eg. NFC).
     29  *
     30  * @hide
     31  */
     32 public class OobData implements Parcelable {
     33     private byte[] securityManagerTk;
     34 
     35     public byte[] getSecurityManagerTk() {
     36         return securityManagerTk;
     37     }
     38 
     39     /**
     40      * Sets the Temporary Key value to be used by the LE Security Manager during
     41      * LE pairing. The value shall be 16 bytes. Please see Bluetooth CSSv6,
     42      * Part A 1.8 for a detailed description.
     43      */
     44     public void setSecurityManagerTk(byte[] securityManagerTk) {
     45         this.securityManagerTk = securityManagerTk;
     46     }
     47 
     48     public OobData() { }
     49 
     50     private OobData(Parcel in) {
     51         securityManagerTk = in.createByteArray();
     52     }
     53 
     54     public int describeContents() {
     55         return 0;
     56     }
     57 
     58     @Override
     59     public void writeToParcel(Parcel out, int flags) {
     60         out.writeByteArray(securityManagerTk);
     61     }
     62 
     63     public static final Parcelable.Creator<OobData> CREATOR
     64             = new Parcelable.Creator<OobData>() {
     65         public OobData createFromParcel(Parcel in) {
     66             return new OobData(in);
     67         }
     68 
     69         public OobData[] newArray(int size) {
     70             return new OobData[size];
     71         }
     72     };
     73 }