GithubHelp home page GithubHelp logo

pdu_tools's Introduction

pdu_tools

Tools for encoding and decoding GSM SMS PDUs.

Usage

Encoding SMS message

encoder = PDUTools::Encoder.new recipient: "+421910100100", message: "This is a message"
pdus = encoder.encode # => [#<PDUTools::PDU:0x007fd5a4a1d908 @pdu_hex="0001000C9124910101100000001154747A0E4ACF416150BB3C9F87CF65">]

in pdus variable is array of PDUs, if the message is too long it is separated to multiple PDUs.

Decoding SMS message

decoder = PDUTools::Decoder.new "0001000C9124910101100000001154747A0E4ACF416150BB3C9F87CF65", :ms_to_sc
message_part = decoder.decode # => #<PDUTools::MessagePart:0x007fd5a503a9f8 @address="+421910100100", @body="This is a message", @timestamp=nil, @validity_period=nil, @user_data_header=nil>

in message_part variable is now MessagePart object which contains information extracted from the PDU, you can check if the message is complete using message_part.complete? to see if message was separated in multiple PDUs using User Data Header.

There is difference when PDU is comming from MS(Mobile Station) to SC(Service Center) or reverse. You need to specify the direction of PDU in decoder's second parameter: :ms_to_sc or :sc_to_ms.

This tool was build with help of this document

Features

  • Encoding 7 bit and 16 bit characters
  • Decoding 7 bit, 8 bit and 16 bit characters
  • Encoding and decoding User Data Header - used for concatenating SMS messages

pdu_tools's People

Contributors

tulak avatar skandragon 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.