LedHandlerFengLiYuan.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package com.gzlh.device.led.handler.impl;
  2. import cn.hutool.core.util.StrUtil;
  3. import com.gzlh.bus.EventDataManager;
  4. import com.gzlh.device.led.action.LedAction;
  5. import com.gzlh.device.led.brand.LedBrandType;
  6. import com.gzlh.device.led.client.LedNettyConfig;
  7. import com.gzlh.device.led.handler.ILedHandler;
  8. import com.gzlh.device.led.utils.FengLiYuanPackUtils;
  9. import com.gzlh.device.led.utils.LedOptions;
  10. import lombok.extern.slf4j.Slf4j;
  11. import org.springframework.stereotype.Service;
  12. import javax.annotation.Resource;
  13. @Service
  14. @Slf4j
  15. public class LedHandlerFengLiYuan implements ILedHandler {
  16. @Resource
  17. LedNettyConfig ledNettyConfig;
  18. @Override
  19. public LedBrandType brandType() {
  20. return LedBrandType.FEND_LI_YUAN;
  21. }
  22. @Override
  23. public void sendMsg(String content, LedOptions options) {
  24. log.info("丰利源发送led消息:{}",content);
  25. String msgHex= FengLiYuanPackUtils.build(content,options);
  26. log.info("数据包:{}",msgHex);
  27. ledNettyConfig.send(msgHex);
  28. }
  29. @Override
  30. public void handlerAction(String action) {
  31. if (StrUtil.contains(action, LedAction.LED_SHOW_CONTENT)) {
  32. //展示内容
  33. if (StrUtil.contains(action,"platNo")){
  34. String carNo= EventDataManager.getCacheData().getCarNo();
  35. LedOptions ledOptions=new LedOptions();
  36. ledOptions.setColor("05").setLine("02").setShowType("0B");
  37. sendMsg(carNo,ledOptions);
  38. }
  39. }
  40. }
  41. }