Top Banner
Automatic Response Automatic Response System Using Sms System Using Sms
43

Automatic Response System Using Sms-Java

Dec 01, 2015

Download

Documents

Yatin Joshi

project ppt
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Automatic Response System Using Sms-Java

Automatic Response System Automatic Response System Using SmsUsing Sms

Page 2: Automatic Response System Using Sms-Java

Contents:Contents: MethodologyMethodology Why Java?Why Java? Reasons for using javaReasons for using java Comparison to other langaugesComparison to other langauges History of JavaHistory of Java Introduction Introduction Primary goals of using javaPrimary goals of using java Types of JavaTypes of Java CritisismCritisism JSMS:JSMS:Software Architecture JSMS Supported Protocols Message Types ReferencesReferences::

Page 3: Automatic Response System Using Sms-Java

MethodologyMethodology

Mobile is connected to serial port of computer.Mobile is connected to serial port of computer. Whenever any message arrives on that mobile ,it is Whenever any message arrives on that mobile ,it is

accepted by java program running on the computer.accepted by java program running on the computer. Program will read message arrived on pc & extract Program will read message arrived on pc & extract

the contents.the contents. Depending upon contents of message, program will Depending upon contents of message, program will

connect to particular database for specific data asked connect to particular database for specific data asked in the Sms.in the Sms.

Page 4: Automatic Response System Using Sms-Java

Contd.Contd.

Data is retrieved & an sms is framed.Data is retrieved & an sms is framed. This sms is tranferred to the mobile This sms is tranferred to the mobile

connected to pc using JSMS API.connected to pc using JSMS API. It will send sms to requesting mobile It will send sms to requesting mobile

using program.using program. We are using Java for developing the We are using Java for developing the

application.application.

Page 5: Automatic Response System Using Sms-Java

Why Why JAVAJAVA??

JavaJava is a is a programming languageprogramming language originally developed originally developed by by Sun MicrosystemsSun Microsystems and released in 1995. The and released in 1995. The language derives much of its language derives much of its syntaxsyntax from from CC and and C++C++ but has a simpler but has a simpler object modelobject model and fewer low-level and fewer low-level facilities. Java applications are typically facilities. Java applications are typically compiledcompiled to to byte code which can run on any Java which can run on any Java virtual machinevirtual machine regardless of regardless of computer architecturecomputer architecture. Java now forms . Java now forms the core of Sun's the core of Sun's Java platformJava platform..

Page 6: Automatic Response System Using Sms-Java

Reasons for using JAVA:Reasons for using JAVA:

Java Is Small and SimpleJava Is Small and Simple : :The most complex parts The most complex parts of C++ were excluded from Java, such as pointers of C++ were excluded from Java, such as pointers and memory management. These elements are and memory management. These elements are complicated to use, and are thus easy to use complicated to use, and are thus easy to use incorrectly. incorrectly.

Java Is Object Oriented :OOP organizes a Java Is Object Oriented :OOP organizes a program as a set of components called objects. program as a set of components called objects. These objects exist independently of each other, These objects exist independently of each other, and they have rules for communicating with other and they have rules for communicating with other objects and for telling those objects to do things.objects and for telling those objects to do things.

Page 7: Automatic Response System Using Sms-Java

Contd.Contd.

Java is Dynamic :Java is Dynamic :Java programmes carry with them Java programmes carry with them substantial amounts of run-time type information that substantial amounts of run-time type information that is used to verify and resolve accesses to objects at run-is used to verify and resolve accesses to objects at run-time. This makes it possible to dynamically link code time. This makes it possible to dynamically link code in a safe and expedient manner. This is crucial to the in a safe and expedient manner. This is crucial to the robustness of the applet environment.robustness of the applet environment.

Java is Architecture-Neutral :Java is Architecture-Neutral :The Java The Java designers made several hard decisions in the designers made several hard decisions in the Java language and the Java Virtual Machine in Java language and the Java Virtual Machine in an attempt to alter the situation of programmes an attempt to alter the situation of programmes not running on the same machine after few not running on the same machine after few days.days.

Page 8: Automatic Response System Using Sms-Java

Comparison to other languagesComparison to other languages

Multiple Vendor Choice and Support Multiple Vendor Choice and Support

Java technologies are supported by multiple vendors allowing Java technologies are supported by multiple vendors allowing mix and match and best of breed solutions. Java standard APIs mix and match and best of breed solutions. Java standard APIs have always been designed to be supported by multiple have always been designed to be supported by multiple implementationsimplementations

Compile to Machine Code Compile to Machine Code

Java has several solutions to compiling into machine code, that Java has several solutions to compiling into machine code, that is when compiling to byte code is an issue for either is when compiling to byte code is an issue for either intellectual property or performance reasons. intellectual property or performance reasons.

Page 9: Automatic Response System Using Sms-Java

Contd.Contd. Future Proof Future Proof

Java is future proof or rather future portable, in the sense that Java is future proof or rather future portable, in the sense that your existing code base will not become obsolete. How so? I your existing code base will not become obsolete. How so? I can run Java on machines today and machines in the future. can run Java on machines today and machines in the future. You don't have that assurance for Microsoft's technologies like You don't have that assurance for Microsoft's technologies like .NET..NET.

Most Popular Language in the Corporation Most Popular Language in the Corporation

A recent A recent surveysurvey reveals "Interestingly, the strong showing of reveals "Interestingly, the strong showing of Visual C# .NET divides the Microsoft camp and propels Java Visual C# .NET divides the Microsoft camp and propels Java into first place as the most popular language over the coming into first place as the most popular language over the coming

year".year".

Page 10: Automatic Response System Using Sms-Java

Contd.Contd.

More Homogeneous and Less Complex Environment More Homogeneous and Less Complex Environment

The Java environment is more homogeneous and less complex The Java environment is more homogeneous and less complex than .NET. It is not littered with obsolete technologies like than .NET. It is not littered with obsolete technologies like COM, DCOM, COM+, ADO, nor is it dependent on operating COM, DCOM, COM+, ADO, nor is it dependent on operating system indiosyncracies like register settings or most recent system indiosyncracies like register settings or most recent

service patch level.service patch level. Java IDEs are superior in their support for coding tasks. Java IDEs are superior in their support for coding tasks.

Features like code refactoring, intention actions, superior code Features like code refactoring, intention actions, superior code browsing (i.e Find Usages) and robust code completion are browsing (i.e Find Usages) and robust code completion are superior to what you find in Visual Studio.NET. In fact, Visual superior to what you find in Visual Studio.NET. In fact, Visual Studio.NET is known to unintentionally erase code. Studio.NET is known to unintentionally erase code.

Page 11: Automatic Response System Using Sms-Java

ContdContd..

Cross Platform Integration with Other Languages Cross Platform Integration with Other Languages

Integration with Java from other languages like Perl, PHP or Integration with Java from other languages like Perl, PHP or Python is cross platform. In otherwords, I can take my PHP Python is cross platform. In otherwords, I can take my PHP scripts that talk to Java and run in windows, place them in a scripts that talk to Java and run in windows, place them in a

Linux box and have them work without a major porting effort.Linux box and have them work without a major porting effort.

Page 12: Automatic Response System Using Sms-Java

HistoryHistory of Java of Java

Java started as a project called "Oak" by Java started as a project called "Oak" by James GoslingJames Gosling in in June 1991 for use in a set top box project. Gosling's goals June 1991 for use in a set top box project. Gosling's goals were to implement a were to implement a virtual machinevirtual machine and a language that had a and a language that had a familiar C/C++ style of notation. The first public familiar C/C++ style of notation. The first public implementation was Java 1.0 in 1995. It promised "implementation was Java 1.0 in 1995. It promised "Write Once, Run AnywhereWrite Once, Run Anywhere" (WORA), providing no-cost " (WORA), providing no-cost runtimes on popular platforms. It was fairly secure and its runtimes on popular platforms. It was fairly secure and its security was configurable, allowing network and file access to security was configurable, allowing network and file access to be restricted. Major web browsers soon incorporated the be restricted. Major web browsers soon incorporated the ability to run secure Java "ability to run secure Java "appletsapplets" within web pages. Java " within web pages. Java became popular quickly. With the advent of "Java 2", new became popular quickly. With the advent of "Java 2", new versions had multiple configurations built for different types versions had multiple configurations built for different types of platforms. of platforms.

Page 13: Automatic Response System Using Sms-Java

Introduction to LanguageIntroduction to Language Java applicationsJava applications are typically are typically compiledcompiled to to bytecodebytecode, ,

although compilation to native although compilation to native machine codemachine code is also possible. is also possible. At At runtimeruntime, bytecode is usually either , bytecode is usually either interpretedinterpreted or compiled or compiled to native code for execution, although direct to native code for execution, although direct hardwarehardware execution of bytecode by a execution of bytecode by a Java processorJava processor is also possible. is also possible.

The language itself derives much of its The language itself derives much of its syntaxsyntax from from CC and and C++C++ but has a simpler but has a simpler object modelobject model and fewer low-level and fewer low-level facilities. facilities. JavaScriptJavaScript, a , a scripting languagescripting language, shares a similar , shares a similar name and has similar syntax, but is not directly related to Java.name and has similar syntax, but is not directly related to Java.

Sun Microsystems provides a Sun Microsystems provides a GNU General Public LicenseGNU General Public License implementation of a Java implementation of a Java compilercompiler and Java and Java virtual machinevirtual machine, , in compliance with the specifications of the in compliance with the specifications of the Java Community ProcessJava Community Process, although the , although the class libraryclass library that is that is required to run Java programs is not required to run Java programs is not free softwarefree software..

Page 14: Automatic Response System Using Sms-Java

Primary goalsPrimary goals

There were five primary goals in the creation of the Java There were five primary goals in the creation of the Java language:language:

It should use the It should use the object-oriented programmingobject-oriented programming methodology. methodology. It should allow the same program to be It should allow the same program to be executedexecuted on multiple on multiple

operating systemsoperating systems. . It should contain built-in support for using It should contain built-in support for using computer networkscomputer networks. . It should be designed to execute code from It should be designed to execute code from remote sourcesremote sources

securely. securely. It should be easy to use by selecting what was considered the It should be easy to use by selecting what was considered the

good parts of other object-oriented languagesgood parts of other object-oriented languages

Page 15: Automatic Response System Using Sms-Java

Contd.Contd.

In 1997, Sun approached the In 1997, Sun approached the ISO/IEC JTC1 standards bodyISO/IEC JTC1 standards body and later the and later the Ecma InternationalEcma International to formalize Java, but it soon to formalize Java, but it soon withdrew from the process.withdrew from the process.[5][5][6][6][7][7] Java remains a Java remains a proprietary de facto standard that is controlled through the proprietary de facto standard that is controlled through the Java Community ProcessJava Community Process..[8][8] Sun makes most of its Java Sun makes most of its Java implementations available without charge, with revenue being implementations available without charge, with revenue being generated by specialized products such as the Java Enterprise generated by specialized products such as the Java Enterprise System. Sun distinguishes between its Software Development System. Sun distinguishes between its Software Development Kit (SDK) and Kit (SDK) and Runtime Environment (JRE)Runtime Environment (JRE) which is a subset which is a subset of the SDK, the primary distinction being that in the JRE the of the SDK, the primary distinction being that in the JRE the compiler is not present.compiler is not present.

On On November 13November 13, , 20062006, Sun released parts of Java as , Sun released parts of Java as freefree//open sourceopen source software, under the software, under the GNU General Public LicenseGNU General Public License (GPL). The release of the complete (GPL). The release of the complete source codesource code under GPL is under GPL is expected in the first half of expected in the first half of 20072007

Page 16: Automatic Response System Using Sms-Java

Platform independencePlatform independence One characteristic, One characteristic, platform independenceplatform independence, means that , means that programsprograms

written in the Java language must run similarly on any supported written in the Java language must run similarly on any supported hardware/operating-system platform. One should be able to write hardware/operating-system platform. One should be able to write a program once, compile it once, and run it anywhere.a program once, compile it once, and run it anywhere.

This is achieved by most Java This is achieved by most Java compilerscompilers by compiling the Java by compiling the Java language code "halfway" to language code "halfway" to bytecodebytecode simplified machine simplified machine instructions specific to the Java platform. The code is then run on instructions specific to the Java platform. The code is then run on a a virtual machinevirtual machine (VM), a program written in native code on the (VM), a program written in native code on the host hardware that host hardware that interpretsinterprets and executes generic Java bytecode. and executes generic Java bytecode. (Further, standardized libraries are provided to allow access to (Further, standardized libraries are provided to allow access to features of the host machines (such as graphics, features of the host machines (such as graphics, threadingthreading and and networkingnetworking) in unified ways. Note that, although there is an ) in unified ways. Note that, although there is an explicit compiling stage, at some point, the Java bytecode is explicit compiling stage, at some point, the Java bytecode is interpreted or converted to native interpreted or converted to native machine instructionsmachine instructions by the by the JIT compilerJIT compiler

Page 17: Automatic Response System Using Sms-Java

Automatic garbage collectionAutomatic garbage collection

One of the ideas behind Java's automatic memory management One of the ideas behind Java's automatic memory management model is that programmers be spared the burden of having to model is that programmers be spared the burden of having to perform manual memory management. In some languages the perform manual memory management. In some languages the programmer allocates memory for the creation of objects stored programmer allocates memory for the creation of objects stored on the heap and the responsibility of later deallocating that on the heap and the responsibility of later deallocating that memory thus resides with the programmer. If the programmer memory thus resides with the programmer. If the programmer forgets to deallocate memory or writes code that fails to do so, a forgets to deallocate memory or writes code that fails to do so, a memory leakmemory leak occurs and the program can consume an arbitrarily occurs and the program can consume an arbitrarily large amount of memory. Additionally, if the program attempts to large amount of memory. Additionally, if the program attempts to deallocate the region of memory more than once, the result is deallocate the region of memory more than once, the result is undefined and the program may become unstable and may crash. undefined and the program may become unstable and may crash. Finally, in non garbage collected environments, there is a certain Finally, in non garbage collected environments, there is a certain degree of overhead and complexity of user-code to track and degree of overhead and complexity of user-code to track and finalize allocations. Often developers may box themselves into finalize allocations. Often developers may box themselves into certain designs to provide reasonable assurances that memory certain designs to provide reasonable assurances that memory leaks will not occur.leaks will not occur.

Page 18: Automatic Response System Using Sms-Java

Contd.Contd.

In Java, this potential problem is avoided by In Java, this potential problem is avoided by automatic garbage collectionautomatic garbage collection. The programmer . The programmer determines when objects are created, and the Java determines when objects are created, and the Java runtime is responsible for managing the runtime is responsible for managing the object's lifecycleobject's lifecycle. The program or other objects can . The program or other objects can reference an object by holding a reference to it reference an object by holding a reference to it (which, from a low-level point of view, is its address (which, from a low-level point of view, is its address on the heap). When no references to an object on the heap). When no references to an object remain, the Java garbage collector automatically remain, the Java garbage collector automatically deletes the deletes the unreachable objectunreachable object, freeing memory and , freeing memory and preventing a memory leak. Memory leaks may still preventing a memory leak. Memory leaks may still occur if a programmer's code holds a reference to occur if a programmer's code holds a reference to an object that is no longer needed—in other words, an object that is no longer needed—in other words, they can still occur but at higher conceptual levels.they can still occur but at higher conceptual levels.

Page 19: Automatic Response System Using Sms-Java

SyntaxSyntax

The syntax of Java is largely derived from C++. However, The syntax of Java is largely derived from C++. However, unlike C++, which combines the syntax for structured, unlike C++, which combines the syntax for structured, generic, and object-oriented programming, Java was built generic, and object-oriented programming, Java was built exclusively as an object oriented language. As a result, almost exclusively as an object oriented language. As a result, almost everything is an object and all code is written inside a class. everything is an object and all code is written inside a class. The exceptions are the intrinsic data types (ordinal and real The exceptions are the intrinsic data types (ordinal and real numbers, boolean values, and characters), which are not numbers, boolean values, and characters), which are not classes for performance reasons.classes for performance reasons.

Page 20: Automatic Response System Using Sms-Java

Example:Hello worldExample:Hello world

public class Hellopublic class Hello{ { public static void main(String[] args) public static void main(String[] args) { { System.out.println("Hello, World!"); System.out.println("Hello, World!"); } } }}

Page 21: Automatic Response System Using Sms-Java

An example that better demonstrates An example that better demonstrates object-oriented programmingobject-oriented programming::

// OddEven.java // OddEven.java import javax.swing.JOptionPane;import javax.swing.JOptionPane;public class OddEven {public class OddEven { private int input; public OddEven() { private int input; public OddEven() { input = input =

integer.parseInt(JOptionPane.showInputDialog("integer.parseInt(JOptionPane.showInputDialog("Please Enter A Number")Please Enter A Number")

); } ); } public void calculate() { public void calculate() { if (input % 2 == 0) if (input % 2 == 0)

Page 22: Automatic Response System Using Sms-Java

Odd evenOdd even

System.out.println("Even"); System.out.println("Even");

else else

System.out.println("Odd");System.out.println("Odd"); } }

public static void main(String[] args)public static void main(String[] args)

{ OddEven number = new OddEven(); { OddEven number = new OddEven(); number.calculate(); number.calculate();

}}

}}

Page 23: Automatic Response System Using Sms-Java

Types of JavaTypes of Java

There are many types of Java programs which There are many types of Java programs which run differently:run differently:

Applet - can be put online (in web browsers). Applet - can be put online (in web browsers). Application - can only be run on the computer, Application - can only be run on the computer,

cannot be put online. cannot be put online. Servlet - runs on a server and helps to display Servlet - runs on a server and helps to display

web pages. web pages. Swing application - like an application, but can Swing application - like an application, but can

have a more graphical lookhave a more graphical look. .

Page 24: Automatic Response System Using Sms-Java

AppletApplet

Java applets are programs that are Java applets are programs that are embedded in other applications, embedded in other applications, typically in a Web page displayed in typically in a Web page displayed in a Web browsera Web browser

Page 25: Automatic Response System Using Sms-Java

Example of appletExample of applet

import java.applet.Applet;import java.applet.Applet;

import java.awt.Graphics;import java.awt.Graphics;

public class Hello extends Applet { public class Hello extends Applet {

public void paint(Graphics gc) public void paint(Graphics gc) { g.drawString("Hello, world!", 65, { g.drawString("Hello, world!", 65, 95); 95);

} }

}}

Page 26: Automatic Response System Using Sms-Java

CriticismCriticism

PerformancePerformance

Java's performance has increased substantially since Java's performance has increased substantially since the early versions, and performance of the early versions, and performance of JIT compilersJIT compilers relative to native compilers has in some tests been relative to native compilers has in some tests been shown to be quite similar.The performance of the shown to be quite similar.The performance of the compilers does not necessarily indicate the compilers does not necessarily indicate the performance of the compiled code; only careful performance of the compiled code; only careful testing can reveal the true performance issues in any testing can reveal the true performance issues in any systemsystem

Page 27: Automatic Response System Using Sms-Java

Look and feelLook and feel

The default The default look and feellook and feel of of GUIGUI applications written in Java applications written in Java using the using the SwingSwing toolkit is very different from native toolkit is very different from native applications. It is possible to specify a different look and feel applications. It is possible to specify a different look and feel through the through the pluggable look and feelpluggable look and feel system of Swing. Clones system of Swing. Clones of of WindowsWindows, , GTKGTK and and MotifMotif are supplied by Sun. are supplied by Sun. AppleApple also also provides an provides an AquaAqua look and feel for look and feel for Mac OS XMac OS X. Though prior . Though prior implementations of these look and feels have been considered implementations of these look and feels have been considered lacking, Swing in Java SE 6 addresses this problem by using lacking, Swing in Java SE 6 addresses this problem by using more native more native widgetwidget drawing routines of the underlying drawing routines of the underlying platforms. Alternatively, third party toolkits such as platforms. Alternatively, third party toolkits such as wx4jwx4j or or SWTSWT may be used for increased integration with the native may be used for increased integration with the native windowing systemwindowing system

Page 28: Automatic Response System Using Sms-Java

Lack of OO purityLack of OO purity

Java's Java's primitive typesprimitive types are not objects. Primitive types store are not objects. Primitive types store their values in the their values in the stackstack rather than being references to values. rather than being references to values. This was a conscious decision by Java's designers for This was a conscious decision by Java's designers for performance reasons. Because of this, Java is not considered performance reasons. Because of this, Java is not considered to be a pure object-oriented programming language. However, to be a pure object-oriented programming language. However, as of Java 5.0, as of Java 5.0, autoboxingautoboxing enables programmers to write as if enables programmers to write as if primitive types are their wrapper classes, and freely primitive types are their wrapper classes, and freely interchange between them for improved flexibilityinterchange between them for improved flexibility

Page 29: Automatic Response System Using Sms-Java

ResourcesResources Java Runtime EnvironmentJava Runtime Environment: : The The Java Runtime EnvironmentJava Runtime Environment

or or JREJRE is the software required to run any is the software required to run any applicationapplication deployed on the Java Platform. deployed on the Java Platform. End-usersEnd-users commonly use a commonly use a JRE in JRE in software packagessoftware packages and Web browser and Web browser pluginsplugins. Sun also . Sun also distributes a superset of the JRE called the Java 2 distributes a superset of the JRE called the Java 2 SDKSDK (more (more commonly known as the JDK), which includes development commonly known as the JDK), which includes development tools such as the tools such as the Java compilerJava compiler, , JavadocJavadoc, and , and debuggerdebugger..

One of the unique advantages of the concept of a runtime One of the unique advantages of the concept of a runtime engine is that errors (exceptions) should not 'crash' the system. engine is that errors (exceptions) should not 'crash' the system. Moreover, in runtime engine environments such as Java there Moreover, in runtime engine environments such as Java there exist tools that attach to the runtime engine and everytime that exist tools that attach to the runtime engine and everytime that an exception of interest occurs they record debugging an exception of interest occurs they record debugging information that existed in memory at the time the exception information that existed in memory at the time the exception was thrown (stack and heap values). These tools are called was thrown (stack and heap values). These tools are called ExceptionException

Page 30: Automatic Response System Using Sms-Java

Contd.Contd.

Interception or Error Interception tools and they Interception or Error Interception tools and they provide 'root-cause' information for exceptions in provide 'root-cause' information for exceptions in Java programs that run in production, testing or Java programs that run in production, testing or development environmentsdevelopment environments

Page 31: Automatic Response System Using Sms-Java

APIsAPIs Sun has defined three platforms targeting different Sun has defined three platforms targeting different

application environments and segmented many of its application environments and segmented many of its APIsAPIs so that they belong to one of the platforms. The so that they belong to one of the platforms. The platforms are:platforms are:

Java Platform, Micro EditionJava Platform, Micro Edition (Java ME) — targeting (Java ME) — targeting environments with limited resources, environments with limited resources,

Java Platform, Standard Edition (Java SE) — Java Platform, Standard Edition (Java SE) — targeting workstation environments, and targeting workstation environments, and

Java Platform, Enterprise Edition (Java EE) — Java Platform, Enterprise Edition (Java EE) — targeting large distributed enterprise or Internet targeting large distributed enterprise or Internet environments. environments.

Page 32: Automatic Response System Using Sms-Java

JSMSJSMS

Open up the world of "Mobile Messaging" to our Java application. Using jSMS, our application is

quickly enabled to send and receive mobile short messages (SMS).

Page 33: Automatic Response System Using Sms-Java

Software Architecture

The jSMS SDK does not contain any native code and can therefore be run on all available Java2 platforms (e.g.Solaris, Linux, Windows). When using a GSMdevice, your Java Platform must also supply an implementation of javax.comm (Java Communications API).The jSMS programming interface has been designed to be independent of the underlaying protocol. You can easily switch from one transport facility to another one, without needing to change your your application. The jSMS Library requires only 180KB and can therefore also be used in Embedded Devices.

Page 34: Automatic Response System Using Sms-Java

ConnectivityjSMS supports the most widespread protocols used today for mobile messaging. Accessing the mobile network can be achieved by using a GSM device (e.g. a Mobile Phone), a modem connection or the Internet (TCP/IP).

Page 35: Automatic Response System Using Sms-Java

jSMS supported protocols

GSM 03.38, 03.40 & 07.05 (GSM Devices with a built-in Modem)

UCP (Universal Computer Protocol) CIMD2 (Computer Interface to Message Distribution) SMPP (Short Message Peer-to-Peer Protocol) TAP/IXO (Paging Protocol) MM1 (Multimedia Messaging using WAP/WAP PUSH and

GPRS) MM7 (Multimedia Messaging for Value Added Service

Providers)

Page 36: Automatic Response System Using Sms-Java

Message Types

7-Bit Text -max. 160 Characters / Message UCS2 (Unicode) Universal Character Set -

(e.g. for Simplified Chinese) Binary Data (8-Bit) - max. 80 Bytes / Message SmartMessages -Business Cards, Calendar

Entries, Operator Logos, Picture Messages,Ringtones

Status Reports

Page 37: Automatic Response System Using Sms-Java

Message and Sms Message

The base class for all messages (except MMS) in the jSMS API is called Message. A Message object can be sent as an SMS (by using one of the SmsService implementations) or as an email (using the SmtpService). If you want to have more control about the content and attributes of a SMS Message, the class SmsMessage should be used. SmsMessage extends the base Message class and adds additionalfeatures like specifying the message's character encoding (alphabet), setting the validity period of the message, requesting a status report, etc.

Page 38: Automatic Response System Using Sms-Java

Example Code for smsExample Code for sms

importimport com.objectxp.msg.*; com.objectxp.msg.*; public classpublic class SendSMS { SendSMS { public static public static voidvoid main(String args[]) { main(String args[]) { trytry { // Create and initialize a SMS service { // Create and initialize a SMS service SmsService service = SmsService service = newnew GsmSmsService(); GsmSmsService(); service.init(); service.init(); service.connect(); // Create a new SMS Messageservice.connect(); // Create a new SMS Message SmsMessage msg = SmsMessage msg = newnew SmsMessage(service); SmsMessage(service); // Set recipient and message// Set recipient and message msg.setRecipient("0791243657");msg.setRecipient("0791243657"); msg.setMessage("SYS1: Power loss. Shutdown in 5 msg.setMessage("SYS1: Power loss. Shutdown in 5

minutes."); minutes.");

Page 39: Automatic Response System Using Sms-Java

ctdctd

msg.requestStatusReport(true);msg.requestStatusReport(true);// Send the SMS // Send the SMS service.sendMessage(msg);service.sendMessage(msg);

System.out.println("Message sent successfuly, ID is System.out.println("Message sent successfuly, ID is "+msg.getMessageId());"+msg.getMessageId());

service.disconnect(); } service.disconnect(); } catch( MessageException me ) { catch( MessageException me ) { System.out.println("Message could not be sent: System.out.println("Message could not be sent: "+me.getMessage()); "+me.getMessage());

} } finally { if( service != null ) {finally { if( service != null ) { service.destroy(); // Destroy the service } } service.destroy(); // Destroy the service } } }}}}

Page 40: Automatic Response System Using Sms-Java

Multimedia Message Service (MMS)

Currently,jSMS provides a implementation for the following protocol(s):

MM1 (WSP/WTP using WAP-PUSH and a PPP connection)

MM7 (Multimedia Messaging for Value Added Service Providers (VASP))

The MMS Service interface defines the methods to send and receive a Multimedia Message (MMS) to/from a MMS-Proxy/Relay.

Page 41: Automatic Response System Using Sms-Java

ApplicationsApplications

Possible ApplicationsPossible Applications

Alarming Alarming Remote Control Remote Control Monitoring Monitoring Notification Notification Marketing Marketing News servicesNews services

Page 42: Automatic Response System Using Sms-Java

KeywordsKeywords

GSM (Global System for Mobile Communications): The most widely used communication protocol. GSM is used generally for mobile telephone calls. GSM enables 9.6 Kbps data transfer rate.

GPRS (General Packet Radio Service): GPRS allows users to be connected to the network at all times. GPRS transfer rate is between 30 and 100 Kbps and only the traffic generated by the user is billed.

Page 43: Automatic Response System Using Sms-Java

References:References:

http:// www.objectxp.com / http :// java.sun.com /products/ javacomm /

index.html http ://www.wikipedia.com The Complete Reference-Java by Herbert Shildt Programming with Java: E.Balagurusamy Teach yourself Java: Joseph O’Neil Core Java: Gary Cornell