package com.fxy.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 蓝牙对象
 *
 * @author qin.guilin
 *
 */
public class ScanBean implements Parcelable {

    public String device_name;
    public String action;
    public String data_name;
    public int is_broadcast = 1 ;
    public String status_name = "";
    public String action_stop = "";
    public int scan_id = 0 ;
    public String manufacturer="";
    public String device_model="";
    public int is_api = 1;


    public String toJsonString(){
        return "{\"scan_id\":"+scan_id+"," +
                "\"manufacturer\":\""+manufacturer+"\"," +
                "\"device_model\":\""+device_model+"\"," +
                "\"action\":\""+action+"\"," +
                "\"is_broadcast\":"+is_broadcast+"," +
                "\"data_name\":\""+data_name+"\"," +
                "\"status_name\":\""+status_name+"\"," +
                "\"is_api\":"+is_api+"," +
                "\"device_name\":\""+device_name+"\",}";

    }

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

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.device_name);
        dest.writeString(this.action);
        dest.writeString(this.data_name);
        dest.writeString(this.status_name);
        dest.writeInt(this.is_broadcast);
        dest.writeString(this.action_stop);
        dest.writeInt(this.scan_id);
        dest.writeString(this.manufacturer);
        dest.writeString(this.device_model);
        dest.writeInt(this.is_api);
    }

    public ScanBean() {
    }

    protected ScanBean(Parcel in) {
        this.device_name     = in.readString();
        this.action     = in.readString();
        this.data_name = in.readString();
        this.status_name    = in.readString();
        this.is_broadcast = in.readInt();
        this.action_stop     = in.readString();
        this.scan_id = in.readInt();
        this.manufacturer = in.readString();
        this.device_model = in.readString();
        this.is_api = in.readInt();
    }

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

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

    public String getDeviceName() {
        return device_name;
    }
    public String getAction() {
        return action;
    }
    public String getDataName() {
        return data_name;
    }
    public String getStatusName() {
        return status_name;
    }

    public Integer getBroadcast() {
        return is_broadcast;
    }

    public Integer getIsBroadcast() {
        return  is_broadcast;
    }
    public void setIsBroadcast(Integer isBroadcast) {
        this.is_broadcast = isBroadcast;
    }

    public String getActionStop() {
        return action_stop;
    }

    public int getCanId() {
        return scan_id;
    }

    public String getManufacturer(){
        return manufacturer;
    }

    public int getIsApi(){
        return is_api;
    }
}
