当前位置: 首页>>代码示例>>Java>>正文


Java MessageMode类代码示例

本文整理汇总了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;
    }
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:SmppSubmitSmCommand.java

示例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());
  }
}
 
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:22,代码来源:CustomDeliveryReceiptStripperTest.java

示例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);
	}
}
 
开发者ID:groupe-sii,项目名称:ogham,代码行数:24,代码来源:DeliveryReceiptTask.java

示例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);
    }
}
 
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:31,代码来源:SMPPServerSimulator.java

示例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);
    }
}
 
开发者ID:opentelecoms-org,项目名称:jsmpp,代码行数:30,代码来源:StressServer.java


注:本文中的org.jsmpp.bean.MessageMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。