package com.sv.socket.event;

import com.common.DeviceDTO;
import com.sv.entity.Device;
import com.sv.socket.DeviceSocket;
import org.springframework.context.ApplicationEvent;

import java.io.Serializable;
import java.util.concurrent.CountDownLatch;

public class SocketConnectEvent extends ApplicationEvent implements Serializable {

    private DeviceDTO device;

    private CountDownLatch countDownLatch;

    private DeviceSocket deviceSocket;

    /**
     * Create a new ApplicationEvent.
     *
     * @param device the object on which the event initially occurred (never {@code null})
     */
    public SocketConnectEvent(DeviceDTO device,CountDownLatch countDownLatch,DeviceSocket deviceSocket) {
        super(device);
        this.device = device;
        this.countDownLatch = countDownLatch;
        this.deviceSocket = deviceSocket;
    }


    public DeviceDTO getDevice() {
        return device;
    }

    public CountDownLatch getCountDownLatch() {
        return countDownLatch;
    }

    public void setCountDownLatch(CountDownLatch countDownLatch) {
        this.countDownLatch = countDownLatch;
    }

    public DeviceSocket getDeviceSocket() {
        return deviceSocket;
    }

    public void setDeviceSocket(DeviceSocket deviceSocket) {
        this.deviceSocket = deviceSocket;
    }
}
