package com.phlx.anchorcollect.ble;

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

import cn.wandersnail.ble.Device;


public class BluetoothEntity implements Parcelable {
    private String name;
    private String address;
    private int rssi;
    private int bondState;
    private Device device;
    private BluetoothDevice bluetoothDevice;

    public BluetoothEntity() {
    }

    protected BluetoothEntity(Parcel in) {
        name = in.readString();
        address = in.readString();
        rssi = in.readInt();
        bondState = in.readInt();
        device = in.readParcelable(Device.class.getClassLoader());
        bluetoothDevice = in.readParcelable(BluetoothDevice.class.getClassLoader());
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(name);
        dest.writeString(address);
        dest.writeInt(rssi);
        dest.writeInt(bondState);
        dest.writeParcelable(device, flags);
        dest.writeParcelable(bluetoothDevice, flags);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<BluetoothEntity> CREATOR = new Creator<BluetoothEntity>() {
        @Override
        public BluetoothEntity createFromParcel(Parcel in) {
            return new BluetoothEntity(in);
        }

        @Override
        public BluetoothEntity[] newArray(int size) {
            return new BluetoothEntity[size];
        }
    };

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getRssi() {
        return rssi;
    }

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

    public int getBondState() {
        return bondState;
    }

    public void setBondState(int bondState) {
        this.bondState = bondState;
    }

    public Device getDevice() {
        return device;
    }

    public void setDevice(Device device) {
        this.device = device;
    }

    public BluetoothDevice getBluetoothDevice() {
        return bluetoothDevice;
    }

    public void setBluetoothDevice(BluetoothDevice bluetoothDevice) {
        this.bluetoothDevice = bluetoothDevice;
    }

    @Override
    public String toString() {
        return "BluetoothEntity{" +
                "name='" + name + '\'' +
                ", address='" + address + '\'' +
                ", rssi=" + rssi +
                ", bondState=" + bondState +
                ", device=" + device +
                ", bluetoothDevice=" + bluetoothDevice +
                '}';
    }
}
