use of com.zx.sms.codec.smgp.msg.SMGPSubmitRespMessage in project SMSGate by Lihuanghe.
the class SMGPMessageCodec method fromBytes.
private SMGPBaseMessage fromBytes(byte[] bytes) throws Exception {
if (bytes == null) {
return null;
}
if (bytes.length < SMGPBaseMessage.SZ_HEADER) {
return null;
}
int commandLength = ByteUtil.byte2int(bytes, 0);
assert bytes.length == commandLength;
int commandId = ByteUtil.byte2int(bytes, 4);
SMGPBaseMessage baseMsg = null;
switch(commandId) {
case SMGPConstants.SMGP_LOGIN:
baseMsg = new SMGPLoginMessage();
break;
case SMGPConstants.SMGP_LOGIN_RESP:
baseMsg = new SMGPLoginRespMessage();
break;
case SMGPConstants.SMGP_SUBMIT:
baseMsg = new SMGPSubmitMessage();
break;
case SMGPConstants.SMGP_SUBMIT_RESP:
baseMsg = new SMGPSubmitRespMessage();
break;
case SMGPConstants.SMGP_DELIVER:
baseMsg = new SMGPDeliverMessage();
break;
case SMGPConstants.SMGP_DELIVER_RESP:
baseMsg = new SMGPDeliverRespMessage();
break;
case SMGPConstants.SMGP_ACTIVE_TEST:
baseMsg = new SMGPActiveTestMessage();
break;
case SMGPConstants.SMGP_ACTIVE_TEST_RESP:
baseMsg = new SMGPActiveTestRespMessage();
break;
case SMGPConstants.SMGP_EXIT_TEST:
baseMsg = new SMGPExitMessage();
break;
case SMGPConstants.SMGP_EXIT_RESP:
baseMsg = new SMGPExitRespMessage();
break;
default:
baseMsg = new SMGPUnknownMessage(commandId);
break;
}
baseMsg.fromBytes(bytes, version);
return baseMsg;
}
use of com.zx.sms.codec.smgp.msg.SMGPSubmitRespMessage in project SMSGate by Lihuanghe.
the class SMGPMessageReceiveHandler method reponse.
@Override
protected ChannelFuture reponse(final ChannelHandlerContext ctx, Object msg) {
if (msg instanceof SMGPDeliverMessage) {
SMGPDeliverRespMessage resp = new SMGPDeliverRespMessage();
resp.setSequenceNo(((SMGPDeliverMessage) msg).getSequenceNo());
resp.setMsgId(((SMGPDeliverMessage) msg).getMsgId());
resp.setStatus(0);
return ctx.writeAndFlush(resp);
} else if (msg instanceof SMGPSubmitMessage) {
SMGPSubmitRespMessage resp = new SMGPSubmitRespMessage();
resp.setSequenceNo(((SMGPSubmitMessage) msg).getSequenceNo());
resp.setStatus(0);
return ctx.writeAndFlush(resp);
}
return null;
}
use of com.zx.sms.codec.smgp.msg.SMGPSubmitRespMessage in project SMSGate by Lihuanghe.
the class SMGPSubmitLongMessageHandler method response.
@Override
protected BaseMessage response(SMGPSubmitMessage msg) {
// 短信片断未接收完全,直接给网关回复resp,等待其它片断
SMGPSubmitRespMessage responseMessage = new SMGPSubmitRespMessage();
responseMessage.setSequenceNo(msg.getSequenceNo());
responseMessage.setStatus(0);
responseMessage.setMsgId(new MsgId());
return responseMessage;
}
Aggregations