Your SlideShare is downloading. ×
0
MORENA: A Middleware for Programming      NFC-enabled Android Applications as      Distributed Object-Oriented Programs   ...
RFID in Android      • NFC (touch range).                                  NdefMessage: {      • Callback on activities   ...
Drawbacks of the Android NFC API      • Manual failure handling (and NFC causes A LOT of failures because of its        ha...
Lessons Learnt from Previous Ambient-Oriented      Programming Research      • Using objects as first class software repres...
Middleware Architecture                       Application                       Thing level   One middleware              ...
Evaluation: WiFi Sharing ApplicationMonday 28 January 13
Evaluation: WiFi Sharing ApplicationMonday 28 January 13
Things                                                          From now on, we don’t   public class WifiConfig extends Th...
Initializing Things                                     As soon as an empty                                        tag is ...
Discovering and Reading Things                                         As soon as a WifiConfig                              ...
Saving Modified Things          myWifiConfig.ssid_ = "MyNewWifiName";          myWifiConfig.key_ = "MyNewWifiPassword";    ...
Broadcasting Things to Other Phones                                  Will trigger whenDiscovered on the                   ...
Evaluation: WiFi Sharing ApplicationMonday 28 January 13
Middleware Architecture                       Application                       Thing level   One middleware              ...
Detecting RFID Tags                       new MyTagDiscoverer(this,                          THING_TYPE,                  ...
The Tag Reference AbstractionMonday 28 January 13
Reading RFID Tags               tagReference.read(                     new TagReadListener() {                          @O...
Writing RFID Tags               tagReference.write(                     toWrite,                     new TagWrittenListene...
Fine-grained Filtering              private class MyTagDiscoverer extends TagDiscoverer {	 	              	 @Override     ...
Conclusion      • Event-driven discovery.      • Non-blocking communication:            • Things: cached copy, asynchronou...
MORENA: A Middleware for Programming      NFC-enabled Android Applications as      Distributed Object-Oriented Programs   ...
Upcoming SlideShare
Loading in...5
×

Morena middleware2012

182

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
182
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Morena middleware2012"

  1. 1. MORENA: A Middleware for Programming NFC-enabled Android Applications as Distributed Object-Oriented Programs Andoni Lombide Carreton Kevin Pinte Wolfgang De Meuter ACM/IFIP/USENIX 13th International Conference on Middleware 2012 December 5 2012 Montreal, CanadaMonday 28 January 13
  2. 2. RFID in Android • NFC (touch range). NdefMessage: { • Callback on activities , to detect RFID tags with subscribed MIME- , NdefRecord type in memory. byte array } • File access abstraction read writeMonday 28 January 13
  3. 3. Drawbacks of the Android NFC API • Manual failure handling (and NFC causes A LOT of failures because of its hardware characteristics). • Blocking communication (Android documentation recommends to use a separate thread for many RFID operations). • Manual data conversion • Tight coupling with activity-based architectureMonday 28 January 13
  4. 4. Lessons Learnt from Previous Ambient-Oriented Programming Research • Using objects as first class software representations for RFID-tagged “things” is a nice abstraction. • These objects can be directly stored in the RFID tags’ memory to minimize data conversion. • Event-driven discovery (fortunately built-in into Android). • Asynchronous reads and writes.Monday 28 January 13
  5. 5. Middleware Architecture Application Thing level One middleware for Android 4.0 Tag level or higher AndroidMonday 28 January 13
  6. 6. Evaluation: WiFi Sharing ApplicationMonday 28 January 13
  7. 7. Evaluation: WiFi Sharing ApplicationMonday 28 January 13
  8. 8. Things From now on, we don’t public class WifiConfig extends Thing { have to worry about the public String ssid_; activity anymore. public String key_; public WifiConfig(ThingActivity<WifiConfig> activity, String ssid, String key) { super(activity); ssid_ = ssid; key_ = key; } public boolean connect(WifiManager wm) { // Connect to ssid_ with password key_ }; Supported serialization: } - JSON-serializable fields. - Skipping transient fields. - Deep serialization, no cycles.Monday 28 January 13
  9. 9. Initializing Things As soon as an empty tag is detected @Override public void whenDiscovered(EmptyRecord empty) { empty.initialize( myWifiThing, new ThingSavedListener<WifiConfig>() { @Override public void signal(WifiConfig thing) { toast("WiFi joiner created!"); } }, new ThingSaveFailedListener() { @Override public void signal() { toast("Creating WiFi joiner failed, try again."); } }); }Monday 28 January 13
  10. 10. Discovering and Reading Things As soon as a WifiConfig tag is detected @Override public void whenDiscovered(WifiConfig wc) { toast("Joining Wifi network " + wc.ssid_); wc.connect(); } Contains cached fields for synchronous access. Physical reads must be asynchronous.Monday 28 January 13
  11. 11. Saving Modified Things myWifiConfig.ssid_ = "MyNewWifiName"; myWifiConfig.key_ = "MyNewWifiPassword"; myWifiConfig.saveAsync( new ThingSavedListener<WifiConfig>() { @Override public void signal(WifiConfig wc) { toast("WiFi joiner saved!"); } }, new ThingSaveFailedListener() { @Override public void signal() { toast("Saving WiFi joiner failed, try again."); } });Monday 28 January 13
  12. 12. Broadcasting Things to Other Phones Will trigger whenDiscovered on the receiving phone with the broadcasted thing myWifiConfig.broadcast( new ThingBroadcastSuccessListener<WifiConfig>() { @Override public void signal(WifiConfig wc) { toast("WiFi joiner shared!"); } }, new ThingBroadcastFailedListener<WifiConfig>() { @Override public void signal(WifiConfig wc) { toast("Failed to share WiFi joiner, try again."); } });Monday 28 January 13
  13. 13. Evaluation: WiFi Sharing ApplicationMonday 28 January 13
  14. 14. Middleware Architecture Application Thing level One middleware for Android 4.0 Tag level or higher AndroidMonday 28 January 13
  15. 15. Detecting RFID Tags new MyTagDiscoverer(this, THING_TYPE, new NdefMessageToStringConverter(), new StringToNdefMessageConverter()); private class MyTagDiscoverer extends TagDiscoverer { @Override public void onTagDetected(TagReference tagReference) { readTagAndUpdateUI(tagReference); } @Override public void onTagRedetected(TagReference tagReference) { readTagAndUpdateUI(tagReference); } }Monday 28 January 13
  16. 16. The Tag Reference AbstractionMonday 28 January 13
  17. 17. Reading RFID Tags tagReference.read( new TagReadListener() { @Override public void signal(TagReference tagReference) { // tagReference.getCachedData() } }, new TagReadFailedListener() { @Override public void signal(TagReference tagReference) { // Deal with failure } });Monday 28 January 13
  18. 18. Writing RFID Tags tagReference.write( toWrite, new TagWrittenListener() { @Override public void signal(TagReference tagReference) { // Handle write success } }, new TagWriteFailedListener() { @Override public void signal(TagReference tagReference) { // Deal with failure } });Monday 28 January 13
  19. 19. Fine-grained Filtering private class MyTagDiscoverer extends TagDiscoverer { @Override public void onTagDetected(TagReference tagReference) { readTagAndUpdateUI(tagReference); } @Override public void onTagRedetected(TagReference tagReference) { readTagAndUpdateUI(tagReference); } @Override public boolean checkCondition(TagReference tagReference) { // Can be used to apply a predicate // on tagReference.getCachedData() } }Monday 28 January 13
  20. 20. Conclusion • Event-driven discovery. • Non-blocking communication: • Things: cached copy, asynchronous saving of cached data. • TagReferences: first class references to RFID tags offering asynchronous reads and writes. • Automatic data conversion • Looser coupling from activity-based architecture • Data structures over several tags, stronger consistency guarantees?Monday 28 January 13
  21. 21. MORENA: A Middleware for Programming NFC-enabled Android Applications as Distributed Object-Oriented Programs Andoni Lombide Carreton Kevin Pinte Wolfgang De Meuter ACM/IFIP/USENIX 13th International Conference on Middleware 2012 December 5 2012 Montreal, CanadaMonday 28 January 13
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×