• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Java ME Networking & Connectivity

on

  • 12,581 views

This seminar presents an overview of networking and local connectivity of Java ME platform: HTTP, Sockets, Datagrams, messaging, Bluetooth, serial and RFID.

This seminar presents an overview of networking and local connectivity of Java ME platform: HTTP, Sockets, Datagrams, messaging, Bluetooth, serial and RFID.

Statistics

Views

Total Views
12,581
Views on SlideShare
12,543
Embed Views
38

Actions

Likes
7
Downloads
0
Comments
0

5 Embeds 38

http://www.slideshare.net 22
http://www.javameblog.com 13
http://209.85.135.104 1
http://www.zend2.com 1
http://static.slidesharecdn.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Java ME Networking & Connectivity Java ME Networking & Connectivity Presentation Transcript

    • Java ME Networking & Connectivity Stefano Sanna gerdavax@tiscali.it - http://www.gerdavax.it Supported by: Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Speaker • Stefano Sanna is... – Mobile Application Architect @ Beeweeb – Technical writer @ DEV, JavaJournal, CP, FSM... – Supporter JMDF, JIA, JUG Sardegna, GULCh... – LEGO constructor (since 1973...) Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Agenda • Generic Connection Framework – Networking • Basic: HTTP/HTTPS • Low-level: socket, serversocket, datagrams • Messaging • Web Services • Multimedia – Local connectivity: • Bluetooth • IrDA & Serial ports • Near Field Communication • Conclusions Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Agenda • Generic Connection Framework – Networking • Basic: HTTP/HTTPS • Low-level: socket, serversocket, datagrams • Messaging • Web Services • Multimedia – Local connectivity • Bluetooth • IrDA & Serial ports • Near Field Communication • Conclusions Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Java ME: made for connectivity • Many optional APIs for the Java ME platforms have been designed to support remote and local connectivity on consumer handsets • Manufacturers can add and remove support for protocols with no impact to the whole runtime Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Generic Connection Framework • The Generic Connection Framework (GCF) is the core library component that provides dynamic access to any communication protocol with a standard interface • The Connector factory creates connections according to URI schemas and protocols: Protocols: Connection connection = Connector.open(SCHEMA); - HTTP/HTTPS - Socket/SecureSocket InputStream input = connection.openInputStream(); - ServerSocket - Datagram OutputStream output = connection.openOutputStream(); - Serial (Comm & IrDA) - SMS/MMS - Bleutooth // your logic here! :-) - Contactless (NFC) connection.close(); Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Agenda • Generic Connection Framework – Networking • Basic: HTTP/HTTPS • Low-level: socket, serversocket, datagrams • Messaging • Web Services • Multimedia – Local connectivity: • Bluetooth • IrDA & Serial ports • Near Field Communication • Conclusions Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Basic networking • The MIDP Profile requires Java runtime environment to support both HTTP and HTTPS connections • HttpConnection and HttpsConnection encapsulate HTTP protocol: HttpConnection connection; connection = (HttpConnection) Connector.open(“http://www.jmdf.org”); InputStream input = connection.openInputStream(); if (connection.getResponseCode() == HttpConnection.OK) { // you can now download the web page... } Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Low-level networking • Low-level networking library is key requirement for instant messaging, M2M communication • A MIDP device may support direct access to transport-level protocols TCP and UDP, in both client and server mode: – Socket, ServerSocket, Datagram Connector.open(“socket://www.myhost.it:3040”); Connector.open(“socket://:3040”); // creates a listening connection Connector.open(“datagram://updserver.myhost.it:4556”); Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Messaging • SMS and MMS are most popular facilities since the advent of 2G mobile telephony • JME supports short text, binary and multipart messages on the Wireless Messaging API: – JSR 120: SMS – JSR 205: MMS • MIDlets can send/receive messages to/from a registered port (as in TCP/UDP connections) using the schema: sms://RECIPIENT:PORT Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Messaging • GCF and custom classes manage message dispatch and notification SENDING A MESSAGE: String recipient = "sms://+391234567890:12345"; MessageConnection conn; conn = (MessageConnection) Connector.open(recipient); TextMessage msg = (TextMessage) conn.newMessage(conn.TEXT_MESSAGE); msg.setPayloadText("Hello World!"); • MIDP 2.0 Push conn.send(msg); Registry lets RECEIVING A MESSAGE: MIDlets to be MessageConnection c; c = (MessageConnection) Connector.open("sms://:12345"); registered on Message msg = c.receive(); if (msg instanceof TextMessage) { an assigned port TextMessage tmsg = (TextMessage)msg; // Handle the text message... } and executed when a message has been received Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Web services • Access to web services is provided by the WSA (Web Services API, JSR 172) MIDlet • Stub generators create Stub mobile-side client interface automatically WSA Service Provider using WSDL Interface JAXP JAX-RPC Compatibility is limited to WS-I Basic Profile 1.0 MIDP/PP CLDC/CDC • Lightweight Web Services (REST/JSON) can be supported using basic HttpConnection (GET/POST) and JAXP subset of JSR 172 Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Multimedia • Mobile Media API (JSR 135) enables audio and video playback and recording • It supports standard download, progressive download and RTSP RTSP • Custom DataSources can be HTTP implemented to support (Progressive download) new protocols and servers Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Multimedia • Transport is nearly neutral for developers: Manager and Player classes hide all details related to protocols, formats and encodings • Easy to play a song using HTTP: Player player = Manager.createPlayer(“http://myhost.it/song.mp3”); player.realize(); player.prefetch(); player.start(); 3Player plays any kind of music source (even with DRM) using MMAPI and custom datasources Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Multimedia • Easy to play a video using RTSP: Player player = Manager.createPlayer(“rtsp://myhost.it/video.3gp”); player.realize(); player.prefetch(); VideoControl vc = (VideoControl) player.getControl(“VideoControl”); vc.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, aCanvas); vc.setVisible(true); player.start(); BeeTV plays seamlessly live and video-on-demand channels Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Agenda • Generic Connection Framework – Networking • Basic: HTTP/HTTPS • Low-level: socket, serversocket, datagrams • Messaging • Web Services • Multimedia – Local connectivity • Bluetooth • IrDA & Serial ports • Near Field Communication • Conclusions Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Local connectivity • Computer is ubiquitous: any object can be equipped with an small embedded CPU and some wireless module • Local connectivity (aka ad-hoc networking) is the ability of any device to transmit and receive data with its surroundings • Java ME provides a rich set of optional APIs to access common wireless and wired devices Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Bluetooth • Bluetooth is the leading consumer technology for local connectivity: peripherals, P2P networks, environment awareness... MASTER MASTER • JSR 82 (Bluetooth API) provides powerful interface to device and service discovery, L2CAP and RFCOMM connections, OBEX Push client and server Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Bluetooth • Four lines of code to open connection to a Bluetooth GPS and read NMEA connect to the RFCOMM serial port and read data: gps = “btspp://0002C71536EA:1;authenticate=false;encrypt=false;master=false"; StreamConnection conn = (StreamConnection) Connector.open(gps); buffer = new BufferedReader(new InputStreamReader(conn.openInputStream())); // it's time to read the first line: String nmea_sentence = buffer.readLine(); • NMEA sentences contain position data: Satellites $GPGGA,164922.982,3859.4108,N,00856.1785,E,1,04,3.4,127.9,M,47 .6,M,0.0,0000*7A Latitude Longitude Altitude Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • IrDA & Serial Ports • Embedded modules often use old-fashioned infrared and serial ports. These interfaces are still in use for industrial applications to access IrDA printers, barcode and RFID readers... • The GCF provides transparent access to them: Connector.open(“comm:com0;baudrate=19200”); • Example: Windows Mobile PDAs have CompactFlash socket for enhanced peripherals Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Near Field Communication • Near Field Communication (NFC) is a new, short-range wireless connectivity technology that evolved from contactless identification and interconnection technologies • JSR 257 (Contactless API) provides full support for reading/writing mode of ISO 14443 tags and inter-device communication • Nokia 6131 NFC is the first device compatible with this API Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Network Monitor Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Conclusions • Java ME has been designed “with networking and connectivity in mind” • The Generic Connection Framework provides homogeneous access to any I/O interface for both remote and local connectivity • Upcoming networking standard are under specification and will be seamlessly integrated in next-generation Java ME runtimes Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • About me • Stefano Sanna – Website: http://www.gerdavax.it – Email: gerdavax@tiscali.it • Java Mobile Developers Forum – Website: http://www.jmdf.org • Beeweeb Technologies – Website: http://www.beeweeb.com Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org
    • Thank you :-) Java ME Networking & Connectivity (Versione 1.0) (C) 2007 Stefano Sanna http://www.gerdavax.it - gerdavax@tiscali.it Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation. Please, find a copy of the license at: http://www.gnu.org/copyleft/fdl.html http://www.gnu.org/copyleft/fdl.html Java ME Connectivity Overview – ActionScript.it and JMDF online Meeting, 21-03-2007 - http://www.jmdf.org