J2ME Home Monitoring - EECS People Web Server

Download Report

Transcript J2ME Home Monitoring - EECS People Web Server

J2ME Technology
J2ME Home Monitoring
The Java™ 2 Platform
Java Technology Benefits
• Learn Once… Write Anywhere
• Dynamic provisioning of new
applications
• Enhanced User experience
– Dynamic, graphical content
– Fast interaction (local operation)
– Disconnected operation (convenience, costeffective)
– Intelligent network bandwidth usage
• Leverage 2.5 million Java developers
• Availability of development tools
– Large selection of available tools
Java Enabled Content for Wireless
Mobile
Communication
Services
Email
CRM
Instant Messaging
Mobile
Commerce
Services
Mobile
Information
Services
SMART
Wireless
Portal
Infrastructure
News
Stock Updates
Weather forecast
Directories
Location-based services
Music
Mobile
Entertainment Games
Video
Services
Streaming
Auctions
Banking and Trading
Travel Reservations
Mobile
Enterprise
Services
Productivity
Collaboration
Work-Force Automation
J2ME User Initiated Provisioning
Advertise
App on
Web Page
Descriptor File
Name
Version
Size
App URL
...
Handset
Downloads
Descriptor File
OTA
User
Selects
App
Java Application
Jar file
“Breakout”
game
Handset
Downloads
Application
HTTP Network Transfer
OTA
Java Service Vending Machine
J2ME CDC
Major J2ME Adoption
Handset Manufacturers
Wireless Operators
Major Industry Interest
Java Service Vending Machine Industry Players
Mobilitec
Iplanet
ATG
Openwave
4thpass
BEA
Ellipsus
J2ME Home Monitoring
What is J2ME Home Monitoring:
It is a Java Application for your remote visual monitoring needs. You can
monitor your office, warehouse, yard and other places while you are on-the-go.
The software package allows you to easily view up-to-the-minute images of
the places or things you wish to monitor, right on your mobile device.
David Fox won the Motorola-Nextel Developer Challenge at JavaOne
by whipping up a program that lets you control lights and appliances
at home via cell phone, and stream webcam images to its tiny screen.
And, he did it in six hours, and drove away in a BMW Z3 for his efforts.
The contest was simple enough -- write an application, any application,
for the new Motorola i85s cell phone.
From design to prototype to build to deploy, in six hours or less.
J2ME Home Monitoring
Hardware and Software Requirements
1.
2.
3.
IBM-compatible personal computer with an attached PC Camera.
JDK1.3.1(base tools needed to develop Java applets and applications)
J2ME emulator for developing and testing the MIDlet
( a set of tools that provides developers with the emulation environment,
documentation and examples needed to develop CLDC/MIDP compliant applications,
Microsoft Windows 98 Second Edition, Microsoft Windows NT or Microsoft Windows 20
4.
5.
PNG Image converter
A web server or a web space for your home page
J2ME Home Monitoring
A use case of J2ME Home Monitor
1.
2.
3.
4.
5.
The PC Camera can be set to take a picture each 10 seconds.
The picture will be placed in a certain directory.
The PNG Converter will pick the image from a certain directory and co
it from jpg to png format.
The batch file will pick the png image and ftp it to a certain directory o
The Java 2 application allows you to “pull” down the last image uploa
and view it on your mobile device.
J2ME Home Monitoring
Batch script
:start
C:\PROGRA~1\2png\2png.exe s="C:\delete\Source\*.*" d="c:\delete\destination" -q75 -w
c:\WINNT\system32\ftp -s:ftp.TXT
@echo off
echo Starting!
echo Wscript.Sleep 10000> sleep.vbs
start /w wscript.exe sleep.vbs
echo Done!
del sleep.vbs
@echo off
goto :start
d at:
Description:
Pic2Pic Pro is easy to use and powerful utility for
batch conversion of image files using scripts.
J2ME Home Monitoring
ftp script
open 10.213.51.154
userID
Password
# directory of destination
cd /app
cd weblogic
cd nunivak
cd wlserver6.1
cd config
cd eghosh01domain
cd applications
binary
hash
#directory of source
lcd c:\delete\source
put Sample.png
Testing your application
Ihttp://people.ku.edu/~eghosh01/monitor.png
J2ME application:
Consists of two classes
VideoTimer ClassJ
MIDlet ClassJ
VideoTimer, which calles a nextImage() method every couple of seconds:
nextImage
httpconnection.openDataInputStream()
datainputstream.readFully(abyte0)
createImage()
J2J
class VideoTimer extends TimerTask {
VideoTimer()
{
}
public void run() {
try {
nextImage();
frm.append(image);
disp.setCurrent(frm);
} catch (Exception ex) {
System.out.println("Exception
" + ex);
}
}
}
MIDlet Class:
The timer is triggered like this:
timer = new Timer();
vt = new VideoTimer();
timer.schedule(vt,(long)10,10);
It also needs to pass the
Form and display obkect to VideoTimer Class
J2ME Home Monitoring
Software
1. JavaTM 2 SDK, Standard Edition
Version 1.3.1_02
http://java.sun.com/j2se/1.3/download-windows.html
Description:
2. JavaTM 2 Platform Micro Edition, Wireless Toolkit 1.0.3
http://java.sun.com/products/j2mewtoolkit/download.html
3. Pic2PicPro
http://www.wavelsoftware.com/pc2pcpro.htm
References

Wireless Java with J2ME in 21 days
Wireless programming with Java 2 Micro
Edition


http://www-106.ibm.com/developerworks/

http://java.sun.com/j2me/