1 / 40

Mini Course

Mini Course. Programming Context-aware Mobile Phones Thomas Bodin IT University of Copenhagen. Week agenda. 09.00 - 12.00: Lectures in AUD 3 13.00 - 16.00: Exercises in room 3A52 Homepage: http://lacomoco.itu.dk/minicourse/. Monday agenda. Context-aware computing

rumer
Télécharger la présentation

Mini Course

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mini Course Programming Context-aware Mobile Phones Thomas Bodin IT University of Copenhagen

  2. Week agenda 09.00 - 12.00: Lectures in AUD 3 13.00 - 16.00: Exercises in room 3A52 Homepage:http://lacomoco.itu.dk/minicourse/

  3. Monday agenda • Context-aware computing • There is more to Context than Location • On location models for ubiquitous computing • Positioning Technologies • Mobility Lab • Introduction to week exercise • The afternoon exercises will lead to a small distributed system consisting of a client-side covering the j2ME/JSR 82 API and a server-side covering the BlipNet API. • Introduction to server-side programming • Design Patterns • Distributed system

  4. Context-aware computing • There is more to Context than Location • December 1999 • On location models for ubiquitous computing • 25 August 2004

  5. There is more to Context than Location • Mobile computing vs. ultra-mobile computing • Ultra-mobile devices (PDA, mobile phones, wearable computers) • Related Work • Active Badge System (sensing locality of mobile users) • Stick-e-notes (time and location tagging) • Observation • Lack of context definition • Location sensing is dominant • Lack of sensor employment

  6. There is more to Context than Location • Context model proposal • Describes the situation/environment a device/user is in • Identified by a unique name that goes into two general categories • Human factors • Physical environment • For each context a set of features is relevant • For each relevant feature a range of values is determined by the context • Applying context in two general ways • Changes in the environment (e.g. walking tour) • Improvement of the user interface (e.g. light-sensitive display and orientation-sensitive user interface)

  7. There is more to Context than Location • Three application domains • Adaptive user interfaces (interaction styles and display modes) • Context-aware communication (filter, reroute and deliver messages and streams in accordance with context) • Proactive application scheduling (ad hoc style of interaction)

  8. There is more to Context than Location • Sensor technology • Optical/Vision (photo-diode, color sensor, IR, UV-sensor etc.) • Main color, motion detection (low processing) • Detection of objects, landmarks, people, gestures etc. (high processing) • Audio (microphone and electronics) • Determination of loudness, background noise and base frequency • Speaker identification • Motion (mercury switches, angular sensors and accelerometers) • Detection of stationary vs. moving • Location (GPS, GSM, Wi-Fi, Bluetooth etc)

  9. There is more to Context than Location • Sensor technology (continued) • Bio-Sensors (pulse, skin resistance, blood pressure etc.) • Emotional state can be estimated • Specialized sensors (touch, temperature, air pressure etc.) • Specialized applications • Security systems

  10. There is more to Context than Location • Sensor fusion • Physical/logical sensors • Cues: abstraction from physical/logical sensors • Ex 1: Artificial light, stationary or walking, room temperature, dry • Ex 2: Natural light (clody or sunny), walking or running, dry or raining, high pulse • Context: description of a current situation • Ex 1: In the office • Ex 2: Jogging • Scripting: including context in application

  11. On location models for ubiquitous computing • Crucial for location-based or context-aware applications • Supporting position, nearest neighbor and range queries • No location model satisfies all identified requirements (choose location models carefully with respect to the required spatial reasoning and the involved modeling effort). • Geometric coordinates (Global Positioning System (GPS), active bat system) • Symbolic coordinates (Global System for Mobile Communications (GSM), active badge system based on infrared signals (IR) or radio frequency identification (RFID))

  12. On location models for ubiquitous computing The system model consists of three kinds of components:

  13. On location models for ubiquitous computing • Use cases for location models • Position queries • Geometric position (global and local coordinate reference systems) • Symbolic position (cell IDs) • Nearest Neighbor queries • Searching for the n objects closest to a certain position • Distance function required

  14. On location models for ubiquitous computing • Use cases for location models (continued) • Navigation • The topological relation connected to (finding the shortest/fastest path • Range queries • The topological relation contained in

  15. Positioning Technologies • WLAN • WiFi Positioning • Bluetooth Positioning • GSM • GPS • RFID

  16. WLAN • IEEE (Institute of Electrical and Electronics Engineers) is a non-profit organization that develops, defines, and reviews electronics and computer science standards. • Wireless Local Area Network (WLAN) Working Group (802.11) • IEEE 802.11b – Wireless Fidelity (WiFi) providing 11 Mbps data rate in 2.4 GHz ISM band • Wireless Personal Area Network (WPAN) Working Group (802.15) • IEEE 802.15.1 – Bluetooth providing 1 Mbps data rate and 10 – 100 meter range in the 2.4 GHz ISM band

  17. WLAN – WiFi Positioning A calibration model is used to calculate the device location based on the received signal strengths.

  18. WLAN – Bluetooth Positioning

  19. GSM • GSM (Global System for Mobile Communications) has become the most successful global mobile technology for mobile phones and digital cellular networks with more than one billion subscribers. • GPRS (general packet radio service) is used as a data service upgrade to the GSM network with transmission bit rates from 9.6 Kbps to more than 150 Kbps. It supplements the SMS (Short Message Service). • The new EDGE air interface has been developed specifically to meet the bandwidth needs of 3G.

  20. GSM

  21. GPS • GPS (Global Positioning System) is a satellite navigational system formed by 24 satellites making two complete orbits every 24 hours • By using three satellites, GPS can calculate the longitude and latitude of the receiver based on where the three spheres intersect (cf. triangulation). • Developed and operated by the U.S. Department of Defense. • Galileo will be Europe’s own global navigation satellite system, providing a highly accurate, guaranteed global positioning service under civilian control. It will be inter-operable with GPS and GLONASS, the two other global satellite navigation systems

  22. RFID • RFID (Radio Frequency Identification) • A technology similar in theory to bar code identification • Transmission ranges of more than 90 feet

  23. Mobility Lab

  24. Mobility Lab - Support • Webpage: http://mobilitylab.itu.dk/ • Opening hours according to personal support and equipment registration: Monday-Friday 13.00 - 14.00 • Newsgroup: it-c.mobilitylab • Mailinglist: mobilitylab@itu.dk

  25. Introduction to week exercise • The afternoon exercises will lead to a small distributed system consisting of a client-side covering the j2ME/JSR 82 API and a server-side covering the BlipNet API. • Initially, the overall functionality will be to exchange small visiting cards with name, phone number, current location etc. Also, this information exchange may include messages attached to certain locations of mobile devices. Technologically, the exchange service will rely on a certain Bluetooth profile (supported by the mobile phone), and the location of a mobile device is achieved through a Bluetooth access point (cf. cell id).

  26. Introduction to week exercise

  27. Introduction to week exercise • The SPP Server contains 4 main classes • SppServer • Handles the connection to the BlipServer • Spawns an SppServerSession object when a connection to a mobile phone (cf. terminal) has been made • SppServerSession • Management of input-/output stream • Implementation of application protocol • SppServerDatabase • Management of the JDBC in order to register terminals (bluetooth address, name, phonenumber) • SppServerException

  28. Introduction to week exercise • The SPP MIDlet contains 8 main classes • SppMIDlet • Initializes the MIDlet • SppDiscovery • Discovers the connected BlipNodes (cf. inquiry) • SppBlipNodeList • Appends the BlipNodes (discovered by the SppDiscovery) to the mobile phone display • SppStream • Management of input-/output stream • Implementation of application protocol

  29. Introduction to week exercise • The SPP MIDlet contains 8 main classes (continued) • SppCardForm • Handles the exchange of visiting card data (bluetooth address, name, phonenumber) • SppCardPositionForm • Handles the name and area exchange (e.g. the user requests the server with a username, and the responds with an area, if the username is registered by the server) • SppStore • Handles the persistence of data (bluetooth address, name, phonenumber and area) on the mobile phone • SppException

  30. Introduction to week exercise • The database ’spp’ contains 3 tables • The ’area’ table contains 2 columns: ’area_id’, ’type’ • The ’card’ table contains 3 columns: ’card_id’, ’bluetooth_address’, ’name’, ’phonenumber’ • card_position contains 3 columns: ’card_id’, ’area_id’, ’timestamp’

  31. Introduction to server-side programming • Design patterns • Singleton pattern • Observer pattern • Distributed System • Application Protocol • Database connectivity (JDBC)

  32. Design patterns • The idea behind object-oriented programming is that a computer program is composed of a collection of individual units, or objects, as opposed to a traditional view in which a program is a list of instructions to the computer. Each object is capable of receiving messages, processing data, and sending messages to other objects. • Abstraction, encapsulation, polymorphism and inheritance are key concepts in object-oriented programming

  33. Design patterns • Observer pattern

  34. Design patterns • Observer pattern UML • Minimal coupling between the Subject and the Observer • Support for event broadcasting

  35. Design patterns • Singleton pattern UML • Controlled access to sole instance • Permits a variable number of instances

  36. Design patterns public class SppServerDatabase { private static SppServerDatabase database; private SppServerDatabase() throws SppServerException { try { Class.forName(“org.gjt.mm.mysql.Driver”); connection = DriverManager.getConnection(“jdbc:mysql://localhost/spp”, “root”, “ml”); System.out.println(“Connection successful!”); } catch(ClassNotFoundException cnf) { throw new SppServerException(cnf.getMessage()); } catch(SQLException sqle) { throw new SppServerException(sqle.getMessage()); } } public synchronized static SppServerDatabase getSppServerDatabase() throws SppServerException { if(database == null) database = new SppServerDatabase(); return database; } (…)

  37. Distributed System • A distributed system is defined as one in which hardware or software components located at networked computers communicate and coordinate their actions only by passing messages. • This mini course focuses on the client-server model communicating over the Serial Port Profile (cf. Bluetooth).

  38. Distributed System • Application Protocol (server-side) public void run() { while(true) { try { byte[] flag = new byte[1]; is.read(flag, 0, 1); int i = (int)flag[0]; switch(i) { case CARD: readCard(); break; case CARD_POSITION: break; } } catch(IOException ioe) {} } }

  39. Distributed System • Application Protocol (client-side) public void sendCard(String bluetoothAddress, String name, String phonenumber) throws SppException { byte[] flag = new byte[4]; flag[0] = (byte)CARD; flag[1] = (byte)bluetoothAddress.getBytes().length; flag[2] = (byte)name.getBytes().length; flag[3] = (byte)phonenumber.getBytes().length; try { os.write(flag); os.write(bluetoothAddress.getBytes()); os.write(name.getBytes()); os.write(phonenumber.getBytes()); os.flush(); } catch(IOException ioe) { System.out.println("IO Exception!"); } }

  40. Distributed System • Database connectivity (JDBC) public void setCardId(String btAddress, String name, String phonenumber) throws SppServerException { String query = "insert into card values (null, '” + btAddress + "','" + name + "','" + phonenumber + "')"; try { Statement statement = connection.createStatement(); statement.execute(query); ResultSet resultSet = statement.getResultSet(); } catch(SQLException sqle) { throw new SppServerException(sqle.getMessage()); } }

More Related