package com.zd.laboratory.event;

import com.zd.laboratory.mqtt.service.impl.SubMessageSendManager;
import com.zd.laboratory.service.impl.LabSubjectManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * 传感器 状态监听
 *
 * @author liubo
 */
@Component
public class SensorStatusListener implements ApplicationListener <SensorStatusEvent> {

    @Autowired
    private SubMessageSendManager subMessageSendManager;

    @Autowired
    private LabSubjectManagerService subjectManagerService;


    @Override
    public void onApplicationEvent(SensorStatusEvent sensorStatusEvent) {

        subMessageSendManager.sendSensorNews(sensorStatusEvent.getSource());
    }
}
