Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Android Bluetooth Hacking Java Day2010 Eng

16.625 Aufrufe

Veröffentlicht am

Presents the first and only (so far) android bluetooth library!

Veröffentlicht in: Technologie, News & Politik
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... ,DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ,DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ,DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ,DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ,DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ,DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier

Android Bluetooth Hacking Java Day2010 Eng

  1. 1. Bluetooth Hacking Stefano Sanna - JUG Sardegna Emanuele Di Saverio - JUG Roma Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 01/30/2010
  2. 2. Outline • Who we are • The relevance of Bluetooth on mobile devices • Android & Bluetooth: an unconsummated marriage • Happy hacking! • Bluetooth API for Android 1.x • Official API for Android 2.x • Demo: Android controls Arduino Bluetooth Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  3. 3. Who we are • Stefano Sanna • Senior Solution Engineer Android @ beeweeb SpA • Author of the book “Java Micro Edition”, Hoepli (2007) • Main designer Bluetooth API for Android 1.x • Emanuele Di Saverio • Scrum Master and Senior Developer @ beeweeb SpA • SCMAD, SCJP • Committer easy-bluetooth spin-off for Android Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  4. 4. Bluetooth on Android • early Android • Wrapper Java su Bluez • Android 0.9 • API Bluetooth disappears! • Android 1.x • No API for developers • Android 2.x • Exposes an API allowing discovery of remote devices, opening and accepting RFCOMM connections Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  5. 5. The relevance of Bluetooth • Without a dedicated API is not possible to: • Discovery devices and services • Transfer files with Bluetooth FTP and OBEX • GPS connections, gamepads, medical devices • Remote control of embedded modules and sensor networks • Robotic application (i.e. LEGO Mindstorms) Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  6. 6. A lot of devices out there... Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  7. 7. Happy Hacking! Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 01/30/2010
  8. 8. System service & Reflection • Bluetooth Service is accessible like every other Android Service: Object bluetoothService = context.getSystemService(“bluetooth”); Having the right Class, we can leverage la reflection to know (and invoke!) the methods: Class bluetoothServiceClass = bluetoothService.class; Method[] bluetoothMethods = bluetoothServiceClass.getMethods(); Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  9. 9. Available Methods public android.bluetooth.BluetoothDevice(android.bluetooth.IBluetoothDevice) public boolean android.bluetooth.BluetoothDevice.cancelBondProcess(java.lang.String) public void android.bluetooth.BluetoothDevice.cancelDiscovery() public boolean android.bluetooth.BluetoothDevice.cancelPin(java.lang.String) public boolean android.bluetooth.BluetoothDevice.createBond(java.lang.String) public boolean android.bluetooth.BluetoothDevice.disable() public boolean android.bluetooth.BluetoothDevice.disconnectRemoteDeviceAcl(java.lang.String) public boolean android.bluetooth.BluetoothDevice.enable() public java.lang.String android.bluetooth.BluetoothDevice.getAddress() public int android.bluetooth.BluetoothDevice.getBluetoothState() public int android.bluetooth.BluetoothDevice.getBondState(java.lang.String) public java.lang.String android.bluetooth.BluetoothDevice.getCompany() public int android.bluetooth.BluetoothDevice.getDiscoverableTimeout() public java.lang.String android.bluetooth.BluetoothDevice.getManufacturer() public java.lang.String android.bluetooth.BluetoothDevice.getName() public int android.bluetooth.BluetoothDevice.getRemoteClass(java.lang.String) public java.lang.String android.bluetooth.BluetoothDevice.getRemoteCompany(java.lang.String) public [B android.bluetooth.BluetoothDevice.getRemoteFeatures(java.lang.String) public java.lang.String android.bluetooth.BluetoothDevice.getRemoteManufacturer(java.lang.String) public java.lang.String android.bluetooth.BluetoothDevice.getRemoteName(java.lang.String) public java.lang.String android.bluetooth.BluetoothDevice.getRemoteRevision(java.lang.String) public boolean android.bluetooth.BluetoothDevice.getRemoteServiceChannel(java.lang.String,short,android.bluetoot h.IBluetoothDeviceCallback) Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  10. 10. Available Methods public android.bluetooth.BluetoothDevice(android.bluetooth.IBluetoothDevice) public boolean android.bluetooth.BluetoothDevice.cancelBondProcess(java.lang.String) public void android.bluetooth.BluetoothDevice.cancelDiscovery() O X! public boolean android.bluetooth.BluetoothDevice.cancelPin(java.lang.String) public boolean android.bluetooth.BluetoothDevice.createBond(java.lang.String) O E public boolean android.bluetooth.BluetoothDevice.disable() public boolean android.bluetooth.BluetoothDevice.disconnectRemoteDeviceAcl(java.lang.String) T L public boolean android.bluetooth.BluetoothDevice.enable() public java.lang.String android.bluetooth.BluetoothDevice.getAddress() public int android.bluetooth.BluetoothDevice.getBluetoothState() public int android.bluetooth.BluetoothDevice.getBondState(java.lang.String) P public java.lang.String android.bluetooth.BluetoothDevice.getCompany() public int android.bluetooth.BluetoothDevice.getDiscoverableTimeout() M public java.lang.String android.bluetooth.BluetoothDevice.getManufacturer() public java.lang.String android.bluetooth.BluetoothDevice.getName() O public int android.bluetooth.BluetoothDevice.getRemoteClass(java.lang.String) public java.lang.String android.bluetooth.BluetoothDevice.getRemoteCompany(java.lang.String) public [B android.bluetooth.BluetoothDevice.getRemoteFeatures(java.lang.String) C public java.lang.String android.bluetooth.BluetoothDevice.getRemoteManufacturer(java.lang.String) public java.lang.String android.bluetooth.BluetoothDevice.getRemoteName(java.lang.String) public java.lang.String android.bluetooth.BluetoothDevice.getRemoteRevision(java.lang.String) public boolean android.bluetooth.BluetoothDevice.getRemoteServiceChannel(java.lang.String,short,android.bluetoot h.IBluetoothDeviceCallback) Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  11. 11. Permission • First Step: to access Bluetooth functionalities we need to declare two Permissions in the Manifest: <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  12. 12. Remote device discovery LocalBluetoothDevice local = LocalBluetoothDevice.init(context); local.setListener(new LocalBluetoothDeviceListener() { public void scanStarted() { // scan has started... } public void scanCompleted(ArrayList<String> devices) { // scan is over } }); local.scan(); // start scan... Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  13. 13. Open an RFCOMM socket from client RemoteBluetoothDevice dev = local.getRemoteBluetoothDevice(address); dev.setListener(new RemoteBluetoothDeviceListener() { public void paired() { // we open sockets and I/O streams... 3 BluetoothSocket socket = dev.openSocket(1); InputStream input = socket.getInputStream(); OutputStream output = socket.getOutputStream(); } public void pinRequested() { // show dialog for PIN input 2 } }); dev.pair(); 1 Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  14. 14. Compatible devices • HTC Dream • HTC Magic • HTC Tattoo • Samsung Galaxy i7500 • Samsung Galaxy i5700 • Huawei U8220 • Sony-Ericsson XPERIA X10 Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  15. 15. Bluetooth API for Android 1.x • The only opensource library (Apache 2.0) for accessing Bluetooth stack on Android 1.x • Features: • turn on/off Bluetooth • discovery of remote devices and RFCOMM bound to a service • opening of RFCOMM connections from client • Works without the necessity of root access • Check it out! • http://code.google.com/p/android-bluetooth Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  16. 16. Bluetooth API for Android 1.x • More than 1000 downloads! • Used in commercial and free projects: • Inspired Bluetooth File Transfer by Medieval Software, the most succesful file transfer application on the Android Market • Used in Amarino (developed by MIT), first framework for controlling Arduino via an Android device • Used in GoPayment by Intuit Inc., for credit card payment via swiper and Bluetooth printer • Used in DUBwise project, for flying helicpoters :) Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  17. 17. Main limitations • It’s not possible to register an SDP (Service Discovery Protocol) service on the database, even though is possible to create RFCOMM server socket • If a device inquiry is issue just after phone startup, the native call interferes with a system scan process and Bluetooth stack become unusable • Compatibility problems with HTC Hero Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  18. 18. Permission on socket dbus Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  19. 19. Android 2.x API • Android 2.0 : Bluetooth officially in the SDK! • Yay! But... • No direct control over pairing • No direct access to RFCOMM channels • No service discovery ...not so : • Android style: based on Intents and Receivers • Publish/Subscribe paradigm, a little clunky! Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  20. 20. Discovery in Android 2.x BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); IntentFilter filter = new IntentFilter(); filter.addAction(BluetoothDevice.ACTION_FOUND); filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); //also can register for DISCOVERY_STARTED Action context.registerReceiver(receiver, filter); adapter.startDiscovery(); Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  21. 21. BroadcastReceiver private final BroadcastReceiver receiver = new BroadcastReceiver() { public void onReceive(Context ctx, Intent intent) { final String action = intent.getAction(); if (action.equals(BluetoothDevice.ACTION_FOUND)) { BluetoothDevice device = (BluetoothDevice) intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); //process device } else if (action.equals(BluetoothAdapter.ACTION_DISCOVERY_FINISHED)) { //done :o) } } }; Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  22. 22. Socket e stream I/O //given a valid “BluetoothDevice”... UUID uuidOfTargetService = UUID.nameUUIDFromBytes(“2d26618601fb47c28d9f10b8ec891363”); BluetoothSocket socket = rbd.createRfcommSocketToServiceRecord(uuidOfTargetService); socket.connect(); InputStream input = socket.getInputStream(); OutputStream output = socket.getOutputStream(); .... socket.close(); Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  23. 23. Android good practices • It’s important to keep in mind good practices of Android (and Java) programming!: • I/O operations always in a separate Thread • update UI via Handler • unregister Receivers before destroying Context Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  24. 24. Is a separate library still useful? • In spite of Android 2.0 API, a Bluetooth library would be greatly useful! • Access to hidden features (via reflection) • Expose a simpler API • 1.x vs 2.x abstraction Retrocompatibility! • ....working out Easy Bluetooth • Check it out: http://android-bluetooth.googlecode.com/svn/ Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  25. 25. Android controls Arduino • We want to use Android to control via Bluetooth a LED and read a temperature Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  26. 26. Arduino • “Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. [...] It can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators. • Strictly MADE IN ITALY! • http://www.arduino.cc Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  27. 27. Arduino Source int LED_PIN = 13; int LM35_PIN = 2; void setup() { Hardware: Serial.begin(115200); } pinMode(LED_PIN, OUTPUT); • Arduino Bluetooth • Prototype shield e breadboard void loop() { • LM35 Temperature Sensor if (Serial.available() > 0) { int inByte = Serial.read(); switch (inByte) { case '1': digitalWrite(LED_PIN, HIGH); Serial.write('1'); break; case '0': void readTemp() { digitalWrite(LED_PIN, LOW); int temp = analogRead(LM35_PIN); Serial.write('0'); temp= ( 5.0 * temp * 100.0) / 1024.0; break; Serial.write(temp); case 'r': } readTemp(); break; } } Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  28. 28. Android Source // define commands... byte LED_ON_REQUEST = ‘1’; byte LED_OFF_REQUEST = ‘0’; byte READ_TEMPERATURE = ‘r’; [...] // in the Thread we send comandi and read responses... output.write(request); final int response = input.read(); if (request == 'r') { handler.post(new Runnable() { public void run() { String temp = Integer.toString(response); Toast.makeText(Controller.this, "LM35 Sensor: " + temp + "°C", 4000).show(); }); } Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  29. 29. DEMO! Starring: Motorola Milestone (Android 2.0), HTC Magic (Android 1.6) and Arduino Bluetooth Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 01/30/2010
  30. 30. Resources • Android • http://developer.android.com • http://source.android.com • Bluetooth API for Android 1.x e Easy Bluetooth • http://code.google.com/p/android-bluetooth • Arduino • http://www.arduino.cc Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  31. 31. References • Stefano Sanna • gerdavax AT gmail DOT com • http://www.gerdavax.it • Emanuele Di Saverio • emanuele DOT disaverio AT gmail DOT com Stefano Sanna & Emanuele di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 30 gennaio 2010
  32. 32. THANK YOU! Stefano & Emanuele & i rispettivi JUG! Stefano Sanna & Emanuele Di Saverio – JUG Sardegna / JUG Roma Javaday IV – Roma – 01/30/2010

×