Titanium+Plus Modules and Javascript Bridges: Controlling Hardware with a Web Language                           Rob Choha...
2001: A Space Odyssey   Start around 5720
Streaming BBC Channel 12 to Space
Sweet Spot = Hardware + Software + Content
Mobile Architecture,extending Titanium example  One Barcode app idea to rule them all!!!                                  ...
Libraries that are ripe for                     Titanium+Plus• DropBox                           • My Tracks, Map or Lat/L...
How To:               Appcelerator makes it easy                     to get started•   Titanium generates stubs•   From th...
Hardware that could be          interesting to Titanium                Developers• Barometer• WiFi• Bluetooth• Near Field ...
Barometer• Motorola chose a   What is a Barometer good for  Digital Pressure   (courtesy of the chip manufacturer, Bosch) ...
Barometer,                Javascript example• This is a perfect example of how Titanium+Plus can be extended• Barometer us...
Titanium+Module Implementation for             a Barometer on Androidpublic void onSensorChanged(SensorEvent event) {long ...
Screen from Motorola Xoom, Native App by Noosters       500+ Downloads as of Sep 2011
Screen from Motorola Xoom, Native App by Guild Software        5,000+ Downloads as of Sep 2011
Screen from Motorola Xoom, Native App by David Momenso         100+ Downloads as of Sep 2011
Titanium+Plus Modules helps to lower the bar
Data Mining on Android         Bluetooth Hardware Apps,         Data mined from AndBOT.com, April 2011•   Bluetooth   Samp...
Bluetooth now becomes          very interesting for            Titanium UsersWhat is a Bluetooth good for in the contextof...
San Diego Based Fitness Startup• San Diego based startup         Mobile Phone  focusing on Bicycle fitness• Patent pending...
San Diego Based Fitness Startup                  why Titanium worked for them• 100% bootstrapped                          ...
Bluetooth on Android &       Titanium+Plus• Android module built for  Android 1.6                    • Many pitfalls      ...
Localization Notes on          Titanium+Plus with Android• Android res files for each locale (en, ja, es, ...)
Titanium+Plus Modules and Javascript Bridges: Controlling Hardware with a Web Language                     Rob Chohan     ...
Rob Chohan: Titanium+Plus Modules and Javascript Bridges: Controlling Hardware with a Web Language
Upcoming SlideShare
Loading in …5
×

Rob Chohan: Titanium+Plus Modules and Javascript Bridges: Controlling Hardware with a Web Language

1,927 views

Published on

Javascript is a fantastic language and the lingua franca of the Web. But can you use Javascript to control hardware? Titanium already does a great job of supporting hardware over iOS & Android, such as the accelerometer and the camera. But what about other hardware? Can you use Titanium to turn on Wifi or Bluetooth radios? How about other sensors like the Barometer on the Motorola XOOM?

It turns out that the flexibility of the Titanium+Plus allows all of this and more.

This talk discusses the ups and down of developing Titanium+Plus modules specifically for hardware like Wifi and Bluetooth. We will also discuss some aspects of doing localization for Titanium+Plus in Android.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Rob Chohan: Titanium+Plus Modules and Javascript Bridges: Controlling Hardware with a Web Language

  1. 1. Titanium+Plus Modules and Javascript Bridges: Controlling Hardware with a Web Language Rob Chohan Chief Technologist, ePi Rational (C) 2011 ePi Rational, LLC
  2. 2. 2001: A Space Odyssey Start around 5720
  3. 3. Streaming BBC Channel 12 to Space
  4. 4. Sweet Spot = Hardware + Software + Content
  5. 5. Mobile Architecture,extending Titanium example One Barcode app idea to rule them all!!! Titanium – Open source User Interface & Hardware API Library(Software to be written to tie these together) Zxing or Zebra Crossing – Open source barcode library encode/decode iOS Android Killer Barcode App = Camera +
  6. 6. Libraries that are ripe for Titanium+Plus• DropBox • My Tracks, Map or Lat/Long? -117.117203, 32.784180• Airpush -117.116966, -117.116501, 32.784218 32.784386 -117.116501, 32.784439 -117.116341, 32.784527• Square -117.116280, 32.784618• Networking• Google Analytics*• A cryptographically secure RNG that your app needs that Javascript cant provide (e.g., SecureRandom)
  7. 7. How To: Appcelerator makes it easy to get started• Titanium generates stubs• From their it is up to you to fill in the blanks• Pull in your favorite JAR, Java, or Obj-C or C++ code• Build and distribute on the Appcelerator Marketplace
  8. 8. Hardware that could be interesting to Titanium Developers• Barometer• WiFi• Bluetooth• Near Field Communications (NFC)• ANT+• GPS
  9. 9. Barometer• Motorola chose a What is a Barometer good for Digital Pressure (courtesy of the chip manufacturer, Bosch) Sensor in their • Enhancement of GPS Motorola Xoom navigation • Indoor and outdoor navigation • Leisure and sports • Weather forecast • Vertical velocity indication
  10. 10. Barometer, Javascript example• This is a perfect example of how Titanium+Plus can be extended• Barometer usage (targeting Motorola XOOM)var baro = require(epi.baro);data = baro.getBaro();  // in milliBars, of course
  11. 11. Titanium+Module Implementation for a Barometer on Androidpublic void onSensorChanged(SensorEvent event) {long curTime = System.currentTimeMillis();    switch (event.sensor.getType()) {      case Sensor.TYPE_PRESSURE:        if (lastUpdate == -1 || (curTime - lastUpdate) > mTime){           float pressure = event.values[0];        }        break;              case Sensor.TYPE_ACCELEROMETER:        if (lastUpdate == -1 || (curTime - lastUpdate) > mTime){            float x = event.values[0];          float y = event.values[1];          float z = event.values[2];        }        break;    }}
  12. 12. Screen from Motorola Xoom, Native App by Noosters 500+ Downloads as of Sep 2011
  13. 13. Screen from Motorola Xoom, Native App by Guild Software 5,000+ Downloads as of Sep 2011
  14. 14. Screen from Motorola Xoom, Native App by David Momenso 100+ Downloads as of Sep 2011
  15. 15. Titanium+Plus Modules helps to lower the bar
  16. 16. Data Mining on Android Bluetooth Hardware Apps, Data mined from AndBOT.com, April 2011• Bluetooth Samples• Bluetooth Bar Widget• Bluetooth Backport for pre-Android 2.0• Bluetooth Fileshare - Bluex• Bluetooth On/Off for Droid• Bluetooth Remote• Bluetooth text & paint Chat• Bluetooth Terminal• Bluetooth WidgetVery useful apps, but what else can be done?
  17. 17. Bluetooth now becomes very interesting for Titanium UsersWhat is a Bluetooth good for in the contextof Titanium • Chat programs • Getting data from custom sensor boardsvar btLib = require(epi.bt);bt = btLib.turnOnRadio();  // discoverybt.discovery();// pairing// exchanging of data
  18. 18. San Diego Based Fitness Startup• San Diego based startup Mobile Phone focusing on Bicycle fitness• Patent pending nutrition and hydration algorithm for cyclists• 100% bootstrapped• Developed a custom sensor board with o wheel revolution counters o digital pressure barometer o another type of pressure sensor o Bluetooth 3 radio Custom Device comm over Bluetooth
  19. 19. San Diego Based Fitness Startup why Titanium worked for them• 100% bootstrapped Mobile Phone• team is comprised of o 1 firmware o 1 electrical engineer o 1 Titanium Dev o 1 Bluetooth Dev o 1 Marketing• Each team member was able to focus on their particular part• Team currently at funding stage Custom Device comm over Bluetooth
  20. 20. Bluetooth on Android & Titanium+Plus• Android module built for Android 1.6 • Many pitfalls o older firmware and Android• Relies on the Bluetooth phones (wait for supported hardware!) Backport open source jar o building for Titanium from Sosuke Masui, Japan required modifying the Python build scripts for both• Development was started back the Module and the before Bluetooth was Application o Android resources!!!, supported on Android 2.0 created a two-step build process o Port to iOS coming after funding
  21. 21. Localization Notes on Titanium+Plus with Android• Android res files for each locale (en, ja, es, ...)
  22. 22. Titanium+Plus Modules and Javascript Bridges: Controlling Hardware with a Web Language Rob Chohan Chief Technologist, ePi Rational (C) 2011 ePi Rational, LLC

×