Re: [Hecl-devel] Hecl on the T-Mobile G1 Google Android phone
Brought to you by:
davidw
From: David W. <dav...@gm...> - 2008-12-29 16:01:32
|
I'll have to look up a few things I haven't fiddled with in a while, but the new sensor stuff definitely works. I used the simulator I posted yesterday, and added this to Hecl.java, in onCreate, and it seems to report sensor changes just fine: try { interp.eval(new Thing("java android.hardware.SensorManager sensman")); interp.eval(new Thing("java org.openintents.hardware.SensorManagerSimulator smsim")); interp.eval(new Thing("set sm [[activity] -field mSensorManager]")); The above two lines are tweaks that I also added because they're necessary to get the sensor simulator working. interp.eval(new Thing("proc Sensor {args} { androidlog \"SENSOR: $args\" }")); interp.eval(new Thing("$sm registerlistener [callback -new [list [list Sensor]]] 2")); } catch (Exception e) { logStacktrace(e); errmsg("Hecl Error: " + e.toString()); } I get lots of output like this: V/hecl log( 382): SENSOR: 2 3.296164035797119 8.55926513671875 0.760979413986206 V/hecl log( 382): SENSOR: 2 -3.0134410858154297 9.305353164672852 -0.6957076787948608 V/hecl log( 382): SENSOR: 2 -3.11090350151062 9.272369384765625 -0.7182086706161499 So I'll have to try and remember what's going on - it may be a blocking issue where the server mode stops events or something of that ilk. The basic functionality is there, though, if you want to fiddle with the script.hcl file and rebuild the .apk. The important bits are to 1) register the SensorManager with the java command, 2) register a callback, and 3) create a command to handle it. -- David N. Welton http://www.welton.it/davidw/ http://www.dedasys.com/ |