Giter Site home page Giter Site logo

smsj's Introduction

Maven Central Gitee Github

SMSJ

Java library implementing the 3GPP TS 23.040 and WAP-230-WSP, and allowing development of SMS or MMS and more

SMSJ is based on the marre SMSJ libraries. It contains several bug fixes, and has been generally refactored, and released at maven central repository.

Introductions

白话短信协议

白话彩信协议

白话CMPP、SGIP ---(SMSSP的doc还在写~)

Maven

<dependency>  
  <groupId>com.github.xfslove</groupId>
  <artifactId>smsj</artifactId>
  <version>1.0.1</version>
</dependency>

Packages

  • mms - a several models represents mms file.
  • sms - a several models represents sms messages.
  • wap - a several models represents wap.

Usages

  • Gsm-7bit charset

    Gsm7BitCharset.INSTANCE

  • create SMS data coding scheme

    SmsDcs dataCodingScheme = SmsDcs.general(DcsGroup.GENERAL_DATA_CODING, SmsAlphabet.LATIN1, SmsMsgClass.Cass_1);
    
    SmsDcs dataCodingScheme = SmsDcs.waitingInfo(DcsGroup.MESSAGE_WAITING_STORE_UCS2, SmsWaitingInfo.VOICE);
    
  • create SMS text message

    SmsTextMessage message = new SmsTextMessage("github");
    SmsPdu[] pdus = message.getPdus();
    
    byte[] udh = pdus[i].getUdhBytes();
    byte[] ud = pdus[i].getUdBytes();
    
  • create WAP SI Push message

    WapSIPush push = new WapSIPush("www.github.com", "github");
    SmsWapPushMessage message = new SmsWapPushMessage(push);
    SmsPdu[] pdus = message.getPdus();
    
    byte[] udh = pdus[i].getUdhBytes();
    byte[] ud = pdus[i].getUdBytes();
    
  • create WAP SL Push message

    WapSLPush push = new WapSLPush("www.github.com");
    SmsWapPushMessage message = new SmsWapPushMessage(push);
    SmsPdu[] pdus = message.getPdus();
    
    byte[] udh = pdus[i].getUdhBytes();
    byte[] ud = pdus[i].getUdBytes();
    
  • create MMS Notification message

    SmsMmsNotificationMessage message = new SmsMmsNotificationMessage("http://mms-location", 0);
    message.setFrom("from");
    message.setExpiry(absolute);
    message.setTransactionId("transaction-id");
    message.setSubject("subject");
    SmsPdu[] pdus = message.getPdus();
    
    byte[] udh = pdus[i].getUdhBytes();
    byte[] ud = pdus[i].getUdBytes();
    
  • create mixed MMS file

    MixedMms mms = new MixedMms();
    mms.setDate(shownDate);
    mms.setFrom("from");
    mms.setSubject("subject");
    mms.setTransactionId("transaction-id");
    
    mms.addBodyPart(MimeFactory.createBinaryBodyPart(imgBytes, "image/jpg"));
    mms.addBodyPart(MimeFactory.createTextBodyPart("github"));
    mms.writeTo(os);
    
  • create related MMS file

    RelatedMms mms = new RelatedMms();
    mms.setDate(shownDate);
    mms.setFrom("from");
    mms.setSubject("subject");
    mms.setTransactionId("transaction-id");
    // px
    mms.setHeight(600);
    mms.setWidth(400);
    
    SmilRegion imgRegion = new SmilRegion(SmilRegion.IMAGE);
    // percentage
    imgRegion.setHeight(60);
    imgRegion.setWidth(100);
    imgRegion.setLeft(0);
    imgRegion.setTop(0);
    mms.addRegion(imgRegion);
    
    SmilRegion txtRegion = new SmilRegion(SmilRegion.TEXT);
    // percentage
    txtRegion.setHeight(40);
    txtRegion.setWidth(100);
    txtRegion.setLeft(0);
    txtRegion.setTop(60);
    mms.addRegion(txtRegion);
    
    SmilPar par1 = new SmilPar();
    // ms
    par1.setDur(3000);
    mms.addPar(par1);
    mms.addBodyPart(MimeFactory.createBinaryBodyPart(imgBytes, "image/jpg"), SmilRegion.IMAGE);
    
    SmilPar par2 = new SmilPar();
    par2.setDur(3000);
    mms.addPar(par2);
    mms.addBodyPart(MimeFactory.createTextBodyPart("github"), SmilRegion.TEXT);
    // notice: must one smilPar one BodyPart
    mms.writeTo(os);
    

smsj's People

Contributors

marre avatar xfslove avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.