package com.epson.mobilephone.common.ble.util;

import android.bluetooth.BluetoothDevice;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;

public class ScannedDevice implements Parcelable {
    public static final Parcelable.Creator<ScannedDevice> CREATOR = new Parcelable.Creator<ScannedDevice>() {
        public ScannedDevice createFromParcel(Parcel parcel) {
            return new ScannedDevice(parcel);
        }

        public ScannedDevice[] newArray(int i) {
            return new ScannedDevice[i];
        }
    };
    public static final int HIGH_SIGNAL = -60;
    public static final int INVALID_SIGNAL = 127;
    public static final int LOW_SIGNAL = -75;
    public static final int MID_SIGNAL = -70;
    public static final String TYPE = "ScannedDevice";
    private static final String UNKNOWN = "Unknown";
    private BluetoothDevice mDevice;
    private String mDisplayName;
    private byte[] mHardwareType;
    private int mRssi;

    public int describeContents() {
        return 0;
    }

    protected ScannedDevice(Parcel parcel) {
        this.mDevice = (BluetoothDevice) parcel.readParcelable(BluetoothDevice.class.getClassLoader());
        this.mRssi = parcel.readInt();
        this.mDisplayName = parcel.readString();
        this.mHardwareType = parcel.createByteArray();
    }

    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeParcelable(this.mDevice, i);
        parcel.writeInt(this.mRssi);
        parcel.writeString(this.mDisplayName);
        parcel.writeByteArray(this.mHardwareType);
    }

    public ScannedDevice(BluetoothDevice bluetoothDevice, int i, String str, byte[] bArr) {
        if (bluetoothDevice != null) {
            this.mDevice = bluetoothDevice;
            if (Build.VERSION.SDK_INT >= 21) {
                this.mDisplayName = str;
            } else {
                this.mDisplayName = this.mDevice.getName();
            }
            String str2 = this.mDisplayName;
            if (str2 == null || str2.length() == 0) {
                this.mDisplayName = UNKNOWN;
            }
            this.mRssi = i;
            this.mHardwareType = bArr;
            return;
        }
        throw new IllegalArgumentException("BluetoothDevice is null");
    }

    public BluetoothDevice getDevice() {
        return this.mDevice;
    }

    public int getRssi() {
        return this.mRssi;
    }

    public void setRssi(int i) {
        this.mRssi = i;
    }

    public byte[] getHardwareType() {
        return this.mHardwareType;
    }

    public String getDisplayName() {
        return this.mDisplayName;
    }
}
