package com.hboxs.serialport.plc.message;

public class Message {
    public enum Type {
        connected,
        disconnected,
        response,
        sendError,
        ack,
        nak
    }

    private Object content;

    private Type type;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    private int id;

    public String getName() {
        return name;
    }

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

    /**
     * 判断当前发的是哪条指令
     */
    private String name;

    public Message(Object content, Type type) {
        this.content = content;
        this.type = type;
        name="none";
    }

    public Message(Object content, Type type, String name) {
        this.content = content;
        this.type = type;
        this.name=name;
    }

    public Message(Object content, Type type, int id, String name) {
        this.content = content;
        this.type = type;
        this.id=id;
        this.name=name;
    }

    public Object getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return "Message{" +
                "content=" + content +
                ", type=" + type +
                ", id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
}
