本文整理汇总了Java中org.jsmpp.bean.MessageMode类的典型用法代码示例。如果您正苦于以下问题:Java MessageMode类的具体用法?Java MessageMode怎么用?Java MessageMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageMode类属于org.jsmpp.bean包,在下文中一共展示了MessageMode类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSubmitSm
import org.jsmpp.bean.MessageMode; //导入依赖的package包/类
protected SubmitSm[] createSubmitSm(Exchange exchange) throws SmppException {
SubmitSm template = createSubmitSmTemplate(exchange);
byte[][] segments = splitBody(exchange.getIn());
// multipart message
if (segments.length > 1) {
template.setEsmClass(new ESMClass(MessageMode.DEFAULT, MessageType.DEFAULT, GSMSpecificFeature.UDHI).value());
}
SubmitSm[] submitSms = new SubmitSm[segments.length];
for (int i = 0; i < segments.length; i++) {
SubmitSm submitSm = SmppUtils.copySubmitSm(template);
submitSm.setShortMessage(segments[i]);
submitSms[i] = submitSm;
}
return submitSms;
}
示例2: testParseValid
import org.jsmpp.bean.MessageMode; //导入依赖的package包/类
@Test
public void testParseValid() {
try {
DeliverSm deliverSm = new DeliverSm();
deliverSm.setEsmClass(new ESMClass(MessageMode.DEFAULT, MessageType.SMSC_DEL_RECEIPT, GSMSpecificFeature.DEFAULT).value());
deliverSm.setShortMessage(
("id:0123456789 sub:002 dlvrd:003 submit date:0809011130 done date:0809021131 err:123 stat:DND_REJECTED text:Hello World")
.getBytes(Charset.forName("US-ASCII")));
CustomDeliveryReceipt delReceipt = customDeliveryReceiptStripper.strip(deliverSm);
assertEquals("0123456789", delReceipt.getId());
assertEquals(2, delReceipt.getSubmitted());
assertEquals(3, delReceipt.getDelivered());
assertEquals(createDate(2008, 9, 1, 11, 30), delReceipt.getSubmitDate());
assertEquals(createDate(2008, 9, 2, 11, 31), delReceipt.getDoneDate());
assertEquals("123", delReceipt.getError());
assertEquals(DND_REJECTED, delReceipt.getFinalStatus());
assertEquals("Hello World", delReceipt.getText());
} catch (InvalidDeliveryReceiptException e) {
fail("Failed parsing delivery receipt: " + e.getMessage());
}
}
示例3: run
import org.jsmpp.bean.MessageMode; //导入依赖的package包/类
public void run() {
try {
Thread.sleep(WAIT_DURATION);
} catch (InterruptedException e1) {
Thread.currentThread().interrupt();
LOG.error("Sleep interrupted", e1);
}
SessionState state = session.getSessionState();
if (!state.isReceivable()) {
LOG.debug("Not sending delivery receipt for message id {} since session state is {}", messageId, state);
return;
}
String stringValue = Integer.valueOf(messageId.getValue(), TWO_BYTES).toString();
try {
DeliveryReceipt delRec = new DeliveryReceipt(stringValue, totalSubmitted, totalDelivered, new Date(), new Date(), DeliveryReceiptState.DELIVRD, null, new String(shortMessage));
session.deliverShortMessage("mc", sourceAddrTon, sourceAddrNpi, sourceAddress, destAddrTon, destAddrNpi, destAddress, new ESMClass(MessageMode.DEFAULT,
MessageType.SMSC_DEL_RECEIPT, GSMSpecificFeature.DEFAULT), (byte) 0, (byte) 0, new RegisteredDelivery(0), DataCodings.ZERO, delRec.toString().getBytes());
LOG.debug("Sending delivery receipt for message id {}: {}", messageId, stringValue);
} catch (Exception e) {
LOG.error("Failed sending delivery_receipt for message id {}: {}", messageId, stringValue, e);
}
}
示例4: run
import org.jsmpp.bean.MessageMode; //导入依赖的package包/类
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
LOGGER.error("Interupted", e1);
}
SessionState state = session.getSessionState();
if (!state.isReceivable()) {
LOGGER.debug("Not sending delivery receipt for message id {} since session state is {}", messageId, state);
return;
}
String stringValue = Integer.valueOf(messageId.getValue(), 16).toString();
try {
DeliveryReceipt delRec = new DeliveryReceipt(stringValue, totalSubmitted, totalDelivered, new Date(), new Date(), DeliveryReceiptState.DELIVRD, "000", new String(shortMessage));
session.deliverShortMessage(
"mc",
sourceAddrTon, sourceAddrNpi, sourceAddress,
destAddrTon, destAddrNpi, destAddress,
new ESMClass(MessageMode.DEFAULT, MessageType.SMSC_DEL_RECEIPT, GSMSpecificFeature.DEFAULT),
(byte)0,
(byte)0,
new RegisteredDelivery(0),
DataCodings.ZERO,
delRec.toString().getBytes());
LOGGER.debug("Sending delivery receipt for message id {}: {}", messageId, stringValue);
} catch (Exception e) {
LOGGER.error("Failed sending delivery_receipt for message id " + messageId + ":" + stringValue, e);
}
}
示例5: run
import org.jsmpp.bean.MessageMode; //导入依赖的package包/类
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
String stringValue = Integer.valueOf(messageId.getValue(), 16).toString();
try {
DeliveryReceipt delRec = new DeliveryReceipt(stringValue, 1, 1, new Date(), new Date(), DeliveryReceiptState.DELIVRD, null, new String(submitSm.getShortMessage()));
session.deliverShortMessage(
"mc",
TypeOfNumber.valueOf(submitSm.getDestAddrTon()),
NumberingPlanIndicator.valueOf(submitSm.getDestAddrNpi()),
submitSm.getDestAddress(),
TypeOfNumber.valueOf(submitSm.getSourceAddrTon()),
NumberingPlanIndicator.valueOf(submitSm.getSourceAddrNpi()),
submitSm.getSourceAddr(),
new ESMClass(MessageMode.DEFAULT, MessageType.SMSC_DEL_RECEIPT, GSMSpecificFeature.DEFAULT),
(byte)0,
(byte)0,
new RegisteredDelivery(0),
DataCodings.ZERO,
delRec.toString().getBytes());
LOGGER.debug("Sending delivery receipt for message id " + messageId + ":" + stringValue);
} catch (Exception e) {
LOGGER.error("Failed sending delivery_receipt for message id " + messageId + ":" + stringValue, e);
}
}