use of com.zx.sms.codec.sgip12.msg.SgipReportResponseMessage in project SMSGate by Lihuanghe.
the class SgipReportRequestMessageHandler method channelRead.
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof SgipReportRequestMessage) {
SgipReportResponseMessage resp = new SgipReportResponseMessage(((SgipReportRequestMessage) msg).getHeader());
resp.setResult((short) 0);
resp.setTimestamp(((SgipReportRequestMessage) msg).getTimestamp());
ctx.channel().writeAndFlush(resp);
} else {
ctx.fireChannelRead(msg);
}
}
use of com.zx.sms.codec.sgip12.msg.SgipReportResponseMessage in project SMSGate by Lihuanghe.
the class SgipReportResponseMessageCodec method decode.
@Override
protected void decode(ChannelHandlerContext ctx, Message msg, List<Object> out) throws Exception {
int commandId = msg.getHeader().getCommandId();
if (packetType.getCommandId() != commandId) {
// 不解析,交给下一个codec
out.add(msg);
return;
}
SgipReportResponseMessage responseMessage = new SgipReportResponseMessage(msg.getHeader());
responseMessage.setTimestamp(msg.getTimestamp());
ByteBuf bodyBuffer = Unpooled.wrappedBuffer(msg.getBodyBuffer());
responseMessage.setResult(bodyBuffer.readUnsignedByte());
responseMessage.setReserve(bodyBuffer.readCharSequence(SgipReportResponse.RESERVE.getLength(), GlobalConstance.defaultTransportCharset).toString().trim());
ReferenceCountUtil.release(bodyBuffer);
out.add(responseMessage);
}
Aggregations