package iot.lidee.bootstrap.tcp.config;

import iot.lidee.protocol.WModelManager;
import iot.lidee.base.core.HandlerMapping;
import iot.lidee.base.core.SpringHandlerMapping;
import iot.lidee.base.session.SessionListener;
import iot.lidee.base.session.SessionManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author bill
 */
@Configuration
public class TcpBeanConfig {

    @Bean
    public HandlerMapping handlerMapping(){
        return new SpringHandlerMapping();
    }

    @Bean
    public TcpHandlerInterceptor handlerInterceptor(){
        return new TcpHandlerInterceptor();
    }

    @Bean
    public SessionListener sessionListener(){
        return new TcpSessionListener();
    }

    @Bean
    public SessionManager sessionManager(SessionListener sessionListener){
        return new SessionManager(sessionListener);
    }

    @Bean
    public WModelManager wModelManager(){
        return new WModelManager("iot.lidee.modbus");
    }


}
