Package org.jsmpp.bean

Examples of org.jsmpp.bean.DataCoding


        // 11110101
        SimpleDataCoding dataCoding = new SimpleDataCoding(Alphabet.ALPHA_8_BIT, MessageClass.CLASS1);
        byte expected = (byte)0xf5;
        assertEquals(dataCoding.toByte(), expected);
       
        DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
        assertEquals(buildedInstance, dataCoding);
    }
View Full Code Here


        // 11110110
        SimpleDataCoding dataCoding = new SimpleDataCoding(Alphabet.ALPHA_8_BIT, MessageClass.CLASS2);
        byte expected = (byte)0xf6;
        assertEquals(dataCoding.toByte(), expected);
       
        DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
        assertEquals(buildedInstance, dataCoding);
    }
View Full Code Here

        // 11110111
        SimpleDataCoding dataCoding = new SimpleDataCoding(Alphabet.ALPHA_8_BIT, MessageClass.CLASS3);
        byte expected = (byte)0xf7;
        assertEquals(dataCoding.toByte(), expected);
       
        DataCoding buildedInstance = DataCodings.newInstance(dataCoding.toByte());
        assertEquals(buildedInstance, dataCoding);
    }
View Full Code Here

        SmppSplitter splitter = createSplitter(exchange);
        Charset charset = determineCharset(providedAlphabet, determinedAlphabet.value());

        byte[][] segments = splitter.split(body.getBytes(charset));

        DataCoding dataCoding = new GeneralDataCoding(false, true, MessageClass.CLASS1, determinedAlphabet);
        ESMClass esmClass;

        // multipart message
        if (segments.length > 1) {
            esmClass = new ESMClass(MessageMode.DEFAULT, MessageType.DEFAULT, GSMSpecificFeature.UDHI);
        } else {
            esmClass = new ESMClass();
        }

        SubmitMulti template = createSubmitMultiTemplate(exchange);
        SubmitMulti[] submitMulties = new SubmitMulti[segments.length];
       
        for (int i = 0; i < segments.length; i++) {
            SubmitMulti submitMulti = SmppUtils.copySubmitMulti(template);
            submitMulti.setEsmClass(esmClass.value());
            submitMulti.setDataCoding(dataCoding.value());
            submitMulti.setShortMessage(segments[i]);
            submitMulties[i] = submitMulti;
        }

        return submitMulties;
View Full Code Here

        SmppSplitter splitter = createSplitter(exchange);
        Charset charset = determineCharset(providedAlphabet, determinedAlphabet.value());

        byte[][] segments = splitter.split(body.getBytes(charset));

        DataCoding dataCoding = new GeneralDataCoding(false, true, MessageClass.CLASS1, determinedAlphabet);
        ESMClass esmClass;

        // multipart message
        if (segments.length > 1) {
            esmClass = new ESMClass(MessageMode.DEFAULT, MessageType.DEFAULT, GSMSpecificFeature.UDHI);
        } else {
            esmClass = new ESMClass();
        }

        SubmitMulti template = createSubmitMultiTemplate(exchange);
        SubmitMulti[] submitMulties = new SubmitMulti[segments.length];
       
        for (int i = 0; i < segments.length; i++) {
            SubmitMulti submitMulti = SmppUtils.copySubmitMulti(template);
            submitMulti.setEsmClass(esmClass.value());
            submitMulti.setDataCoding(dataCoding.value());
            submitMulti.setShortMessage(segments[i]);
            submitMulties[i] = submitMulti;
        }

        return submitMulties;
View Full Code Here

      Object payload = msg.getPayload();
      if (payload instanceof String) {
        smsTxt = (String) payload;
      }
    }
    final DataCoding dataCodingFromHeader = SmesMessageSpecification.dataCodingFromHeader(msg);
    final SmesMessageSpecification spec = new SmesMessageSpecification()
        .reset()
        .setSmppSession(smppSession)
        .setSourceAddress(srcAddy)
        .setDestinationAddress(dstAddy)
View Full Code Here

    /* ********** Single line tests ************* */

    @Test
    public void singleLineSplitsCorrectlyFor7Bit() throws Exception {
        DataCoding dataCoding = DataCodings.newInstance((byte) 0);

        verifySingleLineMessageSplitCorrectlyForDataCoding(dataCoding);
    }
View Full Code Here

        verifySingleLineMessageSplitCorrectlyForDataCoding(dataCoding);
    }

    @Test
    public void singleLineSplitsCorrectlyFor8Bit() throws Exception {
        DataCoding dataCoding = DataCodings.newInstance((byte) 4);

        verifySingleLineMessageSplitCorrectlyForDataCoding(dataCoding);
    }
View Full Code Here

        verifySingleLineMessageSplitCorrectlyForDataCoding(dataCoding);
    }

    @Test
    public void singleLineSplitsCorrectlyFor16Bit() throws Exception {
        DataCoding dataCoding = DataCodings.newInstance((byte) 8);

        verifySingleLineMessageSplitCorrectlyForDataCoding(dataCoding);
    }
View Full Code Here

        verifySingleLineMessageSplitCorrectlyForDataCoding(dataCoding);
    }

    @Test
    public void singleLineSplitsCorrectlyForSimpleDataCoding() throws Exception {
        DataCoding dataCoding = new SimpleDataCoding();

        verifySingleLineMessageSplitCorrectlyForDataCoding(dataCoding);
    }
View Full Code Here

TOP

Related Classes of org.jsmpp.bean.DataCoding

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.