Skip to main content

Posts

Showing posts with the label ase

Android-Powered, Automated Cat Feeder

This is my Android-powered, automated cat feeder: The attached HTC Magic is running SL4A and provides scheduled and on demand feeding as well as an MJPEG webcam feed. Feeding is triggered via Bluetooth. The Arduino is hooked up to a SparkFun BlueSMiRF and a simple relay circuit I made on perfboard for powering the motor on and off. The brackets and food chute were designed in SketchUp and printed on my MakerBot . You can find all the SKPs, STLs, schematic, and parts list on Thingiverse . Here's the 50 odd lines of Python code running on the phone via SL4A that make the magic happen: import android # See http://android-scripting.googlecode.com/ import gsd # See http://getshitdone.googlecode.com/ import socket import threading import time def feed(droid): droid.toggleBluetoothState(True) droid.bluetoothConnect('00001101-0000-1000-8000-00805F9B34FB', '00:06:66:04:b2:07') droid.bluetoothWrite('f') class Server(gsd.App): def __init__(s
Read more

SL4A r3 Released

So, what's new? Features: Added Bluetooth binary read and write using base64. Bug fixes: Launching scripts from shortcuts and Locale works again. In the works: Started work on support for in-process interpreters. Visit the SL4A project page to download the latest APK.
Read more

SL4A r2 Released

So, what's new? Features: Context menus have been replaced with quick action menus. Events generated by an API call are now documented in the API reference and the API browser. Folder support added to the script list. However, copying and moving scripts is not yet supported. Renaming support added to the script list. Scripts distributed as APKs can now be started for result. Scripts launched from SL4A can not yet be started for result. Bug fixes: The camera and video recording APIs will hopefully work on more devices now. Fixed Bluetooth API documentation. Fixed duplicate events piling up in the event queue. Under the covers: To deal with the new folder support, full script paths are passed around as File objects instead of just the script name as a String . In the works: Bug fixing and expanding the interpreter API to support running scripts in process. Visit the SL4A project page to download the latest APK.
Read more

SL4A r1 Released

Note: If SL4A crashes on start up, be sure to uninstall any installed r0 interpreters and upgrade them to the new r1 releases. Loads of new goodies this time. So, what's new? Features: Added WebView API which makes it possible to easily build scripts with a GUI. Added HTML interpreter . For scripts running in the foreground or displaying WebViews, context and option menu items can be added. Added search support to the API browser. Added undo and redo to the script editor via volume up and down buttons. A new, significantly improved terminal experience. Time and date picker dialog APIs. Additional signal strength APIs. Additional Wifi APIs including locking. Additional telephony APIs. Removed phone call recording since this is not currently possible in Android. It is now possible to specify that startActivity() should block until the user closes the started activity. Bluetooth connections can now be established to a particular device address. Attachments can be a
Read more

SL4A r0 Released

After far too long, SL4A r0 has been released. So, what's new? Features: Interpreters are now installed as separate APKs. Scripts can now be bundled into Script APKs that do not depend on SL4A. Added support for running multiple scripts simultaneously. You can view, stop, and connect a terminal to running scripts in the Script Monitor. The number of running scripts is indicated by the notification icon and in the notification itself. Lots of performance improvements to start up time and memory consumption. For instance, interpreters are now run in a single process instead of being wrapped up in a shell process and facades are loaded lazily. Security has been improved by requiring scripts to authenticate themselves with the RPC server. This happens automatically and prevents malware from connecting to a running SL4A RPC server and assume SL4A's permissions. The Bluetooth API is now blocking, easier to use, and more robust. It is now possible to deprecate APIs before ch
Read more

ASE is now SL4A

As part of the move to separate interpreters from the Android Scripting Environment (ASE) project, it has been renamed to Scripting Layer for Android (SL4A). SL4A will focus on providing: a simple, very high level API layer on top of Android's own APIs, on-device developer tools (script editing, launching, debugging, etc.), sharing scripts as APKs (i.e. typical Android applications), and standards for adding new interpreters . We've been very busy getting everything ready for SL4A release r0 and we are excited to share it with everyone as soon as possible.
Read more

ASE r25 Released

I skipped release notes for r24, so I'm rolling them into the release notes for r25. So, what's new? Features: It's now possible to specify the MIME type when calling startActivity or startActivityForResult . Added APIs for: Viewing local HTML files Interactively taking pictures and video Recording phone calls Retrieving cell location and signal strength on GSM networks Checking if TTS is currently speaking Screen brightness control Checking screen state (i.e. is it on or off) A new SeekBar dialog Added Try::Tiny to Perl modules. There's now a trigger service that will allow launching scripts as particular events occur on the phone. Currently there's one such event which will launch a script when the ringer mode changes. Export more along these lines in the near future. Interpreters are now chmoded to be world readable and executable. This is cool because now you can execute interpreters directly from adb shell. Bug fixes: Fixed NPE when extras ar
Read more

ASE r23 Released

So, what's new? Features: Added support for adjusting and inspecting media volume. Also added inspecting the maximum volume for media and ringer.  Added APIs for accessing the contacts database.  pickPhone() API now returns the chosen phone number instead of the data URI.  Added APIs for generating DTMF tones (see DTMF dialer example ).  Bug fixes: Wake lock bugs fixed. Perl error messages make more sense.  SMS bugs fixed.  Broken error responses fixed.  Under the covers: Usage tracking happens in a background thread pool which should make the application more responsive.  Usage tracking now includes API use. Arguments are not logged, only that a particular API is used. This will help significantly with prioritizing bugs and feature development. So please, enable usage tracking!  In the works: Still working on distributing interpreters as APKs separately from ASE. This is an arduous task.  More advanced triggers.  A new slider input dialog. A new spinner input di
Read more

DTMF Dialer in ASE

I just wrote a useful little script using some new APIs that will be in version r23. import android import time droid = android.Android() phone = droid.pickPhone().result.replace('-', '') phone = phone.replace('+49', '0') droid.makeToast('Dialing ' + phone + ' in 2 seconds.') time.sleep(2) droid.setMediaVolume(droid.getMaxMediaVolume().result) droid.generateDtmfTones(phone) droid.exit() I have a shortcut to this script on my home screen. When I want to place a call on a land line, I can start it up, choose the number I want to dial, and hold it up to the phone. This script is pretty naive about the format of the phone number. It expects German numbers (the +49) that it's dialing within Germany (the leading 0). Here's the QR code to add this script to ASE:
Read more

ASE r22 Released

So, what's new? Features: Wake lock support added. It's now possible to have your scripts continue running when the phone tries to sleep. Location APIs now return location data from all available providers (i.e. network, gps, etc.) Wifi APIs added for scanning and retrieving access points. Added API for getting a list of all applications that are launchable via the launch API. Added support for launching scripts in the background from Locale. Changed callNumber API to automatically URL encode numbers (i.e. now it should "just work" ™) Bug fixes: Fixed general bugginess of Bluetooth support. No more deadlocks. Bigger rows in device listing. Fixed occasional activity hangs when network connections are poor. Fixed missing id field in error results. Fixed list results being returned as strings. Fixed Locale plugin. Fixed broken TTS support. Fixed broken sendEmail API. Fixed crash when importing incorrectly formatted scripts via QR code. Fixed race cond
Read more

ASE r21 Released

So, what's new? Features: More SMS support. It's now possible to send, read, and manipulate SMS messages. Bluetooth support. Camera support. Code generation has a new prompt interface in addition to insert. Bug fixes: Fixed APIs that return lists.  Fixed toggling settings.  Fixed Tcl sample scripts.  Fixed Perl template code.  Fixed canceling speech recognition dialog.  Fixed memory leak. Under the covers: Progress toward decoupling large pieces of ASE (interpreters, facades, etc.) In the works: Distributing interpreters as APKs separately from ASE. Visit the  ASE project page  to download the latest APK.
Read more

ASE r20 Released

So, what's new? Features: First version of triggers added. Scripts can be scheduled to launch periodically. It's still a little rough around the edges, so file bugs ! Bug fixes: Live folder now only shows scripts that can be executed. API browser crash fixed for airplane mode API. Cleaned up settings APIs so that they fit a common pattern. Under the covers: Additional improvements to RPC annotations. These improvements should be reflected in the API browser soon as improved documentation and code generation. In the works: Triggers for scripts that should be executed at a specific time in the future. Visit the  ASE project page  to download the latest APK.
Read more

ASE r19 Released

So, what's new? Features: JRuby updated to 1.4. New logcat viewer. Use left and right flings to switch between the Script Manager, Interpreter Manager, and Logcat Viewer. Screen timeout API. Airplane mode API. Bug fixes: Installing interpreters on Cyanogen now works. Downloading interpreters is now faster. Scripts live folder works. Python sample scripts updated and fixed. Under the covers: Improving the RPC annotations for code generation. In the works: The first version of the trigger manager is working and will hopefully make it into r20. Visit the  ASE project page  to download the latest APK.
Read more

ASE r18 Released

Note: The r18 release had a interpreter installation bug that has been addressed in r18-1. So, what's new? Features: Help menus now provide links to both the wiki documentation and to the new screencast tutorials. Downloading interpreters now shows a progress bar and can be aborted. Installation is more robust. However, there is still a known issue with installation on Cyanogen. Shortcuts now support launching scripts in a terminal or in the background. Bug fixes: Python sample scripts changed to use namedtuples. Under the covers: Launching scripts from other activities is now made easier via the AseServiceLauncher. In the works: A trigger manager for launching scripts at certain times or when certain events occur. Visit the  ASE project page  to download the latest APK.
Read more

Reencode Videos to Play Faster

I'm currently recording screencasts (using XVidCap ) to use as a video-based help system in ASE . Because the Android emulator is slow and the steps are quite simple to follow, it's useful to speed up the playback of the screencast. I'm currently doing this with MEncoder (the magic flag is -speed <multiplier> ): mencoder input.mpg -ovc lavc -lavcopts vcodec=mpeg4 -speed 2 -oac copy -o output.avi I also recommend Avidemux (over Open Movie Editor) for your basic editing needs.
Read more

ASE r17 Released

So, what's new? Features: Tcl added as a supported language. User interface APIs added for displaying various dialogs. API Browser updated to provide code generation . Long tap on a method to insert it into the script editor. Editor now auto completes parenthesis, brackets, and quotes. Terminal and editor have fullscreen mode and font size selection in preferences. Alert manager APIs added for regularly triggering scripts. Speech recognition API added. Live folder support added. Long tap on a home screen to add a live folder of ASE scripts. Python API now uses namedtuples instead of dicts (i.e. use droid.getInput().result instead of droid.getInput()['result'] ). And lots of other improvements! Under the covers: All scripts now run as a service and can pop into the foreground as necessary. This is a huge step toward having ASE work as a common runtime for ASE powered applications. A lot of facade refactoring that will make it easier to add new APIs in the futur
Read more

Using ASE with your.flowingdata

As of ASE r16, python-twitter is included with Python. There is a bug that prevents it from working (the fix will be available in r17). But, there's a work around: Open ASE shell (Menu > Interpreters > Shell) Type mkdir /sdcard/ase/python/tmp I'm using the python-twitter module to make it easy to keep track of events on your.flowingdata (yfd). I have the following yfd.py script: import android import twitter droid = android.Android() t = twitter.Api(username='foo', password='bar') def yfd(data=None): if data is None: data = droid.getInput('d yfd')['result'] if data: t.PostDirectMessage('yfd', data) droid.exit() if __name__ == '__main__': yfd() Then, I have a few shortcut scripts I use for common data entries. For example, goodmorning: import yfd yfd.yfd('goodmorning') and goodnight: import yfd yfd.yfd('goodnight') On my Nexus One, I created a folder on my home screen called "yfd&q
Read more

ASE r15 and r16 Released

I skipped release notes for r15, so I'm rolling them into the release notes for r16. So, what's new? Features: Cupcake support is back by popular demand. Built-in API browser. In the script editor, open the menu and tap "help" to see a list of all available ASE Android APIs. python-twitter package added. Anonymous usage tracking. Want to support ASE and increase development activity? Enable usage tracking! New sendEmail API supports pre-filled form fields. More and larger font sizes available for the terminal. Under the covers: Huge refactoring of the AndroidFacade and RPC classes. Without this, the built-in API browser would not exist. Thanks, Felix! In the works: Shorter time between releases. Voice-to-text support. Email attachments. More APIs. Visit the  ASE project page  to download the latest APK.
Read more

ASE r14 Released

What's new? Features: JavaScript (via Rhino) support added by Brice Lambson. Donut TTS support. Eclair is also now supported. Cupcake, however, is no longer supported. Interpreter manager. Interpreters can now be installed, uninstalled, and started as interactive terminals in the new interpreter manager. Press the menu button and then tap "Interpreters." ASE Server. You can now launch a background service to host the AndroidProxy. This means you can develop for ASE off the phone more easily by simply directing your scripts to connect to your phone over the network (no USB cable required). New APIs and updated Javadoc . Be sure to scroll down to where you can see the @Rpc annotations for documentation. Bug fixes: Interpreter installation is more robust. Keep filing bugs! BufferedReader warnings for BeanShell removed. Visit the ASE project page to download the latest APK.
Read more

ASE r13 Released

What's new? Administration: New version scheme. To help preserve my sanity, ASE versions will now increase monotonically with releases, starting with r13. Presently, ASE is still in alpha. Interpreter archives are now versioned separately from ASE. This should make pushing new releases easier (that means releasing more often!) Features: Soft keyboard support in the terminal. Smaller APK. Python install now takes less main memory. Python help() works. New Python test.py script. I now use this for testing ASE. It's included with the scripts archive because it also provides many example uses of the API. Bug fixes: Locale API updated. Fixed several broken RPC methods. Visit the ASE project page to download the latest APK.
Read more