com.cloudhopper.smpp.type.Address.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中com.cloudhopper.smpp.type.Address.<init>()方法的一些代码示例,展示了Address.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.<init>()方法的具体详情如下:
包路径:com.cloudhopper.smpp.type.Address
类名称:Address
方法名:<init>

Address.<init>介绍

暂无

代码示例

代码示例来源:origin: traccar/traccar

submit.setSourceAddress(command ? new Address(commandSourceTon, commandSourceNpi, commandSourceAddress)
    : new Address(sourceTon, sourceNpi, sourceAddress));
submit.setDestAddress(new Address(destTon, destNpi, destAddress));
SubmitSmResp submitResponce = getSession().submit(submit, submitTimeout);
if (submitResponce.getCommandStatus() == SmppConstants.STATUS_OK) {

代码示例来源:origin: MavoCz/smscsim

@Override
public DeliverSm createMessage() throws Exception {
  Address sourceAddress = new Address((byte) sourceAddressTon, (byte) sourceAddressNpi, sourceAddressDigits);
  Address destinationAddress = new Address((byte) destAddressTon, (byte) destAddressNpi, destAddressDigits);
  DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, sessionManager.getNextSequenceNumber());
  return pdu;
}

代码示例来源:origin: MavoCz/smscsim

@ManagedOperation
public void sendSegmentedDeliverMsgUdh00(int numberOfSegments) throws Exception {
  Address sourceAddress = new Address((byte) 0, (byte) 0, "123456789");
  Address destinationAddress = new Address((byte) 0, (byte) 0, "987654321");
  int msgRefNum = nextMsgRefNum.incrementAndGet();
  for (int i = 1; i <= numberOfSegments; i++) {
    String shortMessage = "Segment content " + i + ". ";
    DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, getSessionManager().getNextSequenceNumber());
    SmppPduUtils.setSegmentUdh00AndMessage(pdu, msgRefNum, i, numberOfSegments, shortMessage);
    send(pdu);
  }
}

代码示例来源:origin: MavoCz/smscsim

@ManagedOperation
public void sendSegmentedDeliverMsgUdh08(int numberOfSegments) throws Exception {
  Address sourceAddress = new Address((byte) 0, (byte) 0, "123456789");
  Address destinationAddress = new Address((byte) 0, (byte) 0, "987654321");
  int msgRefNum = nextMsgRefNum.incrementAndGet();
  for (int i = 1; i <= numberOfSegments; i++) {
    String shortMessage = "Segment content " + i + ". ";
    DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, getSessionManager().getNextSequenceNumber());
    SmppPduUtils.setSegmentUdh08AndMessage(pdu, msgRefNum, i, numberOfSegments, shortMessage);
    send(pdu);
  }
}

代码示例来源:origin: MavoCz/smscsim

@ManagedOperation
public void sendSegmentedDeliverLongMsg(int numberOfSegments, int minMsgSize) throws Exception {
  Address sourceAddress = new Address((byte) 0, (byte) 0, "123456789");
  Address destinationAddress = new Address((byte) 0, (byte) 0, "987654321");
  int msgRefNum = nextMsgRefNum.incrementAndGet();
  for (int i = 1; i <= numberOfSegments; i++) {
    StringBuilder sb = new StringBuilder(255);
    sb.append("Segment content ");
    sb.append(i);
    sb.append(". ");
    while (sb.length() < minMsgSize) {
      sb.append(".");
    }
    String shortMessage = sb.toString();
    DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, getSessionManager().getNextSequenceNumber());
    SmppPduUtils.setSegmentOptionalParams(pdu, msgRefNum, i, numberOfSegments);
    byte[] body = CharsetUtil.encode(shortMessage, CharsetUtil.CHARSET_GSM);
    if (body.length < 256) {
      pdu.setShortMessage(body);
    } else {
      SmppPduUtils.setMessagePayloadOptionalParams(pdu, body);
    }
    pdu.setDataCoding(SmppConstants.DATA_CODING_8BITA);
    send(pdu);
  }
}

代码示例来源:origin: MavoCz/smscsim

@ManagedOperation
public void sendSegmentedDeliverMsg(int numberOfSegments) throws Exception {
  Address sourceAddress = new Address((byte) 0, (byte) 0, "123456789");
  Address destinationAddress = new Address((byte) 0, (byte) 0, "987654321");
  int msgRefNum = nextMsgRefNum.incrementAndGet();
  for (int i = 1; i <= numberOfSegments; i++) {
    String shortMessage = "Segment content " + i + ". ";
    DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, getSessionManager().getNextSequenceNumber());
    SmppPduUtils.setSegmentOptionalParams(pdu, msgRefNum, i, numberOfSegments);
    pdu.setShortMessage(CharsetUtil.encode(shortMessage, CharsetUtil.CHARSET_GSM));
    send(pdu);
  }
}

代码示例来源:origin: MavoCz/smscsim

@ManagedOperation
public void sendSegmentedBinaryDeliverMsg(int numberOfSegments) throws Exception {
  Address sourceAddress = new Address((byte) 0, (byte) 0, "123456789");
  Address destinationAddress = new Address((byte) 0, (byte) 0, "987654321");
  int msgRefNum = nextMsgRefNum.incrementAndGet();
  for (int i = 1; i <= numberOfSegments; i++) {
    String shortMessage = "Segment content " + i + ". ";
    DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, getSessionManager().getNextSequenceNumber());
    SmppPduUtils.setSegmentOptionalParams(pdu, msgRefNum, i, numberOfSegments);
    pdu.setShortMessage(CharsetUtil.encode(shortMessage, CharsetUtil.NAME_GSM));
    pdu.setDataCoding((byte) 0x02); // 8 bit binary encoding
    send(pdu);
  }
}

代码示例来源:origin: twitter-archive/cloudhopper-smpp

/**
 * 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 UnrecoverablePduEncodingException
 * @throws RecoverablePduEncodingException
 */
static public Address readAddress(ChannelBuffer 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;
}

代码示例来源:origin: org.restcomm.smpp/ch-smpp

/**
 * 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 UnrecoverablePduEncodingException
 * @throws RecoverablePduEncodingException
 */
static public Address readAddress(ChannelBuffer 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;
}

代码示例来源:origin: com.fizzed/ch-smpp

/**
 * 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 UnrecoverablePduEncodingException
 * @throws RecoverablePduEncodingException
 */
static public Address readAddress(ChannelBuffer 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;
}

代码示例来源:origin: MavoCz/smscsim

@ManagedOperation
public void sendSegmentedDeliverMsgRandomized(int numberOfMessages, int numberOfSegments) throws Exception {
  for (int msgNum = 0; msgNum < numberOfMessages; msgNum++) {
    Address sourceAddress = new Address((byte) 0, (byte) 0, "123456789");
    Address destinationAddress = new Address((byte) 0, (byte) 0, "987654321");
    int msgRefNum = nextMsgRefNum.incrementAndGet();
    for (int i = 1; i <= numberOfSegments; i++) {
      String shortMessage = "Msg " + msgNum + ". Segment content " + i + ". ";
      DeliverSm pdu = SmppPduUtils.createDeliverSm(sourceAddress, destinationAddress, getSessionManager().getNextSequenceNumber());
      SmppPduUtils.setSegmentOptionalParams(pdu, msgRefNum, i, numberOfSegments);
      pdu.setShortMessage(CharsetUtil.encode(shortMessage, CharsetUtil.CHARSET_GSM));
      getDeliverSender().scheduleDelivery(new PduRequestRecord(pdu, 1000, 5000));
    }
  }
}

代码示例来源:origin: com.cloudhopper/ch-smpp

/**
 * 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 UnrecoverablePduEncodingException
 * @throws RecoverablePduEncodingException
 */
static public Address readAddress(ChannelBuffer 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;
}

代码示例来源:origin: wizardjedi/my-spring-learning

sm.setSourceAddress(new Address((byte)5, (byte)0, "Test"));
sm.setDestAddress(new Address((byte)1, (byte)1, "79111234567"));

代码示例来源:origin: org.mobicents.smsc/smpp-simulator

pdu = deliverPdu;
pdu.setSourceAddress(new Address((byte) param.getSourceTON().getCode(), (byte) param.getSourceNPI().getCode(),
    param.getSourceAddress()));
pdu.setDestAddress(new Address((byte) param.getDestTON().getCode(), (byte) param.getDestNPI().getCode(),
    param.getDestAddress()));

代码示例来源:origin: tdelenikas/smslib

submitRequest.setSourceAddress(new Address(getTON(message.getOriginatorAddress()), getNPI(message.getOriginatorAddress()), message.getOriginatorAddress().getAddress()));
submitRequest.setDestAddress(new Address(getTON(message.getRecipientAddress()), getNPI(message.getRecipientAddress()), message.getRecipientAddress().getAddress()));
switch (message.getEncoding())

代码示例来源:origin: org.mobicents.smsc/smpp-simulator

config0.setSystemId(this.param.getSystemId());
config0.setPassword(this.param.getPassword());
config0.setAddressRange(new Address((byte) 1, (byte) 1, this.param.getAddressRange()));
config0.getLoggingOptions().setLogBytes(true);

代码示例来源:origin: org.mobicents.smsc/smpp-simulator

pdu.setSourceAddress(new Address((byte)this.param.getSourceTON().getCode(), (byte)this.param.getSourceNPI().getCode(), this.param.getSourceAddress()));
    ((SubmitMulti) pdu).addDestAddresses(new Address((byte) this.param.getDestTON().getCode(), (byte) this.param.getDestNPI().getCode(), String
        .valueOf(daOrig + i2)));
  pdu.setDestAddress(new Address((byte) this.param.getDestTON().getCode(), (byte) this.param.getDestNPI().getCode(), destAddr));

代码示例来源:origin: org.restcomm.smpp/smpp-extensions

String addressRange = esme.getEsmeAddressRange();
Address addressRangeObj = new Address();
if(addressTon!=-1){
  addressRangeObj.setTon((byte)addressTon);

代码示例来源:origin: org.mobicents.smsc/smpp

String addressRange = esme.getEsmeAddressRange();
Address addressRangeObj = new Address();
if(addressTon!=-1){
  addressRangeObj.setTon((byte)addressTon);

相关文章