use of com.zx.sms.codec.smpp.Address in project SMSGate by Lihuanghe.
the class SMPPSessionConnectedHandler method createTestReq.
@Override
protected BaseMessage createTestReq(String str) {
final EndpointEntity finalentity = getEndpointEntity();
// String content = "£$¥èéùì@";
if (finalentity instanceof ServerEndpoint) {
DeliverSm pdu = new DeliverSm();
pdu.setSourceAddress(new Address((byte) 0, (byte) 0, "13800138000"));
pdu.setDestAddress(new Address((byte) 0, (byte) 0, "10086"));
// pdu.setSmsMsg(new SmsTextMessage(content,SmsDcs.getGeneralDataCodingDcs(SmsAlphabet.GSM,SmsMsgClass.CLASS_UNKNOWN)));
pdu.setSmsMsg(str);
return pdu;
} else {
SubmitSm pdu = new SubmitSm();
pdu.setRegisteredDelivery((byte) 0);
pdu.setSourceAddress(new Address((byte) 0, (byte) 0, "10086"));
pdu.setDestAddress(new Address((byte) 0, (byte) 0, "13800138000"));
// pdu.setSmsMsg(new SmsTextMessage(content,SmsDcs.getGeneralDataCodingDcs(SmsAlphabet.GSM,SmsMsgClass.CLASS_UNKNOWN)));
pdu.setSmsMsg(str);
return pdu;
}
}
use of com.zx.sms.codec.smpp.Address in project SMSGate by Lihuanghe.
the class ByteBufUtil method readAddress.
/**
* Read and create a new Address from a buffer. Checks if there is
* a minimum number of bytes readable from the buffer.
* @param buffer
* @return
* @throws UnrecoverablePduException
* @throws RecoverablePduException
*/
public static Address readAddress(ByteBuf buffer) throws UnrecoverablePduException, RecoverablePduException {
// an address is at least 3 bytes long (ton, npi, and null byte)
if (buffer.readableBytes() < 3) {
throw new NotEnoughDataInBufferException("Parsing address", buffer.readableBytes(), 3);
}
Address address = new Address();
address.read(buffer);
return address;
}
Aggregations