Thank you Bil When there is no easy one command solution I would try working with some binary shift and convert to seconds
Bye bill lam <bbill....@gmail.com> schrieb am Mi., 22. Aug. 2018, 14:35: > can't cast to 64-bit int, j32 doesn't support 64-bit int. > > may or may not make any difference, but you may try run in async mode > wd'setj asyncj 1' > then reset android to take effect. > verify setting using > wd'getj asyncj' > > > On Wed, Aug 22, 2018, 7:23 PM Strale <str...@gmail.com> wrote: > > > Hello > > > > I have made the following minimal code to read Android sensors > > it looks to work even if sensor data are sometime wrong and > > ALooper_pollAll seems to go in timeout > > > > I have a problem with the sensor time > > in android sensor.h it is defined as a 64bit, Nanoseconds from a ("date") > > I read this value with J as two 32bit integers > > eTimeN =: memr event,16,1,4 > > eTimeS =: memr event,20,1,4 > > > > is it possible to read it as a 64bit ? or can I cast the two 32Bit into a > > 64 bit J value ? > > > > Thanks in advance > > Paolo > > > > Code: > > > > require 'dll' > > > > smgr =: 'libandroid.so ASensorManager_getInstance > x ' cd '' > > looper =: 'libandroid.so ALooper_forThread > x i' cd < 0 > > Ident =: 3 > > > > ASENSOR_TYPE_ACCELEROMETER =: 1 > > ASENSOR_TYPE_MAGNETIC_FIELD =: 2 > > ASENSOR_TYPE_GYROSCOPE =: 4 > > ASENSOR_TYPE_LIGHT =: 5 > > ASENSOR_TYPE_PROXIMITY =: 8 > > > > sensorId =: 4 > > > > > > queue =: 'libandroid.so ASensorManager_createEventQueue > x x x i x x ' > cd > > smgr; looper ; Ident;(0);(0) > > sensor=: 'libandroid.so ASensorManager_getDefaultSensor > x x i' cd smgr; > > sensorId > > > > eventRate =: 'libandroid.so ASensor_getMinDelay > i x ' cd < sensor > > er1 =: 'libandroid.so ASensorEventQueue_registerSensor > i x x i i ' cd > > queue ; sensor;eventRate;eventRate > > er3 =: 'libandroid.so ASensorEventQueue_enableSensor > i x x ' cd queue ; > > sensor > > er2 =: 'libandroid.so ASensorEventQueue_setEventRate > i x x i ' cd > queue ; > > sensor; eventRate > > > > event =: mema 104 + 152 > > numEvent =: 1 > > data3ax =: _1 > > getsnsr =: verb define > > for. i. 30 do. > > idntLoop =: 'libandroid.so ALooper_pollAll > i i x x x ' cd 1000;0;0;0 > > evtRead =: 'libandroid.so ASensorEventQueue_getEvents > i x x i ' cd > > queue;event; numEvent > > if. evtRead > 0 do. > > evtVers =: memr event, 0,1,4 > > evtSens =: memr event, 4,1,4 > > evtType =: memr event, 8,1,4 > > eTimeN =: memr event,16,1,4 > > eTimeS =: memr event,20,1,4 > > data3raw =: memr event,24,3,4 NB. sensor values > > data3bin =: 2 ic data3raw > > data3ax =: _1 fc data3bin NB. J floating point > > break. > > end. > > end. > > ) > > > > getsnsr 0 > > > > memf event > > 'libandroid.so ASensorEventQueue_disableSensor > n x x ' cd queue ; senor > > 'libandroid.so ASensorManager_destroyEventQueue > n x x ' cd smgr ; queue > > 'libandroid.so ALooper_release > n x ' cd < looper > > cdf '' > > > > > > -- > > We are made of star dust > > (Carl Sagan) > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm