update 电单车协议

This commit is contained in:
Guoqs
2024-08-26 10:13:02 +08:00
parent f0c2869590
commit f27773ba05
12 changed files with 123 additions and 85 deletions

View File

@@ -9,6 +9,7 @@ import com.jsowell.common.enums.ykc.PileChannelEntity;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.CRC16Util;
import com.jsowell.common.util.DateUtils;
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
import io.netty.channel.ChannelHandlerContext;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
@@ -25,17 +26,7 @@ public abstract class AbstractEBikeHandler implements InitializingBean {
* 执行逻辑
* 有应答
*/
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, ChannelHandlerContext ctx) {
throw new UnsupportedOperationException();
}
/**
* 执行逻辑
* 不需要应答
*/
// public void pushProcess() {
// throw new UnsupportedOperationException();
// }
public abstract byte[] supplyProcess(Class<? extends AbsEBikeMessage> msg, ChannelHandlerContext ctx);
/**
* 组装应答的结果

View File

@@ -1,7 +1,9 @@
package com.jsowell.netty.handler.electricbicycles;
import com.jsowell.common.core.domain.ebike.EBikeCommandEnum;
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
import com.jsowell.pile.domain.ebike.EBikeCommandEnum;
import com.jsowell.netty.factory.EBikeOperateFactory;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -17,4 +19,16 @@ public class GetServerTimeHandler extends AbstractEBikeHandler {
public void afterPropertiesSet() throws Exception {
EBikeOperateFactory.register(type, this);
}
/**
* 执行逻辑
* 有应答
*
* @param msg
* @param ctx
*/
@Override
public byte[] supplyProcess(Class<? extends AbsEBikeMessage> msg, ChannelHandlerContext ctx) {
return new byte[0];
}
}

View File

@@ -1,7 +1,9 @@
package com.jsowell.netty.handler.electricbicycles;
import com.jsowell.common.core.domain.ebike.EBikeCommandEnum;
import com.jsowell.pile.domain.ebike.EBikeCommandEnum;
import com.jsowell.netty.factory.EBikeOperateFactory;
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -17,4 +19,16 @@ public class HeartbeatHandler extends AbstractEBikeHandler {
public void afterPropertiesSet() throws Exception {
EBikeOperateFactory.register(type, this);
}
/**
* 执行逻辑
* 有应答
*
* @param msg
* @param ctx
*/
@Override
public byte[] supplyProcess(Class<? extends AbsEBikeMessage> msg, ChannelHandlerContext ctx) {
return new byte[0];
}
}

View File

@@ -1,7 +1,9 @@
package com.jsowell.netty.handler.electricbicycles;
import com.jsowell.common.core.domain.ebike.EBikeCommandEnum;
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
import com.jsowell.pile.domain.ebike.EBikeCommandEnum;
import com.jsowell.netty.factory.EBikeOperateFactory;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -17,4 +19,16 @@ public class RegistrationHandler extends AbstractEBikeHandler {
public void afterPropertiesSet() throws Exception {
EBikeOperateFactory.register(type, this);
}
/**
* 执行逻辑
* 有应答
*
* @param msg
* @param ctx
*/
@Override
public byte[] supplyProcess(Class<? extends AbsEBikeMessage> msg, ChannelHandlerContext ctx) {
return new byte[0];
}
}

View File

@@ -1,7 +1,9 @@
package com.jsowell.netty.handler.electricbicycles;
import com.jsowell.common.core.domain.ebike.EBikeCommandEnum;
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
import com.jsowell.pile.domain.ebike.EBikeCommandEnum;
import com.jsowell.netty.factory.EBikeOperateFactory;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@@ -17,4 +19,16 @@ public class SettlementUploadHandler extends AbstractEBikeHandler {
public void afterPropertiesSet() throws Exception {
EBikeOperateFactory.register(type, this);
}
/**
* 执行逻辑
* 有应答
*
* @param msg
* @param ctx
*/
@Override
public byte[] supplyProcess(Class<? extends AbsEBikeMessage> msg, ChannelHandlerContext ctx) {
return new byte[0];
}
}