package com.jiayue.ipfcst.common.data.entity.sendertunnelinfo;

import com.jiayue.ipfcst.common.data.constant.enums.TunnelType;
import com.jiayue.ipfcst.common.data.entity.BaseTunnelInfo;
import com.jiayue.ipfcst.common.data.entity.ProtocolDataType;
import com.jiayue.ipfcst.common.data.entity.ProtocolSenderDataPoint;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Proxy;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;

/**
 * modbus协议tcp发送数据通道信息
 *
 * @author 修唯xiuwei
 * @version 3.0
 */
@EqualsAndHashCode(callSuper = true)
@Entity
@Data
@Proxy(lazy = false)
public class SenderModbusTcpTunnelInfo extends BaseTunnelInfo<ProtocolSenderDataPoint> {


    /**
     * 创建类时确定通道类型
     */
    public SenderModbusTcpTunnelInfo() {
        this.setTunnelType(TunnelType.MODBUSTCPSLAVE);
    }


    /**
     * 自身端口
     */
    @Column(length = 6)
    private Integer selfPort = 502;
    /**
     * 自身ip
     */
    @Column(length = 15)
    private String selfIp;
    /**
     * 功能码
     */
    @Column(length = 2)
    private Integer functionCode = 3;


    @Column(length = 2)
    @Enumerated(EnumType.STRING)
    private ProtocolDataType protocolDataType;

    /**
     * 设备地址
     */
    @Column(length = 4)
    private Integer slaveId = 1;

    /**
     * 远端ip
     */
    @Column
    private String remoteIp;


}
