java - Android - streaming sensor data continuously? -


i have following code giving me sensor data:

private void computeorientation() {         if (sensormanager.getrotationmatrix(m_rotationmatrix, null, m_lastaccels, m_lastmagfields)) {             sensormanager.getorientation(m_rotationmatrix, m_orientation);              /* 1 radian = 57.2957795 degrees */             /*              * [0] : yaw, rotation around z axis [1] : pitch, rotation around x              * axis [2] : roll, rotation around y axis              */             float yaw = m_orientation[0] * 57.2957795f;             float pitch = m_orientation[1] * 57.2957795f;             float roll = m_orientation[2] * 57.2957795f;              /* append returns average of last 10 values */             m_lastyaw = m_filters[0].append(yaw);             m_lastpitch = m_filters[1].append(pitch);             m_lastroll = m_filters[2].append(roll);              yawtext.settext("azi z: " + m_lastyaw);             pitchtext.settext("pitch x: " + m_lastpitch);             rolltext.settext("roll y: " + m_lastroll);                      //now want send 3 values on network                     //whenever they're calculated } 

this function invoked every few milliseconds reckon, onsensorchanged(sensorevent event).

i want continually send/stream data on internet network remote device, using data stream calculate things in real time.

how should this? through sockets? asynctask? example source code getting started appreciated =)

this job service calculate data in background. because no ui necessary can use thread insteed of asynctask sensor data.

there more detail needed in general, setup of connection between phone , remote device. if use lan, sockets in combination bytearrayriter on phone , bytearrayreader on device should job.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -