package com.gzlh.device.led.handler.impl; import cn.hutool.core.util.StrUtil; import com.gzlh.bus.EventDataManager; import com.gzlh.device.led.action.LedAction; import com.gzlh.device.led.brand.LedBrandType; import com.gzlh.device.led.client.LedNettyConfig; import com.gzlh.device.led.handler.ILedHandler; import com.gzlh.device.led.utils.FengLiYuanPackUtils; import com.gzlh.device.led.utils.LedOptions; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; @Service @Slf4j public class LedHandlerFengLiYuan implements ILedHandler { @Resource LedNettyConfig ledNettyConfig; @Override public LedBrandType brandType() { return LedBrandType.FEND_LI_YUAN; } @Override public void sendMsg(String content, LedOptions options) { log.info("丰利源发送led消息:{}",content); String msgHex= FengLiYuanPackUtils.build(content,options); log.info("数据包:{}",msgHex); ledNettyConfig.send(msgHex); } @Override public void handlerAction(String action) { if (StrUtil.contains(action, LedAction.LED_SHOW_CONTENT)) { //展示内容 if (StrUtil.contains(action,"platNo")){ String carNo= EventDataManager.getCacheData().getCarNo(); LedOptions ledOptions=new LedOptions(); ledOptions.setColor("05").setLine("02").setShowType("0B"); sendMsg(carNo,ledOptions); } } } }