[1078] 增加文本下发
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package com.genersoft.iot.vmp.jt1078.bean;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 文本信息标志
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "文本信息标志")
|
||||
public class JTTextSign {
|
||||
|
||||
@@ -14,6 +16,9 @@ public class JTTextSign {
|
||||
@Schema(description = "1终端显示器显示")
|
||||
private boolean terminalDisplay;
|
||||
|
||||
@Schema(description = "1广告屏显示")
|
||||
private boolean adScreen;
|
||||
|
||||
@Schema(description = "1终端 TTS 播读")
|
||||
private boolean tts;
|
||||
|
||||
@@ -29,41 +34,12 @@ public class JTTextSign {
|
||||
if (tts) {
|
||||
byteSign |= (0x1 << 3);
|
||||
}
|
||||
if (adScreen) {
|
||||
byteSign |= (0x1 << 4);
|
||||
}
|
||||
if (source) {
|
||||
byteSign |= (0x1 << 5);
|
||||
}
|
||||
return byteSign;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean isTerminalDisplay() {
|
||||
return terminalDisplay;
|
||||
}
|
||||
|
||||
public void setTerminalDisplay(boolean terminalDisplay) {
|
||||
this.terminalDisplay = terminalDisplay;
|
||||
}
|
||||
|
||||
public boolean isTts() {
|
||||
return tts;
|
||||
}
|
||||
|
||||
public void setTts(boolean tts) {
|
||||
this.tts = tts;
|
||||
}
|
||||
|
||||
public boolean isSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(boolean source) {
|
||||
this.source = source;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Jt808Decoder extends ByteToMessageDecoder {
|
||||
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
|
||||
in.retain();
|
||||
Session session = ctx.channel().attr(Session.KEY).get();
|
||||
log.info("> {} hex: 7e{}7e", session, ByteBufUtil.hexDump(in));
|
||||
log.debug("> {} hex: 7e{}7e", session, ByteBufUtil.hexDump(in));
|
||||
try {
|
||||
// 按照部标定义执行校验和转义
|
||||
ByteBuf buf = unEscapeAndCheck(in);
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Jt808Encoder extends MessageToByteEncoder<Rs> {
|
||||
List<ByteBuf> encodeList = Jt808EncoderCmd.encode(msg, session, session.nextSerialNo());
|
||||
if(encodeList!=null && !encodeList.isEmpty()){
|
||||
for (ByteBuf byteBuf : encodeList) {
|
||||
log.info("< {} hex:{}", session, ByteBufUtil.hexDump(byteBuf));
|
||||
log.debug("< {} hex:{}", session, ByteBufUtil.hexDump(byteBuf));
|
||||
out.writeBytes(byteBuf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,16 @@ import com.genersoft.iot.vmp.jt1078.annotation.MsgId;
|
||||
import com.genersoft.iot.vmp.jt1078.bean.JTTextSign;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* 文本信息下发
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@MsgId(id = "8300")
|
||||
public class J8300 extends Rs {
|
||||
|
||||
@@ -36,28 +40,4 @@ public class J8300 extends Rs {
|
||||
buffer.writeCharSequence(content, Charset.forName("GBK"));
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public JTTextSign getSign() {
|
||||
return sign;
|
||||
}
|
||||
|
||||
public void setSign(JTTextSign sign) {
|
||||
this.sign = sign;
|
||||
}
|
||||
|
||||
public int getTextType() {
|
||||
return textType;
|
||||
}
|
||||
|
||||
public void setTextType(int textType) {
|
||||
this.textType = textType;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +385,12 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
||||
@Override
|
||||
public int linkDetection(String phoneNumber) {
|
||||
J8204 j8204 = new J8204();
|
||||
return (int) jt1078Template.linkDetection(phoneNumber, j8204, 6);
|
||||
Object result = jt1078Template.linkDetection(phoneNumber, j8204, 6);
|
||||
if (result == null) {
|
||||
return 1;
|
||||
}else {
|
||||
return (int) result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user