Search in sources :

Example 1 with Address

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;
    }
}
Also used : Address(com.zx.sms.codec.smpp.Address) SubmitSm(com.zx.sms.codec.smpp.msg.SubmitSm) ServerEndpoint(com.zx.sms.connect.manager.ServerEndpoint) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity) DeliverSm(com.zx.sms.codec.smpp.msg.DeliverSm)

Example 2 with Address

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;
}
Also used : Address(com.zx.sms.codec.smpp.Address) NotEnoughDataInBufferException(com.zx.sms.codec.smpp.NotEnoughDataInBufferException)

Aggregations

Address (com.zx.sms.codec.smpp.Address)2 NotEnoughDataInBufferException (com.zx.sms.codec.smpp.NotEnoughDataInBufferException)1 DeliverSm (com.zx.sms.codec.smpp.msg.DeliverSm)1 SubmitSm (com.zx.sms.codec.smpp.msg.SubmitSm)1 EndpointEntity (com.zx.sms.connect.manager.EndpointEntity)1 ServerEndpoint (com.zx.sms.connect.manager.ServerEndpoint)1