Embedded webserver implementation and usage - DroidCon Paris 2014

23
Micro serveur http embarqué usages et implémentations HTTP

description

http://fr.droidcon.com/2014/agenda/ http://fr.droidcon.com/2014/agenda/detail?title=Embed+HTTP+micro+server+in+your+app Guilhem Duché, iD.apps

Transcript of Embedded webserver implementation and usage - DroidCon Paris 2014

Page 1: Embedded webserver implementation and usage - DroidCon Paris 2014

Micro serveur http embarqué

usages et implémentations

HTTP

Page 2: Embedded webserver implementation and usage - DroidCon Paris 2014

1. Introduction2. Pour quoi faire ?3. Solutions techniques4. Affichage d’informations5. Partage de fichiers6. Avec un chromecast7. Conclusion

Page 3: Embedded webserver implementation and usage - DroidCon Paris 2014

1. Introduction

Page 4: Embedded webserver implementation and usage - DroidCon Paris 2014

1. Introduction

Comment échanger entre différents devices localement ?

Bluetooth => appairage

QRCode => limité

NFC => peu de données, forte proximité

Push => réactivité, débit, compatibilité

Réseau local => Wifi + Serveur HTTP

Page 5: Embedded webserver implementation and usage - DroidCon Paris 2014

2. Pour quoi faire ?

Page 6: Embedded webserver implementation and usage - DroidCon Paris 2014

2. Pour quoi faire ?

Exemples d’applications :▪ Envoi de données dans une application iPad

▪ Airdroid

▪ SuperBeam

Différents types d’usages▪ Affichage/envoi d’information

▪ Partage de fichiers

▪ Serveur accessible localement

Page 7: Embedded webserver implementation and usage - DroidCon Paris 2014

3. Solutions techniques

Page 8: Embedded webserver implementation and usage - DroidCon Paris 2014

3. Solutions techniques

Objectif => pas d’usine à gaz

NanoHttpd :▪ 1 fichier

▪ Support complet http 1.1

▪ Facile à modifier

https://github.com/NanoHttpd/nanohttpd

Restlet▪ Simple pour mise en œuvre API Rest

http://restlet.com/

Page 9: Embedded webserver implementation and usage - DroidCon Paris 2014

4. Affichage d’informations

Page 10: Embedded webserver implementation and usage - DroidCon Paris 2014

4. Affichage d’informations

Projet client avec forte synchronisation DB

Comment débugguer une base SQLite rapidement

Librairie Cardeto : ▪ DB Browsing

▪ Logcat

▪ Clipboard

▪ Static variables

▪ App info

https://github.com/guiguito/Cardeto

Page 11: Embedded webserver implementation and usage - DroidCon Paris 2014

4. Implémentation/démo

Permissions nécessaires

Surcharger le comportement de nanoHttpd

Page 12: Embedded webserver implementation and usage - DroidCon Paris 2014

5. Partage de fichiers

Page 13: Embedded webserver implementation and usage - DroidCon Paris 2014

5. Partage de fichiers

Partage android via wifi▪ Fichiers▪ Images▪ Vidéos▪ Contact▪ Position Google maps▪ Textes

AIRShare▪ Superbeam light▪ Open source▪ NFC/QRCode

https://github.com/guiguito/AIRShare

Page 14: Embedded webserver implementation and usage - DroidCon Paris 2014

5. Implémentation/démo

Partage de fichier avec nano httpd

IP du smarphone en AP

Page 15: Embedded webserver implementation and usage - DroidCon Paris 2014

6. Avec un chromecast

Page 16: Embedded webserver implementation and usage - DroidCon Paris 2014

6. Architecture d’une application chromecast

Page 17: Embedded webserver implementation and usage - DroidCon Paris 2014

6. Idée d’application chromecast

Faire une présentation avec un chromecast▪ PPT▪ PDF

Pas de libs java pour les PPT

Héberger un site dans assets

SlidesCast▪ SlideShare▪ Local Fileshttps://github.com/guiguito/SlidesCast

Page 18: Embedded webserver implementation and usage - DroidCon Paris 2014

Architecture (1/2)

Browser HTML 5

iFrame

Page 19: Embedded webserver implementation and usage - DroidCon Paris 2014

Architecture (2/2)

Page 20: Embedded webserver implementation and usage - DroidCon Paris 2014

Implémentation

Data centric chromecast app

Chromecast :▪ iFrame

▪ HTML 5 post message

Smartphone : ▪ Cast Companion Library▪ SlideShare API▪ Viewer.js => support de postmessage▪ NanoHttpd => support des Assets

Page 21: Embedded webserver implementation and usage - DroidCon Paris 2014

7. Conclusion

Page 22: Embedded webserver implementation and usage - DroidCon Paris 2014

Implémentation/démo

Wifi is not dead

Ne pas se priver d’un serveur HTTP embarqué▪ Simple à utiliser

▪ Simple à modifier

▪ Efficace

▪ Compatibilité du HTTP

Mixer : site web + webservices

Très bon moyen de faire communiquer différents types de devices connectés

Page 23: Embedded webserver implementation and usage - DroidCon Paris 2014

@theguiguito

https://github.com/guiguito

iD.appshttp://www.id-apps.fr

http://blog.id-apps.info

@iD_apps

Guilhem DUCHE

DemainQuentin Sallat : passage de Holo à Material Design