當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。