Files
jsowell-charger-web/jsowell-netty/src/main/java/com/jsowell/netty/handler/RemoteUpdateHandler.java
2023-03-04 16:29:55 +08:00

59 lines
1.8 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.jsowell.netty.handler;
import com.alibaba.fastjson2.JSONObject;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.util.YKCUtils;
import com.jsowell.netty.factory.YKCOperateFactory;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 远程更新
*
* 对桩进行软件升级,平台升级模式为 ftp 文件升级,由桩企提供升级需要的更新文件(特定文件名, 由桩企定义)
* 平台在数据帧中提供访问更新文件相关服务器地址及下载路径信息, 桩下载完更新程序后对文件进行较验,并对桩进行升级
*
* @author JS-ZZA
* @date 2022/9/19 15:56
*/
@Slf4j
@Component
public class RemoteUpdateHandler extends AbstractHandler{
private final String type = YKCUtils.frameType2Str(YKCFrameTypeCode.REMOTE_UPDATE_CODE.getBytes());
@Override
public void afterPropertiesSet() throws Exception {
YKCOperateFactory.register(type, this);
}
@Override
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
log.info("[===远程更新===] param:{}, channel:{}", JSONObject.toJSONString(ykcDataProtocol), channel.toString());
// 下发
// 桩编号
// 桩型号 0x01直流 0x02交流
// 桩功率 不足 2 位补零
// 升级服务器地址 不足 16 位补零
// 升级服务器端口 不足 2 位补零
// 用户名 不足 16 位补零
// 密码 不足 16 位补零
// 文件路径 不足 32 位补零,文件路径名由平 台定义
// 执行控制 0x01立即执行 0x02空闲执行
// 下载超时时间 单位: min
return null;
}
}