Download Automatic Response System Using Sms

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Automatic Response System
Using Sms
By www.PPTSWorld.com
Contents:













Methodology
Why Java?
Reasons for using java
Comparison to other langauges
History of Java
Introduction
Primary goals of using java
Types of Java
Critisism
JSMS:Software Architecture
JSMS Supported Protocols
Message Types
References:
Methodology




Mobile is connected to serial port of computer.
Whenever any message arrives on that mobile ,it is
accepted by java program running on the computer.
Program will read message arrived on pc & extract
the contents.
Depending upon contents of message, program will
connect to particular database for specific data asked
in the Sms.
Contd.




Data is retrieved & an sms is framed.
This sms is tranferred to the mobile
connected to pc using JSMS API.
It will send sms to requesting mobile using
program.
We are using Java for developing the
application.
Why JAVA?
Java is a programming language originally developed
by Sun Microsystems and released in 1995. The
language derives much of its syntax from C and C++
but has a simpler object model and fewer low-level
facilities. Java applications are typically compiled to
byte code which can run on any Java virtual machine
regardless of computer architecture. Java now forms
the core of Sun's Java platform.
Reasons for using JAVA:


Java Is Small and Simple :The most complex parts
of C++ were excluded from Java, such as pointers
and memory management. These elements are
complicated to use, and are thus easy to use
incorrectly.
Java Is Object Oriented :OOP organizes a
program as a set of components called objects.
These objects exist independently of each other,
and they have rules for communicating with other
objects and for telling those objects to do things.
Contd.

Java is Dynamic :Java programmes carry with them
substantial amounts of run-time type information that
is used to verify and resolve accesses to objects at runtime. This makes it possible to dynamically link code
in a safe and expedient manner. This is crucial to the
robustness of the applet environment.

Java is Architecture-Neutral :The Java
designers made several hard decisions in the
Java language and the Java Virtual Machine in
an attempt to alter the situation of programmes
not running on the same machine after few
days.
Comparison to other languages


Multiple Vendor Choice and Support
Java technologies are supported by multiple vendors allowing
mix and match and best of breed solutions. Java standard APIs
have always been designed to be supported by multiple
implementations
Compile to Machine Code
Java has several solutions to compiling into machine code, that
is when compiling to byte code is an issue for either
intellectual property or performance reasons.
Contd.


Future Proof
Java is future proof or rather future portable, in the sense that
your existing code base will not become obsolete. How so? I
can run Java on machines today and machines in the future.
You don't have that assurance for Microsoft's technologies like
.NET.
Most Popular Language in the Corporation
A recent survey reveals "Interestingly, the strong showing of
Visual C# .NET divides the Microsoft camp and propels Java
into first place as the most popular language over the coming
year".
Contd.


More Homogeneous and Less Complex Environment
The Java environment is more homogeneous and less complex
than .NET. It is not littered with obsolete technologies like
COM, DCOM, COM+, ADO, nor is it dependent on operating
system indiosyncracies like register settings or most recent
service patch level.
Java IDEs are superior in their support for coding tasks.
Features like code refactoring, intention actions, superior code
browsing (i.e Find Usages) and robust code completion are
superior to what you find in Visual Studio.NET. In fact, Visual
Studio.NET is known to unintentionally erase code.
Contd.

Cross Platform Integration with Other Languages
Integration with Java from other languages like Perl, PHP or
Python is cross platform. In otherwords, I can take my PHP
scripts that talk to Java and run in windows, place them in a
Linux box and have them work without a major porting effort.
History of Java
Java started as a project called "Oak" by James Gosling in
June 1991 for use in a set top box project. Gosling's goals were
to implement a virtual machine and a language that had a
familiar C/C++ style of notation. The first public
implementation was Java 1.0 in 1995. It promised "Write
Once, Run Anywhere" (WORA), providing no-cost runtimes
on popular platforms. It was fairly secure and its security was
configurable, allowing network and file access to be restricted.
Major web browsers soon incorporated the ability to run
secure Java "applets" within web pages. Java became popular
quickly. With the advent of "Java 2", new versions had
multiple configurations built for different types of platforms.
Introduction to Language



Java applications are typically compiled to bytecode, although
compilation to native machine code is also possible. At
runtime, bytecode is usually either interpreted or compiled to
native code for execution, although direct hardware execution
of bytecode by a Java processor is also possible.
The language itself derives much of its syntax from C and C++
but has a simpler object model and fewer low-level facilities.
JavaScript, a scripting language, shares a similar name and has
similar syntax, but is not directly related to Java.
Sun Microsystems provides a GNU General Public License
implementation of a Java compiler and Java virtual machine,
in compliance with the specifications of the Java Community
Process, although the class library that is required to run Java
programs is not free software.
Primary goals





There were five primary goals in the creation of the Java
language:
It should use the object-oriented programming methodology.
It should allow the same program to be executed on multiple
operating systems.
It should contain built-in support for using computer networks.
It should be designed to execute code from remote sources
securely.
It should be easy to use by selecting what was considered the
good parts of other object-oriented languages
Contd.


In 1997, Sun approached the ISO/IEC JTC1 standards body
and later the Ecma International to formalize Java, but it soon
withdrew from the process.[5][6][7] Java remains a proprietary
de facto standard that is controlled through the Java
Community Process.[8] Sun makes most of its Java
implementations available without charge, with revenue being
generated by specialized products such as the Java Enterprise
System. Sun distinguishes between its Software Development
Kit (SDK) and Runtime Environment (JRE) which is a subset
of the SDK, the primary distinction being that in the JRE the
compiler is not present.
On November 13, 2006, Sun released parts of Java as
free/open source software, under the GNU General Public
License (GPL). The release of the complete source code under
GPL is expected in the first half of 2007
Platform independence


One characteristic, platform independence, means that
programs written in the Java language must run similarly on
any supported hardware/operating-system platform. One
should be able to write a program once, compile it once, and
run it anywhere.
This is achieved by most Java compilers by compiling the Java
language code "halfway" to bytecode simplified machine
instructions specific to the Java platform. The code is then run
on a virtual machine (VM), a program written in native code
on the host hardware that interprets and executes generic Java
bytecode. (Further, standardized libraries are provided to allow
access to features of the host machines (such as graphics,
threading and networking) in unified ways. Note that, although
there is an explicit compiling stage, at some point, the Java
bytecode is interpreted or converted to native machine
instructions by the JIT compiler
Automatic garbage collection
One of the ideas behind Java's automatic memory management
model is that programmers be spared the burden of having to
perform manual memory management. In some languages the
programmer allocates memory for the creation of objects
stored on the heap and the responsibility of later deallocating
that memory thus resides with the programmer. If the
programmer forgets to deallocate memory or writes code that
fails to do so, a memory leak occurs and the program can
consume an arbitrarily large amount of memory. Additionally,
if the program attempts to deallocate the region of memory
more than once, the result is undefined and the program may
become unstable and may crash. Finally, in non garbage
collected environments, there is a certain degree of overhead
and complexity of user-code to track and finalize allocations.
Often developers may box themselves into certain designs to
provide reasonable assurances that memory leaks will not
occur.
Contd.

In Java, this potential problem is avoided by automatic
garbage collection. The programmer determines when
objects are created, and the Java runtime is responsible
for managing the object's lifecycle. The program or other
objects can reference an object by holding a reference
to it (which, from a low-level point of view, is its address
on the heap). When no references to an object remain,
the Java garbage collector automatically deletes the
unreachable object, freeing memory and preventing a
memory leak. Memory leaks may still occur if a
programmer's code holds a reference to an object that is
no longer needed—in other words, they can still occur
but at higher conceptual levels.
Syntax

The syntax of Java is largely derived from C++. However,
unlike C++, which combines the syntax for structured, generic,
and object-oriented programming, Java was built exclusively
as an object oriented language. As a result, almost everything
is an object and all code is written inside a class. The
exceptions are the intrinsic data types (ordinal and real
numbers, boolean values, and characters), which are not
classes for performance reasons.
Example:Hello world
public class Hello
{
public static void main(String[] args)
{
System.out.println("Hello, World!");
}
}
An example that better demonstrates object-oriented
programming:
// OddEven.java
import javax.swing.JOptionPane;
public class OddEven {
private int input; public OddEven() {
input =
integer.parseInt(JOptionPane.showInputDialog("
Please Enter A Number")
); }
public void calculate() {
if (input % 2 == 0)
Odd even
System.out.println("Even");
else
System.out.println("Odd"); }
public static void main(String[] args)
{
OddEven number = new OddEven();
number.calculate();
}
}
Types of Java





There are many types of Java programs which
run differently:
Applet - can be put online (in web browsers).
Application - can only be run on the computer,
cannot be put online.
Servlet - runs on a server and helps to display
web pages.
Swing application - like an application, but can
have a more graphical look.
Applet

Java applets are programs that are
embedded in other applications, typically
in a Web page displayed in a Web browser
Example of applet
import java.applet.Applet;
import java.awt.Graphics;
public class Hello extends Applet {
public void paint(Graphics gc) {
g.drawString("Hello, world!", 65, 95);
}
}
Criticism

Performance
Java's performance has increased substantially since
the early versions, and performance of JIT compilers
relative to native compilers has in some tests been
shown to be quite similar.The performance of the
compilers does not necessarily indicate the
performance of the compiled code; only careful
testing can reveal the true performance issues in any
system
Look and feel

The default look and feel of GUI applications written in Java
using the Swing toolkit is very different from native
applications. It is possible to specify a different look and feel
through the pluggable look and feel system of Swing. Clones
of Windows, GTK and Motif are supplied by Sun. Apple also
provides an Aqua look and feel for Mac OS X. Though prior
implementations of these look and feels have been considered
lacking, Swing in Java SE 6 addresses this problem by using
more native widget drawing routines of the underlying
platforms. Alternatively, third party toolkits such as wx4j or
SWT may be used for increased integration with the native
windowing system
Lack of OO purity

Java's primitive types are not objects. Primitive types store
their values in the stack rather than being references to values.
This was a conscious decision by Java's designers for
performance reasons. Because of this, Java is not considered to
be a pure object-oriented programming language. However, as
of Java 5.0, autoboxing enables programmers to write as if
primitive types are their wrapper classes, and freely
interchange between them for improved flexibility
Resources


Java Runtime Environment: The Java Runtime
Environment or JRE is the software required to run any
application deployed on the Java Platform. End-users
commonly use a JRE in software packages and Web browser
plugins. Sun also distributes a superset of the JRE called the
Java 2 SDK (more commonly known as the JDK), which
includes development tools such as the Java compiler,
Javadoc, and debugger.
One of the unique advantages of the concept of a runtime
engine is that errors (exceptions) should not 'crash' the system.
Moreover, in runtime engine environments such as Java there
exist tools that attach to the runtime engine and everytime that
an exception of interest occurs they record debugging
information that existed in memory at the time the exception
was thrown (stack and heap values). These tools are called
Exception
Contd.
Interception or Error Interception tools and they
provide 'root-cause' information for exceptions in
Java programs that run in production, testing or
development environments
APIs




Sun has defined three platforms targeting different
application environments and segmented many of its
APIs so that they belong to one of the platforms. The
platforms are:
Java Platform, Micro Edition (Java ME) — targeting
environments with limited resources,
Java Platform, Standard Edition (Java SE) —
targeting workstation environments, and
Java Platform, Enterprise Edition (Java EE) —
targeting large distributed enterprise or Internet
environments.
JSMS
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).
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.
Connectivity
jSMS 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).
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)
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
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 additional
features like specifying the message's character
encoding (alphabet), setting the validity period of the
message, requesting a status report, etc.
Example Code for sms
import com.objectxp.msg.*;
public class SendSMS {
public static void main(String args[]) {
try { // Create and initialize a SMS service
SmsService service = new GsmSmsService();
service.init();
service.connect(); // Create a new SMS Message
SmsMessage msg = new SmsMessage(service);
// Set recipient and message
msg.setRecipient("0791243657");
msg.setMessage("SYS1: Power loss. Shutdown in 5
minutes.");
ctd
msg.requestStatusReport(true);
// Send the SMS
service.sendMessage(msg);
System.out.println("Message sent successfuly, ID is
"+msg.getMessageId());
service.disconnect(); }
catch( MessageException me ) {
System.out.println("Message could not be sent:
"+me.getMessage());
}
finally { if( service != null ) {
service.destroy(); // Destroy the service } }
}}
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.
Applications
Possible Applications

Alarming
Remote Control
Monitoring
Notification
Marketing

News services




Keywords


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.
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