Package com.cloudhopper.smpp.pdu

Examples of com.cloudhopper.smpp.pdu.DeliverSm


        // any command id with its 31st bit set to true is a response
        if (PduUtil.isRequestCommandId(commandId)) {
            if (commandId == SmppConstants.CMD_ID_ENQUIRE_LINK) {
                pdu = new EnquireLink();
            } else if (commandId == SmppConstants.CMD_ID_DELIVER_SM) {
                pdu = new DeliverSm();
            } else if (commandId == SmppConstants.CMD_ID_SUBMIT_SM) {
                pdu = new SubmitSm();
            } else if (commandId == SmppConstants.CMD_ID_DATA_SM) {
                pdu = new DataSm();
            } else if (commandId == SmppConstants.CMD_ID_CANCEL_SM) {
View Full Code Here


        // any command id with its 31st bit set to true is a response
        if (PduUtil.isRequestCommandId(commandId)) {
            if (commandId == SmppConstants.CMD_ID_ENQUIRE_LINK) {
                pdu = new EnquireLink();
            } else if (commandId == SmppConstants.CMD_ID_DELIVER_SM) {
                pdu = new DeliverSm();
            } else if (commandId == SmppConstants.CMD_ID_SUBMIT_SM) {
                pdu = new SubmitSm();
            } else if (commandId == SmppConstants.CMD_ID_DATA_SM) {
                pdu = new DataSm();
            } else if (commandId == SmppConstants.CMD_ID_BIND_TRANSCEIVER) {
View Full Code Here

        PduTranscoderContext context = new DefaultPduTranscoderContext();
        PduTranscoder transcoder = new DefaultPduTranscoder(context);

        ChannelBuffer buffer0 = BufferHelper.createBuffer("000000BA00000005000000000000000200010134343935313336313932300001013430343034000400000000000000006E69643A30303539313133393738207375623A30303120646C7672643A303031207375626D697420646174653A3130303231303137333020646F6E6520646174653A3130303231303137333120737461743A44454C49565244206572723A30303020746578743A4024232125262F3A000E0001010006000101001E000833383630316661000427000102");

        DeliverSm pdu0 = (DeliverSm)transcoder.decode(buffer0);

        // id:0059113978 sub:001 dlvrd:001 submit date:1002101730 done date:1002101731 stat:DELIVRD err:000 text:@$#!%&/:
        byte[] sm0 = pdu0.getShortMessage();

        String message0 = new String(sm0, "ISO-8859-1");

        DeliveryReceipt dlr = DeliveryReceipt.parseShortMessage(message0, DateTimeZone.UTC);

        Assert.assertEquals("0059113978", dlr.getMessageId());
        Assert.assertEquals(1, dlr.getSubmitCount());
        Assert.assertEquals(1, dlr.getDeliveredCount());
        Assert.assertEquals(new DateTime(2010, 2, 10, 17, 30, 0, 0, DateTimeZone.UTC), dlr.getSubmitDate());
        Assert.assertEquals(new DateTime(2010, 2, 10, 17, 31, 0, 0, DateTimeZone.UTC), dlr.getDoneDate());
        Assert.assertEquals(SmppConstants.STATE_DELIVERED, dlr.getState());
        Assert.assertEquals(0, dlr.getErrorCode());
        Assert.assertEquals("@$#!%&/:", dlr.getText());

        Tlv tlv0 = pdu0.getOptionalParameter(SmppConstants.TAG_RECEIPTED_MSG_ID);
        String receiptedMessageId = tlv0.getValueAsString();
        Assert.assertEquals("38601fa", receiptedMessageId);

        Tlv tlv1 = pdu0.getOptionalParameter(SmppConstants.TAG_MSG_STATE);
        byte state = tlv1.getValueAsByte();
        Assert.assertEquals(SmppConstants.STATE_DELIVERED, state);

        String receipt0 = dlr.toShortMessage();
        Assert.assertEquals(message0, receipt0);
View Full Code Here

TOP

Related Classes of com.cloudhopper.smpp.pdu.DeliverSm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.